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
1,800
Cito/DBUtils
DBUtils/SteadyDB.py
SteadyDBConnection.begin
def begin(self, *args, **kwargs): """Indicate the beginning of a transaction. During a transaction, connections won't be transparently replaced, and all errors will be raised to the application. If the underlying driver supports this method, it will be called with the given par...
python
def begin(self, *args, **kwargs): """Indicate the beginning of a transaction. During a transaction, connections won't be transparently replaced, and all errors will be raised to the application. If the underlying driver supports this method, it will be called with the given par...
['def', 'begin', '(', 'self', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'self', '.', '_transaction', '=', 'True', 'try', ':', 'begin', '=', 'self', '.', '_con', '.', 'begin', 'except', 'AttributeError', ':', 'pass', 'else', ':', 'begin', '(', '*', 'args', ',', '*', '*', 'kwargs', ')']
Indicate the beginning of a transaction. During a transaction, connections won't be transparently replaced, and all errors will be raised to the application. If the underlying driver supports this method, it will be called with the given parameters (e.g. for distributed transactions).
['Indicate', 'the', 'beginning', 'of', 'a', 'transaction', '.']
train
https://github.com/Cito/DBUtils/blob/90e8825e038f08c82044b8e50831480175fa026a/DBUtils/SteadyDB.py#L409-L425
1,801
stanfordnlp/stanza
stanza/nlp/corenlp.py
CoreNLPClient.annotate_json
def annotate_json(self, text, annotators=None): """Return a JSON dict from the CoreNLP server, containing annotations of the text. :param (str) text: Text to annotate. :param (list[str]) annotators: a list of annotator names :return (dict): a dict of annotations """ # W...
python
def annotate_json(self, text, annotators=None): """Return a JSON dict from the CoreNLP server, containing annotations of the text. :param (str) text: Text to annotate. :param (list[str]) annotators: a list of annotator names :return (dict): a dict of annotations """ # W...
['def', 'annotate_json', '(', 'self', ',', 'text', ',', 'annotators', '=', 'None', ')', ':', "# WARN(chaganty): I'd like to deprecate this function -- we", '# should just use annotate().json', '#properties = {', "# 'annotators': ','.join(annotators or self.default_annotators),", "# 'outputFormat': 'json',", '#}',...
Return a JSON dict from the CoreNLP server, containing annotations of the text. :param (str) text: Text to annotate. :param (list[str]) annotators: a list of annotator names :return (dict): a dict of annotations
['Return', 'a', 'JSON', 'dict', 'from', 'the', 'CoreNLP', 'server', 'containing', 'annotations', 'of', 'the', 'text', '.']
train
https://github.com/stanfordnlp/stanza/blob/920c55d8eaa1e7105971059c66eb448a74c100d6/stanza/nlp/corenlp.py#L79-L96
1,802
rgs1/zk_shell
zk_shell/shell.py
Shell.do_time
def do_time(self, params): """ \x1b[1mNAME\x1b[0m time - Measures elapsed seconds after running commands \x1b[1mSYNOPSIS\x1b[0m time <cmd1> <cmd2> ... <cmdN> \x1b[1mEXAMPLES\x1b[0m > time 'loop 10 0 "create /foo_ bar ephemeral=false sequence=true"' Took 0.05585 seconds ...
python
def do_time(self, params): """ \x1b[1mNAME\x1b[0m time - Measures elapsed seconds after running commands \x1b[1mSYNOPSIS\x1b[0m time <cmd1> <cmd2> ... <cmdN> \x1b[1mEXAMPLES\x1b[0m > time 'loop 10 0 "create /foo_ bar ephemeral=false sequence=true"' Took 0.05585 seconds ...
['def', 'do_time', '(', 'self', ',', 'params', ')', ':', 'start', '=', 'time', '.', 'time', '(', ')', 'for', 'cmd', 'in', 'params', '.', 'cmds', ':', 'try', ':', 'self', '.', 'onecmd', '(', 'cmd', ')', 'except', 'Exception', 'as', 'ex', ':', 'self', '.', 'show_output', '(', '"Command failed: %s."', ',', 'ex', ')', 'ela...
\x1b[1mNAME\x1b[0m time - Measures elapsed seconds after running commands \x1b[1mSYNOPSIS\x1b[0m time <cmd1> <cmd2> ... <cmdN> \x1b[1mEXAMPLES\x1b[0m > time 'loop 10 0 "create /foo_ bar ephemeral=false sequence=true"' Took 0.05585 seconds
['\\', 'x1b', '[', '1mNAME', '\\', 'x1b', '[', '0m', 'time', '-', 'Measures', 'elapsed', 'seconds', 'after', 'running', 'commands']
train
https://github.com/rgs1/zk_shell/blob/bbf34fdfcf1f81100e2a5816fad8af6afc782a54/zk_shell/shell.py#L2883-L2903
1,803
tensorflow/datasets
tensorflow_datasets/translate/wmt.py
_parse_tmx
def _parse_tmx(path): """Generates examples from TMX file.""" def _get_tuv_lang(tuv): for k, v in tuv.items(): if k.endswith("}lang"): return v raise AssertionError("Language not found in `tuv` attributes.") def _get_tuv_seg(tuv): segs = tuv.findall("seg") assert len(segs) == 1, "In...
python
def _parse_tmx(path): """Generates examples from TMX file.""" def _get_tuv_lang(tuv): for k, v in tuv.items(): if k.endswith("}lang"): return v raise AssertionError("Language not found in `tuv` attributes.") def _get_tuv_seg(tuv): segs = tuv.findall("seg") assert len(segs) == 1, "In...
['def', '_parse_tmx', '(', 'path', ')', ':', 'def', '_get_tuv_lang', '(', 'tuv', ')', ':', 'for', 'k', ',', 'v', 'in', 'tuv', '.', 'items', '(', ')', ':', 'if', 'k', '.', 'endswith', '(', '"}lang"', ')', ':', 'return', 'v', 'raise', 'AssertionError', '(', '"Language not found in `tuv` attributes."', ')', 'def', '_get_t...
Generates examples from TMX file.
['Generates', 'examples', 'from', 'TMX', 'file', '.']
train
https://github.com/tensorflow/datasets/blob/46ceb0cf7b4690f38ecbbc689e4d659a903d08dc/tensorflow_datasets/translate/wmt.py#L838-L858
1,804
dnanexus/dx-toolkit
src/python/dxpy/bindings/search.py
find_projects
def find_projects(name=None, name_mode='exact', properties=None, tags=None, level=None, describe=False, explicit_perms=None, region=None, public=None, created_after=None, created_before=None, billed_to=None, limit=None, return_handler=False, first_page_size=100, con...
python
def find_projects(name=None, name_mode='exact', properties=None, tags=None, level=None, describe=False, explicit_perms=None, region=None, public=None, created_after=None, created_before=None, billed_to=None, limit=None, return_handler=False, first_page_size=100, con...
['def', 'find_projects', '(', 'name', '=', 'None', ',', 'name_mode', '=', "'exact'", ',', 'properties', '=', 'None', ',', 'tags', '=', 'None', ',', 'level', '=', 'None', ',', 'describe', '=', 'False', ',', 'explicit_perms', '=', 'None', ',', 'region', '=', 'None', ',', 'public', '=', 'None', ',', 'created_after', '=', ...
:param name: Name of the project (also see *name_mode*) :type name: string :param name_mode: Method by which to interpret the *name* field ("exact": exact match, "glob": use "*" and "?" as wildcards, "regexp": interpret as a regular expression) :type name_mode: string :param properties: Properties (key-...
[':', 'param', 'name', ':', 'Name', 'of', 'the', 'project', '(', 'also', 'see', '*', 'name_mode', '*', ')', ':', 'type', 'name', ':', 'string', ':', 'param', 'name_mode', ':', 'Method', 'by', 'which', 'to', 'interpret', 'the', '*', 'name', '*', 'field', '(', 'exact', ':', 'exact', 'match', 'glob', ':', 'use', '*', 'and...
train
https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/search.py#L434-L526
1,805
ivilata/pymultihash
multihash/multihash.py
Multihash.encode
def encode(self, encoding=None): r"""Encode into a multihash-encoded digest. If `encoding` is `None`, a binary digest is produced: >>> mh = Multihash(0x01, b'TEST') >>> mh.encode() b'\x01\x04TEST' If the name of an `encoding` is specified, it is used to encode the ...
python
def encode(self, encoding=None): r"""Encode into a multihash-encoded digest. If `encoding` is `None`, a binary digest is produced: >>> mh = Multihash(0x01, b'TEST') >>> mh.encode() b'\x01\x04TEST' If the name of an `encoding` is specified, it is used to encode the ...
['def', 'encode', '(', 'self', ',', 'encoding', '=', 'None', ')', ':', 'try', ':', 'fc', '=', 'self', '.', 'func', '.', 'value', 'except', 'AttributeError', ':', '# application-specific function code', 'fc', '=', 'self', '.', 'func', 'mhash', '=', 'bytes', '(', '[', 'fc', ',', 'len', '(', 'self', '.', 'digest', ')', ']...
r"""Encode into a multihash-encoded digest. If `encoding` is `None`, a binary digest is produced: >>> mh = Multihash(0x01, b'TEST') >>> mh.encode() b'\x01\x04TEST' If the name of an `encoding` is specified, it is used to encode the binary digest before returning it (se...
['r', 'Encode', 'into', 'a', 'multihash', '-', 'encoded', 'digest', '.']
train
https://github.com/ivilata/pymultihash/blob/093365f20f6d8627c1fae13e0f4e0b35e9b39ad2/multihash/multihash.py#L120-L145
1,806
consbio/gis-metadata-parser
gis_metadata/metadata_parser.py
MetadataParser._parse_dates
def _parse_dates(self, prop=DATES): """ Creates and returns a Date Types data structure parsed from the metadata """ return parse_dates(self._xml_tree, self._data_structures[prop])
python
def _parse_dates(self, prop=DATES): """ Creates and returns a Date Types data structure parsed from the metadata """ return parse_dates(self._xml_tree, self._data_structures[prop])
['def', '_parse_dates', '(', 'self', ',', 'prop', '=', 'DATES', ')', ':', 'return', 'parse_dates', '(', 'self', '.', '_xml_tree', ',', 'self', '.', '_data_structures', '[', 'prop', ']', ')']
Creates and returns a Date Types data structure parsed from the metadata
['Creates', 'and', 'returns', 'a', 'Date', 'Types', 'data', 'structure', 'parsed', 'from', 'the', 'metadata']
train
https://github.com/consbio/gis-metadata-parser/blob/59eefb2e51cd4d8cc3e94623a2167499ca9ef70f/gis_metadata/metadata_parser.py#L309-L312
1,807
saltstack/salt
salt/thorium/check.py
lt
def lt(name, value): ''' Only succeed if the value in the given register location is less than the given value USAGE: .. code-block:: yaml foo: check.lt: - value: 42 run_remote_ex: local.cmd: - tgt: '*' - func: test.ping ...
python
def lt(name, value): ''' Only succeed if the value in the given register location is less than the given value USAGE: .. code-block:: yaml foo: check.lt: - value: 42 run_remote_ex: local.cmd: - tgt: '*' - func: test.ping ...
['def', 'lt', '(', 'name', ',', 'value', ')', ':', 'ret', '=', '{', "'name'", ':', 'name', ',', "'result'", ':', 'False', ',', "'comment'", ':', "''", ',', "'changes'", ':', '{', '}', '}', 'if', 'name', 'not', 'in', '__reg__', ':', 'ret', '[', "'result'", ']', '=', 'False', 'ret', '[', "'comment'", ']', '=', "'Value {0...
Only succeed if the value in the given register location is less than the given value USAGE: .. code-block:: yaml foo: check.lt: - value: 42 run_remote_ex: local.cmd: - tgt: '*' - func: test.ping - require: ...
['Only', 'succeed', 'if', 'the', 'value', 'in', 'the', 'given', 'register', 'location', 'is', 'less', 'than', 'the', 'given', 'value']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/thorium/check.py#L83-L113
1,808
sdispater/eloquent
eloquent/migrations/database_migration_repository.py
DatabaseMigrationRepository.get_last
def get_last(self): """ Get the last migration batch. :rtype: list """ query = self.table().where('batch', self.get_last_batch_number()) return query.order_by('migration', 'desc').get()
python
def get_last(self): """ Get the last migration batch. :rtype: list """ query = self.table().where('batch', self.get_last_batch_number()) return query.order_by('migration', 'desc').get()
['def', 'get_last', '(', 'self', ')', ':', 'query', '=', 'self', '.', 'table', '(', ')', '.', 'where', '(', "'batch'", ',', 'self', '.', 'get_last_batch_number', '(', ')', ')', 'return', 'query', '.', 'order_by', '(', "'migration'", ',', "'desc'", ')', '.', 'get', '(', ')']
Get the last migration batch. :rtype: list
['Get', 'the', 'last', 'migration', 'batch', '.']
train
https://github.com/sdispater/eloquent/blob/0638b688d5fd0c1a46b7471dd465eeb4c2f84666/eloquent/migrations/database_migration_repository.py#L25-L33
1,809
openego/ding0
ding0/core/network/__init__.py
GridDing0.find_and_union_paths
def find_and_union_paths(self, node_source, nodes_target): """ Determines shortest paths from `node_source` to all nodes in `node_target` in _graph using find_path(). The branches of all paths are stored in a set - the result is a list of unique branches. Args ---- node_source:...
python
def find_and_union_paths(self, node_source, nodes_target): """ Determines shortest paths from `node_source` to all nodes in `node_target` in _graph using find_path(). The branches of all paths are stored in a set - the result is a list of unique branches. Args ---- node_source:...
['def', 'find_and_union_paths', '(', 'self', ',', 'node_source', ',', 'nodes_target', ')', ':', 'branches', '=', 'set', '(', ')', 'for', 'node_target', 'in', 'nodes_target', ':', 'path', '=', 'self', '.', 'find_path', '(', 'node_source', ',', 'node_target', ')', 'node_pairs', '=', 'list', '(', 'zip', '(', 'path', '[', ...
Determines shortest paths from `node_source` to all nodes in `node_target` in _graph using find_path(). The branches of all paths are stored in a set - the result is a list of unique branches. Args ---- node_source: GridDing0 source node, member of _graph node_targe...
['Determines', 'shortest', 'paths', 'from', 'node_source', 'to', 'all', 'nodes', 'in', 'node_target', 'in', '_graph', 'using', 'find_path', '()', '.']
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/__init__.py#L361-L385
1,810
pywbem/pywbem
wbemcli.py
gc
def gc(cn, ns=None, lo=None, iq=None, ico=None, pl=None): """ This function is a wrapper for :meth:`~pywbem.WBEMConnection.GetClass`. Retrieve a class. Parameters: cn (:term:`string` or :class:`~pywbem.CIMClassName`): Name of the class to be retrieved (case independent). ...
python
def gc(cn, ns=None, lo=None, iq=None, ico=None, pl=None): """ This function is a wrapper for :meth:`~pywbem.WBEMConnection.GetClass`. Retrieve a class. Parameters: cn (:term:`string` or :class:`~pywbem.CIMClassName`): Name of the class to be retrieved (case independent). ...
['def', 'gc', '(', 'cn', ',', 'ns', '=', 'None', ',', 'lo', '=', 'None', ',', 'iq', '=', 'None', ',', 'ico', '=', 'None', ',', 'pl', '=', 'None', ')', ':', 'return', 'CONN', '.', 'GetClass', '(', 'cn', ',', 'ns', ',', 'LocalOnly', '=', 'lo', ',', 'IncludeQualifiers', '=', 'iq', ',', 'IncludeClassOrigin', '=', 'ico', ',...
This function is a wrapper for :meth:`~pywbem.WBEMConnection.GetClass`. Retrieve a class. Parameters: cn (:term:`string` or :class:`~pywbem.CIMClassName`): Name of the class to be retrieved (case independent). If specified as a `CIMClassName` object, its `host` attribute will b...
['This', 'function', 'is', 'a', 'wrapper', 'for', ':', 'meth', ':', '~pywbem', '.', 'WBEMConnection', '.', 'GetClass', '.']
train
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/wbemcli.py#L2758-L2811
1,811
scarface-4711/denonavr
denonavr/denonavr.py
DenonAVR.create_zones
def create_zones(self, add_zones): """Create instances of additional zones for the receiver.""" for zone, zname in add_zones.items(): # Name either set explicitly or name of Main Zone with suffix zonename = "{} {}".format(self._name, zone) if ( zname is None) else...
python
def create_zones(self, add_zones): """Create instances of additional zones for the receiver.""" for zone, zname in add_zones.items(): # Name either set explicitly or name of Main Zone with suffix zonename = "{} {}".format(self._name, zone) if ( zname is None) else...
['def', 'create_zones', '(', 'self', ',', 'add_zones', ')', ':', 'for', 'zone', ',', 'zname', 'in', 'add_zones', '.', 'items', '(', ')', ':', '# Name either set explicitly or name of Main Zone with suffix', 'zonename', '=', '"{} {}"', '.', 'format', '(', 'self', '.', '_name', ',', 'zone', ')', 'if', '(', 'zname', 'is',...
Create instances of additional zones for the receiver.
['Create', 'instances', 'of', 'additional', 'zones', 'for', 'the', 'receiver', '.']
train
https://github.com/scarface-4711/denonavr/blob/59a136e27b43cb1d1e140cf67705087b3aa377cd/denonavr/denonavr.py#L390-L397
1,812
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_firmware_ext.py
brocade_firmware_ext.show_firmware_version_output_show_firmware_version_control_processor_memory
def show_firmware_version_output_show_firmware_version_control_processor_memory(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") show_firmware_version = ET.Element("show_firmware_version") config = show_firmware_version output = ET.SubElement(show...
python
def show_firmware_version_output_show_firmware_version_control_processor_memory(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") show_firmware_version = ET.Element("show_firmware_version") config = show_firmware_version output = ET.SubElement(show...
['def', 'show_firmware_version_output_show_firmware_version_control_processor_memory', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'config', '=', 'ET', '.', 'Element', '(', '"config"', ')', 'show_firmware_version', '=', 'ET', '.', 'Element', '(', '"show_firmware_version"', ')', 'config', '=', 'show_firmware_version...
Auto Generated Code
['Auto', 'Generated', 'Code']
train
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_firmware_ext.py#L137-L149
1,813
takuti/flurs
flurs/base.py
RecommenderMixin.register_user
def register_user(self, user): """For new users, append their information into the dictionaries. Args: user (User): User. """ self.users[user.index] = {'known_items': set()} self.n_user += 1
python
def register_user(self, user): """For new users, append their information into the dictionaries. Args: user (User): User. """ self.users[user.index] = {'known_items': set()} self.n_user += 1
['def', 'register_user', '(', 'self', ',', 'user', ')', ':', 'self', '.', 'users', '[', 'user', '.', 'index', ']', '=', '{', "'known_items'", ':', 'set', '(', ')', '}', 'self', '.', 'n_user', '+=', '1']
For new users, append their information into the dictionaries. Args: user (User): User.
['For', 'new', 'users', 'append', 'their', 'information', 'into', 'the', 'dictionaries', '.']
train
https://github.com/takuti/flurs/blob/a998fc180b45db7eaf38dbbbf8125a93100b8a8c/flurs/base.py#L45-L53
1,814
benjamin-hodgson/asynqp
doc/examples/helloworld.py
hello_world
def hello_world(): """ Sends a 'hello world' message and then reads it from the queue. """ # connect to the RabbitMQ broker connection = yield from asynqp.connect('localhost', 5672, username='guest', password='guest') # Open a communications channel channel = yield from connection.open_chan...
python
def hello_world(): """ Sends a 'hello world' message and then reads it from the queue. """ # connect to the RabbitMQ broker connection = yield from asynqp.connect('localhost', 5672, username='guest', password='guest') # Open a communications channel channel = yield from connection.open_chan...
['def', 'hello_world', '(', ')', ':', '# connect to the RabbitMQ broker', 'connection', '=', 'yield', 'from', 'asynqp', '.', 'connect', '(', "'localhost'", ',', '5672', ',', 'username', '=', "'guest'", ',', 'password', '=', "'guest'", ')', '# Open a communications channel', 'channel', '=', 'yield', 'from', 'connection'...
Sends a 'hello world' message and then reads it from the queue.
['Sends', 'a', 'hello', 'world', 'message', 'and', 'then', 'reads', 'it', 'from', 'the', 'queue', '.']
train
https://github.com/benjamin-hodgson/asynqp/blob/ea8630d1803d10d4fd64b1a0e50f3097710b34d1/doc/examples/helloworld.py#L6-L35
1,815
Hironsan/anago
anago/utils.py
load_glove
def load_glove(file): """Loads GloVe vectors in numpy array. Args: file (str): a path to a glove file. Return: dict: a dict of numpy arrays. """ model = {} with open(file, encoding="utf8", errors='ignore') as f: for line in f: line = line.split(' ') ...
python
def load_glove(file): """Loads GloVe vectors in numpy array. Args: file (str): a path to a glove file. Return: dict: a dict of numpy arrays. """ model = {} with open(file, encoding="utf8", errors='ignore') as f: for line in f: line = line.split(' ') ...
['def', 'load_glove', '(', 'file', ')', ':', 'model', '=', '{', '}', 'with', 'open', '(', 'file', ',', 'encoding', '=', '"utf8"', ',', 'errors', '=', "'ignore'", ')', 'as', 'f', ':', 'for', 'line', 'in', 'f', ':', 'line', '=', 'line', '.', 'split', '(', "' '", ')', 'word', '=', 'line', '[', '0', ']', 'vector', '=', 'np...
Loads GloVe vectors in numpy array. Args: file (str): a path to a glove file. Return: dict: a dict of numpy arrays.
['Loads', 'GloVe', 'vectors', 'in', 'numpy', 'array', '.']
train
https://github.com/Hironsan/anago/blob/66a97f91c41f9613b736892e9762dccb9c28f623/anago/utils.py#L267-L284
1,816
a1ezzz/wasp-general
wasp_general/uri.py
WURI.reset_component
def reset_component(self, component): """ Unset component in this URI :param component: component name (or component type) to reset :return: None """ if isinstance(component, str) is True: component = WURI.Component(component) self.__components[component] = None
python
def reset_component(self, component): """ Unset component in this URI :param component: component name (or component type) to reset :return: None """ if isinstance(component, str) is True: component = WURI.Component(component) self.__components[component] = None
['def', 'reset_component', '(', 'self', ',', 'component', ')', ':', 'if', 'isinstance', '(', 'component', ',', 'str', ')', 'is', 'True', ':', 'component', '=', 'WURI', '.', 'Component', '(', 'component', ')', 'self', '.', '__components', '[', 'component', ']', '=', 'None']
Unset component in this URI :param component: component name (or component type) to reset :return: None
['Unset', 'component', 'in', 'this', 'URI']
train
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/uri.py#L137-L146
1,817
pydsigner/pygu
pygu/pygw.py
Container.remove
def remove(self, *widgets): ''' Remove @widgets from the blitting hand of the Container(). Each arg must be a Widget(), a fellow Container(), or an iterable. Else, things get ugly... ''' for w in widgets: if w in self.widgets: self.widgets.re...
python
def remove(self, *widgets): ''' Remove @widgets from the blitting hand of the Container(). Each arg must be a Widget(), a fellow Container(), or an iterable. Else, things get ugly... ''' for w in widgets: if w in self.widgets: self.widgets.re...
['def', 'remove', '(', 'self', ',', '*', 'widgets', ')', ':', 'for', 'w', 'in', 'widgets', ':', 'if', 'w', 'in', 'self', '.', 'widgets', ':', 'self', '.', 'widgets', '.', 'remove', '(', 'w', ')', 'w', '.', 'remove_internal', '(', 'self', ')', 'elif', 'w', 'in', 'self', '.', 'containers', ':', 'self', '.', 'containers',...
Remove @widgets from the blitting hand of the Container(). Each arg must be a Widget(), a fellow Container(), or an iterable. Else, things get ugly...
['Remove']
train
https://github.com/pydsigner/pygu/blob/09fe71534900933908ab83db12f5659b7827e31c/pygu/pygw.py#L197-L213
1,818
mabuchilab/QNET
docs/_extensions/inheritance_diagram.py
InheritanceGraph._class_info
def _class_info(self, classes, show_builtins, private_bases, parts, aliases, top_classes): # type: (List[Any], bool, bool, int, Optional[Dict[unicode, unicode]], List[Any]) -> List[Tuple[unicode, unicode, List[unicode], unicode]] # NOQA """Return name and bases for all classes that are ancestors of ...
python
def _class_info(self, classes, show_builtins, private_bases, parts, aliases, top_classes): # type: (List[Any], bool, bool, int, Optional[Dict[unicode, unicode]], List[Any]) -> List[Tuple[unicode, unicode, List[unicode], unicode]] # NOQA """Return name and bases for all classes that are ancestors of ...
['def', '_class_info', '(', 'self', ',', 'classes', ',', 'show_builtins', ',', 'private_bases', ',', 'parts', ',', 'aliases', ',', 'top_classes', ')', ':', '# type: (List[Any], bool, bool, int, Optional[Dict[unicode, unicode]], List[Any]) -> List[Tuple[unicode, unicode, List[unicode], unicode]] # NOQA', 'all_classes',...
Return name and bases for all classes that are ancestors of *classes*. *parts* gives the number of dotted name parts that is removed from the displayed node names. *top_classes* gives the name(s) of the top most ancestor class to traverse to. Multiple names can be specified sep...
['Return', 'name', 'and', 'bases', 'for', 'all', 'classes', 'that', 'are', 'ancestors', 'of', '*', 'classes', '*', '.']
train
https://github.com/mabuchilab/QNET/blob/cc20d26dad78691d34c67173e5cd67dcac94208a/docs/_extensions/inheritance_diagram.py#L181-L236
1,819
exhuma/python-cluster
cluster/method/hierarchical.py
HierarchicalClustering.getlevel
def getlevel(self, threshold): """ Returns all clusters with a maximum distance of *threshold* in between each other :param threshold: the maximum distance between clusters. See :py:meth:`~cluster.cluster.Cluster.getlevel` """ # if it's not worth clustering, ju...
python
def getlevel(self, threshold): """ Returns all clusters with a maximum distance of *threshold* in between each other :param threshold: the maximum distance between clusters. See :py:meth:`~cluster.cluster.Cluster.getlevel` """ # if it's not worth clustering, ju...
['def', 'getlevel', '(', 'self', ',', 'threshold', ')', ':', "# if it's not worth clustering, just return the data", 'if', 'len', '(', 'self', '.', '_input', ')', '<=', '1', ':', 'return', 'self', '.', '_input', '# initialize the cluster if not yet done', 'if', 'not', 'self', '.', '__cluster_created', ':', 'self', '.',...
Returns all clusters with a maximum distance of *threshold* in between each other :param threshold: the maximum distance between clusters. See :py:meth:`~cluster.cluster.Cluster.getlevel`
['Returns', 'all', 'clusters', 'with', 'a', 'maximum', 'distance', 'of', '*', 'threshold', '*', 'in', 'between', 'each', 'other']
train
https://github.com/exhuma/python-cluster/blob/4c0ac14d9beafcd51f0d849151514083c296402f/cluster/method/hierarchical.py#L191-L209
1,820
gitpython-developers/GitPython
git/refs/log.py
RefLog.entry_at
def entry_at(cls, filepath, index): """:return: RefLogEntry at the given index :param filepath: full path to the index file from which to read the entry :param index: python list compatible index, i.e. it may be negative to specify an entry counted from the end of the list :...
python
def entry_at(cls, filepath, index): """:return: RefLogEntry at the given index :param filepath: full path to the index file from which to read the entry :param index: python list compatible index, i.e. it may be negative to specify an entry counted from the end of the list :...
['def', 'entry_at', '(', 'cls', ',', 'filepath', ',', 'index', ')', ':', 'fp', '=', 'open', '(', 'filepath', ',', "'rb'", ')', 'if', 'index', '<', '0', ':', 'return', 'RefLogEntry', '.', 'from_line', '(', 'fp', '.', 'readlines', '(', ')', '[', 'index', ']', '.', 'strip', '(', ')', ')', 'else', ':', '# read until index ...
:return: RefLogEntry at the given index :param filepath: full path to the index file from which to read the entry :param index: python list compatible index, i.e. it may be negative to specify an entry counted from the end of the list :raise IndexError: If the entry didn't exist ...
[':', 'return', ':', 'RefLogEntry', 'at', 'the', 'given', 'index', ':', 'param', 'filepath', ':', 'full', 'path', 'to', 'the', 'index', 'file', 'from', 'which', 'to', 'read', 'the', 'entry', ':', 'param', 'index', ':', 'python', 'list', 'compatible', 'index', 'i', '.', 'e', '.', 'it', 'may', 'be', 'negative', 'to', 'sp...
train
https://github.com/gitpython-developers/GitPython/blob/1f66e25c25cde2423917ee18c4704fff83b837d1/git/refs/log.py#L208-L236
1,821
f3at/feat
src/feat/models/getter.py
source_getattr
def source_getattr(): """ Creates a getter that will drop the current value and retrieve the source's attribute with the context key as name. """ def source_getattr(_value, context, **_params): value = getattr(context["model"].source, context["key"]) return _attr(value) return ...
python
def source_getattr(): """ Creates a getter that will drop the current value and retrieve the source's attribute with the context key as name. """ def source_getattr(_value, context, **_params): value = getattr(context["model"].source, context["key"]) return _attr(value) return ...
['def', 'source_getattr', '(', ')', ':', 'def', 'source_getattr', '(', '_value', ',', 'context', ',', '*', '*', '_params', ')', ':', 'value', '=', 'getattr', '(', 'context', '[', '"model"', ']', '.', 'source', ',', 'context', '[', '"key"', ']', ')', 'return', '_attr', '(', 'value', ')', 'return', 'source_getattr']
Creates a getter that will drop the current value and retrieve the source's attribute with the context key as name.
['Creates', 'a', 'getter', 'that', 'will', 'drop', 'the', 'current', 'value', 'and', 'retrieve', 'the', 'source', 's', 'attribute', 'with', 'the', 'context', 'key', 'as', 'name', '.']
train
https://github.com/f3at/feat/blob/15da93fc9d6ec8154f52a9172824e25821195ef8/src/feat/models/getter.py#L68-L78
1,822
mmp2/megaman
megaman/relaxation/riemannian_relaxation.py
RiemannianRelaxation.compute_dual_rmetric
def compute_dual_rmetric(self,Ynew=None): """Helper function to calculate the """ usedY = self.Y if Ynew is None else Ynew rieman_metric = RiemannMetric(usedY, self.laplacian_matrix) return rieman_metric.get_dual_rmetric()
python
def compute_dual_rmetric(self,Ynew=None): """Helper function to calculate the """ usedY = self.Y if Ynew is None else Ynew rieman_metric = RiemannMetric(usedY, self.laplacian_matrix) return rieman_metric.get_dual_rmetric()
['def', 'compute_dual_rmetric', '(', 'self', ',', 'Ynew', '=', 'None', ')', ':', 'usedY', '=', 'self', '.', 'Y', 'if', 'Ynew', 'is', 'None', 'else', 'Ynew', 'rieman_metric', '=', 'RiemannMetric', '(', 'usedY', ',', 'self', '.', 'laplacian_matrix', ')', 'return', 'rieman_metric', '.', 'get_dual_rmetric', '(', ')']
Helper function to calculate the
['Helper', 'function', 'to', 'calculate', 'the']
train
https://github.com/mmp2/megaman/blob/faccaf267aad0a8b18ec8a705735fd9dd838ca1e/megaman/relaxation/riemannian_relaxation.py#L103-L107
1,823
msoulier/tftpy
tftpy/TftpContexts.py
TftpContextClientDownload.start
def start(self): """Initiate the download.""" log.info("Sending tftp download request to %s" % self.host) log.info(" filename -> %s" % self.file_to_transfer) log.info(" options -> %s" % self.options) self.metrics.start_time = time.time() log.debug("Set metrics.star...
python
def start(self): """Initiate the download.""" log.info("Sending tftp download request to %s" % self.host) log.info(" filename -> %s" % self.file_to_transfer) log.info(" options -> %s" % self.options) self.metrics.start_time = time.time() log.debug("Set metrics.star...
['def', 'start', '(', 'self', ')', ':', 'log', '.', 'info', '(', '"Sending tftp download request to %s"', '%', 'self', '.', 'host', ')', 'log', '.', 'info', '(', '" filename -> %s"', '%', 'self', '.', 'file_to_transfer', ')', 'log', '.', 'info', '(', '" options -> %s"', '%', 'self', '.', 'options', ')', 'self', '...
Initiate the download.
['Initiate', 'the', 'download', '.']
train
https://github.com/msoulier/tftpy/blob/af2f2fe89a3bf45748b78703820efb0986a8207a/tftpy/TftpContexts.py#L379-L422
1,824
blockcypher/blockcypher-python
blockcypher/api.py
simple_spend_p2sh
def simple_spend_p2sh(all_from_pubkeys, from_privkeys_to_use, to_address, to_satoshis, change_address=None, min_confirmations=0, api_key=None, coin_symbol='btc'): ''' Simple method to spend from a p2sh address. all_from_pubkeys is a list of *all* pubkeys for the address in question. from_privk...
python
def simple_spend_p2sh(all_from_pubkeys, from_privkeys_to_use, to_address, to_satoshis, change_address=None, min_confirmations=0, api_key=None, coin_symbol='btc'): ''' Simple method to spend from a p2sh address. all_from_pubkeys is a list of *all* pubkeys for the address in question. from_privk...
['def', 'simple_spend_p2sh', '(', 'all_from_pubkeys', ',', 'from_privkeys_to_use', ',', 'to_address', ',', 'to_satoshis', ',', 'change_address', '=', 'None', ',', 'min_confirmations', '=', '0', ',', 'api_key', '=', 'None', ',', 'coin_symbol', '=', "'btc'", ')', ':', 'assert', 'is_valid_coin_symbol', '(', 'coin_symbol',...
Simple method to spend from a p2sh address. all_from_pubkeys is a list of *all* pubkeys for the address in question. from_privkeys_to_use is a list of all privkeys that will be used to sign the tx (and no more). If the address is a 2-of-3 multisig and you supply 1 (or 3) from_privkeys_to_use this will bre...
['Simple', 'method', 'to', 'spend', 'from', 'a', 'p2sh', 'address', '.']
train
https://github.com/blockcypher/blockcypher-python/blob/7601ea21916957ff279384fd699527ff9c28a56e/blockcypher/api.py#L1701-L1839
1,825
nornir-automation/nornir
nornir/plugins/tasks/networking/netmiko_file_transfer.py
netmiko_file_transfer
def netmiko_file_transfer( task: Task, source_file: str, dest_file: str, **kwargs: Any ) -> Result: """ Execute Netmiko file_transfer method Arguments: source_file: Source file. dest_file: Destination file. kwargs: Additional arguments to pass to file_transfer Returns: ...
python
def netmiko_file_transfer( task: Task, source_file: str, dest_file: str, **kwargs: Any ) -> Result: """ Execute Netmiko file_transfer method Arguments: source_file: Source file. dest_file: Destination file. kwargs: Additional arguments to pass to file_transfer Returns: ...
['def', 'netmiko_file_transfer', '(', 'task', ':', 'Task', ',', 'source_file', ':', 'str', ',', 'dest_file', ':', 'str', ',', '*', '*', 'kwargs', ':', 'Any', ')', '->', 'Result', ':', 'net_connect', '=', 'task', '.', 'host', '.', 'get_connection', '(', '"netmiko"', ',', 'task', '.', 'nornir', '.', 'config', ')', 'kwarg...
Execute Netmiko file_transfer method Arguments: source_file: Source file. dest_file: Destination file. kwargs: Additional arguments to pass to file_transfer Returns: Result object with the following attributes set: * result (``bool``): file exists and MD5 is valid ...
['Execute', 'Netmiko', 'file_transfer', 'method']
train
https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/plugins/tasks/networking/netmiko_file_transfer.py#L8-L36
1,826
BrianHicks/emit
emit/router/core.py
Router.resolve_node_modules
def resolve_node_modules(self): 'import the modules specified in init' if not self.resolved_node_modules: try: self.resolved_node_modules = [ importlib.import_module(mod, self.node_package) for mod in self.node_modules ]...
python
def resolve_node_modules(self): 'import the modules specified in init' if not self.resolved_node_modules: try: self.resolved_node_modules = [ importlib.import_module(mod, self.node_package) for mod in self.node_modules ]...
['def', 'resolve_node_modules', '(', 'self', ')', ':', 'if', 'not', 'self', '.', 'resolved_node_modules', ':', 'try', ':', 'self', '.', 'resolved_node_modules', '=', '[', 'importlib', '.', 'import_module', '(', 'mod', ',', 'self', '.', 'node_package', ')', 'for', 'mod', 'in', 'self', '.', 'node_modules', ']', 'except',...
import the modules specified in init
['import', 'the', 'modules', 'specified', 'in', 'init']
train
https://github.com/BrianHicks/emit/blob/19a86c2392b136c9e857000798ccaa525aa0ed84/emit/router/core.py#L161-L173
1,827
pazz/alot
alot/ui.py
UI.choice
def choice(self, message, choices=None, select=None, cancel=None, msg_position='above', choices_to_return=None): """ prompt user to make a choice. :param message: string to display before list of choices :type message: unicode :param choices: dict of possible choi...
python
def choice(self, message, choices=None, select=None, cancel=None, msg_position='above', choices_to_return=None): """ prompt user to make a choice. :param message: string to display before list of choices :type message: unicode :param choices: dict of possible choi...
['def', 'choice', '(', 'self', ',', 'message', ',', 'choices', '=', 'None', ',', 'select', '=', 'None', ',', 'cancel', '=', 'None', ',', 'msg_position', '=', "'above'", ',', 'choices_to_return', '=', 'None', ')', ':', 'choices', '=', 'choices', 'or', '{', "'y'", ':', "'yes'", ',', "'n'", ':', "'no'", '}', 'assert', 'se...
prompt user to make a choice. :param message: string to display before list of choices :type message: unicode :param choices: dict of possible choices :type choices: dict: keymap->choice (both str) :param choices_to_return: dict of possible choices to return for the ...
['prompt', 'user', 'to', 'make', 'a', 'choice', '.']
train
https://github.com/pazz/alot/blob/d0297605c0ec1c6b65f541d0fd5b69ac5a0f4ded/alot/ui.py#L514-L579
1,828
widdowquinn/pyani
pyani/pyani_graphics.py
clean_axis
def clean_axis(axis): """Remove ticks, tick labels, and frame from axis""" axis.get_xaxis().set_ticks([]) axis.get_yaxis().set_ticks([]) for spine in list(axis.spines.values()): spine.set_visible(False)
python
def clean_axis(axis): """Remove ticks, tick labels, and frame from axis""" axis.get_xaxis().set_ticks([]) axis.get_yaxis().set_ticks([]) for spine in list(axis.spines.values()): spine.set_visible(False)
['def', 'clean_axis', '(', 'axis', ')', ':', 'axis', '.', 'get_xaxis', '(', ')', '.', 'set_ticks', '(', '[', ']', ')', 'axis', '.', 'get_yaxis', '(', ')', '.', 'set_ticks', '(', '[', ']', ')', 'for', 'spine', 'in', 'list', '(', 'axis', '.', 'spines', '.', 'values', '(', ')', ')', ':', 'spine', '.', 'set_visible', '(', ...
Remove ticks, tick labels, and frame from axis
['Remove', 'ticks', 'tick', 'labels', 'and', 'frame', 'from', 'axis']
train
https://github.com/widdowquinn/pyani/blob/2b24ec971401e04024bba896e4011984fe3f53f0/pyani/pyani_graphics.py#L63-L68
1,829
sernst/cauldron
cauldron/session/projects/steps.py
ProjectStep.get_dom
def get_dom(self) -> str: """ Retrieves the current value of the DOM for the step """ if self.is_running: return self.dumps() if self.dom is not None: return self.dom dom = self.dumps() self.dom = dom return dom
python
def get_dom(self) -> str: """ Retrieves the current value of the DOM for the step """ if self.is_running: return self.dumps() if self.dom is not None: return self.dom dom = self.dumps() self.dom = dom return dom
['def', 'get_dom', '(', 'self', ')', '->', 'str', ':', 'if', 'self', '.', 'is_running', ':', 'return', 'self', '.', 'dumps', '(', ')', 'if', 'self', '.', 'dom', 'is', 'not', 'None', ':', 'return', 'self', '.', 'dom', 'dom', '=', 'self', '.', 'dumps', '(', ')', 'self', '.', 'dom', '=', 'dom', 'return', 'dom']
Retrieves the current value of the DOM for the step
['Retrieves', 'the', 'current', 'value', 'of', 'the', 'DOM', 'for', 'the', 'step']
train
https://github.com/sernst/cauldron/blob/4086aec9c038c402ea212c79fe8bd0d27104f9cf/cauldron/session/projects/steps.py#L179-L190
1,830
juju/charm-helpers
charmhelpers/cli/__init__.py
OutputFormatter.tab
def tab(self, output): """Output data in excel-compatible tab-delimited format""" import csv csvwriter = csv.writer(self.outfile, dialect=csv.excel_tab) csvwriter.writerows(output)
python
def tab(self, output): """Output data in excel-compatible tab-delimited format""" import csv csvwriter = csv.writer(self.outfile, dialect=csv.excel_tab) csvwriter.writerows(output)
['def', 'tab', '(', 'self', ',', 'output', ')', ':', 'import', 'csv', 'csvwriter', '=', 'csv', '.', 'writer', '(', 'self', '.', 'outfile', ',', 'dialect', '=', 'csv', '.', 'excel_tab', ')', 'csvwriter', '.', 'writerows', '(', 'output', ')']
Output data in excel-compatible tab-delimited format
['Output', 'data', 'in', 'excel', '-', 'compatible', 'tab', '-', 'delimited', 'format']
train
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/cli/__init__.py#L81-L85
1,831
PMBio/limix-backup
limix/deprecated/archive/qtl_old.py
interact_GxG
def interact_GxG(pheno,snps1,snps2=None,K=None,covs=None): """ Epistasis test between two sets of SNPs Args: pheno: [N x 1] SP.array of 1 phenotype for N individuals snps1: [N x S1] SP.array of S1 SNPs for N individuals snps2: [N x S2] SP.array of S2 SNPs for N individuals ...
python
def interact_GxG(pheno,snps1,snps2=None,K=None,covs=None): """ Epistasis test between two sets of SNPs Args: pheno: [N x 1] SP.array of 1 phenotype for N individuals snps1: [N x S1] SP.array of S1 SNPs for N individuals snps2: [N x S2] SP.array of S2 SNPs for N individuals ...
['def', 'interact_GxG', '(', 'pheno', ',', 'snps1', ',', 'snps2', '=', 'None', ',', 'K', '=', 'None', ',', 'covs', '=', 'None', ')', ':', 'if', 'K', 'is', 'None', ':', 'K', '=', 'SP', '.', 'eye', '(', 'N', ')', 'N', '=', 'snps1', '.', 'shape', '[', '0', ']', 'if', 'snps2', 'is', 'None', ':', 'snps2', '=', 'snps1', 'ret...
Epistasis test between two sets of SNPs Args: pheno: [N x 1] SP.array of 1 phenotype for N individuals snps1: [N x S1] SP.array of S1 SNPs for N individuals snps2: [N x S2] SP.array of S2 SNPs for N individuals K: [N x N] SP.array of LMM-covariance/kinship koefficients (opti...
['Epistasis', 'test', 'between', 'two', 'sets', 'of', 'SNPs']
train
https://github.com/PMBio/limix-backup/blob/1e201fdb5c694d0d5506f207f3de65d8ef66146c/limix/deprecated/archive/qtl_old.py#L488-L509
1,832
noirbizarre/django-eztables
eztables/views.py
DatatablesView.get_page
def get_page(self, form): '''Get the requested page''' page_size = form.cleaned_data['iDisplayLength'] start_index = form.cleaned_data['iDisplayStart'] paginator = Paginator(self.object_list, page_size) num_page = (start_index / page_size) + 1 return paginator.page(num_pa...
python
def get_page(self, form): '''Get the requested page''' page_size = form.cleaned_data['iDisplayLength'] start_index = form.cleaned_data['iDisplayStart'] paginator = Paginator(self.object_list, page_size) num_page = (start_index / page_size) + 1 return paginator.page(num_pa...
['def', 'get_page', '(', 'self', ',', 'form', ')', ':', 'page_size', '=', 'form', '.', 'cleaned_data', '[', "'iDisplayLength'", ']', 'start_index', '=', 'form', '.', 'cleaned_data', '[', "'iDisplayStart'", ']', 'paginator', '=', 'Paginator', '(', 'self', '.', 'object_list', ',', 'page_size', ')', 'num_page', '=', '(', ...
Get the requested page
['Get', 'the', 'requested', 'page']
train
https://github.com/noirbizarre/django-eztables/blob/347e74dcc08121d20f4cf942181d873dbe33b995/eztables/views.py#L179-L185
1,833
FactoryBoy/factory_boy
factory/base.py
BaseFactory.attributes
def attributes(cls, create=False, extra=None): """Build a dict of attribute values, respecting declaration order. The process is: - Handle 'orderless' attributes, overriding defaults with provided kwargs when applicable - Handle ordered attributes, overriding them with provi...
python
def attributes(cls, create=False, extra=None): """Build a dict of attribute values, respecting declaration order. The process is: - Handle 'orderless' attributes, overriding defaults with provided kwargs when applicable - Handle ordered attributes, overriding them with provi...
['def', 'attributes', '(', 'cls', ',', 'create', '=', 'False', ',', 'extra', '=', 'None', ')', ':', 'warnings', '.', 'warn', '(', '"Usage of Factory.attributes() is deprecated."', ',', 'DeprecationWarning', ',', 'stacklevel', '=', '2', ',', ')', 'declarations', '=', 'cls', '.', '_meta', '.', 'pre_declarations', '.', 'a...
Build a dict of attribute values, respecting declaration order. The process is: - Handle 'orderless' attributes, overriding defaults with provided kwargs when applicable - Handle ordered attributes, overriding them with provided kwargs when applicable; the current list o...
['Build', 'a', 'dict', 'of', 'attribute', 'values', 'respecting', 'declaration', 'order', '.']
train
https://github.com/FactoryBoy/factory_boy/blob/edaa7c7f5a14065b229927903bd7989cc93cd069/factory/base.py#L444-L462
1,834
AtteqCom/zsl
src/zsl/resource/json_server_resource.py
JsonServerResource.read
def read(self, params, args, data): """Modifies the parameters and adds metadata for read results.""" result_count = None result_links = None if params is None: params = [] if args: args = args.copy() else: args = {} ctx = sel...
python
def read(self, params, args, data): """Modifies the parameters and adds metadata for read results.""" result_count = None result_links = None if params is None: params = [] if args: args = args.copy() else: args = {} ctx = sel...
['def', 'read', '(', 'self', ',', 'params', ',', 'args', ',', 'data', ')', ':', 'result_count', '=', 'None', 'result_links', '=', 'None', 'if', 'params', 'is', 'None', ':', 'params', '=', '[', ']', 'if', 'args', ':', 'args', '=', 'args', '.', 'copy', '(', ')', 'else', ':', 'args', '=', '{', '}', 'ctx', '=', 'self', '.'...
Modifies the parameters and adds metadata for read results.
['Modifies', 'the', 'parameters', 'and', 'adds', 'metadata', 'for', 'read', 'results', '.']
train
https://github.com/AtteqCom/zsl/blob/ab51a96da1780ff642912396d4b85bdcb72560c1/src/zsl/resource/json_server_resource.py#L188-L231
1,835
JNRowe/upoints
upoints/osm.py
_get_flags
def _get_flags(osm_obj): """Create element independent flags output. Args: osm_obj (Node): Object with OSM-style metadata Returns: list: Human readable flags output """ flags = [] if osm_obj.visible: flags.append('visible') if osm_obj.user: flags.append('use...
python
def _get_flags(osm_obj): """Create element independent flags output. Args: osm_obj (Node): Object with OSM-style metadata Returns: list: Human readable flags output """ flags = [] if osm_obj.visible: flags.append('visible') if osm_obj.user: flags.append('use...
['def', '_get_flags', '(', 'osm_obj', ')', ':', 'flags', '=', '[', ']', 'if', 'osm_obj', '.', 'visible', ':', 'flags', '.', 'append', '(', "'visible'", ')', 'if', 'osm_obj', '.', 'user', ':', 'flags', '.', 'append', '(', "'user: %s'", '%', 'osm_obj', '.', 'user', ')', 'if', 'osm_obj', '.', 'timestamp', ':', 'flags', '....
Create element independent flags output. Args: osm_obj (Node): Object with OSM-style metadata Returns: list: Human readable flags output
['Create', 'element', 'independent', 'flags', 'output', '.']
train
https://github.com/JNRowe/upoints/blob/1e4b7a53ed2a06cd854523d54c36aabdccea3830/upoints/osm.py#L62-L81
1,836
cytoscape/py2cytoscape
py2cytoscape/cyrest/networks.py
networks.deleteNode
def deleteNode(self, networkId, nodeId, verbose=None): """ Deletes the node specified by the `nodeId` and `networkId` parameters. :param networkId: SUID of the network containing the node. :param nodeId: SUID of the node :param verbose: print more :returns: default: suc...
python
def deleteNode(self, networkId, nodeId, verbose=None): """ Deletes the node specified by the `nodeId` and `networkId` parameters. :param networkId: SUID of the network containing the node. :param nodeId: SUID of the node :param verbose: print more :returns: default: suc...
['def', 'deleteNode', '(', 'self', ',', 'networkId', ',', 'nodeId', ',', 'verbose', '=', 'None', ')', ':', 'response', '=', 'api', '(', 'url', '=', 'self', '.', '___url', '+', "'networks/'", '+', 'str', '(', 'networkId', ')', '+', "'/nodes/'", '+', 'str', '(', 'nodeId', ')', '+', "''", ',', 'method', '=', '"DELETE"', '...
Deletes the node specified by the `nodeId` and `networkId` parameters. :param networkId: SUID of the network containing the node. :param nodeId: SUID of the node :param verbose: print more :returns: default: successful operation
['Deletes', 'the', 'node', 'specified', 'by', 'the', 'nodeId', 'and', 'networkId', 'parameters', '.']
train
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/networks.py#L744-L756
1,837
cqparts/cqparts
src/cqparts_fasteners/solidtypes/fastener_heads/base.py
FastenerHead.make_cutter
def make_cutter(self): """ Create solid to subtract from material to make way for the fastener's head (just the head) """ return cadquery.Workplane('XY') \ .circle(self.access_diameter / 2) \ .extrude(self.access_height)
python
def make_cutter(self): """ Create solid to subtract from material to make way for the fastener's head (just the head) """ return cadquery.Workplane('XY') \ .circle(self.access_diameter / 2) \ .extrude(self.access_height)
['def', 'make_cutter', '(', 'self', ')', ':', 'return', 'cadquery', '.', 'Workplane', '(', "'XY'", ')', '.', 'circle', '(', 'self', '.', 'access_diameter', '/', '2', ')', '.', 'extrude', '(', 'self', '.', 'access_height', ')']
Create solid to subtract from material to make way for the fastener's head (just the head)
['Create', 'solid', 'to', 'subtract', 'from', 'material', 'to', 'make', 'way', 'for', 'the', 'fastener', 's', 'head', '(', 'just', 'the', 'head', ')']
train
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/solidtypes/fastener_heads/base.py#L26-L33
1,838
azraq27/neural
neural/freesurfer.py
mgz_to_nifti
def mgz_to_nifti(filename,prefix=None,gzip=True): '''Convert ``filename`` to a NIFTI file using ``mri_convert``''' setup_freesurfer() if prefix==None: prefix = nl.prefix(filename) + '.nii' if gzip and not prefix.endswith('.gz'): prefix += '.gz' nl.run([os.path.join(freesurfer_home,'b...
python
def mgz_to_nifti(filename,prefix=None,gzip=True): '''Convert ``filename`` to a NIFTI file using ``mri_convert``''' setup_freesurfer() if prefix==None: prefix = nl.prefix(filename) + '.nii' if gzip and not prefix.endswith('.gz'): prefix += '.gz' nl.run([os.path.join(freesurfer_home,'b...
['def', 'mgz_to_nifti', '(', 'filename', ',', 'prefix', '=', 'None', ',', 'gzip', '=', 'True', ')', ':', 'setup_freesurfer', '(', ')', 'if', 'prefix', '==', 'None', ':', 'prefix', '=', 'nl', '.', 'prefix', '(', 'filename', ')', '+', "'.nii'", 'if', 'gzip', 'and', 'not', 'prefix', '.', 'endswith', '(', "'.gz'", ')', ':'...
Convert ``filename`` to a NIFTI file using ``mri_convert``
['Convert', 'filename', 'to', 'a', 'NIFTI', 'file', 'using', 'mri_convert']
train
https://github.com/azraq27/neural/blob/fe91bfeecbf73ad99708cf5dca66cb61fcd529f5/neural/freesurfer.py#L34-L41
1,839
SatelliteQE/nailgun
nailgun/entity_mixins.py
EntityReadMixin.read
def read(self, entity=None, attrs=None, ignore=None, params=None): """Get information about the current entity. 1. Create a new entity of type ``type(self)``. 2. Call :meth:`read_json` and capture the response. 3. Populate the entity with the response. 4. Return the entity. ...
python
def read(self, entity=None, attrs=None, ignore=None, params=None): """Get information about the current entity. 1. Create a new entity of type ``type(self)``. 2. Call :meth:`read_json` and capture the response. 3. Populate the entity with the response. 4. Return the entity. ...
['def', 'read', '(', 'self', ',', 'entity', '=', 'None', ',', 'attrs', '=', 'None', ',', 'ignore', '=', 'None', ',', 'params', '=', 'None', ')', ':', 'if', 'entity', 'is', 'None', ':', 'entity', '=', 'type', '(', 'self', ')', '(', 'self', '.', '_server_config', ')', 'if', 'attrs', 'is', 'None', ':', 'attrs', '=', 'self...
Get information about the current entity. 1. Create a new entity of type ``type(self)``. 2. Call :meth:`read_json` and capture the response. 3. Populate the entity with the response. 4. Return the entity. Step one is skipped if the ``entity`` argument is specified. Step two ...
['Get', 'information', 'about', 'the', 'current', 'entity', '.']
train
https://github.com/SatelliteQE/nailgun/blob/c36d8c20862e87bf6975bd48ac1ca40a9e634eaa/nailgun/entity_mixins.py#L751-L823
1,840
iskandr/fancyimpute
fancyimpute/solver.py
Solver.transform
def transform(self, X, y=None): """ Transform input `X`. Note: all imputations should have a `fit_transform` method, but only some (like IterativeImputer) also support inductive mode using `fit` or `fit_transform` on `X_train` and then `transform` on new `X_test`. ...
python
def transform(self, X, y=None): """ Transform input `X`. Note: all imputations should have a `fit_transform` method, but only some (like IterativeImputer) also support inductive mode using `fit` or `fit_transform` on `X_train` and then `transform` on new `X_test`. ...
['def', 'transform', '(', 'self', ',', 'X', ',', 'y', '=', 'None', ')', ':', 'raise', 'ValueError', '(', '"%s.transform not implemented! This imputation algorithm likely "', '"doesn\'t support inductive mode. Only %s.fit_transform is "', '"supported at this time."', '%', '(', 'self', '.', '__class__', '.', '__name__', ...
Transform input `X`. Note: all imputations should have a `fit_transform` method, but only some (like IterativeImputer) also support inductive mode using `fit` or `fit_transform` on `X_train` and then `transform` on new `X_test`.
['Transform', 'input', 'X', '.']
train
https://github.com/iskandr/fancyimpute/blob/9f0837d387c7303d5c8c925a9989ca77a1a96e3e/fancyimpute/solver.py#L215-L228
1,841
IBMStreams/pypi.streamsx
streamsx/topology/topology.py
Stream.publish
def publish(self, topic, schema=None, name=None): """ Publish this stream on a topic for other Streams applications to subscribe to. A Streams application may publish a stream to allow other Streams applications to subscribe to it. A subscriber matches a publisher if the topic an...
python
def publish(self, topic, schema=None, name=None): """ Publish this stream on a topic for other Streams applications to subscribe to. A Streams application may publish a stream to allow other Streams applications to subscribe to it. A subscriber matches a publisher if the topic an...
['def', 'publish', '(', 'self', ',', 'topic', ',', 'schema', '=', 'None', ',', 'name', '=', 'None', ')', ':', 'sl', '=', '_SourceLocation', '(', '_source_info', '(', ')', ',', "'publish'", ')', 'schema', '=', 'streamsx', '.', 'topology', '.', 'schema', '.', '_normalize', '(', 'schema', ')', 'if', 'schema', 'is', 'not',...
Publish this stream on a topic for other Streams applications to subscribe to. A Streams application may publish a stream to allow other Streams applications to subscribe to it. A subscriber matches a publisher if the topic and schema match. By default a stream is published using its sc...
['Publish', 'this', 'stream', 'on', 'a', 'topic', 'for', 'other', 'Streams', 'applications', 'to', 'subscribe', 'to', '.', 'A', 'Streams', 'application', 'may', 'publish', 'a', 'stream', 'to', 'allow', 'other', 'Streams', 'applications', 'to', 'subscribe', 'to', 'it', '.', 'A', 'subscriber', 'matches', 'a', 'publisher'...
train
https://github.com/IBMStreams/pypi.streamsx/blob/abd67b4757120f6f805787fba390f53e9df9cdd8/streamsx/topology/topology.py#L1601-L1667
1,842
cmbruns/pyopenvr
src/openvr/__init__.py
IVRRenderModels.getRenderModelName
def getRenderModelName(self, unRenderModelIndex, pchRenderModelName, unRenderModelNameLen): """ Use this to get the names of available render models. Index does not correlate to a tracked device index, but is only used for iterating over all available render models. If the index is out of rang...
python
def getRenderModelName(self, unRenderModelIndex, pchRenderModelName, unRenderModelNameLen): """ Use this to get the names of available render models. Index does not correlate to a tracked device index, but is only used for iterating over all available render models. If the index is out of rang...
['def', 'getRenderModelName', '(', 'self', ',', 'unRenderModelIndex', ',', 'pchRenderModelName', ',', 'unRenderModelNameLen', ')', ':', 'fn', '=', 'self', '.', 'function_table', '.', 'getRenderModelName', 'result', '=', 'fn', '(', 'unRenderModelIndex', ',', 'pchRenderModelName', ',', 'unRenderModelNameLen', ')', 'retur...
Use this to get the names of available render models. Index does not correlate to a tracked device index, but is only used for iterating over all available render models. If the index is out of range, this function will return 0. Otherwise, it will return the size of the buffer required for the name.
['Use', 'this', 'to', 'get', 'the', 'names', 'of', 'available', 'render', 'models', '.', 'Index', 'does', 'not', 'correlate', 'to', 'a', 'tracked', 'device', 'index', 'but', 'is', 'only', 'used', 'for', 'iterating', 'over', 'all', 'available', 'render', 'models', '.', 'If', 'the', 'index', 'is', 'out', 'of', 'range', '...
train
https://github.com/cmbruns/pyopenvr/blob/68395d26bb3df6ab1f0f059c38d441f962938be6/src/openvr/__init__.py#L5373-L5382
1,843
aiogram/aiogram
aiogram/bot/bot.py
Bot.send_voice
async def send_voice(self, chat_id: typing.Union[base.Integer, base.String], voice: typing.Union[base.InputFile, base.String], caption: typing.Union[base.String, None] = None, parse_mode: typing.Union[base.String, None] = None, ...
python
async def send_voice(self, chat_id: typing.Union[base.Integer, base.String], voice: typing.Union[base.InputFile, base.String], caption: typing.Union[base.String, None] = None, parse_mode: typing.Union[base.String, None] = None, ...
['async', 'def', 'send_voice', '(', 'self', ',', 'chat_id', ':', 'typing', '.', 'Union', '[', 'base', '.', 'Integer', ',', 'base', '.', 'String', ']', ',', 'voice', ':', 'typing', '.', 'Union', '[', 'base', '.', 'InputFile', ',', 'base', '.', 'String', ']', ',', 'caption', ':', 'typing', '.', 'Union', '[', 'base', '.',...
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document). Source: https://core.telegram.org/bots/api#sendvoi...
['Use', 'this', 'method', 'to', 'send', 'audio', 'files', 'if', 'you', 'want', 'Telegram', 'clients', 'to', 'display', 'the', 'file', 'as', 'a', 'playable', 'voice', 'message', '.']
train
https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L525-L575
1,844
NuGrid/NuGridPy
nugridpy/data_plot.py
DataPlot.abu_profile
def abu_profile(self,ixaxis='mass',isos=None,ifig=None,fname=None,logy=False, colourblind=False): ''' Plot common abundances as a function of either mass coordiate or radius. Parameters ---------- ixaxis : string, optional 'mass', 'logradius' or ...
python
def abu_profile(self,ixaxis='mass',isos=None,ifig=None,fname=None,logy=False, colourblind=False): ''' Plot common abundances as a function of either mass coordiate or radius. Parameters ---------- ixaxis : string, optional 'mass', 'logradius' or ...
['def', 'abu_profile', '(', 'self', ',', 'ixaxis', '=', "'mass'", ',', 'isos', '=', 'None', ',', 'ifig', '=', 'None', ',', 'fname', '=', 'None', ',', 'logy', '=', 'False', ',', 'colourblind', '=', 'False', ')', ':', 'pT', '=', 'self', '.', '_classTest', '(', ')', '# Class-specific things:', 'if', 'pT', 'is', "'mesa_pro...
Plot common abundances as a function of either mass coordiate or radius. Parameters ---------- ixaxis : string, optional 'mass', 'logradius' or 'radius' The default value is 'mass' isos : list, optional list of isos to plot, i.e. ['h1','he4','c12'] f...
['Plot', 'common', 'abundances', 'as', 'a', 'function', 'of', 'either', 'mass', 'coordiate', 'or', 'radius', '.']
train
https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/data_plot.py#L4658-L4745
1,845
gwastro/pycbc
pycbc/results/scatter_histograms.py
remove_common_offset
def remove_common_offset(arr): """Given an array of data, removes a common offset > 1000, returning the removed value. """ offset = 0 isneg = (arr <= 0).all() # make sure all values have the same sign if isneg or (arr >= 0).all(): # only remove offset if the minimum and maximum value...
python
def remove_common_offset(arr): """Given an array of data, removes a common offset > 1000, returning the removed value. """ offset = 0 isneg = (arr <= 0).all() # make sure all values have the same sign if isneg or (arr >= 0).all(): # only remove offset if the minimum and maximum value...
['def', 'remove_common_offset', '(', 'arr', ')', ':', 'offset', '=', '0', 'isneg', '=', '(', 'arr', '<=', '0', ')', '.', 'all', '(', ')', '# make sure all values have the same sign', 'if', 'isneg', 'or', '(', 'arr', '>=', '0', ')', '.', 'all', '(', ')', ':', '# only remove offset if the minimum and maximum values are t...
Given an array of data, removes a common offset > 1000, returning the removed value.
['Given', 'an', 'array', 'of', 'data', 'removes', 'a', 'common', 'offset', '>', '1000', 'returning', 'the', 'removed', 'value', '.']
train
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/results/scatter_histograms.py#L753-L770
1,846
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v20/ardupilotmega.py
MAVLink.ahrs_encode
def ahrs_encode(self, omegaIx, omegaIy, omegaIz, accel_weight, renorm_val, error_rp, error_yaw): ''' Status of DCM attitude estimator omegaIx : X gyro drift estimate rad/s (float) omegaIy : Y gyro drift estimate rad/s (...
python
def ahrs_encode(self, omegaIx, omegaIy, omegaIz, accel_weight, renorm_val, error_rp, error_yaw): ''' Status of DCM attitude estimator omegaIx : X gyro drift estimate rad/s (float) omegaIy : Y gyro drift estimate rad/s (...
['def', 'ahrs_encode', '(', 'self', ',', 'omegaIx', ',', 'omegaIy', ',', 'omegaIz', ',', 'accel_weight', ',', 'renorm_val', ',', 'error_rp', ',', 'error_yaw', ')', ':', 'return', 'MAVLink_ahrs_message', '(', 'omegaIx', ',', 'omegaIy', ',', 'omegaIz', ',', 'accel_weight', ',', 'renorm_val', ',', 'error_rp', ',', 'error_...
Status of DCM attitude estimator omegaIx : X gyro drift estimate rad/s (float) omegaIy : Y gyro drift estimate rad/s (float) omegaIz : Z gyro drift estimate rad/s (float) accel_weight : av...
['Status', 'of', 'DCM', 'attitude', 'estimator']
train
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v20/ardupilotmega.py#L10042-L10055
1,847
saltstack/salt
salt/beacons/sh.py
_get_shells
def _get_shells(): ''' Return the valid shells on this system ''' start = time.time() if 'sh.last_shells' in __context__: if start - __context__['sh.last_shells'] > 5: __context__['sh.last_shells'] = start else: __context__['sh.shells'] = __salt__['cmd.shells'...
python
def _get_shells(): ''' Return the valid shells on this system ''' start = time.time() if 'sh.last_shells' in __context__: if start - __context__['sh.last_shells'] > 5: __context__['sh.last_shells'] = start else: __context__['sh.shells'] = __salt__['cmd.shells'...
['def', '_get_shells', '(', ')', ':', 'start', '=', 'time', '.', 'time', '(', ')', 'if', "'sh.last_shells'", 'in', '__context__', ':', 'if', 'start', '-', '__context__', '[', "'sh.last_shells'", ']', '>', '5', ':', '__context__', '[', "'sh.last_shells'", ']', '=', 'start', 'else', ':', '__context__', '[', "'sh.shells'"...
Return the valid shells on this system
['Return', 'the', 'valid', 'shells', 'on', 'this', 'system']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/sh.py#L29-L42
1,848
RaRe-Technologies/smart_open
smart_open/smart_open_lib.py
_parse_uri
def _parse_uri(uri_as_string): """ Parse the given URI from a string. Supported URI schemes are: * file * hdfs * http * https * s3 * s3a * s3n * s3u * webhdfs .s3, s3a and s3n are treated the same way. s3u is s3 but without SSL. Valid URI ex...
python
def _parse_uri(uri_as_string): """ Parse the given URI from a string. Supported URI schemes are: * file * hdfs * http * https * s3 * s3a * s3n * s3u * webhdfs .s3, s3a and s3n are treated the same way. s3u is s3 but without SSL. Valid URI ex...
['def', '_parse_uri', '(', 'uri_as_string', ')', ':', 'if', 'os', '.', 'name', '==', "'nt'", ':', "# urlsplit doesn't work on Windows -- it parses the drive as the scheme...", 'if', "'://'", 'not', 'in', 'uri_as_string', ':', '# no protocol given => assume a local file', 'uri_as_string', '=', "'file://'", '+', 'uri_as_...
Parse the given URI from a string. Supported URI schemes are: * file * hdfs * http * https * s3 * s3a * s3n * s3u * webhdfs .s3, s3a and s3n are treated the same way. s3u is s3 but without SSL. Valid URI examples:: * s3://my_bucket/my_key ...
['Parse', 'the', 'given', 'URI', 'from', 'a', 'string', '.']
train
https://github.com/RaRe-Technologies/smart_open/blob/2dc8d60f223fc7b00a2000c56362a7bd6cd0850e/smart_open/smart_open_lib.py#L658-L719
1,849
ewels/MultiQC
multiqc/modules/biobloomtools/biobloomtools.py
MultiqcModule.parse_bbt
def parse_bbt(self, fh): """ Parse the BioBloom Tools output into a 3D dict """ parsed_data = OrderedDict() headers = None for l in fh: s = l.split("\t") if headers is None: headers = s else: parsed_data[s[0]] = dict() ...
python
def parse_bbt(self, fh): """ Parse the BioBloom Tools output into a 3D dict """ parsed_data = OrderedDict() headers = None for l in fh: s = l.split("\t") if headers is None: headers = s else: parsed_data[s[0]] = dict() ...
['def', 'parse_bbt', '(', 'self', ',', 'fh', ')', ':', 'parsed_data', '=', 'OrderedDict', '(', ')', 'headers', '=', 'None', 'for', 'l', 'in', 'fh', ':', 's', '=', 'l', '.', 'split', '(', '"\\t"', ')', 'if', 'headers', 'is', 'None', ':', 'headers', '=', 's', 'else', ':', 'parsed_data', '[', 's', '[', '0', ']', ']', '=',...
Parse the BioBloom Tools output into a 3D dict
['Parse', 'the', 'BioBloom', 'Tools', 'output', 'into', 'a', '3D', 'dict']
train
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/biobloomtools/biobloomtools.py#L58-L71
1,850
angr/claripy
claripy/frontend_mixins/smtlib_script_dumper_mixin.py
SMTLibScriptDumperMixin.get_smtlib_script_satisfiability
def get_smtlib_script_satisfiability(self, extra_constraints=(), extra_variables=()): """ Return an smt-lib script that check the satisfiability of the current constraints :return string: smt-lib script """ try: e_csts = self._solver_backend.convert_list(extra_constr...
python
def get_smtlib_script_satisfiability(self, extra_constraints=(), extra_variables=()): """ Return an smt-lib script that check the satisfiability of the current constraints :return string: smt-lib script """ try: e_csts = self._solver_backend.convert_list(extra_constr...
['def', 'get_smtlib_script_satisfiability', '(', 'self', ',', 'extra_constraints', '=', '(', ')', ',', 'extra_variables', '=', '(', ')', ')', ':', 'try', ':', 'e_csts', '=', 'self', '.', '_solver_backend', '.', 'convert_list', '(', 'extra_constraints', '+', 'tuple', '(', 'self', '.', 'constraints', ')', ')', 'e_variabl...
Return an smt-lib script that check the satisfiability of the current constraints :return string: smt-lib script
['Return', 'an', 'smt', '-', 'lib', 'script', 'that', 'check', 'the', 'satisfiability', 'of', 'the', 'current', 'constraints']
train
https://github.com/angr/claripy/blob/4ed61924880af1ea8fb778047d896ec0156412a6/claripy/frontend_mixins/smtlib_script_dumper_mixin.py#L10-L23
1,851
gabstopper/smc-python
smc/core/node.py
Node.rename
def rename(self, name): """ Rename this node :param str name: new name for node """ self.update(name='{} node {}'.format(name, self.nodeid))
python
def rename(self, name): """ Rename this node :param str name: new name for node """ self.update(name='{} node {}'.format(name, self.nodeid))
['def', 'rename', '(', 'self', ',', 'name', ')', ':', 'self', '.', 'update', '(', 'name', '=', "'{} node {}'", '.', 'format', '(', 'name', ',', 'self', '.', 'nodeid', ')', ')']
Rename this node :param str name: new name for node
['Rename', 'this', 'node', ':', 'param', 'str', 'name', ':', 'new', 'name', 'for', 'node']
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L57-L63
1,852
python-xlib/python-xlib
Xlib/display.py
Display.open_font
def open_font(self, name): """Open the font identifed by the pattern name and return its font object. If name does not match any font, None is returned.""" fid = self.display.allocate_resource_id() ec = error.CatchError(error.BadName) request.OpenFont(display = self.display, ...
python
def open_font(self, name): """Open the font identifed by the pattern name and return its font object. If name does not match any font, None is returned.""" fid = self.display.allocate_resource_id() ec = error.CatchError(error.BadName) request.OpenFont(display = self.display, ...
['def', 'open_font', '(', 'self', ',', 'name', ')', ':', 'fid', '=', 'self', '.', 'display', '.', 'allocate_resource_id', '(', ')', 'ec', '=', 'error', '.', 'CatchError', '(', 'error', '.', 'BadName', ')', 'request', '.', 'OpenFont', '(', 'display', '=', 'self', '.', 'display', ',', 'onerror', '=', 'ec', ',', 'fid', '=...
Open the font identifed by the pattern name and return its font object. If name does not match any font, None is returned.
['Open', 'the', 'font', 'identifed', 'by', 'the', 'pattern', 'name', 'and', 'return', 'its', 'font', 'object', '.', 'If', 'name', 'does', 'not', 'match', 'any', 'font', 'None', 'is', 'returned', '.']
train
https://github.com/python-xlib/python-xlib/blob/8901e831737e79fe5645f48089d70e1d1046d2f2/Xlib/display.py#L618-L635
1,853
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
et2lst
def et2lst(et, body, lon, typein, timlen=_default_len_out, ampmlen=_default_len_out): """ Given an ephemeris epoch, compute the local solar time for an object on the surface of a body at a specified longitude. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/et2lst_c.html :param et: Epoch i...
python
def et2lst(et, body, lon, typein, timlen=_default_len_out, ampmlen=_default_len_out): """ Given an ephemeris epoch, compute the local solar time for an object on the surface of a body at a specified longitude. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/et2lst_c.html :param et: Epoch i...
['def', 'et2lst', '(', 'et', ',', 'body', ',', 'lon', ',', 'typein', ',', 'timlen', '=', '_default_len_out', ',', 'ampmlen', '=', '_default_len_out', ')', ':', 'et', '=', 'ctypes', '.', 'c_double', '(', 'et', ')', 'body', '=', 'ctypes', '.', 'c_int', '(', 'body', ')', 'lon', '=', 'ctypes', '.', 'c_double', '(', 'lon', ...
Given an ephemeris epoch, compute the local solar time for an object on the surface of a body at a specified longitude. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/et2lst_c.html :param et: Epoch in seconds past J2000 epoch. :type et: float :param body: ID-code of the body of interest. ...
['Given', 'an', 'ephemeris', 'epoch', 'compute', 'the', 'local', 'solar', 'time', 'for', 'an', 'object', 'on', 'the', 'surface', 'of', 'a', 'body', 'at', 'a', 'specified', 'longitude', '.']
train
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L4984-L5026
1,854
pkgw/pwkit
pwkit/latex.py
latexify
def latexify(obj, **kwargs): """Render an object in LaTeX appropriately. """ if hasattr(obj, '__pk_latex__'): return obj.__pk_latex__(**kwargs) if isinstance(obj, text_type): from .unicode_to_latex import unicode_to_latex return unicode_to_latex(obj) if isinstance(obj, boo...
python
def latexify(obj, **kwargs): """Render an object in LaTeX appropriately. """ if hasattr(obj, '__pk_latex__'): return obj.__pk_latex__(**kwargs) if isinstance(obj, text_type): from .unicode_to_latex import unicode_to_latex return unicode_to_latex(obj) if isinstance(obj, boo...
['def', 'latexify', '(', 'obj', ',', '*', '*', 'kwargs', ')', ':', 'if', 'hasattr', '(', 'obj', ',', "'__pk_latex__'", ')', ':', 'return', 'obj', '.', '__pk_latex__', '(', '*', '*', 'kwargs', ')', 'if', 'isinstance', '(', 'obj', ',', 'text_type', ')', ':', 'from', '.', 'unicode_to_latex', 'import', 'unicode_to_latex', ...
Render an object in LaTeX appropriately.
['Render', 'an', 'object', 'in', 'LaTeX', 'appropriately', '.']
train
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/latex.py#L145-L174
1,855
saltstack/salt
salt/modules/publish.py
runner
def runner(fun, arg=None, timeout=5): ''' Execute a runner on the master and return the data from the runner function CLI Example: .. code-block:: bash salt publish.runner manage.down ''' arg = _parse_args(arg) if 'master_uri' not in __opts__: return 'No access to mas...
python
def runner(fun, arg=None, timeout=5): ''' Execute a runner on the master and return the data from the runner function CLI Example: .. code-block:: bash salt publish.runner manage.down ''' arg = _parse_args(arg) if 'master_uri' not in __opts__: return 'No access to mas...
['def', 'runner', '(', 'fun', ',', 'arg', '=', 'None', ',', 'timeout', '=', '5', ')', ':', 'arg', '=', '_parse_args', '(', 'arg', ')', 'if', "'master_uri'", 'not', 'in', '__opts__', ':', 'return', "'No access to master. If using salt-call with --local, please remove.'", 'log', '.', 'info', '(', "'Publishing runner \\'%...
Execute a runner on the master and return the data from the runner function CLI Example: .. code-block:: bash salt publish.runner manage.down
['Execute', 'a', 'runner', 'on', 'the', 'master', 'and', 'return', 'the', 'data', 'from', 'the', 'runner', 'function']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/publish.py#L303-L335
1,856
EVEprosper/ProsperCommon
prosper/common/prosper_config.py
read_config
def read_config( config_filepath, logger=logging.getLogger('ProsperCommon'), ): """fetch and parse config file Args: config_filepath (str): path to config file. abspath > relpath logger (:obj:`logging.Logger`): logger to catch error msgs """ config_parser = configparse...
python
def read_config( config_filepath, logger=logging.getLogger('ProsperCommon'), ): """fetch and parse config file Args: config_filepath (str): path to config file. abspath > relpath logger (:obj:`logging.Logger`): logger to catch error msgs """ config_parser = configparse...
['def', 'read_config', '(', 'config_filepath', ',', 'logger', '=', 'logging', '.', 'getLogger', '(', "'ProsperCommon'", ')', ',', ')', ':', 'config_parser', '=', 'configparser', '.', 'ConfigParser', '(', 'interpolation', '=', 'ExtendedInterpolation', '(', ')', ',', 'allow_no_value', '=', 'True', ',', 'delimiters', '=',...
fetch and parse config file Args: config_filepath (str): path to config file. abspath > relpath logger (:obj:`logging.Logger`): logger to catch error msgs
['fetch', 'and', 'parse', 'config', 'file']
train
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_config.py#L265-L287
1,857
b3j0f/conf
b3j0f/conf/model/base.py
CompositeModelElement.update
def update(self, other, copy=True, *args, **kwargs): """Update this composite model element with other element content. :param other: element to update with this. Must be the same type of this or this __contenttype__. :param bool copy: copy other before updating. :return: se...
python
def update(self, other, copy=True, *args, **kwargs): """Update this composite model element with other element content. :param other: element to update with this. Must be the same type of this or this __contenttype__. :param bool copy: copy other before updating. :return: se...
['def', 'update', '(', 'self', ',', 'other', ',', 'copy', '=', 'True', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'super', '(', 'CompositeModelElement', ',', 'self', ')', '.', 'update', '(', 'other', ',', 'copy', '=', 'copy', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', 'if', 'other', ':', '# dirty hack fo...
Update this composite model element with other element content. :param other: element to update with this. Must be the same type of this or this __contenttype__. :param bool copy: copy other before updating. :return: self
['Update', 'this', 'composite', 'model', 'element', 'with', 'other', 'element', 'content', '.']
train
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/base.py#L253-L292
1,858
eqcorrscan/EQcorrscan
eqcorrscan/core/lag_calc.py
_channel_loop
def _channel_loop(detection, template, min_cc, detection_id, interpolate, i, pre_lag_ccsum=None, detect_chans=0, horizontal_chans=['E', 'N', '1', '2'], vertical_chans=['Z'], debug=0): """ Inner loop for correlating and assigning picks. Utility function ...
python
def _channel_loop(detection, template, min_cc, detection_id, interpolate, i, pre_lag_ccsum=None, detect_chans=0, horizontal_chans=['E', 'N', '1', '2'], vertical_chans=['Z'], debug=0): """ Inner loop for correlating and assigning picks. Utility function ...
['def', '_channel_loop', '(', 'detection', ',', 'template', ',', 'min_cc', ',', 'detection_id', ',', 'interpolate', ',', 'i', ',', 'pre_lag_ccsum', '=', 'None', ',', 'detect_chans', '=', '0', ',', 'horizontal_chans', '=', '[', "'E'", ',', "'N'", ',', "'1'", ',', "'2'", ']', ',', 'vertical_chans', '=', '[', "'Z'", ']', ...
Inner loop for correlating and assigning picks. Utility function to take a stream of data for the detected event and write maximum correlation to absolute time as picks in an obspy.core.event.Event object. Only outputs picks for picks above min_cc. :type detection: obspy.core.stream.Stream :pa...
['Inner', 'loop', 'for', 'correlating', 'and', 'assigning', 'picks', '.']
train
https://github.com/eqcorrscan/EQcorrscan/blob/3121b4aca801ee5d38f56ca297ce1c0f9515d9ff/eqcorrscan/core/lag_calc.py#L101-L254
1,859
undertherain/pycontextfree
contextfree/shapes.py
triangle
def triangle(rad=0.5): """Draw a triangle""" # half_height = math.sqrt(3) * side / 6 # half_height = side / 2 ctx = _state["ctx"] side = 3 * rad / math.sqrt(3) ctx.move_to(0, -rad / 2) ctx.line_to(-side / 2, -rad / 2) ctx.line_to(0, rad) ctx.line_to(side / 2, -rad / 2) ctx.close_...
python
def triangle(rad=0.5): """Draw a triangle""" # half_height = math.sqrt(3) * side / 6 # half_height = side / 2 ctx = _state["ctx"] side = 3 * rad / math.sqrt(3) ctx.move_to(0, -rad / 2) ctx.line_to(-side / 2, -rad / 2) ctx.line_to(0, rad) ctx.line_to(side / 2, -rad / 2) ctx.close_...
['def', 'triangle', '(', 'rad', '=', '0.5', ')', ':', '# half_height = math.sqrt(3) * side / 6', '# half_height = side / 2', 'ctx', '=', '_state', '[', '"ctx"', ']', 'side', '=', '3', '*', 'rad', '/', 'math', '.', 'sqrt', '(', '3', ')', 'ctx', '.', 'move_to', '(', '0', ',', '-', 'rad', '/', '2', ')', 'ctx', '.', 'line_...
Draw a triangle
['Draw', 'a', 'triangle']
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/contextfree/shapes.py#L28-L39
1,860
inveniosoftware-contrib/invenio-classifier
invenio_classifier/engine.py
_get_singlekws
def _get_singlekws(skw_matches, spires=False): """Get single keywords. :var skw_matches: dict of {keyword: [info,...]} :keyword spires: bool, to get the spires output :return: list of formatted keywords """ output = {} for single_keyword, info in skw_matches: output[single_keyword.o...
python
def _get_singlekws(skw_matches, spires=False): """Get single keywords. :var skw_matches: dict of {keyword: [info,...]} :keyword spires: bool, to get the spires output :return: list of formatted keywords """ output = {} for single_keyword, info in skw_matches: output[single_keyword.o...
['def', '_get_singlekws', '(', 'skw_matches', ',', 'spires', '=', 'False', ')', ':', 'output', '=', '{', '}', 'for', 'single_keyword', ',', 'info', 'in', 'skw_matches', ':', 'output', '[', 'single_keyword', '.', 'output', '(', 'spires', ')', ']', '=', 'len', '(', 'info', '[', '0', ']', ')', 'output', '=', '[', '{', "'k...
Get single keywords. :var skw_matches: dict of {keyword: [info,...]} :keyword spires: bool, to get the spires output :return: list of formatted keywords
['Get', 'single', 'keywords', '.']
train
https://github.com/inveniosoftware-contrib/invenio-classifier/blob/3c758cf34dca6bf0548e7da5de34e5f72e3b255e/invenio_classifier/engine.py#L348-L360
1,861
tornadoweb/tornado
tornado/web.py
RequestHandler.render_linked_css
def render_linked_css(self, css_files: Iterable[str]) -> str: """Default method used to render the final css links for the rendered webpage. Override this method in a sub-classed controller to change the output. """ paths = [] unique_paths = set() # type: Set[str] ...
python
def render_linked_css(self, css_files: Iterable[str]) -> str: """Default method used to render the final css links for the rendered webpage. Override this method in a sub-classed controller to change the output. """ paths = [] unique_paths = set() # type: Set[str] ...
['def', 'render_linked_css', '(', 'self', ',', 'css_files', ':', 'Iterable', '[', 'str', ']', ')', '->', 'str', ':', 'paths', '=', '[', ']', 'unique_paths', '=', 'set', '(', ')', '# type: Set[str]', 'for', 'path', 'in', 'css_files', ':', 'if', 'not', 'is_absolute', '(', 'path', ')', ':', 'path', '=', 'self', '.', 'stat...
Default method used to render the final css links for the rendered webpage. Override this method in a sub-classed controller to change the output.
['Default', 'method', 'used', 'to', 'render', 'the', 'final', 'css', 'links', 'for', 'the', 'rendered', 'webpage', '.']
train
https://github.com/tornadoweb/tornado/blob/b8b481770bcdb333a69afde5cce7eaa449128326/tornado/web.py#L951-L971
1,862
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
uddc
def uddc(udfunc, x, dx): """ SPICE private routine intended solely for the support of SPICE routines. Users should not call this routine directly due to the volatile nature of this routine. This routine calculates the derivative of 'udfunc' with respect to time for 'et', then determines if the ...
python
def uddc(udfunc, x, dx): """ SPICE private routine intended solely for the support of SPICE routines. Users should not call this routine directly due to the volatile nature of this routine. This routine calculates the derivative of 'udfunc' with respect to time for 'et', then determines if the ...
['def', 'uddc', '(', 'udfunc', ',', 'x', ',', 'dx', ')', ':', 'x', '=', 'ctypes', '.', 'c_double', '(', 'x', ')', 'dx', '=', 'ctypes', '.', 'c_double', '(', 'dx', ')', 'isdescr', '=', 'ctypes', '.', 'c_int', '(', ')', 'libspice', '.', 'uddc_c', '(', 'udfunc', ',', 'x', ',', 'dx', ',', 'ctypes', '.', 'byref', '(', 'isde...
SPICE private routine intended solely for the support of SPICE routines. Users should not call this routine directly due to the volatile nature of this routine. This routine calculates the derivative of 'udfunc' with respect to time for 'et', then determines if the derivative has a negative value. ...
['SPICE', 'private', 'routine', 'intended', 'solely', 'for', 'the', 'support', 'of', 'SPICE', 'routines', '.', 'Users', 'should', 'not', 'call', 'this', 'routine', 'directly', 'due', 'to', 'the', 'volatile', 'nature', 'of', 'this', 'routine', '.']
train
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L14221-L14257
1,863
delph-in/pydelphin
delphin/mrs/query.py
select_nodeids
def select_nodeids(xmrs, iv=None, label=None, pred=None): """ Return the list of matching nodeids in *xmrs*. Nodeids in *xmrs* match if their corresponding :class:`~delphin.mrs.components.ElementaryPredication` object matches its `intrinsic_variable` to *iv*, `label` to *label*, and `pred` to *...
python
def select_nodeids(xmrs, iv=None, label=None, pred=None): """ Return the list of matching nodeids in *xmrs*. Nodeids in *xmrs* match if their corresponding :class:`~delphin.mrs.components.ElementaryPredication` object matches its `intrinsic_variable` to *iv*, `label` to *label*, and `pred` to *...
['def', 'select_nodeids', '(', 'xmrs', ',', 'iv', '=', 'None', ',', 'label', '=', 'None', ',', 'pred', '=', 'None', ')', ':', 'def', 'datamatch', '(', 'nid', ')', ':', 'ep', '=', 'xmrs', '.', 'ep', '(', 'nid', ')', 'return', '(', '(', 'iv', 'is', 'None', 'or', 'ep', '.', 'iv', '==', 'iv', ')', 'and', '(', 'pred', 'is',...
Return the list of matching nodeids in *xmrs*. Nodeids in *xmrs* match if their corresponding :class:`~delphin.mrs.components.ElementaryPredication` object matches its `intrinsic_variable` to *iv*, `label` to *label*, and `pred` to *pred*. The *iv*, *label*, and *pred* filters are ignored if they a...
['Return', 'the', 'list', 'of', 'matching', 'nodeids', 'in', '*', 'xmrs', '*', '.']
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/query.py#L12-L37
1,864
emilmont/pyStatParser
stat_parser/eval_parser.py
TreeOperations._convert_to_spans
def _convert_to_spans(self, tree, start, set, parent = None): "Convert a tree into spans (X, i, j) and add to a set." if len(tree) == 3: # Binary rule. # Remove unary collapsing. current = self._remove_vertical_markovization(tree[0]).split("+") split = s...
python
def _convert_to_spans(self, tree, start, set, parent = None): "Convert a tree into spans (X, i, j) and add to a set." if len(tree) == 3: # Binary rule. # Remove unary collapsing. current = self._remove_vertical_markovization(tree[0]).split("+") split = s...
['def', '_convert_to_spans', '(', 'self', ',', 'tree', ',', 'start', ',', 'set', ',', 'parent', '=', 'None', ')', ':', 'if', 'len', '(', 'tree', ')', '==', '3', ':', '# Binary rule.', '# Remove unary collapsing.', 'current', '=', 'self', '.', '_remove_vertical_markovization', '(', 'tree', '[', '0', ']', ')', '.', 'spli...
Convert a tree into spans (X, i, j) and add to a set.
['Convert', 'a', 'tree', 'into', 'spans', '(', 'X', 'i', 'j', ')', 'and', 'add', 'to', 'a', 'set', '.']
train
https://github.com/emilmont/pyStatParser/blob/0e4990d7c1f0e3a0e0626ea2059ffd9030edf323/stat_parser/eval_parser.py#L30-L53
1,865
jjgomera/iapws
iapws/humidAir.py
HumidAir._eq
def _eq(self, T, P): """Procedure for calculate the composition in saturation state Parameters ---------- T : float Temperature [K] P : float Pressure [MPa] Returns ------- Asat : float Saturation mass fraction of dry ...
python
def _eq(self, T, P): """Procedure for calculate the composition in saturation state Parameters ---------- T : float Temperature [K] P : float Pressure [MPa] Returns ------- Asat : float Saturation mass fraction of dry ...
['def', '_eq', '(', 'self', ',', 'T', ',', 'P', ')', ':', 'if', 'T', '<=', '273.16', ':', 'ice', '=', '_Ice', '(', 'T', ',', 'P', ')', 'gw', '=', 'ice', '[', '"g"', ']', 'else', ':', 'water', '=', 'IAPWS95', '(', 'T', '=', 'T', ',', 'P', '=', 'P', ')', 'gw', '=', 'water', '.', 'g', 'def', 'f', '(', 'parr', ')', ':', 'r...
Procedure for calculate the composition in saturation state Parameters ---------- T : float Temperature [K] P : float Pressure [MPa] Returns ------- Asat : float Saturation mass fraction of dry air in humid air [kg/kg]
['Procedure', 'for', 'calculate', 'the', 'composition', 'in', 'saturation', 'state']
train
https://github.com/jjgomera/iapws/blob/1e5812aab38212fb8a63736f61cdcfa427d223b1/iapws/humidAir.py#L729-L761
1,866
mottosso/be
be/vendor/click/decorators.py
version_option
def version_option(version=None, *param_decls, **attrs): """Adds a ``--version`` option which immediately ends the program printing out the version number. This is implemented as an eager option that prints the version and exits the program in the callback. :param version: the version number to show. ...
python
def version_option(version=None, *param_decls, **attrs): """Adds a ``--version`` option which immediately ends the program printing out the version number. This is implemented as an eager option that prints the version and exits the program in the callback. :param version: the version number to show. ...
['def', 'version_option', '(', 'version', '=', 'None', ',', '*', 'param_decls', ',', '*', '*', 'attrs', ')', ':', 'if', 'version', 'is', 'None', ':', 'module', '=', 'sys', '.', '_getframe', '(', '1', ')', '.', 'f_globals', '.', 'get', '(', "'__name__'", ')', 'def', 'decorator', '(', 'f', ')', ':', 'prog_name', '=', 'at...
Adds a ``--version`` option which immediately ends the program printing out the version number. This is implemented as an eager option that prints the version and exits the program in the callback. :param version: the version number to show. If not provided Click attempts an auto disc...
['Adds', 'a', '--', 'version', 'option', 'which', 'immediately', 'ends', 'the', 'program', 'printing', 'out', 'the', 'version', 'number', '.', 'This', 'is', 'implemented', 'as', 'an', 'eager', 'option', 'that', 'prints', 'the', 'version', 'and', 'exits', 'the', 'program', 'in', 'the', 'callback', '.']
train
https://github.com/mottosso/be/blob/0f3d4f3597c71223f616d78c6d9b2c8dffcd8a71/be/vendor/click/decorators.py#L222-L273
1,867
bcbio/bcbio-nextgen
bcbio/heterogeneity/bubbletree.py
_freqs_by_chromosome
def _freqs_by_chromosome(in_file, params, somatic_info): """Retrieve frequencies across each chromosome as inputs to HMM. """ freqs = [] coords = [] cur_chrom = None with pysam.VariantFile(in_file) as bcf_in: for rec in bcf_in: if _is_biallelic_snp(rec) and _passes_plus_germl...
python
def _freqs_by_chromosome(in_file, params, somatic_info): """Retrieve frequencies across each chromosome as inputs to HMM. """ freqs = [] coords = [] cur_chrom = None with pysam.VariantFile(in_file) as bcf_in: for rec in bcf_in: if _is_biallelic_snp(rec) and _passes_plus_germl...
['def', '_freqs_by_chromosome', '(', 'in_file', ',', 'params', ',', 'somatic_info', ')', ':', 'freqs', '=', '[', ']', 'coords', '=', '[', ']', 'cur_chrom', '=', 'None', 'with', 'pysam', '.', 'VariantFile', '(', 'in_file', ')', 'as', 'bcf_in', ':', 'for', 'rec', 'in', 'bcf_in', ':', 'if', '_is_biallelic_snp', '(', 'rec'...
Retrieve frequencies across each chromosome as inputs to HMM.
['Retrieve', 'frequencies', 'across', 'each', 'chromosome', 'as', 'inputs', 'to', 'HMM', '.']
train
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/bubbletree.py#L248-L270
1,868
monarch-initiative/dipper
dipper/sources/UDP.py
UDP.fetch
def fetch(self, is_dl_forced=True): """ Fetches data from udp collaboration server, see top level comments for class for more information :return: """ username = config.get_config()['dbauth']['udp']['user'] password = config.get_config()['dbauth']['udp']['passwor...
python
def fetch(self, is_dl_forced=True): """ Fetches data from udp collaboration server, see top level comments for class for more information :return: """ username = config.get_config()['dbauth']['udp']['user'] password = config.get_config()['dbauth']['udp']['passwor...
['def', 'fetch', '(', 'self', ',', 'is_dl_forced', '=', 'True', ')', ':', 'username', '=', 'config', '.', 'get_config', '(', ')', '[', "'dbauth'", ']', '[', "'udp'", ']', '[', "'user'", ']', 'password', '=', 'config', '.', 'get_config', '(', ')', '[', "'dbauth'", ']', '[', "'udp'", ']', '[', "'password'", ']', 'credent...
Fetches data from udp collaboration server, see top level comments for class for more information :return:
['Fetches', 'data', 'from', 'udp', 'collaboration', 'server', 'see', 'top', 'level', 'comments', 'for', 'class', 'for', 'more', 'information', ':', 'return', ':']
train
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/UDP.py#L93-L190
1,869
ND-CSE-30151/tock
tock/machines.py
Configuration.match
def match(self, other): """Returns true iff self (as a pattern) matches other (as a configuration). Note that this is asymmetric: other is allowed to have symbols that aren't found in self.""" if len(self) != len(other): raise ValueError() for s1, s2 in zip(self, oth...
python
def match(self, other): """Returns true iff self (as a pattern) matches other (as a configuration). Note that this is asymmetric: other is allowed to have symbols that aren't found in self.""" if len(self) != len(other): raise ValueError() for s1, s2 in zip(self, oth...
['def', 'match', '(', 'self', ',', 'other', ')', ':', 'if', 'len', '(', 'self', ')', '!=', 'len', '(', 'other', ')', ':', 'raise', 'ValueError', '(', ')', 'for', 's1', ',', 's2', 'in', 'zip', '(', 'self', ',', 'other', ')', ':', 'i', '=', 's2', '.', 'position', '-', 's1', '.', 'position', 'if', 'i', '<', '0', ':', 'ret...
Returns true iff self (as a pattern) matches other (as a configuration). Note that this is asymmetric: other is allowed to have symbols that aren't found in self.
['Returns', 'true', 'iff', 'self', '(', 'as', 'a', 'pattern', ')', 'matches', 'other', '(', 'as', 'a', 'configuration', ')', '.', 'Note', 'that', 'this', 'is', 'asymmetric', ':', 'other', 'is', 'allowed', 'to', 'have', 'symbols', 'that', 'aren', 't', 'found', 'in', 'self', '.']
train
https://github.com/ND-CSE-30151/tock/blob/b8d21901aaf0e6ac913c2afa855f5b5a882a16c6/tock/machines.py#L107-L123
1,870
fhs/pyhdf
pyhdf/HDF.py
HDF.getfileversion
def getfileversion(self): """Get file version info. Args: no argument Returns: 4-element tuple with the following components: -major version number (int) -minor version number (int) -complete library version number (int) -addit...
python
def getfileversion(self): """Get file version info. Args: no argument Returns: 4-element tuple with the following components: -major version number (int) -minor version number (int) -complete library version number (int) -addit...
['def', 'getfileversion', '(', 'self', ')', ':', 'status', ',', 'major_v', ',', 'minor_v', ',', 'release', ',', 'info', '=', '_C', '.', 'Hgetfileversion', '(', 'self', '.', '_id', ')', '_checkErr', '(', "'getfileversion'", ',', 'status', ',', '"cannot get file version"', ')', 'return', 'major_v', ',', 'minor_v', ',', '...
Get file version info. Args: no argument Returns: 4-element tuple with the following components: -major version number (int) -minor version number (int) -complete library version number (int) -additional information (string) C...
['Get', 'file', 'version', 'info', '.']
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/HDF.py#L244-L261
1,871
tensorflow/hub
tensorflow_hub/resolver.py
atomic_download
def atomic_download(handle, download_fn, module_dir, lock_file_timeout_sec=10 * 60): """Returns the path to a Module directory for a given TF-Hub Module handle. Args: handle: (string) Location of a TF-Hub Module. download_fn: Callback function tha...
python
def atomic_download(handle, download_fn, module_dir, lock_file_timeout_sec=10 * 60): """Returns the path to a Module directory for a given TF-Hub Module handle. Args: handle: (string) Location of a TF-Hub Module. download_fn: Callback function tha...
['def', 'atomic_download', '(', 'handle', ',', 'download_fn', ',', 'module_dir', ',', 'lock_file_timeout_sec', '=', '10', '*', '60', ')', ':', 'lock_file', '=', '_lock_filename', '(', 'module_dir', ')', 'task_uid', '=', 'uuid', '.', 'uuid4', '(', ')', '.', 'hex', 'lock_contents', '=', '_lock_file_contents', '(', 'task_...
Returns the path to a Module directory for a given TF-Hub Module handle. Args: handle: (string) Location of a TF-Hub Module. download_fn: Callback function that actually performs download. The callback receives two arguments, handle and the location of a temporary directory ...
['Returns', 'the', 'path', 'to', 'a', 'Module', 'directory', 'for', 'a', 'given', 'TF', '-', 'Hub', 'Module', 'handle', '.']
train
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/resolver.py#L345-L434
1,872
LedgerHQ/btchip-python
btchip/msqr.py
legendre_symbol
def legendre_symbol(a, p): """ Compute the Legendre symbol a|p using Euler's criterion. p is a prime, a is relatively prime to p (if p divides a, then a|p = 0) Returns 1 if a has a square root modulo p, -1 otherwise. """ ls = pow(a, (p - 1) / 2, p) return -1 if ls == p - 1 else ls
python
def legendre_symbol(a, p): """ Compute the Legendre symbol a|p using Euler's criterion. p is a prime, a is relatively prime to p (if p divides a, then a|p = 0) Returns 1 if a has a square root modulo p, -1 otherwise. """ ls = pow(a, (p - 1) / 2, p) return -1 if ls == p - 1 else ls
['def', 'legendre_symbol', '(', 'a', ',', 'p', ')', ':', 'ls', '=', 'pow', '(', 'a', ',', '(', 'p', '-', '1', ')', '/', '2', ',', 'p', ')', 'return', '-', '1', 'if', 'ls', '==', 'p', '-', '1', 'else', 'ls']
Compute the Legendre symbol a|p using Euler's criterion. p is a prime, a is relatively prime to p (if p divides a, then a|p = 0) Returns 1 if a has a square root modulo p, -1 otherwise.
['Compute', 'the', 'Legendre', 'symbol', 'a|p', 'using', 'Euler', 's', 'criterion', '.', 'p', 'is', 'a', 'prime', 'a', 'is', 'relatively', 'prime', 'to', 'p', '(', 'if', 'p', 'divides', 'a', 'then', 'a|p', '=', '0', ')']
train
https://github.com/LedgerHQ/btchip-python/blob/fe82d7f5638169f583a445b8e200fd1c9f3ea218/btchip/msqr.py#L84-L94
1,873
roboogle/gtkmvc3
gtkmvco/gtkmvc3/support/metaclasses.py
ObservablePropertyMeta.get_getter
def get_getter(cls, prop_name, # @NoSelf user_getter=None, getter_takes_name=False): """This implementation returns the PROP_NAME value if there exists such property. Otherwise there must exist a logical getter (user_getter) which the value is taken from. If no ...
python
def get_getter(cls, prop_name, # @NoSelf user_getter=None, getter_takes_name=False): """This implementation returns the PROP_NAME value if there exists such property. Otherwise there must exist a logical getter (user_getter) which the value is taken from. If no ...
['def', 'get_getter', '(', 'cls', ',', 'prop_name', ',', '# @NoSelf', 'user_getter', '=', 'None', ',', 'getter_takes_name', '=', 'False', ')', ':', 'has_prop_variable', '=', 'cls', '.', 'has_prop_attribute', '(', 'prop_name', ')', '# WARNING! Deprecated', 'has_specific_getter', '=', 'hasattr', '(', 'cls', ',', 'GET_PRO...
This implementation returns the PROP_NAME value if there exists such property. Otherwise there must exist a logical getter (user_getter) which the value is taken from. If no getter is found, None is returned (i.e. the property cannot be created)
['This', 'implementation', 'returns', 'the', 'PROP_NAME', 'value', 'if', 'there', 'exists', 'such', 'property', '.', 'Otherwise', 'there', 'must', 'exist', 'a', 'logical', 'getter', '(', 'user_getter', ')', 'which', 'the', 'value', 'is', 'taken', 'from', '.', 'If', 'no', 'getter', 'is', 'found', 'None', 'is', 'returned...
train
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/support/metaclasses.py#L555-L626
1,874
RaRe-Technologies/smart_open
smart_open/http.py
open
def open(uri, mode, kerberos=False, user=None, password=None): """Implement streamed reader from a web site. Supports Kerberos and Basic HTTP authentication. Parameters ---------- url: str The URL to open. mode: str The mode to open using. kerberos: boolean, optional ...
python
def open(uri, mode, kerberos=False, user=None, password=None): """Implement streamed reader from a web site. Supports Kerberos and Basic HTTP authentication. Parameters ---------- url: str The URL to open. mode: str The mode to open using. kerberos: boolean, optional ...
['def', 'open', '(', 'uri', ',', 'mode', ',', 'kerberos', '=', 'False', ',', 'user', '=', 'None', ',', 'password', '=', 'None', ')', ':', 'if', 'mode', '==', "'rb'", ':', 'return', 'BufferedInputBase', '(', 'uri', ',', 'mode', ',', 'kerberos', '=', 'kerberos', ',', 'user', '=', 'user', ',', 'password', '=', 'password',...
Implement streamed reader from a web site. Supports Kerberos and Basic HTTP authentication. Parameters ---------- url: str The URL to open. mode: str The mode to open using. kerberos: boolean, optional If True, will attempt to use the local Kerberos credentials user...
['Implement', 'streamed', 'reader', 'from', 'a', 'web', 'site', '.']
train
https://github.com/RaRe-Technologies/smart_open/blob/2dc8d60f223fc7b00a2000c56362a7bd6cd0850e/smart_open/http.py#L25-L51
1,875
jorgenschaefer/elpy
elpy/jedibackend.py
linecol_to_pos
def linecol_to_pos(text, line, col): """Return the offset of this line and column in text. Lines are one-based, columns zero-based. This is how Jedi wants it. Don't ask me why. """ nth_newline_offset = 0 for i in range(line - 1): new_offset = text.find("\n", nth_newline_offset) ...
python
def linecol_to_pos(text, line, col): """Return the offset of this line and column in text. Lines are one-based, columns zero-based. This is how Jedi wants it. Don't ask me why. """ nth_newline_offset = 0 for i in range(line - 1): new_offset = text.find("\n", nth_newline_offset) ...
['def', 'linecol_to_pos', '(', 'text', ',', 'line', ',', 'col', ')', ':', 'nth_newline_offset', '=', '0', 'for', 'i', 'in', 'range', '(', 'line', '-', '1', ')', ':', 'new_offset', '=', 'text', '.', 'find', '(', '"\\n"', ',', 'nth_newline_offset', ')', 'if', 'new_offset', '<', '0', ':', 'raise', 'ValueError', '(', '"Tex...
Return the offset of this line and column in text. Lines are one-based, columns zero-based. This is how Jedi wants it. Don't ask me why.
['Return', 'the', 'offset', 'of', 'this', 'line', 'and', 'column', 'in', 'text', '.']
train
https://github.com/jorgenschaefer/elpy/blob/ffd982f829b11e53f2be187c7b770423341f29bc/elpy/jedibackend.py#L286-L305
1,876
gabrielfalcao/dominic
dominic/xpath/expr.py
Function.function
def function(minargs, maxargs, implicit=False, first=False, convert=None): """Function decorator. minargs -- Minimum number of arguments taken by the function. maxargs -- Maximum number of arguments taken by the function. implicit -- True for functions which operate on a nodeset consist...
python
def function(minargs, maxargs, implicit=False, first=False, convert=None): """Function decorator. minargs -- Minimum number of arguments taken by the function. maxargs -- Maximum number of arguments taken by the function. implicit -- True for functions which operate on a nodeset consist...
['def', 'function', '(', 'minargs', ',', 'maxargs', ',', 'implicit', '=', 'False', ',', 'first', '=', 'False', ',', 'convert', '=', 'None', ')', ':', 'def', 'decorator', '(', 'f', ')', ':', 'def', 'new_f', '(', 'self', ',', 'node', ',', 'pos', ',', 'size', ',', 'context', ')', ':', 'if', 'implicit', 'and', 'len', '(', ...
Function decorator. minargs -- Minimum number of arguments taken by the function. maxargs -- Maximum number of arguments taken by the function. implicit -- True for functions which operate on a nodeset consisting of the current context node when passed no argument. ...
['Function', 'decorator', '.']
train
https://github.com/gabrielfalcao/dominic/blob/a42f418fc288f3b70cb95847b405eaf7b83bb3a0/dominic/xpath/expr.py#L344-L376
1,877
MolSSI-BSE/basis_set_exchange
basis_set_exchange/curate/readers/turbomole.py
read_turbomole
def read_turbomole(basis_lines, fname): '''Reads turbomole-formatted file data and converts it to a dictionary with the usual BSE fields Note that the turbomole format does not store all the fields we have, so some fields are left blank ''' skipchars = '*#$' basis_lines = [l for l...
python
def read_turbomole(basis_lines, fname): '''Reads turbomole-formatted file data and converts it to a dictionary with the usual BSE fields Note that the turbomole format does not store all the fields we have, so some fields are left blank ''' skipchars = '*#$' basis_lines = [l for l...
['def', 'read_turbomole', '(', 'basis_lines', ',', 'fname', ')', ':', 'skipchars', '=', "'*#$'", 'basis_lines', '=', '[', 'l', 'for', 'l', 'in', 'basis_lines', 'if', 'l', 'and', 'not', 'l', '[', '0', ']', 'in', 'skipchars', ']', 'bs_data', '=', 'create_skel', '(', "'component'", ')', 'i', '=', '0', 'while', 'i', '<', '...
Reads turbomole-formatted file data and converts it to a dictionary with the usual BSE fields Note that the turbomole format does not store all the fields we have, so some fields are left blank
['Reads', 'turbomole', '-', 'formatted', 'file', 'data', 'and', 'converts', 'it', 'to', 'a', 'dictionary', 'with', 'the', 'usual', 'BSE', 'fields']
train
https://github.com/MolSSI-BSE/basis_set_exchange/blob/e79110aaeb65f392ed5032420322dee3336948f7/basis_set_exchange/curate/readers/turbomole.py#L5-L117
1,878
dogoncouch/logdissect
logdissect/output/log.py
OutputModule.write_output
def write_output(self, data, args=None, filename=None, label=None): """Write log data to a log file""" if args: if not args.outlog: return 0 if not filename: filename=args.outlog lastpath = '' with open(str(filename), 'w') as output_file: f...
python
def write_output(self, data, args=None, filename=None, label=None): """Write log data to a log file""" if args: if not args.outlog: return 0 if not filename: filename=args.outlog lastpath = '' with open(str(filename), 'w') as output_file: f...
['def', 'write_output', '(', 'self', ',', 'data', ',', 'args', '=', 'None', ',', 'filename', '=', 'None', ',', 'label', '=', 'None', ')', ':', 'if', 'args', ':', 'if', 'not', 'args', '.', 'outlog', ':', 'return', '0', 'if', 'not', 'filename', ':', 'filename', '=', 'args', '.', 'outlog', 'lastpath', '=', "''", 'with', '...
Write log data to a log file
['Write', 'log', 'data', 'to', 'a', 'log', 'file']
train
https://github.com/dogoncouch/logdissect/blob/426b50264cbfa9665c86df3781e1e415ba8dbbd3/logdissect/output/log.py#L37-L58
1,879
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_vcs.py
brocade_vcs.get_last_config_update_time_for_xpaths_output_last_config_update_time_for_xpaths_last_config_update_time
def get_last_config_update_time_for_xpaths_output_last_config_update_time_for_xpaths_last_config_update_time(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_last_config_update_time_for_xpaths = ET.Element("get_last_config_update_time_for_xpaths") con...
python
def get_last_config_update_time_for_xpaths_output_last_config_update_time_for_xpaths_last_config_update_time(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_last_config_update_time_for_xpaths = ET.Element("get_last_config_update_time_for_xpaths") con...
['def', 'get_last_config_update_time_for_xpaths_output_last_config_update_time_for_xpaths_last_config_update_time', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'config', '=', 'ET', '.', 'Element', '(', '"config"', ')', 'get_last_config_update_time_for_xpaths', '=', 'ET', '.', 'Element', '(', '"get_last_config_updat...
Auto Generated Code
['Auto', 'Generated', 'Code']
train
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_vcs.py#L716-L730
1,880
Capitains/MyCapytain
MyCapytain/resources/collections/cts.py
XmlCtsCitation.ingest
def ingest(cls, resource, element=None, xpath="ti:citation"): """ Ingest xml to create a citation :param resource: XML on which to do xpath :param element: Element where the citation should be stored :param xpath: XPath to use to retrieve citation :return: XmlCtsCitation ...
python
def ingest(cls, resource, element=None, xpath="ti:citation"): """ Ingest xml to create a citation :param resource: XML on which to do xpath :param element: Element where the citation should be stored :param xpath: XPath to use to retrieve citation :return: XmlCtsCitation ...
['def', 'ingest', '(', 'cls', ',', 'resource', ',', 'element', '=', 'None', ',', 'xpath', '=', '"ti:citation"', ')', ':', '# Reuse of of find citation', 'results', '=', 'resource', '.', 'xpath', '(', 'xpath', ',', 'namespaces', '=', 'XPATH_NAMESPACES', ')', 'if', 'len', '(', 'results', ')', '>', '0', ':', 'citation', '...
Ingest xml to create a citation :param resource: XML on which to do xpath :param element: Element where the citation should be stored :param xpath: XPath to use to retrieve citation :return: XmlCtsCitation
['Ingest', 'xml', 'to', 'create', 'a', 'citation']
train
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/collections/cts.py#L43-L76
1,881
oceanprotocol/squid-py
squid_py/aquarius/aquarius.py
Aquarius.get_asset_ddo
def get_asset_ddo(self, did): """ Retrieve asset ddo for a given did. :param did: Asset DID string :return: DDO instance """ response = self.requests_session.get(f'{self.url}/{did}').content if not response: return {} try: parsed_r...
python
def get_asset_ddo(self, did): """ Retrieve asset ddo for a given did. :param did: Asset DID string :return: DDO instance """ response = self.requests_session.get(f'{self.url}/{did}').content if not response: return {} try: parsed_r...
['def', 'get_asset_ddo', '(', 'self', ',', 'did', ')', ':', 'response', '=', 'self', '.', 'requests_session', '.', 'get', '(', "f'{self.url}/{did}'", ')', '.', 'content', 'if', 'not', 'response', ':', 'return', '{', '}', 'try', ':', 'parsed_response', '=', 'json', '.', 'loads', '(', 'response', ')', 'except', 'TypeErro...
Retrieve asset ddo for a given did. :param did: Asset DID string :return: DDO instance
['Retrieve', 'asset', 'ddo', 'for', 'a', 'given', 'did', '.']
train
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/aquarius/aquarius.py#L79-L97
1,882
opengridcc/opengrid
opengrid/library/regression.py
MultiVarLinReg._do_analysis_cross_validation
def _do_analysis_cross_validation(self): """ Find the best model (fit) based on cross-valiation (leave one out) """ assert len(self.df) < 15, "Cross-validation is not implemented if your sample contains more than 15 datapoints" # initialization: first model is the mean, but com...
python
def _do_analysis_cross_validation(self): """ Find the best model (fit) based on cross-valiation (leave one out) """ assert len(self.df) < 15, "Cross-validation is not implemented if your sample contains more than 15 datapoints" # initialization: first model is the mean, but com...
['def', '_do_analysis_cross_validation', '(', 'self', ')', ':', 'assert', 'len', '(', 'self', '.', 'df', ')', '<', '15', ',', '"Cross-validation is not implemented if your sample contains more than 15 datapoints"', '# initialization: first model is the mean, but compute cv correctly.', 'errors', '=', '[', ']', 'respons...
Find the best model (fit) based on cross-valiation (leave one out)
['Find', 'the', 'best', 'model', '(', 'fit', ')', 'based', 'on', 'cross', '-', 'valiation', '(', 'leave', 'one', 'out', ')']
train
https://github.com/opengridcc/opengrid/blob/69b8da3c8fcea9300226c45ef0628cd6d4307651/opengrid/library/regression.py#L157-L219
1,883
andycasey/sick
sick/models/create.py
create
def create(output_prefix, grid_flux_filename, wavelength_filenames, clobber=False, grid_flux_filename_format="csv", **kwargs): """ Create a new *sick* model from files describing the parameter names, fluxes, and wavelengths. """ if not clobber: # Check to make sure the output files won'...
python
def create(output_prefix, grid_flux_filename, wavelength_filenames, clobber=False, grid_flux_filename_format="csv", **kwargs): """ Create a new *sick* model from files describing the parameter names, fluxes, and wavelengths. """ if not clobber: # Check to make sure the output files won'...
['def', 'create', '(', 'output_prefix', ',', 'grid_flux_filename', ',', 'wavelength_filenames', ',', 'clobber', '=', 'False', ',', 'grid_flux_filename_format', '=', '"csv"', ',', '*', '*', 'kwargs', ')', ':', 'if', 'not', 'clobber', ':', "# Check to make sure the output files won't exist already.", 'output_suffixes', '...
Create a new *sick* model from files describing the parameter names, fluxes, and wavelengths.
['Create', 'a', 'new', '*', 'sick', '*', 'model', 'from', 'files', 'describing', 'the', 'parameter', 'names', 'fluxes', 'and', 'wavelengths', '.']
train
https://github.com/andycasey/sick/blob/6c37686182794c4cafea45abf7062b30b789b1a2/sick/models/create.py#L49-L161
1,884
googleapis/google-cloud-python
error_reporting/google/cloud/error_reporting/_logging.py
_ErrorReportingLoggingAPI.report_error_event
def report_error_event(self, error_report): """Report error payload. :type error_report: dict :param: error_report: dict payload of the error report formatted according to https://cloud.google.com/error-reporting/docs/formatting-error-messages This object sho...
python
def report_error_event(self, error_report): """Report error payload. :type error_report: dict :param: error_report: dict payload of the error report formatted according to https://cloud.google.com/error-reporting/docs/formatting-error-messages This object sho...
['def', 'report_error_event', '(', 'self', ',', 'error_report', ')', ':', 'logger', '=', 'self', '.', 'logging_client', '.', 'logger', '(', '"errors"', ')', 'logger', '.', 'log_struct', '(', 'error_report', ')']
Report error payload. :type error_report: dict :param: error_report: dict payload of the error report formatted according to https://cloud.google.com/error-reporting/docs/formatting-error-messages This object should be built using :meth:~`google.cloud.err...
['Report', 'error', 'payload', '.']
train
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/error_reporting/google/cloud/error_reporting/_logging.py#L55-L66
1,885
tensorflow/tensor2tensor
tensor2tensor/data_generators/problem.py
Problem.get_hparams
def get_hparams(self, model_hparams=None): """Returns problem_hparams.""" if self._hparams is not None: return self._hparams if model_hparams is None: model_hparams = default_model_hparams() if self._encoders is None: data_dir = (model_hparams and hasattr(model_hparams, "data_dir") a...
python
def get_hparams(self, model_hparams=None): """Returns problem_hparams.""" if self._hparams is not None: return self._hparams if model_hparams is None: model_hparams = default_model_hparams() if self._encoders is None: data_dir = (model_hparams and hasattr(model_hparams, "data_dir") a...
['def', 'get_hparams', '(', 'self', ',', 'model_hparams', '=', 'None', ')', ':', 'if', 'self', '.', '_hparams', 'is', 'not', 'None', ':', 'return', 'self', '.', '_hparams', 'if', 'model_hparams', 'is', 'None', ':', 'model_hparams', '=', 'default_model_hparams', '(', ')', 'if', 'self', '.', '_encoders', 'is', 'None', ':...
Returns problem_hparams.
['Returns', 'problem_hparams', '.']
train
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/problem.py#L513-L542
1,886
cozy/python_cozy_management
cozy_management/weboob.py
install
def install(): ''' Install weboob system-wide ''' tmp_weboob_dir = '/tmp/weboob' # Check that the directory does not already exists while (os.path.exists(tmp_weboob_dir)): tmp_weboob_dir += '1' # Clone the repository print 'Fetching sources in temporary dir {}'.format(tmp_w...
python
def install(): ''' Install weboob system-wide ''' tmp_weboob_dir = '/tmp/weboob' # Check that the directory does not already exists while (os.path.exists(tmp_weboob_dir)): tmp_weboob_dir += '1' # Clone the repository print 'Fetching sources in temporary dir {}'.format(tmp_w...
['def', 'install', '(', ')', ':', 'tmp_weboob_dir', '=', "'/tmp/weboob'", '# Check that the directory does not already exists', 'while', '(', 'os', '.', 'path', '.', 'exists', '(', 'tmp_weboob_dir', ')', ')', ':', 'tmp_weboob_dir', '+=', "'1'", '# Clone the repository', 'print', "'Fetching sources in temporary dir {}'"...
Install weboob system-wide
['Install', 'weboob', 'system', '-', 'wide']
train
https://github.com/cozy/python_cozy_management/blob/820cea58458ae3e067fa8cc2da38edbda4681dac/cozy_management/weboob.py#L32-L72
1,887
ConsenSys/mythril-classic
mythril/laser/smt/__init__.py
_SmtSymbolFactory.BitVecSym
def BitVecSym(name: str, size: int, annotations: Annotations = None) -> BitVec: """Creates a new bit vector with a symbolic value.""" raw = z3.BitVec(name, size) return BitVec(raw, annotations)
python
def BitVecSym(name: str, size: int, annotations: Annotations = None) -> BitVec: """Creates a new bit vector with a symbolic value.""" raw = z3.BitVec(name, size) return BitVec(raw, annotations)
['def', 'BitVecSym', '(', 'name', ':', 'str', ',', 'size', ':', 'int', ',', 'annotations', ':', 'Annotations', '=', 'None', ')', '->', 'BitVec', ':', 'raw', '=', 'z3', '.', 'BitVec', '(', 'name', ',', 'size', ')', 'return', 'BitVec', '(', 'raw', ',', 'annotations', ')']
Creates a new bit vector with a symbolic value.
['Creates', 'a', 'new', 'bit', 'vector', 'with', 'a', 'symbolic', 'value', '.']
train
https://github.com/ConsenSys/mythril-classic/blob/27af71c34b2ce94f4fae5613ec457f93df1a8f56/mythril/laser/smt/__init__.py#L132-L135
1,888
SeanOC/sharpy
sharpy/product.py
PricingPlan.initial_bill_date
def initial_bill_date(self): ''' An estimated initial bill date for an account created today, based on available plan info. ''' time_to_start = None if self.initial_bill_count_unit == 'months': time_to_start = relativedelta(months=self.initial_bill_co...
python
def initial_bill_date(self): ''' An estimated initial bill date for an account created today, based on available plan info. ''' time_to_start = None if self.initial_bill_count_unit == 'months': time_to_start = relativedelta(months=self.initial_bill_co...
['def', 'initial_bill_date', '(', 'self', ')', ':', 'time_to_start', '=', 'None', 'if', 'self', '.', 'initial_bill_count_unit', '==', "'months'", ':', 'time_to_start', '=', 'relativedelta', '(', 'months', '=', 'self', '.', 'initial_bill_count', ')', 'else', ':', 'time_to_start', '=', 'relativedelta', '(', 'days', '=', ...
An estimated initial bill date for an account created today, based on available plan info.
['An', 'estimated', 'initial', 'bill', 'date', 'for', 'an', 'account', 'created', 'today', 'based', 'on', 'available', 'plan', 'info', '.']
train
https://github.com/SeanOC/sharpy/blob/935943ca86034255f0a93c1a84734814be176ed4/sharpy/product.py#L331-L345
1,889
mixmastamyk/console
console/utils.py
reset_terminal
def reset_terminal(): ''' Reset the terminal/console screen. (Also aliased to cls.) Greater than a fullscreen terminal clear, also clears the scrollback buffer. May expose bugs in dumb terminals. ''' if os.name == 'nt': from .windows import cls cls() else: text ...
python
def reset_terminal(): ''' Reset the terminal/console screen. (Also aliased to cls.) Greater than a fullscreen terminal clear, also clears the scrollback buffer. May expose bugs in dumb terminals. ''' if os.name == 'nt': from .windows import cls cls() else: text ...
['def', 'reset_terminal', '(', ')', ':', 'if', 'os', '.', 'name', '==', "'nt'", ':', 'from', '.', 'windows', 'import', 'cls', 'cls', '(', ')', 'else', ':', 'text', '=', 'sc', '.', 'reset', '_write', '(', 'text', ')', 'return', 'text']
Reset the terminal/console screen. (Also aliased to cls.) Greater than a fullscreen terminal clear, also clears the scrollback buffer. May expose bugs in dumb terminals.
['Reset', 'the', 'terminal', '/', 'console', 'screen', '.', '(', 'Also', 'aliased', 'to', 'cls', '.', ')']
train
https://github.com/mixmastamyk/console/blob/afe6c95d5a7b83d85376f450454e3769e4a5c3d0/console/utils.py#L88-L100
1,890
qwiglydee/drf-mongo-filters
drf_mongo_filters/filters.py
Filter.filter_params
def filter_params(self, value): """ return filtering params """ if value is None: return {} key = self.target if self.lookup_type is not None: key += '__' + self.lookup_type return { key: value }
python
def filter_params(self, value): """ return filtering params """ if value is None: return {} key = self.target if self.lookup_type is not None: key += '__' + self.lookup_type return { key: value }
['def', 'filter_params', '(', 'self', ',', 'value', ')', ':', 'if', 'value', 'is', 'None', ':', 'return', '{', '}', 'key', '=', 'self', '.', 'target', 'if', 'self', '.', 'lookup_type', 'is', 'not', 'None', ':', 'key', '+=', "'__'", '+', 'self', '.', 'lookup_type', 'return', '{', 'key', ':', 'value', '}']
return filtering params
['return', 'filtering', 'params']
train
https://github.com/qwiglydee/drf-mongo-filters/blob/f7e397c329bac6d7b8cbb1df70d96eccdcfbc1ec/drf_mongo_filters/filters.py#L78-L86
1,891
rigetti/pyquil
pyquil/_parser/PyQuilListener.py
CustomErrorListener.get_expected_tokens
def get_expected_tokens(self, parser, interval_set): # type: (QuilParser, IntervalSet) -> Iterator """ Like the default getExpectedTokens method except that it will fallback to the rule name if the token isn't a literal. For instance, instead of <INVALID> for integer it will return the ...
python
def get_expected_tokens(self, parser, interval_set): # type: (QuilParser, IntervalSet) -> Iterator """ Like the default getExpectedTokens method except that it will fallback to the rule name if the token isn't a literal. For instance, instead of <INVALID> for integer it will return the ...
['def', 'get_expected_tokens', '(', 'self', ',', 'parser', ',', 'interval_set', ')', ':', '# type: (QuilParser, IntervalSet) -> Iterator', 'for', 'tok', 'in', 'interval_set', ':', 'literal_name', '=', 'parser', '.', 'literalNames', '[', 'tok', ']', 'symbolic_name', '=', 'parser', '.', 'symbolicNames', '[', 'tok', ']', ...
Like the default getExpectedTokens method except that it will fallback to the rule name if the token isn't a literal. For instance, instead of <INVALID> for integer it will return the rule name: INT
['Like', 'the', 'default', 'getExpectedTokens', 'method', 'except', 'that', 'it', 'will', 'fallback', 'to', 'the', 'rule', 'name', 'if', 'the', 'token', 'isn', 't', 'a', 'literal', '.', 'For', 'instance', 'instead', 'of', '<INVALID', '>', 'for', 'integer', 'it', 'will', 'return', 'the', 'rule', 'name', ':', 'INT']
train
https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/_parser/PyQuilListener.py#L87-L100
1,892
orbingol/NURBS-Python
geomdl/_operations.py
normal_surface_single
def normal_surface_single(obj, uv, normalize): """ Evaluates the surface normal vector at the given (u, v) parameter pair. The output returns a list containing the starting point (i.e. origin) of the vector and the vector itself. :param obj: input surface :type obj: abstract.Surface :param uv: (u,...
python
def normal_surface_single(obj, uv, normalize): """ Evaluates the surface normal vector at the given (u, v) parameter pair. The output returns a list containing the starting point (i.e. origin) of the vector and the vector itself. :param obj: input surface :type obj: abstract.Surface :param uv: (u,...
['def', 'normal_surface_single', '(', 'obj', ',', 'uv', ',', 'normalize', ')', ':', '# Take the 1st derivative of the surface', 'skl', '=', 'obj', '.', 'derivatives', '(', 'uv', '[', '0', ']', ',', 'uv', '[', '1', ']', ',', '1', ')', 'point', '=', 'skl', '[', '0', ']', '[', '0', ']', 'vector', '=', 'linalg', '.', 'vect...
Evaluates the surface normal vector at the given (u, v) parameter pair. The output returns a list containing the starting point (i.e. origin) of the vector and the vector itself. :param obj: input surface :type obj: abstract.Surface :param uv: (u,v) parameter pair :type uv: list or tuple :para...
['Evaluates', 'the', 'surface', 'normal', 'vector', 'at', 'the', 'given', '(', 'u', 'v', ')', 'parameter', 'pair', '.']
train
https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/_operations.py#L191-L212
1,893
joeyespo/gitpress
gitpress/config.py
set_value
def set_value(repo_directory, key, value, strict=True): """Sets the value of a particular key in the config file. This has no effect when setting to the same value.""" if value is None: raise ValueError('Argument "value" must not be None.') # Read values and do nothing if not making any changes ...
python
def set_value(repo_directory, key, value, strict=True): """Sets the value of a particular key in the config file. This has no effect when setting to the same value.""" if value is None: raise ValueError('Argument "value" must not be None.') # Read values and do nothing if not making any changes ...
['def', 'set_value', '(', 'repo_directory', ',', 'key', ',', 'value', ',', 'strict', '=', 'True', ')', ':', 'if', 'value', 'is', 'None', ':', 'raise', 'ValueError', '(', '\'Argument "value" must not be None.\'', ')', '# Read values and do nothing if not making any changes', 'config', '=', 'read_config', '(', 'repo_dire...
Sets the value of a particular key in the config file. This has no effect when setting to the same value.
['Sets', 'the', 'value', 'of', 'a', 'particular', 'key', 'in', 'the', 'config', 'file', '.', 'This', 'has', 'no', 'effect', 'when', 'setting', 'to', 'the', 'same', 'value', '.']
train
https://github.com/joeyespo/gitpress/blob/a23edb80b6e4a113d167217475344a01c92b5c6d/gitpress/config.py#L62-L81
1,894
F5Networks/f5-common-python
f5/bigip/mixins.py
CheckExistenceMixin._return_object
def _return_object(self, container, item_name): """Helper method to retrieve the object""" coll = container.get_collection() for item in coll: if item.name == item_name: return item
python
def _return_object(self, container, item_name): """Helper method to retrieve the object""" coll = container.get_collection() for item in coll: if item.name == item_name: return item
['def', '_return_object', '(', 'self', ',', 'container', ',', 'item_name', ')', ':', 'coll', '=', 'container', '.', 'get_collection', '(', ')', 'for', 'item', 'in', 'coll', ':', 'if', 'item', '.', 'name', '==', 'item_name', ':', 'return', 'item']
Helper method to retrieve the object
['Helper', 'method', 'to', 'retrieve', 'the', 'object']
train
https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/mixins.py#L463-L468
1,895
pypa/pipenv
pipenv/vendor/distlib/database.py
InstalledDistribution.read_exports
def read_exports(self): """ Read exports data from a file in .ini format. :return: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries. """ result = {} ...
python
def read_exports(self): """ Read exports data from a file in .ini format. :return: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries. """ result = {} ...
['def', 'read_exports', '(', 'self', ')', ':', 'result', '=', '{', '}', 'r', '=', 'self', '.', 'get_distinfo_resource', '(', 'EXPORTS_FILENAME', ')', 'if', 'r', ':', 'with', 'contextlib', '.', 'closing', '(', 'r', '.', 'as_stream', '(', ')', ')', 'as', 'stream', ':', 'result', '=', 'read_exports', '(', 'stream', ')', '...
Read exports data from a file in .ini format. :return: A dictionary of exports, mapping an export category to a list of :class:`ExportEntry` instances describing the individual export entries.
['Read', 'exports', 'data', 'from', 'a', 'file', 'in', '.', 'ini', 'format', '.']
train
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L617-L630
1,896
bitesofcode/projexui
projexui/widgets/xorbcolumnnavigator.py
XOrbColumnItem.setCurrentSchemaPath
def setCurrentSchemaPath(self, path): """ Sets the current item based on the inputed column. :param path | <str> """ if not path: return False parts = path.split('.') name = parts[0] next = parts[1:] ...
python
def setCurrentSchemaPath(self, path): """ Sets the current item based on the inputed column. :param path | <str> """ if not path: return False parts = path.split('.') name = parts[0] next = parts[1:] ...
['def', 'setCurrentSchemaPath', '(', 'self', ',', 'path', ')', ':', 'if', 'not', 'path', ':', 'return', 'False', 'parts', '=', 'path', '.', 'split', '(', "'.'", ')', 'name', '=', 'parts', '[', '0', ']', 'next', '=', 'parts', '[', '1', ':', ']', 'if', 'name', '==', 'self', '.', 'text', '(', '0', ')', ':', 'if', 'next', ...
Sets the current item based on the inputed column. :param path | <str>
['Sets', 'the', 'current', 'item', 'based', 'on', 'the', 'inputed', 'column', '.', ':', 'param', 'path', '|', '<str', '>']
train
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbcolumnnavigator.py#L96-L121
1,897
fprimex/zdesk
zdesk/zdesk_api.py
ZendeskAPI.ticket_metrics
def ticket_metrics(self, ticket_id, **kwargs): "https://developer.zendesk.com/rest_api/docs/core/ticket_metrics#show-ticket-metrics" api_path = "/api/v2/tickets/{ticket_id}/metrics.json" api_path = api_path.format(ticket_id=ticket_id) return self.call(api_path, **kwargs)
python
def ticket_metrics(self, ticket_id, **kwargs): "https://developer.zendesk.com/rest_api/docs/core/ticket_metrics#show-ticket-metrics" api_path = "/api/v2/tickets/{ticket_id}/metrics.json" api_path = api_path.format(ticket_id=ticket_id) return self.call(api_path, **kwargs)
['def', 'ticket_metrics', '(', 'self', ',', 'ticket_id', ',', '*', '*', 'kwargs', ')', ':', 'api_path', '=', '"/api/v2/tickets/{ticket_id}/metrics.json"', 'api_path', '=', 'api_path', '.', 'format', '(', 'ticket_id', '=', 'ticket_id', ')', 'return', 'self', '.', 'call', '(', 'api_path', ',', '*', '*', 'kwargs', ')']
https://developer.zendesk.com/rest_api/docs/core/ticket_metrics#show-ticket-metrics
['https', ':', '//', 'developer', '.', 'zendesk', '.', 'com', '/', 'rest_api', '/', 'docs', '/', 'core', '/', 'ticket_metrics#show', '-', 'ticket', '-', 'metrics']
train
https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L3551-L3555
1,898
deontologician/restnavigator
restnavigator/utils.py
LinkList.get_by
def get_by(self, prop, val, raise_exc=False): '''Retrieve an item from the dictionary with the given metadata properties. If there is no such item, None will be returned, if there are multiple such items, the first will be returned.''' try: val = self.serialize(val) ...
python
def get_by(self, prop, val, raise_exc=False): '''Retrieve an item from the dictionary with the given metadata properties. If there is no such item, None will be returned, if there are multiple such items, the first will be returned.''' try: val = self.serialize(val) ...
['def', 'get_by', '(', 'self', ',', 'prop', ',', 'val', ',', 'raise_exc', '=', 'False', ')', ':', 'try', ':', 'val', '=', 'self', '.', 'serialize', '(', 'val', ')', 'return', 'self', '.', '_meta', '[', 'prop', ']', '[', 'val', ']', '[', '0', ']', 'except', '(', 'KeyError', ',', 'IndexError', ')', ':', 'if', 'raise_exc'...
Retrieve an item from the dictionary with the given metadata properties. If there is no such item, None will be returned, if there are multiple such items, the first will be returned.
['Retrieve', 'an', 'item', 'from', 'the', 'dictionary', 'with', 'the', 'given', 'metadata', 'properties', '.', 'If', 'there', 'is', 'no', 'such', 'item', 'None', 'will', 'be', 'returned', 'if', 'there', 'are', 'multiple', 'such', 'items', 'the', 'first', 'will', 'be', 'returned', '.']
train
https://github.com/deontologician/restnavigator/blob/453b9de4e70e602009d3e3ffafcf77d23c8b07c5/restnavigator/utils.py#L205-L216
1,899
mbedmicro/pyOCD
pyocd/utility/conversion.py
u16le_list_to_byte_list
def u16le_list_to_byte_list(data): """! @brief Convert a halfword array into a byte array""" byteData = [] for h in data: byteData.extend([h & 0xff, (h >> 8) & 0xff]) return byteData
python
def u16le_list_to_byte_list(data): """! @brief Convert a halfword array into a byte array""" byteData = [] for h in data: byteData.extend([h & 0xff, (h >> 8) & 0xff]) return byteData
['def', 'u16le_list_to_byte_list', '(', 'data', ')', ':', 'byteData', '=', '[', ']', 'for', 'h', 'in', 'data', ':', 'byteData', '.', 'extend', '(', '[', 'h', '&', '0xff', ',', '(', 'h', '>>', '8', ')', '&', '0xff', ']', ')', 'return', 'byteData']
! @brief Convert a halfword array into a byte array
['!']
train
https://github.com/mbedmicro/pyOCD/blob/41a174718a9739f3cbe785c2ba21cb7fd1310c6f/pyocd/utility/conversion.py#L49-L54