Unnamed: 0
int64
0
10k
repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
5
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
100
30.3k
language
stringclasses
1 value
func_code_string
stringlengths
100
30.3k
func_code_tokens
stringlengths
138
33.2k
func_documentation_string
stringlengths
1
15k
func_documentation_tokens
stringlengths
5
5.14k
split_name
stringclasses
1 value
func_code_url
stringlengths
91
315
3,300
quantopian/zipline
zipline/lib/adjusted_array.py
AdjustedArray.update_labels
def update_labels(self, func): """ Map a function over baseline and adjustment values in place. Note that the baseline data values must be a LabelArray. """ if not isinstance(self.data, LabelArray): raise TypeError( 'update_labels only supported if da...
python
def update_labels(self, func): """ Map a function over baseline and adjustment values in place. Note that the baseline data values must be a LabelArray. """ if not isinstance(self.data, LabelArray): raise TypeError( 'update_labels only supported if da...
['def', 'update_labels', '(', 'self', ',', 'func', ')', ':', 'if', 'not', 'isinstance', '(', 'self', '.', 'data', ',', 'LabelArray', ')', ':', 'raise', 'TypeError', '(', "'update_labels only supported if data is of type LabelArray.'", ')', '# Map the baseline values.', 'self', '.', '_data', '=', 'self', '.', '_data', '...
Map a function over baseline and adjustment values in place. Note that the baseline data values must be a LabelArray.
['Map', 'a', 'function', 'over', 'baseline', 'and', 'adjustment', 'values', 'in', 'place', '.']
train
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/lib/adjusted_array.py#L311-L328
3,301
by46/simplekit
simplekit/objson/dolphin2.py
dump
def dump(obj, fp, *args, **kwargs): """Serialize a object to a file object. Basic Usage: >>> import simplekit.objson >>> from cStringIO import StringIO >>> obj = {'name': 'wendy'} >>> io = StringIO() >>> simplekit.objson.dump(obj, io) >>> print io.getvalue() :param obj: a object w...
python
def dump(obj, fp, *args, **kwargs): """Serialize a object to a file object. Basic Usage: >>> import simplekit.objson >>> from cStringIO import StringIO >>> obj = {'name': 'wendy'} >>> io = StringIO() >>> simplekit.objson.dump(obj, io) >>> print io.getvalue() :param obj: a object w...
['def', 'dump', '(', 'obj', ',', 'fp', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'kwargs', '[', "'default'", ']', '=', 'object2dict', 'json', '.', 'dump', '(', 'obj', ',', 'fp', ',', '*', 'args', ',', '*', '*', 'kwargs', ')']
Serialize a object to a file object. Basic Usage: >>> import simplekit.objson >>> from cStringIO import StringIO >>> obj = {'name': 'wendy'} >>> io = StringIO() >>> simplekit.objson.dump(obj, io) >>> print io.getvalue() :param obj: a object which need to dump :param fp: a instance...
['Serialize', 'a', 'object', 'to', 'a', 'file', 'object', '.']
train
https://github.com/by46/simplekit/blob/33f3ce6de33accc185e1057f096af41859db5976/simplekit/objson/dolphin2.py#L98-L118
3,302
erigones/zabbix-api
zabbix_api.py
ZabbixAPI.timestamp_to_datetime
def timestamp_to_datetime(cls, dt, dt_format=DATETIME_FORMAT): """Convert unix timestamp to human readable date/time string""" return cls.convert_datetime(cls.get_datetime(dt), dt_format=dt_format)
python
def timestamp_to_datetime(cls, dt, dt_format=DATETIME_FORMAT): """Convert unix timestamp to human readable date/time string""" return cls.convert_datetime(cls.get_datetime(dt), dt_format=dt_format)
['def', 'timestamp_to_datetime', '(', 'cls', ',', 'dt', ',', 'dt_format', '=', 'DATETIME_FORMAT', ')', ':', 'return', 'cls', '.', 'convert_datetime', '(', 'cls', '.', 'get_datetime', '(', 'dt', ')', ',', 'dt_format', '=', 'dt_format', ')']
Convert unix timestamp to human readable date/time string
['Convert', 'unix', 'timestamp', 'to', 'human', 'readable', 'date', '/', 'time', 'string']
train
https://github.com/erigones/zabbix-api/blob/2474ab1d1ddb46c26eea70671b3a599b836d42da/zabbix_api.py#L222-L224
3,303
ninuxorg/nodeshot
nodeshot/core/nodes/views.py
NodeList.perform_create
def perform_create(self, serializer): """ determine user when node is added """ if serializer.instance is None: serializer.save(user=self.request.user)
python
def perform_create(self, serializer): """ determine user when node is added """ if serializer.instance is None: serializer.save(user=self.request.user)
['def', 'perform_create', '(', 'self', ',', 'serializer', ')', ':', 'if', 'serializer', '.', 'instance', 'is', 'None', ':', 'serializer', '.', 'save', '(', 'user', '=', 'self', '.', 'request', '.', 'user', ')']
determine user when node is added
['determine', 'user', 'when', 'node', 'is', 'added']
train
https://github.com/ninuxorg/nodeshot/blob/2466f0a55f522b2696026f196436ce7ba3f1e5c6/nodeshot/core/nodes/views.py#L51-L54
3,304
projecthamster/hamster-lib
hamster_lib/helpers/config_helpers.py
get_config_path
def get_config_path(appdirs=DEFAULT_APPDIRS, file_name=DEFAULT_CONFIG_FILENAME): """ Return the path where the config file is stored. Args: app_name (text_type, optional): Name of the application, defaults to ``'projecthamster``. Allows you to use your own application specific names...
python
def get_config_path(appdirs=DEFAULT_APPDIRS, file_name=DEFAULT_CONFIG_FILENAME): """ Return the path where the config file is stored. Args: app_name (text_type, optional): Name of the application, defaults to ``'projecthamster``. Allows you to use your own application specific names...
['def', 'get_config_path', '(', 'appdirs', '=', 'DEFAULT_APPDIRS', ',', 'file_name', '=', 'DEFAULT_CONFIG_FILENAME', ')', ':', 'return', 'os', '.', 'path', '.', 'join', '(', 'appdirs', '.', 'user_config_dir', ',', 'file_name', ')']
Return the path where the config file is stored. Args: app_name (text_type, optional): Name of the application, defaults to ``'projecthamster``. Allows you to use your own application specific namespace if you wish. file_name (text_type, optional): Name of the config file. Defaults ...
['Return', 'the', 'path', 'where', 'the', 'config', 'file', 'is', 'stored', '.']
train
https://github.com/projecthamster/hamster-lib/blob/bc34c822c239a6fa0cde3a4f90b0d00506fb5a4f/hamster_lib/helpers/config_helpers.py#L141-L155
3,305
reflexsc/reflex
src/rfxmon/__init__.py
Monitor.reporting
def reporting(self): """ report on consumption info """ self.thread_debug("reporting") res = resource.getrusage(resource.RUSAGE_SELF) self.NOTIFY("", type='internal-usage', maxrss=round(res.ru_maxrss/1024, 2), ix...
python
def reporting(self): """ report on consumption info """ self.thread_debug("reporting") res = resource.getrusage(resource.RUSAGE_SELF) self.NOTIFY("", type='internal-usage', maxrss=round(res.ru_maxrss/1024, 2), ix...
['def', 'reporting', '(', 'self', ')', ':', 'self', '.', 'thread_debug', '(', '"reporting"', ')', 'res', '=', 'resource', '.', 'getrusage', '(', 'resource', '.', 'RUSAGE_SELF', ')', 'self', '.', 'NOTIFY', '(', '""', ',', 'type', '=', "'internal-usage'", ',', 'maxrss', '=', 'round', '(', 'res', '.', 'ru_maxrss', '/', '1...
report on consumption info
['report', 'on', 'consumption', 'info']
train
https://github.com/reflexsc/reflex/blob/cee6b0ccfef395ca5e157d644a2e3252cea9fe62/src/rfxmon/__init__.py#L342-L356
3,306
tensorflow/tensor2tensor
tensor2tensor/data_generators/wikisum/wikisum.py
_wiki_articles
def _wiki_articles(shard_id, wikis_dir=None): """Generates WikipediaArticles from GCS that are part of shard shard_id.""" if not wikis_dir: wikis_dir = WIKI_CONTENT_DIR with tf.Graph().as_default(): dataset = tf.data.TFRecordDataset( cc_utils.readahead( os.path.join(wikis_dir, WIKI_CON...
python
def _wiki_articles(shard_id, wikis_dir=None): """Generates WikipediaArticles from GCS that are part of shard shard_id.""" if not wikis_dir: wikis_dir = WIKI_CONTENT_DIR with tf.Graph().as_default(): dataset = tf.data.TFRecordDataset( cc_utils.readahead( os.path.join(wikis_dir, WIKI_CON...
['def', '_wiki_articles', '(', 'shard_id', ',', 'wikis_dir', '=', 'None', ')', ':', 'if', 'not', 'wikis_dir', ':', 'wikis_dir', '=', 'WIKI_CONTENT_DIR', 'with', 'tf', '.', 'Graph', '(', ')', '.', 'as_default', '(', ')', ':', 'dataset', '=', 'tf', '.', 'data', '.', 'TFRecordDataset', '(', 'cc_utils', '.', 'readahead', '...
Generates WikipediaArticles from GCS that are part of shard shard_id.
['Generates', 'WikipediaArticles', 'from', 'GCS', 'that', 'are', 'part', 'of', 'shard', 'shard_id', '.']
train
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/wikisum/wikisum.py#L279-L323
3,307
facetoe/zenpy
zenpy/lib/api_objects/help_centre_objects.py
Article.author
def author(self): """ | Comment: The id of the user who wrote the article (set to the user who made the request on create by default) """ if self.api and self.author_id: return self.api._get_user(self.author_id)
python
def author(self): """ | Comment: The id of the user who wrote the article (set to the user who made the request on create by default) """ if self.api and self.author_id: return self.api._get_user(self.author_id)
['def', 'author', '(', 'self', ')', ':', 'if', 'self', '.', 'api', 'and', 'self', '.', 'author_id', ':', 'return', 'self', '.', 'api', '.', '_get_user', '(', 'self', '.', 'author_id', ')']
| Comment: The id of the user who wrote the article (set to the user who made the request on create by default)
['|', 'Comment', ':', 'The', 'id', 'of', 'the', 'user', 'who', 'wrote', 'the', 'article', '(', 'set', 'to', 'the', 'user', 'who', 'made', 'the', 'request', 'on', 'create', 'by', 'default', ')']
train
https://github.com/facetoe/zenpy/blob/34c54c7e408b9ed01604ddf8b3422204c8bf31ea/zenpy/lib/api_objects/help_centre_objects.py#L233-L238
3,308
python-cmd2/cmd2
cmd2/cmd2.py
Cmd.do_py
def do_py(self, args: argparse.Namespace) -> bool: """Invoke Python command or shell""" from .pyscript_bridge import PyscriptBridge if self._in_py: err = "Recursively entering interactive Python consoles is not allowed." self.perror(err, traceback_war=False) r...
python
def do_py(self, args: argparse.Namespace) -> bool: """Invoke Python command or shell""" from .pyscript_bridge import PyscriptBridge if self._in_py: err = "Recursively entering interactive Python consoles is not allowed." self.perror(err, traceback_war=False) r...
['def', 'do_py', '(', 'self', ',', 'args', ':', 'argparse', '.', 'Namespace', ')', '->', 'bool', ':', 'from', '.', 'pyscript_bridge', 'import', 'PyscriptBridge', 'if', 'self', '.', '_in_py', ':', 'err', '=', '"Recursively entering interactive Python consoles is not allowed."', 'self', '.', 'perror', '(', 'err', ',', 't...
Invoke Python command or shell
['Invoke', 'Python', 'command', 'or', 'shell']
train
https://github.com/python-cmd2/cmd2/blob/b22c0bd891ed08c8b09df56df9d91f48166a5e2a/cmd2/cmd2.py#L3034-L3212
3,309
Kami/python-yubico-client
yubico_client/yubico.py
Yubico.get_parameters_as_dictionary
def get_parameters_as_dictionary(self, query_string): """ Returns query string parameters as a dictionary. """ pairs = (x.split('=', 1) for x in query_string.split('&')) return dict((k, unquote(v)) for k, v in pairs)
python
def get_parameters_as_dictionary(self, query_string): """ Returns query string parameters as a dictionary. """ pairs = (x.split('=', 1) for x in query_string.split('&')) return dict((k, unquote(v)) for k, v in pairs)
['def', 'get_parameters_as_dictionary', '(', 'self', ',', 'query_string', ')', ':', 'pairs', '=', '(', 'x', '.', 'split', '(', "'='", ',', '1', ')', 'for', 'x', 'in', 'query_string', '.', 'split', '(', "'&'", ')', ')', 'return', 'dict', '(', '(', 'k', ',', 'unquote', '(', 'v', ')', ')', 'for', 'k', ',', 'v', 'in', 'pai...
Returns query string parameters as a dictionary.
['Returns', 'query', 'string', 'parameters', 'as', 'a', 'dictionary', '.']
train
https://github.com/Kami/python-yubico-client/blob/3334b2ee1b5b996af3ef6be57a4ea52b8e45e764/yubico_client/yubico.py#L342-L345
3,310
ldomic/lintools
lintools/molecule.py
Molecule.load_molecule_in_rdkit_smiles
def load_molecule_in_rdkit_smiles(self, molSize,kekulize=True,bonds=[],bond_color=None,atom_color = {}, size= {} ): """ Loads mol file in rdkit without the hydrogens - they do not have to appear in the final figure. Once loaded, the molecule is converted to SMILES format which RDKit appears to ...
python
def load_molecule_in_rdkit_smiles(self, molSize,kekulize=True,bonds=[],bond_color=None,atom_color = {}, size= {} ): """ Loads mol file in rdkit without the hydrogens - they do not have to appear in the final figure. Once loaded, the molecule is converted to SMILES format which RDKit appears to ...
['def', 'load_molecule_in_rdkit_smiles', '(', 'self', ',', 'molSize', ',', 'kekulize', '=', 'True', ',', 'bonds', '=', '[', ']', ',', 'bond_color', '=', 'None', ',', 'atom_color', '=', '{', '}', ',', 'size', '=', '{', '}', ')', ':', 'mol_in_rdkit', '=', 'self', '.', 'topology_data', '.', 'mol', '#need to reload without...
Loads mol file in rdkit without the hydrogens - they do not have to appear in the final figure. Once loaded, the molecule is converted to SMILES format which RDKit appears to draw best - since we do not care about the actual coordinates of the original molecule, it is sufficient to have just 2D ...
['Loads', 'mol', 'file', 'in', 'rdkit', 'without', 'the', 'hydrogens', '-', 'they', 'do', 'not', 'have', 'to', 'appear', 'in', 'the', 'final', 'figure', '.', 'Once', 'loaded', 'the', 'molecule', 'is', 'converted', 'to', 'SMILES', 'format', 'which', 'RDKit', 'appears', 'to', 'draw', 'best', '-', 'since', 'we', 'do', 'no...
train
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/molecule.py#L48-L94
3,311
suurjaak/InputScope
inputscope/webui.py
init
def init(): """Initialize configuration and web application.""" global app if app: return app conf.init(), db.init(conf.DbPath, conf.DbStatements) bottle.TEMPLATE_PATH.insert(0, conf.TemplatePath) app = bottle.default_app() bottle.BaseTemplate.defaults.update(get_url=app.get_url) ...
python
def init(): """Initialize configuration and web application.""" global app if app: return app conf.init(), db.init(conf.DbPath, conf.DbStatements) bottle.TEMPLATE_PATH.insert(0, conf.TemplatePath) app = bottle.default_app() bottle.BaseTemplate.defaults.update(get_url=app.get_url) ...
['def', 'init', '(', ')', ':', 'global', 'app', 'if', 'app', ':', 'return', 'app', 'conf', '.', 'init', '(', ')', ',', 'db', '.', 'init', '(', 'conf', '.', 'DbPath', ',', 'conf', '.', 'DbStatements', ')', 'bottle', '.', 'TEMPLATE_PATH', '.', 'insert', '(', '0', ',', 'conf', '.', 'TemplatePath', ')', 'app', '=', 'bottle...
Initialize configuration and web application.
['Initialize', 'configuration', 'and', 'web', 'application', '.']
train
https://github.com/suurjaak/InputScope/blob/245ff045163a1995e8cd5ac558d0a93024eb86eb/inputscope/webui.py#L210-L219
3,312
wonambi-python/wonambi
wonambi/widgets/channels.py
ChannelsGroup.get_info
def get_info(self): """Get the information about the channel groups. Returns ------- dict information about this channel group Notes ----- The items in selectedItems() are ordered based on the user's selection (which appears pretty random). I...
python
def get_info(self): """Get the information about the channel groups. Returns ------- dict information about this channel group Notes ----- The items in selectedItems() are ordered based on the user's selection (which appears pretty random). I...
['def', 'get_info', '(', 'self', ')', ':', 'selectedItems', '=', 'self', '.', 'idx_l0', '.', 'selectedItems', '(', ')', 'selected_chan', '=', '[', 'x', '.', 'text', '(', ')', 'for', 'x', 'in', 'selectedItems', ']', 'chan_to_plot', '=', '[', ']', 'for', 'chan', 'in', 'self', '.', 'chan_name', '+', '[', "'_REF'", ']', ':...
Get the information about the channel groups. Returns ------- dict information about this channel group Notes ----- The items in selectedItems() are ordered based on the user's selection (which appears pretty random). It's more consistent to use the ...
['Get', 'the', 'information', 'about', 'the', 'channel', 'groups', '.']
train
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/channels.py#L221-L271
3,313
scott-maddox/openbandparams
src/openbandparams/iii_v_zinc_blende_strained.py
IIIVZincBlendeStrained001.strain_in_plane
def strain_in_plane(self, **kwargs): ''' Returns the in-plane strain assuming no lattice relaxation, which is positive for tensile strain and negative for compressive strain. ''' if self._strain_out_of_plane is not None: return ((self._strain_out_of_plane / -2.) * ...
python
def strain_in_plane(self, **kwargs): ''' Returns the in-plane strain assuming no lattice relaxation, which is positive for tensile strain and negative for compressive strain. ''' if self._strain_out_of_plane is not None: return ((self._strain_out_of_plane / -2.) * ...
['def', 'strain_in_plane', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'if', 'self', '.', '_strain_out_of_plane', 'is', 'not', 'None', ':', 'return', '(', '(', 'self', '.', '_strain_out_of_plane', '/', '-', '2.', ')', '*', '(', 'self', '.', 'unstrained', '.', 'c11', '(', '*', '*', 'kwargs', ')', '/', 'self', '.', '...
Returns the in-plane strain assuming no lattice relaxation, which is positive for tensile strain and negative for compressive strain.
['Returns', 'the', 'in', '-', 'plane', 'strain', 'assuming', 'no', 'lattice', 'relaxation', 'which', 'is', 'positive', 'for', 'tensile', 'strain', 'and', 'negative', 'for', 'compressive', 'strain', '.']
train
https://github.com/scott-maddox/openbandparams/blob/bc24e59187326bcb8948117434536082c9055777/src/openbandparams/iii_v_zinc_blende_strained.py#L86-L96
3,314
HIPS/autograd
autograd/differential_operators.py
value_and_grad
def value_and_grad(fun, x): """Returns a function that returns both value and gradient. Suitable for use in scipy.optimize""" vjp, ans = _make_vjp(fun, x) if not vspace(ans).size == 1: raise TypeError("value_and_grad only applies to real scalar-output " "functions. Try ja...
python
def value_and_grad(fun, x): """Returns a function that returns both value and gradient. Suitable for use in scipy.optimize""" vjp, ans = _make_vjp(fun, x) if not vspace(ans).size == 1: raise TypeError("value_and_grad only applies to real scalar-output " "functions. Try ja...
['def', 'value_and_grad', '(', 'fun', ',', 'x', ')', ':', 'vjp', ',', 'ans', '=', '_make_vjp', '(', 'fun', ',', 'x', ')', 'if', 'not', 'vspace', '(', 'ans', ')', '.', 'size', '==', '1', ':', 'raise', 'TypeError', '(', '"value_and_grad only applies to real scalar-output "', '"functions. Try jacobian, elementwise_grad or...
Returns a function that returns both value and gradient. Suitable for use in scipy.optimize
['Returns', 'a', 'function', 'that', 'returns', 'both', 'value', 'and', 'gradient', '.', 'Suitable', 'for', 'use', 'in', 'scipy', '.', 'optimize']
train
https://github.com/HIPS/autograd/blob/e3b525302529d7490769d5c0bcfc7457e24e3b3e/autograd/differential_operators.py#L132-L140
3,315
opereto/pyopereto
pyopereto/client.py
OperetoClient.create_product
def create_product(self, product, version, build, name=None, description=None, attributes={}): ''' create_product(self, product, version, build, name=None, description=None, attributes={}) Create product :Parameters: * *product* (`string`) -- product * *version* (`strin...
python
def create_product(self, product, version, build, name=None, description=None, attributes={}): ''' create_product(self, product, version, build, name=None, description=None, attributes={}) Create product :Parameters: * *product* (`string`) -- product * *version* (`strin...
['def', 'create_product', '(', 'self', ',', 'product', ',', 'version', ',', 'build', ',', 'name', '=', 'None', ',', 'description', '=', 'None', ',', 'attributes', '=', '{', '}', ')', ':', 'request_data', '=', '{', "'product'", ':', 'product', ',', "'version'", ':', 'version', ',', "'build'", ':', 'build', '}', 'if', 'n...
create_product(self, product, version, build, name=None, description=None, attributes={}) Create product :Parameters: * *product* (`string`) -- product * *version* (`string`) -- version * *build* (`string`) -- build * *name* (`string`) -- name * *description* (`...
['create_product', '(', 'self', 'product', 'version', 'build', 'name', '=', 'None', 'description', '=', 'None', 'attributes', '=', '{}', ')']
train
https://github.com/opereto/pyopereto/blob/16ca987738a7e1b82b52b0b099794a74ed557223/pyopereto/client.py#L1492-L1515
3,316
zetaops/zengine
zengine/tornado_server/server.py
HttpHandler.post
def post(self, view_name): """ login handler """ sess_id = None input_data = {} # try: self._handle_headers() # handle input input_data = json_decode(self.request.body) if self.request.body else {} input_data['path'] = view_name #...
python
def post(self, view_name): """ login handler """ sess_id = None input_data = {} # try: self._handle_headers() # handle input input_data = json_decode(self.request.body) if self.request.body else {} input_data['path'] = view_name #...
['def', 'post', '(', 'self', ',', 'view_name', ')', ':', 'sess_id', '=', 'None', 'input_data', '=', '{', '}', '# try:', 'self', '.', '_handle_headers', '(', ')', '# handle input', 'input_data', '=', 'json_decode', '(', 'self', '.', 'request', '.', 'body', ')', 'if', 'self', '.', 'request', '.', 'body', 'else', '{', '}'...
login handler
['login', 'handler']
train
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/tornado_server/server.py#L110-L137
3,317
enkore/i3pystatus
i3pystatus/network.py
Network.cycle_interface
def cycle_interface(self, increment=1): """Cycle through available interfaces in `increment` steps. Sign indicates direction.""" interfaces = [i for i in netifaces.interfaces() if i not in self.ignore_interfaces] if self.interface in interfaces: next_index = (interfaces.index(self.in...
python
def cycle_interface(self, increment=1): """Cycle through available interfaces in `increment` steps. Sign indicates direction.""" interfaces = [i for i in netifaces.interfaces() if i not in self.ignore_interfaces] if self.interface in interfaces: next_index = (interfaces.index(self.in...
['def', 'cycle_interface', '(', 'self', ',', 'increment', '=', '1', ')', ':', 'interfaces', '=', '[', 'i', 'for', 'i', 'in', 'netifaces', '.', 'interfaces', '(', ')', 'if', 'i', 'not', 'in', 'self', '.', 'ignore_interfaces', ']', 'if', 'self', '.', 'interface', 'in', 'interfaces', ':', 'next_index', '=', '(', 'interfac...
Cycle through available interfaces in `increment` steps. Sign indicates direction.
['Cycle', 'through', 'available', 'interfaces', 'in', 'increment', 'steps', '.', 'Sign', 'indicates', 'direction', '.']
train
https://github.com/enkore/i3pystatus/blob/14cfde967cecf79b40e223e35a04600f4c875af7/i3pystatus/network.py#L394-L405
3,318
minio/minio-py
minio/compat.py
urlencode
def urlencode(resource): """ This implementation of urlencode supports all unicode characters :param: resource: Resource value to be url encoded. """ if isinstance(resource, str): return _urlencode(resource.encode('utf-8')) return _urlencode(resource)
python
def urlencode(resource): """ This implementation of urlencode supports all unicode characters :param: resource: Resource value to be url encoded. """ if isinstance(resource, str): return _urlencode(resource.encode('utf-8')) return _urlencode(resource)
['def', 'urlencode', '(', 'resource', ')', ':', 'if', 'isinstance', '(', 'resource', ',', 'str', ')', ':', 'return', '_urlencode', '(', 'resource', '.', 'encode', '(', "'utf-8'", ')', ')', 'return', '_urlencode', '(', 'resource', ')']
This implementation of urlencode supports all unicode characters :param: resource: Resource value to be url encoded.
['This', 'implementation', 'of', 'urlencode', 'supports', 'all', 'unicode', 'characters']
train
https://github.com/minio/minio-py/blob/7107c84183cf5fb4deff68c0a16ab9f1c0b4c37e/minio/compat.py#L96-L105
3,319
usc-isi-i2/etk
etk/knowledge_graph_schema.py
KGSchema.is_location
def is_location(v) -> (bool, str): """ Boolean function for checking if v is a location format Args: v: Returns: bool """ def convert2float(value): try: float_num = float(value) return float_num except...
python
def is_location(v) -> (bool, str): """ Boolean function for checking if v is a location format Args: v: Returns: bool """ def convert2float(value): try: float_num = float(value) return float_num except...
['def', 'is_location', '(', 'v', ')', '->', '(', 'bool', ',', 'str', ')', ':', 'def', 'convert2float', '(', 'value', ')', ':', 'try', ':', 'float_num', '=', 'float', '(', 'value', ')', 'return', 'float_num', 'except', 'ValueError', ':', 'return', 'False', 'if', 'not', 'isinstance', '(', 'v', ',', 'str', ')', ':', 'retu...
Boolean function for checking if v is a location format Args: v: Returns: bool
['Boolean', 'function', 'for', 'checking', 'if', 'v', 'is', 'a', 'location', 'format']
train
https://github.com/usc-isi-i2/etk/blob/aab077c984ea20f5e8ae33af622fe11d3c4df866/etk/knowledge_graph_schema.py#L197-L227
3,320
ska-sa/hypercube
hypercube/base_cube.py
HyperCube.bytes_required
def bytes_required(self): """ Returns ------- int Estimated number of bytes required by arrays registered on the cube, taking their extents into account. """ return np.sum([hcu.array_bytes(a) for a in self.arrays(reify=True).itervalues(...
python
def bytes_required(self): """ Returns ------- int Estimated number of bytes required by arrays registered on the cube, taking their extents into account. """ return np.sum([hcu.array_bytes(a) for a in self.arrays(reify=True).itervalues(...
['def', 'bytes_required', '(', 'self', ')', ':', 'return', 'np', '.', 'sum', '(', '[', 'hcu', '.', 'array_bytes', '(', 'a', ')', 'for', 'a', 'in', 'self', '.', 'arrays', '(', 'reify', '=', 'True', ')', '.', 'itervalues', '(', ')', ']', ')']
Returns ------- int Estimated number of bytes required by arrays registered on the cube, taking their extents into account.
['Returns', '-------', 'int', 'Estimated', 'number', 'of', 'bytes', 'required', 'by', 'arrays', 'registered', 'on', 'the', 'cube', 'taking', 'their', 'extents', 'into', 'account', '.']
train
https://github.com/ska-sa/hypercube/blob/6564a9e65ccd9ed7e7a71bd643f183e1ec645b29/hypercube/base_cube.py#L81-L90
3,321
hannorein/rebound
rebound/simulation.py
Simulation.add_particles_ascii
def add_particles_ascii(self, s): """ Adds particles from an ASCII string. Parameters ---------- s : string One particle per line. Each line should include particle's mass, radius, position and velocity. """ for l in s.split("\n"): r = l....
python
def add_particles_ascii(self, s): """ Adds particles from an ASCII string. Parameters ---------- s : string One particle per line. Each line should include particle's mass, radius, position and velocity. """ for l in s.split("\n"): r = l....
['def', 'add_particles_ascii', '(', 'self', ',', 's', ')', ':', 'for', 'l', 'in', 's', '.', 'split', '(', '"\\n"', ')', ':', 'r', '=', 'l', '.', 'split', '(', ')', 'if', 'len', '(', 'r', ')', ':', 'try', ':', 'r', '=', '[', 'float', '(', 'x', ')', 'for', 'x', 'in', 'r', ']', 'p', '=', 'Particle', '(', 'simulation', '='...
Adds particles from an ASCII string. Parameters ---------- s : string One particle per line. Each line should include particle's mass, radius, position and velocity.
['Adds', 'particles', 'from', 'an', 'ASCII', 'string', '.']
train
https://github.com/hannorein/rebound/blob/bb0f814c98e629401acaab657cae2304b0e003f7/rebound/simulation.py#L1206-L1223
3,322
rndusr/torf
torf/_torrent.py
Torrent.pieces
def pieces(self): """ Number of pieces the content is split into or ``None`` if :attr:`piece_size` returns ``None`` """ if self.piece_size is None: return None else: return math.ceil(self.size / self.piece_size)
python
def pieces(self): """ Number of pieces the content is split into or ``None`` if :attr:`piece_size` returns ``None`` """ if self.piece_size is None: return None else: return math.ceil(self.size / self.piece_size)
['def', 'pieces', '(', 'self', ')', ':', 'if', 'self', '.', 'piece_size', 'is', 'None', ':', 'return', 'None', 'else', ':', 'return', 'math', '.', 'ceil', '(', 'self', '.', 'size', '/', 'self', '.', 'piece_size', ')']
Number of pieces the content is split into or ``None`` if :attr:`piece_size` returns ``None``
['Number', 'of', 'pieces', 'the', 'content', 'is', 'split', 'into', 'or', 'None', 'if', ':', 'attr', ':', 'piece_size', 'returns', 'None']
train
https://github.com/rndusr/torf/blob/df0363232daacd3f8c91aafddaa0623b8c28cbd2/torf/_torrent.py#L312-L320
3,323
fermiPy/fermipy
fermipy/diffuse/diffuse_src_manager.py
DiffuseModelManager.make_diffuse_comp_info
def make_diffuse_comp_info(self, source_name, source_ver, diffuse_dict, components=None, comp_key=None): """ Make a dictionary mapping the merged component names to list of template files Parameters ---------- source_name : str Name of the sour...
python
def make_diffuse_comp_info(self, source_name, source_ver, diffuse_dict, components=None, comp_key=None): """ Make a dictionary mapping the merged component names to list of template files Parameters ---------- source_name : str Name of the sour...
['def', 'make_diffuse_comp_info', '(', 'self', ',', 'source_name', ',', 'source_ver', ',', 'diffuse_dict', ',', 'components', '=', 'None', ',', 'comp_key', '=', 'None', ')', ':', 'model_type', '=', 'diffuse_dict', '[', "'model_type'", ']', 'sourcekey', '=', "'%s_%s'", '%', '(', 'source_name', ',', 'source_ver', ')', 'i...
Make a dictionary mapping the merged component names to list of template files Parameters ---------- source_name : str Name of the source source_ver : str Key identifying the version of the source diffuse_dict : dict Information about this compo...
['Make', 'a', 'dictionary', 'mapping', 'the', 'merged', 'component', 'names', 'to', 'list', 'of', 'template', 'files']
train
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/diffuse_src_manager.py#L325-L375
3,324
pennlabs/penn-sdk-python
penn/dining.py
Dining.venues
def venues(self): """Get a list of all venue objects. >>> venues = din.venues() """ response = self._request(V2_ENDPOINTS['VENUES']) # Normalize `dateHours` to array for venue in response["result_data"]["document"]["venue"]: if venue.get("id") in VENUE_NAME...
python
def venues(self): """Get a list of all venue objects. >>> venues = din.venues() """ response = self._request(V2_ENDPOINTS['VENUES']) # Normalize `dateHours` to array for venue in response["result_data"]["document"]["venue"]: if venue.get("id") in VENUE_NAME...
['def', 'venues', '(', 'self', ')', ':', 'response', '=', 'self', '.', '_request', '(', 'V2_ENDPOINTS', '[', "'VENUES'", ']', ')', '# Normalize `dateHours` to array', 'for', 'venue', 'in', 'response', '[', '"result_data"', ']', '[', '"document"', ']', '[', '"venue"', ']', ':', 'if', 'venue', '.', 'get', '(', '"id"', ')...
Get a list of all venue objects. >>> venues = din.venues()
['Get', 'a', 'list', 'of', 'all', 'venue', 'objects', '.']
train
https://github.com/pennlabs/penn-sdk-python/blob/31ff12c20d69438d63bc7a796f83ce4f4c828396/penn/dining.py#L157-L173
3,325
paramiko/paramiko
paramiko/sftp_file.py
SFTPFile.prefetch
def prefetch(self, file_size=None): """ Pre-fetch the remaining contents of this file in anticipation of future `.read` calls. If reading the entire file, pre-fetching can dramatically improve the download speed by avoiding roundtrip latency. The file's contents are incrementall...
python
def prefetch(self, file_size=None): """ Pre-fetch the remaining contents of this file in anticipation of future `.read` calls. If reading the entire file, pre-fetching can dramatically improve the download speed by avoiding roundtrip latency. The file's contents are incrementall...
['def', 'prefetch', '(', 'self', ',', 'file_size', '=', 'None', ')', ':', 'if', 'file_size', 'is', 'None', ':', 'file_size', '=', 'self', '.', 'stat', '(', ')', '.', 'st_size', '# queue up async reads for the rest of the file', 'chunks', '=', '[', ']', 'n', '=', 'self', '.', '_realpos', 'while', 'n', '<', 'file_size', ...
Pre-fetch the remaining contents of this file in anticipation of future `.read` calls. If reading the entire file, pre-fetching can dramatically improve the download speed by avoiding roundtrip latency. The file's contents are incrementally buffered in a background thread. The prefetch...
['Pre', '-', 'fetch', 'the', 'remaining', 'contents', 'of', 'this', 'file', 'in', 'anticipation', 'of', 'future', '.', 'read', 'calls', '.', 'If', 'reading', 'the', 'entire', 'file', 'pre', '-', 'fetching', 'can', 'dramatically', 'improve', 'the', 'download', 'speed', 'by', 'avoiding', 'roundtrip', 'latency', '.', 'The...
train
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_file.py#L438-L476
3,326
WebarchivCZ/WA-KAT
src/wa_kat/templates/static/js/Lib/site-packages/wa_kat_main.py
MARCGeneratorAdapter.on_complete
def on_complete(cls, req): """ Callback called when the request to REST is done. Handles the errors and if there is none, :class:`.OutputPicker` is shown. """ # handle http errors if not (req.status == 200 or req.status == 0): ViewController.log_view.add(req.t...
python
def on_complete(cls, req): """ Callback called when the request to REST is done. Handles the errors and if there is none, :class:`.OutputPicker` is shown. """ # handle http errors if not (req.status == 200 or req.status == 0): ViewController.log_view.add(req.t...
['def', 'on_complete', '(', 'cls', ',', 'req', ')', ':', '# handle http errors', 'if', 'not', '(', 'req', '.', 'status', '==', '200', 'or', 'req', '.', 'status', '==', '0', ')', ':', 'ViewController', '.', 'log_view', '.', 'add', '(', 'req', '.', 'text', ')', 'alert', '(', 'req', '.', 'text', ')', '# TODO: better handl...
Callback called when the request to REST is done. Handles the errors and if there is none, :class:`.OutputPicker` is shown.
['Callback', 'called', 'when', 'the', 'request', 'to', 'REST', 'is', 'done', '.', 'Handles', 'the', 'errors', 'and', 'if', 'there', 'is', 'none', ':', 'class', ':', '.', 'OutputPicker', 'is', 'shown', '.']
train
https://github.com/WebarchivCZ/WA-KAT/blob/16d064a3a775dc1d2713debda7847ded52dd2a06/src/wa_kat/templates/static/js/Lib/site-packages/wa_kat_main.py#L248-L271
3,327
mkouhei/bootstrap-py
bootstrap_py/classifiers.py
Classifiers._acronym_lic
def _acronym_lic(self, license_statement): """Convert license acronym.""" pat = re.compile(r'\(([\w+\W?\s?]+)\)') if pat.search(license_statement): lic = pat.search(license_statement).group(1) if lic.startswith('CNRI'): acronym_licence = lic[:4] ...
python
def _acronym_lic(self, license_statement): """Convert license acronym.""" pat = re.compile(r'\(([\w+\W?\s?]+)\)') if pat.search(license_statement): lic = pat.search(license_statement).group(1) if lic.startswith('CNRI'): acronym_licence = lic[:4] ...
['def', '_acronym_lic', '(', 'self', ',', 'license_statement', ')', ':', 'pat', '=', 're', '.', 'compile', '(', "r'\\(([\\w+\\W?\\s?]+)\\)'", ')', 'if', 'pat', '.', 'search', '(', 'license_statement', ')', ':', 'lic', '=', 'pat', '.', 'search', '(', 'license_statement', ')', '.', 'group', '(', '1', ')', 'if', 'lic', '....
Convert license acronym.
['Convert', 'license', 'acronym', '.']
train
https://github.com/mkouhei/bootstrap-py/blob/95d56ed98ef409fd9f019dc352fd1c3711533275/bootstrap_py/classifiers.py#L54-L67
3,328
pytroll/satpy
satpy/readers/viirs_sdr.py
VIIRSSDRReader.get_right_geo_fhs
def get_right_geo_fhs(self, dsid, fhs): """Find the right geographical file handlers for given dataset ID *dsid*.""" ds_info = self.ids[dsid] req_geo, rem_geo = self._get_req_rem_geo(ds_info) desired, other = split_desired_other(fhs, req_geo, rem_geo) if desired: try:...
python
def get_right_geo_fhs(self, dsid, fhs): """Find the right geographical file handlers for given dataset ID *dsid*.""" ds_info = self.ids[dsid] req_geo, rem_geo = self._get_req_rem_geo(ds_info) desired, other = split_desired_other(fhs, req_geo, rem_geo) if desired: try:...
['def', 'get_right_geo_fhs', '(', 'self', ',', 'dsid', ',', 'fhs', ')', ':', 'ds_info', '=', 'self', '.', 'ids', '[', 'dsid', ']', 'req_geo', ',', 'rem_geo', '=', 'self', '.', '_get_req_rem_geo', '(', 'ds_info', ')', 'desired', ',', 'other', '=', 'split_desired_other', '(', 'fhs', ',', 'req_geo', ',', 'rem_geo', ')', '...
Find the right geographical file handlers for given dataset ID *dsid*.
['Find', 'the', 'right', 'geographical', 'file', 'handlers', 'for', 'given', 'dataset', 'ID', '*', 'dsid', '*', '.']
train
https://github.com/pytroll/satpy/blob/1f21d20ac686b745fb0da9b4030d139893e066dd/satpy/readers/viirs_sdr.py#L532-L544
3,329
jsfenfen/990-xml-reader
irs_reader/text_format_utils.py
debracket
def debracket(string): """ Eliminate the bracketed var names in doc, line strings """ result = re.sub(BRACKET_RE, ';', str(string)) result = result.lstrip(';') result = result.lstrip(' ') result = result.replace('; ;',';') return result
python
def debracket(string): """ Eliminate the bracketed var names in doc, line strings """ result = re.sub(BRACKET_RE, ';', str(string)) result = result.lstrip(';') result = result.lstrip(' ') result = result.replace('; ;',';') return result
['def', 'debracket', '(', 'string', ')', ':', 'result', '=', 're', '.', 'sub', '(', 'BRACKET_RE', ',', "';'", ',', 'str', '(', 'string', ')', ')', 'result', '=', 'result', '.', 'lstrip', '(', "';'", ')', 'result', '=', 'result', '.', 'lstrip', '(', "' '", ')', 'result', '=', 'result', '.', 'replace', '(', "'; ;'", ',',...
Eliminate the bracketed var names in doc, line strings
['Eliminate', 'the', 'bracketed', 'var', 'names', 'in', 'doc', 'line', 'strings']
train
https://github.com/jsfenfen/990-xml-reader/blob/00020529b789081329a31a2e30b5ee729ce7596a/irs_reader/text_format_utils.py#L15-L21
3,330
ucbvislab/radiotool
radiotool/utils.py
linear
def linear(arr1, arr2): """ Create a linear blend of arr1 (fading out) and arr2 (fading in) """ n = N.shape(arr1)[0] try: channels = N.shape(arr1)[1] except: channels = 1 f_in = N.linspace(0, 1, num=n) f_out = N.linspace(1, 0, num=n) # f_in = N.arange(n) / float(n -...
python
def linear(arr1, arr2): """ Create a linear blend of arr1 (fading out) and arr2 (fading in) """ n = N.shape(arr1)[0] try: channels = N.shape(arr1)[1] except: channels = 1 f_in = N.linspace(0, 1, num=n) f_out = N.linspace(1, 0, num=n) # f_in = N.arange(n) / float(n -...
['def', 'linear', '(', 'arr1', ',', 'arr2', ')', ':', 'n', '=', 'N', '.', 'shape', '(', 'arr1', ')', '[', '0', ']', 'try', ':', 'channels', '=', 'N', '.', 'shape', '(', 'arr1', ')', '[', '1', ']', 'except', ':', 'channels', '=', '1', 'f_in', '=', 'N', '.', 'linspace', '(', '0', ',', '1', ',', 'num', '=', 'n', ')', 'f_o...
Create a linear blend of arr1 (fading out) and arr2 (fading in)
['Create', 'a', 'linear', 'blend', 'of', 'arr1', '(', 'fading', 'out', ')', 'and', 'arr2', '(', 'fading', 'in', ')']
train
https://github.com/ucbvislab/radiotool/blob/01c9d878a811cf400b1482896d641d9c95e83ded/radiotool/utils.py#L91-L112
3,331
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
pltar
def pltar(vrtces, plates): """ Compute the total area of a collection of triangular plates. https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pltar_c.html :param vrtces: Array of vertices. :type vrtces: Nx3-Element Array of floats :param plates: Array of plates. :type plate...
python
def pltar(vrtces, plates): """ Compute the total area of a collection of triangular plates. https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pltar_c.html :param vrtces: Array of vertices. :type vrtces: Nx3-Element Array of floats :param plates: Array of plates. :type plate...
['def', 'pltar', '(', 'vrtces', ',', 'plates', ')', ':', 'nv', '=', 'ctypes', '.', 'c_int', '(', 'len', '(', 'vrtces', ')', ')', 'vrtces', '=', 'stypes', '.', 'toDoubleMatrix', '(', 'vrtces', ')', 'np', '=', 'ctypes', '.', 'c_int', '(', 'len', '(', 'plates', ')', ')', 'plates', '=', 'stypes', '.', 'toIntMatrix', '(', '...
Compute the total area of a collection of triangular plates. https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pltar_c.html :param vrtces: Array of vertices. :type vrtces: Nx3-Element Array of floats :param plates: Array of plates. :type plates: Nx3-Element Array of ints :retur...
['Compute', 'the', 'total', 'area', 'of', 'a', 'collection', 'of', 'triangular', 'plates', '.', 'https', ':', '//', 'naif', '.', 'jpl', '.', 'nasa', '.', 'gov', '/', 'pub', '/', 'naif', '/', 'toolkit_docs', '/', 'C', '/', 'cspice', '/', 'pltar_c', '.', 'html', ':', 'param', 'vrtces', ':', 'Array', 'of', 'vertices', '.'...
train
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L9646-L9663
3,332
jaraco/keyrings.alt
keyrings/alt/Google.py
DocsKeyring.get_password
def get_password(self, service, username): """Get password of the username for the service """ result = self._get_entry(self._keyring, service, username) if result: result = self._decrypt(result) return result
python
def get_password(self, service, username): """Get password of the username for the service """ result = self._get_entry(self._keyring, service, username) if result: result = self._decrypt(result) return result
['def', 'get_password', '(', 'self', ',', 'service', ',', 'username', ')', ':', 'result', '=', 'self', '.', '_get_entry', '(', 'self', '.', '_keyring', ',', 'service', ',', 'username', ')', 'if', 'result', ':', 'result', '=', 'self', '.', '_decrypt', '(', 'result', ')', 'return', 'result']
Get password of the username for the service
['Get', 'password', 'of', 'the', 'username', 'for', 'the', 'service']
train
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/Google.py#L85-L91
3,333
weld-project/weld
python/numpy/weldnumpy/__init__.py
array
def array(arr, *args, **kwargs): ''' Wrapper around weldarray - first create np.array and then convert to weldarray. ''' return weldarray(np.array(arr, *args, **kwargs))
python
def array(arr, *args, **kwargs): ''' Wrapper around weldarray - first create np.array and then convert to weldarray. ''' return weldarray(np.array(arr, *args, **kwargs))
['def', 'array', '(', 'arr', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'return', 'weldarray', '(', 'np', '.', 'array', '(', 'arr', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ')']
Wrapper around weldarray - first create np.array and then convert to weldarray.
['Wrapper', 'around', 'weldarray', '-', 'first', 'create', 'np', '.', 'array', 'and', 'then', 'convert', 'to', 'weldarray', '.']
train
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/numpy/weldnumpy/__init__.py#L13-L18
3,334
google/prettytensor
prettytensor/pretty_tensor_class.py
_DeferredLayer.attach_template
def attach_template(self, _template, _key, **unbound_var_values): """Attaches the template to this with the _key is supplied with this layer. Note: names were chosen to avoid conflicts. Args: _template: The template to construct. _key: The key that this layer should replace. **unbound_va...
python
def attach_template(self, _template, _key, **unbound_var_values): """Attaches the template to this with the _key is supplied with this layer. Note: names were chosen to avoid conflicts. Args: _template: The template to construct. _key: The key that this layer should replace. **unbound_va...
['def', 'attach_template', '(', 'self', ',', '_template', ',', '_key', ',', '*', '*', 'unbound_var_values', ')', ':', 'if', '_key', 'in', 'unbound_var_values', ':', 'raise', 'ValueError', '(', "'%s specified twice.'", '%', '_key', ')', 'unbound_var_values', '[', '_key', ']', '=', 'self', 'return', '_DeferredLayer', '('...
Attaches the template to this with the _key is supplied with this layer. Note: names were chosen to avoid conflicts. Args: _template: The template to construct. _key: The key that this layer should replace. **unbound_var_values: The values for the unbound_vars. Returns: A new layer...
['Attaches', 'the', 'template', 'to', 'this', 'with', 'the', '_key', 'is', 'supplied', 'with', 'this', 'layer', '.']
train
https://github.com/google/prettytensor/blob/75daa0b11252590f548da5647addc0ea610c4c45/prettytensor/pretty_tensor_class.py#L1282-L1306
3,335
seperman/deepdiff
deepdiff/diff.py
DeepDiff.__skip_this
def __skip_this(self, level): """ Check whether this comparison should be skipped because one of the objects to compare meets exclusion criteria. :rtype: bool """ skip = False if self.exclude_paths and level.path() in self.exclude_paths: skip = True el...
python
def __skip_this(self, level): """ Check whether this comparison should be skipped because one of the objects to compare meets exclusion criteria. :rtype: bool """ skip = False if self.exclude_paths and level.path() in self.exclude_paths: skip = True el...
['def', '__skip_this', '(', 'self', ',', 'level', ')', ':', 'skip', '=', 'False', 'if', 'self', '.', 'exclude_paths', 'and', 'level', '.', 'path', '(', ')', 'in', 'self', '.', 'exclude_paths', ':', 'skip', '=', 'True', 'elif', 'self', '.', 'exclude_regex_paths', 'and', 'any', '(', '[', 'exclude_regex_path', '.', 'searc...
Check whether this comparison should be skipped because one of the objects to compare meets exclusion criteria. :rtype: bool
['Check', 'whether', 'this', 'comparison', 'should', 'be', 'skipped', 'because', 'one', 'of', 'the', 'objects', 'to', 'compare', 'meets', 'exclusion', 'criteria', '.', ':', 'rtype', ':', 'bool']
train
https://github.com/seperman/deepdiff/blob/a66879190fadc671632f154c1fcb82f5c3cef800/deepdiff/diff.py#L209-L225
3,336
python-escpos/python-escpos
src/escpos/capabilities.py
BaseProfile.get_font
def get_font(self, font): """Return the escpos index for `font`. Makes sure that the requested `font` is valid. """ font = {'a': 0, 'b': 1}.get(font, font) if not six.text_type(font) in self.fonts: raise NotSupported( '"{}" is not a valid font in the c...
python
def get_font(self, font): """Return the escpos index for `font`. Makes sure that the requested `font` is valid. """ font = {'a': 0, 'b': 1}.get(font, font) if not six.text_type(font) in self.fonts: raise NotSupported( '"{}" is not a valid font in the c...
['def', 'get_font', '(', 'self', ',', 'font', ')', ':', 'font', '=', '{', "'a'", ':', '0', ',', "'b'", ':', '1', '}', '.', 'get', '(', 'font', ',', 'font', ')', 'if', 'not', 'six', '.', 'text_type', '(', 'font', ')', 'in', 'self', '.', 'fonts', ':', 'raise', 'NotSupported', '(', '\'"{}" is not a valid font in the curre...
Return the escpos index for `font`. Makes sure that the requested `font` is valid.
['Return', 'the', 'escpos', 'index', 'for', 'font', '.', 'Makes', 'sure', 'that', 'the', 'requested', 'font', 'is', 'valid', '.']
train
https://github.com/python-escpos/python-escpos/blob/52719c0b7de8948fabdffd180a2d71c22cf4c02b/src/escpos/capabilities.py#L72-L80
3,337
SeabornGames/RequestClient
seaborn/request_client/api_call.py
ApiCall.save_formatted_data
def save_formatted_data(self, data): """ This will save the formatted data as a repr object (see returns.py) :param data: dict of the return data :return: None """ self.data = data self._timestamps['process'] = time.time() self._stage = STAGE_DONE_DATA_FOR...
python
def save_formatted_data(self, data): """ This will save the formatted data as a repr object (see returns.py) :param data: dict of the return data :return: None """ self.data = data self._timestamps['process'] = time.time() self._stage = STAGE_DONE_DATA_FOR...
['def', 'save_formatted_data', '(', 'self', ',', 'data', ')', ':', 'self', '.', 'data', '=', 'data', 'self', '.', '_timestamps', '[', "'process'", ']', '=', 'time', '.', 'time', '(', ')', 'self', '.', '_stage', '=', 'STAGE_DONE_DATA_FORMATTED']
This will save the formatted data as a repr object (see returns.py) :param data: dict of the return data :return: None
['This', 'will', 'save', 'the', 'formatted', 'data', 'as', 'a', 'repr', 'object', '(', 'see', 'returns', '.', 'py', ')', ':', 'param', 'data', ':', 'dict', 'of', 'the', 'return', 'data', ':', 'return', ':', 'None']
train
https://github.com/SeabornGames/RequestClient/blob/21aeb951ddfdb6ee453ad0edc896ff224e06425d/seaborn/request_client/api_call.py#L558-L566
3,338
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Taskmaster.py
Taskmaster.next_task
def next_task(self): """ Returns the next task to be executed. This simply asks for the next Node to be evaluated, and then wraps it in the specific Task subclass with which we were initialized. """ node = self._find_next_ready_node() if node is None: ...
python
def next_task(self): """ Returns the next task to be executed. This simply asks for the next Node to be evaluated, and then wraps it in the specific Task subclass with which we were initialized. """ node = self._find_next_ready_node() if node is None: ...
['def', 'next_task', '(', 'self', ')', ':', 'node', '=', 'self', '.', '_find_next_ready_node', '(', ')', 'if', 'node', 'is', 'None', ':', 'return', 'None', 'executor', '=', 'node', '.', 'get_executor', '(', ')', 'if', 'executor', 'is', 'None', ':', 'return', 'None', 'tlist', '=', 'executor', '.', 'get_all_targets', '('...
Returns the next task to be executed. This simply asks for the next Node to be evaluated, and then wraps it in the specific Task subclass with which we were initialized.
['Returns', 'the', 'next', 'task', 'to', 'be', 'executed', '.']
train
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Taskmaster.py#L952-L985
3,339
jssimporter/python-jss
jss/jssobject.py
JSSObject.get_url
def get_url(cls, data): """Return the URL for a get request based on data type. Args: data: Accepts multiple types. Int: Generate URL to object with data ID. None: Get basic object GET URL (list). String/Unicode: Search for <data> with default...
python
def get_url(cls, data): """Return the URL for a get request based on data type. Args: data: Accepts multiple types. Int: Generate URL to object with data ID. None: Get basic object GET URL (list). String/Unicode: Search for <data> with default...
['def', 'get_url', '(', 'cls', ',', 'data', ')', ':', 'try', ':', 'data', '=', 'int', '(', 'data', ')', 'except', '(', 'ValueError', ',', 'TypeError', ')', ':', 'pass', 'if', 'isinstance', '(', 'data', ',', 'int', ')', ':', 'return', '"%s%s%s"', '%', '(', 'cls', '.', '_url', ',', 'cls', '.', 'id_url', ',', 'data', ')',...
Return the URL for a get request based on data type. Args: data: Accepts multiple types. Int: Generate URL to object with data ID. None: Get basic object GET URL (list). String/Unicode: Search for <data> with default_search, usuall...
['Return', 'the', 'URL', 'for', 'a', 'get', 'request', 'based', 'on', 'data', 'type', '.']
train
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobject.py#L239-L273
3,340
tensorflow/cleverhans
examples/nips17_adversarial_competition/eval_infra/code/eval_lib/work_data.py
AttackWorkPieces.init_from_adversarial_batches
def init_from_adversarial_batches(self, adv_batches): """Initializes work pieces from adversarial batches. Args: adv_batches: dict with adversarial batches, could be obtained as AversarialBatches.data """ for idx, (adv_batch_id, adv_batch_val) in enumerate(iteritems(adv_batches)): w...
python
def init_from_adversarial_batches(self, adv_batches): """Initializes work pieces from adversarial batches. Args: adv_batches: dict with adversarial batches, could be obtained as AversarialBatches.data """ for idx, (adv_batch_id, adv_batch_val) in enumerate(iteritems(adv_batches)): w...
['def', 'init_from_adversarial_batches', '(', 'self', ',', 'adv_batches', ')', ':', 'for', 'idx', ',', '(', 'adv_batch_id', ',', 'adv_batch_val', ')', 'in', 'enumerate', '(', 'iteritems', '(', 'adv_batches', ')', ')', ':', 'work_id', '=', 'ATTACK_WORK_ID_PATTERN', '.', 'format', '(', 'idx', ')', 'self', '.', 'work', '[...
Initializes work pieces from adversarial batches. Args: adv_batches: dict with adversarial batches, could be obtained as AversarialBatches.data
['Initializes', 'work', 'pieces', 'from', 'adversarial', 'batches', '.']
train
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/examples/nips17_adversarial_competition/eval_infra/code/eval_lib/work_data.py#L349-L367
3,341
RI-imaging/ODTbrain
odtbrain/_alg2d_int.py
integrate_2d
def integrate_2d(uSin, angles, res, nm, lD=0, coords=None, count=None, max_count=None, verbose=0): r"""(slow) 2D reconstruction with the Fourier diffraction theorem Two-dimensional diffraction tomography reconstruction algorithm for scattering of a plane wave :math:`u_0(\mathbf{r}) = u...
python
def integrate_2d(uSin, angles, res, nm, lD=0, coords=None, count=None, max_count=None, verbose=0): r"""(slow) 2D reconstruction with the Fourier diffraction theorem Two-dimensional diffraction tomography reconstruction algorithm for scattering of a plane wave :math:`u_0(\mathbf{r}) = u...
['def', 'integrate_2d', '(', 'uSin', ',', 'angles', ',', 'res', ',', 'nm', ',', 'lD', '=', '0', ',', 'coords', '=', 'None', ',', 'count', '=', 'None', ',', 'max_count', '=', 'None', ',', 'verbose', '=', '0', ')', ':', 'if', 'coords', 'is', 'None', ':', 'lx', '=', 'uSin', '.', 'shape', '[', '1', ']', 'x', '=', 'np', '.'...
r"""(slow) 2D reconstruction with the Fourier diffraction theorem Two-dimensional diffraction tomography reconstruction algorithm for scattering of a plane wave :math:`u_0(\mathbf{r}) = u_0(x,z)` by a dielectric object with refractive index :math:`n(x,z)`. This function implements the solution...
['r', '(', 'slow', ')', '2D', 'reconstruction', 'with', 'the', 'Fourier', 'diffraction', 'theorem']
train
https://github.com/RI-imaging/ODTbrain/blob/abbab8b790f10c0c7aea8d858d7d60f2fdd7161e/odtbrain/_alg2d_int.py#L5-L271
3,342
davenquinn/Attitude
attitude/stereonet.py
iterative_plane_errors
def iterative_plane_errors(axes,covariance_matrix, **kwargs): """ An iterative version of `pca.plane_errors`, which computes an error surface for a plane. """ sheet = kwargs.pop('sheet','upper') level = kwargs.pop('level',1) n = kwargs.pop('n',100) cov = N.sqrt(N.diagonal(covariance_mat...
python
def iterative_plane_errors(axes,covariance_matrix, **kwargs): """ An iterative version of `pca.plane_errors`, which computes an error surface for a plane. """ sheet = kwargs.pop('sheet','upper') level = kwargs.pop('level',1) n = kwargs.pop('n',100) cov = N.sqrt(N.diagonal(covariance_mat...
['def', 'iterative_plane_errors', '(', 'axes', ',', 'covariance_matrix', ',', '*', '*', 'kwargs', ')', ':', 'sheet', '=', 'kwargs', '.', 'pop', '(', "'sheet'", ',', "'upper'", ')', 'level', '=', 'kwargs', '.', 'pop', '(', "'level'", ',', '1', ')', 'n', '=', 'kwargs', '.', 'pop', '(', "'n'", ',', '100', ')', 'cov', '=',...
An iterative version of `pca.plane_errors`, which computes an error surface for a plane.
['An', 'iterative', 'version', 'of', 'pca', '.', 'plane_errors', 'which', 'computes', 'an', 'error', 'surface', 'for', 'a', 'plane', '.']
train
https://github.com/davenquinn/Attitude/blob/2ce97b9aba0aa5deedc6617c2315e07e6396d240/attitude/stereonet.py#L156-L193
3,343
SylvanasSun/FishFishJump
fish_core/utils/common_utils.py
check_validity_for_dict
def check_validity_for_dict(keys, dict): """ >>> dict = {'a': 0, 'b': 1, 'c': 2} >>> keys = ['a', 'd', 'e'] >>> check_validity_for_dict(keys, dict) == False True >>> keys = ['a', 'b', 'c'] >>> check_validity_for_dict(keys, dict) == False False """ for key in keys: if key ...
python
def check_validity_for_dict(keys, dict): """ >>> dict = {'a': 0, 'b': 1, 'c': 2} >>> keys = ['a', 'd', 'e'] >>> check_validity_for_dict(keys, dict) == False True >>> keys = ['a', 'b', 'c'] >>> check_validity_for_dict(keys, dict) == False False """ for key in keys: if key ...
['def', 'check_validity_for_dict', '(', 'keys', ',', 'dict', ')', ':', 'for', 'key', 'in', 'keys', ':', 'if', 'key', 'not', 'in', 'dict', 'or', 'dict', '[', 'key', ']', 'is', "''", 'or', 'dict', '[', 'key', ']', 'is', 'None', ':', 'return', 'False', 'return', 'True']
>>> dict = {'a': 0, 'b': 1, 'c': 2} >>> keys = ['a', 'd', 'e'] >>> check_validity_for_dict(keys, dict) == False True >>> keys = ['a', 'b', 'c'] >>> check_validity_for_dict(keys, dict) == False False
['>>>', 'dict', '=', '{', 'a', ':', '0', 'b', ':', '1', 'c', ':', '2', '}', '>>>', 'keys', '=', '[', 'a', 'd', 'e', ']', '>>>', 'check_validity_for_dict', '(', 'keys', 'dict', ')', '==', 'False', 'True', '>>>', 'keys', '=', '[', 'a', 'b', 'c', ']', '>>>', 'check_validity_for_dict', '(', 'keys', 'dict', ')', '==', 'Fals...
train
https://github.com/SylvanasSun/FishFishJump/blob/696212d242d8d572f3f1b43925f3d8ab8acc6a2d/fish_core/utils/common_utils.py#L58-L71
3,344
tjcsl/cslbot
cslbot/commands/distro.py
cmd
def cmd(send, *_): """Gets a random distro. Syntax: {command} """ url = get('http://distrowatch.com/random.php').url match = re.search('=(.*)', url) if match: send(match.group(1)) else: send("no distro found")
python
def cmd(send, *_): """Gets a random distro. Syntax: {command} """ url = get('http://distrowatch.com/random.php').url match = re.search('=(.*)', url) if match: send(match.group(1)) else: send("no distro found")
['def', 'cmd', '(', 'send', ',', '*', '_', ')', ':', 'url', '=', 'get', '(', "'http://distrowatch.com/random.php'", ')', '.', 'url', 'match', '=', 're', '.', 'search', '(', "'=(.*)'", ',', 'url', ')', 'if', 'match', ':', 'send', '(', 'match', '.', 'group', '(', '1', ')', ')', 'else', ':', 'send', '(', '"no distro found...
Gets a random distro. Syntax: {command}
['Gets', 'a', 'random', 'distro', '.']
train
https://github.com/tjcsl/cslbot/blob/aebe07be47141f61d7c180706bddfb707f19b2b5/cslbot/commands/distro.py#L26-L37
3,345
andreikop/qutepart
qutepart/syntax/__init__.py
SyntaxManager.getSyntax
def getSyntax(self, xmlFileName=None, mimeType=None, languageName=None, sourceFilePath=None, firstLine=None): """Get syntax by one of parameters: * xmlFileName * mimeType * languageName ...
python
def getSyntax(self, xmlFileName=None, mimeType=None, languageName=None, sourceFilePath=None, firstLine=None): """Get syntax by one of parameters: * xmlFileName * mimeType * languageName ...
['def', 'getSyntax', '(', 'self', ',', 'xmlFileName', '=', 'None', ',', 'mimeType', '=', 'None', ',', 'languageName', '=', 'None', ',', 'sourceFilePath', '=', 'None', ',', 'firstLine', '=', 'None', ')', ':', 'syntax', '=', 'None', 'if', 'syntax', 'is', 'None', 'and', 'xmlFileName', 'is', 'not', 'None', ':', 'try', ':',...
Get syntax by one of parameters: * xmlFileName * mimeType * languageName * sourceFilePath First parameter in the list has biggest priority
['Get', 'syntax', 'by', 'one', 'of', 'parameters', ':', '*', 'xmlFileName', '*', 'mimeType', '*', 'languageName', '*', 'sourceFilePath', 'First', 'parameter', 'in', 'the', 'list', 'has', 'biggest', 'priority']
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/__init__.py#L214-L260
3,346
atlassian-api/atlassian-python-api
atlassian/bitbucket.py
Bitbucket.delete_branch
def delete_branch(self, project, repository, name, end_point): """ Delete branch from related repo :param self: :param project: :param repository: :param name: :param end_point: :return: """ url = 'rest/branch-utils/1.0/projects/{project}/...
python
def delete_branch(self, project, repository, name, end_point): """ Delete branch from related repo :param self: :param project: :param repository: :param name: :param end_point: :return: """ url = 'rest/branch-utils/1.0/projects/{project}/...
['def', 'delete_branch', '(', 'self', ',', 'project', ',', 'repository', ',', 'name', ',', 'end_point', ')', ':', 'url', '=', "'rest/branch-utils/1.0/projects/{project}/repos/{repository}/branches'", '.', 'format', '(', 'project', '=', 'project', ',', 'repository', '=', 'repository', ')', 'data', '=', '{', '"name"', ':...
Delete branch from related repo :param self: :param project: :param repository: :param name: :param end_point: :return:
['Delete', 'branch', 'from', 'related', 'repo', ':', 'param', 'self', ':', ':', 'param', 'project', ':', ':', 'param', 'repository', ':', ':', 'param', 'name', ':', ':', 'param', 'end_point', ':', ':', 'return', ':']
train
https://github.com/atlassian-api/atlassian-python-api/blob/540d269905c3e7547b666fe30c647b2d512cf358/atlassian/bitbucket.py#L315-L330
3,347
Opentrons/opentrons
api/src/opentrons/legacy_api/instruments/pipette.py
Pipette._aspirate_plunger_position
def _aspirate_plunger_position(self, ul): """Calculate axis position for a given liquid volume. Translates the passed liquid volume to absolute coordinates on the axis associated with this pipette. Calibration of the pipette motor's ul-to-mm conversion is required """ m...
python
def _aspirate_plunger_position(self, ul): """Calculate axis position for a given liquid volume. Translates the passed liquid volume to absolute coordinates on the axis associated with this pipette. Calibration of the pipette motor's ul-to-mm conversion is required """ m...
['def', '_aspirate_plunger_position', '(', 'self', ',', 'ul', ')', ':', 'millimeters', '=', 'ul', '/', 'self', '.', '_ul_per_mm', '(', 'ul', ',', "'aspirate'", ')', 'destination_mm', '=', 'self', '.', '_get_plunger_position', '(', "'bottom'", ')', '+', 'millimeters', 'return', 'round', '(', 'destination_mm', ',', '6', ...
Calculate axis position for a given liquid volume. Translates the passed liquid volume to absolute coordinates on the axis associated with this pipette. Calibration of the pipette motor's ul-to-mm conversion is required
['Calculate', 'axis', 'position', 'for', 'a', 'given', 'liquid', 'volume', '.']
train
https://github.com/Opentrons/opentrons/blob/a7c15cc2636ecb64ab56c7edc1d8a57163aaeadf/api/src/opentrons/legacy_api/instruments/pipette.py#L1453-L1463
3,348
Kunstmord/datalib
src/dataset.py
DataSetBase.return_multiple_convert_numpy
def return_multiple_convert_numpy(self, start_id, end_id, converter, add_args=None): """ Converts several objects, with ids in the range (start_id, end_id) into a 2d numpy array and returns the array, the conversion is done by the 'converter' function Parameters ---------- ...
python
def return_multiple_convert_numpy(self, start_id, end_id, converter, add_args=None): """ Converts several objects, with ids in the range (start_id, end_id) into a 2d numpy array and returns the array, the conversion is done by the 'converter' function Parameters ---------- ...
['def', 'return_multiple_convert_numpy', '(', 'self', ',', 'start_id', ',', 'end_id', ',', 'converter', ',', 'add_args', '=', 'None', ')', ':', 'if', 'end_id', '==', '-', '1', ':', 'end_id', '=', 'self', '.', 'points_amt', 'return', 'return_multiple_convert_numpy_base', '(', 'self', '.', 'dbpath', ',', 'self', '.', 'pa...
Converts several objects, with ids in the range (start_id, end_id) into a 2d numpy array and returns the array, the conversion is done by the 'converter' function Parameters ---------- start_id : the id of the first object to be converted end_id : the id of the last object to be...
['Converts', 'several', 'objects', 'with', 'ids', 'in', 'the', 'range', '(', 'start_id', 'end_id', ')', 'into', 'a', '2d', 'numpy', 'array', 'and', 'returns', 'the', 'array', 'the', 'conversion', 'is', 'done', 'by', 'the', 'converter', 'function']
train
https://github.com/Kunstmord/datalib/blob/9d7db3e7c3a5feeeb5d19eb0dbee858bd2b50886/src/dataset.py#L864-L885
3,349
pypa/pipenv
pipenv/patched/notpip/_vendor/ipaddress.py
IPv6Address.teredo
def teredo(self): """Tuple of embedded teredo IPs. Returns: Tuple of the (server, client) IPs or None if the address doesn't appear to be a teredo address (doesn't start with 2001::/32) """ if (self._ip >> 96) != 0x20010000: return None ...
python
def teredo(self): """Tuple of embedded teredo IPs. Returns: Tuple of the (server, client) IPs or None if the address doesn't appear to be a teredo address (doesn't start with 2001::/32) """ if (self._ip >> 96) != 0x20010000: return None ...
['def', 'teredo', '(', 'self', ')', ':', 'if', '(', 'self', '.', '_ip', '>>', '96', ')', '!=', '0x20010000', ':', 'return', 'None', 'return', '(', 'IPv4Address', '(', '(', 'self', '.', '_ip', '>>', '64', ')', '&', '0xFFFFFFFF', ')', ',', 'IPv4Address', '(', '~', 'self', '.', '_ip', '&', '0xFFFFFFFF', ')', ')']
Tuple of embedded teredo IPs. Returns: Tuple of the (server, client) IPs or None if the address doesn't appear to be a teredo address (doesn't start with 2001::/32)
['Tuple', 'of', 'embedded', 'teredo', 'IPs', '.']
train
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/ipaddress.py#L2148-L2160
3,350
abarker/pdfCropMargins
src/pdfCropMargins/external_program_calls.py
remove_program_temp_directory
def remove_program_temp_directory(): """Remove the global temp directory and all its contents.""" if os.path.exists(program_temp_directory): max_retries = 3 curr_retries = 0 time_between_retries = 1 while True: try: shutil.rmtree(program_temp_directory...
python
def remove_program_temp_directory(): """Remove the global temp directory and all its contents.""" if os.path.exists(program_temp_directory): max_retries = 3 curr_retries = 0 time_between_retries = 1 while True: try: shutil.rmtree(program_temp_directory...
['def', 'remove_program_temp_directory', '(', ')', ':', 'if', 'os', '.', 'path', '.', 'exists', '(', 'program_temp_directory', ')', ':', 'max_retries', '=', '3', 'curr_retries', '=', '0', 'time_between_retries', '=', '1', 'while', 'True', ':', 'try', ':', 'shutil', '.', 'rmtree', '(', 'program_temp_directory', ')', 'br...
Remove the global temp directory and all its contents.
['Remove', 'the', 'global', 'temp', 'directory', 'and', 'all', 'its', 'contents', '.']
train
https://github.com/abarker/pdfCropMargins/blob/55aca874613750ebf4ae69fd8851bdbb7696d6ac/src/pdfCropMargins/external_program_calls.py#L191-L208
3,351
Kozea/pygal
pygal/graph/pyramid.py
VerticalPyramid._get_separated_values
def _get_separated_values(self, secondary=False): """Separate values between odd and even series stacked""" series = self.secondary_series if secondary else self.series positive_vals = map( sum, zip( *[ serie.safe_values for index, seri...
python
def _get_separated_values(self, secondary=False): """Separate values between odd and even series stacked""" series = self.secondary_series if secondary else self.series positive_vals = map( sum, zip( *[ serie.safe_values for index, seri...
['def', '_get_separated_values', '(', 'self', ',', 'secondary', '=', 'False', ')', ':', 'series', '=', 'self', '.', 'secondary_series', 'if', 'secondary', 'else', 'self', '.', 'series', 'positive_vals', '=', 'map', '(', 'sum', ',', 'zip', '(', '*', '[', 'serie', '.', 'safe_values', 'for', 'index', ',', 'serie', 'in', '...
Separate values between odd and even series stacked
['Separate', 'values', 'between', 'odd', 'and', 'even', 'series', 'stacked']
train
https://github.com/Kozea/pygal/blob/5e25c98a59a0642eecd9fcc5dbfeeb2190fbb5e7/pygal/graph/pyramid.py#L40-L61
3,352
mikhaildubov/AST-text-analysis
east/asts/ast_linear.py
LinearAnnotatedSuffixTree._construct
def _construct(self, strings_collection): """ Generalized suffix tree construction algorithm based on the Ukkonen's algorithm for suffix tree construction, with linear [O(n_1 + ... + n_m)] worst-case time complexity, where m is the number of strings in collection. ...
python
def _construct(self, strings_collection): """ Generalized suffix tree construction algorithm based on the Ukkonen's algorithm for suffix tree construction, with linear [O(n_1 + ... + n_m)] worst-case time complexity, where m is the number of strings in collection. ...
['def', '_construct', '(', 'self', ',', 'strings_collection', ')', ':', '# 1. Add a unique character to each string in the collection', 'strings_collection', '=', 'utils', '.', 'make_unique_endings', '(', 'strings_collection', ')', '############################################################', "# 2. Build the GST usin...
Generalized suffix tree construction algorithm based on the Ukkonen's algorithm for suffix tree construction, with linear [O(n_1 + ... + n_m)] worst-case time complexity, where m is the number of strings in collection.
['Generalized', 'suffix', 'tree', 'construction', 'algorithm', 'based', 'on', 'the', 'Ukkonen', 's', 'algorithm', 'for', 'suffix', 'tree', 'construction', 'with', 'linear', '[', 'O', '(', 'n_1', '+', '...', '+', 'n_m', ')', ']', 'worst', '-', 'case', 'time', 'complexity', 'where', 'm', 'is', 'the', 'number', 'of', 'str...
train
https://github.com/mikhaildubov/AST-text-analysis/blob/055ad8d2492c100bbbaa25309ec1074bdf1dfaa5/east/asts/ast_linear.py#L12-L208
3,353
pazz/alot
alot/ui.py
UI._input_filter
def _input_filter(self, keys, raw): """ handles keypresses. This function gets triggered directly by class:`urwid.MainLoop` upon user input and is supposed to pass on its `keys` parameter to let the root widget handle keys. We intercept the input here to trigger custom co...
python
def _input_filter(self, keys, raw): """ handles keypresses. This function gets triggered directly by class:`urwid.MainLoop` upon user input and is supposed to pass on its `keys` parameter to let the root widget handle keys. We intercept the input here to trigger custom co...
['def', '_input_filter', '(', 'self', ',', 'keys', ',', 'raw', ')', ':', 'logging', '.', 'debug', '(', '"Got key (%s, %s)"', ',', 'keys', ',', 'raw', ')', '# work around: escape triggers this twice, with keys = raw = []', '# the first time..', 'if', 'not', 'keys', ':', 'return', '# let widgets handle input if key is vi...
handles keypresses. This function gets triggered directly by class:`urwid.MainLoop` upon user input and is supposed to pass on its `keys` parameter to let the root widget handle keys. We intercept the input here to trigger custom commands as defined in our keybindings.
['handles', 'keypresses', '.', 'This', 'function', 'gets', 'triggered', 'directly', 'by', 'class', ':', 'urwid', '.', 'MainLoop', 'upon', 'user', 'input', 'and', 'is', 'supposed', 'to', 'pass', 'on', 'its', 'keys', 'parameter', 'to', 'let', 'the', 'root', 'widget', 'handle', 'keys', '.', 'We', 'intercept', 'the', 'inpu...
train
https://github.com/pazz/alot/blob/d0297605c0ec1c6b65f541d0fd5b69ac5a0f4ded/alot/ui.py#L153-L233
3,354
basecrm/basecrm-python
basecrm/services.py
DealSourcesService.retrieve
def retrieve(self, id) : """ Retrieve a single source Returns a single source available to the user by the provided id If a source with the supplied unique identifier does not exist it returns an error :calls: ``get /deal_sources/{id}`` :param int id: Unique identifier ...
python
def retrieve(self, id) : """ Retrieve a single source Returns a single source available to the user by the provided id If a source with the supplied unique identifier does not exist it returns an error :calls: ``get /deal_sources/{id}`` :param int id: Unique identifier ...
['def', 'retrieve', '(', 'self', ',', 'id', ')', ':', '_', ',', '_', ',', 'deal_source', '=', 'self', '.', 'http_client', '.', 'get', '(', '"/deal_sources/{id}"', '.', 'format', '(', 'id', '=', 'id', ')', ')', 'return', 'deal_source']
Retrieve a single source Returns a single source available to the user by the provided id If a source with the supplied unique identifier does not exist it returns an error :calls: ``get /deal_sources/{id}`` :param int id: Unique identifier of a DealSource. :return: Dictionary ...
['Retrieve', 'a', 'single', 'source']
train
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L443-L457
3,355
googleapis/google-cloud-python
firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py
FirestoreClient.delete_document
def delete_document( self, name, current_document=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Deletes a document. Example: >>> from google.cloud import...
python
def delete_document( self, name, current_document=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Deletes a document. Example: >>> from google.cloud import...
['def', 'delete_document', '(', 'self', ',', 'name', ',', 'current_document', '=', 'None', ',', 'retry', '=', 'google', '.', 'api_core', '.', 'gapic_v1', '.', 'method', '.', 'DEFAULT', ',', 'timeout', '=', 'google', '.', 'api_core', '.', 'gapic_v1', '.', 'method', '.', 'DEFAULT', ',', 'metadata', '=', 'None', ',', ')',...
Deletes a document. Example: >>> from google.cloud import firestore_v1beta1 >>> >>> client = firestore_v1beta1.FirestoreClient() >>> >>> name = client.any_path_path('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]') >>> >>>...
['Deletes', 'a', 'document', '.']
train
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/gapic/firestore_client.py#L669-L742
3,356
beetbox/audioread
audioread/__init__.py
_gst_available
def _gst_available(): """Determine whether Gstreamer and the Python GObject bindings are installed. """ try: import gi except ImportError: return False try: gi.require_version('Gst', '1.0') except (ValueError, AttributeError): return False try: f...
python
def _gst_available(): """Determine whether Gstreamer and the Python GObject bindings are installed. """ try: import gi except ImportError: return False try: gi.require_version('Gst', '1.0') except (ValueError, AttributeError): return False try: f...
['def', '_gst_available', '(', ')', ':', 'try', ':', 'import', 'gi', 'except', 'ImportError', ':', 'return', 'False', 'try', ':', 'gi', '.', 'require_version', '(', "'Gst'", ',', "'1.0'", ')', 'except', '(', 'ValueError', ',', 'AttributeError', ')', ':', 'return', 'False', 'try', ':', 'from', 'gi', '.', 'repository', '...
Determine whether Gstreamer and the Python GObject bindings are installed.
['Determine', 'whether', 'Gstreamer', 'and', 'the', 'Python', 'GObject', 'bindings', 'are', 'installed', '.']
train
https://github.com/beetbox/audioread/blob/c8bedf7880f13a7b7488b108aaf245d648674818/audioread/__init__.py#L22-L41
3,357
LordDarkula/chess_py
chess_py/core/board.py
Board._calc_all_possible_moves
def _calc_all_possible_moves(self, input_color): """ Returns list of all possible moves :type: input_color: Color :rtype: list """ for piece in self: # Tests if square on the board is not empty if piece is not None and piece.color == input_color:...
python
def _calc_all_possible_moves(self, input_color): """ Returns list of all possible moves :type: input_color: Color :rtype: list """ for piece in self: # Tests if square on the board is not empty if piece is not None and piece.color == input_color:...
['def', '_calc_all_possible_moves', '(', 'self', ',', 'input_color', ')', ':', 'for', 'piece', 'in', 'self', ':', '# Tests if square on the board is not empty', 'if', 'piece', 'is', 'not', 'None', 'and', 'piece', '.', 'color', '==', 'input_color', ':', 'for', 'move', 'in', 'piece', '.', 'possible_moves', '(', 'self', '...
Returns list of all possible moves :type: input_color: Color :rtype: list
['Returns', 'list', 'of', 'all', 'possible', 'moves']
train
https://github.com/LordDarkula/chess_py/blob/14bebc2f8c49ae25c59375cc83d0b38d8ff7281d/chess_py/core/board.py#L229-L264
3,358
osrg/ryu
ryu/services/protocols/bgp/bgpspeaker.py
BGPSpeaker.neighbor_state_get
def neighbor_state_get(self, address=None, format='json'): """ This method returns the state of peer(s) in a json format. ``address`` specifies the address of a peer. If not given, the state of all the peers return. ``format`` specifies the format of the response. This ...
python
def neighbor_state_get(self, address=None, format='json'): """ This method returns the state of peer(s) in a json format. ``address`` specifies the address of a peer. If not given, the state of all the peers return. ``format`` specifies the format of the response. This ...
['def', 'neighbor_state_get', '(', 'self', ',', 'address', '=', 'None', ',', 'format', '=', "'json'", ')', ':', 'show', '=', '{', "'params'", ':', '[', "'neighbor'", ',', "'summary'", ']', ',', "'format'", ':', 'format', ',', '}', 'if', 'address', ':', 'show', '[', "'params'", ']', '.', 'append', '(', 'address', ')', '...
This method returns the state of peer(s) in a json format. ``address`` specifies the address of a peer. If not given, the state of all the peers return. ``format`` specifies the format of the response. This parameter must be one of the following. - 'json' (default) ...
['This', 'method', 'returns', 'the', 'state', 'of', 'peer', '(', 's', ')', 'in', 'a', 'json', 'format', '.']
train
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/bgpspeaker.py#L610-L630
3,359
slundberg/shap
shap/explainers/deep/deep_pytorch.py
add_interim_values
def add_interim_values(module, input, output): """The forward hook used to save interim tensors, detached from the graph. Used to calculate the multipliers """ try: del module.x except AttributeError: pass try: del module.y except AttributeError: pass modu...
python
def add_interim_values(module, input, output): """The forward hook used to save interim tensors, detached from the graph. Used to calculate the multipliers """ try: del module.x except AttributeError: pass try: del module.y except AttributeError: pass modu...
['def', 'add_interim_values', '(', 'module', ',', 'input', ',', 'output', ')', ':', 'try', ':', 'del', 'module', '.', 'x', 'except', 'AttributeError', ':', 'pass', 'try', ':', 'del', 'module', '.', 'y', 'except', 'AttributeError', ':', 'pass', 'module_type', '=', 'module', '.', '__class__', '.', '__name__', 'if', 'modu...
The forward hook used to save interim tensors, detached from the graph. Used to calculate the multipliers
['The', 'forward', 'hook', 'used', 'to', 'save', 'interim', 'tensors', 'detached', 'from', 'the', 'graph', '.', 'Used', 'to', 'calculate', 'the', 'multipliers']
train
https://github.com/slundberg/shap/blob/b280cb81d498b9d98565cad8dd16fc88ae52649f/shap/explainers/deep/deep_pytorch.py#L209-L245
3,360
aricaldeira/PySPED
pysped/nfe/processador_nfe.py
ConexaoHTTPS.connect
def connect(self): "Connect to a host on a given (SSL) port." # # source_address é atributo incluído na versão 2.7 do Python # Verificando a existência para funcionar em versões anteriores à 2.7 # if hasattr(self, 'source_address'): sock = socket.create_conne...
python
def connect(self): "Connect to a host on a given (SSL) port." # # source_address é atributo incluído na versão 2.7 do Python # Verificando a existência para funcionar em versões anteriores à 2.7 # if hasattr(self, 'source_address'): sock = socket.create_conne...
['def', 'connect', '(', 'self', ')', ':', '#', '# source_address é atributo incluído na versão 2.7 do Python', '# Verificando a existência para funcionar em versões anteriores à 2.7', '#', 'if', 'hasattr', '(', 'self', ',', "'source_address'", ')', ':', 'sock', '=', 'socket', '.', 'create_connection', '(', '(', 'self',...
Connect to a host on a given (SSL) port.
['Connect', 'to', 'a', 'host', 'on', 'a', 'given', '(', 'SSL', ')', 'port', '.']
train
https://github.com/aricaldeira/PySPED/blob/42905693e913f32db2c23f4e067f94af28a8164a/pysped/nfe/processador_nfe.py#L162-L181
3,361
pulumi/pulumi
sdk/python/lib/pulumi/runtime/settings.py
get_project
def get_project() -> Optional[str]: """ Returns the current project name. """ project = SETTINGS.project if not project: require_test_mode_enabled() raise RunError('Missing project name; for test mode, please set PULUMI_NODEJS_PROJECT') return project
python
def get_project() -> Optional[str]: """ Returns the current project name. """ project = SETTINGS.project if not project: require_test_mode_enabled() raise RunError('Missing project name; for test mode, please set PULUMI_NODEJS_PROJECT') return project
['def', 'get_project', '(', ')', '->', 'Optional', '[', 'str', ']', ':', 'project', '=', 'SETTINGS', '.', 'project', 'if', 'not', 'project', ':', 'require_test_mode_enabled', '(', ')', 'raise', 'RunError', '(', "'Missing project name; for test mode, please set PULUMI_NODEJS_PROJECT'", ')', 'return', 'project']
Returns the current project name.
['Returns', 'the', 'current', 'project', 'name', '.']
train
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/settings.py#L107-L115
3,362
MartinThoma/mpu
mpu/math.py
round_down
def round_down(x, decimal_places): """ Round a float down to decimal_places. Parameters ---------- x : float decimal_places : int Returns ------- rounded_float : float Examples -------- >>> round_down(1.23456, 3) 1.234 >>> round_down(1.23456, 2) 1.23 ""...
python
def round_down(x, decimal_places): """ Round a float down to decimal_places. Parameters ---------- x : float decimal_places : int Returns ------- rounded_float : float Examples -------- >>> round_down(1.23456, 3) 1.234 >>> round_down(1.23456, 2) 1.23 ""...
['def', 'round_down', '(', 'x', ',', 'decimal_places', ')', ':', 'from', 'math', 'import', 'floor', 'd', '=', 'int', '(', "'1'", '+', '(', "'0'", '*', 'decimal_places', ')', ')', 'return', 'floor', '(', 'x', '*', 'd', ')', '/', 'd']
Round a float down to decimal_places. Parameters ---------- x : float decimal_places : int Returns ------- rounded_float : float Examples -------- >>> round_down(1.23456, 3) 1.234 >>> round_down(1.23456, 2) 1.23
['Round', 'a', 'float', 'down', 'to', 'decimal_places', '.']
train
https://github.com/MartinThoma/mpu/blob/61bc36d0192ca90c0bcf9b8a5d7d0d8520e20ff6/mpu/math.py#L206-L228
3,363
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
FuncConverter.pyxlines
def pyxlines(self): """Cython code lines. Assumptions: * Function shall be a method * Method shall be inlined * Method returns nothing * Method arguments are of type `int` (except self) * Local variables are generally of type `int` but of type `double` ...
python
def pyxlines(self): """Cython code lines. Assumptions: * Function shall be a method * Method shall be inlined * Method returns nothing * Method arguments are of type `int` (except self) * Local variables are generally of type `int` but of type `double` ...
['def', 'pyxlines', '(', 'self', ')', ':', 'lines', '=', '[', "' '", '+', 'line', 'for', 'line', 'in', 'self', '.', 'cleanlines', ']', 'lines', '[', '0', ']', '=', 'lines', '[', '0', ']', '.', 'replace', '(', "'def '", ',', "'cpdef inline void '", ')', 'lines', '[', '0', ']', '=', 'lines', '[', '0', ']', '.', 'repla...
Cython code lines. Assumptions: * Function shall be a method * Method shall be inlined * Method returns nothing * Method arguments are of type `int` (except self) * Local variables are generally of type `int` but of type `double` when their name sta...
['Cython', 'code', 'lines', '.']
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L1218-L1240
3,364
spry-group/python-vultr
vultr/v1_startupscript.py
VultrStartupScript.update
def update(self, scriptid, params=None): ''' /v1/startupscript/update POST - account Update an existing startup script Link: https://www.vultr.com/api/#startupscript_update ''' params = update_params(params, {'SCRIPTID': scriptid}) return self.request('/v1/startu...
python
def update(self, scriptid, params=None): ''' /v1/startupscript/update POST - account Update an existing startup script Link: https://www.vultr.com/api/#startupscript_update ''' params = update_params(params, {'SCRIPTID': scriptid}) return self.request('/v1/startu...
['def', 'update', '(', 'self', ',', 'scriptid', ',', 'params', '=', 'None', ')', ':', 'params', '=', 'update_params', '(', 'params', ',', '{', "'SCRIPTID'", ':', 'scriptid', '}', ')', 'return', 'self', '.', 'request', '(', "'/v1/startupscript/update'", ',', 'params', ',', "'POST'", ')']
/v1/startupscript/update POST - account Update an existing startup script Link: https://www.vultr.com/api/#startupscript_update
['/', 'v1', '/', 'startupscript', '/', 'update', 'POST', '-', 'account', 'Update', 'an', 'existing', 'startup', 'script']
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_startupscript.py#L46-L54
3,365
vtkiorg/vtki
vtki/container.py
MultiBlock._get_attrs
def _get_attrs(self): """An internal helper for the representation methods""" attrs = [] attrs.append(("N Blocks", self.n_blocks, "{}")) bds = self.bounds attrs.append(("X Bounds", (bds[0], bds[1]), "{:.3f}, {:.3f}")) attrs.append(("Y Bounds", (bds[2], bds[3]), "{:.3f}, {...
python
def _get_attrs(self): """An internal helper for the representation methods""" attrs = [] attrs.append(("N Blocks", self.n_blocks, "{}")) bds = self.bounds attrs.append(("X Bounds", (bds[0], bds[1]), "{:.3f}, {:.3f}")) attrs.append(("Y Bounds", (bds[2], bds[3]), "{:.3f}, {...
['def', '_get_attrs', '(', 'self', ')', ':', 'attrs', '=', '[', ']', 'attrs', '.', 'append', '(', '(', '"N Blocks"', ',', 'self', '.', 'n_blocks', ',', '"{}"', ')', ')', 'bds', '=', 'self', '.', 'bounds', 'attrs', '.', 'append', '(', '(', '"X Bounds"', ',', '(', 'bds', '[', '0', ']', ',', 'bds', '[', '1', ']', ')', ','...
An internal helper for the representation methods
['An', 'internal', 'helper', 'for', 'the', 'representation', 'methods']
train
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/container.py#L356-L364
3,366
juju/charm-helpers
charmhelpers/contrib/openstack/amulet/utils.py
OpenStackAmuletUtils.get_rmq_cluster_status
def get_rmq_cluster_status(self, sentry_unit): """Execute rabbitmq cluster status command on a unit and return the full output. :param unit: sentry unit :returns: String containing console output of cluster status command """ cmd = 'rabbitmqctl cluster_status' ou...
python
def get_rmq_cluster_status(self, sentry_unit): """Execute rabbitmq cluster status command on a unit and return the full output. :param unit: sentry unit :returns: String containing console output of cluster status command """ cmd = 'rabbitmqctl cluster_status' ou...
['def', 'get_rmq_cluster_status', '(', 'self', ',', 'sentry_unit', ')', ':', 'cmd', '=', "'rabbitmqctl cluster_status'", 'output', ',', '_', '=', 'self', '.', 'run_cmd_unit', '(', 'sentry_unit', ',', 'cmd', ')', 'self', '.', 'log', '.', 'debug', '(', "'{} cluster_status:\\n{}'", '.', 'format', '(', 'sentry_unit', '.', ...
Execute rabbitmq cluster status command on a unit and return the full output. :param unit: sentry unit :returns: String containing console output of cluster status command
['Execute', 'rabbitmq', 'cluster', 'status', 'command', 'on', 'a', 'unit', 'and', 'return', 'the', 'full', 'output', '.']
train
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L1218-L1229
3,367
PaulHancock/Aegean
AegeanTools/source_finder.py
SourceFinder.find_sources_in_image
def find_sources_in_image(self, filename, hdu_index=0, outfile=None, rms=None, bkg=None, max_summits=None, innerclip=5, outerclip=4, cores=None, rmsin=None, bkgin=None, beam=None, doislandflux=False, nopositive=False, nonegative=False, mask=None, lat=None, img...
python
def find_sources_in_image(self, filename, hdu_index=0, outfile=None, rms=None, bkg=None, max_summits=None, innerclip=5, outerclip=4, cores=None, rmsin=None, bkgin=None, beam=None, doislandflux=False, nopositive=False, nonegative=False, mask=None, lat=None, img...
['def', 'find_sources_in_image', '(', 'self', ',', 'filename', ',', 'hdu_index', '=', '0', ',', 'outfile', '=', 'None', ',', 'rms', '=', 'None', ',', 'bkg', '=', 'None', ',', 'max_summits', '=', 'None', ',', 'innerclip', '=', '5', ',', 'outerclip', '=', '4', ',', 'cores', '=', 'None', ',', 'rmsin', '=', 'None', ',', 'b...
Run the Aegean source finder. Parameters ---------- filename : str or HDUList Image filename or HDUList. hdu_index : int The index of the FITS HDU (extension). outfile : str file for printing catalog (NOT a table, just a text file of my own...
['Run', 'the', 'Aegean', 'source', 'finder', '.']
train
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L1396-L1540
3,368
scanny/python-pptx
pptx/chart/data.py
BubbleSeriesData.add_data_point
def add_data_point(self, x, y, size, number_format=None): """ Append a new BubbleDataPoint object having the values *x*, *y*, and *size*. The optional *number_format* is used to format the Y value. If not provided, the number format is inherited from the series data. """ ...
python
def add_data_point(self, x, y, size, number_format=None): """ Append a new BubbleDataPoint object having the values *x*, *y*, and *size*. The optional *number_format* is used to format the Y value. If not provided, the number format is inherited from the series data. """ ...
['def', 'add_data_point', '(', 'self', ',', 'x', ',', 'y', ',', 'size', ',', 'number_format', '=', 'None', ')', ':', 'data_point', '=', 'BubbleDataPoint', '(', 'self', ',', 'x', ',', 'y', ',', 'size', ',', 'number_format', ')', 'self', '.', 'append', '(', 'data_point', ')', 'return', 'data_point']
Append a new BubbleDataPoint object having the values *x*, *y*, and *size*. The optional *number_format* is used to format the Y value. If not provided, the number format is inherited from the series data.
['Append', 'a', 'new', 'BubbleDataPoint', 'object', 'having', 'the', 'values', '*', 'x', '*', '*', 'y', '*', 'and', '*', 'size', '*', '.', 'The', 'optional', '*', 'number_format', '*', 'is', 'used', 'to', 'format', 'the', 'Y', 'value', '.', 'If', 'not', 'provided', 'the', 'number', 'format', 'is', 'inherited', 'from', ...
train
https://github.com/scanny/python-pptx/blob/d6ab8234f8b03953d2f831ff9394b1852db34130/pptx/chart/data.py#L769-L777
3,369
pyviz/holoviews
holoviews/util/parser.py
Parser.collect_tokens
def collect_tokens(cls, parseresult, mode): """ Collect the tokens from a (potentially) nested parse result. """ inner = '(%s)' if mode=='parens' else '[%s]' if parseresult is None: return [] tokens = [] for token in parseresult.asList(): # If value is...
python
def collect_tokens(cls, parseresult, mode): """ Collect the tokens from a (potentially) nested parse result. """ inner = '(%s)' if mode=='parens' else '[%s]' if parseresult is None: return [] tokens = [] for token in parseresult.asList(): # If value is...
['def', 'collect_tokens', '(', 'cls', ',', 'parseresult', ',', 'mode', ')', ':', 'inner', '=', "'(%s)'", 'if', 'mode', '==', "'parens'", 'else', "'[%s]'", 'if', 'parseresult', 'is', 'None', ':', 'return', '[', ']', 'tokens', '=', '[', ']', 'for', 'token', 'in', 'parseresult', '.', 'asList', '(', ')', ':', '# If value i...
Collect the tokens from a (potentially) nested parse result.
['Collect', 'the', 'tokens', 'from', 'a', '(', 'potentially', ')', 'nested', 'parse', 'result', '.']
train
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/util/parser.py#L63-L78
3,370
pantsbuild/pants
src/python/pants/backend/jvm/tasks/jar_publish.py
PushDb.dump
def dump(self, path): """Saves the pushdb as a properties file to the given path.""" with open(path, 'w') as props: Properties.dump(self._props, props)
python
def dump(self, path): """Saves the pushdb as a properties file to the given path.""" with open(path, 'w') as props: Properties.dump(self._props, props)
['def', 'dump', '(', 'self', ',', 'path', ')', ':', 'with', 'open', '(', 'path', ',', "'w'", ')', 'as', 'props', ':', 'Properties', '.', 'dump', '(', 'self', '.', '_props', ',', 'props', ')']
Saves the pushdb as a properties file to the given path.
['Saves', 'the', 'pushdb', 'as', 'a', 'properties', 'file', 'to', 'the', 'given', 'path', '.']
train
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/backend/jvm/tasks/jar_publish.py#L144-L147
3,371
tweepy/tweepy
tweepy/api.py
API.remove_list_members
def remove_list_members(self, screen_name=None, user_id=None, slug=None, list_id=None, owner_id=None, owner_screen_name=None): """ Perform bulk remove of list members from user ID or screenname """ return self._remove_list_members(list_to_csv(screen_name), ...
python
def remove_list_members(self, screen_name=None, user_id=None, slug=None, list_id=None, owner_id=None, owner_screen_name=None): """ Perform bulk remove of list members from user ID or screenname """ return self._remove_list_members(list_to_csv(screen_name), ...
['def', 'remove_list_members', '(', 'self', ',', 'screen_name', '=', 'None', ',', 'user_id', '=', 'None', ',', 'slug', '=', 'None', ',', 'list_id', '=', 'None', ',', 'owner_id', '=', 'None', ',', 'owner_screen_name', '=', 'None', ')', ':', 'return', 'self', '.', '_remove_list_members', '(', 'list_to_csv', '(', 'screen_...
Perform bulk remove of list members from user ID or screenname
['Perform', 'bulk', 'remove', 'of', 'list', 'members', 'from', 'user', 'ID', 'or', 'screenname']
train
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/api.py#L1097-L1103
3,372
saltstack/salt
salt/modules/boto_ec2.py
get_tags
def get_tags(instance_id=None, keyid=None, key=None, profile=None, region=None): ''' Given an instance_id, return a list of tags associated with that instance. returns (list) - list of tags as key/value pairs CLI Example: .. code-block:: bash salt myminion boto_ec2.g...
python
def get_tags(instance_id=None, keyid=None, key=None, profile=None, region=None): ''' Given an instance_id, return a list of tags associated with that instance. returns (list) - list of tags as key/value pairs CLI Example: .. code-block:: bash salt myminion boto_ec2.g...
['def', 'get_tags', '(', 'instance_id', '=', 'None', ',', 'keyid', '=', 'None', ',', 'key', '=', 'None', ',', 'profile', '=', 'None', ',', 'region', '=', 'None', ')', ':', 'tags', '=', '[', ']', 'client', '=', '_get_conn', '(', 'key', '=', 'key', ',', 'keyid', '=', 'keyid', ',', 'profile', '=', 'profile', ',', 'region'...
Given an instance_id, return a list of tags associated with that instance. returns (list) - list of tags as key/value pairs CLI Example: .. code-block:: bash salt myminion boto_ec2.get_tags instance_id
['Given', 'an', 'instance_id', 'return', 'a', 'list', 'of', 'tags', 'associated', 'with', 'that', 'instance', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_ec2.py#L751-L773
3,373
CityOfZion/neo-python
neo/Core/TX/TransactionAttribute.py
TransactionAttribute.ToJson
def ToJson(self): """ Convert object members to a dictionary that can be parsed as JSON. Returns: dict: """ obj = { 'usage': self.Usage, 'data': '' if not self.Data else self.Data.hex() } return obj
python
def ToJson(self): """ Convert object members to a dictionary that can be parsed as JSON. Returns: dict: """ obj = { 'usage': self.Usage, 'data': '' if not self.Data else self.Data.hex() } return obj
['def', 'ToJson', '(', 'self', ')', ':', 'obj', '=', '{', "'usage'", ':', 'self', '.', 'Usage', ',', "'data'", ':', "''", 'if', 'not', 'self', '.', 'Data', 'else', 'self', '.', 'Data', '.', 'hex', '(', ')', '}', 'return', 'obj']
Convert object members to a dictionary that can be parsed as JSON. Returns: dict:
['Convert', 'object', 'members', 'to', 'a', 'dictionary', 'that', 'can', 'be', 'parsed', 'as', 'JSON', '.']
train
https://github.com/CityOfZion/neo-python/blob/fe90f62e123d720d4281c79af0598d9df9e776fb/neo/Core/TX/TransactionAttribute.py#L147-L158
3,374
trevorstephens/gplearn
gplearn/genetic.py
SymbolicClassifier.predict_proba
def predict_proba(self, X): """Predict probabilities on test vectors X. Parameters ---------- X : array-like, shape = [n_samples, n_features] Input vectors, where n_samples is the number of samples and n_features is the number of features. Returns ...
python
def predict_proba(self, X): """Predict probabilities on test vectors X. Parameters ---------- X : array-like, shape = [n_samples, n_features] Input vectors, where n_samples is the number of samples and n_features is the number of features. Returns ...
['def', 'predict_proba', '(', 'self', ',', 'X', ')', ':', 'if', 'not', 'hasattr', '(', 'self', ',', "'_program'", ')', ':', 'raise', 'NotFittedError', '(', "'SymbolicClassifier not fitted.'", ')', 'X', '=', 'check_array', '(', 'X', ')', '_', ',', 'n_features', '=', 'X', '.', 'shape', 'if', 'self', '.', 'n_features_', '...
Predict probabilities on test vectors X. Parameters ---------- X : array-like, shape = [n_samples, n_features] Input vectors, where n_samples is the number of samples and n_features is the number of features. Returns ------- proba : array, shape ...
['Predict', 'probabilities', 'on', 'test', 'vectors', 'X', '.']
train
https://github.com/trevorstephens/gplearn/blob/5c0465f2ecdcd5abcdf3fe520688d24cd59e4a52/gplearn/genetic.py#L1108-L1138
3,375
django-extensions/django-extensions
django_extensions/management/commands/graph_models.py
Command.add_arguments
def add_arguments(self, parser): """Unpack self.arguments for parser.add_arguments.""" parser.add_argument('app_label', nargs='*') for argument in self.arguments: parser.add_argument(*argument.split(' '), **self.arguments[argument])
python
def add_arguments(self, parser): """Unpack self.arguments for parser.add_arguments.""" parser.add_argument('app_label', nargs='*') for argument in self.arguments: parser.add_argument(*argument.split(' '), **self.arguments[argument])
['def', 'add_arguments', '(', 'self', ',', 'parser', ')', ':', 'parser', '.', 'add_argument', '(', "'app_label'", ',', 'nargs', '=', "'*'", ')', 'for', 'argument', 'in', 'self', '.', 'arguments', ':', 'parser', '.', 'add_argument', '(', '*', 'argument', '.', 'split', '(', "' '", ')', ',', '*', '*', 'self', '.', 'argume...
Unpack self.arguments for parser.add_arguments.
['Unpack', 'self', '.', 'arguments', 'for', 'parser', '.', 'add_arguments', '.']
train
https://github.com/django-extensions/django-extensions/blob/7e0bef97ea6cb7f9eea5e2528e3a985a83a7b9b8/django_extensions/management/commands/graph_models.py#L169-L173
3,376
oceanprotocol/squid-py
squid_py/agreements/service_factory.py
ServiceFactory.build_access_service
def build_access_service(did, price, consume_endpoint, service_endpoint, timeout, template_id): """ Build the access service. :param did: DID, str :param price: Asset price, int :param consume_endpoint: url of the service provider, str :param service_endpoint: identifier...
python
def build_access_service(did, price, consume_endpoint, service_endpoint, timeout, template_id): """ Build the access service. :param did: DID, str :param price: Asset price, int :param consume_endpoint: url of the service provider, str :param service_endpoint: identifier...
['def', 'build_access_service', '(', 'did', ',', 'price', ',', 'consume_endpoint', ',', 'service_endpoint', ',', 'timeout', ',', 'template_id', ')', ':', '# TODO fill all the possible mappings', 'param_map', '=', '{', "'_documentId'", ':', 'did_to_id', '(', 'did', ')', ',', "'_amount'", ':', 'price', ',', "'_rewardAddr...
Build the access service. :param did: DID, str :param price: Asset price, int :param consume_endpoint: url of the service provider, str :param service_endpoint: identifier of the service inside the asset DDO, str :param timeout: amount of time in seconds before the agreement exp...
['Build', 'the', 'access', 'service', '.']
train
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/agreements/service_factory.py#L166-L204
3,377
projectshift/shift-boiler
boiler/collections/api_collection.py
ApiCollection.dict
def dict(self): """ Returns current collection as a dictionary """ collection = super().dict() serialized_items = [] for item in collection['items']: serialized_items.append(self.serializer(item)) collection['items'] = serialized_items return collection
python
def dict(self): """ Returns current collection as a dictionary """ collection = super().dict() serialized_items = [] for item in collection['items']: serialized_items.append(self.serializer(item)) collection['items'] = serialized_items return collection
['def', 'dict', '(', 'self', ')', ':', 'collection', '=', 'super', '(', ')', '.', 'dict', '(', ')', 'serialized_items', '=', '[', ']', 'for', 'item', 'in', 'collection', '[', "'items'", ']', ':', 'serialized_items', '.', 'append', '(', 'self', '.', 'serializer', '(', 'item', ')', ')', 'collection', '[', "'items'", ']',...
Returns current collection as a dictionary
['Returns', 'current', 'collection', 'as', 'a', 'dictionary']
train
https://github.com/projectshift/shift-boiler/blob/8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b/boiler/collections/api_collection.py#L23-L31
3,378
troeger/opensubmit
web/opensubmit/admin/submission.py
SubmissionAdmin.file_link
def file_link(self, instance): ''' Renders the link to the student upload file. ''' sfile = instance.file_upload if not sfile: return mark_safe('No file submitted by student.') else: return mark_safe('<a href="%s">%s</a><br/>(<a href="%s" targe...
python
def file_link(self, instance): ''' Renders the link to the student upload file. ''' sfile = instance.file_upload if not sfile: return mark_safe('No file submitted by student.') else: return mark_safe('<a href="%s">%s</a><br/>(<a href="%s" targe...
['def', 'file_link', '(', 'self', ',', 'instance', ')', ':', 'sfile', '=', 'instance', '.', 'file_upload', 'if', 'not', 'sfile', ':', 'return', 'mark_safe', '(', "'No file submitted by student.'", ')', 'else', ':', 'return', 'mark_safe', '(', '\'<a href="%s">%s</a><br/>(<a href="%s" target="_new">Preview</a>)\'', '%', ...
Renders the link to the student upload file.
['Renders', 'the', 'link', 'to', 'the', 'student', 'upload', 'file', '.']
train
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/admin/submission.py#L153-L161
3,379
thunder-project/thunder
thunder/readers.py
BotoParallelReader.getfiles
def getfiles(self, path, ext=None, start=None, stop=None, recursive=False): """ Get scheme, bucket, and keys for a set of files """ from .utils import connection_with_anon, connection_with_gs parse = BotoClient.parse_query(path) scheme = parse[0] bucket_name = p...
python
def getfiles(self, path, ext=None, start=None, stop=None, recursive=False): """ Get scheme, bucket, and keys for a set of files """ from .utils import connection_with_anon, connection_with_gs parse = BotoClient.parse_query(path) scheme = parse[0] bucket_name = p...
['def', 'getfiles', '(', 'self', ',', 'path', ',', 'ext', '=', 'None', ',', 'start', '=', 'None', ',', 'stop', '=', 'None', ',', 'recursive', '=', 'False', ')', ':', 'from', '.', 'utils', 'import', 'connection_with_anon', ',', 'connection_with_gs', 'parse', '=', 'BotoClient', '.', 'parse_query', '(', 'path', ')', 'sche...
Get scheme, bucket, and keys for a set of files
['Get', 'scheme', 'bucket', 'and', 'keys', 'for', 'a', 'set', 'of', 'files']
train
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/readers.py#L328-L361
3,380
CivicSpleen/ckcache
ckcache/filesystem.py
FsLimitedCache._free_up_space
def _free_up_space(self, size, this_rel_path=None): '''If there are not size bytes of space left, delete files until there is Args: size: size of the current file this_rel_path: rel_pat to the current file, so we don't delete it. ''' # Amount of space w...
python
def _free_up_space(self, size, this_rel_path=None): '''If there are not size bytes of space left, delete files until there is Args: size: size of the current file this_rel_path: rel_pat to the current file, so we don't delete it. ''' # Amount of space w...
['def', '_free_up_space', '(', 'self', ',', 'size', ',', 'this_rel_path', '=', 'None', ')', ':', '# Amount of space we are over ( bytes ) for next put', 'space', '=', 'self', '.', 'size', '+', 'size', '-', 'self', '.', 'maxsize', 'if', 'space', '<=', '0', ':', 'return', 'removes', '=', '[', ']', 'for', 'row', 'in', 'se...
If there are not size bytes of space left, delete files until there is Args: size: size of the current file this_rel_path: rel_pat to the current file, so we don't delete it.
['If', 'there', 'are', 'not', 'size', 'bytes', 'of', 'space', 'left', 'delete', 'files', 'until', 'there', 'is']
train
https://github.com/CivicSpleen/ckcache/blob/0c699b6ba97ff164e9702504f0e1643dd4cd39e1/ckcache/filesystem.py#L508-L537
3,381
raymontag/kppy
kppy/database.py
KPDBv1.close
def close(self): """This method closes the database correctly.""" if self.filepath is not None: if path.isfile(self.filepath+'.lock'): remove(self.filepath+'.lock') self.filepath = None self.read_only = False self.lock() ...
python
def close(self): """This method closes the database correctly.""" if self.filepath is not None: if path.isfile(self.filepath+'.lock'): remove(self.filepath+'.lock') self.filepath = None self.read_only = False self.lock() ...
['def', 'close', '(', 'self', ')', ':', 'if', 'self', '.', 'filepath', 'is', 'not', 'None', ':', 'if', 'path', '.', 'isfile', '(', 'self', '.', 'filepath', '+', "'.lock'", ')', ':', 'remove', '(', 'self', '.', 'filepath', '+', "'.lock'", ')', 'self', '.', 'filepath', '=', 'None', 'self', '.', 'read_only', '=', 'False',...
This method closes the database correctly.
['This', 'method', 'closes', 'the', 'database', 'correctly', '.']
train
https://github.com/raymontag/kppy/blob/a43f1fff7d49da1da4b3d8628a1b3ebbaf47f43a/kppy/database.py#L448-L459
3,382
googledatalab/pydatalab
datalab/bigquery/_api.py
Api.datasets_list
def datasets_list(self, project_id=None, max_results=0, page_token=None): """Issues a request to list the datasets in the project. Args: project_id: the project id to use to fetch the results; use None for the default project. max_results: an optional maximum number of tables to retrieve. pag...
python
def datasets_list(self, project_id=None, max_results=0, page_token=None): """Issues a request to list the datasets in the project. Args: project_id: the project id to use to fetch the results; use None for the default project. max_results: an optional maximum number of tables to retrieve. pag...
['def', 'datasets_list', '(', 'self', ',', 'project_id', '=', 'None', ',', 'max_results', '=', '0', ',', 'page_token', '=', 'None', ')', ':', 'if', 'project_id', 'is', 'None', ':', 'project_id', '=', 'self', '.', '_project_id', 'url', '=', 'Api', '.', '_ENDPOINT', '+', '(', 'Api', '.', '_DATASETS_PATH', '%', '(', 'proj...
Issues a request to list the datasets in the project. Args: project_id: the project id to use to fetch the results; use None for the default project. max_results: an optional maximum number of tables to retrieve. page_token: an optional token to continue the retrieval. Returns: A parsed...
['Issues', 'a', 'request', 'to', 'list', 'the', 'datasets', 'in', 'the', 'project', '.']
train
https://github.com/googledatalab/pydatalab/blob/d9031901d5bca22fe0d5925d204e6698df9852e1/datalab/bigquery/_api.py#L324-L346
3,383
viralogic/py-enumerable
py_linq/py_linq3.py
Enumerable3.intersect
def intersect(self, enumerable, key=lambda x: x): """ Returns enumerable that is the intersection between given enumerable and self :param enumerable: enumerable object :param key: key selector as lambda expression :return: new Enumerable object """ if not...
python
def intersect(self, enumerable, key=lambda x: x): """ Returns enumerable that is the intersection between given enumerable and self :param enumerable: enumerable object :param key: key selector as lambda expression :return: new Enumerable object """ if not...
['def', 'intersect', '(', 'self', ',', 'enumerable', ',', 'key', '=', 'lambda', 'x', ':', 'x', ')', ':', 'if', 'not', 'isinstance', '(', 'enumerable', ',', 'Enumerable3', ')', ':', 'raise', 'TypeError', '(', 'u"enumerable parameter must be an instance of Enumerable"', ')', 'return', 'self', '.', 'join', '(', 'enumerabl...
Returns enumerable that is the intersection between given enumerable and self :param enumerable: enumerable object :param key: key selector as lambda expression :return: new Enumerable object
['Returns', 'enumerable', 'that', 'is', 'the', 'intersection', 'between', 'given', 'enumerable', 'and', 'self', ':', 'param', 'enumerable', ':', 'enumerable', 'object', ':', 'param', 'key', ':', 'key', 'selector', 'as', 'lambda', 'expression', ':', 'return', ':', 'new', 'Enumerable', 'object']
train
https://github.com/viralogic/py-enumerable/blob/63363649bccef223379e1e87056747240c83aa9d/py_linq/py_linq3.py#L434-L445
3,384
JukeboxPipeline/jukebox-core
src/jukeboxcore/launcher.py
Launcher.launch
def launch(self, args, unknown): """Launch something according to the provided arguments :param args: arguments from the launch parser :type args: Namespace :param unknown: list of unknown arguments :type unknown: list :returns: None :rtype: None :raises:...
python
def launch(self, args, unknown): """Launch something according to the provided arguments :param args: arguments from the launch parser :type args: Namespace :param unknown: list of unknown arguments :type unknown: list :returns: None :rtype: None :raises:...
['def', 'launch', '(', 'self', ',', 'args', ',', 'unknown', ')', ':', 'pm', '=', 'plugins', '.', 'PluginManager', '.', 'get', '(', ')', 'addon', '=', 'pm', '.', 'get_plugin', '(', 'args', '.', 'addon', ')', 'isgui', '=', 'isinstance', '(', 'addon', ',', 'plugins', '.', 'JB_StandaloneGuiPlugin', ')', 'if', 'isgui', ':',...
Launch something according to the provided arguments :param args: arguments from the launch parser :type args: Namespace :param unknown: list of unknown arguments :type unknown: list :returns: None :rtype: None :raises: SystemExit
['Launch', 'something', 'according', 'to', 'the', 'provided', 'arguments']
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/launcher.py#L83-L103
3,385
knipknap/exscript
Exscript/util/start.py
start
def start(users, hosts, func, only_authenticate=False, **kwargs): """ Like run(), but automatically logs into the host before passing the host to the callback function. :type users: Account|list[Account] :param users: The account(s) to use for logging in. :type hosts: Host|list[Host] :par...
python
def start(users, hosts, func, only_authenticate=False, **kwargs): """ Like run(), but automatically logs into the host before passing the host to the callback function. :type users: Account|list[Account] :param users: The account(s) to use for logging in. :type hosts: Host|list[Host] :par...
['def', 'start', '(', 'users', ',', 'hosts', ',', 'func', ',', 'only_authenticate', '=', 'False', ',', '*', '*', 'kwargs', ')', ':', 'if', 'only_authenticate', ':', 'run', '(', 'users', ',', 'hosts', ',', 'autoauthenticate', '(', ')', '(', 'func', ')', ',', '*', '*', 'kwargs', ')', 'else', ':', 'run', '(', 'users', ','...
Like run(), but automatically logs into the host before passing the host to the callback function. :type users: Account|list[Account] :param users: The account(s) to use for logging in. :type hosts: Host|list[Host] :param hosts: A list of Host objects. :type func: function :param func: T...
['Like', 'run', '()', 'but', 'automatically', 'logs', 'into', 'the', 'host', 'before', 'passing', 'the', 'host', 'to', 'the', 'callback', 'function', '.']
train
https://github.com/knipknap/exscript/blob/72718eee3e87b345d5a5255be9824e867e42927b/Exscript/util/start.py#L82-L101
3,386
sony/nnabla
python/src/nnabla/utils/image_utils/__init__.py
minmax_auto_scale
def minmax_auto_scale(img, as_uint16): """ Utility function for rescaling all pixel values of input image to fit the range of uint8. Rescaling method is min-max, which is all pixel values are normalized to [0, 1] by using img.min() and img.max() and then are scaled up by 255 times. If the argument `...
python
def minmax_auto_scale(img, as_uint16): """ Utility function for rescaling all pixel values of input image to fit the range of uint8. Rescaling method is min-max, which is all pixel values are normalized to [0, 1] by using img.min() and img.max() and then are scaled up by 255 times. If the argument `...
['def', 'minmax_auto_scale', '(', 'img', ',', 'as_uint16', ')', ':', 'if', 'as_uint16', ':', 'output_high', '=', '65535', 'output_type', '=', 'np', '.', 'uint16', 'else', ':', 'output_high', '=', '255', 'output_type', '=', 'np', '.', 'uint8', 'return', 'rescale_pixel_intensity', '(', 'img', ',', 'input_low', '=', 'img'...
Utility function for rescaling all pixel values of input image to fit the range of uint8. Rescaling method is min-max, which is all pixel values are normalized to [0, 1] by using img.min() and img.max() and then are scaled up by 255 times. If the argument `as_uint16` is True, output image dtype is np.uint16...
['Utility', 'function', 'for', 'rescaling', 'all', 'pixel', 'values', 'of', 'input', 'image', 'to', 'fit', 'the', 'range', 'of', 'uint8', '.', 'Rescaling', 'method', 'is', 'min', '-', 'max', 'which', 'is', 'all', 'pixel', 'values', 'are', 'normalized', 'to', '[', '0', '1', ']', 'by', 'using', 'img', '.', 'min', '()', '...
train
https://github.com/sony/nnabla/blob/aaf3d33b7cbb38f2a03aa754178ba8f7c8481320/python/src/nnabla/utils/image_utils/__init__.py#L57-L77
3,387
qba73/circleclient
circleclient/circleclient.py
Build.recent_all_projects
def recent_all_projects(self, limit=30, offset=0): """Return information about recent builds across all projects. Args: limit (int), Number of builds to return, max=100, defaults=30. offset (int): Builds returned from this point, default=0. Returns: A list o...
python
def recent_all_projects(self, limit=30, offset=0): """Return information about recent builds across all projects. Args: limit (int), Number of builds to return, max=100, defaults=30. offset (int): Builds returned from this point, default=0. Returns: A list o...
['def', 'recent_all_projects', '(', 'self', ',', 'limit', '=', '30', ',', 'offset', '=', '0', ')', ':', 'method', '=', "'GET'", 'url', '=', '(', "'/recent-builds?circle-token={token}&limit={limit}&'", "'offset={offset}'", '.', 'format', '(', 'token', '=', 'self', '.', 'client', '.', 'api_token', ',', 'limit', '=', 'lim...
Return information about recent builds across all projects. Args: limit (int), Number of builds to return, max=100, defaults=30. offset (int): Builds returned from this point, default=0. Returns: A list of dictionaries.
['Return', 'information', 'about', 'recent', 'builds', 'across', 'all', 'projects', '.']
train
https://github.com/qba73/circleclient/blob/8bf5b093e416c899cc39e43a770c17a5466487b0/circleclient/circleclient.py#L173-L189
3,388
bokeh/bokeh
bokeh/util/serialization.py
convert_datetime_array
def convert_datetime_array(array): ''' Convert NumPy datetime arrays to arrays to milliseconds since epoch. Args: array : (obj) A NumPy array of datetime to convert If the value passed in is not a NumPy array, it will be returned as-is. Returns: array ''' ...
python
def convert_datetime_array(array): ''' Convert NumPy datetime arrays to arrays to milliseconds since epoch. Args: array : (obj) A NumPy array of datetime to convert If the value passed in is not a NumPy array, it will be returned as-is. Returns: array ''' ...
['def', 'convert_datetime_array', '(', 'array', ')', ':', 'if', 'not', 'isinstance', '(', 'array', ',', 'np', '.', 'ndarray', ')', ':', 'return', 'array', 'try', ':', 'dt2001', '=', 'np', '.', 'datetime64', '(', "'2001'", ')', 'legacy_datetime64', '=', '(', 'dt2001', '.', 'astype', '(', "'int64'", ')', '==', 'dt2001', ...
Convert NumPy datetime arrays to arrays to milliseconds since epoch. Args: array : (obj) A NumPy array of datetime to convert If the value passed in is not a NumPy array, it will be returned as-is. Returns: array
['Convert', 'NumPy', 'datetime', 'arrays', 'to', 'arrays', 'to', 'milliseconds', 'since', 'epoch', '.']
train
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/serialization.py#L195-L238
3,389
golemhq/webdriver-manager
webdriver_manager/helpers.py
download_file_with_progress_bar
def download_file_with_progress_bar(url): """Downloads a file from the given url, displays a progress bar. Returns a io.BytesIO object """ request = requests.get(url, stream=True) if request.status_code == 404: msg = ('there was a 404 error trying to reach {} \nThis probably ' ...
python
def download_file_with_progress_bar(url): """Downloads a file from the given url, displays a progress bar. Returns a io.BytesIO object """ request = requests.get(url, stream=True) if request.status_code == 404: msg = ('there was a 404 error trying to reach {} \nThis probably ' ...
['def', 'download_file_with_progress_bar', '(', 'url', ')', ':', 'request', '=', 'requests', '.', 'get', '(', 'url', ',', 'stream', '=', 'True', ')', 'if', 'request', '.', 'status_code', '==', '404', ':', 'msg', '=', '(', "'there was a 404 error trying to reach {} \\nThis probably '", "'means the requested version does...
Downloads a file from the given url, displays a progress bar. Returns a io.BytesIO object
['Downloads', 'a', 'file', 'from', 'the', 'given', 'url', 'displays', 'a', 'progress', 'bar', '.', 'Returns', 'a', 'io', '.', 'BytesIO', 'object']
train
https://github.com/golemhq/webdriver-manager/blob/5c923deec5cb14f503ba7c20b67bc296e411de19/webdriver_manager/helpers.py#L106-L125
3,390
cqparts/cqparts
src/cqparts/params/utils.py
as_parameter
def as_parameter(nullable=True, strict=True): """ Decorate a container class as a functional :class:`Parameter` class for a :class:`ParametricObject`. :param nullable: if set, parameter's value may be Null :type nullable: :class:`bool` .. doctest:: >>> from cqparts.params import as_pa...
python
def as_parameter(nullable=True, strict=True): """ Decorate a container class as a functional :class:`Parameter` class for a :class:`ParametricObject`. :param nullable: if set, parameter's value may be Null :type nullable: :class:`bool` .. doctest:: >>> from cqparts.params import as_pa...
['def', 'as_parameter', '(', 'nullable', '=', 'True', ',', 'strict', '=', 'True', ')', ':', 'def', 'decorator', '(', 'cls', ')', ':', 'base_class', '=', 'Parameter', 'if', 'nullable', 'else', 'NonNullParameter', 'return', 'type', '(', 'cls', '.', '__name__', ',', '(', 'base_class', ',', ')', ',', '{', '# Preserve text ...
Decorate a container class as a functional :class:`Parameter` class for a :class:`ParametricObject`. :param nullable: if set, parameter's value may be Null :type nullable: :class:`bool` .. doctest:: >>> from cqparts.params import as_parameter, ParametricObject >>> @as_parameter(nulla...
['Decorate', 'a', 'container', 'class', 'as', 'a', 'functional', ':', 'class', ':', 'Parameter', 'class', 'for', 'a', ':', 'class', ':', 'ParametricObject', '.']
train
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/params/utils.py#L6-L54
3,391
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
ekacld
def ekacld(handle, segno, column, dvals, entszs, nlflgs, rcptrs, wkindx): """ Add an entire double precision column to an EK segment. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekacld_c.html :param handle: EK file handle. :type handle: int :param segno: Number of segment to add co...
python
def ekacld(handle, segno, column, dvals, entszs, nlflgs, rcptrs, wkindx): """ Add an entire double precision column to an EK segment. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekacld_c.html :param handle: EK file handle. :type handle: int :param segno: Number of segment to add co...
['def', 'ekacld', '(', 'handle', ',', 'segno', ',', 'column', ',', 'dvals', ',', 'entszs', ',', 'nlflgs', ',', 'rcptrs', ',', 'wkindx', ')', ':', 'handle', '=', 'ctypes', '.', 'c_int', '(', 'handle', ')', 'segno', '=', 'ctypes', '.', 'c_int', '(', 'segno', ')', 'column', '=', 'stypes', '.', 'stringToCharP', '(', 'colum...
Add an entire double precision column to an EK segment. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekacld_c.html :param handle: EK file handle. :type handle: int :param segno: Number of segment to add column to. :type segno: int :param column: Column name. :type column: str ...
['Add', 'an', 'entire', 'double', 'precision', 'column', 'to', 'an', 'EK', 'segment', '.']
train
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L3833-L3868
3,392
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_notification_stream.py
brocade_notification_stream.BGPNeighborPrefixExceeded_originator_switch_info_switchIpV6Address
def BGPNeighborPrefixExceeded_originator_switch_info_switchIpV6Address(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") BGPNeighborPrefixExceeded = ET.SubElement(config, "BGPNeighborPrefixExceeded", xmlns="http://brocade.com/ns/brocade-notification-stream") ...
python
def BGPNeighborPrefixExceeded_originator_switch_info_switchIpV6Address(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") BGPNeighborPrefixExceeded = ET.SubElement(config, "BGPNeighborPrefixExceeded", xmlns="http://brocade.com/ns/brocade-notification-stream") ...
['def', 'BGPNeighborPrefixExceeded_originator_switch_info_switchIpV6Address', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'config', '=', 'ET', '.', 'Element', '(', '"config"', ')', 'BGPNeighborPrefixExceeded', '=', 'ET', '.', 'SubElement', '(', 'config', ',', '"BGPNeighborPrefixExceeded"', ',', 'xmlns', '=', '"http...
Auto Generated Code
['Auto', 'Generated', 'Code']
train
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_notification_stream.py#L118-L128
3,393
miniconfig/python-openevse-wifi
openevsewifi/__init__.py
Charger.getAutoServiceLevelEnabled
def getAutoServiceLevelEnabled(self): """Returns True if enabled, False if disabled""" command = '$GE' settings = self.sendCommand(command) flags = int(settings[2], 16) return not (flags & 0x0020)
python
def getAutoServiceLevelEnabled(self): """Returns True if enabled, False if disabled""" command = '$GE' settings = self.sendCommand(command) flags = int(settings[2], 16) return not (flags & 0x0020)
['def', 'getAutoServiceLevelEnabled', '(', 'self', ')', ':', 'command', '=', "'$GE'", 'settings', '=', 'self', '.', 'sendCommand', '(', 'command', ')', 'flags', '=', 'int', '(', 'settings', '[', '2', ']', ',', '16', ')', 'return', 'not', '(', 'flags', '&', '0x0020', ')']
Returns True if enabled, False if disabled
['Returns', 'True', 'if', 'enabled', 'False', 'if', 'disabled']
train
https://github.com/miniconfig/python-openevse-wifi/blob/42fabeae052a9f82092fa9220201413732e38bb4/openevsewifi/__init__.py#L127-L132
3,394
dhermes/bezier
scripts/check_doc_templates.py
get_diff
def get_diff(value1, value2, name1, name2): """Get a diff between two strings. Args: value1 (str): First string to be compared. value2 (str): Second string to be compared. name1 (str): Name of the first string. name2 (str): Name of the second string. Returns: str: T...
python
def get_diff(value1, value2, name1, name2): """Get a diff between two strings. Args: value1 (str): First string to be compared. value2 (str): Second string to be compared. name1 (str): Name of the first string. name2 (str): Name of the second string. Returns: str: T...
['def', 'get_diff', '(', 'value1', ',', 'value2', ',', 'name1', ',', 'name2', ')', ':', 'lines1', '=', '[', 'line', '+', '"\\n"', 'for', 'line', 'in', 'value1', '.', 'splitlines', '(', ')', ']', 'lines2', '=', '[', 'line', '+', '"\\n"', 'for', 'line', 'in', 'value2', '.', 'splitlines', '(', ')', ']', 'diff_lines', '=',...
Get a diff between two strings. Args: value1 (str): First string to be compared. value2 (str): Second string to be compared. name1 (str): Name of the first string. name2 (str): Name of the second string. Returns: str: The full diff.
['Get', 'a', 'diff', 'between', 'two', 'strings', '.']
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/scripts/check_doc_templates.py#L245-L262
3,395
mitsei/dlkit
dlkit/services/repository.py
Repository.use_sequestered_composition_view
def use_sequestered_composition_view(self): """Pass through to provider CompositionLookupSession.use_sequestered_composition_view""" self._containable_views['composition'] = SEQUESTERED # self._get_provider_session('composition_lookup_session') # To make sure the session is tracked for ...
python
def use_sequestered_composition_view(self): """Pass through to provider CompositionLookupSession.use_sequestered_composition_view""" self._containable_views['composition'] = SEQUESTERED # self._get_provider_session('composition_lookup_session') # To make sure the session is tracked for ...
['def', 'use_sequestered_composition_view', '(', 'self', ')', ':', 'self', '.', '_containable_views', '[', "'composition'", ']', '=', 'SEQUESTERED', "# self._get_provider_session('composition_lookup_session') # To make sure the session is tracked", 'for', 'session', 'in', 'self', '.', '_get_provider_sessions', '(', ')...
Pass through to provider CompositionLookupSession.use_sequestered_composition_view
['Pass', 'through', 'to', 'provider', 'CompositionLookupSession', '.', 'use_sequestered_composition_view']
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/repository.py#L1902-L1910
3,396
adamrehn/ue4cli
ue4cli/JsonDataManager.py
JsonDataManager.setDictionary
def setDictionary(self, data): """ Overwrites the entire dictionary """ # Create the directory containing the JSON file if it doesn't already exist jsonDir = os.path.dirname(self.jsonFile) if os.path.exists(jsonDir) == False: os.makedirs(jsonDir) # Store the dictionary Utility.writeFile(self.js...
python
def setDictionary(self, data): """ Overwrites the entire dictionary """ # Create the directory containing the JSON file if it doesn't already exist jsonDir = os.path.dirname(self.jsonFile) if os.path.exists(jsonDir) == False: os.makedirs(jsonDir) # Store the dictionary Utility.writeFile(self.js...
['def', 'setDictionary', '(', 'self', ',', 'data', ')', ':', "# Create the directory containing the JSON file if it doesn't already exist", 'jsonDir', '=', 'os', '.', 'path', '.', 'dirname', '(', 'self', '.', 'jsonFile', ')', 'if', 'os', '.', 'path', '.', 'exists', '(', 'jsonDir', ')', '==', 'False', ':', 'os', '.', 'm...
Overwrites the entire dictionary
['Overwrites', 'the', 'entire', 'dictionary']
train
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/JsonDataManager.py#L42-L53
3,397
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/thread.py
_ThreadContainer.scan_threads
def scan_threads(self): """ Populates the snapshot with running threads. """ # Ignore special process IDs. # PID 0: System Idle Process. Also has a special meaning to the # toolhelp APIs (current process). # PID 4: System Integrity Group. See this forum po...
python
def scan_threads(self): """ Populates the snapshot with running threads. """ # Ignore special process IDs. # PID 0: System Idle Process. Also has a special meaning to the # toolhelp APIs (current process). # PID 4: System Integrity Group. See this forum po...
['def', 'scan_threads', '(', 'self', ')', ':', '# Ignore special process IDs.', '# PID 0: System Idle Process. Also has a special meaning to the', '# toolhelp APIs (current process).', '# PID 4: System Integrity Group. See this forum post for more info:', '# http://tinyurl.com/ycza8jo', '# (points ...
Populates the snapshot with running threads.
['Populates', 'the', 'snapshot', 'with', 'running', 'threads', '.']
train
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/thread.py#L1927-L1965
3,398
happyleavesaoc/python-snapcast
snapcast/control/group.py
Snapgroup.add_client
def add_client(self, client_identifier): """Add a client.""" if client_identifier in self.clients: _LOGGER.error('%s already in group %s', client_identifier, self.identifier) return new_clients = self.clients new_clients.append(client_identifier) yield fro...
python
def add_client(self, client_identifier): """Add a client.""" if client_identifier in self.clients: _LOGGER.error('%s already in group %s', client_identifier, self.identifier) return new_clients = self.clients new_clients.append(client_identifier) yield fro...
['def', 'add_client', '(', 'self', ',', 'client_identifier', ')', ':', 'if', 'client_identifier', 'in', 'self', '.', 'clients', ':', '_LOGGER', '.', 'error', '(', "'%s already in group %s'", ',', 'client_identifier', ',', 'self', '.', 'identifier', ')', 'return', 'new_clients', '=', 'self', '.', 'clients', 'new_clients...
Add a client.
['Add', 'a', 'client', '.']
train
https://github.com/happyleavesaoc/python-snapcast/blob/9b3c483358677327c7fd6d0666bf474c19d87f19/snapcast/control/group.py#L96-L106
3,399
sampottinger/pycotracer
pycotracer/retrieval.py
get_report_raw
def get_report_raw(year, report_type): """Download and extract a CO-TRACER report. Generate a URL for the given report, download the corresponding archive, extract the CSV report, and interpret it using the standard CSV library. @param year: The year for which data should be downloaded. @type year...
python
def get_report_raw(year, report_type): """Download and extract a CO-TRACER report. Generate a URL for the given report, download the corresponding archive, extract the CSV report, and interpret it using the standard CSV library. @param year: The year for which data should be downloaded. @type year...
['def', 'get_report_raw', '(', 'year', ',', 'report_type', ')', ':', 'if', 'not', 'is_valid_report_type', '(', 'report_type', ')', ':', 'msg', '=', "'%s is not a valid report type.'", '%', 'report_type', 'raise', 'ValueError', '(', 'msg', ')', 'url', '=', 'get_url', '(', 'year', ',', 'report_type', ')', 'raw_contents',...
Download and extract a CO-TRACER report. Generate a URL for the given report, download the corresponding archive, extract the CSV report, and interpret it using the standard CSV library. @param year: The year for which data should be downloaded. @type year: int @param report_type: The type of repo...
['Download', 'and', 'extract', 'a', 'CO', '-', 'TRACER', 'report', '.']
train
https://github.com/sampottinger/pycotracer/blob/c66c3230949b7bee8c9fec5fc00ab392865a0c8b/pycotracer/retrieval.py#L90-L112