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
4,700
Esri/ArcREST
src/arcrest/cmp/community.py
CommunityMapsProgram.metadataURL
def metadataURL(self, value): """gets/sets the public metadata url""" if value != self._metadataURL: self._metadataURL = value self._metaFS = None
python
def metadataURL(self, value): """gets/sets the public metadata url""" if value != self._metadataURL: self._metadataURL = value self._metaFS = None
['def', 'metadataURL', '(', 'self', ',', 'value', ')', ':', 'if', 'value', '!=', 'self', '.', '_metadataURL', ':', 'self', '.', '_metadataURL', '=', 'value', 'self', '.', '_metaFS', '=', 'None']
gets/sets the public metadata url
['gets', '/', 'sets', 'the', 'public', 'metadata', 'url']
train
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/cmp/community.py#L101-L105
4,701
bitcraze/crazyflie-lib-python
cflib/crazyflie/mem.py
LocoMemory2.update_data
def update_data(self, update_data_finished_cb): """Request an update of the anchor data""" if not self._update_data_finished_cb and self.nr_of_anchors > 0: self._update_data_finished_cb = update_data_finished_cb self.anchor_data = {} self.data_valid = False ...
python
def update_data(self, update_data_finished_cb): """Request an update of the anchor data""" if not self._update_data_finished_cb and self.nr_of_anchors > 0: self._update_data_finished_cb = update_data_finished_cb self.anchor_data = {} self.data_valid = False ...
['def', 'update_data', '(', 'self', ',', 'update_data_finished_cb', ')', ':', 'if', 'not', 'self', '.', '_update_data_finished_cb', 'and', 'self', '.', 'nr_of_anchors', '>', '0', ':', 'self', '.', '_update_data_finished_cb', '=', 'update_data_finished_cb', 'self', '.', 'anchor_data', '=', '{', '}', 'self', '.', 'data_v...
Request an update of the anchor data
['Request', 'an', 'update', 'of', 'the', 'anchor', 'data']
train
https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/mem.py#L604-L617
4,702
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
xmlTextReader.SetParserProp
def SetParserProp(self, prop, value): """Change the parser processing behaviour by changing some of its internal properties. Note that some properties can only be changed before any read has been done. """ ret = libxml2mod.xmlTextReaderSetParserProp(self._o, prop, value) ret...
python
def SetParserProp(self, prop, value): """Change the parser processing behaviour by changing some of its internal properties. Note that some properties can only be changed before any read has been done. """ ret = libxml2mod.xmlTextReaderSetParserProp(self._o, prop, value) ret...
['def', 'SetParserProp', '(', 'self', ',', 'prop', ',', 'value', ')', ':', 'ret', '=', 'libxml2mod', '.', 'xmlTextReaderSetParserProp', '(', 'self', '.', '_o', ',', 'prop', ',', 'value', ')', 'return', 'ret']
Change the parser processing behaviour by changing some of its internal properties. Note that some properties can only be changed before any read has been done.
['Change', 'the', 'parser', 'processing', 'behaviour', 'by', 'changing', 'some', 'of', 'its', 'internal', 'properties', '.', 'Note', 'that', 'some', 'properties', 'can', 'only', 'be', 'changed', 'before', 'any', 'read', 'has', 'been', 'done', '.']
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L6903-L6908
4,703
backbohne/docx-xslt
docxxslt/engines.py
XslEngine.render
def render(self, xml, context, raise_on_errors=True): """Render xml string and apply XSLT transfomation with context""" if xml: self.xml = xml # render XSL self.render_xsl(self.root, context) # create root XSL sheet xsl_ns = self.namespaces[...
python
def render(self, xml, context, raise_on_errors=True): """Render xml string and apply XSLT transfomation with context""" if xml: self.xml = xml # render XSL self.render_xsl(self.root, context) # create root XSL sheet xsl_ns = self.namespaces[...
['def', 'render', '(', 'self', ',', 'xml', ',', 'context', ',', 'raise_on_errors', '=', 'True', ')', ':', 'if', 'xml', ':', 'self', '.', 'xml', '=', 'xml', '# render XSL', 'self', '.', 'render_xsl', '(', 'self', '.', 'root', ',', 'context', ')', '# create root XSL sheet', 'xsl_ns', '=', 'self', '.', 'namespaces', '[', ...
Render xml string and apply XSLT transfomation with context
['Render', 'xml', 'string', 'and', 'apply', 'XSLT', 'transfomation', 'with', 'context']
train
https://github.com/backbohne/docx-xslt/blob/d4cc76776a75b8213660c3c1717d42afe5189e15/docxxslt/engines.py#L105-L151
4,704
saltstack/salt
salt/modules/kubernetesmod.py
services
def services(namespace='default', **kwargs): ''' Return a list of kubernetes services defined in the namespace CLI Examples:: salt '*' kubernetes.services salt '*' kubernetes.services namespace=default ''' cfg = _setup_conn(**kwargs) try: api_instance = kubernetes.clien...
python
def services(namespace='default', **kwargs): ''' Return a list of kubernetes services defined in the namespace CLI Examples:: salt '*' kubernetes.services salt '*' kubernetes.services namespace=default ''' cfg = _setup_conn(**kwargs) try: api_instance = kubernetes.clien...
['def', 'services', '(', 'namespace', '=', "'default'", ',', '*', '*', 'kwargs', ')', ':', 'cfg', '=', '_setup_conn', '(', '*', '*', 'kwargs', ')', 'try', ':', 'api_instance', '=', 'kubernetes', '.', 'client', '.', 'CoreV1Api', '(', ')', 'api_response', '=', 'api_instance', '.', 'list_namespaced_service', '(', 'namespa...
Return a list of kubernetes services defined in the namespace CLI Examples:: salt '*' kubernetes.services salt '*' kubernetes.services namespace=default
['Return', 'a', 'list', 'of', 'kubernetes', 'services', 'defined', 'in', 'the', 'namespace']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L457-L482
4,705
BlueBrain/hpcbench
hpcbench/toolbox/process.py
find_executable
def find_executable(name, names=None, required=True): """Utility function to find an executable in PATH name: program to find. Use given value if absolute path names: list of additional names. For instance >>> find_executable('sed', names=['gsed']) required: If True, then the function raises a...
python
def find_executable(name, names=None, required=True): """Utility function to find an executable in PATH name: program to find. Use given value if absolute path names: list of additional names. For instance >>> find_executable('sed', names=['gsed']) required: If True, then the function raises a...
['def', 'find_executable', '(', 'name', ',', 'names', '=', 'None', ',', 'required', '=', 'True', ')', ':', 'path_from_env', '=', 'os', '.', 'environ', '.', 'get', '(', 'name', '.', 'upper', '(', ')', ')', 'if', 'path_from_env', 'is', 'not', 'None', ':', 'return', 'path_from_env', 'names', '=', '[', 'name', ']', '+', '(...
Utility function to find an executable in PATH name: program to find. Use given value if absolute path names: list of additional names. For instance >>> find_executable('sed', names=['gsed']) required: If True, then the function raises an Exception if the program is not found else the function...
['Utility', 'function', 'to', 'find', 'an', 'executable', 'in', 'PATH', 'name', ':', 'program', 'to', 'find', '.', 'Use', 'given', 'value', 'if', 'absolute', 'path']
train
https://github.com/BlueBrain/hpcbench/blob/192d0ec142b897157ec25f131d1ef28f84752592/hpcbench/toolbox/process.py#L28-L54
4,706
vertexproject/synapse
synapse/cortex.py
CoreApi.delTrigger
async def delTrigger(self, iden): ''' Deletes a trigger from the cortex ''' trig = self.cell.triggers.get(iden) self._trig_auth_check(trig.get('useriden')) self.cell.triggers.delete(iden)
python
async def delTrigger(self, iden): ''' Deletes a trigger from the cortex ''' trig = self.cell.triggers.get(iden) self._trig_auth_check(trig.get('useriden')) self.cell.triggers.delete(iden)
['async', 'def', 'delTrigger', '(', 'self', ',', 'iden', ')', ':', 'trig', '=', 'self', '.', 'cell', '.', 'triggers', '.', 'get', '(', 'iden', ')', 'self', '.', '_trig_auth_check', '(', 'trig', '.', 'get', '(', "'useriden'", ')', ')', 'self', '.', 'cell', '.', 'triggers', '.', 'delete', '(', 'iden', ')']
Deletes a trigger from the cortex
['Deletes', 'a', 'trigger', 'from', 'the', 'cortex']
train
https://github.com/vertexproject/synapse/blob/22e67c5a8f6d7caddbcf34b39ab1bd2d6c4a6e0b/synapse/cortex.py#L217-L223
4,707
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
segment_radial_distances
def segment_radial_distances(neurites, neurite_type=NeuriteType.all, origin=None): '''Lengths of the segments in a collection of neurites''' def _seg_rd(sec, pos): '''list of radial distances of all segments of a section''' # TODO: remove this disable when pylint is fixed # pylint: disab...
python
def segment_radial_distances(neurites, neurite_type=NeuriteType.all, origin=None): '''Lengths of the segments in a collection of neurites''' def _seg_rd(sec, pos): '''list of radial distances of all segments of a section''' # TODO: remove this disable when pylint is fixed # pylint: disab...
['def', 'segment_radial_distances', '(', 'neurites', ',', 'neurite_type', '=', 'NeuriteType', '.', 'all', ',', 'origin', '=', 'None', ')', ':', 'def', '_seg_rd', '(', 'sec', ',', 'pos', ')', ':', "'''list of radial distances of all segments of a section'''", '# TODO: remove this disable when pylint is fixed', '# pylint...
Lengths of the segments in a collection of neurites
['Lengths', 'of', 'the', 'segments', 'in', 'a', 'collection', 'of', 'neurites']
train
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L263-L277
4,708
glormph/msstitch
src/app/writers/pycolator.py
write_percolator_xml
def write_percolator_xml(staticxml, feats, fn): """Given the static percolator xml root and process info nodes, and all psms and peptides as iterators in a dict {'peptide': pep_iterator, 'psm': psm_iterator}, this generates percolator out data into a file.""" # First get xml until psms opening element ...
python
def write_percolator_xml(staticxml, feats, fn): """Given the static percolator xml root and process info nodes, and all psms and peptides as iterators in a dict {'peptide': pep_iterator, 'psm': psm_iterator}, this generates percolator out data into a file.""" # First get xml until psms opening element ...
['def', 'write_percolator_xml', '(', 'staticxml', ',', 'feats', ',', 'fn', ')', ':', '# First get xml until psms opening element is found.', 'etree', '.', 'SubElement', '(', 'staticxml', ',', "'psms'", ')', '.', 'text', '=', "'***psms***'", 'root', '=', 'etree', '.', 'tostring', '(', 'staticxml', ',', 'pretty_print', '...
Given the static percolator xml root and process info nodes, and all psms and peptides as iterators in a dict {'peptide': pep_iterator, 'psm': psm_iterator}, this generates percolator out data into a file.
['Given', 'the', 'static', 'percolator', 'xml', 'root', 'and', 'process', 'info', 'nodes', 'and', 'all', 'psms', 'and', 'peptides', 'as', 'iterators', 'in', 'a', 'dict', '{', 'peptide', ':', 'pep_iterator', 'psm', ':', 'psm_iterator', '}', 'this', 'generates', 'percolator', 'out', 'data', 'into', 'a', 'file', '.']
train
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/writers/pycolator.py#L4-L37
4,709
KrzyHonk/bpmn-python
bpmn_python/graph/classes/events/throw_event_type.py
ThrowEvent.set_event_definition_list
def set_event_definition_list(self, value): """ Setter for 'event_definition_list' field. :param value - a new value of 'event_definition_list' field. Must be a list of EventDefinition objects """ if value is None or not isinstance(value, list): raise TypeError("Event...
python
def set_event_definition_list(self, value): """ Setter for 'event_definition_list' field. :param value - a new value of 'event_definition_list' field. Must be a list of EventDefinition objects """ if value is None or not isinstance(value, list): raise TypeError("Event...
['def', 'set_event_definition_list', '(', 'self', ',', 'value', ')', ':', 'if', 'value', 'is', 'None', 'or', 'not', 'isinstance', '(', 'value', ',', 'list', ')', ':', 'raise', 'TypeError', '(', '"EventDefinitionList new value must be a list"', ')', 'else', ':', 'for', 'element', 'in', 'value', ':', 'if', 'not', 'isinst...
Setter for 'event_definition_list' field. :param value - a new value of 'event_definition_list' field. Must be a list of EventDefinition objects
['Setter', 'for', 'event_definition_list', 'field', '.', ':', 'param', 'value', '-', 'a', 'new', 'value', 'of', 'event_definition_list', 'field', '.', 'Must', 'be', 'a', 'list', 'of', 'EventDefinition', 'objects']
train
https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/graph/classes/events/throw_event_type.py#L30-L41
4,710
project-ncl/pnc-cli
pnc_cli/tools/config_utils.py
ConfigReader.get_dependency_structure
def get_dependency_structure(self, artifact=None, include_dependencies=False): """ Reads dependency structure. If an artifact is passed in you get only its dependencies otherwise the complete structure is returned. :param artifact: an artifact task or artifact name if only an artifact's...
python
def get_dependency_structure(self, artifact=None, include_dependencies=False): """ Reads dependency structure. If an artifact is passed in you get only its dependencies otherwise the complete structure is returned. :param artifact: an artifact task or artifact name if only an artifact's...
['def', 'get_dependency_structure', '(', 'self', ',', 'artifact', '=', 'None', ',', 'include_dependencies', '=', 'False', ')', ':', 'artifacts', '=', '[', ']', 'dependencies_dict', '=', '{', '}', 'if', 'artifact', ':', 'if', 'isinstance', '(', 'artifact', ',', 'str', ')', ':', 'artifact', '=', 'self', '.', 'get_tasks',...
Reads dependency structure. If an artifact is passed in you get only its dependencies otherwise the complete structure is returned. :param artifact: an artifact task or artifact name if only an artifact's deps are needed :param include_dependencies: flag to include also dependencies in returned...
['Reads', 'dependency', 'structure', '.', 'If', 'an', 'artifact', 'is', 'passed', 'in', 'you', 'get', 'only', 'its', 'dependencies', 'otherwise', 'the', 'complete', 'structure', 'is', 'returned', '.']
train
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/tools/config_utils.py#L149-L176
4,711
RudolfCardinal/pythonlib
cardinal_pythonlib/psychiatry/treatment_resistant_depression.py
timedelta_days
def timedelta_days(days: int) -> timedelta64: """ Convert a duration in days to a NumPy ``timedelta64`` object. """ int_days = int(days) if int_days != days: raise ValueError("Fractional days passed to timedelta_days: " "{!r}".format(days)) try: # Do not ...
python
def timedelta_days(days: int) -> timedelta64: """ Convert a duration in days to a NumPy ``timedelta64`` object. """ int_days = int(days) if int_days != days: raise ValueError("Fractional days passed to timedelta_days: " "{!r}".format(days)) try: # Do not ...
['def', 'timedelta_days', '(', 'days', ':', 'int', ')', '->', 'timedelta64', ':', 'int_days', '=', 'int', '(', 'days', ')', 'if', 'int_days', '!=', 'days', ':', 'raise', 'ValueError', '(', '"Fractional days passed to timedelta_days: "', '"{!r}"', '.', 'format', '(', 'days', ')', ')', 'try', ':', '# Do not pass e.g. 27....
Convert a duration in days to a NumPy ``timedelta64`` object.
['Convert', 'a', 'duration', 'in', 'days', 'to', 'a', 'NumPy', 'timedelta64', 'object', '.']
train
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/psychiatry/treatment_resistant_depression.py#L121-L135
4,712
xhtml2pdf/xhtml2pdf
xhtml2pdf/util.py
getFrameDimensions
def getFrameDimensions(data, page_width, page_height): """Calculate dimensions of a frame Returns left, top, width and height of the frame in points. """ box = data.get("-pdf-frame-box", []) if len(box) == 4: return [getSize(x) for x in box] top = getSize(data.get("top", 0)) left = ...
python
def getFrameDimensions(data, page_width, page_height): """Calculate dimensions of a frame Returns left, top, width and height of the frame in points. """ box = data.get("-pdf-frame-box", []) if len(box) == 4: return [getSize(x) for x in box] top = getSize(data.get("top", 0)) left = ...
['def', 'getFrameDimensions', '(', 'data', ',', 'page_width', ',', 'page_height', ')', ':', 'box', '=', 'data', '.', 'get', '(', '"-pdf-frame-box"', ',', '[', ']', ')', 'if', 'len', '(', 'box', ')', '==', '4', ':', 'return', '[', 'getSize', '(', 'x', ')', 'for', 'x', 'in', 'box', ']', 'top', '=', 'getSize', '(', 'data'...
Calculate dimensions of a frame Returns left, top, width and height of the frame in points.
['Calculate', 'dimensions', 'of', 'a', 'frame']
train
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/util.py#L372-L407
4,713
DarkEnergySurvey/ugali
ugali/utils/healpix.py
index_pix_in_pixels
def index_pix_in_pixels(pix,pixels,sort=False,outside=-1): """ Find the indices of a set of pixels into another set of pixels. !!! ASSUMES SORTED PIXELS !!! Parameters: ----------- pix : set of search pixels pixels : set of reference pixels Returns: -------- index : index ...
python
def index_pix_in_pixels(pix,pixels,sort=False,outside=-1): """ Find the indices of a set of pixels into another set of pixels. !!! ASSUMES SORTED PIXELS !!! Parameters: ----------- pix : set of search pixels pixels : set of reference pixels Returns: -------- index : index ...
['def', 'index_pix_in_pixels', '(', 'pix', ',', 'pixels', ',', 'sort', '=', 'False', ',', 'outside', '=', '-', '1', ')', ':', '# ADW: Not really safe to set index = -1 (accesses last entry); ', '# -np.inf would be better, but breaks other code...', '# ADW: Are the pixels always sorted? Is there a quick way to check?', ...
Find the indices of a set of pixels into another set of pixels. !!! ASSUMES SORTED PIXELS !!! Parameters: ----------- pix : set of search pixels pixels : set of reference pixels Returns: -------- index : index into the reference pixels
['Find', 'the', 'indices', 'of', 'a', 'set', 'of', 'pixels', 'into', 'another', 'set', 'of', 'pixels', '.', '!!!', 'ASSUMES', 'SORTED', 'PIXELS', '!!!']
train
https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/utils/healpix.py#L217-L244
4,714
joshleeb/creditcard
creditcard/formatter.py
is_visa
def is_visa(n): """Checks if credit card number fits the visa format.""" n, length = str(n), len(str(n)) if length >= 13 and length <= 16: if n[0] == '4': return True return False
python
def is_visa(n): """Checks if credit card number fits the visa format.""" n, length = str(n), len(str(n)) if length >= 13 and length <= 16: if n[0] == '4': return True return False
['def', 'is_visa', '(', 'n', ')', ':', 'n', ',', 'length', '=', 'str', '(', 'n', ')', ',', 'len', '(', 'str', '(', 'n', ')', ')', 'if', 'length', '>=', '13', 'and', 'length', '<=', '16', ':', 'if', 'n', '[', '0', ']', '==', "'4'", ':', 'return', 'True', 'return', 'False']
Checks if credit card number fits the visa format.
['Checks', 'if', 'credit', 'card', 'number', 'fits', 'the', 'visa', 'format', '.']
train
https://github.com/joshleeb/creditcard/blob/8cff49ba80029026c7e221764eb2387eb2e04a4c/creditcard/formatter.py#L1-L8
4,715
abakan-zz/napi
napi/transformers.py
NapiTransformer.visit_UnaryOp
def visit_UnaryOp(self, node): """Interfere with ``not`` operation to :func:`numpy.logical_not`.""" if isinstance(node.op, Not): self._debug('UnaryOp', node.op, incr=1) operand = self[node.operand] self._debug('|-', operand, incr=2) tn = self._tn() ...
python
def visit_UnaryOp(self, node): """Interfere with ``not`` operation to :func:`numpy.logical_not`.""" if isinstance(node.op, Not): self._debug('UnaryOp', node.op, incr=1) operand = self[node.operand] self._debug('|-', operand, incr=2) tn = self._tn() ...
['def', 'visit_UnaryOp', '(', 'self', ',', 'node', ')', ':', 'if', 'isinstance', '(', 'node', '.', 'op', ',', 'Not', ')', ':', 'self', '.', '_debug', '(', "'UnaryOp'", ',', 'node', '.', 'op', ',', 'incr', '=', '1', ')', 'operand', '=', 'self', '[', 'node', '.', 'operand', ']', 'self', '.', '_debug', '(', "'|-'", ',', '...
Interfere with ``not`` operation to :func:`numpy.logical_not`.
['Interfere', 'with', 'not', 'operation', 'to', ':', 'func', ':', 'numpy', '.', 'logical_not', '.']
train
https://github.com/abakan-zz/napi/blob/314da65bd78e2c716b7efb6deaf3816d8f38f7fd/napi/transformers.py#L422-L435
4,716
NuGrid/NuGridPy
nugridpy/mesa.py
history_data.kippenhahn
def kippenhahn(self, num_frame, xax, t0_model=0, title='Kippenhahn diagram', tp_agb=0., t_eps=5.e2, plot_star_mass=True, symbol_size=8, c12_bm=False, print_legend=True): """Kippenhahn plot as a function of time or model. Parameters ------...
python
def kippenhahn(self, num_frame, xax, t0_model=0, title='Kippenhahn diagram', tp_agb=0., t_eps=5.e2, plot_star_mass=True, symbol_size=8, c12_bm=False, print_legend=True): """Kippenhahn plot as a function of time or model. Parameters ------...
['def', 'kippenhahn', '(', 'self', ',', 'num_frame', ',', 'xax', ',', 't0_model', '=', '0', ',', 'title', '=', "'Kippenhahn diagram'", ',', 'tp_agb', '=', '0.', ',', 't_eps', '=', '5.e2', ',', 'plot_star_mass', '=', 'True', ',', 'symbol_size', '=', '8', ',', 'c12_bm', '=', 'False', ',', 'print_legend', '=', 'True', ')'...
Kippenhahn plot as a function of time or model. Parameters ---------- num_frame : integer Number of frame to plot this plot into, if <0 open no new figure. xax : string Either 'model', 'time' or 'logtimerev' to indicate what is to be used ...
['Kippenhahn', 'plot', 'as', 'a', 'function', 'of', 'time', 'or', 'model', '.']
train
https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/mesa.py#L1538-L1658
4,717
python-security/pyt
pyt/cfg/alias_helper.py
handle_aliases_in_init_files
def handle_aliases_in_init_files(name, import_alias_mapping): """Returns either None or the handled alias. Used in add_module. """ for key, val in import_alias_mapping.items(): # e.g. Foo == Foo # e.g. Foo.Bar startswith Foo. if name == val or \ name.startswith(va...
python
def handle_aliases_in_init_files(name, import_alias_mapping): """Returns either None or the handled alias. Used in add_module. """ for key, val in import_alias_mapping.items(): # e.g. Foo == Foo # e.g. Foo.Bar startswith Foo. if name == val or \ name.startswith(va...
['def', 'handle_aliases_in_init_files', '(', 'name', ',', 'import_alias_mapping', ')', ':', 'for', 'key', ',', 'val', 'in', 'import_alias_mapping', '.', 'items', '(', ')', ':', '# e.g. Foo == Foo', '# e.g. Foo.Bar startswith Foo.', 'if', 'name', '==', 'val', 'or', 'name', '.', 'startswith', '(', 'val', '+', "'.'", ')',...
Returns either None or the handled alias. Used in add_module.
['Returns', 'either', 'None', 'or', 'the', 'handled', 'alias', '.', 'Used', 'in', 'add_module', '.']
train
https://github.com/python-security/pyt/blob/efc0cfb716e40e0c8df4098f1cc8cf43723cd31f/pyt/cfg/alias_helper.py#L32-L46
4,718
atztogo/phonopy
phonopy/structure/tetrahedron_method.py
TetrahedronMethod._g_3
def _g_3(self): """omega3 < omega < omega4""" # return 3 * (1.0 - self._n_3()) / (self._vertices_omegas[3] - self._omega) return (3 * self._f(1, 3) * self._f(2, 3) / (self._vertices_omegas[3] - self._vertices_omegas[0]))
python
def _g_3(self): """omega3 < omega < omega4""" # return 3 * (1.0 - self._n_3()) / (self._vertices_omegas[3] - self._omega) return (3 * self._f(1, 3) * self._f(2, 3) / (self._vertices_omegas[3] - self._vertices_omegas[0]))
['def', '_g_3', '(', 'self', ')', ':', '# return 3 * (1.0 - self._n_3()) / (self._vertices_omegas[3] - self._omega)', 'return', '(', '3', '*', 'self', '.', '_f', '(', '1', ',', '3', ')', '*', 'self', '.', '_f', '(', '2', ',', '3', ')', '/', '(', 'self', '.', '_vertices_omegas', '[', '3', ']', '-', 'self', '.', '_vertic...
omega3 < omega < omega4
['omega3', '<', 'omega', '<', 'omega4']
train
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/tetrahedron_method.py#L450-L454
4,719
programa-stic/barf-project
barf/core/smt/smttranslator.py
SmtTranslator.get_name_init
def get_name_init(self, name): """Get initial name of symbol. """ self._register_name(name) return self._var_name_mappers[name].get_init()
python
def get_name_init(self, name): """Get initial name of symbol. """ self._register_name(name) return self._var_name_mappers[name].get_init()
['def', 'get_name_init', '(', 'self', ',', 'name', ')', ':', 'self', '.', '_register_name', '(', 'name', ')', 'return', 'self', '.', '_var_name_mappers', '[', 'name', ']', '.', 'get_init', '(', ')']
Get initial name of symbol.
['Get', 'initial', 'name', 'of', 'symbol', '.']
train
https://github.com/programa-stic/barf-project/blob/18ed9e5eace55f7bf6015ec57f037c364099021c/barf/core/smt/smttranslator.py#L138-L143
4,720
nicolargo/glances
glances/amps/glances_amp.py
GlancesAmp.load_config
def load_config(self, config): """Load AMP parameters from the configuration file.""" # Read AMP confifuration. # For ex, the AMP foo should have the following section: # # [foo] # enable=true # regex=\/usr\/bin\/nginx # refresh=60 # # and...
python
def load_config(self, config): """Load AMP parameters from the configuration file.""" # Read AMP confifuration. # For ex, the AMP foo should have the following section: # # [foo] # enable=true # regex=\/usr\/bin\/nginx # refresh=60 # # and...
['def', 'load_config', '(', 'self', ',', 'config', ')', ':', '# Read AMP confifuration.', '# For ex, the AMP foo should have the following section:', '#', '# [foo]', '# enable=true', '# regex=\\/usr\\/bin\\/nginx', '# refresh=60', '#', '# and optionnaly:', '#', '# one_line=false', '# option1=opt1', '# ...', '#', 'amp_s...
Load AMP parameters from the configuration file.
['Load', 'AMP', 'parameters', 'from', 'the', 'configuration', 'file', '.']
train
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/amps/glances_amp.py#L69-L115
4,721
minhhoit/yacms
yacms/core/templatetags/yacms_tags.py
ifinstalled
def ifinstalled(parser, token): """ Old-style ``if`` tag that renders contents if the given app is installed. The main use case is: {% ifinstalled app_name %} {% include "app_name/template.html" %} {% endifinstalled %} so we need to manually pull out all tokens if the app isn't install...
python
def ifinstalled(parser, token): """ Old-style ``if`` tag that renders contents if the given app is installed. The main use case is: {% ifinstalled app_name %} {% include "app_name/template.html" %} {% endifinstalled %} so we need to manually pull out all tokens if the app isn't install...
['def', 'ifinstalled', '(', 'parser', ',', 'token', ')', ':', 'try', ':', 'tag', ',', 'app', '=', 'token', '.', 'split_contents', '(', ')', 'except', 'ValueError', ':', 'raise', 'TemplateSyntaxError', '(', '"ifinstalled should be in the form: "', '"{% ifinstalled app_name %}"', '"{% endifinstalled %}"', ')', 'end_tag',...
Old-style ``if`` tag that renders contents if the given app is installed. The main use case is: {% ifinstalled app_name %} {% include "app_name/template.html" %} {% endifinstalled %} so we need to manually pull out all tokens if the app isn't installed, since if we used a normal ``if`` tag wit...
['Old', '-', 'style', 'if', 'tag', 'that', 'renders', 'contents', 'if', 'the', 'given', 'app', 'is', 'installed', '.', 'The', 'main', 'use', 'case', 'is', ':']
train
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/core/templatetags/yacms_tags.py#L149-L188
4,722
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_integer
def get_as_integer(self, key): """ Converts map element into an integer or returns 0 if conversion is not possible. :param key: an index of element to get. :return: integer value ot the element or 0 if conversion is not supported. """ value = self.get(key) retur...
python
def get_as_integer(self, key): """ Converts map element into an integer or returns 0 if conversion is not possible. :param key: an index of element to get. :return: integer value ot the element or 0 if conversion is not supported. """ value = self.get(key) retur...
['def', 'get_as_integer', '(', 'self', ',', 'key', ')', ':', 'value', '=', 'self', '.', 'get', '(', 'key', ')', 'return', 'IntegerConverter', '.', 'to_integer', '(', 'value', ')']
Converts map element into an integer or returns 0 if conversion is not possible. :param key: an index of element to get. :return: integer value ot the element or 0 if conversion is not supported.
['Converts', 'map', 'element', 'into', 'an', 'integer', 'or', 'returns', '0', 'if', 'conversion', 'is', 'not', 'possible', '.']
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L245-L254
4,723
openvax/varcode
varcode/nucleotides.py
is_purine
def is_purine(nucleotide, allow_extended_nucleotides=False): """Is the nucleotide a purine""" if not allow_extended_nucleotides and nucleotide not in STANDARD_NUCLEOTIDES: raise ValueError( "{} is a non-standard nucleotide, neither purine or pyrimidine".format(nucleotide)) return nucleot...
python
def is_purine(nucleotide, allow_extended_nucleotides=False): """Is the nucleotide a purine""" if not allow_extended_nucleotides and nucleotide not in STANDARD_NUCLEOTIDES: raise ValueError( "{} is a non-standard nucleotide, neither purine or pyrimidine".format(nucleotide)) return nucleot...
['def', 'is_purine', '(', 'nucleotide', ',', 'allow_extended_nucleotides', '=', 'False', ')', ':', 'if', 'not', 'allow_extended_nucleotides', 'and', 'nucleotide', 'not', 'in', 'STANDARD_NUCLEOTIDES', ':', 'raise', 'ValueError', '(', '"{} is a non-standard nucleotide, neither purine or pyrimidine"', '.', 'format', '(', ...
Is the nucleotide a purine
['Is', 'the', 'nucleotide', 'a', 'purine']
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/nucleotides.py#L55-L60
4,724
limodou/uliweb
uliweb/utils/generic.py
make_view_field
def make_view_field(field, obj=None, types_convert_map=None, fields_convert_map=None, value=__default_value__, auto_convert=True): """ If auto_convert, then all values will be converted to string format, otherwise remain the orignal value """ from uliweb.utils.textconvert import text2html...
python
def make_view_field(field, obj=None, types_convert_map=None, fields_convert_map=None, value=__default_value__, auto_convert=True): """ If auto_convert, then all values will be converted to string format, otherwise remain the orignal value """ from uliweb.utils.textconvert import text2html...
['def', 'make_view_field', '(', 'field', ',', 'obj', '=', 'None', ',', 'types_convert_map', '=', 'None', ',', 'fields_convert_map', '=', 'None', ',', 'value', '=', '__default_value__', ',', 'auto_convert', '=', 'True', ')', ':', 'from', 'uliweb', '.', 'utils', '.', 'textconvert', 'import', 'text2html', 'from', 'uliweb'...
If auto_convert, then all values will be converted to string format, otherwise remain the orignal value
['If', 'auto_convert', 'then', 'all', 'values', 'will', 'be', 'converted', 'to', 'string', 'format', 'otherwise', 'remain', 'the', 'orignal', 'value']
train
https://github.com/limodou/uliweb/blob/34472f25e4bc0b954a35346672f94e84ef18b076/uliweb/utils/generic.py#L717-L860
4,725
ericjang/tdb
tdb/debug_session.py
DebugSession.s
def s(self): """ step to the next node in the execution order """ next_node=self._exe_order[self.step] self._eval(next_node) self.step+=1 if self.step==len(self._exe_order): return self._finish() else: # if stepping, return the value of the node we just # evaled return self._break(value=self...
python
def s(self): """ step to the next node in the execution order """ next_node=self._exe_order[self.step] self._eval(next_node) self.step+=1 if self.step==len(self._exe_order): return self._finish() else: # if stepping, return the value of the node we just # evaled return self._break(value=self...
['def', 's', '(', 'self', ')', ':', 'next_node', '=', 'self', '.', '_exe_order', '[', 'self', '.', 'step', ']', 'self', '.', '_eval', '(', 'next_node', ')', 'self', '.', 'step', '+=', '1', 'if', 'self', '.', 'step', '==', 'len', '(', 'self', '.', '_exe_order', ')', ':', 'return', 'self', '.', '_finish', '(', ')', 'else...
step to the next node in the execution order
['step', 'to', 'the', 'next', 'node', 'in', 'the', 'execution', 'order']
train
https://github.com/ericjang/tdb/blob/5e78b5dbecf78b6d28eb2f5b67decf8d1f1eb17d/tdb/debug_session.py#L63-L75
4,726
fabioz/PyDev.Debugger
_pydevd_bundle/pydevd_comm.py
build_exception_info_response
def build_exception_info_response(dbg, thread_id, request_seq, set_additional_thread_info, iter_visible_frames_info, max_frames): ''' :return ExceptionInfoResponse ''' thread = pydevd_find_thread_by_id(thread_id) additional_info = set_additional_thread_info(thread) topmost_frame = additional_inf...
python
def build_exception_info_response(dbg, thread_id, request_seq, set_additional_thread_info, iter_visible_frames_info, max_frames): ''' :return ExceptionInfoResponse ''' thread = pydevd_find_thread_by_id(thread_id) additional_info = set_additional_thread_info(thread) topmost_frame = additional_inf...
['def', 'build_exception_info_response', '(', 'dbg', ',', 'thread_id', ',', 'request_seq', ',', 'set_additional_thread_info', ',', 'iter_visible_frames_info', ',', 'max_frames', ')', ':', 'thread', '=', 'pydevd_find_thread_by_id', '(', 'thread_id', ')', 'additional_info', '=', 'set_additional_thread_info', '(', 'thread...
:return ExceptionInfoResponse
[':', 'return', 'ExceptionInfoResponse']
train
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydevd_bundle/pydevd_comm.py#L1063-L1154
4,727
urbn/Caesium
caesium/handler.py
BaseHandler.get_mongo_query_from_arguments
def get_mongo_query_from_arguments(self, reserved_attributes=[]): """Generate a mongo query from the given URL query parameters, handles OR query via multiples :param list reserved_attributes: A list of attributes you want to exclude from this particular query :return: dict """ ...
python
def get_mongo_query_from_arguments(self, reserved_attributes=[]): """Generate a mongo query from the given URL query parameters, handles OR query via multiples :param list reserved_attributes: A list of attributes you want to exclude from this particular query :return: dict """ ...
['def', 'get_mongo_query_from_arguments', '(', 'self', ',', 'reserved_attributes', '=', '[', ']', ')', ':', 'query', '=', '{', '}', 'for', 'arg', 'in', 'self', '.', 'request', '.', 'arguments', ':', 'if', 'arg', 'not', 'in', 'reserved_attributes', ':', 'if', 'len', '(', 'self', '.', 'request', '.', 'arguments', '.', 'g...
Generate a mongo query from the given URL query parameters, handles OR query via multiples :param list reserved_attributes: A list of attributes you want to exclude from this particular query :return: dict
['Generate', 'a', 'mongo', 'query', 'from', 'the', 'given', 'URL', 'query', 'parameters', 'handles', 'OR', 'query', 'via', 'multiples']
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/handler.py#L108-L125
4,728
biocore/burrito-fillings
bfillings/mothur.py
Mothur.__get_method_abbrev
def __get_method_abbrev(self): """Abbreviated form of clustering method parameter. Used to guess output filenames for MOTHUR. """ abbrevs = { 'furthest': 'fn', 'nearest': 'nn', 'average': 'an', } if self.Parameters['method'].isOn(): ...
python
def __get_method_abbrev(self): """Abbreviated form of clustering method parameter. Used to guess output filenames for MOTHUR. """ abbrevs = { 'furthest': 'fn', 'nearest': 'nn', 'average': 'an', } if self.Parameters['method'].isOn(): ...
['def', '__get_method_abbrev', '(', 'self', ')', ':', 'abbrevs', '=', '{', "'furthest'", ':', "'fn'", ',', "'nearest'", ':', "'nn'", ',', "'average'", ':', "'an'", ',', '}', 'if', 'self', '.', 'Parameters', '[', "'method'", ']', '.', 'isOn', '(', ')', ':', 'method', '=', 'self', '.', 'Parameters', '[', "'method'", ']',...
Abbreviated form of clustering method parameter. Used to guess output filenames for MOTHUR.
['Abbreviated', 'form', 'of', 'clustering', 'method', 'parameter', '.']
train
https://github.com/biocore/burrito-fillings/blob/02ab71a46119b40793bd56a4ae00ca15f6dc3329/bfillings/mothur.py#L292-L306
4,729
materialsproject/pymatgen
pymatgen/command_line/aconvasp_caller.py
run_aconvasp_command
def run_aconvasp_command(command, structure): """ Helper function for calling aconvasp with different arguments """ poscar = Poscar(structure) p = subprocess.Popen(command, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE) ou...
python
def run_aconvasp_command(command, structure): """ Helper function for calling aconvasp with different arguments """ poscar = Poscar(structure) p = subprocess.Popen(command, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE) ou...
['def', 'run_aconvasp_command', '(', 'command', ',', 'structure', ')', ':', 'poscar', '=', 'Poscar', '(', 'structure', ')', 'p', '=', 'subprocess', '.', 'Popen', '(', 'command', ',', 'stdout', '=', 'subprocess', '.', 'PIPE', ',', 'stdin', '=', 'subprocess', '.', 'PIPE', ',', 'stderr', '=', 'subprocess', '.', 'PIPE', ')...
Helper function for calling aconvasp with different arguments
['Helper', 'function', 'for', 'calling', 'aconvasp', 'with', 'different', 'arguments']
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/aconvasp_caller.py#L25-L34
4,730
openbermuda/ripl
ripl/slidelayout.py
SlideLayout.layout
def layout(self, slide): """ Return layout information for slide """ image = Image.new('RGB', (WIDTH, HEIGHT), 'black') draw = ImageDraw.Draw(image) draw.font = self.font self.vertical_layout(draw, slide) self.horizontal_layout(draw, slide) ret...
python
def layout(self, slide): """ Return layout information for slide """ image = Image.new('RGB', (WIDTH, HEIGHT), 'black') draw = ImageDraw.Draw(image) draw.font = self.font self.vertical_layout(draw, slide) self.horizontal_layout(draw, slide) ret...
['def', 'layout', '(', 'self', ',', 'slide', ')', ':', 'image', '=', 'Image', '.', 'new', '(', "'RGB'", ',', '(', 'WIDTH', ',', 'HEIGHT', ')', ',', "'black'", ')', 'draw', '=', 'ImageDraw', '.', 'Draw', '(', 'image', ')', 'draw', '.', 'font', '=', 'self', '.', 'font', 'self', '.', 'vertical_layout', '(', 'draw', ',', '...
Return layout information for slide
['Return', 'layout', 'information', 'for', 'slide']
train
https://github.com/openbermuda/ripl/blob/4886b1a697e4b81c2202db9cb977609e034f8e70/ripl/slidelayout.py#L45-L56
4,731
apache/spark
python/pyspark/rdd.py
RDD.map
def map(self, f, preservesPartitioning=False): """ Return a new RDD by applying a function to each element of this RDD. >>> rdd = sc.parallelize(["b", "a", "c"]) >>> sorted(rdd.map(lambda x: (x, 1)).collect()) [('a', 1), ('b', 1), ('c', 1)] """ def func(_, iterat...
python
def map(self, f, preservesPartitioning=False): """ Return a new RDD by applying a function to each element of this RDD. >>> rdd = sc.parallelize(["b", "a", "c"]) >>> sorted(rdd.map(lambda x: (x, 1)).collect()) [('a', 1), ('b', 1), ('c', 1)] """ def func(_, iterat...
['def', 'map', '(', 'self', ',', 'f', ',', 'preservesPartitioning', '=', 'False', ')', ':', 'def', 'func', '(', '_', ',', 'iterator', ')', ':', 'return', 'map', '(', 'fail_on_stopiteration', '(', 'f', ')', ',', 'iterator', ')', 'return', 'self', '.', 'mapPartitionsWithIndex', '(', 'func', ',', 'preservesPartitioning', ...
Return a new RDD by applying a function to each element of this RDD. >>> rdd = sc.parallelize(["b", "a", "c"]) >>> sorted(rdd.map(lambda x: (x, 1)).collect()) [('a', 1), ('b', 1), ('c', 1)]
['Return', 'a', 'new', 'RDD', 'by', 'applying', 'a', 'function', 'to', 'each', 'element', 'of', 'this', 'RDD', '.']
train
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/rdd.py#L317-L327
4,732
pypa/pipenv
pipenv/vendor/attr/_make.py
fields_dict
def fields_dict(cls): """ Return an ordered dictionary of ``attrs`` attributes for a class, whose keys are the attribute names. :param type cls: Class to introspect. :raise TypeError: If *cls* is not a class. :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs`` cla...
python
def fields_dict(cls): """ Return an ordered dictionary of ``attrs`` attributes for a class, whose keys are the attribute names. :param type cls: Class to introspect. :raise TypeError: If *cls* is not a class. :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs`` cla...
['def', 'fields_dict', '(', 'cls', ')', ':', 'if', 'not', 'isclass', '(', 'cls', ')', ':', 'raise', 'TypeError', '(', '"Passed object must be a class."', ')', 'attrs', '=', 'getattr', '(', 'cls', ',', '"__attrs_attrs__"', ',', 'None', ')', 'if', 'attrs', 'is', 'None', ':', 'raise', 'NotAnAttrsClassError', '(', '"{cls!r...
Return an ordered dictionary of ``attrs`` attributes for a class, whose keys are the attribute names. :param type cls: Class to introspect. :raise TypeError: If *cls* is not a class. :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs`` class. :rtype: an ordered dict w...
['Return', 'an', 'ordered', 'dictionary', 'of', 'attrs', 'attributes', 'for', 'a', 'class', 'whose', 'keys', 'are', 'the', 'attribute', 'names', '.']
train
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/attr/_make.py#L1339-L1364
4,733
SBRG/ssbio
ssbio/protein/sequence/properties/kinetic_folding_rate.py
get_foldrate_at_temp
def get_foldrate_at_temp(ref_rate, new_temp, ref_temp=37.0): """Scale the predicted kinetic folding rate of a protein to temperature T, based on the relationship ln(k_f)∝1/T Args: ref_rate (float): Kinetic folding rate calculated from the function :func:`~ssbio.protein.sequence.properties.kinetic_foldi...
python
def get_foldrate_at_temp(ref_rate, new_temp, ref_temp=37.0): """Scale the predicted kinetic folding rate of a protein to temperature T, based on the relationship ln(k_f)∝1/T Args: ref_rate (float): Kinetic folding rate calculated from the function :func:`~ssbio.protein.sequence.properties.kinetic_foldi...
['def', 'get_foldrate_at_temp', '(', 'ref_rate', ',', 'new_temp', ',', 'ref_temp', '=', '37.0', ')', ':', '# Not much data available on this slope value, however its effect on growth rate in a model is very small', 'slope', '=', '22000', '# Get folding rate for the reference temperature', 'preFactor', '=', 'float', '('...
Scale the predicted kinetic folding rate of a protein to temperature T, based on the relationship ln(k_f)∝1/T Args: ref_rate (float): Kinetic folding rate calculated from the function :func:`~ssbio.protein.sequence.properties.kinetic_folding_rate.get_foldrate` new_temp (float): Temperature in degre...
['Scale', 'the', 'predicted', 'kinetic', 'folding', 'rate', 'of', 'a', 'protein', 'to', 'temperature', 'T', 'based', 'on', 'the', 'relationship', 'ln', '(', 'k_f', ')', '∝1', '/', 'T']
train
https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/properties/kinetic_folding_rate.py#L55-L77
4,734
fastai/fastai
fastai/text/models/awd_lstm.py
AWD_LSTM.reset
def reset(self): "Reset the hidden states." [r.reset() for r in self.rnns if hasattr(r, 'reset')] if self.qrnn: self.hidden = [self._one_hidden(l) for l in range(self.n_layers)] else: self.hidden = [(self._one_hidden(l), self._one_hidden(l)) for l in range(self.n_layers)]
python
def reset(self): "Reset the hidden states." [r.reset() for r in self.rnns if hasattr(r, 'reset')] if self.qrnn: self.hidden = [self._one_hidden(l) for l in range(self.n_layers)] else: self.hidden = [(self._one_hidden(l), self._one_hidden(l)) for l in range(self.n_layers)]
['def', 'reset', '(', 'self', ')', ':', '[', 'r', '.', 'reset', '(', ')', 'for', 'r', 'in', 'self', '.', 'rnns', 'if', 'hasattr', '(', 'r', ',', "'reset'", ')', ']', 'if', 'self', '.', 'qrnn', ':', 'self', '.', 'hidden', '=', '[', 'self', '.', '_one_hidden', '(', 'l', ')', 'for', 'l', 'in', 'range', '(', 'self', '.', '...
Reset the hidden states.
['Reset', 'the', 'hidden', 'states', '.']
train
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/text/models/awd_lstm.py#L135-L139
4,735
pysathq/pysat
pysat/formula.py
CNF.from_file
def from_file(self, fname, comment_lead=['c'], compressed_with='use_ext'): """ Read a CNF formula from a file in the DIMACS format. A file name is expected as an argument. A default argument is ``comment_lead`` for parsing comment lines. A given file can be compressed by eith...
python
def from_file(self, fname, comment_lead=['c'], compressed_with='use_ext'): """ Read a CNF formula from a file in the DIMACS format. A file name is expected as an argument. A default argument is ``comment_lead`` for parsing comment lines. A given file can be compressed by eith...
['def', 'from_file', '(', 'self', ',', 'fname', ',', 'comment_lead', '=', '[', "'c'", ']', ',', 'compressed_with', '=', "'use_ext'", ')', ':', 'with', 'FileObject', '(', 'fname', ',', 'mode', '=', "'r'", ',', 'compression', '=', 'compressed_with', ')', 'as', 'fobj', ':', 'self', '.', 'from_fp', '(', 'fobj', '.', 'fp', ...
Read a CNF formula from a file in the DIMACS format. A file name is expected as an argument. A default argument is ``comment_lead`` for parsing comment lines. A given file can be compressed by either gzip, bzip2, or lzma. :param fname: name of a file to parse. ...
['Read', 'a', 'CNF', 'formula', 'from', 'a', 'file', 'in', 'the', 'DIMACS', 'format', '.', 'A', 'file', 'name', 'is', 'expected', 'as', 'an', 'argument', '.', 'A', 'default', 'argument', 'is', 'comment_lead', 'for', 'parsing', 'comment', 'lines', '.', 'A', 'given', 'file', 'can', 'be', 'compressed', 'by', 'either', 'gz...
train
https://github.com/pysathq/pysat/blob/522742e8f2d4c6ac50ecd9087f7a346206774c67/pysat/formula.py#L409-L443
4,736
openid/python-openid
openid/extensions/draft/pape5.py
PAPEExtension._getAlias
def _getAlias(self, auth_level_uri): """Return the alias for the specified auth level URI. @raises KeyError: if no alias is defined """ for (alias, existing_uri) in self.auth_level_aliases.iteritems(): if auth_level_uri == existing_uri: return alias ...
python
def _getAlias(self, auth_level_uri): """Return the alias for the specified auth level URI. @raises KeyError: if no alias is defined """ for (alias, existing_uri) in self.auth_level_aliases.iteritems(): if auth_level_uri == existing_uri: return alias ...
['def', '_getAlias', '(', 'self', ',', 'auth_level_uri', ')', ':', 'for', '(', 'alias', ',', 'existing_uri', ')', 'in', 'self', '.', 'auth_level_aliases', '.', 'iteritems', '(', ')', ':', 'if', 'auth_level_uri', '==', 'existing_uri', ':', 'return', 'alias', 'raise', 'KeyError', '(', 'auth_level_uri', ')']
Return the alias for the specified auth level URI. @raises KeyError: if no alias is defined
['Return', 'the', 'alias', 'for', 'the', 'specified', 'auth', 'level', 'URI', '.']
train
https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/extensions/draft/pape5.py#L81-L90
4,737
romana/vpc-router
vpcrouter/vpc/__init__.py
find_instance_and_eni_by_ip
def find_instance_and_eni_by_ip(vpc_info, ip): """ Given a specific IP address, find the EC2 instance and ENI. We need this information for setting the route. Returns instance and emi in a tuple. """ for instance in vpc_info['instances']: for eni in instance.interfaces: fo...
python
def find_instance_and_eni_by_ip(vpc_info, ip): """ Given a specific IP address, find the EC2 instance and ENI. We need this information for setting the route. Returns instance and emi in a tuple. """ for instance in vpc_info['instances']: for eni in instance.interfaces: fo...
['def', 'find_instance_and_eni_by_ip', '(', 'vpc_info', ',', 'ip', ')', ':', 'for', 'instance', 'in', 'vpc_info', '[', "'instances'", ']', ':', 'for', 'eni', 'in', 'instance', '.', 'interfaces', ':', 'for', 'pa', 'in', 'eni', '.', 'private_ip_addresses', ':', 'if', 'pa', '.', 'private_ip_address', '==', 'ip', ':', 'ret...
Given a specific IP address, find the EC2 instance and ENI. We need this information for setting the route. Returns instance and emi in a tuple.
['Given', 'a', 'specific', 'IP', 'address', 'find', 'the', 'EC2', 'instance', 'and', 'ENI', '.']
train
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/vpc/__init__.py#L168-L183
4,738
iotile/coretools
iotilebuild/iotile/build/config/site_scons/autobuild.py
autobuild_arm_program
def autobuild_arm_program(elfname, test_dir=os.path.join('firmware', 'test'), patch=True): """ Build the an ARM module for all targets and build all unit tests. If pcb files are given, also build those. """ try: #Build for all targets family = utilities.get_family('module_settings.json'...
python
def autobuild_arm_program(elfname, test_dir=os.path.join('firmware', 'test'), patch=True): """ Build the an ARM module for all targets and build all unit tests. If pcb files are given, also build those. """ try: #Build for all targets family = utilities.get_family('module_settings.json'...
['def', 'autobuild_arm_program', '(', 'elfname', ',', 'test_dir', '=', 'os', '.', 'path', '.', 'join', '(', "'firmware'", ',', "'test'", ')', ',', 'patch', '=', 'True', ')', ':', 'try', ':', '#Build for all targets', 'family', '=', 'utilities', '.', 'get_family', '(', "'module_settings.json'", ')', 'family', '.', 'for_...
Build the an ARM module for all targets and build all unit tests. If pcb files are given, also build those.
['Build', 'the', 'an', 'ARM', 'module', 'for', 'all', 'targets', 'and', 'build', 'all', 'unit', 'tests', '.', 'If', 'pcb', 'files', 'are', 'given', 'also', 'build', 'those', '.']
train
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/site_scons/autobuild.py#L152-L176
4,739
fastai/fastai
fastai/widgets/image_cleaner.py
ImageCleaner.get_widgets
def get_widgets(self, duplicates): "Create and format widget set." widgets = [] for (img,fp,human_readable_label) in self._all_images[:self._batch_size]: img_widget = self.make_img_widget(img, layout=Layout(height='250px', width='300px')) dropdown = self.make_dropdown_wid...
python
def get_widgets(self, duplicates): "Create and format widget set." widgets = [] for (img,fp,human_readable_label) in self._all_images[:self._batch_size]: img_widget = self.make_img_widget(img, layout=Layout(height='250px', width='300px')) dropdown = self.make_dropdown_wid...
['def', 'get_widgets', '(', 'self', ',', 'duplicates', ')', ':', 'widgets', '=', '[', ']', 'for', '(', 'img', ',', 'fp', ',', 'human_readable_label', ')', 'in', 'self', '.', '_all_images', '[', ':', 'self', '.', '_batch_size', ']', ':', 'img_widget', '=', 'self', '.', 'make_img_widget', '(', 'img', ',', 'layout', '=', ...
Create and format widget set.
['Create', 'and', 'format', 'widget', 'set', '.']
train
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/widgets/image_cleaner.py#L189-L201
4,740
pantsbuild/pants
contrib/node/src/python/pants/contrib/node/tasks/node_task.py
NodeTask.add_package
def add_package( self, target=None, package_manager=None, package=None, type_option=None, version_option=None, node_paths=None, workunit_name=None, workunit_labels=None): """Add an additional package using requested package_manager.""" package_manager = package_manager or self.get_package_manager(t...
python
def add_package( self, target=None, package_manager=None, package=None, type_option=None, version_option=None, node_paths=None, workunit_name=None, workunit_labels=None): """Add an additional package using requested package_manager.""" package_manager = package_manager or self.get_package_manager(t...
['def', 'add_package', '(', 'self', ',', 'target', '=', 'None', ',', 'package_manager', '=', 'None', ',', 'package', '=', 'None', ',', 'type_option', '=', 'None', ',', 'version_option', '=', 'None', ',', 'node_paths', '=', 'None', ',', 'workunit_name', '=', 'None', ',', 'workunit_labels', '=', 'None', ')', ':', 'packag...
Add an additional package using requested package_manager.
['Add', 'an', 'additional', 'package', 'using', 'requested', 'package_manager', '.']
train
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/contrib/node/src/python/pants/contrib/node/tasks/node_task.py#L83-L96
4,741
kblin/ncbi-genome-download
ncbi_genome_download/core.py
get_strain_label
def get_strain_label(entry, viral=False): """Try to extract a strain from an assemly summary entry. First this checks 'infraspecific_name', then 'isolate', then it tries to get it from 'organism_name'. If all fails, it falls back to just returning the assembly accesion number. """ def get_strai...
python
def get_strain_label(entry, viral=False): """Try to extract a strain from an assemly summary entry. First this checks 'infraspecific_name', then 'isolate', then it tries to get it from 'organism_name'. If all fails, it falls back to just returning the assembly accesion number. """ def get_strai...
['def', 'get_strain_label', '(', 'entry', ',', 'viral', '=', 'False', ')', ':', 'def', 'get_strain', '(', 'entry', ')', ':', 'strain', '=', 'entry', '[', "'infraspecific_name'", ']', 'if', 'strain', '!=', "''", ':', 'strain', '=', 'strain', '.', 'split', '(', "'='", ')', '[', '-', '1', ']', 'return', 'strain', 'strain'...
Try to extract a strain from an assemly summary entry. First this checks 'infraspecific_name', then 'isolate', then it tries to get it from 'organism_name'. If all fails, it falls back to just returning the assembly accesion number.
['Try', 'to', 'extract', 'a', 'strain', 'from', 'an', 'assemly', 'summary', 'entry', '.']
train
https://github.com/kblin/ncbi-genome-download/blob/dc55382d351c29e1027be8fa3876701762c1d752/ncbi_genome_download/core.py#L582-L613
4,742
angr/angr
angr/sim_manager.py
SimulationManager.move
def move(self, from_stash, to_stash, filter_func=None): """ Move states from one stash to another. :param from_stash: Take matching states from this stash. :param to_stash: Put matching states into this stash. :param filter_func: Stash states that match this filter. Should b...
python
def move(self, from_stash, to_stash, filter_func=None): """ Move states from one stash to another. :param from_stash: Take matching states from this stash. :param to_stash: Put matching states into this stash. :param filter_func: Stash states that match this filter. Should b...
['def', 'move', '(', 'self', ',', 'from_stash', ',', 'to_stash', ',', 'filter_func', '=', 'None', ')', ':', 'filter_func', '=', 'filter_func', 'or', '(', 'lambda', 's', ':', 'True', ')', 'stash_splitter', '=', 'lambda', 'states', ':', 'reversed', '(', 'self', '.', '_filter_states', '(', 'filter_func', ',', 'states', ')...
Move states from one stash to another. :param from_stash: Take matching states from this stash. :param to_stash: Put matching states into this stash. :param filter_func: Stash states that match this filter. Should be a function that takes a state and returns True...
['Move', 'states', 'from', 'one', 'stash', 'to', 'another', '.']
train
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_manager.py#L461-L475
4,743
awslabs/sockeye
sockeye/training.py
DecoderProcessManager.collect_results
def collect_results(self) -> Optional[Tuple[int, Dict[str, float]]]: """ Returns the decoded checkpoint and the decoder metrics or None if the queue is empty. """ self.wait_to_finish() if self.decoder_metric_queue.empty(): if self._results_pending: sel...
python
def collect_results(self) -> Optional[Tuple[int, Dict[str, float]]]: """ Returns the decoded checkpoint and the decoder metrics or None if the queue is empty. """ self.wait_to_finish() if self.decoder_metric_queue.empty(): if self._results_pending: sel...
['def', 'collect_results', '(', 'self', ')', '->', 'Optional', '[', 'Tuple', '[', 'int', ',', 'Dict', '[', 'str', ',', 'float', ']', ']', ']', ':', 'self', '.', 'wait_to_finish', '(', ')', 'if', 'self', '.', 'decoder_metric_queue', '.', 'empty', '(', ')', ':', 'if', 'self', '.', '_results_pending', ':', 'self', '.', '_...
Returns the decoded checkpoint and the decoder metrics or None if the queue is empty.
['Returns', 'the', 'decoded', 'checkpoint', 'and', 'the', 'decoder', 'metrics', 'or', 'None', 'if', 'the', 'queue', 'is', 'empty', '.']
train
https://github.com/awslabs/sockeye/blob/5d64a1ee1ef3cbba17c6d1d94bc061020c43f6ab/sockeye/training.py#L1319-L1333
4,744
gc3-uzh-ch/elasticluster
elasticluster/providers/openstack.py
OpenStackCloudProvider._check_security_groups
def _check_security_groups(self, names): """ Raise an exception if any of the named security groups does not exist. :param List[str] groups: List of security group names :raises: `SecurityGroupError` if group does not exist """ self._init_os_api() log.debug("Chec...
python
def _check_security_groups(self, names): """ Raise an exception if any of the named security groups does not exist. :param List[str] groups: List of security group names :raises: `SecurityGroupError` if group does not exist """ self._init_os_api() log.debug("Chec...
['def', '_check_security_groups', '(', 'self', ',', 'names', ')', ':', 'self', '.', '_init_os_api', '(', ')', 'log', '.', 'debug', '(', '"Checking existence of security group(s) %s ..."', ',', 'names', ')', 'try', ':', '# python-novaclient < 8.0.0', 'security_groups', '=', 'self', '.', 'nova_client', '.', 'security_gro...
Raise an exception if any of the named security groups does not exist. :param List[str] groups: List of security group names :raises: `SecurityGroupError` if group does not exist
['Raise', 'an', 'exception', 'if', 'any', 'of', 'the', 'named', 'security', 'groups', 'does', 'not', 'exist', '.']
train
https://github.com/gc3-uzh-ch/elasticluster/blob/e6345633308c76de13b889417df572815aabe744/elasticluster/providers/openstack.py#L720-L748
4,745
awslabs/serverless-application-model
samtranslator/model/intrinsics.py
is_instrinsic
def is_instrinsic(input): """ Checks if the given input is an intrinsic function dictionary. Intrinsic function is a dictionary with single key that is the name of the intrinsics. :param input: Input value to check if it is an intrinsic :return: True, if yes """ if input is not None \ ...
python
def is_instrinsic(input): """ Checks if the given input is an intrinsic function dictionary. Intrinsic function is a dictionary with single key that is the name of the intrinsics. :param input: Input value to check if it is an intrinsic :return: True, if yes """ if input is not None \ ...
['def', 'is_instrinsic', '(', 'input', ')', ':', 'if', 'input', 'is', 'not', 'None', 'and', 'isinstance', '(', 'input', ',', 'dict', ')', 'and', 'len', '(', 'input', ')', '==', '1', ':', 'key', '=', 'list', '(', 'input', '.', 'keys', '(', ')', ')', '[', '0', ']', 'return', 'key', '==', '"Ref"', 'or', 'key', '==', '"Con...
Checks if the given input is an intrinsic function dictionary. Intrinsic function is a dictionary with single key that is the name of the intrinsics. :param input: Input value to check if it is an intrinsic :return: True, if yes
['Checks', 'if', 'the', 'given', 'input', 'is', 'an', 'intrinsic', 'function', 'dictionary', '.', 'Intrinsic', 'function', 'is', 'a', 'dictionary', 'with', 'single', 'key', 'that', 'is', 'the', 'name', 'of', 'the', 'intrinsics', '.']
train
https://github.com/awslabs/serverless-application-model/blob/cccb0c96b5c91e53355ebc07e542467303a5eedd/samtranslator/model/intrinsics.py#L124-L140
4,746
DataBiosphere/toil
src/toil/leader.py
Leader._handledFailedSuccessor
def _handledFailedSuccessor(self, jobNode, jobGraph, successorJobStoreID): """Deal with the successor having failed. Return True if there are still active successors. Return False if all successors have failed and the job is queued to run to handle the failed successors.""" logger.debug(...
python
def _handledFailedSuccessor(self, jobNode, jobGraph, successorJobStoreID): """Deal with the successor having failed. Return True if there are still active successors. Return False if all successors have failed and the job is queued to run to handle the failed successors.""" logger.debug(...
['def', '_handledFailedSuccessor', '(', 'self', ',', 'jobNode', ',', 'jobGraph', ',', 'successorJobStoreID', ')', ':', 'logger', '.', 'debug', '(', '"Successor job: %s of job: %s has failed "', '""', '"predecessors"', ',', 'jobNode', ',', 'jobGraph', ')', '# Add the job to the set having failed successors', 'self', '.'...
Deal with the successor having failed. Return True if there are still active successors. Return False if all successors have failed and the job is queued to run to handle the failed successors.
['Deal', 'with', 'the', 'successor', 'having', 'failed', '.', 'Return', 'True', 'if', 'there', 'are', 'still', 'active', 'successors', '.', 'Return', 'False', 'if', 'all', 'successors', 'have', 'failed', 'and', 'the', 'job', 'is', 'queued', 'to', 'run', 'to', 'handle', 'the', 'failed', 'successors', '.']
train
https://github.com/DataBiosphere/toil/blob/a8252277ff814e7bee0971139c2344f88e44b644/src/toil/leader.py#L259-L284
4,747
IBMStreams/pypi.streamsx
streamsx/rest_primitives.py
_StreamsV4Delegator._cancel_job
def _cancel_job(self, job, force): """Cancel job using streamtool.""" import streamsx.st as st if st._has_local_install: return st._cancel_job(job.id, force, domain_id=job.get_instance().get_domain().id, instance_id=job.get_instance().id) return False
python
def _cancel_job(self, job, force): """Cancel job using streamtool.""" import streamsx.st as st if st._has_local_install: return st._cancel_job(job.id, force, domain_id=job.get_instance().get_domain().id, instance_id=job.get_instance().id) return False
['def', '_cancel_job', '(', 'self', ',', 'job', ',', 'force', ')', ':', 'import', 'streamsx', '.', 'st', 'as', 'st', 'if', 'st', '.', '_has_local_install', ':', 'return', 'st', '.', '_cancel_job', '(', 'job', '.', 'id', ',', 'force', ',', 'domain_id', '=', 'job', '.', 'get_instance', '(', ')', '.', 'get_domain', '(', '...
Cancel job using streamtool.
['Cancel', 'job', 'using', 'streamtool', '.']
train
https://github.com/IBMStreams/pypi.streamsx/blob/abd67b4757120f6f805787fba390f53e9df9cdd8/streamsx/rest_primitives.py#L2419-L2425
4,748
littlemo/moear-spider-zhihudaily
moear_spider_zhihudaily/spiders/zhihu_daily.py
ZhihuDailySpider.parse_post
def parse_post(self, response): ''' 根据 :meth:`.ZhihuDailySpider.parse` 中生成的具体文章地址,获取到文章内容, 并对其进行格式化处理,结果填充到对象属性 ``item_list`` 中 :param Response response: 由 ``Scrapy`` 调用并传入的请求响应对象 ''' content = json.loads(response.body.decode(), encoding='UTF-8') post = response....
python
def parse_post(self, response): ''' 根据 :meth:`.ZhihuDailySpider.parse` 中生成的具体文章地址,获取到文章内容, 并对其进行格式化处理,结果填充到对象属性 ``item_list`` 中 :param Response response: 由 ``Scrapy`` 调用并传入的请求响应对象 ''' content = json.loads(response.body.decode(), encoding='UTF-8') post = response....
['def', 'parse_post', '(', 'self', ',', 'response', ')', ':', 'content', '=', 'json', '.', 'loads', '(', 'response', '.', 'body', '.', 'decode', '(', ')', ',', 'encoding', '=', "'UTF-8'", ')', 'post', '=', 'response', '.', 'meta', '[', "'post'", ']', 'post', '[', "'origin_url'", ']', '=', 'content', '.', 'get', '(', "'...
根据 :meth:`.ZhihuDailySpider.parse` 中生成的具体文章地址,获取到文章内容, 并对其进行格式化处理,结果填充到对象属性 ``item_list`` 中 :param Response response: 由 ``Scrapy`` 调用并传入的请求响应对象
['根据', ':', 'meth', ':', '.', 'ZhihuDailySpider', '.', 'parse', '中生成的具体文章地址,获取到文章内容,', '并对其进行格式化处理,结果填充到对象属性', 'item_list', '中']
train
https://github.com/littlemo/moear-spider-zhihudaily/blob/1e4e60b547afe3e2fbb3bbcb7d07a75dca608149/moear_spider_zhihudaily/spiders/zhihu_daily.py#L126-L166
4,749
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
xmlNs.newNodeEatName
def newNodeEatName(self, name): """Creation of a new node element. @ns is optional (None). """ ret = libxml2mod.xmlNewNodeEatName(self._o, name) if ret is None:raise treeError('xmlNewNodeEatName() failed') __tmp = xmlNode(_obj=ret) return __tmp
python
def newNodeEatName(self, name): """Creation of a new node element. @ns is optional (None). """ ret = libxml2mod.xmlNewNodeEatName(self._o, name) if ret is None:raise treeError('xmlNewNodeEatName() failed') __tmp = xmlNode(_obj=ret) return __tmp
['def', 'newNodeEatName', '(', 'self', ',', 'name', ')', ':', 'ret', '=', 'libxml2mod', '.', 'xmlNewNodeEatName', '(', 'self', '.', '_o', ',', 'name', ')', 'if', 'ret', 'is', 'None', ':', 'raise', 'treeError', '(', "'xmlNewNodeEatName() failed'", ')', '__tmp', '=', 'xmlNode', '(', '_obj', '=', 'ret', ')', 'return', '__...
Creation of a new node element. @ns is optional (None).
['Creation', 'of', 'a', 'new', 'node', 'element', '.']
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L5946-L5951
4,750
bitesofcode/projexui
projexui/xsettings.py
XSettings.fileName
def fileName(self): """ Returns the filename. :return <str> """ if self._filename: return self._filename filename = nativestring(super(XSettings, self).fileName()) if self._customFormat: filename, ext = os.p...
python
def fileName(self): """ Returns the filename. :return <str> """ if self._filename: return self._filename filename = nativestring(super(XSettings, self).fileName()) if self._customFormat: filename, ext = os.p...
['def', 'fileName', '(', 'self', ')', ':', 'if', 'self', '.', '_filename', ':', 'return', 'self', '.', '_filename', 'filename', '=', 'nativestring', '(', 'super', '(', 'XSettings', ',', 'self', ')', '.', 'fileName', '(', ')', ')', 'if', 'self', '.', '_customFormat', ':', 'filename', ',', 'ext', '=', 'os', '.', 'path', ...
Returns the filename. :return <str>
['Returns', 'the', 'filename', '.', ':', 'return', '<str', '>']
train
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xsettings.py#L565-L578
4,751
florianpaquet/mease
mease/registry.py
Mease.sender
def sender(self, func, routing=None, routing_re=None): """ Registers a sender function """ if routing and not isinstance(routing, list): routing = [routing] if routing_re: if not isinstance(routing_re, list): routing_re = [routing_re] ...
python
def sender(self, func, routing=None, routing_re=None): """ Registers a sender function """ if routing and not isinstance(routing, list): routing = [routing] if routing_re: if not isinstance(routing_re, list): routing_re = [routing_re] ...
['def', 'sender', '(', 'self', ',', 'func', ',', 'routing', '=', 'None', ',', 'routing_re', '=', 'None', ')', ':', 'if', 'routing', 'and', 'not', 'isinstance', '(', 'routing', ',', 'list', ')', ':', 'routing', '=', '[', 'routing', ']', 'if', 'routing_re', ':', 'if', 'not', 'isinstance', '(', 'routing_re', ',', 'list', ...
Registers a sender function
['Registers', 'a', 'sender', 'function']
train
https://github.com/florianpaquet/mease/blob/b9fbd08bbe162c8890c2a2124674371170c319ef/mease/registry.py#L65-L77
4,752
dschep/ntfy
ntfy/backends/pushjet.py
notify
def notify(title, message, secret, endpoint=None, level=3, link=None, retcode=None): """ Required parameter: * ``secret`` - The Pushjet service secret token, created with http://docs.pushjet.io/docs/creating-a-new-service ...
python
def notify(title, message, secret, endpoint=None, level=3, link=None, retcode=None): """ Required parameter: * ``secret`` - The Pushjet service secret token, created with http://docs.pushjet.io/docs/creating-a-new-service ...
['def', 'notify', '(', 'title', ',', 'message', ',', 'secret', ',', 'endpoint', '=', 'None', ',', 'level', '=', '3', ',', 'link', '=', 'None', ',', 'retcode', '=', 'None', ')', ':', 'data', '=', '{', "'title'", ':', 'title', ',', "'message'", ':', 'message', ',', "'level'", ':', 'level', ',', "'secret'", ':', 'secret',...
Required parameter: * ``secret`` - The Pushjet service secret token, created with http://docs.pushjet.io/docs/creating-a-new-service Optional parameters: * ``endpoint`` - custom Pushjet API endpoint (defaults to https://api.pushjet.io) * ``level`` - The importance le...
['Required', 'parameter', ':', '*', 'secret', '-', 'The', 'Pushjet', 'service', 'secret', 'token', 'created', 'with', 'http', ':', '//', 'docs', '.', 'pushjet', '.', 'io', '/', 'docs', '/', 'creating', '-', 'a', '-', 'new', '-', 'service']
train
https://github.com/dschep/ntfy/blob/ecfeee960af406a27ebb123495e0ec2733286889/ntfy/backends/pushjet.py#L6-L42
4,753
yvesalexandre/bandicoot
bandicoot/weekmatrix.py
_extract_list_from_generator
def _extract_list_from_generator(generator): """ Iterates over a generator to extract all the objects and add them to a list. Useful when the objects have to be used multiple times. """ extracted = [] for i in generator: extracted.append(list(i)) return extracted
python
def _extract_list_from_generator(generator): """ Iterates over a generator to extract all the objects and add them to a list. Useful when the objects have to be used multiple times. """ extracted = [] for i in generator: extracted.append(list(i)) return extracted
['def', '_extract_list_from_generator', '(', 'generator', ')', ':', 'extracted', '=', '[', ']', 'for', 'i', 'in', 'generator', ':', 'extracted', '.', 'append', '(', 'list', '(', 'i', ')', ')', 'return', 'extracted']
Iterates over a generator to extract all the objects and add them to a list. Useful when the objects have to be used multiple times.
['Iterates', 'over', 'a', 'generator', 'to', 'extract', 'all', 'the', 'objects', 'and', 'add', 'them', 'to', 'a', 'list', '.', 'Useful', 'when', 'the', 'objects', 'have', 'to', 'be', 'used', 'multiple', 'times', '.']
train
https://github.com/yvesalexandre/bandicoot/blob/73a658f6f17331541cf0b1547028db9b70e8d58a/bandicoot/weekmatrix.py#L310-L319
4,754
toros-astro/corral
corral/template/template/migrations/env.py
run_migrations
def run_migrations(): """Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context. """ with engine.connect() as connection: context.configure( connection=connection, target_metadata=Model.metadata) ...
python
def run_migrations(): """Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context. """ with engine.connect() as connection: context.configure( connection=connection, target_metadata=Model.metadata) ...
['def', 'run_migrations', '(', ')', ':', 'with', 'engine', '.', 'connect', '(', ')', 'as', 'connection', ':', 'context', '.', 'configure', '(', 'connection', '=', 'connection', ',', 'target_metadata', '=', 'Model', '.', 'metadata', ')', 'with', 'context', '.', 'begin_transaction', '(', ')', ':', 'context', '.', 'run_mi...
Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context.
['Run', 'migrations', 'in', 'online', 'mode', '.']
train
https://github.com/toros-astro/corral/blob/75474b38ff366330d33644461a902d07374a5bbc/corral/template/template/migrations/env.py#L44-L57
4,755
harlowja/notifier
notifier/_notifier.py
Notifier.listeners_iter
def listeners_iter(self): """Return an iterator over the mapping of event => listeners bound. The listener list(s) returned should **not** be mutated. NOTE(harlowja): Each listener in the yielded (event, listeners) tuple is an instance of the :py:class:`~.Listener` type, which ...
python
def listeners_iter(self): """Return an iterator over the mapping of event => listeners bound. The listener list(s) returned should **not** be mutated. NOTE(harlowja): Each listener in the yielded (event, listeners) tuple is an instance of the :py:class:`~.Listener` type, which ...
['def', 'listeners_iter', '(', 'self', ')', ':', 'topics', '=', 'set', '(', 'six', '.', 'iterkeys', '(', 'self', '.', '_topics', ')', ')', 'while', 'topics', ':', 'event_type', '=', 'topics', '.', 'pop', '(', ')', 'try', ':', 'yield', 'event_type', ',', 'self', '.', '_topics', '[', 'event_type', ']', 'except', 'KeyErro...
Return an iterator over the mapping of event => listeners bound. The listener list(s) returned should **not** be mutated. NOTE(harlowja): Each listener in the yielded (event, listeners) tuple is an instance of the :py:class:`~.Listener` type, which itself wraps a provided callback (an...
['Return', 'an', 'iterator', 'over', 'the', 'mapping', 'of', 'event', '=', '>', 'listeners', 'bound', '.']
train
https://github.com/harlowja/notifier/blob/35bf58e6350b1d3a3e8c4224e9d01178df70d753/notifier/_notifier.py#L451-L467
4,756
SpriteLink/NIPAP
nipap-cli/nipap_cli/nipap_cli.py
add_pool
def add_pool(arg, opts, shell_opts): """ Add a pool. """ p = Pool() p.name = opts.get('name') p.description = opts.get('description') p.default_type = opts.get('default-type') p.ipv4_default_prefix_length = opts.get('ipv4_default_prefix_length') p.ipv6_default_prefix_length = opts.get('...
python
def add_pool(arg, opts, shell_opts): """ Add a pool. """ p = Pool() p.name = opts.get('name') p.description = opts.get('description') p.default_type = opts.get('default-type') p.ipv4_default_prefix_length = opts.get('ipv4_default_prefix_length') p.ipv6_default_prefix_length = opts.get('...
['def', 'add_pool', '(', 'arg', ',', 'opts', ',', 'shell_opts', ')', ':', 'p', '=', 'Pool', '(', ')', 'p', '.', 'name', '=', 'opts', '.', 'get', '(', "'name'", ')', 'p', '.', 'description', '=', 'opts', '.', 'get', '(', "'description'", ')', 'p', '.', 'default_type', '=', 'opts', '.', 'get', '(', "'default-type'", ')',...
Add a pool.
['Add', 'a', 'pool', '.']
train
https://github.com/SpriteLink/NIPAP/blob/f96069f11ab952d80b13cab06e0528f2d24b3de9/nipap-cli/nipap_cli/nipap_cli.py#L965-L998
4,757
googleapis/google-cloud-python
firestore/google/cloud/firestore_v1beta1/collection.py
CollectionReference.add
def add(self, document_data, document_id=None): """Create a document in the Firestore database with the provided data. Args: document_data (dict): Property names and values to use for creating the document. document_id (Optional[str]): The document identifier wit...
python
def add(self, document_data, document_id=None): """Create a document in the Firestore database with the provided data. Args: document_data (dict): Property names and values to use for creating the document. document_id (Optional[str]): The document identifier wit...
['def', 'add', '(', 'self', ',', 'document_data', ',', 'document_id', '=', 'None', ')', ':', 'if', 'document_id', 'is', 'None', ':', 'parent_path', ',', 'expected_prefix', '=', 'self', '.', '_parent_info', '(', ')', 'document_pb', '=', 'document_pb2', '.', 'Document', '(', ')', 'created_document_pb', '=', 'self', '.', ...
Create a document in the Firestore database with the provided data. Args: document_data (dict): Property names and values to use for creating the document. document_id (Optional[str]): The document identifier within the current collection. If not provided...
['Create', 'a', 'document', 'in', 'the', 'Firestore', 'database', 'with', 'the', 'provided', 'data', '.']
train
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L135-L180
4,758
dnanexus/dx-toolkit
src/python/dxpy/bindings/dxfile_functions.py
upload_string
def upload_string(to_upload, media_type=None, keep_open=False, wait_on_close=False, **kwargs): """ :param to_upload: String to upload into a file :type to_upload: string :param media_type: Internet Media Type :type media_type: string :param keep_open: If False, closes the file after uploading ...
python
def upload_string(to_upload, media_type=None, keep_open=False, wait_on_close=False, **kwargs): """ :param to_upload: String to upload into a file :type to_upload: string :param media_type: Internet Media Type :type media_type: string :param keep_open: If False, closes the file after uploading ...
['def', 'upload_string', '(', 'to_upload', ',', 'media_type', '=', 'None', ',', 'keep_open', '=', 'False', ',', 'wait_on_close', '=', 'False', ',', '*', '*', 'kwargs', ')', ':', "# Use 'a' mode because we will be responsible for closing the file", '# ourselves later (if requested).', 'handler', '=', 'new_dxfile', '(', ...
:param to_upload: String to upload into a file :type to_upload: string :param media_type: Internet Media Type :type media_type: string :param keep_open: If False, closes the file after uploading :type keep_open: boolean :param wait_on_close: If True, waits for the file to close :type wait_on...
[':', 'param', 'to_upload', ':', 'String', 'to', 'upload', 'into', 'a', 'file', ':', 'type', 'to_upload', ':', 'string', ':', 'param', 'media_type', ':', 'Internet', 'Media', 'Type', ':', 'type', 'media_type', ':', 'string', ':', 'param', 'keep_open', ':', 'If', 'False', 'closes', 'the', 'file', 'after', 'uploading', '...
train
https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxfile_functions.py#L561-L595
4,759
git-afsantos/bonsai
bonsai/model.py
CodeFunction.pretty_str
def pretty_str(self, indent=0): """Return a human-readable string representation of this object. Kwargs: indent (int): The amount of spaces to use as indentation. """ spaces = ' ' * indent params = ', '.join(map(lambda p: p.result + ' ' + p.name, ...
python
def pretty_str(self, indent=0): """Return a human-readable string representation of this object. Kwargs: indent (int): The amount of spaces to use as indentation. """ spaces = ' ' * indent params = ', '.join(map(lambda p: p.result + ' ' + p.name, ...
['def', 'pretty_str', '(', 'self', ',', 'indent', '=', '0', ')', ':', 'spaces', '=', "' '", '*', 'indent', 'params', '=', "', '", '.', 'join', '(', 'map', '(', 'lambda', 'p', ':', 'p', '.', 'result', '+', "' '", '+', 'p', '.', 'name', ',', 'self', '.', 'parameters', ')', ')', 'if', 'self', '.', 'is_constructor', ':', '...
Return a human-readable string representation of this object. Kwargs: indent (int): The amount of spaces to use as indentation.
['Return', 'a', 'human', '-', 'readable', 'string', 'representation', 'of', 'this', 'object', '.']
train
https://github.com/git-afsantos/bonsai/blob/aa5af3f535b3b506bfc95c107c501fc9c4bcd072/bonsai/model.py#L326-L344
4,760
molmod/molmod
molmod/io/gamess.py
HessianParser.read
def read(self, line, f, data): """See :meth:`PunchParser.read`""" assert("hessian" not in data) f.readline() N = len(data["symbols"]) hessian = np.zeros((3*N, 3*N), float) tmp = hessian.ravel() counter = 0 while True: line = f.readline() ...
python
def read(self, line, f, data): """See :meth:`PunchParser.read`""" assert("hessian" not in data) f.readline() N = len(data["symbols"]) hessian = np.zeros((3*N, 3*N), float) tmp = hessian.ravel() counter = 0 while True: line = f.readline() ...
['def', 'read', '(', 'self', ',', 'line', ',', 'f', ',', 'data', ')', ':', 'assert', '(', '"hessian"', 'not', 'in', 'data', ')', 'f', '.', 'readline', '(', ')', 'N', '=', 'len', '(', 'data', '[', '"symbols"', ']', ')', 'hessian', '=', 'np', '.', 'zeros', '(', '(', '3', '*', 'N', ',', '3', '*', 'N', ')', ',', 'float', '...
See :meth:`PunchParser.read`
['See', ':', 'meth', ':', 'PunchParser', '.', 'read']
train
https://github.com/molmod/molmod/blob/a7b5b4364ed514ad4c465856c05b5eda1cb561e0/molmod/io/gamess.py#L207-L223
4,761
esheldon/fitsio
fitsio/hdu/table.py
_npy2fits
def _npy2fits(d, table_type='binary', write_bitcols=False): """ d is the full element from the descr """ npy_dtype = d[1][1:] if npy_dtype[0] == 'S' or npy_dtype[0] == 'U': name, form, dim = _npy_string2fits(d, table_type=table_type) else: name, form, dim = _npy_num2fits( ...
python
def _npy2fits(d, table_type='binary', write_bitcols=False): """ d is the full element from the descr """ npy_dtype = d[1][1:] if npy_dtype[0] == 'S' or npy_dtype[0] == 'U': name, form, dim = _npy_string2fits(d, table_type=table_type) else: name, form, dim = _npy_num2fits( ...
['def', '_npy2fits', '(', 'd', ',', 'table_type', '=', "'binary'", ',', 'write_bitcols', '=', 'False', ')', ':', 'npy_dtype', '=', 'd', '[', '1', ']', '[', '1', ':', ']', 'if', 'npy_dtype', '[', '0', ']', '==', "'S'", 'or', 'npy_dtype', '[', '0', ']', '==', "'U'", ':', 'name', ',', 'form', ',', 'dim', '=', '_npy_string...
d is the full element from the descr
['d', 'is', 'the', 'full', 'element', 'from', 'the', 'descr']
train
https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L2106-L2117
4,762
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceBinSession.get_bin_ids_by_resource
def get_bin_ids_by_resource(self, resource_id): """Gets the list of ``Bin`` ``Ids`` mapped to a ``Resource``. arg: resource_id (osid.id.Id): ``Id`` of a ``Resource`` return: (osid.id.IdList) - list of bin ``Ids`` raise: NotFound - ``resource_id`` is not found raise: NullAr...
python
def get_bin_ids_by_resource(self, resource_id): """Gets the list of ``Bin`` ``Ids`` mapped to a ``Resource``. arg: resource_id (osid.id.Id): ``Id`` of a ``Resource`` return: (osid.id.IdList) - list of bin ``Ids`` raise: NotFound - ``resource_id`` is not found raise: NullAr...
['def', 'get_bin_ids_by_resource', '(', 'self', ',', 'resource_id', ')', ':', '# Implemented from template for', '# osid.resource.ResourceBinSession.get_bin_ids_by_resource', 'mgr', '=', 'self', '.', '_get_provider_manager', '(', "'RESOURCE'", ',', 'local', '=', 'True', ')', 'lookup_session', '=', 'mgr', '.', 'get_reso...
Gets the list of ``Bin`` ``Ids`` mapped to a ``Resource``. arg: resource_id (osid.id.Id): ``Id`` of a ``Resource`` return: (osid.id.IdList) - list of bin ``Ids`` raise: NotFound - ``resource_id`` is not found raise: NullArgument - ``resource_id`` is ``null`` raise: Operat...
['Gets', 'the', 'list', 'of', 'Bin', 'Ids', 'mapped', 'to', 'a', 'Resource', '.']
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L1452-L1473
4,763
lsbardel/python-stdnet
stdnet/backends/redisb/__init__.py
pairs_to_dict
def pairs_to_dict(response, encoding): "Create a dict given a list of key/value pairs" it = iter(response) return dict(((k.decode(encoding), v) for k, v in zip(it, it)))
python
def pairs_to_dict(response, encoding): "Create a dict given a list of key/value pairs" it = iter(response) return dict(((k.decode(encoding), v) for k, v in zip(it, it)))
['def', 'pairs_to_dict', '(', 'response', ',', 'encoding', ')', ':', 'it', '=', 'iter', '(', 'response', ')', 'return', 'dict', '(', '(', '(', 'k', '.', 'decode', '(', 'encoding', ')', ',', 'v', ')', 'for', 'k', ',', 'v', 'in', 'zip', '(', 'it', ',', 'it', ')', ')', ')']
Create a dict given a list of key/value pairs
['Create', 'a', 'dict', 'given', 'a', 'list', 'of', 'key', '/', 'value', 'pairs']
train
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/__init__.py#L36-L39
4,764
saltstack/salt
salt/modules/debian_service.py
get_all
def get_all(): ''' Return all available boot services CLI Example: .. code-block:: bash salt '*' service.get_all ''' ret = set() lines = glob.glob('/etc/init.d/*') for line in lines: service = line.split('/etc/init.d/')[1] # Remove README. If it's an enabled s...
python
def get_all(): ''' Return all available boot services CLI Example: .. code-block:: bash salt '*' service.get_all ''' ret = set() lines = glob.glob('/etc/init.d/*') for line in lines: service = line.split('/etc/init.d/')[1] # Remove README. If it's an enabled s...
['def', 'get_all', '(', ')', ':', 'ret', '=', 'set', '(', ')', 'lines', '=', 'glob', '.', 'glob', '(', "'/etc/init.d/*'", ')', 'for', 'line', 'in', 'lines', ':', 'service', '=', 'line', '.', 'split', '(', "'/etc/init.d/'", ')', '[', '1', ']', "# Remove README. If it's an enabled service, it will be added back in.", 'i...
Return all available boot services CLI Example: .. code-block:: bash salt '*' service.get_all
['Return', 'all', 'available', 'boot', 'services']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_service.py#L136-L153
4,765
f3at/feat
src/feat/models/value.py
Boolean.validate
def validate(self, value): """ Accepts: str, unicode, bool Returns: bool """ if isinstance(value, bool): return value if isinstance(value, (str, unicode)): if value.lower() == "true": value = True elif value.lower() == "...
python
def validate(self, value): """ Accepts: str, unicode, bool Returns: bool """ if isinstance(value, bool): return value if isinstance(value, (str, unicode)): if value.lower() == "true": value = True elif value.lower() == "...
['def', 'validate', '(', 'self', ',', 'value', ')', ':', 'if', 'isinstance', '(', 'value', ',', 'bool', ')', ':', 'return', 'value', 'if', 'isinstance', '(', 'value', ',', '(', 'str', ',', 'unicode', ')', ')', ':', 'if', 'value', '.', 'lower', '(', ')', '==', '"true"', ':', 'value', '=', 'True', 'elif', 'value', '.', '...
Accepts: str, unicode, bool Returns: bool
['Accepts', ':', 'str', 'unicode', 'bool', 'Returns', ':', 'bool']
train
https://github.com/f3at/feat/blob/15da93fc9d6ec8154f52a9172824e25821195ef8/src/feat/models/value.py#L613-L630
4,766
diging/tethne
tethne/analyze/corpus.py
_forward
def _forward(X, s=1.1, gamma=1., k=5): """ Forward dynamic algorithm for burstness automaton HMM, from `Kleinberg (2002) <http://www.cs.cornell.edu/home/kleinber/bhs.pdf>`_. Parameters ---------- X : list A series of time-gaps between events. s : float (default: 1.1) Scaling...
python
def _forward(X, s=1.1, gamma=1., k=5): """ Forward dynamic algorithm for burstness automaton HMM, from `Kleinberg (2002) <http://www.cs.cornell.edu/home/kleinber/bhs.pdf>`_. Parameters ---------- X : list A series of time-gaps between events. s : float (default: 1.1) Scaling...
['def', '_forward', '(', 'X', ',', 's', '=', '1.1', ',', 'gamma', '=', '1.', ',', 'k', '=', '5', ')', ':', 'X', '=', 'list', '(', 'X', ')', 'def', 'alpha', '(', 'i', ')', ':', 'return', '(', 'n', '/', 'T', ')', '*', '(', 's', '**', 'i', ')', 'def', 'tau', '(', 'i', ',', 'j', ')', ':', 'if', 'j', '>', 'i', ':', 'return'...
Forward dynamic algorithm for burstness automaton HMM, from `Kleinberg (2002) <http://www.cs.cornell.edu/home/kleinber/bhs.pdf>`_. Parameters ---------- X : list A series of time-gaps between events. s : float (default: 1.1) Scaling parameter ( > 1.)that controls graininess of ...
['Forward', 'dynamic', 'algorithm', 'for', 'burstness', 'automaton', 'HMM', 'from', 'Kleinberg', '(', '2002', ')', '<http', ':', '//', 'www', '.', 'cs', '.', 'cornell', '.', 'edu', '/', 'home', '/', 'kleinber', '/', 'bhs', '.', 'pdf', '>', '_', '.']
train
https://github.com/diging/tethne/blob/ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f/tethne/analyze/corpus.py#L30-L88
4,767
LEMS/pylems
lems/parser/LEMS.py
LEMSFileParser.parse_with
def parse_with(self, node): """ Parses <With> @param node: Node containing the <With> element @type node: xml.etree.Element """ if 'instance' in node.lattrib: instance = node.lattrib['instance'] list = None index = None elif '...
python
def parse_with(self, node): """ Parses <With> @param node: Node containing the <With> element @type node: xml.etree.Element """ if 'instance' in node.lattrib: instance = node.lattrib['instance'] list = None index = None elif '...
['def', 'parse_with', '(', 'self', ',', 'node', ')', ':', 'if', "'instance'", 'in', 'node', '.', 'lattrib', ':', 'instance', '=', 'node', '.', 'lattrib', '[', "'instance'", ']', 'list', '=', 'None', 'index', '=', 'None', 'elif', "'list'", 'in', 'node', '.', 'lattrib', 'and', "'index'", 'in', 'node', '.', 'lattrib', ':'...
Parses <With> @param node: Node containing the <With> element @type node: xml.etree.Element
['Parses', '<With', '>']
train
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1688-L1713
4,768
googleapis/google-cloud-python
dns/google/cloud/dns/changes.py
Changes.from_api_repr
def from_api_repr(cls, resource, zone): """Factory: construct a change set given its API representation :type resource: dict :param resource: change set representation returned from the API. :type zone: :class:`google.cloud.dns.zone.ManagedZone` :param zone: A zone which holds...
python
def from_api_repr(cls, resource, zone): """Factory: construct a change set given its API representation :type resource: dict :param resource: change set representation returned from the API. :type zone: :class:`google.cloud.dns.zone.ManagedZone` :param zone: A zone which holds...
['def', 'from_api_repr', '(', 'cls', ',', 'resource', ',', 'zone', ')', ':', 'changes', '=', 'cls', '(', 'zone', '=', 'zone', ')', 'changes', '.', '_set_properties', '(', 'resource', ')', 'return', 'changes']
Factory: construct a change set given its API representation :type resource: dict :param resource: change set representation returned from the API. :type zone: :class:`google.cloud.dns.zone.ManagedZone` :param zone: A zone which holds zero or more change sets. :rtype: :class:...
['Factory', ':', 'construct', 'a', 'change', 'set', 'given', 'its', 'API', 'representation']
train
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dns/google/cloud/dns/changes.py#L42-L56
4,769
zendesk/connect_python_sdk
outbound/__init__.py
unsubscribe
def unsubscribe(user_id, from_all=False, campaign_ids=None, on_error=None, on_success=None): """ Unsubscribe a user from some or all campaigns. :param str | number user_id: the id you use to identify a user. this should be static for the lifetime of a user. :param bool from_all True to unsubscribe fro...
python
def unsubscribe(user_id, from_all=False, campaign_ids=None, on_error=None, on_success=None): """ Unsubscribe a user from some or all campaigns. :param str | number user_id: the id you use to identify a user. this should be static for the lifetime of a user. :param bool from_all True to unsubscribe fro...
['def', 'unsubscribe', '(', 'user_id', ',', 'from_all', '=', 'False', ',', 'campaign_ids', '=', 'None', ',', 'on_error', '=', 'None', ',', 'on_success', '=', 'None', ')', ':', '__subscription', '(', 'user_id', ',', 'unsubscribe', '=', 'True', ',', 'all_campaigns', '=', 'from_all', ',', 'campaign_ids', '=', 'campaign_id...
Unsubscribe a user from some or all campaigns. :param str | number user_id: the id you use to identify a user. this should be static for the lifetime of a user. :param bool from_all True to unsubscribe from all campaigns. Take precedence over campaigns IDs if both are given. :param list of str ca...
['Unsubscribe', 'a', 'user', 'from', 'some', 'or', 'all', 'campaigns', '.']
train
https://github.com/zendesk/connect_python_sdk/blob/6d7c1a539dcf23c1b1942e9bf6c9084c929df7e6/outbound/__init__.py#L37-L62
4,770
hollenstein/maspy
maspy/auxiliary.py
listFiletypes
def listFiletypes(targetfilename, directory): """Looks for all occurences of a specified filename in a directory and returns a list of all present file extensions of this filename. In this cas everything after the first dot is considered to be the file extension: ``"filename.txt" -> "txt"``, ``"filenam...
python
def listFiletypes(targetfilename, directory): """Looks for all occurences of a specified filename in a directory and returns a list of all present file extensions of this filename. In this cas everything after the first dot is considered to be the file extension: ``"filename.txt" -> "txt"``, ``"filenam...
['def', 'listFiletypes', '(', 'targetfilename', ',', 'directory', ')', ':', 'targetextensions', '=', 'list', '(', ')', 'for', 'filename', 'in', 'os', '.', 'listdir', '(', 'directory', ')', ':', 'if', 'not', 'os', '.', 'path', '.', 'isfile', '(', 'joinpath', '(', 'directory', ',', 'filename', ')', ')', ':', 'continue', ...
Looks for all occurences of a specified filename in a directory and returns a list of all present file extensions of this filename. In this cas everything after the first dot is considered to be the file extension: ``"filename.txt" -> "txt"``, ``"filename.txt.zip" -> "txt.zip"`` :param targetfilename:...
['Looks', 'for', 'all', 'occurences', 'of', 'a', 'specified', 'filename', 'in', 'a', 'directory', 'and', 'returns', 'a', 'list', 'of', 'all', 'present', 'file', 'extensions', 'of', 'this', 'filename', '.']
train
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/auxiliary.py#L446-L468
4,771
DataBiosphere/toil
src/toil/job.py
Job.addFollowOn
def addFollowOn(self, followOnJob): """ Adds a follow-on job, follow-on jobs will be run after the child jobs and \ their successors have been run. :param toil.job.Job followOnJob: :return: followOnJob :rtype: toil.job.Job """ self._followOns.append(follo...
python
def addFollowOn(self, followOnJob): """ Adds a follow-on job, follow-on jobs will be run after the child jobs and \ their successors have been run. :param toil.job.Job followOnJob: :return: followOnJob :rtype: toil.job.Job """ self._followOns.append(follo...
['def', 'addFollowOn', '(', 'self', ',', 'followOnJob', ')', ':', 'self', '.', '_followOns', '.', 'append', '(', 'followOnJob', ')', 'followOnJob', '.', '_addPredecessor', '(', 'self', ')', 'return', 'followOnJob']
Adds a follow-on job, follow-on jobs will be run after the child jobs and \ their successors have been run. :param toil.job.Job followOnJob: :return: followOnJob :rtype: toil.job.Job
['Adds', 'a', 'follow', '-', 'on', 'job', 'follow', '-', 'on', 'jobs', 'will', 'be', 'run', 'after', 'the', 'child', 'jobs', 'and', '\\', 'their', 'successors', 'have', 'been', 'run', '.']
train
https://github.com/DataBiosphere/toil/blob/a8252277ff814e7bee0971139c2344f88e44b644/src/toil/job.py#L349-L360
4,772
joshspeagle/dynesty
dynesty/nestedsamplers.py
UnitCubeSampler.update_slice
def update_slice(self, blob): """Update the slice proposal scale based on the relative size of the slices compared to our initial guess.""" nexpand, ncontract = blob['nexpand'], blob['ncontract'] self.scale *= nexpand / (2. * ncontract)
python
def update_slice(self, blob): """Update the slice proposal scale based on the relative size of the slices compared to our initial guess.""" nexpand, ncontract = blob['nexpand'], blob['ncontract'] self.scale *= nexpand / (2. * ncontract)
['def', 'update_slice', '(', 'self', ',', 'blob', ')', ':', 'nexpand', ',', 'ncontract', '=', 'blob', '[', "'nexpand'", ']', ',', 'blob', '[', "'ncontract'", ']', 'self', '.', 'scale', '*=', 'nexpand', '/', '(', '2.', '*', 'ncontract', ')']
Update the slice proposal scale based on the relative size of the slices compared to our initial guess.
['Update', 'the', 'slice', 'proposal', 'scale', 'based', 'on', 'the', 'relative', 'size', 'of', 'the', 'slices', 'compared', 'to', 'our', 'initial', 'guess', '.']
train
https://github.com/joshspeagle/dynesty/blob/9e482aafeb5cf84bedb896fa6f07a761d917983e/dynesty/nestedsamplers.py#L209-L214
4,773
edibledinos/pwnypack
pwnypack/elf.py
ELF.get_symbol
def get_symbol(self, symbol): """ Get a specific symbol by index or name. Args: symbol(int or str): The index or name of the symbol to return. Returns: ELF.Symbol: The symbol. Raises: KeyError: The requested symbol does not exist. ""...
python
def get_symbol(self, symbol): """ Get a specific symbol by index or name. Args: symbol(int or str): The index or name of the symbol to return. Returns: ELF.Symbol: The symbol. Raises: KeyError: The requested symbol does not exist. ""...
['def', 'get_symbol', '(', 'self', ',', 'symbol', ')', ':', 'self', '.', '_ensure_symbols_loaded', '(', ')', 'if', 'type', '(', 'symbol', ')', 'is', 'int', ':', 'return', 'self', '.', '_symbols_by_index', '[', 'symbol', ']', 'else', ':', 'return', 'self', '.', '_symbols_by_name', '[', 'symbol', ']']
Get a specific symbol by index or name. Args: symbol(int or str): The index or name of the symbol to return. Returns: ELF.Symbol: The symbol. Raises: KeyError: The requested symbol does not exist.
['Get', 'a', 'specific', 'symbol', 'by', 'index', 'or', 'name', '.']
train
https://github.com/edibledinos/pwnypack/blob/e0a5a8e6ef3f4f1f7e1b91ee379711f4a49cb0e6/pwnypack/elf.py#L911-L929
4,774
dslackw/slpkg
slpkg/messages.py
Msg.answer
def answer(self): """Message answer """ if self.meta.default_answer in ["y", "Y"]: answer = self.meta.default_answer else: try: answer = raw_input("Would you like to continue [y/N]? ") except EOFError: print("") ...
python
def answer(self): """Message answer """ if self.meta.default_answer in ["y", "Y"]: answer = self.meta.default_answer else: try: answer = raw_input("Would you like to continue [y/N]? ") except EOFError: print("") ...
['def', 'answer', '(', 'self', ')', ':', 'if', 'self', '.', 'meta', '.', 'default_answer', 'in', '[', '"y"', ',', '"Y"', ']', ':', 'answer', '=', 'self', '.', 'meta', '.', 'default_answer', 'else', ':', 'try', ':', 'answer', '=', 'raw_input', '(', '"Would you like to continue [y/N]? "', ')', 'except', 'EOFError', ':', ...
Message answer
['Message', 'answer']
train
https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/messages.py#L121-L132
4,775
mongodb/mongo-python-driver
pymongo/message.py
_OpReply.raw_response
def raw_response(self, cursor_id=None): """Check the response header from the database, without decoding BSON. Check the response for errors and unpack. Can raise CursorNotFound, NotMasterError, ExecutionTimeout, or OperationFailure. :Parameters: - `cursor_id` (optio...
python
def raw_response(self, cursor_id=None): """Check the response header from the database, without decoding BSON. Check the response for errors and unpack. Can raise CursorNotFound, NotMasterError, ExecutionTimeout, or OperationFailure. :Parameters: - `cursor_id` (optio...
['def', 'raw_response', '(', 'self', ',', 'cursor_id', '=', 'None', ')', ':', 'if', 'self', '.', 'flags', '&', '1', ':', "# Shouldn't get this response if we aren't doing a getMore", 'if', 'cursor_id', 'is', 'None', ':', 'raise', 'ProtocolError', '(', '"No cursor id for getMore operation"', ')', '# Fake a getMore comma...
Check the response header from the database, without decoding BSON. Check the response for errors and unpack. Can raise CursorNotFound, NotMasterError, ExecutionTimeout, or OperationFailure. :Parameters: - `cursor_id` (optional): cursor_id we sent to get this response - ...
['Check', 'the', 'response', 'header', 'from', 'the', 'database', 'without', 'decoding', 'BSON', '.']
train
https://github.com/mongodb/mongo-python-driver/blob/c29c21449e3aae74154207058cf85fd94018d4cd/pymongo/message.py#L1373-L1410
4,776
Rafiot/PubSubLogger
pubsublogger/subscriber.py
setup
def setup(name, path='log', enable_debug=False): """ Prepare a NestedSetup. :param name: the channel name :param path: the path where the logs will be written :param enable_debug: do we want to save the message at the DEBUG level :return a nested Setup """ path_tmpl = os.path.join(path...
python
def setup(name, path='log', enable_debug=False): """ Prepare a NestedSetup. :param name: the channel name :param path: the path where the logs will be written :param enable_debug: do we want to save the message at the DEBUG level :return a nested Setup """ path_tmpl = os.path.join(path...
['def', 'setup', '(', 'name', ',', 'path', '=', "'log'", ',', 'enable_debug', '=', 'False', ')', ':', 'path_tmpl', '=', 'os', '.', 'path', '.', 'join', '(', 'path', ',', "'{name}_{level}.log'", ')', 'info', '=', 'path_tmpl', '.', 'format', '(', 'name', '=', 'name', ',', 'level', '=', "'info'", ')', 'warn', '=', 'path_t...
Prepare a NestedSetup. :param name: the channel name :param path: the path where the logs will be written :param enable_debug: do we want to save the message at the DEBUG level :return a nested Setup
['Prepare', 'a', 'NestedSetup', '.']
train
https://github.com/Rafiot/PubSubLogger/blob/4f28ad673f42ee2ec7792d414d325aef9a56da53/pubsublogger/subscriber.py#L43-L91
4,777
sixty-north/cosmic-ray
src/cosmic_ray/cli.py
handle_interceptors
def handle_interceptors(args): """usage: {program} interceptors List the available interceptor plugins. """ assert args print('\n'.join(cosmic_ray.plugins.interceptor_names())) return ExitCode.OK
python
def handle_interceptors(args): """usage: {program} interceptors List the available interceptor plugins. """ assert args print('\n'.join(cosmic_ray.plugins.interceptor_names())) return ExitCode.OK
['def', 'handle_interceptors', '(', 'args', ')', ':', 'assert', 'args', 'print', '(', "'\\n'", '.', 'join', '(', 'cosmic_ray', '.', 'plugins', '.', 'interceptor_names', '(', ')', ')', ')', 'return', 'ExitCode', '.', 'OK']
usage: {program} interceptors List the available interceptor plugins.
['usage', ':', '{', 'program', '}', 'interceptors']
train
https://github.com/sixty-north/cosmic-ray/blob/c654e074afbb7b7fcbc23359083c1287c0d3e991/src/cosmic_ray/cli.py#L193-L201
4,778
ciena/afkak
afkak/_util.py
_coerce_consumer_group
def _coerce_consumer_group(consumer_group): """ Ensure that the consumer group is a text string. :param consumer_group: :class:`bytes` or :class:`str` instance :raises TypeError: when `consumer_group` is not :class:`bytes` or :class:`str` """ if not isinstance(consumer_group, string_typ...
python
def _coerce_consumer_group(consumer_group): """ Ensure that the consumer group is a text string. :param consumer_group: :class:`bytes` or :class:`str` instance :raises TypeError: when `consumer_group` is not :class:`bytes` or :class:`str` """ if not isinstance(consumer_group, string_typ...
['def', '_coerce_consumer_group', '(', 'consumer_group', ')', ':', 'if', 'not', 'isinstance', '(', 'consumer_group', ',', 'string_types', ')', ':', 'raise', 'TypeError', '(', "'consumer_group={!r} must be text'", '.', 'format', '(', 'consumer_group', ')', ')', 'if', 'not', 'isinstance', '(', 'consumer_group', ',', 'tex...
Ensure that the consumer group is a text string. :param consumer_group: :class:`bytes` or :class:`str` instance :raises TypeError: when `consumer_group` is not :class:`bytes` or :class:`str`
['Ensure', 'that', 'the', 'consumer', 'group', 'is', 'a', 'text', 'string', '.']
train
https://github.com/ciena/afkak/blob/6f5e05ba6f135ea3c29cdb80efda009f7845569a/afkak/_util.py#L47-L59
4,779
ARMmbed/icetea
icetea_lib/Plugin/PluginManager.py
PluginManager._register_external_service
def _register_external_service(self, plugin_name, plugin_instance): """ Register an external service. :param plugin_name: Service name :param plugin_instance: PluginBase :return: """ for attr in plugin_instance.get_external_services().keys(): if attr ...
python
def _register_external_service(self, plugin_name, plugin_instance): """ Register an external service. :param plugin_name: Service name :param plugin_instance: PluginBase :return: """ for attr in plugin_instance.get_external_services().keys(): if attr ...
['def', '_register_external_service', '(', 'self', ',', 'plugin_name', ',', 'plugin_instance', ')', ':', 'for', 'attr', 'in', 'plugin_instance', '.', 'get_external_services', '(', ')', '.', 'keys', '(', ')', ':', 'if', 'attr', 'in', 'self', '.', '_external_services', ':', 'raise', 'PluginException', '(', '"External ser...
Register an external service. :param plugin_name: Service name :param plugin_instance: PluginBase :return:
['Register', 'an', 'external', 'service', '.']
train
https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Plugin/PluginManager.py#L267-L279
4,780
numberoverzero/bloop
bloop/session.py
SessionWrapper.describe_stream
def describe_stream(self, stream_arn, first_shard=None): """Wraps :func:`boto3.DynamoDBStreams.Client.describe_stream`, handling continuation tokens. :param str stream_arn: Stream arn, usually from the model's ``Meta.stream["arn"]``. :param str first_shard: *(Optional)* If provided, only shards...
python
def describe_stream(self, stream_arn, first_shard=None): """Wraps :func:`boto3.DynamoDBStreams.Client.describe_stream`, handling continuation tokens. :param str stream_arn: Stream arn, usually from the model's ``Meta.stream["arn"]``. :param str first_shard: *(Optional)* If provided, only shards...
['def', 'describe_stream', '(', 'self', ',', 'stream_arn', ',', 'first_shard', '=', 'None', ')', ':', 'description', '=', '{', '"Shards"', ':', '[', ']', '}', 'request', '=', '{', '"StreamArn"', ':', 'stream_arn', ',', '"ExclusiveStartShardId"', ':', 'first_shard', '}', "# boto3 isn't down with literal Nones.", 'if', '...
Wraps :func:`boto3.DynamoDBStreams.Client.describe_stream`, handling continuation tokens. :param str stream_arn: Stream arn, usually from the model's ``Meta.stream["arn"]``. :param str first_shard: *(Optional)* If provided, only shards after this shard id will be returned. :return: All shards i...
['Wraps', ':', 'func', ':', 'boto3', '.', 'DynamoDBStreams', '.', 'Client', '.', 'describe_stream', 'handling', 'continuation', 'tokens', '.']
train
https://github.com/numberoverzero/bloop/blob/4c95f5a0ff0802443a1c258bfaccecd1758363e7/bloop/session.py#L304-L332
4,781
abe-winter/pg13-py
pg13/sqex.py
NameIndexer.update_aliases
def update_aliases(aliases,aonly,x): "helper for ctor. takes AliasX or string as second arg" if isinstance(x,basestring): aliases[x]=x elif isinstance(x,sqparse2.AliasX): if not isinstance(x.alias,basestring): raise TypeError('alias not string',type(x.alias)) if isinstance(x.name,sqparse2.NameX)...
python
def update_aliases(aliases,aonly,x): "helper for ctor. takes AliasX or string as second arg" if isinstance(x,basestring): aliases[x]=x elif isinstance(x,sqparse2.AliasX): if not isinstance(x.alias,basestring): raise TypeError('alias not string',type(x.alias)) if isinstance(x.name,sqparse2.NameX)...
['def', 'update_aliases', '(', 'aliases', ',', 'aonly', ',', 'x', ')', ':', 'if', 'isinstance', '(', 'x', ',', 'basestring', ')', ':', 'aliases', '[', 'x', ']', '=', 'x', 'elif', 'isinstance', '(', 'x', ',', 'sqparse2', '.', 'AliasX', ')', ':', 'if', 'not', 'isinstance', '(', 'x', '.', 'alias', ',', 'basestring', ')', ...
helper for ctor. takes AliasX or string as second arg
['helper', 'for', 'ctor', '.', 'takes', 'AliasX', 'or', 'string', 'as', 'second', 'arg']
train
https://github.com/abe-winter/pg13-py/blob/c78806f99f35541a8756987e86edca3438aa97f5/pg13/sqex.py#L104-L114
4,782
geertj/gruvi
lib/gruvi/jsonrpc.py
JsonRpcProtocol.send_notification
def send_notification(self, method, *args): """Send a JSON-RPC notification. The notification *method* is sent with positional arguments *args*. """ message = self._version.create_request(method, args, notification=True) self.send_message(message)
python
def send_notification(self, method, *args): """Send a JSON-RPC notification. The notification *method* is sent with positional arguments *args*. """ message = self._version.create_request(method, args, notification=True) self.send_message(message)
['def', 'send_notification', '(', 'self', ',', 'method', ',', '*', 'args', ')', ':', 'message', '=', 'self', '.', '_version', '.', 'create_request', '(', 'method', ',', 'args', ',', 'notification', '=', 'True', ')', 'self', '.', 'send_message', '(', 'message', ')']
Send a JSON-RPC notification. The notification *method* is sent with positional arguments *args*.
['Send', 'a', 'JSON', '-', 'RPC', 'notification', '.']
train
https://github.com/geertj/gruvi/blob/1d77ca439600b6ea7a19aa1ee85dca0f3be3f3f8/lib/gruvi/jsonrpc.py#L443-L449
4,783
onelogin/python-saml
src/onelogin/saml2/response.py
OneLogin_Saml2_Response.get_nameid_data
def get_nameid_data(self): """ Gets the NameID Data provided by the SAML Response from the IdP :returns: Name ID Data (Value, Format, NameQualifier, SPNameQualifier) :rtype: dict """ nameid = None nameid_data = {} encrypted_id_data_nodes = self.__query_a...
python
def get_nameid_data(self): """ Gets the NameID Data provided by the SAML Response from the IdP :returns: Name ID Data (Value, Format, NameQualifier, SPNameQualifier) :rtype: dict """ nameid = None nameid_data = {} encrypted_id_data_nodes = self.__query_a...
['def', 'get_nameid_data', '(', 'self', ')', ':', 'nameid', '=', 'None', 'nameid_data', '=', '{', '}', 'encrypted_id_data_nodes', '=', 'self', '.', '__query_assertion', '(', "'/saml:Subject/saml:EncryptedID/xenc:EncryptedData'", ')', 'if', 'encrypted_id_data_nodes', ':', 'encrypted_data', '=', 'encrypted_id_data_nodes'...
Gets the NameID Data provided by the SAML Response from the IdP :returns: Name ID Data (Value, Format, NameQualifier, SPNameQualifier) :rtype: dict
['Gets', 'the', 'NameID', 'Data', 'provided', 'by', 'the', 'SAML', 'Response', 'from', 'the', 'IdP']
train
https://github.com/onelogin/python-saml/blob/9fe7a72da5b4caa1529c1640b52d2649447ce49b/src/onelogin/saml2/response.py#L438-L487
4,784
alejandroautalan/pygubu
pygubu/widgets/simpletooltip.py
ToolTip.showtip
def showtip(self, text): "Display text in tooltip window" self.text = text if self.tipwindow or not self.text: return x, y, cx, cy = self.widget.bbox("insert") x = x + self.widget.winfo_rootx() + 27 y = y + cy + self.widget.winfo_rooty() +27 self.tipwi...
python
def showtip(self, text): "Display text in tooltip window" self.text = text if self.tipwindow or not self.text: return x, y, cx, cy = self.widget.bbox("insert") x = x + self.widget.winfo_rootx() + 27 y = y + cy + self.widget.winfo_rooty() +27 self.tipwi...
['def', 'showtip', '(', 'self', ',', 'text', ')', ':', 'self', '.', 'text', '=', 'text', 'if', 'self', '.', 'tipwindow', 'or', 'not', 'self', '.', 'text', ':', 'return', 'x', ',', 'y', ',', 'cx', ',', 'cy', '=', 'self', '.', 'widget', '.', 'bbox', '(', '"insert"', ')', 'x', '=', 'x', '+', 'self', '.', 'widget', '.', 'w...
Display text in tooltip window
['Display', 'text', 'in', 'tooltip', 'window']
train
https://github.com/alejandroautalan/pygubu/blob/41c8fb37ef973736ec5d68cbe1cd4ecb78712e40/pygubu/widgets/simpletooltip.py#L20-L42
4,785
beregond/super_state_machine
super_state_machine/machines.py
StateMachineMetaclass._add_new_methods
def _add_new_methods(cls): """Add all generated methods to result class.""" for name, method in cls.context.new_methods.items(): if hasattr(cls.context.new_class, name): raise ValueError( "Name collision in state machine class - '{name}'." ...
python
def _add_new_methods(cls): """Add all generated methods to result class.""" for name, method in cls.context.new_methods.items(): if hasattr(cls.context.new_class, name): raise ValueError( "Name collision in state machine class - '{name}'." ...
['def', '_add_new_methods', '(', 'cls', ')', ':', 'for', 'name', ',', 'method', 'in', 'cls', '.', 'context', '.', 'new_methods', '.', 'items', '(', ')', ':', 'if', 'hasattr', '(', 'cls', '.', 'context', '.', 'new_class', ',', 'name', ')', ':', 'raise', 'ValueError', '(', '"Name collision in state machine class - \'{nam...
Add all generated methods to result class.
['Add', 'all', 'generated', 'methods', 'to', 'result', 'class', '.']
train
https://github.com/beregond/super_state_machine/blob/31ad527f4e6b7a01e315ce865735ca18957c223e/super_state_machine/machines.py#L235-L244
4,786
sony/nnabla
python/benchmark/function/function_benchmark.py
FunctionBenchmark.benchmark_forward
def benchmark_forward(self): """Benchmark forward execution. """ self._setup() def f(): self._forward() self.mod_ext.synchronize(**self.ext_kwargs) f() # Ignore first self.forward_stat = self._calc_benchmark_stat(f)
python
def benchmark_forward(self): """Benchmark forward execution. """ self._setup() def f(): self._forward() self.mod_ext.synchronize(**self.ext_kwargs) f() # Ignore first self.forward_stat = self._calc_benchmark_stat(f)
['def', 'benchmark_forward', '(', 'self', ')', ':', 'self', '.', '_setup', '(', ')', 'def', 'f', '(', ')', ':', 'self', '.', '_forward', '(', ')', 'self', '.', 'mod_ext', '.', 'synchronize', '(', '*', '*', 'self', '.', 'ext_kwargs', ')', 'f', '(', ')', '# Ignore first', 'self', '.', 'forward_stat', '=', 'self', '.', '_...
Benchmark forward execution.
['Benchmark', 'forward', 'execution', '.']
train
https://github.com/sony/nnabla/blob/aaf3d33b7cbb38f2a03aa754178ba8f7c8481320/python/benchmark/function/function_benchmark.py#L285-L294
4,787
datosgobar/pydatajson
pydatajson/core.py
DataJson.generate_datasets_report
def generate_datasets_report( self, catalogs, harvest='valid', report=None, export_path=None, catalog_ids=None, catalog_homepages=None, catalog_orgs=None ): """Genera un reporte sobre las condiciones de la metadata de los datasets contenidos en uno o varios catálo...
python
def generate_datasets_report( self, catalogs, harvest='valid', report=None, export_path=None, catalog_ids=None, catalog_homepages=None, catalog_orgs=None ): """Genera un reporte sobre las condiciones de la metadata de los datasets contenidos en uno o varios catálo...
['def', 'generate_datasets_report', '(', 'self', ',', 'catalogs', ',', 'harvest', '=', "'valid'", ',', 'report', '=', 'None', ',', 'export_path', '=', 'None', ',', 'catalog_ids', '=', 'None', ',', 'catalog_homepages', '=', 'None', ',', 'catalog_orgs', '=', 'None', ')', ':', 'assert', 'isinstance', '(', 'catalogs', ',',...
Genera un reporte sobre las condiciones de la metadata de los datasets contenidos en uno o varios catálogos. Args: catalogs (str, dict o list): Uno (str o dict) o varios (list de strs y/o dicts) catálogos. harvest (str): Criterio a utilizar para determinar el val...
['Genera', 'un', 'reporte', 'sobre', 'las', 'condiciones', 'de', 'la', 'metadata', 'de', 'los', 'datasets', 'contenidos', 'en', 'uno', 'o', 'varios', 'catálogos', '.']
train
https://github.com/datosgobar/pydatajson/blob/3141082ffbaa295e2deaf6ffbbc5a59f5859960e/pydatajson/core.py#L588-L690
4,788
picklepete/pyicloud
pyicloud/services/findmyiphone.py
AppleDevice.display_message
def display_message( self, subject='Find My iPhone Alert', message="This is a note", sounds=False ): """ Send a request to the device to play a sound. It's possible to pass a custom message by changing the `subject`. """ data = json.dumps( { ...
python
def display_message( self, subject='Find My iPhone Alert', message="This is a note", sounds=False ): """ Send a request to the device to play a sound. It's possible to pass a custom message by changing the `subject`. """ data = json.dumps( { ...
['def', 'display_message', '(', 'self', ',', 'subject', '=', "'Find My iPhone Alert'", ',', 'message', '=', '"This is a note"', ',', 'sounds', '=', 'False', ')', ':', 'data', '=', 'json', '.', 'dumps', '(', '{', "'device'", ':', 'self', '.', 'content', '[', "'id'", ']', ',', "'subject'", ':', 'subject', ',', "'sound'",...
Send a request to the device to play a sound. It's possible to pass a custom message by changing the `subject`.
['Send', 'a', 'request', 'to', 'the', 'device', 'to', 'play', 'a', 'sound', '.']
train
https://github.com/picklepete/pyicloud/blob/9bb6d750662ce24c8febc94807ddbdcdf3cadaa2/pyicloud/services/findmyiphone.py#L146-L167
4,789
tensorflow/tensor2tensor
tensor2tensor/models/video/savp.py
NextFrameSavpBase.pad_conv3d_lrelu
def pad_conv3d_lrelu(self, activations, n_filters, kernel_size, strides, scope): """Pad, apply 3-D convolution and leaky relu.""" padding = [[0, 0], [1, 1], [1, 1], [1, 1], [0, 0]] # tf.nn.conv3d accepts a list of 5 values for strides # with first and last value equal to 1 if...
python
def pad_conv3d_lrelu(self, activations, n_filters, kernel_size, strides, scope): """Pad, apply 3-D convolution and leaky relu.""" padding = [[0, 0], [1, 1], [1, 1], [1, 1], [0, 0]] # tf.nn.conv3d accepts a list of 5 values for strides # with first and last value equal to 1 if...
['def', 'pad_conv3d_lrelu', '(', 'self', ',', 'activations', ',', 'n_filters', ',', 'kernel_size', ',', 'strides', ',', 'scope', ')', ':', 'padding', '=', '[', '[', '0', ',', '0', ']', ',', '[', '1', ',', '1', ']', ',', '[', '1', ',', '1', ']', ',', '[', '1', ',', '1', ']', ',', '[', '0', ',', '0', ']', ']', '# tf.nn.c...
Pad, apply 3-D convolution and leaky relu.
['Pad', 'apply', '3', '-', 'D', 'convolution', 'and', 'leaky', 'relu', '.']
train
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/video/savp.py#L298-L327
4,790
wesyoung/pyzyre
buildutils/zyre/fetch.py
checksum_file
def checksum_file(scheme, path): """Return the checksum (hex digest) of a file""" h = getattr(hashlib, scheme)() with open(path, 'rb') as f: chunk = f.read(65535) while chunk: h.update(chunk) chunk = f.read(65535) return h.hexdigest()
python
def checksum_file(scheme, path): """Return the checksum (hex digest) of a file""" h = getattr(hashlib, scheme)() with open(path, 'rb') as f: chunk = f.read(65535) while chunk: h.update(chunk) chunk = f.read(65535) return h.hexdigest()
['def', 'checksum_file', '(', 'scheme', ',', 'path', ')', ':', 'h', '=', 'getattr', '(', 'hashlib', ',', 'scheme', ')', '(', ')', 'with', 'open', '(', 'path', ',', "'rb'", ')', 'as', 'f', ':', 'chunk', '=', 'f', '.', 'read', '(', '65535', ')', 'while', 'chunk', ':', 'h', '.', 'update', '(', 'chunk', ')', 'chunk', '=', ...
Return the checksum (hex digest) of a file
['Return', 'the', 'checksum', '(', 'hex', 'digest', ')', 'of', 'a', 'file']
train
https://github.com/wesyoung/pyzyre/blob/22d4c757acefcfdb700d3802adaf30b402bb9eea/buildutils/zyre/fetch.py#L50-L59
4,791
LeKono/pyhgnc
src/pyhgnc/manager/query.py
QueryManager.alias_symbol
def alias_symbol(self, alias_symbol=None, is_previous_symbol=None, hgnc_symbol=None, hgnc_identifier=None, limit=None, as_df=False): """Method to query :class:`.models.AliasSymbol` objec...
python
def alias_symbol(self, alias_symbol=None, is_previous_symbol=None, hgnc_symbol=None, hgnc_identifier=None, limit=None, as_df=False): """Method to query :class:`.models.AliasSymbol` objec...
['def', 'alias_symbol', '(', 'self', ',', 'alias_symbol', '=', 'None', ',', 'is_previous_symbol', '=', 'None', ',', 'hgnc_symbol', '=', 'None', ',', 'hgnc_identifier', '=', 'None', ',', 'limit', '=', 'None', ',', 'as_df', '=', 'False', ')', ':', 'q', '=', 'self', '.', 'session', '.', 'query', '(', 'models', '.', 'Alias...
Method to query :class:`.models.AliasSymbol` objects in database :param alias_symbol: alias symbol(s) :type alias_symbol: str or tuple(str) or None :param is_previous_symbol: flag for 'is previous' :type is_previous_symbol: bool or tuple(bool) or None :param hgnc_symbol: HGNC ...
['Method', 'to', 'query', ':', 'class', ':', '.', 'models', '.', 'AliasSymbol', 'objects', 'in', 'database']
train
https://github.com/LeKono/pyhgnc/blob/1cae20c40874bfb51581b7c5c1481707e942b5d0/src/pyhgnc/manager/query.py#L416-L465
4,792
mrstephenneal/pdfconduit
pdf/utils/info.py
Info._resolved_objects
def _resolved_objects(pdf, xobject): """Retrieve rotatation info.""" return [pdf.getPage(i).get(xobject) for i in range(pdf.getNumPages())][0]
python
def _resolved_objects(pdf, xobject): """Retrieve rotatation info.""" return [pdf.getPage(i).get(xobject) for i in range(pdf.getNumPages())][0]
['def', '_resolved_objects', '(', 'pdf', ',', 'xobject', ')', ':', 'return', '[', 'pdf', '.', 'getPage', '(', 'i', ')', '.', 'get', '(', 'xobject', ')', 'for', 'i', 'in', 'range', '(', 'pdf', '.', 'getNumPages', '(', ')', ')', ']', '[', '0', ']']
Retrieve rotatation info.
['Retrieve', 'rotatation', 'info', '.']
train
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/utils/info.py#L28-L30
4,793
thespacedoctor/fundamentals
fundamentals/mysql/yaml_to_database.py
main
def main(arguments=None): """ The main function used when ``yaml_to_database.py`` when installed as a cl tool """ # setup the command-line util settings su = tools( arguments=arguments, docString=__doc__, logLevel="WARNING", options_first=False, projectName=F...
python
def main(arguments=None): """ The main function used when ``yaml_to_database.py`` when installed as a cl tool """ # setup the command-line util settings su = tools( arguments=arguments, docString=__doc__, logLevel="WARNING", options_first=False, projectName=F...
['def', 'main', '(', 'arguments', '=', 'None', ')', ':', '# setup the command-line util settings', 'su', '=', 'tools', '(', 'arguments', '=', 'arguments', ',', 'docString', '=', '__doc__', ',', 'logLevel', '=', '"WARNING"', ',', 'options_first', '=', 'False', ',', 'projectName', '=', 'False', ')', 'arguments', ',', 'se...
The main function used when ``yaml_to_database.py`` when installed as a cl tool
['The', 'main', 'function', 'used', 'when', 'yaml_to_database', '.', 'py', 'when', 'installed', 'as', 'a', 'cl', 'tool']
train
https://github.com/thespacedoctor/fundamentals/blob/1d2c007ac74442ec2eabde771cfcacdb9c1ab382/fundamentals/mysql/yaml_to_database.py#L38-L95
4,794
bitesofcode/projexui
projexui/widgets/xorbtreewidget/xorbtreewidget.py
XOrbTreeWidget.emitRecordClicked
def emitRecordClicked(self, item): """ Emits the record clicked signal for the given item, provided the signals are not currently blocked. :param item | <QTreeWidgetItem> """ # load the next page if isinstance(item, XBatchItem): ...
python
def emitRecordClicked(self, item): """ Emits the record clicked signal for the given item, provided the signals are not currently blocked. :param item | <QTreeWidgetItem> """ # load the next page if isinstance(item, XBatchItem): ...
['def', 'emitRecordClicked', '(', 'self', ',', 'item', ')', ':', '# load the next page\r', 'if', 'isinstance', '(', 'item', ',', 'XBatchItem', ')', ':', 'item', '.', 'startLoading', '(', ')', 'self', '.', 'clearSelection', '(', ')', '# emit that the record has been clicked\r', 'if', 'isinstance', '(', 'item', ',', 'XOr...
Emits the record clicked signal for the given item, provided the signals are not currently blocked. :param item | <QTreeWidgetItem>
['Emits', 'the', 'record', 'clicked', 'signal', 'for', 'the', 'given', 'item', 'provided', 'the', 'signals', 'are', 'not', 'currently', 'blocked', '.', ':', 'param', 'item', '|', '<QTreeWidgetItem', '>']
train
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L1134-L1148
4,795
tanghaibao/goatools
goatools/nt_utils.py
get_unique_fields
def get_unique_fields(fld_lists): """Get unique namedtuple fields, despite potential duplicates in lists of fields.""" flds = [] fld_set = set([f for flst in fld_lists for f in flst]) fld_seen = set() # Add unique fields to list of fields in order that they appear for fld_list in fld_lists: ...
python
def get_unique_fields(fld_lists): """Get unique namedtuple fields, despite potential duplicates in lists of fields.""" flds = [] fld_set = set([f for flst in fld_lists for f in flst]) fld_seen = set() # Add unique fields to list of fields in order that they appear for fld_list in fld_lists: ...
['def', 'get_unique_fields', '(', 'fld_lists', ')', ':', 'flds', '=', '[', ']', 'fld_set', '=', 'set', '(', '[', 'f', 'for', 'flst', 'in', 'fld_lists', 'for', 'f', 'in', 'flst', ']', ')', 'fld_seen', '=', 'set', '(', ')', '# Add unique fields to list of fields in order that they appear', 'for', 'fld_list', 'in', 'fld_l...
Get unique namedtuple fields, despite potential duplicates in lists of fields.
['Get', 'unique', 'namedtuple', 'fields', 'despite', 'potential', 'duplicates', 'in', 'lists', 'of', 'fields', '.']
train
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/nt_utils.py#L81-L94
4,796
python-rope/rope
rope/base/utils/__init__.py
saveit
def saveit(func): """A decorator that caches the return value of a function""" name = '_' + func.__name__ def _wrapper(self, *args, **kwds): if not hasattr(self, name): setattr(self, name, func(self, *args, **kwds)) return getattr(self, name) return _wrapper
python
def saveit(func): """A decorator that caches the return value of a function""" name = '_' + func.__name__ def _wrapper(self, *args, **kwds): if not hasattr(self, name): setattr(self, name, func(self, *args, **kwds)) return getattr(self, name) return _wrapper
['def', 'saveit', '(', 'func', ')', ':', 'name', '=', "'_'", '+', 'func', '.', '__name__', 'def', '_wrapper', '(', 'self', ',', '*', 'args', ',', '*', '*', 'kwds', ')', ':', 'if', 'not', 'hasattr', '(', 'self', ',', 'name', ')', ':', 'setattr', '(', 'self', ',', 'name', ',', 'func', '(', 'self', ',', '*', 'args', ',', ...
A decorator that caches the return value of a function
['A', 'decorator', 'that', 'caches', 'the', 'return', 'value', 'of', 'a', 'function']
train
https://github.com/python-rope/rope/blob/1c9f9cd5964b099a99a9111e998f0dc728860688/rope/base/utils/__init__.py#L5-L14
4,797
improbable-research/keanu
keanu-python/keanu/vertex/generated.py
IntegerAddition
def IntegerAddition(left: vertex_constructor_param_types, right: vertex_constructor_param_types, label: Optional[str]=None) -> Vertex: """ Adds one vertex to another :param left: a vertex to add :param right: a vertex to add """ return Integer(context.jvm_view().IntegerAdditionVertex, label...
python
def IntegerAddition(left: vertex_constructor_param_types, right: vertex_constructor_param_types, label: Optional[str]=None) -> Vertex: """ Adds one vertex to another :param left: a vertex to add :param right: a vertex to add """ return Integer(context.jvm_view().IntegerAdditionVertex, label...
['def', 'IntegerAddition', '(', 'left', ':', 'vertex_constructor_param_types', ',', 'right', ':', 'vertex_constructor_param_types', ',', 'label', ':', 'Optional', '[', 'str', ']', '=', 'None', ')', '->', 'Vertex', ':', 'return', 'Integer', '(', 'context', '.', 'jvm_view', '(', ')', '.', 'IntegerAdditionVertex', ',', 'l...
Adds one vertex to another :param left: a vertex to add :param right: a vertex to add
['Adds', 'one', 'vertex', 'to', 'another', ':', 'param', 'left', ':', 'a', 'vertex', 'to', 'add', ':', 'param', 'right', ':', 'a', 'vertex', 'to', 'add']
train
https://github.com/improbable-research/keanu/blob/73189a8f569078e156168e795f82c7366c59574b/keanu-python/keanu/vertex/generated.py#L714-L721
4,798
tmux-python/tmuxp
tmuxp/cli.py
_validate_choices
def _validate_choices(options): """ Callback wrapper for validating click.prompt input. Parameters ---------- options : list List of allowed choices Returns ------- :func:`callable` callback function for value_proc in :func:`click.prompt`. Raises ------ :cl...
python
def _validate_choices(options): """ Callback wrapper for validating click.prompt input. Parameters ---------- options : list List of allowed choices Returns ------- :func:`callable` callback function for value_proc in :func:`click.prompt`. Raises ------ :cl...
['def', '_validate_choices', '(', 'options', ')', ':', 'def', 'func', '(', 'value', ')', ':', 'if', 'value', 'not', 'in', 'options', ':', 'raise', 'click', '.', 'BadParameter', '(', "'Possible choices are: {0}.'", '.', 'format', '(', "', '", '.', 'join', '(', 'options', ')', ')', ')', 'return', 'value', 'return', 'func...
Callback wrapper for validating click.prompt input. Parameters ---------- options : list List of allowed choices Returns ------- :func:`callable` callback function for value_proc in :func:`click.prompt`. Raises ------ :class:`click.BadParameter`
['Callback', 'wrapper', 'for', 'validating', 'click', '.', 'prompt', 'input', '.']
train
https://github.com/tmux-python/tmuxp/blob/f4aa2e26589a4311131898d2e4a85cb1876b5c9b/tmuxp/cli.py#L103-L129
4,799
theolind/pymysensors
mysensors/handler.py
handle_heartbeat_response_22
def handle_heartbeat_response_22(msg): """Process an internal heartbeat response message.""" if not msg.gateway.is_sensor(msg.node_id): return None msg.gateway.sensors[msg.node_id].heartbeat = msg.payload msg.gateway.alert(msg) return None
python
def handle_heartbeat_response_22(msg): """Process an internal heartbeat response message.""" if not msg.gateway.is_sensor(msg.node_id): return None msg.gateway.sensors[msg.node_id].heartbeat = msg.payload msg.gateway.alert(msg) return None
['def', 'handle_heartbeat_response_22', '(', 'msg', ')', ':', 'if', 'not', 'msg', '.', 'gateway', '.', 'is_sensor', '(', 'msg', '.', 'node_id', ')', ':', 'return', 'None', 'msg', '.', 'gateway', '.', 'sensors', '[', 'msg', '.', 'node_id', ']', '.', 'heartbeat', '=', 'msg', '.', 'payload', 'msg', '.', 'gateway', '.', 'a...
Process an internal heartbeat response message.
['Process', 'an', 'internal', 'heartbeat', 'response', 'message', '.']
train
https://github.com/theolind/pymysensors/blob/a139ab6e2f6b71ebaf37282f69bfd0f7fe6193b6/mysensors/handler.py#L241-L247