Unnamed: 0
int64
0
10k
repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
5
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
100
30.3k
language
stringclasses
1 value
func_code_string
stringlengths
100
30.3k
func_code_tokens
stringlengths
138
33.2k
func_documentation_string
stringlengths
1
15k
func_documentation_tokens
stringlengths
5
5.14k
split_name
stringclasses
1 value
func_code_url
stringlengths
91
315
3,100
olsoneric/pedemath
pedemath/vec3.py
rotate_around_vector_v3
def rotate_around_vector_v3(v, angle_rad, norm_vec): """ rotate v around norm_vec by angle_rad.""" cos_val = math.cos(angle_rad) sin_val = math.sin(angle_rad) ## (v * cosVal) + ## ((normVec * v) * (1.0 - cosVal)) * normVec + ## (v ^ normVec) * sinVal) #line1: scaleV3(v,cosVal) #line2: do...
python
def rotate_around_vector_v3(v, angle_rad, norm_vec): """ rotate v around norm_vec by angle_rad.""" cos_val = math.cos(angle_rad) sin_val = math.sin(angle_rad) ## (v * cosVal) + ## ((normVec * v) * (1.0 - cosVal)) * normVec + ## (v ^ normVec) * sinVal) #line1: scaleV3(v,cosVal) #line2: do...
['def', 'rotate_around_vector_v3', '(', 'v', ',', 'angle_rad', ',', 'norm_vec', ')', ':', 'cos_val', '=', 'math', '.', 'cos', '(', 'angle_rad', ')', 'sin_val', '=', 'math', '.', 'sin', '(', 'angle_rad', ')', '## (v * cosVal) +', '## ((normVec * v) * (1.0 - cosVal)) * normVec +', '## (v ^ normVec) * sinVal)', '#line1: s...
rotate v around norm_vec by angle_rad.
['rotate', 'v', 'around', 'norm_vec', 'by', 'angle_rad', '.']
train
https://github.com/olsoneric/pedemath/blob/4bffcfe7089e421d603eb0a9708b84789c2d16be/pedemath/vec3.py#L136-L153
3,101
geophysics-ubonn/crtomo_tools
lib/crtomo/cfg.py
crtomo_config.set_defaults
def set_defaults(self): """Fill the dictionary with all defaults """ self['mswitch'] = 1 self['elem'] = '../grid/elem.dat' self['elec'] = '../grid/elec.dat' self['volt'] = '../mod/volt.dat' self['inv_dir'] = '../inv' self['diff_inv'] = 'F ! difference inve...
python
def set_defaults(self): """Fill the dictionary with all defaults """ self['mswitch'] = 1 self['elem'] = '../grid/elem.dat' self['elec'] = '../grid/elec.dat' self['volt'] = '../mod/volt.dat' self['inv_dir'] = '../inv' self['diff_inv'] = 'F ! difference inve...
['def', 'set_defaults', '(', 'self', ')', ':', 'self', '[', "'mswitch'", ']', '=', '1', 'self', '[', "'elem'", ']', '=', "'../grid/elem.dat'", 'self', '[', "'elec'", ']', '=', "'../grid/elec.dat'", 'self', '[', "'volt'", ']', '=', "'../mod/volt.dat'", 'self', '[', "'inv_dir'", ']', '=', "'../inv'", 'self', '[', "'diff_...
Fill the dictionary with all defaults
['Fill', 'the', 'dictionary', 'with', 'all', 'defaults']
train
https://github.com/geophysics-ubonn/crtomo_tools/blob/27c3e21a557f8df1c12455b96c4c2e00e08a5b4a/lib/crtomo/cfg.py#L180-L214
3,102
sdispater/orator
orator/orm/factory.py
Factory.create_as
def create_as(self, klass, name, **attributes): """ Create an instance of the given model and type and persist it to the database. :param klass: The class :type klass: class :param name: The type :type name: str :param attributes: The instance attributes ...
python
def create_as(self, klass, name, **attributes): """ Create an instance of the given model and type and persist it to the database. :param klass: The class :type klass: class :param name: The type :type name: str :param attributes: The instance attributes ...
['def', 'create_as', '(', 'self', ',', 'klass', ',', 'name', ',', '*', '*', 'attributes', ')', ':', 'return', 'self', '.', 'of', '(', 'klass', ',', 'name', ')', '.', 'create', '(', '*', '*', 'attributes', ')']
Create an instance of the given model and type and persist it to the database. :param klass: The class :type klass: class :param name: The type :type name: str :param attributes: The instance attributes :type attributes: dict :return: mixed
['Create', 'an', 'instance', 'of', 'the', 'given', 'model', 'and', 'type', 'and', 'persist', 'it', 'to', 'the', 'database', '.']
train
https://github.com/sdispater/orator/blob/bd90bf198ee897751848f9a92e49d18e60a74136/orator/orm/factory.py#L127-L142
3,103
briwilcox/Concurrent-Pandas
concurrentpandas.py
ConcurrentPandas.unpack
def unpack(self, to_unpack): """ Unpack is a recursive function that will unpack anything that inherits from abstract base class Container provided it is not also inheriting from Python basestring. Raise Exception if resulting object is neither a container or a string Code work...
python
def unpack(self, to_unpack): """ Unpack is a recursive function that will unpack anything that inherits from abstract base class Container provided it is not also inheriting from Python basestring. Raise Exception if resulting object is neither a container or a string Code work...
['def', 'unpack', '(', 'self', ',', 'to_unpack', ')', ':', '# Python 3 lacks basestring type, work around below', 'try', ':', 'isinstance', '(', 'to_unpack', ',', 'basestring', ')', 'except', 'NameError', ':', 'basestring', '=', 'str', '# Base Case', 'if', 'isinstance', '(', 'to_unpack', ',', 'basestring', ')', ':', 's...
Unpack is a recursive function that will unpack anything that inherits from abstract base class Container provided it is not also inheriting from Python basestring. Raise Exception if resulting object is neither a container or a string Code working in both Python 2 and Python 3
['Unpack', 'is', 'a', 'recursive', 'function', 'that', 'will', 'unpack', 'anything', 'that', 'inherits', 'from', 'abstract', 'base', 'class', 'Container', 'provided', 'it', 'is', 'not', 'also', 'inheriting', 'from', 'Python', 'basestring', '.']
train
https://github.com/briwilcox/Concurrent-Pandas/blob/22cb392dacb712e1bdb5b60c6ba7015c38445c99/concurrentpandas.py#L202-L239
3,104
bpannier/simpletr64
simpletr64/actions/wifi.py
Wifi.getSpecificAssociatedDeviceInfo
def getSpecificAssociatedDeviceInfo(self, macAddress, wifiInterfaceId=1, timeout=1): """Execute GetSpecificAssociatedDeviceInfo action to get detailed information about a Wifi client. :param str macAddress: MAC address in the form ``38:C9:86:26:7E:38``; be aware that the MAC address might b...
python
def getSpecificAssociatedDeviceInfo(self, macAddress, wifiInterfaceId=1, timeout=1): """Execute GetSpecificAssociatedDeviceInfo action to get detailed information about a Wifi client. :param str macAddress: MAC address in the form ``38:C9:86:26:7E:38``; be aware that the MAC address might b...
['def', 'getSpecificAssociatedDeviceInfo', '(', 'self', ',', 'macAddress', ',', 'wifiInterfaceId', '=', '1', ',', 'timeout', '=', '1', ')', ':', 'namespace', '=', 'Wifi', '.', 'getServiceType', '(', '"getSpecificAssociatedDeviceInfo"', ')', '+', 'str', '(', 'wifiInterfaceId', ')', 'uri', '=', 'self', '.', 'getControlUR...
Execute GetSpecificAssociatedDeviceInfo action to get detailed information about a Wifi client. :param str macAddress: MAC address in the form ``38:C9:86:26:7E:38``; be aware that the MAC address might be case sensitive, depending on the router :param int wifiInterfaceId: the id of the Wifi...
['Execute', 'GetSpecificAssociatedDeviceInfo', 'action', 'to', 'get', 'detailed', 'information', 'about', 'a', 'Wifi', 'client', '.']
train
https://github.com/bpannier/simpletr64/blob/31081139f4e6c85084a56de1617df73927135466/simpletr64/actions/wifi.py#L174-L192
3,105
inveniosoftware/invenio-files-rest
invenio_files_rest/serializer.py
ObjectVersionSchema.dump_links
def dump_links(self, o): """Dump links.""" params = {'versionId': o.version_id} data = { 'self': url_for( '.object_api', bucket_id=o.bucket_id, key=o.key, _external=True, **(params if not o.is_head or o.d...
python
def dump_links(self, o): """Dump links.""" params = {'versionId': o.version_id} data = { 'self': url_for( '.object_api', bucket_id=o.bucket_id, key=o.key, _external=True, **(params if not o.is_head or o.d...
['def', 'dump_links', '(', 'self', ',', 'o', ')', ':', 'params', '=', '{', "'versionId'", ':', 'o', '.', 'version_id', '}', 'data', '=', '{', "'self'", ':', 'url_for', '(', "'.object_api'", ',', 'bucket_id', '=', 'o', '.', 'bucket_id', ',', 'key', '=', 'o', '.', 'key', ',', '_external', '=', 'True', ',', '*', '*', '(',...
Dump links.
['Dump', 'links', '.']
train
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/serializer.py#L69-L97
3,106
GNS3/gns3-server
gns3server/compute/virtualbox/virtualbox_vm.py
VirtualBoxVM.close
def close(self): """ Closes this VirtualBox VM. """ if self._closed: # VM is already closed return if not (yield from super().close()): return False log.debug("VirtualBox VM '{name}' [{id}] is closing".format(name=self.name, id=self....
python
def close(self): """ Closes this VirtualBox VM. """ if self._closed: # VM is already closed return if not (yield from super().close()): return False log.debug("VirtualBox VM '{name}' [{id}] is closing".format(name=self.name, id=self....
['def', 'close', '(', 'self', ')', ':', 'if', 'self', '.', '_closed', ':', '# VM is already closed', 'return', 'if', 'not', '(', 'yield', 'from', 'super', '(', ')', '.', 'close', '(', ')', ')', ':', 'return', 'False', 'log', '.', 'debug', '(', '"VirtualBox VM \'{name}\' [{id}] is closing"', '.', 'format', '(', 'name', ...
Closes this VirtualBox VM.
['Closes', 'this', 'VirtualBox', 'VM', '.']
train
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/virtualbox/virtualbox_vm.py#L484-L540
3,107
ThreatConnect-Inc/tcex
tcex/tcex_resources.py
Resource.copy
def copy(self): """Return a "clean" copy of this instance. Return: (instance): A clean copy of this instance. """ resource = copy.copy(self) # workaround for bytes/str issue in Py3 with copy of instance # TypeError: a bytes-like object is required, not 'str'...
python
def copy(self): """Return a "clean" copy of this instance. Return: (instance): A clean copy of this instance. """ resource = copy.copy(self) # workaround for bytes/str issue in Py3 with copy of instance # TypeError: a bytes-like object is required, not 'str'...
['def', 'copy', '(', 'self', ')', ':', 'resource', '=', 'copy', '.', 'copy', '(', 'self', ')', '# workaround for bytes/str issue in Py3 with copy of instance', "# TypeError: a bytes-like object is required, not 'str' (ssl.py)", 'resource', '.', '_request', '=', 'self', '.', 'tcex', '.', 'request', '(', 'self', '.', 'tc...
Return a "clean" copy of this instance. Return: (instance): A clean copy of this instance.
['Return', 'a', 'clean', 'copy', 'of', 'this', 'instance', '.']
train
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_resources.py#L524-L547
3,108
juju-solutions/charms.reactive
charms/reactive/bus.py
Handler._get_args
def _get_args(self): """ Lazily evaluate the args. """ if not hasattr(self, '_args_evaled'): # cache the args in case handler is re-invoked due to flags change self._args_evaled = list(chain.from_iterable(self._args)) return self._args_evaled
python
def _get_args(self): """ Lazily evaluate the args. """ if not hasattr(self, '_args_evaled'): # cache the args in case handler is re-invoked due to flags change self._args_evaled = list(chain.from_iterable(self._args)) return self._args_evaled
['def', '_get_args', '(', 'self', ')', ':', 'if', 'not', 'hasattr', '(', 'self', ',', "'_args_evaled'", ')', ':', '# cache the args in case handler is re-invoked due to flags change', 'self', '.', '_args_evaled', '=', 'list', '(', 'chain', '.', 'from_iterable', '(', 'self', '.', '_args', ')', ')', 'return', 'self', '.'...
Lazily evaluate the args.
['Lazily', 'evaluate', 'the', 'args', '.']
train
https://github.com/juju-solutions/charms.reactive/blob/e37e781432e77c12b63d2c739bd6cd70d3230c3a/charms/reactive/bus.py#L167-L174
3,109
materialsproject/pymatgen
pymatgen/io/abinit/works.py
GKKPWork.on_ok
def on_ok(self, sender): """ This callback is called when one task reaches status `S_OK`. It removes the WFKQ file if all its children have reached `S_OK`. """ if self.remove_wfkq: for task in self.wfkq_tasks: if task.status != task.S_OK: continue ...
python
def on_ok(self, sender): """ This callback is called when one task reaches status `S_OK`. It removes the WFKQ file if all its children have reached `S_OK`. """ if self.remove_wfkq: for task in self.wfkq_tasks: if task.status != task.S_OK: continue ...
['def', 'on_ok', '(', 'self', ',', 'sender', ')', ':', 'if', 'self', '.', 'remove_wfkq', ':', 'for', 'task', 'in', 'self', '.', 'wfkq_tasks', ':', 'if', 'task', '.', 'status', '!=', 'task', '.', 'S_OK', ':', 'continue', 'children', '=', 'self', '.', 'wfkq_task_children', '[', 'task', ']', 'if', 'all', '(', 'child', '.'...
This callback is called when one task reaches status `S_OK`. It removes the WFKQ file if all its children have reached `S_OK`.
['This', 'callback', 'is', 'called', 'when', 'one', 'task', 'reaches', 'status', 'S_OK', '.', 'It', 'removes', 'the', 'WFKQ', 'file', 'if', 'all', 'its', 'children', 'have', 'reached', 'S_OK', '.']
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L1780-L1804
3,110
pip-services3-python/pip-services3-commons-python
pip_services3_commons/config/ConfigParams.py
ConfigParams.add_section
def add_section(self, section, section_params): """ Adds parameters into this ConfigParams under specified section. Keys for the new parameters are appended with section dot prefix. :param section: name of the section where add new parameters :param section_params: new paramete...
python
def add_section(self, section, section_params): """ Adds parameters into this ConfigParams under specified section. Keys for the new parameters are appended with section dot prefix. :param section: name of the section where add new parameters :param section_params: new paramete...
['def', 'add_section', '(', 'self', ',', 'section', ',', 'section_params', ')', ':', 'if', 'section', '==', 'None', ':', 'raise', 'Exception', '(', '"Section name cannot be null"', ')', 'section', '=', '""', 'if', 'self', '.', '_is_shadow_name', '(', 'section', ')', 'else', 'section', 'if', 'section_params', '==', 'Non...
Adds parameters into this ConfigParams under specified section. Keys for the new parameters are appended with section dot prefix. :param section: name of the section where add new parameters :param section_params: new parameters to be added.
['Adds', 'parameters', 'into', 'this', 'ConfigParams', 'under', 'specified', 'section', '.', 'Keys', 'for', 'the', 'new', 'parameters', 'are', 'appended', 'with', 'section', 'dot', 'prefix', '.']
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/config/ConfigParams.py#L111-L136
3,111
hover2pi/svo_filters
svo_filters/svo.py
Filter.info
def info(self, fetch=False): """ Print a table of info about the current filter """ # Get the info from the class tp = (int, bytes, bool, str, float, tuple, list, np.ndarray) info = [[k, str(v)] for k, v in vars(self).items() if isinstance(v, tp) and k not...
python
def info(self, fetch=False): """ Print a table of info about the current filter """ # Get the info from the class tp = (int, bytes, bool, str, float, tuple, list, np.ndarray) info = [[k, str(v)] for k, v in vars(self).items() if isinstance(v, tp) and k not...
['def', 'info', '(', 'self', ',', 'fetch', '=', 'False', ')', ':', '# Get the info from the class', 'tp', '=', '(', 'int', ',', 'bytes', ',', 'bool', ',', 'str', ',', 'float', ',', 'tuple', ',', 'list', ',', 'np', '.', 'ndarray', ')', 'info', '=', '[', '[', 'k', ',', 'str', '(', 'v', ')', ']', 'for', 'k', ',', 'v', 'in...
Print a table of info about the current filter
['Print', 'a', 'table', 'of', 'info', 'about', 'the', 'current', 'filter']
train
https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L417-L436
3,112
cariad/py-wpconfigr
wpconfigr/wp_config_string.py
WpConfigString.set
def set(self, key, value): """ Updates the value of the given key in the loaded content. Args: key (str): Key of the property to update. value (str): New value of the property. Return: bool: Indicates whether or not a change was made. """ ...
python
def set(self, key, value): """ Updates the value of the given key in the loaded content. Args: key (str): Key of the property to update. value (str): New value of the property. Return: bool: Indicates whether or not a change was made. """ ...
['def', 'set', '(', 'self', ',', 'key', ',', 'value', ')', ':', 'match', '=', 'self', '.', '_get_match', '(', 'key', '=', 'key', ')', 'if', 'not', 'match', ':', 'self', '.', '_log', '.', 'info', '(', '\'"%s" does not exist, so it will be added.\'', ',', 'key', ')', 'if', 'isinstance', '(', 'value', ',', 'str', ')', ':'...
Updates the value of the given key in the loaded content. Args: key (str): Key of the property to update. value (str): New value of the property. Return: bool: Indicates whether or not a change was made.
['Updates', 'the', 'value', 'of', 'the', 'given', 'key', 'in', 'the', 'loaded', 'content', '.']
train
https://github.com/cariad/py-wpconfigr/blob/8f25bb849b72ce95957566544a2be8445316c818/wpconfigr/wp_config_string.py#L143-L204
3,113
census-instrumentation/opencensus-python
opencensus/metrics/export/gauge.py
DerivedGauge.create_time_series
def create_time_series(self, label_values, func): """Create a derived measurement to trac `func`. :type label_values: list(:class:`LabelValue`) :param label_values: The measurement's label values. :type func: function :param func: The function to track. :rtype: :class:...
python
def create_time_series(self, label_values, func): """Create a derived measurement to trac `func`. :type label_values: list(:class:`LabelValue`) :param label_values: The measurement's label values. :type func: function :param func: The function to track. :rtype: :class:...
['def', 'create_time_series', '(', 'self', ',', 'label_values', ',', 'func', ')', ':', 'if', 'label_values', 'is', 'None', ':', 'raise', 'ValueError', 'if', 'any', '(', 'lv', 'is', 'None', 'for', 'lv', 'in', 'label_values', ')', ':', 'raise', 'ValueError', 'if', 'len', '(', 'label_values', ')', '!=', 'self', '.', '_len...
Create a derived measurement to trac `func`. :type label_values: list(:class:`LabelValue`) :param label_values: The measurement's label values. :type func: function :param func: The function to track. :rtype: :class:`DerivedGaugePoint` :return: A read-only measurement ...
['Create', 'a', 'derived', 'measurement', 'to', 'trac', 'func', '.']
train
https://github.com/census-instrumentation/opencensus-python/blob/992b223f7e34c5dcb65922b7d5c827e7a1351e7d/opencensus/metrics/export/gauge.py#L412-L432
3,114
pantsbuild/pants
src/python/pants/backend/jvm/subsystems/jar_dependency_management.py
JarDependencyManagement.targets_by_artifact_set
def targets_by_artifact_set(self, targets): """Partitions the input targets by the sets of pinned artifacts they are managed by. :param collections.Iterable targets: the input targets (typically just JarLibrary targets). :return: a mapping of PinnedJarArtifactSet -> list of targets. :rtype: dict ""...
python
def targets_by_artifact_set(self, targets): """Partitions the input targets by the sets of pinned artifacts they are managed by. :param collections.Iterable targets: the input targets (typically just JarLibrary targets). :return: a mapping of PinnedJarArtifactSet -> list of targets. :rtype: dict ""...
['def', 'targets_by_artifact_set', '(', 'self', ',', 'targets', ')', ':', 'sets_to_targets', '=', 'defaultdict', '(', 'list', ')', 'for', 'target', 'in', 'targets', ':', 'sets_to_targets', '[', 'self', '.', 'for_target', '(', 'target', ')', ']', '.', 'append', '(', 'target', ')', 'return', 'dict', '(', 'sets_to_targets...
Partitions the input targets by the sets of pinned artifacts they are managed by. :param collections.Iterable targets: the input targets (typically just JarLibrary targets). :return: a mapping of PinnedJarArtifactSet -> list of targets. :rtype: dict
['Partitions', 'the', 'input', 'targets', 'by', 'the', 'sets', 'of', 'pinned', 'artifacts', 'they', 'are', 'managed', 'by', '.']
train
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/backend/jvm/subsystems/jar_dependency_management.py#L164-L174
3,115
appointlet/span
span/__init__.py
Span.encompassed_by
def encompassed_by(self, span): """ Returns true if the given span encompasses this span. """ if isinstance(span, list): return [sp for sp in span if sp.encompasses(self)] return span.encompasses(self)
python
def encompassed_by(self, span): """ Returns true if the given span encompasses this span. """ if isinstance(span, list): return [sp for sp in span if sp.encompasses(self)] return span.encompasses(self)
['def', 'encompassed_by', '(', 'self', ',', 'span', ')', ':', 'if', 'isinstance', '(', 'span', ',', 'list', ')', ':', 'return', '[', 'sp', 'for', 'sp', 'in', 'span', 'if', 'sp', '.', 'encompasses', '(', 'self', ')', ']', 'return', 'span', '.', 'encompasses', '(', 'self', ')']
Returns true if the given span encompasses this span.
['Returns', 'true', 'if', 'the', 'given', 'span', 'encompasses', 'this', 'span', '.']
train
https://github.com/appointlet/span/blob/6d4f2920e45df827890ebe55b1c41b1f3414c0c9/span/__init__.py#L77-L84
3,116
iskandr/fancyimpute
fancyimpute/iterative_imputer.py
is_scalar_nan
def is_scalar_nan(x): """Tests if x is NaN This function is meant to overcome the issue that np.isnan does not allow non-numerical types as input, and that np.nan is not np.float('nan'). Parameters ---------- x : any type Returns ------- boolean Examples -------- >>> is_s...
python
def is_scalar_nan(x): """Tests if x is NaN This function is meant to overcome the issue that np.isnan does not allow non-numerical types as input, and that np.nan is not np.float('nan'). Parameters ---------- x : any type Returns ------- boolean Examples -------- >>> is_s...
['def', 'is_scalar_nan', '(', 'x', ')', ':', '# convert from numpy.bool_ to python bool to ensure that testing', '# is_scalar_nan(x) is True does not fail.', "# Redondant np.floating is needed because numbers can't match np.float32", '# in python 2.', 'return', 'bool', '(', 'isinstance', '(', 'x', ',', '(', 'numbers', ...
Tests if x is NaN This function is meant to overcome the issue that np.isnan does not allow non-numerical types as input, and that np.nan is not np.float('nan'). Parameters ---------- x : any type Returns ------- boolean Examples -------- >>> is_scalar_nan(np.nan) True ...
['Tests', 'if', 'x', 'is', 'NaN', 'This', 'function', 'is', 'meant', 'to', 'overcome', 'the', 'issue', 'that', 'np', '.', 'isnan', 'does', 'not', 'allow', 'non', '-', 'numerical', 'types', 'as', 'input', 'and', 'that', 'np', '.', 'nan', 'is', 'not', 'np', '.', 'float', '(', 'nan', ')', '.', 'Parameters', '----------', ...
train
https://github.com/iskandr/fancyimpute/blob/9f0837d387c7303d5c8c925a9989ca77a1a96e3e/fancyimpute/iterative_imputer.py#L59-L87
3,117
noahbenson/neuropythy
neuropythy/util/core.py
dataframe_select
def dataframe_select(df, *cols, **filters): ''' dataframe_select(df, k1=v1, k2=v2...) yields df after selecting all the columns in which the given keys (k1, k2, etc.) have been selected such that the associated columns in the dataframe contain only the rows whose cells match the given values. da...
python
def dataframe_select(df, *cols, **filters): ''' dataframe_select(df, k1=v1, k2=v2...) yields df after selecting all the columns in which the given keys (k1, k2, etc.) have been selected such that the associated columns in the dataframe contain only the rows whose cells match the given values. da...
['def', 'dataframe_select', '(', 'df', ',', '*', 'cols', ',', '*', '*', 'filters', ')', ':', 'ii', '=', 'np', '.', 'ones', '(', 'len', '(', 'df', ')', ',', 'dtype', '=', "'bool'", ')', 'for', '(', 'k', ',', 'v', ')', 'in', 'six', '.', 'iteritems', '(', 'filters', ')', ':', 'vals', '=', 'df', '[', 'k', ']', '.', 'values...
dataframe_select(df, k1=v1, k2=v2...) yields df after selecting all the columns in which the given keys (k1, k2, etc.) have been selected such that the associated columns in the dataframe contain only the rows whose cells match the given values. dataframe_select(df, col1, col2...) selects the given colu...
['dataframe_select', '(', 'df', 'k1', '=', 'v1', 'k2', '=', 'v2', '...', ')', 'yields', 'df', 'after', 'selecting', 'all', 'the', 'columns', 'in', 'which', 'the', 'given', 'keys', '(', 'k1', 'k2', 'etc', '.', ')', 'have', 'been', 'selected', 'such', 'that', 'the', 'associated', 'columns', 'in', 'the', 'dataframe', 'con...
train
https://github.com/noahbenson/neuropythy/blob/b588889f6db36ddb9602ae4a72c1c0d3f41586b2/neuropythy/util/core.py#L296-L318
3,118
nickjj/flask-webpack
flask_webpack/__init__.py
Webpack.javascript_tag
def javascript_tag(self, *args): """ Convenience tag to output 1 or more javascript tags. :param args: 1 or more javascript file names :return: Script tag(s) containing the asset """ tags = [] for arg in args: asset_path = self.asset_url_for('{0}.js'...
python
def javascript_tag(self, *args): """ Convenience tag to output 1 or more javascript tags. :param args: 1 or more javascript file names :return: Script tag(s) containing the asset """ tags = [] for arg in args: asset_path = self.asset_url_for('{0}.js'...
['def', 'javascript_tag', '(', 'self', ',', '*', 'args', ')', ':', 'tags', '=', '[', ']', 'for', 'arg', 'in', 'args', ':', 'asset_path', '=', 'self', '.', 'asset_url_for', '(', "'{0}.js'", '.', 'format', '(', 'arg', ')', ')', 'if', 'asset_path', ':', 'tags', '.', 'append', '(', '\'<script src="{0}"></script>\'', '.', '...
Convenience tag to output 1 or more javascript tags. :param args: 1 or more javascript file names :return: Script tag(s) containing the asset
['Convenience', 'tag', 'to', 'output', '1', 'or', 'more', 'javascript', 'tags', '.']
train
https://github.com/nickjj/flask-webpack/blob/241617c6ce0fd9ec11f507204958ddd0ec467634/flask_webpack/__init__.py#L81-L95
3,119
pjamesjoyce/lcopt
lcopt/settings.py
LcoptSettings.write
def write(self): """write the current settings to the config file""" with open(storage.config_file, 'w') as cfg: yaml.dump(self.as_dict(), cfg, default_flow_style=False) storage.refresh()
python
def write(self): """write the current settings to the config file""" with open(storage.config_file, 'w') as cfg: yaml.dump(self.as_dict(), cfg, default_flow_style=False) storage.refresh()
['def', 'write', '(', 'self', ')', ':', 'with', 'open', '(', 'storage', '.', 'config_file', ',', "'w'", ')', 'as', 'cfg', ':', 'yaml', '.', 'dump', '(', 'self', '.', 'as_dict', '(', ')', ',', 'cfg', ',', 'default_flow_style', '=', 'False', ')', 'storage', '.', 'refresh', '(', ')']
write the current settings to the config file
['write', 'the', 'current', 'settings', 'to', 'the', 'config', 'file']
train
https://github.com/pjamesjoyce/lcopt/blob/3f1caca31fece4a3068a384900707e6d21d04597/lcopt/settings.py#L98-L103
3,120
Kozea/cairocffi
cairocffi/context.py
Context.get_source
def get_source(self): """Return this context’s source. :returns: An instance of :class:`Pattern` or one of its sub-classes, a new Python object referencing the existing cairo pattern. """ return Pattern._from_pointer( cairo.cairo_get_source(self._poi...
python
def get_source(self): """Return this context’s source. :returns: An instance of :class:`Pattern` or one of its sub-classes, a new Python object referencing the existing cairo pattern. """ return Pattern._from_pointer( cairo.cairo_get_source(self._poi...
['def', 'get_source', '(', 'self', ')', ':', 'return', 'Pattern', '.', '_from_pointer', '(', 'cairo', '.', 'cairo_get_source', '(', 'self', '.', '_pointer', ')', ',', 'incref', '=', 'True', ')']
Return this context’s source. :returns: An instance of :class:`Pattern` or one of its sub-classes, a new Python object referencing the existing cairo pattern.
['Return', 'this', 'context’s', 'source', '.']
train
https://github.com/Kozea/cairocffi/blob/450853add7e32eea20985b6aa5f54d9cb3cd04fe/cairocffi/context.py#L395-L404
3,121
apple/turicreate
src/unity/python/turicreate/data_structures/sframe.py
SFrame.select_columns
def select_columns(self, column_names): """ Selects all columns where the name of the column or the type of column is included in the column_names. An exception is raised if duplicate columns are selected i.e. sf.select_columns(['a','a']), or non-existent columns are selected. ...
python
def select_columns(self, column_names): """ Selects all columns where the name of the column or the type of column is included in the column_names. An exception is raised if duplicate columns are selected i.e. sf.select_columns(['a','a']), or non-existent columns are selected. ...
['def', 'select_columns', '(', 'self', ',', 'column_names', ')', ':', 'if', 'not', '_is_non_string_iterable', '(', 'column_names', ')', ':', 'raise', 'TypeError', '(', '"column_names must be an iterable"', ')', 'if', 'not', '(', 'all', '(', '[', 'isinstance', '(', 'x', ',', 'six', '.', 'string_types', ')', 'or', 'isins...
Selects all columns where the name of the column or the type of column is included in the column_names. An exception is raised if duplicate columns are selected i.e. sf.select_columns(['a','a']), or non-existent columns are selected. Throws an exception for all other input types. ...
['Selects', 'all', 'columns', 'where', 'the', 'name', 'of', 'the', 'column', 'or', 'the', 'type', 'of', 'column', 'is', 'included', 'in', 'the', 'column_names', '.', 'An', 'exception', 'is', 'raised', 'if', 'duplicate', 'columns', 'are', 'selected', 'i', '.', 'e', '.', 'sf', '.', 'select_columns', '(', '[', 'a', 'a', '...
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L3062-L3137
3,122
Spinmob/spinmob
_data.py
fitter.set_guess_to_fit_result
def set_guess_to_fit_result(self): """ If you have a fit result, set the guess parameters to the fit parameters. """ if self.results is None: print("No fit results to use! Run fit() first.") return # loop over the results and set the guess values ...
python
def set_guess_to_fit_result(self): """ If you have a fit result, set the guess parameters to the fit parameters. """ if self.results is None: print("No fit results to use! Run fit() first.") return # loop over the results and set the guess values ...
['def', 'set_guess_to_fit_result', '(', 'self', ')', ':', 'if', 'self', '.', 'results', 'is', 'None', ':', 'print', '(', '"No fit results to use! Run fit() first."', ')', 'return', '# loop over the results and set the guess values', 'for', 'n', 'in', 'range', '(', 'len', '(', 'self', '.', '_pguess', ')', ')', ':', 'sel...
If you have a fit result, set the guess parameters to the fit parameters.
['If', 'you', 'have', 'a', 'fit', 'result', 'set', 'the', 'guess', 'parameters', 'to', 'the', 'fit', 'parameters', '.']
train
https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L2080-L2094
3,123
sassoo/goldman
goldman/middleware/bearer_token/__init__.py
Middleware._get_token
def _get_token(self, req): """ Get the token from the Authorization header If the header is actually malformed where Bearer Auth was indicated by the request then an InvalidAuthSyntax exception is raised. Otherwise an AuthRequired exception since it's unclear in this scenario if...
python
def _get_token(self, req): """ Get the token from the Authorization header If the header is actually malformed where Bearer Auth was indicated by the request then an InvalidAuthSyntax exception is raised. Otherwise an AuthRequired exception since it's unclear in this scenario if...
['def', '_get_token', '(', 'self', ',', 'req', ')', ':', 'self', '.', '_validate_auth_scheme', '(', 'req', ')', 'try', ':', 'return', 'naked', '(', 'req', '.', 'auth', '.', 'split', '(', "' '", ')', '[', '1', ']', ')', 'except', 'IndexError', ':', 'desc', '=', "'You are using the Bearer Authentication scheme as '", "'r...
Get the token from the Authorization header If the header is actually malformed where Bearer Auth was indicated by the request then an InvalidAuthSyntax exception is raised. Otherwise an AuthRequired exception since it's unclear in this scenario if the requestor was even aware A...
['Get', 'the', 'token', 'from', 'the', 'Authorization', 'header']
train
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/middleware/bearer_token/__init__.py#L123-L154
3,124
neuropsychology/NeuroKit.py
neurokit/statistics/statistics.py
find_following_duplicates
def find_following_duplicates(array): """ Find the duplicates that are following themselves. Parameters ---------- array : list or ndarray A list containing duplicates. Returns ---------- uniques : list A list containing True for each unique and False for following dup...
python
def find_following_duplicates(array): """ Find the duplicates that are following themselves. Parameters ---------- array : list or ndarray A list containing duplicates. Returns ---------- uniques : list A list containing True for each unique and False for following dup...
['def', 'find_following_duplicates', '(', 'array', ')', ':', 'array', '=', 'array', '[', ':', ']', 'uniques', '=', '[', ']', 'for', 'i', 'in', 'range', '(', 'len', '(', 'array', ')', ')', ':', 'if', 'i', '==', '0', ':', 'uniques', '.', 'append', '(', 'True', ')', 'else', ':', 'if', 'array', '[', 'i', ']', '==', 'array'...
Find the duplicates that are following themselves. Parameters ---------- array : list or ndarray A list containing duplicates. Returns ---------- uniques : list A list containing True for each unique and False for following duplicates. Example ---------- >>> impor...
['Find', 'the', 'duplicates', 'that', 'are', 'following', 'themselves', '.']
train
https://github.com/neuropsychology/NeuroKit.py/blob/c9589348fbbde0fa7e986048c48f38e6b488adfe/neurokit/statistics/statistics.py#L219-L263
3,125
ocaballeror/LyricFetch
lyricfetch/scraping.py
musixmatch
def musixmatch(song): """ Returns the lyrics found in musixmatch for the specified mp3 file or an empty string if not found. """ escape = re.sub("'-¡¿", '', URLESCAPE) translate = { escape: '', ' ': '-' } artist = song.artist.title() artist = re.sub(r"( '|' )", '', ar...
python
def musixmatch(song): """ Returns the lyrics found in musixmatch for the specified mp3 file or an empty string if not found. """ escape = re.sub("'-¡¿", '', URLESCAPE) translate = { escape: '', ' ': '-' } artist = song.artist.title() artist = re.sub(r"( '|' )", '', ar...
['def', 'musixmatch', '(', 'song', ')', ':', 'escape', '=', 're', '.', 'sub', '(', '"\'-¡¿", ', "'", ', ', 'U', 'LESCAPE)', '', 'translate', '=', '{', 'escape', ':', "''", ',', "' '", ':', "'-'", '}', 'artist', '=', 'song', '.', 'artist', '.', 'title', '(', ')', 'artist', '=', 're', '.', 'sub', '(', 'r"( \'|\' )"', ','...
Returns the lyrics found in musixmatch for the specified mp3 file or an empty string if not found.
['Returns', 'the', 'lyrics', 'found', 'in', 'musixmatch', 'for', 'the', 'specified', 'mp3', 'file', 'or', 'an', 'empty', 'string', 'if', 'not', 'found', '.']
train
https://github.com/ocaballeror/LyricFetch/blob/86e62fb39c4c413ad7e1acf5bf0d28c9ed7c8fcb/lyricfetch/scraping.py#L283-L314
3,126
Auzzy/1846-routes
routes1846/find_best_routes.py
_filter_invalid_routes
def _filter_invalid_routes(routes, board, railroad): """ Given a collection of routes, returns a new set containing only valid routes. Invalid routes removed: - contain less than 2 cities, or - go through Chicago using an impassable exit - only contain Chicago as a station, but don't use the correct...
python
def _filter_invalid_routes(routes, board, railroad): """ Given a collection of routes, returns a new set containing only valid routes. Invalid routes removed: - contain less than 2 cities, or - go through Chicago using an impassable exit - only contain Chicago as a station, but don't use the correct...
['def', '_filter_invalid_routes', '(', 'routes', ',', 'board', ',', 'railroad', ')', ':', 'chicago_space', '=', 'board', '.', 'get_space', '(', 'CHICAGO_CELL', ')', 'chicago_neighbor_cells', '=', '[', 'cell', 'for', 'cell', 'in', 'CHICAGO_CELL', '.', 'neighbors', '.', 'values', '(', ')', 'if', 'cell', '!=', 'CHICAGO_CO...
Given a collection of routes, returns a new set containing only valid routes. Invalid routes removed: - contain less than 2 cities, or - go through Chicago using an impassable exit - only contain Chicago as a station, but don't use the correct exit path This fltering after the fact keeps the path findi...
['Given', 'a', 'collection', 'of', 'routes', 'returns', 'a', 'new', 'set', 'containing', 'only', 'valid', 'routes', '.', 'Invalid', 'routes', 'removed', ':', '-', 'contain', 'less', 'than', '2', 'cities', 'or', '-', 'go', 'through', 'Chicago', 'using', 'an', 'impassable', 'exit', '-', 'only', 'contain', 'Chicago', 'as'...
train
https://github.com/Auzzy/1846-routes/blob/60c90928e184cbcc09c9fef46c2df07f5f14c2c2/routes1846/find_best_routes.py#L171-L224
3,127
apple/turicreate
src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py
convert_elementwise_mul_scalar
def convert_elementwise_mul_scalar(net, node, module, builder): """Convert a scalar multiplication from mxnet to coreml. Parameters ---------- net: network A mxnet network object. node: layer Node to convert. module: module An module for MXNet builder: NeuralNetwo...
python
def convert_elementwise_mul_scalar(net, node, module, builder): """Convert a scalar multiplication from mxnet to coreml. Parameters ---------- net: network A mxnet network object. node: layer Node to convert. module: module An module for MXNet builder: NeuralNetwo...
['def', 'convert_elementwise_mul_scalar', '(', 'net', ',', 'node', ',', 'module', ',', 'builder', ')', ':', 'import', 'numpy', 'input_name', ',', 'output_name', '=', '_get_input_output_name', '(', 'net', ',', 'node', ')', 'name', '=', 'node', '[', "'name'", ']', 'param', '=', '_get_attr', '(', 'node', ')', 'mult', '=',...
Convert a scalar multiplication from mxnet to coreml. Parameters ---------- net: network A mxnet network object. node: layer Node to convert. module: module An module for MXNet builder: NeuralNetworkBuilder A neural network builder object.
['Convert', 'a', 'scalar', 'multiplication', 'from', 'mxnet', 'to', 'coreml', '.']
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L224-L252
3,128
pydata/xarray
xarray/coding/cftimeindex.py
_parsed_string_to_bounds
def _parsed_string_to_bounds(date_type, resolution, parsed): """Generalization of pandas.tseries.index.DatetimeIndex._parsed_string_to_bounds for use with non-standard calendars and cftime.datetime objects. """ if resolution == 'year': return (date_type(parsed.year, 1, 1), ...
python
def _parsed_string_to_bounds(date_type, resolution, parsed): """Generalization of pandas.tseries.index.DatetimeIndex._parsed_string_to_bounds for use with non-standard calendars and cftime.datetime objects. """ if resolution == 'year': return (date_type(parsed.year, 1, 1), ...
['def', '_parsed_string_to_bounds', '(', 'date_type', ',', 'resolution', ',', 'parsed', ')', ':', 'if', 'resolution', '==', "'year'", ':', 'return', '(', 'date_type', '(', 'parsed', '.', 'year', ',', '1', ',', '1', ')', ',', 'date_type', '(', 'parsed', '.', 'year', '+', '1', ',', '1', ',', '1', ')', '-', 'timedelta', '...
Generalization of pandas.tseries.index.DatetimeIndex._parsed_string_to_bounds for use with non-standard calendars and cftime.datetime objects.
['Generalization', 'of', 'pandas', '.', 'tseries', '.', 'index', '.', 'DatetimeIndex', '.', '_parsed_string_to_bounds', 'for', 'use', 'with', 'non', '-', 'standard', 'calendars', 'and', 'cftime', '.', 'datetime', 'objects', '.']
train
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/coding/cftimeindex.py#L117-L148
3,129
jtpaasch/simplygithub
simplygithub/branches.py
update_branch
def update_branch(profile, name, sha): """Move a branch's HEAD to a new SHA. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. ...
python
def update_branch(profile, name, sha): """Move a branch's HEAD to a new SHA. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. ...
['def', 'update_branch', '(', 'profile', ',', 'name', ',', 'sha', ')', ':', 'ref', '=', '"heads/"', '+', 'name', 'data', '=', 'refs', '.', 'update_ref', '(', 'profile', ',', 'ref', ',', 'sha', ')', 'return', 'data']
Move a branch's HEAD to a new SHA. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. name The name of the branch to ...
['Move', 'a', 'branch', 's', 'HEAD', 'to', 'a', 'new', 'SHA', '.']
train
https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/branches.py#L98-L120
3,130
google/grr
grr/core/grr_response_core/lib/utils.py
Xor
def Xor(bytestr, key): """Returns a `bytes` object where each byte has been xored with key.""" # TODO(hanuszczak): Remove this import when string migration is done. # pytype: disable=import-error from builtins import bytes # pylint: disable=redefined-builtin, g-import-not-at-top # pytype: enable=import-error...
python
def Xor(bytestr, key): """Returns a `bytes` object where each byte has been xored with key.""" # TODO(hanuszczak): Remove this import when string migration is done. # pytype: disable=import-error from builtins import bytes # pylint: disable=redefined-builtin, g-import-not-at-top # pytype: enable=import-error...
['def', 'Xor', '(', 'bytestr', ',', 'key', ')', ':', '# TODO(hanuszczak): Remove this import when string migration is done.', '# pytype: disable=import-error', 'from', 'builtins', 'import', 'bytes', '# pylint: disable=redefined-builtin, g-import-not-at-top', '# pytype: enable=import-error', 'precondition', '.', 'Assert...
Returns a `bytes` object where each byte has been xored with key.
['Returns', 'a', 'bytes', 'object', 'where', 'each', 'byte', 'has', 'been', 'xored', 'with', 'key', '.']
train
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/utils.py#L535-L551
3,131
commonsense/metanl
metanl/mecab.py
MeCabWrapper.is_stopword_record
def is_stopword_record(self, record): """ Determine whether a single MeCab record represents a stopword. This mostly determines words to strip based on their parts of speech. If common_words is set to True (default), it will also strip common verbs and nouns such as くる and よう. I...
python
def is_stopword_record(self, record): """ Determine whether a single MeCab record represents a stopword. This mostly determines words to strip based on their parts of speech. If common_words is set to True (default), it will also strip common verbs and nouns such as くる and よう. I...
['def', 'is_stopword_record', '(', 'self', ',', 'record', ')', ':', '# preserve negations', 'if', 'record', '.', 'root', '==', "'ない':", '', 'return', 'False', 'return', '(', 'record', '.', 'pos', 'in', 'STOPWORD_CATEGORIES', 'or', 'record', '.', 'subclass1', 'in', 'STOPWORD_CATEGORIES', 'or', 'record', '.', 'root', 'in...
Determine whether a single MeCab record represents a stopword. This mostly determines words to strip based on their parts of speech. If common_words is set to True (default), it will also strip common verbs and nouns such as くる and よう. If more_stopwords is True, it will look at the sub-...
['Determine', 'whether', 'a', 'single', 'MeCab', 'record', 'represents', 'a', 'stopword', '.']
train
https://github.com/commonsense/metanl/blob/4b9ae8353489cc409bebd7e1fe10ab5b527b078e/metanl/mecab.py#L162-L178
3,132
PSPC-SPAC-buyandsell/von_anchor
von_anchor/anchor/issuer.py
Issuer.get_box_ids_issued
async def get_box_ids_issued(self) -> str: """ Return json object on lists of all unique box identifiers (schema identifiers, credential definition identifiers, and revocation registry identifiers) for all credential definitions and credentials issued; e.g., :: { ...
python
async def get_box_ids_issued(self) -> str: """ Return json object on lists of all unique box identifiers (schema identifiers, credential definition identifiers, and revocation registry identifiers) for all credential definitions and credentials issued; e.g., :: { ...
['async', 'def', 'get_box_ids_issued', '(', 'self', ')', '->', 'str', ':', 'LOGGER', '.', 'debug', '(', "'Issuer.get_box_ids_issued >>>'", ')', 'cd_ids', '=', '[', 'd', 'for', 'd', 'in', 'listdir', '(', 'self', '.', 'dir_tails', ')', 'if', 'isdir', '(', 'join', '(', 'self', '.', 'dir_tails', ',', 'd', ')', ')', 'and', ...
Return json object on lists of all unique box identifiers (schema identifiers, credential definition identifiers, and revocation registry identifiers) for all credential definitions and credentials issued; e.g., :: { "schema_id": [ "R17v42T4pk......
['Return', 'json', 'object', 'on', 'lists', 'of', 'all', 'unique', 'box', 'identifiers', '(', 'schema', 'identifiers', 'credential', 'definition', 'identifiers', 'and', 'revocation', 'registry', 'identifiers', ')', 'for', 'all', 'credential', 'definitions', 'and', 'credentials', 'issued', ';', 'e', '.', 'g', '.']
train
https://github.com/PSPC-SPAC-buyandsell/von_anchor/blob/78ac1de67be42a676274f4bf71fe12f66e72f309/von_anchor/anchor/issuer.py#L624-L679
3,133
kensho-technologies/graphql-compiler
graphql_compiler/schema_generation/schema_graph.py
_validate_non_abstract_edge_has_defined_endpoint_types
def _validate_non_abstract_edge_has_defined_endpoint_types(class_name, properties): """Validate that the non-abstract edge properties dict has defined in/out link properties.""" edge_source = properties.get(EDGE_SOURCE_PROPERTY_NAME, None) edge_destination = properties.get(EDGE_DESTINATION_PROPERTY_NAME, No...
python
def _validate_non_abstract_edge_has_defined_endpoint_types(class_name, properties): """Validate that the non-abstract edge properties dict has defined in/out link properties.""" edge_source = properties.get(EDGE_SOURCE_PROPERTY_NAME, None) edge_destination = properties.get(EDGE_DESTINATION_PROPERTY_NAME, No...
['def', '_validate_non_abstract_edge_has_defined_endpoint_types', '(', 'class_name', ',', 'properties', ')', ':', 'edge_source', '=', 'properties', '.', 'get', '(', 'EDGE_SOURCE_PROPERTY_NAME', ',', 'None', ')', 'edge_destination', '=', 'properties', '.', 'get', '(', 'EDGE_DESTINATION_PROPERTY_NAME', ',', 'None', ')', ...
Validate that the non-abstract edge properties dict has defined in/out link properties.
['Validate', 'that', 'the', 'non', '-', 'abstract', 'edge', 'properties', 'dict', 'has', 'defined', 'in', '/', 'out', 'link', 'properties', '.']
train
https://github.com/kensho-technologies/graphql-compiler/blob/f6079c6d10f64932f6b3af309b79bcea2123ca8f/graphql_compiler/schema_generation/schema_graph.py#L16-L26
3,134
quantopian/zipline
zipline/pipeline/factors/factor.py
Factor.demean
def demean(self, mask=NotSpecified, groupby=NotSpecified): """ Construct a Factor that computes ``self`` and subtracts the mean from row of the result. If ``mask`` is supplied, ignore values where ``mask`` returns False when computing row means, and output NaN anywhere the mask ...
python
def demean(self, mask=NotSpecified, groupby=NotSpecified): """ Construct a Factor that computes ``self`` and subtracts the mean from row of the result. If ``mask`` is supplied, ignore values where ``mask`` returns False when computing row means, and output NaN anywhere the mask ...
['def', 'demean', '(', 'self', ',', 'mask', '=', 'NotSpecified', ',', 'groupby', '=', 'NotSpecified', ')', ':', 'return', 'GroupedRowTransform', '(', 'transform', '=', 'demean', ',', 'transform_args', '=', '(', ')', ',', 'factor', '=', 'self', ',', 'groupby', '=', 'groupby', ',', 'dtype', '=', 'self', '.', 'dtype', ','...
Construct a Factor that computes ``self`` and subtracts the mean from row of the result. If ``mask`` is supplied, ignore values where ``mask`` returns False when computing row means, and output NaN anywhere the mask is False. If ``groupby`` is supplied, compute by partitioning each row...
['Construct', 'a', 'Factor', 'that', 'computes', 'self', 'and', 'subtracts', 'the', 'mean', 'from', 'row', 'of', 'the', 'result', '.']
train
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L402-L524
3,135
cmorisse/ikp3db
ikp3db.py
IKBreakpoint.restore_breakpoints_state
def restore_breakpoints_state(cls, breakpoints_state_list): """Restore the state of breakpoints given a list provided by backup_breakpoints_state(). If list of breakpoint has changed since backup missing or added breakpoints are ignored. breakpoints_state_list is a list of tup...
python
def restore_breakpoints_state(cls, breakpoints_state_list): """Restore the state of breakpoints given a list provided by backup_breakpoints_state(). If list of breakpoint has changed since backup missing or added breakpoints are ignored. breakpoints_state_list is a list of tup...
['def', 'restore_breakpoints_state', '(', 'cls', ',', 'breakpoints_state_list', ')', ':', 'for', 'breakpoint_state', 'in', 'breakpoints_state_list', ':', 'bp', '=', 'cls', '.', 'breakpoints_by_number', '[', 'breakpoint_state', '[', '0', ']', ']', 'if', 'bp', ':', 'bp', '.', 'enabled', '=', 'breakpoint_state', '[', '1',...
Restore the state of breakpoints given a list provided by backup_breakpoints_state(). If list of breakpoint has changed since backup missing or added breakpoints are ignored. breakpoints_state_list is a list of tuple. Each tuple is of form: (breakpoint_number, enabled, conditi...
['Restore', 'the', 'state', 'of', 'breakpoints', 'given', 'a', 'list', 'provided', 'by', 'backup_breakpoints_state', '()', '.', 'If', 'list', 'of', 'breakpoint', 'has', 'changed', 'since', 'backup', 'missing', 'or', 'added', 'breakpoints', 'are', 'ignored', '.', 'breakpoints_state_list', 'is', 'a', 'list', 'of', 'tuple...
train
https://github.com/cmorisse/ikp3db/blob/a0f318d4e8494b2e6f2f07ec0f1202ca023c920f/ikp3db.py#L559-L573
3,136
inspirehep/inspire-dojson
inspire_dojson/hepnames/rules.py
name
def name(self, key, value): """Populate the ``name`` key. Also populates the ``status``, ``birth_date`` and ``death_date`` keys through side effects. """ def _get_title(value): c_value = force_single_element(value.get('c', '')) if c_value != 'title (e.g. Sir)': return c_valu...
python
def name(self, key, value): """Populate the ``name`` key. Also populates the ``status``, ``birth_date`` and ``death_date`` keys through side effects. """ def _get_title(value): c_value = force_single_element(value.get('c', '')) if c_value != 'title (e.g. Sir)': return c_valu...
['def', 'name', '(', 'self', ',', 'key', ',', 'value', ')', ':', 'def', '_get_title', '(', 'value', ')', ':', 'c_value', '=', 'force_single_element', '(', 'value', '.', 'get', '(', "'c'", ',', "''", ')', ')', 'if', 'c_value', '!=', "'title (e.g. Sir)'", ':', 'return', 'c_value', 'def', '_get_value', '(', 'value', ')', ...
Populate the ``name`` key. Also populates the ``status``, ``birth_date`` and ``death_date`` keys through side effects.
['Populate', 'the', 'name', 'key', '.']
train
https://github.com/inspirehep/inspire-dojson/blob/17f3789cd3d5ae58efa1190dc0eea9efb9c8ca59/inspire_dojson/hepnames/rules.py#L176-L209
3,137
aodag/WebDispatch
webdispatch/uritemplate.py
URITemplate.convert_values
def convert_values(self, matchdict: Dict[str, str]) -> Dict[str, Any]: """ convert values of ``matchdict`` with converter this object has.""" converted = {} for varname, value in matchdict.items(): converter = self.converters[varname] converted[varname] = convert...
python
def convert_values(self, matchdict: Dict[str, str]) -> Dict[str, Any]: """ convert values of ``matchdict`` with converter this object has.""" converted = {} for varname, value in matchdict.items(): converter = self.converters[varname] converted[varname] = convert...
['def', 'convert_values', '(', 'self', ',', 'matchdict', ':', 'Dict', '[', 'str', ',', 'str', ']', ')', '->', 'Dict', '[', 'str', ',', 'Any', ']', ':', 'converted', '=', '{', '}', 'for', 'varname', ',', 'value', 'in', 'matchdict', '.', 'items', '(', ')', ':', 'converter', '=', 'self', '.', 'converters', '[', 'varname',...
convert values of ``matchdict`` with converter this object has.
['convert', 'values', 'of', 'matchdict', 'with', 'converter', 'this', 'object', 'has', '.']
train
https://github.com/aodag/WebDispatch/blob/55f8658a2b4100498e098a80303a346c3940f1bc/webdispatch/uritemplate.py#L136-L144
3,138
Cadair/jupyter_environment_kernels
environment_kernels/activate_helper.py
source_bash
def source_bash(args, stdin=None): """Simply bash-specific wrapper around source-foreign Returns a dict to be used as a new environment""" args = list(args) new_args = ['bash', '--sourcer=source'] new_args.extend(args) return source_foreign(new_args, stdin=stdin)
python
def source_bash(args, stdin=None): """Simply bash-specific wrapper around source-foreign Returns a dict to be used as a new environment""" args = list(args) new_args = ['bash', '--sourcer=source'] new_args.extend(args) return source_foreign(new_args, stdin=stdin)
['def', 'source_bash', '(', 'args', ',', 'stdin', '=', 'None', ')', ':', 'args', '=', 'list', '(', 'args', ')', 'new_args', '=', '[', "'bash'", ',', "'--sourcer=source'", ']', 'new_args', '.', 'extend', '(', 'args', ')', 'return', 'source_foreign', '(', 'new_args', ',', 'stdin', '=', 'stdin', ')']
Simply bash-specific wrapper around source-foreign Returns a dict to be used as a new environment
['Simply', 'bash', '-', 'specific', 'wrapper', 'around', 'source', '-', 'foreign']
train
https://github.com/Cadair/jupyter_environment_kernels/blob/3da304550b511bda7d5d39280379b5ca39bb31bc/environment_kernels/activate_helper.py#L66-L73
3,139
bcbio/bcbio-nextgen
bcbio/cwl/hpc.py
_get_filesystem_types
def _get_filesystem_types(args, sample_file): """Retrieve the types of inputs and staging based on sample JSON and arguments. """ out = set([]) ext = "" if args.no_container else "_container" with open(sample_file) as in_handle: for f in _get_file_paths(json.load(in_handle)): if ...
python
def _get_filesystem_types(args, sample_file): """Retrieve the types of inputs and staging based on sample JSON and arguments. """ out = set([]) ext = "" if args.no_container else "_container" with open(sample_file) as in_handle: for f in _get_file_paths(json.load(in_handle)): if ...
['def', '_get_filesystem_types', '(', 'args', ',', 'sample_file', ')', ':', 'out', '=', 'set', '(', '[', ']', ')', 'ext', '=', '""', 'if', 'args', '.', 'no_container', 'else', '"_container"', 'with', 'open', '(', 'sample_file', ')', 'as', 'in_handle', ':', 'for', 'f', 'in', '_get_file_paths', '(', 'json', '.', 'load', ...
Retrieve the types of inputs and staging based on sample JSON and arguments.
['Retrieve', 'the', 'types', 'of', 'inputs', 'and', 'staging', 'based', 'on', 'sample', 'JSON', 'and', 'arguments', '.']
train
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/hpc.py#L130-L145
3,140
foremast/foremast
src/foremast/autoscaling_policy/create_policy.py
AutoScalingPolicy.prepare_policy_template
def prepare_policy_template(self, scaling_type, period_sec, server_group): """Renders scaling policy templates based on configs and variables. After rendering, POSTs the json to Spinnaker for creation. Args: scaling_type (str): ``scale_up`` or ``scaling_down``. Type of policy ...
python
def prepare_policy_template(self, scaling_type, period_sec, server_group): """Renders scaling policy templates based on configs and variables. After rendering, POSTs the json to Spinnaker for creation. Args: scaling_type (str): ``scale_up`` or ``scaling_down``. Type of policy ...
['def', 'prepare_policy_template', '(', 'self', ',', 'scaling_type', ',', 'period_sec', ',', 'server_group', ')', ':', 'template_kwargs', '=', '{', "'app'", ':', 'self', '.', 'app', ',', "'env'", ':', 'self', '.', 'env', ',', "'region'", ':', 'self', '.', 'region', ',', "'server_group'", ':', 'server_group', ',', "'per...
Renders scaling policy templates based on configs and variables. After rendering, POSTs the json to Spinnaker for creation. Args: scaling_type (str): ``scale_up`` or ``scaling_down``. Type of policy period_sec (int): Period of time to look at metrics for determining scale ...
['Renders', 'scaling', 'policy', 'templates', 'based', 'on', 'configs', 'and', 'variables', '.', 'After', 'rendering', 'POSTs', 'the', 'json', 'to', 'Spinnaker', 'for', 'creation', '.']
train
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/autoscaling_policy/create_policy.py#L56-L88
3,141
googleapis/google-auth-library-python
google/oauth2/_client.py
refresh_grant
def refresh_grant(request, token_uri, refresh_token, client_id, client_secret): """Implements the OAuth 2.0 refresh token grant. For more details, see `rfc678 section 6`_. Args: request (google.auth.transport.Request): A callable used to make HTTP requests. token_uri (str): The...
python
def refresh_grant(request, token_uri, refresh_token, client_id, client_secret): """Implements the OAuth 2.0 refresh token grant. For more details, see `rfc678 section 6`_. Args: request (google.auth.transport.Request): A callable used to make HTTP requests. token_uri (str): The...
['def', 'refresh_grant', '(', 'request', ',', 'token_uri', ',', 'refresh_token', ',', 'client_id', ',', 'client_secret', ')', ':', 'body', '=', '{', "'grant_type'", ':', '_REFRESH_GRANT_TYPE', ',', "'client_id'", ':', 'client_id', ',', "'client_secret'", ':', 'client_secret', ',', "'refresh_token'", ':', 'refresh_token...
Implements the OAuth 2.0 refresh token grant. For more details, see `rfc678 section 6`_. Args: request (google.auth.transport.Request): A callable used to make HTTP requests. token_uri (str): The OAuth 2.0 authorizations server's token endpoint URI. refresh_toke...
['Implements', 'the', 'OAuth', '2', '.', '0', 'refresh', 'token', 'grant', '.']
train
https://github.com/googleapis/google-auth-library-python/blob/2c6ad78917e936f38f87c946209c8031166dc96e/google/oauth2/_client.py#L204-L249
3,142
bcbio/bcbio-nextgen
bcbio/variation/mutect.py
_config_params
def _config_params(base_config, assoc_files, region, out_file, items): """Add parameters based on configuration variables, associated files and genomic regions. """ params = [] dbsnp = assoc_files.get("dbsnp") if dbsnp: params += ["--dbsnp", dbsnp] cosmic = assoc_files.get("cosmic") ...
python
def _config_params(base_config, assoc_files, region, out_file, items): """Add parameters based on configuration variables, associated files and genomic regions. """ params = [] dbsnp = assoc_files.get("dbsnp") if dbsnp: params += ["--dbsnp", dbsnp] cosmic = assoc_files.get("cosmic") ...
['def', '_config_params', '(', 'base_config', ',', 'assoc_files', ',', 'region', ',', 'out_file', ',', 'items', ')', ':', 'params', '=', '[', ']', 'dbsnp', '=', 'assoc_files', '.', 'get', '(', '"dbsnp"', ')', 'if', 'dbsnp', ':', 'params', '+=', '[', '"--dbsnp"', ',', 'dbsnp', ']', 'cosmic', '=', 'assoc_files', '.', 'ge...
Add parameters based on configuration variables, associated files and genomic regions.
['Add', 'parameters', 'based', 'on', 'configuration', 'variables', 'associated', 'files', 'and', 'genomic', 'regions', '.']
train
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/mutect.py#L46-L75
3,143
Azure/azure-storage-python
azure-storage-file/azure/storage/file/fileservice.py
FileService.exists
def exists(self, share_name, directory_name=None, file_name=None, timeout=None, snapshot=None): ''' Returns a boolean indicating whether the share exists if only share name is given. If directory_name is specificed a boolean will be returned indicating if the directory exists. If file_na...
python
def exists(self, share_name, directory_name=None, file_name=None, timeout=None, snapshot=None): ''' Returns a boolean indicating whether the share exists if only share name is given. If directory_name is specificed a boolean will be returned indicating if the directory exists. If file_na...
['def', 'exists', '(', 'self', ',', 'share_name', ',', 'directory_name', '=', 'None', ',', 'file_name', '=', 'None', ',', 'timeout', '=', 'None', ',', 'snapshot', '=', 'None', ')', ':', '_validate_not_none', '(', "'share_name'", ',', 'share_name', ')', 'try', ':', 'request', '=', 'HTTPRequest', '(', ')', 'request', '.'...
Returns a boolean indicating whether the share exists if only share name is given. If directory_name is specificed a boolean will be returned indicating if the directory exists. If file_name is specified as well, a boolean will be returned indicating if the file exists. :param str share...
['Returns', 'a', 'boolean', 'indicating', 'whether', 'the', 'share', 'exists', 'if', 'only', 'share', 'name', 'is', 'given', '.', 'If', 'directory_name', 'is', 'specificed', 'a', 'boolean', 'will', 'be', 'returned', 'indicating', 'if', 'the', 'directory', 'exists', '.', 'If', 'file_name', 'is', 'specified', 'as', 'well...
train
https://github.com/Azure/azure-storage-python/blob/52327354b192cbcf6b7905118ec6b5d57fa46275/azure-storage-file/azure/storage/file/fileservice.py#L1260-L1307
3,144
wesm/feather
cpp/build-support/cpplint.py
_DropCommonSuffixes
def _DropCommonSuffixes(filename): """Drops common suffixes like _test.cc or -inl.h from filename. For example: >>> _DropCommonSuffixes('foo/foo-inl.h') 'foo/foo' >>> _DropCommonSuffixes('foo/bar/foo.cc') 'foo/bar/foo' >>> _DropCommonSuffixes('foo/foo_internal.h') 'foo/foo' >>> _DropCom...
python
def _DropCommonSuffixes(filename): """Drops common suffixes like _test.cc or -inl.h from filename. For example: >>> _DropCommonSuffixes('foo/foo-inl.h') 'foo/foo' >>> _DropCommonSuffixes('foo/bar/foo.cc') 'foo/bar/foo' >>> _DropCommonSuffixes('foo/foo_internal.h') 'foo/foo' >>> _DropCom...
['def', '_DropCommonSuffixes', '(', 'filename', ')', ':', 'for', 'suffix', 'in', '(', "'test.cc'", ',', "'regtest.cc'", ',', "'unittest.cc'", ',', "'inl.h'", ',', "'impl.h'", ',', "'internal.h'", ')', ':', 'if', '(', 'filename', '.', 'endswith', '(', 'suffix', ')', 'and', 'len', '(', 'filename', ')', '>', 'len', '(', '...
Drops common suffixes like _test.cc or -inl.h from filename. For example: >>> _DropCommonSuffixes('foo/foo-inl.h') 'foo/foo' >>> _DropCommonSuffixes('foo/bar/foo.cc') 'foo/bar/foo' >>> _DropCommonSuffixes('foo/foo_internal.h') 'foo/foo' >>> _DropCommonSuffixes('foo/foo_unusualinternal.h')...
['Drops', 'common', 'suffixes', 'like', '_test', '.', 'cc', 'or', '-', 'inl', '.', 'h', 'from', 'filename', '.']
train
https://github.com/wesm/feather/blob/99267b30461c46b9e437f95e1d9338a92a854270/cpp/build-support/cpplint.py#L4501-L4525
3,145
aio-libs/aiohttp-devtools
aiohttp_devtools/start/template/app/settings.py
Settings.substitute_environ
def substitute_environ(self): """ Substitute environment variables into settings. """ for attr_name in dir(self): if attr_name.startswith('_') or attr_name.upper() != attr_name: continue orig_value = getattr(self, attr_name) is_require...
python
def substitute_environ(self): """ Substitute environment variables into settings. """ for attr_name in dir(self): if attr_name.startswith('_') or attr_name.upper() != attr_name: continue orig_value = getattr(self, attr_name) is_require...
['def', 'substitute_environ', '(', 'self', ')', ':', 'for', 'attr_name', 'in', 'dir', '(', 'self', ')', ':', 'if', 'attr_name', '.', 'startswith', '(', "'_'", ')', 'or', 'attr_name', '.', 'upper', '(', ')', '!=', 'attr_name', ':', 'continue', 'orig_value', '=', 'getattr', '(', 'self', ',', 'attr_name', ')', 'is_require...
Substitute environment variables into settings.
['Substitute', 'environment', 'variables', 'into', 'settings', '.']
train
https://github.com/aio-libs/aiohttp-devtools/blob/e9ea6feb43558e6e64595ea0ea5613f226cba81f/aiohttp_devtools/start/template/app/settings.py#L48-L76
3,146
sanger-pathogens/circlator
circlator/merge.py
Merger._get_possible_circular_ref_contigs
def _get_possible_circular_ref_contigs(self, nucmer_hits, log_fh=None, log_outprefix=None): '''Returns a dict ref name => tuple(hit at start, hit at end) for each ref sequence in the hash nucmer_hits (each value is a list of nucmer hits)''' writing_log_file = None not in [log_fh, log_outprefix] ...
python
def _get_possible_circular_ref_contigs(self, nucmer_hits, log_fh=None, log_outprefix=None): '''Returns a dict ref name => tuple(hit at start, hit at end) for each ref sequence in the hash nucmer_hits (each value is a list of nucmer hits)''' writing_log_file = None not in [log_fh, log_outprefix] ...
['def', '_get_possible_circular_ref_contigs', '(', 'self', ',', 'nucmer_hits', ',', 'log_fh', '=', 'None', ',', 'log_outprefix', '=', 'None', ')', ':', 'writing_log_file', '=', 'None', 'not', 'in', '[', 'log_fh', ',', 'log_outprefix', ']', 'maybe_circular', '=', '{', '}', 'all_nucmer_hits', '=', '[', ']', 'for', 'l', '...
Returns a dict ref name => tuple(hit at start, hit at end) for each ref sequence in the hash nucmer_hits (each value is a list of nucmer hits)
['Returns', 'a', 'dict', 'ref', 'name', '=', '>', 'tuple', '(', 'hit', 'at', 'start', 'hit', 'at', 'end', ')', 'for', 'each', 'ref', 'sequence', 'in', 'the', 'hash', 'nucmer_hits', '(', 'each', 'value', 'is', 'a', 'list', 'of', 'nucmer', 'hits', ')']
train
https://github.com/sanger-pathogens/circlator/blob/a4befb8c9dbbcd4b3ad1899a95aa3e689d58b638/circlator/merge.py#L240-L293
3,147
mbedmicro/pyOCD
pyocd/core/session.py
Session.find_user_file
def find_user_file(self, option_name, filename_list): """! @brief Search the project directory for a file.""" if option_name is not None: filePath = self._options.get(option_name, None) else: filePath = None # Look for default filenames if a path wasn't p...
python
def find_user_file(self, option_name, filename_list): """! @brief Search the project directory for a file.""" if option_name is not None: filePath = self._options.get(option_name, None) else: filePath = None # Look for default filenames if a path wasn't p...
['def', 'find_user_file', '(', 'self', ',', 'option_name', ',', 'filename_list', ')', ':', 'if', 'option_name', 'is', 'not', 'None', ':', 'filePath', '=', 'self', '.', '_options', '.', 'get', '(', 'option_name', ',', 'None', ')', 'else', ':', 'filePath', '=', 'None', "# Look for default filenames if a path wasn't provi...
! @brief Search the project directory for a file.
['!']
train
https://github.com/mbedmicro/pyOCD/blob/41a174718a9739f3cbe785c2ba21cb7fd1310c6f/pyocd/core/session.py#L167-L188
3,148
tensorflow/tensor2tensor
tensor2tensor/layers/common_attention.py
attention_bias_local
def attention_bias_local(length, max_backward, max_forward): """Create an bias tensor to be added to attention logits. A position may attend to positions at most max_distance from it, forward and backwards. This does not actually save any computation. Args: length: int max_backward: int, maximum di...
python
def attention_bias_local(length, max_backward, max_forward): """Create an bias tensor to be added to attention logits. A position may attend to positions at most max_distance from it, forward and backwards. This does not actually save any computation. Args: length: int max_backward: int, maximum di...
['def', 'attention_bias_local', '(', 'length', ',', 'max_backward', ',', 'max_forward', ')', ':', 'band', '=', 'common_layers', '.', 'ones_matrix_band_part', '(', 'length', ',', 'length', ',', 'max_backward', ',', 'max_forward', ',', 'out_shape', '=', '[', '1', ',', '1', ',', 'length', ',', 'length', ']', ')', 'return'...
Create an bias tensor to be added to attention logits. A position may attend to positions at most max_distance from it, forward and backwards. This does not actually save any computation. Args: length: int max_backward: int, maximum distance backward to attend. Negative values indicate unlimite...
['Create', 'an', 'bias', 'tensor', 'to', 'be', 'added', 'to', 'attention', 'logits', '.']
train
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_attention.py#L873-L897
3,149
mozilla/moz-sql-parser
moz_sql_parser/formatting.py
escape
def escape(identifier, ansi_quotes, should_quote): """ Escape identifiers. ANSI uses single quotes, but many databases use back quotes. """ if not should_quote(identifier): return identifier quote = '"' if ansi_quotes else '`' identifier = identifier.replace(quote, 2*quote) re...
python
def escape(identifier, ansi_quotes, should_quote): """ Escape identifiers. ANSI uses single quotes, but many databases use back quotes. """ if not should_quote(identifier): return identifier quote = '"' if ansi_quotes else '`' identifier = identifier.replace(quote, 2*quote) re...
['def', 'escape', '(', 'identifier', ',', 'ansi_quotes', ',', 'should_quote', ')', ':', 'if', 'not', 'should_quote', '(', 'identifier', ')', ':', 'return', 'identifier', 'quote', '=', '\'"\'', 'if', 'ansi_quotes', 'else', "'`'", 'identifier', '=', 'identifier', '.', 'replace', '(', 'quote', ',', '2', '*', 'quote', ')',...
Escape identifiers. ANSI uses single quotes, but many databases use back quotes.
['Escape', 'identifiers', '.']
train
https://github.com/mozilla/moz-sql-parser/blob/35fcc69b8f73b48e1fd48025cae1e174d57c3921/moz_sql_parser/formatting.py#L39-L51
3,150
angr/angr
angr/analyses/cfg/cfg_fast_soot.py
CFGFastSoot._create_jobs
def _create_jobs(self, target, jumpkind, current_function_addr, soot_block, addr, cfg_node, stmt_addr, stmt_idx): # pylint:disable=arguments-differ """ Given a node and details of a successor, makes a list of CFGJobs and if it is a call or exit marks it appropriately so in the CFG :pa...
python
def _create_jobs(self, target, jumpkind, current_function_addr, soot_block, addr, cfg_node, stmt_addr, stmt_idx): # pylint:disable=arguments-differ """ Given a node and details of a successor, makes a list of CFGJobs and if it is a call or exit marks it appropriately so in the CFG :pa...
['def', '_create_jobs', '(', 'self', ',', 'target', ',', 'jumpkind', ',', 'current_function_addr', ',', 'soot_block', ',', 'addr', ',', 'cfg_node', ',', 'stmt_addr', ',', 'stmt_idx', ')', ':', '# pylint:disable=arguments-differ', 'target_addr', '=', 'target', 'jobs', '=', '[', ']', 'if', 'target_addr', 'is', 'None', ':...
Given a node and details of a successor, makes a list of CFGJobs and if it is a call or exit marks it appropriately so in the CFG :param int target: Destination of the resultant job :param str jumpkind: The jumpkind of the edge going to this node :param int current_funct...
['Given', 'a', 'node', 'and', 'details', 'of', 'a', 'successor', 'makes', 'a', 'list', 'of', 'CFGJobs', 'and', 'if', 'it', 'is', 'a', 'call', 'or', 'exit', 'marks', 'it', 'appropriately', 'so', 'in', 'the', 'CFG']
train
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_fast_soot.py#L371-L443
3,151
radujica/baloo
baloo/weld/weld_str.py
weld_str_get
def weld_str_get(array, i): """Retrieve character at index i. Parameters ---------- array : numpy.ndarray or WeldObject Input data. i : int Index of character to retrieve. If greater than length of string, returns None. Returns ------- WeldObject Representation ...
python
def weld_str_get(array, i): """Retrieve character at index i. Parameters ---------- array : numpy.ndarray or WeldObject Input data. i : int Index of character to retrieve. If greater than length of string, returns None. Returns ------- WeldObject Representation ...
['def', 'weld_str_get', '(', 'array', ',', 'i', ')', ':', 'obj_id', ',', 'weld_obj', '=', 'create_weld_object', '(', 'array', ')', 'index_literal', '=', 'to_weld_literal', '(', 'i', ',', 'WeldLong', '(', ')', ')', 'missing_literal', '=', 'default_missing_data_literal', '(', 'WeldVec', '(', 'WeldChar', '(', ')', ')', ')...
Retrieve character at index i. Parameters ---------- array : numpy.ndarray or WeldObject Input data. i : int Index of character to retrieve. If greater than length of string, returns None. Returns ------- WeldObject Representation of this computation.
['Retrieve', 'character', 'at', 'index', 'i', '.']
train
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_str.py#L118-L155
3,152
DataDog/integrations-core
mongo/datadog_checks/mongo/mongo.py
MongoDb._build_metric_list_to_collect
def _build_metric_list_to_collect(self, additional_metrics): """ Build the metric list to collect based on the instance preferences. """ metrics_to_collect = {} # Defaut metrics for default_metrics in itervalues(self.DEFAULT_METRICS): metrics_to_collect.updat...
python
def _build_metric_list_to_collect(self, additional_metrics): """ Build the metric list to collect based on the instance preferences. """ metrics_to_collect = {} # Defaut metrics for default_metrics in itervalues(self.DEFAULT_METRICS): metrics_to_collect.updat...
['def', '_build_metric_list_to_collect', '(', 'self', ',', 'additional_metrics', ')', ':', 'metrics_to_collect', '=', '{', '}', '# Defaut metrics', 'for', 'default_metrics', 'in', 'itervalues', '(', 'self', '.', 'DEFAULT_METRICS', ')', ':', 'metrics_to_collect', '.', 'update', '(', 'default_metrics', ')', '# Additional...
Build the metric list to collect based on the instance preferences.
['Build', 'the', 'metric', 'list', 'to', 'collect', 'based', 'on', 'the', 'instance', 'preferences', '.']
train
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/mongo/datadog_checks/mongo/mongo.py#L500-L527
3,153
spencerahill/aospy
aospy/calc.py
Calc._file_name
def _file_name(self, dtype_out_time, extension='nc'): """Create the name of the aospy file.""" if dtype_out_time is None: dtype_out_time = '' out_lbl = utils.io.data_out_label(self.intvl_out, dtype_out_time, dtype_vert=self.dtype_out_vert) ...
python
def _file_name(self, dtype_out_time, extension='nc'): """Create the name of the aospy file.""" if dtype_out_time is None: dtype_out_time = '' out_lbl = utils.io.data_out_label(self.intvl_out, dtype_out_time, dtype_vert=self.dtype_out_vert) ...
['def', '_file_name', '(', 'self', ',', 'dtype_out_time', ',', 'extension', '=', "'nc'", ')', ':', 'if', 'dtype_out_time', 'is', 'None', ':', 'dtype_out_time', '=', "''", 'out_lbl', '=', 'utils', '.', 'io', '.', 'data_out_label', '(', 'self', '.', 'intvl_out', ',', 'dtype_out_time', ',', 'dtype_vert', '=', 'self', '.',...
Create the name of the aospy file.
['Create', 'the', 'name', 'of', 'the', 'aospy', 'file', '.']
train
https://github.com/spencerahill/aospy/blob/2f6e775b9b9956c54af117fdcdce2c87196afb6c/aospy/calc.py#L77-L91
3,154
inspirehep/inspire-dojson
inspire_dojson/hep/rules/bd0xx.py
languages
def languages(self, key, value): """Populate the ``languages`` key.""" languages = self.get('languages', []) values = force_list(value.get('a')) for value in values: for language in RE_LANGUAGE.split(value): try: name = language.strip().capitalize() l...
python
def languages(self, key, value): """Populate the ``languages`` key.""" languages = self.get('languages', []) values = force_list(value.get('a')) for value in values: for language in RE_LANGUAGE.split(value): try: name = language.strip().capitalize() l...
['def', 'languages', '(', 'self', ',', 'key', ',', 'value', ')', ':', 'languages', '=', 'self', '.', 'get', '(', "'languages'", ',', '[', ']', ')', 'values', '=', 'force_list', '(', 'value', '.', 'get', '(', "'a'", ')', ')', 'for', 'value', 'in', 'values', ':', 'for', 'language', 'in', 'RE_LANGUAGE', '.', 'split', '(',...
Populate the ``languages`` key.
['Populate', 'the', 'languages', 'key', '.']
train
https://github.com/inspirehep/inspire-dojson/blob/17f3789cd3d5ae58efa1190dc0eea9efb9c8ca59/inspire_dojson/hep/rules/bd0xx.py#L411-L424
3,155
chop-dbhi/varify
fabfile.py
merge_commit
def merge_commit(commit): "Fetches the latest code and merges up the specified commit." with cd(env.path): run('git fetch') if '@' in commit: branch, commit = commit.split('@') run('git checkout {0}'.format(branch)) run('git merge {0}'.format(commit))
python
def merge_commit(commit): "Fetches the latest code and merges up the specified commit." with cd(env.path): run('git fetch') if '@' in commit: branch, commit = commit.split('@') run('git checkout {0}'.format(branch)) run('git merge {0}'.format(commit))
['def', 'merge_commit', '(', 'commit', ')', ':', 'with', 'cd', '(', 'env', '.', 'path', ')', ':', 'run', '(', "'git fetch'", ')', 'if', "'@'", 'in', 'commit', ':', 'branch', ',', 'commit', '=', 'commit', '.', 'split', '(', "'@'", ')', 'run', '(', "'git checkout {0}'", '.', 'format', '(', 'branch', ')', ')', 'run', '(',...
Fetches the latest code and merges up the specified commit.
['Fetches', 'the', 'latest', 'code', 'and', 'merges', 'up', 'the', 'specified', 'commit', '.']
train
https://github.com/chop-dbhi/varify/blob/5dc721e49ed9bd3582f4b117785fdd1a8b6ba777/fabfile.py#L105-L112
3,156
Skyscanner/skyscanner-python-sdk
skyscanner/skyscanner.py
Flights.create_session
def create_session(self, **params): """ Create the session date format: YYYY-mm-dd location: ISO code """ return self.make_request(self.PRICING_SESSION_URL, method='post', headers=self._session_headers(), ...
python
def create_session(self, **params): """ Create the session date format: YYYY-mm-dd location: ISO code """ return self.make_request(self.PRICING_SESSION_URL, method='post', headers=self._session_headers(), ...
['def', 'create_session', '(', 'self', ',', '*', '*', 'params', ')', ':', 'return', 'self', '.', 'make_request', '(', 'self', '.', 'PRICING_SESSION_URL', ',', 'method', '=', "'post'", ',', 'headers', '=', 'self', '.', '_session_headers', '(', ')', ',', 'callback', '=', 'lambda', 'resp', ':', 'resp', '.', 'headers', '['...
Create the session date format: YYYY-mm-dd location: ISO code
['Create', 'the', 'session', 'date', 'format', ':', 'YYYY', '-', 'mm', '-', 'dd', 'location', ':', 'ISO', 'code']
train
https://github.com/Skyscanner/skyscanner-python-sdk/blob/26ce4a563f538a689f2a29063f3604731703ddac/skyscanner/skyscanner.py#L434-L445
3,157
manns/pyspread
pyspread/src/gui/_toolbars.py
AttributesToolbar._create_color_buttons
def _create_color_buttons(self): """Create color choice buttons""" button_size = (30, 30) button_style = wx.NO_BORDER try: self.linecolor_choice = \ csel.ColourSelect(self, -1, unichr(0x2500), (0, 0, 0), size=button_size, st...
python
def _create_color_buttons(self): """Create color choice buttons""" button_size = (30, 30) button_style = wx.NO_BORDER try: self.linecolor_choice = \ csel.ColourSelect(self, -1, unichr(0x2500), (0, 0, 0), size=button_size, st...
['def', '_create_color_buttons', '(', 'self', ')', ':', 'button_size', '=', '(', '30', ',', '30', ')', 'button_style', '=', 'wx', '.', 'NO_BORDER', 'try', ':', 'self', '.', 'linecolor_choice', '=', 'csel', '.', 'ColourSelect', '(', 'self', ',', '-', '1', ',', 'unichr', '(', '0x2500', ')', ',', '(', '0', ',', '0', ',', ...
Create color choice buttons
['Create', 'color', 'choice', 'buttons']
train
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_toolbars.py#L679-L712
3,158
eqcorrscan/EQcorrscan
eqcorrscan/utils/clustering.py
empirical_SVD
def empirical_SVD(stream_list, linear=True): """ Depreciated. Use empirical_svd. """ warnings.warn('Depreciated, use empirical_svd instead.') return empirical_svd(stream_list=stream_list, linear=linear)
python
def empirical_SVD(stream_list, linear=True): """ Depreciated. Use empirical_svd. """ warnings.warn('Depreciated, use empirical_svd instead.') return empirical_svd(stream_list=stream_list, linear=linear)
['def', 'empirical_SVD', '(', 'stream_list', ',', 'linear', '=', 'True', ')', ':', 'warnings', '.', 'warn', '(', "'Depreciated, use empirical_svd instead.'", ')', 'return', 'empirical_svd', '(', 'stream_list', '=', 'stream_list', ',', 'linear', '=', 'linear', ')']
Depreciated. Use empirical_svd.
['Depreciated', '.', 'Use', 'empirical_svd', '.']
train
https://github.com/eqcorrscan/EQcorrscan/blob/3121b4aca801ee5d38f56ca297ce1c0f9515d9ff/eqcorrscan/utils/clustering.py#L416-L421
3,159
shaunduncan/nosqlite
nosqlite.py
_all
def _all(field, value, document): """ Returns True if the value of document field contains all the values specified by ``value``. If supplied value is not an iterable, a MalformedQueryException is raised. If the value of the document field is not an iterable, False is returned """ try: ...
python
def _all(field, value, document): """ Returns True if the value of document field contains all the values specified by ``value``. If supplied value is not an iterable, a MalformedQueryException is raised. If the value of the document field is not an iterable, False is returned """ try: ...
['def', '_all', '(', 'field', ',', 'value', ',', 'document', ')', ':', 'try', ':', 'a', '=', 'set', '(', 'value', ')', 'except', 'TypeError', ':', 'raise', 'MalformedQueryException', '(', '"\'$all\' must accept an iterable"', ')', 'try', ':', 'b', '=', 'set', '(', 'document', '.', 'get', '(', 'field', ',', '[', ']', ')...
Returns True if the value of document field contains all the values specified by ``value``. If supplied value is not an iterable, a MalformedQueryException is raised. If the value of the document field is not an iterable, False is returned
['Returns', 'True', 'if', 'the', 'value', 'of', 'document', 'field', 'contains', 'all', 'the', 'values', 'specified', 'by', 'value', '.', 'If', 'supplied', 'value', 'is', 'not', 'an', 'iterable', 'a', 'MalformedQueryException', 'is', 'raised', '.', 'If', 'the', 'value', 'of', 'the', 'document', 'field', 'is', 'not', 'a...
train
https://github.com/shaunduncan/nosqlite/blob/3033c029b7c8290c66a8b36dc512e560505d4c85/nosqlite.py#L482-L499
3,160
openstack/pyghmi
pyghmi/ipmi/command.py
Command.get_channel_access
def get_channel_access(self, channel=None, read_mode='volatile'): """Get channel access :param channel: number [1:7] :param read_mode: non_volatile = get non-volatile Channel Access volatile = get present volatile (active) setting of Channel Access :return: A Pyth...
python
def get_channel_access(self, channel=None, read_mode='volatile'): """Get channel access :param channel: number [1:7] :param read_mode: non_volatile = get non-volatile Channel Access volatile = get present volatile (active) setting of Channel Access :return: A Pyth...
['def', 'get_channel_access', '(', 'self', ',', 'channel', '=', 'None', ',', 'read_mode', '=', "'volatile'", ')', ':', 'if', 'channel', 'is', 'None', ':', 'channel', '=', 'self', '.', 'get_network_channel', '(', ')', 'data', '=', '[', ']', 'data', '.', 'append', '(', 'channel', '&', '0b00001111', ')', 'b', '=', '0', 'r...
Get channel access :param channel: number [1:7] :param read_mode: non_volatile = get non-volatile Channel Access volatile = get present volatile (active) setting of Channel Access :return: A Python dict with the following keys/values: { - alerting: ...
['Get', 'channel', 'access']
train
https://github.com/openstack/pyghmi/blob/f710b1d30a8eed19a9e86f01f9351c737666f3e5/pyghmi/ipmi/command.py#L1394-L1463
3,161
log2timeline/dfvfs
dfvfs/helpers/file_system_searcher.py
FindSpec.AtMaximumDepth
def AtMaximumDepth(self, search_depth): """Determines if the find specification is at maximum depth. Args: search_depth (int): number of location path segments to compare. Returns: bool: True if at maximum depth, False if not. """ if self._location_segments is not None: if search...
python
def AtMaximumDepth(self, search_depth): """Determines if the find specification is at maximum depth. Args: search_depth (int): number of location path segments to compare. Returns: bool: True if at maximum depth, False if not. """ if self._location_segments is not None: if search...
['def', 'AtMaximumDepth', '(', 'self', ',', 'search_depth', ')', ':', 'if', 'self', '.', '_location_segments', 'is', 'not', 'None', ':', 'if', 'search_depth', '>=', 'self', '.', '_number_of_location_segments', ':', 'return', 'True', 'return', 'False']
Determines if the find specification is at maximum depth. Args: search_depth (int): number of location path segments to compare. Returns: bool: True if at maximum depth, False if not.
['Determines', 'if', 'the', 'find', 'specification', 'is', 'at', 'maximum', 'depth', '.']
train
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/helpers/file_system_searcher.py#L314-L327
3,162
KelSolaar/Foundations
foundations/environment.py
Environment.get_values
def get_values(self, *args): """ Gets environment variables values. Usage:: >>> environment = Environment("HOME") >>> environment.get_values() {'HOME': u'/Users/JohnDoe'} >>> environment.get_values("USER") {'HOME': u'/Users/JohnDoe', ...
python
def get_values(self, *args): """ Gets environment variables values. Usage:: >>> environment = Environment("HOME") >>> environment.get_values() {'HOME': u'/Users/JohnDoe'} >>> environment.get_values("USER") {'HOME': u'/Users/JohnDoe', ...
['def', 'get_values', '(', 'self', ',', '*', 'args', ')', ':', 'args', 'and', 'self', '.', '__add_variables', '(', '*', 'args', ')', 'LOGGER', '.', 'debug', '(', '"> Object environment variables: \'{0}\'."', '.', 'format', '(', '","', '.', 'join', '(', '(', 'key', 'for', 'key', 'in', 'self', '.', '__variables', 'if', '...
Gets environment variables values. Usage:: >>> environment = Environment("HOME") >>> environment.get_values() {'HOME': u'/Users/JohnDoe'} >>> environment.get_values("USER") {'HOME': u'/Users/JohnDoe', 'USER': u'JohnDoe'} :param \*args: Addit...
['Gets', 'environment', 'variables', 'values', '.']
train
https://github.com/KelSolaar/Foundations/blob/5c141330faf09dad70a12bc321f4c564917d0a91/foundations/environment.py#L131-L158
3,163
fracpete/python-weka-wrapper3
python/weka/core/classes.py
Configurable.to_dict
def to_dict(self): """ Returns a dictionary that represents this object, to be used for JSONification. :return: the object dictionary :rtype: dict """ result = {} result["type"] = "Configurable" result["class"] = get_classname(self) result["config...
python
def to_dict(self): """ Returns a dictionary that represents this object, to be used for JSONification. :return: the object dictionary :rtype: dict """ result = {} result["type"] = "Configurable" result["class"] = get_classname(self) result["config...
['def', 'to_dict', '(', 'self', ')', ':', 'result', '=', '{', '}', 'result', '[', '"type"', ']', '=', '"Configurable"', 'result', '[', '"class"', ']', '=', 'get_classname', '(', 'self', ')', 'result', '[', '"config"', ']', '=', '{', '}', 'for', 'k', 'in', 'self', '.', '_config', ':', 'v', '=', 'self', '.', '_config', '...
Returns a dictionary that represents this object, to be used for JSONification. :return: the object dictionary :rtype: dict
['Returns', 'a', 'dictionary', 'that', 'represents', 'this', 'object', 'to', 'be', 'used', 'for', 'JSONification', '.']
train
https://github.com/fracpete/python-weka-wrapper3/blob/d850ab1bdb25fbd5a8d86e99f34a397975425838/python/weka/core/classes.py#L352-L369
3,164
wheeler-microfluidics/nested-structures
nested_structures/__init__.py
apply_dict_depth_first
def apply_dict_depth_first(nodes, func, depth=0, as_dict=True, parents=None, pre=None, post=None): ''' This function is similar to the `apply_depth_first` except that it operates on the `OrderedDict`-based structure returned from `apply_depth_first` when `as_dict=True`. Note that if `as_dict` is `F...
python
def apply_dict_depth_first(nodes, func, depth=0, as_dict=True, parents=None, pre=None, post=None): ''' This function is similar to the `apply_depth_first` except that it operates on the `OrderedDict`-based structure returned from `apply_depth_first` when `as_dict=True`. Note that if `as_dict` is `F...
['def', 'apply_dict_depth_first', '(', 'nodes', ',', 'func', ',', 'depth', '=', '0', ',', 'as_dict', '=', 'True', ',', 'parents', '=', 'None', ',', 'pre', '=', 'None', ',', 'post', '=', 'None', ')', ':', 'if', 'as_dict', ':', 'items', '=', 'OrderedDict', '(', ')', 'else', ':', 'items', '=', '[', ']', 'if', 'parents', '...
This function is similar to the `apply_depth_first` except that it operates on the `OrderedDict`-based structure returned from `apply_depth_first` when `as_dict=True`. Note that if `as_dict` is `False`, the result of this function is given in the entry/tuple form.
['This', 'function', 'is', 'similar', 'to', 'the', 'apply_depth_first', 'except', 'that', 'it', 'operates', 'on', 'the', 'OrderedDict', '-', 'based', 'structure', 'returned', 'from', 'apply_depth_first', 'when', 'as_dict', '=', 'True', '.']
train
https://github.com/wheeler-microfluidics/nested-structures/blob/e3586bcca01c59f18ae16b8240e6e49197b63ecb/nested_structures/__init__.py#L149-L190
3,165
dslackw/slpkg
slpkg/binary/install.py
BinaryInstall.not_downgrade
def not_downgrade(self, package): """Don't downgrade packages if repository version is lower than installed""" name = split_package(package)[0] rep_ver = split_package(package)[1] ins_ver = GetFromInstalled(name).version()[1:] if not ins_ver: ins_ver = "0" ...
python
def not_downgrade(self, package): """Don't downgrade packages if repository version is lower than installed""" name = split_package(package)[0] rep_ver = split_package(package)[1] ins_ver = GetFromInstalled(name).version()[1:] if not ins_ver: ins_ver = "0" ...
['def', 'not_downgrade', '(', 'self', ',', 'package', ')', ':', 'name', '=', 'split_package', '(', 'package', ')', '[', '0', ']', 'rep_ver', '=', 'split_package', '(', 'package', ')', '[', '1', ']', 'ins_ver', '=', 'GetFromInstalled', '(', 'name', ')', '.', 'version', '(', ')', '[', '1', ':', ']', 'if', 'not', 'ins_ver...
Don't downgrade packages if repository version is lower than installed
['Don', 't', 'downgrade', 'packages', 'if', 'repository', 'version', 'is', 'lower', 'than', 'installed']
train
https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/binary/install.py#L242-L255
3,166
wdm0006/git-pandas
gitpandas/repository.py
Repository.blame
def blame(self, rev='HEAD', committer=True, by='repository', ignore_globs=None, include_globs=None): """ Returns the blame from the current HEAD of the repository as a DataFrame. The DataFrame is grouped by committer name, so it will be the sum of all contributions to the repository by each com...
python
def blame(self, rev='HEAD', committer=True, by='repository', ignore_globs=None, include_globs=None): """ Returns the blame from the current HEAD of the repository as a DataFrame. The DataFrame is grouped by committer name, so it will be the sum of all contributions to the repository by each com...
['def', 'blame', '(', 'self', ',', 'rev', '=', "'HEAD'", ',', 'committer', '=', 'True', ',', 'by', '=', "'repository'", ',', 'ignore_globs', '=', 'None', ',', 'include_globs', '=', 'None', ')', ':', 'blames', '=', '[', ']', 'file_names', '=', '[', 'x', 'for', 'x', 'in', 'self', '.', 'repo', '.', 'git', '.', 'log', '(',...
Returns the blame from the current HEAD of the repository as a DataFrame. The DataFrame is grouped by committer name, so it will be the sum of all contributions to the repository by each committer. As with the commit history method, extensions and ignore_dirs parameters can be passed to exclude certain...
['Returns', 'the', 'blame', 'from', 'the', 'current', 'HEAD', 'of', 'the', 'repository', 'as', 'a', 'DataFrame', '.', 'The', 'DataFrame', 'is', 'grouped', 'by', 'committer', 'name', 'so', 'it', 'will', 'be', 'the', 'sum', 'of', 'all', 'contributions', 'to', 'the', 'repository', 'by', 'each', 'committer', '.', 'As', 'wi...
train
https://github.com/wdm0006/git-pandas/blob/e56b817b1d66b8296d1d5e703d5db0e181d25899/gitpandas/repository.py#L524-L579
3,167
ebu/PlugIt
plugit_proxy/views.py
generic_send_mail
def generic_send_mail(sender, dests, subject, message, key, origin='', html_message=False): """Generic mail sending function""" # If no EBUIO Mail settings have been set, then no e-mail shall be sent if settings.EBUIO_MAIL_SECRET_KEY and settings.EBUIO_MAIL_SECRET_HASH: headers = {} if key...
python
def generic_send_mail(sender, dests, subject, message, key, origin='', html_message=False): """Generic mail sending function""" # If no EBUIO Mail settings have been set, then no e-mail shall be sent if settings.EBUIO_MAIL_SECRET_KEY and settings.EBUIO_MAIL_SECRET_HASH: headers = {} if key...
['def', 'generic_send_mail', '(', 'sender', ',', 'dests', ',', 'subject', ',', 'message', ',', 'key', ',', 'origin', '=', "''", ',', 'html_message', '=', 'False', ')', ':', '# If no EBUIO Mail settings have been set, then no e-mail shall be sent', 'if', 'settings', '.', 'EBUIO_MAIL_SECRET_KEY', 'and', 'settings', '.', ...
Generic mail sending function
['Generic', 'mail', 'sending', 'function']
train
https://github.com/ebu/PlugIt/blob/de5f1e870f67caaef7a4a58e4bb1ed54d9c5dc53/plugit_proxy/views.py#L1213-L1246
3,168
arviz-devs/arviz
arviz/data/datasets.py
list_datasets
def list_datasets(): """Get a string representation of all available datasets with descriptions.""" lines = [] for name, resource in itertools.chain(LOCAL_DATASETS.items(), REMOTE_DATASETS.items()): if isinstance(resource, LocalFileMetadata): location = "local: {}".format(resource.filen...
python
def list_datasets(): """Get a string representation of all available datasets with descriptions.""" lines = [] for name, resource in itertools.chain(LOCAL_DATASETS.items(), REMOTE_DATASETS.items()): if isinstance(resource, LocalFileMetadata): location = "local: {}".format(resource.filen...
['def', 'list_datasets', '(', ')', ':', 'lines', '=', '[', ']', 'for', 'name', ',', 'resource', 'in', 'itertools', '.', 'chain', '(', 'LOCAL_DATASETS', '.', 'items', '(', ')', ',', 'REMOTE_DATASETS', '.', 'items', '(', ')', ')', ':', 'if', 'isinstance', '(', 'resource', ',', 'LocalFileMetadata', ')', ':', 'location', '...
Get a string representation of all available datasets with descriptions.
['Get', 'a', 'string', 'representation', 'of', 'all', 'available', 'datasets', 'with', 'descriptions', '.']
train
https://github.com/arviz-devs/arviz/blob/d04d8da07f029fd2931f48d2f7f324cf393e5277/arviz/data/datasets.py#L170-L183
3,169
axialmarket/fsq
fsq/path.py
down
def down(p_queue, host=None): if host is not None: return _path(_c.FSQ_DOWN, root=_path(host, root=hosts(p_queue))) '''Construct a path to the down file for a queue''' return _path(p_queue, _c.FSQ_DOWN)
python
def down(p_queue, host=None): if host is not None: return _path(_c.FSQ_DOWN, root=_path(host, root=hosts(p_queue))) '''Construct a path to the down file for a queue''' return _path(p_queue, _c.FSQ_DOWN)
['def', 'down', '(', 'p_queue', ',', 'host', '=', 'None', ')', ':', 'if', 'host', 'is', 'not', 'None', ':', 'return', '_path', '(', '_c', '.', 'FSQ_DOWN', ',', 'root', '=', '_path', '(', 'host', ',', 'root', '=', 'hosts', '(', 'p_queue', ')', ')', ')', 'return', '_path', '(', 'p_queue', ',', '_c', '.', 'FSQ_DOWN', ')']
Construct a path to the down file for a queue
['Construct', 'a', 'path', 'to', 'the', 'down', 'file', 'for', 'a', 'queue']
train
https://github.com/axialmarket/fsq/blob/43b84c292cb8a187599d86753b947cf73248f989/fsq/path.py#L64-L68
3,170
Alignak-monitoring/alignak
alignak/external_command.py
ExternalCommandManager.delay_svc_notification
def delay_svc_notification(self, service, notification_time): """Modify service first notification delay Format of the line that triggers function call:: DELAY_SVC_NOTIFICATION;<host_name>;<service_description>;<notification_time> :param service: service to edit :type service: ...
python
def delay_svc_notification(self, service, notification_time): """Modify service first notification delay Format of the line that triggers function call:: DELAY_SVC_NOTIFICATION;<host_name>;<service_description>;<notification_time> :param service: service to edit :type service: ...
['def', 'delay_svc_notification', '(', 'self', ',', 'service', ',', 'notification_time', ')', ':', 'service', '.', 'first_notification_delay', '=', 'notification_time', 'self', '.', 'send_an_element', '(', 'service', '.', 'get_update_status_brok', '(', ')', ')']
Modify service first notification delay Format of the line that triggers function call:: DELAY_SVC_NOTIFICATION;<host_name>;<service_description>;<notification_time> :param service: service to edit :type service: alignak.objects.service.Service :param notification_time: new val...
['Modify', 'service', 'first', 'notification', 'delay', 'Format', 'of', 'the', 'line', 'that', 'triggers', 'function', 'call', '::']
train
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/external_command.py#L1701-L1714
3,171
realitix/vulkan
generator/generate.py
format_vk
def format_vk(vk): """Format vk before using it""" # Force extension require to be a list for ext in get_extensions_filtered(vk): req = ext['require'] if not isinstance(req, list): ext['require'] = [req]
python
def format_vk(vk): """Format vk before using it""" # Force extension require to be a list for ext in get_extensions_filtered(vk): req = ext['require'] if not isinstance(req, list): ext['require'] = [req]
['def', 'format_vk', '(', 'vk', ')', ':', '# Force extension require to be a list', 'for', 'ext', 'in', 'get_extensions_filtered', '(', 'vk', ')', ':', 'req', '=', 'ext', '[', "'require'", ']', 'if', 'not', 'isinstance', '(', 'req', ',', 'list', ')', ':', 'ext', '[', "'require'", ']', '=', '[', 'req', ']']
Format vk before using it
['Format', 'vk', 'before', 'using', 'it']
train
https://github.com/realitix/vulkan/blob/07285387092aaa61d2d71fa2913d60a73f022cbe/generator/generate.py#L496-L503
3,172
mila/pyoo
pyoo.py
VerticalCellRange.__set_values
def __set_values(self, values): """ Sets values in this cell range from an iterable. This is much more effective than writing cell values one by one. """ array = tuple((self._clean_value(v),) for v in values) self._get_target().setDataArray(array)
python
def __set_values(self, values): """ Sets values in this cell range from an iterable. This is much more effective than writing cell values one by one. """ array = tuple((self._clean_value(v),) for v in values) self._get_target().setDataArray(array)
['def', '__set_values', '(', 'self', ',', 'values', ')', ':', 'array', '=', 'tuple', '(', '(', 'self', '.', '_clean_value', '(', 'v', ')', ',', ')', 'for', 'v', 'in', 'values', ')', 'self', '.', '_get_target', '(', ')', '.', 'setDataArray', '(', 'array', ')']
Sets values in this cell range from an iterable. This is much more effective than writing cell values one by one.
['Sets', 'values', 'in', 'this', 'cell', 'range', 'from', 'an', 'iterable', '.']
train
https://github.com/mila/pyoo/blob/1e024999f608c87ea72cd443e39c89eb0ba3cc62/pyoo.py#L1519-L1526
3,173
DecBayComp/RWA-python
rwa/generic.py
namedtuple_storable
def namedtuple_storable(namedtuple, *args, **kwargs): """ Storable factory for named tuples. """ return default_storable(namedtuple, namedtuple._fields, *args, **kwargs)
python
def namedtuple_storable(namedtuple, *args, **kwargs): """ Storable factory for named tuples. """ return default_storable(namedtuple, namedtuple._fields, *args, **kwargs)
['def', 'namedtuple_storable', '(', 'namedtuple', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'return', 'default_storable', '(', 'namedtuple', ',', 'namedtuple', '.', '_fields', ',', '*', 'args', ',', '*', '*', 'kwargs', ')']
Storable factory for named tuples.
['Storable', 'factory', 'for', 'named', 'tuples', '.']
train
https://github.com/DecBayComp/RWA-python/blob/734a52e15a0e8c244d84d74acf3fd64721074732/rwa/generic.py#L1000-L1004
3,174
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_link.py
LinkModule.report_altitude
def report_altitude(self, altitude): '''possibly report a new altitude''' master = self.master if getattr(self.console, 'ElevationMap', None) is not None and self.mpstate.settings.basealt != 0: lat = master.field('GLOBAL_POSITION_INT', 'lat', 0)*1.0e-7 lon = master.field(...
python
def report_altitude(self, altitude): '''possibly report a new altitude''' master = self.master if getattr(self.console, 'ElevationMap', None) is not None and self.mpstate.settings.basealt != 0: lat = master.field('GLOBAL_POSITION_INT', 'lat', 0)*1.0e-7 lon = master.field(...
['def', 'report_altitude', '(', 'self', ',', 'altitude', ')', ':', 'master', '=', 'self', '.', 'master', 'if', 'getattr', '(', 'self', '.', 'console', ',', "'ElevationMap'", ',', 'None', ')', 'is', 'not', 'None', 'and', 'self', '.', 'mpstate', '.', 'settings', '.', 'basealt', '!=', '0', ':', 'lat', '=', 'master', '.', ...
possibly report a new altitude
['possibly', 'report', 'a', 'new', 'altitude']
train
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_link.py#L354-L371
3,175
pyviz/param
param/__init__.py
ObjectSelector._validate
def _validate(self, val): """ val must be None or one of the objects in self.objects. """ if not self.check_on_set: self._ensure_value_is_in_objects(val) return if not (val in self.objects or (self.allow_None and val is None)): # CEBALERT: can...
python
def _validate(self, val): """ val must be None or one of the objects in self.objects. """ if not self.check_on_set: self._ensure_value_is_in_objects(val) return if not (val in self.objects or (self.allow_None and val is None)): # CEBALERT: can...
['def', '_validate', '(', 'self', ',', 'val', ')', ':', 'if', 'not', 'self', '.', 'check_on_set', ':', 'self', '.', '_ensure_value_is_in_objects', '(', 'val', ')', 'return', 'if', 'not', '(', 'val', 'in', 'self', '.', 'objects', 'or', '(', 'self', '.', 'allow_None', 'and', 'val', 'is', 'None', ')', ')', ':', '# CEBALER...
val must be None or one of the objects in self.objects.
['val', 'must', 'be', 'None', 'or', 'one', 'of', 'the', 'objects', 'in', 'self', '.', 'objects', '.']
train
https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/__init__.py#L1206-L1235
3,176
incf-nidash/nidmresults
nidmresults/objects/contrast.py
ContrastMap.export
def export(self, nidm_version, export_dir): """ Create prov graph. """ # Contrast Map entity atts = ( (PROV['type'], NIDM_CONTRAST_MAP), (NIDM_CONTRAST_NAME, self.name)) if not self.isderfrommap: atts = atts + ( (NIDM_I...
python
def export(self, nidm_version, export_dir): """ Create prov graph. """ # Contrast Map entity atts = ( (PROV['type'], NIDM_CONTRAST_MAP), (NIDM_CONTRAST_NAME, self.name)) if not self.isderfrommap: atts = atts + ( (NIDM_I...
['def', 'export', '(', 'self', ',', 'nidm_version', ',', 'export_dir', ')', ':', '# Contrast Map entity', 'atts', '=', '(', '(', 'PROV', '[', "'type'", ']', ',', 'NIDM_CONTRAST_MAP', ')', ',', '(', 'NIDM_CONTRAST_NAME', ',', 'self', '.', 'name', ')', ')', 'if', 'not', 'self', '.', 'isderfrommap', ':', 'atts', '=', 'att...
Create prov graph.
['Create', 'prov', 'graph', '.']
train
https://github.com/incf-nidash/nidmresults/blob/438f7cce6abc4a4379b629bd76f4d427891e033f/nidmresults/objects/contrast.py#L181-L203
3,177
SteveMcGrath/pySecurityCenter
examples/sc4/csv_gen/sccsv/generator.py
gen_csv
def gen_csv(sc, filename, field_list, source, filters): '''csv SecurityCenterObj, AssetListName, CSVFields, EmailAddress ''' # First thing we need to do is initialize the csvfile and build the header # for the file. datafile = open(filename, 'wb') csvfile = csv.writer(datafile) header = [] ...
python
def gen_csv(sc, filename, field_list, source, filters): '''csv SecurityCenterObj, AssetListName, CSVFields, EmailAddress ''' # First thing we need to do is initialize the csvfile and build the header # for the file. datafile = open(filename, 'wb') csvfile = csv.writer(datafile) header = [] ...
['def', 'gen_csv', '(', 'sc', ',', 'filename', ',', 'field_list', ',', 'source', ',', 'filters', ')', ':', '# First thing we need to do is initialize the csvfile and build the header', '# for the file.', 'datafile', '=', 'open', '(', 'filename', ',', "'wb'", ')', 'csvfile', '=', 'csv', '.', 'writer', '(', 'datafile', '...
csv SecurityCenterObj, AssetListName, CSVFields, EmailAddress
['csv', 'SecurityCenterObj', 'AssetListName', 'CSVFields', 'EmailAddress']
train
https://github.com/SteveMcGrath/pySecurityCenter/blob/f0b10b1bcd4fd23a8d4d09ca6774cdf5e1cfd880/examples/sc4/csv_gen/sccsv/generator.py#L46-L70
3,178
i3visio/osrframework
osrframework/utils/platforms.py
Platform.do_searchfy
def do_searchfy(self, query, **kwargs): """ Verifying a searchfy query in this platform. This might be redefined in any class inheriting from Platform. Performing additional procesing may be possible by iterating the requested profiles to extract more entities from the URI woul...
python
def do_searchfy(self, query, **kwargs): """ Verifying a searchfy query in this platform. This might be redefined in any class inheriting from Platform. Performing additional procesing may be possible by iterating the requested profiles to extract more entities from the URI woul...
['def', 'do_searchfy', '(', 'self', ',', 'query', ',', '*', '*', 'kwargs', ')', ':', 'results', '=', '[', ']', 'print', '(', '"[*] Launching search using the {} module..."', '.', 'format', '(', 'self', '.', '__class__', '.', '__name__', ')', ')', 'test', '=', 'self', '.', 'check_searchfy', '(', 'query', ',', 'kwargs', ...
Verifying a searchfy query in this platform. This might be redefined in any class inheriting from Platform. Performing additional procesing may be possible by iterating the requested profiles to extract more entities from the URI would be slow. Sample code may be: if kwargs["proce...
['Verifying', 'a', 'searchfy', 'query', 'in', 'this', 'platform', '.']
train
https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/utils/platforms.py#L439-L517
3,179
HewlettPackard/python-hpOneView
hpOneView/oneview_client.py
OneViewClient.appliance_node_information
def appliance_node_information(self): """ Gets the ApplianceNodeInformation API client. Returns: ApplianceNodeInformation: """ if not self.__appliance_node_information: self.__appliance_node_information = ApplianceNodeInformation(self.__connection) ...
python
def appliance_node_information(self): """ Gets the ApplianceNodeInformation API client. Returns: ApplianceNodeInformation: """ if not self.__appliance_node_information: self.__appliance_node_information = ApplianceNodeInformation(self.__connection) ...
['def', 'appliance_node_information', '(', 'self', ')', ':', 'if', 'not', 'self', '.', '__appliance_node_information', ':', 'self', '.', '__appliance_node_information', '=', 'ApplianceNodeInformation', '(', 'self', '.', '__connection', ')', 'return', 'self', '.', '__appliance_node_information']
Gets the ApplianceNodeInformation API client. Returns: ApplianceNodeInformation:
['Gets', 'the', 'ApplianceNodeInformation', 'API', 'client', '.']
train
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L1153-L1162
3,180
CalebBell/fluids
fluids/compressible.py
is_critical_flow
def is_critical_flow(P1, P2, k): r'''Determines if a flow of a fluid driven by pressure gradient P1 - P2 is critical, for a fluid with the given isentropic coefficient. This function calculates critical flow pressure, and checks if this is larger than P2. If so, the flow is critical and choked. Par...
python
def is_critical_flow(P1, P2, k): r'''Determines if a flow of a fluid driven by pressure gradient P1 - P2 is critical, for a fluid with the given isentropic coefficient. This function calculates critical flow pressure, and checks if this is larger than P2. If so, the flow is critical and choked. Par...
['def', 'is_critical_flow', '(', 'P1', ',', 'P2', ',', 'k', ')', ':', 'Pcf', '=', 'P_critical_flow', '(', 'P1', ',', 'k', ')', 'return', 'Pcf', '>', 'P2']
r'''Determines if a flow of a fluid driven by pressure gradient P1 - P2 is critical, for a fluid with the given isentropic coefficient. This function calculates critical flow pressure, and checks if this is larger than P2. If so, the flow is critical and choked. Parameters ---------- P1 : float...
['r', 'Determines', 'if', 'a', 'flow', 'of', 'a', 'fluid', 'driven', 'by', 'pressure', 'gradient', 'P1', '-', 'P2', 'is', 'critical', 'for', 'a', 'fluid', 'with', 'the', 'given', 'isentropic', 'coefficient', '.', 'This', 'function', 'calculates', 'critical', 'flow', 'pressure', 'and', 'checks', 'if', 'this', 'is', 'lar...
train
https://github.com/CalebBell/fluids/blob/57f556752e039f1d3e5a822f408c184783db2828/fluids/compressible.py#L515-L554
3,181
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/dbapi/cursor.py
_format_operation_list
def _format_operation_list(operation, parameters): """Formats parameters in operation in the way BigQuery expects. The input operation will be a query like ``SELECT %s`` and the output will be a query like ``SELECT ?``. :type operation: str :param operation: A Google BigQuery query string. :t...
python
def _format_operation_list(operation, parameters): """Formats parameters in operation in the way BigQuery expects. The input operation will be a query like ``SELECT %s`` and the output will be a query like ``SELECT ?``. :type operation: str :param operation: A Google BigQuery query string. :t...
['def', '_format_operation_list', '(', 'operation', ',', 'parameters', ')', ':', 'formatted_params', '=', '[', '"?"', 'for', '_', 'in', 'parameters', ']', 'try', ':', 'return', 'operation', '%', 'tuple', '(', 'formatted_params', ')', 'except', 'TypeError', 'as', 'exc', ':', 'raise', 'exceptions', '.', 'ProgrammingError...
Formats parameters in operation in the way BigQuery expects. The input operation will be a query like ``SELECT %s`` and the output will be a query like ``SELECT ?``. :type operation: str :param operation: A Google BigQuery query string. :type parameters: Sequence[Any] :param parameters: Seque...
['Formats', 'parameters', 'in', 'operation', 'in', 'the', 'way', 'BigQuery', 'expects', '.']
train
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/dbapi/cursor.py#L282-L305
3,182
theno/fabsetup
fabsetup/addons.py
load_repo_addons
def load_repo_addons(_globals): '''Load all fabsetup addons which are stored under ~/.fabsetup-addon-repos as git repositories. Args: _globals(dict): the globals() namespace of the fabric script. Return: None ''' repos_dir = os.path.expanduser('~/.fabsetup-addon-repos') if os.path....
python
def load_repo_addons(_globals): '''Load all fabsetup addons which are stored under ~/.fabsetup-addon-repos as git repositories. Args: _globals(dict): the globals() namespace of the fabric script. Return: None ''' repos_dir = os.path.expanduser('~/.fabsetup-addon-repos') if os.path....
['def', 'load_repo_addons', '(', '_globals', ')', ':', 'repos_dir', '=', 'os', '.', 'path', '.', 'expanduser', '(', "'~/.fabsetup-addon-repos'", ')', 'if', 'os', '.', 'path', '.', 'isdir', '(', 'repos_dir', ')', ':', 'basedir', ',', 'repos', ',', '_', '=', 'next', '(', 'os', '.', 'walk', '(', 'repos_dir', ')', ')', 'fo...
Load all fabsetup addons which are stored under ~/.fabsetup-addon-repos as git repositories. Args: _globals(dict): the globals() namespace of the fabric script. Return: None
['Load', 'all', 'fabsetup', 'addons', 'which', 'are', 'stored', 'under', '~', '/', '.', 'fabsetup', '-', 'addon', '-', 'repos', 'as', 'git', 'repositories', '.']
train
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/addons.py#L126-L145
3,183
OnroerendErfgoed/crabpy_pyramid
crabpy_pyramid/renderers/capakey.py
item_afdeling_adapter
def item_afdeling_adapter(obj, request): """ Adapter for rendering an object of :class: `crabpy.gateway.capakey.Afdeling` to json. """ return { 'id': obj.id, 'naam': obj.naam, 'gemeente': { 'id': obj.gemeente.id, 'naam': obj.gemeente.naam }, ...
python
def item_afdeling_adapter(obj, request): """ Adapter for rendering an object of :class: `crabpy.gateway.capakey.Afdeling` to json. """ return { 'id': obj.id, 'naam': obj.naam, 'gemeente': { 'id': obj.gemeente.id, 'naam': obj.gemeente.naam }, ...
['def', 'item_afdeling_adapter', '(', 'obj', ',', 'request', ')', ':', 'return', '{', "'id'", ':', 'obj', '.', 'id', ',', "'naam'", ':', 'obj', '.', 'naam', ',', "'gemeente'", ':', '{', "'id'", ':', 'obj', '.', 'gemeente', '.', 'id', ',', "'naam'", ':', 'obj', '.', 'gemeente', '.', 'naam', '}', ',', "'centroid'", ':', ...
Adapter for rendering an object of :class: `crabpy.gateway.capakey.Afdeling` to json.
['Adapter', 'for', 'rendering', 'an', 'object', 'of', ':', 'class', ':', 'crabpy', '.', 'gateway', '.', 'capakey', '.', 'Afdeling', 'to', 'json', '.']
train
https://github.com/OnroerendErfgoed/crabpy_pyramid/blob/b727ea55838d71575db96e987b536a0bac9f6a7a/crabpy_pyramid/renderers/capakey.py#L80-L94
3,184
nutechsoftware/alarmdecoder
examples/usb_device.py
main
def main(): """ Example application that prints messages from the panel to the terminal. """ try: # Retrieve the first USB device device = AlarmDecoder(USBDevice.find()) # Set up an event handler and open the device device.on_message += handle_message with device...
python
def main(): """ Example application that prints messages from the panel to the terminal. """ try: # Retrieve the first USB device device = AlarmDecoder(USBDevice.find()) # Set up an event handler and open the device device.on_message += handle_message with device...
['def', 'main', '(', ')', ':', 'try', ':', '# Retrieve the first USB device', 'device', '=', 'AlarmDecoder', '(', 'USBDevice', '.', 'find', '(', ')', ')', '# Set up an event handler and open the device', 'device', '.', 'on_message', '+=', 'handle_message', 'with', 'device', '.', 'open', '(', ')', ':', 'while', 'True', ...
Example application that prints messages from the panel to the terminal.
['Example', 'application', 'that', 'prints', 'messages', 'from', 'the', 'panel', 'to', 'the', 'terminal', '.']
train
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/examples/usb_device.py#L5-L20
3,185
horejsek/python-webdriverwrapper
webdriverwrapper/info.py
WebdriverWrapperInfoMixin.check_expected_infos
def check_expected_infos(self, test_method): """ This method is called after each test. It will read decorated informations and check if there are expected infos. You can set expected infos by decorators :py:func:`.expected_info_messages` and :py:func:`.allowed_info_messages`. ...
python
def check_expected_infos(self, test_method): """ This method is called after each test. It will read decorated informations and check if there are expected infos. You can set expected infos by decorators :py:func:`.expected_info_messages` and :py:func:`.allowed_info_messages`. ...
['def', 'check_expected_infos', '(', 'self', ',', 'test_method', ')', ':', 'f', '=', 'lambda', 'key', ',', 'default', '=', '[', ']', ':', 'getattr', '(', 'test_method', ',', 'key', ',', 'default', ')', 'expected_info_messages', '=', 'f', '(', 'EXPECTED_INFO_MESSAGES', ')', 'allowed_info_messages', '=', 'f', '(', 'ALLOW...
This method is called after each test. It will read decorated informations and check if there are expected infos. You can set expected infos by decorators :py:func:`.expected_info_messages` and :py:func:`.allowed_info_messages`.
['This', 'method', 'is', 'called', 'after', 'each', 'test', '.', 'It', 'will', 'read', 'decorated', 'informations', 'and', 'check', 'if', 'there', 'are', 'expected', 'infos', '.']
train
https://github.com/horejsek/python-webdriverwrapper/blob/a492f79ab60ed83d860dd817b6a0961500d7e3f5/webdriverwrapper/info.py#L52-L63
3,186
xolox/python-qpass
qpass/__init__.py
PasswordStore.context
def context(self): """ An execution context created using :mod:`executor.contexts`. The value of :attr:`context` defaults to a :class:`~executor.contexts.LocalContext` object with the following characteristics: - The working directory of the execution context is set to ...
python
def context(self): """ An execution context created using :mod:`executor.contexts`. The value of :attr:`context` defaults to a :class:`~executor.contexts.LocalContext` object with the following characteristics: - The working directory of the execution context is set to ...
['def', 'context', '(', 'self', ')', ':', '# Make sure the directory exists.', 'self', '.', 'ensure_directory_exists', '(', ')', '# Prepare the environment variables.', 'environment', '=', '{', 'DIRECTORY_VARIABLE', ':', 'self', '.', 'directory', '}', 'try', ':', '# Try to enable the GPG agent in headless sessions.', '...
An execution context created using :mod:`executor.contexts`. The value of :attr:`context` defaults to a :class:`~executor.contexts.LocalContext` object with the following characteristics: - The working directory of the execution context is set to the value of :attr:`directory...
['An', 'execution', 'context', 'created', 'using', ':', 'mod', ':', 'executor', '.', 'contexts', '.']
train
https://github.com/xolox/python-qpass/blob/43ce447b0904ff42a54b8f1dd4d2479f950f258f/qpass/__init__.py#L244-L272
3,187
matthiask/django-cte-forest
cte_forest/models.py
CTENodeManager.as_tree
def as_tree(self, visitor=None, children=None): """ Recursively traverses each tree (starting from each root) in order to generate a dictionary-based tree structure of the entire forest. Each level of the forest/tree is a list of nodes, and each node consists of a dictionary ...
python
def as_tree(self, visitor=None, children=None): """ Recursively traverses each tree (starting from each root) in order to generate a dictionary-based tree structure of the entire forest. Each level of the forest/tree is a list of nodes, and each node consists of a dictionary ...
['def', 'as_tree', '(', 'self', ',', 'visitor', '=', 'None', ',', 'children', '=', 'None', ')', ':', 'return', '[', 'root', '.', 'as_tree', '(', 'visitor', '=', 'visitor', ',', 'children', '=', 'children', ')', 'for', 'root', 'in', 'self', '.', 'roots', '(', ')', ']']
Recursively traverses each tree (starting from each root) in order to generate a dictionary-based tree structure of the entire forest. Each level of the forest/tree is a list of nodes, and each node consists of a dictionary representation, where the entry ``children`` (by...
['Recursively', 'traverses', 'each', 'tree', '(', 'starting', 'from', 'each', 'root', ')', 'in', 'order', 'to', 'generate', 'a', 'dictionary', '-', 'based', 'tree', 'structure', 'of', 'the', 'entire', 'forest', '.', 'Each', 'level', 'of', 'the', 'forest', '/', 'tree', 'is', 'a', 'list', 'of', 'nodes', 'and', 'each', 'n...
train
https://github.com/matthiask/django-cte-forest/blob/7bff29d69eddfcf214e9cf61647c91d28655619c/cte_forest/models.py#L604-L645
3,188
bukun/TorCMS
torcms/handlers/page_handler.py
PageHandler.list
def list(self): ''' View the list of the pages. ''' kwd = { 'pager': '', 'title': '单页列表', } self.render('wiki_page/page_list.html', kwd=kwd, view=MWiki.query_recent(), view_all=MWiki.query...
python
def list(self): ''' View the list of the pages. ''' kwd = { 'pager': '', 'title': '单页列表', } self.render('wiki_page/page_list.html', kwd=kwd, view=MWiki.query_recent(), view_all=MWiki.query...
['def', 'list', '(', 'self', ')', ':', 'kwd', '=', '{', "'pager'", ':', "''", ',', "'title'", ':', "'单页列表',", '', '}', 'self', '.', 'render', '(', "'wiki_page/page_list.html'", ',', 'kwd', '=', 'kwd', ',', 'view', '=', 'MWiki', '.', 'query_recent', '(', ')', ',', 'view_all', '=', 'MWiki', '.', 'query_all', '(', ')', ',...
View the list of the pages.
['View', 'the', 'list', 'of', 'the', 'pages', '.']
train
https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/page_handler.py#L179-L193
3,189
EventTeam/beliefs
src/beliefs/cells/posets.py
PartialOrderedCell.is_equal
def is_equal(self, other): """ Computes whether two Partial Orderings contain the same information """ if not (hasattr(other, 'get_domain') or hasattr(other, 'upper') or hasattr(other, 'lower')): other = self.coerce(other) if self.is_domain_equal(other) \ ...
python
def is_equal(self, other): """ Computes whether two Partial Orderings contain the same information """ if not (hasattr(other, 'get_domain') or hasattr(other, 'upper') or hasattr(other, 'lower')): other = self.coerce(other) if self.is_domain_equal(other) \ ...
['def', 'is_equal', '(', 'self', ',', 'other', ')', ':', 'if', 'not', '(', 'hasattr', '(', 'other', ',', "'get_domain'", ')', 'or', 'hasattr', '(', 'other', ',', "'upper'", ')', 'or', 'hasattr', '(', 'other', ',', "'lower'", ')', ')', ':', 'other', '=', 'self', '.', 'coerce', '(', 'other', ')', 'if', 'self', '.', 'is_d...
Computes whether two Partial Orderings contain the same information
['Computes', 'whether', 'two', 'Partial', 'Orderings', 'contain', 'the', 'same', 'information']
train
https://github.com/EventTeam/beliefs/blob/c07d22b61bebeede74a72800030dde770bf64208/src/beliefs/cells/posets.py#L161-L171
3,190
mozilla-releng/scriptworker
scriptworker/utils.py
get_parts_of_url_path
def get_parts_of_url_path(url): """Given a url, take out the path part and split it by '/'. Args: url (str): the url slice returns list: parts after the domain name of the URL """ parsed = urlparse(url) path = unquote(parsed.path).lstrip('/') parts = path.split('/') re...
python
def get_parts_of_url_path(url): """Given a url, take out the path part and split it by '/'. Args: url (str): the url slice returns list: parts after the domain name of the URL """ parsed = urlparse(url) path = unquote(parsed.path).lstrip('/') parts = path.split('/') re...
['def', 'get_parts_of_url_path', '(', 'url', ')', ':', 'parsed', '=', 'urlparse', '(', 'url', ')', 'path', '=', 'unquote', '(', 'parsed', '.', 'path', ')', '.', 'lstrip', '(', "'/'", ')', 'parts', '=', 'path', '.', 'split', '(', "'/'", ')', 'return', 'parts']
Given a url, take out the path part and split it by '/'. Args: url (str): the url slice returns list: parts after the domain name of the URL
['Given', 'a', 'url', 'take', 'out', 'the', 'path', 'part', 'and', 'split', 'it', 'by', '/', '.']
train
https://github.com/mozilla-releng/scriptworker/blob/8e97bbd83b9b578565ec57904c966dd6ae4ef0ae/scriptworker/utils.py#L592-L605
3,191
PmagPy/PmagPy
pmagpy/ipmag.py
download_magic
def download_magic(infile, dir_path='.', input_dir_path='', overwrite=False, print_progress=True, data_model=3., separate_locs=False): """ takes the name of a text file downloaded from the MagIC database and unpacks it into magic-formatted files. by default, download_ma...
python
def download_magic(infile, dir_path='.', input_dir_path='', overwrite=False, print_progress=True, data_model=3., separate_locs=False): """ takes the name of a text file downloaded from the MagIC database and unpacks it into magic-formatted files. by default, download_ma...
['def', 'download_magic', '(', 'infile', ',', 'dir_path', '=', "'.'", ',', 'input_dir_path', '=', "''", ',', 'overwrite', '=', 'False', ',', 'print_progress', '=', 'True', ',', 'data_model', '=', '3.', ',', 'separate_locs', '=', 'False', ')', ':', 'if', 'data_model', '==', '2.5', ':', 'method_col', '=', '"magic_method_...
takes the name of a text file downloaded from the MagIC database and unpacks it into magic-formatted files. by default, download_magic assumes that you are doing everything in your current directory. if not, you may provide optional arguments dir_path (where you want the results to go) and input_dir_pat...
['takes', 'the', 'name', 'of', 'a', 'text', 'file', 'downloaded', 'from', 'the', 'MagIC', 'database', 'and', 'unpacks', 'it', 'into', 'magic', '-', 'formatted', 'files', '.', 'by', 'default', 'download_magic', 'assumes', 'that', 'you', 'are', 'doing', 'everything', 'in', 'your', 'current', 'directory', '.', 'if', 'not'...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/ipmag.py#L4059-L4245
3,192
pmorissette/bt
bt/core.py
StrategyBase.adjust
def adjust(self, amount, update=True, flow=True, fee=0.0): """ Adjust capital - used to inject capital to a Strategy. This injection of capital will have no effect on the children. Args: * amount (float): Amount to adjust by. * update (bool): Force update? ...
python
def adjust(self, amount, update=True, flow=True, fee=0.0): """ Adjust capital - used to inject capital to a Strategy. This injection of capital will have no effect on the children. Args: * amount (float): Amount to adjust by. * update (bool): Force update? ...
['def', 'adjust', '(', 'self', ',', 'amount', ',', 'update', '=', 'True', ',', 'flow', '=', 'True', ',', 'fee', '=', '0.0', ')', ':', '# adjust capital', 'self', '.', '_capital', '+=', 'amount', 'self', '.', '_last_fee', '+=', 'fee', '# if flow - increment net_flows - this will not affect', '# performance. Commissions ...
Adjust capital - used to inject capital to a Strategy. This injection of capital will have no effect on the children. Args: * amount (float): Amount to adjust by. * update (bool): Force update? * flow (bool): Is this adjustment a flow? A flow will not have an ...
['Adjust', 'capital', '-', 'used', 'to', 'inject', 'capital', 'to', 'a', 'Strategy', '.', 'This', 'injection', 'of', 'capital', 'will', 'have', 'no', 'effect', 'on', 'the', 'children', '.']
train
https://github.com/pmorissette/bt/blob/0363e6fa100d9392dd18e32e3d8379d5e83c28fa/bt/core.py#L589-L618
3,193
saltstack/salt
salt/modules/useradd.py
_quote_username
def _quote_username(name): ''' Usernames can only contain ascii chars, so make sure we return a str type ''' if not isinstance(name, six.string_types): return str(name) # future lint: disable=blacklisted-function else: return salt.utils.stringutils.to_str(name)
python
def _quote_username(name): ''' Usernames can only contain ascii chars, so make sure we return a str type ''' if not isinstance(name, six.string_types): return str(name) # future lint: disable=blacklisted-function else: return salt.utils.stringutils.to_str(name)
['def', '_quote_username', '(', 'name', ')', ':', 'if', 'not', 'isinstance', '(', 'name', ',', 'six', '.', 'string_types', ')', ':', 'return', 'str', '(', 'name', ')', '# future lint: disable=blacklisted-function', 'else', ':', 'return', 'salt', '.', 'utils', '.', 'stringutils', '.', 'to_str', '(', 'name', ')']
Usernames can only contain ascii chars, so make sure we return a str type
['Usernames', 'can', 'only', 'contain', 'ascii', 'chars', 'so', 'make', 'sure', 'we', 'return', 'a', 'str', 'type']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/useradd.py#L50-L57
3,194
saltstack/salt
salt/modules/localemod.py
_localectl_set
def _localectl_set(locale=''): ''' Use systemd's localectl command to set the LANG locale parameter, making sure not to trample on other params that have been set. ''' locale_params = _parse_dbus_locale() if dbus is not None else _localectl_status().get('system_locale', {}) locale_params['LANG']...
python
def _localectl_set(locale=''): ''' Use systemd's localectl command to set the LANG locale parameter, making sure not to trample on other params that have been set. ''' locale_params = _parse_dbus_locale() if dbus is not None else _localectl_status().get('system_locale', {}) locale_params['LANG']...
['def', '_localectl_set', '(', 'locale', '=', "''", ')', ':', 'locale_params', '=', '_parse_dbus_locale', '(', ')', 'if', 'dbus', 'is', 'not', 'None', 'else', '_localectl_status', '(', ')', '.', 'get', '(', "'system_locale'", ',', '{', '}', ')', 'locale_params', '[', "'LANG'", ']', '=', 'six', '.', 'text_type', '(', 'l...
Use systemd's localectl command to set the LANG locale parameter, making sure not to trample on other params that have been set.
['Use', 'systemd', 's', 'localectl', 'command', 'to', 'set', 'the', 'LANG', 'locale', 'parameter', 'making', 'sure', 'not', 'to', 'trample', 'on', 'other', 'params', 'that', 'have', 'been', 'set', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/localemod.py#L100-L108
3,195
RedHatInsights/insights-core
insights/collect.py
get_pool
def get_pool(parallel, kwargs): """ Yields: a ThreadPoolExecutor if parallel is True and `concurrent.futures` exists. `None` otherwise. """ if parallel: try: from concurrent.futures import ThreadPoolExecutor with ThreadPoolExecutor(thread_name_prefix="ins...
python
def get_pool(parallel, kwargs): """ Yields: a ThreadPoolExecutor if parallel is True and `concurrent.futures` exists. `None` otherwise. """ if parallel: try: from concurrent.futures import ThreadPoolExecutor with ThreadPoolExecutor(thread_name_prefix="ins...
['def', 'get_pool', '(', 'parallel', ',', 'kwargs', ')', ':', 'if', 'parallel', ':', 'try', ':', 'from', 'concurrent', '.', 'futures', 'import', 'ThreadPoolExecutor', 'with', 'ThreadPoolExecutor', '(', 'thread_name_prefix', '=', '"insights-collector-pool"', ',', '*', '*', 'kwargs', ')', 'as', 'pool', ':', 'yield', 'poo...
Yields: a ThreadPoolExecutor if parallel is True and `concurrent.futures` exists. `None` otherwise.
['Yields', ':', 'a', 'ThreadPoolExecutor', 'if', 'parallel', 'is', 'True', 'and', 'concurrent', '.', 'futures', 'exists', '.', 'None', 'otherwise', '.']
train
https://github.com/RedHatInsights/insights-core/blob/b57cbf8ed7c089672426ede0441e0a4f789ef4a1/insights/collect.py#L199-L214
3,196
clalancette/pycdlib
pycdlib/rockridge.py
RRERRecord.record
def record(self): # type: () -> bytes ''' Generate a string representing the Rock Ridge Extensions Reference record. Parameters: None. Returns: String containing the Rock Ridge record. ''' if not self._initialized: raise pycd...
python
def record(self): # type: () -> bytes ''' Generate a string representing the Rock Ridge Extensions Reference record. Parameters: None. Returns: String containing the Rock Ridge record. ''' if not self._initialized: raise pycd...
['def', 'record', '(', 'self', ')', ':', '# type: () -> bytes', 'if', 'not', 'self', '.', '_initialized', ':', 'raise', 'pycdlibexception', '.', 'PyCdlibInternalError', '(', "'ER record not yet initialized!'", ')', 'return', "b'ER'", '+', 'struct', '.', 'pack', '(', "'=BBBBBB'", ',', 'RRERRecord', '.', 'length', '(', '...
Generate a string representing the Rock Ridge Extensions Reference record. Parameters: None. Returns: String containing the Rock Ridge record.
['Generate', 'a', 'string', 'representing', 'the', 'Rock', 'Ridge', 'Extensions', 'Reference', 'record', '.']
train
https://github.com/clalancette/pycdlib/blob/1e7b77a809e905d67dc71e12d70e850be26b6233/pycdlib/rockridge.py#L623-L637
3,197
mitsei/dlkit
dlkit/json_/assessment/objects.py
Question.get_learning_objectives
def get_learning_objectives(self): """ This method also mirrors that in the Item.""" # This is pretty much identicial to the method in assessment.Item! mgr = self._get_provider_manager('LEARNING') lookup_session = mgr.get_objective_lookup_session(proxy=getattr(self, "_proxy", None)) ...
python
def get_learning_objectives(self): """ This method also mirrors that in the Item.""" # This is pretty much identicial to the method in assessment.Item! mgr = self._get_provider_manager('LEARNING') lookup_session = mgr.get_objective_lookup_session(proxy=getattr(self, "_proxy", None)) ...
['def', 'get_learning_objectives', '(', 'self', ')', ':', '# This is pretty much identicial to the method in assessment.Item!', 'mgr', '=', 'self', '.', '_get_provider_manager', '(', "'LEARNING'", ')', 'lookup_session', '=', 'mgr', '.', 'get_objective_lookup_session', '(', 'proxy', '=', 'getattr', '(', 'self', ',', '"_...
This method also mirrors that in the Item.
['This', 'method', 'also', 'mirrors', 'that', 'in', 'the', 'Item', '.']
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/objects.py#L128-L134
3,198
ejeschke/ginga
ginga/examples/gw/clocks.py
Clock.clock_resized_cb
def clock_resized_cb(self, viewer, width, height): """This method is called when an individual clock is resized. It deletes and reconstructs the placement of the text objects in the canvas. """ self.logger.info("resized canvas to %dx%d" % (width, height)) # add text objec...
python
def clock_resized_cb(self, viewer, width, height): """This method is called when an individual clock is resized. It deletes and reconstructs the placement of the text objects in the canvas. """ self.logger.info("resized canvas to %dx%d" % (width, height)) # add text objec...
['def', 'clock_resized_cb', '(', 'self', ',', 'viewer', ',', 'width', ',', 'height', ')', ':', 'self', '.', 'logger', '.', 'info', '(', '"resized canvas to %dx%d"', '%', '(', 'width', ',', 'height', ')', ')', '# add text objects to canvas', 'self', '.', 'canvas', '.', 'delete_all_objects', '(', ')', 'Text', '=', 'self'...
This method is called when an individual clock is resized. It deletes and reconstructs the placement of the text objects in the canvas.
['This', 'method', 'is', 'called', 'when', 'an', 'individual', 'clock', 'is', 'resized', '.', 'It', 'deletes', 'and', 'reconstructs', 'the', 'placement', 'of', 'the', 'text', 'objects', 'in', 'the', 'canvas', '.']
train
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/examples/gw/clocks.py#L82-L106
3,199
getsentry/sentry-plugins
src/sentry_plugins/github/plugin.py
GitHubRepositoryProvider.validate_config
def validate_config(self, organization, config, actor=None): """ ``` if config['foo'] and not config['bar']: raise PluginError('You cannot configure foo with bar') return config ``` """ if config.get('name'): client = self.get_client(actor)...
python
def validate_config(self, organization, config, actor=None): """ ``` if config['foo'] and not config['bar']: raise PluginError('You cannot configure foo with bar') return config ``` """ if config.get('name'): client = self.get_client(actor)...
['def', 'validate_config', '(', 'self', ',', 'organization', ',', 'config', ',', 'actor', '=', 'None', ')', ':', 'if', 'config', '.', 'get', '(', "'name'", ')', ':', 'client', '=', 'self', '.', 'get_client', '(', 'actor', ')', 'try', ':', 'repo', '=', 'client', '.', 'get_repo', '(', 'config', '[', "'name'", ']', ')', '...
``` if config['foo'] and not config['bar']: raise PluginError('You cannot configure foo with bar') return config ```
['if', 'config', '[', 'foo', ']', 'and', 'not', 'config', '[', 'bar', ']', ':', 'raise', 'PluginError', '(', 'You', 'cannot', 'configure', 'foo', 'with', 'bar', ')', 'return', 'config']
train
https://github.com/getsentry/sentry-plugins/blob/2d65331bcb807e0bb16b5e7bdcae56b152bb0dda/src/sentry_plugins/github/plugin.py#L278-L294