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
6,500
angr/angr
angr/state_plugins/fast_memory.py
SimFastMemory._translate_cond
def _translate_cond(self, c): #pylint:disable=no-self-use """ Checks whether this condition can be supported by FastMemory." """ if isinstance(c, claripy.ast.Base) and not c.singlevalued: raise SimFastMemoryError("size not supported") if c is None: return ...
python
def _translate_cond(self, c): #pylint:disable=no-self-use """ Checks whether this condition can be supported by FastMemory." """ if isinstance(c, claripy.ast.Base) and not c.singlevalued: raise SimFastMemoryError("size not supported") if c is None: return ...
['def', '_translate_cond', '(', 'self', ',', 'c', ')', ':', '#pylint:disable=no-self-use', 'if', 'isinstance', '(', 'c', ',', 'claripy', '.', 'ast', '.', 'Base', ')', 'and', 'not', 'c', '.', 'singlevalued', ':', 'raise', 'SimFastMemoryError', '(', '"size not supported"', ')', 'if', 'c', 'is', 'None', ':', 'return', 'Tr...
Checks whether this condition can be supported by FastMemory."
['Checks', 'whether', 'this', 'condition', 'can', 'be', 'supported', 'by', 'FastMemory', '.']
train
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/fast_memory.py#L76-L85
6,501
mdiener/grace
grace/py27/slimit/parser.py
Parser.p_iteration_statement_6
def p_iteration_statement_6(self, p): """ iteration_statement \ : FOR LPAREN VAR identifier initializer_noin IN expr RPAREN statement """ p[0] = ast.ForIn(item=ast.VarDecl(identifier=p[4], initializer=p[5]), iterable=p[7], statement=p[9])
python
def p_iteration_statement_6(self, p): """ iteration_statement \ : FOR LPAREN VAR identifier initializer_noin IN expr RPAREN statement """ p[0] = ast.ForIn(item=ast.VarDecl(identifier=p[4], initializer=p[5]), iterable=p[7], statement=p[9])
['def', 'p_iteration_statement_6', '(', 'self', ',', 'p', ')', ':', 'p', '[', '0', ']', '=', 'ast', '.', 'ForIn', '(', 'item', '=', 'ast', '.', 'VarDecl', '(', 'identifier', '=', 'p', '[', '4', ']', ',', 'initializer', '=', 'p', '[', '5', ']', ')', ',', 'iterable', '=', 'p', '[', '7', ']', ',', 'statement', '=', 'p', '...
iteration_statement \ : FOR LPAREN VAR identifier initializer_noin IN expr RPAREN statement
['iteration_statement', '\\', ':', 'FOR', 'LPAREN', 'VAR', 'identifier', 'initializer_noin', 'IN', 'expr', 'RPAREN', 'statement']
train
https://github.com/mdiener/grace/blob/2dab13a2cf636da5da989904c5885166fc94d36d/grace/py27/slimit/parser.py#L1017-L1023
6,502
yamcs/yamcs-python
yamcs-client/yamcs/archive/client.py
ArchiveClient.list_event_sources
def list_event_sources(self): """ Returns the existing event sources. :rtype: ~collections.Iterable[str] """ # Server does not do pagination on listings of this resource. # Return an iterator anyway for similarity with other API methods path = '/archive/{}/events...
python
def list_event_sources(self): """ Returns the existing event sources. :rtype: ~collections.Iterable[str] """ # Server does not do pagination on listings of this resource. # Return an iterator anyway for similarity with other API methods path = '/archive/{}/events...
['def', 'list_event_sources', '(', 'self', ')', ':', '# Server does not do pagination on listings of this resource.', '# Return an iterator anyway for similarity with other API methods', 'path', '=', "'/archive/{}/events/sources'", '.', 'format', '(', 'self', '.', '_instance', ')', 'response', '=', 'self', '.', '_clien...
Returns the existing event sources. :rtype: ~collections.Iterable[str]
['Returns', 'the', 'existing', 'event', 'sources', '.']
train
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/archive/client.py#L125-L138
6,503
zhmcclient/python-zhmcclient
zhmcclient_mock/_urihandler.py
UserRoleAddPermissionHandler.post
def post(method, hmc, uri, uri_parms, body, logon_required, wait_for_completion): """Operation: Add Permission to User Role.""" assert wait_for_completion is True # synchronous operation user_role_oid = uri_parms[0] user_role_uri = '/api/user-roles/' + user_role_oid ...
python
def post(method, hmc, uri, uri_parms, body, logon_required, wait_for_completion): """Operation: Add Permission to User Role.""" assert wait_for_completion is True # synchronous operation user_role_oid = uri_parms[0] user_role_uri = '/api/user-roles/' + user_role_oid ...
['def', 'post', '(', 'method', ',', 'hmc', ',', 'uri', ',', 'uri_parms', ',', 'body', ',', 'logon_required', ',', 'wait_for_completion', ')', ':', 'assert', 'wait_for_completion', 'is', 'True', '# synchronous operation', 'user_role_oid', '=', 'uri_parms', '[', '0', ']', 'user_role_uri', '=', "'/api/user-roles/'", '+', ...
Operation: Add Permission to User Role.
['Operation', ':', 'Add', 'Permission', 'to', 'User', 'Role', '.']
train
https://github.com/zhmcclient/python-zhmcclient/blob/9657563e5d9184c51d3c903442a58b9725fdf335/zhmcclient_mock/_urihandler.py#L717-L743
6,504
base4sistemas/satcfe
satcfe/entidades.py
Entidade.documento
def documento(self, *args, **kwargs): """Resulta no documento XML como string, que pode ou não incluir a declaração XML no início do documento. """ forcar_unicode = kwargs.pop('forcar_unicode', False) incluir_xml_decl = kwargs.pop('incluir_xml_decl', True) doc = ET.tostri...
python
def documento(self, *args, **kwargs): """Resulta no documento XML como string, que pode ou não incluir a declaração XML no início do documento. """ forcar_unicode = kwargs.pop('forcar_unicode', False) incluir_xml_decl = kwargs.pop('incluir_xml_decl', True) doc = ET.tostri...
['def', 'documento', '(', 'self', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'forcar_unicode', '=', 'kwargs', '.', 'pop', '(', "'forcar_unicode'", ',', 'False', ')', 'incluir_xml_decl', '=', 'kwargs', '.', 'pop', '(', "'incluir_xml_decl'", ',', 'True', ')', 'doc', '=', 'ET', '.', 'tostring', '(', 'self', '.',...
Resulta no documento XML como string, que pode ou não incluir a declaração XML no início do documento.
['Resulta', 'no', 'documento', 'XML', 'como', 'string', 'que', 'pode', 'ou', 'não', 'incluir', 'a', 'declaração', 'XML', 'no', 'início', 'do', 'documento', '.']
train
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/entidades.py#L308-L324
6,505
lextoumbourou/txstripe
txstripe/resource.py
APIResource.refresh
def refresh(self): """Return a deferred.""" d = self.request('get', self.instance_url()) return d.addCallback(self.refresh_from).addCallback(lambda _: self)
python
def refresh(self): """Return a deferred.""" d = self.request('get', self.instance_url()) return d.addCallback(self.refresh_from).addCallback(lambda _: self)
['def', 'refresh', '(', 'self', ')', ':', 'd', '=', 'self', '.', 'request', '(', "'get'", ',', 'self', '.', 'instance_url', '(', ')', ')', 'return', 'd', '.', 'addCallback', '(', 'self', '.', 'refresh_from', ')', '.', 'addCallback', '(', 'lambda', '_', ':', 'self', ')']
Return a deferred.
['Return', 'a', 'deferred', '.']
train
https://github.com/lextoumbourou/txstripe/blob/a69e67f524258026fd1840655a0578311bba3b89/txstripe/resource.py#L138-L141
6,506
bhmm/bhmm
bhmm/api.py
estimate_hmm
def estimate_hmm(observations, nstates, lag=1, initial_model=None, output=None, reversible=True, stationary=False, p=None, accuracy=1e-3, maxit=1000, maxit_P=100000, mincount_connectivity=1e-2): r""" Estimate maximum-likelihood HMM Generic maximum-likelihood estimation of HMMs...
python
def estimate_hmm(observations, nstates, lag=1, initial_model=None, output=None, reversible=True, stationary=False, p=None, accuracy=1e-3, maxit=1000, maxit_P=100000, mincount_connectivity=1e-2): r""" Estimate maximum-likelihood HMM Generic maximum-likelihood estimation of HMMs...
['def', 'estimate_hmm', '(', 'observations', ',', 'nstates', ',', 'lag', '=', '1', ',', 'initial_model', '=', 'None', ',', 'output', '=', 'None', ',', 'reversible', '=', 'True', ',', 'stationary', '=', 'False', ',', 'p', '=', 'None', ',', 'accuracy', '=', '1e-3', ',', 'maxit', '=', '1000', ',', 'maxit_P', '=', '100000'...
r""" Estimate maximum-likelihood HMM Generic maximum-likelihood estimation of HMMs Parameters ---------- observations : list of numpy arrays representing temporal data `observations[i]` is a 1d numpy array corresponding to the observed trajectory index `i` nstates : int The number ...
['r', 'Estimate', 'maximum', '-', 'likelihood', 'HMM']
train
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/api.py#L309-L372
6,507
nerdvegas/rez
src/rezgui/objects/Config.py
Config.prepend_string_list
def prepend_string_list(self, key, value, max_length_key): """Prepend a fixed-length string list with a new string. The oldest string will be removed from the list. If the string is already in the list, it is shuffled to the top. Use this to implement things like a 'most recent files' e...
python
def prepend_string_list(self, key, value, max_length_key): """Prepend a fixed-length string list with a new string. The oldest string will be removed from the list. If the string is already in the list, it is shuffled to the top. Use this to implement things like a 'most recent files' e...
['def', 'prepend_string_list', '(', 'self', ',', 'key', ',', 'value', ',', 'max_length_key', ')', ':', 'max_len', '=', 'self', '.', 'get', '(', 'max_length_key', ')', 'strings', '=', 'self', '.', 'get_string_list', '(', 'key', ')', 'strings', '=', '[', 'value', ']', '+', '[', 'x', 'for', 'x', 'in', 'strings', 'if', 'x'...
Prepend a fixed-length string list with a new string. The oldest string will be removed from the list. If the string is already in the list, it is shuffled to the top. Use this to implement things like a 'most recent files' entry.
['Prepend', 'a', 'fixed', '-', 'length', 'string', 'list', 'with', 'a', 'new', 'string', '.']
train
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/objects/Config.py#L49-L65
6,508
panzarino/mlbgame
mlbgame/stats.py
player_stats
def player_stats(game_id): """Return dictionary of individual stats of a game with matching id. The additional pitching/batting is mostly the same stats, except it contains some useful stats such as groundouts/flyouts per pitcher (go/ao). MLB decided to have two box score files, thus we return...
python
def player_stats(game_id): """Return dictionary of individual stats of a game with matching id. The additional pitching/batting is mostly the same stats, except it contains some useful stats such as groundouts/flyouts per pitcher (go/ao). MLB decided to have two box score files, thus we return...
['def', 'player_stats', '(', 'game_id', ')', ':', '# get data from data module', 'box_score', '=', 'mlbgame', '.', 'data', '.', 'get_box_score', '(', 'game_id', ')', 'box_score_tree', '=', 'etree', '.', 'parse', '(', 'box_score', ')', '.', 'getroot', '(', ')', '# get pitching and batting info', 'pitching', '=', 'box_sc...
Return dictionary of individual stats of a game with matching id. The additional pitching/batting is mostly the same stats, except it contains some useful stats such as groundouts/flyouts per pitcher (go/ao). MLB decided to have two box score files, thus we return the data from both.
['Return', 'dictionary', 'of', 'individual', 'stats', 'of', 'a', 'game', 'with', 'matching', 'id', '.']
train
https://github.com/panzarino/mlbgame/blob/0a2d10540de793fdc3b8476aa18f5cf3b53d0b54/mlbgame/stats.py#L62-L106
6,509
pysathq/pysat
pysat/solvers.py
Glucose3.delete
def delete(self): """ Destructor. """ if self.glucose: pysolvers.glucose3_del(self.glucose) self.glucose = None if self.prfile: self.prfile.close()
python
def delete(self): """ Destructor. """ if self.glucose: pysolvers.glucose3_del(self.glucose) self.glucose = None if self.prfile: self.prfile.close()
['def', 'delete', '(', 'self', ')', ':', 'if', 'self', '.', 'glucose', ':', 'pysolvers', '.', 'glucose3_del', '(', 'self', '.', 'glucose', ')', 'self', '.', 'glucose', '=', 'None', 'if', 'self', '.', 'prfile', ':', 'self', '.', 'prfile', '.', 'close', '(', ')']
Destructor.
['Destructor', '.']
train
https://github.com/pysathq/pysat/blob/522742e8f2d4c6ac50ecd9087f7a346206774c67/pysat/solvers.py#L987-L997
6,510
lago-project/lago
lago/utils.py
load_virt_stream
def load_virt_stream(virt_fd): """ Loads the given conf stream into a dict, trying different formats if needed Args: virt_fd (str): file like objcect with the virt config to load Returns: dict: Loaded virt config """ try: virt_conf = json.load(virt_fd) except Va...
python
def load_virt_stream(virt_fd): """ Loads the given conf stream into a dict, trying different formats if needed Args: virt_fd (str): file like objcect with the virt config to load Returns: dict: Loaded virt config """ try: virt_conf = json.load(virt_fd) except Va...
['def', 'load_virt_stream', '(', 'virt_fd', ')', ':', 'try', ':', 'virt_conf', '=', 'json', '.', 'load', '(', 'virt_fd', ')', 'except', 'ValueError', ':', 'virt_fd', '.', 'seek', '(', '0', ')', 'virt_conf', '=', 'yaml', '.', 'load', '(', 'virt_fd', ')', 'return', 'deepcopy', '(', 'virt_conf', ')']
Loads the given conf stream into a dict, trying different formats if needed Args: virt_fd (str): file like objcect with the virt config to load Returns: dict: Loaded virt config
['Loads', 'the', 'given', 'conf', 'stream', 'into', 'a', 'dict', 'trying', 'different', 'formats', 'if', 'needed']
train
https://github.com/lago-project/lago/blob/5b8970f7687e063e4619066d5b8093ca997678c9/lago/utils.py#L513-L530
6,511
PmagPy/PmagPy
pmagpy/pmag.py
s_l
def s_l(l, alpha): """ get sigma as a function of degree l from Constable and Parker (1988) """ a2 = alpha**2 c_a = 0.547 s_l = np.sqrt(old_div(((c_a**(2. * l)) * a2), ((l + 1.) * (2. * l + 1.)))) return s_l
python
def s_l(l, alpha): """ get sigma as a function of degree l from Constable and Parker (1988) """ a2 = alpha**2 c_a = 0.547 s_l = np.sqrt(old_div(((c_a**(2. * l)) * a2), ((l + 1.) * (2. * l + 1.)))) return s_l
['def', 's_l', '(', 'l', ',', 'alpha', ')', ':', 'a2', '=', 'alpha', '**', '2', 'c_a', '=', '0.547', 's_l', '=', 'np', '.', 'sqrt', '(', 'old_div', '(', '(', '(', 'c_a', '**', '(', '2.', '*', 'l', ')', ')', '*', 'a2', ')', ',', '(', '(', 'l', '+', '1.', ')', '*', '(', '2.', '*', 'l', '+', '1.', ')', ')', ')', ')', 'ret...
get sigma as a function of degree l from Constable and Parker (1988)
['get', 'sigma', 'as', 'a', 'function', 'of', 'degree', 'l', 'from', 'Constable', 'and', 'Parker', '(', '1988', ')']
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L9264-L9271
6,512
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/PharLapCommon.py
getPharLapPath
def getPharLapPath(): """Reads the registry to find the installed path of the Phar Lap ETS development kit. Raises UserError if no installed version of Phar Lap can be found.""" if not SCons.Util.can_read_reg: raise SCons.Errors.InternalError("No Windows registry module was found") try...
python
def getPharLapPath(): """Reads the registry to find the installed path of the Phar Lap ETS development kit. Raises UserError if no installed version of Phar Lap can be found.""" if not SCons.Util.can_read_reg: raise SCons.Errors.InternalError("No Windows registry module was found") try...
['def', 'getPharLapPath', '(', ')', ':', 'if', 'not', 'SCons', '.', 'Util', '.', 'can_read_reg', ':', 'raise', 'SCons', '.', 'Errors', '.', 'InternalError', '(', '"No Windows registry module was found"', ')', 'try', ':', 'k', '=', 'SCons', '.', 'Util', '.', 'RegOpenKeyEx', '(', 'SCons', '.', 'Util', '.', 'HKEY_LOCAL_MA...
Reads the registry to find the installed path of the Phar Lap ETS development kit. Raises UserError if no installed version of Phar Lap can be found.
['Reads', 'the', 'registry', 'to', 'find', 'the', 'installed', 'path', 'of', 'the', 'Phar', 'Lap', 'ETS', 'development', 'kit', '.']
train
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/PharLapCommon.py#L40-L64
6,513
wonambi-python/wonambi
wonambi/ioeeg/moberg.py
Moberg.return_dat
def return_dat(self, chan, begsam, endsam): """Return the data as 2D numpy.ndarray. Parameters ---------- chan : int or list index (indices) of the channels to read begsam : int index of the first sample endsam : int index of the last ...
python
def return_dat(self, chan, begsam, endsam): """Return the data as 2D numpy.ndarray. Parameters ---------- chan : int or list index (indices) of the channels to read begsam : int index of the first sample endsam : int index of the last ...
['def', 'return_dat', '(', 'self', ',', 'chan', ',', 'begsam', ',', 'endsam', ')', ':', 'if', 'begsam', '<', '0', ':', 'begpad', '=', '-', '1', '*', 'begsam', 'begsam', '=', '0', 'else', ':', 'begpad', '=', '0', 'if', 'endsam', '>', 'self', '.', 'n_smp', ':', 'endpad', '=', 'endsam', '-', 'self', '.', 'n_smp', 'endsam'...
Return the data as 2D numpy.ndarray. Parameters ---------- chan : int or list index (indices) of the channels to read begsam : int index of the first sample endsam : int index of the last sample Returns ------- numpy.n...
['Return', 'the', 'data', 'as', '2D', 'numpy', '.', 'ndarray', '.']
train
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/moberg.py#L99-L141
6,514
pandas-dev/pandas
pandas/core/resample.py
DatetimeIndexResampler._upsample
def _upsample(self, method, limit=None, fill_value=None): """ Parameters ---------- method : string {'backfill', 'bfill', 'pad', 'ffill', 'asfreq'} method for upsampling limit : int, default None Maximum size gap to fill when reindexing fill_value ...
python
def _upsample(self, method, limit=None, fill_value=None): """ Parameters ---------- method : string {'backfill', 'bfill', 'pad', 'ffill', 'asfreq'} method for upsampling limit : int, default None Maximum size gap to fill when reindexing fill_value ...
['def', '_upsample', '(', 'self', ',', 'method', ',', 'limit', '=', 'None', ',', 'fill_value', '=', 'None', ')', ':', 'self', '.', '_set_binner', '(', ')', 'if', 'self', '.', 'axis', ':', 'raise', 'AssertionError', '(', "'axis must be 0'", ')', 'if', 'self', '.', '_from_selection', ':', 'raise', 'ValueError', '(', '"Up...
Parameters ---------- method : string {'backfill', 'bfill', 'pad', 'ffill', 'asfreq'} method for upsampling limit : int, default None Maximum size gap to fill when reindexing fill_value : scalar, default None Value to use for missing values Se...
['Parameters', '----------', 'method', ':', 'string', '{', 'backfill', 'bfill', 'pad', 'ffill', 'asfreq', '}', 'method', 'for', 'upsampling', 'limit', ':', 'int', 'default', 'None', 'Maximum', 'size', 'gap', 'to', 'fill', 'when', 'reindexing', 'fill_value', ':', 'scalar', 'default', 'None', 'Value', 'to', 'use', 'for',...
train
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/resample.py#L1030-L1069
6,515
praekeltfoundation/molo
molo/core/api/importers.py
list_of_objects_from_api
def list_of_objects_from_api(url): ''' API only serves 20 pages by default This fetches info on all of items and return them as a list Assumption: limit of API is not less than 20 ''' response = requests.get(url) content = json.loads(response.content) count = content["meta"]["total_cou...
python
def list_of_objects_from_api(url): ''' API only serves 20 pages by default This fetches info on all of items and return them as a list Assumption: limit of API is not less than 20 ''' response = requests.get(url) content = json.loads(response.content) count = content["meta"]["total_cou...
['def', 'list_of_objects_from_api', '(', 'url', ')', ':', 'response', '=', 'requests', '.', 'get', '(', 'url', ')', 'content', '=', 'json', '.', 'loads', '(', 'response', '.', 'content', ')', 'count', '=', 'content', '[', '"meta"', ']', '[', '"total_count"', ']', 'if', 'count', '<=', '20', ':', 'return', 'content', '['...
API only serves 20 pages by default This fetches info on all of items and return them as a list Assumption: limit of API is not less than 20
['API', 'only', 'serves', '20', 'pages', 'by', 'default', 'This', 'fetches', 'info', 'on', 'all', 'of', 'items', 'and', 'return', 'them', 'as', 'a', 'list']
train
https://github.com/praekeltfoundation/molo/blob/57702fda4fab261d67591415f7d46bc98fa38525/molo/core/api/importers.py#L53-L76
6,516
digidotcom/python-devicecloud
devicecloud/monitor_tcp.py
TCPClientManager.stop
def stop(self): """Stops all session activity. Blocks until io and writer thread dies """ if self._io_thread is not None: self.log.info("Waiting for I/O thread to stop...") self.closed = True self._io_thread.join() if self._writer_thread is n...
python
def stop(self): """Stops all session activity. Blocks until io and writer thread dies """ if self._io_thread is not None: self.log.info("Waiting for I/O thread to stop...") self.closed = True self._io_thread.join() if self._writer_thread is n...
['def', 'stop', '(', 'self', ')', ':', 'if', 'self', '.', '_io_thread', 'is', 'not', 'None', ':', 'self', '.', 'log', '.', 'info', '(', '"Waiting for I/O thread to stop..."', ')', 'self', '.', 'closed', '=', 'True', 'self', '.', '_io_thread', '.', 'join', '(', ')', 'if', 'self', '.', '_writer_thread', 'is', 'not', 'Non...
Stops all session activity. Blocks until io and writer thread dies
['Stops', 'all', 'session', 'activity', '.']
train
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/monitor_tcp.py#L564-L579
6,517
mitsei/dlkit
dlkit/aws_adapter/repository/managers.py
RepositoryProxyManager.get_asset_admin_session_for_repository
def get_asset_admin_session_for_repository(self, repository_id=None, proxy=None): """Gets an asset administration session for the given repository. arg: repository_id (osid.id.Id): the ``Id`` of the repository arg: proxy (osid.proxy.Proxy): a proxy return: (osid.repository.AssetAd...
python
def get_asset_admin_session_for_repository(self, repository_id=None, proxy=None): """Gets an asset administration session for the given repository. arg: repository_id (osid.id.Id): the ``Id`` of the repository arg: proxy (osid.proxy.Proxy): a proxy return: (osid.repository.AssetAd...
['def', 'get_asset_admin_session_for_repository', '(', 'self', ',', 'repository_id', '=', 'None', ',', 'proxy', '=', 'None', ')', ':', 'asset_lookup_session', '=', 'self', '.', '_provider_manager', '.', 'get_asset_lookup_session_for_repository', '(', 'repository_id', ',', 'proxy', ')', 'return', 'AssetAdminSession', '(...
Gets an asset administration session for the given repository. arg: repository_id (osid.id.Id): the ``Id`` of the repository arg: proxy (osid.proxy.Proxy): a proxy return: (osid.repository.AssetAdminSession) - an ``AssetAdminSession`` raise: NotFound - ``repositor...
['Gets', 'an', 'asset', 'administration', 'session', 'for', 'the', 'given', 'repository', '.']
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/aws_adapter/repository/managers.py#L1865-L1889
6,518
radjkarl/imgProcessor
imgProcessor/camera/LensDistortion.py
LensDistortion.standardUncertainties
def standardUncertainties(self, sharpness=0.5): ''' sharpness -> image sharpness // std of Gaussian PSF [px] returns a list of standard uncertainties for the x and y component: (1x,2x), (1y, 2y), (intensity:None) 1. px-size-changes(due to deflection) 2. reprojecti...
python
def standardUncertainties(self, sharpness=0.5): ''' sharpness -> image sharpness // std of Gaussian PSF [px] returns a list of standard uncertainties for the x and y component: (1x,2x), (1y, 2y), (intensity:None) 1. px-size-changes(due to deflection) 2. reprojecti...
['def', 'standardUncertainties', '(', 'self', ',', 'sharpness', '=', '0.5', ')', ':', 'height', ',', 'width', '=', 'self', '.', 'coeffs', '[', "'shape'", ']', 'fx', ',', 'fy', '=', 'self', '.', 'getDeflection', '(', 'width', ',', 'height', ')', '# is RMSE of imgPoint-projectedPoints\r', 'r', '=', 'self', '.', 'coeffs',...
sharpness -> image sharpness // std of Gaussian PSF [px] returns a list of standard uncertainties for the x and y component: (1x,2x), (1y, 2y), (intensity:None) 1. px-size-changes(due to deflection) 2. reprojection error
['sharpness', '-', '>', 'image', 'sharpness', '//', 'std', 'of', 'Gaussian', 'PSF', '[', 'px', ']', 'returns', 'a', 'list', 'of', 'standard', 'uncertainties', 'for', 'the', 'x', 'and', 'y', 'component', ':', '(', '1x', '2x', ')', '(', '1y', '2y', ')', '(', 'intensity', ':', 'None', ')', '1', '.', 'px', '-', 'size', '-'...
train
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/LensDistortion.py#L404-L418
6,519
alpacahq/pylivetrader
pylivetrader/loader.py
translate
def translate(script): '''translate zipline script into pylivetrader script. ''' tree = ast.parse(script) ZiplineImportVisitor().visit(tree) return astor.to_source(tree)
python
def translate(script): '''translate zipline script into pylivetrader script. ''' tree = ast.parse(script) ZiplineImportVisitor().visit(tree) return astor.to_source(tree)
['def', 'translate', '(', 'script', ')', ':', 'tree', '=', 'ast', '.', 'parse', '(', 'script', ')', 'ZiplineImportVisitor', '(', ')', '.', 'visit', '(', 'tree', ')', 'return', 'astor', '.', 'to_source', '(', 'tree', ')']
translate zipline script into pylivetrader script.
['translate', 'zipline', 'script', 'into', 'pylivetrader', 'script', '.']
train
https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/loader.py#L72-L79
6,520
sorgerlab/indra
indra/preassembler/hierarchy_manager.py
HierarchyManager.load_from_rdf_file
def load_from_rdf_file(self, rdf_file): """Initialize given an RDF input file representing the hierarchy." Parameters ---------- rdf_file : str Path to an RDF file. """ self.graph = rdflib.Graph() self.graph.parse(os.path.abspath(rdf_file), format='nt...
python
def load_from_rdf_file(self, rdf_file): """Initialize given an RDF input file representing the hierarchy." Parameters ---------- rdf_file : str Path to an RDF file. """ self.graph = rdflib.Graph() self.graph.parse(os.path.abspath(rdf_file), format='nt...
['def', 'load_from_rdf_file', '(', 'self', ',', 'rdf_file', ')', ':', 'self', '.', 'graph', '=', 'rdflib', '.', 'Graph', '(', ')', 'self', '.', 'graph', '.', 'parse', '(', 'os', '.', 'path', '.', 'abspath', '(', 'rdf_file', ')', ',', 'format', '=', "'nt'", ')', 'self', '.', 'initialize', '(', ')']
Initialize given an RDF input file representing the hierarchy." Parameters ---------- rdf_file : str Path to an RDF file.
['Initialize', 'given', 'an', 'RDF', 'input', 'file', 'representing', 'the', 'hierarchy', '.']
train
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/hierarchy_manager.py#L62-L72
6,521
piotr-rusin/spam-lists
spam_lists/validation.py
is_valid_url
def is_valid_url(value): """Check if given value is a valid URL string. :param value: a value to test :returns: True if the value is valid """ match = URL_REGEX.match(value) host_str = urlparse(value).hostname return match and is_valid_host(host_str)
python
def is_valid_url(value): """Check if given value is a valid URL string. :param value: a value to test :returns: True if the value is valid """ match = URL_REGEX.match(value) host_str = urlparse(value).hostname return match and is_valid_host(host_str)
['def', 'is_valid_url', '(', 'value', ')', ':', 'match', '=', 'URL_REGEX', '.', 'match', '(', 'value', ')', 'host_str', '=', 'urlparse', '(', 'value', ')', '.', 'hostname', 'return', 'match', 'and', 'is_valid_host', '(', 'host_str', ')']
Check if given value is a valid URL string. :param value: a value to test :returns: True if the value is valid
['Check', 'if', 'given', 'value', 'is', 'a', 'valid', 'URL', 'string', '.']
train
https://github.com/piotr-rusin/spam-lists/blob/fd616e8761b28f3eaa503fee5e45f7748e8f88f2/spam_lists/validation.py#L33-L41
6,522
jreese/aiosqlite
aiosqlite/core.py
Connection.execute_insert
async def execute_insert( self, sql: str, parameters: Iterable[Any] = None ) -> Optional[sqlite3.Row]: """Helper to insert and get the last_insert_rowid.""" if parameters is None: parameters = [] return await self._execute(self._execute_insert, sql, parameters)
python
async def execute_insert( self, sql: str, parameters: Iterable[Any] = None ) -> Optional[sqlite3.Row]: """Helper to insert and get the last_insert_rowid.""" if parameters is None: parameters = [] return await self._execute(self._execute_insert, sql, parameters)
['async', 'def', 'execute_insert', '(', 'self', ',', 'sql', ':', 'str', ',', 'parameters', ':', 'Iterable', '[', 'Any', ']', '=', 'None', ')', '->', 'Optional', '[', 'sqlite3', '.', 'Row', ']', ':', 'if', 'parameters', 'is', 'None', ':', 'parameters', '=', '[', ']', 'return', 'await', 'self', '.', '_execute', '(', 'sel...
Helper to insert and get the last_insert_rowid.
['Helper', 'to', 'insert', 'and', 'get', 'the', 'last_insert_rowid', '.']
train
https://github.com/jreese/aiosqlite/blob/3f548b568b8db9a57022b6e2c9627f5cdefb983f/aiosqlite/core.py#L213-L219
6,523
dchaplinsky/LT2OpenCorpora
lt2opencorpora/convert.py
TagSet._get_group_no
def _get_group_no(self, tag_name): """ Takes tag name and returns the number of the group to which tag belongs """ if tag_name in self.full: return self.groups.index(self.full[tag_name]["parent"]) else: return len(self.groups)
python
def _get_group_no(self, tag_name): """ Takes tag name and returns the number of the group to which tag belongs """ if tag_name in self.full: return self.groups.index(self.full[tag_name]["parent"]) else: return len(self.groups)
['def', '_get_group_no', '(', 'self', ',', 'tag_name', ')', ':', 'if', 'tag_name', 'in', 'self', '.', 'full', ':', 'return', 'self', '.', 'groups', '.', 'index', '(', 'self', '.', 'full', '[', 'tag_name', ']', '[', '"parent"', ']', ')', 'else', ':', 'return', 'len', '(', 'self', '.', 'groups', ')']
Takes tag name and returns the number of the group to which tag belongs
['Takes', 'tag', 'name', 'and', 'returns', 'the', 'number', 'of', 'the', 'group', 'to', 'which', 'tag', 'belongs']
train
https://github.com/dchaplinsky/LT2OpenCorpora/blob/7bf48098ec2db4c8955a660fd0c1b80a16e43054/lt2opencorpora/convert.py#L90-L98
6,524
abseil/abseil-py
absl/flags/_argument_parser.py
BaseListParser.parse
def parse(self, argument): """See base class.""" if isinstance(argument, list): return argument elif not argument: return [] else: return [s.strip() for s in argument.split(self._token)]
python
def parse(self, argument): """See base class.""" if isinstance(argument, list): return argument elif not argument: return [] else: return [s.strip() for s in argument.split(self._token)]
['def', 'parse', '(', 'self', ',', 'argument', ')', ':', 'if', 'isinstance', '(', 'argument', ',', 'list', ')', ':', 'return', 'argument', 'elif', 'not', 'argument', ':', 'return', '[', ']', 'else', ':', 'return', '[', 's', '.', 'strip', '(', ')', 'for', 's', 'in', 'argument', '.', 'split', '(', 'self', '.', '_token', ...
See base class.
['See', 'base', 'class', '.']
train
https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_argument_parser.py#L474-L481
6,525
senaite/senaite.jsonapi
src/senaite/jsonapi/api.py
deactivate_object
def deactivate_object(brain_or_object): """Deactivate the given object :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :returns: Nothing :rtype: None """ obj = get_object(brain_or_object) # we do not...
python
def deactivate_object(brain_or_object): """Deactivate the given object :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :returns: Nothing :rtype: None """ obj = get_object(brain_or_object) # we do not...
['def', 'deactivate_object', '(', 'brain_or_object', ')', ':', 'obj', '=', 'get_object', '(', 'brain_or_object', ')', '# we do not want to delete the site root!', 'if', 'is_root', '(', 'obj', ')', ':', 'fail', '(', '401', ',', '"Deactivating the Portal is not allowed"', ')', 'try', ':', 'do_transition_for', '(', 'brain...
Deactivate the given object :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :returns: Nothing :rtype: None
['Deactivate', 'the', 'given', 'object']
train
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/api.py#L1466-L1481
6,526
dwavesystems/dimod
dimod/binary_quadratic_model.py
BinaryQuadraticModel.energies
def energies(self, samples_like, dtype=np.float): """Determine the energies of the given samples. Args: samples_like (samples_like): A collection of raw samples. `samples_like` is an extension of NumPy's array_like structure. See :func:`.as_samples`. ...
python
def energies(self, samples_like, dtype=np.float): """Determine the energies of the given samples. Args: samples_like (samples_like): A collection of raw samples. `samples_like` is an extension of NumPy's array_like structure. See :func:`.as_samples`. ...
['def', 'energies', '(', 'self', ',', 'samples_like', ',', 'dtype', '=', 'np', '.', 'float', ')', ':', 'samples', ',', 'labels', '=', 'as_samples', '(', 'samples_like', ')', 'if', 'all', '(', 'v', '==', 'idx', 'for', 'idx', ',', 'v', 'in', 'enumerate', '(', 'labels', ')', ')', ':', 'ldata', ',', '(', 'irow', ',', 'icol...
Determine the energies of the given samples. Args: samples_like (samples_like): A collection of raw samples. `samples_like` is an extension of NumPy's array_like structure. See :func:`.as_samples`. dtype (:class:`numpy.dtype`): The data t...
['Determine', 'the', 'energies', 'of', 'the', 'given', 'samples', '.']
train
https://github.com/dwavesystems/dimod/blob/beff1b7f86b559d923ac653c1de6d593876d6d38/dimod/binary_quadratic_model.py#L1497-L1520
6,527
rongcloud/server-sdk-python
rongcloud/sms.py
SMS.sendCode
def sendCode(self, mobile, templateId, region, verifyId=None, verifyCode=None): """ 发送短信验证码方法。 方法 @param mobile:接收短信验证码的目标手机号,每分钟同一手机号只能发送一次短信验证码,同一手机号 1 小时内最多发送 3 次。(必传) @param templateId:短信模板 Id,在开发者...
python
def sendCode(self, mobile, templateId, region, verifyId=None, verifyCode=None): """ 发送短信验证码方法。 方法 @param mobile:接收短信验证码的目标手机号,每分钟同一手机号只能发送一次短信验证码,同一手机号 1 小时内最多发送 3 次。(必传) @param templateId:短信模板 Id,在开发者...
['def', 'sendCode', '(', 'self', ',', 'mobile', ',', 'templateId', ',', 'region', ',', 'verifyId', '=', 'None', ',', 'verifyCode', '=', 'None', ')', ':', 'desc', '=', '{', '"name"', ':', '"SMSSendCodeReslut"', ',', '"desc"', ':', '" SMSSendCodeReslut 成功返回结果",', '', '"fields"', ':', '[', '{', '"name"', ':', '"code"', ',...
发送短信验证码方法。 方法 @param mobile:接收短信验证码的目标手机号,每分钟同一手机号只能发送一次短信验证码,同一手机号 1 小时内最多发送 3 次。(必传) @param templateId:短信模板 Id,在开发者后台->短信服务->服务设置->短信模版中获取。(必传) @param region:手机号码所属国家区号,目前只支持中图区号 86) @param verifyId:图片验证标识 Id ,开启图片验证功能后此参数必传,否则可以不传。在获取图片验证码方法返回值中获取。 @param verifyCode:图片验证码...
['发送短信验证码方法。', '方法']
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/sms.py#L47-L93
6,528
zhmcclient/python-zhmcclient
zhmcclient/_manager.py
_NameUriCache.get
def get(self, name): """ Get the resource URI for a specified resource name. If an entry for the specified resource name does not exist in the Name-URI cache, the cache is refreshed from the HMC with all resources of the manager holding this cache. If an entry for the s...
python
def get(self, name): """ Get the resource URI for a specified resource name. If an entry for the specified resource name does not exist in the Name-URI cache, the cache is refreshed from the HMC with all resources of the manager holding this cache. If an entry for the s...
['def', 'get', '(', 'self', ',', 'name', ')', ':', 'self', '.', 'auto_invalidate', '(', ')', 'try', ':', 'return', 'self', '.', '_uris', '[', 'name', ']', 'except', 'KeyError', ':', 'self', '.', 'refresh', '(', ')', 'try', ':', 'return', 'self', '.', '_uris', '[', 'name', ']', 'except', 'KeyError', ':', 'raise', 'NotFo...
Get the resource URI for a specified resource name. If an entry for the specified resource name does not exist in the Name-URI cache, the cache is refreshed from the HMC with all resources of the manager holding this cache. If an entry for the specified resource name still does not exi...
['Get', 'the', 'resource', 'URI', 'for', 'a', 'specified', 'resource', 'name', '.']
train
https://github.com/zhmcclient/python-zhmcclient/blob/9657563e5d9184c51d3c903442a58b9725fdf335/zhmcclient/_manager.py#L75-L94
6,529
consbio/ncdjango
ncdjango/interfaces/arcgis/views.py
GetImageView.get_render_configurations
def get_render_configurations(self, request, **kwargs): """Render image interface""" data = self.process_form_data(self._get_form_defaults(), kwargs) variable_set = self.get_variable_set(self.service.variable_set.order_by('index'), data) base_config = ImageConfiguration( ex...
python
def get_render_configurations(self, request, **kwargs): """Render image interface""" data = self.process_form_data(self._get_form_defaults(), kwargs) variable_set = self.get_variable_set(self.service.variable_set.order_by('index'), data) base_config = ImageConfiguration( ex...
['def', 'get_render_configurations', '(', 'self', ',', 'request', ',', '*', '*', 'kwargs', ')', ':', 'data', '=', 'self', '.', 'process_form_data', '(', 'self', '.', '_get_form_defaults', '(', ')', ',', 'kwargs', ')', 'variable_set', '=', 'self', '.', 'get_variable_set', '(', 'self', '.', 'service', '.', 'variable_set'...
Render image interface
['Render', 'image', 'interface']
train
https://github.com/consbio/ncdjango/blob/f807bfd1e4083ab29fbc3c4d4418be108383a710/ncdjango/interfaces/arcgis/views.py#L284-L297
6,530
cltk/cltk
cltk/phonology/utils.py
Consonant.is_equal
def is_equal(self, other_consonnant): """ >>> v_consonant = Consonant(Place.labio_dental, Manner.fricative, True, "v", False) >>> f_consonant = Consonant(Place.labio_dental, Manner.fricative, False, "f", False) >>> v_consonant.is_equal(f_consonant) False :param other_con...
python
def is_equal(self, other_consonnant): """ >>> v_consonant = Consonant(Place.labio_dental, Manner.fricative, True, "v", False) >>> f_consonant = Consonant(Place.labio_dental, Manner.fricative, False, "f", False) >>> v_consonant.is_equal(f_consonant) False :param other_con...
['def', 'is_equal', '(', 'self', ',', 'other_consonnant', ')', ':', 'return', 'self', '.', 'place', '==', 'other_consonnant', '.', 'place', 'and', 'self', '.', 'manner', '==', 'other_consonnant', '.', 'manner', 'and', 'self', '.', 'voiced', '==', 'other_consonnant', '.', 'voiced', 'and', 'self', '.', 'geminate', '==', ...
>>> v_consonant = Consonant(Place.labio_dental, Manner.fricative, True, "v", False) >>> f_consonant = Consonant(Place.labio_dental, Manner.fricative, False, "f", False) >>> v_consonant.is_equal(f_consonant) False :param other_consonnant: :return:
['>>>', 'v_consonant', '=', 'Consonant', '(', 'Place', '.', 'labio_dental', 'Manner', '.', 'fricative', 'True', 'v', 'False', ')', '>>>', 'f_consonant', '=', 'Consonant', '(', 'Place', '.', 'labio_dental', 'Manner', '.', 'fricative', 'False', 'f', 'False', ')', '>>>', 'v_consonant', '.', 'is_equal', '(', 'f_consonant',...
train
https://github.com/cltk/cltk/blob/ed9c025b7ec43c949481173251b70e05e4dffd27/cltk/phonology/utils.py#L148-L159
6,531
wmayner/pyphi
pyphi/macro.py
MacroSubsystem.potential_purviews
def potential_purviews(self, direction, mechanism, purviews=False): """Override Subsystem implementation using Network-level indices.""" all_purviews = utils.powerset(self.node_indices) return irreducible_purviews( self.cm, direction, mechanism, all_purviews)
python
def potential_purviews(self, direction, mechanism, purviews=False): """Override Subsystem implementation using Network-level indices.""" all_purviews = utils.powerset(self.node_indices) return irreducible_purviews( self.cm, direction, mechanism, all_purviews)
['def', 'potential_purviews', '(', 'self', ',', 'direction', ',', 'mechanism', ',', 'purviews', '=', 'False', ')', ':', 'all_purviews', '=', 'utils', '.', 'powerset', '(', 'self', '.', 'node_indices', ')', 'return', 'irreducible_purviews', '(', 'self', '.', 'cm', ',', 'direction', ',', 'mechanism', ',', 'all_purviews',...
Override Subsystem implementation using Network-level indices.
['Override', 'Subsystem', 'implementation', 'using', 'Network', '-', 'level', 'indices', '.']
train
https://github.com/wmayner/pyphi/blob/deeca69a084d782a6fde7bf26f59e93b593c5d77/pyphi/macro.py#L354-L358
6,532
AtomHash/evernode
evernode/classes/paginate.py
Paginate.json_paginate
def json_paginate(self, base_url, page_number): """ Return a dict for a JSON paginate """ data = self.page(page_number) first_id = None last_id = None if data: first_id = data[0].id last_id = data[-1].id return { 'meta': { ...
python
def json_paginate(self, base_url, page_number): """ Return a dict for a JSON paginate """ data = self.page(page_number) first_id = None last_id = None if data: first_id = data[0].id last_id = data[-1].id return { 'meta': { ...
['def', 'json_paginate', '(', 'self', ',', 'base_url', ',', 'page_number', ')', ':', 'data', '=', 'self', '.', 'page', '(', 'page_number', ')', 'first_id', '=', 'None', 'last_id', '=', 'None', 'if', 'data', ':', 'first_id', '=', 'data', '[', '0', ']', '.', 'id', 'last_id', '=', 'data', '[', '-', '1', ']', '.', 'id', 'r...
Return a dict for a JSON paginate
['Return', 'a', 'dict', 'for', 'a', 'JSON', 'paginate']
train
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/classes/paginate.py#L105-L122
6,533
jsvine/spectra
spectra/core.py
Color.to
def to(self, space): """ Convert color to a different color space. :param str space: Name of the color space. :rtype: Color :returns: A new spectra.Color in the given color space. """ if space == self.space: return self new_color = convert_color(self.col...
python
def to(self, space): """ Convert color to a different color space. :param str space: Name of the color space. :rtype: Color :returns: A new spectra.Color in the given color space. """ if space == self.space: return self new_color = convert_color(self.col...
['def', 'to', '(', 'self', ',', 'space', ')', ':', 'if', 'space', '==', 'self', '.', 'space', ':', 'return', 'self', 'new_color', '=', 'convert_color', '(', 'self', '.', 'color_object', ',', 'COLOR_SPACES', '[', 'space', ']', ')', 'return', 'self', '.', '__class__', '(', 'space', ',', '*', 'new_color', '.', 'get_value_...
Convert color to a different color space. :param str space: Name of the color space. :rtype: Color :returns: A new spectra.Color in the given color space.
['Convert', 'color', 'to', 'a', 'different', 'color', 'space', '.']
train
https://github.com/jsvine/spectra/blob/2269a0ae9b5923154b15bd661fb81179608f7ec2/spectra/core.py#L45-L56
6,534
Sanji-IO/sanji
sanji/model/__init__.py
Model.update
def update(self, id, newObj): """Update a object Args: id (int): Target Object ID newObj (object): New object will be merged into original object Returns: Object: Updated object None: If specified object id is not found ...
python
def update(self, id, newObj): """Update a object Args: id (int): Target Object ID newObj (object): New object will be merged into original object Returns: Object: Updated object None: If specified object id is not found ...
['def', 'update', '(', 'self', ',', 'id', ',', 'newObj', ')', ':', 'newObj', '=', 'self', '.', 'validation', '(', 'newObj', ')', 'for', 'obj', 'in', 'self', '.', 'model', '.', 'db', ':', 'if', 'obj', '[', '"id"', ']', '!=', 'id', ':', 'continue', 'newObj', '.', 'pop', '(', '"id"', ',', 'None', ')', 'obj', '.', 'update'...
Update a object Args: id (int): Target Object ID newObj (object): New object will be merged into original object Returns: Object: Updated object None: If specified object id is not found MultipleInvalid: If input obj...
['Update', 'a', 'object', 'Args', ':', 'id', '(', 'int', ')', ':', 'Target', 'Object', 'ID', 'newObj', '(', 'object', ')', ':', 'New', 'object', 'will', 'be', 'merged', 'into', 'original', 'object', 'Returns', ':', 'Object', ':', 'Updated', 'object', 'None', ':', 'If', 'specified', 'object', 'id', 'is', 'not', 'found',...
train
https://github.com/Sanji-IO/sanji/blob/5c54cc2772bdfeae3337f785de1957237b828b34/sanji/model/__init__.py#L129-L151
6,535
hollenstein/maspy
maspy/proteindb.py
ProteinDatabase._calculateCoverageMasks
def _calculateCoverageMasks(proteindb, peptidedb): """Calcualte the sequence coverage masks for all proteindb elements. Private method used by :class:`ProteinDatabase`. A coverage mask is a numpy boolean array with the length of the protein sequence. Each protein position that has been ...
python
def _calculateCoverageMasks(proteindb, peptidedb): """Calcualte the sequence coverage masks for all proteindb elements. Private method used by :class:`ProteinDatabase`. A coverage mask is a numpy boolean array with the length of the protein sequence. Each protein position that has been ...
['def', '_calculateCoverageMasks', '(', 'proteindb', ',', 'peptidedb', ')', ':', 'for', 'proteinId', ',', 'proteinEntry', 'in', 'viewitems', '(', 'proteindb', ')', ':', 'coverageMaskUnique', '=', 'numpy', '.', 'zeros', '(', 'proteinEntry', '.', 'length', '(', ')', ',', 'dtype', '=', "'bool'", ')', 'for', 'peptide', 'in...
Calcualte the sequence coverage masks for all proteindb elements. Private method used by :class:`ProteinDatabase`. A coverage mask is a numpy boolean array with the length of the protein sequence. Each protein position that has been covered in at least one peptide is set to True. Covera...
['Calcualte', 'the', 'sequence', 'coverage', 'masks', 'for', 'all', 'proteindb', 'elements', '.', 'Private', 'method', 'used', 'by', ':', 'class', ':', 'ProteinDatabase', '.']
train
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/proteindb.py#L334-L367
6,536
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_threshold_monitor.py
brocade_threshold_monitor.threshold_monitor_hidden_threshold_monitor_Memory_retry
def threshold_monitor_hidden_threshold_monitor_Memory_retry(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") threshold_monitor_hidden = ET.SubElement(config, "threshold-monitor-hidden", xmlns="urn:brocade.com:mgmt:brocade-threshold-monitor") threshold_mon...
python
def threshold_monitor_hidden_threshold_monitor_Memory_retry(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") threshold_monitor_hidden = ET.SubElement(config, "threshold-monitor-hidden", xmlns="urn:brocade.com:mgmt:brocade-threshold-monitor") threshold_mon...
['def', 'threshold_monitor_hidden_threshold_monitor_Memory_retry', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'config', '=', 'ET', '.', 'Element', '(', '"config"', ')', 'threshold_monitor_hidden', '=', 'ET', '.', 'SubElement', '(', 'config', ',', '"threshold-monitor-hidden"', ',', 'xmlns', '=', '"urn:brocade.com:m...
Auto Generated Code
['Auto', 'Generated', 'Code']
train
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_threshold_monitor.py#L487-L498
6,537
onnx/onnxmltools
onnxutils/onnxconverter_common/optimizer.py
Solution.delete_node_1ton
def delete_node_1ton(node_list, begin, node, end): # type: ([],LinkedNode, LinkedNode, LinkedNode)->[] """ delete the node which has 1-input and n-output """ if end is None: assert end is not None end = node.successor elif not isinstance(end, list): ...
python
def delete_node_1ton(node_list, begin, node, end): # type: ([],LinkedNode, LinkedNode, LinkedNode)->[] """ delete the node which has 1-input and n-output """ if end is None: assert end is not None end = node.successor elif not isinstance(end, list): ...
['def', 'delete_node_1ton', '(', 'node_list', ',', 'begin', ',', 'node', ',', 'end', ')', ':', '# type: ([],LinkedNode, LinkedNode, LinkedNode)->[]', 'if', 'end', 'is', 'None', ':', 'assert', 'end', 'is', 'not', 'None', 'end', '=', 'node', '.', 'successor', 'elif', 'not', 'isinstance', '(', 'end', ',', 'list', ')', ':'...
delete the node which has 1-input and n-output
['delete', 'the', 'node', 'which', 'has', '1', '-', 'input', 'and', 'n', '-', 'output']
train
https://github.com/onnx/onnxmltools/blob/d4e4c31990fc2d9fd1f92139f497d360914c9df2/onnxutils/onnxconverter_common/optimizer.py#L290-L315
6,538
yangl1996/libpagure
libpagure/libpagure.py
Pagure.create_basic_url
def create_basic_url(self): """ Create URL prefix for API calls based on type of repo. Repo may be forked and may be in namespace. That makes total 4 different types of URL. :return: """ if self.username is None: if self.namespace is None: re...
python
def create_basic_url(self): """ Create URL prefix for API calls based on type of repo. Repo may be forked and may be in namespace. That makes total 4 different types of URL. :return: """ if self.username is None: if self.namespace is None: re...
['def', 'create_basic_url', '(', 'self', ')', ':', 'if', 'self', '.', 'username', 'is', 'None', ':', 'if', 'self', '.', 'namespace', 'is', 'None', ':', 'request_url', '=', '"{}/api/0/{}/"', '.', 'format', '(', 'self', '.', 'instance', ',', 'self', '.', 'repo', ')', 'else', ':', 'request_url', '=', '"{}/api/0/{}/{}/"', ...
Create URL prefix for API calls based on type of repo. Repo may be forked and may be in namespace. That makes total 4 different types of URL. :return:
['Create', 'URL', 'prefix', 'for', 'API', 'calls', 'based', 'on', 'type', 'of', 'repo', '.']
train
https://github.com/yangl1996/libpagure/blob/dd96ed29142407463790c66ed321984a6ea7465a/libpagure/libpagure.py#L92-L114
6,539
NoviceLive/intellicoder
intellicoder/sources.py
make_c_header
def make_c_header(name, front, body): """ Build a C header from the front and body. """ return """ {0} # ifndef _GU_ZHENGXIONG_{1}_H # define _GU_ZHENGXIONG_{1}_H {2} # endif /* {3}.h */ """.strip().format(front, name.upper(), body, name) + '\n'
python
def make_c_header(name, front, body): """ Build a C header from the front and body. """ return """ {0} # ifndef _GU_ZHENGXIONG_{1}_H # define _GU_ZHENGXIONG_{1}_H {2} # endif /* {3}.h */ """.strip().format(front, name.upper(), body, name) + '\n'
['def', 'make_c_header', '(', 'name', ',', 'front', ',', 'body', ')', ':', 'return', '"""\n{0}\n\n\n# ifndef _GU_ZHENGXIONG_{1}_H\n# define _GU_ZHENGXIONG_{1}_H\n\n\n{2}\n\n\n# endif /* {3}.h */\n """', '.', 'strip', '(', ')', '.', 'format', '(', 'front', ',', 'name', '.', 'upper', '(', ')', ',', 'body', ',', 'name'...
Build a C header from the front and body.
['Build', 'a', 'C', 'header', 'from', 'the', 'front', 'and', 'body', '.']
train
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/sources.py#L77-L93
6,540
bitesofcode/projexui
projexui/widgets/xviewwidget/xviewpanel.py
XViewPanelBar.setTabText
def setTabText(self, index, text): """ Returns the text for the tab at the inputed index. :param index | <int> :return <str> """ try: self.items()[index].setText(text) except IndexError: pass
python
def setTabText(self, index, text): """ Returns the text for the tab at the inputed index. :param index | <int> :return <str> """ try: self.items()[index].setText(text) except IndexError: pass
['def', 'setTabText', '(', 'self', ',', 'index', ',', 'text', ')', ':', 'try', ':', 'self', '.', 'items', '(', ')', '[', 'index', ']', '.', 'setText', '(', 'text', ')', 'except', 'IndexError', ':', 'pass']
Returns the text for the tab at the inputed index. :param index | <int> :return <str>
['Returns', 'the', 'text', 'for', 'the', 'tab', 'at', 'the', 'inputed', 'index', '.']
train
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewpanel.py#L626-L637
6,541
urbn/Caesium
caesium/document.py
AsyncRevisionStackManager.__get_pending_revisions
def __get_pending_revisions(self): """ Get all the pending revisions after the current time :return: A list of revisions :rtype: list """ dttime = time.mktime(datetime.datetime.now().timetuple()) changes = yield self.revisions.find({ "toa" : { ...
python
def __get_pending_revisions(self): """ Get all the pending revisions after the current time :return: A list of revisions :rtype: list """ dttime = time.mktime(datetime.datetime.now().timetuple()) changes = yield self.revisions.find({ "toa" : { ...
['def', '__get_pending_revisions', '(', 'self', ')', ':', 'dttime', '=', 'time', '.', 'mktime', '(', 'datetime', '.', 'datetime', '.', 'now', '(', ')', '.', 'timetuple', '(', ')', ')', 'changes', '=', 'yield', 'self', '.', 'revisions', '.', 'find', '(', '{', '"toa"', ':', '{', '"$lt"', ':', 'dttime', ',', '}', ',', '"p...
Get all the pending revisions after the current time :return: A list of revisions :rtype: list
['Get', 'all', 'the', 'pending', 'revisions', 'after', 'the', 'current', 'time']
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L67-L86
6,542
itamarst/eliot
eliot/_action.py
WrittenAction.status
def status(self): """ One of C{STARTED_STATUS}, C{SUCCEEDED_STATUS}, C{FAILED_STATUS} or C{None}. """ message = self.end_message if self.end_message else self.start_message if message: return message.contents[ACTION_STATUS_FIELD] else: retu...
python
def status(self): """ One of C{STARTED_STATUS}, C{SUCCEEDED_STATUS}, C{FAILED_STATUS} or C{None}. """ message = self.end_message if self.end_message else self.start_message if message: return message.contents[ACTION_STATUS_FIELD] else: retu...
['def', 'status', '(', 'self', ')', ':', 'message', '=', 'self', '.', 'end_message', 'if', 'self', '.', 'end_message', 'else', 'self', '.', 'start_message', 'if', 'message', ':', 'return', 'message', '.', 'contents', '[', 'ACTION_STATUS_FIELD', ']', 'else', ':', 'return', 'None']
One of C{STARTED_STATUS}, C{SUCCEEDED_STATUS}, C{FAILED_STATUS} or C{None}.
['One', 'of', 'C', '{', 'STARTED_STATUS', '}', 'C', '{', 'SUCCEEDED_STATUS', '}', 'C', '{', 'FAILED_STATUS', '}', 'or', 'C', '{', 'None', '}', '.']
train
https://github.com/itamarst/eliot/blob/c03c96520c5492fadfc438b4b0f6336e2785ba2d/eliot/_action.py#L594-L603
6,543
akaszynski/pymeshfix
pymeshfix/examples/fix.py
with_vtk
def with_vtk(plot=True): """ Tests VTK interface and mesh repair of Stanford Bunny Mesh """ mesh = vtki.PolyData(bunny_scan) meshfix = pymeshfix.MeshFix(mesh) if plot: print('Plotting input mesh') meshfix.plot() meshfix.repair() if plot: print('Plotting repaired mesh') ...
python
def with_vtk(plot=True): """ Tests VTK interface and mesh repair of Stanford Bunny Mesh """ mesh = vtki.PolyData(bunny_scan) meshfix = pymeshfix.MeshFix(mesh) if plot: print('Plotting input mesh') meshfix.plot() meshfix.repair() if plot: print('Plotting repaired mesh') ...
['def', 'with_vtk', '(', 'plot', '=', 'True', ')', ':', 'mesh', '=', 'vtki', '.', 'PolyData', '(', 'bunny_scan', ')', 'meshfix', '=', 'pymeshfix', '.', 'MeshFix', '(', 'mesh', ')', 'if', 'plot', ':', 'print', '(', "'Plotting input mesh'", ')', 'meshfix', '.', 'plot', '(', ')', 'meshfix', '.', 'repair', '(', ')', 'if', ...
Tests VTK interface and mesh repair of Stanford Bunny Mesh
['Tests', 'VTK', 'interface', 'and', 'mesh', 'repair', 'of', 'Stanford', 'Bunny', 'Mesh']
train
https://github.com/akaszynski/pymeshfix/blob/51873b25d8d46168479989a528db8456af6748f4/pymeshfix/examples/fix.py#L15-L27
6,544
fhs/pyhdf
pyhdf/SD.py
SDS.setrange
def setrange(self, min, max): """Set the dataset min and max values. Args:: min dataset minimum value (attribute 'valid_range') max dataset maximum value (attribute 'valid_range') Returns:: None The data range is part of the so-called "st...
python
def setrange(self, min, max): """Set the dataset min and max values. Args:: min dataset minimum value (attribute 'valid_range') max dataset maximum value (attribute 'valid_range') Returns:: None The data range is part of the so-called "st...
['def', 'setrange', '(', 'self', ',', 'min', ',', 'max', ')', ':', '# Obtain SDS data type.', 'try', ':', 'sds_name', ',', 'rank', ',', 'dim_sizes', ',', 'data_type', ',', 'n_attrs', '=', 'self', '.', 'info', '(', ')', 'except', 'HDF4Error', ':', 'raise', 'HDF4Error', '(', "'setrange : cannot execute'", ')', 'n_values'...
Set the dataset min and max values. Args:: min dataset minimum value (attribute 'valid_range') max dataset maximum value (attribute 'valid_range') Returns:: None The data range is part of the so-called "standard" SDS attributes. Calling m...
['Set', 'the', 'dataset', 'min', 'and', 'max', 'values', '.']
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L2555-L2629
6,545
sphinx-gallery/sphinx-gallery
sphinx_gallery/docs_resolv.py
SphinxDocLinkResolver._get_link
def _get_link(self, cobj): """Get a valid link, False if not found""" fullname = cobj['module_short'] + '.' + cobj['name'] try: value = self._searchindex['objects'][cobj['module_short']] match = value[cobj['name']] except KeyError: link = False ...
python
def _get_link(self, cobj): """Get a valid link, False if not found""" fullname = cobj['module_short'] + '.' + cobj['name'] try: value = self._searchindex['objects'][cobj['module_short']] match = value[cobj['name']] except KeyError: link = False ...
['def', '_get_link', '(', 'self', ',', 'cobj', ')', ':', 'fullname', '=', 'cobj', '[', "'module_short'", ']', '+', "'.'", '+', 'cobj', '[', "'name'", ']', 'try', ':', 'value', '=', 'self', '.', '_searchindex', '[', "'objects'", ']', '[', 'cobj', '[', "'module_short'", ']', ']', 'match', '=', 'value', '[', 'cobj', '[', ...
Get a valid link, False if not found
['Get', 'a', 'valid', 'link', 'False', 'if', 'not', 'found']
train
https://github.com/sphinx-gallery/sphinx-gallery/blob/b0c1f6701bf3f4cef238757e1105cf3686b5e674/sphinx_gallery/docs_resolv.py#L191-L224
6,546
bjmorgan/lattice_mc
lattice_mc/lattice.py
Lattice.site_occupation_statistics
def site_occupation_statistics( self ): """ Average site occupation for each site type Args: None Returns: (Dict(Str:Float)): Dictionary of occupation statistics, e.g.:: { 'A' : 2.5, 'B' : 25.3 } """ if self.time == 0.0: ...
python
def site_occupation_statistics( self ): """ Average site occupation for each site type Args: None Returns: (Dict(Str:Float)): Dictionary of occupation statistics, e.g.:: { 'A' : 2.5, 'B' : 25.3 } """ if self.time == 0.0: ...
['def', 'site_occupation_statistics', '(', 'self', ')', ':', 'if', 'self', '.', 'time', '==', '0.0', ':', 'return', 'None', 'occupation_stats', '=', '{', 'label', ':', '0.0', 'for', 'label', 'in', 'self', '.', 'site_labels', '}', 'for', 'site', 'in', 'self', '.', 'sites', ':', 'occupation_stats', '[', 'site', '.', 'lab...
Average site occupation for each site type Args: None Returns: (Dict(Str:Float)): Dictionary of occupation statistics, e.g.:: { 'A' : 2.5, 'B' : 25.3 }
['Average', 'site', 'occupation', 'for', 'each', 'site', 'type']
train
https://github.com/bjmorgan/lattice_mc/blob/7fa7be85f2f23a2d8dfd0830ecdb89d0dbf2bfd5/lattice_mc/lattice.py#L250-L269
6,547
duniter/duniter-python-api
duniterpy/documents/peer.py
Peer.raw
def raw(self) -> str: """ Return a raw format string of the Peer document :return: """ doc = """Version: {0} Type: Peer Currency: {1} PublicKey: {2} Block: {3} Endpoints: """.format(self.version, self.currency, self.pubkey, self.blockUID) for _endpoint in self.endpoints...
python
def raw(self) -> str: """ Return a raw format string of the Peer document :return: """ doc = """Version: {0} Type: Peer Currency: {1} PublicKey: {2} Block: {3} Endpoints: """.format(self.version, self.currency, self.pubkey, self.blockUID) for _endpoint in self.endpoints...
['def', 'raw', '(', 'self', ')', '->', 'str', ':', 'doc', '=', '"""Version: {0}\nType: Peer\nCurrency: {1}\nPublicKey: {2}\nBlock: {3}\nEndpoints:\n"""', '.', 'format', '(', 'self', '.', 'version', ',', 'self', '.', 'currency', ',', 'self', '.', 'pubkey', ',', 'self', '.', 'blockUID', ')', 'for', '_endpoint', 'in', 'se...
Return a raw format string of the Peer document :return:
['Return', 'a', 'raw', 'format', 'string', 'of', 'the', 'Peer', 'document']
train
https://github.com/duniter/duniter-python-api/blob/3a1e5d61a2f72f5afaf29d010c6cf4dff3648165/duniterpy/documents/peer.py#L101-L118
6,548
vowatchka/palindromus
palindromus/__init__.py
checktext
def checktext(sometext, interchange = ALL): """ Checks that some text is palindrome. Checking performs case-insensitive :param str sometext: It is some string that will be checked for palindrome as text. What is the text see at help(palindromus.istext) The text can be multiline. ...
python
def checktext(sometext, interchange = ALL): """ Checks that some text is palindrome. Checking performs case-insensitive :param str sometext: It is some string that will be checked for palindrome as text. What is the text see at help(palindromus.istext) The text can be multiline. ...
['def', 'checktext', '(', 'sometext', ',', 'interchange', '=', 'ALL', ')', ':', '# check invalid data types', 'OnlyStringsCanBeChecked', '(', 'sometext', ')', 'if', 'istext', '(', 'sometext', ')', ':', 'return', 'checkstring', '(', 'sometext', ',', 'interchange', '=', 'interchange', ')', 'else', ':', 'return', 'False']
Checks that some text is palindrome. Checking performs case-insensitive :param str sometext: It is some string that will be checked for palindrome as text. What is the text see at help(palindromus.istext) The text can be multiline. :keyword dict interchange: It is dictionary o...
['Checks', 'that', 'some', 'text', 'is', 'palindrome', '.', 'Checking', 'performs', 'case', '-', 'insensitive', ':', 'param', 'str', 'sometext', ':', 'It', 'is', 'some', 'string', 'that', 'will', 'be', 'checked', 'for', 'palindrome', 'as', 'text', '.', 'What', 'is', 'the', 'text', 'see', 'at', 'help', '(', 'palindromus...
train
https://github.com/vowatchka/palindromus/blob/2fdac9259d7ba515d27cfde48c6d2be721594d66/palindromus/__init__.py#L291-L316
6,549
django-extensions/django-extensions
django_extensions/templatetags/widont.py
widont
def widont(value, count=1): """ Add an HTML non-breaking space between the final two words of the string to avoid "widowed" words. Examples: >>> print(widont('Test me out')) Test me&nbsp;out >>> print("'",widont('It works with trailing spaces too '), "'") ' It works with traili...
python
def widont(value, count=1): """ Add an HTML non-breaking space between the final two words of the string to avoid "widowed" words. Examples: >>> print(widont('Test me out')) Test me&nbsp;out >>> print("'",widont('It works with trailing spaces too '), "'") ' It works with traili...
['def', 'widont', '(', 'value', ',', 'count', '=', '1', ')', ':', 'def', 'replace', '(', 'matchobj', ')', ':', 'return', 'force_text', '(', "'&nbsp;%s'", '%', 'matchobj', '.', 'group', '(', '1', ')', ')', 'for', 'i', 'in', 'range', '(', 'count', ')', ':', 'value', '=', 're_widont', '.', 'sub', '(', 'replace', ',', 'for...
Add an HTML non-breaking space between the final two words of the string to avoid "widowed" words. Examples: >>> print(widont('Test me out')) Test me&nbsp;out >>> print("'",widont('It works with trailing spaces too '), "'") ' It works with trailing spaces&nbsp;too ' >>> print(wi...
['Add', 'an', 'HTML', 'non', '-', 'breaking', 'space', 'between', 'the', 'final', 'two', 'words', 'of', 'the', 'string', 'to', 'avoid', 'widowed', 'words', '.']
train
https://github.com/django-extensions/django-extensions/blob/7e0bef97ea6cb7f9eea5e2528e3a985a83a7b9b8/django_extensions/templatetags/widont.py#L15-L35
6,550
dacut/python-aws-sig
awssig/sigv4.py
AWSSigV4Verifier.canonical_request
def canonical_request(self): """ The AWS SigV4 canonical request given parameters from an HTTP request. This process is outlined here: http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html The canonical request is: request_method + '\n' + ...
python
def canonical_request(self): """ The AWS SigV4 canonical request given parameters from an HTTP request. This process is outlined here: http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html The canonical request is: request_method + '\n' + ...
['def', 'canonical_request', '(', 'self', ')', ':', 'signed_headers', '=', 'self', '.', 'signed_headers', 'header_lines', '=', '""', '.', 'join', '(', '[', '"%s:%s\\n"', '%', 'item', 'for', 'item', 'in', 'iteritems', '(', 'signed_headers', ')', ']', ')', 'header_keys', '=', '";"', '.', 'join', '(', '[', 'key', 'for', '...
The AWS SigV4 canonical request given parameters from an HTTP request. This process is outlined here: http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html The canonical request is: request_method + '\n' + canonical_uri_path + '\n' + ...
['The', 'AWS', 'SigV4', 'canonical', 'request', 'given', 'parameters', 'from', 'an', 'HTTP', 'request', '.', 'This', 'process', 'is', 'outlined', 'here', ':', 'http', ':', '//', 'docs', '.', 'aws', '.', 'amazon', '.', 'com', '/', 'general', '/', 'latest', '/', 'gr', '/', 'sigv4', '-', 'create', '-', 'canonical', '-', '...
train
https://github.com/dacut/python-aws-sig/blob/7f6054dca4b32e67ca3d39db31c1b4be5efe54bd/awssig/sigv4.py#L302-L325
6,551
wtsi-hgi/gitlab-build-variables
gitlabbuildvariables/update/_single_project_updaters.py
FileBasedProjectVariablesUpdater._resolve_group_location
def _resolve_group_location(self, group: str) -> str: """ Resolves the location of a setting file based on the given identifier. :param group: the identifier for the group's settings file (~its location) :return: the absolute path of the settings location """ if os.path.i...
python
def _resolve_group_location(self, group: str) -> str: """ Resolves the location of a setting file based on the given identifier. :param group: the identifier for the group's settings file (~its location) :return: the absolute path of the settings location """ if os.path.i...
['def', '_resolve_group_location', '(', 'self', ',', 'group', ':', 'str', ')', '->', 'str', ':', 'if', 'os', '.', 'path', '.', 'isabs', '(', 'group', ')', ':', 'possible_paths', '=', '[', 'group', ']', 'else', ':', 'possible_paths', '=', '[', ']', 'for', 'repository', 'in', 'self', '.', 'setting_repositories', ':', 'po...
Resolves the location of a setting file based on the given identifier. :param group: the identifier for the group's settings file (~its location) :return: the absolute path of the settings location
['Resolves', 'the', 'location', 'of', 'a', 'setting', 'file', 'based', 'on', 'the', 'given', 'identifier', '.', ':', 'param', 'group', ':', 'the', 'identifier', 'for', 'the', 'group', 's', 'settings', 'file', '(', '~its', 'location', ')', ':', 'return', ':', 'the', 'absolute', 'path', 'of', 'the', 'settings', 'location...
train
https://github.com/wtsi-hgi/gitlab-build-variables/blob/ed1afe50bc41fa20ffb29cacba5ff6dbc2446808/gitlabbuildvariables/update/_single_project_updaters.py#L78-L100
6,552
emc-openstack/storops
storops/vnx/calculator.py
io_size_kb
def io_size_kb(prev, curr, counters): """ calculate the io size based on bandwidth and throughput formula: average_io_size = bandwidth / throughput :param prev: prev resource, not used :param curr: current resource :param counters: two stats, bandwidth in MB and throughput count :return: value,...
python
def io_size_kb(prev, curr, counters): """ calculate the io size based on bandwidth and throughput formula: average_io_size = bandwidth / throughput :param prev: prev resource, not used :param curr: current resource :param counters: two stats, bandwidth in MB and throughput count :return: value,...
['def', 'io_size_kb', '(', 'prev', ',', 'curr', ',', 'counters', ')', ':', 'bw_stats', ',', 'io_stats', '=', 'counters', 'size_mb', '=', 'div', '(', 'getattr', '(', 'curr', ',', 'bw_stats', ')', ',', 'getattr', '(', 'curr', ',', 'io_stats', ')', ')', 'return', 'mul', '(', 'size_mb', ',', '1024', ')']
calculate the io size based on bandwidth and throughput formula: average_io_size = bandwidth / throughput :param prev: prev resource, not used :param curr: current resource :param counters: two stats, bandwidth in MB and throughput count :return: value, NaN if invalid
['calculate', 'the', 'io', 'size', 'based', 'on', 'bandwidth', 'and', 'throughput']
train
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/calculator.py#L187-L198
6,553
pallets/werkzeug
src/werkzeug/formparser.py
FormDataParser.parse_from_environ
def parse_from_environ(self, environ): """Parses the information from the environment as form data. :param environ: the WSGI environment to be used for parsing. :return: A tuple in the form ``(stream, form, files)``. """ content_type = environ.get("CONTENT_TYPE", "") con...
python
def parse_from_environ(self, environ): """Parses the information from the environment as form data. :param environ: the WSGI environment to be used for parsing. :return: A tuple in the form ``(stream, form, files)``. """ content_type = environ.get("CONTENT_TYPE", "") con...
['def', 'parse_from_environ', '(', 'self', ',', 'environ', ')', ':', 'content_type', '=', 'environ', '.', 'get', '(', '"CONTENT_TYPE"', ',', '""', ')', 'content_length', '=', 'get_content_length', '(', 'environ', ')', 'mimetype', ',', 'options', '=', 'parse_options_header', '(', 'content_type', ')', 'return', 'self', '...
Parses the information from the environment as form data. :param environ: the WSGI environment to be used for parsing. :return: A tuple in the form ``(stream, form, files)``.
['Parses', 'the', 'information', 'from', 'the', 'environment', 'as', 'form', 'data', '.']
train
https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/formparser.py#L197-L206
6,554
fabioz/PyDev.Debugger
third_party/pep8/lib2to3/lib2to3/fixer_base.py
BaseFix.start_tree
def start_tree(self, tree, filename): """Some fixers need to maintain tree-wide state. This method is called once, at the start of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. """ self.used_names = tre...
python
def start_tree(self, tree, filename): """Some fixers need to maintain tree-wide state. This method is called once, at the start of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. """ self.used_names = tre...
['def', 'start_tree', '(', 'self', ',', 'tree', ',', 'filename', ')', ':', 'self', '.', 'used_names', '=', 'tree', '.', 'used_names', 'self', '.', 'set_filename', '(', 'filename', ')', 'self', '.', 'numbers', '=', 'itertools', '.', 'count', '(', '1', ')', 'self', '.', 'first_log', '=', 'True']
Some fixers need to maintain tree-wide state. This method is called once, at the start of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from.
['Some', 'fixers', 'need', 'to', 'maintain', 'tree', '-', 'wide', 'state', '.', 'This', 'method', 'is', 'called', 'once', 'at', 'the', 'start', 'of', 'tree', 'fix', '-', 'up', '.']
train
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/lib2to3/lib2to3/fixer_base.py#L150-L160
6,555
fitnr/convertdate
convertdate/mayan.py
from_jd
def from_jd(jd): '''Calculate Mayan long count from Julian day''' d = jd - EPOCH baktun = trunc(d / 144000) d = (d % 144000) katun = trunc(d / 7200) d = (d % 7200) tun = trunc(d / 360) d = (d % 360) uinal = trunc(d / 20) kin = int((d % 20)) return (baktun, katun, tun, uinal,...
python
def from_jd(jd): '''Calculate Mayan long count from Julian day''' d = jd - EPOCH baktun = trunc(d / 144000) d = (d % 144000) katun = trunc(d / 7200) d = (d % 7200) tun = trunc(d / 360) d = (d % 360) uinal = trunc(d / 20) kin = int((d % 20)) return (baktun, katun, tun, uinal,...
['def', 'from_jd', '(', 'jd', ')', ':', 'd', '=', 'jd', '-', 'EPOCH', 'baktun', '=', 'trunc', '(', 'd', '/', '144000', ')', 'd', '=', '(', 'd', '%', '144000', ')', 'katun', '=', 'trunc', '(', 'd', '/', '7200', ')', 'd', '=', '(', 'd', '%', '7200', ')', 'tun', '=', 'trunc', '(', 'd', '/', '360', ')', 'd', '=', '(', 'd',...
Calculate Mayan long count from Julian day
['Calculate', 'Mayan', 'long', 'count', 'from', 'Julian', 'day']
train
https://github.com/fitnr/convertdate/blob/e920f168a87f99183b0aa7290d6c3af222582d43/convertdate/mayan.py#L41-L53
6,556
dwavesystems/dwave-cloud-client
dwave/cloud/utils.py
strip_head
def strip_head(sequence, values): """Strips elements of `values` from the beginning of `sequence`.""" values = set(values) return list(itertools.dropwhile(lambda x: x in values, sequence))
python
def strip_head(sequence, values): """Strips elements of `values` from the beginning of `sequence`.""" values = set(values) return list(itertools.dropwhile(lambda x: x in values, sequence))
['def', 'strip_head', '(', 'sequence', ',', 'values', ')', ':', 'values', '=', 'set', '(', 'values', ')', 'return', 'list', '(', 'itertools', '.', 'dropwhile', '(', 'lambda', 'x', ':', 'x', 'in', 'values', ',', 'sequence', ')', ')']
Strips elements of `values` from the beginning of `sequence`.
['Strips', 'elements', 'of', 'values', 'from', 'the', 'beginning', 'of', 'sequence', '.']
train
https://github.com/dwavesystems/dwave-cloud-client/blob/df3221a8385dc0c04d7b4d84f740bf3ad6706230/dwave/cloud/utils.py#L133-L136
6,557
tyarkoni/pliers
pliers/utils/base.py
batch_iterable
def batch_iterable(l, n): ''' Chunks iterable into n sized batches Solution from: http://stackoverflow.com/questions/1915170/split-a-generator-iterable-every-n-items-in-python-splitevery''' i = iter(l) piece = list(islice(i, n)) while piece: yield piece piece = list(islice(i, n))
python
def batch_iterable(l, n): ''' Chunks iterable into n sized batches Solution from: http://stackoverflow.com/questions/1915170/split-a-generator-iterable-every-n-items-in-python-splitevery''' i = iter(l) piece = list(islice(i, n)) while piece: yield piece piece = list(islice(i, n))
['def', 'batch_iterable', '(', 'l', ',', 'n', ')', ':', 'i', '=', 'iter', '(', 'l', ')', 'piece', '=', 'list', '(', 'islice', '(', 'i', ',', 'n', ')', ')', 'while', 'piece', ':', 'yield', 'piece', 'piece', '=', 'list', '(', 'islice', '(', 'i', ',', 'n', ')', ')']
Chunks iterable into n sized batches Solution from: http://stackoverflow.com/questions/1915170/split-a-generator-iterable-every-n-items-in-python-splitevery
['Chunks', 'iterable', 'into', 'n', 'sized', 'batches', 'Solution', 'from', ':', 'http', ':', '//', 'stackoverflow', '.', 'com', '/', 'questions', '/', '1915170', '/', 'split', '-', 'a', '-', 'generator', '-', 'iterable', '-', 'every', '-', 'n', '-', 'items', '-', 'in', '-', 'python', '-', 'splitevery']
train
https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/utils/base.py#L45-L52
6,558
cloudant/python-cloudant
src/cloudant/design_document.py
DesignDocument.search_info
def search_info(self, search_index): """ Retrieves information about a specified search index within the design document, returns dictionary GET databasename/_design/{ddoc}/_search_info/{search_index} """ ddoc_search_info = self.r_session.get( '/'.join([self....
python
def search_info(self, search_index): """ Retrieves information about a specified search index within the design document, returns dictionary GET databasename/_design/{ddoc}/_search_info/{search_index} """ ddoc_search_info = self.r_session.get( '/'.join([self....
['def', 'search_info', '(', 'self', ',', 'search_index', ')', ':', 'ddoc_search_info', '=', 'self', '.', 'r_session', '.', 'get', '(', "'/'", '.', 'join', '(', '[', 'self', '.', 'document_url', ',', "'_search_info'", ',', 'search_index', ']', ')', ')', 'ddoc_search_info', '.', 'raise_for_status', '(', ')', 'return', 'r...
Retrieves information about a specified search index within the design document, returns dictionary GET databasename/_design/{ddoc}/_search_info/{search_index}
['Retrieves', 'information', 'about', 'a', 'specified', 'search', 'index', 'within', 'the', 'design', 'document', 'returns', 'dictionary']
train
https://github.com/cloudant/python-cloudant/blob/e0ba190f6ba07fe3522a668747128214ad573c7e/src/cloudant/design_document.py#L712-L722
6,559
saltstack/salt
salt/states/pcs.py
auth
def auth(name, nodes, pcsuser='hacluster', pcspasswd='hacluster', extra_args=None): ''' Ensure all nodes are authorized to the cluster name Irrelevant, not used (recommended: pcs_auth__auth) nodes a list of nodes which should be authorized to the cluster pcsuser user for com...
python
def auth(name, nodes, pcsuser='hacluster', pcspasswd='hacluster', extra_args=None): ''' Ensure all nodes are authorized to the cluster name Irrelevant, not used (recommended: pcs_auth__auth) nodes a list of nodes which should be authorized to the cluster pcsuser user for com...
['def', 'auth', '(', 'name', ',', 'nodes', ',', 'pcsuser', '=', "'hacluster'", ',', 'pcspasswd', '=', "'hacluster'", ',', 'extra_args', '=', 'None', ')', ':', 'ret', '=', '{', "'name'", ':', 'name', ',', "'result'", ':', 'True', ',', "'comment'", ':', "''", ',', "'changes'", ':', '{', '}', '}', 'auth_required', '=', 'F...
Ensure all nodes are authorized to the cluster name Irrelevant, not used (recommended: pcs_auth__auth) nodes a list of nodes which should be authorized to the cluster pcsuser user for communication with pcs (default: hacluster) pcspasswd password for pcsuser (default: ha...
['Ensure', 'all', 'nodes', 'are', 'authorized', 'to', 'the', 'cluster']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pcs.py#L360-L444
6,560
materialsproject/pymatgen-db
matgendb/vv/validate.py
Sampler.sample
def sample(self, cursor): """Extract records randomly from the database. Continue until the target proportion of the items have been extracted, or until `min_items` if this is larger. If `max_items` is non-negative, do not extract more than these. This function is a generator, y...
python
def sample(self, cursor): """Extract records randomly from the database. Continue until the target proportion of the items have been extracted, or until `min_items` if this is larger. If `max_items` is non-negative, do not extract more than these. This function is a generator, y...
['def', 'sample', '(', 'self', ',', 'cursor', ')', ':', 'count', '=', 'cursor', '.', 'count', '(', ')', '# special case: empty collection', 'if', 'count', '==', '0', ':', 'self', '.', '_empty', '=', 'True', 'raise', 'ValueError', '(', '"Empty collection"', ')', '# special case: entire collection', 'if', 'self', '.', 'p...
Extract records randomly from the database. Continue until the target proportion of the items have been extracted, or until `min_items` if this is larger. If `max_items` is non-negative, do not extract more than these. This function is a generator, yielding items incrementally. ...
['Extract', 'records', 'randomly', 'from', 'the', 'database', '.', 'Continue', 'until', 'the', 'target', 'proportion', 'of', 'the', 'items', 'have', 'been', 'extracted', 'or', 'until', 'min_items', 'if', 'this', 'is', 'larger', '.', 'If', 'max_items', 'is', 'non', '-', 'negative', 'do', 'not', 'extract', 'more', 'than'...
train
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/vv/validate.py#L669-L723
6,561
caseyjlaw/rtpipe
rtpipe/parsecal.py
telcal_sol.calcgain
def calcgain(self, ant1, ant2, skyfreq, pol): """ Calculates the complex gain product (g1*g2) for a pair of antennas. """ select = self.select[n.where( (self.skyfreq[self.select] == skyfreq) & (self.polarization[self.select] == pol) )[0]] if len(select): # for when telcal solutions do...
python
def calcgain(self, ant1, ant2, skyfreq, pol): """ Calculates the complex gain product (g1*g2) for a pair of antennas. """ select = self.select[n.where( (self.skyfreq[self.select] == skyfreq) & (self.polarization[self.select] == pol) )[0]] if len(select): # for when telcal solutions do...
['def', 'calcgain', '(', 'self', ',', 'ant1', ',', 'ant2', ',', 'skyfreq', ',', 'pol', ')', ':', 'select', '=', 'self', '.', 'select', '[', 'n', '.', 'where', '(', '(', 'self', '.', 'skyfreq', '[', 'self', '.', 'select', ']', '==', 'skyfreq', ')', '&', '(', 'self', '.', 'polarization', '[', 'self', '.', 'select', ']', ...
Calculates the complex gain product (g1*g2) for a pair of antennas.
['Calculates', 'the', 'complex', 'gain', 'product', '(', 'g1', '*', 'g2', ')', 'for', 'a', 'pair', 'of', 'antennas', '.']
train
https://github.com/caseyjlaw/rtpipe/blob/ac33e4332cf215091a63afbb3137850876d73ec0/rtpipe/parsecal.py#L565-L584
6,562
neo4j/neo4j-python-driver
neo4j/types/__init__.py
Record.items
def items(self, *keys): """ Return the fields of the record as a list of key and value tuples :return: """ if keys: d = [] for key in keys: try: i = self.index(key) except KeyError: d.append(...
python
def items(self, *keys): """ Return the fields of the record as a list of key and value tuples :return: """ if keys: d = [] for key in keys: try: i = self.index(key) except KeyError: d.append(...
['def', 'items', '(', 'self', ',', '*', 'keys', ')', ':', 'if', 'keys', ':', 'd', '=', '[', ']', 'for', 'key', 'in', 'keys', ':', 'try', ':', 'i', '=', 'self', '.', 'index', '(', 'key', ')', 'except', 'KeyError', ':', 'd', '.', 'append', '(', '(', 'key', ',', 'None', ')', ')', 'else', ':', 'd', '.', 'append', '(', '(',...
Return the fields of the record as a list of key and value tuples :return:
['Return', 'the', 'fields', 'of', 'the', 'record', 'as', 'a', 'list', 'of', 'key', 'and', 'value', 'tuples']
train
https://github.com/neo4j/neo4j-python-driver/blob/0c641e826765e86ff5454dae57c99521db8ca45c/neo4j/types/__init__.py#L280-L295
6,563
globocom/GloboNetworkAPI-client-python
networkapiclient/Equipamento.py
Equipamento.listar_por_tipo_ambiente
def listar_por_tipo_ambiente(self, id_tipo_equipamento, id_ambiente): """Lista os equipamentos de um tipo e que estão associados a um ambiente. :param id_tipo_equipamento: Identificador do tipo do equipamento. :param id_ambiente: Identificador do ambiente. :return: Dicionário com a seg...
python
def listar_por_tipo_ambiente(self, id_tipo_equipamento, id_ambiente): """Lista os equipamentos de um tipo e que estão associados a um ambiente. :param id_tipo_equipamento: Identificador do tipo do equipamento. :param id_ambiente: Identificador do ambiente. :return: Dicionário com a seg...
['def', 'listar_por_tipo_ambiente', '(', 'self', ',', 'id_tipo_equipamento', ',', 'id_ambiente', ')', ':', 'if', 'not', 'is_valid_int_param', '(', 'id_tipo_equipamento', ')', ':', 'raise', 'InvalidParameterError', '(', "u'O identificador do tipo do equipamento é inválido ou não foi informado.')", '', 'if', 'not', 'is_v...
Lista os equipamentos de um tipo e que estão associados a um ambiente. :param id_tipo_equipamento: Identificador do tipo do equipamento. :param id_ambiente: Identificador do ambiente. :return: Dicionário com a seguinte estrutura: :: {'equipamento': [{'id': < id_equipament...
['Lista', 'os', 'equipamentos', 'de', 'um', 'tipo', 'e', 'que', 'estão', 'associados', 'a', 'um', 'ambiente', '.']
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Equipamento.py#L466-L505
6,564
quantmind/pulsar
examples/httpbin/manage.py
HttpBin.get
def get(self, request): '''The home page of this router''' ul = Html('ul') for router in sorted(self.routes, key=lambda r: r.creation_count): a = router.link(escape(router.route.path)) a.addClass(router.name) for method in METHODS: if router.ge...
python
def get(self, request): '''The home page of this router''' ul = Html('ul') for router in sorted(self.routes, key=lambda r: r.creation_count): a = router.link(escape(router.route.path)) a.addClass(router.name) for method in METHODS: if router.ge...
['def', 'get', '(', 'self', ',', 'request', ')', ':', 'ul', '=', 'Html', '(', "'ul'", ')', 'for', 'router', 'in', 'sorted', '(', 'self', '.', 'routes', ',', 'key', '=', 'lambda', 'r', ':', 'r', '.', 'creation_count', ')', ':', 'a', '=', 'router', '.', 'link', '(', 'escape', '(', 'router', '.', 'route', '.', 'path', ')'...
The home page of this router
['The', 'home', 'page', 'of', 'this', 'router']
train
https://github.com/quantmind/pulsar/blob/fee44e871954aa6ca36d00bb5a3739abfdb89b26/examples/httpbin/manage.py#L106-L127
6,565
buzzfeed/caliendo
caliendo/facade.py
Wrapper.wrapper__ignore
def wrapper__ignore(self, type_): """ Selectively ignore certain types when wrapping attributes. :param class type: The class/type definition to ignore. :rtype list(type): The current list of ignored types """ if type_ not in self.__exclusion_list: self.__ex...
python
def wrapper__ignore(self, type_): """ Selectively ignore certain types when wrapping attributes. :param class type: The class/type definition to ignore. :rtype list(type): The current list of ignored types """ if type_ not in self.__exclusion_list: self.__ex...
['def', 'wrapper__ignore', '(', 'self', ',', 'type_', ')', ':', 'if', 'type_', 'not', 'in', 'self', '.', '__exclusion_list', ':', 'self', '.', '__exclusion_list', '.', 'append', '(', 'type_', ')', 'return', 'self', '.', '__exclusion_list']
Selectively ignore certain types when wrapping attributes. :param class type: The class/type definition to ignore. :rtype list(type): The current list of ignored types
['Selectively', 'ignore', 'certain', 'types', 'when', 'wrapping', 'attributes', '.']
train
https://github.com/buzzfeed/caliendo/blob/1628a10f7782ad67c0422b5cbc9bf4979ac40abc/caliendo/facade.py#L86-L96
6,566
lsst-sqre/documenteer
documenteer/sphinxconfig/utils.py
get_filepaths_with_extension
def get_filepaths_with_extension(extname, root_dir='.'): """Get relative filepaths of files in a directory, and sub-directories, with the given extension. Parameters ---------- extname : `str` Extension name (e.g. 'txt', 'rst'). Extension comparison is case-insensitive. root_dir...
python
def get_filepaths_with_extension(extname, root_dir='.'): """Get relative filepaths of files in a directory, and sub-directories, with the given extension. Parameters ---------- extname : `str` Extension name (e.g. 'txt', 'rst'). Extension comparison is case-insensitive. root_dir...
['def', 'get_filepaths_with_extension', '(', 'extname', ',', 'root_dir', '=', "'.'", ')', ':', '# needed for comparison with os.path.splitext', 'if', 'not', 'extname', '.', 'startswith', '(', "'.'", ')', ':', 'extname', '=', "'.'", '+', 'extname', '# for case-insensitivity', 'extname', '=', 'extname', '.', 'lower', '('...
Get relative filepaths of files in a directory, and sub-directories, with the given extension. Parameters ---------- extname : `str` Extension name (e.g. 'txt', 'rst'). Extension comparison is case-insensitive. root_dir : `str`, optional Root directory. Current working direc...
['Get', 'relative', 'filepaths', 'of', 'files', 'in', 'a', 'directory', 'and', 'sub', '-', 'directories', 'with', 'the', 'given', 'extension', '.']
train
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/utils.py#L83-L116
6,567
thespacedoctor/fundamentals
fundamentals/times.py
calculate_time_difference
def calculate_time_difference(startDate, endDate): """ *Return the time difference between two dates as a string* **Key Arguments:** - ``startDate`` -- the first date in YYYY-MM-DDTHH:MM:SS format - ``endDate`` -- the final date YYYY-MM-DDTHH:MM:SS format **Return:** - ``relTim...
python
def calculate_time_difference(startDate, endDate): """ *Return the time difference between two dates as a string* **Key Arguments:** - ``startDate`` -- the first date in YYYY-MM-DDTHH:MM:SS format - ``endDate`` -- the final date YYYY-MM-DDTHH:MM:SS format **Return:** - ``relTim...
['def', 'calculate_time_difference', '(', 'startDate', ',', 'endDate', ')', ':', '################ > IMPORTS ################', 'from', 'datetime', 'import', 'datetime', 'from', 'dateutil', 'import', 'relativedelta', '################ > VARIABLE SETTINGS ######', '################ >ACTION(S) ################', 'if', '"...
*Return the time difference between two dates as a string* **Key Arguments:** - ``startDate`` -- the first date in YYYY-MM-DDTHH:MM:SS format - ``endDate`` -- the final date YYYY-MM-DDTHH:MM:SS format **Return:** - ``relTime`` -- the difference between the two dates in Y,M,D,h,m,s (str...
['*', 'Return', 'the', 'time', 'difference', 'between', 'two', 'dates', 'as', 'a', 'string', '*']
train
https://github.com/thespacedoctor/fundamentals/blob/1d2c007ac74442ec2eabde771cfcacdb9c1ab382/fundamentals/times.py#L42-L95
6,568
posativ/isso
isso/wsgi.py
urlsplit
def urlsplit(name): """ Parse :param:`name` into (netloc, port, ssl) """ if not (isinstance(name, string_types)): name = str(name) if not name.startswith(('http://', 'https://')): name = 'http://' + name rv = urlparse(name) if rv.scheme == 'https' and rv.port is None: ...
python
def urlsplit(name): """ Parse :param:`name` into (netloc, port, ssl) """ if not (isinstance(name, string_types)): name = str(name) if not name.startswith(('http://', 'https://')): name = 'http://' + name rv = urlparse(name) if rv.scheme == 'https' and rv.port is None: ...
['def', 'urlsplit', '(', 'name', ')', ':', 'if', 'not', '(', 'isinstance', '(', 'name', ',', 'string_types', ')', ')', ':', 'name', '=', 'str', '(', 'name', ')', 'if', 'not', 'name', '.', 'startswith', '(', '(', "'http://'", ',', "'https://'", ')', ')', ':', 'name', '=', "'http://'", '+', 'name', 'rv', '=', 'urlparse',...
Parse :param:`name` into (netloc, port, ssl)
['Parse', ':', 'param', ':', 'name', 'into', '(', 'netloc', 'port', 'ssl', ')']
train
https://github.com/posativ/isso/blob/78997f491044b7d694ac7170edc32030544095b7/isso/wsgi.py#L50-L64
6,569
LuqueDaniel/pybooru
pybooru/api_moebooru.py
MoebooruApi_Mixin.post_revert_tags
def post_revert_tags(self, post_id, history_id): """Function to reverts a post to a previous set of tags (Requires login) (UNTESTED). Parameters: post_id (int): The post id number to update. history_id (int): The id number of the tag history. """ params =...
python
def post_revert_tags(self, post_id, history_id): """Function to reverts a post to a previous set of tags (Requires login) (UNTESTED). Parameters: post_id (int): The post id number to update. history_id (int): The id number of the tag history. """ params =...
['def', 'post_revert_tags', '(', 'self', ',', 'post_id', ',', 'history_id', ')', ':', 'params', '=', '{', "'id'", ':', 'post_id', ',', "'history_id'", ':', 'history_id', '}', 'return', 'self', '.', '_get', '(', "'post/revert_tags'", ',', 'params', ',', "'PUT'", ')']
Function to reverts a post to a previous set of tags (Requires login) (UNTESTED). Parameters: post_id (int): The post id number to update. history_id (int): The id number of the tag history.
['Function', 'to', 'reverts', 'a', 'post', 'to', 'a', 'previous', 'set', 'of', 'tags', '(', 'Requires', 'login', ')', '(', 'UNTESTED', ')', '.']
train
https://github.com/LuqueDaniel/pybooru/blob/60cd5254684d293b308f0b11b8f4ac2dce101479/pybooru/api_moebooru.py#L126-L135
6,570
CellProfiler/centrosome
centrosome/cpmorphology.py
calculate_solidity
def calculate_solidity(labels,indexes=None): """Calculate the area of each label divided by the area of its convex hull labels - a label matrix indexes - the indexes of the labels to measure """ if indexes is not None: """ Convert to compat 32bit integer """ indexes = np.array(i...
python
def calculate_solidity(labels,indexes=None): """Calculate the area of each label divided by the area of its convex hull labels - a label matrix indexes - the indexes of the labels to measure """ if indexes is not None: """ Convert to compat 32bit integer """ indexes = np.array(i...
['def', 'calculate_solidity', '(', 'labels', ',', 'indexes', '=', 'None', ')', ':', 'if', 'indexes', 'is', 'not', 'None', ':', '""" Convert to compat 32bit integer """', 'indexes', '=', 'np', '.', 'array', '(', 'indexes', ',', 'dtype', '=', 'np', '.', 'int32', ')', 'areas', '=', 'scind', '.', 'sum', '(', 'np', '.', 'on...
Calculate the area of each label divided by the area of its convex hull labels - a label matrix indexes - the indexes of the labels to measure
['Calculate', 'the', 'area', 'of', 'each', 'label', 'divided', 'by', 'the', 'area', 'of', 'its', 'convex', 'hull', 'labels', '-', 'a', 'label', 'matrix', 'indexes', '-', 'the', 'indexes', 'of', 'the', 'labels', 'to', 'measure']
train
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/cpmorphology.py#L2466-L2477
6,571
PixelwarStudio/PyTree
Tree/core.py
generate_branches
def generate_branches(scales=None, angles=None, shift_angle=0): """Generates branches with alternative system. Args: scales (tuple/array): Indicating how the branch/es length/es develop/s from age to age. angles (tuple/array): Holding the branch and shift angle in radians. shift_angle (...
python
def generate_branches(scales=None, angles=None, shift_angle=0): """Generates branches with alternative system. Args: scales (tuple/array): Indicating how the branch/es length/es develop/s from age to age. angles (tuple/array): Holding the branch and shift angle in radians. shift_angle (...
['def', 'generate_branches', '(', 'scales', '=', 'None', ',', 'angles', '=', 'None', ',', 'shift_angle', '=', '0', ')', ':', 'branches', '=', '[', ']', 'for', 'pos', ',', 'scale', 'in', 'enumerate', '(', 'scales', ')', ':', 'angle', '=', '-', 'sum', '(', 'angles', ')', '/', '2', '+', 'sum', '(', 'angles', '[', ':', 'po...
Generates branches with alternative system. Args: scales (tuple/array): Indicating how the branch/es length/es develop/s from age to age. angles (tuple/array): Holding the branch and shift angle in radians. shift_angle (float): Holding the rotation angle for all branches. Returns: ...
['Generates', 'branches', 'with', 'alternative', 'system', '.']
train
https://github.com/PixelwarStudio/PyTree/blob/f14b25ea145da6b00d836e34251d2a4c823766dc/Tree/core.py#L225-L240
6,572
cloudnull/turbolift
turbolift/methods/__init__.py
BaseMethod._index_fs
def _index_fs(self): """Returns a deque object full of local file system items. :returns: ``deque`` """ indexed_objects = self._return_deque() directory = self.job_args.get('directory') if directory: indexed_objects = self._return_deque( deq...
python
def _index_fs(self): """Returns a deque object full of local file system items. :returns: ``deque`` """ indexed_objects = self._return_deque() directory = self.job_args.get('directory') if directory: indexed_objects = self._return_deque( deq...
['def', '_index_fs', '(', 'self', ')', ':', 'indexed_objects', '=', 'self', '.', '_return_deque', '(', ')', 'directory', '=', 'self', '.', 'job_args', '.', 'get', '(', "'directory'", ')', 'if', 'directory', ':', 'indexed_objects', '=', 'self', '.', '_return_deque', '(', 'deque', '=', 'indexed_objects', ',', 'item', '='...
Returns a deque object full of local file system items. :returns: ``deque``
['Returns', 'a', 'deque', 'object', 'full', 'of', 'local', 'file', 'system', 'items', '.']
train
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/methods/__init__.py#L497-L523
6,573
cgtobi/PyRMVtransport
RMVtransport/rmvjourney.py
RMVJourney._departure
def _departure(self) -> datetime: """Extract departure time.""" departure_time = datetime.strptime( self.journey.MainStop.BasicStop.Dep.Time.text, "%H:%M" ).time() if departure_time > (self.now - timedelta(hours=1)).time(): return datetime.combine(self.now.date(),...
python
def _departure(self) -> datetime: """Extract departure time.""" departure_time = datetime.strptime( self.journey.MainStop.BasicStop.Dep.Time.text, "%H:%M" ).time() if departure_time > (self.now - timedelta(hours=1)).time(): return datetime.combine(self.now.date(),...
['def', '_departure', '(', 'self', ')', '->', 'datetime', ':', 'departure_time', '=', 'datetime', '.', 'strptime', '(', 'self', '.', 'journey', '.', 'MainStop', '.', 'BasicStop', '.', 'Dep', '.', 'Time', '.', 'text', ',', '"%H:%M"', ')', '.', 'time', '(', ')', 'if', 'departure_time', '>', '(', 'self', '.', 'now', '-', ...
Extract departure time.
['Extract', 'departure', 'time', '.']
train
https://github.com/cgtobi/PyRMVtransport/blob/20a0d68ecfdedceb32e8ca96c381fdec7e2069c7/RMVtransport/rmvjourney.py#L49-L56
6,574
pbrod/numdifftools
src/numdifftools/nd_algopy.py
directionaldiff
def directionaldiff(f, x0, vec, **options): """ Return directional derivative of a function of n variables Parameters ---------- fun: callable analytical function to differentiate. x0: array vector location at which to differentiate fun. If x0 is an nxm array, then fun i...
python
def directionaldiff(f, x0, vec, **options): """ Return directional derivative of a function of n variables Parameters ---------- fun: callable analytical function to differentiate. x0: array vector location at which to differentiate fun. If x0 is an nxm array, then fun i...
['def', 'directionaldiff', '(', 'f', ',', 'x0', ',', 'vec', ',', '*', '*', 'options', ')', ':', 'x0', '=', 'np', '.', 'asarray', '(', 'x0', ')', 'vec', '=', 'np', '.', 'asarray', '(', 'vec', ')', 'if', 'x0', '.', 'size', '!=', 'vec', '.', 'size', ':', 'raise', 'ValueError', '(', "'vec and x0 must be the same shapes'", ...
Return directional derivative of a function of n variables Parameters ---------- fun: callable analytical function to differentiate. x0: array vector location at which to differentiate fun. If x0 is an nxm array, then fun is assumed to be a function of n*m variables. vec: ar...
['Return', 'directional', 'derivative', 'of', 'a', 'function', 'of', 'n', 'variables']
train
https://github.com/pbrod/numdifftools/blob/2c88878df732c9c6629febea56e7a91fd898398d/src/numdifftools/nd_algopy.py#L485-L533
6,575
SBRG/ssbio
ssbio/protein/sequence/properties/aggregation_propensity.py
AMYLPRED.get_aggregation_propensity
def get_aggregation_propensity(self, seq, outdir, cutoff_v=5, cutoff_n=5, run_amylmuts=False): """Run the AMYLPRED2 web server for a protein sequence and get the consensus result for aggregation propensity. Args: seq (str, Seq, SeqRecord): Amino acid sequence outdir (str): Direc...
python
def get_aggregation_propensity(self, seq, outdir, cutoff_v=5, cutoff_n=5, run_amylmuts=False): """Run the AMYLPRED2 web server for a protein sequence and get the consensus result for aggregation propensity. Args: seq (str, Seq, SeqRecord): Amino acid sequence outdir (str): Direc...
['def', 'get_aggregation_propensity', '(', 'self', ',', 'seq', ',', 'outdir', ',', 'cutoff_v', '=', '5', ',', 'cutoff_n', '=', '5', ',', 'run_amylmuts', '=', 'False', ')', ':', 'seq', '=', 'ssbio', '.', 'protein', '.', 'sequence', '.', 'utils', '.', 'cast_to_str', '(', 'seq', ')', 'results', '=', 'self', '.', 'run_amyl...
Run the AMYLPRED2 web server for a protein sequence and get the consensus result for aggregation propensity. Args: seq (str, Seq, SeqRecord): Amino acid sequence outdir (str): Directory to where output files should be saved cutoff_v (int): The minimal number of methods that ...
['Run', 'the', 'AMYLPRED2', 'web', 'server', 'for', 'a', 'protein', 'sequence', 'and', 'get', 'the', 'consensus', 'result', 'for', 'aggregation', 'propensity', '.']
train
https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/properties/aggregation_propensity.py#L66-L88
6,576
ultrabug/py3status
py3status/util.py
Gradients.hsv_2_hex
def hsv_2_hex(self, h, s, v): """ convert a hsv color to hex """ return self.rgb_2_hex(*hsv_to_rgb(h, s, v))
python
def hsv_2_hex(self, h, s, v): """ convert a hsv color to hex """ return self.rgb_2_hex(*hsv_to_rgb(h, s, v))
['def', 'hsv_2_hex', '(', 'self', ',', 'h', ',', 's', ',', 'v', ')', ':', 'return', 'self', '.', 'rgb_2_hex', '(', '*', 'hsv_to_rgb', '(', 'h', ',', 's', ',', 'v', ')', ')']
convert a hsv color to hex
['convert', 'a', 'hsv', 'color', 'to', 'hex']
train
https://github.com/ultrabug/py3status/blob/4c105f1b44f7384ca4f7da5f821a47e468c7dee2/py3status/util.py#L40-L44
6,577
gem/oq-engine
openquake/hazardlib/geo/surface/multi.py
MultiSurface.get_min_distance
def get_min_distance(self, mesh): """ For each point in ``mesh`` compute the minimum distance to each surface element and return the smallest value. See :meth:`superclass method <.base.BaseSurface.get_min_distance>` for spec of input and result values. """ ...
python
def get_min_distance(self, mesh): """ For each point in ``mesh`` compute the minimum distance to each surface element and return the smallest value. See :meth:`superclass method <.base.BaseSurface.get_min_distance>` for spec of input and result values. """ ...
['def', 'get_min_distance', '(', 'self', ',', 'mesh', ')', ':', 'dists', '=', '[', 'surf', '.', 'get_min_distance', '(', 'mesh', ')', 'for', 'surf', 'in', 'self', '.', 'surfaces', ']', 'return', 'numpy', '.', 'min', '(', 'dists', ',', 'axis', '=', '0', ')']
For each point in ``mesh`` compute the minimum distance to each surface element and return the smallest value. See :meth:`superclass method <.base.BaseSurface.get_min_distance>` for spec of input and result values.
['For', 'each', 'point', 'in', 'mesh', 'compute', 'the', 'minimum', 'distance', 'to', 'each', 'surface', 'element', 'and', 'return', 'the', 'smallest', 'value', '.']
train
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/surface/multi.py#L161-L172
6,578
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavutil.py
mavfile.set_relay
def set_relay(self, relay_pin=0, state=True): '''Set relay_pin to value of state''' if self.mavlink10(): self.mav.command_long_send( self.target_system, # target_system self.target_component, # target_component mavlink.MAV_CMD_DO_SET_RELAY, # ...
python
def set_relay(self, relay_pin=0, state=True): '''Set relay_pin to value of state''' if self.mavlink10(): self.mav.command_long_send( self.target_system, # target_system self.target_component, # target_component mavlink.MAV_CMD_DO_SET_RELAY, # ...
['def', 'set_relay', '(', 'self', ',', 'relay_pin', '=', '0', ',', 'state', '=', 'True', ')', ':', 'if', 'self', '.', 'mavlink10', '(', ')', ':', 'self', '.', 'mav', '.', 'command_long_send', '(', 'self', '.', 'target_system', ',', '# target_system', 'self', '.', 'target_component', ',', '# target_component', 'mavlink'...
Set relay_pin to value of state
['Set', 'relay_pin', 'to', 'value', 'of', 'state']
train
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavutil.py#L598-L614
6,579
pycampers/ampy
ampy/files.py
Files.rmdir
def rmdir(self, directory, missing_okay=False): """Forcefully remove the specified directory and all its children.""" # Build a script to walk an entire directory structure and delete every # file and subfolder. This is tricky because MicroPython has no os.walk # or similar function to ...
python
def rmdir(self, directory, missing_okay=False): """Forcefully remove the specified directory and all its children.""" # Build a script to walk an entire directory structure and delete every # file and subfolder. This is tricky because MicroPython has no os.walk # or similar function to ...
['def', 'rmdir', '(', 'self', ',', 'directory', ',', 'missing_okay', '=', 'False', ')', ':', '# Build a script to walk an entire directory structure and delete every', '# file and subfolder. This is tricky because MicroPython has no os.walk', '# or similar function to walk folders, so this code does it manually', '# w...
Forcefully remove the specified directory and all its children.
['Forcefully', 'remove', 'the', 'specified', 'directory', 'and', 'all', 'its', 'children', '.']
train
https://github.com/pycampers/ampy/blob/6851f8b177c334f5ff7bd43bf07307a437433ba2/ampy/files.py#L249-L292
6,580
bitcraze/crazyflie-lib-python
cflib/positioning/motion_commander.py
MotionCommander.land
def land(self, velocity=VELOCITY): """ Go straight down and turn off the motors. Do not call this function if you use the with keyword. Landing is done automatically when the context goes out of scope. :param velocity: The velocity (meters/second) when going down :retur...
python
def land(self, velocity=VELOCITY): """ Go straight down and turn off the motors. Do not call this function if you use the with keyword. Landing is done automatically when the context goes out of scope. :param velocity: The velocity (meters/second) when going down :retur...
['def', 'land', '(', 'self', ',', 'velocity', '=', 'VELOCITY', ')', ':', 'if', 'self', '.', '_is_flying', ':', 'self', '.', 'down', '(', 'self', '.', '_thread', '.', 'get_height', '(', ')', ',', 'velocity', ')', 'self', '.', '_thread', '.', 'stop', '(', ')', 'self', '.', '_thread', '=', 'None', 'self', '.', '_cf', '.',...
Go straight down and turn off the motors. Do not call this function if you use the with keyword. Landing is done automatically when the context goes out of scope. :param velocity: The velocity (meters/second) when going down :return:
['Go', 'straight', 'down', 'and', 'turn', 'off', 'the', 'motors', '.']
train
https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/positioning/motion_commander.py#L109-L126
6,581
disqus/disqus-python
disqusapi/utils.py
build_interfaces_by_method
def build_interfaces_by_method(interfaces): """ Create new dictionary from INTERFACES hashed by method then the endpoints name. For use when using the disqusapi by the method interface instead of the endpoint interface. For instance: 'blacklists': { 'add': { 'formats': ['jso...
python
def build_interfaces_by_method(interfaces): """ Create new dictionary from INTERFACES hashed by method then the endpoints name. For use when using the disqusapi by the method interface instead of the endpoint interface. For instance: 'blacklists': { 'add': { 'formats': ['jso...
['def', 'build_interfaces_by_method', '(', 'interfaces', ')', ':', 'def', 'traverse', '(', 'block', ',', 'parts', ')', ':', 'try', ':', 'method', '=', 'block', '[', "'method'", ']', '.', 'lower', '(', ')', 'except', 'KeyError', ':', 'for', 'k', ',', 'v', 'in', 'compat', '.', 'iteritems', '(', 'block', ')', ':', 'traver...
Create new dictionary from INTERFACES hashed by method then the endpoints name. For use when using the disqusapi by the method interface instead of the endpoint interface. For instance: 'blacklists': { 'add': { 'formats': ['json', 'jsonp'], 'method': 'POST', ...
['Create', 'new', 'dictionary', 'from', 'INTERFACES', 'hashed', 'by', 'method', 'then', 'the', 'endpoints', 'name', '.', 'For', 'use', 'when', 'using', 'the', 'disqusapi', 'by', 'the', 'method', 'interface', 'instead', 'of', 'the', 'endpoint', 'interface', '.', 'For', 'instance', ':']
train
https://github.com/disqus/disqus-python/blob/605f33c7b735fcb85e16041c27658fbba49d7a7b/disqusapi/utils.py#L8-L48
6,582
mpg-age-bioinformatics/AGEpy
AGEpy/bed.py
dfTObedtool
def dfTObedtool(df): """ Transforms a pandas dataframe into a bedtool :param df: Pandas dataframe :returns: a bedtool """ df=df.astype(str) df=df.drop_duplicates() df=df.values.tolist() df=["\t".join(s) for s in df ] df="\n".join(df) df=BedTool(df, from_string=True) re...
python
def dfTObedtool(df): """ Transforms a pandas dataframe into a bedtool :param df: Pandas dataframe :returns: a bedtool """ df=df.astype(str) df=df.drop_duplicates() df=df.values.tolist() df=["\t".join(s) for s in df ] df="\n".join(df) df=BedTool(df, from_string=True) re...
['def', 'dfTObedtool', '(', 'df', ')', ':', 'df', '=', 'df', '.', 'astype', '(', 'str', ')', 'df', '=', 'df', '.', 'drop_duplicates', '(', ')', 'df', '=', 'df', '.', 'values', '.', 'tolist', '(', ')', 'df', '=', '[', '"\\t"', '.', 'join', '(', 's', ')', 'for', 's', 'in', 'df', ']', 'df', '=', '"\\n"', '.', 'join', '(',...
Transforms a pandas dataframe into a bedtool :param df: Pandas dataframe :returns: a bedtool
['Transforms', 'a', 'pandas', 'dataframe', 'into', 'a', 'bedtool']
train
https://github.com/mpg-age-bioinformatics/AGEpy/blob/887808a7a2c1504f39ce8d8cb36c15c1721cd29f/AGEpy/bed.py#L55-L70
6,583
pandas-dev/pandas
pandas/io/sql.py
SQLDatabase.to_sql
def to_sql(self, frame, name, if_exists='fail', index=True, index_label=None, schema=None, chunksize=None, dtype=None, method=None): """ Write records stored in a DataFrame to a SQL database. Parameters ---------- frame : DataFrame name : st...
python
def to_sql(self, frame, name, if_exists='fail', index=True, index_label=None, schema=None, chunksize=None, dtype=None, method=None): """ Write records stored in a DataFrame to a SQL database. Parameters ---------- frame : DataFrame name : st...
['def', 'to_sql', '(', 'self', ',', 'frame', ',', 'name', ',', 'if_exists', '=', "'fail'", ',', 'index', '=', 'True', ',', 'index_label', '=', 'None', ',', 'schema', '=', 'None', ',', 'chunksize', '=', 'None', ',', 'dtype', '=', 'None', ',', 'method', '=', 'None', ')', ':', 'if', 'dtype', 'and', 'not', 'is_dict_like', ...
Write records stored in a DataFrame to a SQL database. Parameters ---------- frame : DataFrame name : string Name of SQL table. if_exists : {'fail', 'replace', 'append'}, default 'fail' - fail: If table exists, do nothing. - replace: If table ...
['Write', 'records', 'stored', 'in', 'a', 'DataFrame', 'to', 'a', 'SQL', 'database', '.']
train
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/sql.py#L1106-L1181
6,584
priestc/moneywagon
moneywagon/tx.py
Transaction._get_utxos
def _get_utxos(self, address, services, **modes): """ Using the service fallback engine, get utxos from remote service. """ return get_unspent_outputs( self.crypto, address, services=services, **modes )
python
def _get_utxos(self, address, services, **modes): """ Using the service fallback engine, get utxos from remote service. """ return get_unspent_outputs( self.crypto, address, services=services, **modes )
['def', '_get_utxos', '(', 'self', ',', 'address', ',', 'services', ',', '*', '*', 'modes', ')', ':', 'return', 'get_unspent_outputs', '(', 'self', '.', 'crypto', ',', 'address', ',', 'services', '=', 'services', ',', '*', '*', 'modes', ')']
Using the service fallback engine, get utxos from remote service.
['Using', 'the', 'service', 'fallback', 'engine', 'get', 'utxos', 'from', 'remote', 'service', '.']
train
https://github.com/priestc/moneywagon/blob/00518f1f557dcca8b3031f46d3564c2baa0227a3/moneywagon/tx.py#L58-L65
6,585
dadadel/pyment
pyment/docstring.py
DocsTools._get_options
def _get_options(self, style): """Get the list of keywords for a particular style :param style: the style that the keywords are wanted """ return [self.opt[o][style]['name'] for o in self.opt]
python
def _get_options(self, style): """Get the list of keywords for a particular style :param style: the style that the keywords are wanted """ return [self.opt[o][style]['name'] for o in self.opt]
['def', '_get_options', '(', 'self', ',', 'style', ')', ':', 'return', '[', 'self', '.', 'opt', '[', 'o', ']', '[', 'style', ']', '[', "'name'", ']', 'for', 'o', 'in', 'self', '.', 'opt', ']']
Get the list of keywords for a particular style :param style: the style that the keywords are wanted
['Get', 'the', 'list', 'of', 'keywords', 'for', 'a', 'particular', 'style']
train
https://github.com/dadadel/pyment/blob/3d1bdf87d083ff56230bd0bf7c5252e20552b7b6/pyment/docstring.py#L713-L719
6,586
acorg/dark-matter
dark/reads.py
Reads.save
def save(self, filename, format_='fasta'): """ Write the reads to C{filename} in the requested format. @param filename: Either a C{str} file name to save into (the file will be overwritten) or an open file descriptor (e.g., sys.stdout). @param format_: A C{str} format to sav...
python
def save(self, filename, format_='fasta'): """ Write the reads to C{filename} in the requested format. @param filename: Either a C{str} file name to save into (the file will be overwritten) or an open file descriptor (e.g., sys.stdout). @param format_: A C{str} format to sav...
['def', 'save', '(', 'self', ',', 'filename', ',', 'format_', '=', "'fasta'", ')', ':', 'format_', '=', 'format_', '.', 'lower', '(', ')', 'count', '=', '0', 'if', 'isinstance', '(', 'filename', ',', 'str', ')', ':', 'try', ':', 'with', 'open', '(', 'filename', ',', "'w'", ')', 'as', 'fp', ':', 'for', 'read', 'in', 'se...
Write the reads to C{filename} in the requested format. @param filename: Either a C{str} file name to save into (the file will be overwritten) or an open file descriptor (e.g., sys.stdout). @param format_: A C{str} format to save as, either 'fasta', 'fastq' or 'fasta-ss'. ...
['Write', 'the', 'reads', 'to', 'C', '{', 'filename', '}', 'in', 'the', 'requested', 'format', '.']
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/reads.py#L1323-L1352
6,587
aaronn/django-rest-framework-passwordless
drfpasswordless/utils.py
send_email_with_callback_token
def send_email_with_callback_token(user, email_token, **kwargs): """ Sends a Email to user.email. Passes silently without sending in test environment """ try: if api_settings.PASSWORDLESS_EMAIL_NOREPLY_ADDRESS: # Make sure we have a sending address before sending. ...
python
def send_email_with_callback_token(user, email_token, **kwargs): """ Sends a Email to user.email. Passes silently without sending in test environment """ try: if api_settings.PASSWORDLESS_EMAIL_NOREPLY_ADDRESS: # Make sure we have a sending address before sending. ...
['def', 'send_email_with_callback_token', '(', 'user', ',', 'email_token', ',', '*', '*', 'kwargs', ')', ':', 'try', ':', 'if', 'api_settings', '.', 'PASSWORDLESS_EMAIL_NOREPLY_ADDRESS', ':', '# Make sure we have a sending address before sending.', '# Get email subject and message', 'email_subject', '=', 'kwargs', '.',...
Sends a Email to user.email. Passes silently without sending in test environment
['Sends', 'a', 'Email', 'to', 'user', '.', 'email', '.']
train
https://github.com/aaronn/django-rest-framework-passwordless/blob/cd3f229cbc24de9c4b65768395ab5ba8ac1aaf1a/drfpasswordless/utils.py#L105-L145
6,588
pyQode/pyqode.core
pyqode/core/dialogs/goto.py
DlgGotoLine.get_line
def get_line(cls, parent, current_line, line_count): """ Gets user selected line. :param parent: Parent widget :param current_line: Current line number :param line_count: Number of lines in the current text document. :returns: tuple(line, status) status is False if the ...
python
def get_line(cls, parent, current_line, line_count): """ Gets user selected line. :param parent: Parent widget :param current_line: Current line number :param line_count: Number of lines in the current text document. :returns: tuple(line, status) status is False if the ...
['def', 'get_line', '(', 'cls', ',', 'parent', ',', 'current_line', ',', 'line_count', ')', ':', 'dlg', '=', 'DlgGotoLine', '(', 'parent', ',', 'current_line', '+', '1', ',', 'line_count', ')', 'if', 'dlg', '.', 'exec_', '(', ')', '==', 'dlg', '.', 'Accepted', ':', 'return', 'dlg', '.', 'spinBox', '.', 'value', '(', ')...
Gets user selected line. :param parent: Parent widget :param current_line: Current line number :param line_count: Number of lines in the current text document. :returns: tuple(line, status) status is False if the dialog has been rejected.
['Gets', 'user', 'selected', 'line', '.']
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/dialogs/goto.py#L28-L42
6,589
raphaelvallat/pingouin
pingouin/distribution.py
homoscedasticity
def homoscedasticity(*args, alpha=.05): """Test equality of variance. Parameters ---------- sample1, sample2,... : array_like Array of sample data. May be different lengths. Returns ------- equal_var : boolean True if data have equal variance. p : float P-value....
python
def homoscedasticity(*args, alpha=.05): """Test equality of variance. Parameters ---------- sample1, sample2,... : array_like Array of sample data. May be different lengths. Returns ------- equal_var : boolean True if data have equal variance. p : float P-value....
['def', 'homoscedasticity', '(', '*', 'args', ',', 'alpha', '=', '.05', ')', ':', 'from', 'scipy', '.', 'stats', 'import', 'levene', ',', 'bartlett', 'k', '=', 'len', '(', 'args', ')', 'if', 'k', '<', '2', ':', 'raise', 'ValueError', '(', '"Must enter at least two input sample vectors."', ')', '# Test normality of data...
Test equality of variance. Parameters ---------- sample1, sample2,... : array_like Array of sample data. May be different lengths. Returns ------- equal_var : boolean True if data have equal variance. p : float P-value. See Also -------- normality : Tes...
['Test', 'equality', 'of', 'variance', '.']
train
https://github.com/raphaelvallat/pingouin/blob/58b19fa4fffbfe09d58b456e3926a148249e4d9b/pingouin/distribution.py#L165-L271
6,590
hobson/pug-dj
pug/dj/db.py
make_choices
def make_choices(*args): """Convert a 1-D sequence into a 2-D sequence of tuples for use in a Django field choices attribute >>> make_choices(range(3)) ((0, u'0'), (1, u'1'), (2, u'2')) >>> make_choices(dict(enumerate('abcd'))) ((0, u'a'), (1, u'b'), (2, u'c'), (3, u'd')) >>> make_choices('hell...
python
def make_choices(*args): """Convert a 1-D sequence into a 2-D sequence of tuples for use in a Django field choices attribute >>> make_choices(range(3)) ((0, u'0'), (1, u'1'), (2, u'2')) >>> make_choices(dict(enumerate('abcd'))) ((0, u'a'), (1, u'b'), (2, u'c'), (3, u'd')) >>> make_choices('hell...
['def', 'make_choices', '(', '*', 'args', ')', ':', 'if', 'not', 'args', ':', 'return', 'tuple', '(', ')', 'if', 'isinstance', '(', 'args', '[', '0', ']', ',', '(', 'list', ',', 'tuple', ')', ')', ':', 'return', 'make_choices', '(', '*', 'tuple', '(', 'args', '[', '0', ']', ')', ')', 'elif', 'isinstance', '(', 'args', ...
Convert a 1-D sequence into a 2-D sequence of tuples for use in a Django field choices attribute >>> make_choices(range(3)) ((0, u'0'), (1, u'1'), (2, u'2')) >>> make_choices(dict(enumerate('abcd'))) ((0, u'a'), (1, u'b'), (2, u'c'), (3, u'd')) >>> make_choices('hello') (('hello', u'hello'),) ...
['Convert', 'a', '1', '-', 'D', 'sequence', 'into', 'a', '2', '-', 'D', 'sequence', 'of', 'tuples', 'for', 'use', 'in', 'a', 'Django', 'field', 'choices', 'attribute']
train
https://github.com/hobson/pug-dj/blob/55678b08755a55366ce18e7d3b8ea8fa4491ab04/pug/dj/db.py#L153-L172
6,591
praekeltfoundation/seed-stage-based-messaging
seed_stage_based_messaging/decorators.py
internal_only
def internal_only(view_func): """ A view decorator which blocks access for requests coming through the load balancer. """ @functools.wraps(view_func) def wrapper(request, *args, **kwargs): forwards = request.META.get("HTTP_X_FORWARDED_FOR", "").split(",") # The nginx in the docker c...
python
def internal_only(view_func): """ A view decorator which blocks access for requests coming through the load balancer. """ @functools.wraps(view_func) def wrapper(request, *args, **kwargs): forwards = request.META.get("HTTP_X_FORWARDED_FOR", "").split(",") # The nginx in the docker c...
['def', 'internal_only', '(', 'view_func', ')', ':', '@', 'functools', '.', 'wraps', '(', 'view_func', ')', 'def', 'wrapper', '(', 'request', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'forwards', '=', 'request', '.', 'META', '.', 'get', '(', '"HTTP_X_FORWARDED_FOR"', ',', '""', ')', '.', 'split', '(', '","',...
A view decorator which blocks access for requests coming through the load balancer.
['A', 'view', 'decorator', 'which', 'blocks', 'access', 'for', 'requests', 'coming', 'through', 'the', 'load', 'balancer', '.']
train
https://github.com/praekeltfoundation/seed-stage-based-messaging/blob/6f0cacf0727ac2ed19877de214d58009c685b8fa/seed_stage_based_messaging/decorators.py#L6-L21
6,592
mmp2/megaman
megaman/utils/validation.py
check_array
def check_array(array, accept_sparse=None, dtype="numeric", order=None, copy=False, force_all_finite=True, ensure_2d=True, allow_nd=False, ensure_min_samples=1, ensure_min_features=1, warn_on_dtype=False): """Input validation on an array, list, sparse matrix or simila...
python
def check_array(array, accept_sparse=None, dtype="numeric", order=None, copy=False, force_all_finite=True, ensure_2d=True, allow_nd=False, ensure_min_samples=1, ensure_min_features=1, warn_on_dtype=False): """Input validation on an array, list, sparse matrix or simila...
['def', 'check_array', '(', 'array', ',', 'accept_sparse', '=', 'None', ',', 'dtype', '=', '"numeric"', ',', 'order', '=', 'None', ',', 'copy', '=', 'False', ',', 'force_all_finite', '=', 'True', ',', 'ensure_2d', '=', 'True', ',', 'allow_nd', '=', 'False', ',', 'ensure_min_samples', '=', '1', ',', 'ensure_min_features...
Input validation on an array, list, sparse matrix or similar. By default, the input is converted to an at least 2nd numpy array. If the dtype of the array is object, attempt converting to float, raising on failure. Parameters ---------- array : object Input object to check / convert. ...
['Input', 'validation', 'on', 'an', 'array', 'list', 'sparse', 'matrix', 'or', 'similar', '.', 'By', 'default', 'the', 'input', 'is', 'converted', 'to', 'an', 'at', 'least', '2nd', 'numpy', 'array', '.', 'If', 'the', 'dtype', 'of', 'the', 'array', 'is', 'object', 'attempt', 'converting', 'to', 'float', 'raising', 'on',...
train
https://github.com/mmp2/megaman/blob/faccaf267aad0a8b18ec8a705735fd9dd838ca1e/megaman/utils/validation.py#L210-L339
6,593
MichaelAquilina/hashedindex
hashedindex/textparser.py
word_tokenize
def word_tokenize(text, stopwords=_stopwords, ngrams=None, min_length=0, ignore_numeric=True): """ Parses the given text and yields tokens which represent words within the given text. Tokens are assumed to be divided by any form of whitespace character. """ if ngrams is None: ngrams = 1 ...
python
def word_tokenize(text, stopwords=_stopwords, ngrams=None, min_length=0, ignore_numeric=True): """ Parses the given text and yields tokens which represent words within the given text. Tokens are assumed to be divided by any form of whitespace character. """ if ngrams is None: ngrams = 1 ...
['def', 'word_tokenize', '(', 'text', ',', 'stopwords', '=', '_stopwords', ',', 'ngrams', '=', 'None', ',', 'min_length', '=', '0', ',', 'ignore_numeric', '=', 'True', ')', ':', 'if', 'ngrams', 'is', 'None', ':', 'ngrams', '=', '1', 'text', '=', 're', '.', 'sub', '(', 're', '.', 'compile', '(', "'\\'s'", ')', ',', "''"...
Parses the given text and yields tokens which represent words within the given text. Tokens are assumed to be divided by any form of whitespace character.
['Parses', 'the', 'given', 'text', 'and', 'yields', 'tokens', 'which', 'represent', 'words', 'within', 'the', 'given', 'text', '.', 'Tokens', 'are', 'assumed', 'to', 'be', 'divided', 'by', 'any', 'form', 'of', 'whitespace', 'character', '.']
train
https://github.com/MichaelAquilina/hashedindex/blob/5a84dcd6c697ea04162cf7b2683fa2723845b51c/hashedindex/textparser.py#L67-L89
6,594
nikdon/pyEntropy
pyentrp/entropy.py
util_granulate_time_series
def util_granulate_time_series(time_series, scale): """Extract coarse-grained time series Args: time_series: Time series scale: Scale factor Returns: Vector of coarse-grained time series with given scale factor """ n = len(time_series) b = int(np.fix(n / scale)) tem...
python
def util_granulate_time_series(time_series, scale): """Extract coarse-grained time series Args: time_series: Time series scale: Scale factor Returns: Vector of coarse-grained time series with given scale factor """ n = len(time_series) b = int(np.fix(n / scale)) tem...
['def', 'util_granulate_time_series', '(', 'time_series', ',', 'scale', ')', ':', 'n', '=', 'len', '(', 'time_series', ')', 'b', '=', 'int', '(', 'np', '.', 'fix', '(', 'n', '/', 'scale', ')', ')', 'temp', '=', 'np', '.', 'reshape', '(', 'time_series', '[', '0', ':', 'b', '*', 'scale', ']', ',', '(', 'b', ',', 'scale',...
Extract coarse-grained time series Args: time_series: Time series scale: Scale factor Returns: Vector of coarse-grained time series with given scale factor
['Extract', 'coarse', '-', 'grained', 'time', 'series']
train
https://github.com/nikdon/pyEntropy/blob/ae2bf71c2e5b6edb2e468ff52183b30acf7073e6/pyentrp/entropy.py#L64-L78
6,595
fermiPy/fermipy
fermipy/spectrum.py
SpectralFunction._integrate
def _integrate(cls, fn, emin, emax, params, scale=1.0, extra_params=None, npt=20): """Fast numerical integration method using mid-point rule.""" emin = np.expand_dims(emin, -1) emax = np.expand_dims(emax, -1) params = copy.deepcopy(params) for i, p in enumera...
python
def _integrate(cls, fn, emin, emax, params, scale=1.0, extra_params=None, npt=20): """Fast numerical integration method using mid-point rule.""" emin = np.expand_dims(emin, -1) emax = np.expand_dims(emax, -1) params = copy.deepcopy(params) for i, p in enumera...
['def', '_integrate', '(', 'cls', ',', 'fn', ',', 'emin', ',', 'emax', ',', 'params', ',', 'scale', '=', '1.0', ',', 'extra_params', '=', 'None', ',', 'npt', '=', '20', ')', ':', 'emin', '=', 'np', '.', 'expand_dims', '(', 'emin', ',', '-', '1', ')', 'emax', '=', 'np', '.', 'expand_dims', '(', 'emax', ',', '-', '1', ')...
Fast numerical integration method using mid-point rule.
['Fast', 'numerical', 'integration', 'method', 'using', 'mid', '-', 'point', 'rule', '.']
train
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/spectrum.py#L230-L246
6,596
wavefrontHQ/python-client
wavefront_api_client/api/user_api.py
UserApi.remove_user_from_user_groups
def remove_user_from_user_groups(self, id, **kwargs): # noqa: E501 """Removes specific user groups from the user # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = a...
python
def remove_user_from_user_groups(self, id, **kwargs): # noqa: E501 """Removes specific user groups from the user # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = a...
['def', 'remove_user_from_user_groups', '(', 'self', ',', 'id', ',', '*', '*', 'kwargs', ')', ':', '# noqa: E501', 'kwargs', '[', "'_return_http_data_only'", ']', '=', 'True', 'if', 'kwargs', '.', 'get', '(', "'async_req'", ')', ':', 'return', 'self', '.', 'remove_user_from_user_groups_with_http_info', '(', 'id', ',', ...
Removes specific user groups from the user # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.remove_user_from_user_groups(id, async_req=True) >>> result = thread...
['Removes', 'specific', 'user', 'groups', 'from', 'the', 'user', '#', 'noqa', ':', 'E501']
train
https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/api/user_api.py#L911-L932
6,597
mmp2/megaman
megaman/utils/k_means_clustering.py
get_centroids
def get_centroids(data,k,labels,centroids,data_norms): """ For each element in the dataset, choose the closest centroid Parameters ------------ data: array-like, shape= (m_samples,n_samples) K: integer, number of K clusters centroids: array-like, shape=(K, n_samples) labels: ...
python
def get_centroids(data,k,labels,centroids,data_norms): """ For each element in the dataset, choose the closest centroid Parameters ------------ data: array-like, shape= (m_samples,n_samples) K: integer, number of K clusters centroids: array-like, shape=(K, n_samples) labels: ...
['def', 'get_centroids', '(', 'data', ',', 'k', ',', 'labels', ',', 'centroids', ',', 'data_norms', ')', ':', 'D', '=', 'data', '.', 'shape', '[', '1', ']', 'for', 'j', 'in', 'range', '(', 'k', ')', ':', 'cluster_points', '=', 'np', '.', 'where', '(', 'labels', '==', 'j', ')', 'cluster_total', '=', 'len', '(', 'cluster...
For each element in the dataset, choose the closest centroid Parameters ------------ data: array-like, shape= (m_samples,n_samples) K: integer, number of K clusters centroids: array-like, shape=(K, n_samples) labels: array-like, shape (1,n_samples) returns ------------- c...
['For', 'each', 'element', 'in', 'the', 'dataset', 'choose', 'the', 'closest', 'centroid', 'Parameters', '------------', 'data', ':', 'array', '-', 'like', 'shape', '=', '(', 'm_samples', 'n_samples', ')', 'K', ':', 'integer', 'number', 'of', 'K', 'clusters', 'centroids', ':', 'array', '-', 'like', 'shape', '=', '(', '...
train
https://github.com/mmp2/megaman/blob/faccaf267aad0a8b18ec8a705735fd9dd838ca1e/megaman/utils/k_means_clustering.py#L121-L145
6,598
saltstack/salt
salt/modules/influxdbmod.py
revoke_admin_privileges
def revoke_admin_privileges(name, **client_args): ''' Revoke cluster administration privileges from a user. name Name of the user from whom admin privileges will be revoked. CLI Example: .. code-block:: bash salt '*' influxdb.revoke_admin_privileges <name> ''' client = _c...
python
def revoke_admin_privileges(name, **client_args): ''' Revoke cluster administration privileges from a user. name Name of the user from whom admin privileges will be revoked. CLI Example: .. code-block:: bash salt '*' influxdb.revoke_admin_privileges <name> ''' client = _c...
['def', 'revoke_admin_privileges', '(', 'name', ',', '*', '*', 'client_args', ')', ':', 'client', '=', '_client', '(', '*', '*', 'client_args', ')', 'client', '.', 'revoke_admin_privileges', '(', 'name', ')', 'return', 'True']
Revoke cluster administration privileges from a user. name Name of the user from whom admin privileges will be revoked. CLI Example: .. code-block:: bash salt '*' influxdb.revoke_admin_privileges <name>
['Revoke', 'cluster', 'administration', 'privileges', 'from', 'a', 'user', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/influxdbmod.py#L292-L308
6,599
adrienverge/yamllint
yamllint/rules/common.py
get_real_end_line
def get_real_end_line(token): """Finds the line on which the token really ends. With pyyaml, scalar tokens often end on a next line. """ end_line = token.end_mark.line + 1 if not isinstance(token, yaml.ScalarToken): return end_line pos = token.end_mark.pointer - 1 while (pos >= to...
python
def get_real_end_line(token): """Finds the line on which the token really ends. With pyyaml, scalar tokens often end on a next line. """ end_line = token.end_mark.line + 1 if not isinstance(token, yaml.ScalarToken): return end_line pos = token.end_mark.pointer - 1 while (pos >= to...
['def', 'get_real_end_line', '(', 'token', ')', ':', 'end_line', '=', 'token', '.', 'end_mark', '.', 'line', '+', '1', 'if', 'not', 'isinstance', '(', 'token', ',', 'yaml', '.', 'ScalarToken', ')', ':', 'return', 'end_line', 'pos', '=', 'token', '.', 'end_mark', '.', 'pointer', '-', '1', 'while', '(', 'pos', '>=', 'tok...
Finds the line on which the token really ends. With pyyaml, scalar tokens often end on a next line.
['Finds', 'the', 'line', 'on', 'which', 'the', 'token', 'really', 'ends', '.']
train
https://github.com/adrienverge/yamllint/blob/fec2c2fba736cabf6bee6b5eeb905cab0dc820f6/yamllint/rules/common.py#L61-L77