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,900
shawnsilva/steamwebapi
steamwebapi/api.py
ISteamUser.get_player_bans
def get_player_bans(self, steamIDS, format=None): """Request the communities a steam id is banned in. steamIDS: Comma-delimited list of SteamIDs format: Return format. None defaults to json. (json, xml, vdf) """ parameters = {'steamids' : steamIDS} if format is not None...
python
def get_player_bans(self, steamIDS, format=None): """Request the communities a steam id is banned in. steamIDS: Comma-delimited list of SteamIDs format: Return format. None defaults to json. (json, xml, vdf) """ parameters = {'steamids' : steamIDS} if format is not None...
['def', 'get_player_bans', '(', 'self', ',', 'steamIDS', ',', 'format', '=', 'None', ')', ':', 'parameters', '=', '{', "'steamids'", ':', 'steamIDS', '}', 'if', 'format', 'is', 'not', 'None', ':', 'parameters', '[', "'format'", ']', '=', 'format', 'url', '=', 'self', '.', 'create_request_url', '(', 'self', '.', 'interf...
Request the communities a steam id is banned in. steamIDS: Comma-delimited list of SteamIDs format: Return format. None defaults to json. (json, xml, vdf)
['Request', 'the', 'communities', 'a', 'steam', 'id', 'is', 'banned', 'in', '.']
train
https://github.com/shawnsilva/steamwebapi/blob/dc16538ebe985cc7ea170f660169ebc2366efbf2/steamwebapi/api.py#L122-L135
1,901
mailgun/expiringdict
expiringdict/__init__.py
ExpiringDict.values
def values(self): """ Return a copy of the dictionary's list of values. See the note for dict.items(). """ r = [] for key in self._safe_keys(): try: r.append(self[key]) except KeyError: pass return r
python
def values(self): """ Return a copy of the dictionary's list of values. See the note for dict.items(). """ r = [] for key in self._safe_keys(): try: r.append(self[key]) except KeyError: pass return r
['def', 'values', '(', 'self', ')', ':', 'r', '=', '[', ']', 'for', 'key', 'in', 'self', '.', '_safe_keys', '(', ')', ':', 'try', ':', 'r', '.', 'append', '(', 'self', '[', 'key', ']', ')', 'except', 'KeyError', ':', 'pass', 'return', 'r']
Return a copy of the dictionary's list of values. See the note for dict.items().
['Return', 'a', 'copy', 'of', 'the', 'dictionary', 's', 'list', 'of', 'values', '.', 'See', 'the', 'note', 'for', 'dict', '.', 'items', '()', '.']
train
https://github.com/mailgun/expiringdict/blob/750048022cde40d35721253a88fbaa2df1781e94/expiringdict/__init__.py#L129-L138
1,902
dlecocq/nsq-py
nsq/response.py
Error.exception
def exception(self): '''Return an instance of the corresponding exception''' code, _, message = self.data.partition(' ') return self.find(code)(message)
python
def exception(self): '''Return an instance of the corresponding exception''' code, _, message = self.data.partition(' ') return self.find(code)(message)
['def', 'exception', '(', 'self', ')', ':', 'code', ',', '_', ',', 'message', '=', 'self', '.', 'data', '.', 'partition', '(', "' '", ')', 'return', 'self', '.', 'find', '(', 'code', ')', '(', 'message', ')']
Return an instance of the corresponding exception
['Return', 'an', 'instance', 'of', 'the', 'corresponding', 'exception']
train
https://github.com/dlecocq/nsq-py/blob/3ecacf6ab7719d38031179277113d875554a0c16/nsq/response.py#L147-L150
1,903
leonidessaguisagjr/pseudol10nutil
pseudol10nutil/pseudol10nutil.py
PseudoL10nUtil.pseudolocalize
def pseudolocalize(self, s): """ Performs pseudo-localization on a string. The specific transforms to be applied to the string is defined in the transforms field of the object. :param s: String to pseudo-localize. :returns: Copy of the string s with the transforms applied. If ...
python
def pseudolocalize(self, s): """ Performs pseudo-localization on a string. The specific transforms to be applied to the string is defined in the transforms field of the object. :param s: String to pseudo-localize. :returns: Copy of the string s with the transforms applied. If ...
['def', 'pseudolocalize', '(', 'self', ',', 's', ')', ':', 'if', 'not', 's', ':', '# If the string is empty or None', 'return', 'u""', 'if', 'not', 'isinstance', '(', 's', ',', 'six', '.', 'text_type', ')', ':', 'raise', 'TypeError', '(', '"String to pseudo-localize must be of type \'{0}\'."', '.', 'format', '(', 'six'...
Performs pseudo-localization on a string. The specific transforms to be applied to the string is defined in the transforms field of the object. :param s: String to pseudo-localize. :returns: Copy of the string s with the transforms applied. If the input string is an empty st...
['Performs', 'pseudo', '-', 'localization', 'on', 'a', 'string', '.', 'The', 'specific', 'transforms', 'to', 'be', 'applied', 'to', 'the', 'string', 'is', 'defined', 'in', 'the', 'transforms', 'field', 'of', 'the', 'object', '.']
train
https://github.com/leonidessaguisagjr/pseudol10nutil/blob/39cb0ae8cc5c1df5690816a18472e0366a49ab8d/pseudol10nutil/pseudol10nutil.py#L33-L77
1,904
spacetelescope/stsci.tools
lib/stsci/tools/wcsutil.py
WCSObject.createReferenceWCS
def createReferenceWCS(self,refname,overwrite=yes): """ Write out the values of the WCS keywords to the NEW specified image 'fitsname'. """ hdu = self.createWcsHDU() # If refname already exists, delete it to make way for new file if os.path.exists(refname): ...
python
def createReferenceWCS(self,refname,overwrite=yes): """ Write out the values of the WCS keywords to the NEW specified image 'fitsname'. """ hdu = self.createWcsHDU() # If refname already exists, delete it to make way for new file if os.path.exists(refname): ...
['def', 'createReferenceWCS', '(', 'self', ',', 'refname', ',', 'overwrite', '=', 'yes', ')', ':', 'hdu', '=', 'self', '.', 'createWcsHDU', '(', ')', '# If refname already exists, delete it to make way for new file', 'if', 'os', '.', 'path', '.', 'exists', '(', 'refname', ')', ':', 'if', 'overwrite', '==', 'yes', ':', ...
Write out the values of the WCS keywords to the NEW specified image 'fitsname'.
['Write', 'out', 'the', 'values', 'of', 'the', 'WCS', 'keywords', 'to', 'the', 'NEW', 'specified', 'image', 'fitsname', '.']
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/wcsutil.py#L1025-L1053
1,905
kensho-technologies/graphql-compiler
graphql_compiler/compiler/sql_context_helpers.py
get_node_at_path
def get_node_at_path(query_path, context): """Return the SqlNode associated with the query path.""" if query_path not in context.query_path_to_node: raise AssertionError( u'Unable to find SqlNode for query path {} with context {}.'.format( query_path, context)) node = con...
python
def get_node_at_path(query_path, context): """Return the SqlNode associated with the query path.""" if query_path not in context.query_path_to_node: raise AssertionError( u'Unable to find SqlNode for query path {} with context {}.'.format( query_path, context)) node = con...
['def', 'get_node_at_path', '(', 'query_path', ',', 'context', ')', ':', 'if', 'query_path', 'not', 'in', 'context', '.', 'query_path_to_node', ':', 'raise', 'AssertionError', '(', "u'Unable to find SqlNode for query path {} with context {}.'", '.', 'format', '(', 'query_path', ',', 'context', ')', ')', 'node', '=', 'c...
Return the SqlNode associated with the query path.
['Return', 'the', 'SqlNode', 'associated', 'with', 'the', 'query', 'path', '.']
train
https://github.com/kensho-technologies/graphql-compiler/blob/f6079c6d10f64932f6b3af309b79bcea2123ca8f/graphql_compiler/compiler/sql_context_helpers.py#L27-L34
1,906
materialsproject/pymatgen
pymatgen/analysis/molecule_matcher.py
InchiMolAtomMapper._group_centroid
def _group_centroid(mol, ilabels, group_atoms): """ Calculate the centroids of a group atoms indexed by the labels of inchi Args: mol: The molecule. OpenBabel OBMol object ilabel: inchi label map Returns: Centroid. Tuple (x, y, z) """ ...
python
def _group_centroid(mol, ilabels, group_atoms): """ Calculate the centroids of a group atoms indexed by the labels of inchi Args: mol: The molecule. OpenBabel OBMol object ilabel: inchi label map Returns: Centroid. Tuple (x, y, z) """ ...
['def', '_group_centroid', '(', 'mol', ',', 'ilabels', ',', 'group_atoms', ')', ':', 'c1x', ',', 'c1y', ',', 'c1z', '=', '0.0', ',', '0.0', ',', '0.0', 'for', 'i', 'in', 'group_atoms', ':', 'orig_idx', '=', 'ilabels', '[', 'i', '-', '1', ']', 'oa1', '=', 'mol', '.', 'GetAtom', '(', 'orig_idx', ')', 'c1x', '+=', 'float'...
Calculate the centroids of a group atoms indexed by the labels of inchi Args: mol: The molecule. OpenBabel OBMol object ilabel: inchi label map Returns: Centroid. Tuple (x, y, z)
['Calculate', 'the', 'centroids', 'of', 'a', 'group', 'atoms', 'indexed', 'by', 'the', 'labels', 'of', 'inchi']
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/molecule_matcher.py#L237-L259
1,907
MacHu-GWU/sqlalchemy_mate-project
sqlalchemy_mate/credential.py
EngineCreator.create_mysql
def create_mysql(self, **kwargs): """ :rtype: Engine """ return self._ce( self._ccs(self.DialectAndDriver.mysql), **kwargs )
python
def create_mysql(self, **kwargs): """ :rtype: Engine """ return self._ce( self._ccs(self.DialectAndDriver.mysql), **kwargs )
['def', 'create_mysql', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'return', 'self', '.', '_ce', '(', 'self', '.', '_ccs', '(', 'self', '.', 'DialectAndDriver', '.', 'mysql', ')', ',', '*', '*', 'kwargs', ')']
:rtype: Engine
[':', 'rtype', ':', 'Engine']
train
https://github.com/MacHu-GWU/sqlalchemy_mate-project/blob/946754744c8870f083fd7b4339fca15d1d6128b2/sqlalchemy_mate/credential.py#L362-L368
1,908
mwouts/jupytext
jupytext/cell_metadata.py
json_options_to_metadata
def json_options_to_metadata(options, add_brackets=True): """Read metadata from its json representation""" try: options = loads('{' + options + '}' if add_brackets else options) return options except ValueError: return {}
python
def json_options_to_metadata(options, add_brackets=True): """Read metadata from its json representation""" try: options = loads('{' + options + '}' if add_brackets else options) return options except ValueError: return {}
['def', 'json_options_to_metadata', '(', 'options', ',', 'add_brackets', '=', 'True', ')', ':', 'try', ':', 'options', '=', 'loads', '(', "'{'", '+', 'options', '+', "'}'", 'if', 'add_brackets', 'else', 'options', ')', 'return', 'options', 'except', 'ValueError', ':', 'return', '{', '}']
Read metadata from its json representation
['Read', 'metadata', 'from', 'its', 'json', 'representation']
train
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/cell_metadata.py#L333-L339
1,909
tjcsl/ion
intranet/apps/announcements/views.py
add_announcement_view
def add_announcement_view(request): """Add an announcement.""" if request.method == "POST": form = AnnouncementForm(request.POST) logger.debug(form) if form.is_valid(): obj = form.save() obj.user = request.user # SAFE HTML obj.content = saf...
python
def add_announcement_view(request): """Add an announcement.""" if request.method == "POST": form = AnnouncementForm(request.POST) logger.debug(form) if form.is_valid(): obj = form.save() obj.user = request.user # SAFE HTML obj.content = saf...
['def', 'add_announcement_view', '(', 'request', ')', ':', 'if', 'request', '.', 'method', '==', '"POST"', ':', 'form', '=', 'AnnouncementForm', '(', 'request', '.', 'POST', ')', 'logger', '.', 'debug', '(', 'form', ')', 'if', 'form', '.', 'is_valid', '(', ')', ':', 'obj', '=', 'form', '.', 'save', '(', ')', 'obj', '.'...
Add an announcement.
['Add', 'an', 'announcement', '.']
train
https://github.com/tjcsl/ion/blob/5d722b0725d572039bb0929fd5715a4070c82c72/intranet/apps/announcements/views.py#L268-L286
1,910
Capitains/MyCapytain
MyCapytain/resources/texts/local/capitains/cts.py
CapitainsCtsPassage.next
def next(self): """ Next CapitainsCtsPassage (Interactive CapitainsCtsPassage) """ if self.nextId is not None: return super(CapitainsCtsPassage, self).getTextualNode(subreference=self.nextId)
python
def next(self): """ Next CapitainsCtsPassage (Interactive CapitainsCtsPassage) """ if self.nextId is not None: return super(CapitainsCtsPassage, self).getTextualNode(subreference=self.nextId)
['def', 'next', '(', 'self', ')', ':', 'if', 'self', '.', 'nextId', 'is', 'not', 'None', ':', 'return', 'super', '(', 'CapitainsCtsPassage', ',', 'self', ')', '.', 'getTextualNode', '(', 'subreference', '=', 'self', '.', 'nextId', ')']
Next CapitainsCtsPassage (Interactive CapitainsCtsPassage)
['Next', 'CapitainsCtsPassage', '(', 'Interactive', 'CapitainsCtsPassage', ')']
train
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/local/capitains/cts.py#L672-L676
1,911
sepandhaghighi/art
art/art.py
tsave
def tsave( text, font=DEFAULT_FONT, filename="art", chr_ignore=True, print_status=True): r""" Save ascii art (support \n). :param text: input text :param font: input font :type font:str :type text:str :param filename: output file name :type filena...
python
def tsave( text, font=DEFAULT_FONT, filename="art", chr_ignore=True, print_status=True): r""" Save ascii art (support \n). :param text: input text :param font: input font :type font:str :type text:str :param filename: output file name :type filena...
['def', 'tsave', '(', 'text', ',', 'font', '=', 'DEFAULT_FONT', ',', 'filename', '=', '"art"', ',', 'chr_ignore', '=', 'True', ',', 'print_status', '=', 'True', ')', ':', 'try', ':', 'if', 'isinstance', '(', 'text', ',', 'str', ')', 'is', 'False', ':', 'raise', 'Exception', '(', 'TEXT_TYPE_ERROR', ')', 'files_list', '=...
r""" Save ascii art (support \n). :param text: input text :param font: input font :type font:str :type text:str :param filename: output file name :type filename:str :param chr_ignore: ignore not supported character :type chr_ignore:bool :param print_status : save message print f...
['r', 'Save', 'ascii', 'art', '(', 'support', '\\', 'n', ')', '.']
train
https://github.com/sepandhaghighi/art/blob/c5b0409de76464b0714c377f8fca17716f3a9482/art/art.py#L197-L246
1,912
twilio/twilio-python
twilio/rest/authy/v1/service/entity/factor/__init__.py
FactorPage.get_instance
def get_instance(self, payload): """ Build an instance of FactorInstance :param dict payload: Payload response from the API :returns: twilio.rest.authy.v1.service.entity.factor.FactorInstance :rtype: twilio.rest.authy.v1.service.entity.factor.FactorInstance """ ...
python
def get_instance(self, payload): """ Build an instance of FactorInstance :param dict payload: Payload response from the API :returns: twilio.rest.authy.v1.service.entity.factor.FactorInstance :rtype: twilio.rest.authy.v1.service.entity.factor.FactorInstance """ ...
['def', 'get_instance', '(', 'self', ',', 'payload', ')', ':', 'return', 'FactorInstance', '(', 'self', '.', '_version', ',', 'payload', ',', 'service_sid', '=', 'self', '.', '_solution', '[', "'service_sid'", ']', ',', 'identity', '=', 'self', '.', '_solution', '[', "'identity'", ']', ',', ')']
Build an instance of FactorInstance :param dict payload: Payload response from the API :returns: twilio.rest.authy.v1.service.entity.factor.FactorInstance :rtype: twilio.rest.authy.v1.service.entity.factor.FactorInstance
['Build', 'an', 'instance', 'of', 'FactorInstance']
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/authy/v1/service/entity/factor/__init__.py#L211-L225
1,913
SpamScope/mail-parser
mailparser/utils.py
fingerprints
def fingerprints(data): """ This function return the fingerprints of data. Args: data (string): raw data Returns: namedtuple: fingerprints md5, sha1, sha256, sha512 """ Hashes = namedtuple('Hashes', "md5 sha1 sha256 sha512") if six.PY2: if not isinstance(data, str...
python
def fingerprints(data): """ This function return the fingerprints of data. Args: data (string): raw data Returns: namedtuple: fingerprints md5, sha1, sha256, sha512 """ Hashes = namedtuple('Hashes', "md5 sha1 sha256 sha512") if six.PY2: if not isinstance(data, str...
['def', 'fingerprints', '(', 'data', ')', ':', 'Hashes', '=', 'namedtuple', '(', "'Hashes'", ',', '"md5 sha1 sha256 sha512"', ')', 'if', 'six', '.', 'PY2', ':', 'if', 'not', 'isinstance', '(', 'data', ',', 'str', ')', ':', 'data', '=', 'data', '.', 'encode', '(', '"utf-8"', ')', 'elif', 'six', '.', 'PY3', ':', 'if', 'n...
This function return the fingerprints of data. Args: data (string): raw data Returns: namedtuple: fingerprints md5, sha1, sha256, sha512
['This', 'function', 'return', 'the', 'fingerprints', 'of', 'data', '.']
train
https://github.com/SpamScope/mail-parser/blob/814b56d0b803feab9dea04f054b802ce138097e2/mailparser/utils.py#L161-L201
1,914
edx/edx-val
edxval/models.py
ListField.get_prep_value
def get_prep_value(self, value): """ Converts a list to its json representation to store in database as text. """ if value and not isinstance(value, list): raise ValidationError(u'ListField value {} is not a list.'.format(value)) return json.dumps(self.validate_list(v...
python
def get_prep_value(self, value): """ Converts a list to its json representation to store in database as text. """ if value and not isinstance(value, list): raise ValidationError(u'ListField value {} is not a list.'.format(value)) return json.dumps(self.validate_list(v...
['def', 'get_prep_value', '(', 'self', ',', 'value', ')', ':', 'if', 'value', 'and', 'not', 'isinstance', '(', 'value', ',', 'list', ')', ':', 'raise', 'ValidationError', '(', "u'ListField value {} is not a list.'", '.', 'format', '(', 'value', ')', ')', 'return', 'json', '.', 'dumps', '(', 'self', '.', 'validate_list'...
Converts a list to its json representation to store in database as text.
['Converts', 'a', 'list', 'to', 'its', 'json', 'representation', 'to', 'store', 'in', 'database', 'as', 'text', '.']
train
https://github.com/edx/edx-val/blob/30df48061e77641edb5272895b7c7f7f25eb7aa7/edxval/models.py#L233-L239
1,915
PyHDI/Pyverilog
pyverilog/vparser/parser.py
VerilogParser.p_generate_named_block
def p_generate_named_block(self, p): 'generate_block : BEGIN COLON ID generate_items END' p[0] = Block(p[4], p[3], lineno=p.lineno(1)) p.set_lineno(0, p.lineno(1))
python
def p_generate_named_block(self, p): 'generate_block : BEGIN COLON ID generate_items END' p[0] = Block(p[4], p[3], lineno=p.lineno(1)) p.set_lineno(0, p.lineno(1))
['def', 'p_generate_named_block', '(', 'self', ',', 'p', ')', ':', 'p', '[', '0', ']', '=', 'Block', '(', 'p', '[', '4', ']', ',', 'p', '[', '3', ']', ',', 'lineno', '=', 'p', '.', 'lineno', '(', '1', ')', ')', 'p', '.', 'set_lineno', '(', '0', ',', 'p', '.', 'lineno', '(', '1', ')', ')']
generate_block : BEGIN COLON ID generate_items END
['generate_block', ':', 'BEGIN', 'COLON', 'ID', 'generate_items', 'END']
train
https://github.com/PyHDI/Pyverilog/blob/b852cc5ed6a7a2712e33639f9d9782d0d1587a53/pyverilog/vparser/parser.py#L1938-L1941
1,916
pypa/pipenv
pipenv/vendor/distlib/database.py
InstalledDistribution.exports
def exports(self): """ Return the information exported by this distribution. :return: A dictionary of exports, mapping an export category to a dict of :class:`ExportEntry` instances describing the individual export entries, and keyed by name. """ ...
python
def exports(self): """ Return the information exported by this distribution. :return: A dictionary of exports, mapping an export category to a dict of :class:`ExportEntry` instances describing the individual export entries, and keyed by name. """ ...
['def', 'exports', '(', 'self', ')', ':', 'result', '=', '{', '}', 'r', '=', 'self', '.', 'get_distinfo_resource', '(', 'EXPORTS_FILENAME', ')', 'if', 'r', ':', 'result', '=', 'self', '.', 'read_exports', '(', ')', 'return', 'result']
Return the information exported by this distribution. :return: A dictionary of exports, mapping an export category to a dict of :class:`ExportEntry` instances describing the individual export entries, and keyed by name.
['Return', 'the', 'information', 'exported', 'by', 'this', 'distribution', '.', ':', 'return', ':', 'A', 'dictionary', 'of', 'exports', 'mapping', 'an', 'export', 'category', 'to', 'a', 'dict', 'of', ':', 'class', ':', 'ExportEntry', 'instances', 'describing', 'the', 'individual', 'export', 'entries', 'and', 'keyed', '...
train
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L604-L615
1,917
TkTech/Jawa
jawa/attributes/code.py
CodeAttribute.disassemble
def disassemble(self, *, transforms=None) -> Iterator[Instruction]: """ Disassembles this method, yielding an iterable of :class:`~jawa.util.bytecode.Instruction` objects. """ if transforms is None: if self.cf.classloader: transforms = self.cf.classloa...
python
def disassemble(self, *, transforms=None) -> Iterator[Instruction]: """ Disassembles this method, yielding an iterable of :class:`~jawa.util.bytecode.Instruction` objects. """ if transforms is None: if self.cf.classloader: transforms = self.cf.classloa...
['def', 'disassemble', '(', 'self', ',', '*', ',', 'transforms', '=', 'None', ')', '->', 'Iterator', '[', 'Instruction', ']', ':', 'if', 'transforms', 'is', 'None', ':', 'if', 'self', '.', 'cf', '.', 'classloader', ':', 'transforms', '=', 'self', '.', 'cf', '.', 'classloader', '.', 'bytecode_transforms', 'else', ':', '...
Disassembles this method, yielding an iterable of :class:`~jawa.util.bytecode.Instruction` objects.
['Disassembles', 'this', 'method', 'yielding', 'an', 'iterable', 'of', ':', 'class', ':', '~jawa', '.', 'util', '.', 'bytecode', '.', 'Instruction', 'objects', '.']
train
https://github.com/TkTech/Jawa/blob/94c8424e699029ac33fbc0e866fff0ecb2742289/jawa/attributes/code.py#L123-L141
1,918
ejeschke/ginga
ginga/Bindings.py
BindingMapper.mode_key_up
def mode_key_up(self, viewer, keyname): """This method is called when a key is pressed in a mode and was not handled by some other handler with precedence, such as a subcanvas. """ # Is this a mode key? if keyname not in self.mode_map: # <== no ret...
python
def mode_key_up(self, viewer, keyname): """This method is called when a key is pressed in a mode and was not handled by some other handler with precedence, such as a subcanvas. """ # Is this a mode key? if keyname not in self.mode_map: # <== no ret...
['def', 'mode_key_up', '(', 'self', ',', 'viewer', ',', 'keyname', ')', ':', '# Is this a mode key?', 'if', 'keyname', 'not', 'in', 'self', '.', 'mode_map', ':', '# <== no', 'return', 'False', 'bnch', '=', 'self', '.', 'mode_map', '[', 'keyname', ']', 'if', 'self', '.', '_kbdmode', '==', 'bnch', '.', 'name', ':', '# <-...
This method is called when a key is pressed in a mode and was not handled by some other handler with precedence, such as a subcanvas.
['This', 'method', 'is', 'called', 'when', 'a', 'key', 'is', 'pressed', 'in', 'a', 'mode', 'and', 'was', 'not', 'handled', 'by', 'some', 'other', 'handler', 'with', 'precedence', 'such', 'as', 'a', 'subcanvas', '.']
train
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/Bindings.py#L2706-L2727
1,919
roaet/eh
eh/mdv/tabulate.py
_main
def _main(): """\ Usage: tabulate [options] [FILE ...] Pretty-print tabular data. See also https://bitbucket.org/astanin/python-tabulate FILE a filename of the file with tabular data; if "-" or missing, read data from stdin. Options: -h,...
python
def _main(): """\ Usage: tabulate [options] [FILE ...] Pretty-print tabular data. See also https://bitbucket.org/astanin/python-tabulate FILE a filename of the file with tabular data; if "-" or missing, read data from stdin. Options: -h,...
['def', '_main', '(', ')', ':', 'import', 'getopt', 'import', 'sys', 'import', 'textwrap', 'usage', '=', 'textwrap', '.', 'dedent', '(', '_main', '.', '__doc__', ')', 'try', ':', 'opts', ',', 'args', '=', 'getopt', '.', 'getopt', '(', 'sys', '.', 'argv', '[', '1', ':', ']', ',', '"h1o:s:F:f:"', ',', '[', '"help"', ',',...
\ Usage: tabulate [options] [FILE ...] Pretty-print tabular data. See also https://bitbucket.org/astanin/python-tabulate FILE a filename of the file with tabular data; if "-" or missing, read data from stdin. Options: -h, --help ...
['\\', 'Usage', ':', 'tabulate', '[', 'options', ']', '[', 'FILE', '...', ']']
train
https://github.com/roaet/eh/blob/9370864a9f1d65bb0f822d0aea83f1169c98f3bd/eh/mdv/tabulate.py#L1056-L1124
1,920
blockstack/virtualchain
virtualchain/lib/indexer.py
get_index_range
def get_index_range(blockchain_name, blockchain_client, impl, working_dir): """ Get the range of block numbers that we need to fetch from the blockchain. Requires virtualchain to have been configured with setup_virtualchain() if impl=None Return None, None if we fail to connect to the blockchain ...
python
def get_index_range(blockchain_name, blockchain_client, impl, working_dir): """ Get the range of block numbers that we need to fetch from the blockchain. Requires virtualchain to have been configured with setup_virtualchain() if impl=None Return None, None if we fail to connect to the blockchain ...
['def', 'get_index_range', '(', 'blockchain_name', ',', 'blockchain_client', ',', 'impl', ',', 'working_dir', ')', ':', 'start_block', '=', 'config', '.', 'get_first_block_id', '(', 'impl', ')', 'try', ':', 'current_block', '=', 'get_blockchain_height', '(', 'blockchain_name', ',', 'blockchain_client', ')', 'except', '...
Get the range of block numbers that we need to fetch from the blockchain. Requires virtualchain to have been configured with setup_virtualchain() if impl=None Return None, None if we fail to connect to the blockchain
['Get', 'the', 'range', 'of', 'block', 'numbers', 'that', 'we', 'need', 'to', 'fetch', 'from', 'the', 'blockchain', '.', 'Requires', 'virtualchain', 'to', 'have', 'been', 'configured', 'with', 'setup_virtualchain', '()', 'if', 'impl', '=', 'None', 'Return', 'None', 'None', 'if', 'we', 'fail', 'to', 'connect', 'to', 'th...
train
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L1617-L1641
1,921
google/prettytensor
prettytensor/recurrent_networks.py
RecurrentRunner.run
def run(self, fetch_list, feed_dict=None, sess=None): """Runs the graph with the provided feeds and fetches. This function wraps sess.Run(), but takes care of state saving and restoring by feeding in states and storing the new state values. Args: fetch_list: A list of requested output tensors. ...
python
def run(self, fetch_list, feed_dict=None, sess=None): """Runs the graph with the provided feeds and fetches. This function wraps sess.Run(), but takes care of state saving and restoring by feeding in states and storing the new state values. Args: fetch_list: A list of requested output tensors. ...
['def', 'run', '(', 'self', ',', 'fetch_list', ',', 'feed_dict', '=', 'None', ',', 'sess', '=', 'None', ')', ':', 'if', 'tf', '.', 'get_default_graph', '(', ')', '!=', 'self', '.', '_graph', ':', 'raise', 'ValueError', '(', "'The current default graph is different from the graph'", "' used at construction time of Recur...
Runs the graph with the provided feeds and fetches. This function wraps sess.Run(), but takes care of state saving and restoring by feeding in states and storing the new state values. Args: fetch_list: A list of requested output tensors. feed_dict: A dictionary of feeds - see Session.Run(). Opt...
['Runs', 'the', 'graph', 'with', 'the', 'provided', 'feeds', 'and', 'fetches', '.']
train
https://github.com/google/prettytensor/blob/75daa0b11252590f548da5647addc0ea610c4c45/prettytensor/recurrent_networks.py#L599-L634
1,922
tensorflow/tensor2tensor
tensor2tensor/models/revnet.py
revnet_cifar_base
def revnet_cifar_base(): """Tiny hparams suitable for CIFAR/etc.""" hparams = revnet_base() hparams.num_channels_init_block = 32 hparams.first_batch_norm = [False, True, True] hparams.init_stride = 1 hparams.init_kernel_size = 3 hparams.init_maxpool = False hparams.strides = [1, 2, 2] hparams.batch_si...
python
def revnet_cifar_base(): """Tiny hparams suitable for CIFAR/etc.""" hparams = revnet_base() hparams.num_channels_init_block = 32 hparams.first_batch_norm = [False, True, True] hparams.init_stride = 1 hparams.init_kernel_size = 3 hparams.init_maxpool = False hparams.strides = [1, 2, 2] hparams.batch_si...
['def', 'revnet_cifar_base', '(', ')', ':', 'hparams', '=', 'revnet_base', '(', ')', 'hparams', '.', 'num_channels_init_block', '=', '32', 'hparams', '.', 'first_batch_norm', '=', '[', 'False', ',', 'True', ',', 'True', ']', 'hparams', '.', 'init_stride', '=', '1', 'hparams', '.', 'init_kernel_size', '=', '3', 'hparams...
Tiny hparams suitable for CIFAR/etc.
['Tiny', 'hparams', 'suitable', 'for', 'CIFAR', '/', 'etc', '.']
train
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/revnet.py#L386-L400
1,923
openid/python-openid
openid/oidutil.py
importElementTree
def importElementTree(module_names=None): """Find a working ElementTree implementation, trying the standard places that such a thing might show up. >>> ElementTree = importElementTree() @param module_names: The names of modules to try to use as ElementTree. Defaults to C{L{elementtree_modules}...
python
def importElementTree(module_names=None): """Find a working ElementTree implementation, trying the standard places that such a thing might show up. >>> ElementTree = importElementTree() @param module_names: The names of modules to try to use as ElementTree. Defaults to C{L{elementtree_modules}...
['def', 'importElementTree', '(', 'module_names', '=', 'None', ')', ':', 'if', 'module_names', 'is', 'None', ':', 'module_names', '=', 'elementtree_modules', 'for', 'mod_name', 'in', 'module_names', ':', 'try', ':', 'ElementTree', '=', '__import__', '(', 'mod_name', ',', 'None', ',', 'None', ',', '[', "'unused'", ']', ...
Find a working ElementTree implementation, trying the standard places that such a thing might show up. >>> ElementTree = importElementTree() @param module_names: The names of modules to try to use as ElementTree. Defaults to C{L{elementtree_modules}} @returns: An ElementTree module
['Find', 'a', 'working', 'ElementTree', 'implementation', 'trying', 'the', 'standard', 'places', 'that', 'such', 'a', 'thing', 'might', 'show', 'up', '.']
train
https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/oidutil.py#L55-L89
1,924
antiboredom/videogrep
videogrep/tools/getyoutubecc.py
getyoutubecc._parseXml
def _parseXml(self,cc): """ INPUT: XML file with captions OUTPUT: parsed object like: [{'texlines': [u"So, I'm going to rewrite this", 'in a more concise form as'], 'time': {'hours':'1', 'min':'2','sec':44,'msec':232} }] """ htmlpar = HTMLParser.HTMLPa...
python
def _parseXml(self,cc): """ INPUT: XML file with captions OUTPUT: parsed object like: [{'texlines': [u"So, I'm going to rewrite this", 'in a more concise form as'], 'time': {'hours':'1', 'min':'2','sec':44,'msec':232} }] """ htmlpar = HTMLParser.HTMLPa...
['def', '_parseXml', '(', 'self', ',', 'cc', ')', ':', 'htmlpar', '=', 'HTMLParser', '.', 'HTMLParser', '(', ')', 'cc', '=', 'cc', '.', 'split', '(', '"</text>"', ')', '# [\'<text start="2997.929">So, it will\\nhas time\', \'<text start="3000.929">blah\', ..]', 'captions', '=', '[', ']', 'for', 'line', 'in', 'cc', ':',...
INPUT: XML file with captions OUTPUT: parsed object like: [{'texlines': [u"So, I'm going to rewrite this", 'in a more concise form as'], 'time': {'hours':'1', 'min':'2','sec':44,'msec':232} }]
['INPUT', ':', 'XML', 'file', 'with', 'captions', 'OUTPUT', ':', 'parsed', 'object', 'like', ':', '[', '{', 'texlines', ':', '[', 'u', 'So', 'I', 'm', 'going', 'to', 'rewrite', 'this', 'in', 'a', 'more', 'concise', 'form', 'as', ']', 'time', ':', '{', 'hours', ':', '1', 'min', ':', '2', 'sec', ':', '44', 'msec', ':', '...
train
https://github.com/antiboredom/videogrep/blob/faffd3446d96242677757f1af7db23b6dfc429cf/videogrep/tools/getyoutubecc.py#L57-L76
1,925
pescadores/pescador
pescador/maps.py
keras_tuples
def keras_tuples(stream, inputs=None, outputs=None): """Reformat data objects as keras-compatible tuples. For more detail: https://keras.io/models/model/#fit Parameters ---------- stream : iterable Stream of data objects. inputs : string or iterable of strings, None Keys to us...
python
def keras_tuples(stream, inputs=None, outputs=None): """Reformat data objects as keras-compatible tuples. For more detail: https://keras.io/models/model/#fit Parameters ---------- stream : iterable Stream of data objects. inputs : string or iterable of strings, None Keys to us...
['def', 'keras_tuples', '(', 'stream', ',', 'inputs', '=', 'None', ',', 'outputs', '=', 'None', ')', ':', 'flatten_inputs', ',', 'flatten_outputs', '=', 'False', ',', 'False', 'if', 'inputs', 'and', 'isinstance', '(', 'inputs', ',', 'six', '.', 'string_types', ')', ':', 'inputs', '=', '[', 'inputs', ']', 'flatten_input...
Reformat data objects as keras-compatible tuples. For more detail: https://keras.io/models/model/#fit Parameters ---------- stream : iterable Stream of data objects. inputs : string or iterable of strings, None Keys to use for ordered input data. If not specified, returns ...
['Reformat', 'data', 'objects', 'as', 'keras', '-', 'compatible', 'tuples', '.']
train
https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/maps.py#L120-L179
1,926
hovren/crisp
crisp/calibration.py
AutoCalibrator.calibrate
def calibrate(self, max_tracks=MAX_OPTIMIZATION_TRACKS, max_eval=MAX_OPTIMIZATION_FEV, norm_c=DEFAULT_NORM_C): """Perform calibration Parameters ---------------------- max_eval : int Maximum number of function evaluations Returns --------------------- ...
python
def calibrate(self, max_tracks=MAX_OPTIMIZATION_TRACKS, max_eval=MAX_OPTIMIZATION_FEV, norm_c=DEFAULT_NORM_C): """Perform calibration Parameters ---------------------- max_eval : int Maximum number of function evaluations Returns --------------------- ...
['def', 'calibrate', '(', 'self', ',', 'max_tracks', '=', 'MAX_OPTIMIZATION_TRACKS', ',', 'max_eval', '=', 'MAX_OPTIMIZATION_FEV', ',', 'norm_c', '=', 'DEFAULT_NORM_C', ')', ':', 'x0', '=', 'np', '.', 'array', '(', '[', 'self', '.', 'parameter', '[', 'param', ']', 'for', 'param', 'in', 'PARAM_ORDER', ']', ')', 'availab...
Perform calibration Parameters ---------------------- max_eval : int Maximum number of function evaluations Returns --------------------- dict Optimization result Raises ----------------------- CalibrationError ...
['Perform', 'calibration']
train
https://github.com/hovren/crisp/blob/65cae19e7cfae5a397859096c9ef666e0f4e7f1b/crisp/calibration.py#L167-L209
1,927
saltstack/salt
salt/modules/smf_service.py
start
def start(name): ''' Start the specified service CLI Example: .. code-block:: bash salt '*' service.start <service name> ''' cmd = '/usr/sbin/svcadm enable -s -t {0}'.format(name) retcode = __salt__['cmd.retcode'](cmd, python_shell=False) if not retcode: return True ...
python
def start(name): ''' Start the specified service CLI Example: .. code-block:: bash salt '*' service.start <service name> ''' cmd = '/usr/sbin/svcadm enable -s -t {0}'.format(name) retcode = __salt__['cmd.retcode'](cmd, python_shell=False) if not retcode: return True ...
['def', 'start', '(', 'name', ')', ':', 'cmd', '=', "'/usr/sbin/svcadm enable -s -t {0}'", '.', 'format', '(', 'name', ')', 'retcode', '=', '__salt__', '[', "'cmd.retcode'", ']', '(', 'cmd', ',', 'python_shell', '=', 'False', ')', 'if', 'not', 'retcode', ':', 'return', 'True', 'if', 'retcode', '==', '3', ':', '# Return...
Start the specified service CLI Example: .. code-block:: bash salt '*' service.start <service name>
['Start', 'the', 'specified', 'service']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smf_service.py#L155-L176
1,928
bsolomon1124/pyfinance
pyfinance/returns.py
TSeries.drawdown_end
def drawdown_end(self, return_date=False): """The date of the drawdown trough. Date at which the drawdown was most negative. Parameters ---------- return_date : bool, default False If True, return a `datetime.date` object. If False, return a Pandas Times...
python
def drawdown_end(self, return_date=False): """The date of the drawdown trough. Date at which the drawdown was most negative. Parameters ---------- return_date : bool, default False If True, return a `datetime.date` object. If False, return a Pandas Times...
['def', 'drawdown_end', '(', 'self', ',', 'return_date', '=', 'False', ')', ':', 'end', '=', 'self', '.', 'drawdown_idx', '(', ')', '.', 'idxmin', '(', ')', 'if', 'return_date', ':', 'return', 'end', '.', 'date', '(', ')', 'return', 'end']
The date of the drawdown trough. Date at which the drawdown was most negative. Parameters ---------- return_date : bool, default False If True, return a `datetime.date` object. If False, return a Pandas Timestamp object. Returns ------- ...
['The', 'date', 'of', 'the', 'drawdown', 'trough', '.']
train
https://github.com/bsolomon1124/pyfinance/blob/c95925209a809b4e648e79cbeaf7711d8e5ff1a6/pyfinance/returns.py#L396-L415
1,929
jmbhughes/suvi-trainer
suvitrainer/gui.py
App.onclick
def onclick(self, event): """ Draw contours on the data for a click in the thematic map :param event: mouse click on thematic map preview """ if event.inaxes == self.previewax: y, x = int(event.xdata), int(event.ydata) label = self.selection_array[x, y] ...
python
def onclick(self, event): """ Draw contours on the data for a click in the thematic map :param event: mouse click on thematic map preview """ if event.inaxes == self.previewax: y, x = int(event.xdata), int(event.ydata) label = self.selection_array[x, y] ...
['def', 'onclick', '(', 'self', ',', 'event', ')', ':', 'if', 'event', '.', 'inaxes', '==', 'self', '.', 'previewax', ':', 'y', ',', 'x', '=', 'int', '(', 'event', '.', 'xdata', ')', ',', 'int', '(', 'event', '.', 'ydata', ')', 'label', '=', 'self', '.', 'selection_array', '[', 'x', ',', 'y', ']', 'contiguous_regions',...
Draw contours on the data for a click in the thematic map :param event: mouse click on thematic map preview
['Draw', 'contours', 'on', 'the', 'data', 'for', 'a', 'click', 'in', 'the', 'thematic', 'map', ':', 'param', 'event', ':', 'mouse', 'click', 'on', 'thematic', 'map', 'preview']
train
https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/suvitrainer/gui.py#L378-L445
1,930
delph-in/pydelphin
delphin/interfaces/ace.py
parse_from_iterable
def parse_from_iterable(grm, data, **kwargs): """ Parse each sentence in *data* with ACE using grammar *grm*. Args: grm (str): path to a compiled grammar image data (iterable): the sentences to parse **kwargs: additional keyword arguments to pass to the AceParser Yields: ...
python
def parse_from_iterable(grm, data, **kwargs): """ Parse each sentence in *data* with ACE using grammar *grm*. Args: grm (str): path to a compiled grammar image data (iterable): the sentences to parse **kwargs: additional keyword arguments to pass to the AceParser Yields: ...
['def', 'parse_from_iterable', '(', 'grm', ',', 'data', ',', '*', '*', 'kwargs', ')', ':', 'with', 'AceParser', '(', 'grm', ',', '*', '*', 'kwargs', ')', 'as', 'parser', ':', 'for', 'datum', 'in', 'data', ':', 'yield', 'parser', '.', 'interact', '(', 'datum', ')']
Parse each sentence in *data* with ACE using grammar *grm*. Args: grm (str): path to a compiled grammar image data (iterable): the sentences to parse **kwargs: additional keyword arguments to pass to the AceParser Yields: :class:`~delphin.interfaces.ParseResponse` Example: ...
['Parse', 'each', 'sentence', 'in', '*', 'data', '*', 'with', 'ACE', 'using', 'grammar', '*', 'grm', '*', '.']
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/interfaces/ace.py#L468-L485
1,931
grycap/RADL
radl/radl_parse.py
RADLParser.p_feature_contains
def p_feature_contains(self, t): """feature_contains : VAR CONTAINS LPAREN features RPAREN""" t[0] = Feature(t[1], t[2], Features(t[4]), line=t.lineno(1))
python
def p_feature_contains(self, t): """feature_contains : VAR CONTAINS LPAREN features RPAREN""" t[0] = Feature(t[1], t[2], Features(t[4]), line=t.lineno(1))
['def', 'p_feature_contains', '(', 'self', ',', 't', ')', ':', 't', '[', '0', ']', '=', 'Feature', '(', 't', '[', '1', ']', ',', 't', '[', '2', ']', ',', 'Features', '(', 't', '[', '4', ']', ')', ',', 'line', '=', 't', '.', 'lineno', '(', '1', ')', ')']
feature_contains : VAR CONTAINS LPAREN features RPAREN
['feature_contains', ':', 'VAR', 'CONTAINS', 'LPAREN', 'features', 'RPAREN']
train
https://github.com/grycap/RADL/blob/03ccabb0313a48a5aa0e20c1f7983fddcb95e9cb/radl/radl_parse.py#L335-L338
1,932
ryanvarley/ExoData
exodata/database.py
OECDatabase.transitingPlanets
def transitingPlanets(self): """ Returns a list of transiting planet objects """ transitingPlanets = [] for planet in self.planets: try: if planet.isTransiting: transitingPlanets.append(planet) except KeyError: # No 'discover...
python
def transitingPlanets(self): """ Returns a list of transiting planet objects """ transitingPlanets = [] for planet in self.planets: try: if planet.isTransiting: transitingPlanets.append(planet) except KeyError: # No 'discover...
['def', 'transitingPlanets', '(', 'self', ')', ':', 'transitingPlanets', '=', '[', ']', 'for', 'planet', 'in', 'self', '.', 'planets', ':', 'try', ':', 'if', 'planet', '.', 'isTransiting', ':', 'transitingPlanets', '.', 'append', '(', 'planet', ')', 'except', 'KeyError', ':', "# No 'discoverymethod' tag - this also fil...
Returns a list of transiting planet objects
['Returns', 'a', 'list', 'of', 'transiting', 'planet', 'objects']
train
https://github.com/ryanvarley/ExoData/blob/e0d3652117214d2377a707d6778f93b7eb201a41/exodata/database.py#L68-L81
1,933
DistrictDataLabs/yellowbrick
yellowbrick/cluster/icdm.py
InterclusterDistance.draw
def draw(self): """ Draw the embedded centers with their sizes on the visualization. """ # Compute the sizes of the markers from their score sizes = self._get_cluster_sizes() # Draw the scatter plots with associated sizes on the graph self.ax.scatter( ...
python
def draw(self): """ Draw the embedded centers with their sizes on the visualization. """ # Compute the sizes of the markers from their score sizes = self._get_cluster_sizes() # Draw the scatter plots with associated sizes on the graph self.ax.scatter( ...
['def', 'draw', '(', 'self', ')', ':', '# Compute the sizes of the markers from their score', 'sizes', '=', 'self', '.', '_get_cluster_sizes', '(', ')', '# Draw the scatter plots with associated sizes on the graph', 'self', '.', 'ax', '.', 'scatter', '(', 'self', '.', 'embedded_centers_', '[', ':', ',', '0', ']', ',', ...
Draw the embedded centers with their sizes on the visualization.
['Draw', 'the', 'embedded', 'centers', 'with', 'their', 'sizes', 'on', 'the', 'visualization', '.']
train
https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/cluster/icdm.py#L270-L291
1,934
bunq/sdk_python
bunq/sdk/json/adapters.py
ShareDetailAdapter.serialize
def serialize(cls, share_detail): """ :type share_detail: object_.ShareDetail :rtype: dict """ return { cls._FIELD_PAYMENT: converter.serialize( share_detail._payment_field_for_request), cls._FIELD_READ_ONLY: converter.serialize( ...
python
def serialize(cls, share_detail): """ :type share_detail: object_.ShareDetail :rtype: dict """ return { cls._FIELD_PAYMENT: converter.serialize( share_detail._payment_field_for_request), cls._FIELD_READ_ONLY: converter.serialize( ...
['def', 'serialize', '(', 'cls', ',', 'share_detail', ')', ':', 'return', '{', 'cls', '.', '_FIELD_PAYMENT', ':', 'converter', '.', 'serialize', '(', 'share_detail', '.', '_payment_field_for_request', ')', ',', 'cls', '.', '_FIELD_READ_ONLY', ':', 'converter', '.', 'serialize', '(', 'share_detail', '.', '_read_only_fie...
:type share_detail: object_.ShareDetail :rtype: dict
[':', 'type', 'share_detail', ':', 'object_', '.', 'ShareDetail']
train
https://github.com/bunq/sdk_python/blob/da6c9b83e6d83ee8062617f53c6eb7293c0d863d/bunq/sdk/json/adapters.py#L501-L516
1,935
aio-libs/yarl
yarl/__init__.py
URL.port
def port(self): """Port part of URL, with scheme-based fallback. None for relative URLs or URLs without explicit port and scheme without default port substitution. """ return self._val.port or DEFAULT_PORTS.get(self._val.scheme)
python
def port(self): """Port part of URL, with scheme-based fallback. None for relative URLs or URLs without explicit port and scheme without default port substitution. """ return self._val.port or DEFAULT_PORTS.get(self._val.scheme)
['def', 'port', '(', 'self', ')', ':', 'return', 'self', '.', '_val', '.', 'port', 'or', 'DEFAULT_PORTS', '.', 'get', '(', 'self', '.', '_val', '.', 'scheme', ')']
Port part of URL, with scheme-based fallback. None for relative URLs or URLs without explicit port and scheme without default port substitution.
['Port', 'part', 'of', 'URL', 'with', 'scheme', '-', 'based', 'fallback', '.']
train
https://github.com/aio-libs/yarl/blob/e47da02c00ad764e030ca7647a9565548c97d362/yarl/__init__.py#L456-L463
1,936
pypa/setuptools
setuptools/msvc.py
EnvironmentInfo._build_paths
def _build_paths(self, name, spec_path_lists, exists): """ Given an environment variable name and specified paths, return a pathsep-separated string of paths containing unique, extant, directories from those paths and from the environment variable. Raise an error if no paths ...
python
def _build_paths(self, name, spec_path_lists, exists): """ Given an environment variable name and specified paths, return a pathsep-separated string of paths containing unique, extant, directories from those paths and from the environment variable. Raise an error if no paths ...
['def', '_build_paths', '(', 'self', ',', 'name', ',', 'spec_path_lists', ',', 'exists', ')', ':', '# flatten spec_path_lists', 'spec_paths', '=', 'itertools', '.', 'chain', '.', 'from_iterable', '(', 'spec_path_lists', ')', 'env_paths', '=', 'safe_env', '.', 'get', '(', 'name', ',', "''", ')', '.', 'split', '(', 'os',...
Given an environment variable name and specified paths, return a pathsep-separated string of paths containing unique, extant, directories from those paths and from the environment variable. Raise an error if no paths are resolved.
['Given', 'an', 'environment', 'variable', 'name', 'and', 'specified', 'paths', 'return', 'a', 'pathsep', '-', 'separated', 'string', 'of', 'paths', 'containing', 'unique', 'extant', 'directories', 'from', 'those', 'paths', 'and', 'from', 'the', 'environment', 'variable', '.', 'Raise', 'an', 'error', 'if', 'no', 'paths...
train
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/msvc.py#L1261-L1278
1,937
smdabdoub/phylotoast
bin/diversity.py
print_KruskalWallisH
def print_KruskalWallisH(div_calc): """ Compute the Kruskal-Wallis H-test for independent samples. A typical rule is that each group must have at least 5 measurements. """ calc = defaultdict(list) try: for k1, v1 in div_calc.iteritems(): for k2, v2 in v1.iteritems(): ...
python
def print_KruskalWallisH(div_calc): """ Compute the Kruskal-Wallis H-test for independent samples. A typical rule is that each group must have at least 5 measurements. """ calc = defaultdict(list) try: for k1, v1 in div_calc.iteritems(): for k2, v2 in v1.iteritems(): ...
['def', 'print_KruskalWallisH', '(', 'div_calc', ')', ':', 'calc', '=', 'defaultdict', '(', 'list', ')', 'try', ':', 'for', 'k1', ',', 'v1', 'in', 'div_calc', '.', 'iteritems', '(', ')', ':', 'for', 'k2', ',', 'v2', 'in', 'v1', '.', 'iteritems', '(', ')', ':', 'calc', '[', 'k1', ']', '.', 'append', '(', 'v2', ')', 'exc...
Compute the Kruskal-Wallis H-test for independent samples. A typical rule is that each group must have at least 5 measurements.
['Compute', 'the', 'Kruskal', '-', 'Wallis', 'H', '-', 'test', 'for', 'independent', 'samples', '.', 'A', 'typical', 'rule', 'is', 'that', 'each', 'group', 'must', 'have', 'at', 'least', '5', 'measurements', '.']
train
https://github.com/smdabdoub/phylotoast/blob/0b74ef171e6a84761710548501dfac71285a58a3/bin/diversity.py#L69-L84
1,938
Rapptz/discord.py
discord/message.py
Message.raw_channel_mentions
def raw_channel_mentions(self): """A property that returns an array of channel IDs matched with the syntax of <#channel_id> in the message content. """ return [int(x) for x in re.findall(r'<#([0-9]+)>', self.content)]
python
def raw_channel_mentions(self): """A property that returns an array of channel IDs matched with the syntax of <#channel_id> in the message content. """ return [int(x) for x in re.findall(r'<#([0-9]+)>', self.content)]
['def', 'raw_channel_mentions', '(', 'self', ')', ':', 'return', '[', 'int', '(', 'x', ')', 'for', 'x', 'in', 're', '.', 'findall', '(', "r'<#([0-9]+)>'", ',', 'self', '.', 'content', ')', ']']
A property that returns an array of channel IDs matched with the syntax of <#channel_id> in the message content.
['A', 'property', 'that', 'returns', 'an', 'array', 'of', 'channel', 'IDs', 'matched', 'with', 'the', 'syntax', 'of', '<#channel_id', '>', 'in', 'the', 'message', 'content', '.']
train
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L380-L384
1,939
BD2KOnFHIR/fhirtordf
fhirtordf/fhir/fhirmetavoc.py
FHIRMetaVocEntry._to_str
def _to_str(uri: URIRef) -> str: """ Convert a FHIR style URI into a tag name to be used to retrieve data from a JSON representation Example: http://hl7.org/fhir/Provenance.agent.whoReference --> whoReference :param uri: URI to convert :return: tag name """ local_...
python
def _to_str(uri: URIRef) -> str: """ Convert a FHIR style URI into a tag name to be used to retrieve data from a JSON representation Example: http://hl7.org/fhir/Provenance.agent.whoReference --> whoReference :param uri: URI to convert :return: tag name """ local_...
['def', '_to_str', '(', 'uri', ':', 'URIRef', ')', '->', 'str', ':', 'local_name', '=', 'str', '(', 'uri', ')', '.', 'replace', '(', 'str', '(', 'FHIR', ')', ',', "''", ')', 'return', 'local_name', '.', 'rsplit', '(', "'.'", ',', '1', ')', '[', '1', ']', 'if', "'.'", 'in', 'local_name', 'else', 'local_name']
Convert a FHIR style URI into a tag name to be used to retrieve data from a JSON representation Example: http://hl7.org/fhir/Provenance.agent.whoReference --> whoReference :param uri: URI to convert :return: tag name
['Convert', 'a', 'FHIR', 'style', 'URI', 'into', 'a', 'tag', 'name', 'to', 'be', 'used', 'to', 'retrieve', 'data', 'from', 'a', 'JSON', 'representation', 'Example', ':', 'http', ':', '//', 'hl7', '.', 'org', '/', 'fhir', '/', 'Provenance', '.', 'agent', '.', 'whoReference', '--', '>', 'whoReference', ':', 'param', 'uri...
train
https://github.com/BD2KOnFHIR/fhirtordf/blob/f97b3df683fa4caacf5cf4f29699ab060bcc0fbf/fhirtordf/fhir/fhirmetavoc.py#L60-L68
1,940
log2timeline/dfvfs
dfvfs/file_io/vshadow_file_io.py
VShadowFile.read
def read(self, size=None): """Reads a byte string from the file-like object at the current offset. The function will read a byte string of the specified size or all of the remaining data if no size was specified. Args: size (Optional[int]): number of bytes to read, where None is all re...
python
def read(self, size=None): """Reads a byte string from the file-like object at the current offset. The function will read a byte string of the specified size or all of the remaining data if no size was specified. Args: size (Optional[int]): number of bytes to read, where None is all re...
['def', 'read', '(', 'self', ',', 'size', '=', 'None', ')', ':', 'if', 'not', 'self', '.', '_is_open', ':', 'raise', 'IOError', '(', "'Not opened.'", ')', 'return', 'self', '.', '_vshadow_store', '.', 'read', '(', 'size', ')']
Reads a byte string from the file-like object at the current offset. The function will read a byte string of the specified size or all of the remaining data if no size was specified. Args: size (Optional[int]): number of bytes to read, where None is all remaining data. Returns: ...
['Reads', 'a', 'byte', 'string', 'from', 'the', 'file', '-', 'like', 'object', 'at', 'the', 'current', 'offset', '.']
train
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/file_io/vshadow_file_io.py#L78-L98
1,941
undertherain/pycontextfree
setup_boilerplate.py
parse_requirements
def parse_requirements( requirements_path: str = 'requirements.txt') -> t.List[str]: """Read contents of requirements.txt file and return data from its relevant lines. Only non-empty and non-comment lines are relevant. """ requirements = [] with HERE.joinpath(requirements_path).open() as re...
python
def parse_requirements( requirements_path: str = 'requirements.txt') -> t.List[str]: """Read contents of requirements.txt file and return data from its relevant lines. Only non-empty and non-comment lines are relevant. """ requirements = [] with HERE.joinpath(requirements_path).open() as re...
['def', 'parse_requirements', '(', 'requirements_path', ':', 'str', '=', "'requirements.txt'", ')', '->', 't', '.', 'List', '[', 'str', ']', ':', 'requirements', '=', '[', ']', 'with', 'HERE', '.', 'joinpath', '(', 'requirements_path', ')', '.', 'open', '(', ')', 'as', 'reqs_file', ':', 'for', 'requirement', 'in', '[',...
Read contents of requirements.txt file and return data from its relevant lines. Only non-empty and non-comment lines are relevant.
['Read', 'contents', 'of', 'requirements', '.', 'txt', 'file', 'and', 'return', 'data', 'from', 'its', 'relevant', 'lines', '.']
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/setup_boilerplate.py#L66-L78
1,942
tensorflow/tensor2tensor
tensor2tensor/models/image_transformer_2d.py
img2img_transformer2d_n31
def img2img_transformer2d_n31(): """Set of hyperparameters.""" hparams = img2img_transformer2d_base() hparams.batch_size = 1 hparams.num_encoder_layers = 6 hparams.num_decoder_layers = 12 hparams.num_heads = 8 hparams.query_shape = (16, 32) hparams.memory_flange = (16, 32) return hparams
python
def img2img_transformer2d_n31(): """Set of hyperparameters.""" hparams = img2img_transformer2d_base() hparams.batch_size = 1 hparams.num_encoder_layers = 6 hparams.num_decoder_layers = 12 hparams.num_heads = 8 hparams.query_shape = (16, 32) hparams.memory_flange = (16, 32) return hparams
['def', 'img2img_transformer2d_n31', '(', ')', ':', 'hparams', '=', 'img2img_transformer2d_base', '(', ')', 'hparams', '.', 'batch_size', '=', '1', 'hparams', '.', 'num_encoder_layers', '=', '6', 'hparams', '.', 'num_decoder_layers', '=', '12', 'hparams', '.', 'num_heads', '=', '8', 'hparams', '.', 'query_shape', '=', ...
Set of hyperparameters.
['Set', 'of', 'hyperparameters', '.']
train
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/image_transformer_2d.py#L829-L838
1,943
thespacedoctor/tastic
tastic/tastic.py
baseClass.to_string
def to_string( self, indentLevel=1, title=True, tags=None, projects=None, tasks=None, notes=None): """*convert this taskpaper object to a string* **Key Arguments:** - ``indentLevel`` -- the level of the inde...
python
def to_string( self, indentLevel=1, title=True, tags=None, projects=None, tasks=None, notes=None): """*convert this taskpaper object to a string* **Key Arguments:** - ``indentLevel`` -- the level of the inde...
['def', 'to_string', '(', 'self', ',', 'indentLevel', '=', '1', ',', 'title', '=', 'True', ',', 'tags', '=', 'None', ',', 'projects', '=', 'None', ',', 'tasks', '=', 'None', ',', 'notes', '=', 'None', ')', ':', 'indent', '=', 'indentLevel', '*', '"\\t"', 'objectString', '=', '""', 'if', 'title', ':', 'try', ':', '# NON...
*convert this taskpaper object to a string* **Key Arguments:** - ``indentLevel`` -- the level of the indent for this object. Default *1*. - ``title`` -- print the title of the taskpaper object alongside the contents. Default *True* - ``tags`` -- replace tags with these tags....
['*', 'convert', 'this', 'taskpaper', 'object', 'to', 'a', 'string', '*']
train
https://github.com/thespacedoctor/tastic/blob/a0a16cf329a50057906ac3f696bb60b6fcee25e0/tastic/tastic.py#L315-L406
1,944
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_validate_data
def _validate_data(dataset, target, features=None, validation_set='auto'): """ Validate and canonicalize training and validation data. Parameters ---------- dataset : SFrame Dataset for training the model. target : string Name of the column containing the target variable. ...
python
def _validate_data(dataset, target, features=None, validation_set='auto'): """ Validate and canonicalize training and validation data. Parameters ---------- dataset : SFrame Dataset for training the model. target : string Name of the column containing the target variable. ...
['def', '_validate_data', '(', 'dataset', ',', 'target', ',', 'features', '=', 'None', ',', 'validation_set', '=', "'auto'", ')', ':', '_raise_error_if_not_sframe', '(', 'dataset', ',', '"training dataset"', ')', '# Determine columns to keep', 'if', 'features', 'is', 'None', ':', 'features', '=', '[', 'feat', 'for', 'f...
Validate and canonicalize training and validation data. Parameters ---------- dataset : SFrame Dataset for training the model. target : string Name of the column containing the target variable. features : list[string], optional List of feature names used. validation_s...
['Validate', 'and', 'canonicalize', 'training', 'and', 'validation', 'data', '.']
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L563-L625
1,945
datadotworld/data.world-py
datadotworld/client/_swagger/apis/insights_api.py
InsightsApi.get_insights_for_project
def get_insights_for_project(self, project_owner, project_id, **kwargs): """ Get insights for project. Get insights for a project. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invo...
python
def get_insights_for_project(self, project_owner, project_id, **kwargs): """ Get insights for project. Get insights for a project. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invo...
['def', 'get_insights_for_project', '(', 'self', ',', 'project_owner', ',', 'project_id', ',', '*', '*', 'kwargs', ')', ':', 'kwargs', '[', "'_return_http_data_only'", ']', '=', 'True', 'if', 'kwargs', '.', 'get', '(', "'callback'", ')', ':', 'return', 'self', '.', 'get_insights_for_project_with_http_info', '(', 'proje...
Get insights for project. Get insights for a project. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> ...
['Get', 'insights', 'for', 'project', '.', 'Get', 'insights', 'for', 'a', 'project', '.', 'This', 'method', 'makes', 'a', 'synchronous', 'HTTP', 'request', 'by', 'default', '.', 'To', 'make', 'an', 'asynchronous', 'HTTP', 'request', 'please', 'define', 'a', 'callback', 'function', 'to', 'be', 'invoked', 'when', 'receiv...
train
https://github.com/datadotworld/data.world-py/blob/ffaeb115f358731ab0b805b0c43b7ff2e3cf0a77/datadotworld/client/_swagger/apis/insights_api.py#L404-L431
1,946
talkincode/txradius
txradius/radius/packet.py
Packet.DecodePacket
def DecodePacket(self, packet): """Initialize the object from raw packet data. Decode a packet as received from the network and decode it. :param packet: raw packet :type packet: string""" try: (self.code, self.id, length, self.authenticator) = \ ...
python
def DecodePacket(self, packet): """Initialize the object from raw packet data. Decode a packet as received from the network and decode it. :param packet: raw packet :type packet: string""" try: (self.code, self.id, length, self.authenticator) = \ ...
['def', 'DecodePacket', '(', 'self', ',', 'packet', ')', ':', 'try', ':', '(', 'self', '.', 'code', ',', 'self', '.', 'id', ',', 'length', ',', 'self', '.', 'authenticator', ')', '=', 'struct', '.', 'unpack', '(', "'!BBH16s'", ',', 'packet', '[', '0', ':', '20', ']', ')', 'except', 'struct', '.', 'error', ':', 'raise',...
Initialize the object from raw packet data. Decode a packet as received from the network and decode it. :param packet: raw packet :type packet: string
['Initialize', 'the', 'object', 'from', 'raw', 'packet', 'data', '.', 'Decode', 'a', 'packet', 'as', 'received', 'from', 'the', 'network', 'and', 'decode', 'it', '.']
train
https://github.com/talkincode/txradius/blob/b86fdbc9be41183680b82b07d3a8e8ea10926e01/txradius/radius/packet.py#L308-L350
1,947
SecurityInnovation/PGPy
pgpy/pgp.py
PGPKey.revoker
def revoker(self, revoker, **prefs): """ Generate a signature that specifies another key as being valid for revoking this key. :param revoker: The :py:obj:`PGPKey` to specify as a valid revocation key. :type revoker: :py:obj:`PGPKey` :raises: :py:exc:`~pgpy.errors.PGPError` if t...
python
def revoker(self, revoker, **prefs): """ Generate a signature that specifies another key as being valid for revoking this key. :param revoker: The :py:obj:`PGPKey` to specify as a valid revocation key. :type revoker: :py:obj:`PGPKey` :raises: :py:exc:`~pgpy.errors.PGPError` if t...
['def', 'revoker', '(', 'self', ',', 'revoker', ',', '*', '*', 'prefs', ')', ':', 'hash_algo', '=', 'prefs', '.', 'pop', '(', "'hash'", ',', 'None', ')', 'sig', '=', 'PGPSignature', '.', 'new', '(', 'SignatureType', '.', 'DirectlyOnKey', ',', 'self', '.', 'key_algorithm', ',', 'hash_algo', ',', 'self', '.', 'fingerprin...
Generate a signature that specifies another key as being valid for revoking this key. :param revoker: The :py:obj:`PGPKey` to specify as a valid revocation key. :type revoker: :py:obj:`PGPKey` :raises: :py:exc:`~pgpy.errors.PGPError` if the key is passphrase-protected and has not been unlocked ...
['Generate', 'a', 'signature', 'that', 'specifies', 'another', 'key', 'as', 'being', 'valid', 'for', 'revoking', 'this', 'key', '.']
train
https://github.com/SecurityInnovation/PGPy/blob/f1c3d68e32c334f5aa14c34580925e97f17f4fde/pgpy/pgp.py#L2015-L2048
1,948
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_xstp_ext.py
brocade_xstp_ext.get_stp_mst_detail_output_msti_port_oper_bpdu_guard
def get_stp_mst_detail_output_msti_port_oper_bpdu_guard(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_stp_mst_detail = ET.Element("get_stp_mst_detail") config = get_stp_mst_detail output = ET.SubElement(get_stp_mst_detail, "output") ...
python
def get_stp_mst_detail_output_msti_port_oper_bpdu_guard(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_stp_mst_detail = ET.Element("get_stp_mst_detail") config = get_stp_mst_detail output = ET.SubElement(get_stp_mst_detail, "output") ...
['def', 'get_stp_mst_detail_output_msti_port_oper_bpdu_guard', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'config', '=', 'ET', '.', 'Element', '(', '"config"', ')', 'get_stp_mst_detail', '=', 'ET', '.', 'Element', '(', '"get_stp_mst_detail"', ')', 'config', '=', 'get_stp_mst_detail', 'output', '=', 'ET', '.', 'Sub...
Auto Generated Code
['Auto', 'Generated', 'Code']
train
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_xstp_ext.py#L4946-L4961
1,949
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/util.py
_Recommender.evaluate_rmse
def evaluate_rmse(self, dataset, target): """ Evaluate the prediction error for each user-item pair in the given data set. Parameters ---------- dataset : SFrame An SFrame in the same format as the one used during training. target : str T...
python
def evaluate_rmse(self, dataset, target): """ Evaluate the prediction error for each user-item pair in the given data set. Parameters ---------- dataset : SFrame An SFrame in the same format as the one used during training. target : str T...
['def', 'evaluate_rmse', '(', 'self', ',', 'dataset', ',', 'target', ')', ':', 'assert', 'target', 'in', 'dataset', '.', 'column_names', '(', ')', ',', "'Provided dataset must contain a target column with the same \\\n name as the target used during training.'", 'y', '=', 'dataset', '[', 'target', ']', '...
Evaluate the prediction error for each user-item pair in the given data set. Parameters ---------- dataset : SFrame An SFrame in the same format as the one used during training. target : str The name of the target rating column in `dataset`. Ret...
['Evaluate', 'the', 'prediction', 'error', 'for', 'each', 'user', '-', 'item', 'pair', 'in', 'the', 'given', 'data', 'set', '.']
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1576-L1635
1,950
jonathf/chaospy
chaospy/poly/constructor/identifier.py
identify_core
def identify_core(core): """Identify the polynomial argument.""" for datatype, identifier in { int: _identify_scaler, numpy.int8: _identify_scaler, numpy.int16: _identify_scaler, numpy.int32: _identify_scaler, numpy.int64: _identify_scaler, ...
python
def identify_core(core): """Identify the polynomial argument.""" for datatype, identifier in { int: _identify_scaler, numpy.int8: _identify_scaler, numpy.int16: _identify_scaler, numpy.int32: _identify_scaler, numpy.int64: _identify_scaler, ...
['def', 'identify_core', '(', 'core', ')', ':', 'for', 'datatype', ',', 'identifier', 'in', '{', 'int', ':', '_identify_scaler', ',', 'numpy', '.', 'int8', ':', '_identify_scaler', ',', 'numpy', '.', 'int16', ':', '_identify_scaler', ',', 'numpy', '.', 'int32', ':', '_identify_scaler', ',', 'numpy', '.', 'int64', ':', ...
Identify the polynomial argument.
['Identify', 'the', 'polynomial', 'argument', '.']
train
https://github.com/jonathf/chaospy/blob/25ecfa7bf5608dc10c0b31d142ded0e3755f5d74/chaospy/poly/constructor/identifier.py#L11-L33
1,951
openstack/proliantutils
proliantutils/ilo/ris.py
RISOperations._create_list_of_array_controllers
def _create_list_of_array_controllers(self): """Creates the list of Array Controller URIs. :raises: IloCommandNotSupportedError if the ArrayControllers doesnt have member "Member". :returns list of ArrayControllers. """ headers, array_uri, array_settings = ( ...
python
def _create_list_of_array_controllers(self): """Creates the list of Array Controller URIs. :raises: IloCommandNotSupportedError if the ArrayControllers doesnt have member "Member". :returns list of ArrayControllers. """ headers, array_uri, array_settings = ( ...
['def', '_create_list_of_array_controllers', '(', 'self', ')', ':', 'headers', ',', 'array_uri', ',', 'array_settings', '=', '(', 'self', '.', '_get_array_controller_resource', '(', ')', ')', 'array_uri_links', '=', '[', ']', 'if', '(', "'links'", 'in', 'array_settings', 'and', "'Member'", 'in', 'array_settings', '[', ...
Creates the list of Array Controller URIs. :raises: IloCommandNotSupportedError if the ArrayControllers doesnt have member "Member". :returns list of ArrayControllers.
['Creates', 'the', 'list', 'of', 'Array', 'Controller', 'URIs', '.']
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/ris.py#L331-L348
1,952
ask/carrot
carrot/backends/pikachu.py
SyncBackend.queue_declare
def queue_declare(self, queue, durable, exclusive, auto_delete, warn_if_exists=False, arguments=None): """Declare a named queue.""" return self.channel.queue_declare(queue=queue, durable=durable, exclusive=e...
python
def queue_declare(self, queue, durable, exclusive, auto_delete, warn_if_exists=False, arguments=None): """Declare a named queue.""" return self.channel.queue_declare(queue=queue, durable=durable, exclusive=e...
['def', 'queue_declare', '(', 'self', ',', 'queue', ',', 'durable', ',', 'exclusive', ',', 'auto_delete', ',', 'warn_if_exists', '=', 'False', ',', 'arguments', '=', 'None', ')', ':', 'return', 'self', '.', 'channel', '.', 'queue_declare', '(', 'queue', '=', 'queue', ',', 'durable', '=', 'durable', ',', 'exclusive', '=...
Declare a named queue.
['Declare', 'a', 'named', 'queue', '.']
train
https://github.com/ask/carrot/blob/5889a25cd2e274642071c9bba39772f4b3e3d9da/carrot/backends/pikachu.py#L87-L95
1,953
mhe/pynrrd
nrrd/parsers.py
parse_number_list
def parse_number_list(x, dtype=None): """Parse NRRD number list from string into (N,) :class:`numpy.ndarray`. See :ref:`user-guide:int list` and :ref:`user-guide:double list` for more information on the format. Parameters ---------- x : :class:`str` String containing NRRD number list d...
python
def parse_number_list(x, dtype=None): """Parse NRRD number list from string into (N,) :class:`numpy.ndarray`. See :ref:`user-guide:int list` and :ref:`user-guide:double list` for more information on the format. Parameters ---------- x : :class:`str` String containing NRRD number list d...
['def', 'parse_number_list', '(', 'x', ',', 'dtype', '=', 'None', ')', ':', '# Always convert to float and then perform truncation to integer if necessary', 'number_list', '=', 'np', '.', 'array', '(', '[', 'float', '(', 'x', ')', 'for', 'x', 'in', 'x', '.', 'split', '(', ')', ']', ')', 'if', 'dtype', 'is', 'None', ':'...
Parse NRRD number list from string into (N,) :class:`numpy.ndarray`. See :ref:`user-guide:int list` and :ref:`user-guide:double list` for more information on the format. Parameters ---------- x : :class:`str` String containing NRRD number list dtype : data-type, optional Datatype t...
['Parse', 'NRRD', 'number', 'list', 'from', 'string', 'into', '(', 'N', ')', ':', 'class', ':', 'numpy', '.', 'ndarray', '.']
train
https://github.com/mhe/pynrrd/blob/96dd875b302031ea27e2d3aaa611dc6f2dfc7979/nrrd/parsers.py#L168-L204
1,954
althonos/fs.sshfs
fs/sshfs/sshfs.py
SSHFS._exec_command
def _exec_command(self, cmd): """Run a command on the remote SSH server. Returns: bytes: the output of the command, if it didn't fail None: if the error pipe of the command was not empty """ _, out, err = self._client.exec_command(cmd, timeout=self._timeout) ...
python
def _exec_command(self, cmd): """Run a command on the remote SSH server. Returns: bytes: the output of the command, if it didn't fail None: if the error pipe of the command was not empty """ _, out, err = self._client.exec_command(cmd, timeout=self._timeout) ...
['def', '_exec_command', '(', 'self', ',', 'cmd', ')', ':', '_', ',', 'out', ',', 'err', '=', 'self', '.', '_client', '.', 'exec_command', '(', 'cmd', ',', 'timeout', '=', 'self', '.', '_timeout', ')', 'return', 'out', '.', 'read', '(', ')', '.', 'strip', '(', ')', 'if', 'not', 'err', '.', 'read', '(', ')', '.', 'strip...
Run a command on the remote SSH server. Returns: bytes: the output of the command, if it didn't fail None: if the error pipe of the command was not empty
['Run', 'a', 'command', 'on', 'the', 'remote', 'SSH', 'server', '.']
train
https://github.com/althonos/fs.sshfs/blob/773cbdb6bceac5e00cf5785b6ffad6dc4574d29c/fs/sshfs/sshfs.py#L311-L319
1,955
Azure/blobxfer
blobxfer/operations/md5.py
compute_md5_for_file_asbase64
def compute_md5_for_file_asbase64( filename, pagealign=False, start=None, end=None, blocksize=65536): # type: (str, bool, int, int, int) -> str """Compute MD5 hash for file and encode as Base64 :param str filename: file to compute MD5 for :param bool pagealign: page align data :param int sta...
python
def compute_md5_for_file_asbase64( filename, pagealign=False, start=None, end=None, blocksize=65536): # type: (str, bool, int, int, int) -> str """Compute MD5 hash for file and encode as Base64 :param str filename: file to compute MD5 for :param bool pagealign: page align data :param int sta...
['def', 'compute_md5_for_file_asbase64', '(', 'filename', ',', 'pagealign', '=', 'False', ',', 'start', '=', 'None', ',', 'end', '=', 'None', ',', 'blocksize', '=', '65536', ')', ':', '# type: (str, bool, int, int, int) -> str', 'hasher', '=', 'blobxfer', '.', 'util', '.', 'new_md5_hasher', '(', ')', 'with', 'open', '(...
Compute MD5 hash for file and encode as Base64 :param str filename: file to compute MD5 for :param bool pagealign: page align data :param int start: file start offset :param int end: file end offset :param int blocksize: block size :rtype: str :return: MD5 for file encoded as Base64
['Compute', 'MD5', 'hash', 'for', 'file', 'and', 'encode', 'as', 'Base64', ':', 'param', 'str', 'filename', ':', 'file', 'to', 'compute', 'MD5', 'for', ':', 'param', 'bool', 'pagealign', ':', 'page', 'align', 'data', ':', 'param', 'int', 'start', ':', 'file', 'start', 'offset', ':', 'param', 'int', 'end', ':', 'file', ...
train
https://github.com/Azure/blobxfer/blob/3eccbe7530cc6a20ab2d30f9e034b6f021817f34/blobxfer/operations/md5.py#L50-L84
1,956
grampajoe/pymosh
pymosh/riff.py
RiffIndexList.find_all
def find_all(self, header, list_type=None): """Find all direct children with header and optional list type.""" found = [] for chunk in self: if chunk.header == header and (not list_type or (header in list_headers and chunk.type == list_type)): found.ap...
python
def find_all(self, header, list_type=None): """Find all direct children with header and optional list type.""" found = [] for chunk in self: if chunk.header == header and (not list_type or (header in list_headers and chunk.type == list_type)): found.ap...
['def', 'find_all', '(', 'self', ',', 'header', ',', 'list_type', '=', 'None', ')', ':', 'found', '=', '[', ']', 'for', 'chunk', 'in', 'self', ':', 'if', 'chunk', '.', 'header', '==', 'header', 'and', '(', 'not', 'list_type', 'or', '(', 'header', 'in', 'list_headers', 'and', 'chunk', '.', 'type', '==', 'list_type', ')'...
Find all direct children with header and optional list type.
['Find', 'all', 'direct', 'children', 'with', 'header', 'and', 'optional', 'list', 'type', '.']
train
https://github.com/grampajoe/pymosh/blob/2a17a0271fda939528edc31572940d3b676f8a47/pymosh/riff.py#L117-L124
1,957
hustlzp/permission
permission/permission.py
Rule.run
def run(self): """Run self.rules_list. Return True if one rule channel has been passed. Otherwise return False and the deny() method of the last failed rule. """ failed_result = None for rule in self.rules_list: for check, deny in rule: if not...
python
def run(self): """Run self.rules_list. Return True if one rule channel has been passed. Otherwise return False and the deny() method of the last failed rule. """ failed_result = None for rule in self.rules_list: for check, deny in rule: if not...
['def', 'run', '(', 'self', ')', ':', 'failed_result', '=', 'None', 'for', 'rule', 'in', 'self', '.', 'rules_list', ':', 'for', 'check', ',', 'deny', 'in', 'rule', ':', 'if', 'not', 'check', '(', ')', ':', 'failed_result', '=', '(', 'False', ',', 'deny', ')', 'break', 'else', ':', 'return', '(', 'True', ',', 'None', ')...
Run self.rules_list. Return True if one rule channel has been passed. Otherwise return False and the deny() method of the last failed rule.
['Run', 'self', '.', 'rules_list', '.']
train
https://github.com/hustlzp/permission/blob/302a02a775c4cd53f7588ff9c4ce1ca49a0d40bf/permission/permission.py#L98-L112
1,958
StanfordVL/robosuite
robosuite/devices/spacemouse.py
SpaceMouse.run
def run(self): """Listener method that keeps pulling new messages.""" t_last_click = -1 while True: d = self.device.read(13) if d is not None and self._enabled: if d[0] == 1: ## readings from 6-DoF sensor self.y = convert(d[1], d[2]...
python
def run(self): """Listener method that keeps pulling new messages.""" t_last_click = -1 while True: d = self.device.read(13) if d is not None and self._enabled: if d[0] == 1: ## readings from 6-DoF sensor self.y = convert(d[1], d[2]...
['def', 'run', '(', 'self', ')', ':', 't_last_click', '=', '-', '1', 'while', 'True', ':', 'd', '=', 'self', '.', 'device', '.', 'read', '(', '13', ')', 'if', 'd', 'is', 'not', 'None', 'and', 'self', '.', '_enabled', ':', 'if', 'd', '[', '0', ']', '==', '1', ':', '## readings from 6-DoF sensor', 'self', '.', 'y', '=', ...
Listener method that keeps pulling new messages.
['Listener', 'method', 'that', 'keeps', 'pulling', 'new', 'messages', '.']
train
https://github.com/StanfordVL/robosuite/blob/65cd16810e2ed647e3ec88746af3412065b7f278/robosuite/devices/spacemouse.py#L155-L199
1,959
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py
DockerSwarmClient._parse_resources
def _parse_resources(resource_values: dict, resource_name: str) -> dict: """Parse resources key. Args: resource_values (dict): resource configurations values resource_name (string): Resource name Returns: dict, resources specification """ # ...
python
def _parse_resources(resource_values: dict, resource_name: str) -> dict: """Parse resources key. Args: resource_values (dict): resource configurations values resource_name (string): Resource name Returns: dict, resources specification """ # ...
['def', '_parse_resources', '(', 'resource_values', ':', 'dict', ',', 'resource_name', ':', 'str', ')', '->', 'dict', ':', '# Initialising empty dictionary', 'resources', '=', '{', '}', 'for', 'r_values', 'in', 'resource_values', '[', 'resource_name', ']', ':', 'if', "'limits'", 'in', 'r_values', ':', 'for', 'r_key', '...
Parse resources key. Args: resource_values (dict): resource configurations values resource_name (string): Resource name Returns: dict, resources specification
['Parse', 'resources', 'key', '.']
train
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L617-L645
1,960
sibirrer/lenstronomy
lenstronomy/Util/util.py
get_axes
def get_axes(x, y): """ computes the axis x and y of a given 2d grid :param x: :param y: :return: """ n=int(np.sqrt(len(x))) if n**2 != len(x): raise ValueError("lenght of input array given as %s is not square of integer number!" % (len(x))) x_image = x.reshape(n,n) y_ima...
python
def get_axes(x, y): """ computes the axis x and y of a given 2d grid :param x: :param y: :return: """ n=int(np.sqrt(len(x))) if n**2 != len(x): raise ValueError("lenght of input array given as %s is not square of integer number!" % (len(x))) x_image = x.reshape(n,n) y_ima...
['def', 'get_axes', '(', 'x', ',', 'y', ')', ':', 'n', '=', 'int', '(', 'np', '.', 'sqrt', '(', 'len', '(', 'x', ')', ')', ')', 'if', 'n', '**', '2', '!=', 'len', '(', 'x', ')', ':', 'raise', 'ValueError', '(', '"lenght of input array given as %s is not square of integer number!"', '%', '(', 'len', '(', 'x', ')', ')', ...
computes the axis x and y of a given 2d grid :param x: :param y: :return:
['computes', 'the', 'axis', 'x', 'and', 'y', 'of', 'a', 'given', '2d', 'grid', ':', 'param', 'x', ':', ':', 'param', 'y', ':', ':', 'return', ':']
train
https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/util.py#L227-L241
1,961
inveniosoftware/invenio-github
invenio_github/handlers.py
disconnect
def disconnect(remote): """Disconnect callback handler for GitHub.""" # User must be authenticated if not current_user.is_authenticated: return current_app.login_manager.unauthorized() external_method = 'github' external_ids = [i.id for i in current_user.external_identifiers ...
python
def disconnect(remote): """Disconnect callback handler for GitHub.""" # User must be authenticated if not current_user.is_authenticated: return current_app.login_manager.unauthorized() external_method = 'github' external_ids = [i.id for i in current_user.external_identifiers ...
['def', 'disconnect', '(', 'remote', ')', ':', '# User must be authenticated', 'if', 'not', 'current_user', '.', 'is_authenticated', ':', 'return', 'current_app', '.', 'login_manager', '.', 'unauthorized', '(', ')', 'external_method', '=', "'github'", 'external_ids', '=', '[', 'i', '.', 'id', 'for', 'i', 'in', 'current...
Disconnect callback handler for GitHub.
['Disconnect', 'callback', 'handler', 'for', 'GitHub', '.']
train
https://github.com/inveniosoftware/invenio-github/blob/ec42fd6a06079310dcbe2c46d9fd79d5197bbe26/invenio_github/handlers.py#L62-L103
1,962
ContextLab/quail
quail/fingerprint.py
stick_perm
def stick_perm(presenter, egg, dist_dict, strategy): """Computes weights for one reordering using stick-breaking method""" # seed RNG np.random.seed() # unpack egg egg_pres, egg_rec, egg_features, egg_dist_funcs = parse_egg(egg) # reorder regg = order_stick(presenter, egg, dist_dict, stra...
python
def stick_perm(presenter, egg, dist_dict, strategy): """Computes weights for one reordering using stick-breaking method""" # seed RNG np.random.seed() # unpack egg egg_pres, egg_rec, egg_features, egg_dist_funcs = parse_egg(egg) # reorder regg = order_stick(presenter, egg, dist_dict, stra...
['def', 'stick_perm', '(', 'presenter', ',', 'egg', ',', 'dist_dict', ',', 'strategy', ')', ':', '# seed RNG', 'np', '.', 'random', '.', 'seed', '(', ')', '# unpack egg', 'egg_pres', ',', 'egg_rec', ',', 'egg_features', ',', 'egg_dist_funcs', '=', 'parse_egg', '(', 'egg', ')', '# reorder', 'regg', '=', 'order_stick', '...
Computes weights for one reordering using stick-breaking method
['Computes', 'weights', 'for', 'one', 'reordering', 'using', 'stick', '-', 'breaking', 'method']
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/fingerprint.py#L577-L603
1,963
uw-it-aca/uw-restclients-pws
uw_pws/__init__.py
PWS.get_person_by_prox_rfid
def get_person_by_prox_rfid(self, prox_rfid): """ Returns a restclients.Person object for the given rfid. If the rfid isn't found, or if there is an error communicating with the IdCard WS, a DataFailureException will be thrown. """ if not self.valid_prox_rfid(prox_rfid):...
python
def get_person_by_prox_rfid(self, prox_rfid): """ Returns a restclients.Person object for the given rfid. If the rfid isn't found, or if there is an error communicating with the IdCard WS, a DataFailureException will be thrown. """ if not self.valid_prox_rfid(prox_rfid):...
['def', 'get_person_by_prox_rfid', '(', 'self', ',', 'prox_rfid', ')', ':', 'if', 'not', 'self', '.', 'valid_prox_rfid', '(', 'prox_rfid', ')', ':', 'raise', 'InvalidProxRFID', '(', 'prox_rfid', ')', 'url', '=', '"{}.json?{}"', '.', 'format', '(', 'CARD_PREFIX', ',', 'urlencode', '(', '{', '"prox_rfid"', ':', 'prox_rfi...
Returns a restclients.Person object for the given rfid. If the rfid isn't found, or if there is an error communicating with the IdCard WS, a DataFailureException will be thrown.
['Returns', 'a', 'restclients', '.', 'Person', 'object', 'for', 'the', 'given', 'rfid', '.', 'If', 'the', 'rfid', 'isn', 't', 'found', 'or', 'if', 'there', 'is', 'an', 'error', 'communicating', 'with', 'the', 'IdCard', 'WS', 'a', 'DataFailureException', 'will', 'be', 'thrown', '.']
train
https://github.com/uw-it-aca/uw-restclients-pws/blob/758d94b42a01762738140c5f984d05f389325b7a/uw_pws/__init__.py#L120-L141
1,964
Lagg/steamodd
steam/items.py
item.equipped
def equipped(self): """ Returns a dict of classes that have the item equipped and in what slot """ equipped = self._item.get("equipped", []) # WORKAROUND: 0 is probably an off-by-one error # WORKAROUND: 65535 actually serves a purpose (according to Valve) return dict([(eq["class...
python
def equipped(self): """ Returns a dict of classes that have the item equipped and in what slot """ equipped = self._item.get("equipped", []) # WORKAROUND: 0 is probably an off-by-one error # WORKAROUND: 65535 actually serves a purpose (according to Valve) return dict([(eq["class...
['def', 'equipped', '(', 'self', ')', ':', 'equipped', '=', 'self', '.', '_item', '.', 'get', '(', '"equipped"', ',', '[', ']', ')', '# WORKAROUND: 0 is probably an off-by-one error', '# WORKAROUND: 65535 actually serves a purpose (according to Valve)', 'return', 'dict', '(', '[', '(', 'eq', '[', '"class"', ']', ',', '...
Returns a dict of classes that have the item equipped and in what slot
['Returns', 'a', 'dict', 'of', 'classes', 'that', 'have', 'the', 'item', 'equipped', 'and', 'in', 'what', 'slot']
train
https://github.com/Lagg/steamodd/blob/2e9ced4e7a6dbe3e09d5a648450bafc12b937b95/steam/items.py#L306-L312
1,965
bitesofcode/projexui
projexui/widgets/xtreewidget/xtreewidget.py
XTreeWidget.mouseDoubleClickEvent
def mouseDoubleClickEvent(self, event): """ Overloads when a mouse press occurs. If in editable mode, and the click occurs on a selected index, then the editor will be created and no selection change will occur. :param event | <QMousePressEvent> """ ...
python
def mouseDoubleClickEvent(self, event): """ Overloads when a mouse press occurs. If in editable mode, and the click occurs on a selected index, then the editor will be created and no selection change will occur. :param event | <QMousePressEvent> """ ...
['def', 'mouseDoubleClickEvent', '(', 'self', ',', 'event', ')', ':', 'item', '=', 'self', '.', 'itemAt', '(', 'event', '.', 'pos', '(', ')', ')', 'column', '=', 'self', '.', 'columnAt', '(', 'event', '.', 'pos', '(', ')', '.', 'x', '(', ')', ')', 'mid_button', '=', 'event', '.', 'button', '(', ')', '==', 'QtCore', '.'...
Overloads when a mouse press occurs. If in editable mode, and the click occurs on a selected index, then the editor will be created and no selection change will occur. :param event | <QMousePressEvent>
['Overloads', 'when', 'a', 'mouse', 'press', 'occurs', '.', 'If', 'in', 'editable', 'mode', 'and', 'the', 'click', 'occurs', 'on', 'a', 'selected', 'index', 'then', 'the', 'editor', 'will', 'be', 'created', 'and', 'no', 'selection', 'change', 'will', 'occur', '.', ':', 'param', 'event', '|', '<QMousePressEvent', '>']
train
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtreewidget/xtreewidget.py#L1263-L1283
1,966
lablup/backend.ai-client-py
src/ai/backend/client/session.py
Session.close
def close(self): ''' Terminates the session. It schedules the ``close()`` coroutine of the underlying aiohttp session and then enqueues a sentinel object to indicate termination. Then it waits until the worker thread to self-terminate by joining. ''' if self._cl...
python
def close(self): ''' Terminates the session. It schedules the ``close()`` coroutine of the underlying aiohttp session and then enqueues a sentinel object to indicate termination. Then it waits until the worker thread to self-terminate by joining. ''' if self._cl...
['def', 'close', '(', 'self', ')', ':', 'if', 'self', '.', '_closed', ':', 'return', 'self', '.', '_closed', '=', 'True', 'self', '.', '_worker_thread', '.', 'work_queue', '.', 'put', '(', 'self', '.', 'aiohttp_session', '.', 'close', '(', ')', ')', 'self', '.', '_worker_thread', '.', 'work_queue', '.', 'put', '(', 'se...
Terminates the session. It schedules the ``close()`` coroutine of the underlying aiohttp session and then enqueues a sentinel object to indicate termination. Then it waits until the worker thread to self-terminate by joining.
['Terminates', 'the', 'session', '.', 'It', 'schedules', 'the', 'close', '()', 'coroutine', 'of', 'the', 'underlying', 'aiohttp', 'session', 'and', 'then', 'enqueues', 'a', 'sentinel', 'object', 'to', 'indicate', 'termination', '.', 'Then', 'it', 'waits', 'until', 'the', 'worker', 'thread', 'to', 'self', '-', 'terminat...
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/session.py#L214-L226
1,967
flowersteam/explauto
explauto/sensorimotor_model/inverse/cma.py
fmin
def fmin(objective_function, x0, sigma0, options=None, args=(), gradf=None, restarts=0, restart_from_best='False', incpopsize=2, eval_initial_x=False, noise_handler=None, noise_change_sigma_exponent=1, noise_kappa_exponent=0, # T...
python
def fmin(objective_function, x0, sigma0, options=None, args=(), gradf=None, restarts=0, restart_from_best='False', incpopsize=2, eval_initial_x=False, noise_handler=None, noise_change_sigma_exponent=1, noise_kappa_exponent=0, # T...
['def', 'fmin', '(', 'objective_function', ',', 'x0', ',', 'sigma0', ',', 'options', '=', 'None', ',', 'args', '=', '(', ')', ',', 'gradf', '=', 'None', ',', 'restarts', '=', '0', ',', 'restart_from_best', '=', "'False'", ',', 'incpopsize', '=', '2', ',', 'eval_initial_x', '=', 'False', ',', 'noise_handler', '=', 'None...
functional interface to the stochastic optimizer CMA-ES for non-convex function minimization. Calling Sequences ================= ``fmin(objective_function, x0, sigma0)`` minimizes `objective_function` starting at `x0` and with standard deviation `sigma0` (step-size) ...
['functional', 'interface', 'to', 'the', 'stochastic', 'optimizer', 'CMA', '-', 'ES', 'for', 'non', '-', 'convex', 'function', 'minimization', '.']
train
https://github.com/flowersteam/explauto/blob/cf0f81ecb9f6412f7276a95bd27359000e1e26b6/explauto/sensorimotor_model/inverse/cma.py#L5137-L5598
1,968
Esri/ArcREST
src/arcrest/manageags/_security.py
Security.updateUser
def updateUser(self, username, password, fullname, description, email): """ Updates a user account in the user store Input: username - the name of the user. The name must be unique in the user store. password - the password for this user. ...
python
def updateUser(self, username, password, fullname, description, email): """ Updates a user account in the user store Input: username - the name of the user. The name must be unique in the user store. password - the password for this user. ...
['def', 'updateUser', '(', 'self', ',', 'username', ',', 'password', ',', 'fullname', ',', 'description', ',', 'email', ')', ':', 'params', '=', '{', '"f"', ':', '"json"', ',', '"username"', ':', 'username', '}', 'if', 'password', 'is', 'not', 'None', ':', 'params', '[', "'password'", ']', '=', 'password', 'if', 'fulln...
Updates a user account in the user store Input: username - the name of the user. The name must be unique in the user store. password - the password for this user. fullname - an optional full name for the user. description - an o...
['Updates', 'a', 'user', 'account', 'in', 'the', 'user', 'store', 'Input', ':', 'username', '-', 'the', 'name', 'of', 'the', 'user', '.', 'The', 'name', 'must', 'be', 'unique', 'in', 'the', 'user', 'store', '.', 'password', '-', 'the', 'password', 'for', 'this', 'user', '.', 'fullname', '-', 'an', 'optional', 'full', '...
train
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_security.py#L621-L648
1,969
base4sistemas/pyescpos
escpos/impl/epson.py
GenericESCPOS.code128
def code128(self, data, **kwargs): """Renders given ``data`` as **Code 128** barcode symbology. :param str codeset: Optional. Keyword argument for the subtype (code set) to render. Defaults to :attr:`escpos.barcode.CODE128_A`. .. warning:: You should draw up your data ...
python
def code128(self, data, **kwargs): """Renders given ``data`` as **Code 128** barcode symbology. :param str codeset: Optional. Keyword argument for the subtype (code set) to render. Defaults to :attr:`escpos.barcode.CODE128_A`. .. warning:: You should draw up your data ...
['def', 'code128', '(', 'self', ',', 'data', ',', '*', '*', 'kwargs', ')', ':', 'if', 'not', 're', '.', 'match', '(', "r'^[\\x20-\\x7F]+$'", ',', 'data', ')', ':', 'raise', 'ValueError', '(', "'Invalid Code 128 symbology. Code 128 can encode '", "'any ASCII character ranging from 32 (20h) to 127 (7Fh); '", "'got {!r}'"...
Renders given ``data`` as **Code 128** barcode symbology. :param str codeset: Optional. Keyword argument for the subtype (code set) to render. Defaults to :attr:`escpos.barcode.CODE128_A`. .. warning:: You should draw up your data according to the subtype (code set). ...
['Renders', 'given', 'data', 'as', '**', 'Code', '128', '**', 'barcode', 'symbology', '.']
train
https://github.com/base4sistemas/pyescpos/blob/621bd00f1499aff700f37d8d36d04e0d761708f1/escpos/impl/epson.py#L240-L261
1,970
jazzband/sorl-thumbnail
sorl/thumbnail/kvstores/base.py
KVStoreBase._get
def _get(self, key, identity='image'): """ Deserializing, prefix wrapper for _get_raw """ value = self._get_raw(add_prefix(key, identity)) if not value: return None if identity == 'image': return deserialize_image_file(value) return dese...
python
def _get(self, key, identity='image'): """ Deserializing, prefix wrapper for _get_raw """ value = self._get_raw(add_prefix(key, identity)) if not value: return None if identity == 'image': return deserialize_image_file(value) return dese...
['def', '_get', '(', 'self', ',', 'key', ',', 'identity', '=', "'image'", ')', ':', 'value', '=', 'self', '.', '_get_raw', '(', 'add_prefix', '(', 'key', ',', 'identity', ')', ')', 'if', 'not', 'value', ':', 'return', 'None', 'if', 'identity', '==', "'image'", ':', 'return', 'deserialize_image_file', '(', 'value', ')',...
Deserializing, prefix wrapper for _get_raw
['Deserializing', 'prefix', 'wrapper', 'for', '_get_raw']
train
https://github.com/jazzband/sorl-thumbnail/blob/22ccd9781462a820f963f57018ad3dcef85053ed/sorl/thumbnail/kvstores/base.py#L141-L153
1,971
lordmauve/lepton
examples/fireworks.py
on_draw
def on_draw(): global yrot win.clear() glLoadIdentity() glTranslatef(0, 0, -100) glRotatef(yrot, 0.0, 1.0, 0.0) default_system.draw() ''' glBindTexture(GL_TEXTURE_2D, 1) glEnable(GL_TEXTURE_2D) glEnable(GL_POINT_SPRITE) glPointSize(100); glBegin(GL_POINTS) glVertex2f(0,0) glEnd() glBindTexture(GL_TEXTURE...
python
def on_draw(): global yrot win.clear() glLoadIdentity() glTranslatef(0, 0, -100) glRotatef(yrot, 0.0, 1.0, 0.0) default_system.draw() ''' glBindTexture(GL_TEXTURE_2D, 1) glEnable(GL_TEXTURE_2D) glEnable(GL_POINT_SPRITE) glPointSize(100); glBegin(GL_POINTS) glVertex2f(0,0) glEnd() glBindTexture(GL_TEXTURE...
['def', 'on_draw', '(', ')', ':', 'global', 'yrot', 'win', '.', 'clear', '(', ')', 'glLoadIdentity', '(', ')', 'glTranslatef', '(', '0', ',', '0', ',', '-', '100', ')', 'glRotatef', '(', 'yrot', ',', '0.0', ',', '1.0', ',', '0.0', ')', 'default_system', '.', 'draw', '(', ')']
glBindTexture(GL_TEXTURE_2D, 1) glEnable(GL_TEXTURE_2D) glEnable(GL_POINT_SPRITE) glPointSize(100); glBegin(GL_POINTS) glVertex2f(0,0) glEnd() glBindTexture(GL_TEXTURE_2D, 2) glEnable(GL_TEXTURE_2D) glEnable(GL_POINT_SPRITE) glPointSize(100); glBegin(GL_POINTS) glVertex2f(50,0) glEnd() glBindTexture(GL_TE...
['glBindTexture', '(', 'GL_TEXTURE_2D', '1', ')', 'glEnable', '(', 'GL_TEXTURE_2D', ')', 'glEnable', '(', 'GL_POINT_SPRITE', ')', 'glPointSize', '(', '100', ')', ';', 'glBegin', '(', 'GL_POINTS', ')', 'glVertex2f', '(', '0', '0', ')', 'glEnd', '()', 'glBindTexture', '(', 'GL_TEXTURE_2D', '2', ')', 'glEnable', '(', 'GL_...
train
https://github.com/lordmauve/lepton/blob/bf03f2c20ea8c51ade632f692d0a21e520fbba7c/examples/fireworks.py#L132-L155
1,972
Turbo87/aerofiles
aerofiles/flarmcfg/writer.py
Writer.write_waypoint
def write_waypoint(self, latitude=None, longitude=None, description=None): """ Adds a waypoint to the current task declaration. The first and the last waypoint added will be treated as takeoff and landing location, respectively. :: writer.write_waypoint( ...
python
def write_waypoint(self, latitude=None, longitude=None, description=None): """ Adds a waypoint to the current task declaration. The first and the last waypoint added will be treated as takeoff and landing location, respectively. :: writer.write_waypoint( ...
['def', 'write_waypoint', '(', 'self', ',', 'latitude', '=', 'None', ',', 'longitude', '=', 'None', ',', 'description', '=', 'None', ')', ':', 'if', 'not', 'description', ':', 'description', '=', "''", 'latitude', '=', 'self', '.', 'format_latitude', '(', 'latitude', ')', 'longitude', '=', 'self', '.', 'format_longitud...
Adds a waypoint to the current task declaration. The first and the last waypoint added will be treated as takeoff and landing location, respectively. :: writer.write_waypoint( latitude=(51 + 7.345 / 60.), longitude=(6 + 24.765 / 60.), ...
['Adds', 'a', 'waypoint', 'to', 'the', 'current', 'task', 'declaration', '.', 'The', 'first', 'and', 'the', 'last', 'waypoint', 'added', 'will', 'be', 'treated', 'as', 'takeoff', 'and', 'landing', 'location', 'respectively', '.']
train
https://github.com/Turbo87/aerofiles/blob/d8b7b04a1fcea5c98f89500de1164619a4ec7ef4/aerofiles/flarmcfg/writer.py#L150-L182
1,973
vingd/vingd-api-python
vingd/client.py
Vingd.revoke_vouchers
def revoke_vouchers(self, vid_encoded=None, uid_from=None, uid_to=None, gid=None, valid_after=None, valid_before=None, last=None, first=None): """ REVOKES/INVALIDATES a filtered list of vouchers. :type vid_encoded: ...
python
def revoke_vouchers(self, vid_encoded=None, uid_from=None, uid_to=None, gid=None, valid_after=None, valid_before=None, last=None, first=None): """ REVOKES/INVALIDATES a filtered list of vouchers. :type vid_encoded: ...
['def', 'revoke_vouchers', '(', 'self', ',', 'vid_encoded', '=', 'None', ',', 'uid_from', '=', 'None', ',', 'uid_to', '=', 'None', ',', 'gid', '=', 'None', ',', 'valid_after', '=', 'None', ',', 'valid_before', '=', 'None', ',', 'last', '=', 'None', ',', 'first', '=', 'None', ')', ':', 'resource', '=', 'self', '.', 'kvp...
REVOKES/INVALIDATES a filtered list of vouchers. :type vid_encoded: ``alphanumeric(64)`` :param vid_encoded: Voucher ID, as a string with CRC. :type uid_from: ``bigint`` :param uid_from: Filter by source account UID. :type uid_to: ``bigint`` ...
['REVOKES', '/', 'INVALIDATES', 'a', 'filtered', 'list', 'of', 'vouchers', '.', ':', 'type', 'vid_encoded', ':', 'alphanumeric', '(', '64', ')', ':', 'param', 'vid_encoded', ':', 'Voucher', 'ID', 'as', 'a', 'string', 'with', 'CRC', '.', ':', 'type', 'uid_from', ':', 'bigint', ':', 'param', 'uid_from', ':', 'Filter', 'b...
train
https://github.com/vingd/vingd-api-python/blob/7548a49973a472f7277c8ef847563faa7b6f3706/vingd/client.py#L853-L925
1,974
ladybug-tools/ladybug
ladybug/wea.py
Wea.directional_irradiance
def directional_irradiance(self, altitude=90, azimuth=180, ground_reflectance=0.2, isotrophic=True): """Returns the irradiance components facing a given altitude and azimuth. This method computes unobstructed solar flux facing a given altitude and azimuth. The def...
python
def directional_irradiance(self, altitude=90, azimuth=180, ground_reflectance=0.2, isotrophic=True): """Returns the irradiance components facing a given altitude and azimuth. This method computes unobstructed solar flux facing a given altitude and azimuth. The def...
['def', 'directional_irradiance', '(', 'self', ',', 'altitude', '=', '90', ',', 'azimuth', '=', '180', ',', 'ground_reflectance', '=', '0.2', ',', 'isotrophic', '=', 'True', ')', ':', '# function to convert polar coordinates to xyz.', 'def', 'pol2cart', '(', 'phi', ',', 'theta', ')', ':', 'mult', '=', 'math', '.', 'cos...
Returns the irradiance components facing a given altitude and azimuth. This method computes unobstructed solar flux facing a given altitude and azimuth. The default is set to return the golbal horizontal irradiance, assuming an altitude facing straight up (90 degrees). Args: ...
['Returns', 'the', 'irradiance', 'components', 'facing', 'a', 'given', 'altitude', 'and', 'azimuth', '.']
train
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L594-L692
1,975
honzajavorek/redis-collections
redis_collections/dicts.py
Dict.copy
def copy(self, key=None): """ Return a new collection with the same items as this one. If *key* is specified, create the new collection with the given Redis key. """ other = self.__class__(redis=self.redis, key=key) other.update(self) return other
python
def copy(self, key=None): """ Return a new collection with the same items as this one. If *key* is specified, create the new collection with the given Redis key. """ other = self.__class__(redis=self.redis, key=key) other.update(self) return other
['def', 'copy', '(', 'self', ',', 'key', '=', 'None', ')', ':', 'other', '=', 'self', '.', '__class__', '(', 'redis', '=', 'self', '.', 'redis', ',', 'key', '=', 'key', ')', 'other', '.', 'update', '(', 'self', ')', 'return', 'other']
Return a new collection with the same items as this one. If *key* is specified, create the new collection with the given Redis key.
['Return', 'a', 'new', 'collection', 'with', 'the', 'same', 'items', 'as', 'this', 'one', '.', 'If', '*', 'key', '*', 'is', 'specified', 'create', 'the', 'new', 'collection', 'with', 'the', 'given', 'Redis', 'key', '.']
train
https://github.com/honzajavorek/redis-collections/blob/07ca8efe88fb128f7dc7319dfa6a26cd39b3776b/redis_collections/dicts.py#L362-L371
1,976
Jahaja/psdash
psdash/log.py
LogReader.search
def search(self, text): """ Find text in log file from current position returns a tuple containing: absolute position, position in result buffer, result buffer (the actual file contents) """ key = hash(text) searcher = self._searchers....
python
def search(self, text): """ Find text in log file from current position returns a tuple containing: absolute position, position in result buffer, result buffer (the actual file contents) """ key = hash(text) searcher = self._searchers....
['def', 'search', '(', 'self', ',', 'text', ')', ':', 'key', '=', 'hash', '(', 'text', ')', 'searcher', '=', 'self', '.', '_searchers', '.', 'get', '(', 'key', ')', 'if', 'not', 'searcher', ':', 'searcher', '=', 'ReverseFileSearcher', '(', 'self', '.', 'filename', ',', 'text', ')', 'self', '.', '_searchers', '[', 'key'...
Find text in log file from current position returns a tuple containing: absolute position, position in result buffer, result buffer (the actual file contents)
['Find', 'text', 'in', 'log', 'file', 'from', 'current', 'position']
train
https://github.com/Jahaja/psdash/blob/4f1784742666045a3c33bd471dbe489b4f5c7699/psdash/log.py#L114-L140
1,977
sdispater/orator
orator/migrations/migrator.py
Migrator.run
def run(self, path, pretend=False): """ Run the outstanding migrations for a given path. :param path: The path :type path: str :param pretend: Whether we execute the migrations as dry-run :type pretend: bool """ self._notes = [] files = self._get...
python
def run(self, path, pretend=False): """ Run the outstanding migrations for a given path. :param path: The path :type path: str :param pretend: Whether we execute the migrations as dry-run :type pretend: bool """ self._notes = [] files = self._get...
['def', 'run', '(', 'self', ',', 'path', ',', 'pretend', '=', 'False', ')', ':', 'self', '.', '_notes', '=', '[', ']', 'files', '=', 'self', '.', '_get_migration_files', '(', 'path', ')', 'ran', '=', 'self', '.', '_repository', '.', 'get_ran', '(', ')', 'migrations', '=', '[', 'f', 'for', 'f', 'in', 'files', 'if', 'f',...
Run the outstanding migrations for a given path. :param path: The path :type path: str :param pretend: Whether we execute the migrations as dry-run :type pretend: bool
['Run', 'the', 'outstanding', 'migrations', 'for', 'a', 'given', 'path', '.']
train
https://github.com/sdispater/orator/blob/bd90bf198ee897751848f9a92e49d18e60a74136/orator/migrations/migrator.py#L34-L51
1,978
consbio/parserutils
parserutils/elements.py
iter_elements
def iter_elements(element_function, parent_to_parse, **kwargs): """ Applies element_function to each of the sub-elements in parent_to_parse. The passed in function must take at least one element, and an optional list of kwargs which are relevant to each of the elements in the list: def elem_func...
python
def iter_elements(element_function, parent_to_parse, **kwargs): """ Applies element_function to each of the sub-elements in parent_to_parse. The passed in function must take at least one element, and an optional list of kwargs which are relevant to each of the elements in the list: def elem_func...
['def', 'iter_elements', '(', 'element_function', ',', 'parent_to_parse', ',', '*', '*', 'kwargs', ')', ':', 'parent', '=', 'get_element', '(', 'parent_to_parse', ')', 'if', 'not', 'hasattr', '(', 'element_function', ',', "'__call__'", ')', ':', 'return', 'parent', 'for', 'child', 'in', '(', '[', ']', 'if', 'parent', '...
Applies element_function to each of the sub-elements in parent_to_parse. The passed in function must take at least one element, and an optional list of kwargs which are relevant to each of the elements in the list: def elem_func(each_elem, **kwargs)
['Applies', 'element_function', 'to', 'each', 'of', 'the', 'sub', '-', 'elements', 'in', 'parent_to_parse', '.', 'The', 'passed', 'in', 'function', 'must', 'take', 'at', 'least', 'one', 'element', 'and', 'an', 'optional', 'list', 'of', 'kwargs', 'which', 'are', 'relevant', 'to', 'each', 'of', 'the', 'elements', 'in', '...
train
https://github.com/consbio/parserutils/blob/f13f80db99ed43479336b116e38512e3566e4623/parserutils/elements.py#L911-L927
1,979
mitsei/dlkit
dlkit/json_/assessment/sessions.py
ItemBankSession.get_item_ids_by_banks
def get_item_ids_by_banks(self, bank_ids): """Gets the list of ``Item Ids`` corresponding to a list of ``Banks``. arg: bank_ids (osid.id.IdList): list of bank ``Ids`` return: (osid.id.IdList) - list of bank ``Ids`` raise: NullArgument - ``bank_ids`` is ``null`` raise: Opera...
python
def get_item_ids_by_banks(self, bank_ids): """Gets the list of ``Item Ids`` corresponding to a list of ``Banks``. arg: bank_ids (osid.id.IdList): list of bank ``Ids`` return: (osid.id.IdList) - list of bank ``Ids`` raise: NullArgument - ``bank_ids`` is ``null`` raise: Opera...
['def', 'get_item_ids_by_banks', '(', 'self', ',', 'bank_ids', ')', ':', '# Implemented from template for', '# osid.resource.ResourceBinSession.get_resource_ids_by_bins', 'id_list', '=', '[', ']', 'for', 'item', 'in', 'self', '.', 'get_items_by_banks', '(', 'bank_ids', ')', ':', 'id_list', '.', 'append', '(', 'item', '...
Gets the list of ``Item Ids`` corresponding to a list of ``Banks``. arg: bank_ids (osid.id.IdList): list of bank ``Ids`` return: (osid.id.IdList) - list of bank ``Ids`` raise: NullArgument - ``bank_ids`` is ``null`` raise: OperationFailed - unable to complete request raise:...
['Gets', 'the', 'list', 'of', 'Item', 'Ids', 'corresponding', 'to', 'a', 'list', 'of', 'Banks', '.']
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/sessions.py#L3451-L3467
1,980
biocore/mustached-octo-ironman
moi/group.py
Group.close
def close(self): """Unsubscribe the group and all jobs being listened too""" for channel in self._listening_to: self.toredis.unsubscribe(channel) self.toredis.unsubscribe(self.group_pubsub)
python
def close(self): """Unsubscribe the group and all jobs being listened too""" for channel in self._listening_to: self.toredis.unsubscribe(channel) self.toredis.unsubscribe(self.group_pubsub)
['def', 'close', '(', 'self', ')', ':', 'for', 'channel', 'in', 'self', '.', '_listening_to', ':', 'self', '.', 'toredis', '.', 'unsubscribe', '(', 'channel', ')', 'self', '.', 'toredis', '.', 'unsubscribe', '(', 'self', '.', 'group_pubsub', ')']
Unsubscribe the group and all jobs being listened too
['Unsubscribe', 'the', 'group', 'and', 'all', 'jobs', 'being', 'listened', 'too']
train
https://github.com/biocore/mustached-octo-ironman/blob/54128d8fdff327e1b7ffd9bb77bf38c3df9526d7/moi/group.py#L109-L113
1,981
inveniosoftware/invenio-records-rest
invenio_records_rest/schemas/json.py
StrictKeysMixin.check_unknown_fields
def check_unknown_fields(self, data, original_data): """Check for unknown keys.""" if isinstance(original_data, list): for elem in original_data: self.check_unknown_fields(data, elem) else: for key in original_data: if key not in [ ...
python
def check_unknown_fields(self, data, original_data): """Check for unknown keys.""" if isinstance(original_data, list): for elem in original_data: self.check_unknown_fields(data, elem) else: for key in original_data: if key not in [ ...
['def', 'check_unknown_fields', '(', 'self', ',', 'data', ',', 'original_data', ')', ':', 'if', 'isinstance', '(', 'original_data', ',', 'list', ')', ':', 'for', 'elem', 'in', 'original_data', ':', 'self', '.', 'check_unknown_fields', '(', 'data', ',', 'elem', ')', 'else', ':', 'for', 'key', 'in', 'original_data', ':',...
Check for unknown keys.
['Check', 'for', 'unknown', 'keys', '.']
train
https://github.com/inveniosoftware/invenio-records-rest/blob/e7b63c5f72cef03d06d3f1b4c12c0d37e3a628b9/invenio_records_rest/schemas/json.py#L24-L36
1,982
genialis/resolwe-runtime-utils
resolwe_runtime_utils.py
save_dir
def save_dir(key, dir_path, *refs): """Convert the given parameters to a special JSON object. JSON object is of the form: { key: {"dir": dir_path}}, or { key: {"dir": dir_path, "refs": [refs[0], refs[1], ... ]}} """ if not os.path.isdir(dir_path): return error( "Output '{}'...
python
def save_dir(key, dir_path, *refs): """Convert the given parameters to a special JSON object. JSON object is of the form: { key: {"dir": dir_path}}, or { key: {"dir": dir_path, "refs": [refs[0], refs[1], ... ]}} """ if not os.path.isdir(dir_path): return error( "Output '{}'...
['def', 'save_dir', '(', 'key', ',', 'dir_path', ',', '*', 'refs', ')', ':', 'if', 'not', 'os', '.', 'path', '.', 'isdir', '(', 'dir_path', ')', ':', 'return', 'error', '(', '"Output \'{}\' set to a missing directory: \'{}\'."', '.', 'format', '(', 'key', ',', 'dir_path', ')', ')', 'result', '=', '{', 'key', ':', '{', ...
Convert the given parameters to a special JSON object. JSON object is of the form: { key: {"dir": dir_path}}, or { key: {"dir": dir_path, "refs": [refs[0], refs[1], ... ]}}
['Convert', 'the', 'given', 'parameters', 'to', 'a', 'special', 'JSON', 'object', '.']
train
https://github.com/genialis/resolwe-runtime-utils/blob/5657d7cf981972a5259b9b475eae220479401001/resolwe_runtime_utils.py#L146-L173
1,983
CalebBell/fluids
fluids/fittings.py
K_tilting_disk_check_valve_Crane
def K_tilting_disk_check_valve_Crane(D, angle, fd=None): r'''Returns the loss coefficient for a tilting disk check valve as shown in [1]_. Results are specified in [1]_ to be for the disk's resting position to be at 5 or 25 degrees to the flow direction. The model is implemented here so as to switch to...
python
def K_tilting_disk_check_valve_Crane(D, angle, fd=None): r'''Returns the loss coefficient for a tilting disk check valve as shown in [1]_. Results are specified in [1]_ to be for the disk's resting position to be at 5 or 25 degrees to the flow direction. The model is implemented here so as to switch to...
['def', 'K_tilting_disk_check_valve_Crane', '(', 'D', ',', 'angle', ',', 'fd', '=', 'None', ')', ':', 'if', 'fd', 'is', 'None', ':', 'fd', '=', 'ft_Crane', '(', 'D', ')', 'if', 'angle', '<', '10', ':', '# 5 degree case', 'if', 'D', '<=', '0.2286', ':', '# 2-8 inches, split at 9 inch', 'return', '40', '*', 'fd', 'elif',...
r'''Returns the loss coefficient for a tilting disk check valve as shown in [1]_. Results are specified in [1]_ to be for the disk's resting position to be at 5 or 25 degrees to the flow direction. The model is implemented here so as to switch to the higher loss 15 degree coefficients at 10 degrees, a...
['r', 'Returns', 'the', 'loss', 'coefficient', 'for', 'a', 'tilting', 'disk', 'check', 'valve', 'as', 'shown', 'in', '[', '1', ']', '_', '.', 'Results', 'are', 'specified', 'in', '[', '1', ']', '_', 'to', 'be', 'for', 'the', 'disk', 's', 'resting', 'position', 'to', 'be', 'at', '5', 'or', '25', 'degrees', 'to', 'the', ...
train
https://github.com/CalebBell/fluids/blob/57f556752e039f1d3e5a822f408c184783db2828/fluids/fittings.py#L3536-L3617
1,984
AustralianSynchrotron/lightflow
lightflow/models/datastore.py
DataStore.exists
def exists(self, workflow_id): """ Checks whether a document with the specified workflow id already exists. Args: workflow_id (str): The workflow id that should be checked. Raises: DataStoreNotConnected: If the data store is not connected to the server. Returns...
python
def exists(self, workflow_id): """ Checks whether a document with the specified workflow id already exists. Args: workflow_id (str): The workflow id that should be checked. Raises: DataStoreNotConnected: If the data store is not connected to the server. Returns...
['def', 'exists', '(', 'self', ',', 'workflow_id', ')', ':', 'try', ':', 'db', '=', 'self', '.', '_client', '[', 'self', '.', 'database', ']', 'col', '=', 'db', '[', 'WORKFLOW_DATA_COLLECTION_NAME', ']', 'return', 'col', '.', 'find_one', '(', '{', '"_id"', ':', 'ObjectId', '(', 'workflow_id', ')', '}', ')', 'is', 'not'...
Checks whether a document with the specified workflow id already exists. Args: workflow_id (str): The workflow id that should be checked. Raises: DataStoreNotConnected: If the data store is not connected to the server. Returns: bool: ``True`` if a document ...
['Checks', 'whether', 'a', 'document', 'with', 'the', 'specified', 'workflow', 'id', 'already', 'exists', '.']
train
https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/datastore.py#L139-L157
1,985
alexandrovteam/pyimzML
pyimzml/ImzMLParser.py
ImzMLParser.__iter_read_spectrum_meta
def __iter_read_spectrum_meta(self): """ This method should only be called by __init__. Reads the data formats, coordinates and offsets from the .imzML file and initializes the respective attributes. While traversing the XML tree, the per-spectrum metadata is pruned, i.e. the <spectrumLi...
python
def __iter_read_spectrum_meta(self): """ This method should only be called by __init__. Reads the data formats, coordinates and offsets from the .imzML file and initializes the respective attributes. While traversing the XML tree, the per-spectrum metadata is pruned, i.e. the <spectrumLi...
['def', '__iter_read_spectrum_meta', '(', 'self', ')', ':', 'mz_group', '=', 'int_group', '=', 'None', 'slist', '=', 'None', 'elem_iterator', '=', 'self', '.', 'iterparse', '(', 'self', '.', 'filename', ',', 'events', '=', '(', '"start"', ',', '"end"', ')', ')', 'if', 'sys', '.', 'version_info', '>', '(', '3', ',', ')'...
This method should only be called by __init__. Reads the data formats, coordinates and offsets from the .imzML file and initializes the respective attributes. While traversing the XML tree, the per-spectrum metadata is pruned, i.e. the <spectrumList> element(s) are left behind empty. Supported ...
['This', 'method', 'should', 'only', 'be', 'called', 'by', '__init__', '.', 'Reads', 'the', 'data', 'formats', 'coordinates', 'and', 'offsets', 'from', 'the', '.', 'imzML', 'file', 'and', 'initializes', 'the', 'respective', 'attributes', '.', 'While', 'traversing', 'the', 'XML', 'tree', 'the', 'per', '-', 'spectrum', '...
train
https://github.com/alexandrovteam/pyimzML/blob/baae0bea7279f9439113d6b2f61be528c0462b3f/pyimzml/ImzMLParser.py#L115-L148
1,986
materialsproject/pymatgen
pymatgen/electronic_structure/plotter.py
BoltztrapPlotter.plot_power_factor_mu
def plot_power_factor_mu(self, temp=600, output='eig', relaxation_time=1e-14, xlim=None): """ Plot the power factor in function of Fermi level. Semi-log plot Args: temp: the temperature xlim: a list of min and max fermi energy by default (0, ...
python
def plot_power_factor_mu(self, temp=600, output='eig', relaxation_time=1e-14, xlim=None): """ Plot the power factor in function of Fermi level. Semi-log plot Args: temp: the temperature xlim: a list of min and max fermi energy by default (0, ...
['def', 'plot_power_factor_mu', '(', 'self', ',', 'temp', '=', '600', ',', 'output', '=', "'eig'", ',', 'relaxation_time', '=', '1e-14', ',', 'xlim', '=', 'None', ')', ':', 'import', 'matplotlib', '.', 'pyplot', 'as', 'plt', 'plt', '.', 'figure', '(', 'figsize', '=', '(', '9', ',', '7', ')', ')', 'pf', '=', 'self', '.'...
Plot the power factor in function of Fermi level. Semi-log plot Args: temp: the temperature xlim: a list of min and max fermi energy by default (0, and band gap) tau: A relaxation time in s. By default none and the plot is by units of relaxatio...
['Plot', 'the', 'power', 'factor', 'in', 'function', 'of', 'Fermi', 'level', '.', 'Semi', '-', 'log', 'plot']
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/plotter.py#L2797-L2831
1,987
nutechsoftware/alarmdecoder
alarmdecoder/decoder.py
AlarmDecoder._handle_rfx
def _handle_rfx(self, data): """ Handle RF messages. :param data: RF message to parse :type data: string :returns: :py:class:`~alarmdecoder.messages.RFMessage` """ msg = RFMessage(data) self.on_rfx_message(message=msg) return msg
python
def _handle_rfx(self, data): """ Handle RF messages. :param data: RF message to parse :type data: string :returns: :py:class:`~alarmdecoder.messages.RFMessage` """ msg = RFMessage(data) self.on_rfx_message(message=msg) return msg
['def', '_handle_rfx', '(', 'self', ',', 'data', ')', ':', 'msg', '=', 'RFMessage', '(', 'data', ')', 'self', '.', 'on_rfx_message', '(', 'message', '=', 'msg', ')', 'return', 'msg']
Handle RF messages. :param data: RF message to parse :type data: string :returns: :py:class:`~alarmdecoder.messages.RFMessage`
['Handle', 'RF', 'messages', '.']
train
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/alarmdecoder/decoder.py#L499-L512
1,988
ska-sa/katcp-python
katcp/client.py
DeviceClient.until_protocol
def until_protocol(self, timeout=None): """Return future that resolves after receipt of katcp protocol info. If the returned future resolves, the server's protocol information is available in the ProtocolFlags instance self.protocol_flags. """ t0 = self.ioloop.time() yi...
python
def until_protocol(self, timeout=None): """Return future that resolves after receipt of katcp protocol info. If the returned future resolves, the server's protocol information is available in the ProtocolFlags instance self.protocol_flags. """ t0 = self.ioloop.time() yi...
['def', 'until_protocol', '(', 'self', ',', 'timeout', '=', 'None', ')', ':', 't0', '=', 'self', '.', 'ioloop', '.', 'time', '(', ')', 'yield', 'self', '.', 'until_running', '(', 'timeout', '=', 'timeout', ')', 't1', '=', 'self', '.', 'ioloop', '.', 'time', '(', ')', 'if', 'timeout', ':', 'timedelta', '=', 'timeout', '...
Return future that resolves after receipt of katcp protocol info. If the returned future resolves, the server's protocol information is available in the ProtocolFlags instance self.protocol_flags.
['Return', 'future', 'that', 'resolves', 'after', 'receipt', 'of', 'katcp', 'protocol', 'info', '.']
train
https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L972-L987
1,989
Tanganelli/CoAPthon3
coapthon/layers/messagelayer.py
MessageLayer.fetch_mid
def fetch_mid(self): """ Gets the next valid MID. :return: the mid to use """ current_mid = self._current_mid self._current_mid += 1 self._current_mid %= 65535 return current_mid
python
def fetch_mid(self): """ Gets the next valid MID. :return: the mid to use """ current_mid = self._current_mid self._current_mid += 1 self._current_mid %= 65535 return current_mid
['def', 'fetch_mid', '(', 'self', ')', ':', 'current_mid', '=', 'self', '.', '_current_mid', 'self', '.', '_current_mid', '+=', '1', 'self', '.', '_current_mid', '%=', '65535', 'return', 'current_mid']
Gets the next valid MID. :return: the mid to use
['Gets', 'the', 'next', 'valid', 'MID', '.']
train
https://github.com/Tanganelli/CoAPthon3/blob/985763bfe2eb9e00f49ec100c5b8877c2ed7d531/coapthon/layers/messagelayer.py#L40-L49
1,990
doloopwhile/PyExecJS
execjs/_external_runtime.py
_find_executable
def _find_executable(prog, pathext=("",)): """protected""" pathlist = _decode_if_not_text(os.environ.get('PATH', '')).split(os.pathsep) for dir in pathlist: for ext in pathext: filename = os.path.join(dir, prog + ext) try: st = os.stat(filename) e...
python
def _find_executable(prog, pathext=("",)): """protected""" pathlist = _decode_if_not_text(os.environ.get('PATH', '')).split(os.pathsep) for dir in pathlist: for ext in pathext: filename = os.path.join(dir, prog + ext) try: st = os.stat(filename) e...
['def', '_find_executable', '(', 'prog', ',', 'pathext', '=', '(', '""', ',', ')', ')', ':', 'pathlist', '=', '_decode_if_not_text', '(', 'os', '.', 'environ', '.', 'get', '(', "'PATH'", ',', "''", ')', ')', '.', 'split', '(', 'os', '.', 'pathsep', ')', 'for', 'dir', 'in', 'pathlist', ':', 'for', 'ext', 'in', 'pathext'...
protected
['protected']
train
https://github.com/doloopwhile/PyExecJS/blob/e300f0a8120c0b7b70eed0758c3c85a9bd1a7b9f/execjs/_external_runtime.py#L182-L195
1,991
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_1/graph/graph_client.py
GraphClient.set_avatar
def set_avatar(self, avatar, subject_descriptor): """SetAvatar. [Preview API] :param :class:`<Avatar> <azure.devops.v5_1.graph.models.Avatar>` avatar: :param str subject_descriptor: """ route_values = {} if subject_descriptor is not None: route_values[...
python
def set_avatar(self, avatar, subject_descriptor): """SetAvatar. [Preview API] :param :class:`<Avatar> <azure.devops.v5_1.graph.models.Avatar>` avatar: :param str subject_descriptor: """ route_values = {} if subject_descriptor is not None: route_values[...
['def', 'set_avatar', '(', 'self', ',', 'avatar', ',', 'subject_descriptor', ')', ':', 'route_values', '=', '{', '}', 'if', 'subject_descriptor', 'is', 'not', 'None', ':', 'route_values', '[', "'subjectDescriptor'", ']', '=', 'self', '.', '_serialize', '.', 'url', '(', "'subject_descriptor'", ',', 'subject_descriptor',...
SetAvatar. [Preview API] :param :class:`<Avatar> <azure.devops.v5_1.graph.models.Avatar>` avatar: :param str subject_descriptor:
['SetAvatar', '.', '[', 'Preview', 'API', ']', ':', 'param', ':', 'class', ':', '<Avatar', '>', '<azure', '.', 'devops', '.', 'v5_1', '.', 'graph', '.', 'models', '.', 'Avatar', '>', 'avatar', ':', ':', 'param', 'str', 'subject_descriptor', ':']
train
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_1/graph/graph_client.py#L64-L78
1,992
unbit/davvy
davvy/__init__.py
register_prop
def register_prop(name, handler_get, handler_set): """ register a property handler """ global props_get, props_set if handler_get: props_get[name] = handler_get if handler_set: props_set[name] = handler_set
python
def register_prop(name, handler_get, handler_set): """ register a property handler """ global props_get, props_set if handler_get: props_get[name] = handler_get if handler_set: props_set[name] = handler_set
['def', 'register_prop', '(', 'name', ',', 'handler_get', ',', 'handler_set', ')', ':', 'global', 'props_get', ',', 'props_set', 'if', 'handler_get', ':', 'props_get', '[', 'name', ']', '=', 'handler_get', 'if', 'handler_set', ':', 'props_set', '[', 'name', ']', '=', 'handler_set']
register a property handler
['register', 'a', 'property', 'handler']
train
https://github.com/unbit/davvy/blob/d9cd95fba25dbc76d80955bbbe5ff9d7cf52268a/davvy/__init__.py#L9-L17
1,993
sibirrer/lenstronomy
lenstronomy/ImSim/MultiBand/multi_frame.py
MultiFrame.image_linear_solve
def image_linear_solve(self, kwargs_lens, kwargs_source, kwargs_lens_light, kwargs_ps, inv_bool=False): """ computes the image (lens and source surface brightness with a given lens model). The linear parameters are computed with a weighted linear least square optimization (i.e. flux normalizatio...
python
def image_linear_solve(self, kwargs_lens, kwargs_source, kwargs_lens_light, kwargs_ps, inv_bool=False): """ computes the image (lens and source surface brightness with a given lens model). The linear parameters are computed with a weighted linear least square optimization (i.e. flux normalizatio...
['def', 'image_linear_solve', '(', 'self', ',', 'kwargs_lens', ',', 'kwargs_source', ',', 'kwargs_lens_light', ',', 'kwargs_ps', ',', 'inv_bool', '=', 'False', ')', ':', 'A', '=', 'self', '.', 'linear_response_matrix', '(', 'kwargs_lens', ',', 'kwargs_source', ',', 'kwargs_lens_light', ',', 'kwargs_ps', ')', 'C_D_respo...
computes the image (lens and source surface brightness with a given lens model). The linear parameters are computed with a weighted linear least square optimization (i.e. flux normalization of the brightness profiles) :param kwargs_lens: list of keyword arguments corresponding to the superposition of di...
['computes', 'the', 'image', '(', 'lens', 'and', 'source', 'surface', 'brightness', 'with', 'a', 'given', 'lens', 'model', ')', '.', 'The', 'linear', 'parameters', 'are', 'computed', 'with', 'a', 'weighted', 'linear', 'least', 'square', 'optimization', '(', 'i', '.', 'e', '.', 'flux', 'normalization', 'of', 'the', 'bri...
train
https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/ImSim/MultiBand/multi_frame.py#L50-L68
1,994
dwavesystems/dimod
dimod/binary_quadratic_model.py
BinaryQuadraticModel.add_variables_from
def add_variables_from(self, linear, vartype=None): """Add variables and/or linear biases to a binary quadratic model. Args: linear (dict[variable, bias]/iterable[(variable, bias)]): A collection of variables and their linear biases to add to the model. If a ...
python
def add_variables_from(self, linear, vartype=None): """Add variables and/or linear biases to a binary quadratic model. Args: linear (dict[variable, bias]/iterable[(variable, bias)]): A collection of variables and their linear biases to add to the model. If a ...
['def', 'add_variables_from', '(', 'self', ',', 'linear', ',', 'vartype', '=', 'None', ')', ':', 'if', 'isinstance', '(', 'linear', ',', 'abc', '.', 'Mapping', ')', ':', 'for', 'v', ',', 'bias', 'in', 'iteritems', '(', 'linear', ')', ':', 'self', '.', 'add_variable', '(', 'v', ',', 'bias', ',', 'vartype', '=', 'vartype...
Add variables and/or linear biases to a binary quadratic model. Args: linear (dict[variable, bias]/iterable[(variable, bias)]): A collection of variables and their linear biases to add to the model. If a dict, keys are variables in the binary quadratic model and ...
['Add', 'variables', 'and', '/', 'or', 'linear', 'biases', 'to', 'a', 'binary', 'quadratic', 'model', '.']
train
https://github.com/dwavesystems/dimod/blob/beff1b7f86b559d923ac653c1de6d593876d6d38/dimod/binary_quadratic_model.py#L459-L504
1,995
django-fluent/django-fluent-contents
fluent_contents/admin/placeholderfield.py
PlaceholderFieldAdmin.get_placeholder_data
def get_placeholder_data(self, request, obj=None): """ Return the data of the placeholder fields. """ # Return all placeholder fields in the model. if not hasattr(self.model, '_meta_placeholder_fields'): return [] data = [] for name, field in self.mod...
python
def get_placeholder_data(self, request, obj=None): """ Return the data of the placeholder fields. """ # Return all placeholder fields in the model. if not hasattr(self.model, '_meta_placeholder_fields'): return [] data = [] for name, field in self.mod...
['def', 'get_placeholder_data', '(', 'self', ',', 'request', ',', 'obj', '=', 'None', ')', ':', '# Return all placeholder fields in the model.', 'if', 'not', 'hasattr', '(', 'self', '.', 'model', ',', "'_meta_placeholder_fields'", ')', ':', 'return', '[', ']', 'data', '=', '[', ']', 'for', 'name', ',', 'field', 'in', '...
Return the data of the placeholder fields.
['Return', 'the', 'data', 'of', 'the', 'placeholder', 'fields', '.']
train
https://github.com/django-fluent/django-fluent-contents/blob/896f14add58471b98d7aa295b2c9e6abedec9003/fluent_contents/admin/placeholderfield.py#L55-L72
1,996
thombashi/pytablereader
pytablereader/csv/core.py
CsvTableTextLoader.load
def load(self): """ Extract tabular data as |TableData| instances from a CSV text object. |load_source_desc_text| :return: Loaded table data. |load_table_name_desc| =================== ======================================== Format spec...
python
def load(self): """ Extract tabular data as |TableData| instances from a CSV text object. |load_source_desc_text| :return: Loaded table data. |load_table_name_desc| =================== ======================================== Format spec...
['def', 'load', '(', 'self', ')', ':', 'self', '.', '_validate', '(', ')', 'self', '.', '_logger', '.', 'logging_load', '(', ')', 'self', '.', '_csv_reader', '=', 'csv', '.', 'reader', '(', 'six', '.', 'StringIO', '(', 'self', '.', 'source', '.', 'strip', '(', ')', ')', ',', 'delimiter', '=', 'self', '.', 'delimiter', ...
Extract tabular data as |TableData| instances from a CSV text object. |load_source_desc_text| :return: Loaded table data. |load_table_name_desc| =================== ======================================== Format specifier Value after the replacemen...
['Extract', 'tabular', 'data', 'as', '|TableData|', 'instances', 'from', 'a', 'CSV', 'text', 'object', '.', '|load_source_desc_text|']
train
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/csv/core.py#L220-L258
1,997
sixty-north/asq
asq/queryables.py
Queryable.of_type
def of_type(self, classinfo): '''Filters elements according to whether they are of a certain type. Note: This method uses deferred execution. Args: classinfo: If classinfo is neither a class object nor a type object it may be a tuple of class or type objects, or may...
python
def of_type(self, classinfo): '''Filters elements according to whether they are of a certain type. Note: This method uses deferred execution. Args: classinfo: If classinfo is neither a class object nor a type object it may be a tuple of class or type objects, or may...
['def', 'of_type', '(', 'self', ',', 'classinfo', ')', ':', 'if', 'self', '.', 'closed', '(', ')', ':', 'raise', 'ValueError', '(', '"Attempt to call of_type() on a closed "', '"Queryable."', ')', 'if', 'not', 'is_type', '(', 'classinfo', ')', ':', 'raise', 'TypeError', '(', '"of_type() parameter classinfo={0} is not a...
Filters elements according to whether they are of a certain type. Note: This method uses deferred execution. Args: classinfo: If classinfo is neither a class object nor a type object it may be a tuple of class or type objects, or may recursively contain othe...
['Filters', 'elements', 'according', 'to', 'whether', 'they', 'are', 'of', 'a', 'certain', 'type', '.']
train
https://github.com/sixty-north/asq/blob/db0c4cbcf2118435136d4b63c62a12711441088e/asq/queryables.py#L578-L607
1,998
rosenbrockc/acorn
acorn/ipython.py
InteractiveDecorator.pre_run_cell
def pre_run_cell(self, cellno, code): """Executes before the user-entered code in `ipython` is run. This intercepts loops and other problematic code that would produce lots of database entries and streamlines it to produce only a single entry. Args: cellno (int): the cell nu...
python
def pre_run_cell(self, cellno, code): """Executes before the user-entered code in `ipython` is run. This intercepts loops and other problematic code that would produce lots of database entries and streamlines it to produce only a single entry. Args: cellno (int): the cell nu...
['def', 'pre_run_cell', '(', 'self', ',', 'cellno', ',', 'code', ')', ':', '#First, we look for loops and list/dict comprehensions in the code. Find', '#the id of the latest cell that was executed.', 'self', '.', 'cellid', '=', 'cellno', '#If there is a loop somewhere in the code, it could generate millions of', '#data...
Executes before the user-entered code in `ipython` is run. This intercepts loops and other problematic code that would produce lots of database entries and streamlines it to produce only a single entry. Args: cellno (int): the cell number that is about to be executed. co...
['Executes', 'before', 'the', 'user', '-', 'entered', 'code', 'in', 'ipython', 'is', 'run', '.', 'This', 'intercepts', 'loops', 'and', 'other', 'problematic', 'code', 'that', 'would', 'produce', 'lots', 'of', 'database', 'entries', 'and', 'streamlines', 'it', 'to', 'produce', 'only', 'a', 'single', 'entry', '.']
train
https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/ipython.py#L421-L451
1,999
PmagPy/PmagPy
pmagpy/pmag.py
measurements_methods
def measurements_methods(meas_data, noave): """ get list of unique specs """ # version_num = get_version() sids = get_specs(meas_data) # list of measurement records for this specimen # # step through spec by spec # SpecTmps, SpecOuts = [], [] for spec in sids: TRM, IRM3D, ATRM, CR =...
python
def measurements_methods(meas_data, noave): """ get list of unique specs """ # version_num = get_version() sids = get_specs(meas_data) # list of measurement records for this specimen # # step through spec by spec # SpecTmps, SpecOuts = [], [] for spec in sids: TRM, IRM3D, ATRM, CR =...
['def', 'measurements_methods', '(', 'meas_data', ',', 'noave', ')', ':', '#', 'version_num', '=', 'get_version', '(', ')', 'sids', '=', 'get_specs', '(', 'meas_data', ')', '# list of measurement records for this specimen', '#', '# step through spec by spec', '#', 'SpecTmps', ',', 'SpecOuts', '=', '[', ']', ',', '[', ...
get list of unique specs
['get', 'list', 'of', 'unique', 'specs']
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L7745-L8254