Unnamed: 0
int64
0
10k
repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
5
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
100
30.3k
language
stringclasses
1 value
func_code_string
stringlengths
100
30.3k
func_code_tokens
stringlengths
138
33.2k
func_documentation_string
stringlengths
1
15k
func_documentation_tokens
stringlengths
5
5.14k
split_name
stringclasses
1 value
func_code_url
stringlengths
91
315
1,300
hectane/python-hectane
pyhectane/connection.py
Connection.send
def send(self, from_, to, subject, text='', html='', cc=[], bcc=[], headers={}, attachments=[]): """ Send an email. """ if isinstance(to, string_types): raise TypeError('"to" parameter must be enumerable') if text == '' and html == '': raise V...
python
def send(self, from_, to, subject, text='', html='', cc=[], bcc=[], headers={}, attachments=[]): """ Send an email. """ if isinstance(to, string_types): raise TypeError('"to" parameter must be enumerable') if text == '' and html == '': raise V...
['def', 'send', '(', 'self', ',', 'from_', ',', 'to', ',', 'subject', ',', 'text', '=', "''", ',', 'html', '=', "''", ',', 'cc', '=', '[', ']', ',', 'bcc', '=', '[', ']', ',', 'headers', '=', '{', '}', ',', 'attachments', '=', '[', ']', ')', ':', 'if', 'isinstance', '(', 'to', ',', 'string_types', ')', ':', 'raise', 'T...
Send an email.
['Send', 'an', 'email', '.']
train
https://github.com/hectane/python-hectane/blob/e0fe1df576f776566e813f71782f8adf60146383/pyhectane/connection.py#L64-L83
1,301
raphaelvallat/pingouin
pingouin/plotting.py
plot_paired
def plot_paired(data=None, dv=None, within=None, subject=None, order=None, boxplot=True, figsize=(4, 4), dpi=100, ax=None, colors=['green', 'grey', 'indianred'], pointplot_kwargs={'scale': .6, 'markers': '.'}, boxplot_kwargs={'color': 'lightslategrey', 'wi...
python
def plot_paired(data=None, dv=None, within=None, subject=None, order=None, boxplot=True, figsize=(4, 4), dpi=100, ax=None, colors=['green', 'grey', 'indianred'], pointplot_kwargs={'scale': .6, 'markers': '.'}, boxplot_kwargs={'color': 'lightslategrey', 'wi...
['def', 'plot_paired', '(', 'data', '=', 'None', ',', 'dv', '=', 'None', ',', 'within', '=', 'None', ',', 'subject', '=', 'None', ',', 'order', '=', 'None', ',', 'boxplot', '=', 'True', ',', 'figsize', '=', '(', '4', ',', '4', ')', ',', 'dpi', '=', '100', ',', 'ax', '=', 'None', ',', 'colors', '=', '[', "'green'", ',',...
Paired plot. Parameters ---------- data : pandas DataFrame Long-format dataFrame. dv : string Name of column containing the dependant variable. within : string Name of column containing the within-subject factor. Note that ``within`` must have exactly two within-subj...
['Paired', 'plot', '.']
train
https://github.com/raphaelvallat/pingouin/blob/58b19fa4fffbfe09d58b456e3926a148249e4d9b/pingouin/plotting.py#L489-L617
1,302
buguroo/pyknow
pyknow/matchers/rete/abstract.py
TwoInputNode.activate_right
def activate_right(self, token): """Make a copy of the received token and call `_activate_right`.""" watchers.MATCHER.debug( "Node <%s> activated right with token %r", self, token) return self._activate_right(token.copy())
python
def activate_right(self, token): """Make a copy of the received token and call `_activate_right`.""" watchers.MATCHER.debug( "Node <%s> activated right with token %r", self, token) return self._activate_right(token.copy())
['def', 'activate_right', '(', 'self', ',', 'token', ')', ':', 'watchers', '.', 'MATCHER', '.', 'debug', '(', '"Node <%s> activated right with token %r"', ',', 'self', ',', 'token', ')', 'return', 'self', '.', '_activate_right', '(', 'token', '.', 'copy', '(', ')', ')']
Make a copy of the received token and call `_activate_right`.
['Make', 'a', 'copy', 'of', 'the', 'received', 'token', 'and', 'call', '_activate_right', '.']
train
https://github.com/buguroo/pyknow/blob/48818336f2e9a126f1964f2d8dc22d37ff800fe8/pyknow/matchers/rete/abstract.py#L68-L72
1,303
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
dskstl
def dskstl(keywrd, dpval): """ Set the value of a specified DSK tolerance or margin parameter. https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dskstl_c.html :param keywrd: Code specifying parameter to set. :type keywrd: int :param dpval: Value of parameter. :type dpval: f...
python
def dskstl(keywrd, dpval): """ Set the value of a specified DSK tolerance or margin parameter. https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dskstl_c.html :param keywrd: Code specifying parameter to set. :type keywrd: int :param dpval: Value of parameter. :type dpval: f...
['def', 'dskstl', '(', 'keywrd', ',', 'dpval', ')', ':', 'keywrd', '=', 'ctypes', '.', 'c_int', '(', 'keywrd', ')', 'dpval', '=', 'ctypes', '.', 'c_double', '(', 'dpval', ')', 'libspice', '.', 'dskstl_c', '(', 'keywrd', ',', 'dpval', ')']
Set the value of a specified DSK tolerance or margin parameter. https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dskstl_c.html :param keywrd: Code specifying parameter to set. :type keywrd: int :param dpval: Value of parameter. :type dpval: float :return:
['Set', 'the', 'value', 'of', 'a', 'specified', 'DSK', 'tolerance', 'or', 'margin', 'parameter', '.', 'https', ':', '//', 'naif', '.', 'jpl', '.', 'nasa', '.', 'gov', '/', 'pub', '/', 'naif', '/', 'toolkit_docs', '/', 'C', '/', 'cspice', '/', 'dskstl_c', '.', 'html', ':', 'param', 'keywrd', ':', 'Code', 'specifying', '...
train
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L3164-L3178
1,304
ssato/python-anyconfig
src/anyconfig/backend/xml.py
container_to_etree
def container_to_etree(obj, parent=None, to_str=None, **options): """ Convert a dict-like object to XML ElementTree. :param obj: Container instance to convert to :param parent: XML ElementTree parent node object or None :param to_str: Callable to convert value to string or None :param options: ...
python
def container_to_etree(obj, parent=None, to_str=None, **options): """ Convert a dict-like object to XML ElementTree. :param obj: Container instance to convert to :param parent: XML ElementTree parent node object or None :param to_str: Callable to convert value to string or None :param options: ...
['def', 'container_to_etree', '(', 'obj', ',', 'parent', '=', 'None', ',', 'to_str', '=', 'None', ',', '*', '*', 'options', ')', ':', 'if', 'to_str', 'is', 'None', ':', 'to_str', '=', '_to_str_fn', '(', '*', '*', 'options', ')', 'if', 'not', 'anyconfig', '.', 'utils', '.', 'is_dict_like', '(', 'obj', ')', ':', 'if', 'p...
Convert a dict-like object to XML ElementTree. :param obj: Container instance to convert to :param parent: XML ElementTree parent node object or None :param to_str: Callable to convert value to string or None :param options: Keyword options, - tags: Dict of tags for special nodes to keep XML i...
['Convert', 'a', 'dict', '-', 'like', 'object', 'to', 'XML', 'ElementTree', '.']
train
https://github.com/ssato/python-anyconfig/blob/f2f4fb8d8e232aadea866c202e1dd7a5967e2877/src/anyconfig/backend/xml.py#L410-L445
1,305
coin-or/GiMPy
src/gimpy/graph.py
Graph.set_node_attr
def set_node_attr(self, name, attr, value): ''' API: set_node_attr(self, name, attr) Description: Sets attr attribute of node named name to value. Input: name: Name of node. attr: Attribute of node to set. Pre: Graph should have this no...
python
def set_node_attr(self, name, attr, value): ''' API: set_node_attr(self, name, attr) Description: Sets attr attribute of node named name to value. Input: name: Name of node. attr: Attribute of node to set. Pre: Graph should have this no...
['def', 'set_node_attr', '(', 'self', ',', 'name', ',', 'attr', ',', 'value', ')', ':', 'self', '.', 'get_node', '(', 'name', ')', '.', 'set_attr', '(', 'attr', ',', 'value', ')']
API: set_node_attr(self, name, attr) Description: Sets attr attribute of node named name to value. Input: name: Name of node. attr: Attribute of node to set. Pre: Graph should have this node. Post: Node attribute will be updated.
['API', ':', 'set_node_attr', '(', 'self', 'name', 'attr', ')', 'Description', ':', 'Sets', 'attr', 'attribute', 'of', 'node', 'named', 'name', 'to', 'value', '.', 'Input', ':', 'name', ':', 'Name', 'of', 'node', '.', 'attr', ':', 'Attribute', 'of', 'node', 'to', 'set', '.', 'Pre', ':', 'Graph', 'should', 'have', 'this...
train
https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L523-L536
1,306
praekeltfoundation/molo
molo/core/api/importers.py
ContentImporter.recreate_article_body
def recreate_article_body(self): ''' Handles case where article body contained page or image. Assumes all articles and images have been created. ''' for foreign_id, body in iteritems(self.record_keeper.article_bodies): try: local_page_id = self.record...
python
def recreate_article_body(self): ''' Handles case where article body contained page or image. Assumes all articles and images have been created. ''' for foreign_id, body in iteritems(self.record_keeper.article_bodies): try: local_page_id = self.record...
['def', 'recreate_article_body', '(', 'self', ')', ':', 'for', 'foreign_id', ',', 'body', 'in', 'iteritems', '(', 'self', '.', 'record_keeper', '.', 'article_bodies', ')', ':', 'try', ':', 'local_page_id', '=', 'self', '.', 'record_keeper', '.', 'get_local_page', '(', 'foreign_id', ')', 'page', '=', 'Page', '.', 'objec...
Handles case where article body contained page or image. Assumes all articles and images have been created.
['Handles', 'case', 'where', 'article', 'body', 'contained', 'page', 'or', 'image', '.']
train
https://github.com/praekeltfoundation/molo/blob/57702fda4fab261d67591415f7d46bc98fa38525/molo/core/api/importers.py#L718-L755
1,307
jobovy/galpy
galpy/df/diskdf.py
surfacemass
def surfacemass(self,R,romberg=False,nsigma=None,relative=False): """ NAME: surfacemass PURPOSE: calculate the surface-mass at R by marginalizing over velocity INPUT: R - radius at which to calculate the surfacemass density (can be Quantity) ...
python
def surfacemass(self,R,romberg=False,nsigma=None,relative=False): """ NAME: surfacemass PURPOSE: calculate the surface-mass at R by marginalizing over velocity INPUT: R - radius at which to calculate the surfacemass density (can be Quantity) ...
['def', 'surfacemass', '(', 'self', ',', 'R', ',', 'romberg', '=', 'False', ',', 'nsigma', '=', 'None', ',', 'relative', '=', 'False', ')', ':', 'if', 'nsigma', '==', 'None', ':', 'nsigma', '=', '_NSIGMA', 'logSigmaR', '=', 'self', '.', 'targetSurfacemass', '(', 'R', ',', 'log', '=', 'True', ',', 'use_physical', '=', '...
NAME: surfacemass PURPOSE: calculate the surface-mass at R by marginalizing over velocity INPUT: R - radius at which to calculate the surfacemass density (can be Quantity) OPTIONAL INPUT: nsigma - number of sigma to integrate the velocities over...
['NAME', ':']
train
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/df/diskdf.py#L664-L725
1,308
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/msvs.py
msvs_parse_version
def msvs_parse_version(s): """ Split a Visual Studio version, which may in fact be something like '7.0Exp', into is version number (returned as a float) and trailing "suite" portion. """ num, suite = version_re.match(s).groups() return float(num), suite
python
def msvs_parse_version(s): """ Split a Visual Studio version, which may in fact be something like '7.0Exp', into is version number (returned as a float) and trailing "suite" portion. """ num, suite = version_re.match(s).groups() return float(num), suite
['def', 'msvs_parse_version', '(', 's', ')', ':', 'num', ',', 'suite', '=', 'version_re', '.', 'match', '(', 's', ')', '.', 'groups', '(', ')', 'return', 'float', '(', 'num', ')', ',', 'suite']
Split a Visual Studio version, which may in fact be something like '7.0Exp', into is version number (returned as a float) and trailing "suite" portion.
['Split', 'a', 'Visual', 'Studio', 'version', 'which', 'may', 'in', 'fact', 'be', 'something', 'like', '7', '.', '0Exp', 'into', 'is', 'version', 'number', '(', 'returned', 'as', 'a', 'float', ')', 'and', 'trailing', 'suite', 'portion', '.']
train
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/msvs.py#L97-L104
1,309
linode/linode_api4-python
linode_api4/objects/tag.py
Tag._get_raw_objects
def _get_raw_objects(self): """ Helper function to populate the first page of raw objects for this tag. This has the side effect of creating the ``_raw_objects`` attribute of this object. """ if not hasattr(self, '_raw_objects'): result = self._client.get(type...
python
def _get_raw_objects(self): """ Helper function to populate the first page of raw objects for this tag. This has the side effect of creating the ``_raw_objects`` attribute of this object. """ if not hasattr(self, '_raw_objects'): result = self._client.get(type...
['def', '_get_raw_objects', '(', 'self', ')', ':', 'if', 'not', 'hasattr', '(', 'self', ',', "'_raw_objects'", ')', ':', 'result', '=', 'self', '.', '_client', '.', 'get', '(', 'type', '(', 'self', ')', '.', 'api_endpoint', ',', 'model', '=', 'self', ')', "# I want to cache this to avoid making duplicate requests, but ...
Helper function to populate the first page of raw objects for this tag. This has the side effect of creating the ``_raw_objects`` attribute of this object.
['Helper', 'function', 'to', 'populate', 'the', 'first', 'page', 'of', 'raw', 'objects', 'for', 'this', 'tag', '.', 'This', 'has', 'the', 'side', 'effect', 'of', 'creating', 'the', '_raw_objects', 'attribute', 'of', 'this', 'object', '.']
train
https://github.com/linode/linode_api4-python/blob/1dd7318d2aed014c746d48c7957464c57af883ca/linode_api4/objects/tag.py#L32-L45
1,310
marazmiki/django-ulogin
django_ulogin/views.py
PostBackView.handle_authenticated_user
def handle_authenticated_user(self, response): """ Handles the ULogin response if user is already authenticated """ current_user = get_user(self.request) ulogin, registered = ULoginUser.objects.get_or_create( uid=response['uid'], network=response[...
python
def handle_authenticated_user(self, response): """ Handles the ULogin response if user is already authenticated """ current_user = get_user(self.request) ulogin, registered = ULoginUser.objects.get_or_create( uid=response['uid'], network=response[...
['def', 'handle_authenticated_user', '(', 'self', ',', 'response', ')', ':', 'current_user', '=', 'get_user', '(', 'self', '.', 'request', ')', 'ulogin', ',', 'registered', '=', 'ULoginUser', '.', 'objects', '.', 'get_or_create', '(', 'uid', '=', 'response', '[', "'uid'", ']', ',', 'network', '=', 'response', '[', "'ne...
Handles the ULogin response if user is already authenticated
['Handles', 'the', 'ULogin', 'response', 'if', 'user', 'is', 'already', 'authenticated']
train
https://github.com/marazmiki/django-ulogin/blob/f41ad4b4ca130ad8af25be72ad882c8cf94a80dc/django_ulogin/views.py#L82-L107
1,311
bfontaine/term2048
term2048/ui.py
parse_cli_args
def parse_cli_args(): """parse args from the CLI and return a dict""" parser = argparse.ArgumentParser(description='2048 in your terminal') parser.add_argument('--mode', dest='mode', type=str, default=None, help='colors mode (dark or light)') parser.add_argument('--az', dest='azm...
python
def parse_cli_args(): """parse args from the CLI and return a dict""" parser = argparse.ArgumentParser(description='2048 in your terminal') parser.add_argument('--mode', dest='mode', type=str, default=None, help='colors mode (dark or light)') parser.add_argument('--az', dest='azm...
['def', 'parse_cli_args', '(', ')', ':', 'parser', '=', 'argparse', '.', 'ArgumentParser', '(', 'description', '=', "'2048 in your terminal'", ')', 'parser', '.', 'add_argument', '(', "'--mode'", ',', 'dest', '=', "'mode'", ',', 'type', '=', 'str', ',', 'default', '=', 'None', ',', 'help', '=', "'colors mode (dark or l...
parse args from the CLI and return a dict
['parse', 'args', 'from', 'the', 'CLI', 'and', 'return', 'a', 'dict']
train
https://github.com/bfontaine/term2048/blob/8b5ce8b65f44f20a7ad36022a34dce56184070af/term2048/ui.py#L30-L41
1,312
pecan/pecan
pecan/commands/serve.py
ServeCommand.serve
def serve(self, app, conf): """ A very simple approach for a WSGI server. """ if self.args.reload: try: self.watch_and_spawn(conf) except ImportError: print('The `--reload` option requires `watchdog` to be ' '...
python
def serve(self, app, conf): """ A very simple approach for a WSGI server. """ if self.args.reload: try: self.watch_and_spawn(conf) except ImportError: print('The `--reload` option requires `watchdog` to be ' '...
['def', 'serve', '(', 'self', ',', 'app', ',', 'conf', ')', ':', 'if', 'self', '.', 'args', '.', 'reload', ':', 'try', ':', 'self', '.', 'watch_and_spawn', '(', 'conf', ')', 'except', 'ImportError', ':', 'print', '(', "'The `--reload` option requires `watchdog` to be '", "'installed.'", ')', 'print', '(', "' $ pip in...
A very simple approach for a WSGI server.
['A', 'very', 'simple', 'approach', 'for', 'a', 'WSGI', 'server', '.']
train
https://github.com/pecan/pecan/blob/833d0653fa0e6bbfb52545b091c30182105f4a82/pecan/commands/serve.py#L139-L152
1,313
clld/pycdstar
src/pycdstar/commands.py
c_metadata
def c_metadata(api, args, verbose=False): """ Set or get metadata associated with an object:: usage: cdstar metadata <URL> [<JSON>] <JSON> Path to metadata in JSON, or JSON literal. """ obj = api.get_object(args['<URL>'].split('/')[-1]) if not set_metadata(args['<JSON>'], obj): return jso...
python
def c_metadata(api, args, verbose=False): """ Set or get metadata associated with an object:: usage: cdstar metadata <URL> [<JSON>] <JSON> Path to metadata in JSON, or JSON literal. """ obj = api.get_object(args['<URL>'].split('/')[-1]) if not set_metadata(args['<JSON>'], obj): return jso...
['def', 'c_metadata', '(', 'api', ',', 'args', ',', 'verbose', '=', 'False', ')', ':', 'obj', '=', 'api', '.', 'get_object', '(', 'args', '[', "'<URL>'", ']', '.', 'split', '(', "'/'", ')', '[', '-', '1', ']', ')', 'if', 'not', 'set_metadata', '(', 'args', '[', "'<JSON>'", ']', ',', 'obj', ')', ':', 'return', 'json', '...
Set or get metadata associated with an object:: usage: cdstar metadata <URL> [<JSON>] <JSON> Path to metadata in JSON, or JSON literal.
['Set', 'or', 'get', 'metadata', 'associated', 'with', 'an', 'object', '::']
train
https://github.com/clld/pycdstar/blob/1a225b472c4e6bf9b8078fa3198f939395c53d22/src/pycdstar/commands.py#L24-L34
1,314
TissueMAPS/TmDeploy
tmdeploy/config.py
CloudSection.key_file_public
def key_file_public(self): '''str: path to the public key that will be uploaded to the cloud provider (by default looks for a ``.pub`` file with name :attr:`key_name <tmdeploy.config.CloudSection.key_name>` in ``~/.ssh`` directory) ''' if not hasattr(self, '_key_file_publ...
python
def key_file_public(self): '''str: path to the public key that will be uploaded to the cloud provider (by default looks for a ``.pub`` file with name :attr:`key_name <tmdeploy.config.CloudSection.key_name>` in ``~/.ssh`` directory) ''' if not hasattr(self, '_key_file_publ...
['def', 'key_file_public', '(', 'self', ')', ':', 'if', 'not', 'hasattr', '(', 'self', ',', "'_key_file_public'", ')', ':', 'self', '.', 'key_file_public', '=', "'~/.ssh/{key}.pub'", '.', 'format', '(', 'key', '=', 'self', '.', 'key_name', ')', 'return', 'self', '.', '_key_file_public']
str: path to the public key that will be uploaded to the cloud provider (by default looks for a ``.pub`` file with name :attr:`key_name <tmdeploy.config.CloudSection.key_name>` in ``~/.ssh`` directory)
['str', ':', 'path', 'to', 'the', 'public', 'key', 'that', 'will', 'be', 'uploaded', 'to', 'the', 'cloud', 'provider', '(', 'by', 'default', 'looks', 'for', 'a', '.', 'pub', 'file', 'with', 'name', ':', 'attr', ':', 'key_name', '<tmdeploy', '.', 'config', '.', 'CloudSection', '.', 'key_name', '>', 'in', '~', '/', '.', ...
train
https://github.com/TissueMAPS/TmDeploy/blob/f891b4ffb21431988bc4a063ae871da3bf284a45/tmdeploy/config.py#L310-L318
1,315
log2timeline/dfvfs
dfvfs/file_io/gzip_file_io.py
GzipFile.read
def read(self, size=None): """Reads a byte string from the gzip file at the current offset. The function will read a byte string up to the specified size or all of the remaining data if no size was specified. Args: size (Optional[int]): number of bytes to read, where None is all remain...
python
def read(self, size=None): """Reads a byte string from the gzip file at the current offset. The function will read a byte string up to the specified size or all of the remaining data if no size was specified. Args: size (Optional[int]): number of bytes to read, where None is all remain...
['def', 'read', '(', 'self', ',', 'size', '=', 'None', ')', ':', 'data', '=', "b''", 'while', '(', '(', 'size', 'and', 'len', '(', 'data', ')', '<', 'size', ')', 'and', 'self', '.', '_current_offset', '<', 'self', '.', 'uncompressed_data_size', ')', ':', 'member', '=', 'self', '.', '_GetMemberForOffset', '(', 'self', '...
Reads a byte string from the gzip file at the current offset. The function will read a byte string up to the specified size or all of the remaining data if no size was specified. Args: size (Optional[int]): number of bytes to read, where None is all remaining data. Returns: byte...
['Reads', 'a', 'byte', 'string', 'from', 'the', 'gzip', 'file', 'at', 'the', 'current', 'offset', '.']
train
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/file_io/gzip_file_io.py#L117-L144
1,316
Esri/ArcREST
src/arcrest/manageags/administration.py
AGSAdministration.services
def services(self): """ Gets the services object which will provide the ArcGIS Server's admin information about services and folders. """ if self._resources is None: self.__init() if "services" in self._resources: url = self._url + "/services" ...
python
def services(self): """ Gets the services object which will provide the ArcGIS Server's admin information about services and folders. """ if self._resources is None: self.__init() if "services" in self._resources: url = self._url + "/services" ...
['def', 'services', '(', 'self', ')', ':', 'if', 'self', '.', '_resources', 'is', 'None', ':', 'self', '.', '__init', '(', ')', 'if', '"services"', 'in', 'self', '.', '_resources', ':', 'url', '=', 'self', '.', '_url', '+', '"/services"', 'return', '_services', '.', 'Services', '(', 'url', '=', 'url', ',', 'securityHan...
Gets the services object which will provide the ArcGIS Server's admin information about services and folders.
['Gets', 'the', 'services', 'object', 'which', 'will', 'provide', 'the', 'ArcGIS', 'Server', 's', 'admin', 'information', 'about', 'services', 'and', 'folders', '.']
train
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/administration.py#L382-L397
1,317
saltstack/salt
salt/netapi/__init__.py
NetapiClient.ssh
def ssh(self, *args, **kwargs): ''' Run salt-ssh commands synchronously Wraps :py:meth:`salt.client.ssh.client.SSHClient.cmd_sync`. :return: Returns the result from the salt-ssh command ''' ssh_client = salt.client.ssh.client.SSHClient(mopts=self.opts, ...
python
def ssh(self, *args, **kwargs): ''' Run salt-ssh commands synchronously Wraps :py:meth:`salt.client.ssh.client.SSHClient.cmd_sync`. :return: Returns the result from the salt-ssh command ''' ssh_client = salt.client.ssh.client.SSHClient(mopts=self.opts, ...
['def', 'ssh', '(', 'self', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'ssh_client', '=', 'salt', '.', 'client', '.', 'ssh', '.', 'client', '.', 'SSHClient', '(', 'mopts', '=', 'self', '.', 'opts', ',', 'disable_custom_roster', '=', 'True', ')', 'return', 'ssh_client', '.', 'cmd_sync', '(', 'kwargs', ')']
Run salt-ssh commands synchronously Wraps :py:meth:`salt.client.ssh.client.SSHClient.cmd_sync`. :return: Returns the result from the salt-ssh command
['Run', 'salt', '-', 'ssh', 'commands', 'synchronously']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/__init__.py#L136-L146
1,318
boriel/zxbasic
zxbparser.py
p_let_arr_substr_in_args3
def p_let_arr_substr_in_args3(p): """ statement : LET ARRAY_ID LP arguments COMMA TO RP EQ expr | ARRAY_ID LP arguments COMMA TO RP EQ expr """ i = 2 if p[1].upper() == 'LET' else 1 id_ = p[i] arg_list = p[i + 2] substr = (make_number(0, lineno=p.lineno(i + 4)), ...
python
def p_let_arr_substr_in_args3(p): """ statement : LET ARRAY_ID LP arguments COMMA TO RP EQ expr | ARRAY_ID LP arguments COMMA TO RP EQ expr """ i = 2 if p[1].upper() == 'LET' else 1 id_ = p[i] arg_list = p[i + 2] substr = (make_number(0, lineno=p.lineno(i + 4)), ...
['def', 'p_let_arr_substr_in_args3', '(', 'p', ')', ':', 'i', '=', '2', 'if', 'p', '[', '1', ']', '.', 'upper', '(', ')', '==', "'LET'", 'else', '1', 'id_', '=', 'p', '[', 'i', ']', 'arg_list', '=', 'p', '[', 'i', '+', '2', ']', 'substr', '=', '(', 'make_number', '(', '0', ',', 'lineno', '=', 'p', '.', 'lineno', '(', '...
statement : LET ARRAY_ID LP arguments COMMA TO RP EQ expr | ARRAY_ID LP arguments COMMA TO RP EQ expr
['statement', ':', 'LET', 'ARRAY_ID', 'LP', 'arguments', 'COMMA', 'TO', 'RP', 'EQ', 'expr', '|', 'ARRAY_ID', 'LP', 'arguments', 'COMMA', 'TO', 'RP', 'EQ', 'expr']
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L2646-L2657
1,319
andycasey/sick
sick/models/model.py
Model.infer
def infer(self, data, initial_proposal=None, full_output=False,**kwargs): """ Infer the model parameters, given the data. auto_convergence=True, walkers=100, burn=2000, sample=2000, minimum_sample=2000, convergence_check_frequency=1000, a=2.0, threads=1, """ # ...
python
def infer(self, data, initial_proposal=None, full_output=False,**kwargs): """ Infer the model parameters, given the data. auto_convergence=True, walkers=100, burn=2000, sample=2000, minimum_sample=2000, convergence_check_frequency=1000, a=2.0, threads=1, """ # ...
['def', 'infer', '(', 'self', ',', 'data', ',', 'initial_proposal', '=', 'None', ',', 'full_output', '=', 'False', ',', '*', '*', 'kwargs', ')', ':', "# Apply data masks now so we don't have to do it on the fly.", 'data', ',', 'pixels_affected', '=', 'self', '.', '_apply_data_mask', '(', 'data', ')', '# Any channels / ...
Infer the model parameters, given the data. auto_convergence=True, walkers=100, burn=2000, sample=2000, minimum_sample=2000, convergence_check_frequency=1000, a=2.0, threads=1,
['Infer', 'the', 'model', 'parameters', 'given', 'the', 'data', '.', 'auto_convergence', '=', 'True', 'walkers', '=', '100', 'burn', '=', '2000', 'sample', '=', '2000', 'minimum_sample', '=', '2000', 'convergence_check_frequency', '=', '1000', 'a', '=', '2', '.', '0', 'threads', '=', '1']
train
https://github.com/andycasey/sick/blob/6c37686182794c4cafea45abf7062b30b789b1a2/sick/models/model.py#L261-L578
1,320
saltstack/salt
salt/daemons/masterapi.py
access_keys
def access_keys(opts): ''' A key needs to be placed in the filesystem with permissions 0400 so clients are required to run as root. ''' # TODO: Need a way to get all available users for systems not supported by pwd module. # For now users pattern matching will not work for publisher_acl. ...
python
def access_keys(opts): ''' A key needs to be placed in the filesystem with permissions 0400 so clients are required to run as root. ''' # TODO: Need a way to get all available users for systems not supported by pwd module. # For now users pattern matching will not work for publisher_acl. ...
['def', 'access_keys', '(', 'opts', ')', ':', '# TODO: Need a way to get all available users for systems not supported by pwd module.', '# For now users pattern matching will not work for publisher_acl.', 'keys', '=', '{', '}', 'publisher_acl', '=', 'opts', '[', "'publisher_acl'", ']', 'acl_users', '=', 'set', '(...
A key needs to be placed in the filesystem with permissions 0400 so clients are required to run as root.
['A', 'key', 'needs', 'to', 'be', 'placed', 'in', 'the', 'filesystem', 'with', 'permissions', '0400', 'so', 'clients', 'are', 'required', 'to', 'run', 'as', 'root', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/masterapi.py#L259-L287
1,321
molmod/molmod
molmod/graphs.py
EqualPattern.compare
def compare(self, vertex0, vertex1, subject_graph): """Returns true when the two vertices are of the same kind""" return ( self.pattern_graph.vertex_fingerprints[vertex0] == subject_graph.vertex_fingerprints[vertex1] ).all()
python
def compare(self, vertex0, vertex1, subject_graph): """Returns true when the two vertices are of the same kind""" return ( self.pattern_graph.vertex_fingerprints[vertex0] == subject_graph.vertex_fingerprints[vertex1] ).all()
['def', 'compare', '(', 'self', ',', 'vertex0', ',', 'vertex1', ',', 'subject_graph', ')', ':', 'return', '(', 'self', '.', 'pattern_graph', '.', 'vertex_fingerprints', '[', 'vertex0', ']', '==', 'subject_graph', '.', 'vertex_fingerprints', '[', 'vertex1', ']', ')', '.', 'all', '(', ')']
Returns true when the two vertices are of the same kind
['Returns', 'true', 'when', 'the', 'two', 'vertices', 'are', 'of', 'the', 'same', 'kind']
train
https://github.com/molmod/molmod/blob/a7b5b4364ed514ad4c465856c05b5eda1cb561e0/molmod/graphs.py#L1402-L1407
1,322
tonybaloney/wily
wily/operators/__init__.py
resolve_metric_as_tuple
def resolve_metric_as_tuple(metric): """ Resolve metric key to a given target. :param metric: the metric name. :type metric: ``str`` :rtype: :class:`Metric` """ if "." in metric: _, metric = metric.split(".") r = [ (operator, match) for operator, match in ALL_METRICS ...
python
def resolve_metric_as_tuple(metric): """ Resolve metric key to a given target. :param metric: the metric name. :type metric: ``str`` :rtype: :class:`Metric` """ if "." in metric: _, metric = metric.split(".") r = [ (operator, match) for operator, match in ALL_METRICS ...
['def', 'resolve_metric_as_tuple', '(', 'metric', ')', ':', 'if', '"."', 'in', 'metric', ':', '_', ',', 'metric', '=', 'metric', '.', 'split', '(', '"."', ')', 'r', '=', '[', '(', 'operator', ',', 'match', ')', 'for', 'operator', ',', 'match', 'in', 'ALL_METRICS', 'if', 'match', '[', '0', ']', '==', 'metric', ']', 'if'...
Resolve metric key to a given target. :param metric: the metric name. :type metric: ``str`` :rtype: :class:`Metric`
['Resolve', 'metric', 'key', 'to', 'a', 'given', 'target', '.']
train
https://github.com/tonybaloney/wily/blob/bae259354a91b57d56603f0ca7403186f086a84c/wily/operators/__init__.py#L170-L188
1,323
DLR-RM/RAFCON
source/rafcon/core/global_variable_manager.py
GlobalVariableManager.delete_variable
def delete_variable(self, key): """Deletes a global variable :param key: the key of the global variable to be deleted :raises exceptions.AttributeError: if the global variable does not exist """ key = str(key) if self.is_locked(key): raise RuntimeError("Glob...
python
def delete_variable(self, key): """Deletes a global variable :param key: the key of the global variable to be deleted :raises exceptions.AttributeError: if the global variable does not exist """ key = str(key) if self.is_locked(key): raise RuntimeError("Glob...
['def', 'delete_variable', '(', 'self', ',', 'key', ')', ':', 'key', '=', 'str', '(', 'key', ')', 'if', 'self', '.', 'is_locked', '(', 'key', ')', ':', 'raise', 'RuntimeError', '(', '"Global variable is locked"', ')', 'with', 'self', '.', '__global_lock', ':', 'if', 'key', 'in', 'self', '.', '__global_variable_dictiona...
Deletes a global variable :param key: the key of the global variable to be deleted :raises exceptions.AttributeError: if the global variable does not exist
['Deletes', 'a', 'global', 'variable']
train
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/global_variable_manager.py#L159-L179
1,324
spacetelescope/pysynphot
commissioning/extrap/extrap.py
classify_file
def classify_file(f): """Examine the column names to determine which type of file this is. Return a tuple: retvalue[0] = "file is non-parameterized" retvalue[1] = "file contains error column" """ cols=f[1].columns if len(cols) == 2: #Then we must have a simple file return (Tr...
python
def classify_file(f): """Examine the column names to determine which type of file this is. Return a tuple: retvalue[0] = "file is non-parameterized" retvalue[1] = "file contains error column" """ cols=f[1].columns if len(cols) == 2: #Then we must have a simple file return (Tr...
['def', 'classify_file', '(', 'f', ')', ':', 'cols', '=', 'f', '[', '1', ']', '.', 'columns', 'if', 'len', '(', 'cols', ')', '==', '2', ':', '#Then we must have a simple file', 'return', '(', 'True', ',', 'False', ')', 'elif', 'len', '(', 'cols', ')', '==', '3', 'and', '(', "'ERROR'", 'in', 'cols', '.', 'names', ')', '...
Examine the column names to determine which type of file this is. Return a tuple: retvalue[0] = "file is non-parameterized" retvalue[1] = "file contains error column"
['Examine', 'the', 'column', 'names', 'to', 'determine', 'which', 'type', 'of', 'file', 'this', 'is', '.', 'Return', 'a', 'tuple', ':', 'retvalue', '[', '0', ']', '=', 'file', 'is', 'non', '-', 'parameterized', 'retvalue', '[', '1', ']', '=', 'file', 'contains', 'error', 'column']
train
https://github.com/spacetelescope/pysynphot/blob/a125ff956f4d94beb157bd51899747a13234bb97/commissioning/extrap/extrap.py#L22-L37
1,325
pyvisa/pyvisa
pyvisa/shell.py
VisaShell.do_open
def do_open(self, args): """Open resource by number, resource name or alias: open 3""" if not args: print('A resource name must be specified.') return if self.current: print('You can only open one resource at a time. Please close the current one first.') ...
python
def do_open(self, args): """Open resource by number, resource name or alias: open 3""" if not args: print('A resource name must be specified.') return if self.current: print('You can only open one resource at a time. Please close the current one first.') ...
['def', 'do_open', '(', 'self', ',', 'args', ')', ':', 'if', 'not', 'args', ':', 'print', '(', "'A resource name must be specified.'", ')', 'return', 'if', 'self', '.', 'current', ':', 'print', '(', "'You can only open one resource at a time. Please close the current one first.'", ')', 'return', 'if', 'args', '.', 'isd...
Open resource by number, resource name or alias: open 3
['Open', 'resource', 'by', 'number', 'resource', 'name', 'or', 'alias', ':', 'open', '3']
train
https://github.com/pyvisa/pyvisa/blob/b8b2d4371e1f00782856aa9176ff1ced6bcb3798/pyvisa/shell.py#L138-L171
1,326
Telefonica/toolium
toolium/driver_wrapper.py
DriverWrapper.configure_visual_baseline
def configure_visual_baseline(self): """Configure baseline directory""" # Get baseline name baseline_name = self.config.get_optional('VisualTests', 'baseline_name', '{Driver_type}') for section in self.config.sections(): for option in self.config.options(section): ...
python
def configure_visual_baseline(self): """Configure baseline directory""" # Get baseline name baseline_name = self.config.get_optional('VisualTests', 'baseline_name', '{Driver_type}') for section in self.config.sections(): for option in self.config.options(section): ...
['def', 'configure_visual_baseline', '(', 'self', ')', ':', '# Get baseline name', 'baseline_name', '=', 'self', '.', 'config', '.', 'get_optional', '(', "'VisualTests'", ',', "'baseline_name'", ',', "'{Driver_type}'", ')', 'for', 'section', 'in', 'self', '.', 'config', '.', 'sections', '(', ')', ':', 'for', 'option', ...
Configure baseline directory
['Configure', 'baseline', 'directory']
train
https://github.com/Telefonica/toolium/blob/56847c243b3a98876df74c184b75e43f8810e475/toolium/driver_wrapper.py#L133-L146
1,327
saltstack/salt
salt/states/zk_concurrency.py
lock
def lock(name, zk_hosts=None, identifier=None, max_concurrency=1, timeout=None, ephemeral_lease=False, profile=None, scheme=None, username=None, password=None, default_acl=None): ''' Block state execution until you are abl...
python
def lock(name, zk_hosts=None, identifier=None, max_concurrency=1, timeout=None, ephemeral_lease=False, profile=None, scheme=None, username=None, password=None, default_acl=None): ''' Block state execution until you are abl...
['def', 'lock', '(', 'name', ',', 'zk_hosts', '=', 'None', ',', 'identifier', '=', 'None', ',', 'max_concurrency', '=', '1', ',', 'timeout', '=', 'None', ',', 'ephemeral_lease', '=', 'False', ',', 'profile', '=', 'None', ',', 'scheme', '=', 'None', ',', 'username', '=', 'None', ',', 'password', '=', 'None', ',', 'defau...
Block state execution until you are able to get the lock (or hit the timeout)
['Block', 'state', 'execution', 'until', 'you', 'are', 'able', 'to', 'get', 'the', 'lock', '(', 'or', 'hit', 'the', 'timeout', ')']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zk_concurrency.py#L69-L112
1,328
trevisanj/a99
a99/gui/a_WConfigEditor.py
WConfigEditor._update_fobj
def _update_fobj(self): """Updates fobj from GUI. Opposite of _update_gui().""" # print("PPPPPPPPPPPPPPPPPPPRINTANDO O STACK") # traceback.print_stack() emsg, flag_error = "", False fieldname = None try: self._before_update_fobj() ...
python
def _update_fobj(self): """Updates fobj from GUI. Opposite of _update_gui().""" # print("PPPPPPPPPPPPPPPPPPPRINTANDO O STACK") # traceback.print_stack() emsg, flag_error = "", False fieldname = None try: self._before_update_fobj() ...
['def', '_update_fobj', '(', 'self', ')', ':', '# print("PPPPPPPPPPPPPPPPPPPRINTANDO O STACK")\r', '# traceback.print_stack()\r', 'emsg', ',', 'flag_error', '=', '""', ',', 'False', 'fieldname', '=', 'None', 'try', ':', 'self', '.', '_before_update_fobj', '(', ')', 'for', 'item', 'in', 'self', '.', '_map', ':', 'self',...
Updates fobj from GUI. Opposite of _update_gui().
['Updates', 'fobj', 'from', 'GUI', '.', 'Opposite', 'of', '_update_gui', '()', '.']
train
https://github.com/trevisanj/a99/blob/193e6e3c9b3e4f4a0ba7eb3eece846fe7045c539/a99/gui/a_WConfigEditor.py#L119-L146
1,329
bukun/TorCMS
torcms/model/post_model.py
MPost.query_most_pic
def query_most_pic(num, kind='1'): ''' Query most pics. ''' return TabPost.select().where( (TabPost.kind == kind) & (TabPost.logo != "") ).order_by(TabPost.view_count.desc()).limit(num)
python
def query_most_pic(num, kind='1'): ''' Query most pics. ''' return TabPost.select().where( (TabPost.kind == kind) & (TabPost.logo != "") ).order_by(TabPost.view_count.desc()).limit(num)
['def', 'query_most_pic', '(', 'num', ',', 'kind', '=', "'1'", ')', ':', 'return', 'TabPost', '.', 'select', '(', ')', '.', 'where', '(', '(', 'TabPost', '.', 'kind', '==', 'kind', ')', '&', '(', 'TabPost', '.', 'logo', '!=', '""', ')', ')', '.', 'order_by', '(', 'TabPost', '.', 'view_count', '.', 'desc', '(', ')', ')'...
Query most pics.
['Query', 'most', 'pics', '.']
train
https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L352-L358
1,330
molmod/molmod
molmod/graphs.py
Graph.full_match
def full_match(self, other): """Find the mapping between vertex indexes in self and other. This also works on disconnected graphs. Derived classes should just implement get_vertex_string and get_edge_string to make this method aware of the different nature of certain vertices. ...
python
def full_match(self, other): """Find the mapping between vertex indexes in self and other. This also works on disconnected graphs. Derived classes should just implement get_vertex_string and get_edge_string to make this method aware of the different nature of certain vertices. ...
['def', 'full_match', '(', 'self', ',', 'other', ')', ':', '# we need normalize subgraphs because these graphs are used as patterns.', 'graphs0', '=', '[', 'self', '.', 'get_subgraph', '(', 'group', ',', 'normalize', '=', 'True', ')', 'for', 'group', 'in', 'self', '.', 'independent_vertices', ']', 'graphs1', '=', '[', ...
Find the mapping between vertex indexes in self and other. This also works on disconnected graphs. Derived classes should just implement get_vertex_string and get_edge_string to make this method aware of the different nature of certain vertices. In case molecules, this would...
['Find', 'the', 'mapping', 'between', 'vertex', 'indexes', 'in', 'self', 'and', 'other', '.']
train
https://github.com/molmod/molmod/blob/a7b5b4364ed514ad4c465856c05b5eda1cb561e0/molmod/graphs.py#L782-L828
1,331
openego/eDisGo
edisgo/grid/network.py
Results.save
def save(self, directory, parameters='all'): """ Saves results to disk. Depending on which results are selected and if they exist, the following directories and files are created: * `powerflow_results` directory * `voltages_pu.csv` See :py:attr:`~pfa_v_m...
python
def save(self, directory, parameters='all'): """ Saves results to disk. Depending on which results are selected and if they exist, the following directories and files are created: * `powerflow_results` directory * `voltages_pu.csv` See :py:attr:`~pfa_v_m...
['def', 'save', '(', 'self', ',', 'directory', ',', 'parameters', '=', "'all'", ')', ':', 'def', '_save_power_flow_results', '(', 'target_dir', ')', ':', 'if', 'self', '.', 'pfa_v_mag_pu', 'is', 'not', 'None', ':', '# create directory', 'os', '.', 'makedirs', '(', 'target_dir', ',', 'exist_ok', '=', 'True', ')', '# vol...
Saves results to disk. Depending on which results are selected and if they exist, the following directories and files are created: * `powerflow_results` directory * `voltages_pu.csv` See :py:attr:`~pfa_v_mag_pu` for more information. * `currents.csv` ...
['Saves', 'results', 'to', 'disk', '.']
train
https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/network.py#L2996-L3209
1,332
SKA-ScienceDataProcessor/integration-prototype
sip/tango_control/tango_master/app/sdp_master_device.py
SDPMasterDevice._get_service_state
def _get_service_state(service_id: str): """Get the Service state object for the specified id.""" LOG.debug('Getting state of service %s', service_id) services = get_service_id_list() service_ids = [s for s in services if service_id in s] if len(service_ids) != 1: ret...
python
def _get_service_state(service_id: str): """Get the Service state object for the specified id.""" LOG.debug('Getting state of service %s', service_id) services = get_service_id_list() service_ids = [s for s in services if service_id in s] if len(service_ids) != 1: ret...
['def', '_get_service_state', '(', 'service_id', ':', 'str', ')', ':', 'LOG', '.', 'debug', '(', "'Getting state of service %s'", ',', 'service_id', ')', 'services', '=', 'get_service_id_list', '(', ')', 'service_ids', '=', '[', 's', 'for', 's', 'in', 'services', 'if', 'service_id', 'in', 's', ']', 'if', 'len', '(', 's...
Get the Service state object for the specified id.
['Get', 'the', 'Service', 'state', 'object', 'for', 'the', 'specified', 'id', '.']
train
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_master/app/sdp_master_device.py#L118-L126
1,333
python-rope/rope
rope/base/history.py
History.do
def do(self, changes, task_handle=taskhandle.NullTaskHandle()): """Perform the change and add it to the `self.undo_list` Note that uninteresting changes (changes to ignored files) will not be appended to `self.undo_list`. """ try: self.current_change = changes ...
python
def do(self, changes, task_handle=taskhandle.NullTaskHandle()): """Perform the change and add it to the `self.undo_list` Note that uninteresting changes (changes to ignored files) will not be appended to `self.undo_list`. """ try: self.current_change = changes ...
['def', 'do', '(', 'self', ',', 'changes', ',', 'task_handle', '=', 'taskhandle', '.', 'NullTaskHandle', '(', ')', ')', ':', 'try', ':', 'self', '.', 'current_change', '=', 'changes', 'changes', '.', 'do', '(', 'change', '.', 'create_job_set', '(', 'task_handle', ',', 'changes', ')', ')', 'finally', ':', 'self', '.', '...
Perform the change and add it to the `self.undo_list` Note that uninteresting changes (changes to ignored files) will not be appended to `self.undo_list`.
['Perform', 'the', 'change', 'and', 'add', 'it', 'to', 'the', 'self', '.', 'undo_list']
train
https://github.com/python-rope/rope/blob/1c9f9cd5964b099a99a9111e998f0dc728860688/rope/base/history.py#L27-L42
1,334
glitchassassin/lackey
lackey/RegionMatching.py
Region.stopObserver
def stopObserver(self): """ Stops this region's observer loop. If this is running in a subprocess, the subprocess will end automatically. """ self._observer.isStopped = True self._observer.isRunning = False
python
def stopObserver(self): """ Stops this region's observer loop. If this is running in a subprocess, the subprocess will end automatically. """ self._observer.isStopped = True self._observer.isRunning = False
['def', 'stopObserver', '(', 'self', ')', ':', 'self', '.', '_observer', '.', 'isStopped', '=', 'True', 'self', '.', '_observer', '.', 'isRunning', '=', 'False']
Stops this region's observer loop. If this is running in a subprocess, the subprocess will end automatically.
['Stops', 'this', 'region', 's', 'observer', 'loop', '.']
train
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1486-L1492
1,335
EUDAT-B2SAFE/B2HANDLE
b2handle/utilhandle.py
create_authentication_string
def create_authentication_string(username, password): ''' Creates an authentication string from the username and password. :username: Username. :password: Password. :return: The encoded string. ''' username_utf8 = username.encode('utf-8') userpw_utf8 = password.encode('utf-8') user...
python
def create_authentication_string(username, password): ''' Creates an authentication string from the username and password. :username: Username. :password: Password. :return: The encoded string. ''' username_utf8 = username.encode('utf-8') userpw_utf8 = password.encode('utf-8') user...
['def', 'create_authentication_string', '(', 'username', ',', 'password', ')', ':', 'username_utf8', '=', 'username', '.', 'encode', '(', "'utf-8'", ')', 'userpw_utf8', '=', 'password', '.', 'encode', '(', "'utf-8'", ')', 'username_perc', '=', 'quote', '(', 'username_utf8', ')', 'userpw_perc', '=', 'quote', '(', 'userp...
Creates an authentication string from the username and password. :username: Username. :password: Password. :return: The encoded string.
['Creates', 'an', 'authentication', 'string', 'from', 'the', 'username', 'and', 'password', '.']
train
https://github.com/EUDAT-B2SAFE/B2HANDLE/blob/a6d216d459644e01fbdfd5b318a535950bc5cdbb/b2handle/utilhandle.py#L102-L118
1,336
brechtm/rinohtype
src/rinoh/hyphenator.py
Hyph_dict.positions
def positions(self, word): """ Returns a list of positions where the word can be hyphenated. E.g. for the dutch word 'lettergrepen' this method returns the list [3, 6, 9]. Each position is a 'data int' (dint) with a data attribute. If the data attribute is not None, it c...
python
def positions(self, word): """ Returns a list of positions where the word can be hyphenated. E.g. for the dutch word 'lettergrepen' this method returns the list [3, 6, 9]. Each position is a 'data int' (dint) with a data attribute. If the data attribute is not None, it c...
['def', 'positions', '(', 'self', ',', 'word', ')', ':', 'word', '=', 'word', '.', 'lower', '(', ')', 'points', '=', 'self', '.', 'cache', '.', 'get', '(', 'word', ')', 'if', 'points', 'is', 'None', ':', 'prepWord', '=', "'.%s.'", '%', 'word', 'res', '=', '[', '0', ']', '*', '(', 'len', '(', 'prepWord', ')', '+', '1', ...
Returns a list of positions where the word can be hyphenated. E.g. for the dutch word 'lettergrepen' this method returns the list [3, 6, 9]. Each position is a 'data int' (dint) with a data attribute. If the data attribute is not None, it contains a tuple with information about ...
['Returns', 'a', 'list', 'of', 'positions', 'where', 'the', 'word', 'can', 'be', 'hyphenated', '.', 'E', '.', 'g', '.', 'for', 'the', 'dutch', 'word', 'lettergrepen', 'this', 'method', 'returns', 'the', 'list', '[', '3', '6', '9', ']', '.']
train
https://github.com/brechtm/rinohtype/blob/40a63c4e5ad7550f62b6860f1812cb67cafb9dc7/src/rinoh/hyphenator.py#L114-L147
1,337
ensime/ensime-vim
ensime_shared/ticker.py
Ticker._start_refresh_timer
def _start_refresh_timer(self): """Start the Vim timer. """ if not self._timer: self._timer = self._vim.eval( "timer_start({}, 'EnTick', {{'repeat': -1}})" .format(REFRESH_TIMER) )
python
def _start_refresh_timer(self): """Start the Vim timer. """ if not self._timer: self._timer = self._vim.eval( "timer_start({}, 'EnTick', {{'repeat': -1}})" .format(REFRESH_TIMER) )
['def', '_start_refresh_timer', '(', 'self', ')', ':', 'if', 'not', 'self', '.', '_timer', ':', 'self', '.', '_timer', '=', 'self', '.', '_vim', '.', 'eval', '(', '"timer_start({}, \'EnTick\', {{\'repeat\': -1}})"', '.', 'format', '(', 'REFRESH_TIMER', ')', ')']
Start the Vim timer.
['Start', 'the', 'Vim', 'timer', '.']
train
https://github.com/ensime/ensime-vim/blob/caa734e84f002b25446c615706283a74edd4ecfe/ensime_shared/ticker.py#L30-L36
1,338
arviz-devs/arviz
arviz/stats/stats.py
loo
def loo(data, pointwise=False, reff=None, scale="deviance"): """Pareto-smoothed importance sampling leave-one-out cross-validation. Calculates leave-one-out (LOO) cross-validation for out of sample predictive model fit, following Vehtari et al. (2017). Cross-validation is computed using Pareto-smoothed ...
python
def loo(data, pointwise=False, reff=None, scale="deviance"): """Pareto-smoothed importance sampling leave-one-out cross-validation. Calculates leave-one-out (LOO) cross-validation for out of sample predictive model fit, following Vehtari et al. (2017). Cross-validation is computed using Pareto-smoothed ...
['def', 'loo', '(', 'data', ',', 'pointwise', '=', 'False', ',', 'reff', '=', 'None', ',', 'scale', '=', '"deviance"', ')', ':', 'inference_data', '=', 'convert_to_inference_data', '(', 'data', ')', 'for', 'group', 'in', '(', '"posterior"', ',', '"sample_stats"', ')', ':', 'if', 'not', 'hasattr', '(', 'inference_data',...
Pareto-smoothed importance sampling leave-one-out cross-validation. Calculates leave-one-out (LOO) cross-validation for out of sample predictive model fit, following Vehtari et al. (2017). Cross-validation is computed using Pareto-smoothed importance sampling (PSIS). Parameters ---------- data...
['Pareto', '-', 'smoothed', 'importance', 'sampling', 'leave', '-', 'one', '-', 'out', 'cross', '-', 'validation', '.']
train
https://github.com/arviz-devs/arviz/blob/d04d8da07f029fd2931f48d2f7f324cf393e5277/arviz/stats/stats.py#L387-L490
1,339
codelv/enaml-native
src/enamlnative/widgets/scroll_view.py
ScrollView._update_proxy
def _update_proxy(self, change): """ An observer which sends the state change to the proxy. """ if change['type'] in ['event', 'update'] and self.proxy_is_active: handler = getattr(self.proxy, 'set_' + change['name'], None) if handler is not None: handler...
python
def _update_proxy(self, change): """ An observer which sends the state change to the proxy. """ if change['type'] in ['event', 'update'] and self.proxy_is_active: handler = getattr(self.proxy, 'set_' + change['name'], None) if handler is not None: handler...
['def', '_update_proxy', '(', 'self', ',', 'change', ')', ':', 'if', 'change', '[', "'type'", ']', 'in', '[', "'event'", ',', "'update'", ']', 'and', 'self', '.', 'proxy_is_active', ':', 'handler', '=', 'getattr', '(', 'self', '.', 'proxy', ',', "'set_'", '+', 'change', '[', "'name'", ']', ',', 'None', ')', 'if', 'hand...
An observer which sends the state change to the proxy.
['An', 'observer', 'which', 'sends', 'the', 'state', 'change', 'to', 'the', 'proxy', '.']
train
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/widgets/scroll_view.py#L65-L72
1,340
kislyuk/aegea
aegea/packages/github3/repos/hook.py
Hook.edit
def edit(self, config={}, events=[], add_events=[], rm_events=[], active=True): """Edit this hook. :param dict config: (optional), key-value pairs of settings for this hook :param list events: (optional), which events should this be triggered for :pa...
python
def edit(self, config={}, events=[], add_events=[], rm_events=[], active=True): """Edit this hook. :param dict config: (optional), key-value pairs of settings for this hook :param list events: (optional), which events should this be triggered for :pa...
['def', 'edit', '(', 'self', ',', 'config', '=', '{', '}', ',', 'events', '=', '[', ']', ',', 'add_events', '=', '[', ']', ',', 'rm_events', '=', '[', ']', ',', 'active', '=', 'True', ')', ':', 'data', '=', '{', "'config'", ':', 'config', ',', "'active'", ':', 'active', '}', 'if', 'events', ':', 'data', '[', "'events'"...
Edit this hook. :param dict config: (optional), key-value pairs of settings for this hook :param list events: (optional), which events should this be triggered for :param list add_events: (optional), events to be added to the list of events that this hook trig...
['Edit', 'this', 'hook', '.']
train
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/hook.py#L65-L96
1,341
coghost/izen
izen/chaos.py
RsaPub.rsa_base64_encrypt
def rsa_base64_encrypt(self, plain, b64=True): """ 使用公钥加密 ``可见数据`` - 由于rsa公钥加密相对耗时, 多用来 ``加密数据量小`` 的数据 .. note:: 1. 使用aes加密数据 2. 然后rsa用来加密aes加密数据时使用的key :param plain: :type plain: :param b64: :type b64: :return: ...
python
def rsa_base64_encrypt(self, plain, b64=True): """ 使用公钥加密 ``可见数据`` - 由于rsa公钥加密相对耗时, 多用来 ``加密数据量小`` 的数据 .. note:: 1. 使用aes加密数据 2. 然后rsa用来加密aes加密数据时使用的key :param plain: :type plain: :param b64: :type b64: :return: ...
['def', 'rsa_base64_encrypt', '(', 'self', ',', 'plain', ',', 'b64', '=', 'True', ')', ':', 'with', 'open', '(', 'self', '.', 'key_file', ')', 'as', 'fp', ':', 'key_', '=', 'RSA', '.', 'importKey', '(', 'fp', '.', 'read', '(', ')', ')', 'plain', '=', 'helper', '.', 'to_bytes', '(', 'plain', ')', 'cipher', '=', 'PKCS1_v...
使用公钥加密 ``可见数据`` - 由于rsa公钥加密相对耗时, 多用来 ``加密数据量小`` 的数据 .. note:: 1. 使用aes加密数据 2. 然后rsa用来加密aes加密数据时使用的key :param plain: :type plain: :param b64: :type b64: :return: :rtype:
['使用公钥加密', '可见数据']
train
https://github.com/coghost/izen/blob/432db017f99dd2ba809e1ba1792145ab6510263d/izen/chaos.py#L143-L165
1,342
doconix/django-mako-plus
django_mako_plus/tags.py
django_include
def django_include(context, template_name, **kwargs): ''' Mako tag to include a Django template withing the current DMP (Mako) template. Since this is a Django template, it is search for using the Django search algorithm (instead of the DMP app-based concept). See https://docs.djangoproject.com/en/2...
python
def django_include(context, template_name, **kwargs): ''' Mako tag to include a Django template withing the current DMP (Mako) template. Since this is a Django template, it is search for using the Django search algorithm (instead of the DMP app-based concept). See https://docs.djangoproject.com/en/2...
['def', 'django_include', '(', 'context', ',', 'template_name', ',', '*', '*', 'kwargs', ')', ':', 'try', ':', 'djengine', '=', 'engines', '[', "'django'", ']', 'except', 'KeyError', 'as', 'e', ':', 'raise', 'TemplateDoesNotExist', '(', '"Django template engine not configured in settings, so template cannot be found: {...
Mako tag to include a Django template withing the current DMP (Mako) template. Since this is a Django template, it is search for using the Django search algorithm (instead of the DMP app-based concept). See https://docs.djangoproject.com/en/2.1/topics/templates/. The current context is sent to the incl...
['Mako', 'tag', 'to', 'include', 'a', 'Django', 'template', 'withing', 'the', 'current', 'DMP', '(', 'Mako', ')', 'template', '.', 'Since', 'this', 'is', 'a', 'Django', 'template', 'it', 'is', 'search', 'for', 'using', 'the', 'Django', 'search', 'algorithm', '(', 'instead', 'of', 'the', 'DMP', 'app', '-', 'based', 'con...
train
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/tags.py#L14-L33
1,343
ardydedase/pycouchbase
couchbase-python-cffi/couchbase_ffi/result.py
MultiResult._add_bad_rc
def _add_bad_rc(self, rc, result): """ Sets an error with a bad return code. Handles 'quiet' logic :param rc: The error code """ if not rc: return self.all_ok = False if rc == C.LCB_KEY_ENOENT and self._quiet: return try: ...
python
def _add_bad_rc(self, rc, result): """ Sets an error with a bad return code. Handles 'quiet' logic :param rc: The error code """ if not rc: return self.all_ok = False if rc == C.LCB_KEY_ENOENT and self._quiet: return try: ...
['def', '_add_bad_rc', '(', 'self', ',', 'rc', ',', 'result', ')', ':', 'if', 'not', 'rc', ':', 'return', 'self', '.', 'all_ok', '=', 'False', 'if', 'rc', '==', 'C', '.', 'LCB_KEY_ENOENT', 'and', 'self', '.', '_quiet', ':', 'return', 'try', ':', 'raise', 'pycbc_exc_lcb', '(', 'rc', ')', 'except', 'PyCBC', '.', 'default...
Sets an error with a bad return code. Handles 'quiet' logic :param rc: The error code
['Sets', 'an', 'error', 'with', 'a', 'bad', 'return', 'code', '.', 'Handles', 'quiet', 'logic', ':', 'param', 'rc', ':', 'The', 'error', 'code']
train
https://github.com/ardydedase/pycouchbase/blob/6f010b4d2ef41aead2366878d0cf0b1284c0db0e/couchbase-python-cffi/couchbase_ffi/result.py#L132-L150
1,344
mabuchilab/QNET
src/qnet/algebra/pattern_matching/__init__.py
Pattern.finditer
def finditer(self, expr): """Return an iterator over all matches in `expr` Iterate over all :class:`MatchDict` results of matches for any matching (sub-)expressions in `expr`. The order of the matches conforms to the equivalent matched expressions returned by :meth:`findall`. ""...
python
def finditer(self, expr): """Return an iterator over all matches in `expr` Iterate over all :class:`MatchDict` results of matches for any matching (sub-)expressions in `expr`. The order of the matches conforms to the equivalent matched expressions returned by :meth:`findall`. ""...
['def', 'finditer', '(', 'self', ',', 'expr', ')', ':', 'try', ':', 'for', 'arg', 'in', 'expr', '.', 'args', ':', 'for', 'm', 'in', 'self', '.', 'finditer', '(', 'arg', ')', ':', 'yield', 'm', 'for', 'arg', 'in', 'expr', '.', 'kwargs', '.', 'values', '(', ')', ':', 'for', 'm', 'in', 'self', '.', 'finditer', '(', 'arg',...
Return an iterator over all matches in `expr` Iterate over all :class:`MatchDict` results of matches for any matching (sub-)expressions in `expr`. The order of the matches conforms to the equivalent matched expressions returned by :meth:`findall`.
['Return', 'an', 'iterator', 'over', 'all', 'matches', 'in', 'expr']
train
https://github.com/mabuchilab/QNET/blob/cc20d26dad78691d34c67173e5cd67dcac94208a/src/qnet/algebra/pattern_matching/__init__.py#L370-L388
1,345
QUANTAXIS/QUANTAXIS
QUANTAXIS/QASetting/executor.py
execute
def execute(command, shell=None, working_dir=".", echo=False, echo_indent=0): """Execute a command on the command-line. :param str,list command: The command to run :param bool shell: Whether or not to use the shell. This is optional; if ``command`` is a basestring, shell will be set to True, otherw...
python
def execute(command, shell=None, working_dir=".", echo=False, echo_indent=0): """Execute a command on the command-line. :param str,list command: The command to run :param bool shell: Whether or not to use the shell. This is optional; if ``command`` is a basestring, shell will be set to True, otherw...
['def', 'execute', '(', 'command', ',', 'shell', '=', 'None', ',', 'working_dir', '=', '"."', ',', 'echo', '=', 'False', ',', 'echo_indent', '=', '0', ')', ':', 'if', 'shell', 'is', 'None', ':', 'shell', '=', 'True', 'if', 'isinstance', '(', 'command', ',', 'str', ')', 'else', 'False', 'p', '=', 'Popen', '(', 'command'...
Execute a command on the command-line. :param str,list command: The command to run :param bool shell: Whether or not to use the shell. This is optional; if ``command`` is a basestring, shell will be set to True, otherwise it will be false. You can override this behavior by setting this paramet...
['Execute', 'a', 'command', 'on', 'the', 'command', '-', 'line', '.', ':', 'param', 'str', 'list', 'command', ':', 'The', 'command', 'to', 'run', ':', 'param', 'bool', 'shell', ':', 'Whether', 'or', 'not', 'to', 'use', 'the', 'shell', '.', 'This', 'is', 'optional', ';', 'if', 'command', 'is', 'a', 'basestring', 'shell'...
train
https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASetting/executor.py#L33-L71
1,346
aio-libs/aiodocker
aiodocker/docker.py
Docker._query_json
async def _query_json( self, path, method="GET", *, params=None, data=None, headers=None, timeout=None ): """ A shorthand of _query() that treats the input as JSON. """ if headers is None: headers = {} headers["content-type"] = "application/json" i...
python
async def _query_json( self, path, method="GET", *, params=None, data=None, headers=None, timeout=None ): """ A shorthand of _query() that treats the input as JSON. """ if headers is None: headers = {} headers["content-type"] = "application/json" i...
['async', 'def', '_query_json', '(', 'self', ',', 'path', ',', 'method', '=', '"GET"', ',', '*', ',', 'params', '=', 'None', ',', 'data', '=', 'None', ',', 'headers', '=', 'None', ',', 'timeout', '=', 'None', ')', ':', 'if', 'headers', 'is', 'None', ':', 'headers', '=', '{', '}', 'headers', '[', '"content-type"', ']', ...
A shorthand of _query() that treats the input as JSON.
['A', 'shorthand', 'of', '_query', '()', 'that', 'treats', 'the', 'input', 'as', 'JSON', '.']
train
https://github.com/aio-libs/aiodocker/blob/88d0285ddba8e606ff684278e0a831347209189c/aiodocker/docker.py#L176-L191
1,347
asmodehn/filefinder2
filefinder2/util.py
module_for_loader
def module_for_loader(fxn): """Decorator to handle selecting the proper module for loaders. The decorated function is passed the module to use instead of the module name. The module passed in to the function is either from sys.modules if it already exists or is a new module. If the module is new, then _...
python
def module_for_loader(fxn): """Decorator to handle selecting the proper module for loaders. The decorated function is passed the module to use instead of the module name. The module passed in to the function is either from sys.modules if it already exists or is a new module. If the module is new, then _...
['def', 'module_for_loader', '(', 'fxn', ')', ':', 'warnings', '.', 'warn', '(', "'The import system now takes care of this automatically.'", ',', 'DeprecationWarning', ',', 'stacklevel', '=', '2', ')', '@', 'functools', '.', 'wraps', '(', 'fxn', ')', 'def', 'module_for_loader_wrapper', '(', 'self', ',', 'fullname', ',...
Decorator to handle selecting the proper module for loaders. The decorated function is passed the module to use instead of the module name. The module passed in to the function is either from sys.modules if it already exists or is a new module. If the module is new, then __name__ is set the first argume...
['Decorator', 'to', 'handle', 'selecting', 'the', 'proper', 'module', 'for', 'loaders', '.', 'The', 'decorated', 'function', 'is', 'passed', 'the', 'module', 'to', 'use', 'instead', 'of', 'the', 'module', 'name', '.', 'The', 'module', 'passed', 'in', 'to', 'the', 'function', 'is', 'either', 'from', 'sys', '.', 'modules...
train
https://github.com/asmodehn/filefinder2/blob/3f0b211ce11a34562e2a2160e039ae5290b68d6b/filefinder2/util.py#L169-L201
1,348
kgori/treeCl
treeCl/bootstrap.py
optimise_levenberg_marquardt
def optimise_levenberg_marquardt(x, a, c, damping=0.001, tolerance=0.001): """ Optimise value of x using levenberg-marquardt """ x_new = x x_old = x-1 # dummy value f_old = f(x_new, a, c) while np.abs(x_new - x_old).sum() > tolerance: x_old = x_new x_tmp = levenberg_marquardt...
python
def optimise_levenberg_marquardt(x, a, c, damping=0.001, tolerance=0.001): """ Optimise value of x using levenberg-marquardt """ x_new = x x_old = x-1 # dummy value f_old = f(x_new, a, c) while np.abs(x_new - x_old).sum() > tolerance: x_old = x_new x_tmp = levenberg_marquardt...
['def', 'optimise_levenberg_marquardt', '(', 'x', ',', 'a', ',', 'c', ',', 'damping', '=', '0.001', ',', 'tolerance', '=', '0.001', ')', ':', 'x_new', '=', 'x', 'x_old', '=', 'x', '-', '1', '# dummy value', 'f_old', '=', 'f', '(', 'x_new', ',', 'a', ',', 'c', ')', 'while', 'np', '.', 'abs', '(', 'x_new', '-', 'x_old', ...
Optimise value of x using levenberg-marquardt
['Optimise', 'value', 'of', 'x', 'using', 'levenberg', '-', 'marquardt']
train
https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/bootstrap.py#L143-L160
1,349
pypa/pipenv
pipenv/vendor/tomlkit/parser.py
Parser._parse_table
def _parse_table( self, parent_name=None ): # type: (Optional[str]) -> Tuple[Key, Union[Table, AoT]] """ Parses a table element. """ if self._current != "[": raise self.parse_error( InternalParserError, "_parse_table() called on non-bracket charac...
python
def _parse_table( self, parent_name=None ): # type: (Optional[str]) -> Tuple[Key, Union[Table, AoT]] """ Parses a table element. """ if self._current != "[": raise self.parse_error( InternalParserError, "_parse_table() called on non-bracket charac...
['def', '_parse_table', '(', 'self', ',', 'parent_name', '=', 'None', ')', ':', '# type: (Optional[str]) -> Tuple[Key, Union[Table, AoT]]', 'if', 'self', '.', '_current', '!=', '"["', ':', 'raise', 'self', '.', 'parse_error', '(', 'InternalParserError', ',', '"_parse_table() called on non-bracket character."', ')', 'in...
Parses a table element.
['Parses', 'a', 'table', 'element', '.']
train
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/tomlkit/parser.py#L855-L1005
1,350
bigchaindb/bigchaindb-driver
bigchaindb_driver/common/transaction.py
Transaction.inputs_valid
def inputs_valid(self, outputs=None): """Validates the Inputs in the Transaction against given Outputs. Note: Given a `CREATE` Transaction is passed, dummy values for Outputs are submitted for validation that evaluate parts of the validation-c...
python
def inputs_valid(self, outputs=None): """Validates the Inputs in the Transaction against given Outputs. Note: Given a `CREATE` Transaction is passed, dummy values for Outputs are submitted for validation that evaluate parts of the validation-c...
['def', 'inputs_valid', '(', 'self', ',', 'outputs', '=', 'None', ')', ':', 'if', 'self', '.', 'operation', '==', 'Transaction', '.', 'CREATE', ':', '# NOTE: Since in the case of a `CREATE`-transaction we do not have', "# to check for outputs, we're just submitting dummy", "# values to the actual method. Th...
Validates the Inputs in the Transaction against given Outputs. Note: Given a `CREATE` Transaction is passed, dummy values for Outputs are submitted for validation that evaluate parts of the validation-checks to `True`. Args: ...
['Validates', 'the', 'Inputs', 'in', 'the', 'Transaction', 'against', 'given', 'Outputs', '.']
train
https://github.com/bigchaindb/bigchaindb-driver/blob/c294a535f0696bd19483ae11a4882b74e6fc061e/bigchaindb_driver/common/transaction.py#L945-L975
1,351
tensorflow/cleverhans
examples/multigpu_advtrain/make_model.py
make_basic_ngpu
def make_basic_ngpu(nb_classes=10, input_shape=(None, 28, 28, 1), **kwargs): """ Create a multi-GPU model similar to the basic cnn in the tutorials. """ model = make_basic_cnn() layers = model.layers model = MLPnGPU(nb_classes, layers, input_shape) return model
python
def make_basic_ngpu(nb_classes=10, input_shape=(None, 28, 28, 1), **kwargs): """ Create a multi-GPU model similar to the basic cnn in the tutorials. """ model = make_basic_cnn() layers = model.layers model = MLPnGPU(nb_classes, layers, input_shape) return model
['def', 'make_basic_ngpu', '(', 'nb_classes', '=', '10', ',', 'input_shape', '=', '(', 'None', ',', '28', ',', '28', ',', '1', ')', ',', '*', '*', 'kwargs', ')', ':', 'model', '=', 'make_basic_cnn', '(', ')', 'layers', '=', 'model', '.', 'layers', 'model', '=', 'MLPnGPU', '(', 'nb_classes', ',', 'layers', ',', 'input_s...
Create a multi-GPU model similar to the basic cnn in the tutorials.
['Create', 'a', 'multi', '-', 'GPU', 'model', 'similar', 'to', 'the', 'basic', 'cnn', 'in', 'the', 'tutorials', '.']
train
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/examples/multigpu_advtrain/make_model.py#L27-L35
1,352
evhub/coconut
coconut/compiler/compiler.py
Compiler.case_stmt_handle
def case_stmt_handle(self, loc, tokens): """Process case blocks.""" if len(tokens) == 2: item, cases = tokens default = None elif len(tokens) == 3: item, cases, default = tokens else: raise CoconutInternalException("invalid case tokens", to...
python
def case_stmt_handle(self, loc, tokens): """Process case blocks.""" if len(tokens) == 2: item, cases = tokens default = None elif len(tokens) == 3: item, cases, default = tokens else: raise CoconutInternalException("invalid case tokens", to...
['def', 'case_stmt_handle', '(', 'self', ',', 'loc', ',', 'tokens', ')', ':', 'if', 'len', '(', 'tokens', ')', '==', '2', ':', 'item', ',', 'cases', '=', 'tokens', 'default', '=', 'None', 'elif', 'len', '(', 'tokens', ')', '==', '3', ':', 'item', ',', 'cases', ',', 'default', '=', 'tokens', 'else', ':', 'raise', 'Cocon...
Process case blocks.
['Process', 'case', 'blocks', '.']
train
https://github.com/evhub/coconut/blob/ff97177344e7604e89a0a98a977a87ed2a56fc6d/coconut/compiler/compiler.py#L1851-L1873
1,353
tanghaibao/jcvi
jcvi/formats/posmap.py
bed
def bed(args): """ %prog bed frgscffile Convert the frgscf posmap file to bed format. """ p = OptionParser(bed.__doc__) opts, args = p.parse_args(args) if len(args) != 1: sys.exit(not p.print_help()) frgscffile, = args bedfile = frgscffile.rsplit(".", 1)[0] + ".bed" fw...
python
def bed(args): """ %prog bed frgscffile Convert the frgscf posmap file to bed format. """ p = OptionParser(bed.__doc__) opts, args = p.parse_args(args) if len(args) != 1: sys.exit(not p.print_help()) frgscffile, = args bedfile = frgscffile.rsplit(".", 1)[0] + ".bed" fw...
['def', 'bed', '(', 'args', ')', ':', 'p', '=', 'OptionParser', '(', 'bed', '.', '__doc__', ')', 'opts', ',', 'args', '=', 'p', '.', 'parse_args', '(', 'args', ')', 'if', 'len', '(', 'args', ')', '!=', '1', ':', 'sys', '.', 'exit', '(', 'not', 'p', '.', 'print_help', '(', ')', ')', 'frgscffile', ',', '=', 'args', 'bedf...
%prog bed frgscffile Convert the frgscf posmap file to bed format.
['%prog', 'bed', 'frgscffile']
train
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/formats/posmap.py#L241-L264
1,354
B2W-BIT/aiologger
aiologger/logger.py
Logger.exception
def exception( # type: ignore self, msg, *args, exc_info=True, **kwargs ) -> Task: """ Convenience method for logging an ERROR with exception information. """ return self.error(msg, *args, exc_info=exc_info, **kwargs)
python
def exception( # type: ignore self, msg, *args, exc_info=True, **kwargs ) -> Task: """ Convenience method for logging an ERROR with exception information. """ return self.error(msg, *args, exc_info=exc_info, **kwargs)
['def', 'exception', '(', '# type: ignore', 'self', ',', 'msg', ',', '*', 'args', ',', 'exc_info', '=', 'True', ',', '*', '*', 'kwargs', ')', '->', 'Task', ':', 'return', 'self', '.', 'error', '(', 'msg', ',', '*', 'args', ',', 'exc_info', '=', 'exc_info', ',', '*', '*', 'kwargs', ')']
Convenience method for logging an ERROR with exception information.
['Convenience', 'method', 'for', 'logging', 'an', 'ERROR', 'with', 'exception', 'information', '.']
train
https://github.com/B2W-BIT/aiologger/blob/0b366597a8305d5577a267305e81d5e4784cd398/aiologger/logger.py#L218-L224
1,355
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/pymongo/common.py
validate_read_preference_tags
def validate_read_preference_tags(name, value): """Parse readPreferenceTags if passed as a client kwarg. """ if not isinstance(value, list): value = [value] tag_sets = [] for tag_set in value: if tag_set == '': tag_sets.append({}) continue try: ...
python
def validate_read_preference_tags(name, value): """Parse readPreferenceTags if passed as a client kwarg. """ if not isinstance(value, list): value = [value] tag_sets = [] for tag_set in value: if tag_set == '': tag_sets.append({}) continue try: ...
['def', 'validate_read_preference_tags', '(', 'name', ',', 'value', ')', ':', 'if', 'not', 'isinstance', '(', 'value', ',', 'list', ')', ':', 'value', '=', '[', 'value', ']', 'tag_sets', '=', '[', ']', 'for', 'tag_set', 'in', 'value', ':', 'if', 'tag_set', '==', "''", ':', 'tag_sets', '.', 'append', '(', '{', '}', ')',...
Parse readPreferenceTags if passed as a client kwarg.
['Parse', 'readPreferenceTags', 'if', 'passed', 'as', 'a', 'client', 'kwarg', '.']
train
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L338-L355
1,356
dsoprea/NsqSpinner
nsq/identify.py
Identify.output_buffer_size
def output_buffer_size(self, output_buffer_size_b): """output_buffer_size (nsqd 0.2.21+) the size in bytes of the buffer nsqd will use when writing to this client. Valid range: 64 <= output_buffer_size <= configured_max (-1 disables output buffering) --max-output-buffer-size ...
python
def output_buffer_size(self, output_buffer_size_b): """output_buffer_size (nsqd 0.2.21+) the size in bytes of the buffer nsqd will use when writing to this client. Valid range: 64 <= output_buffer_size <= configured_max (-1 disables output buffering) --max-output-buffer-size ...
['def', 'output_buffer_size', '(', 'self', ',', 'output_buffer_size_b', ')', ':', 'assert', 'issubclass', '(', 'output_buffer_size_b', '.', '__class__', ',', 'int', ')', 'return', 'self', '.', '__push', '(', "'output_buffer_size'", ',', 'output_buffer_size_b', ')']
output_buffer_size (nsqd 0.2.21+) the size in bytes of the buffer nsqd will use when writing to this client. Valid range: 64 <= output_buffer_size <= configured_max (-1 disables output buffering) --max-output-buffer-size (nsqd flag) controls the max Defaults to 16kb
['output_buffer_size', '(', 'nsqd', '0', '.', '2', '.', '21', '+', ')', 'the', 'size', 'in', 'bytes', 'of', 'the', 'buffer', 'nsqd', 'will', 'use', 'when', 'writing', 'to', 'this', 'client', '.']
train
https://github.com/dsoprea/NsqSpinner/blob/972237b8ddce737983bfed001fde52e5236be695/nsq/identify.py#L118-L132
1,357
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
ResourceClient.patch
def patch(self, id_or_uri, operation, path, value, timeout=-1, custom_headers=None): """ Uses the PATCH to update a resource. Only one operation can be performed in each PATCH call. Args: id_or_uri: Can be either the resource ID or the resource URI. operation: P...
python
def patch(self, id_or_uri, operation, path, value, timeout=-1, custom_headers=None): """ Uses the PATCH to update a resource. Only one operation can be performed in each PATCH call. Args: id_or_uri: Can be either the resource ID or the resource URI. operation: P...
['def', 'patch', '(', 'self', ',', 'id_or_uri', ',', 'operation', ',', 'path', ',', 'value', ',', 'timeout', '=', '-', '1', ',', 'custom_headers', '=', 'None', ')', ':', 'patch_request_body', '=', '[', '{', "'op'", ':', 'operation', ',', "'path'", ':', 'path', ',', "'value'", ':', 'value', '}', ']', 'return', 'self', '...
Uses the PATCH to update a resource. Only one operation can be performed in each PATCH call. Args: id_or_uri: Can be either the resource ID or the resource URI. operation: Patch operation path: Path value: Value timeout: Timeout in seconds. W...
['Uses', 'the', 'PATCH', 'to', 'update', 'a', 'resource', '.']
train
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L1403-L1425
1,358
wroberts/fsed
fsed/fsed.py
detect_pattern_format
def detect_pattern_format(pattern_filename, encoding, on_word_boundaries): ''' Automatically detects the pattern file format, and determines whether the Aho-Corasick string matching should pay attention to word boundaries or not. Arguments: - `pattern_filename`: - `encoding`: - `on_word...
python
def detect_pattern_format(pattern_filename, encoding, on_word_boundaries): ''' Automatically detects the pattern file format, and determines whether the Aho-Corasick string matching should pay attention to word boundaries or not. Arguments: - `pattern_filename`: - `encoding`: - `on_word...
['def', 'detect_pattern_format', '(', 'pattern_filename', ',', 'encoding', ',', 'on_word_boundaries', ')', ':', 'tsv', '=', 'True', 'boundaries', '=', 'on_word_boundaries', 'with', 'open_file', '(', 'pattern_filename', ')', 'as', 'input_file', ':', 'for', 'line', 'in', 'input_file', ':', 'line', '=', 'line', '.', 'deco...
Automatically detects the pattern file format, and determines whether the Aho-Corasick string matching should pay attention to word boundaries or not. Arguments: - `pattern_filename`: - `encoding`: - `on_word_boundaries`:
['Automatically', 'detects', 'the', 'pattern', 'file', 'format', 'and', 'determines', 'whether', 'the', 'Aho', '-', 'Corasick', 'string', 'matching', 'should', 'pay', 'attention', 'to', 'word', 'boundaries', 'or', 'not', '.']
train
https://github.com/wroberts/fsed/blob/c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2/fsed/fsed.py#L43-L65
1,359
GNS3/gns3-server
gns3server/compute/dynamips/nodes/ethernet_hub.py
EthernetHub.start_capture
def start_capture(self, port_number, output_file, data_link_type="DLT_EN10MB"): """ Starts a packet capture. :param port_number: allocated port number :param output_file: PCAP destination file for the capture :param data_link_type: PCAP data link type (DLT_*), default is DLT_EN1...
python
def start_capture(self, port_number, output_file, data_link_type="DLT_EN10MB"): """ Starts a packet capture. :param port_number: allocated port number :param output_file: PCAP destination file for the capture :param data_link_type: PCAP data link type (DLT_*), default is DLT_EN1...
['def', 'start_capture', '(', 'self', ',', 'port_number', ',', 'output_file', ',', 'data_link_type', '=', '"DLT_EN10MB"', ')', ':', 'if', 'port_number', 'not', 'in', 'self', '.', '_mappings', ':', 'raise', 'DynamipsError', '(', '"Port {} is not allocated"', '.', 'format', '(', 'port_number', ')', ')', 'nio', '=', 'self...
Starts a packet capture. :param port_number: allocated port number :param output_file: PCAP destination file for the capture :param data_link_type: PCAP data link type (DLT_*), default is DLT_EN10MB
['Starts', 'a', 'packet', 'capture', '.']
train
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/ethernet_hub.py#L186-L212
1,360
StorjOld/heartbeat
heartbeat/util.py
KeyedPRF.eval
def eval(self, x): """This method returns the evaluation of the function with input x :param x: this is the input as a Long """ aes = AES.new(self.key, AES.MODE_CFB, "\0" * AES.block_size) while True: nonce = 0 data = KeyedPRF.pad(SHA256.new(str(x + nonce...
python
def eval(self, x): """This method returns the evaluation of the function with input x :param x: this is the input as a Long """ aes = AES.new(self.key, AES.MODE_CFB, "\0" * AES.block_size) while True: nonce = 0 data = KeyedPRF.pad(SHA256.new(str(x + nonce...
['def', 'eval', '(', 'self', ',', 'x', ')', ':', 'aes', '=', 'AES', '.', 'new', '(', 'self', '.', 'key', ',', 'AES', '.', 'MODE_CFB', ',', '"\\0"', '*', 'AES', '.', 'block_size', ')', 'while', 'True', ':', 'nonce', '=', '0', 'data', '=', 'KeyedPRF', '.', 'pad', '(', 'SHA256', '.', 'new', '(', 'str', '(', 'x', '+', 'non...
This method returns the evaluation of the function with input x :param x: this is the input as a Long
['This', 'method', 'returns', 'the', 'evaluation', 'of', 'the', 'function', 'with', 'input', 'x']
train
https://github.com/StorjOld/heartbeat/blob/4d54f2011f1e9f688073d4347bc51bb7bd682718/heartbeat/util.py#L83-L96
1,361
openid/python-openid
openid/extensions/draft/pape2.py
Response.parseExtensionArgs
def parseExtensionArgs(self, args, strict=False): """Parse the provider authentication policy arguments into the internal state of this object @param args: unqualified provider authentication policy arguments @param strict: Whether to raise an exception when bad data is ...
python
def parseExtensionArgs(self, args, strict=False): """Parse the provider authentication policy arguments into the internal state of this object @param args: unqualified provider authentication policy arguments @param strict: Whether to raise an exception when bad data is ...
['def', 'parseExtensionArgs', '(', 'self', ',', 'args', ',', 'strict', '=', 'False', ')', ':', 'policies_str', '=', 'args', '.', 'get', '(', "'auth_policies'", ')', 'if', 'policies_str', 'and', 'policies_str', '!=', "'none'", ':', 'self', '.', 'auth_policies', '=', 'policies_str', '.', 'split', '(', "' '", ')', 'nist_l...
Parse the provider authentication policy arguments into the internal state of this object @param args: unqualified provider authentication policy arguments @param strict: Whether to raise an exception when bad data is encountered @returns: None. The data is par...
['Parse', 'the', 'provider', 'authentication', 'policy', 'arguments', 'into', 'the', 'internal', 'state', 'of', 'this', 'object']
train
https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/extensions/draft/pape2.py#L211-L247
1,362
PGower/PyCanvas
pycanvas/apis/content_migrations.py
list_migration_issues_courses
def list_migration_issues_courses(self, course_id, content_migration_id): """ List migration issues. Returns paginated migration issues """ path = {} data = {} params = {} # REQUIRED - PATH - course_id """ID""" path["course_id...
python
def list_migration_issues_courses(self, course_id, content_migration_id): """ List migration issues. Returns paginated migration issues """ path = {} data = {} params = {} # REQUIRED - PATH - course_id """ID""" path["course_id...
['def', 'list_migration_issues_courses', '(', 'self', ',', 'course_id', ',', 'content_migration_id', ')', ':', 'path', '=', '{', '}', 'data', '=', '{', '}', 'params', '=', '{', '}', '# REQUIRED - PATH - course_id\r', '"""ID"""', 'path', '[', '"course_id"', ']', '=', 'course_id', '# REQUIRED - PATH - content_migration_i...
List migration issues. Returns paginated migration issues
['List', 'migration', 'issues', '.', 'Returns', 'paginated', 'migration', 'issues']
train
https://github.com/PGower/PyCanvas/blob/68520005382b440a1e462f9df369f54d364e21e8/pycanvas/apis/content_migrations.py#L40-L59
1,363
pyQode/pyqode.cobol
pyqode/cobol/modes/indenter.py
IndenterMode.unindent
def unindent(self): """ Un-indents text at cursor position. """ _logger().debug('unindent') cursor = self.editor.textCursor() _logger().debug('cursor has selection %r', cursor.hasSelection()) if cursor.hasSelection(): cursor.beginEditBlock() ...
python
def unindent(self): """ Un-indents text at cursor position. """ _logger().debug('unindent') cursor = self.editor.textCursor() _logger().debug('cursor has selection %r', cursor.hasSelection()) if cursor.hasSelection(): cursor.beginEditBlock() ...
['def', 'unindent', '(', 'self', ')', ':', '_logger', '(', ')', '.', 'debug', '(', "'unindent'", ')', 'cursor', '=', 'self', '.', 'editor', '.', 'textCursor', '(', ')', '_logger', '(', ')', '.', 'debug', '(', "'cursor has selection %r'", ',', 'cursor', '.', 'hasSelection', '(', ')', ')', 'if', 'cursor', '.', 'hasSelect...
Un-indents text at cursor position.
['Un', '-', 'indents', 'text', 'at', 'cursor', 'position', '.']
train
https://github.com/pyQode/pyqode.cobol/blob/eedae4e320a4b2d0c44abb2c3061091321648fb7/pyqode/cobol/modes/indenter.py#L149-L178
1,364
cyrus-/cypy
cypy/__init__.py
fn_kwargs
def fn_kwargs(callable): """Returns a dict with the kwargs from the provided function. Example >>> def x(a, b=0, *args, **kwargs): pass >>> func_kwargs(x) == { 'b': 0 } """ fn = get_fn(callable) (args, _, _, defaults) = _inspect.getargspec(fn) if defaults is None: return { } ...
python
def fn_kwargs(callable): """Returns a dict with the kwargs from the provided function. Example >>> def x(a, b=0, *args, **kwargs): pass >>> func_kwargs(x) == { 'b': 0 } """ fn = get_fn(callable) (args, _, _, defaults) = _inspect.getargspec(fn) if defaults is None: return { } ...
['def', 'fn_kwargs', '(', 'callable', ')', ':', 'fn', '=', 'get_fn', '(', 'callable', ')', '(', 'args', ',', '_', ',', '_', ',', 'defaults', ')', '=', '_inspect', '.', 'getargspec', '(', 'fn', ')', 'if', 'defaults', 'is', 'None', ':', 'return', '{', '}', 'return', 'dict', '(', 'list', '(', 'zip', '(', 'reversed', '(', ...
Returns a dict with the kwargs from the provided function. Example >>> def x(a, b=0, *args, **kwargs): pass >>> func_kwargs(x) == { 'b': 0 }
['Returns', 'a', 'dict', 'with', 'the', 'kwargs', 'from', 'the', 'provided', 'function', '.']
train
https://github.com/cyrus-/cypy/blob/04bb59e91fa314e8cf987743189c77a9b6bc371d/cypy/__init__.py#L742-L754
1,365
gabstopper/smc-python
smc/elements/network.py
IPList.update_or_create
def update_or_create(cls, append_lists=True, with_status=False, **kwargs): """ Update or create an IPList. :param bool append_lists: append to existing IP List :param dict kwargs: provide at minimum the name attribute and optionally match the create constructor value...
python
def update_or_create(cls, append_lists=True, with_status=False, **kwargs): """ Update or create an IPList. :param bool append_lists: append to existing IP List :param dict kwargs: provide at minimum the name attribute and optionally match the create constructor value...
['def', 'update_or_create', '(', 'cls', ',', 'append_lists', '=', 'True', ',', 'with_status', '=', 'False', ',', '*', '*', 'kwargs', ')', ':', 'was_created', ',', 'was_modified', '=', 'False', ',', 'False', 'element', '=', 'None', 'try', ':', 'element', '=', 'cls', '.', 'get', '(', 'kwargs', '.', 'get', '(', "'name'", ...
Update or create an IPList. :param bool append_lists: append to existing IP List :param dict kwargs: provide at minimum the name attribute and optionally match the create constructor values :raises FetchElementFailed: Reason for retrieval failure
['Update', 'or', 'create', 'an', 'IPList', '.', ':', 'param', 'bool', 'append_lists', ':', 'append', 'to', 'existing', 'IP', 'List', ':', 'param', 'dict', 'kwargs', ':', 'provide', 'at', 'minimum', 'the', 'name', 'attribute', 'and', 'optionally', 'match', 'the', 'create', 'constructor', 'values', ':', 'raises', 'FetchE...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L458-L493
1,366
pytorch/text
torchtext/data/field.py
SubwordField.segment
def segment(self, *args): """Segment one or more datasets with this subword field. Arguments: Positional arguments: Dataset objects or other indexable mutable sequences to segment. If a Dataset object is provided, all columns corresponding to this field are u...
python
def segment(self, *args): """Segment one or more datasets with this subword field. Arguments: Positional arguments: Dataset objects or other indexable mutable sequences to segment. If a Dataset object is provided, all columns corresponding to this field are u...
['def', 'segment', '(', 'self', ',', '*', 'args', ')', ':', 'sources', '=', '[', ']', 'for', 'arg', 'in', 'args', ':', 'if', 'isinstance', '(', 'arg', ',', 'Dataset', ')', ':', 'sources', '+=', '[', 'getattr', '(', 'arg', ',', 'name', ')', 'for', 'name', ',', 'field', 'in', 'arg', '.', 'fields', '.', 'items', '(', ')',...
Segment one or more datasets with this subword field. Arguments: Positional arguments: Dataset objects or other indexable mutable sequences to segment. If a Dataset object is provided, all columns corresponding to this field are used; individual colum...
['Segment', 'one', 'or', 'more', 'datasets', 'with', 'this', 'subword', 'field', '.']
train
https://github.com/pytorch/text/blob/26bfce6869dc704f1d86792f9a681d453d7e7bb8/torchtext/data/field.py#L424-L442
1,367
DLR-RM/RAFCON
source/rafcon/core/states/state.py
State.get_uppermost_library_root_state
def get_uppermost_library_root_state(self): """Find state_copy of uppermost LibraryState Method checks if there is a parent library root state and assigns it to be the current library root state till there is no further parent library root state. """ library_root_state = self.g...
python
def get_uppermost_library_root_state(self): """Find state_copy of uppermost LibraryState Method checks if there is a parent library root state and assigns it to be the current library root state till there is no further parent library root state. """ library_root_state = self.g...
['def', 'get_uppermost_library_root_state', '(', 'self', ')', ':', 'library_root_state', '=', 'self', '.', 'get_next_upper_library_root_state', '(', ')', 'parent_library_root_state', '=', 'library_root_state', '# initial a library root state has to be found and if there is no further parent root state', '# parent_libra...
Find state_copy of uppermost LibraryState Method checks if there is a parent library root state and assigns it to be the current library root state till there is no further parent library root state.
['Find', 'state_copy', 'of', 'uppermost', 'LibraryState']
train
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L1441-L1459
1,368
StackStorm/pybind
pybind/slxos/v17s_1_02/__init__.py
brocade_mc_hms_operational._set_igmp_snooping_state
def _set_igmp_snooping_state(self, v, load=False): """ Setter method for igmp_snooping_state, mapped from YANG variable /igmp_snooping_state (container) If this variable is read-only (config: false) in the source YANG file, then _set_igmp_snooping_state is considered as a private method. Backends lo...
python
def _set_igmp_snooping_state(self, v, load=False): """ Setter method for igmp_snooping_state, mapped from YANG variable /igmp_snooping_state (container) If this variable is read-only (config: false) in the source YANG file, then _set_igmp_snooping_state is considered as a private method. Backends lo...
['def', '_set_igmp_snooping_state', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'igmp_snooping_state', '.', 'igmp_snooping_state', ',', 'is...
Setter method for igmp_snooping_state, mapped from YANG variable /igmp_snooping_state (container) If this variable is read-only (config: false) in the source YANG file, then _set_igmp_snooping_state is considered as a private method. Backends looking to populate this variable should do so via calling th...
['Setter', 'method', 'for', 'igmp_snooping_state', 'mapped', 'from', 'YANG', 'variable', '/', 'igmp_snooping_state', '(', 'container', ')', 'If', 'this', 'variable', 'is', 'read', '-', 'only', '(', 'config', ':', 'false', ')', 'in', 'the', 'source', 'YANG', 'file', 'then', '_set_igmp_snooping_state', 'is', 'considered'...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/__init__.py#L1023-L1046
1,369
ARMmbed/icetea
icetea_lib/build/build.py
BuildHttp.get_file
def get_file(self): """ Load data into a file and return file path. :return: path to file as string """ content = self._load() if not content: return None filename = "temporary_file.bin" with open(filename, "wb") as file_name: file...
python
def get_file(self): """ Load data into a file and return file path. :return: path to file as string """ content = self._load() if not content: return None filename = "temporary_file.bin" with open(filename, "wb") as file_name: file...
['def', 'get_file', '(', 'self', ')', ':', 'content', '=', 'self', '.', '_load', '(', ')', 'if', 'not', 'content', ':', 'return', 'None', 'filename', '=', '"temporary_file.bin"', 'with', 'open', '(', 'filename', ',', '"wb"', ')', 'as', 'file_name', ':', 'file_name', '.', 'write', '(', 'content', ')', 'return', 'filenam...
Load data into a file and return file path. :return: path to file as string
['Load', 'data', 'into', 'a', 'file', 'and', 'return', 'file', 'path', '.']
train
https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/build/build.py#L200-L212
1,370
tensorpack/tensorpack
tensorpack/models/_old_batch_norm.py
BatchNorm
def BatchNorm(inputs, training=None, momentum=0.9, epsilon=1e-5, center=True, scale=True, gamma_initializer=tf.ones_initializer(), data_format='channels_last', internal_update=False): """ Mostly equivalent to `tf.layers.batch_normalization`, but difference...
python
def BatchNorm(inputs, training=None, momentum=0.9, epsilon=1e-5, center=True, scale=True, gamma_initializer=tf.ones_initializer(), data_format='channels_last', internal_update=False): """ Mostly equivalent to `tf.layers.batch_normalization`, but difference...
['def', 'BatchNorm', '(', 'inputs', ',', 'training', '=', 'None', ',', 'momentum', '=', '0.9', ',', 'epsilon', '=', '1e-5', ',', 'center', '=', 'True', ',', 'scale', '=', 'True', ',', 'gamma_initializer', '=', 'tf', '.', 'ones_initializer', '(', ')', ',', 'data_format', '=', "'channels_last'", ',', 'internal_update', '...
Mostly equivalent to `tf.layers.batch_normalization`, but difference in the following: 1. Accepts `data_format` rather than `axis`. For 2D input, this argument will be ignored. 2. Default value for `momentum` and `epsilon` is different. 3. Default value for `training` is automatically obtained from `Tow...
['Mostly', 'equivalent', 'to', 'tf', '.', 'layers', '.', 'batch_normalization', 'but', 'difference', 'in', 'the', 'following', ':', '1', '.', 'Accepts', 'data_format', 'rather', 'than', 'axis', '.', 'For', '2D', 'input', 'this', 'argument', 'will', 'be', 'ignored', '.', '2', '.', 'Default', 'value', 'for', 'momentum', ...
train
https://github.com/tensorpack/tensorpack/blob/d7a13cb74c9066bc791d7aafc3b744b60ee79a9f/tensorpack/models/_old_batch_norm.py#L67-L169
1,371
NORDUnet/python-norduniclient
norduniclient/core.py
create_location_relationship
def create_location_relationship(manager, location_handle_id, other_handle_id, rel_type): """ Makes relationship between the two nodes and returns the relationship. If a relationship is not possible NoRelationshipPossible exception is raised. """ other_meta_type = get_node_meta_type(manager, oth...
python
def create_location_relationship(manager, location_handle_id, other_handle_id, rel_type): """ Makes relationship between the two nodes and returns the relationship. If a relationship is not possible NoRelationshipPossible exception is raised. """ other_meta_type = get_node_meta_type(manager, oth...
['def', 'create_location_relationship', '(', 'manager', ',', 'location_handle_id', ',', 'other_handle_id', ',', 'rel_type', ')', ':', 'other_meta_type', '=', 'get_node_meta_type', '(', 'manager', ',', 'other_handle_id', ')', 'if', 'other_meta_type', '==', "'Location'", 'and', 'rel_type', '==', "'Has'", ':', 'return', '...
Makes relationship between the two nodes and returns the relationship. If a relationship is not possible NoRelationshipPossible exception is raised.
['Makes', 'relationship', 'between', 'the', 'two', 'nodes', 'and', 'returns', 'the', 'relationship', '.', 'If', 'a', 'relationship', 'is', 'not', 'possible', 'NoRelationshipPossible', 'exception', 'is', 'raised', '.']
train
https://github.com/NORDUnet/python-norduniclient/blob/ee5084a6f45caac614b4fda4a023749ca52f786c/norduniclient/core.py#L594-L603
1,372
talkincode/toughlib
toughlib/btforms/net.py
validip
def validip(ip, defaultaddr="0.0.0.0", defaultport=8080): """Returns `(ip_address, port)` from string `ip_addr_port`""" addr = defaultaddr port = defaultport ip = ip.split(":", 1) if len(ip) == 1: if not ip[0]: pass elif validipaddr(ip[0]): addr = ip[0] ...
python
def validip(ip, defaultaddr="0.0.0.0", defaultport=8080): """Returns `(ip_address, port)` from string `ip_addr_port`""" addr = defaultaddr port = defaultport ip = ip.split(":", 1) if len(ip) == 1: if not ip[0]: pass elif validipaddr(ip[0]): addr = ip[0] ...
['def', 'validip', '(', 'ip', ',', 'defaultaddr', '=', '"0.0.0.0"', ',', 'defaultport', '=', '8080', ')', ':', 'addr', '=', 'defaultaddr', 'port', '=', 'defaultport', 'ip', '=', 'ip', '.', 'split', '(', '":"', ',', '1', ')', 'if', 'len', '(', 'ip', ')', '==', '1', ':', 'if', 'not', 'ip', '[', '0', ']', ':', 'pass', 'el...
Returns `(ip_address, port)` from string `ip_addr_port`
['Returns', '(', 'ip_address', 'port', ')', 'from', 'string', 'ip_addr_port']
train
https://github.com/talkincode/toughlib/blob/1c2f7dde3a7f101248f1b5f5d428cc85466995cf/toughlib/btforms/net.py#L54-L76
1,373
ARMmbed/mbed-cloud-sdk-python
src/mbed_cloud/update/update.py
UpdateAPI.get_firmware_manifest
def get_firmware_manifest(self, manifest_id): """Get manifest with provided manifest_id. :param str manifest_id: ID of manifest to retrieve (Required) :return: FirmwareManifest """ api = self._get_api(update_service.DefaultApi) return FirmwareManifest(api.firmware_manife...
python
def get_firmware_manifest(self, manifest_id): """Get manifest with provided manifest_id. :param str manifest_id: ID of manifest to retrieve (Required) :return: FirmwareManifest """ api = self._get_api(update_service.DefaultApi) return FirmwareManifest(api.firmware_manife...
['def', 'get_firmware_manifest', '(', 'self', ',', 'manifest_id', ')', ':', 'api', '=', 'self', '.', '_get_api', '(', 'update_service', '.', 'DefaultApi', ')', 'return', 'FirmwareManifest', '(', 'api', '.', 'firmware_manifest_retrieve', '(', 'manifest_id', '=', 'manifest_id', ')', ')']
Get manifest with provided manifest_id. :param str manifest_id: ID of manifest to retrieve (Required) :return: FirmwareManifest
['Get', 'manifest', 'with', 'provided', 'manifest_id', '.']
train
https://github.com/ARMmbed/mbed-cloud-sdk-python/blob/c0af86fb2cdd4dc7ed26f236139241067d293509/src/mbed_cloud/update/update.py#L248-L255
1,374
locationlabs/mockredis
mockredis/script.py
Script._python_to_lua
def _python_to_lua(pval): """ Convert Python object(s) into Lua object(s), as at times Python object(s) are not compatible with Lua functions """ import lua if pval is None: # Python None --> Lua None return lua.eval("") if isinstance(pval,...
python
def _python_to_lua(pval): """ Convert Python object(s) into Lua object(s), as at times Python object(s) are not compatible with Lua functions """ import lua if pval is None: # Python None --> Lua None return lua.eval("") if isinstance(pval,...
['def', '_python_to_lua', '(', 'pval', ')', ':', 'import', 'lua', 'if', 'pval', 'is', 'None', ':', '# Python None --> Lua None', 'return', 'lua', '.', 'eval', '(', '""', ')', 'if', 'isinstance', '(', 'pval', ',', '(', 'list', ',', 'tuple', ',', 'set', ')', ')', ':', '# Python list --> Lua table', '# e.g.: in lrange', '...
Convert Python object(s) into Lua object(s), as at times Python object(s) are not compatible with Lua functions
['Convert', 'Python', 'object', '(', 's', ')', 'into', 'Lua', 'object', '(', 's', ')', 'as', 'at', 'times', 'Python', 'object', '(', 's', ')', 'are', 'not', 'compatible', 'with', 'Lua', 'functions']
train
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/script.py#L138-L179
1,375
secdev/scapy
scapy/modules/krack/automaton.py
KrackAP.build_GTK_KDE
def build_GTK_KDE(self): """Build the Key Data Encapsulation for GTK KeyID: 0 Ref: 802.11i p81 """ return b''.join([ b'\xdd', # Type KDE chb(len(self.gtk_full) + 6), b'\x00\x0f\xac', # OUI b'\x01', # GTK KDE b'\x00\x0...
python
def build_GTK_KDE(self): """Build the Key Data Encapsulation for GTK KeyID: 0 Ref: 802.11i p81 """ return b''.join([ b'\xdd', # Type KDE chb(len(self.gtk_full) + 6), b'\x00\x0f\xac', # OUI b'\x01', # GTK KDE b'\x00\x0...
['def', 'build_GTK_KDE', '(', 'self', ')', ':', 'return', "b''", '.', 'join', '(', '[', "b'\\xdd'", ',', '# Type KDE', 'chb', '(', 'len', '(', 'self', '.', 'gtk_full', ')', '+', '6', ')', ',', "b'\\x00\\x0f\\xac'", ',', '# OUI', "b'\\x01'", ',', '# GTK KDE', "b'\\x00\\x00'", ',', '# KeyID - Tx - Reserved x2', 'self', '...
Build the Key Data Encapsulation for GTK KeyID: 0 Ref: 802.11i p81
['Build', 'the', 'Key', 'Data', 'Encapsulation', 'for', 'GTK', 'KeyID', ':', '0', 'Ref', ':', '802', '.', '11i', 'p81']
train
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/modules/krack/automaton.py#L301-L313
1,376
hsolbrig/PyShEx
pyshex/shape_expressions_language/p5_context.py
Context._visit_shape_te
def _visit_shape_te(self, te: ShExJ.tripleExpr, visit_center: _VisitorCenter) -> None: """ Visit a triple expression that was reached through a shape. This, in turn, is used to visit additional shapes that are referenced by a TripleConstraint :param te: Triple expression reached through ...
python
def _visit_shape_te(self, te: ShExJ.tripleExpr, visit_center: _VisitorCenter) -> None: """ Visit a triple expression that was reached through a shape. This, in turn, is used to visit additional shapes that are referenced by a TripleConstraint :param te: Triple expression reached through ...
['def', '_visit_shape_te', '(', 'self', ',', 'te', ':', 'ShExJ', '.', 'tripleExpr', ',', 'visit_center', ':', '_VisitorCenter', ')', '->', 'None', ':', 'if', 'isinstance', '(', 'te', ',', 'ShExJ', '.', 'TripleConstraint', ')', 'and', 'te', '.', 'valueExpr', 'is', 'not', 'None', ':', 'visit_center', '.', 'f', '(', 'visi...
Visit a triple expression that was reached through a shape. This, in turn, is used to visit additional shapes that are referenced by a TripleConstraint :param te: Triple expression reached through a Shape.expression :param visit_center: context used in shape visitor
['Visit', 'a', 'triple', 'expression', 'that', 'was', 'reached', 'through', 'a', 'shape', '.', 'This', 'in', 'turn', 'is', 'used', 'to', 'visit', 'additional', 'shapes', 'that', 'are', 'referenced', 'by', 'a', 'TripleConstraint', ':', 'param', 'te', ':', 'Triple', 'expression', 'reached', 'through', 'a', 'Shape', '.', ...
train
https://github.com/hsolbrig/PyShEx/blob/9d659cc36e808afd66d4a6d60e8ea21cb12eb744/pyshex/shape_expressions_language/p5_context.py#L335-L343
1,377
merll/docker-map
dockermap/build/context.py
get_exclusions
def get_exclusions(path): """ Generates exclusion patterns from a ``.dockerignore`` file located in the given path. Returns ``None`` if the file does not exist. :param path: Path to look up the ``.dockerignore`` in. :type path: unicode | str :return: List of patterns, that can be passed into :f...
python
def get_exclusions(path): """ Generates exclusion patterns from a ``.dockerignore`` file located in the given path. Returns ``None`` if the file does not exist. :param path: Path to look up the ``.dockerignore`` in. :type path: unicode | str :return: List of patterns, that can be passed into :f...
['def', 'get_exclusions', '(', 'path', ')', ':', 'if', 'not', 'os', '.', 'path', '.', 'isdir', '(', 'path', ')', ':', 'return', 'None', 'dockerignore_file', '=', 'os', '.', 'path', '.', 'join', '(', 'path', ',', "'.dockerignore'", ')', 'if', 'not', 'os', '.', 'path', '.', 'isfile', '(', 'dockerignore_file', ')', ':', '...
Generates exclusion patterns from a ``.dockerignore`` file located in the given path. Returns ``None`` if the file does not exist. :param path: Path to look up the ``.dockerignore`` in. :type path: unicode | str :return: List of patterns, that can be passed into :func:`get_filter_func`. :rtype: lis...
['Generates', 'exclusion', 'patterns', 'from', 'a', '.', 'dockerignore', 'file', 'located', 'in', 'the', 'given', 'path', '.', 'Returns', 'None', 'if', 'the', 'file', 'does', 'not', 'exist', '.']
train
https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/build/context.py#L45-L61
1,378
productml/blurr
blurr/core/field_complex.py
Map.set
def set(self, key: Any, value: Any) -> None: """ Sets the value of a key to a supplied value """ if key is not None: self[key] = value
python
def set(self, key: Any, value: Any) -> None: """ Sets the value of a key to a supplied value """ if key is not None: self[key] = value
['def', 'set', '(', 'self', ',', 'key', ':', 'Any', ',', 'value', ':', 'Any', ')', '->', 'None', ':', 'if', 'key', 'is', 'not', 'None', ':', 'self', '[', 'key', ']', '=', 'value']
Sets the value of a key to a supplied value
['Sets', 'the', 'value', 'of', 'a', 'key', 'to', 'a', 'supplied', 'value']
train
https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/core/field_complex.py#L11-L14
1,379
Robpol86/terminaltables
terminaltables/base_table.py
BaseTable.gen_row_lines
def gen_row_lines(self, row, style, inner_widths, height): r"""Combine cells in row and group them into lines with vertical borders. Caller is expected to pass yielded lines to ''.join() to combine them into a printable line. Caller must append newline character to the end of joined line. ...
python
def gen_row_lines(self, row, style, inner_widths, height): r"""Combine cells in row and group them into lines with vertical borders. Caller is expected to pass yielded lines to ''.join() to combine them into a printable line. Caller must append newline character to the end of joined line. ...
['def', 'gen_row_lines', '(', 'self', ',', 'row', ',', 'style', ',', 'inner_widths', ',', 'height', ')', ':', 'cells_in_row', '=', 'list', '(', ')', "# Resize row if it doesn't have enough cells.", 'if', 'len', '(', 'row', ')', '!=', 'len', '(', 'inner_widths', ')', ':', 'row', '=', 'row', '+', '[', "''", ']', '*', '('...
r"""Combine cells in row and group them into lines with vertical borders. Caller is expected to pass yielded lines to ''.join() to combine them into a printable line. Caller must append newline character to the end of joined line. In: ['Row One Column One', 'Two', 'Three'] Out:...
['r', 'Combine', 'cells', 'in', 'row', 'and', 'group', 'them', 'into', 'lines', 'with', 'vertical', 'borders', '.']
train
https://github.com/Robpol86/terminaltables/blob/ad8f46e50afdbaea377fc1f713bc0e7a31c4fccc/terminaltables/base_table.py#L112-L169
1,380
pypa/pipenv
pipenv/vendor/distlib/locators.py
SimpleScrapingLocator._process_download
def _process_download(self, url): """ See if an URL is a suitable download for a project. If it is, register information in the result dictionary (for _get_project) about the specific version it's for. Note that the return value isn't actually used other than as a boolean ...
python
def _process_download(self, url): """ See if an URL is a suitable download for a project. If it is, register information in the result dictionary (for _get_project) about the specific version it's for. Note that the return value isn't actually used other than as a boolean ...
['def', '_process_download', '(', 'self', ',', 'url', ')', ':', 'if', 'self', '.', 'platform_check', 'and', 'self', '.', '_is_platform_dependent', '(', 'url', ')', ':', 'info', '=', 'None', 'else', ':', 'info', '=', 'self', '.', 'convert_url_to_download_info', '(', 'url', ',', 'self', '.', 'project_name', ')', 'logger'...
See if an URL is a suitable download for a project. If it is, register information in the result dictionary (for _get_project) about the specific version it's for. Note that the return value isn't actually used other than as a boolean value.
['See', 'if', 'an', 'URL', 'is', 'a', 'suitable', 'download', 'for', 'a', 'project', '.']
train
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/locators.py#L673-L691
1,381
ansible/ansible-container
container/openshift/deploy.py
Deploy.get_route_templates
def get_route_templates(self): """ Generate Openshift route templates or playbook tasks. Each port on a service definition found in container.yml represents an externally exposed port. """ def _get_published_ports(service_config): result = [] for port in s...
python
def get_route_templates(self): """ Generate Openshift route templates or playbook tasks. Each port on a service definition found in container.yml represents an externally exposed port. """ def _get_published_ports(service_config): result = [] for port in s...
['def', 'get_route_templates', '(', 'self', ')', ':', 'def', '_get_published_ports', '(', 'service_config', ')', ':', 'result', '=', '[', ']', 'for', 'port', 'in', 'service_config', '.', 'get', '(', "'ports'", ',', '[', ']', ')', ':', 'protocol', '=', "'TCP'", 'if', 'isinstance', '(', 'port', ',', 'string_types', ')', ...
Generate Openshift route templates or playbook tasks. Each port on a service definition found in container.yml represents an externally exposed port.
['Generate', 'Openshift', 'route', 'templates', 'or', 'playbook', 'tasks', '.', 'Each', 'port', 'on', 'a', 'service', 'definition', 'found', 'in', 'container', '.', 'yml', 'represents', 'an', 'externally', 'exposed', 'port', '.']
train
https://github.com/ansible/ansible-container/blob/d031c1a6133d5482a5d054fcbdbecafb923f8b4b/container/openshift/deploy.py#L56-L117
1,382
studionow/pybrightcove
pybrightcove/video.py
Video.add_custom_metadata
def add_custom_metadata(self, key, value, meta_type=None): """ Add custom metadata to the Video. meta_type is required for XML API. """ self.metadata.append({'key': key, 'value': value, 'type': meta_type})
python
def add_custom_metadata(self, key, value, meta_type=None): """ Add custom metadata to the Video. meta_type is required for XML API. """ self.metadata.append({'key': key, 'value': value, 'type': meta_type})
['def', 'add_custom_metadata', '(', 'self', ',', 'key', ',', 'value', ',', 'meta_type', '=', 'None', ')', ':', 'self', '.', 'metadata', '.', 'append', '(', '{', "'key'", ':', 'key', ',', "'value'", ':', 'value', ',', "'type'", ':', 'meta_type', '}', ')']
Add custom metadata to the Video. meta_type is required for XML API.
['Add', 'custom', 'metadata', 'to', 'the', 'Video', '.', 'meta_type', 'is', 'required', 'for', 'XML', 'API', '.']
train
https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/video.py#L487-L491
1,383
shidenggui/easytrader
easytrader/yh_clienttrader.py
YHClientTrader.login
def login(self, user, password, exe_path, comm_password=None, **kwargs): """ 登陆客户端 :param user: 账号 :param password: 明文密码 :param exe_path: 客户端路径类似 'C:\\中国银河证券双子星3.2\\Binarystar.exe', 默认 'C:\\中国银河证券双子星3.2\\Binarystar.exe' :param comm_password: 通讯密码, 华泰需要,可不设 ...
python
def login(self, user, password, exe_path, comm_password=None, **kwargs): """ 登陆客户端 :param user: 账号 :param password: 明文密码 :param exe_path: 客户端路径类似 'C:\\中国银河证券双子星3.2\\Binarystar.exe', 默认 'C:\\中国银河证券双子星3.2\\Binarystar.exe' :param comm_password: 通讯密码, 华泰需要,可不设 ...
['def', 'login', '(', 'self', ',', 'user', ',', 'password', ',', 'exe_path', ',', 'comm_password', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'try', ':', 'self', '.', '_app', '=', 'pywinauto', '.', 'Application', '(', ')', '.', 'connect', '(', 'path', '=', 'self', '.', '_run_exe_path', '(', 'exe_path', ')', ',', '...
登陆客户端 :param user: 账号 :param password: 明文密码 :param exe_path: 客户端路径类似 'C:\\中国银河证券双子星3.2\\Binarystar.exe', 默认 'C:\\中国银河证券双子星3.2\\Binarystar.exe' :param comm_password: 通讯密码, 华泰需要,可不设 :return:
['登陆客户端', ':', 'param', 'user', ':', '账号', ':', 'param', 'password', ':', '明文密码', ':', 'param', 'exe_path', ':', '客户端路径类似', 'C', ':', '\\\\', '中国银河证券双子星3', '.', '2', '\\\\', 'Binarystar', '.', 'exe', '默认', 'C', ':', '\\\\', '中国银河证券双子星3', '.', '2', '\\\\', 'Binarystar', '.', 'exe', ':', 'param', 'comm_password', ':', '通...
train
https://github.com/shidenggui/easytrader/blob/e5ae4daeda4ea125763a95b280dd694c7f68257d/easytrader/yh_clienttrader.py#L25-L80
1,384
Vito2015/pyextend
pyextend/formula/lbstools.py
calc_distance
def calc_distance(lng1, lat1, lng2, lat2): """Calc distance (km) by geo-coordinates. @:param lng1: first coordinate.lng @:param lat1: first coordinate.lat @:param lng2: second coordinate.lng @:param lat2: second coordinate.lat @:return distance: km """ ra = 6378.140 ...
python
def calc_distance(lng1, lat1, lng2, lat2): """Calc distance (km) by geo-coordinates. @:param lng1: first coordinate.lng @:param lat1: first coordinate.lat @:param lng2: second coordinate.lng @:param lat2: second coordinate.lat @:return distance: km """ ra = 6378.140 ...
['def', 'calc_distance', '(', 'lng1', ',', 'lat1', ',', 'lng2', ',', 'lat2', ')', ':', 'ra', '=', '6378.140', '# 赤道半径 (km)', 'rb', '=', '6356.755', '# 极半径 (km)', 'flatten', '=', '(', 'ra', '-', 'rb', ')', '/', 'ra', '# 地球扁率', 'rad_lat_1', '=', 'math', '.', 'radians', '(', 'lat1', ')', 'rad_lng_1', '=', 'math', '.', 'ra...
Calc distance (km) by geo-coordinates. @:param lng1: first coordinate.lng @:param lat1: first coordinate.lat @:param lng2: second coordinate.lng @:param lat2: second coordinate.lat @:return distance: km
['Calc', 'distance', '(', 'km', ')', 'by', 'geo', '-', 'coordinates', '.']
train
https://github.com/Vito2015/pyextend/blob/36861dfe1087e437ffe9b5a1da9345c85b4fa4a1/pyextend/formula/lbstools.py#L32-L54
1,385
edoburu/django-any-urlfield
any_urlfield/templatetags/any_urlfield_tags.py
WithDictNode.render
def render(self, context): """ Render the tag, with extra context layer. """ extra_context = self.context_expr.resolve(context) if not isinstance(extra_context, dict): raise TemplateSyntaxError("{% withdict %} expects the argument to be a dictionary.") with c...
python
def render(self, context): """ Render the tag, with extra context layer. """ extra_context = self.context_expr.resolve(context) if not isinstance(extra_context, dict): raise TemplateSyntaxError("{% withdict %} expects the argument to be a dictionary.") with c...
['def', 'render', '(', 'self', ',', 'context', ')', ':', 'extra_context', '=', 'self', '.', 'context_expr', '.', 'resolve', '(', 'context', ')', 'if', 'not', 'isinstance', '(', 'extra_context', ',', 'dict', ')', ':', 'raise', 'TemplateSyntaxError', '(', '"{% withdict %} expects the argument to be a dictionary."', ')', ...
Render the tag, with extra context layer.
['Render', 'the', 'tag', 'with', 'extra', 'context', 'layer', '.']
train
https://github.com/edoburu/django-any-urlfield/blob/8d7d36c8a1fc251930f6dbdcc8b5b5151d20e3ab/any_urlfield/templatetags/any_urlfield_tags.py#L18-L27
1,386
markovmodel/PyEMMA
pyemma/coordinates/estimation/koopman.py
_compute_u
def _compute_u(K): """ Estimate an approximation of the ratio of stationary over empirical distribution from the basis. Parameters: ----------- K0, ndarray(M+1, M+1), time-lagged correlation matrix for the whitened and padded data set. Returns: -------- u : ndarray(M,) co...
python
def _compute_u(K): """ Estimate an approximation of the ratio of stationary over empirical distribution from the basis. Parameters: ----------- K0, ndarray(M+1, M+1), time-lagged correlation matrix for the whitened and padded data set. Returns: -------- u : ndarray(M,) co...
['def', '_compute_u', '(', 'K', ')', ':', 'M', '=', 'K', '.', 'shape', '[', '0', ']', '-', '1', '# Compute right and left eigenvectors:', 'l', ',', 'U', '=', 'scl', '.', 'eig', '(', 'K', '.', 'T', ')', 'l', ',', 'U', '=', 'sort_by_norm', '(', 'l', ',', 'U', ')', '# Extract the eigenvector for eigenvalue one and normali...
Estimate an approximation of the ratio of stationary over empirical distribution from the basis. Parameters: ----------- K0, ndarray(M+1, M+1), time-lagged correlation matrix for the whitened and padded data set. Returns: -------- u : ndarray(M,) coefficients of the ratio station...
['Estimate', 'an', 'approximation', 'of', 'the', 'ratio', 'of', 'stationary', 'over', 'empirical', 'distribution', 'from', 'the', 'basis', '.', 'Parameters', ':', '-----------', 'K0', 'ndarray', '(', 'M', '+', '1', 'M', '+', '1', ')', 'time', '-', 'lagged', 'correlation', 'matrix', 'for', 'the', 'whitened', 'and', 'pad...
train
https://github.com/markovmodel/PyEMMA/blob/5c3124398217de05ba5ce9c8fb01519222481ab8/pyemma/coordinates/estimation/koopman.py#L29-L50
1,387
ZELLMECHANIK-DRESDEN/dclab
dclab/isoelastics/__init__.py
Isoelastics.load_data
def load_data(self, path): """Load isoelastics from a text file The text file is loaded with `numpy.loadtxt` and must have three columns, representing the two data columns and the elastic modulus with units defined in `definitions.py`. The file header must have a section definin...
python
def load_data(self, path): """Load isoelastics from a text file The text file is loaded with `numpy.loadtxt` and must have three columns, representing the two data columns and the elastic modulus with units defined in `definitions.py`. The file header must have a section definin...
['def', 'load_data', '(', 'self', ',', 'path', ')', ':', 'path', '=', 'pathlib', '.', 'Path', '(', 'path', ')', '.', 'resolve', '(', ')', '# Get metadata', 'meta', '=', '{', '}', 'with', 'path', '.', 'open', '(', ')', 'as', 'fd', ':', 'while', 'True', ':', 'line', '=', 'fd', '.', 'readline', '(', ')', '.', 'strip', '('...
Load isoelastics from a text file The text file is loaded with `numpy.loadtxt` and must have three columns, representing the two data columns and the elastic modulus with units defined in `definitions.py`. The file header must have a section defining meta data of the content lik...
['Load', 'isoelastics', 'from', 'a', 'text', 'file']
train
https://github.com/ZELLMECHANIK-DRESDEN/dclab/blob/79002c4356e7020c2ba73ab0a3819c9abd4affec/dclab/isoelastics/__init__.py#L348-L417
1,388
pettarin/ipapy
ipapy/compatibility.py
is_unicode_string
def is_unicode_string(string): """ Return ``True`` if the given string is a Unicode string, that is, of type ``unicode`` in Python 2 or ``str`` in Python 3. Return ``None`` if ``string`` is ``None``. :param str string: the string to be checked :rtype: bool """ if string is None: ...
python
def is_unicode_string(string): """ Return ``True`` if the given string is a Unicode string, that is, of type ``unicode`` in Python 2 or ``str`` in Python 3. Return ``None`` if ``string`` is ``None``. :param str string: the string to be checked :rtype: bool """ if string is None: ...
['def', 'is_unicode_string', '(', 'string', ')', ':', 'if', 'string', 'is', 'None', ':', 'return', 'None', 'if', 'PY2', ':', 'return', 'isinstance', '(', 'string', ',', 'unicode', ')', 'return', 'isinstance', '(', 'string', ',', 'str', ')']
Return ``True`` if the given string is a Unicode string, that is, of type ``unicode`` in Python 2 or ``str`` in Python 3. Return ``None`` if ``string`` is ``None``. :param str string: the string to be checked :rtype: bool
['Return', 'True', 'if', 'the', 'given', 'string', 'is', 'a', 'Unicode', 'string', 'that', 'is', 'of', 'type', 'unicode', 'in', 'Python', '2', 'or', 'str', 'in', 'Python', '3', '.']
train
https://github.com/pettarin/ipapy/blob/ede4b3c40636f6eb90068369d31a2e75c7115324/ipapy/compatibility.py#L25-L39
1,389
zsethna/OLGA
olga/generate_sequences.py
main
def main(): """ Generate sequences.""" parser = OptionParser(conflict_handler="resolve") parser.add_option('--humanTRA', '--human_T_alpha', action='store_true', dest='humanTRA', default=False, help='use default human TRA model (T cell alpha chain)') parser.add_option('--humanTRB', '--human_T_beta', ac...
python
def main(): """ Generate sequences.""" parser = OptionParser(conflict_handler="resolve") parser.add_option('--humanTRA', '--human_T_alpha', action='store_true', dest='humanTRA', default=False, help='use default human TRA model (T cell alpha chain)') parser.add_option('--humanTRB', '--human_T_beta', ac...
['def', 'main', '(', ')', ':', 'parser', '=', 'OptionParser', '(', 'conflict_handler', '=', '"resolve"', ')', 'parser', '.', 'add_option', '(', "'--humanTRA'", ',', "'--human_T_alpha'", ',', 'action', '=', "'store_true'", ',', 'dest', '=', "'humanTRA'", ',', 'default', '=', 'False', ',', 'help', '=', "'use default huma...
Generate sequences.
['Generate', 'sequences', '.']
train
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/generate_sequences.py#L144-L345
1,390
tyarkoni/pliers
pliers/diagnostics/diagnostics.py
Diagnostics.flag_all
def flag_all(self, thresh_dict=None, include=None, exclude=None): ''' Returns indices of (rows, columns) that satisfy flag() on any diagnostic. Uses user-provided thresholds in thresh_dict/ Args: thresh_dict (dict): dictionary of diagnostic->threshold functions i...
python
def flag_all(self, thresh_dict=None, include=None, exclude=None): ''' Returns indices of (rows, columns) that satisfy flag() on any diagnostic. Uses user-provided thresholds in thresh_dict/ Args: thresh_dict (dict): dictionary of diagnostic->threshold functions i...
['def', 'flag_all', '(', 'self', ',', 'thresh_dict', '=', 'None', ',', 'include', '=', 'None', ',', 'exclude', '=', 'None', ')', ':', 'if', 'thresh_dict', 'is', 'None', ':', 'thresh_dict', '=', '{', '}', 'row_idx', '=', 'set', '(', ')', 'col_idx', '=', 'set', '(', ')', 'include', '=', 'self', '.', 'results', 'if', 'inc...
Returns indices of (rows, columns) that satisfy flag() on any diagnostic. Uses user-provided thresholds in thresh_dict/ Args: thresh_dict (dict): dictionary of diagnostic->threshold functions include (list): optional sublist of diagnostics to flag exclude (list): opt...
['Returns', 'indices', 'of', '(', 'rows', 'columns', ')', 'that', 'satisfy', 'flag', '()', 'on', 'any', 'diagnostic', '.', 'Uses', 'user', '-', 'provided', 'thresholds', 'in', 'thresh_dict', '/']
train
https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/diagnostics/diagnostics.py#L186-L214
1,391
contentful/contentful-management.py
contentful_management/space.py
Space.create_attributes
def create_attributes(klass, attributes, previous_object=None): """Attributes for space creation.""" if previous_object is not None: return {'name': attributes.get('name', previous_object.name)} return { 'name': attributes.get('name', ''), 'defaultLocale': at...
python
def create_attributes(klass, attributes, previous_object=None): """Attributes for space creation.""" if previous_object is not None: return {'name': attributes.get('name', previous_object.name)} return { 'name': attributes.get('name', ''), 'defaultLocale': at...
['def', 'create_attributes', '(', 'klass', ',', 'attributes', ',', 'previous_object', '=', 'None', ')', ':', 'if', 'previous_object', 'is', 'not', 'None', ':', 'return', '{', "'name'", ':', 'attributes', '.', 'get', '(', "'name'", ',', 'previous_object', '.', 'name', ')', '}', 'return', '{', "'name'", ':', 'attributes'...
Attributes for space creation.
['Attributes', 'for', 'space', 'creation', '.']
train
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/space.py#L54-L62
1,392
inveniosoftware/invenio-files-rest
invenio_files_rest/models.py
MultipartObject.merge_parts
def merge_parts(self, version_id=None, **kwargs): """Merge parts into object version.""" self.file.update_checksum(**kwargs) with db.session.begin_nested(): obj = ObjectVersion.create( self.bucket, self.key, _file_id=self.file_id, ...
python
def merge_parts(self, version_id=None, **kwargs): """Merge parts into object version.""" self.file.update_checksum(**kwargs) with db.session.begin_nested(): obj = ObjectVersion.create( self.bucket, self.key, _file_id=self.file_id, ...
['def', 'merge_parts', '(', 'self', ',', 'version_id', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'self', '.', 'file', '.', 'update_checksum', '(', '*', '*', 'kwargs', ')', 'with', 'db', '.', 'session', '.', 'begin_nested', '(', ')', ':', 'obj', '=', 'ObjectVersion', '.', 'create', '(', 'self', '.', 'bucket', ',',...
Merge parts into object version.
['Merge', 'parts', 'into', 'object', 'version', '.']
train
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/models.py#L1490-L1501
1,393
fabioz/PyDev.Debugger
third_party/pep8/pycodestyle.py
whitespace_around_comma
def whitespace_around_comma(logical_line): r"""Avoid extraneous whitespace after a comma or a colon. Note: these checks are disabled by default Okay: a = (1, 2) E241: a = (1, 2) E242: a = (1,\t2) """ line = logical_line for m in WHITESPACE_AFTER_COMMA_REGEX.finditer(line): fou...
python
def whitespace_around_comma(logical_line): r"""Avoid extraneous whitespace after a comma or a colon. Note: these checks are disabled by default Okay: a = (1, 2) E241: a = (1, 2) E242: a = (1,\t2) """ line = logical_line for m in WHITESPACE_AFTER_COMMA_REGEX.finditer(line): fou...
['def', 'whitespace_around_comma', '(', 'logical_line', ')', ':', 'line', '=', 'logical_line', 'for', 'm', 'in', 'WHITESPACE_AFTER_COMMA_REGEX', '.', 'finditer', '(', 'line', ')', ':', 'found', '=', 'm', '.', 'start', '(', ')', '+', '1', 'if', "'\\t'", 'in', 'm', '.', 'group', '(', ')', ':', 'yield', 'found', ',', '"E2...
r"""Avoid extraneous whitespace after a comma or a colon. Note: these checks are disabled by default Okay: a = (1, 2) E241: a = (1, 2) E242: a = (1,\t2)
['r', 'Avoid', 'extraneous', 'whitespace', 'after', 'a', 'comma', 'or', 'a', 'colon', '.']
train
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/pycodestyle.py#L791-L806
1,394
Accelize/pycosio
pycosio/storage/s3.py
_S3System._remove
def _remove(self, client_kwargs): """ Remove an object. args: client_kwargs (dict): Client arguments. """ with _handle_client_error(): # Object if 'Key' in client_kwargs: return self.client.delete_object(**client_kwargs) ...
python
def _remove(self, client_kwargs): """ Remove an object. args: client_kwargs (dict): Client arguments. """ with _handle_client_error(): # Object if 'Key' in client_kwargs: return self.client.delete_object(**client_kwargs) ...
['def', '_remove', '(', 'self', ',', 'client_kwargs', ')', ':', 'with', '_handle_client_error', '(', ')', ':', '# Object', 'if', "'Key'", 'in', 'client_kwargs', ':', 'return', 'self', '.', 'client', '.', 'delete_object', '(', '*', '*', 'client_kwargs', ')', '# Bucket', 'return', 'self', '.', 'client', '.', 'delete_buck...
Remove an object. args: client_kwargs (dict): Client arguments.
['Remove', 'an', 'object', '.']
train
https://github.com/Accelize/pycosio/blob/1cc1f8fdf5394d92918b7bae2bfa682169ccc48c/pycosio/storage/s3.py#L247-L260
1,395
aws/sagemaker-containers
src/sagemaker_containers/_env.py
read_hyperparameters
def read_hyperparameters(): # type: () -> dict """Read the hyperparameters from /opt/ml/input/config/hyperparameters.json. For more information about hyperparameters.json: https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-training-algo.html#your-algorithms-training-algo-running-container-hyp...
python
def read_hyperparameters(): # type: () -> dict """Read the hyperparameters from /opt/ml/input/config/hyperparameters.json. For more information about hyperparameters.json: https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-training-algo.html#your-algorithms-training-algo-running-container-hyp...
['def', 'read_hyperparameters', '(', ')', ':', '# type: () -> dict', 'hyperparameters', '=', '_read_json', '(', 'hyperparameters_file_dir', ')', 'deserialized_hps', '=', '{', '}', 'for', 'k', ',', 'v', 'in', 'hyperparameters', '.', 'items', '(', ')', ':', 'try', ':', 'v', '=', 'json', '.', 'loads', '(', 'v', ')', 'exce...
Read the hyperparameters from /opt/ml/input/config/hyperparameters.json. For more information about hyperparameters.json: https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-training-algo.html#your-algorithms-training-algo-running-container-hyperparameters Returns: (dict[string, objec...
['Read', 'the', 'hyperparameters', 'from', '/', 'opt', '/', 'ml', '/', 'input', '/', 'config', '/', 'hyperparameters', '.', 'json', '.']
train
https://github.com/aws/sagemaker-containers/blob/0030f07abbaf22a55d986d97274d7a8d1aa1f10c/src/sagemaker_containers/_env.py#L197-L219
1,396
googledatalab/pydatalab
solutionbox/ml_workbench/xgboost/trainer/feature_transforms.py
get_transformed_feature_indices
def get_transformed_feature_indices(features, stats): """Returns information about the transformed features. Returns: List in the from [(transformed_feature_name, {size: int, index_start: int})] """ feature_indices = [] index_start = 1 for name, transform in sorted(six.iteritems(features)): tr...
python
def get_transformed_feature_indices(features, stats): """Returns information about the transformed features. Returns: List in the from [(transformed_feature_name, {size: int, index_start: int})] """ feature_indices = [] index_start = 1 for name, transform in sorted(six.iteritems(features)): tr...
['def', 'get_transformed_feature_indices', '(', 'features', ',', 'stats', ')', ':', 'feature_indices', '=', '[', ']', 'index_start', '=', '1', 'for', 'name', ',', 'transform', 'in', 'sorted', '(', 'six', '.', 'iteritems', '(', 'features', ')', ')', ':', 'transform_name', '=', 'transform', '[', "'transform'", ']', 'sour...
Returns information about the transformed features. Returns: List in the from [(transformed_feature_name, {size: int, index_start: int})]
['Returns', 'information', 'about', 'the', 'transformed', 'features', '.']
train
https://github.com/googledatalab/pydatalab/blob/d9031901d5bca22fe0d5925d204e6698df9852e1/solutionbox/ml_workbench/xgboost/trainer/feature_transforms.py#L415-L444
1,397
angr/angr
angr/state_plugins/heap/heap_ptmalloc.py
SimHeapPTMalloc._find_bck
def _find_bck(self, chunk): """ Simply finds the free chunk that would be the backwards chunk relative to the chunk at ptr. Hence, the free head and all other metadata are unaltered by this function. """ cur = self.free_head_chunk if cur is None: return None ...
python
def _find_bck(self, chunk): """ Simply finds the free chunk that would be the backwards chunk relative to the chunk at ptr. Hence, the free head and all other metadata are unaltered by this function. """ cur = self.free_head_chunk if cur is None: return None ...
['def', '_find_bck', '(', 'self', ',', 'chunk', ')', ':', 'cur', '=', 'self', '.', 'free_head_chunk', 'if', 'cur', 'is', 'None', ':', 'return', 'None', 'fwd', '=', 'cur', '.', 'fwd_chunk', '(', ')', 'if', 'cur', '==', 'fwd', ':', 'return', 'cur', '# At this point there should be at least two free chunks in the heap', '...
Simply finds the free chunk that would be the backwards chunk relative to the chunk at ptr. Hence, the free head and all other metadata are unaltered by this function.
['Simply', 'finds', 'the', 'free', 'chunk', 'that', 'would', 'be', 'the', 'backwards', 'chunk', 'relative', 'to', 'the', 'chunk', 'at', 'ptr', '.', 'Hence', 'the', 'free', 'head', 'and', 'all', 'other', 'metadata', 'are', 'unaltered', 'by', 'this', 'function', '.']
train
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L281-L302
1,398
tomnor/channelpack
channelpack/pulltxt.py
PatternPull.file_rows
def file_rows(self, fo): """Return the lines in the file as a list. fo is the open file object.""" rows = [] for i in range(NUMROWS): line = fo.readline() if not line: break rows += [line] return rows
python
def file_rows(self, fo): """Return the lines in the file as a list. fo is the open file object.""" rows = [] for i in range(NUMROWS): line = fo.readline() if not line: break rows += [line] return rows
['def', 'file_rows', '(', 'self', ',', 'fo', ')', ':', 'rows', '=', '[', ']', 'for', 'i', 'in', 'range', '(', 'NUMROWS', ')', ':', 'line', '=', 'fo', '.', 'readline', '(', ')', 'if', 'not', 'line', ':', 'break', 'rows', '+=', '[', 'line', ']', 'return', 'rows']
Return the lines in the file as a list. fo is the open file object.
['Return', 'the', 'lines', 'in', 'the', 'file', 'as', 'a', 'list', '.']
train
https://github.com/tomnor/channelpack/blob/9ad3cd11c698aed4c0fc178385b2ba38a7d0efae/channelpack/pulltxt.py#L101-L113
1,399
larryng/narwal
narwal/reddit.py
Reddit.flair
def flair(self, r, name, text, css_class): """Login required. Sets flair for a user. See https://github.com/reddit/reddit/wiki/API%3A-flair. Returns True or raises :class:`exceptions.UnexpectedResponse` if non-"truthy" value in response. URL: ``http://www.reddit.com/api/flair`` ...
python
def flair(self, r, name, text, css_class): """Login required. Sets flair for a user. See https://github.com/reddit/reddit/wiki/API%3A-flair. Returns True or raises :class:`exceptions.UnexpectedResponse` if non-"truthy" value in response. URL: ``http://www.reddit.com/api/flair`` ...
['def', 'flair', '(', 'self', ',', 'r', ',', 'name', ',', 'text', ',', 'css_class', ')', ':', 'data', '=', 'dict', '(', 'r', '=', 'r', ',', 'name', '=', 'name', ',', 'text', '=', 'text', ',', 'css_class', '=', 'css_class', ')', 'j', '=', 'self', '.', 'post', '(', "'api'", ',', "'flair'", ',', 'data', '=', 'data', ')', ...
Login required. Sets flair for a user. See https://github.com/reddit/reddit/wiki/API%3A-flair. Returns True or raises :class:`exceptions.UnexpectedResponse` if non-"truthy" value in response. URL: ``http://www.reddit.com/api/flair`` :param r: name of subreddit :param name: n...
['Login', 'required', '.', 'Sets', 'flair', 'for', 'a', 'user', '.', 'See', 'https', ':', '//', 'github', '.', 'com', '/', 'reddit', '/', 'reddit', '/', 'wiki', '/', 'API%3A', '-', 'flair', '.', 'Returns', 'True', 'or', 'raises', ':', 'class', ':', 'exceptions', '.', 'UnexpectedResponse', 'if', 'non', '-', 'truthy', 'v...
train
https://github.com/larryng/narwal/blob/58c409a475c8ed865579a61d7010162ed8cef597/narwal/reddit.py#L877-L889