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
2,900
mjirik/imcut
imcut/models.py
Model.likelihood
def likelihood(self, x, cl): """ X = numpy.random.random([2,3,4]) # we have data 2x3 with fature vector with 4 fatures Use likelihoodFromImage() function for 3d image input m.likelihood(X,0) """ # sha = x.shape # xr = x.reshape(-1, sha[-1]) # out...
python
def likelihood(self, x, cl): """ X = numpy.random.random([2,3,4]) # we have data 2x3 with fature vector with 4 fatures Use likelihoodFromImage() function for 3d image input m.likelihood(X,0) """ # sha = x.shape # xr = x.reshape(-1, sha[-1]) # out...
['def', 'likelihood', '(', 'self', ',', 'x', ',', 'cl', ')', ':', '# sha = x.shape', '# xr = x.reshape(-1, sha[-1])', '# outsha = sha[:-1]', '# from PyQt4.QtCore import pyqtRemoveInputHook', '# pyqtRemoveInputHook()', 'logger', '.', 'debug', '(', '"likel "', '+', 'str', '(', 'x', '.', 'shape', ')', ')', 'if', 'self', '...
X = numpy.random.random([2,3,4]) # we have data 2x3 with fature vector with 4 fatures Use likelihoodFromImage() function for 3d image input m.likelihood(X,0)
['X', '=', 'numpy', '.', 'random', '.', 'random', '(', '[', '2', '3', '4', ']', ')', '#', 'we', 'have', 'data', '2x3', 'with', 'fature', 'vector', 'with', '4', 'fatures']
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/models.py#L397-L442
2,901
awslabs/mxboard
python/mxboard/writer.py
SummaryWriter.export_scalars
def export_scalars(self, path): """Exports to the given path an ASCII file containing all the scalars written so far by this instance, with the following format: {writer_id : [[timestamp, step, value], ...], ...} """ if os.path.exists(path) and os.path.isfile(path): l...
python
def export_scalars(self, path): """Exports to the given path an ASCII file containing all the scalars written so far by this instance, with the following format: {writer_id : [[timestamp, step, value], ...], ...} """ if os.path.exists(path) and os.path.isfile(path): l...
['def', 'export_scalars', '(', 'self', ',', 'path', ')', ':', 'if', 'os', '.', 'path', '.', 'exists', '(', 'path', ')', 'and', 'os', '.', 'path', '.', 'isfile', '(', 'path', ')', ':', 'logging', '.', 'warning', '(', "'%s already exists and will be overwritten by scalar dict'", ',', 'path', ')', 'with', 'open', '(', 'pa...
Exports to the given path an ASCII file containing all the scalars written so far by this instance, with the following format: {writer_id : [[timestamp, step, value], ...], ...}
['Exports', 'to', 'the', 'given', 'path', 'an', 'ASCII', 'file', 'containing', 'all', 'the', 'scalars', 'written', 'so', 'far', 'by', 'this', 'instance', 'with', 'the', 'following', 'format', ':', '{', 'writer_id', ':', '[[', 'timestamp', 'step', 'value', ']', '...', ']', '...', '}']
train
https://github.com/awslabs/mxboard/blob/36057ff0f05325c9dc2fe046521325bf9d563a88/python/mxboard/writer.py#L358-L366
2,902
vertexproject/synapse
synapse/lib/syntax.py
Parser.stormcmd
def stormcmd(self): ''' A storm sub-query aware command line splitter. ( not for storm commands, but for commands which may take storm ) ''' argv = [] while self.more(): self.ignore(whitespace) if self.nextstr('{'): self.offs += 1 ...
python
def stormcmd(self): ''' A storm sub-query aware command line splitter. ( not for storm commands, but for commands which may take storm ) ''' argv = [] while self.more(): self.ignore(whitespace) if self.nextstr('{'): self.offs += 1 ...
['def', 'stormcmd', '(', 'self', ')', ':', 'argv', '=', '[', ']', 'while', 'self', '.', 'more', '(', ')', ':', 'self', '.', 'ignore', '(', 'whitespace', ')', 'if', 'self', '.', 'nextstr', '(', "'{'", ')', ':', 'self', '.', 'offs', '+=', '1', 'start', '=', 'self', '.', 'offs', 'self', '.', 'query', '(', ')', 'argv', '.'...
A storm sub-query aware command line splitter. ( not for storm commands, but for commands which may take storm )
['A', 'storm', 'sub', '-', 'query', 'aware', 'command', 'line', 'splitter', '.', '(', 'not', 'for', 'storm', 'commands', 'but', 'for', 'commands', 'which', 'may', 'take', 'storm', ')']
train
https://github.com/vertexproject/synapse/blob/22e67c5a8f6d7caddbcf34b39ab1bd2d6c4a6e0b/synapse/lib/syntax.py#L443-L460
2,903
vladcalin/gemstone
gemstone/core/decorators.py
event_handler
def event_handler(event_name): """ Decorator for designating a handler for an event type. ``event_name`` must be a string representing the name of the event type. The decorated function must accept a parameter: the body of the received event, which will be a Python object that can be encoded as a J...
python
def event_handler(event_name): """ Decorator for designating a handler for an event type. ``event_name`` must be a string representing the name of the event type. The decorated function must accept a parameter: the body of the received event, which will be a Python object that can be encoded as a J...
['def', 'event_handler', '(', 'event_name', ')', ':', 'def', 'wrapper', '(', 'func', ')', ':', 'func', '.', '_event_handler', '=', 'True', 'func', '.', '_handled_event', '=', 'event_name', 'return', 'func', 'return', 'wrapper']
Decorator for designating a handler for an event type. ``event_name`` must be a string representing the name of the event type. The decorated function must accept a parameter: the body of the received event, which will be a Python object that can be encoded as a JSON (dict, list, str, int, bool, float ...
['Decorator', 'for', 'designating', 'a', 'handler', 'for', 'an', 'event', 'type', '.', 'event_name', 'must', 'be', 'a', 'string', 'representing', 'the', 'name', 'of', 'the', 'event', 'type', '.']
train
https://github.com/vladcalin/gemstone/blob/325a49d17621b9d45ffd2b5eca6f0de284de8ba4/gemstone/core/decorators.py#L14-L32
2,904
bwhite/hadoopy
hadoopy/thirdparty/pyinstaller/PyInstaller/lib/altgraph/Graph.py
Graph.restore_edge
def restore_edge(self, edge): """ Restores a previously hidden edge back into the graph. """ try: head_id, tail_id, data = self.hidden_edges[edge] self.nodes[tail_id][0].append(edge) self.nodes[head_id][1].append(edge) self.edges[edge] = he...
python
def restore_edge(self, edge): """ Restores a previously hidden edge back into the graph. """ try: head_id, tail_id, data = self.hidden_edges[edge] self.nodes[tail_id][0].append(edge) self.nodes[head_id][1].append(edge) self.edges[edge] = he...
['def', 'restore_edge', '(', 'self', ',', 'edge', ')', ':', 'try', ':', 'head_id', ',', 'tail_id', ',', 'data', '=', 'self', '.', 'hidden_edges', '[', 'edge', ']', 'self', '.', 'nodes', '[', 'tail_id', ']', '[', '0', ']', '.', 'append', '(', 'edge', ')', 'self', '.', 'nodes', '[', 'head_id', ']', '[', '1', ']', '.', 'a...
Restores a previously hidden edge back into the graph.
['Restores', 'a', 'previously', 'hidden', 'edge', 'back', 'into', 'the', 'graph', '.']
train
https://github.com/bwhite/hadoopy/blob/ff39b4e6d4e6efaf1f571cf0f2c0e0d7ab28c2d6/hadoopy/thirdparty/pyinstaller/PyInstaller/lib/altgraph/Graph.py#L161-L172
2,905
SUNCAT-Center/CatHub
cathub/cathubsqlite.py
CathubSQLite.check_reaction_on_surface
def check_reaction_on_surface(self, chemical_composition, reactants, products): """ Check if entry with same surface and reaction is allready written to database file Parameters ---------- chemcial_composition: str reactants: dic...
python
def check_reaction_on_surface(self, chemical_composition, reactants, products): """ Check if entry with same surface and reaction is allready written to database file Parameters ---------- chemcial_composition: str reactants: dic...
['def', 'check_reaction_on_surface', '(', 'self', ',', 'chemical_composition', ',', 'reactants', ',', 'products', ')', ':', 'con', '=', 'self', '.', 'connection', 'or', 'self', '.', '_connect', '(', ')', 'self', '.', '_initialize', '(', 'con', ')', 'cur', '=', 'con', '.', 'cursor', '(', ')', 'statement', '=', '"""SELEC...
Check if entry with same surface and reaction is allready written to database file Parameters ---------- chemcial_composition: str reactants: dict products: dict Returns id or None
['Check', 'if', 'entry', 'with', 'same', 'surface', 'and', 'reaction', 'is', 'allready', 'written', 'to', 'database', 'file']
train
https://github.com/SUNCAT-Center/CatHub/blob/324625d1d8e740673f139658b2de4c9e1059739e/cathub/cathubsqlite.py#L400-L429
2,906
materialsproject/pymatgen
pymatgen/io/phonopy.py
get_ph_bs_symm_line_from_dict
def get_ph_bs_symm_line_from_dict(bands_dict, has_nac=False, labels_dict=None): """ Creates a pymatgen PhononBandStructure object from the dictionary extracted by the band.yaml file produced by phonopy. The labels will be extracted from the dictionary, if present. If the 'eigenvector' key is found t...
python
def get_ph_bs_symm_line_from_dict(bands_dict, has_nac=False, labels_dict=None): """ Creates a pymatgen PhononBandStructure object from the dictionary extracted by the band.yaml file produced by phonopy. The labels will be extracted from the dictionary, if present. If the 'eigenvector' key is found t...
['def', 'get_ph_bs_symm_line_from_dict', '(', 'bands_dict', ',', 'has_nac', '=', 'False', ',', 'labels_dict', '=', 'None', ')', ':', 'structure', '=', 'get_structure_from_dict', '(', 'bands_dict', ')', 'qpts', '=', '[', ']', 'frequencies', '=', '[', ']', 'eigendisplacements', '=', '[', ']', 'phonopy_labels_dict', '=', ...
Creates a pymatgen PhononBandStructure object from the dictionary extracted by the band.yaml file produced by phonopy. The labels will be extracted from the dictionary, if present. If the 'eigenvector' key is found the eigendisplacements will be calculated according to the formula:: ex...
['Creates', 'a', 'pymatgen', 'PhononBandStructure', 'object', 'from', 'the', 'dictionary', 'extracted', 'by', 'the', 'band', '.', 'yaml', 'file', 'produced', 'by', 'phonopy', '.', 'The', 'labels', 'will', 'be', 'extracted', 'from', 'the', 'dictionary', 'if', 'present', '.', 'If', 'the', 'eigenvector', 'key', 'is', 'fou...
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/phonopy.py#L108-L171
2,907
StackStorm/pybind
pybind/slxos/v17s_1_02/qos_mpls/map_/traffic_class_exp/__init__.py
traffic_class_exp._set_priority
def _set_priority(self, v, load=False): """ Setter method for priority, mapped from YANG variable /qos_mpls/map/traffic_class_exp/priority (list) If this variable is read-only (config: false) in the source YANG file, then _set_priority is considered as a private method. Backends looking to populate ...
python
def _set_priority(self, v, load=False): """ Setter method for priority, mapped from YANG variable /qos_mpls/map/traffic_class_exp/priority (list) If this variable is read-only (config: false) in the source YANG file, then _set_priority is considered as a private method. Backends looking to populate ...
['def', '_set_priority', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'YANGListType', '(', '"priority_in_values"', ',', 'priority', '.', 'pr...
Setter method for priority, mapped from YANG variable /qos_mpls/map/traffic_class_exp/priority (list) If this variable is read-only (config: false) in the source YANG file, then _set_priority is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._...
['Setter', 'method', 'for', 'priority', 'mapped', 'from', 'YANG', 'variable', '/', 'qos_mpls', '/', 'map', '/', 'traffic_class_exp', '/', 'priority', '(', 'list', ')', 'If', 'this', 'variable', 'is', 'read', '-', 'only', '(', 'config', ':', 'false', ')', 'in', 'the', 'source', 'YANG', 'file', 'then', '_set_priority', '...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/qos_mpls/map_/traffic_class_exp/__init__.py#L131-L152
2,908
koordinates/python-client
koordinates/exports.py
Export.download
def download(self, path, progress_callback=None, chunk_size=1024**2): """ Download the export archive. .. warning:: If you pass this function an open file-like object as the ``path`` parameter, the function will not close that file for you. If a ``path`` parame...
python
def download(self, path, progress_callback=None, chunk_size=1024**2): """ Download the export archive. .. warning:: If you pass this function an open file-like object as the ``path`` parameter, the function will not close that file for you. If a ``path`` parame...
['def', 'download', '(', 'self', ',', 'path', ',', 'progress_callback', '=', 'None', ',', 'chunk_size', '=', '1024', '**', '2', ')', ':', 'if', 'not', 'self', '.', 'download_url', 'or', 'self', '.', 'state', '!=', "'complete'", ':', 'raise', 'DownloadError', '(', '"Download not available"', ')', '# ignore parsing the C...
Download the export archive. .. warning:: If you pass this function an open file-like object as the ``path`` parameter, the function will not close that file for you. If a ``path`` parameter is a directory, this function will use the Export name to determine the name o...
['Download', 'the', 'export', 'archive', '.']
train
https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/exports.py#L273-L351
2,909
iotile/coretools
iotilecore/iotile/core/hw/virtual/common_types.py
unpack_rpc_payload
def unpack_rpc_payload(resp_format, payload): """Unpack an RPC payload according to resp_format. Args: resp_format (str): a struct format code (without the <) for the parameter format for this RPC. This format code may include the final character V, which means that it expects ...
python
def unpack_rpc_payload(resp_format, payload): """Unpack an RPC payload according to resp_format. Args: resp_format (str): a struct format code (without the <) for the parameter format for this RPC. This format code may include the final character V, which means that it expects ...
['def', 'unpack_rpc_payload', '(', 'resp_format', ',', 'payload', ')', ':', 'code', '=', '_create_argcode', '(', 'resp_format', ',', 'payload', ')', 'return', 'struct', '.', 'unpack', '(', 'code', ',', 'payload', ')']
Unpack an RPC payload according to resp_format. Args: resp_format (str): a struct format code (without the <) for the parameter format for this RPC. This format code may include the final character V, which means that it expects a variable length bytearray. payload (bytes):...
['Unpack', 'an', 'RPC', 'payload', 'according', 'to', 'resp_format', '.']
train
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/virtual/common_types.py#L121-L135
2,910
blockstack/blockstack-core
blockstack/lib/subdomains.py
SubdomainIndex.reindex
def reindex(cls, lastblock, firstblock=None, opts=None): """ Generate a subdomains db from scratch, using the names db and the atlas db and zone file collection. Best to do this in a one-off command (i.e. *not* in the blockstackd process) """ if opts is None: opts = g...
python
def reindex(cls, lastblock, firstblock=None, opts=None): """ Generate a subdomains db from scratch, using the names db and the atlas db and zone file collection. Best to do this in a one-off command (i.e. *not* in the blockstackd process) """ if opts is None: opts = g...
['def', 'reindex', '(', 'cls', ',', 'lastblock', ',', 'firstblock', '=', 'None', ',', 'opts', '=', 'None', ')', ':', 'if', 'opts', 'is', 'None', ':', 'opts', '=', 'get_blockstack_opts', '(', ')', 'if', 'not', 'is_atlas_enabled', '(', 'opts', ')', ':', 'raise', 'Exception', '(', '"Atlas is not enabled"', ')', 'if', 'not...
Generate a subdomains db from scratch, using the names db and the atlas db and zone file collection. Best to do this in a one-off command (i.e. *not* in the blockstackd process)
['Generate', 'a', 'subdomains', 'db', 'from', 'scratch', 'using', 'the', 'names', 'db', 'and', 'the', 'atlas', 'db', 'and', 'zone', 'file', 'collection', '.', 'Best', 'to', 'do', 'this', 'in', 'a', 'one', '-', 'off', 'command', '(', 'i', '.', 'e', '.', '*', 'not', '*', 'in', 'the', 'blockstackd', 'process', ')']
train
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L946-L978
2,911
saltstack/salt
salt/modules/dracr.py
list_users
def list_users(host=None, admin_username=None, admin_password=None, module=None): ''' List all DRAC users CLI Example: .. code-block:: bash salt dell dracr.list_users ''' users = {} _username = '' for idx in range(1, 17): c...
python
def list_users(host=None, admin_username=None, admin_password=None, module=None): ''' List all DRAC users CLI Example: .. code-block:: bash salt dell dracr.list_users ''' users = {} _username = '' for idx in range(1, 17): c...
['def', 'list_users', '(', 'host', '=', 'None', ',', 'admin_username', '=', 'None', ',', 'admin_password', '=', 'None', ',', 'module', '=', 'None', ')', ':', 'users', '=', '{', '}', '_username', '=', "''", 'for', 'idx', 'in', 'range', '(', '1', ',', '17', ')', ':', 'cmd', '=', '__execute_ret', '(', "'getconfig -g '", "...
List all DRAC users CLI Example: .. code-block:: bash salt dell dracr.list_users
['List', 'all', 'DRAC', 'users']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dracr.py#L475-L517
2,912
jochym/Elastic
parcalc/parcalc.py
ClusterVasp.prepare_calc_dir
def prepare_calc_dir(self): ''' Prepare the calculation directory for VASP execution. This needs to be re-implemented for each local setup. The following code reflects just my particular setup. ''' with open("vasprun.conf","w") as f: f.write('NODES="nodes=%s:p...
python
def prepare_calc_dir(self): ''' Prepare the calculation directory for VASP execution. This needs to be re-implemented for each local setup. The following code reflects just my particular setup. ''' with open("vasprun.conf","w") as f: f.write('NODES="nodes=%s:p...
['def', 'prepare_calc_dir', '(', 'self', ')', ':', 'with', 'open', '(', '"vasprun.conf"', ',', '"w"', ')', 'as', 'f', ':', 'f', '.', 'write', '(', '\'NODES="nodes=%s:ppn=%d"\\n\'', '%', '(', 'self', '.', 'nodes', ',', 'self', '.', 'ppn', ')', ')', 'f', '.', 'write', '(', "'BLOCK=%d\\n'", '%', '(', 'self', '.', 'block',...
Prepare the calculation directory for VASP execution. This needs to be re-implemented for each local setup. The following code reflects just my particular setup.
['Prepare', 'the', 'calculation', 'directory', 'for', 'VASP', 'execution', '.', 'This', 'needs', 'to', 'be', 're', '-', 'implemented', 'for', 'each', 'local', 'setup', '.', 'The', 'following', 'code', 'reflects', 'just', 'my', 'particular', 'setup', '.']
train
https://github.com/jochym/Elastic/blob/8daae37d0c48aab8dfb1de2839dab02314817f95/parcalc/parcalc.py#L114-L124
2,913
guaix-ucm/numina
numina/drps/drpsystem.py
DrpSystem.load
def load(self): """Load all available DRPs in 'entry_point'.""" for drpins in self.iload(self.entry): self.drps[drpins.name] = drpins return self
python
def load(self): """Load all available DRPs in 'entry_point'.""" for drpins in self.iload(self.entry): self.drps[drpins.name] = drpins return self
['def', 'load', '(', 'self', ')', ':', 'for', 'drpins', 'in', 'self', '.', 'iload', '(', 'self', '.', 'entry', ')', ':', 'self', '.', 'drps', '[', 'drpins', '.', 'name', ']', '=', 'drpins', 'return', 'self']
Load all available DRPs in 'entry_point'.
['Load', 'all', 'available', 'DRPs', 'in', 'entry_point', '.']
train
https://github.com/guaix-ucm/numina/blob/6c829495df8937f77c2de9383c1038ffb3e713e3/numina/drps/drpsystem.py#L27-L33
2,914
gabstopper/smc-python
smc/administration/certificates/vpn.py
VPNCertificateCA.create
def create(cls, name, certificate): """ Create a new external VPN CA for signing internal gateway certificates. :param str name: Name of VPN CA :param str certificate: file name, path or certificate string. :raises CreateElementFailed: Failed creating cert with r...
python
def create(cls, name, certificate): """ Create a new external VPN CA for signing internal gateway certificates. :param str name: Name of VPN CA :param str certificate: file name, path or certificate string. :raises CreateElementFailed: Failed creating cert with r...
['def', 'create', '(', 'cls', ',', 'name', ',', 'certificate', ')', ':', 'json', '=', '{', "'name'", ':', 'name', ',', "'certificate'", ':', 'certificate', '}', 'return', 'ElementCreator', '(', 'cls', ',', 'json', ')']
Create a new external VPN CA for signing internal gateway certificates. :param str name: Name of VPN CA :param str certificate: file name, path or certificate string. :raises CreateElementFailed: Failed creating cert with reason :rtype: VPNCertificateCA
['Create', 'a', 'new', 'external', 'VPN', 'CA', 'for', 'signing', 'internal', 'gateway', 'certificates', '.', ':', 'param', 'str', 'name', ':', 'Name', 'of', 'VPN', 'CA', ':', 'param', 'str', 'certificate', ':', 'file', 'name', 'path', 'or', 'certificate', 'string', '.', ':', 'raises', 'CreateElementFailed', ':', 'Fail...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/certificates/vpn.py#L28-L41
2,915
CartoDB/cartoframes
cartoframes/credentials.py
Credentials.save
def save(self, config_loc=None): """Saves current user credentials to user directory. Args: config_loc (str, optional): Location where credentials are to be stored. If no argument is provided, it will be send to the default location. Example: ...
python
def save(self, config_loc=None): """Saves current user credentials to user directory. Args: config_loc (str, optional): Location where credentials are to be stored. If no argument is provided, it will be send to the default location. Example: ...
['def', 'save', '(', 'self', ',', 'config_loc', '=', 'None', ')', ':', 'if', 'not', 'os', '.', 'path', '.', 'exists', '(', '_USER_CONFIG_DIR', ')', ':', '"""create directory if not exists"""', 'os', '.', 'makedirs', '(', '_USER_CONFIG_DIR', ')', 'with', 'open', '(', '_DEFAULT_PATH', ',', "'w'", ')', 'as', 'f', ':', 'js...
Saves current user credentials to user directory. Args: config_loc (str, optional): Location where credentials are to be stored. If no argument is provided, it will be send to the default location. Example: .. code:: from cartof...
['Saves', 'current', 'user', 'credentials', 'to', 'user', 'directory', '.']
train
https://github.com/CartoDB/cartoframes/blob/c94238a545f3dec45963dac3892540942b6f0df8/cartoframes/credentials.py#L94-L116
2,916
sentinel-hub/sentinelhub-py
sentinelhub/geo_utils.py
get_utm_crs
def get_utm_crs(lng, lat, source_crs=CRS.WGS84): """ Get CRS for UTM zone in which (lat, lng) is contained. :param lng: longitude :type lng: float :param lat: latitude :type lat: float :param source_crs: source CRS :type source_crs: constants.CRS :return: CRS of the zone containing the ...
python
def get_utm_crs(lng, lat, source_crs=CRS.WGS84): """ Get CRS for UTM zone in which (lat, lng) is contained. :param lng: longitude :type lng: float :param lat: latitude :type lat: float :param source_crs: source CRS :type source_crs: constants.CRS :return: CRS of the zone containing the ...
['def', 'get_utm_crs', '(', 'lng', ',', 'lat', ',', 'source_crs', '=', 'CRS', '.', 'WGS84', ')', ':', 'if', 'source_crs', 'is', 'not', 'CRS', '.', 'WGS84', ':', 'lng', ',', 'lat', '=', 'transform_point', '(', '(', 'lng', ',', 'lat', ')', ',', 'source_crs', ',', 'CRS', '.', 'WGS84', ')', 'return', 'CRS', '.', 'get_utm_f...
Get CRS for UTM zone in which (lat, lng) is contained. :param lng: longitude :type lng: float :param lat: latitude :type lat: float :param source_crs: source CRS :type source_crs: constants.CRS :return: CRS of the zone containing the lat,lon point :rtype: constants.CRS
['Get', 'CRS', 'for', 'UTM', 'zone', 'in', 'which', '(', 'lat', 'lng', ')', 'is', 'contained', '.']
train
https://github.com/sentinel-hub/sentinelhub-py/blob/08a83b7f1e289187159a643336995d8369860fea/sentinelhub/geo_utils.py#L200-L214
2,917
spyder-ide/spyder
spyder/utils/introspection/fallback_plugin.py
FallbackPlugin.get_completions
def get_completions(self, info): """Return a list of (completion, type) tuples Simple completion based on python-like identifiers and whitespace """ if not info['obj']: return items = [] obj = info['obj'] if info['context']: lexe...
python
def get_completions(self, info): """Return a list of (completion, type) tuples Simple completion based on python-like identifiers and whitespace """ if not info['obj']: return items = [] obj = info['obj'] if info['context']: lexe...
['def', 'get_completions', '(', 'self', ',', 'info', ')', ':', 'if', 'not', 'info', '[', "'obj'", ']', ':', 'return', 'items', '=', '[', ']', 'obj', '=', 'info', '[', "'obj'", ']', 'if', 'info', '[', "'context'", ']', ':', 'lexer', '=', 'find_lexer_for_filename', '(', 'info', '[', "'filename'", ']', ')', '# get a list ...
Return a list of (completion, type) tuples Simple completion based on python-like identifiers and whitespace
['Return', 'a', 'list', 'of', '(', 'completion', 'type', ')', 'tuples', 'Simple', 'completion', 'based', 'on', 'python', '-', 'like', 'identifiers', 'and', 'whitespace']
train
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/introspection/fallback_plugin.py#L37-L79
2,918
opendatateam/udata
udata/core/spatial/geoids.py
build
def build(level, code, validity=None): '''Serialize a GeoID from its parts''' spatial = ':'.join((level, code)) if not validity: return spatial elif isinstance(validity, basestring): return '@'.join((spatial, validity)) elif isinstance(validity, datetime): return '@'.join((sp...
python
def build(level, code, validity=None): '''Serialize a GeoID from its parts''' spatial = ':'.join((level, code)) if not validity: return spatial elif isinstance(validity, basestring): return '@'.join((spatial, validity)) elif isinstance(validity, datetime): return '@'.join((sp...
['def', 'build', '(', 'level', ',', 'code', ',', 'validity', '=', 'None', ')', ':', 'spatial', '=', "':'", '.', 'join', '(', '(', 'level', ',', 'code', ')', ')', 'if', 'not', 'validity', ':', 'return', 'spatial', 'elif', 'isinstance', '(', 'validity', ',', 'basestring', ')', ':', 'return', "'@'", '.', 'join', '(', '(',...
Serialize a GeoID from its parts
['Serialize', 'a', 'GeoID', 'from', 'its', 'parts']
train
https://github.com/opendatateam/udata/blob/f016585af94b0ff6bd73738c700324adc8ba7f8f/udata/core/spatial/geoids.py#L41-L54
2,919
projectatomic/osbs-client
osbs/api.py
OSBS.get_pod_for_build
def get_pod_for_build(self, build_id): """ :return: PodResponse object for pod relating to the build """ pods = self.os.list_pods(label='openshift.io/build.name=%s' % build_id) serialized_response = pods.json() pod_list = [PodResponse(pod) for pod in serialized_response["...
python
def get_pod_for_build(self, build_id): """ :return: PodResponse object for pod relating to the build """ pods = self.os.list_pods(label='openshift.io/build.name=%s' % build_id) serialized_response = pods.json() pod_list = [PodResponse(pod) for pod in serialized_response["...
['def', 'get_pod_for_build', '(', 'self', ',', 'build_id', ')', ':', 'pods', '=', 'self', '.', 'os', '.', 'list_pods', '(', 'label', '=', "'openshift.io/build.name=%s'", '%', 'build_id', ')', 'serialized_response', '=', 'pods', '.', 'json', '(', ')', 'pod_list', '=', '[', 'PodResponse', '(', 'pod', ')', 'for', 'pod', '...
:return: PodResponse object for pod relating to the build
[':', 'return', ':', 'PodResponse', 'object', 'for', 'pod', 'relating', 'to', 'the', 'build']
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L182-L194
2,920
Illumina/interop
src/examples/python/summary.py
main
def main(): """ Retrieve run folder paths from the command line Ensure only metrics required for summary are loaded Load the run metrics Calculate the summary metrics Display error by lane, read """ logging.basicConfig(level=logging.INFO) run_metrics = py_interop_run_metrics.run_metrics...
python
def main(): """ Retrieve run folder paths from the command line Ensure only metrics required for summary are loaded Load the run metrics Calculate the summary metrics Display error by lane, read """ logging.basicConfig(level=logging.INFO) run_metrics = py_interop_run_metrics.run_metrics...
['def', 'main', '(', ')', ':', 'logging', '.', 'basicConfig', '(', 'level', '=', 'logging', '.', 'INFO', ')', 'run_metrics', '=', 'py_interop_run_metrics', '.', 'run_metrics', '(', ')', 'summary', '=', 'py_interop_summary', '.', 'run_summary', '(', ')', 'valid_to_load', '=', 'py_interop_run', '.', 'uchar_vector', '(', ...
Retrieve run folder paths from the command line Ensure only metrics required for summary are loaded Load the run metrics Calculate the summary metrics Display error by lane, read
['Retrieve', 'run', 'folder', 'paths', 'from', 'the', 'command', 'line', 'Ensure', 'only', 'metrics', 'required', 'for', 'summary', 'are', 'loaded', 'Load', 'the', 'run', 'metrics', 'Calculate', 'the', 'summary', 'metrics', 'Display', 'error', 'by', 'lane', 'read']
train
https://github.com/Illumina/interop/blob/a55b40bde4b764e3652758f6cdf72aef5f473370/src/examples/python/summary.py#L17-L49
2,921
influxdata/influxdb-python
influxdb/influxdb08/client.py
InfluxDBClient.delete_cluster_admin
def delete_cluster_admin(self, username): """Delete cluster admin.""" url = "cluster_admins/{0}".format(username) self.request( url=url, method='DELETE', expected_response_code=200 ) return True
python
def delete_cluster_admin(self, username): """Delete cluster admin.""" url = "cluster_admins/{0}".format(username) self.request( url=url, method='DELETE', expected_response_code=200 ) return True
['def', 'delete_cluster_admin', '(', 'self', ',', 'username', ')', ':', 'url', '=', '"cluster_admins/{0}"', '.', 'format', '(', 'username', ')', 'self', '.', 'request', '(', 'url', '=', 'url', ',', 'method', '=', "'DELETE'", ',', 'expected_response_code', '=', '200', ')', 'return', 'True']
Delete cluster admin.
['Delete', 'cluster', 'admin', '.']
train
https://github.com/influxdata/influxdb-python/blob/d5d12499f3755199d5eedd8b363450f1cf4073bd/influxdb/influxdb08/client.py#L640-L650
2,922
Erotemic/utool
utool/util_list.py
isetdiff_flags
def isetdiff_flags(list1, list2): """ move to util_iter """ set2 = set(list2) return (item not in set2 for item in list1)
python
def isetdiff_flags(list1, list2): """ move to util_iter """ set2 = set(list2) return (item not in set2 for item in list1)
['def', 'isetdiff_flags', '(', 'list1', ',', 'list2', ')', ':', 'set2', '=', 'set', '(', 'list2', ')', 'return', '(', 'item', 'not', 'in', 'set2', 'for', 'item', 'in', 'list1', ')']
move to util_iter
['move', 'to', 'util_iter']
train
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_list.py#L1437-L1442
2,923
sdispater/eloquent
eloquent/orm/relations/has_many_through.py
HasManyThrough._set_join
def _set_join(self, query=None): """ Set the join clause for the query. """ if not query: query = self._query foreign_key = '%s.%s' % (self._related.get_table(), self._second_key) query.join(self._parent.get_table(), self.get_qualified_parent_key_name(), '='...
python
def _set_join(self, query=None): """ Set the join clause for the query. """ if not query: query = self._query foreign_key = '%s.%s' % (self._related.get_table(), self._second_key) query.join(self._parent.get_table(), self.get_qualified_parent_key_name(), '='...
['def', '_set_join', '(', 'self', ',', 'query', '=', 'None', ')', ':', 'if', 'not', 'query', ':', 'query', '=', 'self', '.', '_query', 'foreign_key', '=', "'%s.%s'", '%', '(', 'self', '.', '_related', '.', 'get_table', '(', ')', ',', 'self', '.', '_second_key', ')', 'query', '.', 'join', '(', 'self', '.', '_parent', '....
Set the join clause for the query.
['Set', 'the', 'join', 'clause', 'for', 'the', 'query', '.']
train
https://github.com/sdispater/eloquent/blob/0638b688d5fd0c1a46b7471dd465eeb4c2f84666/eloquent/orm/relations/has_many_through.py#L61-L70
2,924
aquatix/python-utilkit
utilkit/stringutil.py
safe_unicode
def safe_unicode(obj, *args): """ return the unicode representation of obj """ try: return unicode(obj, *args) # noqa for undefined-variable except UnicodeDecodeError: # obj is byte string ascii_text = str(obj).encode('string_escape') try: return unicode(ascii_te...
python
def safe_unicode(obj, *args): """ return the unicode representation of obj """ try: return unicode(obj, *args) # noqa for undefined-variable except UnicodeDecodeError: # obj is byte string ascii_text = str(obj).encode('string_escape') try: return unicode(ascii_te...
['def', 'safe_unicode', '(', 'obj', ',', '*', 'args', ')', ':', 'try', ':', 'return', 'unicode', '(', 'obj', ',', '*', 'args', ')', '# noqa for undefined-variable', 'except', 'UnicodeDecodeError', ':', '# obj is byte string', 'ascii_text', '=', 'str', '(', 'obj', ')', '.', 'encode', '(', "'string_escape'", ')', 'try', ...
return the unicode representation of obj
['return', 'the', 'unicode', 'representation', 'of', 'obj']
train
https://github.com/aquatix/python-utilkit/blob/1b4a4175381d2175592208619315f399610f915c/utilkit/stringutil.py#L6-L20
2,925
twoolie/NBT
nbt/chunk.py
BlockArray.get_blocks_byte_array
def get_blocks_byte_array(self, buffer=False): """Return a list of all blocks in this chunk.""" if buffer: length = len(self.blocksList) return BytesIO(pack(">i", length)+self.get_blocks_byte_array()) else: return array.array('B', self.blocksList).tostring()
python
def get_blocks_byte_array(self, buffer=False): """Return a list of all blocks in this chunk.""" if buffer: length = len(self.blocksList) return BytesIO(pack(">i", length)+self.get_blocks_byte_array()) else: return array.array('B', self.blocksList).tostring()
['def', 'get_blocks_byte_array', '(', 'self', ',', 'buffer', '=', 'False', ')', ':', 'if', 'buffer', ':', 'length', '=', 'len', '(', 'self', '.', 'blocksList', ')', 'return', 'BytesIO', '(', 'pack', '(', '">i"', ',', 'length', ')', '+', 'self', '.', 'get_blocks_byte_array', '(', ')', ')', 'else', ':', 'return', 'array'...
Return a list of all blocks in this chunk.
['Return', 'a', 'list', 'of', 'all', 'blocks', 'in', 'this', 'chunk', '.']
train
https://github.com/twoolie/NBT/blob/b06dd6cc8117d2788da1d8416e642d58bad45762/nbt/chunk.py#L329-L335
2,926
tensorpack/tensorpack
tensorpack/models/registry.py
layer_register
def layer_register( log_shape=False, use_scope=True): """ Args: log_shape (bool): log input/output shape of this layer use_scope (bool or None): Whether to call this layer with an extra first argument as variable scope. When set to None, it can be called e...
python
def layer_register( log_shape=False, use_scope=True): """ Args: log_shape (bool): log input/output shape of this layer use_scope (bool or None): Whether to call this layer with an extra first argument as variable scope. When set to None, it can be called e...
['def', 'layer_register', '(', 'log_shape', '=', 'False', ',', 'use_scope', '=', 'True', ')', ':', 'def', 'wrapper', '(', 'func', ')', ':', '@', 'wraps', '(', 'func', ')', 'def', 'wrapped_func', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'assert', 'args', '[', '0', ']', 'is', 'not', 'None', ',', 'args', 'if',...
Args: log_shape (bool): log input/output shape of this layer use_scope (bool or None): Whether to call this layer with an extra first argument as variable scope. When set to None, it can be called either with or without the scope name argument, depend on whether the f...
['Args', ':', 'log_shape', '(', 'bool', ')', ':', 'log', 'input', '/', 'output', 'shape', 'of', 'this', 'layer', 'use_scope', '(', 'bool', 'or', 'None', ')', ':', 'Whether', 'to', 'call', 'this', 'layer', 'with', 'an', 'extra', 'first', 'argument', 'as', 'variable', 'scope', '.', 'When', 'set', 'to', 'None', 'it', 'can...
train
https://github.com/tensorpack/tensorpack/blob/d7a13cb74c9066bc791d7aafc3b744b60ee79a9f/tensorpack/models/registry.py#L64-L155
2,927
SCIP-Interfaces/PySCIPOpt
examples/finished/read_tsplib.py
distATT
def distATT(x1,y1,x2,y2): """Compute the ATT distance between two points (see TSPLIB documentation)""" xd = x2 - x1 yd = y2 - y1 rij = math.sqrt((xd*xd + yd*yd) /10.) tij = int(rij + .5) if tij < rij: return tij + 1 else: return tij
python
def distATT(x1,y1,x2,y2): """Compute the ATT distance between two points (see TSPLIB documentation)""" xd = x2 - x1 yd = y2 - y1 rij = math.sqrt((xd*xd + yd*yd) /10.) tij = int(rij + .5) if tij < rij: return tij + 1 else: return tij
['def', 'distATT', '(', 'x1', ',', 'y1', ',', 'x2', ',', 'y2', ')', ':', 'xd', '=', 'x2', '-', 'x1', 'yd', '=', 'y2', '-', 'y1', 'rij', '=', 'math', '.', 'sqrt', '(', '(', 'xd', '*', 'xd', '+', 'yd', '*', 'yd', ')', '/', '10.', ')', 'tij', '=', 'int', '(', 'rij', '+', '.5', ')', 'if', 'tij', '<', 'rij', ':', 'return', ...
Compute the ATT distance between two points (see TSPLIB documentation)
['Compute', 'the', 'ATT', 'distance', 'between', 'two', 'points', '(', 'see', 'TSPLIB', 'documentation', ')']
train
https://github.com/SCIP-Interfaces/PySCIPOpt/blob/9c960b40d94a48b0304d73dbe28b467b9c065abe/examples/finished/read_tsplib.py#L42-L51
2,928
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/widgetdelegate.py
WidgetDelegateViewMixin.index_at_event
def index_at_event(self, event): """Get the index under the position of the given MouseEvent :param event: the mouse event :type event: :class:`QtGui.QMouseEvent` :returns: the index :rtype: :class:`QtCore.QModelIndex` :raises: None """ # find index at mo...
python
def index_at_event(self, event): """Get the index under the position of the given MouseEvent :param event: the mouse event :type event: :class:`QtGui.QMouseEvent` :returns: the index :rtype: :class:`QtCore.QModelIndex` :raises: None """ # find index at mo...
['def', 'index_at_event', '(', 'self', ',', 'event', ')', ':', '# find index at mouse position', 'globalpos', '=', 'event', '.', 'globalPos', '(', ')', 'viewport', '=', 'self', '.', 'viewport', '(', ')', 'pos', '=', 'viewport', '.', 'mapFromGlobal', '(', 'globalpos', ')', 'return', 'self', '.', 'indexAt', '(', 'pos', '...
Get the index under the position of the given MouseEvent :param event: the mouse event :type event: :class:`QtGui.QMouseEvent` :returns: the index :rtype: :class:`QtCore.QModelIndex` :raises: None
['Get', 'the', 'index', 'under', 'the', 'position', 'of', 'the', 'given', 'MouseEvent']
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgetdelegate.py#L362-L375
2,929
dmlc/gluon-nlp
src/gluonnlp/data/batchify/batchify.py
_pad_arrs_to_max_length
def _pad_arrs_to_max_length(arrs, pad_axis, pad_val, use_shared_mem, dtype): """Inner Implementation of the Pad batchify Parameters ---------- arrs : list pad_axis : int pad_val : number use_shared_mem : bool, default False Returns ------- ret : NDArray original_length : ND...
python
def _pad_arrs_to_max_length(arrs, pad_axis, pad_val, use_shared_mem, dtype): """Inner Implementation of the Pad batchify Parameters ---------- arrs : list pad_axis : int pad_val : number use_shared_mem : bool, default False Returns ------- ret : NDArray original_length : ND...
['def', '_pad_arrs_to_max_length', '(', 'arrs', ',', 'pad_axis', ',', 'pad_val', ',', 'use_shared_mem', ',', 'dtype', ')', ':', 'if', 'isinstance', '(', 'arrs', '[', '0', ']', ',', 'mx', '.', 'nd', '.', 'NDArray', ')', ':', 'dtype', '=', 'arrs', '[', '0', ']', '.', 'dtype', 'if', 'dtype', 'is', 'None', 'else', 'dtype',...
Inner Implementation of the Pad batchify Parameters ---------- arrs : list pad_axis : int pad_val : number use_shared_mem : bool, default False Returns ------- ret : NDArray original_length : NDArray
['Inner', 'Implementation', 'of', 'the', 'Pad', 'batchify']
train
https://github.com/dmlc/gluon-nlp/blob/4b83eb6bcc8881e5f1081a3675adaa19fac5c0ba/src/gluonnlp/data/batchify/batchify.py#L29-L75
2,930
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.bk_default
def bk_default(cls): "Make the current background color the default." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_MASK #wAttributes |= win32.BACKGROUND_BLACK wAttributes &= ~win32.BACKGROUND_INTENSITY cls._set_text_attributes(wAttributes)
python
def bk_default(cls): "Make the current background color the default." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.BACKGROUND_MASK #wAttributes |= win32.BACKGROUND_BLACK wAttributes &= ~win32.BACKGROUND_INTENSITY cls._set_text_attributes(wAttributes)
['def', 'bk_default', '(', 'cls', ')', ':', 'wAttributes', '=', 'cls', '.', '_get_text_attributes', '(', ')', 'wAttributes', '&=', '~', 'win32', '.', 'BACKGROUND_MASK', '#wAttributes |= win32.BACKGROUND_BLACK', 'wAttributes', '&=', '~', 'win32', '.', 'BACKGROUND_INTENSITY', 'cls', '.', '_set_text_attributes', '(', 'wAt...
Make the current background color the default.
['Make', 'the', 'current', 'background', 'color', 'the', 'default', '.']
train
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L1009-L1015
2,931
Duke-GCB/DukeDSClient
ddsc/config.py
Config.add_properties
def add_properties(self, filename): """ Add properties to config based on filename replacing previous values. :param filename: str path to YAML file to pull top level properties from """ filename = os.path.expanduser(filename) if os.path.exists(filename): with...
python
def add_properties(self, filename): """ Add properties to config based on filename replacing previous values. :param filename: str path to YAML file to pull top level properties from """ filename = os.path.expanduser(filename) if os.path.exists(filename): with...
['def', 'add_properties', '(', 'self', ',', 'filename', ')', ':', 'filename', '=', 'os', '.', 'path', '.', 'expanduser', '(', 'filename', ')', 'if', 'os', '.', 'path', '.', 'exists', '(', 'filename', ')', ':', 'with', 'open', '(', 'filename', ',', "'r'", ')', 'as', 'yaml_file', ':', 'self', '.', 'update_properties', '(...
Add properties to config based on filename replacing previous values. :param filename: str path to YAML file to pull top level properties from
['Add', 'properties', 'to', 'config', 'based', 'on', 'filename', 'replacing', 'previous', 'values', '.', ':', 'param', 'filename', ':', 'str', 'path', 'to', 'YAML', 'file', 'to', 'pull', 'top', 'level', 'properties', 'from']
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/config.py#L81-L89
2,932
pkgw/pwkit
pwkit/msmt.py
Uval.from_pcount
def from_pcount(nevents): """We assume a Poisson process. nevents is the number of events in some interval. The distribution of values is the distribution of the Poisson rate parameter given this observed number of events, where the "rate" is in units of events per interval of the same d...
python
def from_pcount(nevents): """We assume a Poisson process. nevents is the number of events in some interval. The distribution of values is the distribution of the Poisson rate parameter given this observed number of events, where the "rate" is in units of events per interval of the same d...
['def', 'from_pcount', '(', 'nevents', ')', ':', 'if', 'nevents', '<', '0', ':', 'raise', 'ValueError', '(', "'Poisson parameter `nevents` must be nonnegative'", ')', 'return', 'Uval', '(', 'np', '.', 'random', '.', 'gamma', '(', 'nevents', '+', '1', ',', 'size', '=', 'uval_nsamples', ')', ')']
We assume a Poisson process. nevents is the number of events in some interval. The distribution of values is the distribution of the Poisson rate parameter given this observed number of events, where the "rate" is in units of events per interval of the same duration. The max-likelihood v...
['We', 'assume', 'a', 'Poisson', 'process', '.', 'nevents', 'is', 'the', 'number', 'of', 'events', 'in', 'some', 'interval', '.', 'The', 'distribution', 'of', 'values', 'is', 'the', 'distribution', 'of', 'the', 'Poisson', 'rate', 'parameter', 'given', 'this', 'observed', 'number', 'of', 'events', 'where', 'the', 'rate'...
train
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/msmt.py#L353-L363
2,933
readbeyond/aeneas
aeneas/textfile.py
TextFile.children_not_empty
def children_not_empty(self): """ Return the direct not empty children of the root of the fragments tree, as ``TextFile`` objects. :rtype: list of :class:`~aeneas.textfile.TextFile` """ children = [] for child_node in self.fragments_tree.children_not_empty: ...
python
def children_not_empty(self): """ Return the direct not empty children of the root of the fragments tree, as ``TextFile`` objects. :rtype: list of :class:`~aeneas.textfile.TextFile` """ children = [] for child_node in self.fragments_tree.children_not_empty: ...
['def', 'children_not_empty', '(', 'self', ')', ':', 'children', '=', '[', ']', 'for', 'child_node', 'in', 'self', '.', 'fragments_tree', '.', 'children_not_empty', ':', 'child_text_file', '=', 'self', '.', 'get_subtree', '(', 'child_node', ')', 'child_text_file', '.', 'set_language', '(', 'child_node', '.', 'value', '...
Return the direct not empty children of the root of the fragments tree, as ``TextFile`` objects. :rtype: list of :class:`~aeneas.textfile.TextFile`
['Return', 'the', 'direct', 'not', 'empty', 'children', 'of', 'the', 'root', 'of', 'the', 'fragments', 'tree', 'as', 'TextFile', 'objects', '.']
train
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/textfile.py#L455-L467
2,934
saltstack/salt
salt/states/boto_apigateway.py
_Swagger.deploy_models
def deploy_models(self, ret): ''' Method to deploy swagger file's definition objects and associated schema to AWS Apigateway as Models ret a dictionary for returning status to Saltstack ''' for model, schema in self.models(): # add in a few attributes in...
python
def deploy_models(self, ret): ''' Method to deploy swagger file's definition objects and associated schema to AWS Apigateway as Models ret a dictionary for returning status to Saltstack ''' for model, schema in self.models(): # add in a few attributes in...
['def', 'deploy_models', '(', 'self', ',', 'ret', ')', ':', 'for', 'model', ',', 'schema', 'in', 'self', '.', 'models', '(', ')', ':', '# add in a few attributes into the model schema that AWS expects', '# _schema = schema.copy()', '_schema', '=', 'self', '.', '_update_schema_to_aws_notation', '(', 'schema', ')', '_sch...
Method to deploy swagger file's definition objects and associated schema to AWS Apigateway as Models ret a dictionary for returning status to Saltstack
['Method', 'to', 'deploy', 'swagger', 'file', 's', 'definition', 'objects', 'and', 'associated', 'schema', 'to', 'AWS', 'Apigateway', 'as', 'Models']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1360-L1416
2,935
saltstack/salt
salt/modules/selinux.py
getenforce
def getenforce(): ''' Return the mode selinux is running in CLI Example: .. code-block:: bash salt '*' selinux.getenforce ''' _selinux_fs_path = selinux_fs_path() if _selinux_fs_path is None: return 'Disabled' try: enforce = os.path.join(_selinux_fs_path, 'enfo...
python
def getenforce(): ''' Return the mode selinux is running in CLI Example: .. code-block:: bash salt '*' selinux.getenforce ''' _selinux_fs_path = selinux_fs_path() if _selinux_fs_path is None: return 'Disabled' try: enforce = os.path.join(_selinux_fs_path, 'enfo...
['def', 'getenforce', '(', ')', ':', '_selinux_fs_path', '=', 'selinux_fs_path', '(', ')', 'if', '_selinux_fs_path', 'is', 'None', ':', 'return', "'Disabled'", 'try', ':', 'enforce', '=', 'os', '.', 'path', '.', 'join', '(', '_selinux_fs_path', ',', "'enforce'", ')', 'with', 'salt', '.', 'utils', '.', 'files', '.', 'fo...
Return the mode selinux is running in CLI Example: .. code-block:: bash salt '*' selinux.getenforce
['Return', 'the', 'mode', 'selinux', 'is', 'running', 'in']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L85-L106
2,936
nicolargo/glances
glances/stats.py
GlancesStats.load_plugins
def load_plugins(self, args=None): """Load all plugins in the 'plugins' folder.""" for item in os.listdir(plugins_path): if (item.startswith(self.header) and item.endswith(".py") and item != (self.header + "plugin.py")): # Load the plug...
python
def load_plugins(self, args=None): """Load all plugins in the 'plugins' folder.""" for item in os.listdir(plugins_path): if (item.startswith(self.header) and item.endswith(".py") and item != (self.header + "plugin.py")): # Load the plug...
['def', 'load_plugins', '(', 'self', ',', 'args', '=', 'None', ')', ':', 'for', 'item', 'in', 'os', '.', 'listdir', '(', 'plugins_path', ')', ':', 'if', '(', 'item', '.', 'startswith', '(', 'self', '.', 'header', ')', 'and', 'item', '.', 'endswith', '(', '".py"', ')', 'and', 'item', '!=', '(', 'self', '.', 'header', '+...
Load all plugins in the 'plugins' folder.
['Load', 'all', 'plugins', 'in', 'the', 'plugins', 'folder', '.']
train
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/stats.py#L131-L142
2,937
krukas/Trionyx
trionyx/navigation.py
TabRegister.update
def update(self, model_alias, code='general', name=None, order=None, display_filter=None): """ Update given tab :param model_alias: :param code: :param name: :param order: :param display_filter: :return: """ model_alias = self.get_model_al...
python
def update(self, model_alias, code='general', name=None, order=None, display_filter=None): """ Update given tab :param model_alias: :param code: :param name: :param order: :param display_filter: :return: """ model_alias = self.get_model_al...
['def', 'update', '(', 'self', ',', 'model_alias', ',', 'code', '=', "'general'", ',', 'name', '=', 'None', ',', 'order', '=', 'None', ',', 'display_filter', '=', 'None', ')', ':', 'model_alias', '=', 'self', '.', 'get_model_alias', '(', 'model_alias', ')', 'for', 'item', 'in', 'self', '.', 'tabs', '[', 'model_alias', ...
Update given tab :param model_alias: :param code: :param name: :param order: :param display_filter: :return:
['Update', 'given', 'tab']
train
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/navigation.py#L285-L307
2,938
pandas-dev/pandas
pandas/io/excel/_openpyxl.py
_OpenpyxlWriter._convert_to_color
def _convert_to_color(cls, color_spec): """ Convert ``color_spec`` to an openpyxl v2 Color object Parameters ---------- color_spec : str, dict A 32-bit ARGB hex string, or a dict with zero or more of the following keys. 'rgb' ...
python
def _convert_to_color(cls, color_spec): """ Convert ``color_spec`` to an openpyxl v2 Color object Parameters ---------- color_spec : str, dict A 32-bit ARGB hex string, or a dict with zero or more of the following keys. 'rgb' ...
['def', '_convert_to_color', '(', 'cls', ',', 'color_spec', ')', ':', 'from', 'openpyxl', '.', 'styles', 'import', 'Color', 'if', 'isinstance', '(', 'color_spec', ',', 'str', ')', ':', 'return', 'Color', '(', 'color_spec', ')', 'else', ':', 'return', 'Color', '(', '*', '*', 'color_spec', ')']
Convert ``color_spec`` to an openpyxl v2 Color object Parameters ---------- color_spec : str, dict A 32-bit ARGB hex string, or a dict with zero or more of the following keys. 'rgb' 'indexed' 'auto' 'theme' ...
['Convert', 'color_spec', 'to', 'an', 'openpyxl', 'v2', 'Color', 'object', 'Parameters', '----------', 'color_spec', ':', 'str', 'dict', 'A', '32', '-', 'bit', 'ARGB', 'hex', 'string', 'or', 'a', 'dict', 'with', 'zero', 'or', 'more', 'of', 'the', 'following', 'keys', '.', 'rgb', 'indexed', 'auto', 'theme', 'tint', 'ind...
train
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/excel/_openpyxl.py#L98-L123
2,939
wonambi-python/wonambi
wonambi/utils/simulate.py
create_channels
def create_channels(chan_name=None, n_chan=None): """Create instance of Channels with random xyz coordinates Parameters ---------- chan_name : list of str names of the channels n_chan : int if chan_name is not specified, this defines the number of channels Returns ------- ...
python
def create_channels(chan_name=None, n_chan=None): """Create instance of Channels with random xyz coordinates Parameters ---------- chan_name : list of str names of the channels n_chan : int if chan_name is not specified, this defines the number of channels Returns ------- ...
['def', 'create_channels', '(', 'chan_name', '=', 'None', ',', 'n_chan', '=', 'None', ')', ':', 'if', 'chan_name', 'is', 'not', 'None', ':', 'n_chan', '=', 'len', '(', 'chan_name', ')', 'elif', 'n_chan', 'is', 'not', 'None', ':', 'chan_name', '=', '_make_chan_name', '(', 'n_chan', ')', 'else', ':', 'raise', 'TypeError'...
Create instance of Channels with random xyz coordinates Parameters ---------- chan_name : list of str names of the channels n_chan : int if chan_name is not specified, this defines the number of channels Returns ------- instance of Channels where the location of the...
['Create', 'instance', 'of', 'Channels', 'with', 'random', 'xyz', 'coordinates']
train
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/utils/simulate.py#L145-L170
2,940
thomasballinger/trellocardupdate
trellocardupdate/trelloupdate.py
TrelloUpdater.card_names_and_ids
def card_names_and_ids(self): """Returns [(name, id), ...] pairs of cards from current board""" b = Board(self.client, self.board_id) cards = b.getCards() card_names_and_ids = [(unidecode(c.name), c.id) for c in cards] return card_names_and_ids
python
def card_names_and_ids(self): """Returns [(name, id), ...] pairs of cards from current board""" b = Board(self.client, self.board_id) cards = b.getCards() card_names_and_ids = [(unidecode(c.name), c.id) for c in cards] return card_names_and_ids
['def', 'card_names_and_ids', '(', 'self', ')', ':', 'b', '=', 'Board', '(', 'self', '.', 'client', ',', 'self', '.', 'board_id', ')', 'cards', '=', 'b', '.', 'getCards', '(', ')', 'card_names_and_ids', '=', '[', '(', 'unidecode', '(', 'c', '.', 'name', ')', ',', 'c', '.', 'id', ')', 'for', 'c', 'in', 'cards', ']', 're...
Returns [(name, id), ...] pairs of cards from current board
['Returns', '[', '(', 'name', 'id', ')', '...', ']', 'pairs', 'of', 'cards', 'from', 'current', 'board']
train
https://github.com/thomasballinger/trellocardupdate/blob/16a648fa15efef144c07cd56fcdb1d8920fac889/trellocardupdate/trelloupdate.py#L128-L133
2,941
pypa/bandersnatch
src/bandersnatch/utils.py
update_safe
def update_safe(filename: str, **kw: Any) -> Generator[IO, None, None]: """Rewrite a file atomically. Clients are allowed to delete the tmpfile to signal that they don't want to have it updated. """ with tempfile.NamedTemporaryFile( dir=os.path.dirname(filename), delete=False, ...
python
def update_safe(filename: str, **kw: Any) -> Generator[IO, None, None]: """Rewrite a file atomically. Clients are allowed to delete the tmpfile to signal that they don't want to have it updated. """ with tempfile.NamedTemporaryFile( dir=os.path.dirname(filename), delete=False, ...
['def', 'update_safe', '(', 'filename', ':', 'str', ',', '*', '*', 'kw', ':', 'Any', ')', '->', 'Generator', '[', 'IO', ',', 'None', ',', 'None', ']', ':', 'with', 'tempfile', '.', 'NamedTemporaryFile', '(', 'dir', '=', 'os', '.', 'path', '.', 'dirname', '(', 'filename', ')', ',', 'delete', '=', 'False', ',', 'prefix',...
Rewrite a file atomically. Clients are allowed to delete the tmpfile to signal that they don't want to have it updated.
['Rewrite', 'a', 'file', 'atomically', '.']
train
https://github.com/pypa/bandersnatch/blob/8b702c3bc128c5a1cbdd18890adede2f7f17fad4/src/bandersnatch/utils.py#L121-L145
2,942
mikedh/trimesh
trimesh/exchange/stl.py
load_stl_ascii
def load_stl_ascii(file_obj): """ Load an ASCII STL file from a file object. Parameters ---------- file_obj: open file- like object Returns ---------- loaded: kwargs for a Trimesh constructor with keys: vertices: (n,3) float, vertices faces: (m,3)...
python
def load_stl_ascii(file_obj): """ Load an ASCII STL file from a file object. Parameters ---------- file_obj: open file- like object Returns ---------- loaded: kwargs for a Trimesh constructor with keys: vertices: (n,3) float, vertices faces: (m,3)...
['def', 'load_stl_ascii', '(', 'file_obj', ')', ':', '# the first line is the header', 'header', '=', 'file_obj', '.', 'readline', '(', ')', '# make sure header is a string, not bytes', 'if', 'hasattr', '(', 'header', ',', "'decode'", ')', ':', 'try', ':', 'header', '=', 'header', '.', 'decode', '(', "'utf-8'", ')', 'e...
Load an ASCII STL file from a file object. Parameters ---------- file_obj: open file- like object Returns ---------- loaded: kwargs for a Trimesh constructor with keys: vertices: (n,3) float, vertices faces: (m,3) int, indexes of vertices fa...
['Load', 'an', 'ASCII', 'STL', 'file', 'from', 'a', 'file', 'object', '.']
train
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/exchange/stl.py#L126-L186
2,943
openego/eTraGo
etrago/tools/utilities.py
add_missing_components
def add_missing_components(network): # Munich """Add missing transformer at Heizkraftwerk Nord in Munich and missing transformer in Stuttgart Parameters ---------- network : :class:`pypsa.Network Overall container of PyPSA Returns ------- network : :class:`pypsa.Network...
python
def add_missing_components(network): # Munich """Add missing transformer at Heizkraftwerk Nord in Munich and missing transformer in Stuttgart Parameters ---------- network : :class:`pypsa.Network Overall container of PyPSA Returns ------- network : :class:`pypsa.Network...
['def', 'add_missing_components', '(', 'network', ')', ':', '# Munich', '"""https://www.swm.de/privatkunden/unternehmen/energieerzeugung/heizkraftwerke.html?utm_medium=301\n\n to bus 25096:\n 25369 (86)\n 28232 (24)\n 25353 to 25356 (79)\n to bus 23822: (110kV bus of 380/110-kV-transformer)\n 2...
Add missing transformer at Heizkraftwerk Nord in Munich and missing transformer in Stuttgart Parameters ---------- network : :class:`pypsa.Network Overall container of PyPSA Returns ------- network : :class:`pypsa.Network Overall container of PyPSA
['Add', 'missing', 'transformer', 'at', 'Heizkraftwerk', 'Nord', 'in', 'Munich', 'and', 'missing', 'transformer', 'in', 'Stuttgart', 'Parameters', '----------', 'network', ':', ':', 'class', ':', 'pypsa', '.', 'Network', 'Overall', 'container', 'of', 'PyPSA']
train
https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/tools/utilities.py#L1238-L1438
2,944
bitesofcode/projexui
projexui/widgets/xcalendarwidget/xcalendarwidget.py
XCalendarWidget.mouseDoubleClickEvent
def mouseDoubleClickEvent( self, event ): """ Handles the mouse double click event. :param event | <QMouseEvent> """ scene_point = self.mapToScene(event.pos()) date = self.scene().dateAt(scene_point) date_time = self.scene().dateTime...
python
def mouseDoubleClickEvent( self, event ): """ Handles the mouse double click event. :param event | <QMouseEvent> """ scene_point = self.mapToScene(event.pos()) date = self.scene().dateAt(scene_point) date_time = self.scene().dateTime...
['def', 'mouseDoubleClickEvent', '(', 'self', ',', 'event', ')', ':', 'scene_point', '=', 'self', '.', 'mapToScene', '(', 'event', '.', 'pos', '(', ')', ')', 'date', '=', 'self', '.', 'scene', '(', ')', '.', 'dateAt', '(', 'scene_point', ')', 'date_time', '=', 'self', '.', 'scene', '(', ')', '.', 'dateTimeAt', '(', 'sc...
Handles the mouse double click event. :param event | <QMouseEvent>
['Handles', 'the', 'mouse', 'double', 'click', 'event', '.', ':', 'param', 'event', '|', '<QMouseEvent', '>']
train
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xcalendarwidget/xcalendarwidget.py#L261-L286
2,945
ramses-tech/ramses
ramses/utils.py
resource_view_attrs
def resource_view_attrs(raml_resource, singular=False): """ Generate view method names needed for `raml_resource` view. Collects HTTP method names from resource siblings and dynamic children if exist. Collected methods are then translated to `nefertari.view.BaseView` method names, each of which is use...
python
def resource_view_attrs(raml_resource, singular=False): """ Generate view method names needed for `raml_resource` view. Collects HTTP method names from resource siblings and dynamic children if exist. Collected methods are then translated to `nefertari.view.BaseView` method names, each of which is use...
['def', 'resource_view_attrs', '(', 'raml_resource', ',', 'singular', '=', 'False', ')', ':', 'from', '.', 'views', 'import', 'collection_methods', ',', 'item_methods', "# Singular resource doesn't have collection methods though", '# it looks like a collection', 'if', 'singular', ':', 'collection_methods', '=', 'item_m...
Generate view method names needed for `raml_resource` view. Collects HTTP method names from resource siblings and dynamic children if exist. Collected methods are then translated to `nefertari.view.BaseView` method names, each of which is used to process a particular HTTP method request. Maps of ...
['Generate', 'view', 'method', 'names', 'needed', 'for', 'raml_resource', 'view', '.']
train
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/utils.py#L123-L156
2,946
consbio/ncdjango
ncdjango/interfaces/arcgis/views.py
GetImageView.format_image
def format_image(self, image, image_format, **kwargs): """Returns an image in the request format""" image_format = image_format.lower() accept = self.request.META['HTTP_ACCEPT'].split(',') if FORCE_WEBP and 'image/webp' in accept: image_format = 'webp' elif image_fo...
python
def format_image(self, image, image_format, **kwargs): """Returns an image in the request format""" image_format = image_format.lower() accept = self.request.META['HTTP_ACCEPT'].split(',') if FORCE_WEBP and 'image/webp' in accept: image_format = 'webp' elif image_fo...
['def', 'format_image', '(', 'self', ',', 'image', ',', 'image_format', ',', '*', '*', 'kwargs', ')', ':', 'image_format', '=', 'image_format', '.', 'lower', '(', ')', 'accept', '=', 'self', '.', 'request', '.', 'META', '[', "'HTTP_ACCEPT'", ']', '.', 'split', '(', "','", ')', 'if', 'FORCE_WEBP', 'and', "'image/webp'",...
Returns an image in the request format
['Returns', 'an', 'image', 'in', 'the', 'request', 'format']
train
https://github.com/consbio/ncdjango/blob/f807bfd1e4083ab29fbc3c4d4418be108383a710/ncdjango/interfaces/arcgis/views.py#L264-L282
2,947
kmike/port-for
port_for/_download_ranges.py
_unassigned_ports
def _unassigned_ports(): """ Returns a set of all unassigned ports (according to IANA and Wikipedia) """ free_ports = ranges_to_set(_parse_ranges(_iana_unassigned_port_ranges())) known_ports = ranges_to_set(_wikipedia_known_port_ranges()) return free_ports.difference(known_ports)
python
def _unassigned_ports(): """ Returns a set of all unassigned ports (according to IANA and Wikipedia) """ free_ports = ranges_to_set(_parse_ranges(_iana_unassigned_port_ranges())) known_ports = ranges_to_set(_wikipedia_known_port_ranges()) return free_ports.difference(known_ports)
['def', '_unassigned_ports', '(', ')', ':', 'free_ports', '=', 'ranges_to_set', '(', '_parse_ranges', '(', '_iana_unassigned_port_ranges', '(', ')', ')', ')', 'known_ports', '=', 'ranges_to_set', '(', '_wikipedia_known_port_ranges', '(', ')', ')', 'return', 'free_ports', '.', 'difference', '(', 'known_ports', ')']
Returns a set of all unassigned ports (according to IANA and Wikipedia)
['Returns', 'a', 'set', 'of', 'all', 'unassigned', 'ports', '(', 'according', 'to', 'IANA', 'and', 'Wikipedia', ')']
train
https://github.com/kmike/port-for/blob/f61ebf3c2caf54eabe8233b40ef67b973176a6f5/port_for/_download_ranges.py#L37-L41
2,948
saltstack/salt
salt/utils/azurearm.py
get_client
def get_client(client_type, **kwargs): ''' Dynamically load the selected client and return a management client object ''' client_map = {'compute': 'ComputeManagement', 'authorization': 'AuthorizationManagement', 'dns': 'DnsManagement', 'storage': 'St...
python
def get_client(client_type, **kwargs): ''' Dynamically load the selected client and return a management client object ''' client_map = {'compute': 'ComputeManagement', 'authorization': 'AuthorizationManagement', 'dns': 'DnsManagement', 'storage': 'St...
['def', 'get_client', '(', 'client_type', ',', '*', '*', 'kwargs', ')', ':', 'client_map', '=', '{', "'compute'", ':', "'ComputeManagement'", ',', "'authorization'", ':', "'AuthorizationManagement'", ',', "'dns'", ':', "'DnsManagement'", ',', "'storage'", ':', "'StorageManagement'", ',', "'managementlock'", ':', "'Mana...
Dynamically load the selected client and return a management client object
['Dynamically', 'load', 'the', 'selected', 'client', 'and', 'return', 'a', 'management', 'client', 'object']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/azurearm.py#L140-L197
2,949
glomex/gcdt
gcdt/s3.py
remove_file_from_s3
def remove_file_from_s3(awsclient, bucket, key): """Remove a file from an AWS S3 bucket. :param awsclient: :param bucket: :param key: :return: """ client_s3 = awsclient.get_client('s3') response = client_s3.delete_object(Bucket=bucket, Key=key)
python
def remove_file_from_s3(awsclient, bucket, key): """Remove a file from an AWS S3 bucket. :param awsclient: :param bucket: :param key: :return: """ client_s3 = awsclient.get_client('s3') response = client_s3.delete_object(Bucket=bucket, Key=key)
['def', 'remove_file_from_s3', '(', 'awsclient', ',', 'bucket', ',', 'key', ')', ':', 'client_s3', '=', 'awsclient', '.', 'get_client', '(', "'s3'", ')', 'response', '=', 'client_s3', '.', 'delete_object', '(', 'Bucket', '=', 'bucket', ',', 'Key', '=', 'key', ')']
Remove a file from an AWS S3 bucket. :param awsclient: :param bucket: :param key: :return:
['Remove', 'a', 'file', 'from', 'an', 'AWS', 'S3', 'bucket', '.']
train
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/s3.py#L92-L101
2,950
watson-developer-cloud/python-sdk
ibm_watson/discovery_v1.py
CollectionDiskUsage._to_dict
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'used_bytes') and self.used_bytes is not None: _dict['used_bytes'] = self.used_bytes return _dict
python
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'used_bytes') and self.used_bytes is not None: _dict['used_bytes'] = self.used_bytes return _dict
['def', '_to_dict', '(', 'self', ')', ':', '_dict', '=', '{', '}', 'if', 'hasattr', '(', 'self', ',', "'used_bytes'", ')', 'and', 'self', '.', 'used_bytes', 'is', 'not', 'None', ':', '_dict', '[', "'used_bytes'", ']', '=', 'self', '.', 'used_bytes', 'return', '_dict']
Return a json dictionary representing this model.
['Return', 'a', 'json', 'dictionary', 'representing', 'this', 'model', '.']
train
https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/discovery_v1.py#L3836-L3841
2,951
bitprophet/releases
releases/__init__.py
append_unreleased_entries
def append_unreleased_entries(app, manager, releases): """ Generate new abstract 'releases' for unreleased issues. There's one for each combination of bug-vs-feature & major release line. When only one major release line exists, that dimension is ignored. """ for family, lines in six.iteritems...
python
def append_unreleased_entries(app, manager, releases): """ Generate new abstract 'releases' for unreleased issues. There's one for each combination of bug-vs-feature & major release line. When only one major release line exists, that dimension is ignored. """ for family, lines in six.iteritems...
['def', 'append_unreleased_entries', '(', 'app', ',', 'manager', ',', 'releases', ')', ':', 'for', 'family', ',', 'lines', 'in', 'six', '.', 'iteritems', '(', 'manager', ')', ':', 'for', 'type_', 'in', '(', "'bugfix'", ',', "'feature'", ')', ':', 'bucket', '=', "'unreleased_{}'", '.', 'format', '(', 'type_', ')', 'if',...
Generate new abstract 'releases' for unreleased issues. There's one for each combination of bug-vs-feature & major release line. When only one major release line exists, that dimension is ignored.
['Generate', 'new', 'abstract', 'releases', 'for', 'unreleased', 'issues', '.']
train
https://github.com/bitprophet/releases/blob/97a763e41bbe7374106a1c648b89346a0d935429/releases/__init__.py#L202-L221
2,952
QUANTAXIS/QUANTAXIS
QUANTAXIS/QAIndicator/indicators.py
QA_indicator_MA
def QA_indicator_MA(DataFrame,*args,**kwargs): """MA Arguments: DataFrame {[type]} -- [description] Returns: [type] -- [description] """ CLOSE = DataFrame['close'] return pd.DataFrame({'MA{}'.format(N): MA(CLOSE, N) for N in list(args)})
python
def QA_indicator_MA(DataFrame,*args,**kwargs): """MA Arguments: DataFrame {[type]} -- [description] Returns: [type] -- [description] """ CLOSE = DataFrame['close'] return pd.DataFrame({'MA{}'.format(N): MA(CLOSE, N) for N in list(args)})
['def', 'QA_indicator_MA', '(', 'DataFrame', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'CLOSE', '=', 'DataFrame', '[', "'close'", ']', 'return', 'pd', '.', 'DataFrame', '(', '{', "'MA{}'", '.', 'format', '(', 'N', ')', ':', 'MA', '(', 'CLOSE', ',', 'N', ')', 'for', 'N', 'in', 'list', '(', 'args', ')', '}', '...
MA Arguments: DataFrame {[type]} -- [description] Returns: [type] -- [description]
['MA', 'Arguments', ':', 'DataFrame', '{', '[', 'type', ']', '}', '--', '[', 'description', ']', 'Returns', ':', '[', 'type', ']', '--', '[', 'description', ']']
train
https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAIndicator/indicators.py#L58-L69
2,953
msu-coinlab/pymop
pymop/problem.py
Problem.pareto_front
def pareto_front(self, *args, **kwargs): """ Returns ------- P : np.array The Pareto front of a given problem. It is only loaded or calculate the first time and then cached. For a single-objective problem only one point is returned but still in a two dimensional a...
python
def pareto_front(self, *args, **kwargs): """ Returns ------- P : np.array The Pareto front of a given problem. It is only loaded or calculate the first time and then cached. For a single-objective problem only one point is returned but still in a two dimensional a...
['def', 'pareto_front', '(', 'self', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'if', 'self', '.', '_pareto_front', 'is', 'None', ':', 'self', '.', '_pareto_front', '=', 'self', '.', '_calc_pareto_front', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', 'return', 'self', '.', '_pareto_front']
Returns ------- P : np.array The Pareto front of a given problem. It is only loaded or calculate the first time and then cached. For a single-objective problem only one point is returned but still in a two dimensional array.
['Returns', '-------', 'P', ':', 'np', '.', 'array', 'The', 'Pareto', 'front', 'of', 'a', 'given', 'problem', '.', 'It', 'is', 'only', 'loaded', 'or', 'calculate', 'the', 'first', 'time', 'and', 'then', 'cached', '.', 'For', 'a', 'single', '-', 'objective', 'problem', 'only', 'one', 'point', 'is', 'returned', 'but', 's...
train
https://github.com/msu-coinlab/pymop/blob/7b7e789e640126c6d254e86ede5d7f4baad7eaa5/pymop/problem.py#L96-L107
2,954
mitsei/dlkit
dlkit/json_/learning/sessions.py
ObjectiveBankHierarchyDesignSession.remove_child_objective_banks
def remove_child_objective_banks(self, objective_bank_id): """Removes all children from an objective bank. arg: objective_bank_id (osid.id.Id): the ``Id`` of an objective bank raise: NotFound - ``objective_bank_id`` not in hierarchy raise: NullArgument - ``objective...
python
def remove_child_objective_banks(self, objective_bank_id): """Removes all children from an objective bank. arg: objective_bank_id (osid.id.Id): the ``Id`` of an objective bank raise: NotFound - ``objective_bank_id`` not in hierarchy raise: NullArgument - ``objective...
['def', 'remove_child_objective_banks', '(', 'self', ',', 'objective_bank_id', ')', ':', '# Implemented from template for', '# osid.resource.BinHierarchyDesignSession.remove_child_bin_template', 'if', 'self', '.', '_catalog_session', 'is', 'not', 'None', ':', 'return', 'self', '.', '_catalog_session', '.', 'remove_chil...
Removes all children from an objective bank. arg: objective_bank_id (osid.id.Id): the ``Id`` of an objective bank raise: NotFound - ``objective_bank_id`` not in hierarchy raise: NullArgument - ``objective_bank_id`` is ``null`` raise: OperationFailed - unable to com...
['Removes', 'all', 'children', 'from', 'an', 'objective', 'bank', '.']
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L6566-L6582
2,955
maximtrp/scikit-posthocs
scikit_posthocs/_posthocs.py
__convert_to_df
def __convert_to_df(a, val_col=None, group_col=None, val_id=None, group_id=None): '''Hidden helper method to create a DataFrame with input data for further processing. Parameters ---------- a : array_like or pandas DataFrame object An array, any object exposing the array interface or a pan...
python
def __convert_to_df(a, val_col=None, group_col=None, val_id=None, group_id=None): '''Hidden helper method to create a DataFrame with input data for further processing. Parameters ---------- a : array_like or pandas DataFrame object An array, any object exposing the array interface or a pan...
['def', '__convert_to_df', '(', 'a', ',', 'val_col', '=', 'None', ',', 'group_col', '=', 'None', ',', 'val_id', '=', 'None', ',', 'group_id', '=', 'None', ')', ':', 'if', 'not', 'group_col', ':', 'group_col', '=', "'groups'", 'if', 'not', 'val_col', ':', 'val_col', '=', "'vals'", 'if', 'isinstance', '(', 'a', ',', 'Dat...
Hidden helper method to create a DataFrame with input data for further processing. Parameters ---------- a : array_like or pandas DataFrame object An array, any object exposing the array interface or a pandas DataFrame. Array must be two-dimensional. Second dimension may vary, i...
['Hidden', 'helper', 'method', 'to', 'create', 'a', 'DataFrame', 'with', 'input', 'data', 'for', 'further', 'processing', '.']
train
https://github.com/maximtrp/scikit-posthocs/blob/5476b09e2a325cd4e31c0b0bc6906ab5cd77fc5d/scikit_posthocs/_posthocs.py#L11-L106
2,956
ghukill/pyfc4
pyfc4/plugins/pcdm/models.py
PCDMFile._post_create
def _post_create(self, auto_refresh=False): ''' resource.create() hook For PCDM File ''' # set PCDM triple as Collection self.add_triple(self.rdf.prefixes.rdf.type, self.rdf.prefixes.pcdm.File) self.update(auto_refresh=auto_refresh)
python
def _post_create(self, auto_refresh=False): ''' resource.create() hook For PCDM File ''' # set PCDM triple as Collection self.add_triple(self.rdf.prefixes.rdf.type, self.rdf.prefixes.pcdm.File) self.update(auto_refresh=auto_refresh)
['def', '_post_create', '(', 'self', ',', 'auto_refresh', '=', 'False', ')', ':', '# set PCDM triple as Collection', 'self', '.', 'add_triple', '(', 'self', '.', 'rdf', '.', 'prefixes', '.', 'rdf', '.', 'type', ',', 'self', '.', 'rdf', '.', 'prefixes', '.', 'pcdm', '.', 'File', ')', 'self', '.', 'update', '(', 'auto_re...
resource.create() hook For PCDM File
['resource', '.', 'create', '()', 'hook']
train
https://github.com/ghukill/pyfc4/blob/59011df592f08978c4a901a908862d112a5dcf02/pyfc4/plugins/pcdm/models.py#L435-L445
2,957
jtwhite79/pyemu
pyemu/en.py
Ensemble.as_pyemu_matrix
def as_pyemu_matrix(self,typ=Matrix): """ Create a pyemu.Matrix from the Ensemble. Parameters ---------- typ : pyemu.Matrix or derived type the type of matrix to return Returns ------- pyemu.Matrix : pyemu.Matrix """ ...
python
def as_pyemu_matrix(self,typ=Matrix): """ Create a pyemu.Matrix from the Ensemble. Parameters ---------- typ : pyemu.Matrix or derived type the type of matrix to return Returns ------- pyemu.Matrix : pyemu.Matrix """ ...
['def', 'as_pyemu_matrix', '(', 'self', ',', 'typ', '=', 'Matrix', ')', ':', 'x', '=', 'self', '.', 'values', '.', 'copy', '(', ')', '.', 'astype', '(', 'np', '.', 'float', ')', 'return', 'typ', '(', 'x', '=', 'x', ',', 'row_names', '=', 'list', '(', 'self', '.', 'index', ')', ',', 'col_names', '=', 'list', '(', 'self'...
Create a pyemu.Matrix from the Ensemble. Parameters ---------- typ : pyemu.Matrix or derived type the type of matrix to return Returns ------- pyemu.Matrix : pyemu.Matrix
['Create', 'a', 'pyemu', '.', 'Matrix', 'from', 'the', 'Ensemble', '.']
train
https://github.com/jtwhite79/pyemu/blob/c504d8e7a4097cec07655a6318d275739bd8148a/pyemu/en.py#L58-L74
2,958
mikedh/trimesh
trimesh/visual/color.py
ColorVisuals.main_color
def main_color(self): """ What is the most commonly occurring color. Returns ------------ color: (4,) uint8, most common color """ if self.kind is None: return DEFAULT_COLOR elif self.kind == 'face': colors = self.face_colors ...
python
def main_color(self): """ What is the most commonly occurring color. Returns ------------ color: (4,) uint8, most common color """ if self.kind is None: return DEFAULT_COLOR elif self.kind == 'face': colors = self.face_colors ...
['def', 'main_color', '(', 'self', ')', ':', 'if', 'self', '.', 'kind', 'is', 'None', ':', 'return', 'DEFAULT_COLOR', 'elif', 'self', '.', 'kind', '==', "'face'", ':', 'colors', '=', 'self', '.', 'face_colors', 'elif', 'self', '.', 'kind', '==', "'vertex'", ':', 'colors', '=', 'self', '.', 'vertex_colors', 'else', ':',...
What is the most commonly occurring color. Returns ------------ color: (4,) uint8, most common color
['What', 'is', 'the', 'most', 'commonly', 'occurring', 'color', '.']
train
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/visual/color.py#L410-L434
2,959
farshidce/touchworks-python
touchworks/api/http.py
TouchWorks.set_patient_medhx_flag
def set_patient_medhx_flag(self, patient_id, medhx_status): """ invokes TouchWorksMagicConstants.ACTION_GET_ENCOUNTER_LIST_FOR_PATIENT action :param patient_id :param medhx_status - Field in EEHR expects U, G, or D. SP defaults to Null and erro...
python
def set_patient_medhx_flag(self, patient_id, medhx_status): """ invokes TouchWorksMagicConstants.ACTION_GET_ENCOUNTER_LIST_FOR_PATIENT action :param patient_id :param medhx_status - Field in EEHR expects U, G, or D. SP defaults to Null and erro...
['def', 'set_patient_medhx_flag', '(', 'self', ',', 'patient_id', ',', 'medhx_status', ')', ':', 'magic', '=', 'self', '.', '_magic_json', '(', 'action', '=', 'TouchWorksMagicConstants', '.', 'ACTION_SET_PATIENT_MEDHX_FLAG', ',', 'patient_id', '=', 'patient_id', ',', 'parameter1', '=', 'medhx_status', ')', 'response', ...
invokes TouchWorksMagicConstants.ACTION_GET_ENCOUNTER_LIST_FOR_PATIENT action :param patient_id :param medhx_status - Field in EEHR expects U, G, or D. SP defaults to Null and errors out if included. U=Unknown G=Granted D=Declined :ret...
['invokes', 'TouchWorksMagicConstants', '.', 'ACTION_GET_ENCOUNTER_LIST_FOR_PATIENT', 'action', ':', 'param', 'patient_id', ':', 'param', 'medhx_status', '-', 'Field', 'in', 'EEHR', 'expects', 'U', 'G', 'or', 'D', '.', 'SP', 'defaults', 'to', 'Null', 'and', 'errors', 'out', 'if', 'included', '.', 'U', '=', 'Unknown', '...
train
https://github.com/farshidce/touchworks-python/blob/ea8f93a0f4273de1317a318e945a571f5038ba62/touchworks/api/http.py#L458-L480
2,960
asascience-open/paegan-transport
paegan/transport/particles/particle.py
Particle.age
def age(self, **kwargs): """ Age this particle. parameters (optional, only one allowed): days (default) hours minutes seconds """ if kwargs.get('days', None) is not None: self._age += kwargs.get('days') retu...
python
def age(self, **kwargs): """ Age this particle. parameters (optional, only one allowed): days (default) hours minutes seconds """ if kwargs.get('days', None) is not None: self._age += kwargs.get('days') retu...
['def', 'age', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'if', 'kwargs', '.', 'get', '(', "'days'", ',', 'None', ')', 'is', 'not', 'None', ':', 'self', '.', '_age', '+=', 'kwargs', '.', 'get', '(', "'days'", ')', 'return', 'if', 'kwargs', '.', 'get', '(', "'hours'", ',', 'None', ')', 'is', 'not', 'None', ':', 'se...
Age this particle. parameters (optional, only one allowed): days (default) hours minutes seconds
['Age', 'this', 'particle', '.']
train
https://github.com/asascience-open/paegan-transport/blob/99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3/paegan/transport/particles/particle.py#L203-L226
2,961
lago-project/lago
lago/virt.py
VirtEnv.prefixed_name
def prefixed_name(self, unprefixed_name, max_length=0): """ Returns a uuid pefixed identifier Args: unprefixed_name(str): Name to add a prefix to max_length(int): maximum length of the resultant prefixed name, will adapt the given name and the length of th...
python
def prefixed_name(self, unprefixed_name, max_length=0): """ Returns a uuid pefixed identifier Args: unprefixed_name(str): Name to add a prefix to max_length(int): maximum length of the resultant prefixed name, will adapt the given name and the length of th...
['def', 'prefixed_name', '(', 'self', ',', 'unprefixed_name', ',', 'max_length', '=', '0', ')', ':', 'if', 'max_length', '==', '0', ':', 'prefixed_name', '=', "'%s-%s'", '%', '(', 'self', '.', 'uuid', '[', ':', '8', ']', ',', 'unprefixed_name', ')', 'else', ':', 'if', 'max_length', '<', '6', ':', 'raise', 'RuntimeError...
Returns a uuid pefixed identifier Args: unprefixed_name(str): Name to add a prefix to max_length(int): maximum length of the resultant prefixed name, will adapt the given name and the length of the uuid ot fit it Returns: str: prefixed identifier for t...
['Returns', 'a', 'uuid', 'pefixed', 'identifier', 'Args', ':', 'unprefixed_name', '(', 'str', ')', ':', 'Name', 'to', 'add', 'a', 'prefix', 'to', 'max_length', '(', 'int', ')', ':', 'maximum', 'length', 'of', 'the', 'resultant', 'prefixed', 'name', 'will', 'adapt', 'the', 'given', 'name', 'and', 'the', 'length', 'of', ...
train
https://github.com/lago-project/lago/blob/5b8970f7687e063e4619066d5b8093ca997678c9/lago/virt.py#L122-L153
2,962
acutesoftware/AIKIF
aikif/dataTools/cls_datatable.py
DataTable.calc_percentiles
def calc_percentiles(self, col_name, where_col_list, where_value_list): """ calculates the percentiles of col_name WHERE [where_col_list] = [where_value_list] """ #col_data = self.get_col_data_by_name(col_name) col_data = self.select_where(where_col_list, where_value_li...
python
def calc_percentiles(self, col_name, where_col_list, where_value_list): """ calculates the percentiles of col_name WHERE [where_col_list] = [where_value_list] """ #col_data = self.get_col_data_by_name(col_name) col_data = self.select_where(where_col_list, where_value_li...
['def', 'calc_percentiles', '(', 'self', ',', 'col_name', ',', 'where_col_list', ',', 'where_value_list', ')', ':', '#col_data = self.get_col_data_by_name(col_name)', 'col_data', '=', 'self', '.', 'select_where', '(', 'where_col_list', ',', 'where_value_list', ',', 'col_name', ')', "#print('calc_percentiles: col_data =...
calculates the percentiles of col_name WHERE [where_col_list] = [where_value_list]
['calculates', 'the', 'percentiles', 'of', 'col_name', 'WHERE', '[', 'where_col_list', ']', '=', '[', 'where_value_list', ']']
train
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/dataTools/cls_datatable.py#L188-L204
2,963
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py
MongoClient._reset_on_error
def _reset_on_error(self, server, func, *args, **kwargs): """Execute an operation. Reset the server on network error. Returns fn()'s return value on success. On error, clears the server's pool and marks the server Unknown. Re-raises any exception thrown by fn(). """ try...
python
def _reset_on_error(self, server, func, *args, **kwargs): """Execute an operation. Reset the server on network error. Returns fn()'s return value on success. On error, clears the server's pool and marks the server Unknown. Re-raises any exception thrown by fn(). """ try...
['def', '_reset_on_error', '(', 'self', ',', 'server', ',', 'func', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'try', ':', 'return', 'func', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', 'except', 'NetworkTimeout', ':', "# The socket has been closed. Don't reset the server.", 'raise', 'except', 'ConnectionF...
Execute an operation. Reset the server on network error. Returns fn()'s return value on success. On error, clears the server's pool and marks the server Unknown. Re-raises any exception thrown by fn().
['Execute', 'an', 'operation', '.', 'Reset', 'the', 'server', 'on', 'network', 'error', '.']
train
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py#L952-L967
2,964
offu/WeRoBot
werobot/client.py
Client.delete_custom_service_account
def delete_custom_service_account(self, account, nickname, password): """ 删除客服帐号。 :param account: 客服账号的用户名 :param nickname: 客服账号的昵称 :param password: 客服账号的密码 :return: 返回的 JSON 数据包 """ return self.post( url="https://api.weixin.qq.com/customservi...
python
def delete_custom_service_account(self, account, nickname, password): """ 删除客服帐号。 :param account: 客服账号的用户名 :param nickname: 客服账号的昵称 :param password: 客服账号的密码 :return: 返回的 JSON 数据包 """ return self.post( url="https://api.weixin.qq.com/customservi...
['def', 'delete_custom_service_account', '(', 'self', ',', 'account', ',', 'nickname', ',', 'password', ')', ':', 'return', 'self', '.', 'post', '(', 'url', '=', '"https://api.weixin.qq.com/customservice/kfaccount/del"', ',', 'data', '=', '{', '"kf_account"', ':', 'account', ',', '"nickname"', ':', 'nickname', ',', '"p...
删除客服帐号。 :param account: 客服账号的用户名 :param nickname: 客服账号的昵称 :param password: 客服账号的密码 :return: 返回的 JSON 数据包
['删除客服帐号。']
train
https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L310-L326
2,965
datasift/datasift-python
datasift/push.py
Push.create_from_historics
def create_from_historics(self, historics_id, name, output_type, output_params, initial_status=None, start=None, end=None): """ Create a new push subscription using the given Historic ID. Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/pushcr...
python
def create_from_historics(self, historics_id, name, output_type, output_params, initial_status=None, start=None, end=None): """ Create a new push subscription using the given Historic ID. Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/pushcr...
['def', 'create_from_historics', '(', 'self', ',', 'historics_id', ',', 'name', ',', 'output_type', ',', 'output_params', ',', 'initial_status', '=', 'None', ',', 'start', '=', 'None', ',', 'end', '=', 'None', ')', ':', 'return', 'self', '.', '_create', '(', 'False', ',', 'historics_id', ',', 'name', ',', 'output_type'...
Create a new push subscription using the given Historic ID. Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/pushcreate :param historics_id: The ID of a Historics query :type historics_id: str :param name: The name to give the newly created sub...
['Create', 'a', 'new', 'push', 'subscription', 'using', 'the', 'given', 'Historic', 'ID', '.']
train
https://github.com/datasift/datasift-python/blob/bfaca1a47501a18e11065ecf630d9c31df818f65/datasift/push.py#L69-L93
2,966
BerkeleyAutomation/autolab_core
autolab_core/rigid_transformations.py
RigidTransform.interpolate
def interpolate(T0, T1, t): """Return an interpolation of two RigidTransforms. Parameters ---------- T0 : :obj:`RigidTransform` The first RigidTransform to interpolate. T1 : :obj:`RigidTransform` The second RigidTransform to interpolate. t : flo...
python
def interpolate(T0, T1, t): """Return an interpolation of two RigidTransforms. Parameters ---------- T0 : :obj:`RigidTransform` The first RigidTransform to interpolate. T1 : :obj:`RigidTransform` The second RigidTransform to interpolate. t : flo...
['def', 'interpolate', '(', 'T0', ',', 'T1', ',', 't', ')', ':', 'if', 'T0', '.', 'to_frame', '!=', 'T1', '.', 'to_frame', ':', 'raise', 'ValueError', '(', "'Cannot interpolate between 2 transforms with different to frames! Got T1 {0} and T2 {1}'", '.', 'format', '(', 'T0', '.', 'to_frame', ',', 'T1', '.', 'to_frame', ...
Return an interpolation of two RigidTransforms. Parameters ---------- T0 : :obj:`RigidTransform` The first RigidTransform to interpolate. T1 : :obj:`RigidTransform` The second RigidTransform to interpolate. t : float The interpolation step i...
['Return', 'an', 'interpolation', 'of', 'two', 'RigidTransforms', '.']
train
https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L973-L1004
2,967
googleapis/google-cloud-python
firestore/google/cloud/firestore_v1beta1/batch.py
WriteBatch.set
def set(self, reference, document_data, merge=False): """Add a "change" to replace a document. See :meth:`~.firestore_v1beta1.document.DocumentReference.set` for more information on how ``option`` determines how the change is applied. Args: reference (~.fire...
python
def set(self, reference, document_data, merge=False): """Add a "change" to replace a document. See :meth:`~.firestore_v1beta1.document.DocumentReference.set` for more information on how ``option`` determines how the change is applied. Args: reference (~.fire...
['def', 'set', '(', 'self', ',', 'reference', ',', 'document_data', ',', 'merge', '=', 'False', ')', ':', 'if', 'merge', 'is', 'not', 'False', ':', 'write_pbs', '=', '_helpers', '.', 'pbs_for_set_with_merge', '(', 'reference', '.', '_document_path', ',', 'document_data', ',', 'merge', ')', 'else', ':', 'write_pbs', '='...
Add a "change" to replace a document. See :meth:`~.firestore_v1beta1.document.DocumentReference.set` for more information on how ``option`` determines how the change is applied. Args: reference (~.firestore_v1beta1.document.DocumentReference): A docu...
['Add', 'a', 'change', 'to', 'replace', 'a', 'document', '.']
train
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/batch.py#L65-L91
2,968
woolfson-group/isambard
isambard/ampal/specifications/polymer_specs/helix.py
HelicalHelix.curve
def curve(self): """Curve of the super helix.""" return HelicalCurve.pitch_and_radius( self.major_pitch, self.major_radius, handedness=self.major_handedness)
python
def curve(self): """Curve of the super helix.""" return HelicalCurve.pitch_and_radius( self.major_pitch, self.major_radius, handedness=self.major_handedness)
['def', 'curve', '(', 'self', ')', ':', 'return', 'HelicalCurve', '.', 'pitch_and_radius', '(', 'self', '.', 'major_pitch', ',', 'self', '.', 'major_radius', ',', 'handedness', '=', 'self', '.', 'major_handedness', ')']
Curve of the super helix.
['Curve', 'of', 'the', 'super', 'helix', '.']
train
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/specifications/polymer_specs/helix.py#L370-L374
2,969
ajenti/jadi
jadi/jadi.py
interface
def interface(cls): ''' Marks the decorated class as an abstract interface. Injects following classmethods: .. py:method:: .all(context) Returns a list of instances of each component in the ``context`` implementing this ``@interface`` :param context: context to look in ...
python
def interface(cls): ''' Marks the decorated class as an abstract interface. Injects following classmethods: .. py:method:: .all(context) Returns a list of instances of each component in the ``context`` implementing this ``@interface`` :param context: context to look in ...
['def', 'interface', '(', 'cls', ')', ':', 'if', 'not', 'cls', ':', 'return', 'None', 'cls', '.', 'implementations', '=', '[', ']', '# Inject methods', 'def', '_all', '(', 'cls', ',', 'context', ',', 'ignore_exceptions', '=', 'False', ')', ':', 'return', 'list', '(', 'context', '.', 'get_components', '(', 'cls', ',', '...
Marks the decorated class as an abstract interface. Injects following classmethods: .. py:method:: .all(context) Returns a list of instances of each component in the ``context`` implementing this ``@interface`` :param context: context to look in :type context: :class...
['Marks', 'the', 'decorated', 'class', 'as', 'an', 'abstract', 'interface', '.']
train
https://github.com/ajenti/jadi/blob/db76e1c5330672d282f03787fedcd702c04b007f/jadi/jadi.py#L86-L138
2,970
thespacedoctor/fundamentals
fundamentals/renderer/list_of_dictionaries.py
list_of_dictionaries._list_of_dictionaries_to_csv
def _list_of_dictionaries_to_csv( self, csvType="human"): """Convert a python list of dictionaries to pretty csv output **Key Arguments:** - ``csvType`` -- human, machine or reST **Return:** - ``output`` -- the contents of a CSV file """ ...
python
def _list_of_dictionaries_to_csv( self, csvType="human"): """Convert a python list of dictionaries to pretty csv output **Key Arguments:** - ``csvType`` -- human, machine or reST **Return:** - ``output`` -- the contents of a CSV file """ ...
['def', '_list_of_dictionaries_to_csv', '(', 'self', ',', 'csvType', '=', '"human"', ')', ':', 'self', '.', 'log', '.', 'debug', '(', "'starting the ``_list_of_dictionaries_to_csv`` function'", ')', 'if', 'not', 'len', '(', 'self', '.', 'listOfDictionaries', ')', ':', 'return', '"NO MATCH"', 'dataCopy', '=', 'copy', '....
Convert a python list of dictionaries to pretty csv output **Key Arguments:** - ``csvType`` -- human, machine or reST **Return:** - ``output`` -- the contents of a CSV file
['Convert', 'a', 'python', 'list', 'of', 'dictionaries', 'to', 'pretty', 'csv', 'output']
train
https://github.com/thespacedoctor/fundamentals/blob/1d2c007ac74442ec2eabde771cfcacdb9c1ab382/fundamentals/renderer/list_of_dictionaries.py#L500-L639
2,971
edeposit/edeposit.amqp.ftp
src/edeposit/amqp/ftp/passwd_reader.py
set_permissions
def set_permissions(filename, uid=None, gid=None, mode=0775): """ Set pemissions for given `filename`. Args: filename (str): name of the file/directory uid (int, default proftpd): user ID - if not set, user ID of `proftpd` is used gid (int): group...
python
def set_permissions(filename, uid=None, gid=None, mode=0775): """ Set pemissions for given `filename`. Args: filename (str): name of the file/directory uid (int, default proftpd): user ID - if not set, user ID of `proftpd` is used gid (int): group...
['def', 'set_permissions', '(', 'filename', ',', 'uid', '=', 'None', ',', 'gid', '=', 'None', ',', 'mode', '=', '0775', ')', ':', 'if', 'uid', 'is', 'None', ':', 'uid', '=', 'get_ftp_uid', '(', ')', 'if', 'gid', 'is', 'None', ':', 'gid', '=', '-', '1', 'os', '.', 'chown', '(', 'filename', ',', 'uid', ',', 'gid', ')', '...
Set pemissions for given `filename`. Args: filename (str): name of the file/directory uid (int, default proftpd): user ID - if not set, user ID of `proftpd` is used gid (int): group ID, if not set, it is not changed mode (int, default 0775): unix ...
['Set', 'pemissions', 'for', 'given', 'filename', '.']
train
https://github.com/edeposit/edeposit.amqp.ftp/blob/fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71/src/edeposit/amqp/ftp/passwd_reader.py#L115-L133
2,972
madprime/cgivar2gvcf
cgivar2gvcf/__init__.py
process_full_position
def process_full_position(data, header, var_only=False): """ Return genetic data when all alleles called on same line. Returns an array containing one item, a tuple of five items: (string) chromosome (string) start position (1-based) (array of strings) matching dbSNP entries ...
python
def process_full_position(data, header, var_only=False): """ Return genetic data when all alleles called on same line. Returns an array containing one item, a tuple of five items: (string) chromosome (string) start position (1-based) (array of strings) matching dbSNP entries ...
['def', 'process_full_position', '(', 'data', ',', 'header', ',', 'var_only', '=', 'False', ')', ':', 'feature_type', '=', 'data', '[', 'header', '[', "'varType'", ']', ']', '# Skip unmatchable, uncovered, or pseudoautosomal-in-X', 'if', '(', 'feature_type', '==', "'no-ref'", 'or', 'feature_type', '.', 'startswith', '(...
Return genetic data when all alleles called on same line. Returns an array containing one item, a tuple of five items: (string) chromosome (string) start position (1-based) (array of strings) matching dbSNP entries (string) reference allele sequence (array of strings) the ge...
['Return', 'genetic', 'data', 'when', 'all', 'alleles', 'called', 'on', 'same', 'line', '.']
train
https://github.com/madprime/cgivar2gvcf/blob/13b4cd8da08669f7e4b0ceed77a7a17082f91037/cgivar2gvcf/__init__.py#L65-L117
2,973
opencobra/memote
memote/support/validation.py
format_failure
def format_failure(failure): """Format how an error or warning should be displayed.""" return "Line {}, Column {} - #{}: {} - Category: {}, Severity: {}".format( failure.getLine(), failure.getColumn(), failure.getErrorId(), failure.getMessage(), failure.getCategoryAsStrin...
python
def format_failure(failure): """Format how an error or warning should be displayed.""" return "Line {}, Column {} - #{}: {} - Category: {}, Severity: {}".format( failure.getLine(), failure.getColumn(), failure.getErrorId(), failure.getMessage(), failure.getCategoryAsStrin...
['def', 'format_failure', '(', 'failure', ')', ':', 'return', '"Line {}, Column {} - #{}: {} - Category: {}, Severity: {}"', '.', 'format', '(', 'failure', '.', 'getLine', '(', ')', ',', 'failure', '.', 'getColumn', '(', ')', ',', 'failure', '.', 'getErrorId', '(', ')', ',', 'failure', '.', 'getMessage', '(', ')', ',',...
Format how an error or warning should be displayed.
['Format', 'how', 'an', 'error', 'or', 'warning', 'should', 'be', 'displayed', '.']
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/validation.py#L52-L61
2,974
PyHDI/Pyverilog
pyverilog/vparser/parser.py
VerilogParser.p_param
def p_param(self, p): 'param : PARAMETER param_substitution_list COMMA' paramlist = [Parameter(rname, rvalue, lineno=p.lineno(2)) for rname, rvalue in p[2]] p[0] = Decl(tuple(paramlist), lineno=p.lineno(1)) p.set_lineno(0, p.lineno(1))
python
def p_param(self, p): 'param : PARAMETER param_substitution_list COMMA' paramlist = [Parameter(rname, rvalue, lineno=p.lineno(2)) for rname, rvalue in p[2]] p[0] = Decl(tuple(paramlist), lineno=p.lineno(1)) p.set_lineno(0, p.lineno(1))
['def', 'p_param', '(', 'self', ',', 'p', ')', ':', 'paramlist', '=', '[', 'Parameter', '(', 'rname', ',', 'rvalue', ',', 'lineno', '=', 'p', '.', 'lineno', '(', '2', ')', ')', 'for', 'rname', ',', 'rvalue', 'in', 'p', '[', '2', ']', ']', 'p', '[', '0', ']', '=', 'Decl', '(', 'tuple', '(', 'paramlist', ')', ',', 'linen...
param : PARAMETER param_substitution_list COMMA
['param', ':', 'PARAMETER', 'param_substitution_list', 'COMMA']
train
https://github.com/PyHDI/Pyverilog/blob/b852cc5ed6a7a2712e33639f9d9782d0d1587a53/pyverilog/vparser/parser.py#L166-L171
2,975
bslatkin/dpxdt
dpxdt/server/emails.py
send_ready_for_review
def send_ready_for_review(build_id, release_name, release_number): """Sends an email indicating that the release is ready for review.""" build = models.Build.query.get(build_id) if not build.send_email: logging.debug( 'Not sending ready for review email because build does not have ' ...
python
def send_ready_for_review(build_id, release_name, release_number): """Sends an email indicating that the release is ready for review.""" build = models.Build.query.get(build_id) if not build.send_email: logging.debug( 'Not sending ready for review email because build does not have ' ...
['def', 'send_ready_for_review', '(', 'build_id', ',', 'release_name', ',', 'release_number', ')', ':', 'build', '=', 'models', '.', 'Build', '.', 'query', '.', 'get', '(', 'build_id', ')', 'if', 'not', 'build', '.', 'send_email', ':', 'logging', '.', 'debug', '(', "'Not sending ready for review email because build doe...
Sends an email indicating that the release is ready for review.
['Sends', 'an', 'email', 'indicating', 'that', 'the', 'release', 'is', 'ready', 'for', 'review', '.']
train
https://github.com/bslatkin/dpxdt/blob/9f860de1731021d99253670429e5f2157e1f6297/dpxdt/server/emails.py#L45-L96
2,976
Holzhaus/python-cmuclmtk
cmuclmtk/__init__.py
wngram2idngram
def wngram2idngram(input_file, vocab_file, output_file, buffersize=100, hashtablesize=2000000, files=20, compress=False, verbosity=2, n=3, write_ascii=False, fof_size=10): """ Takes a word N-gram file and a vocabulary file and lists every id n-gram which occurred in the text, along with its number of occurr...
python
def wngram2idngram(input_file, vocab_file, output_file, buffersize=100, hashtablesize=2000000, files=20, compress=False, verbosity=2, n=3, write_ascii=False, fof_size=10): """ Takes a word N-gram file and a vocabulary file and lists every id n-gram which occurred in the text, along with its number of occurr...
['def', 'wngram2idngram', '(', 'input_file', ',', 'vocab_file', ',', 'output_file', ',', 'buffersize', '=', '100', ',', 'hashtablesize', '=', '2000000', ',', 'files', '=', '20', ',', 'compress', '=', 'False', ',', 'verbosity', '=', '2', ',', 'n', '=', '3', ',', 'write_ascii', '=', 'False', ',', 'fof_size', '=', '10', '...
Takes a word N-gram file and a vocabulary file and lists every id n-gram which occurred in the text, along with its number of occurrences, in either ASCII or binary format. Note : It is important that the vocabulary file is in alphabetical order. If you are using vocabularies generated by wfreq2vocab then this...
['Takes', 'a', 'word', 'N', '-', 'gram', 'file', 'and', 'a', 'vocabulary', 'file', 'and', 'lists', 'every', 'id', 'n', '-', 'gram', 'which', 'occurred', 'in', 'the', 'text', 'along', 'with', 'its', 'number', 'of', 'occurrences', 'in', 'either', 'ASCII', 'or', 'binary', 'format', '.']
train
https://github.com/Holzhaus/python-cmuclmtk/blob/67a5c6713c497ca644ea1c697a70e8d930c9d4b4/cmuclmtk/__init__.py#L275-L327
2,977
coleifer/walrus
walrus/containers.py
ConsumerGroup.consumer
def consumer(self, name): """ Create a new consumer for the :py:class:`ConsumerGroup`. :param name: name of consumer :returns: a :py:class:`ConsumerGroup` using the given consumer name. """ return type(self)(self.database, self.name, self.keys, name)
python
def consumer(self, name): """ Create a new consumer for the :py:class:`ConsumerGroup`. :param name: name of consumer :returns: a :py:class:`ConsumerGroup` using the given consumer name. """ return type(self)(self.database, self.name, self.keys, name)
['def', 'consumer', '(', 'self', ',', 'name', ')', ':', 'return', 'type', '(', 'self', ')', '(', 'self', '.', 'database', ',', 'self', '.', 'name', ',', 'self', '.', 'keys', ',', 'name', ')']
Create a new consumer for the :py:class:`ConsumerGroup`. :param name: name of consumer :returns: a :py:class:`ConsumerGroup` using the given consumer name.
['Create', 'a', 'new', 'consumer', 'for', 'the', ':', 'py', ':', 'class', ':', 'ConsumerGroup', '.']
train
https://github.com/coleifer/walrus/blob/82bf15a6613487b5b5fefeb488f186d7e0106547/walrus/containers.py#L1359-L1366
2,978
bcbio/bcbio-nextgen
bcbio/pipeline/alignment.py
_get_aligner_index
def _get_aligner_index(aligner, data): """Handle multiple specifications of aligner indexes, returning value to pass to aligner. Original bcbio case -- a list of indices. CWL case: a single file with secondaryFiles staged in the same directory. """ aligner_indexes = tz.get_in(("reference", get_alig...
python
def _get_aligner_index(aligner, data): """Handle multiple specifications of aligner indexes, returning value to pass to aligner. Original bcbio case -- a list of indices. CWL case: a single file with secondaryFiles staged in the same directory. """ aligner_indexes = tz.get_in(("reference", get_alig...
['def', '_get_aligner_index', '(', 'aligner', ',', 'data', ')', ':', 'aligner_indexes', '=', 'tz', '.', 'get_in', '(', '(', '"reference"', ',', 'get_aligner_with_aliases', '(', 'aligner', ',', 'data', ')', ',', '"indexes"', ')', ',', 'data', ')', '# standard bcbio case', 'if', 'aligner_indexes', 'and', 'isinstance', '(...
Handle multiple specifications of aligner indexes, returning value to pass to aligner. Original bcbio case -- a list of indices. CWL case: a single file with secondaryFiles staged in the same directory.
['Handle', 'multiple', 'specifications', 'of', 'aligner', 'indexes', 'returning', 'value', 'to', 'pass', 'to', 'aligner', '.']
train
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/alignment.py#L115-L139
2,979
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/minimal.py
MAVLink.heartbeat_send
def heartbeat_send(self, type, autopilot, base_mode, custom_mode, system_status, mavlink_version=2, force_mavlink1=False): ''' The heartbeat message shows that a system is present and responding. The type of the MAV and Autopilot hardware allow the receivi...
python
def heartbeat_send(self, type, autopilot, base_mode, custom_mode, system_status, mavlink_version=2, force_mavlink1=False): ''' The heartbeat message shows that a system is present and responding. The type of the MAV and Autopilot hardware allow the receivi...
['def', 'heartbeat_send', '(', 'self', ',', 'type', ',', 'autopilot', ',', 'base_mode', ',', 'custom_mode', ',', 'system_status', ',', 'mavlink_version', '=', '2', ',', 'force_mavlink1', '=', 'False', ')', ':', 'return', 'self', '.', 'send', '(', 'self', '.', 'heartbeat_encode', '(', 'type', ',', 'autopilot', ',', 'bas...
The heartbeat message shows that a system is present and responding. The type of the MAV and Autopilot hardware allow the receiving system to treat further messages from this system appropriate (e.g. by laying out the user interface based on the autopilot)...
['The', 'heartbeat', 'message', 'shows', 'that', 'a', 'system', 'is', 'present', 'and', 'responding', '.', 'The', 'type', 'of', 'the', 'MAV', 'and', 'Autopilot', 'hardware', 'allow', 'the', 'receiving', 'system', 'to', 'treat', 'further', 'messages', 'from', 'this', 'system', 'appropriate', '(', 'e', '.', 'g', '.', 'by...
train
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/minimal.py#L805-L821
2,980
campaignmonitor/createsend-python
lib/createsend/transactional.py
Transactional.smart_email_list
def smart_email_list(self, status="all", client_id=None): """Gets the smart email list.""" if client_id is None: response = self._get( "/transactional/smartEmail?status=%s" % status) else: response = self._get( "/transactional/smartEmail?st...
python
def smart_email_list(self, status="all", client_id=None): """Gets the smart email list.""" if client_id is None: response = self._get( "/transactional/smartEmail?status=%s" % status) else: response = self._get( "/transactional/smartEmail?st...
['def', 'smart_email_list', '(', 'self', ',', 'status', '=', '"all"', ',', 'client_id', '=', 'None', ')', ':', 'if', 'client_id', 'is', 'None', ':', 'response', '=', 'self', '.', '_get', '(', '"/transactional/smartEmail?status=%s"', '%', 'status', ')', 'else', ':', 'response', '=', 'self', '.', '_get', '(', '"/transact...
Gets the smart email list.
['Gets', 'the', 'smart', 'email', 'list', '.']
train
https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/transactional.py#L16-L24
2,981
MonashBI/arcana
arcana/data/collection.py
BaseCollection.bind
def bind(self, study, **kwargs): # @UnusedVariable """ Used for duck typing Collection objects with Spec and Match in source and sink initiation. Checks IDs match sessions in study. """ if self.frequency == 'per_subject': tree_subject_ids = list(study.tree.subject_id...
python
def bind(self, study, **kwargs): # @UnusedVariable """ Used for duck typing Collection objects with Spec and Match in source and sink initiation. Checks IDs match sessions in study. """ if self.frequency == 'per_subject': tree_subject_ids = list(study.tree.subject_id...
['def', 'bind', '(', 'self', ',', 'study', ',', '*', '*', 'kwargs', ')', ':', '# @UnusedVariable', 'if', 'self', '.', 'frequency', '==', "'per_subject'", ':', 'tree_subject_ids', '=', 'list', '(', 'study', '.', 'tree', '.', 'subject_ids', ')', 'subject_ids', '=', 'list', '(', 'self', '.', '_collection', '.', 'keys', '(...
Used for duck typing Collection objects with Spec and Match in source and sink initiation. Checks IDs match sessions in study.
['Used', 'for', 'duck', 'typing', 'Collection', 'objects', 'with', 'Spec', 'and', 'Match', 'in', 'source', 'and', 'sink', 'initiation', '.', 'Checks', 'IDs', 'match', 'sessions', 'in', 'study', '.']
train
https://github.com/MonashBI/arcana/blob/d6271a29d13733d00422d11417af8d200be62acc/arcana/data/collection.py#L167-L205
2,982
titusjan/argos
argos/config/choicecti.py
ChoiceCtiEditor.comboBoxRowsInserted
def comboBoxRowsInserted(self, _parent, start, end): """ Called when the user has entered a new value in the combobox. Puts the combobox values back into the cti. """ assert start == end, "Bug, please report: more than one row inserted" configValue = self.comboBox.itemText(st...
python
def comboBoxRowsInserted(self, _parent, start, end): """ Called when the user has entered a new value in the combobox. Puts the combobox values back into the cti. """ assert start == end, "Bug, please report: more than one row inserted" configValue = self.comboBox.itemText(st...
['def', 'comboBoxRowsInserted', '(', 'self', ',', '_parent', ',', 'start', ',', 'end', ')', ':', 'assert', 'start', '==', 'end', ',', '"Bug, please report: more than one row inserted"', 'configValue', '=', 'self', '.', 'comboBox', '.', 'itemText', '(', 'start', ')', 'logger', '.', 'debug', '(', '"Inserting {!r} at posi...
Called when the user has entered a new value in the combobox. Puts the combobox values back into the cti.
['Called', 'when', 'the', 'user', 'has', 'entered', 'a', 'new', 'value', 'in', 'the', 'combobox', '.', 'Puts', 'the', 'combobox', 'values', 'back', 'into', 'the', 'cti', '.']
train
https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/config/choicecti.py#L250-L258
2,983
django-fluent/django-fluent-contents
fluent_contents/rendering/main.py
get_cached_placeholder_output
def get_cached_placeholder_output(parent_object, placeholder_name): """ Return cached output for a placeholder, if available. This avoids fetching the Placeholder object. """ if not PlaceholderRenderingPipe.may_cache_placeholders(): return None language_code = get_parent_language_code(p...
python
def get_cached_placeholder_output(parent_object, placeholder_name): """ Return cached output for a placeholder, if available. This avoids fetching the Placeholder object. """ if not PlaceholderRenderingPipe.may_cache_placeholders(): return None language_code = get_parent_language_code(p...
['def', 'get_cached_placeholder_output', '(', 'parent_object', ',', 'placeholder_name', ')', ':', 'if', 'not', 'PlaceholderRenderingPipe', '.', 'may_cache_placeholders', '(', ')', ':', 'return', 'None', 'language_code', '=', 'get_parent_language_code', '(', 'parent_object', ')', 'cache_key', '=', 'get_placeholder_cache...
Return cached output for a placeholder, if available. This avoids fetching the Placeholder object.
['Return', 'cached', 'output', 'for', 'a', 'placeholder', 'if', 'available', '.', 'This', 'avoids', 'fetching', 'the', 'Placeholder', 'object', '.']
train
https://github.com/django-fluent/django-fluent-contents/blob/896f14add58471b98d7aa295b2c9e6abedec9003/fluent_contents/rendering/main.py#L14-L24
2,984
llllllllll/codetransformer
codetransformer/decompiler/_343.py
normalize_tuple_slice
def normalize_tuple_slice(node): """ Normalize an ast.Tuple node representing the internals of a slice. Returns the node wrapped in an ast.Index. Returns an ExtSlice node built from the tuple elements if there are any slices. """ if not any(isinstance(elt, ast.Slice) for elt in node.elts): ...
python
def normalize_tuple_slice(node): """ Normalize an ast.Tuple node representing the internals of a slice. Returns the node wrapped in an ast.Index. Returns an ExtSlice node built from the tuple elements if there are any slices. """ if not any(isinstance(elt, ast.Slice) for elt in node.elts): ...
['def', 'normalize_tuple_slice', '(', 'node', ')', ':', 'if', 'not', 'any', '(', 'isinstance', '(', 'elt', ',', 'ast', '.', 'Slice', ')', 'for', 'elt', 'in', 'node', '.', 'elts', ')', ':', 'return', 'ast', '.', 'Index', '(', 'value', '=', 'node', ')', 'return', 'ast', '.', 'ExtSlice', '(', '[', '# Wrap non-Slice nodes ...
Normalize an ast.Tuple node representing the internals of a slice. Returns the node wrapped in an ast.Index. Returns an ExtSlice node built from the tuple elements if there are any slices.
['Normalize', 'an', 'ast', '.', 'Tuple', 'node', 'representing', 'the', 'internals', 'of', 'a', 'slice', '.']
train
https://github.com/llllllllll/codetransformer/blob/c5f551e915df45adc7da7e0b1b635f0cc6a1bb27/codetransformer/decompiler/_343.py#L1244-L1261
2,985
saltstack/salt
salt/cloud/clouds/azurearm.py
list_blobs
def list_blobs(call=None, kwargs=None): # pylint: disable=unused-argument ''' List blobs. ''' if kwargs is None: kwargs = {} if 'container' not in kwargs: raise SaltCloudSystemExit( 'A container must be specified' ) storageservice = _get_block_blob_service(...
python
def list_blobs(call=None, kwargs=None): # pylint: disable=unused-argument ''' List blobs. ''' if kwargs is None: kwargs = {} if 'container' not in kwargs: raise SaltCloudSystemExit( 'A container must be specified' ) storageservice = _get_block_blob_service(...
['def', 'list_blobs', '(', 'call', '=', 'None', ',', 'kwargs', '=', 'None', ')', ':', '# pylint: disable=unused-argument', 'if', 'kwargs', 'is', 'None', ':', 'kwargs', '=', '{', '}', 'if', "'container'", 'not', 'in', 'kwargs', ':', 'raise', 'SaltCloudSystemExit', '(', "'A container must be specified'", ')', 'storageser...
List blobs.
['List', 'blobs', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L1744-L1769
2,986
andreikop/qutepart
qutepart/syntax/parser.py
ContextStack.pop
def pop(self, count): """Returns new context stack, which doesn't contain few levels """ if len(self._contexts) - 1 < count: _logger.error("#pop value is too big %d", len(self._contexts)) if len(self._contexts) > 1: return ContextStack(self._contexts[:1], ...
python
def pop(self, count): """Returns new context stack, which doesn't contain few levels """ if len(self._contexts) - 1 < count: _logger.error("#pop value is too big %d", len(self._contexts)) if len(self._contexts) > 1: return ContextStack(self._contexts[:1], ...
['def', 'pop', '(', 'self', ',', 'count', ')', ':', 'if', 'len', '(', 'self', '.', '_contexts', ')', '-', '1', '<', 'count', ':', '_logger', '.', 'error', '(', '"#pop value is too big %d"', ',', 'len', '(', 'self', '.', '_contexts', ')', ')', 'if', 'len', '(', 'self', '.', '_contexts', ')', '>', '1', ':', 'return', 'Co...
Returns new context stack, which doesn't contain few levels
['Returns', 'new', 'context', 'stack', 'which', 'doesn', 't', 'contain', 'few', 'levels']
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/parser.py#L32-L42
2,987
tjcsl/ion
intranet/apps/eighth/views/activities.py
generate_statistics_pdf
def generate_statistics_pdf(activities=None, start_date=None, all_years=False, year=None): ''' Accepts EighthActivity objects and outputs a PDF file. ''' if activities is None: activities = EighthActivity.objects.all().order_by("name") if year is None: year = current_school_year() if no...
python
def generate_statistics_pdf(activities=None, start_date=None, all_years=False, year=None): ''' Accepts EighthActivity objects and outputs a PDF file. ''' if activities is None: activities = EighthActivity.objects.all().order_by("name") if year is None: year = current_school_year() if no...
['def', 'generate_statistics_pdf', '(', 'activities', '=', 'None', ',', 'start_date', '=', 'None', ',', 'all_years', '=', 'False', ',', 'year', '=', 'None', ')', ':', 'if', 'activities', 'is', 'None', ':', 'activities', '=', 'EighthActivity', '.', 'objects', '.', 'all', '(', ')', '.', 'order_by', '(', '"name"', ')', 'i...
Accepts EighthActivity objects and outputs a PDF file.
['Accepts', 'EighthActivity', 'objects', 'and', 'outputs', 'a', 'PDF', 'file', '.']
train
https://github.com/tjcsl/ion/blob/5d722b0725d572039bb0929fd5715a4070c82c72/intranet/apps/eighth/views/activities.py#L58-L173
2,988
arista-eosplus/pyeapi
pyeapi/api/routemaps.py
Routemaps.get
def get(self, name): """Provides a method to retrieve all routemap configuration related to the name attribute. Args: name (string): The name of the routemap. Returns: None if the specified routemap does not exists. If the routermap exists a dictiona...
python
def get(self, name): """Provides a method to retrieve all routemap configuration related to the name attribute. Args: name (string): The name of the routemap. Returns: None if the specified routemap does not exists. If the routermap exists a dictiona...
['def', 'get', '(', 'self', ',', 'name', ')', ':', 'if', 'not', 'self', '.', 'get_block', '(', "r'route-map\\s%s\\s\\w+\\s\\d+'", '%', 'name', ')', ':', 'return', 'None', 'return', 'self', '.', '_parse_entries', '(', 'name', ')']
Provides a method to retrieve all routemap configuration related to the name attribute. Args: name (string): The name of the routemap. Returns: None if the specified routemap does not exists. If the routermap exists a dictionary will be provided as follows::...
['Provides', 'a', 'method', 'to', 'retrieve', 'all', 'routemap', 'configuration', 'related', 'to', 'the', 'name', 'attribute', '.']
train
https://github.com/arista-eosplus/pyeapi/blob/96a74faef1fe3bd79c4e900aed29c9956a0587d6/pyeapi/api/routemaps.py#L57-L99
2,989
apache/incubator-mxnet
example/cnn_text_classification/text_cnn.py
train
def train(symbol_data, train_iterator, valid_iterator, data_column_names, target_names): """Train cnn model Parameters ---------- symbol_data: symbol train_iterator: DataIter Train DataIter valid_iterator: DataIter Valid DataIter data_column_names: li...
python
def train(symbol_data, train_iterator, valid_iterator, data_column_names, target_names): """Train cnn model Parameters ---------- symbol_data: symbol train_iterator: DataIter Train DataIter valid_iterator: DataIter Valid DataIter data_column_names: li...
['def', 'train', '(', 'symbol_data', ',', 'train_iterator', ',', 'valid_iterator', ',', 'data_column_names', ',', 'target_names', ')', ':', 'devs', '=', 'mx', '.', 'cpu', '(', ')', '# default setting', 'if', 'args', '.', 'gpus', 'is', 'not', 'None', ':', 'for', 'i', 'in', 'args', '.', 'gpus', '.', 'split', '(', "','", ...
Train cnn model Parameters ---------- symbol_data: symbol train_iterator: DataIter Train DataIter valid_iterator: DataIter Valid DataIter data_column_names: list of str Defaults to ('data') for a typical model used in image classifi...
['Train', 'cnn', 'model']
train
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/example/cnn_text_classification/text_cnn.py#L201-L231
2,990
dead-beef/markovchain
markovchain/text/util.py
re_sub
def re_sub(pattern, repl, string, count=0, flags=0, custom_flags=0): """Replace regular expression. Parameters ---------- pattern : `str` or `_sre.SRE_Pattern` Compiled regular expression. repl : `str` or `function` Replacement. string : `str` Input string. count: `i...
python
def re_sub(pattern, repl, string, count=0, flags=0, custom_flags=0): """Replace regular expression. Parameters ---------- pattern : `str` or `_sre.SRE_Pattern` Compiled regular expression. repl : `str` or `function` Replacement. string : `str` Input string. count: `i...
['def', 're_sub', '(', 'pattern', ',', 'repl', ',', 'string', ',', 'count', '=', '0', ',', 'flags', '=', '0', ',', 'custom_flags', '=', '0', ')', ':', 'if', 'custom_flags', '&', 'ReFlags', '.', 'OVERLAP', ':', 'prev_string', '=', 'None', 'while', 'string', '!=', 'prev_string', ':', 'prev_string', '=', 'string', 'string...
Replace regular expression. Parameters ---------- pattern : `str` or `_sre.SRE_Pattern` Compiled regular expression. repl : `str` or `function` Replacement. string : `str` Input string. count: `int` Maximum number of pattern occurrences. flags : `int` ...
['Replace', 'regular', 'expression', '.']
train
https://github.com/dead-beef/markovchain/blob/9bd10b2f01089341c4a875a0fa569d50caba22c7/markovchain/text/util.py#L222-L246
2,991
pyviz/holoviews
holoviews/core/data/__init__.py
Dataset.dframe
def dframe(self, dimensions=None, multi_index=False): """Convert dimension values to DataFrame. Returns a pandas dataframe of columns along each dimension, either completely flat or indexed by key dimensions. Args: dimensions: Dimensions to return as columns mul...
python
def dframe(self, dimensions=None, multi_index=False): """Convert dimension values to DataFrame. Returns a pandas dataframe of columns along each dimension, either completely flat or indexed by key dimensions. Args: dimensions: Dimensions to return as columns mul...
['def', 'dframe', '(', 'self', ',', 'dimensions', '=', 'None', ',', 'multi_index', '=', 'False', ')', ':', 'if', 'dimensions', 'is', 'None', ':', 'dimensions', '=', '[', 'd', '.', 'name', 'for', 'd', 'in', 'self', '.', 'dimensions', '(', ')', ']', 'else', ':', 'dimensions', '=', '[', 'self', '.', 'get_dimension', '(', ...
Convert dimension values to DataFrame. Returns a pandas dataframe of columns along each dimension, either completely flat or indexed by key dimensions. Args: dimensions: Dimensions to return as columns multi_index: Convert key dimensions to (multi-)index Return...
['Convert', 'dimension', 'values', 'to', 'DataFrame', '.']
train
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/data/__init__.py#L791-L811
2,992
secdev/scapy
scapy/layers/tls/record_tls13.py
TLS13.pre_dissect
def pre_dissect(self, s): """ Decrypt, verify and decompress the message. """ if len(s) < 5: raise Exception("Invalid record: header is too short.") if isinstance(self.tls_session.rcs.cipher, Cipher_NULL): self.deciphered_len = None return s ...
python
def pre_dissect(self, s): """ Decrypt, verify and decompress the message. """ if len(s) < 5: raise Exception("Invalid record: header is too short.") if isinstance(self.tls_session.rcs.cipher, Cipher_NULL): self.deciphered_len = None return s ...
['def', 'pre_dissect', '(', 'self', ',', 's', ')', ':', 'if', 'len', '(', 's', ')', '<', '5', ':', 'raise', 'Exception', '(', '"Invalid record: header is too short."', ')', 'if', 'isinstance', '(', 'self', '.', 'tls_session', '.', 'rcs', '.', 'cipher', ',', 'Cipher_NULL', ')', ':', 'self', '.', 'deciphered_len', '=', '...
Decrypt, verify and decompress the message.
['Decrypt', 'verify', 'and', 'decompress', 'the', 'message', '.']
train
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/record_tls13.py#L124-L139
2,993
huge-success/sanic
sanic/config.py
Config.load_environment_vars
def load_environment_vars(self, prefix=SANIC_PREFIX): """ Looks for prefixed environment variables and applies them to the configuration if present. """ for k, v in os.environ.items(): if k.startswith(prefix): _, config_key = k.split(prefix, 1) ...
python
def load_environment_vars(self, prefix=SANIC_PREFIX): """ Looks for prefixed environment variables and applies them to the configuration if present. """ for k, v in os.environ.items(): if k.startswith(prefix): _, config_key = k.split(prefix, 1) ...
['def', 'load_environment_vars', '(', 'self', ',', 'prefix', '=', 'SANIC_PREFIX', ')', ':', 'for', 'k', ',', 'v', 'in', 'os', '.', 'environ', '.', 'items', '(', ')', ':', 'if', 'k', '.', 'startswith', '(', 'prefix', ')', ':', '_', ',', 'config_key', '=', 'k', '.', 'split', '(', 'prefix', ',', '1', ')', 'try', ':', 'sel...
Looks for prefixed environment variables and applies them to the configuration if present.
['Looks', 'for', 'prefixed', 'environment', 'variables', 'and', 'applies', 'them', 'to', 'the', 'configuration', 'if', 'present', '.']
train
https://github.com/huge-success/sanic/blob/6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd/sanic/config.py#L116-L133
2,994
albahnsen/CostSensitiveClassification
costcla/models/cost_tree.py
CostSensitiveDecisionTreeClassifier._classify
def _classify(self, X, tree, proba=False): """ Private function that classify a dataset using tree. Parameters ---------- X : array-like of shape = [n_samples, n_features] The input samples. tree : object proba : bool, optional (default=False) ...
python
def _classify(self, X, tree, proba=False): """ Private function that classify a dataset using tree. Parameters ---------- X : array-like of shape = [n_samples, n_features] The input samples. tree : object proba : bool, optional (default=False) ...
['def', '_classify', '(', 'self', ',', 'X', ',', 'tree', ',', 'proba', '=', 'False', ')', ':', 'n_samples', ',', 'n_features', '=', 'X', '.', 'shape', 'predicted', '=', 'np', '.', 'ones', '(', 'n_samples', ')', '# Check if final node', 'if', 'tree', '[', "'split'", ']', '==', '-', '1', ':', 'if', 'not', 'proba', ':', '...
Private function that classify a dataset using tree. Parameters ---------- X : array-like of shape = [n_samples, n_features] The input samples. tree : object proba : bool, optional (default=False) If True then return probabilities else return class ...
['Private', 'function', 'that', 'classify', 'a', 'dataset', 'using', 'tree', '.']
train
https://github.com/albahnsen/CostSensitiveClassification/blob/75778ae32c70671c0cdde6c4651277b6a8b58871/costcla/models/cost_tree.py#L468-L513
2,995
mushkevych/scheduler
synergy/scheduler/garbage_collector.py
GarbageCollector.scan_uow_candidates
def scan_uow_candidates(self): """ method performs two actions: - enlist stale or invalid units of work into reprocessing queue - cancel UOWs that are older than 2 days and have been submitted more than 1 hour ago """ try: since = settings.settings['synergy_start_time...
python
def scan_uow_candidates(self): """ method performs two actions: - enlist stale or invalid units of work into reprocessing queue - cancel UOWs that are older than 2 days and have been submitted more than 1 hour ago """ try: since = settings.settings['synergy_start_time...
['def', 'scan_uow_candidates', '(', 'self', ')', ':', 'try', ':', 'since', '=', 'settings', '.', 'settings', '[', "'synergy_start_timeperiod'", ']', 'uow_list', '=', 'self', '.', 'uow_dao', '.', 'get_reprocessing_candidates', '(', 'since', ')', 'except', 'LookupError', 'as', 'e', ':', 'self', '.', 'logger', '.', 'info'...
method performs two actions: - enlist stale or invalid units of work into reprocessing queue - cancel UOWs that are older than 2 days and have been submitted more than 1 hour ago
['method', 'performs', 'two', 'actions', ':', '-', 'enlist', 'stale', 'or', 'invalid', 'units', 'of', 'work', 'into', 'reprocessing', 'queue', '-', 'cancel', 'UOWs', 'that', 'are', 'older', 'than', '2', 'days', 'and', 'have', 'been', 'submitted', 'more', 'than', '1', 'hour', 'ago']
train
https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/garbage_collector.py#L37-L79
2,996
thombashi/SimpleSQLite
simplesqlite/core.py
SimpleSQLite.fetch_table_names
def fetch_table_names(self, include_system_table=False): """ :return: List of table names in the database. :rtype: list :raises simplesqlite.NullDatabaseConnectionError: |raises_check_connection| :raises simplesqlite.OperationalError: |raises_operational_error| ...
python
def fetch_table_names(self, include_system_table=False): """ :return: List of table names in the database. :rtype: list :raises simplesqlite.NullDatabaseConnectionError: |raises_check_connection| :raises simplesqlite.OperationalError: |raises_operational_error| ...
['def', 'fetch_table_names', '(', 'self', ',', 'include_system_table', '=', 'False', ')', ':', 'self', '.', 'check_connection', '(', ')', 'return', 'self', '.', 'schema_extractor', '.', 'fetch_table_names', '(', 'include_system_table', ')']
:return: List of table names in the database. :rtype: list :raises simplesqlite.NullDatabaseConnectionError: |raises_check_connection| :raises simplesqlite.OperationalError: |raises_operational_error| :Sample Code: .. code:: python from simplesql...
[':', 'return', ':', 'List', 'of', 'table', 'names', 'in', 'the', 'database', '.', ':', 'rtype', ':', 'list', ':', 'raises', 'simplesqlite', '.', 'NullDatabaseConnectionError', ':', '|raises_check_connection|', ':', 'raises', 'simplesqlite', '.', 'OperationalError', ':', '|raises_operational_error|']
train
https://github.com/thombashi/SimpleSQLite/blob/b16f212132b9b98773e68bf7395abc2f60f56fe5/simplesqlite/core.py#L683-L710
2,997
pyros-dev/pyros-common
pyros_interfaces_mock/pyros_mock.py
PyrosMock.setup
def setup(self, publishers=None, subscribers=None, services=None, topics=None, params=None): """ :param publishers: :param subscribers: :param services: :param topics: ONLY HERE for BW compat :param params: :return: """ super(PyrosMock, self).setup...
python
def setup(self, publishers=None, subscribers=None, services=None, topics=None, params=None): """ :param publishers: :param subscribers: :param services: :param topics: ONLY HERE for BW compat :param params: :return: """ super(PyrosMock, self).setup...
['def', 'setup', '(', 'self', ',', 'publishers', '=', 'None', ',', 'subscribers', '=', 'None', ',', 'services', '=', 'None', ',', 'topics', '=', 'None', ',', 'params', '=', 'None', ')', ':', 'super', '(', 'PyrosMock', ',', 'self', ')', '.', 'setup', '(', 'publishers', '=', 'publishers', ',', 'subscribers', '=', 'subscr...
:param publishers: :param subscribers: :param services: :param topics: ONLY HERE for BW compat :param params: :return:
[':', 'param', 'publishers', ':', ':', 'param', 'subscribers', ':', ':', 'param', 'services', ':', ':', 'param', 'topics', ':', 'ONLY', 'HERE', 'for', 'BW', 'compat', ':', 'param', 'params', ':', ':', 'return', ':']
train
https://github.com/pyros-dev/pyros-common/blob/0709538b8777ec055ea31f59cdca5bebaaabb04e/pyros_interfaces_mock/pyros_mock.py#L130-L139
2,998
poppy-project/pypot
pypot/dynamixel/controller.py
DxlController.set_register
def set_register(self, motors): """ Gets the value from :class:`~pypot.dynamixel.motor.DxlMotor` and sets it to the specified register. """ if not motors: return ids = [m.id for m in motors] values = (m.__dict__[self.varname] for m in motors) getattr(self.io, 'set_{}...
python
def set_register(self, motors): """ Gets the value from :class:`~pypot.dynamixel.motor.DxlMotor` and sets it to the specified register. """ if not motors: return ids = [m.id for m in motors] values = (m.__dict__[self.varname] for m in motors) getattr(self.io, 'set_{}...
['def', 'set_register', '(', 'self', ',', 'motors', ')', ':', 'if', 'not', 'motors', ':', 'return', 'ids', '=', '[', 'm', '.', 'id', 'for', 'm', 'in', 'motors', ']', 'values', '=', '(', 'm', '.', '__dict__', '[', 'self', '.', 'varname', ']', 'for', 'm', 'in', 'motors', ')', 'getattr', '(', 'self', '.', 'io', ',', "'set...
Gets the value from :class:`~pypot.dynamixel.motor.DxlMotor` and sets it to the specified register.
['Gets', 'the', 'value', 'from', ':', 'class', ':', '~pypot', '.', 'dynamixel', '.', 'motor', '.', 'DxlMotor', 'and', 'sets', 'it', 'to', 'the', 'specified', 'register', '.']
train
https://github.com/poppy-project/pypot/blob/d9c6551bbc87d45d9d1f0bc15e35b616d0002afd/pypot/dynamixel/controller.py#L85-L95
2,999
DataBiosphere/toil
src/toil/provisioners/node.py
Node.sshAppliance
def sshAppliance(self, *args, **kwargs): """ :param args: arguments to execute in the appliance :param kwargs: tty=bool tells docker whether or not to create a TTY shell for interactive SSHing. The default value is False. Input=string is passed as input to the Popen call....
python
def sshAppliance(self, *args, **kwargs): """ :param args: arguments to execute in the appliance :param kwargs: tty=bool tells docker whether or not to create a TTY shell for interactive SSHing. The default value is False. Input=string is passed as input to the Popen call....
['def', 'sshAppliance', '(', 'self', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'kwargs', '[', "'appliance'", ']', '=', 'True', 'return', 'self', '.', 'coreSSH', '(', '*', 'args', ',', '*', '*', 'kwargs', ')']
:param args: arguments to execute in the appliance :param kwargs: tty=bool tells docker whether or not to create a TTY shell for interactive SSHing. The default value is False. Input=string is passed as input to the Popen call.
[':', 'param', 'args', ':', 'arguments', 'to', 'execute', 'in', 'the', 'appliance', ':', 'param', 'kwargs', ':', 'tty', '=', 'bool', 'tells', 'docker', 'whether', 'or', 'not', 'to', 'create', 'a', 'TTY', 'shell', 'for', 'interactive', 'SSHing', '.', 'The', 'default', 'value', 'is', 'False', '.', 'Input', '=', 'string',...
train
https://github.com/DataBiosphere/toil/blob/a8252277ff814e7bee0971139c2344f88e44b644/src/toil/provisioners/node.py#L194-L202