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,200
lexich/yandex-disk-webdav
yandexwebdav.py
Config.downloadTo
def downloadTo(self, href, localpath): """ Download file to localstorage :param href: remote path :param localpath: local path :return: response """ for iTry in range(TRYINGS): logger.info(u("downloadTo(%s): %s %s") % (iTry, href, localpath)) ...
python
def downloadTo(self, href, localpath): """ Download file to localstorage :param href: remote path :param localpath: local path :return: response """ for iTry in range(TRYINGS): logger.info(u("downloadTo(%s): %s %s") % (iTry, href, localpath)) ...
['def', 'downloadTo', '(', 'self', ',', 'href', ',', 'localpath', ')', ':', 'for', 'iTry', 'in', 'range', '(', 'TRYINGS', ')', ':', 'logger', '.', 'info', '(', 'u', '(', '"downloadTo(%s): %s %s"', ')', '%', '(', 'iTry', ',', 'href', ',', 'localpath', ')', ')', 'try', ':', 'href', '=', 'remote', '(', 'href', ')', 'local...
Download file to localstorage :param href: remote path :param localpath: local path :return: response
['Download', 'file', 'to', 'localstorage', ':', 'param', 'href', ':', 'remote', 'path', ':', 'param', 'localpath', ':', 'local', 'path', ':', 'return', ':', 'response']
train
https://github.com/lexich/yandex-disk-webdav/blob/669f51f999ed14e137454b90e7d035e2ca171c75/yandexwebdav.py#L362-L398
1,201
rwl/pylon
pylon/ac_pf.py
FastDecoupledPF._p_iteration
def _p_iteration(self, P, Bp_solver, Vm, Va, pvpq): """ Performs a P iteration, updates Va. """ dVa = -Bp_solver.solve(P) # Update voltage. Va[pvpq] = Va[pvpq] + dVa V = Vm * exp(1j * Va) return V, Vm, Va
python
def _p_iteration(self, P, Bp_solver, Vm, Va, pvpq): """ Performs a P iteration, updates Va. """ dVa = -Bp_solver.solve(P) # Update voltage. Va[pvpq] = Va[pvpq] + dVa V = Vm * exp(1j * Va) return V, Vm, Va
['def', '_p_iteration', '(', 'self', ',', 'P', ',', 'Bp_solver', ',', 'Vm', ',', 'Va', ',', 'pvpq', ')', ':', 'dVa', '=', '-', 'Bp_solver', '.', 'solve', '(', 'P', ')', '# Update voltage.', 'Va', '[', 'pvpq', ']', '=', 'Va', '[', 'pvpq', ']', '+', 'dVa', 'V', '=', 'Vm', '*', 'exp', '(', '1j', '*', 'Va', ')', 'return', ...
Performs a P iteration, updates Va.
['Performs', 'a', 'P', 'iteration', 'updates', 'Va', '.']
train
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/ac_pf.py#L479-L488
1,202
mila/pyoo
pyoo.py
Chart.change_type
def change_type(self, cls): """ Change type of diagram in this chart. Accepts one of classes which extend Diagram. """ target_type = cls._type target = self._embedded.createInstance(target_type) self._embedded.setDiagram(target) return cls(target)
python
def change_type(self, cls): """ Change type of diagram in this chart. Accepts one of classes which extend Diagram. """ target_type = cls._type target = self._embedded.createInstance(target_type) self._embedded.setDiagram(target) return cls(target)
['def', 'change_type', '(', 'self', ',', 'cls', ')', ':', 'target_type', '=', 'cls', '.', '_type', 'target', '=', 'self', '.', '_embedded', '.', 'createInstance', '(', 'target_type', ')', 'self', '.', '_embedded', '.', 'setDiagram', '(', 'target', ')', 'return', 'cls', '(', 'target', ')']
Change type of diagram in this chart. Accepts one of classes which extend Diagram.
['Change', 'type', 'of', 'diagram', 'in', 'this', 'chart', '.']
train
https://github.com/mila/pyoo/blob/1e024999f608c87ea72cd443e39c89eb0ba3cc62/pyoo.py#L824-L833
1,203
the-tale/pynames
pynames/from_tables_generator.py
FromCSVTablesGenerator.source_loader
def source_loader(self, source_paths, create_missing_tables=True): """Load source from 3 csv files. First file should contain global settings: * ``native_lagnauge,languages`` header on first row * appropriate values on following rows Example:: native_lagnauge,lang...
python
def source_loader(self, source_paths, create_missing_tables=True): """Load source from 3 csv files. First file should contain global settings: * ``native_lagnauge,languages`` header on first row * appropriate values on following rows Example:: native_lagnauge,lang...
['def', 'source_loader', '(', 'self', ',', 'source_paths', ',', 'create_missing_tables', '=', 'True', ')', ':', 'if', 'not', 'isinstance', '(', 'source_paths', ',', 'Iterable', ')', 'or', 'len', '(', 'source_paths', ')', '<', '3', ':', 'raise', 'TypeError', '(', "'FromCSVTablesGenerator.source_loader accepts list of 3 ...
Load source from 3 csv files. First file should contain global settings: * ``native_lagnauge,languages`` header on first row * appropriate values on following rows Example:: native_lagnauge,languages ru,ru ,en Second file should contain ...
['Load', 'source', 'from', '3', 'csv', 'files', '.']
train
https://github.com/the-tale/pynames/blob/da45eaaac3166847bcb2c48cab4571a462660ace/pynames/from_tables_generator.py#L179-L238
1,204
daniellawrence/graphitesend
graphitesend/graphitesend.py
GraphiteClient.autoreconnect
def autoreconnect(self, sleep=1, attempt=3, exponential=True, jitter=5): """ Tries to reconnect with some delay: exponential=False: up to `attempt` times with `sleep` seconds between each try exponential=True: up to `attempt` times with exponential growing `sleep` and r...
python
def autoreconnect(self, sleep=1, attempt=3, exponential=True, jitter=5): """ Tries to reconnect with some delay: exponential=False: up to `attempt` times with `sleep` seconds between each try exponential=True: up to `attempt` times with exponential growing `sleep` and r...
['def', 'autoreconnect', '(', 'self', ',', 'sleep', '=', '1', ',', 'attempt', '=', '3', ',', 'exponential', '=', 'True', ',', 'jitter', '=', '5', ')', ':', 'p', '=', '0', 'while', 'attempt', 'is', 'None', 'or', 'attempt', '>', '0', ':', 'try', ':', 'self', '.', 'reconnect', '(', ')', 'return', 'True', 'except', 'Graphi...
Tries to reconnect with some delay: exponential=False: up to `attempt` times with `sleep` seconds between each try exponential=True: up to `attempt` times with exponential growing `sleep` and random delay in range 1..`jitter` (exponential backoff) :param sleep: time to sleep ...
['Tries', 'to', 'reconnect', 'with', 'some', 'delay', ':']
train
https://github.com/daniellawrence/graphitesend/blob/02281263e642f9b6e146886d4544e1d7aebd7753/graphitesend/graphitesend.py#L175-L213
1,205
tBaxter/tango-comments
build/lib/tango_comments/forms.py
CommentSecurityForm.generate_security_hash
def generate_security_hash(self, content_type, object_pk, timestamp): """ Generate a HMAC security hash from the provided info. """ info = (content_type, object_pk, timestamp) key_salt = "django.contrib.forms.CommentSecurityForm" value = "-".join(info) return salt...
python
def generate_security_hash(self, content_type, object_pk, timestamp): """ Generate a HMAC security hash from the provided info. """ info = (content_type, object_pk, timestamp) key_salt = "django.contrib.forms.CommentSecurityForm" value = "-".join(info) return salt...
['def', 'generate_security_hash', '(', 'self', ',', 'content_type', ',', 'object_pk', ',', 'timestamp', ')', ':', 'info', '=', '(', 'content_type', ',', 'object_pk', ',', 'timestamp', ')', 'key_salt', '=', '"django.contrib.forms.CommentSecurityForm"', 'value', '=', '"-"', '.', 'join', '(', 'info', ')', 'return', 'salte...
Generate a HMAC security hash from the provided info.
['Generate', 'a', 'HMAC', 'security', 'hash', 'from', 'the', 'provided', 'info', '.']
train
https://github.com/tBaxter/tango-comments/blob/1fd335c6fc9e81bba158e42e1483f1a149622ab4/build/lib/tango_comments/forms.py#L86-L93
1,206
mitsei/dlkit
dlkit/json_/repository/objects.py
AssetContentForm.clear_url
def clear_url(self): """Removes the url. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.repository.AssetConten...
python
def clear_url(self): """Removes the url. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.repository.AssetConten...
['def', 'clear_url', '(', 'self', ')', ':', '# Implemented from template for osid.repository.AssetContentForm.clear_url_template', 'if', '(', 'self', '.', 'get_url_metadata', '(', ')', '.', 'is_read_only', '(', ')', 'or', 'self', '.', 'get_url_metadata', '(', ')', '.', 'is_required', '(', ')', ')', ':', 'raise', 'error...
Removes the url. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.*
['Removes', 'the', 'url', '.']
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/objects.py#L1727-L1739
1,207
pypa/pipenv
pipenv/vendor/urllib3/util/ssl_.py
is_ipaddress
def is_ipaddress(hostname): """Detects whether the hostname given is an IP address. :param str hostname: Hostname to examine. :return: True if the hostname is an IP address, False otherwise. """ if six.PY3 and isinstance(hostname, bytes): # IDN A-label bytes are ASCII compatible. ho...
python
def is_ipaddress(hostname): """Detects whether the hostname given is an IP address. :param str hostname: Hostname to examine. :return: True if the hostname is an IP address, False otherwise. """ if six.PY3 and isinstance(hostname, bytes): # IDN A-label bytes are ASCII compatible. ho...
['def', 'is_ipaddress', '(', 'hostname', ')', ':', 'if', 'six', '.', 'PY3', 'and', 'isinstance', '(', 'hostname', ',', 'bytes', ')', ':', '# IDN A-label bytes are ASCII compatible.', 'hostname', '=', 'hostname', '.', 'decode', '(', "'ascii'", ')', 'families', '=', '[', 'socket', '.', 'AF_INET', ']', 'if', 'hasattr', '(...
Detects whether the hostname given is an IP address. :param str hostname: Hostname to examine. :return: True if the hostname is an IP address, False otherwise.
['Detects', 'whether', 'the', 'hostname', 'given', 'is', 'an', 'IP', 'address', '.']
train
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/urllib3/util/ssl_.py#L360-L381
1,208
Carbonara-Project/Guanciale
guanciale/idblib.py
idaunpack
def idaunpack(buf): """ Special data packing format, used in struct definitions, and .id2 files sdk functions: pack_dd etc. """ buf = bytearray(buf) def nextval(o): val = buf[o] ; o += 1 if val == 0xff: # 32 bit value val, = struct.unpack_from(">L", buf,...
python
def idaunpack(buf): """ Special data packing format, used in struct definitions, and .id2 files sdk functions: pack_dd etc. """ buf = bytearray(buf) def nextval(o): val = buf[o] ; o += 1 if val == 0xff: # 32 bit value val, = struct.unpack_from(">L", buf,...
['def', 'idaunpack', '(', 'buf', ')', ':', 'buf', '=', 'bytearray', '(', 'buf', ')', 'def', 'nextval', '(', 'o', ')', ':', 'val', '=', 'buf', '[', 'o', ']', 'o', '+=', '1', 'if', 'val', '==', '0xff', ':', '# 32 bit value\r', 'val', ',', '=', 'struct', '.', 'unpack_from', '(', '">L"', ',', 'buf', ',', 'o', ')', 'o', '+=...
Special data packing format, used in struct definitions, and .id2 files sdk functions: pack_dd etc.
['Special', 'data', 'packing', 'format', 'used', 'in', 'struct', 'definitions', 'and', '.', 'id2', 'files', 'sdk', 'functions', ':', 'pack_dd', 'etc', '.']
train
https://github.com/Carbonara-Project/Guanciale/blob/c239ffac6fb481d09c4071d1de1a09f60dc584ab/guanciale/idblib.py#L161-L194
1,209
ArabellaTech/django-basic-cms
basic_cms/utils.py
json_to_pages
def json_to_pages(json, user, preferred_lang=None): """ Attept to create/update pages from JSON string json. user is the user that will be used when creating a page if a page's original author can't be found. preferred_lang is the language code of the slugs to include in error messages (defaults t...
python
def json_to_pages(json, user, preferred_lang=None): """ Attept to create/update pages from JSON string json. user is the user that will be used when creating a page if a page's original author can't be found. preferred_lang is the language code of the slugs to include in error messages (defaults t...
['def', 'json_to_pages', '(', 'json', ',', 'user', ',', 'preferred_lang', '=', 'None', ')', ':', 'from', '.', 'models', 'import', 'Page', 'if', 'not', 'preferred_lang', ':', 'preferred_lang', '=', 'settings', '.', 'PAGE_DEFAULT_LANGUAGE', 'd', '=', 'simplejson', '.', 'loads', '(', 'json', ')', 'try', ':', 'errors', '='...
Attept to create/update pages from JSON string json. user is the user that will be used when creating a page if a page's original author can't be found. preferred_lang is the language code of the slugs to include in error messages (defaults to settings.PAGE_DEFAULT_LANGUAGE). Returns (errors, pag...
['Attept', 'to', 'create', '/', 'update', 'pages', 'from', 'JSON', 'string', 'json', '.', 'user', 'is', 'the', 'user', 'that', 'will', 'be', 'used', 'when', 'creating', 'a', 'page', 'if', 'a', 'page', 's', 'original', 'author', 'can', 't', 'be', 'found', '.', 'preferred_lang', 'is', 'the', 'language', 'code', 'of', 'th...
train
https://github.com/ArabellaTech/django-basic-cms/blob/863f3c6098606f663994930cd8e7723ad0c07caf/basic_cms/utils.py#L49-L89
1,210
litters/shrew
shrew/utils/auth.py
get_password_from_keyring
def get_password_from_keyring(entry=None, username=None): """ :param entry: The entry in the keychain. This is a caller specific key. :param username: The username to get the password for. Default is the current user. """ if username is None: username = get_username() has_keychain ...
python
def get_password_from_keyring(entry=None, username=None): """ :param entry: The entry in the keychain. This is a caller specific key. :param username: The username to get the password for. Default is the current user. """ if username is None: username = get_username() has_keychain ...
['def', 'get_password_from_keyring', '(', 'entry', '=', 'None', ',', 'username', '=', 'None', ')', ':', 'if', 'username', 'is', 'None', ':', 'username', '=', 'get_username', '(', ')', 'has_keychain', '=', 'initialize_keychain', '(', ')', "# Unlock the user's keychain otherwise, if running under SSH, 'security(1)' will ...
:param entry: The entry in the keychain. This is a caller specific key. :param username: The username to get the password for. Default is the current user.
[':', 'param', 'entry', ':', 'The', 'entry', 'in', 'the', 'keychain', '.', 'This', 'is', 'a', 'caller', 'specific', 'key', '.', ':', 'param', 'username', ':', 'The', 'username', 'to', 'get', 'the', 'password', 'for', '.', 'Default', 'is', 'the', 'current', 'user', '.']
train
https://github.com/litters/shrew/blob/ed4b1879321d858d6bc884d14fea7557372a4d41/shrew/utils/auth.py#L226-L247
1,211
novopl/peltak
src/peltak/extra/gitflow/logic/hotfix.py
finish
def finish(): # type: () -> None """ Merge current feature into develop. """ pretend = context.get('pretend', False) if not pretend and (git.staged() or git.unstaged()): log.err( "You have uncommitted changes in your repo!\n" "You need to stash them before you merge the ...
python
def finish(): # type: () -> None """ Merge current feature into develop. """ pretend = context.get('pretend', False) if not pretend and (git.staged() or git.unstaged()): log.err( "You have uncommitted changes in your repo!\n" "You need to stash them before you merge the ...
['def', 'finish', '(', ')', ':', '# type: () -> None', 'pretend', '=', 'context', '.', 'get', '(', "'pretend'", ',', 'False', ')', 'if', 'not', 'pretend', 'and', '(', 'git', '.', 'staged', '(', ')', 'or', 'git', '.', 'unstaged', '(', ')', ')', ':', 'log', '.', 'err', '(', '"You have uncommitted changes in your repo!\\n...
Merge current feature into develop.
['Merge', 'current', 'feature', 'into', 'develop', '.']
train
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/logic/hotfix.py#L76-L108
1,212
JarryShaw/PyPCAPKit
src/corekit/protochain.py
_AliasList.count
def count(self, value): """S.count(value) -> integer -- return number of occurrences of value""" from pcapkit.protocols.protocol import Protocol try: flag = issubclass(value, Protocol) except TypeError: flag = issubclass(type(value), Protocol) if flag or i...
python
def count(self, value): """S.count(value) -> integer -- return number of occurrences of value""" from pcapkit.protocols.protocol import Protocol try: flag = issubclass(value, Protocol) except TypeError: flag = issubclass(type(value), Protocol) if flag or i...
['def', 'count', '(', 'self', ',', 'value', ')', ':', 'from', 'pcapkit', '.', 'protocols', '.', 'protocol', 'import', 'Protocol', 'try', ':', 'flag', '=', 'issubclass', '(', 'value', ',', 'Protocol', ')', 'except', 'TypeError', ':', 'flag', '=', 'issubclass', '(', 'type', '(', 'value', ')', ',', 'Protocol', ')', 'if', ...
S.count(value) -> integer -- return number of occurrences of value
['S', '.', 'count', '(', 'value', ')', '-', '>', 'integer', '--', 'return', 'number', 'of', 'occurrences', 'of', 'value']
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/corekit/protochain.py#L116-L130
1,213
ahwillia/tensortools
tensortools/visualization.py
plot_similarity
def plot_similarity(ensemble, ax=None, jitter=0.1, scatter_kw=dict(), line_kw=dict()): """Plots similarity across optimization runs as a function of model rank. Parameters ---------- ensemble : Ensemble object holds optimization results across a range of model ranks ax :...
python
def plot_similarity(ensemble, ax=None, jitter=0.1, scatter_kw=dict(), line_kw=dict()): """Plots similarity across optimization runs as a function of model rank. Parameters ---------- ensemble : Ensemble object holds optimization results across a range of model ranks ax :...
['def', 'plot_similarity', '(', 'ensemble', ',', 'ax', '=', 'None', ',', 'jitter', '=', '0.1', ',', 'scatter_kw', '=', 'dict', '(', ')', ',', 'line_kw', '=', 'dict', '(', ')', ')', ':', 'if', 'ax', 'is', 'None', ':', 'ax', '=', 'plt', '.', 'gca', '(', ')', '# compile statistics for plotting', 'x', ',', 'sim', ',', 'mea...
Plots similarity across optimization runs as a function of model rank. Parameters ---------- ensemble : Ensemble object holds optimization results across a range of model ranks ax : matplotlib axis (optional) axis to plot on (defaults to current axis object) jitter : float (optional...
['Plots', 'similarity', 'across', 'optimization', 'runs', 'as', 'a', 'function', 'of', 'model', 'rank', '.']
train
https://github.com/ahwillia/tensortools/blob/f375633ec621caa96665a56205dcf932590d4a6e/tensortools/visualization.py#L64-L113
1,214
project-ncl/pnc-cli
pnc_cli/tools/tasks.py
Tasks.tsort
def tsort(self): """Given a partial ordering, return a totally ordered list. part is a dict of partial orderings. Each value is a set, which the key depends on. The return value is a list of sets, each of which has only dependencies on items in previous entries in the list. ...
python
def tsort(self): """Given a partial ordering, return a totally ordered list. part is a dict of partial orderings. Each value is a set, which the key depends on. The return value is a list of sets, each of which has only dependencies on items in previous entries in the list. ...
['def', 'tsort', '(', 'self', ')', ':', 'task_dict', '=', '{', '}', 'for', 'key', ',', 'task', 'in', 'self', '.', 'tasks', '.', 'iteritems', '(', ')', ':', 'task_dict', '[', 'task', ']', '=', 'task', '.', 'dependencies', '# parts = parts.copy()', 'parts', '=', 'task_dict', '.', 'copy', '(', ')', 'result', '=', '[', ']'...
Given a partial ordering, return a totally ordered list. part is a dict of partial orderings. Each value is a set, which the key depends on. The return value is a list of sets, each of which has only dependencies on items in previous entries in the list. raise ValueError if o...
['Given', 'a', 'partial', 'ordering', 'return', 'a', 'totally', 'ordered', 'list', '.']
train
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/tools/tasks.py#L197-L223
1,215
awickert/gFlex
gflex/f1d.py
F1D.calc_max_flexural_wavelength
def calc_max_flexural_wavelength(self): """ Returns the approximate maximum flexural wavelength This is important when padding of the grid is required: in Flexure (this code), grids are padded out to one maximum flexural wavelength, but in any case, the flexural wavelength is a good character...
python
def calc_max_flexural_wavelength(self): """ Returns the approximate maximum flexural wavelength This is important when padding of the grid is required: in Flexure (this code), grids are padded out to one maximum flexural wavelength, but in any case, the flexural wavelength is a good character...
['def', 'calc_max_flexural_wavelength', '(', 'self', ')', ':', 'if', 'np', '.', 'isscalar', '(', 'self', '.', 'D', ')', ':', 'Dmax', '=', 'self', '.', 'D', 'else', ':', 'Dmax', '=', 'self', '.', 'D', '.', 'max', '(', ')', '# This is an approximation if there is fill that evolves with iterations \r', "# (e.g., water), b...
Returns the approximate maximum flexural wavelength This is important when padding of the grid is required: in Flexure (this code), grids are padded out to one maximum flexural wavelength, but in any case, the flexural wavelength is a good characteristic distance for any truncation limit
['Returns', 'the', 'approximate', 'maximum', 'flexural', 'wavelength', 'This', 'is', 'important', 'when', 'padding', 'of', 'the', 'grid', 'is', 'required', ':', 'in', 'Flexure', '(', 'this', 'code', ')', 'grids', 'are', 'padded', 'out', 'to', 'one', 'maximum', 'flexural', 'wavelength', 'but', 'in', 'any', 'case', 'the'...
train
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/f1d.py#L562-L578
1,216
tanghaibao/jcvi
jcvi/annotation/qc.py
uniq
def uniq(args): """ %prog uniq gffile cdsfasta Remove overlapping gene models. Similar to formats.gff.uniq(), overlapping 'piles' are processed, one by one. Here, we use a different algorithm, that retains the best non-overlapping subset witin each pile, rather than single best model. Scoring ...
python
def uniq(args): """ %prog uniq gffile cdsfasta Remove overlapping gene models. Similar to formats.gff.uniq(), overlapping 'piles' are processed, one by one. Here, we use a different algorithm, that retains the best non-overlapping subset witin each pile, rather than single best model. Scoring ...
['def', 'uniq', '(', 'args', ')', ':', 'p', '=', 'OptionParser', '(', 'uniq', '.', '__doc__', ')', 'p', '.', 'set_outfile', '(', ')', 'opts', ',', 'args', '=', 'p', '.', 'parse_args', '(', 'args', ')', 'if', 'len', '(', 'args', ')', '!=', '2', ':', 'sys', '.', 'exit', '(', 'not', 'p', '.', 'print_help', '(', ')', ')', ...
%prog uniq gffile cdsfasta Remove overlapping gene models. Similar to formats.gff.uniq(), overlapping 'piles' are processed, one by one. Here, we use a different algorithm, that retains the best non-overlapping subset witin each pile, rather than single best model. Scoring function is also differe...
['%prog', 'uniq', 'gffile', 'cdsfasta']
train
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/annotation/qc.py#L34-L80
1,217
phaethon/kamene
kamene/contrib/gsm_um.py
deactivatePdpContextAccept
def deactivatePdpContextAccept(): """DEACTIVATE PDP CONTEXT ACCEPT Section 9.5.9""" a = TpPd(pd=0x8) b = MessageType(mesType=0x47) # 01000111 packet = a / b return packet
python
def deactivatePdpContextAccept(): """DEACTIVATE PDP CONTEXT ACCEPT Section 9.5.9""" a = TpPd(pd=0x8) b = MessageType(mesType=0x47) # 01000111 packet = a / b return packet
['def', 'deactivatePdpContextAccept', '(', ')', ':', 'a', '=', 'TpPd', '(', 'pd', '=', '0x8', ')', 'b', '=', 'MessageType', '(', 'mesType', '=', '0x47', ')', '# 01000111', 'packet', '=', 'a', '/', 'b', 'return', 'packet']
DEACTIVATE PDP CONTEXT ACCEPT Section 9.5.9
['DEACTIVATE', 'PDP', 'CONTEXT', 'ACCEPT', 'Section', '9', '.', '5', '.', '9']
train
https://github.com/phaethon/kamene/blob/11d4064844f4f68ac5d7546f5633ac7d02082914/kamene/contrib/gsm_um.py#L2726-L2731
1,218
sentinel-hub/eo-learn
core/eolearn/core/core_tasks.py
RenameFeature.execute
def execute(self, eopatch): """Returns the EOPatch with renamed features. :param eopatch: input EOPatch :type eopatch: EOPatch :return: input EOPatch with the renamed features :rtype: EOPatch """ for feature_type, feature_name, new_feature_name in self.feature_ge...
python
def execute(self, eopatch): """Returns the EOPatch with renamed features. :param eopatch: input EOPatch :type eopatch: EOPatch :return: input EOPatch with the renamed features :rtype: EOPatch """ for feature_type, feature_name, new_feature_name in self.feature_ge...
['def', 'execute', '(', 'self', ',', 'eopatch', ')', ':', 'for', 'feature_type', ',', 'feature_name', ',', 'new_feature_name', 'in', 'self', '.', 'feature_gen', '(', 'eopatch', ')', ':', 'eopatch', '[', 'feature_type', ']', '[', 'new_feature_name', ']', '=', 'eopatch', '[', 'feature_type', ']', '[', 'feature_name', ']'...
Returns the EOPatch with renamed features. :param eopatch: input EOPatch :type eopatch: EOPatch :return: input EOPatch with the renamed features :rtype: EOPatch
['Returns', 'the', 'EOPatch', 'with', 'renamed', 'features', '.']
train
https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/core_tasks.py#L162-L174
1,219
yamcs/yamcs-python
yamcs-client/yamcs/client.py
YamcsClient.list_clients
def list_clients(self, instance=None): """ Lists the clients. :param Optional[str] instance: A Yamcs instance name. :rtype: ~collections.Iterable[yamcs.model.Client] """ # Server does not do pagination on listings of this resource. # Return an iterator anyway for...
python
def list_clients(self, instance=None): """ Lists the clients. :param Optional[str] instance: A Yamcs instance name. :rtype: ~collections.Iterable[yamcs.model.Client] """ # Server does not do pagination on listings of this resource. # Return an iterator anyway for...
['def', 'list_clients', '(', 'self', ',', 'instance', '=', 'None', ')', ':', '# Server does not do pagination on listings of this resource.', '# Return an iterator anyway for similarity with other API methods', 'url', '=', "'/clients'", 'if', 'instance', ':', 'url', '=', "'/instances/{}/clients'", '.', 'format', '(', '...
Lists the clients. :param Optional[str] instance: A Yamcs instance name. :rtype: ~collections.Iterable[yamcs.model.Client]
['Lists', 'the', 'clients', '.']
train
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/client.py#L312-L328
1,220
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
TargetRegistry.create_typed_target
def create_typed_target (self, type, project, name, sources, requirements, default_build, usage_requirements): """ Creates a TypedTarget with the specified properties. The 'name', 'sources', 'requirements', 'default_build' and 'usage_requirements' are assumed to be in the form specified ...
python
def create_typed_target (self, type, project, name, sources, requirements, default_build, usage_requirements): """ Creates a TypedTarget with the specified properties. The 'name', 'sources', 'requirements', 'default_build' and 'usage_requirements' are assumed to be in the form specified ...
['def', 'create_typed_target', '(', 'self', ',', 'type', ',', 'project', ',', 'name', ',', 'sources', ',', 'requirements', ',', 'default_build', ',', 'usage_requirements', ')', ':', 'assert', 'isinstance', '(', 'type', ',', 'basestring', ')', 'assert', 'isinstance', '(', 'project', ',', 'ProjectTarget', ')', 'assert', ...
Creates a TypedTarget with the specified properties. The 'name', 'sources', 'requirements', 'default_build' and 'usage_requirements' are assumed to be in the form specified by the user in Jamfile corresponding to 'project'.
['Creates', 'a', 'TypedTarget', 'with', 'the', 'specified', 'properties', '.', 'The', 'name', 'sources', 'requirements', 'default_build', 'and', 'usage_requirements', 'are', 'assumed', 'to', 'be', 'in', 'the', 'form', 'specified', 'by', 'the', 'user', 'in', 'Jamfile', 'corresponding', 'to', 'project', '.']
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L222-L237
1,221
SiLab-Bonn/pyBAR
pybar/fei4/register.py
load_configuration_from_text_file
def load_configuration_from_text_file(register, configuration_file): '''Loading configuration from text files to register object Parameters ---------- register : pybar.fei4.register object configuration_file : string Full path (directory and filename) of the configuration file. If na...
python
def load_configuration_from_text_file(register, configuration_file): '''Loading configuration from text files to register object Parameters ---------- register : pybar.fei4.register object configuration_file : string Full path (directory and filename) of the configuration file. If na...
['def', 'load_configuration_from_text_file', '(', 'register', ',', 'configuration_file', ')', ':', 'logging', '.', 'info', '(', '"Loading configuration: %s"', '%', 'configuration_file', ')', 'register', '.', 'configuration_file', '=', 'configuration_file', 'config_dict', '=', 'parse_global_config', '(', 'register', '.'...
Loading configuration from text files to register object Parameters ---------- register : pybar.fei4.register object configuration_file : string Full path (directory and filename) of the configuration file. If name is not given, reload configuration from file.
['Loading', 'configuration', 'from', 'text', 'files', 'to', 'register', 'object', 'Parameters', '----------', 'register', ':', 'pybar', '.', 'fei4', '.', 'register', 'object', 'configuration_file', ':', 'string', 'Full', 'path', '(', 'directory', 'and', 'filename', ')', 'of', 'the', 'configuration', 'file', '.', 'If', ...
train
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L715-L781
1,222
mikeywaites/flask-arrested
arrested/contrib/kim_arrested.py
KimRequestHandler.handle_error
def handle_error(self, exp): """Called if a Mapper returns MappingInvalid. Should handle the error and return it in the appropriate format, can be overridden in order to change the error format. :param exp: MappingInvalid exception raised """ payload = { "mes...
python
def handle_error(self, exp): """Called if a Mapper returns MappingInvalid. Should handle the error and return it in the appropriate format, can be overridden in order to change the error format. :param exp: MappingInvalid exception raised """ payload = { "mes...
['def', 'handle_error', '(', 'self', ',', 'exp', ')', ':', 'payload', '=', '{', '"message"', ':', '"Invalid or incomplete data provided."', ',', '"errors"', ':', 'exp', '.', 'errors', '}', 'self', '.', 'endpoint', '.', 'return_error', '(', 'self', '.', 'error_status', ',', 'payload', '=', 'payload', ')']
Called if a Mapper returns MappingInvalid. Should handle the error and return it in the appropriate format, can be overridden in order to change the error format. :param exp: MappingInvalid exception raised
['Called', 'if', 'a', 'Mapper', 'returns', 'MappingInvalid', '.', 'Should', 'handle', 'the', 'error', 'and', 'return', 'it', 'in', 'the', 'appropriate', 'format', 'can', 'be', 'overridden', 'in', 'order', 'to', 'change', 'the', 'error', 'format', '.']
train
https://github.com/mikeywaites/flask-arrested/blob/6b97ce2ad2765f9acab10f4726e310258aa51de0/arrested/contrib/kim_arrested.py#L126-L137
1,223
Yubico/python-pyhsm
pyhsm/ksm/yubikey_ksm.py
YHSM_KSMRequestHandler.my_address_string
def my_address_string(self): """ For logging client host without resolving. """ addr = getattr(self, 'client_address', ('', None))[0] # If listed in proxy_ips, use the X-Forwarded-For header, if present. if addr in self.proxy_ips: return self.headers.getheader('x-forwarded-f...
python
def my_address_string(self): """ For logging client host without resolving. """ addr = getattr(self, 'client_address', ('', None))[0] # If listed in proxy_ips, use the X-Forwarded-For header, if present. if addr in self.proxy_ips: return self.headers.getheader('x-forwarded-f...
['def', 'my_address_string', '(', 'self', ')', ':', 'addr', '=', 'getattr', '(', 'self', ',', "'client_address'", ',', '(', "''", ',', 'None', ')', ')', '[', '0', ']', '# If listed in proxy_ips, use the X-Forwarded-For header, if present.', 'if', 'addr', 'in', 'self', '.', 'proxy_ips', ':', 'return', 'self', '.', 'head...
For logging client host without resolving.
['For', 'logging', 'client', 'host', 'without', 'resolving', '.']
train
https://github.com/Yubico/python-pyhsm/blob/b6e2744d1ea15c352a0fc1d6ebc5950026b71311/pyhsm/ksm/yubikey_ksm.py#L174-L181
1,224
fabioz/PyDev.Debugger
_pydevd_bundle/pydevd_process_net_command_json.py
_PyDevJsonCommandProcessor.on_next_request
def on_next_request(self, py_db, request): ''' :param NextRequest request: ''' arguments = request.arguments # : :type arguments: NextArguments thread_id = arguments.threadId if py_db.get_use_libraries_filter(): step_cmd_id = CMD_STEP_OVER_MY_CODE el...
python
def on_next_request(self, py_db, request): ''' :param NextRequest request: ''' arguments = request.arguments # : :type arguments: NextArguments thread_id = arguments.threadId if py_db.get_use_libraries_filter(): step_cmd_id = CMD_STEP_OVER_MY_CODE el...
['def', 'on_next_request', '(', 'self', ',', 'py_db', ',', 'request', ')', ':', 'arguments', '=', 'request', '.', 'arguments', '# : :type arguments: NextArguments', 'thread_id', '=', 'arguments', '.', 'threadId', 'if', 'py_db', '.', 'get_use_libraries_filter', '(', ')', ':', 'step_cmd_id', '=', 'CMD_STEP_OVER_MY_CODE',...
:param NextRequest request:
[':', 'param', 'NextRequest', 'request', ':']
train
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydevd_bundle/pydevd_process_net_command_json.py#L333-L348
1,225
mozilla-releng/scriptworker
scriptworker/ed25519.py
verify_ed25519_signature
def verify_ed25519_signature(public_key, contents, signature, message): """Verify that ``signature`` comes from ``public_key`` and ``contents``. Args: public_key (Ed25519PublicKey): the key to verify the signature contents (bytes): the contents that was signed signature (bytes): the sig...
python
def verify_ed25519_signature(public_key, contents, signature, message): """Verify that ``signature`` comes from ``public_key`` and ``contents``. Args: public_key (Ed25519PublicKey): the key to verify the signature contents (bytes): the contents that was signed signature (bytes): the sig...
['def', 'verify_ed25519_signature', '(', 'public_key', ',', 'contents', ',', 'signature', ',', 'message', ')', ':', 'try', ':', 'public_key', '.', 'verify', '(', 'signature', ',', 'contents', ')', 'except', 'InvalidSignature', 'as', 'exc', ':', 'raise', 'ScriptWorkerEd25519Error', '(', 'message', '%', '{', "'exc'", ':'...
Verify that ``signature`` comes from ``public_key`` and ``contents``. Args: public_key (Ed25519PublicKey): the key to verify the signature contents (bytes): the contents that was signed signature (bytes): the signature to verify message (str): the error message to raise. Raises...
['Verify', 'that', 'signature', 'comes', 'from', 'public_key', 'and', 'contents', '.']
train
https://github.com/mozilla-releng/scriptworker/blob/8e97bbd83b9b578565ec57904c966dd6ae4ef0ae/scriptworker/ed25519.py#L119-L135
1,226
rohankapoorcom/zm-py
zoneminder/monitor.py
Monitor.is_available
def is_available(self) -> bool: """Indicate if this Monitor is currently available.""" status_response = self._client.get_state( 'api/monitors/daemonStatus/id:{}/daemon:zmc.json'.format( self._monitor_id ) ) if not status_response: _LO...
python
def is_available(self) -> bool: """Indicate if this Monitor is currently available.""" status_response = self._client.get_state( 'api/monitors/daemonStatus/id:{}/daemon:zmc.json'.format( self._monitor_id ) ) if not status_response: _LO...
['def', 'is_available', '(', 'self', ')', '->', 'bool', ':', 'status_response', '=', 'self', '.', '_client', '.', 'get_state', '(', "'api/monitors/daemonStatus/id:{}/daemon:zmc.json'", '.', 'format', '(', 'self', '.', '_monitor_id', ')', ')', 'if', 'not', 'status_response', ':', '_LOGGER', '.', 'warning', '(', "'Could ...
Indicate if this Monitor is currently available.
['Indicate', 'if', 'this', 'Monitor', 'is', 'currently', 'available', '.']
train
https://github.com/rohankapoorcom/zm-py/blob/bd3a9f6b2f7b84b37589e2939f628b479a5531bf/zoneminder/monitor.py#L143-L161
1,227
openstack/proliantutils
proliantutils/ilo/ris.py
RISOperations._get_persistent_boot_devices
def _get_persistent_boot_devices(self): """Get details of persistent boot devices, its order :returns: List of dictionary of boot sources and list of boot device order :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not ...
python
def _get_persistent_boot_devices(self): """Get details of persistent boot devices, its order :returns: List of dictionary of boot sources and list of boot device order :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not ...
['def', '_get_persistent_boot_devices', '(', 'self', ')', ':', '# Check if the BIOS resource if exists.', 'headers_bios', ',', 'bios_uri', ',', 'bios_settings', '=', 'self', '.', '_check_bios_resource', '(', ')', '# Get the Boot resource.', 'boot_settings', '=', 'self', '.', '_get_bios_boot_resource', '(', 'bios_settin...
Get details of persistent boot devices, its order :returns: List of dictionary of boot sources and list of boot device order :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
['Get', 'details', 'of', 'persistent', 'boot', 'devices', 'its', 'order']
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/ris.py#L1497-L1525
1,228
kibitzr/kibitzr
kibitzr/fetcher/factory.py
fetcher_factory
def fetcher_factory(conf): """Return initialized fetcher capable of processing given conf.""" global PROMOTERS applicable = [] if not PROMOTERS: PROMOTERS = load_promoters() for promoter in PROMOTERS: if promoter.is_applicable(conf): applicable.append((promoter.PRIORITY, ...
python
def fetcher_factory(conf): """Return initialized fetcher capable of processing given conf.""" global PROMOTERS applicable = [] if not PROMOTERS: PROMOTERS = load_promoters() for promoter in PROMOTERS: if promoter.is_applicable(conf): applicable.append((promoter.PRIORITY, ...
['def', 'fetcher_factory', '(', 'conf', ')', ':', 'global', 'PROMOTERS', 'applicable', '=', '[', ']', 'if', 'not', 'PROMOTERS', ':', 'PROMOTERS', '=', 'load_promoters', '(', ')', 'for', 'promoter', 'in', 'PROMOTERS', ':', 'if', 'promoter', '.', 'is_applicable', '(', 'conf', ')', ':', 'applicable', '.', 'append', '(', '...
Return initialized fetcher capable of processing given conf.
['Return', 'initialized', 'fetcher', 'capable', 'of', 'processing', 'given', 'conf', '.']
train
https://github.com/kibitzr/kibitzr/blob/749da312488f1dda1ed1093cf4c95aaac0a604f7/kibitzr/fetcher/factory.py#L22-L37
1,229
log2timeline/plaso
plaso/parsers/mediator.py
ParserMediator.SetStorageWriter
def SetStorageWriter(self, storage_writer): """Sets the storage writer. Args: storage_writer (StorageWriter): storage writer. """ self._storage_writer = storage_writer # Reset the last event data information. Each storage file should # contain event data for their events. self._last_...
python
def SetStorageWriter(self, storage_writer): """Sets the storage writer. Args: storage_writer (StorageWriter): storage writer. """ self._storage_writer = storage_writer # Reset the last event data information. Each storage file should # contain event data for their events. self._last_...
['def', 'SetStorageWriter', '(', 'self', ',', 'storage_writer', ')', ':', 'self', '.', '_storage_writer', '=', 'storage_writer', '# Reset the last event data information. Each storage file should', '# contain event data for their events.', 'self', '.', '_last_event_data_hash', '=', 'None', 'self', '.', '_last_event_dat...
Sets the storage writer. Args: storage_writer (StorageWriter): storage writer.
['Sets', 'the', 'storage', 'writer', '.']
train
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/parsers/mediator.py#L628-L639
1,230
lekhakpadmanabh/Summarizer
smrzr/core.py
summarize_url
def summarize_url(url, num_sentences=4, fmt='default'): '''returns: tuple containing * single-line summary candidate * key points in the format specified. ''' title, meta, full_text = goose_extractor(url) if not full_text: raise ArticleExtractionFail("Couldn't extract: {}...
python
def summarize_url(url, num_sentences=4, fmt='default'): '''returns: tuple containing * single-line summary candidate * key points in the format specified. ''' title, meta, full_text = goose_extractor(url) if not full_text: raise ArticleExtractionFail("Couldn't extract: {}...
['def', 'summarize_url', '(', 'url', ',', 'num_sentences', '=', '4', ',', 'fmt', '=', "'default'", ')', ':', 'title', ',', 'meta', ',', 'full_text', '=', 'goose_extractor', '(', 'url', ')', 'if', 'not', 'full_text', ':', 'raise', 'ArticleExtractionFail', '(', '"Couldn\'t extract: {}"', '.', 'format', '(', 'url', ')', '...
returns: tuple containing * single-line summary candidate * key points in the format specified.
['returns', ':', 'tuple', 'containing', '*', 'single', '-', 'line', 'summary', 'candidate', '*', 'key', 'points', 'in', 'the', 'format', 'specified', '.']
train
https://github.com/lekhakpadmanabh/Summarizer/blob/143456a48217905c720d87331f410e5c8b4e24aa/smrzr/core.py#L128-L156
1,231
JoelBender/bacpypes
py25/bacpypes/netservice.py
NetworkAdapter.process_npdu
def process_npdu(self, npdu): """Encode NPDUs from the service access point and send them downstream.""" if _debug: NetworkAdapter._debug("process_npdu %r (net=%r)", npdu, self.adapterNet) pdu = PDU(user_data=npdu.pduUserData) npdu.encode(pdu) self.request(pdu)
python
def process_npdu(self, npdu): """Encode NPDUs from the service access point and send them downstream.""" if _debug: NetworkAdapter._debug("process_npdu %r (net=%r)", npdu, self.adapterNet) pdu = PDU(user_data=npdu.pduUserData) npdu.encode(pdu) self.request(pdu)
['def', 'process_npdu', '(', 'self', ',', 'npdu', ')', ':', 'if', '_debug', ':', 'NetworkAdapter', '.', '_debug', '(', '"process_npdu %r (net=%r)"', ',', 'npdu', ',', 'self', '.', 'adapterNet', ')', 'pdu', '=', 'PDU', '(', 'user_data', '=', 'npdu', '.', 'pduUserData', ')', 'npdu', '.', 'encode', '(', 'pdu', ')', 'self'...
Encode NPDUs from the service access point and send them downstream.
['Encode', 'NPDUs', 'from', 'the', 'service', 'access', 'point', 'and', 'send', 'them', 'downstream', '.']
train
https://github.com/JoelBender/bacpypes/blob/4111b8604a16fa2b7f80d8104a43b9f3e28dfc78/py25/bacpypes/netservice.py#L190-L196
1,232
adrianliaw/PyCuber
pycuber/solver/cfop/cross.py
CrossSolver.cross_state_value
def cross_state_value(state): """ Compute the state value of the cross solving search. """ centres, edges = state value = 0 for edge in edges: if "U" in edge: if edge["U"] == centres["D"]["D"]: value += 1 els...
python
def cross_state_value(state): """ Compute the state value of the cross solving search. """ centres, edges = state value = 0 for edge in edges: if "U" in edge: if edge["U"] == centres["D"]["D"]: value += 1 els...
['def', 'cross_state_value', '(', 'state', ')', ':', 'centres', ',', 'edges', '=', 'state', 'value', '=', '0', 'for', 'edge', 'in', 'edges', ':', 'if', '"U"', 'in', 'edge', ':', 'if', 'edge', '[', '"U"', ']', '==', 'centres', '[', '"D"', ']', '[', '"D"', ']', ':', 'value', '+=', '1', 'else', ':', 'value', '+=', '2', 'e...
Compute the state value of the cross solving search.
['Compute', 'the', 'state', 'value', 'of', 'the', 'cross', 'solving', 'search', '.']
train
https://github.com/adrianliaw/PyCuber/blob/e44b5ba48c831b964ce73d046fb813222771853f/pycuber/solver/cfop/cross.py#L82-L144
1,233
oemof/demandlib
demandlib/bdew.py
HeatBuilding.weighted_temperature
def weighted_temperature(self, how='geometric_series'): r""" A new temperature vector is generated containing a multi-day average temperature as needed in the load profile function. Parameters ---------- how : string string which type to return ("geometric_se...
python
def weighted_temperature(self, how='geometric_series'): r""" A new temperature vector is generated containing a multi-day average temperature as needed in the load profile function. Parameters ---------- how : string string which type to return ("geometric_se...
['def', 'weighted_temperature', '(', 'self', ',', 'how', '=', "'geometric_series'", ')', ':', '# calculate daily mean temperature', 'temperature', '=', 'self', '.', 'df', '[', "'temperature'", ']', '.', 'resample', '(', "'D'", ')', '.', 'mean', '(', ')', '.', 'reindex', '(', 'self', '.', 'df', '.', 'index', ')', '.', '...
r""" A new temperature vector is generated containing a multi-day average temperature as needed in the load profile function. Parameters ---------- how : string string which type to return ("geometric_series" or "mean") Notes ----- Equation f...
['r', 'A', 'new', 'temperature', 'vector', 'is', 'generated', 'containing', 'a', 'multi', '-', 'day', 'average', 'temperature', 'as', 'needed', 'in', 'the', 'load', 'profile', 'function', '.']
train
https://github.com/oemof/demandlib/blob/4b62d60e05cb06eb2590f9c5655c2cdebf494080/demandlib/bdew.py#L178-L219
1,234
mabuchilab/QNET
src/qnet/printing/sreprprinter.py
IndentedSReprPrinter.emptyPrinter
def emptyPrinter(self, expr): """Fallback printer""" indent_str = " " * (self._print_level - 1) lines = [] if isinstance(expr.__class__, Singleton): # We exploit that Singletons override __expr__ to directly return # their name return indent_str + r...
python
def emptyPrinter(self, expr): """Fallback printer""" indent_str = " " * (self._print_level - 1) lines = [] if isinstance(expr.__class__, Singleton): # We exploit that Singletons override __expr__ to directly return # their name return indent_str + r...
['def', 'emptyPrinter', '(', 'self', ',', 'expr', ')', ':', 'indent_str', '=', '" "', '*', '(', 'self', '.', '_print_level', '-', '1', ')', 'lines', '=', '[', ']', 'if', 'isinstance', '(', 'expr', '.', '__class__', ',', 'Singleton', ')', ':', '# We exploit that Singletons override __expr__ to directly return', '# th...
Fallback printer
['Fallback', 'printer']
train
https://github.com/mabuchilab/QNET/blob/cc20d26dad78691d34c67173e5cd67dcac94208a/src/qnet/printing/sreprprinter.py#L78-L110
1,235
apple/turicreate
src/unity/python/turicreate/extensions.py
_class_instance_from_name
def _class_instance_from_name(class_name, *arg, **kwarg): """ class_name is of the form modA.modB.modC.class module_path splits on "." and the import_path is then ['modA','modB','modC'] the __import__ call is really annoying but essentially it reads like: import class from modA.modB.modC - The...
python
def _class_instance_from_name(class_name, *arg, **kwarg): """ class_name is of the form modA.modB.modC.class module_path splits on "." and the import_path is then ['modA','modB','modC'] the __import__ call is really annoying but essentially it reads like: import class from modA.modB.modC - The...
['def', '_class_instance_from_name', '(', 'class_name', ',', '*', 'arg', ',', '*', '*', 'kwarg', ')', ':', '# we first look in tc.extensions for the class name', 'module_path', '=', 'class_name', '.', 'split', '(', "'.'", ')', 'import_path', '=', 'module_path', '[', '0', ':', '-', '1', ']', 'module', '=', '__import__',...
class_name is of the form modA.modB.modC.class module_path splits on "." and the import_path is then ['modA','modB','modC'] the __import__ call is really annoying but essentially it reads like: import class from modA.modB.modC - Then the module variable points to modC - Then you get the class from...
['class_name', 'is', 'of', 'the', 'form', 'modA', '.', 'modB', '.', 'modC', '.', 'class', 'module_path', 'splits', 'on', '.', 'and', 'the', 'import_path', 'is', 'then', '[', 'modA', 'modB', 'modC', ']', 'the', '__import__', 'call', 'is', 'really', 'annoying', 'but', 'essentially', 'it', 'reads', 'like', ':']
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/extensions.py#L172-L190
1,236
elastic/elasticsearch-py
elasticsearch/client/xpack/rollup.py
RollupClient.get_jobs
def get_jobs(self, id=None, params=None): """ `<>`_ :arg id: The ID of the job(s) to fetch. Accepts glob patterns, or left blank for all jobs """ return self.transport.perform_request( "GET", _make_path("_rollup", "job", id), params=params )
python
def get_jobs(self, id=None, params=None): """ `<>`_ :arg id: The ID of the job(s) to fetch. Accepts glob patterns, or left blank for all jobs """ return self.transport.perform_request( "GET", _make_path("_rollup", "job", id), params=params )
['def', 'get_jobs', '(', 'self', ',', 'id', '=', 'None', ',', 'params', '=', 'None', ')', ':', 'return', 'self', '.', 'transport', '.', 'perform_request', '(', '"GET"', ',', '_make_path', '(', '"_rollup"', ',', '"job"', ',', 'id', ')', ',', 'params', '=', 'params', ')']
`<>`_ :arg id: The ID of the job(s) to fetch. Accepts glob patterns, or left blank for all jobs
['<', '>', '_']
train
https://github.com/elastic/elasticsearch-py/blob/2aab285c8f506f3863cbdaba3c90a685c510ba00/elasticsearch/client/xpack/rollup.py#L19-L28
1,237
scrapinghub/kafka-scanner
kafka_scanner/msg_processor_handlers.py
MsgProcessorHandlers.decompress_messages
def decompress_messages(self, partitions_offmsgs): """ Decompress pre-defined compressed fields for each message. """ for pomsg in partitions_offmsgs: if pomsg['message']: pomsg['message'] = self.decompress_fun(pomsg['message']) yield pomsg
python
def decompress_messages(self, partitions_offmsgs): """ Decompress pre-defined compressed fields for each message. """ for pomsg in partitions_offmsgs: if pomsg['message']: pomsg['message'] = self.decompress_fun(pomsg['message']) yield pomsg
['def', 'decompress_messages', '(', 'self', ',', 'partitions_offmsgs', ')', ':', 'for', 'pomsg', 'in', 'partitions_offmsgs', ':', 'if', 'pomsg', '[', "'message'", ']', ':', 'pomsg', '[', "'message'", ']', '=', 'self', '.', 'decompress_fun', '(', 'pomsg', '[', "'message'", ']', ')', 'yield', 'pomsg']
Decompress pre-defined compressed fields for each message.
['Decompress', 'pre', '-', 'defined', 'compressed', 'fields', 'for', 'each', 'message', '.']
train
https://github.com/scrapinghub/kafka-scanner/blob/8a71901012e8c948180f70a485b57f8d2e7e3ec1/kafka_scanner/msg_processor_handlers.py#L85-L91
1,238
pandas-dev/pandas
pandas/core/indexing.py
_LocIndexer._get_partial_string_timestamp_match_key
def _get_partial_string_timestamp_match_key(self, key, labels): """Translate any partial string timestamp matches in key, returning the new key (GH 10331)""" if isinstance(labels, MultiIndex): if (isinstance(key, str) and labels.levels[0].is_all_dates): # Convert key ...
python
def _get_partial_string_timestamp_match_key(self, key, labels): """Translate any partial string timestamp matches in key, returning the new key (GH 10331)""" if isinstance(labels, MultiIndex): if (isinstance(key, str) and labels.levels[0].is_all_dates): # Convert key ...
['def', '_get_partial_string_timestamp_match_key', '(', 'self', ',', 'key', ',', 'labels', ')', ':', 'if', 'isinstance', '(', 'labels', ',', 'MultiIndex', ')', ':', 'if', '(', 'isinstance', '(', 'key', ',', 'str', ')', 'and', 'labels', '.', 'levels', '[', '0', ']', '.', 'is_all_dates', ')', ':', "# Convert key '2016-01...
Translate any partial string timestamp matches in key, returning the new key (GH 10331)
['Translate', 'any', 'partial', 'string', 'timestamp', 'matches', 'in', 'key', 'returning', 'the', 'new', 'key', '(', 'GH', '10331', ')']
train
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexing.py#L1835-L1856
1,239
haikuginger/beekeeper
beekeeper/api.py
Action.printed_out
def printed_out(self, name): """ Create a string representation of the action """ opt = self.variables().optional_namestring() req = self.variables().required_namestring() out = '' out += '| |\n' out += '| |---{}({}{})\n'.format(name, req, opt) ...
python
def printed_out(self, name): """ Create a string representation of the action """ opt = self.variables().optional_namestring() req = self.variables().required_namestring() out = '' out += '| |\n' out += '| |---{}({}{})\n'.format(name, req, opt) ...
['def', 'printed_out', '(', 'self', ',', 'name', ')', ':', 'opt', '=', 'self', '.', 'variables', '(', ')', '.', 'optional_namestring', '(', ')', 'req', '=', 'self', '.', 'variables', '(', ')', '.', 'required_namestring', '(', ')', 'out', '=', "''", 'out', '+=', "'| |\\n'", 'out', '+=', "'| |---{}({}{})\\n'", '.', '...
Create a string representation of the action
['Create', 'a', 'string', 'representation', 'of', 'the', 'action']
train
https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/api.py#L208-L219
1,240
robinandeer/puzzle
puzzle/plugins/sql/mixins/actions/gemini.py
GeminiActions.add_gemini_query
def add_gemini_query(self, name, query): """Add a user defined gemini query Args: name (str) query (str) """ logger.info("Adding query {0} with text {1}".format(name, query)) new_query = GeminiQuery(name=name, query=query) self.session.add(new_que...
python
def add_gemini_query(self, name, query): """Add a user defined gemini query Args: name (str) query (str) """ logger.info("Adding query {0} with text {1}".format(name, query)) new_query = GeminiQuery(name=name, query=query) self.session.add(new_que...
['def', 'add_gemini_query', '(', 'self', ',', 'name', ',', 'query', ')', ':', 'logger', '.', 'info', '(', '"Adding query {0} with text {1}"', '.', 'format', '(', 'name', ',', 'query', ')', ')', 'new_query', '=', 'GeminiQuery', '(', 'name', '=', 'name', ',', 'query', '=', 'query', ')', 'self', '.', 'session', '.', 'add'...
Add a user defined gemini query Args: name (str) query (str)
['Add', 'a', 'user', 'defined', 'gemini', 'query']
train
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/sql/mixins/actions/gemini.py#L23-L34
1,241
inveniosoftware-attic/invenio-upgrader
invenio_upgrader/engine.py
UpgradeBase.repository
def repository(self): """Repository.""" m = re.match("(.+)(_\d{4}_\d{2}_\d{2}_)(.+)", self.__module__) if m: return m.group(1) m = re.match("(.+)(_release_)(.+)", self.__module__) if m: return m.group(1)
python
def repository(self): """Repository.""" m = re.match("(.+)(_\d{4}_\d{2}_\d{2}_)(.+)", self.__module__) if m: return m.group(1) m = re.match("(.+)(_release_)(.+)", self.__module__) if m: return m.group(1)
['def', 'repository', '(', 'self', ')', ':', 'm', '=', 're', '.', 'match', '(', '"(.+)(_\\d{4}_\\d{2}_\\d{2}_)(.+)"', ',', 'self', '.', '__module__', ')', 'if', 'm', ':', 'return', 'm', '.', 'group', '(', '1', ')', 'm', '=', 're', '.', 'match', '(', '"(.+)(_release_)(.+)"', ',', 'self', '.', '__module__', ')', 'if', 'm...
Repository.
['Repository', '.']
train
https://github.com/inveniosoftware-attic/invenio-upgrader/blob/cee4bcb118515463ecf6de1421642007f79a9fcd/invenio_upgrader/engine.py#L507-L514
1,242
apache/incubator-superset
superset/models/core.py
Database.all_table_names_in_schema
def all_table_names_in_schema(self, schema, cache=False, cache_timeout=None, force=False): """Parameters need to be passed as keyword arguments. For unused parameters, they are referenced in cache_util.memoized_func decorator. :param schema: schema nam...
python
def all_table_names_in_schema(self, schema, cache=False, cache_timeout=None, force=False): """Parameters need to be passed as keyword arguments. For unused parameters, they are referenced in cache_util.memoized_func decorator. :param schema: schema nam...
['def', 'all_table_names_in_schema', '(', 'self', ',', 'schema', ',', 'cache', '=', 'False', ',', 'cache_timeout', '=', 'None', ',', 'force', '=', 'False', ')', ':', 'tables', '=', '[', ']', 'try', ':', 'tables', '=', 'self', '.', 'db_engine_spec', '.', 'get_table_names', '(', 'inspector', '=', 'self', '.', 'inspector'...
Parameters need to be passed as keyword arguments. For unused parameters, they are referenced in cache_util.memoized_func decorator. :param schema: schema name :type schema: str :param cache: whether cache is enabled for the function :type cache: bool :param cac...
['Parameters', 'need', 'to', 'be', 'passed', 'as', 'keyword', 'arguments', '.']
train
https://github.com/apache/incubator-superset/blob/ca2996c78f679260eb79c6008e276733df5fb653/superset/models/core.py#L954-L978
1,243
erinxocon/spotify-local
src/spotify_local/core.py
SpotifyLocal._request
def _request(self, url, params={}): """Makes a request using the currently open session. :param url: A url fragment to use in the creation of the master url """ r = self._session.get(url=url, params=params, headers=DEFAULT_ORIGIN) return r
python
def _request(self, url, params={}): """Makes a request using the currently open session. :param url: A url fragment to use in the creation of the master url """ r = self._session.get(url=url, params=params, headers=DEFAULT_ORIGIN) return r
['def', '_request', '(', 'self', ',', 'url', ',', 'params', '=', '{', '}', ')', ':', 'r', '=', 'self', '.', '_session', '.', 'get', '(', 'url', '=', 'url', ',', 'params', '=', 'params', ',', 'headers', '=', 'DEFAULT_ORIGIN', ')', 'return', 'r']
Makes a request using the currently open session. :param url: A url fragment to use in the creation of the master url
['Makes', 'a', 'request', 'using', 'the', 'currently', 'open', 'session', '.']
train
https://github.com/erinxocon/spotify-local/blob/8188eef221e3d8b9f408ff430d80e74560360459/src/spotify_local/core.py#L29-L35
1,244
pandas-dev/pandas
pandas/core/indexes/interval.py
_is_valid_endpoint
def _is_valid_endpoint(endpoint): """helper for interval_range to check if start/end are valid types""" return any([is_number(endpoint), isinstance(endpoint, Timestamp), isinstance(endpoint, Timedelta), endpoint is None])
python
def _is_valid_endpoint(endpoint): """helper for interval_range to check if start/end are valid types""" return any([is_number(endpoint), isinstance(endpoint, Timestamp), isinstance(endpoint, Timedelta), endpoint is None])
['def', '_is_valid_endpoint', '(', 'endpoint', ')', ':', 'return', 'any', '(', '[', 'is_number', '(', 'endpoint', ')', ',', 'isinstance', '(', 'endpoint', ',', 'Timestamp', ')', ',', 'isinstance', '(', 'endpoint', ',', 'Timedelta', ')', ',', 'endpoint', 'is', 'None', ']', ')']
helper for interval_range to check if start/end are valid types
['helper', 'for', 'interval_range', 'to', 'check', 'if', 'start', '/', 'end', 'are', 'valid', 'types']
train
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/interval.py#L1138-L1143
1,245
tensorflow/mesh
mesh_tensorflow/auto_mtf/layout.py
layout
def layout(mtf_graph, mesh_shape, mtf_outputs=()): """Compute layout rules based on a computational graph and mesh shape. Args: mtf_graph: a mtf.Graph. mesh_shape: an mtf.Shape, str, or listlike of mtf.Dimension. mtf_outputs: an optional iterable of mtf.Tensor, representing the outputs of the c...
python
def layout(mtf_graph, mesh_shape, mtf_outputs=()): """Compute layout rules based on a computational graph and mesh shape. Args: mtf_graph: a mtf.Graph. mesh_shape: an mtf.Shape, str, or listlike of mtf.Dimension. mtf_outputs: an optional iterable of mtf.Tensor, representing the outputs of the c...
['def', 'layout', '(', 'mtf_graph', ',', 'mesh_shape', ',', 'mtf_outputs', '=', '(', ')', ')', ':', 'mesh_shape', '=', 'mtf', '.', 'convert_to_shape', '(', 'mesh_shape', ')', 'estimator', '=', 'memory_estimator', '.', 'MemoryEstimator', '(', 'mtf_graph', ',', 'mesh_shape', ',', 'mtf_outputs', ')', 'optimizer', '=', 'la...
Compute layout rules based on a computational graph and mesh shape. Args: mtf_graph: a mtf.Graph. mesh_shape: an mtf.Shape, str, or listlike of mtf.Dimension. mtf_outputs: an optional iterable of mtf.Tensor, representing the outputs of the computation. Returns: a mtf.LayoutRules
['Compute', 'layout', 'rules', 'based', 'on', 'a', 'computational', 'graph', 'and', 'mesh', 'shape', '.']
train
https://github.com/tensorflow/mesh/blob/3921196e5e43302e820da0a87329f25d7e2a3016/mesh_tensorflow/auto_mtf/layout.py#L47-L63
1,246
ejeschke/ginga
ginga/canvas/types/astro.py
Annulus.sync_state
def sync_state(self): """Called to synchronize state (e.g. when parameters have changed). """ oradius = self.radius + self.width if oradius < self.radius: raise ValueError('Outer boundary < inner boundary') d = dict(points=self.points, radius=self.radius, color=self....
python
def sync_state(self): """Called to synchronize state (e.g. when parameters have changed). """ oradius = self.radius + self.width if oradius < self.radius: raise ValueError('Outer boundary < inner boundary') d = dict(points=self.points, radius=self.radius, color=self....
['def', 'sync_state', '(', 'self', ')', ':', 'oradius', '=', 'self', '.', 'radius', '+', 'self', '.', 'width', 'if', 'oradius', '<', 'self', '.', 'radius', ':', 'raise', 'ValueError', '(', "'Outer boundary < inner boundary'", ')', 'd', '=', 'dict', '(', 'points', '=', 'self', '.', 'points', ',', 'radius', '=', 'self', ...
Called to synchronize state (e.g. when parameters have changed).
['Called', 'to', 'synchronize', 'state', '(', 'e', '.', 'g', '.', 'when', 'parameters', 'have', 'changed', ')', '.']
train
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/canvas/types/astro.py#L713-L729
1,247
davebridges/mousedb
mousedb/animal/views.py
breeding_wean
def breeding_wean(request, breeding_id): """This view is used to generate a form by which to wean pups which belong to a particular breeding set. This view typically is used to wean existing pups. This includes the MouseID, Cage, Markings, Gender and Wean Date fields. For other fields use the breeding-chang...
python
def breeding_wean(request, breeding_id): """This view is used to generate a form by which to wean pups which belong to a particular breeding set. This view typically is used to wean existing pups. This includes the MouseID, Cage, Markings, Gender and Wean Date fields. For other fields use the breeding-chang...
['def', 'breeding_wean', '(', 'request', ',', 'breeding_id', ')', ':', 'breeding', '=', 'Breeding', '.', 'objects', '.', 'get', '(', 'id', '=', 'breeding_id', ')', 'strain', '=', 'breeding', '.', 'Strain', 'PupsFormSet', '=', 'inlineformset_factory', '(', 'Breeding', ',', 'Animal', ',', 'extra', '=', '0', ',', 'exclude...
This view is used to generate a form by which to wean pups which belong to a particular breeding set. This view typically is used to wean existing pups. This includes the MouseID, Cage, Markings, Gender and Wean Date fields. For other fields use the breeding-change page. It takes a request in the form /bree...
['This', 'view', 'is', 'used', 'to', 'generate', 'a', 'form', 'by', 'which', 'to', 'wean', 'pups', 'which', 'belong', 'to', 'a', 'particular', 'breeding', 'set', '.', 'This', 'view', 'typically', 'is', 'used', 'to', 'wean', 'existing', 'pups', '.', 'This', 'includes', 'the', 'MouseID', 'Cage', 'Markings', 'Gender', 'an...
train
https://github.com/davebridges/mousedb/blob/2a33f6d15d88b1540b05f7232b154fdbf8568580/mousedb/animal/views.py#L395-L413
1,248
pycontribs/jira
jira/client.py
JIRA.remove_group
def remove_group(self, groupname): """Delete a group from the JIRA instance. :param groupname: The group to be deleted from the JIRA instance. :type groupname: str :return: Boolean. Returns True on success. :rtype: bool """ # implementation based on # htt...
python
def remove_group(self, groupname): """Delete a group from the JIRA instance. :param groupname: The group to be deleted from the JIRA instance. :type groupname: str :return: Boolean. Returns True on success. :rtype: bool """ # implementation based on # htt...
['def', 'remove_group', '(', 'self', ',', 'groupname', ')', ':', '# implementation based on', '# https://docs.atlassian.com/jira/REST/ondemand/#d2e5173', 'url', '=', 'self', '.', '_options', '[', "'server'", ']', '+', "'/rest/api/latest/group'", 'x', '=', '{', "'groupname'", ':', 'groupname', '}', 'self', '.', '_sessio...
Delete a group from the JIRA instance. :param groupname: The group to be deleted from the JIRA instance. :type groupname: str :return: Boolean. Returns True on success. :rtype: bool
['Delete', 'a', 'group', 'from', 'the', 'JIRA', 'instance', '.']
train
https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/client.py#L1207-L1220
1,249
fermiPy/fermipy
fermipy/gtanalysis.py
GTBinnedAnalysis.counts_map
def counts_map(self): """Return 3-D counts map for this component as a Map object. Returns ------- map : `~fermipy.skymap.MapBase` """ try: if isinstance(self.like, gtutils.SummedLikelihood): cmap = self.like.components[0].logLike.countsMap()...
python
def counts_map(self): """Return 3-D counts map for this component as a Map object. Returns ------- map : `~fermipy.skymap.MapBase` """ try: if isinstance(self.like, gtutils.SummedLikelihood): cmap = self.like.components[0].logLike.countsMap()...
['def', 'counts_map', '(', 'self', ')', ':', 'try', ':', 'if', 'isinstance', '(', 'self', '.', 'like', ',', 'gtutils', '.', 'SummedLikelihood', ')', ':', 'cmap', '=', 'self', '.', 'like', '.', 'components', '[', '0', ']', '.', 'logLike', '.', 'countsMap', '(', ')', 'p_method', '=', 'cmap', '.', 'projection', '(', ')', ...
Return 3-D counts map for this component as a Map object. Returns ------- map : `~fermipy.skymap.MapBase`
['Return', '3', '-', 'D', 'counts', 'map', 'for', 'this', 'component', 'as', 'a', 'Map', 'object', '.']
train
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4787-L4816
1,250
maweigert/gputools
gputools/convolve/convolve.py
convolve
def convolve(data, h, res_g=None, sub_blocks=None): """ convolves 1d-3d data with kernel h data and h can either be numpy arrays or gpu buffer objects (OCLArray, which must be float32 then) boundary conditions are clamping to zero at edge. """ if not len(data.shape) in [1, 2, 3]: ...
python
def convolve(data, h, res_g=None, sub_blocks=None): """ convolves 1d-3d data with kernel h data and h can either be numpy arrays or gpu buffer objects (OCLArray, which must be float32 then) boundary conditions are clamping to zero at edge. """ if not len(data.shape) in [1, 2, 3]: ...
['def', 'convolve', '(', 'data', ',', 'h', ',', 'res_g', '=', 'None', ',', 'sub_blocks', '=', 'None', ')', ':', 'if', 'not', 'len', '(', 'data', '.', 'shape', ')', 'in', '[', '1', ',', '2', ',', '3', ']', ':', 'raise', 'ValueError', '(', '"dim = %s not supported"', '%', '(', 'len', '(', 'data', '.', 'shape', ')', ')', ...
convolves 1d-3d data with kernel h data and h can either be numpy arrays or gpu buffer objects (OCLArray, which must be float32 then) boundary conditions are clamping to zero at edge.
['convolves', '1d', '-', '3d', 'data', 'with', 'kernel', 'h']
train
https://github.com/maweigert/gputools/blob/6ab26efeb05dceef74cf13aadeeeb9b009b529dd/gputools/convolve/convolve.py#L18-L54
1,251
Valassis-Digital-Media/spylon
spylon/spark/progress.py
start
def start(sc, timedelta_formatter=_pretty_time_delta, bar_width=20, sleep_time=0.5): """Creates a :class:`ProgressPrinter` that polls the SparkContext for information about active stage progress and prints that information to stderr. The printer runs in a thread and is useful for showing text-based pro...
python
def start(sc, timedelta_formatter=_pretty_time_delta, bar_width=20, sleep_time=0.5): """Creates a :class:`ProgressPrinter` that polls the SparkContext for information about active stage progress and prints that information to stderr. The printer runs in a thread and is useful for showing text-based pro...
['def', 'start', '(', 'sc', ',', 'timedelta_formatter', '=', '_pretty_time_delta', ',', 'bar_width', '=', '20', ',', 'sleep_time', '=', '0.5', ')', ':', 'global', '_printer_singleton', 'if', '_printer_singleton', 'is', 'None', ':', '_printer_singleton', '=', 'ProgressPrinter', '(', 'sc', ',', 'timedelta_formatter', ','...
Creates a :class:`ProgressPrinter` that polls the SparkContext for information about active stage progress and prints that information to stderr. The printer runs in a thread and is useful for showing text-based progress bars in interactive environments (e.g., REPLs, Jupyter Notebooks). This function ...
['Creates', 'a', ':', 'class', ':', 'ProgressPrinter', 'that', 'polls', 'the', 'SparkContext', 'for', 'information', 'about', 'active', 'stage', 'progress', 'and', 'prints', 'that', 'information', 'to', 'stderr', '.']
train
https://github.com/Valassis-Digital-Media/spylon/blob/ac00e285fa1c790674606b793819c3e5baee0d48/spylon/spark/progress.py#L205-L238
1,252
riga/scinum
scinum.py
atan
def atan(x): """ tan(x) Trigonometric arc tan function. """ _math = infer_math(x) if _math is math: return _math.atan(x) else: return _math.arctan(x)
python
def atan(x): """ tan(x) Trigonometric arc tan function. """ _math = infer_math(x) if _math is math: return _math.atan(x) else: return _math.arctan(x)
['def', 'atan', '(', 'x', ')', ':', '_math', '=', 'infer_math', '(', 'x', ')', 'if', '_math', 'is', 'math', ':', 'return', '_math', '.', 'atan', '(', 'x', ')', 'else', ':', 'return', '_math', '.', 'arctan', '(', 'x', ')']
tan(x) Trigonometric arc tan function.
['tan', '(', 'x', ')', 'Trigonometric', 'arc', 'tan', 'function', '.']
train
https://github.com/riga/scinum/blob/55eb6d8aa77beacee5a07443392954b8a0aad8cb/scinum.py#L1188-L1196
1,253
materialsproject/pymatgen
pymatgen/analysis/phase_diagram.py
PDPlotter._get_3d_plot
def _get_3d_plot(self, label_stable=True): """ Shows the plot using pylab. Usually I won"t do imports in methods, but since plotting is a fairly expensive library to load and not all machines have matplotlib installed, I have done it this way. """ import matplotlib.pyplo...
python
def _get_3d_plot(self, label_stable=True): """ Shows the plot using pylab. Usually I won"t do imports in methods, but since plotting is a fairly expensive library to load and not all machines have matplotlib installed, I have done it this way. """ import matplotlib.pyplo...
['def', '_get_3d_plot', '(', 'self', ',', 'label_stable', '=', 'True', ')', ':', 'import', 'matplotlib', '.', 'pyplot', 'as', 'plt', 'import', 'mpl_toolkits', '.', 'mplot3d', '.', 'axes3d', 'as', 'p3', 'from', 'matplotlib', '.', 'font_manager', 'import', 'FontProperties', 'fig', '=', 'plt', '.', 'figure', '(', ')', 'ax...
Shows the plot using pylab. Usually I won"t do imports in methods, but since plotting is a fairly expensive library to load and not all machines have matplotlib installed, I have done it this way.
['Shows', 'the', 'plot', 'using', 'pylab', '.', 'Usually', 'I', 'won', 't', 'do', 'imports', 'in', 'methods', 'but', 'since', 'plotting', 'is', 'a', 'fairly', 'expensive', 'library', 'to', 'load', 'and', 'not', 'all', 'machines', 'have', 'matplotlib', 'installed', 'I', 'have', 'done', 'it', 'this', 'way', '.']
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L1638-L1670
1,254
yougov/solr-doc-manager
mongo_connector/doc_managers/solr_doc_manager.py
DocManager.upsert
def upsert(self, doc, namespace, timestamp): """Update or insert a document into Solr This method should call whatever add/insert/update method exists for the backend engine and add the document in there. The input will always be one mongo document, represented as a Python dictionary. ...
python
def upsert(self, doc, namespace, timestamp): """Update or insert a document into Solr This method should call whatever add/insert/update method exists for the backend engine and add the document in there. The input will always be one mongo document, represented as a Python dictionary. ...
['def', 'upsert', '(', 'self', ',', 'doc', ',', 'namespace', ',', 'timestamp', ')', ':', 'if', 'self', '.', 'auto_commit_interval', 'is', 'not', 'None', ':', 'self', '.', 'solr', '.', 'add', '(', '[', 'self', '.', '_clean_doc', '(', 'doc', ',', 'namespace', ',', 'timestamp', ')', ']', ',', 'commit', '=', '(', 'self', '...
Update or insert a document into Solr This method should call whatever add/insert/update method exists for the backend engine and add the document in there. The input will always be one mongo document, represented as a Python dictionary.
['Update', 'or', 'insert', 'a', 'document', 'into', 'Solr']
train
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L261-L274
1,255
ask/redish
redish/types.py
ZSet.increment
def increment(self, member, amount=1): """Increment the score of ``member`` by ``amount``.""" self._dict[member] += amount return self._dict[member]
python
def increment(self, member, amount=1): """Increment the score of ``member`` by ``amount``.""" self._dict[member] += amount return self._dict[member]
['def', 'increment', '(', 'self', ',', 'member', ',', 'amount', '=', '1', ')', ':', 'self', '.', '_dict', '[', 'member', ']', '+=', 'amount', 'return', 'self', '.', '_dict', '[', 'member', ']']
Increment the score of ``member`` by ``amount``.
['Increment', 'the', 'score', 'of', 'member', 'by', 'amount', '.']
train
https://github.com/ask/redish/blob/4845f8d5e12fd953ecad624b4e1e89f79a082a3e/redish/types.py#L771-L774
1,256
mongodb/mongo-python-driver
bson/__init__.py
_bson_to_dict
def _bson_to_dict(data, opts): """Decode a BSON string to document_class.""" try: if _raw_document_class(opts.document_class): return opts.document_class(data, opts) _, end = _get_object_size(data, 0, len(data)) return _elements_to_dict(data, 4, end, opts) except InvalidB...
python
def _bson_to_dict(data, opts): """Decode a BSON string to document_class.""" try: if _raw_document_class(opts.document_class): return opts.document_class(data, opts) _, end = _get_object_size(data, 0, len(data)) return _elements_to_dict(data, 4, end, opts) except InvalidB...
['def', '_bson_to_dict', '(', 'data', ',', 'opts', ')', ':', 'try', ':', 'if', '_raw_document_class', '(', 'opts', '.', 'document_class', ')', ':', 'return', 'opts', '.', 'document_class', '(', 'data', ',', 'opts', ')', '_', ',', 'end', '=', '_get_object_size', '(', 'data', ',', '0', ',', 'len', '(', 'data', ')', ')', ...
Decode a BSON string to document_class.
['Decode', 'a', 'BSON', 'string', 'to', 'document_class', '.']
train
https://github.com/mongodb/mongo-python-driver/blob/c29c21449e3aae74154207058cf85fd94018d4cd/bson/__init__.py#L434-L446
1,257
getpelican/pelican-plugins
permalinks/permalinks.py
get_permalink_ids_iter
def get_permalink_ids_iter(self): ''' Method to get permalink ids from content. To be bound to the class last thing. ''' permalink_id_key = self.settings['PERMALINK_ID_METADATA_KEY'] permalink_ids = self.metadata.get(permalink_id_key, '') for permalink_id in permalink_ids.split(','): ...
python
def get_permalink_ids_iter(self): ''' Method to get permalink ids from content. To be bound to the class last thing. ''' permalink_id_key = self.settings['PERMALINK_ID_METADATA_KEY'] permalink_ids = self.metadata.get(permalink_id_key, '') for permalink_id in permalink_ids.split(','): ...
['def', 'get_permalink_ids_iter', '(', 'self', ')', ':', 'permalink_id_key', '=', 'self', '.', 'settings', '[', "'PERMALINK_ID_METADATA_KEY'", ']', 'permalink_ids', '=', 'self', '.', 'metadata', '.', 'get', '(', 'permalink_id_key', ',', "''", ')', 'for', 'permalink_id', 'in', 'permalink_ids', '.', 'split', '(', "','", ...
Method to get permalink ids from content. To be bound to the class last thing.
['Method', 'to', 'get', 'permalink', 'ids', 'from', 'content', '.', 'To', 'be', 'bound', 'to', 'the', 'class', 'last', 'thing', '.']
train
https://github.com/getpelican/pelican-plugins/blob/cfc7a3f224f1743063b034561f89a6a712d13587/permalinks/permalinks.py#L82-L92
1,258
vtkiorg/vtki
vtki/pointset.py
UnstructuredGrid.linear_copy
def linear_copy(self, deep=False): """ Returns a copy of the input unstructured grid containing only linear cells. Converts the following cell types to their linear equivalents. - VTK_QUADRATIC_TETRA --> VTK_TETRA - VTK_QUADRATIC_PYRAMID --> VTK_PYRAMID ...
python
def linear_copy(self, deep=False): """ Returns a copy of the input unstructured grid containing only linear cells. Converts the following cell types to their linear equivalents. - VTK_QUADRATIC_TETRA --> VTK_TETRA - VTK_QUADRATIC_PYRAMID --> VTK_PYRAMID ...
['def', 'linear_copy', '(', 'self', ',', 'deep', '=', 'False', ')', ':', 'lgrid', '=', 'self', '.', 'copy', '(', 'deep', ')', '# grab the vtk object', 'vtk_cell_type', '=', 'numpy_to_vtk', '(', 'self', '.', 'GetCellTypesArray', '(', ')', ',', 'deep', '=', 'True', ')', 'celltype', '=', 'vtk_to_numpy', '(', 'vtk_cell_typ...
Returns a copy of the input unstructured grid containing only linear cells. Converts the following cell types to their linear equivalents. - VTK_QUADRATIC_TETRA --> VTK_TETRA - VTK_QUADRATIC_PYRAMID --> VTK_PYRAMID - VTK_QUADRATIC_WEDGE --> VTK_WEDGE - VTK_...
['Returns', 'a', 'copy', 'of', 'the', 'input', 'unstructured', 'grid', 'containing', 'only', 'linear', 'cells', '.', 'Converts', 'the', 'following', 'cell', 'types', 'to', 'their', 'linear', 'equivalents', '.']
train
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/pointset.py#L2015-L2075
1,259
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
WorkingSet._build_master
def _build_master(cls): """ Prepare the master working set. """ ws = cls() try: from __main__ import __requires__ except ImportError: # The main program does not list any requirements return ws # ensure the requirements are met...
python
def _build_master(cls): """ Prepare the master working set. """ ws = cls() try: from __main__ import __requires__ except ImportError: # The main program does not list any requirements return ws # ensure the requirements are met...
['def', '_build_master', '(', 'cls', ')', ':', 'ws', '=', 'cls', '(', ')', 'try', ':', 'from', '__main__', 'import', '__requires__', 'except', 'ImportError', ':', '# The main program does not list any requirements', 'return', 'ws', '# ensure the requirements are met', 'try', ':', 'ws', '.', 'require', '(', '__requires_...
Prepare the master working set.
['Prepare', 'the', 'master', 'working', 'set', '.']
train
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L568-L585
1,260
mitsei/dlkit
dlkit/json_/learning/queries.py
ProficiencyQuery.match_objective_id
def match_objective_id(self, objective_id, match): """Sets the objective ``Id`` for this query. arg: objective_id (osid.id.Id): an objective ``Id`` arg: match (boolean): ``true`` for a positive match, ``false`` for a negative match raise: NullArgument - ``objectiv...
python
def match_objective_id(self, objective_id, match): """Sets the objective ``Id`` for this query. arg: objective_id (osid.id.Id): an objective ``Id`` arg: match (boolean): ``true`` for a positive match, ``false`` for a negative match raise: NullArgument - ``objectiv...
['def', 'match_objective_id', '(', 'self', ',', 'objective_id', ',', 'match', ')', ':', 'if', 'not', 'isinstance', '(', 'objective_id', ',', 'Id', ')', ':', 'raise', 'errors', '.', 'InvalidArgument', '(', ')', 'self', '.', '_add_match', '(', "'objectiveId'", ',', 'str', '(', 'objective_id', ')', ',', 'match', ')']
Sets the objective ``Id`` for this query. arg: objective_id (osid.id.Id): an objective ``Id`` arg: match (boolean): ``true`` for a positive match, ``false`` for a negative match raise: NullArgument - ``objective_id`` is ``null`` *compliance: mandatory -- This meth...
['Sets', 'the', 'objective', 'Id', 'for', 'this', 'query', '.']
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/queries.py#L1240-L1252
1,261
kubernetes-client/python
kubernetes/client/apis/apps_v1_api.py
AppsV1Api.replace_namespaced_replica_set_scale
def replace_namespaced_replica_set_scale(self, name, namespace, body, **kwargs): """ replace scale of the specified ReplicaSet This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.replace_namesp...
python
def replace_namespaced_replica_set_scale(self, name, namespace, body, **kwargs): """ replace scale of the specified ReplicaSet This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.replace_namesp...
['def', 'replace_namespaced_replica_set_scale', '(', 'self', ',', 'name', ',', 'namespace', ',', 'body', ',', '*', '*', 'kwargs', ')', ':', 'kwargs', '[', "'_return_http_data_only'", ']', '=', 'True', 'if', 'kwargs', '.', 'get', '(', "'async_req'", ')', ':', 'return', 'self', '.', 'replace_namespaced_replica_set_scale_...
replace scale of the specified ReplicaSet This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.replace_namespaced_replica_set_scale(name, namespace, body, async_req=True) >>> result = thread.get() ...
['replace', 'scale', 'of', 'the', 'specified', 'ReplicaSet', 'This', 'method', 'makes', 'a', 'synchronous', 'HTTP', 'request', 'by', 'default', '.', 'To', 'make', 'an', 'asynchronous', 'HTTP', 'request', 'please', 'pass', 'async_req', '=', 'True', '>>>', 'thread', '=', 'api', '.', 'replace_namespaced_replica_set_scale'...
train
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/apis/apps_v1_api.py#L6911-L6935
1,262
firstprayer/monsql
monsql/db.py
Database.drop_table
def drop_table(self, tablename, silent=False): """ Drop a table :Parameters: - tablename: string - slient: boolean. If false and the table doesn't exists an exception will be raised; Otherwise it will be ignored :Return: Nothing """ i...
python
def drop_table(self, tablename, silent=False): """ Drop a table :Parameters: - tablename: string - slient: boolean. If false and the table doesn't exists an exception will be raised; Otherwise it will be ignored :Return: Nothing """ i...
['def', 'drop_table', '(', 'self', ',', 'tablename', ',', 'silent', '=', 'False', ')', ':', 'if', 'not', 'silent', 'and', 'not', 'self', '.', 'is_table_existed', '(', 'tablename', ')', ':', 'raise', 'MonSQLException', '(', "'TABLE %s DOES NOT EXIST'", '%', 'tablename', ')', 'self', '.', '__cursor', '.', 'execute', '(',...
Drop a table :Parameters: - tablename: string - slient: boolean. If false and the table doesn't exists an exception will be raised; Otherwise it will be ignored :Return: Nothing
['Drop', 'a', 'table']
train
https://github.com/firstprayer/monsql/blob/6285c15b574c8664046eae2edfeb548c7b173efd/monsql/db.py#L138-L155
1,263
saxix/django-concurrency
src/concurrency/utils.py
get_classname
def get_classname(o): """ Returns the classname of an object r a class :param o: :return: """ if inspect.isclass(o): target = o elif callable(o): target = o else: target = o.__class__ try: return target.__qualname__ except AttributeError: # pragma: n...
python
def get_classname(o): """ Returns the classname of an object r a class :param o: :return: """ if inspect.isclass(o): target = o elif callable(o): target = o else: target = o.__class__ try: return target.__qualname__ except AttributeError: # pragma: n...
['def', 'get_classname', '(', 'o', ')', ':', 'if', 'inspect', '.', 'isclass', '(', 'o', ')', ':', 'target', '=', 'o', 'elif', 'callable', '(', 'o', ')', ':', 'target', '=', 'o', 'else', ':', 'target', '=', 'o', '.', '__class__', 'try', ':', 'return', 'target', '.', '__qualname__', 'except', 'AttributeError', ':', '# pr...
Returns the classname of an object r a class :param o: :return:
['Returns', 'the', 'classname', 'of', 'an', 'object', 'r', 'a', 'class']
train
https://github.com/saxix/django-concurrency/blob/9a289dc007b1cdf609b7dfb77a6d2868abc8097f/src/concurrency/utils.py#L121-L136
1,264
briney/abutils
abutils/utils/phylogeny.py
igphyml
def igphyml(input_file=None, tree_file=None, root=None, verbose=False): ''' Computes a phylogenetic tree using IgPhyML. .. note:: IgPhyML must be installed. It can be downloaded from https://github.com/kbhoehn/IgPhyML. Args: input_file (str): Path to a Phylip-formatted multip...
python
def igphyml(input_file=None, tree_file=None, root=None, verbose=False): ''' Computes a phylogenetic tree using IgPhyML. .. note:: IgPhyML must be installed. It can be downloaded from https://github.com/kbhoehn/IgPhyML. Args: input_file (str): Path to a Phylip-formatted multip...
['def', 'igphyml', '(', 'input_file', '=', 'None', ',', 'tree_file', '=', 'None', ',', 'root', '=', 'None', ',', 'verbose', '=', 'False', ')', ':', 'if', 'shutil', '.', 'which', '(', "'igphyml'", ')', 'is', 'None', ':', 'raise', 'RuntimeError', '(', "'It appears that IgPhyML is not installed.\\nPlease install and try a...
Computes a phylogenetic tree using IgPhyML. .. note:: IgPhyML must be installed. It can be downloaded from https://github.com/kbhoehn/IgPhyML. Args: input_file (str): Path to a Phylip-formatted multiple sequence alignment. Required. tree_file (str): Path to the output tree f...
['Computes', 'a', 'phylogenetic', 'tree', 'using', 'IgPhyML', '.']
train
https://github.com/briney/abutils/blob/944755fc7d28bfc7d4f1ffad94ca0bf9d74ec54b/abutils/utils/phylogeny.py#L452-L493
1,265
cirruscluster/cirruscluster
cirruscluster/ext/ansible/runner/connection_plugins/fireball.py
Connection.exec_command
def exec_command(self, cmd, tmp_path, sudo_user, sudoable=False, executable='/bin/sh'): ''' run a command on the remote host ''' vvv("EXEC COMMAND %s" % cmd) if self.runner.sudo and sudoable: raise errors.AnsibleError("fireball does not use sudo, but runs as whoever it was initiate...
python
def exec_command(self, cmd, tmp_path, sudo_user, sudoable=False, executable='/bin/sh'): ''' run a command on the remote host ''' vvv("EXEC COMMAND %s" % cmd) if self.runner.sudo and sudoable: raise errors.AnsibleError("fireball does not use sudo, but runs as whoever it was initiate...
['def', 'exec_command', '(', 'self', ',', 'cmd', ',', 'tmp_path', ',', 'sudo_user', ',', 'sudoable', '=', 'False', ',', 'executable', '=', "'/bin/sh'", ')', ':', 'vvv', '(', '"EXEC COMMAND %s"', '%', 'cmd', ')', 'if', 'self', '.', 'runner', '.', 'sudo', 'and', 'sudoable', ':', 'raise', 'errors', '.', 'AnsibleError', '(...
run a command on the remote host
['run', 'a', 'command', 'on', 'the', 'remote', 'host']
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/connection_plugins/fireball.py#L70-L92
1,266
ssato/python-anyconfig
src/anyconfig/cli.py
_try_dump
def _try_dump(cnf, outpath, otype, fmsg, extra_opts=None): """ :param cnf: Configuration object to print out :param outpath: Output file path or None :param otype: Output type or None :param fmsg: message if it cannot detect otype by 'inpath' :param extra_opts: Map object will be given to API.du...
python
def _try_dump(cnf, outpath, otype, fmsg, extra_opts=None): """ :param cnf: Configuration object to print out :param outpath: Output file path or None :param otype: Output type or None :param fmsg: message if it cannot detect otype by 'inpath' :param extra_opts: Map object will be given to API.du...
['def', '_try_dump', '(', 'cnf', ',', 'outpath', ',', 'otype', ',', 'fmsg', ',', 'extra_opts', '=', 'None', ')', ':', 'if', 'extra_opts', 'is', 'None', ':', 'extra_opts', '=', '{', '}', 'try', ':', 'API', '.', 'dump', '(', 'cnf', ',', 'outpath', ',', 'otype', ',', '*', '*', 'extra_opts', ')', 'except', 'API', '.', 'Unk...
:param cnf: Configuration object to print out :param outpath: Output file path or None :param otype: Output type or None :param fmsg: message if it cannot detect otype by 'inpath' :param extra_opts: Map object will be given to API.dump as extra options
[':', 'param', 'cnf', ':', 'Configuration', 'object', 'to', 'print', 'out', ':', 'param', 'outpath', ':', 'Output', 'file', 'path', 'or', 'None', ':', 'param', 'otype', ':', 'Output', 'type', 'or', 'None', ':', 'param', 'fmsg', ':', 'message', 'if', 'it', 'cannot', 'detect', 'otype', 'by', 'inpath', ':', 'param', 'extr...
train
https://github.com/ssato/python-anyconfig/blob/f2f4fb8d8e232aadea866c202e1dd7a5967e2877/src/anyconfig/cli.py#L291-L306
1,267
mishbahr/djangocms-forms
djangocms_forms/admin.py
FormSubmissionAdmin.render_export_form
def render_export_form(self, request, context, form_url=''): """ Render the from submission export form. """ context.update({ 'has_change_permission': self.has_change_permission(request), 'form_url': mark_safe(form_url), 'opts': self.opts, ...
python
def render_export_form(self, request, context, form_url=''): """ Render the from submission export form. """ context.update({ 'has_change_permission': self.has_change_permission(request), 'form_url': mark_safe(form_url), 'opts': self.opts, ...
['def', 'render_export_form', '(', 'self', ',', 'request', ',', 'context', ',', 'form_url', '=', "''", ')', ':', 'context', '.', 'update', '(', '{', "'has_change_permission'", ':', 'self', '.', 'has_change_permission', '(', 'request', ')', ',', "'form_url'", ':', 'mark_safe', '(', 'form_url', ')', ',', "'opts'", ':', '...
Render the from submission export form.
['Render', 'the', 'from', 'submission', 'export', 'form', '.']
train
https://github.com/mishbahr/djangocms-forms/blob/9d7a4ef9769fd5e1526921c084d6da7b8070a2c1/djangocms_forms/admin.py#L260-L272
1,268
geopy/geopy
geopy/units.py
feet
def feet(kilometers=0, meters=0, miles=0, nautical=0): """ TODO docs. """ ret = 0. if nautical: kilometers += nautical / nm(1.) if meters: kilometers += meters / 1000. if kilometers: miles += mi(kilometers=kilometers) ret += miles * 5280 return ret
python
def feet(kilometers=0, meters=0, miles=0, nautical=0): """ TODO docs. """ ret = 0. if nautical: kilometers += nautical / nm(1.) if meters: kilometers += meters / 1000. if kilometers: miles += mi(kilometers=kilometers) ret += miles * 5280 return ret
['def', 'feet', '(', 'kilometers', '=', '0', ',', 'meters', '=', '0', ',', 'miles', '=', '0', ',', 'nautical', '=', '0', ')', ':', 'ret', '=', '0.', 'if', 'nautical', ':', 'kilometers', '+=', 'nautical', '/', 'nm', '(', '1.', ')', 'if', 'meters', ':', 'kilometers', '+=', 'meters', '/', '1000.', 'if', 'kilometers', ':',...
TODO docs.
['TODO', 'docs', '.']
train
https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/units.py#L96-L108
1,269
openstack/pyghmi
pyghmi/ipmi/command.py
Command.get_bootdev
def get_bootdev(self): """Get current boot device override information. Provides the current requested boot device. Be aware that not all IPMI devices support this. Even in BMCs that claim to, occasionally the BIOS or UEFI fail to honor it. This is usually only applicable to the ...
python
def get_bootdev(self): """Get current boot device override information. Provides the current requested boot device. Be aware that not all IPMI devices support this. Even in BMCs that claim to, occasionally the BIOS or UEFI fail to honor it. This is usually only applicable to the ...
['def', 'get_bootdev', '(', 'self', ')', ':', 'response', '=', 'self', '.', 'raw_command', '(', 'netfn', '=', '0', ',', 'command', '=', '9', ',', 'data', '=', '(', '5', ',', '0', ',', '0', ')', ')', "# interpret response per 'get system boot options'", 'if', "'error'", 'in', 'response', ':', 'raise', 'exc', '.', 'IpmiE...
Get current boot device override information. Provides the current requested boot device. Be aware that not all IPMI devices support this. Even in BMCs that claim to, occasionally the BIOS or UEFI fail to honor it. This is usually only applicable to the next reboot. :raises: ...
['Get', 'current', 'boot', 'device', 'override', 'information', '.']
train
https://github.com/openstack/pyghmi/blob/f710b1d30a8eed19a9e86f01f9351c737666f3e5/pyghmi/ipmi/command.py#L241-L281
1,270
tensorflow/tensor2tensor
tensor2tensor/rl/rl_utils.py
random_rollout_subsequences
def random_rollout_subsequences(rollouts, num_subsequences, subsequence_length): """Chooses a random frame sequence of given length from a set of rollouts.""" def choose_subsequence(): # TODO(koz4k): Weigh rollouts by their lengths so sampling is uniform over # frames and not rollouts. rollout = random....
python
def random_rollout_subsequences(rollouts, num_subsequences, subsequence_length): """Chooses a random frame sequence of given length from a set of rollouts.""" def choose_subsequence(): # TODO(koz4k): Weigh rollouts by their lengths so sampling is uniform over # frames and not rollouts. rollout = random....
['def', 'random_rollout_subsequences', '(', 'rollouts', ',', 'num_subsequences', ',', 'subsequence_length', ')', ':', 'def', 'choose_subsequence', '(', ')', ':', '# TODO(koz4k): Weigh rollouts by their lengths so sampling is uniform over', '# frames and not rollouts.', 'rollout', '=', 'random', '.', 'choice', '(', 'rol...
Chooses a random frame sequence of given length from a set of rollouts.
['Chooses', 'a', 'random', 'frame', 'sequence', 'of', 'given', 'length', 'from', 'a', 'set', 'of', 'rollouts', '.']
train
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/rl_utils.py#L323-L336
1,271
osrg/ryu
ryu/lib/lacplib.py
LacpLib._add_flow_v1_2
def _add_flow_v1_2(self, src, port, timeout, datapath): """enter a flow entry for the packet from the slave i/f with idle_timeout. for OpenFlow ver1.2 and ver1.3.""" ofproto = datapath.ofproto parser = datapath.ofproto_parser match = parser.OFPMatch( in_port=port, et...
python
def _add_flow_v1_2(self, src, port, timeout, datapath): """enter a flow entry for the packet from the slave i/f with idle_timeout. for OpenFlow ver1.2 and ver1.3.""" ofproto = datapath.ofproto parser = datapath.ofproto_parser match = parser.OFPMatch( in_port=port, et...
['def', '_add_flow_v1_2', '(', 'self', ',', 'src', ',', 'port', ',', 'timeout', ',', 'datapath', ')', ':', 'ofproto', '=', 'datapath', '.', 'ofproto', 'parser', '=', 'datapath', '.', 'ofproto_parser', 'match', '=', 'parser', '.', 'OFPMatch', '(', 'in_port', '=', 'port', ',', 'eth_src', '=', 'src', ',', 'eth_type', '=',...
enter a flow entry for the packet from the slave i/f with idle_timeout. for OpenFlow ver1.2 and ver1.3.
['enter', 'a', 'flow', 'entry', 'for', 'the', 'packet', 'from', 'the', 'slave', 'i', '/', 'f', 'with', 'idle_timeout', '.', 'for', 'OpenFlow', 'ver1', '.', '2', 'and', 'ver1', '.', '3', '.']
train
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/lacplib.py#L305-L322
1,272
cocaine/cocaine-tools
cocaine/tools/dispatch.py
keyring_remove
def keyring_remove(key, yes, **kwargs): """ Removes a public key from the keyring. Does nothing if a key is already not in the keyring. If none is specified - clears the keyring. To force the cocaine-runtime to refresh its keyring, call `refresh` method. """ if key is None: if not yes: ...
python
def keyring_remove(key, yes, **kwargs): """ Removes a public key from the keyring. Does nothing if a key is already not in the keyring. If none is specified - clears the keyring. To force the cocaine-runtime to refresh its keyring, call `refresh` method. """ if key is None: if not yes: ...
['def', 'keyring_remove', '(', 'key', ',', 'yes', ',', '*', '*', 'kwargs', ')', ':', 'if', 'key', 'is', 'None', ':', 'if', 'not', 'yes', ':', 'click', '.', 'confirm', '(', "'Are you sure you want to remove all keys?'", ',', 'abort', '=', 'True', ')', 'ctx', '=', 'Context', '(', '*', '*', 'kwargs', ')', 'ctx', '.', 'exe...
Removes a public key from the keyring. Does nothing if a key is already not in the keyring. If none is specified - clears the keyring. To force the cocaine-runtime to refresh its keyring, call `refresh` method.
['Removes', 'a', 'public', 'key', 'from', 'the', 'keyring', '.']
train
https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1998-L2013
1,273
PetrochukM/PyTorch-NLP
torchnlp/encoders/text/subword_text_tokenizer.py
SubwordTextTokenizer.build_to_target_size_from_token_counts
def build_to_target_size_from_token_counts(cls, target_size, token_counts, min_val, max_val, ...
python
def build_to_target_size_from_token_counts(cls, target_size, token_counts, min_val, max_val, ...
['def', 'build_to_target_size_from_token_counts', '(', 'cls', ',', 'target_size', ',', 'token_counts', ',', 'min_val', ',', 'max_val', ',', 'num_iterations', '=', '4', ')', ':', 'if', 'min_val', '>', 'max_val', ':', 'raise', 'ValueError', '(', '"Lower bound for the minimum token count "', '"is greater than the upper bo...
Builds a SubwordTextTokenizer that has `vocab_size` near `target_size`. Uses simple recursive binary search to find a minimum token count that most closely matches the `target_size`. Args: target_size: Desired vocab_size to approximate. token_counts: A dictionary of token c...
['Builds', 'a', 'SubwordTextTokenizer', 'that', 'has', 'vocab_size', 'near', 'target_size', '.']
train
https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/text/subword_text_tokenizer.py#L280-L334
1,274
swift-nav/libsbp
generator/sbpg/targets/protobuf.py
to_identifier
def to_identifier(s): """ Convert snake_case to camel_case. """ if s.startswith('GPS'): s = 'Gps' + s[3:] return ''.join([i.capitalize() for i in s.split('_')]) if '_' in s else s
python
def to_identifier(s): """ Convert snake_case to camel_case. """ if s.startswith('GPS'): s = 'Gps' + s[3:] return ''.join([i.capitalize() for i in s.split('_')]) if '_' in s else s
['def', 'to_identifier', '(', 's', ')', ':', 'if', 's', '.', 'startswith', '(', "'GPS'", ')', ':', 's', '=', "'Gps'", '+', 's', '[', '3', ':', ']', 'return', "''", '.', 'join', '(', '[', 'i', '.', 'capitalize', '(', ')', 'for', 'i', 'in', 's', '.', 'split', '(', "'_'", ')', ']', ')', 'if', "'_'", 'in', 's', 'else', 's'...
Convert snake_case to camel_case.
['Convert', 'snake_case', 'to', 'camel_case', '.']
train
https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/protobuf.py#L50-L56
1,275
peterwittek/ncpol2sdpa
ncpol2sdpa/physics_utils.py
define_objective_with_I
def define_objective_with_I(I, *args): """Define a polynomial using measurements and an I matrix describing a Bell inequality. :param I: The I matrix of a Bell inequality in the Collins-Gisin notation. :type I: list of list of int. :param args: Either the measurements of Alice and Bob or a `Probabi...
python
def define_objective_with_I(I, *args): """Define a polynomial using measurements and an I matrix describing a Bell inequality. :param I: The I matrix of a Bell inequality in the Collins-Gisin notation. :type I: list of list of int. :param args: Either the measurements of Alice and Bob or a `Probabi...
['def', 'define_objective_with_I', '(', 'I', ',', '*', 'args', ')', ':', 'objective', '=', 'I', '[', '0', ']', '[', '0', ']', 'if', 'len', '(', 'args', ')', '>', '2', 'or', 'len', '(', 'args', ')', '==', '0', ':', 'raise', 'Exception', '(', '"Wrong number of arguments!"', ')', 'elif', 'len', '(', 'args', ')', '==', '1'...
Define a polynomial using measurements and an I matrix describing a Bell inequality. :param I: The I matrix of a Bell inequality in the Collins-Gisin notation. :type I: list of list of int. :param args: Either the measurements of Alice and Bob or a `Probability` class describing their ...
['Define', 'a', 'polynomial', 'using', 'measurements', 'and', 'an', 'I', 'matrix', 'describing', 'a', 'Bell', 'inequality', '.']
train
https://github.com/peterwittek/ncpol2sdpa/blob/bce75d524d0b9d0093f32e3a0a5611f8589351a7/ncpol2sdpa/physics_utils.py#L219-L260
1,276
brainiak/brainiak
brainiak/funcalign/rsrm.py
RSRM._init_individual
def _init_individual(subjs, voxels, TRs): """Initializes the individual components `S_i` to empty (all zeros). Parameters ---------- subjs : int The number of subjects. voxels : list of int A list with the number of voxels per subject. TRs : in...
python
def _init_individual(subjs, voxels, TRs): """Initializes the individual components `S_i` to empty (all zeros). Parameters ---------- subjs : int The number of subjects. voxels : list of int A list with the number of voxels per subject. TRs : in...
['def', '_init_individual', '(', 'subjs', ',', 'voxels', ',', 'TRs', ')', ':', 'return', '[', 'np', '.', 'zeros', '(', '(', 'voxels', '[', 'i', ']', ',', 'TRs', ')', ')', 'for', 'i', 'in', 'range', '(', 'subjs', ')', ']']
Initializes the individual components `S_i` to empty (all zeros). Parameters ---------- subjs : int The number of subjects. voxels : list of int A list with the number of voxels per subject. TRs : int The number of timepoints in the data. ...
['Initializes', 'the', 'individual', 'components', 'S_i', 'to', 'empty', '(', 'all', 'zeros', ')', '.']
train
https://github.com/brainiak/brainiak/blob/408f12dec2ff56559a26873a848a09e4c8facfeb/brainiak/funcalign/rsrm.py#L420-L442
1,277
LuqueDaniel/pybooru
pybooru/api_danbooru.py
DanbooruApi_Mixin.post_copy_notes
def post_copy_notes(self, post_id, other_post_id): """Function to copy notes (requires login). Parameters: post_id (int): other_post_id (int): The id of the post to copy notes to. """ return self._get('posts/{0}/copy_notes.json'.format(post_id), ...
python
def post_copy_notes(self, post_id, other_post_id): """Function to copy notes (requires login). Parameters: post_id (int): other_post_id (int): The id of the post to copy notes to. """ return self._get('posts/{0}/copy_notes.json'.format(post_id), ...
['def', 'post_copy_notes', '(', 'self', ',', 'post_id', ',', 'other_post_id', ')', ':', 'return', 'self', '.', '_get', '(', "'posts/{0}/copy_notes.json'", '.', 'format', '(', 'post_id', ')', ',', '{', "'other_post_id'", ':', 'other_post_id', '}', ',', "'PUT'", ',', 'auth', '=', 'True', ')']
Function to copy notes (requires login). Parameters: post_id (int): other_post_id (int): The id of the post to copy notes to.
['Function', 'to', 'copy', 'notes', '(', 'requires', 'login', ')', '.']
train
https://github.com/LuqueDaniel/pybooru/blob/60cd5254684d293b308f0b11b8f4ac2dce101479/pybooru/api_danbooru.py#L92-L100
1,278
GoogleCloudPlatform/cloud-debug-python
src/googleclouddebugger/gcp_hub_client.py
GcpHubClient.Stop
def Stop(self): """Signals the worker threads to shut down and waits until it exits.""" self._shutdown = True self._new_updates.set() # Wake up the transmission thread. if self._main_thread is not None: self._main_thread.join() self._main_thread = None if self._transmission_thread is ...
python
def Stop(self): """Signals the worker threads to shut down and waits until it exits.""" self._shutdown = True self._new_updates.set() # Wake up the transmission thread. if self._main_thread is not None: self._main_thread.join() self._main_thread = None if self._transmission_thread is ...
['def', 'Stop', '(', 'self', ')', ':', 'self', '.', '_shutdown', '=', 'True', 'self', '.', '_new_updates', '.', 'set', '(', ')', '# Wake up the transmission thread.', 'if', 'self', '.', '_main_thread', 'is', 'not', 'None', ':', 'self', '.', '_main_thread', '.', 'join', '(', ')', 'self', '.', '_main_thread', '=', 'None'...
Signals the worker threads to shut down and waits until it exits.
['Signals', 'the', 'worker', 'threads', 'to', 'shut', 'down', 'and', 'waits', 'until', 'it', 'exits', '.']
train
https://github.com/GoogleCloudPlatform/cloud-debug-python/blob/89ce3782c98b814838a3ecb5479ed3882368cbee/src/googleclouddebugger/gcp_hub_client.py#L229-L240
1,279
denniskempin/safetynet
safetynet.py
_TypecheckDecorator
def _TypecheckDecorator(subject=None, **kwargs): """Dispatches type checks based on what the subject is. Functions or methods are annotated directly. If this method is called with keyword arguments only, return a decorator. """ if subject is None: return _TypecheckDecoratorFactory(kwargs) elif inspect....
python
def _TypecheckDecorator(subject=None, **kwargs): """Dispatches type checks based on what the subject is. Functions or methods are annotated directly. If this method is called with keyword arguments only, return a decorator. """ if subject is None: return _TypecheckDecoratorFactory(kwargs) elif inspect....
['def', '_TypecheckDecorator', '(', 'subject', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'if', 'subject', 'is', 'None', ':', 'return', '_TypecheckDecoratorFactory', '(', 'kwargs', ')', 'elif', 'inspect', '.', 'isfunction', '(', 'subject', ')', 'or', 'inspect', '.', 'ismethod', '(', 'subject', ')', ':', 'return', ...
Dispatches type checks based on what the subject is. Functions or methods are annotated directly. If this method is called with keyword arguments only, return a decorator.
['Dispatches', 'type', 'checks', 'based', 'on', 'what', 'the', 'subject', 'is', '.']
train
https://github.com/denniskempin/safetynet/blob/fbcc4a112370fc20696f003d901114b4fe26d984/safetynet.py#L459-L470
1,280
h2oai/datatable
datatable/xls.py
_parse_row
def _parse_row(rowvalues, rowtypes): """ Scan a single row from an Excel file, and return the list of ranges corresponding to each consecutive span of non-empty cells in this row. If all cells are empty, return an empty list. Each "range" in the list is a tuple of the form `(startcol, endcol)`. ...
python
def _parse_row(rowvalues, rowtypes): """ Scan a single row from an Excel file, and return the list of ranges corresponding to each consecutive span of non-empty cells in this row. If all cells are empty, return an empty list. Each "range" in the list is a tuple of the form `(startcol, endcol)`. ...
['def', '_parse_row', '(', 'rowvalues', ',', 'rowtypes', ')', ':', 'n', '=', 'len', '(', 'rowvalues', ')', 'assert', 'n', '==', 'len', '(', 'rowtypes', ')', 'if', 'not', 'n', ':', 'return', '[', ']', 'range_start', '=', 'None', 'ranges', '=', '[', ']', 'for', 'i', 'in', 'range', '(', 'n', ')', ':', 'ctype', '=', 'rowty...
Scan a single row from an Excel file, and return the list of ranges corresponding to each consecutive span of non-empty cells in this row. If all cells are empty, return an empty list. Each "range" in the list is a tuple of the form `(startcol, endcol)`. For example, if the row is the following: ...
['Scan', 'a', 'single', 'row', 'from', 'an', 'Excel', 'file', 'and', 'return', 'the', 'list', 'of', 'ranges', 'corresponding', 'to', 'each', 'consecutive', 'span', 'of', 'non', '-', 'empty', 'cells', 'in', 'this', 'row', '.', 'If', 'all', 'cells', 'are', 'empty', 'return', 'an', 'empty', 'list', '.', 'Each', 'range', '...
train
https://github.com/h2oai/datatable/blob/dd5fba74d2ca85b66f82ae3c1e0b6ea2fd792564/datatable/xls.py#L106-L147
1,281
fracpete/python-weka-wrapper3
python/weka/core/classes.py
Environment.variable_names
def variable_names(self): """ Returns the names of all environment variables. :return: the names of the variables :rtype: list """ result = [] names = javabridge.call(self.jobject, "getVariableNames", "()Ljava/util/Set;") for name in javabridge.iterate_co...
python
def variable_names(self): """ Returns the names of all environment variables. :return: the names of the variables :rtype: list """ result = [] names = javabridge.call(self.jobject, "getVariableNames", "()Ljava/util/Set;") for name in javabridge.iterate_co...
['def', 'variable_names', '(', 'self', ')', ':', 'result', '=', '[', ']', 'names', '=', 'javabridge', '.', 'call', '(', 'self', '.', 'jobject', ',', '"getVariableNames"', ',', '"()Ljava/util/Set;"', ')', 'for', 'name', 'in', 'javabridge', '.', 'iterate_collection', '(', 'names', ')', ':', 'result', '.', 'append', '(', ...
Returns the names of all environment variables. :return: the names of the variables :rtype: list
['Returns', 'the', 'names', 'of', 'all', 'environment', 'variables', '.']
train
https://github.com/fracpete/python-weka-wrapper3/blob/d850ab1bdb25fbd5a8d86e99f34a397975425838/python/weka/core/classes.py#L707-L718
1,282
Kozea/pygal
pygal/graph/dot.py
Dot.dot
def dot(self, serie, r_max): """Draw a dot line""" serie_node = self.svg.serie(serie) view_values = list(map(self.view, serie.points)) for i, value in safe_enumerate(serie.values): x, y = view_values[i] if self.logarithmic: log10min = log10(self._...
python
def dot(self, serie, r_max): """Draw a dot line""" serie_node = self.svg.serie(serie) view_values = list(map(self.view, serie.points)) for i, value in safe_enumerate(serie.values): x, y = view_values[i] if self.logarithmic: log10min = log10(self._...
['def', 'dot', '(', 'self', ',', 'serie', ',', 'r_max', ')', ':', 'serie_node', '=', 'self', '.', 'svg', '.', 'serie', '(', 'serie', ')', 'view_values', '=', 'list', '(', 'map', '(', 'self', '.', 'view', ',', 'serie', '.', 'points', ')', ')', 'for', 'i', ',', 'value', 'in', 'safe_enumerate', '(', 'serie', '.', 'values'...
Draw a dot line
['Draw', 'a', 'dot', 'line']
train
https://github.com/Kozea/pygal/blob/5e25c98a59a0642eecd9fcc5dbfeeb2190fbb5e7/pygal/graph/dot.py#L37-L77
1,283
genialis/resolwe
resolwe/flow/models/data.py
Data.create_entity
def create_entity(self): """Create entity if `flow_collection` is defined in process. Following rules applies for adding `Data` object to `Entity`: * Only add `Data object` to `Entity` if process has defined `flow_collection` field * Add object to existing `Entity`, if all paren...
python
def create_entity(self): """Create entity if `flow_collection` is defined in process. Following rules applies for adding `Data` object to `Entity`: * Only add `Data object` to `Entity` if process has defined `flow_collection` field * Add object to existing `Entity`, if all paren...
['def', 'create_entity', '(', 'self', ')', ':', 'entity_type', '=', 'self', '.', 'process', '.', 'entity_type', '# pylint: disable=no-member', 'entity_descriptor_schema', '=', 'self', '.', 'process', '.', 'entity_descriptor_schema', '# pylint: disable=no-member', 'entity_input', '=', 'self', '.', 'process', '.', 'entit...
Create entity if `flow_collection` is defined in process. Following rules applies for adding `Data` object to `Entity`: * Only add `Data object` to `Entity` if process has defined `flow_collection` field * Add object to existing `Entity`, if all parents that are part of it (but ...
['Create', 'entity', 'if', 'flow_collection', 'is', 'defined', 'in', 'process', '.']
train
https://github.com/genialis/resolwe/blob/f7bb54932c81ec0cfc5b5e80d238fceaeaa48d86/resolwe/flow/models/data.py#L338-L401
1,284
jaywink/federation
federation/entities/diaspora/mappers.py
message_to_objects
def message_to_objects( message: str, sender: str, sender_key_fetcher:Callable[[str], str]=None, user: UserType =None, ) -> List: """Takes in a message extracted by a protocol and maps it to entities. :param message: XML payload :type message: str :param sender: Payload sender id :type mess...
python
def message_to_objects( message: str, sender: str, sender_key_fetcher:Callable[[str], str]=None, user: UserType =None, ) -> List: """Takes in a message extracted by a protocol and maps it to entities. :param message: XML payload :type message: str :param sender: Payload sender id :type mess...
['def', 'message_to_objects', '(', 'message', ':', 'str', ',', 'sender', ':', 'str', ',', 'sender_key_fetcher', ':', 'Callable', '[', '[', 'str', ']', ',', 'str', ']', '=', 'None', ',', 'user', ':', 'UserType', '=', 'None', ',', ')', '->', 'List', ':', 'doc', '=', 'etree', '.', 'fromstring', '(', 'message', ')', 'if', ...
Takes in a message extracted by a protocol and maps it to entities. :param message: XML payload :type message: str :param sender: Payload sender id :type message: str :param sender_key_fetcher: Function to fetch sender public key. If not given, key will always be fetched over network. The f...
['Takes', 'in', 'a', 'message', 'extracted', 'by', 'a', 'protocol', 'and', 'maps', 'it', 'to', 'entities', '.']
train
https://github.com/jaywink/federation/blob/59d31bb37e662891dbea72c1dee05dc53146c78b/federation/entities/diaspora/mappers.py#L138-L155
1,285
tensorflow/tensorboard
tensorboard/plugins/image/images_demo.py
get_image
def get_image(verbose=False): """Get the image as a TensorFlow variable. Returns: A `tf.Variable`, which must be initialized prior to use: invoke `sess.run(result.initializer)`.""" base_data = tf.constant(image_data(verbose=verbose)) base_image = tf.image.decode_image(base_data, channels=3) base_imag...
python
def get_image(verbose=False): """Get the image as a TensorFlow variable. Returns: A `tf.Variable`, which must be initialized prior to use: invoke `sess.run(result.initializer)`.""" base_data = tf.constant(image_data(verbose=verbose)) base_image = tf.image.decode_image(base_data, channels=3) base_imag...
['def', 'get_image', '(', 'verbose', '=', 'False', ')', ':', 'base_data', '=', 'tf', '.', 'constant', '(', 'image_data', '(', 'verbose', '=', 'verbose', ')', ')', 'base_image', '=', 'tf', '.', 'image', '.', 'decode_image', '(', 'base_data', ',', 'channels', '=', '3', ')', 'base_image', '.', 'set_shape', '(', '(', 'IMAG...
Get the image as a TensorFlow variable. Returns: A `tf.Variable`, which must be initialized prior to use: invoke `sess.run(result.initializer)`.
['Get', 'the', 'image', 'as', 'a', 'TensorFlow', 'variable', '.']
train
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/image/images_demo.py#L99-L109
1,286
softlayer/softlayer-python
SoftLayer/managers/vs.py
VSManager.list_instances
def list_instances(self, hourly=True, monthly=True, tags=None, cpus=None, memory=None, hostname=None, domain=None, local_disk=None, datacenter=None, nic_speed=None, public_ip=None, private_ip=None, **kwargs): """Retrieve a list of all virtual ...
python
def list_instances(self, hourly=True, monthly=True, tags=None, cpus=None, memory=None, hostname=None, domain=None, local_disk=None, datacenter=None, nic_speed=None, public_ip=None, private_ip=None, **kwargs): """Retrieve a list of all virtual ...
['def', 'list_instances', '(', 'self', ',', 'hourly', '=', 'True', ',', 'monthly', '=', 'True', ',', 'tags', '=', 'None', ',', 'cpus', '=', 'None', ',', 'memory', '=', 'None', ',', 'hostname', '=', 'None', ',', 'domain', '=', 'None', ',', 'local_disk', '=', 'None', ',', 'datacenter', '=', 'None', ',', 'nic_speed', '=',...
Retrieve a list of all virtual servers on the account. Example:: # Print out a list of hourly instances in the DAL05 data center. for vsi in mgr.list_instances(hourly=True, datacenter='dal05'): print vsi['fullyQualifiedDomainName'], vsi['primaryIpAddress'] ...
['Retrieve', 'a', 'list', 'of', 'all', 'virtual', 'servers', 'on', 'the', 'account', '.']
train
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs.py#L61-L162
1,287
mottosso/be
be/cli.py
tab
def tab(topics, complete): """Utility sub-command for tabcompletion This command is meant to be called by a tab completion function and is given a the currently entered topics, along with a boolean indicating whether or not the last entered argument is complete. """ # Discard `be tab` ...
python
def tab(topics, complete): """Utility sub-command for tabcompletion This command is meant to be called by a tab completion function and is given a the currently entered topics, along with a boolean indicating whether or not the last entered argument is complete. """ # Discard `be tab` ...
['def', 'tab', '(', 'topics', ',', 'complete', ')', ':', '# Discard `be tab`', 'topics', '=', 'list', '(', 'topics', ')', '[', '2', ':', ']', '# When given an incomplete argument,', '# the argument is *sometimes* returned twice (?)', '# .. note:: Seen in Git Bash on Windows', '# $ be in giant [TAB]', "# -> ['giant']", ...
Utility sub-command for tabcompletion This command is meant to be called by a tab completion function and is given a the currently entered topics, along with a boolean indicating whether or not the last entered argument is complete.
['Utility', 'sub', '-', 'command', 'for', 'tabcompletion']
train
https://github.com/mottosso/be/blob/0f3d4f3597c71223f616d78c6d9b2c8dffcd8a71/be/cli.py#L433-L512
1,288
neon-jungle/wagtailnews
wagtailnews/permissions.py
user_can_edit_news
def user_can_edit_news(user): """ Check if the user has permission to edit any of the registered NewsItem types. """ newsitem_models = [model.get_newsitem_model() for model in NEWSINDEX_MODEL_CLASSES] if user.is_active and user.is_superuser: # admin can edit news ...
python
def user_can_edit_news(user): """ Check if the user has permission to edit any of the registered NewsItem types. """ newsitem_models = [model.get_newsitem_model() for model in NEWSINDEX_MODEL_CLASSES] if user.is_active and user.is_superuser: # admin can edit news ...
['def', 'user_can_edit_news', '(', 'user', ')', ':', 'newsitem_models', '=', '[', 'model', '.', 'get_newsitem_model', '(', ')', 'for', 'model', 'in', 'NEWSINDEX_MODEL_CLASSES', ']', 'if', 'user', '.', 'is_active', 'and', 'user', '.', 'is_superuser', ':', '# admin can edit news iff any news types exist', 'return', 'bool...
Check if the user has permission to edit any of the registered NewsItem types.
['Check', 'if', 'the', 'user', 'has', 'permission', 'to', 'edit', 'any', 'of', 'the', 'registered', 'NewsItem', 'types', '.']
train
https://github.com/neon-jungle/wagtailnews/blob/4cdec7013cca276dcfc658d3c986444ba6a42a84/wagtailnews/permissions.py#L21-L38
1,289
teepark/greenhouse
greenhouse/io/ssl.py
SSLSocket.do_handshake
def do_handshake(self, timeout): 'perform a SSL/TLS handshake' tout = _timeout(timeout) if not self._blocking: return self._sslobj.do_handshake() while 1: try: return self._sslobj.do_handshake() except ssl.SSLError, exc: ...
python
def do_handshake(self, timeout): 'perform a SSL/TLS handshake' tout = _timeout(timeout) if not self._blocking: return self._sslobj.do_handshake() while 1: try: return self._sslobj.do_handshake() except ssl.SSLError, exc: ...
['def', 'do_handshake', '(', 'self', ',', 'timeout', ')', ':', 'tout', '=', '_timeout', '(', 'timeout', ')', 'if', 'not', 'self', '.', '_blocking', ':', 'return', 'self', '.', '_sslobj', '.', 'do_handshake', '(', ')', 'while', '1', ':', 'try', ':', 'return', 'self', '.', '_sslobj', '.', 'do_handshake', '(', ')', 'excep...
perform a SSL/TLS handshake
['perform', 'a', 'SSL', '/', 'TLS', 'handshake']
train
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/ssl.py#L242-L261
1,290
alfred82santa/dirty-models
dirty_models/models.py
recover_hashmap_model_from_data
def recover_hashmap_model_from_data(model_class, original_data, modified_data, deleted_data, field_type): """ Function to reconstruct a model from DirtyModel basic information: original data, the modified and deleted fields. Necessary for pickle an object """ model = model_class(field_type=field...
python
def recover_hashmap_model_from_data(model_class, original_data, modified_data, deleted_data, field_type): """ Function to reconstruct a model from DirtyModel basic information: original data, the modified and deleted fields. Necessary for pickle an object """ model = model_class(field_type=field...
['def', 'recover_hashmap_model_from_data', '(', 'model_class', ',', 'original_data', ',', 'modified_data', ',', 'deleted_data', ',', 'field_type', ')', ':', 'model', '=', 'model_class', '(', 'field_type', '=', 'field_type', '[', '0', ']', '(', '*', '*', 'field_type', '[', '1', ']', ')', ')', 'return', 'set_model_intern...
Function to reconstruct a model from DirtyModel basic information: original data, the modified and deleted fields. Necessary for pickle an object
['Function', 'to', 'reconstruct', 'a', 'model', 'from', 'DirtyModel', 'basic', 'information', ':', 'original', 'data', 'the', 'modified', 'and', 'deleted', 'fields', '.', 'Necessary', 'for', 'pickle', 'an', 'object']
train
https://github.com/alfred82santa/dirty-models/blob/354becdb751b21f673515eae928c256c7e923c50/dirty_models/models.py#L853-L860
1,291
kislyuk/aegea
aegea/buckets.py
ls
def ls(args): """ List S3 buckets. See also "aws s3 ls". Use "aws s3 ls NAME" to list bucket contents. """ table = [] for bucket in filter_collection(resources.s3.buckets, args): bucket.LocationConstraint = clients.s3.get_bucket_location(Bucket=bucket.name)["LocationConstraint"] clou...
python
def ls(args): """ List S3 buckets. See also "aws s3 ls". Use "aws s3 ls NAME" to list bucket contents. """ table = [] for bucket in filter_collection(resources.s3.buckets, args): bucket.LocationConstraint = clients.s3.get_bucket_location(Bucket=bucket.name)["LocationConstraint"] clou...
['def', 'ls', '(', 'args', ')', ':', 'table', '=', '[', ']', 'for', 'bucket', 'in', 'filter_collection', '(', 'resources', '.', 's3', '.', 'buckets', ',', 'args', ')', ':', 'bucket', '.', 'LocationConstraint', '=', 'clients', '.', 's3', '.', 'get_bucket_location', '(', 'Bucket', '=', 'bucket', '.', 'name', ')', '[', '"...
List S3 buckets. See also "aws s3 ls". Use "aws s3 ls NAME" to list bucket contents.
['List', 'S3', 'buckets', '.', 'See', 'also', 'aws', 's3', 'ls', '.', 'Use', 'aws', 's3', 'ls', 'NAME', 'to', 'list', 'bucket', 'contents', '.']
train
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/buckets.py#L21-L43
1,292
senaite/senaite.core
bika/lims/content/abstractanalysis.py
AbstractAnalysis.getAllowedMethods
def getAllowedMethods(self): """Returns the allowed methods for this analysis, either if the method was assigned directly (by using "Allows manual entry of results") or indirectly via Instrument ("Allows instrument entry of results") in Analysis Service Edit View. :return: A list...
python
def getAllowedMethods(self): """Returns the allowed methods for this analysis, either if the method was assigned directly (by using "Allows manual entry of results") or indirectly via Instrument ("Allows instrument entry of results") in Analysis Service Edit View. :return: A list...
['def', 'getAllowedMethods', '(', 'self', ')', ':', 'service', '=', 'self', '.', 'getAnalysisService', '(', ')', 'if', 'not', 'service', ':', 'return', '[', ']', 'methods', '=', '[', ']', 'if', 'self', '.', 'getManualEntryOfResults', '(', ')', ':', 'methods', '=', 'service', '.', 'getMethods', '(', ')', 'if', 'self', '...
Returns the allowed methods for this analysis, either if the method was assigned directly (by using "Allows manual entry of results") or indirectly via Instrument ("Allows instrument entry of results") in Analysis Service Edit View. :return: A list with the methods allowed for this analy...
['Returns', 'the', 'allowed', 'methods', 'for', 'this', 'analysis', 'either', 'if', 'the', 'method', 'was', 'assigned', 'directly', '(', 'by', 'using', 'Allows', 'manual', 'entry', 'of', 'results', ')', 'or', 'indirectly', 'via', 'Instrument', '(', 'Allows', 'instrument', 'entry', 'of', 'results', ')', 'in', 'Analysis'...
train
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/content/abstractanalysis.py#L717-L736
1,293
pywbem/pywbem
pywbem/_listener.py
ListenerRequestHandler.log
def log(self, format_, args, level=logging.INFO): """ This function is called for anything that needs to get logged. It logs to the logger of this listener. It is not defined in the standard handler class; our version has an additional `level` argument that allows to control the...
python
def log(self, format_, args, level=logging.INFO): """ This function is called for anything that needs to get logged. It logs to the logger of this listener. It is not defined in the standard handler class; our version has an additional `level` argument that allows to control the...
['def', 'log', '(', 'self', ',', 'format_', ',', 'args', ',', 'level', '=', 'logging', '.', 'INFO', ')', ':', 'self', '.', 'server', '.', 'listener', '.', 'logger', '.', 'log', '(', 'level', ',', 'format_', ',', '*', 'args', ')']
This function is called for anything that needs to get logged. It logs to the logger of this listener. It is not defined in the standard handler class; our version has an additional `level` argument that allows to control the logging level in the standard Python logging support. ...
['This', 'function', 'is', 'called', 'for', 'anything', 'that', 'needs', 'to', 'get', 'logged', '.', 'It', 'logs', 'to', 'the', 'logger', 'of', 'this', 'listener', '.']
train
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/_listener.py#L547-L559
1,294
Skype4Py/Skype4Py
Skype4Py/skype.py
Skype.PlaceCall
def PlaceCall(self, *Targets): """Places a call to a single user or creates a conference call. :Parameters: Targets : str One or more call targets. If multiple targets are specified, a conference call is created. The call target can be a Skypename, phone number, or spe...
python
def PlaceCall(self, *Targets): """Places a call to a single user or creates a conference call. :Parameters: Targets : str One or more call targets. If multiple targets are specified, a conference call is created. The call target can be a Skypename, phone number, or spe...
['def', 'PlaceCall', '(', 'self', ',', '*', 'Targets', ')', ':', 'calls', '=', 'self', '.', 'ActiveCalls', 'reply', '=', 'self', '.', '_DoCommand', '(', "'CALL %s'", '%', "', '", '.', 'join', '(', 'Targets', ')', ')', '# Skype for Windows returns the call status which gives us the call Id;', 'if', 'reply', '.', 'starts...
Places a call to a single user or creates a conference call. :Parameters: Targets : str One or more call targets. If multiple targets are specified, a conference call is created. The call target can be a Skypename, phone number, or speed dial code. :return: A call obj...
['Places', 'a', 'call', 'to', 'a', 'single', 'user', 'or', 'creates', 'a', 'conference', 'call', '.']
train
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/skype.py#L680-L701
1,295
marcomusy/vtkplotter
vtkplotter/actors.py
Prop.scale
def scale(self, s=None): """Set/get actor's scaling factor. :param s: scaling factor(s). :type s: float, list .. note:: if `s==(sx,sy,sz)` scale differently in the three coordinates.""" if s is None: return np.array(self.GetScale()) self.SetScale(s) ...
python
def scale(self, s=None): """Set/get actor's scaling factor. :param s: scaling factor(s). :type s: float, list .. note:: if `s==(sx,sy,sz)` scale differently in the three coordinates.""" if s is None: return np.array(self.GetScale()) self.SetScale(s) ...
['def', 'scale', '(', 'self', ',', 's', '=', 'None', ')', ':', 'if', 's', 'is', 'None', ':', 'return', 'np', '.', 'array', '(', 'self', '.', 'GetScale', '(', ')', ')', 'self', '.', 'SetScale', '(', 's', ')', 'return', 'self']
Set/get actor's scaling factor. :param s: scaling factor(s). :type s: float, list .. note:: if `s==(sx,sy,sz)` scale differently in the three coordinates.
['Set', '/', 'get', 'actor', 's', 'scaling', 'factor', '.']
train
https://github.com/marcomusy/vtkplotter/blob/692c3396782722ec525bc1346a26999868c650c6/vtkplotter/actors.py#L372-L382
1,296
binux/pyspider
pyspider/run.py
one
def one(ctx, interactive, enable_phantomjs, enable_puppeteer, scripts): """ One mode not only means all-in-one, it runs every thing in one process over tornado.ioloop, for debug purpose """ ctx.obj['debug'] = False g = ctx.obj g['testing_mode'] = True if scripts: from pyspider....
python
def one(ctx, interactive, enable_phantomjs, enable_puppeteer, scripts): """ One mode not only means all-in-one, it runs every thing in one process over tornado.ioloop, for debug purpose """ ctx.obj['debug'] = False g = ctx.obj g['testing_mode'] = True if scripts: from pyspider....
['def', 'one', '(', 'ctx', ',', 'interactive', ',', 'enable_phantomjs', ',', 'enable_puppeteer', ',', 'scripts', ')', ':', 'ctx', '.', 'obj', '[', "'debug'", ']', '=', 'False', 'g', '=', 'ctx', '.', 'obj', 'g', '[', "'testing_mode'", ']', '=', 'True', 'if', 'scripts', ':', 'from', 'pyspider', '.', 'database', '.', 'loc...
One mode not only means all-in-one, it runs every thing in one process over tornado.ioloop, for debug purpose
['One', 'mode', 'not', 'only', 'means', 'all', '-', 'in', '-', 'one', 'it', 'runs', 'every', 'thing', 'in', 'one', 'process', 'over', 'tornado', '.', 'ioloop', 'for', 'debug', 'purpose']
train
https://github.com/binux/pyspider/blob/3fccfabe2b057b7a56d4a4c79dc0dd6cd2239fe9/pyspider/run.py#L723-L793
1,297
inasafe/inasafe
safe/report/expressions/html_report.py
place_analysis_summary_report
def place_analysis_summary_report(feature, parent): """Retrieve an HTML place analysis table report from a multi exposure analysis. """ _ = feature, parent # NOQA analysis_dir = get_analysis_dir(exposure_place['key']) if analysis_dir: return get_impact_report_as_string(analysis_dir) ...
python
def place_analysis_summary_report(feature, parent): """Retrieve an HTML place analysis table report from a multi exposure analysis. """ _ = feature, parent # NOQA analysis_dir = get_analysis_dir(exposure_place['key']) if analysis_dir: return get_impact_report_as_string(analysis_dir) ...
['def', 'place_analysis_summary_report', '(', 'feature', ',', 'parent', ')', ':', '_', '=', 'feature', ',', 'parent', '# NOQA', 'analysis_dir', '=', 'get_analysis_dir', '(', 'exposure_place', '[', "'key'", ']', ')', 'if', 'analysis_dir', ':', 'return', 'get_impact_report_as_string', '(', 'analysis_dir', ')', 'return', ...
Retrieve an HTML place analysis table report from a multi exposure analysis.
['Retrieve', 'an', 'HTML', 'place', 'analysis', 'table', 'report', 'from', 'a', 'multi', 'exposure', 'analysis', '.']
train
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/html_report.py#L618-L626
1,298
koenedaele/pyramid_skosprovider
pyramid_skosprovider/renderers.py
_map_relations
def _map_relations(relations, p, language='any'): ''' :param: :class:`list` relations: Relations to be mapped. These are concept or collection id's. :param: :class:`skosprovider.providers.VocabularyProvider` p: Provider to look up id's. :param string language: Language to render the rela...
python
def _map_relations(relations, p, language='any'): ''' :param: :class:`list` relations: Relations to be mapped. These are concept or collection id's. :param: :class:`skosprovider.providers.VocabularyProvider` p: Provider to look up id's. :param string language: Language to render the rela...
['def', '_map_relations', '(', 'relations', ',', 'p', ',', 'language', '=', "'any'", ')', ':', 'ret', '=', '[', ']', 'for', 'r', 'in', 'relations', ':', 'c', '=', 'p', '.', 'get_by_id', '(', 'r', ')', 'if', 'c', ':', 'ret', '.', 'append', '(', '_map_relation', '(', 'c', ',', 'language', ')', ')', 'else', ':', 'log', '....
:param: :class:`list` relations: Relations to be mapped. These are concept or collection id's. :param: :class:`skosprovider.providers.VocabularyProvider` p: Provider to look up id's. :param string language: Language to render the relations' labels in :rtype: :class:`list`
[':', 'param', ':', ':', 'class', ':', 'list', 'relations', ':', 'Relations', 'to', 'be', 'mapped', '.', 'These', 'are', 'concept', 'or', 'collection', 'id', 's', '.', ':', 'param', ':', ':', 'class', ':', 'skosprovider', '.', 'providers', '.', 'VocabularyProvider', 'p', ':', 'Provider', 'to', 'look', 'up', 'id', 's', ...
train
https://github.com/koenedaele/pyramid_skosprovider/blob/3affdb53cac7ad01bf3656ecd4c4d7ad9b4948b6/pyramid_skosprovider/renderers.py#L81-L100
1,299
gboeing/osmnx
osmnx/core.py
truncate_graph_bbox
def truncate_graph_bbox(G, north, south, east, west, truncate_by_edge=False, retain_all=False): """ Remove every node in graph that falls outside a bounding box. Needed because overpass returns entire ways that also include nodes outside the bbox if the way (that is, a way with a single OSM ID) has a n...
python
def truncate_graph_bbox(G, north, south, east, west, truncate_by_edge=False, retain_all=False): """ Remove every node in graph that falls outside a bounding box. Needed because overpass returns entire ways that also include nodes outside the bbox if the way (that is, a way with a single OSM ID) has a n...
['def', 'truncate_graph_bbox', '(', 'G', ',', 'north', ',', 'south', ',', 'east', ',', 'west', ',', 'truncate_by_edge', '=', 'False', ',', 'retain_all', '=', 'False', ')', ':', 'start_time', '=', 'time', '.', 'time', '(', ')', 'G', '=', 'G', '.', 'copy', '(', ')', 'nodes_outside_bbox', '=', '[', ']', 'for', 'node', ','...
Remove every node in graph that falls outside a bounding box. Needed because overpass returns entire ways that also include nodes outside the bbox if the way (that is, a way with a single OSM ID) has a node inside the bbox at some point. Parameters ---------- G : networkx multidigraph nort...
['Remove', 'every', 'node', 'in', 'graph', 'that', 'falls', 'outside', 'a', 'bounding', 'box', '.']
train
https://github.com/gboeing/osmnx/blob/be59fd313bcb68af8fc79242c56194f1247e26e2/osmnx/core.py#L940-L1007