repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
ericmjl/nxviz
nxviz/polcart.py
https://github.com/ericmjl/nxviz/blob/6ea5823a8030a686f165fbe37d7a04d0f037ecc9/nxviz/polcart.py#L25-L40
def to_polar(x, y, theta_units="radians"): """ Converts cartesian x, y to polar r, theta. """ assert theta_units in [ "radians", "degrees", ], "kwarg theta_units must specified in radians or degrees" theta = atan2(y, x) r = sqrt(x ** 2 + y ** 2) if theta_units == "degre...
[ "def", "to_polar", "(", "x", ",", "y", ",", "theta_units", "=", "\"radians\"", ")", ":", "assert", "theta_units", "in", "[", "\"radians\"", ",", "\"degrees\"", ",", "]", ",", "\"kwarg theta_units must specified in radians or degrees\"", "theta", "=", "atan2", "(",...
Converts cartesian x, y to polar r, theta.
[ "Converts", "cartesian", "x", "y", "to", "polar", "r", "theta", "." ]
python
train
i3visio/osrframework
osrframework/thirdparties/pipl_com/lib/fields.py
https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/fields.py#L762-L767
def from_dict(cls, d): """Extend Field.from_dict and also load the name from the dict.""" relationship = super(cls, cls).from_dict(d) if relationship.name is not None: relationship.name = Name.from_dict(relationship.name) return relationship
[ "def", "from_dict", "(", "cls", ",", "d", ")", ":", "relationship", "=", "super", "(", "cls", ",", "cls", ")", ".", "from_dict", "(", "d", ")", "if", "relationship", ".", "name", "is", "not", "None", ":", "relationship", ".", "name", "=", "Name", "...
Extend Field.from_dict and also load the name from the dict.
[ "Extend", "Field", ".", "from_dict", "and", "also", "load", "the", "name", "from", "the", "dict", "." ]
python
train
EliotBerriot/lifter
lifter/backends/base.py
https://github.com/EliotBerriot/lifter/blob/9b4394b476cddd952b2af9540affc03f2977163d/lifter/backends/base.py#L20-L31
def setup_fields(attrs): """ Collect all fields declared on the class and remove them from attrs """ fields = {} iterator = list(attrs.items()) for key, value in iterator: if not isinstance(value, Field): continue fields[key] = value del attrs[key] return ...
[ "def", "setup_fields", "(", "attrs", ")", ":", "fields", "=", "{", "}", "iterator", "=", "list", "(", "attrs", ".", "items", "(", ")", ")", "for", "key", ",", "value", "in", "iterator", ":", "if", "not", "isinstance", "(", "value", ",", "Field", ")...
Collect all fields declared on the class and remove them from attrs
[ "Collect", "all", "fields", "declared", "on", "the", "class", "and", "remove", "them", "from", "attrs" ]
python
train
stephantul/reach
reach/reach.py
https://github.com/stephantul/reach/blob/e5ed0cc895d17429e797c6d7dd57bce82ff00d5d/reach/reach.py#L358-L409
def threshold(self, items, threshold=.5, batch_size=100, show_progressbar=False, return_names=True): """ Return all items whose similarity is higher than threshold. Parameters ---------- it...
[ "def", "threshold", "(", "self", ",", "items", ",", "threshold", "=", ".5", ",", "batch_size", "=", "100", ",", "show_progressbar", "=", "False", ",", "return_names", "=", "True", ")", ":", "# This line allows users to input single items.", "# We used to rely on str...
Return all items whose similarity is higher than threshold. Parameters ---------- items : list of objects or a single object. The items to get the most similar items to. threshold : float, optional, default .5 The radius within which to retrieve items. ba...
[ "Return", "all", "items", "whose", "similarity", "is", "higher", "than", "threshold", "." ]
python
train
tylertreat/BigQuery-Python
bigquery/client.py
https://github.com/tylertreat/BigQuery-Python/blob/88d99de42d954d49fc281460068f0e95003da098/bigquery/client.py#L554-L572
def check_table(self, dataset, table, project_id=None): """Check to see if a table exists. Parameters ---------- dataset : str The dataset to check table : str The name of the table project_id: str, optional The project the table is in...
[ "def", "check_table", "(", "self", ",", "dataset", ",", "table", ",", "project_id", "=", "None", ")", ":", "table", "=", "self", ".", "get_table", "(", "dataset", ",", "table", ",", "project_id", ")", "return", "bool", "(", "table", ")" ]
Check to see if a table exists. Parameters ---------- dataset : str The dataset to check table : str The name of the table project_id: str, optional The project the table is in Returns ------- bool True if ...
[ "Check", "to", "see", "if", "a", "table", "exists", "." ]
python
train
PMBio/limix-backup
limix/deprecated/utils/plot.py
https://github.com/PMBio/limix-backup/blob/1e201fdb5c694d0d5506f207f3de65d8ef66146c/limix/deprecated/utils/plot.py#L27-L111
def plot_manhattan(posCum,pv,chromBounds=None, thr=None,qv=None,lim=None,xticklabels=True, alphaNS=0.1,alphaS=0.5,colorNS='DarkBlue',colorS='Orange',plt=None,thr_plotting=None,labelS=None,labelNS=None): """ This script makes a manhattan plot ------------------------------------------- posCum cumulative ...
[ "def", "plot_manhattan", "(", "posCum", ",", "pv", ",", "chromBounds", "=", "None", ",", "thr", "=", "None", ",", "qv", "=", "None", ",", "lim", "=", "None", ",", "xticklabels", "=", "True", ",", "alphaNS", "=", "0.1", ",", "alphaS", "=", "0.5", ",...
This script makes a manhattan plot ------------------------------------------- posCum cumulative position pv pvalues chromBounds chrom boundaries (optionally). If not supplied, everything will be plotted into a single chromosome qv qvalues if provided, threshold for significance is set on qvalues but...
[ "This", "script", "makes", "a", "manhattan", "plot", "-------------------------------------------", "posCum", "cumulative", "position", "pv", "pvalues", "chromBounds", "chrom", "boundaries", "(", "optionally", ")", ".", "If", "not", "supplied", "everything", "will", "...
python
train
saltstack/salt
salt/pillar/cmd_json.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/cmd_json.py#L20-L31
def ext_pillar(minion_id, # pylint: disable=W0613 pillar, # pylint: disable=W0613 command): ''' Execute a command and read the output as JSON ''' try: command = command.replace('%s', minion_id) return salt.utils.json.loads(__salt__['cmd.run'](command)) ...
[ "def", "ext_pillar", "(", "minion_id", ",", "# pylint: disable=W0613", "pillar", ",", "# pylint: disable=W0613", "command", ")", ":", "try", ":", "command", "=", "command", ".", "replace", "(", "'%s'", ",", "minion_id", ")", "return", "salt", ".", "utils", "."...
Execute a command and read the output as JSON
[ "Execute", "a", "command", "and", "read", "the", "output", "as", "JSON" ]
python
train
nugget/python-insteonplm
insteonplm/tools.py
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L334-L338
def kpl_on(self, address, group): """Get the status of a KPL button.""" addr = Address(address) device = self.plm.devices[addr.id] device.states[group].on()
[ "def", "kpl_on", "(", "self", ",", "address", ",", "group", ")", ":", "addr", "=", "Address", "(", "address", ")", "device", "=", "self", ".", "plm", ".", "devices", "[", "addr", ".", "id", "]", "device", ".", "states", "[", "group", "]", ".", "o...
Get the status of a KPL button.
[ "Get", "the", "status", "of", "a", "KPL", "button", "." ]
python
train
secdev/scapy
scapy/contrib/macsec.py
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/macsec.py#L180-L207
def decrypt(self, orig_pkt, assoclen=None): """decrypt a MACsec frame for this Secure Association""" hdr = copy.deepcopy(orig_pkt) del hdr[MACsec].payload pktlen = len(orig_pkt) if self.send_sci: hdrlen = NOSCI_LEN + SCI_LEN else: hdrlen = NOSCI_LE...
[ "def", "decrypt", "(", "self", ",", "orig_pkt", ",", "assoclen", "=", "None", ")", ":", "hdr", "=", "copy", ".", "deepcopy", "(", "orig_pkt", ")", "del", "hdr", "[", "MACsec", "]", ".", "payload", "pktlen", "=", "len", "(", "orig_pkt", ")", "if", "...
decrypt a MACsec frame for this Secure Association
[ "decrypt", "a", "MACsec", "frame", "for", "this", "Secure", "Association" ]
python
train
saltstack/salt
salt/modules/napalm_mod.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L555-L578
def netmiko_multi_call(*methods, **kwargs): ''' .. versionadded:: 2019.2.0 Execute a list of arbitrary Netmiko methods, passing the authentication details from the existing NAPALM connection. methods List of dictionaries with the following keys: - ``name``: the name of the Netmiko...
[ "def", "netmiko_multi_call", "(", "*", "methods", ",", "*", "*", "kwargs", ")", ":", "netmiko_kwargs", "=", "netmiko_args", "(", ")", "kwargs", ".", "update", "(", "netmiko_kwargs", ")", "return", "__salt__", "[", "'netmiko.multi_call'", "]", "(", "*", "meth...
.. versionadded:: 2019.2.0 Execute a list of arbitrary Netmiko methods, passing the authentication details from the existing NAPALM connection. methods List of dictionaries with the following keys: - ``name``: the name of the Netmiko function to invoke. - ``args``: list of argumen...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
python
train
drhagen/parsita
parsita/util.py
https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/util.py#L47-L69
def unsplat(f: Callable[[Iterable], A]) -> Callable[..., A]: """Convert a function taking a single iterable argument into a function taking multiple arguments. Args: f: Any function taking a single iterable argument Returns: A function that accepts multiple arguments. Each argument of this...
[ "def", "unsplat", "(", "f", ":", "Callable", "[", "[", "Iterable", "]", ",", "A", "]", ")", "->", "Callable", "[", "...", ",", "A", "]", ":", "def", "unsplatted", "(", "*", "args", ")", ":", "return", "f", "(", "args", ")", "return", "unsplatted"...
Convert a function taking a single iterable argument into a function taking multiple arguments. Args: f: Any function taking a single iterable argument Returns: A function that accepts multiple arguments. Each argument of this function is passed as an element of an iterable to ``f``. ...
[ "Convert", "a", "function", "taking", "a", "single", "iterable", "argument", "into", "a", "function", "taking", "multiple", "arguments", "." ]
python
test
RazerM/bucketcache
shovel/version.py
https://github.com/RazerM/bucketcache/blob/8d9b163b73da8c498793cce2f22f6a7cbe524d94/shovel/version.py#L75-L82
def tag(): """Tag current version.""" if check_unstaged(): raise EnvironmentError('There are staged changes, abort.') with open(str(INIT_PATH)) as f: metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", f.read())) version = metadata['version'] check_output(['git', 'tag', version, '...
[ "def", "tag", "(", ")", ":", "if", "check_unstaged", "(", ")", ":", "raise", "EnvironmentError", "(", "'There are staged changes, abort.'", ")", "with", "open", "(", "str", "(", "INIT_PATH", ")", ")", "as", "f", ":", "metadata", "=", "dict", "(", "re", "...
Tag current version.
[ "Tag", "current", "version", "." ]
python
train
Karaage-Cluster/karaage
karaage/datastores/__init__.py
https://github.com/Karaage-Cluster/karaage/blob/2f4c8b4e2d728b3fcbb151160c49000f1c04f5c9/karaage/datastores/__init__.py#L265-L271
def add_accounts_to_group(accounts_query, group): """ Add accounts to group. """ query = accounts_query.filter(date_deleted__isnull=True) for account in query: add_account_to_group(account, group)
[ "def", "add_accounts_to_group", "(", "accounts_query", ",", "group", ")", ":", "query", "=", "accounts_query", ".", "filter", "(", "date_deleted__isnull", "=", "True", ")", "for", "account", "in", "query", ":", "add_account_to_group", "(", "account", ",", "group...
Add accounts to group.
[ "Add", "accounts", "to", "group", "." ]
python
train
hotzenklotz/pybeerxml
pybeerxml/hop.py
https://github.com/hotzenklotz/pybeerxml/blob/e9cf8d6090b1e01e5bbb101e255792b134affbe0/pybeerxml/hop.py#L18-L32
def bitterness(self, ibu_method, early_og, batch_size): "Calculate bitterness based on chosen method" if ibu_method == "tinseth": bitterness = 1.65 * math.pow(0.000125, early_og - 1.0) * ((1 - math.pow(math.e, -0.04 * self.time)) / 4.15) * ((self.alpha / 100.0 * self.amount * 1000000) / bat...
[ "def", "bitterness", "(", "self", ",", "ibu_method", ",", "early_og", ",", "batch_size", ")", ":", "if", "ibu_method", "==", "\"tinseth\"", ":", "bitterness", "=", "1.65", "*", "math", ".", "pow", "(", "0.000125", ",", "early_og", "-", "1.0", ")", "*", ...
Calculate bitterness based on chosen method
[ "Calculate", "bitterness", "based", "on", "chosen", "method" ]
python
train
jaraco/keyring
keyring/backend.py
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/backend.py#L120-L136
def get_credential(self, service, username): """Gets the username and password for the service. Returns a Credential instance. The *username* argument is optional and may be omitted by the caller or ignored by the backend. Callers must use the returned username. """ ...
[ "def", "get_credential", "(", "self", ",", "service", ",", "username", ")", ":", "# The default implementation requires a username here.", "if", "username", "is", "not", "None", ":", "password", "=", "self", ".", "get_password", "(", "service", ",", "username", ")...
Gets the username and password for the service. Returns a Credential instance. The *username* argument is optional and may be omitted by the caller or ignored by the backend. Callers must use the returned username.
[ "Gets", "the", "username", "and", "password", "for", "the", "service", ".", "Returns", "a", "Credential", "instance", "." ]
python
valid
fhs/pyhdf
pyhdf/V.py
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/V.py#L822-L849
def delete(self, num_name): """Delete from the HDF file the vgroup identified by its reference number or its name. Args:: num_name either the reference number or the name of the vgroup to delete Returns:: None C library equivalent...
[ "def", "delete", "(", "self", ",", "num_name", ")", ":", "try", ":", "vg", "=", "self", ".", "attach", "(", "num_name", ",", "1", ")", "except", "HDF4Error", "as", "msg", ":", "raise", "HDF4Error", "(", "\"delete: no such vgroup\"", ")", "# ATTENTION: The ...
Delete from the HDF file the vgroup identified by its reference number or its name. Args:: num_name either the reference number or the name of the vgroup to delete Returns:: None C library equivalent : Vdelete
[ "Delete", "from", "the", "HDF", "file", "the", "vgroup", "identified", "by", "its", "reference", "number", "or", "its", "name", "." ]
python
train
galaxy-genome-annotation/python-apollo
arrow/commands/annotations/update_dbxref.py
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/arrow/commands/annotations/update_dbxref.py#L25-L32
def cli(ctx, feature_id, old_db, old_accession, new_db, new_accession, organism="", sequence=""): """Delete a dbxref from a feature Output: A standard apollo feature dictionary ({"features": [{...}]}) """ return ctx.gi.annotations.update_dbxref(feature_id, old_db, old_accession, new_db, new_accession,...
[ "def", "cli", "(", "ctx", ",", "feature_id", ",", "old_db", ",", "old_accession", ",", "new_db", ",", "new_accession", ",", "organism", "=", "\"\"", ",", "sequence", "=", "\"\"", ")", ":", "return", "ctx", ".", "gi", ".", "annotations", ".", "update_dbxr...
Delete a dbxref from a feature Output: A standard apollo feature dictionary ({"features": [{...}]})
[ "Delete", "a", "dbxref", "from", "a", "feature" ]
python
train
joshspeagle/dynesty
priors.py
https://github.com/joshspeagle/dynesty/blob/9e482aafeb5cf84bedb896fa6f07a761d917983e/priors.py#L70-L77
def update(self, **kwargs): """Update `params` values using alias. """ for k in self.prior_params: try: self.params[k] = kwargs[self.alias[k]] except(KeyError): pass
[ "def", "update", "(", "self", ",", "*", "*", "kwargs", ")", ":", "for", "k", "in", "self", ".", "prior_params", ":", "try", ":", "self", ".", "params", "[", "k", "]", "=", "kwargs", "[", "self", ".", "alias", "[", "k", "]", "]", "except", "(", ...
Update `params` values using alias.
[ "Update", "params", "values", "using", "alias", "." ]
python
train
twisted/axiom
axiom/scheduler.py
https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/scheduler.py#L351-L357
def migrateUp(self): """ Recreate the hooks in the site store to trigger this SubScheduler. """ te = self.store.findFirst(TimedEvent, sort=TimedEvent.time.descending) if te is not None: self._transientSchedule(te.time, None)
[ "def", "migrateUp", "(", "self", ")", ":", "te", "=", "self", ".", "store", ".", "findFirst", "(", "TimedEvent", ",", "sort", "=", "TimedEvent", ".", "time", ".", "descending", ")", "if", "te", "is", "not", "None", ":", "self", ".", "_transientSchedule...
Recreate the hooks in the site store to trigger this SubScheduler.
[ "Recreate", "the", "hooks", "in", "the", "site", "store", "to", "trigger", "this", "SubScheduler", "." ]
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/core/ultratb.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/ultratb.py#L218-L235
def fix_frame_records_filenames(records): """Try to fix the filenames in each record from inspect.getinnerframes(). Particularly, modules loaded from within zip files have useless filenames attached to their code object, and inspect.getinnerframes() just uses it. """ fixed_records = [] for fram...
[ "def", "fix_frame_records_filenames", "(", "records", ")", ":", "fixed_records", "=", "[", "]", "for", "frame", ",", "filename", ",", "line_no", ",", "func_name", ",", "lines", ",", "index", "in", "records", ":", "# Look inside the frame's globals dictionary for __f...
Try to fix the filenames in each record from inspect.getinnerframes(). Particularly, modules loaded from within zip files have useless filenames attached to their code object, and inspect.getinnerframes() just uses it.
[ "Try", "to", "fix", "the", "filenames", "in", "each", "record", "from", "inspect", ".", "getinnerframes", "()", "." ]
python
test
helixyte/everest
everest/repositories/state.py
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/repositories/state.py#L58-L73
def manage(cls, entity, unit_of_work): """ Manages the given entity under the given Unit Of Work. If `entity` is already managed by the given Unit Of Work, nothing is done. :raises ValueError: If the given entity is already under management by a different Unit Of Work...
[ "def", "manage", "(", "cls", ",", "entity", ",", "unit_of_work", ")", ":", "if", "hasattr", "(", "entity", ",", "'__everest__'", ")", ":", "if", "not", "unit_of_work", "is", "entity", ".", "__everest__", ".", "unit_of_work", ":", "raise", "ValueError", "("...
Manages the given entity under the given Unit Of Work. If `entity` is already managed by the given Unit Of Work, nothing is done. :raises ValueError: If the given entity is already under management by a different Unit Of Work.
[ "Manages", "the", "given", "entity", "under", "the", "given", "Unit", "Of", "Work", "." ]
python
train
nutechsoftware/alarmdecoder
examples/socket_example.py
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/examples/socket_example.py#L9-L25
def main(): """ Example application that opens a device that has been exposed to the network with ser2sock or similar serial-to-IP software. """ try: # Retrieve an AD2 device that has been exposed with ser2sock on localhost:10000. device = AlarmDecoder(SocketDevice(interface=(HOSTNAM...
[ "def", "main", "(", ")", ":", "try", ":", "# Retrieve an AD2 device that has been exposed with ser2sock on localhost:10000.", "device", "=", "AlarmDecoder", "(", "SocketDevice", "(", "interface", "=", "(", "HOSTNAME", ",", "PORT", ")", ")", ")", "# Set up an event handl...
Example application that opens a device that has been exposed to the network with ser2sock or similar serial-to-IP software.
[ "Example", "application", "that", "opens", "a", "device", "that", "has", "been", "exposed", "to", "the", "network", "with", "ser2sock", "or", "similar", "serial", "-", "to", "-", "IP", "software", "." ]
python
train
angr/angr
angr/keyed_region.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/keyed_region.py#L340-L402
def __store(self, stored_object, overwrite=False): """ Store a variable into the storage. :param StoredObject stored_object: The descriptor describing start address and the variable. :param bool overwrite: Whether existing objects should be overwritten or not. True to make a strong upd...
[ "def", "__store", "(", "self", ",", "stored_object", ",", "overwrite", "=", "False", ")", ":", "start", "=", "stored_object", ".", "start", "object_size", "=", "stored_object", ".", "size", "end", "=", "start", "+", "object_size", "# region items in the middle",...
Store a variable into the storage. :param StoredObject stored_object: The descriptor describing start address and the variable. :param bool overwrite: Whether existing objects should be overwritten or not. True to make a strong update, False to make a weak update. ...
[ "Store", "a", "variable", "into", "the", "storage", "." ]
python
train
Parsl/parsl
parsl/dataflow/dflow.py
https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/dataflow/dflow.py#L792-L857
def cleanup(self): """DataFlowKernel cleanup. This involves killing resources explicitly and sending die messages to IPP workers. If the executors are managed (created by the DFK), then we call scale_in on each of the executors and call executor.shutdown. Otherwise, we do nothing, and ...
[ "def", "cleanup", "(", "self", ")", ":", "logger", ".", "info", "(", "\"DFK cleanup initiated\"", ")", "# this check won't detect two DFK cleanups happening from", "# different threads extremely close in time because of", "# non-atomic read/modify of self.cleanup_called", "if", "self...
DataFlowKernel cleanup. This involves killing resources explicitly and sending die messages to IPP workers. If the executors are managed (created by the DFK), then we call scale_in on each of the executors and call executor.shutdown. Otherwise, we do nothing, and executor cleanup is le...
[ "DataFlowKernel", "cleanup", "." ]
python
valid
carpedm20/ndrive
ndrive/models.py
https://github.com/carpedm20/ndrive/blob/ac58eaf8a8d46292ad752bb38047f65838b8ad2b/ndrive/models.py#L687-L712
def getMusicAlbumList(self, tagtype = 0, startnum = 0, pagingrow = 100): """GetMusicAlbumList Args: tagtype = ??? startnum pagingrow Returns: ??? False: Failed to get property """ url = nurls['setProperty'] ...
[ "def", "getMusicAlbumList", "(", "self", ",", "tagtype", "=", "0", ",", "startnum", "=", "0", ",", "pagingrow", "=", "100", ")", ":", "url", "=", "nurls", "[", "'setProperty'", "]", "data", "=", "{", "'userid'", ":", "self", ".", "user_id", ",", "'us...
GetMusicAlbumList Args: tagtype = ??? startnum pagingrow Returns: ??? False: Failed to get property
[ "GetMusicAlbumList" ]
python
train
dpkp/kafka-python
kafka/consumer/simple.py
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/consumer/simple.py#L188-L258
def seek(self, offset, whence=None, partition=None): """ Alter the current offset in the consumer, similar to fseek Arguments: offset: how much to modify the offset whence: where to modify it from, default is None * None is an absolute offset ...
[ "def", "seek", "(", "self", ",", "offset", ",", "whence", "=", "None", ",", "partition", "=", "None", ")", ":", "if", "whence", "is", "None", ":", "# set an absolute offset", "if", "partition", "is", "None", ":", "for", "tmp_partition", "in", "self", "."...
Alter the current offset in the consumer, similar to fseek Arguments: offset: how much to modify the offset whence: where to modify it from, default is None * None is an absolute offset * 0 is relative to the earliest available offset (head) ...
[ "Alter", "the", "current", "offset", "in", "the", "consumer", "similar", "to", "fseek" ]
python
train
SmokinCaterpillar/pypet
pypet/storageservice.py
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L4909-L4933
def _prm_read_pandas(self, pd_node, full_name): """Reads a DataFrame from dis. :param pd_node: hdf5 node storing the pandas DataFrame :param full_name: Full name of the parameter or result whose data is to be loaded :return: Data to load ...
[ "def", "_prm_read_pandas", "(", "self", ",", "pd_node", ",", "full_name", ")", ":", "try", ":", "name", "=", "pd_node", ".", "_v_name", "pathname", "=", "pd_node", ".", "_v_pathname", "pandas_store", "=", "self", ".", "_hdf5store", "pandas_data", "=", "panda...
Reads a DataFrame from dis. :param pd_node: hdf5 node storing the pandas DataFrame :param full_name: Full name of the parameter or result whose data is to be loaded :return: Data to load
[ "Reads", "a", "DataFrame", "from", "dis", "." ]
python
test
pydata/numexpr
numexpr/necompiler.py
https://github.com/pydata/numexpr/blob/364bac13d84524e0e01db892301b2959d822dcff/numexpr/necompiler.py#L450-L471
def setRegisterNumbersForTemporaries(ast, start): """Assign register numbers for temporary registers, keeping track of aliases and handling immediate operands. """ seen = 0 signature = '' aliases = [] for node in ast.postorderWalk(): if node.astType == 'alias': aliases.ap...
[ "def", "setRegisterNumbersForTemporaries", "(", "ast", ",", "start", ")", ":", "seen", "=", "0", "signature", "=", "''", "aliases", "=", "[", "]", "for", "node", "in", "ast", ".", "postorderWalk", "(", ")", ":", "if", "node", ".", "astType", "==", "'al...
Assign register numbers for temporary registers, keeping track of aliases and handling immediate operands.
[ "Assign", "register", "numbers", "for", "temporary", "registers", "keeping", "track", "of", "aliases", "and", "handling", "immediate", "operands", "." ]
python
train
ulule/django-linguist
linguist/mixins.py
https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/mixins.py#L276-L297
def with_translations(self, **kwargs): """ Prefetches translations. Takes three optional keyword arguments: * ``field_names``: ``field_name`` values for SELECT IN * ``languages``: ``language`` values for SELECT IN * ``chunks_length``: fetches IDs by chunk """ ...
[ "def", "with_translations", "(", "self", ",", "*", "*", "kwargs", ")", ":", "force", "=", "kwargs", ".", "pop", "(", "\"force\"", ",", "False", ")", "if", "self", ".", "_prefetch_translations_done", "and", "force", "is", "False", ":", "return", "self", "...
Prefetches translations. Takes three optional keyword arguments: * ``field_names``: ``field_name`` values for SELECT IN * ``languages``: ``language`` values for SELECT IN * ``chunks_length``: fetches IDs by chunk
[ "Prefetches", "translations", "." ]
python
train
ozgur/python-firebase
firebase/firebase.py
https://github.com/ozgur/python-firebase/blob/6b96b326f6d8f477503ca42fdfbd81bcbe1f9e0d/firebase/firebase.py#L331-L342
def post_async(self, url, data, callback=None, params=None, headers=None): """ Asynchronous POST request with the process pool. """ params = params or {} headers = headers or {} endpoint = self._build_endpoint_url(url, None) self._authenticate(params, headers) ...
[ "def", "post_async", "(", "self", ",", "url", ",", "data", ",", "callback", "=", "None", ",", "params", "=", "None", ",", "headers", "=", "None", ")", ":", "params", "=", "params", "or", "{", "}", "headers", "=", "headers", "or", "{", "}", "endpoin...
Asynchronous POST request with the process pool.
[ "Asynchronous", "POST", "request", "with", "the", "process", "pool", "." ]
python
valid
novopl/peltak
src/peltak/core/context.py
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/context.py#L92-L113
def set(self, name, value): """ Set context value. Args: name (str): The name of the context value to change. value (Any): The new value for the selected context value """ curr = self.values parts = name.split('.') ...
[ "def", "set", "(", "self", ",", "name", ",", "value", ")", ":", "curr", "=", "self", ".", "values", "parts", "=", "name", ".", "split", "(", "'.'", ")", "for", "i", ",", "part", "in", "enumerate", "(", "parts", "[", ":", "-", "1", "]", ")", "...
Set context value. Args: name (str): The name of the context value to change. value (Any): The new value for the selected context value
[ "Set", "context", "value", "." ]
python
train
log2timeline/plaso
plaso/cli/helpers/xlsx_output.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/cli/helpers/xlsx_output.py#L26-L50
def AddArguments(cls, argument_group): """Adds command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments this helper supports. Args: argument_group (argparse._ArgumentGroup|arg...
[ "def", "AddArguments", "(", "cls", ",", "argument_group", ")", ":", "argument_group", ".", "add_argument", "(", "'--fields'", ",", "dest", "=", "'fields'", ",", "type", "=", "str", ",", "action", "=", "'store'", ",", "default", "=", "cls", ".", "_DEFAULT_F...
Adds command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments this helper supports. Args: argument_group (argparse._ArgumentGroup|argparse.ArgumentParser): argparse grou...
[ "Adds", "command", "line", "arguments", "the", "helper", "supports", "to", "an", "argument", "group", "." ]
python
train
learningequality/ricecooker
ricecooker/classes/questions.py
https://github.com/learningequality/ricecooker/blob/2f0385282500cb77ef2894646c6f9ce11bd7a853/ricecooker/classes/questions.py#L442-L460
def validate(self): """ validate: Makes sure single selection question is valid Args: None Returns: boolean indicating if single selection question is valid """ try: assert self.question_type == exercises.SINGLE_SELECTION, "Assumption Failed: Question should b...
[ "def", "validate", "(", "self", ")", ":", "try", ":", "assert", "self", ".", "question_type", "==", "exercises", ".", "SINGLE_SELECTION", ",", "\"Assumption Failed: Question should be single selection type\"", "assert", "len", "(", "self", ".", "answers", ")", ">", ...
validate: Makes sure single selection question is valid Args: None Returns: boolean indicating if single selection question is valid
[ "validate", ":", "Makes", "sure", "single", "selection", "question", "is", "valid", "Args", ":", "None", "Returns", ":", "boolean", "indicating", "if", "single", "selection", "question", "is", "valid" ]
python
train
MeaningCloud/meaningcloud-python
meaningcloud/SentimentResponse.py
https://github.com/MeaningCloud/meaningcloud-python/blob/1dd76ecabeedd80c9bb14a1716d39657d645775f/meaningcloud/SentimentResponse.py#L177-L197
def scoreTagToString(self, scoreTag): """ :param scoreTag: :return: """ scoreTagToString = "" if scoreTag == "P+": scoreTagToString = 'strong positive' elif scoreTag == "P": scoreTagToString = 'positive' elif scoreTag == "NEU": ...
[ "def", "scoreTagToString", "(", "self", ",", "scoreTag", ")", ":", "scoreTagToString", "=", "\"\"", "if", "scoreTag", "==", "\"P+\"", ":", "scoreTagToString", "=", "'strong positive'", "elif", "scoreTag", "==", "\"P\"", ":", "scoreTagToString", "=", "'positive'", ...
:param scoreTag: :return:
[ ":", "param", "scoreTag", ":", ":", "return", ":" ]
python
train
materialsproject/pymatgen
pymatgen/io/abinit/abiobjects.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L1304-L1328
def to_abivars(self): """Returns a dictionary with the abinit variables.""" abivars = dict( gwcalctyp=self.gwcalctyp, ecuteps=self.ecuteps, ecutsigx=self.ecutsigx, symsigma=self.symsigma, gw_qprange=self.gw_qprange, gwpara=self.gwpa...
[ "def", "to_abivars", "(", "self", ")", ":", "abivars", "=", "dict", "(", "gwcalctyp", "=", "self", ".", "gwcalctyp", ",", "ecuteps", "=", "self", ".", "ecuteps", ",", "ecutsigx", "=", "self", ".", "ecutsigx", ",", "symsigma", "=", "self", ".", "symsigm...
Returns a dictionary with the abinit variables.
[ "Returns", "a", "dictionary", "with", "the", "abinit", "variables", "." ]
python
train
collectiveacuity/labPack
labpack/storage/google/drive.py
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/storage/google/drive.py#L273-L291
def _get_space(self): ''' a helper method to retrieve id of drive space ''' title = '%s._space_id' % self.__class__.__name__ list_kwargs = { 'q': "'%s' in parents" % self.drive_space, 'spaces': self.drive_space, 'fields': 'files(name, parents...
[ "def", "_get_space", "(", "self", ")", ":", "title", "=", "'%s._space_id'", "%", "self", ".", "__class__", ".", "__name__", "list_kwargs", "=", "{", "'q'", ":", "\"'%s' in parents\"", "%", "self", ".", "drive_space", ",", "'spaces'", ":", "self", ".", "dri...
a helper method to retrieve id of drive space
[ "a", "helper", "method", "to", "retrieve", "id", "of", "drive", "space" ]
python
train
alexa/alexa-skills-kit-sdk-for-python
ask-sdk-core/ask_sdk_core/utils/request_util.py
https://github.com/alexa/alexa-skills-kit-sdk-for-python/blob/097b6406aa12d5ca0b825b00c936861b530cbf39/ask-sdk-core/ask_sdk_core/utils/request_util.py#L65-L85
def get_intent_name(handler_input): # type: (HandlerInput) -> AnyStr """Return the name of the intent request. The method retrieves the intent ``name`` from the input request, only if the input request is an :py:class:`ask_sdk_model.intent_request.IntentRequest`. If the input is not an IntentRe...
[ "def", "get_intent_name", "(", "handler_input", ")", ":", "# type: (HandlerInput) -> AnyStr", "request", "=", "handler_input", ".", "request_envelope", ".", "request", "if", "isinstance", "(", "request", ",", "IntentRequest", ")", ":", "return", "request", ".", "int...
Return the name of the intent request. The method retrieves the intent ``name`` from the input request, only if the input request is an :py:class:`ask_sdk_model.intent_request.IntentRequest`. If the input is not an IntentRequest, a :py:class:`TypeError` is raised. :param handler_input: The handler...
[ "Return", "the", "name", "of", "the", "intent", "request", "." ]
python
train
QUANTAXIS/QUANTAXIS
QUANTAXIS/QAUtil/QADateTools.py
https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAUtil/QADateTools.py#L47-L64
def QA_util_getBetweenQuarter(begin_date, end_date): """ #加上每季度的起始日期、结束日期 """ quarter_list = {} month_list = QA_util_getBetweenMonth(begin_date, end_date) for value in month_list: tempvalue = value.split("-") year = tempvalue[0] if tempvalue[1] in ['01', '02', '03']: ...
[ "def", "QA_util_getBetweenQuarter", "(", "begin_date", ",", "end_date", ")", ":", "quarter_list", "=", "{", "}", "month_list", "=", "QA_util_getBetweenMonth", "(", "begin_date", ",", "end_date", ")", "for", "value", "in", "month_list", ":", "tempvalue", "=", "va...
#加上每季度的起始日期、结束日期
[ "#加上每季度的起始日期、结束日期" ]
python
train
rosenbrockc/fortpy
fortpy/config.py
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/config.py#L173-L186
def _load_mapping(self, tag, ssh=False): """Extracts all the alternate module name mappings to be considered. :arg tag: the ET tag for the <mappings> element.""" mappings = {} for mapping in tag: if mapping.tag == "map": mappings[mapping.attrib["modu...
[ "def", "_load_mapping", "(", "self", ",", "tag", ",", "ssh", "=", "False", ")", ":", "mappings", "=", "{", "}", "for", "mapping", "in", "tag", ":", "if", "mapping", ".", "tag", "==", "\"map\"", ":", "mappings", "[", "mapping", ".", "attrib", "[", "...
Extracts all the alternate module name mappings to be considered. :arg tag: the ET tag for the <mappings> element.
[ "Extracts", "all", "the", "alternate", "module", "name", "mappings", "to", "be", "considered", "." ]
python
train
hobson/aima
aima/search.py
https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/search.py#L571-L574
def conflicted(self, state, row, col): "Would placing a queen at (row, col) conflict with anything?" return any(self.conflict(row, col, state[c], c) for c in range(col))
[ "def", "conflicted", "(", "self", ",", "state", ",", "row", ",", "col", ")", ":", "return", "any", "(", "self", ".", "conflict", "(", "row", ",", "col", ",", "state", "[", "c", "]", ",", "c", ")", "for", "c", "in", "range", "(", "col", ")", "...
Would placing a queen at (row, col) conflict with anything?
[ "Would", "placing", "a", "queen", "at", "(", "row", "col", ")", "conflict", "with", "anything?" ]
python
valid
kiwi0fruit/sugartex
sugartex/sugartex_filter.py
https://github.com/kiwi0fruit/sugartex/blob/9eb13703cb02d3e2163c9c5f29df280f6bf49cec/sugartex/sugartex_filter.py#L216-L227
def spec(self, postf_un_ops: str) -> list: """Return prefix unary operators list""" spec = [(l + op, {'pat': self.pat(pat), 'postf': self.postf(r, postf_un_ops), 'regex': None}) for op, pat in self.styles.items() for l, ...
[ "def", "spec", "(", "self", ",", "postf_un_ops", ":", "str", ")", "->", "list", ":", "spec", "=", "[", "(", "l", "+", "op", ",", "{", "'pat'", ":", "self", ".", "pat", "(", "pat", ")", ",", "'postf'", ":", "self", ".", "postf", "(", "r", ",",...
Return prefix unary operators list
[ "Return", "prefix", "unary", "operators", "list" ]
python
train
joke2k/faker
faker/providers/geo/__init__.py
https://github.com/joke2k/faker/blob/965824b61132e52d92d1a6ce470396dbbe01c96c/faker/providers/geo/__init__.py#L1011-L1017
def location_on_land(self, coords_only=False): """Returns a random tuple specifying a coordinate set guaranteed to exist on land. Format is `(latitude, longitude, place name, two-letter country code, timezone)` Pass `coords_only` to return coordinates without metadata. """ place ...
[ "def", "location_on_land", "(", "self", ",", "coords_only", "=", "False", ")", ":", "place", "=", "self", ".", "random_element", "(", "self", ".", "land_coords", ")", "return", "(", "place", "[", "0", "]", ",", "place", "[", "1", "]", ")", "if", "coo...
Returns a random tuple specifying a coordinate set guaranteed to exist on land. Format is `(latitude, longitude, place name, two-letter country code, timezone)` Pass `coords_only` to return coordinates without metadata.
[ "Returns", "a", "random", "tuple", "specifying", "a", "coordinate", "set", "guaranteed", "to", "exist", "on", "land", ".", "Format", "is", "(", "latitude", "longitude", "place", "name", "two", "-", "letter", "country", "code", "timezone", ")", "Pass", "coord...
python
train
ewels/MultiQC
multiqc/modules/slamdunk/slamdunk.py
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/slamdunk/slamdunk.py#L319-L362
def slamdunkGeneralStatsTable(self): """ Take the parsed summary stats from Slamdunk and add it to the basic stats table at the top of the report """ headers = OrderedDict() headers['counted'] = { 'title': '{} Counted'.format(config.read_count_prefix), 'descript...
[ "def", "slamdunkGeneralStatsTable", "(", "self", ")", ":", "headers", "=", "OrderedDict", "(", ")", "headers", "[", "'counted'", "]", "=", "{", "'title'", ":", "'{} Counted'", ".", "format", "(", "config", ".", "read_count_prefix", ")", ",", "'description'", ...
Take the parsed summary stats from Slamdunk and add it to the basic stats table at the top of the report
[ "Take", "the", "parsed", "summary", "stats", "from", "Slamdunk", "and", "add", "it", "to", "the", "basic", "stats", "table", "at", "the", "top", "of", "the", "report" ]
python
train
sosy-lab/benchexec
benchexec/model.py
https://github.com/sosy-lab/benchexec/blob/44428f67f41384c03aea13e7e25f884764653617/benchexec/model.py#L436-L494
def extract_runs_from_xml(self, sourcefilesTagList, global_required_files_pattern): ''' This function builds a list of SourcefileSets (containing filename with options). The files and their options are taken from the list of sourcefilesTags. ''' base_dir = self.benchmark.base_dir...
[ "def", "extract_runs_from_xml", "(", "self", ",", "sourcefilesTagList", ",", "global_required_files_pattern", ")", ":", "base_dir", "=", "self", ".", "benchmark", ".", "base_dir", "# runs are structured as sourcefile sets, one set represents one sourcefiles tag", "blocks", "=",...
This function builds a list of SourcefileSets (containing filename with options). The files and their options are taken from the list of sourcefilesTags.
[ "This", "function", "builds", "a", "list", "of", "SourcefileSets", "(", "containing", "filename", "with", "options", ")", ".", "The", "files", "and", "their", "options", "are", "taken", "from", "the", "list", "of", "sourcefilesTags", "." ]
python
train
eandersson/amqpstorm
amqpstorm/management/queue.py
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/queue.py#L15-L32
def get(self, queue, virtual_host='/'): """Get Queue details. :param queue: Queue name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :...
[ "def", "get", "(", "self", ",", "queue", ",", "virtual_host", "=", "'/'", ")", ":", "virtual_host", "=", "quote", "(", "virtual_host", ",", "''", ")", "return", "self", ".", "http_client", ".", "get", "(", "API_QUEUE", "%", "(", "virtual_host", ",", "q...
Get Queue details. :param queue: Queue name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: dict
[ "Get", "Queue", "details", "." ]
python
train
jsommers/switchyard
switchyard/lib/address/__init__.py
https://github.com/jsommers/switchyard/blob/fdcb3869c937dcedbd6ea7a7822ebd412bf1e2b0/switchyard/lib/address/__init__.py#L59-L72
def isBridgeFiltered (self): """ Checks if address is an IEEE 802.1D MAC Bridge Filtered MAC Group Address This range is 01-80-C2-00-00-00 to 01-80-C2-00-00-0F. MAC frames that have a destination MAC address within this range are not relayed by bridges conforming to IEEE 802.1D ...
[ "def", "isBridgeFiltered", "(", "self", ")", ":", "return", "(", "(", "self", ".", "__value", "[", "0", "]", "==", "0x01", ")", "and", "(", "self", ".", "__value", "[", "1", "]", "==", "0x80", ")", "and", "(", "self", ".", "__value", "[", "2", ...
Checks if address is an IEEE 802.1D MAC Bridge Filtered MAC Group Address This range is 01-80-C2-00-00-00 to 01-80-C2-00-00-0F. MAC frames that have a destination MAC address within this range are not relayed by bridges conforming to IEEE 802.1D
[ "Checks", "if", "address", "is", "an", "IEEE", "802", ".", "1D", "MAC", "Bridge", "Filtered", "MAC", "Group", "Address" ]
python
train
notanumber/xapian-haystack
xapian_backend.py
https://github.com/notanumber/xapian-haystack/blob/2247b23d3cb6322ce477d45f84d52da47a940348/xapian_backend.py#L1394-L1410
def _filter_contains(self, term, field_name, field_type, is_not): """ Splits the sentence in terms and join them with OR, using stemmed and un-stemmed. Assumes term is not a list. """ if field_type == 'text': term_list = term.split() else: ...
[ "def", "_filter_contains", "(", "self", ",", "term", ",", "field_name", ",", "field_type", ",", "is_not", ")", ":", "if", "field_type", "==", "'text'", ":", "term_list", "=", "term", ".", "split", "(", ")", "else", ":", "term_list", "=", "[", "term", "...
Splits the sentence in terms and join them with OR, using stemmed and un-stemmed. Assumes term is not a list.
[ "Splits", "the", "sentence", "in", "terms", "and", "join", "them", "with", "OR", "using", "stemmed", "and", "un", "-", "stemmed", "." ]
python
train
sosy-lab/benchexec
benchexec/resources.py
https://github.com/sosy-lab/benchexec/blob/44428f67f41384c03aea13e7e25f884764653617/benchexec/resources.py#L213-L241
def get_memory_banks_per_run(coreAssignment, cgroups): """Get an assignment of memory banks to runs that fits to the given coreAssignment, i.e., no run is allowed to use memory that is not local (on the same NUMA node) to one of its CPU cores.""" try: # read list of available memory banks ...
[ "def", "get_memory_banks_per_run", "(", "coreAssignment", ",", "cgroups", ")", ":", "try", ":", "# read list of available memory banks", "allMems", "=", "set", "(", "cgroups", ".", "read_allowed_memory_banks", "(", ")", ")", "result", "=", "[", "]", "for", "cores"...
Get an assignment of memory banks to runs that fits to the given coreAssignment, i.e., no run is allowed to use memory that is not local (on the same NUMA node) to one of its CPU cores.
[ "Get", "an", "assignment", "of", "memory", "banks", "to", "runs", "that", "fits", "to", "the", "given", "coreAssignment", "i", ".", "e", ".", "no", "run", "is", "allowed", "to", "use", "memory", "that", "is", "not", "local", "(", "on", "the", "same", ...
python
train
xen/webcraft
webcraft/apiview.py
https://github.com/xen/webcraft/blob/74ff1e5b253048d9260446bfbc95de2e402a8005/webcraft/apiview.py#L10-L15
def alchemyencoder(obj): """JSON encoder function for SQLAlchemy special classes.""" if isinstance(obj, datetime.date): return obj.isoformat() elif isinstance(obj, decimal.Decimal): return float(obj)
[ "def", "alchemyencoder", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "datetime", ".", "date", ")", ":", "return", "obj", ".", "isoformat", "(", ")", "elif", "isinstance", "(", "obj", ",", "decimal", ".", "Decimal", ")", ":", "return", ...
JSON encoder function for SQLAlchemy special classes.
[ "JSON", "encoder", "function", "for", "SQLAlchemy", "special", "classes", "." ]
python
train
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L658-L664
def run_script(self, requires, script_name): """Locate distribution for `requires` and run `script_name` script""" ns = sys._getframe(1).f_globals name = ns['__name__'] ns.clear() ns['__name__'] = name self.require(requires)[0].run_script(script_name, ns)
[ "def", "run_script", "(", "self", ",", "requires", ",", "script_name", ")", ":", "ns", "=", "sys", ".", "_getframe", "(", "1", ")", ".", "f_globals", "name", "=", "ns", "[", "'__name__'", "]", "ns", ".", "clear", "(", ")", "ns", "[", "'__name__'", ...
Locate distribution for `requires` and run `script_name` script
[ "Locate", "distribution", "for", "requires", "and", "run", "script_name", "script" ]
python
train
Guake/guake
guake/prefs.py
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/prefs.py#L544-L548
def on_window_height_value_changed(self, hscale): """Changes the value of window_height in dconf """ val = hscale.get_value() self.settings.general.set_int('window-height', int(val))
[ "def", "on_window_height_value_changed", "(", "self", ",", "hscale", ")", ":", "val", "=", "hscale", ".", "get_value", "(", ")", "self", ".", "settings", ".", "general", ".", "set_int", "(", "'window-height'", ",", "int", "(", "val", ")", ")" ]
Changes the value of window_height in dconf
[ "Changes", "the", "value", "of", "window_height", "in", "dconf" ]
python
train
ardydedase/pycouchbase
couchbase-python-cffi/couchbase_ffi/executors.py
https://github.com/ardydedase/pycouchbase/blob/6f010b4d2ef41aead2366878d0cf0b1284c0db0e/couchbase-python-cffi/couchbase_ffi/executors.py#L71-L94
def get_option(name, key_options, global_options, default=None): """ Search the key-specific options and the global options for a given setting. Either dictionary may be None. This will first search the key settings and then the global settings. :param name: The setting to search for :param ke...
[ "def", "get_option", "(", "name", ",", "key_options", ",", "global_options", ",", "default", "=", "None", ")", ":", "if", "key_options", ":", "try", ":", "return", "key_options", "[", "name", "]", "except", "KeyError", ":", "pass", "if", "global_options", ...
Search the key-specific options and the global options for a given setting. Either dictionary may be None. This will first search the key settings and then the global settings. :param name: The setting to search for :param key_options: The item specific settings :param global_options: General meth...
[ "Search", "the", "key", "-", "specific", "options", "and", "the", "global", "options", "for", "a", "given", "setting", ".", "Either", "dictionary", "may", "be", "None", "." ]
python
train
hfurubotten/enturclient
enturclient/api.py
https://github.com/hfurubotten/enturclient/blob/8230f9e9cf5b3a4911e860bc8cbe621231aa5ae4/enturclient/api.py#L75-L108
async def expand_all_quays(self) -> None: """Find all quays from stop places.""" if not self.stops: return headers = {'ET-Client-Name': self._client_name} request = { 'query': GRAPHQL_STOP_TO_QUAY_TEMPLATE, 'variables': { 'stops': self...
[ "async", "def", "expand_all_quays", "(", "self", ")", "->", "None", ":", "if", "not", "self", ".", "stops", ":", "return", "headers", "=", "{", "'ET-Client-Name'", ":", "self", ".", "_client_name", "}", "request", "=", "{", "'query'", ":", "GRAPHQL_STOP_TO...
Find all quays from stop places.
[ "Find", "all", "quays", "from", "stop", "places", "." ]
python
train
JukeboxPipeline/jukebox-core
src/jukeboxcore/addons/guerilla/guerillamgmt.py
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/addons/guerilla/guerillamgmt.py#L715-L731
def setup_prjs_page(self, ): """Create and set the model on the projects page :returns: None :rtype: None :raises: None """ self.prjs_tablev.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents) log.debug("Loading projects for projects page.") ...
[ "def", "setup_prjs_page", "(", "self", ",", ")", ":", "self", ".", "prjs_tablev", ".", "horizontalHeader", "(", ")", ".", "setResizeMode", "(", "QtGui", ".", "QHeaderView", ".", "ResizeToContents", ")", "log", ".", "debug", "(", "\"Loading projects for projects ...
Create and set the model on the projects page :returns: None :rtype: None :raises: None
[ "Create", "and", "set", "the", "model", "on", "the", "projects", "page" ]
python
train
bioasp/caspo
travis-ci/upload.py
https://github.com/bioasp/caspo/blob/a68d1eace75b9b08f23633d1fb5ce6134403959e/travis-ci/upload.py#L11-L23
def artifact_already_exists(cli, meta, owner): """ Checks to see whether the built recipe (aka distribution) already exists on the owner/user's binstar account. """ distro_name = '{}/{}.tar.bz2'.format(conda.config.subdir, meta.dist()) try: dist_info = cli.distribution(owner, meta.name(...
[ "def", "artifact_already_exists", "(", "cli", ",", "meta", ",", "owner", ")", ":", "distro_name", "=", "'{}/{}.tar.bz2'", ".", "format", "(", "conda", ".", "config", ".", "subdir", ",", "meta", ".", "dist", "(", ")", ")", "try", ":", "dist_info", "=", ...
Checks to see whether the built recipe (aka distribution) already exists on the owner/user's binstar account.
[ "Checks", "to", "see", "whether", "the", "built", "recipe", "(", "aka", "distribution", ")", "already", "exists", "on", "the", "owner", "/", "user", "s", "binstar", "account", "." ]
python
train
crypto101/merlyn
merlyn/exercise.py
https://github.com/crypto101/merlyn/blob/0f313210b9ea5385cc2e5b725dc766df9dc3284d/merlyn/exercise.py#L115-L124
def solveAndNotify(self, request): """Notifies the owner of the current request (so, the user doing the exercise) that they've solved the exercise, and mark it as solved in the database. """ remote = request.transport.remote withThisIdentifier = Exercise.identifier == se...
[ "def", "solveAndNotify", "(", "self", ",", "request", ")", ":", "remote", "=", "request", ".", "transport", ".", "remote", "withThisIdentifier", "=", "Exercise", ".", "identifier", "==", "self", ".", "exerciseIdentifier", "exercise", "=", "self", ".", "store",...
Notifies the owner of the current request (so, the user doing the exercise) that they've solved the exercise, and mark it as solved in the database.
[ "Notifies", "the", "owner", "of", "the", "current", "request", "(", "so", "the", "user", "doing", "the", "exercise", ")", "that", "they", "ve", "solved", "the", "exercise", "and", "mark", "it", "as", "solved", "in", "the", "database", "." ]
python
train
inveniosoftware/invenio-access
invenio_access/ext.py
https://github.com/inveniosoftware/invenio-access/blob/3b033a4bdc110eb2f7e9f08f0744a780884bfc80/invenio_access/ext.py#L106-L112
def load_entry_point_actions(self, entry_point_group): """Load actions from an entry point group. :param entry_point_group: The entrypoint for extensions. """ for ep in pkg_resources.iter_entry_points(group=entry_point_group): self.register_action(ep.load())
[ "def", "load_entry_point_actions", "(", "self", ",", "entry_point_group", ")", ":", "for", "ep", "in", "pkg_resources", ".", "iter_entry_points", "(", "group", "=", "entry_point_group", ")", ":", "self", ".", "register_action", "(", "ep", ".", "load", "(", ")"...
Load actions from an entry point group. :param entry_point_group: The entrypoint for extensions.
[ "Load", "actions", "from", "an", "entry", "point", "group", "." ]
python
train
trehn/termdown
termdown.py
https://github.com/trehn/termdown/blob/aa0c4e39d9864fd1466ef9d76947fb93d0cf5be2/termdown.py#L70-L95
def draw_text(stdscr, text, color=0, fallback=None, title=None): """ Draws text in the given color. Duh. """ if fallback is None: fallback = text y, x = stdscr.getmaxyx() if title: title = pad_to_size(title, x, 1) if "\n" in title.rstrip("\n"): # hack to get m...
[ "def", "draw_text", "(", "stdscr", ",", "text", ",", "color", "=", "0", ",", "fallback", "=", "None", ",", "title", "=", "None", ")", ":", "if", "fallback", "is", "None", ":", "fallback", "=", "text", "y", ",", "x", "=", "stdscr", ".", "getmaxyx", ...
Draws text in the given color. Duh.
[ "Draws", "text", "in", "the", "given", "color", ".", "Duh", "." ]
python
train
JdeRobot/base
src/drivers/drone/cmdvel.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/drone/cmdvel.py#L230-L241
def sendCMD (self, vel): ''' Sends CMDVel. @param vel: CMDVel to publish @type vel: CMDVel ''' self.lock.acquire() self.vel = vel self.lock.release()
[ "def", "sendCMD", "(", "self", ",", "vel", ")", ":", "self", ".", "lock", ".", "acquire", "(", ")", "self", ".", "vel", "=", "vel", "self", ".", "lock", ".", "release", "(", ")" ]
Sends CMDVel. @param vel: CMDVel to publish @type vel: CMDVel
[ "Sends", "CMDVel", "." ]
python
train
BlueBrain/hpcbench
hpcbench/toolbox/slurm/cluster.py
https://github.com/BlueBrain/hpcbench/blob/192d0ec142b897157ec25f131d1ef28f84752592/hpcbench/toolbox/slurm/cluster.py#L57-L66
def reservations(self): """get nodes of every reservations""" command = [SINFO, '--reservation'] output = subprocess.check_output(command, env=SINFO_ENV) output = output.decode() it = iter(output.splitlines()) next(it) for line in it: rsv = Reservation...
[ "def", "reservations", "(", "self", ")", ":", "command", "=", "[", "SINFO", ",", "'--reservation'", "]", "output", "=", "subprocess", ".", "check_output", "(", "command", ",", "env", "=", "SINFO_ENV", ")", "output", "=", "output", ".", "decode", "(", ")"...
get nodes of every reservations
[ "get", "nodes", "of", "every", "reservations" ]
python
train
kensho-technologies/graphql-compiler
graphql_compiler/compiler/ir_lowering_gremlin/__init__.py
https://github.com/kensho-technologies/graphql-compiler/blob/f6079c6d10f64932f6b3af309b79bcea2123ca8f/graphql_compiler/compiler/ir_lowering_gremlin/__init__.py#L13-L53
def lower_ir(ir_blocks, query_metadata_table, type_equivalence_hints=None): """Lower the IR into an IR form that can be represented in Gremlin queries. Args: ir_blocks: list of IR blocks to lower into Gremlin-compatible form query_metadata_table: QueryMetadataTable object containing all metadat...
[ "def", "lower_ir", "(", "ir_blocks", ",", "query_metadata_table", ",", "type_equivalence_hints", "=", "None", ")", ":", "sanity_check_ir_blocks_from_frontend", "(", "ir_blocks", ",", "query_metadata_table", ")", "ir_blocks", "=", "lower_context_field_existence", "(", "ir_...
Lower the IR into an IR form that can be represented in Gremlin queries. Args: ir_blocks: list of IR blocks to lower into Gremlin-compatible form query_metadata_table: QueryMetadataTable object containing all metadata collected during query processing, including locati...
[ "Lower", "the", "IR", "into", "an", "IR", "form", "that", "can", "be", "represented", "in", "Gremlin", "queries", "." ]
python
train
AirtestProject/Poco
poco/acceleration.py
https://github.com/AirtestProject/Poco/blob/2c559a586adf3fd11ee81cabc446d4d3f6f2d119/poco/acceleration.py#L18-L69
def dismiss(self, targets, exit_when=None, sleep_interval=0.5, appearance_timeout=20, timeout=120): """ Automatically dismiss the target objects Args: targets (:obj:`list`): list of poco objects to be dropped exit_when: termination condition, default is None which means ...
[ "def", "dismiss", "(", "self", ",", "targets", ",", "exit_when", "=", "None", ",", "sleep_interval", "=", "0.5", ",", "appearance_timeout", "=", "20", ",", "timeout", "=", "120", ")", ":", "try", ":", "self", ".", "wait_for_any", "(", "targets", ",", "...
Automatically dismiss the target objects Args: targets (:obj:`list`): list of poco objects to be dropped exit_when: termination condition, default is None which means to automatically exit when list of ``targets`` is empty sleep_interval: time interval between e...
[ "Automatically", "dismiss", "the", "target", "objects" ]
python
train
gitpython-developers/GitPython
git/db.py
https://github.com/gitpython-developers/GitPython/blob/1f66e25c25cde2423917ee18c4704fff83b837d1/git/db.py#L40-L43
def stream(self, sha): """For now, all lookup is done by git itself""" hexsha, typename, size, stream = self._git.stream_object_data(bin_to_hex(sha)) return OStream(hex_to_bin(hexsha), typename, size, stream)
[ "def", "stream", "(", "self", ",", "sha", ")", ":", "hexsha", ",", "typename", ",", "size", ",", "stream", "=", "self", ".", "_git", ".", "stream_object_data", "(", "bin_to_hex", "(", "sha", ")", ")", "return", "OStream", "(", "hex_to_bin", "(", "hexsh...
For now, all lookup is done by git itself
[ "For", "now", "all", "lookup", "is", "done", "by", "git", "itself" ]
python
train
brbsix/pip-utils
pip_utils/outdated.py
https://github.com/brbsix/pip-utils/blob/bdd2a0a17cf36a1c88aa9e68002e9ed04a27bad8/pip_utils/outdated.py#L76-L86
def _build_package_finder(options, index_urls, session): """ Create a package finder appropriate to this list command. """ return PackageFinder( find_links=options.get('find_links'), index_urls=index_urls, allow_all_prereleases=options.get('pre'), ...
[ "def", "_build_package_finder", "(", "options", ",", "index_urls", ",", "session", ")", ":", "return", "PackageFinder", "(", "find_links", "=", "options", ".", "get", "(", "'find_links'", ")", ",", "index_urls", "=", "index_urls", ",", "allow_all_prereleases", "...
Create a package finder appropriate to this list command.
[ "Create", "a", "package", "finder", "appropriate", "to", "this", "list", "command", "." ]
python
train
saltstack/salt
salt/modules/github.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L1277-L1309
def remove_team(name, profile="github"): ''' Remove a github team. name The name of the team to be removed. profile The name of the profile configuration to use. Defaults to ``github``. CLI Example: .. code-block:: bash salt myminion github.remove_team 'team_name' ...
[ "def", "remove_team", "(", "name", ",", "profile", "=", "\"github\"", ")", ":", "team_info", "=", "get_team", "(", "name", ",", "profile", "=", "profile", ")", "if", "not", "team_info", ":", "log", ".", "error", "(", "'Team %s to be removed does not exist.'", ...
Remove a github team. name The name of the team to be removed. profile The name of the profile configuration to use. Defaults to ``github``. CLI Example: .. code-block:: bash salt myminion github.remove_team 'team_name' .. versionadded:: 2016.11.0
[ "Remove", "a", "github", "team", "." ]
python
train
hyperledger/sawtooth-core
validator/sawtooth_validator/journal/publisher.py
https://github.com/hyperledger/sawtooth-core/blob/8cf473bc2207e51f02bd182d825158a57d72b098/validator/sawtooth_validator/journal/publisher.py#L242-L253
def pending_batch_info(self): """Returns a tuple of the current size of the pending batch queue and the current queue limit. """ c_length = ctypes.c_int(0) c_limit = ctypes.c_int(0) self._call( 'pending_batch_info', ctypes.byref(c_length), ...
[ "def", "pending_batch_info", "(", "self", ")", ":", "c_length", "=", "ctypes", ".", "c_int", "(", "0", ")", "c_limit", "=", "ctypes", ".", "c_int", "(", "0", ")", "self", ".", "_call", "(", "'pending_batch_info'", ",", "ctypes", ".", "byref", "(", "c_l...
Returns a tuple of the current size of the pending batch queue and the current queue limit.
[ "Returns", "a", "tuple", "of", "the", "current", "size", "of", "the", "pending", "batch", "queue", "and", "the", "current", "queue", "limit", "." ]
python
train
mitsei/dlkit
dlkit/json_/assessment/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/sessions.py#L3411-L3428
def get_item_ids_by_bank(self, bank_id): """Gets the list of ``Item`` ``Ids`` associated with a ``Bank``. arg: bank_id (osid.id.Id): ``Id`` of the ``Bank`` return: (osid.id.IdList) - list of related item ``Ids`` raise: NotFound - ``bank_id`` is not found raise: NullArgumen...
[ "def", "get_item_ids_by_bank", "(", "self", ",", "bank_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceBinSession.get_resource_ids_by_bin", "id_list", "=", "[", "]", "for", "item", "in", "self", ".", "get_items_by_bank", "(", "bank_id", ")", "...
Gets the list of ``Item`` ``Ids`` associated with a ``Bank``. arg: bank_id (osid.id.Id): ``Id`` of the ``Bank`` return: (osid.id.IdList) - list of related item ``Ids`` raise: NotFound - ``bank_id`` is not found raise: NullArgument - ``bank_id`` is ``null`` raise: Operatio...
[ "Gets", "the", "list", "of", "Item", "Ids", "associated", "with", "a", "Bank", "." ]
python
train
fboender/ansible-cmdb
lib/mako/util.py
https://github.com/fboender/ansible-cmdb/blob/ebd960ac10684e8c9ec2b12751bba2c4c9504ab7/lib/mako/util.py#L255-L263
def sorted_dict_repr(d): """repr() a dictionary with the keys in order. Used by the lexer unit test to compare parse trees based on strings. """ keys = list(d.keys()) keys.sort() return "{" + ", ".join(["%r: %r" % (k, d[k]) for k in keys]) + "}"
[ "def", "sorted_dict_repr", "(", "d", ")", ":", "keys", "=", "list", "(", "d", ".", "keys", "(", ")", ")", "keys", ".", "sort", "(", ")", "return", "\"{\"", "+", "\", \"", ".", "join", "(", "[", "\"%r: %r\"", "%", "(", "k", ",", "d", "[", "k", ...
repr() a dictionary with the keys in order. Used by the lexer unit test to compare parse trees based on strings.
[ "repr", "()", "a", "dictionary", "with", "the", "keys", "in", "order", "." ]
python
train
google/gin-config
gin/config_parser.py
https://github.com/google/gin-config/blob/17a170e0a6711005d1c78e67cf493dc44674d44f/gin/config_parser.py#L297-L354
def _parse_selector(self, scoped=True, allow_periods_in_scope=False): """Parse a (possibly scoped) selector. A selector is a sequence of one or more valid Python-style identifiers separated by periods (see also `SelectorMap`). A scoped selector is a selector that may be preceded by scope names (separat...
[ "def", "_parse_selector", "(", "self", ",", "scoped", "=", "True", ",", "allow_periods_in_scope", "=", "False", ")", ":", "if", "self", ".", "_current_token", ".", "kind", "!=", "tokenize", ".", "NAME", ":", "self", ".", "_raise_syntax_error", "(", "'Unexpec...
Parse a (possibly scoped) selector. A selector is a sequence of one or more valid Python-style identifiers separated by periods (see also `SelectorMap`). A scoped selector is a selector that may be preceded by scope names (separated by slashes). Args: scoped: Whether scopes are allowed. al...
[ "Parse", "a", "(", "possibly", "scoped", ")", "selector", "." ]
python
test
spacetelescope/pysynphot
pysynphot/refs.py
https://github.com/spacetelescope/pysynphot/blob/a125ff956f4d94beb157bd51899747a13234bb97/pysynphot/refs.py#L135-L216
def setref(graphtable=None, comptable=None, thermtable=None, area=None, waveset=None): """Set default graph and component tables, primary area, and wavelength set. This is similar to setting ``refdata`` in IRAF STSDAS SYNPHOT. If all parameters set to `None`, they are reverted to software de...
[ "def", "setref", "(", "graphtable", "=", "None", ",", "comptable", "=", "None", ",", "thermtable", "=", "None", ",", "area", "=", "None", ",", "waveset", "=", "None", ")", ":", "global", "GRAPHTABLE", ",", "COMPTABLE", ",", "THERMTABLE", ",", "PRIMARY_AR...
Set default graph and component tables, primary area, and wavelength set. This is similar to setting ``refdata`` in IRAF STSDAS SYNPHOT. If all parameters set to `None`, they are reverted to software default. If any of the parameters are not `None`, they are set to desired values while the rest (if...
[ "Set", "default", "graph", "and", "component", "tables", "primary", "area", "and", "wavelength", "set", "." ]
python
train
lrq3000/pyFileFixity
pyFileFixity/lib/sortedcontainers/sortedlist.py
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/sortedcontainers/sortedlist.py#L244-L296
def _delete(self, pos, idx): """Delete the item at the given (pos, idx). Combines lists that are less than half the load level. Updates the index when the sublist length is more than half the load level. This requires decrementing the nodes in a traversal from the leaf node to ...
[ "def", "_delete", "(", "self", ",", "pos", ",", "idx", ")", ":", "_maxes", ",", "_lists", ",", "_index", "=", "self", ".", "_maxes", ",", "self", ".", "_lists", ",", "self", ".", "_index", "lists_pos", "=", "_lists", "[", "pos", "]", "del", "lists_...
Delete the item at the given (pos, idx). Combines lists that are less than half the load level. Updates the index when the sublist length is more than half the load level. This requires decrementing the nodes in a traversal from the leaf node to the root. For an example traversal see s...
[ "Delete", "the", "item", "at", "the", "given", "(", "pos", "idx", ")", "." ]
python
train
splunk/splunk-sdk-python
examples/genevents.py
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/genevents.py#L58-L106
def feed_index(service, opts): """Feed the named index in a specific manner.""" indexname = opts.args[0] itype = opts.kwargs['ingest'] # get index handle try: index = service.indexes[indexname] except KeyError: print("Index %s not found" % indexname) return if ity...
[ "def", "feed_index", "(", "service", ",", "opts", ")", ":", "indexname", "=", "opts", ".", "args", "[", "0", "]", "itype", "=", "opts", ".", "kwargs", "[", "'ingest'", "]", "# get index handle", "try", ":", "index", "=", "service", ".", "indexes", "[",...
Feed the named index in a specific manner.
[ "Feed", "the", "named", "index", "in", "a", "specific", "manner", "." ]
python
train
tensorflow/mesh
mesh_tensorflow/transformer/dataset.py
https://github.com/tensorflow/mesh/blob/3921196e5e43302e820da0a87329f25d7e2a3016/mesh_tensorflow/transformer/dataset.py#L493-L601
def _pack_with_tf_ops(dataset, keys, length): """Helper-function for packing a dataset which has already been batched. See pack_dataset() Uses tf.while_loop. Slow. Args: dataset: a dataset containing padded batches of examples. keys: a list of strings length: an integer Returns: a dataset...
[ "def", "_pack_with_tf_ops", "(", "dataset", ",", "keys", ",", "length", ")", ":", "empty_example", "=", "{", "}", "for", "k", "in", "keys", ":", "empty_example", "[", "k", "]", "=", "tf", ".", "zeros", "(", "[", "0", "]", ",", "dtype", "=", "tf", ...
Helper-function for packing a dataset which has already been batched. See pack_dataset() Uses tf.while_loop. Slow. Args: dataset: a dataset containing padded batches of examples. keys: a list of strings length: an integer Returns: a dataset.
[ "Helper", "-", "function", "for", "packing", "a", "dataset", "which", "has", "already", "been", "batched", "." ]
python
train
python-openxml/python-docx
docx/text/run.py
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/text/run.py#L28-L47
def add_break(self, break_type=WD_BREAK.LINE): """ Add a break element of *break_type* to this run. *break_type* can take the values `WD_BREAK.LINE`, `WD_BREAK.PAGE`, and `WD_BREAK.COLUMN` where `WD_BREAK` is imported from `docx.enum.text`. *break_type* defaults to `WD_BREAK.LINE...
[ "def", "add_break", "(", "self", ",", "break_type", "=", "WD_BREAK", ".", "LINE", ")", ":", "type_", ",", "clear", "=", "{", "WD_BREAK", ".", "LINE", ":", "(", "None", ",", "None", ")", ",", "WD_BREAK", ".", "PAGE", ":", "(", "'page'", ",", "None",...
Add a break element of *break_type* to this run. *break_type* can take the values `WD_BREAK.LINE`, `WD_BREAK.PAGE`, and `WD_BREAK.COLUMN` where `WD_BREAK` is imported from `docx.enum.text`. *break_type* defaults to `WD_BREAK.LINE`.
[ "Add", "a", "break", "element", "of", "*", "break_type", "*", "to", "this", "run", ".", "*", "break_type", "*", "can", "take", "the", "values", "WD_BREAK", ".", "LINE", "WD_BREAK", ".", "PAGE", "and", "WD_BREAK", ".", "COLUMN", "where", "WD_BREAK", "is",...
python
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_antenna.py
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_antenna.py#L20-L28
def cmd_antenna(self, args): '''set gcs location''' if len(args) != 2: if self.gcs_location is None: print("GCS location not set") else: print("GCS location %s" % str(self.gcs_location)) return self.gcs_location = (float(args[0]...
[ "def", "cmd_antenna", "(", "self", ",", "args", ")", ":", "if", "len", "(", "args", ")", "!=", "2", ":", "if", "self", ".", "gcs_location", "is", "None", ":", "print", "(", "\"GCS location not set\"", ")", "else", ":", "print", "(", "\"GCS location %s\""...
set gcs location
[ "set", "gcs", "location" ]
python
train
proycon/pynlpl
pynlpl/formats/folia.py
https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L722-L730
def description(self): """Obtain the description associated with the element. Raises: :class:`NoSuchAnnotation` if there is no associated description.""" for e in self: if isinstance(e, Description): return e.value raise NoSuchAnnotation
[ "def", "description", "(", "self", ")", ":", "for", "e", "in", "self", ":", "if", "isinstance", "(", "e", ",", "Description", ")", ":", "return", "e", ".", "value", "raise", "NoSuchAnnotation" ]
Obtain the description associated with the element. Raises: :class:`NoSuchAnnotation` if there is no associated description.
[ "Obtain", "the", "description", "associated", "with", "the", "element", "." ]
python
train
LionelAuroux/pyrser
pyrser/type_system/scope.py
https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/type_system/scope.py#L191-L199
def intersection_update(self, oset: Scope) -> Scope: """ Update Set with common values of another Set """ keys = list(self._hsig.keys()) for k in keys: if k not in oset: del self._hsig[k] else: self._hsig[k] = oset.get(k) return sel...
[ "def", "intersection_update", "(", "self", ",", "oset", ":", "Scope", ")", "->", "Scope", ":", "keys", "=", "list", "(", "self", ".", "_hsig", ".", "keys", "(", ")", ")", "for", "k", "in", "keys", ":", "if", "k", "not", "in", "oset", ":", "del", ...
Update Set with common values of another Set
[ "Update", "Set", "with", "common", "values", "of", "another", "Set" ]
python
test
materialsproject/pymatgen
pymatgen/phonon/bandstructure.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/bandstructure.py#L427-L505
def as_phononwebsite(self): """ Return a dictionary with the phononwebsite format: http://henriquemiranda.github.io/phononwebsite """ d = {} #define the lattice d["lattice"] = self.structure.lattice._matrix.tolist() #define atoms atom_pos_c...
[ "def", "as_phononwebsite", "(", "self", ")", ":", "d", "=", "{", "}", "#define the lattice", "d", "[", "\"lattice\"", "]", "=", "self", ".", "structure", ".", "lattice", ".", "_matrix", ".", "tolist", "(", ")", "#define atoms", "atom_pos_car", "=", "[", ...
Return a dictionary with the phononwebsite format: http://henriquemiranda.github.io/phononwebsite
[ "Return", "a", "dictionary", "with", "the", "phononwebsite", "format", ":", "http", ":", "//", "henriquemiranda", ".", "github", ".", "io", "/", "phononwebsite" ]
python
train
log2timeline/plaso
plaso/output/xlsx.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/output/xlsx.py#L61-L87
def _FormatDateTime(self, event): """Formats the date to a datetime object without timezone information. Note: timezone information must be removed due to lack of support by xlsxwriter and Excel. Args: event (EventObject): event. Returns: datetime.datetime|str: date and time value or ...
[ "def", "_FormatDateTime", "(", "self", ",", "event", ")", ":", "try", ":", "datetime_object", "=", "datetime", ".", "datetime", "(", "1970", ",", "1", ",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "tzinfo", "=", "pytz", ".", "UTC", ")", ...
Formats the date to a datetime object without timezone information. Note: timezone information must be removed due to lack of support by xlsxwriter and Excel. Args: event (EventObject): event. Returns: datetime.datetime|str: date and time value or a string containing "ERROR" on ...
[ "Formats", "the", "date", "to", "a", "datetime", "object", "without", "timezone", "information", "." ]
python
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1485-L1494
def _proc_gnusparse_00(self, next, pax_headers, buf): """Process a GNU tar extended sparse header, version 0.0. """ offsets = [] for match in re.finditer(br"\d+ GNU.sparse.offset=(\d+)\n", buf): offsets.append(int(match.group(1))) numbytes = [] for match in re...
[ "def", "_proc_gnusparse_00", "(", "self", ",", "next", ",", "pax_headers", ",", "buf", ")", ":", "offsets", "=", "[", "]", "for", "match", "in", "re", ".", "finditer", "(", "br\"\\d+ GNU.sparse.offset=(\\d+)\\n\"", ",", "buf", ")", ":", "offsets", ".", "ap...
Process a GNU tar extended sparse header, version 0.0.
[ "Process", "a", "GNU", "tar", "extended", "sparse", "header", "version", "0", ".", "0", "." ]
python
train
DataONEorg/d1_python
lib_common/src/d1_common/bagit.py
https://github.com/DataONEorg/d1_python/blob/3ac4d4f3ca052d3e8641a6a329cab526c8ddcb0d/lib_common/src/d1_common/bagit.py#L78-L103
def create_bagit_stream(dir_name, payload_info_list): """Create a stream containing a BagIt zip archive. Args: dir_name : str The name of the root directory in the zip file, under which all the files are placed (avoids "zip bombs"). payload_info_list: list L...
[ "def", "create_bagit_stream", "(", "dir_name", ",", "payload_info_list", ")", ":", "zip_file", "=", "zipstream", ".", "ZipFile", "(", "mode", "=", "'w'", ",", "compression", "=", "zipstream", ".", "ZIP_DEFLATED", ")", "_add_path", "(", "dir_name", ",", "payloa...
Create a stream containing a BagIt zip archive. Args: dir_name : str The name of the root directory in the zip file, under which all the files are placed (avoids "zip bombs"). payload_info_list: list List of payload_info_dict, each dict describing a file. ...
[ "Create", "a", "stream", "containing", "a", "BagIt", "zip", "archive", "." ]
python
train
jrief/djangocms-cascade
cmsplugin_cascade/mixins.py
https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/mixins.py#L27-L40
def get_css_classes(cls, instance): """ Returns a list of CSS classes to be added as class="..." to the current HTML tag. """ css_classes = [] if hasattr(cls, 'default_css_class'): css_classes.append(cls.default_css_class) for attr in getattr(cls, 'default_css...
[ "def", "get_css_classes", "(", "cls", ",", "instance", ")", ":", "css_classes", "=", "[", "]", "if", "hasattr", "(", "cls", ",", "'default_css_class'", ")", ":", "css_classes", ".", "append", "(", "cls", ".", "default_css_class", ")", "for", "attr", "in", ...
Returns a list of CSS classes to be added as class="..." to the current HTML tag.
[ "Returns", "a", "list", "of", "CSS", "classes", "to", "be", "added", "as", "class", "=", "...", "to", "the", "current", "HTML", "tag", "." ]
python
train
lowandrew/OLCTools
spadespipeline/GeneSeekr.py
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/GeneSeekr.py#L51-L118
def filterunique(self): """ Filters multiple BLAST hits in a common region of the genome. Leaves only the best hit """ for sample in self.metadata: # Initialise variables sample[self.analysistype].blastresults = list() resultdict = dict() r...
[ "def", "filterunique", "(", "self", ")", ":", "for", "sample", "in", "self", ".", "metadata", ":", "# Initialise variables", "sample", "[", "self", ".", "analysistype", "]", ".", "blastresults", "=", "list", "(", ")", "resultdict", "=", "dict", "(", ")", ...
Filters multiple BLAST hits in a common region of the genome. Leaves only the best hit
[ "Filters", "multiple", "BLAST", "hits", "in", "a", "common", "region", "of", "the", "genome", ".", "Leaves", "only", "the", "best", "hit" ]
python
train
1flow/python-ftr
ftr/extractor.py
https://github.com/1flow/python-ftr/blob/90a2108c5ee005f1bf66dbe8cce68f2b7051b839/ftr/extractor.py#L134-L165
def _tidy(self, html, smart_tidy): """ Tidy HTML if we have a tidy method. This fixes problems with some sites which would otherwise trouble DOMDocument's HTML parsing. Although sometimes it makes the problem worse, which is why we can override it in site config files. ...
[ "def", "_tidy", "(", "self", ",", "html", ",", "smart_tidy", ")", ":", "if", "self", ".", "config", ".", "tidy", "and", "tidylib", "and", "smart_tidy", ":", "try", ":", "document", ",", "errors", "=", "tidylib", ".", "tidy_document", "(", "html", ",", ...
Tidy HTML if we have a tidy method. This fixes problems with some sites which would otherwise trouble DOMDocument's HTML parsing. Although sometimes it makes the problem worse, which is why we can override it in site config files.
[ "Tidy", "HTML", "if", "we", "have", "a", "tidy", "method", "." ]
python
train
Qiskit/qiskit-terra
qiskit/quantum_info/operators/channel/transformations.py
https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/channel/transformations.py#L244-L254
def _stinespring_to_choi(data, input_dim, output_dim): """Transform Stinespring representation to Choi representation.""" trace_dim = data[0].shape[0] // output_dim stine_l = np.reshape(data[0], (output_dim, trace_dim, input_dim)) if data[1] is None: stine_r = stine_l else: stine_r =...
[ "def", "_stinespring_to_choi", "(", "data", ",", "input_dim", ",", "output_dim", ")", ":", "trace_dim", "=", "data", "[", "0", "]", ".", "shape", "[", "0", "]", "//", "output_dim", "stine_l", "=", "np", ".", "reshape", "(", "data", "[", "0", "]", ","...
Transform Stinespring representation to Choi representation.
[ "Transform", "Stinespring", "representation", "to", "Choi", "representation", "." ]
python
test
hyperledger/indy-plenum
plenum/server/node.py
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1727-L1739
async def serviceViewChangerInbox(self, limit: int = None) -> int: """ Service at most `limit` number of messages from the view_changer's outBox. :return: the number of messages successfully serviced. """ msgCount = 0 while self.msgsToViewChanger and (not limit or msgCou...
[ "async", "def", "serviceViewChangerInbox", "(", "self", ",", "limit", ":", "int", "=", "None", ")", "->", "int", ":", "msgCount", "=", "0", "while", "self", ".", "msgsToViewChanger", "and", "(", "not", "limit", "or", "msgCount", "<", "limit", ")", ":", ...
Service at most `limit` number of messages from the view_changer's outBox. :return: the number of messages successfully serviced.
[ "Service", "at", "most", "limit", "number", "of", "messages", "from", "the", "view_changer", "s", "outBox", "." ]
python
train
phoebe-project/phoebe2
phoebe/parameters/parameters.py
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1608-L1641
def get_or_create(self, qualifier, new_parameter, **kwargs): """ Get a :class:`Parameter` from the ParameterSet, if it does not exist, create and attach it. Note: running this on a ParameterSet that is NOT a :class:`phoebe.frontend.bundle.Bundle`, will NOT add the Parame...
[ "def", "get_or_create", "(", "self", ",", "qualifier", ",", "new_parameter", ",", "*", "*", "kwargs", ")", ":", "ps", "=", "self", ".", "filter_or_get", "(", "qualifier", "=", "qualifier", ",", "*", "*", "kwargs", ")", "if", "isinstance", "(", "ps", ",...
Get a :class:`Parameter` from the ParameterSet, if it does not exist, create and attach it. Note: running this on a ParameterSet that is NOT a :class:`phoebe.frontend.bundle.Bundle`, will NOT add the Parameter to the bundle, but only the temporary ParameterSet :paramete...
[ "Get", "a", ":", "class", ":", "Parameter", "from", "the", "ParameterSet", "if", "it", "does", "not", "exist", "create", "and", "attach", "it", "." ]
python
train
mlperf/training
reinforcement/tensorflow/minigo/selfplay.py
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/selfplay.py#L49-L107
def play(network): """Plays out a self-play match, returning a MCTSPlayer object containing: - the final position - the n x 362 tensor of floats representing the mcts search probabilities - the n-ary tensor of floats representing the original value-net estimate where n is the numbe...
[ "def", "play", "(", "network", ")", ":", "readouts", "=", "FLAGS", ".", "num_readouts", "# defined in strategies.py", "# Disable resign in 5% of games", "if", "random", ".", "random", "(", ")", "<", "FLAGS", ".", "resign_disable_pct", ":", "resign_threshold", "=", ...
Plays out a self-play match, returning a MCTSPlayer object containing: - the final position - the n x 362 tensor of floats representing the mcts search probabilities - the n-ary tensor of floats representing the original value-net estimate where n is the number of moves in the game
[ "Plays", "out", "a", "self", "-", "play", "match", "returning", "a", "MCTSPlayer", "object", "containing", ":", "-", "the", "final", "position", "-", "the", "n", "x", "362", "tensor", "of", "floats", "representing", "the", "mcts", "search", "probabilities", ...
python
train
ARMmbed/mbed-cloud-sdk-python
src/mbed_cloud/_backends/mds/apis/subscriptions_api.py
https://github.com/ARMmbed/mbed-cloud-sdk-python/blob/c0af86fb2cdd4dc7ed26f236139241067d293509/src/mbed_cloud/_backends/mds/apis/subscriptions_api.py#L604-L623
def get_pre_subscriptions(self, **kwargs): # noqa: E501 """Get pre-subscriptions # noqa: E501 You can retrieve the pre-subscription data with the GET operation. The server returns with the same JSON structure as described above. If there are no pre-subscribed resources, it returns with an empty array...
[ "def", "get_pre_subscriptions", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'asynchronous'", ")", ":", "return", "self", ".", "get_pre_subscripti...
Get pre-subscriptions # noqa: E501 You can retrieve the pre-subscription data with the GET operation. The server returns with the same JSON structure as described above. If there are no pre-subscribed resources, it returns with an empty array. **Example usage:** curl -X GET https://api.us-east-1.mbedclo...
[ "Get", "pre", "-", "subscriptions", "#", "noqa", ":", "E501" ]
python
train
yyuu/botornado
boto/auth.py
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/auth.py#L223-L237
def string_to_sign(self, http_request): """ Return the canonical StringToSign as well as a dict containing the original version of all headers that were included in the StringToSign. """ headers_to_sign = self.headers_to_sign(http_request) canonical_headers = self...
[ "def", "string_to_sign", "(", "self", ",", "http_request", ")", ":", "headers_to_sign", "=", "self", ".", "headers_to_sign", "(", "http_request", ")", "canonical_headers", "=", "self", ".", "canonical_headers", "(", "headers_to_sign", ")", "string_to_sign", "=", "...
Return the canonical StringToSign as well as a dict containing the original version of all headers that were included in the StringToSign.
[ "Return", "the", "canonical", "StringToSign", "as", "well", "as", "a", "dict", "containing", "the", "original", "version", "of", "all", "headers", "that", "were", "included", "in", "the", "StringToSign", "." ]
python
train
nickmckay/LiPD-utilities
Python/lipd/doi_resolver.py
https://github.com/nickmckay/LiPD-utilities/blob/5dab6bbeffc5effd68e3a6beaca6b76aa928e860/Python/lipd/doi_resolver.py#L125-L147
def illegal_doi(self, doi_string): """ DOI string did not match the regex. Determine what the data is. :param doi_string: (str) Malformed DOI string :return: None """ logger_doi_resolver.info("enter illegal_doi") # Ignores empty or irrelevant strings (blank, space...
[ "def", "illegal_doi", "(", "self", ",", "doi_string", ")", ":", "logger_doi_resolver", ".", "info", "(", "\"enter illegal_doi\"", ")", "# Ignores empty or irrelevant strings (blank, spaces, na, nan, ', others)", "if", "len", "(", "doi_string", ")", ">", "5", ":", "# NOA...
DOI string did not match the regex. Determine what the data is. :param doi_string: (str) Malformed DOI string :return: None
[ "DOI", "string", "did", "not", "match", "the", "regex", ".", "Determine", "what", "the", "data", "is", ".", ":", "param", "doi_string", ":", "(", "str", ")", "Malformed", "DOI", "string", ":", "return", ":", "None" ]
python
train
python-diamond/Diamond
src/diamond/handler/rabbitmq_pubsub.py
https://github.com/python-diamond/Diamond/blob/0f3eb04327d6d3ed5e53a9967d6c9d2c09714a47/src/diamond/handler/rabbitmq_pubsub.py#L87-L97
def get_default_config_help(self): """ Returns the help text for the configuration options for this handler """ config = super(rmqHandler, self).get_default_config_help() config.update({ 'server': '', 'rmq_exchange': '', }) return config
[ "def", "get_default_config_help", "(", "self", ")", ":", "config", "=", "super", "(", "rmqHandler", ",", "self", ")", ".", "get_default_config_help", "(", ")", "config", ".", "update", "(", "{", "'server'", ":", "''", ",", "'rmq_exchange'", ":", "''", ",",...
Returns the help text for the configuration options for this handler
[ "Returns", "the", "help", "text", "for", "the", "configuration", "options", "for", "this", "handler" ]
python
train
helixyte/everest
everest/repositories/uow.py
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/repositories/uow.py#L31-L40
def register_new(self, entity_class, entity): """ Registers the given entity for the given class as NEW. :raises ValueError: If the given entity already holds state that was created by another Unit Of Work. """ EntityState.manage(entity, self) EntityState.get_s...
[ "def", "register_new", "(", "self", ",", "entity_class", ",", "entity", ")", ":", "EntityState", ".", "manage", "(", "entity", ",", "self", ")", "EntityState", ".", "get_state", "(", "entity", ")", ".", "status", "=", "ENTITY_STATUS", ".", "NEW", "self", ...
Registers the given entity for the given class as NEW. :raises ValueError: If the given entity already holds state that was created by another Unit Of Work.
[ "Registers", "the", "given", "entity", "for", "the", "given", "class", "as", "NEW", "." ]
python
train
getpelican/pelican-plugins
filetime_from_git/actions.py
https://github.com/getpelican/pelican-plugins/blob/cfc7a3f224f1743063b034561f89a6a712d13587/filetime_from_git/actions.py#L84-L89
def update_hash_from_str(hsh, str_input): """ Convert a str to object supporting buffer API and update a hash with it. """ byte_input = str(str_input).encode("UTF-8") hsh.update(byte_input)
[ "def", "update_hash_from_str", "(", "hsh", ",", "str_input", ")", ":", "byte_input", "=", "str", "(", "str_input", ")", ".", "encode", "(", "\"UTF-8\"", ")", "hsh", ".", "update", "(", "byte_input", ")" ]
Convert a str to object supporting buffer API and update a hash with it.
[ "Convert", "a", "str", "to", "object", "supporting", "buffer", "API", "and", "update", "a", "hash", "with", "it", "." ]
python
train
vintasoftware/django-role-permissions
rolepermissions/utils.py
https://github.com/vintasoftware/django-role-permissions/blob/28924361e689e994e0c3575e18104a1a5abd8de6/rolepermissions/utils.py#L16-L26
def camelToSnake(s): """ https://gist.github.com/jaytaylor/3660565 Is it ironic that this function is written in camel case, yet it converts to snake case? hmm.. """ _underscorer1 = re.compile(r'(.)([A-Z][a-z]+)') _underscorer2 = re.compile('([a-z0-9])([A-Z])') subbed = _underscorer1.su...
[ "def", "camelToSnake", "(", "s", ")", ":", "_underscorer1", "=", "re", ".", "compile", "(", "r'(.)([A-Z][a-z]+)'", ")", "_underscorer2", "=", "re", ".", "compile", "(", "'([a-z0-9])([A-Z])'", ")", "subbed", "=", "_underscorer1", ".", "sub", "(", "r'\\1_\\2'", ...
https://gist.github.com/jaytaylor/3660565 Is it ironic that this function is written in camel case, yet it converts to snake case? hmm..
[ "https", ":", "//", "gist", ".", "github", ".", "com", "/", "jaytaylor", "/", "3660565", "Is", "it", "ironic", "that", "this", "function", "is", "written", "in", "camel", "case", "yet", "it", "converts", "to", "snake", "case?", "hmm", ".." ]
python
train
dpgaspar/Flask-AppBuilder
flask_appbuilder/baseviews.py
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/baseviews.py#L1067-L1123
def _edit(self, pk): """ Edit function logic, override to implement different logic returns Edit widget and related list or None """ is_valid_form = True pages = get_page_args() page_sizes = get_page_size_args() orders = get_order_args() ge...
[ "def", "_edit", "(", "self", ",", "pk", ")", ":", "is_valid_form", "=", "True", "pages", "=", "get_page_args", "(", ")", "page_sizes", "=", "get_page_size_args", "(", ")", "orders", "=", "get_order_args", "(", ")", "get_filter_args", "(", "self", ".", "_fi...
Edit function logic, override to implement different logic returns Edit widget and related list or None
[ "Edit", "function", "logic", "override", "to", "implement", "different", "logic", "returns", "Edit", "widget", "and", "related", "list", "or", "None" ]
python
train
jadolg/rocketchat_API
rocketchat_API/rocketchat.py
https://github.com/jadolg/rocketchat_API/blob/f220d094434991cb9892418245f054ea06f28aad/rocketchat_API/rocketchat.py#L511-L513
def groups_rename(self, room_id, name, **kwargs): """Changes the name of the private group.""" return self.__call_api_post('groups.rename', roomId=room_id, name=name, kwargs=kwargs)
[ "def", "groups_rename", "(", "self", ",", "room_id", ",", "name", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "__call_api_post", "(", "'groups.rename'", ",", "roomId", "=", "room_id", ",", "name", "=", "name", ",", "kwargs", "=", "kwargs", ...
Changes the name of the private group.
[ "Changes", "the", "name", "of", "the", "private", "group", "." ]
python
train
cmbruns/pyopenvr
src/openvr/__init__.py
https://github.com/cmbruns/pyopenvr/blob/68395d26bb3df6ab1f0f059c38d441f962938be6/src/openvr/__init__.py#L6051-L6057
def getSkeletalReferenceTransforms(self, action, eTransformSpace, eReferencePose, unTransformArrayCount): """Fills the given buffer with the transforms for a specific static skeletal reference pose""" fn = self.function_table.getSkeletalReferenceTransforms pTransformArray = VRBoneTransform_t() ...
[ "def", "getSkeletalReferenceTransforms", "(", "self", ",", "action", ",", "eTransformSpace", ",", "eReferencePose", ",", "unTransformArrayCount", ")", ":", "fn", "=", "self", ".", "function_table", ".", "getSkeletalReferenceTransforms", "pTransformArray", "=", "VRBoneTr...
Fills the given buffer with the transforms for a specific static skeletal reference pose
[ "Fills", "the", "given", "buffer", "with", "the", "transforms", "for", "a", "specific", "static", "skeletal", "reference", "pose" ]
python
train
opereto/pyopereto
pyopereto/client.py
https://github.com/opereto/pyopereto/blob/16ca987738a7e1b82b52b0b099794a74ed557223/pyopereto/client.py#L856-L874
def modify_agent(self, agent_id, **kwargs): ''' modify_agent(self, agent_id, **kwargs) | Modifies agent information (like name) :Parameters: * *agent_id* (`string`) -- Identifier of an existing agent :Example: .. code-block:: python opereto_client ...
[ "def", "modify_agent", "(", "self", ",", "agent_id", ",", "*", "*", "kwargs", ")", ":", "request_data", "=", "{", "'id'", ":", "agent_id", "}", "request_data", ".", "update", "(", "*", "*", "kwargs", ")", "return", "self", ".", "_call_rest_api", "(", "...
modify_agent(self, agent_id, **kwargs) | Modifies agent information (like name) :Parameters: * *agent_id* (`string`) -- Identifier of an existing agent :Example: .. code-block:: python opereto_client = OperetoClient() opereto_client.modify_agent('agentI...
[ "modify_agent", "(", "self", "agent_id", "**", "kwargs", ")" ]
python
train
Azure/msrestazure-for-python
msrestazure/azure_exceptions.py
https://github.com/Azure/msrestazure-for-python/blob/5f99262305692525d03ca87d2c5356b05c5aa874/msrestazure/azure_exceptions.py#L119-L141
def message(self, value): """Attempt to deconstruct error message to retrieve further error data. """ try: import ast value = ast.literal_eval(value) except (SyntaxError, TypeError, ValueError): pass try: value = value.get('...
[ "def", "message", "(", "self", ",", "value", ")", ":", "try", ":", "import", "ast", "value", "=", "ast", ".", "literal_eval", "(", "value", ")", "except", "(", "SyntaxError", ",", "TypeError", ",", "ValueError", ")", ":", "pass", "try", ":", "value", ...
Attempt to deconstruct error message to retrieve further error data.
[ "Attempt", "to", "deconstruct", "error", "message", "to", "retrieve", "further", "error", "data", "." ]
python
train