Unnamed: 0
int64
0
10k
repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
5
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
100
30.3k
language
stringclasses
1 value
func_code_string
stringlengths
100
30.3k
func_code_tokens
stringlengths
138
33.2k
func_documentation_string
stringlengths
1
15k
func_documentation_tokens
stringlengths
5
5.14k
split_name
stringclasses
1 value
func_code_url
stringlengths
91
315
3,800
OSSOS/MOP
src/ossos/plotting/scripts/plot_aq.py
parse_nate_sims
def parse_nate_sims(path): ''' parts0.dat) contains the id number, particle fraction (ignore) a, ecc, inc, long. asc., arg. per, and mean anomaly for every particle in the simulation at t=0. The second (parts3999.dat) contains the same info at t=3.999 Gyrs for these particles. :return: ''' ...
python
def parse_nate_sims(path): ''' parts0.dat) contains the id number, particle fraction (ignore) a, ecc, inc, long. asc., arg. per, and mean anomaly for every particle in the simulation at t=0. The second (parts3999.dat) contains the same info at t=3.999 Gyrs for these particles. :return: ''' ...
['def', 'parse_nate_sims', '(', 'path', ')', ':', 'zerostate', '=', 'pandas', '.', 'read_table', '(', 'path', '+', "'parts0.dat'", ',', 'delim_whitespace', '=', 'True', ')', 'endstate', '=', 'pandas', '.', 'read_table', '(', 'path', '+', "'parts3999.dat'", ',', 'delim_whitespace', '=', 'True', ')', '# add perihelion', ...
parts0.dat) contains the id number, particle fraction (ignore) a, ecc, inc, long. asc., arg. per, and mean anomaly for every particle in the simulation at t=0. The second (parts3999.dat) contains the same info at t=3.999 Gyrs for these particles. :return:
['parts0', '.', 'dat', ')', 'contains', 'the', 'id', 'number', 'particle', 'fraction', '(', 'ignore', ')', 'a', 'ecc', 'inc', 'long', '.', 'asc', '.', 'arg', '.', 'per', 'and', 'mean', 'anomaly', 'for', 'every', 'particle', 'in', 'the', 'simulation', 'at', 't', '=', '0', '.', 'The', 'second', '(', 'parts3999', '.', 'da...
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/plotting/scripts/plot_aq.py#L17-L32
3,801
scottjbarr/bitfinex
bitfinex/client.py
Client.order_book
def order_book(self, symbol, parameters=None): """ curl "https://api.bitfinex.com/v1/book/btcusd" {"bids":[{"price":"561.1101","amount":"0.985","timestamp":"1395557729.0"}],"asks":[{"price":"562.9999","amount":"0.985","timestamp":"1395557711.0"}]} The 'bids' and 'asks' arrays will have...
python
def order_book(self, symbol, parameters=None): """ curl "https://api.bitfinex.com/v1/book/btcusd" {"bids":[{"price":"561.1101","amount":"0.985","timestamp":"1395557729.0"}],"asks":[{"price":"562.9999","amount":"0.985","timestamp":"1395557711.0"}]} The 'bids' and 'asks' arrays will have...
['def', 'order_book', '(', 'self', ',', 'symbol', ',', 'parameters', '=', 'None', ')', ':', 'data', '=', 'self', '.', '_get', '(', 'self', '.', 'url_for', '(', 'PATH_ORDERBOOK', ',', 'path_arg', '=', 'symbol', ',', 'parameters', '=', 'parameters', ')', ')', 'for', 'type_', 'in', 'data', '.', 'keys', '(', ')', ':', 'for...
curl "https://api.bitfinex.com/v1/book/btcusd" {"bids":[{"price":"561.1101","amount":"0.985","timestamp":"1395557729.0"}],"asks":[{"price":"562.9999","amount":"0.985","timestamp":"1395557711.0"}]} The 'bids' and 'asks' arrays will have multiple bid and ask dicts. Optional parameters ...
['curl', 'https', ':', '//', 'api', '.', 'bitfinex', '.', 'com', '/', 'v1', '/', 'book', '/', 'btcusd']
train
https://github.com/scottjbarr/bitfinex/blob/03f7c71615fe38c2e28be0ebb761d3106ef0a51a/bitfinex/client.py#L469-L494
3,802
pypa/pipenv
pipenv/vendor/dotenv/environ.py
_cast_boolean
def _cast_boolean(value): """ Helper to convert config values to boolean as ConfigParser do. """ _BOOLEANS = {'1': True, 'yes': True, 'true': True, 'on': True, '0': False, 'no': False, 'false': False, 'off': False, '': False} value = str(value) if value.lower() not in _BOOLEANS:...
python
def _cast_boolean(value): """ Helper to convert config values to boolean as ConfigParser do. """ _BOOLEANS = {'1': True, 'yes': True, 'true': True, 'on': True, '0': False, 'no': False, 'false': False, 'off': False, '': False} value = str(value) if value.lower() not in _BOOLEANS:...
['def', '_cast_boolean', '(', 'value', ')', ':', '_BOOLEANS', '=', '{', "'1'", ':', 'True', ',', "'yes'", ':', 'True', ',', "'true'", ':', 'True', ',', "'on'", ':', 'True', ',', "'0'", ':', 'False', ',', "'no'", ':', 'False', ',', "'false'", ':', 'False', ',', "'off'", ':', 'False', ',', "''", ':', 'False', '}', 'value...
Helper to convert config values to boolean as ConfigParser do.
['Helper', 'to', 'convert', 'config', 'values', 'to', 'boolean', 'as', 'ConfigParser', 'do', '.']
train
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/environ.py#L17-L27
3,803
StackStorm/pybind
pybind/nos/v7_2_0/__init__.py
brocade_vswitch._set_vcenter
def _set_vcenter(self, v, load=False): """ Setter method for vcenter, mapped from YANG variable /vcenter (list) If this variable is read-only (config: false) in the source YANG file, then _set_vcenter is considered as a private method. Backends looking to populate this variable should do so via ...
python
def _set_vcenter(self, v, load=False): """ Setter method for vcenter, mapped from YANG variable /vcenter (list) If this variable is read-only (config: false) in the source YANG file, then _set_vcenter is considered as a private method. Backends looking to populate this variable should do so via ...
['def', '_set_vcenter', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'YANGListType', '(', '"id"', ',', 'vcenter', '.', 'vcenter', ',', 'yang...
Setter method for vcenter, mapped from YANG variable /vcenter (list) If this variable is read-only (config: false) in the source YANG file, then _set_vcenter is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_vcenter() directly. YANG ...
['Setter', 'method', 'for', 'vcenter', 'mapped', 'from', 'YANG', 'variable', '/', 'vcenter', '(', 'list', ')', 'If', 'this', 'variable', 'is', 'read', '-', 'only', '(', 'config', ':', 'false', ')', 'in', 'the', 'source', 'YANG', 'file', 'then', '_set_vcenter', 'is', 'considered', 'as', 'a', 'private', 'method', '.', 'B...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v7_2_0/__init__.py#L4868-L4891
3,804
theislab/anndata
anndata/base.py
AnnData._to_dict_fixed_width_arrays
def _to_dict_fixed_width_arrays(self, var_len_str=True): """A dict of arrays that stores data and annotation. It is sufficient for reconstructing the object. """ self.strings_to_categoricals() obs_rec, uns_obs = df_to_records_fixed_width(self._obs, var_len_str) var_rec, ...
python
def _to_dict_fixed_width_arrays(self, var_len_str=True): """A dict of arrays that stores data and annotation. It is sufficient for reconstructing the object. """ self.strings_to_categoricals() obs_rec, uns_obs = df_to_records_fixed_width(self._obs, var_len_str) var_rec, ...
['def', '_to_dict_fixed_width_arrays', '(', 'self', ',', 'var_len_str', '=', 'True', ')', ':', 'self', '.', 'strings_to_categoricals', '(', ')', 'obs_rec', ',', 'uns_obs', '=', 'df_to_records_fixed_width', '(', 'self', '.', '_obs', ',', 'var_len_str', ')', 'var_rec', ',', 'uns_var', '=', 'df_to_records_fixed_width', '(...
A dict of arrays that stores data and annotation. It is sufficient for reconstructing the object.
['A', 'dict', 'of', 'arrays', 'that', 'stores', 'data', 'and', 'annotation', '.']
train
https://github.com/theislab/anndata/blob/34f4eb63710628fbc15e7050e5efcac1d7806062/anndata/base.py#L2239-L2266
3,805
twisted/txacme
src/txacme/client.py
Client._check_regr
def _check_regr(self, regr, new_reg): """ Check that a registration response contains the registration we were expecting. """ body = getattr(new_reg, 'body', new_reg) for k, v in body.items(): if k == 'resource' or not v: continue i...
python
def _check_regr(self, regr, new_reg): """ Check that a registration response contains the registration we were expecting. """ body = getattr(new_reg, 'body', new_reg) for k, v in body.items(): if k == 'resource' or not v: continue i...
['def', '_check_regr', '(', 'self', ',', 'regr', ',', 'new_reg', ')', ':', 'body', '=', 'getattr', '(', 'new_reg', ',', "'body'", ',', 'new_reg', ')', 'for', 'k', ',', 'v', 'in', 'body', '.', 'items', '(', ')', ':', 'if', 'k', '==', "'resource'", 'or', 'not', 'v', ':', 'continue', 'if', 'regr', '.', 'body', '[', 'k', '...
Check that a registration response contains the registration we were expecting.
['Check', 'that', 'a', 'registration', 'response', 'contains', 'the', 'registration', 'we', 'were', 'expecting', '.']
train
https://github.com/twisted/txacme/blob/9478381cc63c6d53d14bf8db8407c923f472989a/src/txacme/client.py#L253-L266
3,806
signetlabdei/sem
sem/manager.py
CampaignManager.save_to_folders
def save_to_folders(self, parameter_space, folder_name, runs): """ Save results to a folder structure. """ self.space_to_folders(self.db.get_results(), {}, parameter_space, runs, folder_name)
python
def save_to_folders(self, parameter_space, folder_name, runs): """ Save results to a folder structure. """ self.space_to_folders(self.db.get_results(), {}, parameter_space, runs, folder_name)
['def', 'save_to_folders', '(', 'self', ',', 'parameter_space', ',', 'folder_name', ',', 'runs', ')', ':', 'self', '.', 'space_to_folders', '(', 'self', '.', 'db', '.', 'get_results', '(', ')', ',', '{', '}', ',', 'parameter_space', ',', 'runs', ',', 'folder_name', ')']
Save results to a folder structure.
['Save', 'results', 'to', 'a', 'folder', 'structure', '.']
train
https://github.com/signetlabdei/sem/blob/5077dd7a6d15644a18790bb6fde320e905f0fef0/sem/manager.py#L432-L437
3,807
twilio/twilio-python
twilio/rest/studio/v1/flow/engagement/step/__init__.py
StepContext.step_context
def step_context(self): """ Access the step_context :returns: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextList :rtype: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextList """ if self._step_context is None: self._step...
python
def step_context(self): """ Access the step_context :returns: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextList :rtype: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextList """ if self._step_context is None: self._step...
['def', 'step_context', '(', 'self', ')', ':', 'if', 'self', '.', '_step_context', 'is', 'None', ':', 'self', '.', '_step_context', '=', 'StepContextList', '(', 'self', '.', '_version', ',', 'flow_sid', '=', 'self', '.', '_solution', '[', "'flow_sid'", ']', ',', 'engagement_sid', '=', 'self', '.', '_solution', '[', "'e...
Access the step_context :returns: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextList :rtype: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextList
['Access', 'the', 'step_context']
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/studio/v1/flow/engagement/step/__init__.py#L255-L269
3,808
litl/rauth
rauth/oauth.py
RsaSha1Signature.sign
def sign(self, consumer_secret, access_token_secret, method, url, oauth_params, req_kwargs): '''Sign request parameters. :param consumer_secret: RSA private key. :type consumer_secret: str or RSA._RSAobj :para...
python
def sign(self, consumer_secret, access_token_secret, method, url, oauth_params, req_kwargs): '''Sign request parameters. :param consumer_secret: RSA private key. :type consumer_secret: str or RSA._RSAobj :para...
['def', 'sign', '(', 'self', ',', 'consumer_secret', ',', 'access_token_secret', ',', 'method', ',', 'url', ',', 'oauth_params', ',', 'req_kwargs', ')', ':', 'url', '=', 'self', '.', '_remove_qs', '(', 'url', ')', 'oauth_params', '=', 'self', '.', '_normalize_request_parameters', '(', 'oauth_params', ',', 'req_kwargs',...
Sign request parameters. :param consumer_secret: RSA private key. :type consumer_secret: str or RSA._RSAobj :param access_token_secret: Unused. :type access_token_secret: str :param method: The method of this particular request. :type method: str :param url: The ...
['Sign', 'request', 'parameters', '.']
train
https://github.com/litl/rauth/blob/a6d887d7737cf21ec896a8104f25c2754c694011/rauth/oauth.py#L176-L221
3,809
pytroll/pyspectral
rsr_convert_scripts/seviri_rsr.py
get_central_wave
def get_central_wave(wavl, resp): """Calculate the central wavelength or the central wavenumber, depending on what is input """ return np.trapz(resp * wavl, wavl) / np.trapz(resp, wavl)
python
def get_central_wave(wavl, resp): """Calculate the central wavelength or the central wavenumber, depending on what is input """ return np.trapz(resp * wavl, wavl) / np.trapz(resp, wavl)
['def', 'get_central_wave', '(', 'wavl', ',', 'resp', ')', ':', 'return', 'np', '.', 'trapz', '(', 'resp', '*', 'wavl', ',', 'wavl', ')', '/', 'np', '.', 'trapz', '(', 'resp', ',', 'wavl', ')']
Calculate the central wavelength or the central wavenumber, depending on what is input
['Calculate', 'the', 'central', 'wavelength', 'or', 'the', 'central', 'wavenumber', 'depending', 'on', 'what', 'is', 'input']
train
https://github.com/pytroll/pyspectral/blob/fd296c0e0bdf5364fa180134a1292665d6bc50a3/rsr_convert_scripts/seviri_rsr.py#L215-L219
3,810
genialis/resolwe
resolwe/rest/projection.py
apply_subfield_projection
def apply_subfield_projection(field, value, deep=False): """Apply projection from request context. The passed dictionary may be mutated. :param field: An instance of `Field` or `Serializer` :type field: `Field` or `Serializer` :param value: Dictionary to apply the projection to :type value: di...
python
def apply_subfield_projection(field, value, deep=False): """Apply projection from request context. The passed dictionary may be mutated. :param field: An instance of `Field` or `Serializer` :type field: `Field` or `Serializer` :param value: Dictionary to apply the projection to :type value: di...
['def', 'apply_subfield_projection', '(', 'field', ',', 'value', ',', 'deep', '=', 'False', ')', ':', '# Discover the root manually. We cannot use either `self.root` or `self.context`', '# due to a bug with incorrect caching (see DRF issue #5087).', 'prefix', '=', '[', ']', 'root', '=', 'field', 'while', 'root', '.', '...
Apply projection from request context. The passed dictionary may be mutated. :param field: An instance of `Field` or `Serializer` :type field: `Field` or `Serializer` :param value: Dictionary to apply the projection to :type value: dict :param deep: Also process all deep projections :type ...
['Apply', 'projection', 'from', 'request', 'context', '.']
train
https://github.com/genialis/resolwe/blob/f7bb54932c81ec0cfc5b5e80d238fceaeaa48d86/resolwe/rest/projection.py#L8-L64
3,811
log2timeline/dfvfs
dfvfs/vfs/tsk_file_entry.py
TSKFileEntry.GetLinkedFileEntry
def GetLinkedFileEntry(self): """Retrieves the linked file entry, e.g. for a symbolic link. Returns: TSKFileEntry: linked file entry or None. """ link = self._GetLink() if not link: return None # TODO: is there a way to determine the link inode number here? link_inode = None ...
python
def GetLinkedFileEntry(self): """Retrieves the linked file entry, e.g. for a symbolic link. Returns: TSKFileEntry: linked file entry or None. """ link = self._GetLink() if not link: return None # TODO: is there a way to determine the link inode number here? link_inode = None ...
['def', 'GetLinkedFileEntry', '(', 'self', ')', ':', 'link', '=', 'self', '.', '_GetLink', '(', ')', 'if', 'not', 'link', ':', 'return', 'None', '# TODO: is there a way to determine the link inode number here?', 'link_inode', '=', 'None', 'parent_path_spec', '=', 'getattr', '(', 'self', '.', 'path_spec', ',', "'parent'...
Retrieves the linked file entry, e.g. for a symbolic link. Returns: TSKFileEntry: linked file entry or None.
['Retrieves', 'the', 'linked', 'file', 'entry', 'e', '.', 'g', '.', 'for', 'a', 'symbolic', 'link', '.']
train
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/vfs/tsk_file_entry.py#L813-L837
3,812
lrq3000/pyFileFixity
pyFileFixity/lib/brownanrs/rs.py
RSCoder._forney
def _forney(self, omega, X): '''Computes the error magnitudes. Works also with erasures and errors+erasures beyond the (n-k)//2 bound, here the bound is 2*e+v <= (n-k-1) with e the number of errors and v the number of erasures.''' # XXX Is floor division okay here? Should this be ceiling? Y = [...
python
def _forney(self, omega, X): '''Computes the error magnitudes. Works also with erasures and errors+erasures beyond the (n-k)//2 bound, here the bound is 2*e+v <= (n-k-1) with e the number of errors and v the number of erasures.''' # XXX Is floor division okay here? Should this be ceiling? Y = [...
['def', '_forney', '(', 'self', ',', 'omega', ',', 'X', ')', ':', '# XXX Is floor division okay here? Should this be ceiling?', 'Y', '=', '[', ']', '# the final result, the error/erasures polynomial (contain the values that we should minus on the received message to get the repaired message)', 'Xlength', '=', 'len', '(...
Computes the error magnitudes. Works also with erasures and errors+erasures beyond the (n-k)//2 bound, here the bound is 2*e+v <= (n-k-1) with e the number of errors and v the number of erasures.
['Computes', 'the', 'error', 'magnitudes', '.', 'Works', 'also', 'with', 'erasures', 'and', 'errors', '+', 'erasures', 'beyond', 'the', '(', 'n', '-', 'k', ')', '//', '2', 'bound', 'here', 'the', 'bound', 'is', '2', '*', 'e', '+', 'v', '<', '=', '(', 'n', '-', 'k', '-', '1', ')', 'with', 'e', 'the', 'number', 'of', 'er...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/brownanrs/rs.py#L920-L946
3,813
openthread/openthread
tools/harness-thci/OpenThread.py
OpenThread.__convertIp6PrefixStringToIp6Address
def __convertIp6PrefixStringToIp6Address(self, strIp6Prefix): """convert IPv6 prefix string to IPv6 dotted-quad format for example: 2001000000000000 -> 2001:: Args: strIp6Prefix: IPv6 address string Returns: IPv6 address dotted-quad format ...
python
def __convertIp6PrefixStringToIp6Address(self, strIp6Prefix): """convert IPv6 prefix string to IPv6 dotted-quad format for example: 2001000000000000 -> 2001:: Args: strIp6Prefix: IPv6 address string Returns: IPv6 address dotted-quad format ...
['def', '__convertIp6PrefixStringToIp6Address', '(', 'self', ',', 'strIp6Prefix', ')', ':', 'prefix1', '=', 'strIp6Prefix', '.', 'rstrip', '(', "'L'", ')', 'prefix2', '=', 'prefix1', '.', 'lstrip', '(', '"0x"', ')', 'hexPrefix', '=', 'str', '(', 'prefix2', ')', '.', 'ljust', '(', '16', ',', "'0'", ')', 'hexIter', '=', ...
convert IPv6 prefix string to IPv6 dotted-quad format for example: 2001000000000000 -> 2001:: Args: strIp6Prefix: IPv6 address string Returns: IPv6 address dotted-quad format
['convert', 'IPv6', 'prefix', 'string', 'to', 'IPv6', 'dotted', '-', 'quad', 'format', 'for', 'example', ':', '2001000000000000', '-', '>', '2001', '::']
train
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L485-L503
3,814
instacart/jardin
jardin/model.py
Model.find
def find(self, id, **kwargs): """ Finds a record by its id in the model's table in the replica database. :returns: an instance of the model. """ return self.find_by(values={self.primary_key: id}, **kwargs)
python
def find(self, id, **kwargs): """ Finds a record by its id in the model's table in the replica database. :returns: an instance of the model. """ return self.find_by(values={self.primary_key: id}, **kwargs)
['def', 'find', '(', 'self', ',', 'id', ',', '*', '*', 'kwargs', ')', ':', 'return', 'self', '.', 'find_by', '(', 'values', '=', '{', 'self', '.', 'primary_key', ':', 'id', '}', ',', '*', '*', 'kwargs', ')']
Finds a record by its id in the model's table in the replica database. :returns: an instance of the model.
['Finds', 'a', 'record', 'by', 'its', 'id', 'in', 'the', 'model', 's', 'table', 'in', 'the', 'replica', 'database', '.', ':', 'returns', ':', 'an', 'instance', 'of', 'the', 'model', '.']
train
https://github.com/instacart/jardin/blob/007e283b9ccd621b60b86679148cacd9eab7c4e3/jardin/model.py#L426-L431
3,815
StellarCN/py-stellar-base
stellar_base/operation.py
Payment.to_xdr_object
def to_xdr_object(self): """Creates an XDR Operation object that represents this :class:`Payment`. """ asset = self.asset.to_xdr_object() destination = account_xdr_object(self.destination) amount = Operation.to_xdr_amount(self.amount) payment_op = Xdr.types.Pay...
python
def to_xdr_object(self): """Creates an XDR Operation object that represents this :class:`Payment`. """ asset = self.asset.to_xdr_object() destination = account_xdr_object(self.destination) amount = Operation.to_xdr_amount(self.amount) payment_op = Xdr.types.Pay...
['def', 'to_xdr_object', '(', 'self', ')', ':', 'asset', '=', 'self', '.', 'asset', '.', 'to_xdr_object', '(', ')', 'destination', '=', 'account_xdr_object', '(', 'self', '.', 'destination', ')', 'amount', '=', 'Operation', '.', 'to_xdr_amount', '(', 'self', '.', 'amount', ')', 'payment_op', '=', 'Xdr', '.', 'types', '...
Creates an XDR Operation object that represents this :class:`Payment`.
['Creates', 'an', 'XDR', 'Operation', 'object', 'that', 'represents', 'this', ':', 'class', ':', 'Payment', '.']
train
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/operation.py#L265-L278
3,816
ministryofjustice/money-to-prisoners-common
mtp_common/build_tasks/executor.py
Context.shell
def shell(self, command, *args, environment=None): """ Runs a shell command """ command += ' ' + ' '.join(args) command = command.strip() self.debug(self.yellow_style('$ %s' % command)) env = self.env.copy() env.update(environment or {}) return sub...
python
def shell(self, command, *args, environment=None): """ Runs a shell command """ command += ' ' + ' '.join(args) command = command.strip() self.debug(self.yellow_style('$ %s' % command)) env = self.env.copy() env.update(environment or {}) return sub...
['def', 'shell', '(', 'self', ',', 'command', ',', '*', 'args', ',', 'environment', '=', 'None', ')', ':', 'command', '+=', "' '", '+', "' '", '.', 'join', '(', 'args', ')', 'command', '=', 'command', '.', 'strip', '(', ')', 'self', '.', 'debug', '(', 'self', '.', 'yellow_style', '(', "'$ %s'", '%', 'command', ')', ')'...
Runs a shell command
['Runs', 'a', 'shell', 'command']
train
https://github.com/ministryofjustice/money-to-prisoners-common/blob/33c43a2912cb990d9148da7c8718f480f07d90a1/mtp_common/build_tasks/executor.py#L434-L443
3,817
serhatbolsu/robotframework-appiumlibrary
AppiumLibrary/keywords/_applicationmanagement.py
_ApplicationManagementKeywords.log_source
def log_source(self, loglevel='INFO'): """Logs and returns the entire html source of the current page or frame. The `loglevel` argument defines the used log level. Valid log levels are `WARN`, `INFO` (default), `DEBUG`, `TRACE` and `NONE` (no logging). """ ll = loglevel.up...
python
def log_source(self, loglevel='INFO'): """Logs and returns the entire html source of the current page or frame. The `loglevel` argument defines the used log level. Valid log levels are `WARN`, `INFO` (default), `DEBUG`, `TRACE` and `NONE` (no logging). """ ll = loglevel.up...
['def', 'log_source', '(', 'self', ',', 'loglevel', '=', "'INFO'", ')', ':', 'll', '=', 'loglevel', '.', 'upper', '(', ')', 'if', 'll', '==', "'NONE'", ':', 'return', "''", 'else', ':', 'if', '"run_keyword_and_ignore_error"', 'not', 'in', '[', 'check_error_ignored', '[', '3', ']', 'for', 'check_error_ignored', 'in', 'i...
Logs and returns the entire html source of the current page or frame. The `loglevel` argument defines the used log level. Valid log levels are `WARN`, `INFO` (default), `DEBUG`, `TRACE` and `NONE` (no logging).
['Logs', 'and', 'returns', 'the', 'entire', 'html', 'source', 'of', 'the', 'current', 'page', 'or', 'frame', '.', 'The', 'loglevel', 'argument', 'defines', 'the', 'used', 'log', 'level', '.', 'Valid', 'log', 'levels', 'are', 'WARN', 'INFO', '(', 'default', ')', 'DEBUG', 'TRACE', 'and', 'NONE', '(', 'no', 'logging', ')'...
train
https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/91c808cf0602af6be8135ac529fa488fded04a85/AppiumLibrary/keywords/_applicationmanagement.py#L172-L187
3,818
Scoppio/RagnarokEngine3
RagnarokEngine3/RE3.py
Vector2.angle
def angle(vec1, vec2): """Calculate the angle between two Vector2's""" dotp = Vector2.dot(vec1, vec2) mag1 = vec1.length() mag2 = vec2.length() result = dotp / (mag1 * mag2) return math.acos(result)
python
def angle(vec1, vec2): """Calculate the angle between two Vector2's""" dotp = Vector2.dot(vec1, vec2) mag1 = vec1.length() mag2 = vec2.length() result = dotp / (mag1 * mag2) return math.acos(result)
['def', 'angle', '(', 'vec1', ',', 'vec2', ')', ':', 'dotp', '=', 'Vector2', '.', 'dot', '(', 'vec1', ',', 'vec2', ')', 'mag1', '=', 'vec1', '.', 'length', '(', ')', 'mag2', '=', 'vec2', '.', 'length', '(', ')', 'result', '=', 'dotp', '/', '(', 'mag1', '*', 'mag2', ')', 'return', 'math', '.', 'acos', '(', 'result', ')'...
Calculate the angle between two Vector2's
['Calculate', 'the', 'angle', 'between', 'two', 'Vector2', 's']
train
https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L213-L219
3,819
awslabs/aws-sam-cli
samcli/local/docker/lambda_container.py
LambdaContainer._get_additional_options
def _get_additional_options(runtime, debug_options): """ Return additional Docker container options. Used by container debug mode to enable certain container security options. :param DebugContext debug_options: DebugContext for the runtime of the container. :return dict: Dictiona...
python
def _get_additional_options(runtime, debug_options): """ Return additional Docker container options. Used by container debug mode to enable certain container security options. :param DebugContext debug_options: DebugContext for the runtime of the container. :return dict: Dictiona...
['def', '_get_additional_options', '(', 'runtime', ',', 'debug_options', ')', ':', 'if', 'not', 'debug_options', ':', 'return', 'None', 'opts', '=', '{', '}', 'if', 'runtime', '==', 'Runtime', '.', 'go1x', '.', 'value', ':', '# These options are required for delve to function properly inside a docker container on docke...
Return additional Docker container options. Used by container debug mode to enable certain container security options. :param DebugContext debug_options: DebugContext for the runtime of the container. :return dict: Dictionary containing additional arguments to be passed to container creation.
['Return', 'additional', 'Docker', 'container', 'options', '.', 'Used', 'by', 'container', 'debug', 'mode', 'to', 'enable', 'certain', 'container', 'security', 'options', '.', ':', 'param', 'DebugContext', 'debug_options', ':', 'DebugContext', 'for', 'the', 'runtime', 'of', 'the', 'container', '.', ':', 'return', 'dict...
train
https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/docker/lambda_container.py#L104-L122
3,820
hellosign/hellosign-python-sdk
hellosign_sdk/hsclient.py
HSClient.get_embedded_object
def get_embedded_object(self, signature_id): ''' Retrieves a embedded signing object Retrieves an embedded object containing a signature url that can be opened in an iFrame. Args: signature_id (str): The id of the signature to get a signature url for Returns: ...
python
def get_embedded_object(self, signature_id): ''' Retrieves a embedded signing object Retrieves an embedded object containing a signature url that can be opened in an iFrame. Args: signature_id (str): The id of the signature to get a signature url for Returns: ...
['def', 'get_embedded_object', '(', 'self', ',', 'signature_id', ')', ':', 'request', '=', 'self', '.', '_get_request', '(', ')', 'return', 'request', '.', 'get', '(', 'self', '.', 'EMBEDDED_OBJECT_GET_URL', '+', 'signature_id', ')']
Retrieves a embedded signing object Retrieves an embedded object containing a signature url that can be opened in an iFrame. Args: signature_id (str): The id of the signature to get a signature url for Returns: An Embedded object
['Retrieves', 'a', 'embedded', 'signing', 'object']
train
https://github.com/hellosign/hellosign-python-sdk/blob/4325a29ad5766380a214eac3914511f62f7ecba4/hellosign_sdk/hsclient.py#L966-L980
3,821
Microsoft/nni
tools/nni_cmd/config_utils.py
Experiments.read_file
def read_file(self): '''load config from local file''' if os.path.exists(self.experiment_file): try: with open(self.experiment_file, 'r') as file: return json.load(file) except ValueError: return {} return {}
python
def read_file(self): '''load config from local file''' if os.path.exists(self.experiment_file): try: with open(self.experiment_file, 'r') as file: return json.load(file) except ValueError: return {} return {}
['def', 'read_file', '(', 'self', ')', ':', 'if', 'os', '.', 'path', '.', 'exists', '(', 'self', '.', 'experiment_file', ')', ':', 'try', ':', 'with', 'open', '(', 'self', '.', 'experiment_file', ',', "'r'", ')', 'as', 'file', ':', 'return', 'json', '.', 'load', '(', 'file', ')', 'except', 'ValueError', ':', 'return', ...
load config from local file
['load', 'config', 'from', 'local', 'file']
train
https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/config_utils.py#L114-L122
3,822
PyCQA/pydocstyle
src/pydocstyle/violations.py
ErrorRegistry.to_rst
def to_rst(cls) -> str: """Output the registry as reStructuredText, for documentation.""" sep_line = '+' + 6 * '-' + '+' + '-' * 71 + '+\n' blank_line = '|' + 78 * ' ' + '|\n' table = '' for group in cls.groups: table += sep_line table += blank_line ...
python
def to_rst(cls) -> str: """Output the registry as reStructuredText, for documentation.""" sep_line = '+' + 6 * '-' + '+' + '-' * 71 + '+\n' blank_line = '|' + 78 * ' ' + '|\n' table = '' for group in cls.groups: table += sep_line table += blank_line ...
['def', 'to_rst', '(', 'cls', ')', '->', 'str', ':', 'sep_line', '=', "'+'", '+', '6', '*', "'-'", '+', "'+'", '+', "'-'", '*', '71', '+', "'+\\n'", 'blank_line', '=', "'|'", '+', '78', '*', "' '", '+', "'|\\n'", 'table', '=', "''", 'for', 'group', 'in', 'cls', '.', 'groups', ':', 'table', '+=', 'sep_line', 'table', '+...
Output the registry as reStructuredText, for documentation.
['Output', 'the', 'registry', 'as', 'reStructuredText', 'for', 'documentation', '.']
train
https://github.com/PyCQA/pydocstyle/blob/2549847f9efad225789f931e83dfe782418ca13e/src/pydocstyle/violations.py#L153-L168
3,823
resonai/ybt
yabt/buildcontext.py
BuildContext.can_use_cache
def can_use_cache(self, target: Target) -> bool: """Return True if should attempt to load `target` from cache. Return False if `target` has to be built, regardless of its cache status (because cache is disabled, or dependencies are dirty). """ # if caching is disabled for t...
python
def can_use_cache(self, target: Target) -> bool: """Return True if should attempt to load `target` from cache. Return False if `target` has to be built, regardless of its cache status (because cache is disabled, or dependencies are dirty). """ # if caching is disabled for t...
['def', 'can_use_cache', '(', 'self', ',', 'target', ':', 'Target', ')', '->', 'bool', ':', '# if caching is disabled for this execution, then all targets are dirty', 'if', 'self', '.', 'conf', '.', 'no_build_cache', ':', 'return', 'False', "# if the target's `cachable` prop is falsy, then it is dirty", 'if', 'not', 't...
Return True if should attempt to load `target` from cache. Return False if `target` has to be built, regardless of its cache status (because cache is disabled, or dependencies are dirty).
['Return', 'True', 'if', 'should', 'attempt', 'to', 'load', 'target', 'from', 'cache', '.', 'Return', 'False', 'if', 'target', 'has', 'to', 'be', 'built', 'regardless', 'of', 'its', 'cache', 'status', '(', 'because', 'cache', 'is', 'disabled', 'or', 'dependencies', 'are', 'dirty', ')', '.']
train
https://github.com/resonai/ybt/blob/5b40df0922ef3383eb85f2b04a26a2db4b81b3fd/yabt/buildcontext.py#L479-L496
3,824
FPGAwars/apio
apio/commands/examples.py
cli
def cli(ctx, list, dir, files, project_dir, sayno): """Manage verilog examples.\n Install with `apio install examples`""" exit_code = 0 if list: exit_code = Examples().list_examples() elif dir: exit_code = Examples().copy_example_dir(dir, project_dir, sayno) elif files: ...
python
def cli(ctx, list, dir, files, project_dir, sayno): """Manage verilog examples.\n Install with `apio install examples`""" exit_code = 0 if list: exit_code = Examples().list_examples() elif dir: exit_code = Examples().copy_example_dir(dir, project_dir, sayno) elif files: ...
['def', 'cli', '(', 'ctx', ',', 'list', ',', 'dir', ',', 'files', ',', 'project_dir', ',', 'sayno', ')', ':', 'exit_code', '=', '0', 'if', 'list', ':', 'exit_code', '=', 'Examples', '(', ')', '.', 'list_examples', '(', ')', 'elif', 'dir', ':', 'exit_code', '=', 'Examples', '(', ')', '.', 'copy_example_dir', '(', 'dir',...
Manage verilog examples.\n Install with `apio install examples`
['Manage', 'verilog', 'examples', '.', '\\', 'n', 'Install', 'with', 'apio', 'install', 'examples']
train
https://github.com/FPGAwars/apio/blob/5c6310f11a061a760764c6b5847bfb431dc3d0bc/apio/commands/examples.py#L29-L45
3,825
7sDream/zhihu-py3
zhihu/question.py
Question.follower_num
def follower_num(self): """获取问题关注人数. :return: 问题关注人数 :rtype: int """ follower_num_block = self.soup.find('div', class_='zg-gray-normal') # 无人关注时 找不到对应block,直接返回0 (感谢知乎用户 段晓晨 提出此问题) if follower_num_block is None or follower_num_block.strong is None: re...
python
def follower_num(self): """获取问题关注人数. :return: 问题关注人数 :rtype: int """ follower_num_block = self.soup.find('div', class_='zg-gray-normal') # 无人关注时 找不到对应block,直接返回0 (感谢知乎用户 段晓晨 提出此问题) if follower_num_block is None or follower_num_block.strong is None: re...
['def', 'follower_num', '(', 'self', ')', ':', 'follower_num_block', '=', 'self', '.', 'soup', '.', 'find', '(', "'div'", ',', 'class_', '=', "'zg-gray-normal'", ')', '# 无人关注时 找不到对应block,直接返回0 (感谢知乎用户 段晓晨 提出此问题)', 'if', 'follower_num_block', 'is', 'None', 'or', 'follower_num_block', '.', 'strong', 'is', 'None', ':', 'r...
获取问题关注人数. :return: 问题关注人数 :rtype: int
['获取问题关注人数', '.']
train
https://github.com/7sDream/zhihu-py3/blob/bcb4aa8325f8b54d3b44bd0bdc959edd9761fcfc/zhihu/question.py#L136-L146
3,826
improbable-research/keanu
keanu-python/keanu/vertex/generated.py
IntegerMax
def IntegerMax(left: vertex_constructor_param_types, right: vertex_constructor_param_types, label: Optional[str]=None) -> Vertex: """ Finds the maximum between two vertices :param left: one of the vertices to find the maximum of :param right: one of the vertices to find the maximum of """ r...
python
def IntegerMax(left: vertex_constructor_param_types, right: vertex_constructor_param_types, label: Optional[str]=None) -> Vertex: """ Finds the maximum between two vertices :param left: one of the vertices to find the maximum of :param right: one of the vertices to find the maximum of """ r...
['def', 'IntegerMax', '(', 'left', ':', 'vertex_constructor_param_types', ',', 'right', ':', 'vertex_constructor_param_types', ',', 'label', ':', 'Optional', '[', 'str', ']', '=', 'None', ')', '->', 'Vertex', ':', 'return', 'Integer', '(', 'context', '.', 'jvm_view', '(', ')', '.', 'IntegerMaxVertex', ',', 'label', ','...
Finds the maximum between two vertices :param left: one of the vertices to find the maximum of :param right: one of the vertices to find the maximum of
['Finds', 'the', 'maximum', 'between', 'two', 'vertices', ':', 'param', 'left', ':', 'one', 'of', 'the', 'vertices', 'to', 'find', 'the', 'maximum', 'of', ':', 'param', 'right', ':', 'one', 'of', 'the', 'vertices', 'to', 'find', 'the', 'maximum', 'of']
train
https://github.com/improbable-research/keanu/blob/73189a8f569078e156168e795f82c7366c59574b/keanu-python/keanu/vertex/generated.py#L744-L751
3,827
linkedin/pyexchange
pyexchange/base/soap.py
ExchangeServiceSOAP._xpath_to_dict
def _xpath_to_dict(self, element, property_map, namespace_map): """ property_map = { u'name' : { u'xpath' : u't:Mailbox/t:Name'}, u'email' : { u'xpath' : u't:Mailbox/t:EmailAddress'}, u'response' : { u'xpath' : u't:ResponseType'}, u'last_response': { u'xpath' : u't:Las...
python
def _xpath_to_dict(self, element, property_map, namespace_map): """ property_map = { u'name' : { u'xpath' : u't:Mailbox/t:Name'}, u'email' : { u'xpath' : u't:Mailbox/t:EmailAddress'}, u'response' : { u'xpath' : u't:ResponseType'}, u'last_response': { u'xpath' : u't:Las...
['def', '_xpath_to_dict', '(', 'self', ',', 'element', ',', 'property_map', ',', 'namespace_map', ')', ':', 'result', '=', '{', '}', 'log', '.', 'info', '(', 'etree', '.', 'tostring', '(', 'element', ',', 'pretty_print', '=', 'True', ')', ')', 'for', 'key', 'in', 'property_map', ':', 'item', '=', 'property_map', '[', '...
property_map = { u'name' : { u'xpath' : u't:Mailbox/t:Name'}, u'email' : { u'xpath' : u't:Mailbox/t:EmailAddress'}, u'response' : { u'xpath' : u't:ResponseType'}, u'last_response': { u'xpath' : u't:LastResponseTime', u'cast': u'datetime'}, } This runs the given xpath ...
['property_map', '=', '{', 'u', 'name', ':', '{', 'u', 'xpath', ':', 'u', 't', ':', 'Mailbox', '/', 't', ':', 'Name', '}', 'u', 'email', ':', '{', 'u', 'xpath', ':', 'u', 't', ':', 'Mailbox', '/', 't', ':', 'EmailAddress', '}', 'u', 'response', ':', '{', 'u', 'xpath', ':', 'u', 't', ':', 'ResponseType', '}', 'u', 'last...
train
https://github.com/linkedin/pyexchange/blob/d568f4edd326adb451b915ddf66cf1a37820e3ca/pyexchange/base/soap.py#L83-L132
3,828
devassistant/devassistant
devassistant/gui/run_window.py
RunLoggingHandler.emit
def emit(self, record): """ Function inserts log messages to list_view """ msg = record.getMessage() list_store = self.list_view.get_model() Gdk.threads_enter() if msg: # Underline URLs in the record message msg = replace_markup_chars(recor...
python
def emit(self, record): """ Function inserts log messages to list_view """ msg = record.getMessage() list_store = self.list_view.get_model() Gdk.threads_enter() if msg: # Underline URLs in the record message msg = replace_markup_chars(recor...
['def', 'emit', '(', 'self', ',', 'record', ')', ':', 'msg', '=', 'record', '.', 'getMessage', '(', ')', 'list_store', '=', 'self', '.', 'list_view', '.', 'get_model', '(', ')', 'Gdk', '.', 'threads_enter', '(', ')', 'if', 'msg', ':', '# Underline URLs in the record message', 'msg', '=', 'replace_markup_chars', '(', 'r...
Function inserts log messages to list_view
['Function', 'inserts', 'log', 'messages', 'to', 'list_view']
train
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/run_window.py#L62-L93
3,829
frejanordsiek/GeminiMotorDrive
GeminiMotorDrive/__init__.py
GeminiG6._get_parameter
def _get_parameter(self, name, tp, timeout=1.0, max_retries=2): """ Gets the specified drive parameter. Gets a parameter from the drive. Only supports ``bool``, ``int``, and ``float`` parameters. Parameters ---------- name : str Name of the parameter to chec...
python
def _get_parameter(self, name, tp, timeout=1.0, max_retries=2): """ Gets the specified drive parameter. Gets a parameter from the drive. Only supports ``bool``, ``int``, and ``float`` parameters. Parameters ---------- name : str Name of the parameter to chec...
['def', '_get_parameter', '(', 'self', ',', 'name', ',', 'tp', ',', 'timeout', '=', '1.0', ',', 'max_retries', '=', '2', ')', ':', "# Raise a TypeError if tp isn't one of the valid types.", 'if', 'tp', 'not', 'in', '(', 'bool', ',', 'int', ',', 'float', ')', ':', 'raise', 'TypeError', '(', "'Only supports bool, int, an...
Gets the specified drive parameter. Gets a parameter from the drive. Only supports ``bool``, ``int``, and ``float`` parameters. Parameters ---------- name : str Name of the parameter to check. It is always the command to set it but without the value. ...
['Gets', 'the', 'specified', 'drive', 'parameter', '.']
train
https://github.com/frejanordsiek/GeminiMotorDrive/blob/8de347ffb91228fbfe3832098b4996fa0141d8f1/GeminiMotorDrive/__init__.py#L145-L219
3,830
opennode/waldur-core
waldur_core/logging/views.py
AlertViewSet.list
def list(self, request, *args, **kwargs): """ To get a list of alerts, run **GET** against */api/alerts/* as authenticated user. Alert severity field can take one of this values: "Error", "Warning", "Info", "Debug". Field scope will contain link to object that cause alert. Conte...
python
def list(self, request, *args, **kwargs): """ To get a list of alerts, run **GET** against */api/alerts/* as authenticated user. Alert severity field can take one of this values: "Error", "Warning", "Info", "Debug". Field scope will contain link to object that cause alert. Conte...
['def', 'list', '(', 'self', ',', 'request', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'return', 'super', '(', 'AlertViewSet', ',', 'self', ')', '.', 'list', '(', 'request', ',', '*', 'args', ',', '*', '*', 'kwargs', ')']
To get a list of alerts, run **GET** against */api/alerts/* as authenticated user. Alert severity field can take one of this values: "Error", "Warning", "Info", "Debug". Field scope will contain link to object that cause alert. Context - dictionary that contains information about all related to...
['To', 'get', 'a', 'list', 'of', 'alerts', 'run', '**', 'GET', '**', 'against', '*', '/', 'api', '/', 'alerts', '/', '*', 'as', 'authenticated', 'user', '.']
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/logging/views.py#L161-L230
3,831
empymod/empymod
empymod/model.py
dipole
def dipole(src, rec, depth, res, freqtime, signal=None, ab=11, aniso=None, epermH=None, epermV=None, mpermH=None, mpermV=None, xdirect=False, ht='fht', htarg=None, ft='sin', ftarg=None, opt=None, loop=None, verb=2): r"""Return the electromagnetic field due to a dipole source. C...
python
def dipole(src, rec, depth, res, freqtime, signal=None, ab=11, aniso=None, epermH=None, epermV=None, mpermH=None, mpermV=None, xdirect=False, ht='fht', htarg=None, ft='sin', ftarg=None, opt=None, loop=None, verb=2): r"""Return the electromagnetic field due to a dipole source. C...
['def', 'dipole', '(', 'src', ',', 'rec', ',', 'depth', ',', 'res', ',', 'freqtime', ',', 'signal', '=', 'None', ',', 'ab', '=', '11', ',', 'aniso', '=', 'None', ',', 'epermH', '=', 'None', ',', 'epermV', '=', 'None', ',', 'mpermH', '=', 'None', ',', 'mpermV', '=', 'None', ',', 'xdirect', '=', 'False', ',', 'ht', '=', ...
r"""Return the electromagnetic field due to a dipole source. Calculate the electromagnetic frequency- or time-domain field due to infinitesimal small electric or magnetic dipole source(s), measured by infinitesimal small electric or magnetic dipole receiver(s); sources and receivers are directed along ...
['r', 'Return', 'the', 'electromagnetic', 'field', 'due', 'to', 'a', 'dipole', 'source', '.']
train
https://github.com/empymod/empymod/blob/4a78ca4191ed4b4d42d019ce715a9a3889dba1bc/empymod/model.py#L593-L960
3,832
rochacbruno/dynaconf
dynaconf/contrib/flask_dynaconf.py
DynaconfConfig.get
def get(self, key, default=None): """Gets config from dynaconf variables if variables does not exists in dynaconf try getting from `app.config` to support runtime settings.""" return self._settings.get(key, Config.get(self, key, default))
python
def get(self, key, default=None): """Gets config from dynaconf variables if variables does not exists in dynaconf try getting from `app.config` to support runtime settings.""" return self._settings.get(key, Config.get(self, key, default))
['def', 'get', '(', 'self', ',', 'key', ',', 'default', '=', 'None', ')', ':', 'return', 'self', '.', '_settings', '.', 'get', '(', 'key', ',', 'Config', '.', 'get', '(', 'self', ',', 'key', ',', 'default', ')', ')']
Gets config from dynaconf variables if variables does not exists in dynaconf try getting from `app.config` to support runtime settings.
['Gets', 'config', 'from', 'dynaconf', 'variables', 'if', 'variables', 'does', 'not', 'exists', 'in', 'dynaconf', 'try', 'getting', 'from', 'app', '.', 'config', 'to', 'support', 'runtime', 'settings', '.']
train
https://github.com/rochacbruno/dynaconf/blob/5a7cc8f8252251cbdf4f4112965801f9dfe2831d/dynaconf/contrib/flask_dynaconf.py#L130-L134
3,833
bodylabs/lace
lace/arcball.py
ArcBallT.drag
def drag(self, NewPt): # //Mouse drag, calculate rotation (Point2fT Quat4fT) """ drag (Point2fT mouse_coord) -> new_quaternion_rotation_vec """ X = 0 Y = 1 Z = 2 W = 3 self.m_EnVec = self._mapToSphere(NewPt) # //Compute the vector perpendicular t...
python
def drag(self, NewPt): # //Mouse drag, calculate rotation (Point2fT Quat4fT) """ drag (Point2fT mouse_coord) -> new_quaternion_rotation_vec """ X = 0 Y = 1 Z = 2 W = 3 self.m_EnVec = self._mapToSphere(NewPt) # //Compute the vector perpendicular t...
['def', 'drag', '(', 'self', ',', 'NewPt', ')', ':', '# //Mouse drag, calculate rotation (Point2fT Quat4fT)', 'X', '=', '0', 'Y', '=', '1', 'Z', '=', '2', 'W', '=', '3', 'self', '.', 'm_EnVec', '=', 'self', '.', '_mapToSphere', '(', 'NewPt', ')', '# //Compute the vector perpendicular to the begin and end vectors', '# P...
drag (Point2fT mouse_coord) -> new_quaternion_rotation_vec
['drag', '(', 'Point2fT', 'mouse_coord', ')', '-', '>', 'new_quaternion_rotation_vec']
train
https://github.com/bodylabs/lace/blob/b68f4a60a4cac66c0607ffbae38ef9d07d37f459/lace/arcball.py#L70-L98
3,834
InfoAgeTech/django-core
django_core/views/response.py
JSONHybridDeleteView.delete
def delete(self, request, *args, **kwargs): """ Calls the delete() method on the fetched object and then redirects to the success URL. """ self.object = self.get_object() success_url = self.get_success_url() self.object.delete() if self.request.is_ajax():...
python
def delete(self, request, *args, **kwargs): """ Calls the delete() method on the fetched object and then redirects to the success URL. """ self.object = self.get_object() success_url = self.get_success_url() self.object.delete() if self.request.is_ajax():...
['def', 'delete', '(', 'self', ',', 'request', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'self', '.', 'object', '=', 'self', '.', 'get_object', '(', ')', 'success_url', '=', 'self', '.', 'get_success_url', '(', ')', 'self', '.', 'object', '.', 'delete', '(', ')', 'if', 'self', '.', 'request', '.', 'is_ajax',...
Calls the delete() method on the fetched object and then redirects to the success URL.
['Calls', 'the', 'delete', '()', 'method', 'on', 'the', 'fetched', 'object', 'and', 'then', 'redirects', 'to', 'the', 'success', 'URL', '.']
train
https://github.com/InfoAgeTech/django-core/blob/9664a145473b75120bf71e1644e9c8086e7e8955/django_core/views/response.py#L166-L178
3,835
python-diamond/Diamond
src/collectors/conntrack/conntrack.py
ConnTrackCollector.get_default_config_help
def get_default_config_help(self): """ Return help text for collector configuration """ config_help = super(ConnTrackCollector, self).get_default_config_help() config_help.update({ "dir": "Directories with files of interest, comma seperated", "files":...
python
def get_default_config_help(self): """ Return help text for collector configuration """ config_help = super(ConnTrackCollector, self).get_default_config_help() config_help.update({ "dir": "Directories with files of interest, comma seperated", "files":...
['def', 'get_default_config_help', '(', 'self', ')', ':', 'config_help', '=', 'super', '(', 'ConnTrackCollector', ',', 'self', ')', '.', 'get_default_config_help', '(', ')', 'config_help', '.', 'update', '(', '{', '"dir"', ':', '"Directories with files of interest, comma seperated"', ',', '"files"', ':', '"List of file...
Return help text for collector configuration
['Return', 'help', 'text', 'for', 'collector', 'configuration']
train
https://github.com/python-diamond/Diamond/blob/0f3eb04327d6d3ed5e53a9967d6c9d2c09714a47/src/collectors/conntrack/conntrack.py#L22-L31
3,836
tradenity/python-sdk
tradenity/resources/payment_token.py
PaymentToken.get_payment_token_by_id
def get_payment_token_by_id(cls, payment_token_id, **kwargs): """Find PaymentToken Return single instance of PaymentToken by its ID. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.get_payment...
python
def get_payment_token_by_id(cls, payment_token_id, **kwargs): """Find PaymentToken Return single instance of PaymentToken by its ID. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.get_payment...
['def', 'get_payment_token_by_id', '(', 'cls', ',', 'payment_token_id', ',', '*', '*', 'kwargs', ')', ':', 'kwargs', '[', "'_return_http_data_only'", ']', '=', 'True', 'if', 'kwargs', '.', 'get', '(', "'async'", ')', ':', 'return', 'cls', '.', '_get_payment_token_by_id_with_http_info', '(', 'payment_token_id', ',', '*'...
Find PaymentToken Return single instance of PaymentToken by its ID. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.get_payment_token_by_id(payment_token_id, async=True) >>> result = thread.ge...
['Find', 'PaymentToken']
train
https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/payment_token.py#L474-L494
3,837
spacetelescope/synphot_refactor
synphot/models.py
_get_meta
def _get_meta(model): """Return metadata of a model. Model could be a real model or evaluated metadata.""" if isinstance(model, Model): w = model.meta else: w = model # Already metadata return w
python
def _get_meta(model): """Return metadata of a model. Model could be a real model or evaluated metadata.""" if isinstance(model, Model): w = model.meta else: w = model # Already metadata return w
['def', '_get_meta', '(', 'model', ')', ':', 'if', 'isinstance', '(', 'model', ',', 'Model', ')', ':', 'w', '=', 'model', '.', 'meta', 'else', ':', 'w', '=', 'model', '# Already metadata', 'return', 'w']
Return metadata of a model. Model could be a real model or evaluated metadata.
['Return', 'metadata', 'of', 'a', 'model', '.', 'Model', 'could', 'be', 'a', 'real', 'model', 'or', 'evaluated', 'metadata', '.']
train
https://github.com/spacetelescope/synphot_refactor/blob/9c064f3cff0c41dd8acadc0f67c6350931275b9f/synphot/models.py#L744-L751
3,838
RedHatInsights/insights-core
insights/parsers/dmidecode.py
parse_dmidecode
def parse_dmidecode(dmidecode_content, pythonic_keys=False): """ Returns a dictionary of dmidecode information parsed from a dmidecode list (i.e. from context.content) This method will attempt to handle leading spaces rather than tabs. """ if len(dmidecode_content) < 3: return {} s...
python
def parse_dmidecode(dmidecode_content, pythonic_keys=False): """ Returns a dictionary of dmidecode information parsed from a dmidecode list (i.e. from context.content) This method will attempt to handle leading spaces rather than tabs. """ if len(dmidecode_content) < 3: return {} s...
['def', 'parse_dmidecode', '(', 'dmidecode_content', ',', 'pythonic_keys', '=', 'False', ')', ':', 'if', 'len', '(', 'dmidecode_content', ')', '<', '3', ':', 'return', '{', '}', 'section', '=', 'None', 'obj', '=', '{', '}', 'current', '=', '{', '}', 'buf', '=', '"\\n"', '.', 'join', '(', 'dmidecode_content', ')', '.', ...
Returns a dictionary of dmidecode information parsed from a dmidecode list (i.e. from context.content) This method will attempt to handle leading spaces rather than tabs.
['Returns', 'a', 'dictionary', 'of', 'dmidecode', 'information', 'parsed', 'from', 'a', 'dmidecode', 'list', '(', 'i', '.', 'e', '.', 'from', 'context', '.', 'content', ')']
train
https://github.com/RedHatInsights/insights-core/blob/b57cbf8ed7c089672426ede0441e0a4f789ef4a1/insights/parsers/dmidecode.py#L147-L215
3,839
tensorflow/tensorboard
tensorboard/plugins/graph/graphs_plugin.py
GraphsPlugin.graph_impl
def graph_impl(self, run, tag, is_conceptual, limit_attr_size=None, large_attrs_key=None): """Result of the form `(body, mime_type)`, or `None` if no graph exists.""" if is_conceptual: tensor_events = self._multiplexer.Tensors(run, tag) # Take the first event if there are multiple events written fro...
python
def graph_impl(self, run, tag, is_conceptual, limit_attr_size=None, large_attrs_key=None): """Result of the form `(body, mime_type)`, or `None` if no graph exists.""" if is_conceptual: tensor_events = self._multiplexer.Tensors(run, tag) # Take the first event if there are multiple events written fro...
['def', 'graph_impl', '(', 'self', ',', 'run', ',', 'tag', ',', 'is_conceptual', ',', 'limit_attr_size', '=', 'None', ',', 'large_attrs_key', '=', 'None', ')', ':', 'if', 'is_conceptual', ':', 'tensor_events', '=', 'self', '.', '_multiplexer', '.', 'Tensors', '(', 'run', ',', 'tag', ')', '# Take the first event if ther...
Result of the form `(body, mime_type)`, or `None` if no graph exists.
['Result', 'of', 'the', 'form', '(', 'body', 'mime_type', ')', 'or', 'None', 'if', 'no', 'graph', 'exists', '.']
train
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/graph/graphs_plugin.py#L145-L169
3,840
log2timeline/plaso
plaso/multi_processing/psort.py
PsortEventHeap.PopEvent
def PopEvent(self): """Pops an event from the heap. Returns: tuple: containing: str: identifier of the event MACB group or None if the event cannot be grouped. str: identifier of the event content. EventObject: event. """ try: macb_group_identifier, cont...
python
def PopEvent(self): """Pops an event from the heap. Returns: tuple: containing: str: identifier of the event MACB group or None if the event cannot be grouped. str: identifier of the event content. EventObject: event. """ try: macb_group_identifier, cont...
['def', 'PopEvent', '(', 'self', ')', ':', 'try', ':', 'macb_group_identifier', ',', 'content_identifier', ',', 'event', '=', 'heapq', '.', 'heappop', '(', 'self', '.', '_heap', ')', 'if', 'macb_group_identifier', '==', "''", ':', 'macb_group_identifier', '=', 'None', 'return', 'macb_group_identifier', ',', 'content_id...
Pops an event from the heap. Returns: tuple: containing: str: identifier of the event MACB group or None if the event cannot be grouped. str: identifier of the event content. EventObject: event.
['Pops', 'an', 'event', 'from', 'the', 'heap', '.']
train
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/multi_processing/psort.py#L127-L146
3,841
thespacedoctor/tastic
tastic/tastic.py
baseClass.notes
def notes(self): """*list of the notes assoicated with this object* **Usage:** The document, project and task objects can all contain notes. .. code-block:: python docNotes = doc.notes projectNotes = aProject.notes taskNotes = a...
python
def notes(self): """*list of the notes assoicated with this object* **Usage:** The document, project and task objects can all contain notes. .. code-block:: python docNotes = doc.notes projectNotes = aProject.notes taskNotes = a...
['def', 'notes', '(', 'self', ')', ':', 'return', 'self', '.', '_get_object', '(', 'regex', '=', 're', '.', 'compile', '(', "r'((?<=\\n)|(?<=^))(?P<title>\\S(?<!-)((?!(: +@|: *\\n|: *$)).)*)\\s*?(\\n|$)(?P<tagString>&&&)?(?P<content>&&&)?'", ',', 're', '.', 'UNICODE', ')', ',', 'objectType', '=', '"note"', ',', 'conten...
*list of the notes assoicated with this object* **Usage:** The document, project and task objects can all contain notes. .. code-block:: python docNotes = doc.notes projectNotes = aProject.notes taskNotes = aTask.notes
['*', 'list', 'of', 'the', 'notes', 'assoicated', 'with', 'this', 'object', '*']
train
https://github.com/thespacedoctor/tastic/blob/a0a16cf329a50057906ac3f696bb60b6fcee25e0/tastic/tastic.py#L189-L207
3,842
evocell/rabifier
rabifier/utils.py
Pathfinder.get
def get(self, name): """ Looks for a name in the path. :param name: file name :return: path to the file """ for d in self.paths: if os.path.exists(d) and name in os.listdir(d): return os.path.join(d, name) logger.debug('File not found {}'.for...
python
def get(self, name): """ Looks for a name in the path. :param name: file name :return: path to the file """ for d in self.paths: if os.path.exists(d) and name in os.listdir(d): return os.path.join(d, name) logger.debug('File not found {}'.for...
['def', 'get', '(', 'self', ',', 'name', ')', ':', 'for', 'd', 'in', 'self', '.', 'paths', ':', 'if', 'os', '.', 'path', '.', 'exists', '(', 'd', ')', 'and', 'name', 'in', 'os', '.', 'listdir', '(', 'd', ')', ':', 'return', 'os', '.', 'path', '.', 'join', '(', 'd', ',', 'name', ')', 'logger', '.', 'debug', '(', "'File ...
Looks for a name in the path. :param name: file name :return: path to the file
['Looks', 'for', 'a', 'name', 'in', 'the', 'path', '.']
train
https://github.com/evocell/rabifier/blob/a5be3d516517e555bde463b94f06aeed106d19b8/rabifier/utils.py#L62-L73
3,843
mdiener/grace
grace/py27/slimit/mangler.py
mangle
def mangle(tree, toplevel=False): """Mangle names. Args: toplevel: defaults to False. Defines if global scope should be mangled or not. """ sym_table = SymbolTable() visitor = ScopeTreeVisitor(sym_table) visitor.visit(tree) fill_scope_references(tree) mangle_scope_tree(...
python
def mangle(tree, toplevel=False): """Mangle names. Args: toplevel: defaults to False. Defines if global scope should be mangled or not. """ sym_table = SymbolTable() visitor = ScopeTreeVisitor(sym_table) visitor.visit(tree) fill_scope_references(tree) mangle_scope_tree(...
['def', 'mangle', '(', 'tree', ',', 'toplevel', '=', 'False', ')', ':', 'sym_table', '=', 'SymbolTable', '(', ')', 'visitor', '=', 'ScopeTreeVisitor', '(', 'sym_table', ')', 'visitor', '.', 'visit', '(', 'tree', ')', 'fill_scope_references', '(', 'tree', ')', 'mangle_scope_tree', '(', 'sym_table', '.', 'globals', ',', ...
Mangle names. Args: toplevel: defaults to False. Defines if global scope should be mangled or not.
['Mangle', 'names', '.']
train
https://github.com/mdiener/grace/blob/2dab13a2cf636da5da989904c5885166fc94d36d/grace/py27/slimit/mangler.py#L36-L51
3,844
umutbozkurt/django-rest-framework-mongoengine
rest_framework_mongoengine/fields.py
DocumentField.to_representation
def to_representation(self, obj): """ convert value to representation. DRF ModelField uses ``value_to_string`` for this purpose. Mongoengine fields do not have such method. This implementation uses ``django.utils.encoding.smart_text`` to convert everything to text, while keeping json-safe type...
python
def to_representation(self, obj): """ convert value to representation. DRF ModelField uses ``value_to_string`` for this purpose. Mongoengine fields do not have such method. This implementation uses ``django.utils.encoding.smart_text`` to convert everything to text, while keeping json-safe type...
['def', 'to_representation', '(', 'self', ',', 'obj', ')', ':', 'value', '=', 'self', '.', 'model_field', '.', '__get__', '(', 'obj', ',', 'None', ')', 'return', 'smart_text', '(', 'value', ',', 'strings_only', '=', 'True', ')']
convert value to representation. DRF ModelField uses ``value_to_string`` for this purpose. Mongoengine fields do not have such method. This implementation uses ``django.utils.encoding.smart_text`` to convert everything to text, while keeping json-safe types intact. NB: The argument is whole o...
['convert', 'value', 'to', 'representation', '.']
train
https://github.com/umutbozkurt/django-rest-framework-mongoengine/blob/2fe6de53907b31a5e8b742e4c6b728942b5fa4f0/rest_framework_mongoengine/fields.py#L58-L69
3,845
PyGithub/PyGithub
github/MainClass.py
Github.get_rate_limit
def get_rate_limit(self): """ Rate limit status for different resources (core/search/graphql). :calls: `GET /rate_limit <http://developer.github.com/v3/rate_limit>`_ :rtype: :class:`github.RateLimit.RateLimit` """ headers, data = self.__requester.requestJsonAndCheck( ...
python
def get_rate_limit(self): """ Rate limit status for different resources (core/search/graphql). :calls: `GET /rate_limit <http://developer.github.com/v3/rate_limit>`_ :rtype: :class:`github.RateLimit.RateLimit` """ headers, data = self.__requester.requestJsonAndCheck( ...
['def', 'get_rate_limit', '(', 'self', ')', ':', 'headers', ',', 'data', '=', 'self', '.', '__requester', '.', 'requestJsonAndCheck', '(', "'GET'", ',', "'/rate_limit'", ')', 'return', 'RateLimit', '.', 'RateLimit', '(', 'self', '.', '__requester', ',', 'headers', ',', 'data', '[', '"resources"', ']', ',', 'True', ')']
Rate limit status for different resources (core/search/graphql). :calls: `GET /rate_limit <http://developer.github.com/v3/rate_limit>`_ :rtype: :class:`github.RateLimit.RateLimit`
['Rate', 'limit', 'status', 'for', 'different', 'resources', '(', 'core', '/', 'search', '/', 'graphql', ')', '.']
train
https://github.com/PyGithub/PyGithub/blob/f716df86bbe7dc276c6596699fa9712b61ef974c/github/MainClass.py#L172-L183
3,846
carpedm20/ndrive
ndrive/models.py
ndrive.getList
def getList(self, dummy = 56184, orgresource = '/', type = 1, dept = 0, sort = 'name', order = 'asc', startnum = 0, pagingrow = 1000): """GetList Args: dummy: ??? orgresource: Directory path to get the file list ex) /Picture/ type: 1 => only director...
python
def getList(self, dummy = 56184, orgresource = '/', type = 1, dept = 0, sort = 'name', order = 'asc', startnum = 0, pagingrow = 1000): """GetList Args: dummy: ??? orgresource: Directory path to get the file list ex) /Picture/ type: 1 => only director...
['def', 'getList', '(', 'self', ',', 'dummy', '=', '56184', ',', 'orgresource', '=', "'/'", ',', 'type', '=', '1', ',', 'dept', '=', '0', ',', 'sort', '=', "'name'", ',', 'order', '=', "'asc'", ',', 'startnum', '=', '0', ',', 'pagingrow', '=', '1000', ')', ':', 'url', '=', 'nurls', '[', "'getList'", ']', 'data', '=', '...
GetList Args: dummy: ??? orgresource: Directory path to get the file list ex) /Picture/ type: 1 => only directories with idxfolder property 2 => only files 3 => directories and files with thumbnail info ...
['GetList']
train
https://github.com/carpedm20/ndrive/blob/ac58eaf8a8d46292ad752bb38047f65838b8ad2b/ndrive/models.py#L426-L519
3,847
BlueBrain/NeuroM
neurom/check/neuron_checks.py
has_no_narrow_start
def has_no_narrow_start(neuron, frac=0.9): '''Check if neurites have a narrow start Arguments: neuron(Neuron): The neuron object to test frac(float): Ratio that the second point must be smaller than the first Returns: CheckResult with a list of all first segments of neurites with a...
python
def has_no_narrow_start(neuron, frac=0.9): '''Check if neurites have a narrow start Arguments: neuron(Neuron): The neuron object to test frac(float): Ratio that the second point must be smaller than the first Returns: CheckResult with a list of all first segments of neurites with a...
['def', 'has_no_narrow_start', '(', 'neuron', ',', 'frac', '=', '0.9', ')', ':', 'bad_ids', '=', '[', '(', 'neurite', '.', 'root_node', '.', 'id', ',', '[', 'neurite', '.', 'root_node', '.', 'points', '[', '1', ']', ']', ')', 'for', 'neurite', 'in', 'neuron', '.', 'neurites', 'if', 'neurite', '.', 'root_node', '.', 'po...
Check if neurites have a narrow start Arguments: neuron(Neuron): The neuron object to test frac(float): Ratio that the second point must be smaller than the first Returns: CheckResult with a list of all first segments of neurites with a narrow start
['Check', 'if', 'neurites', 'have', 'a', 'narrow', 'start']
train
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/check/neuron_checks.py#L253-L266
3,848
Telefonica/toolium
toolium/config_parser.py
ExtendedConfigParser.get_config_from_file
def get_config_from_file(conf_properties_files): """Reads properties files and saves them to a config object :param conf_properties_files: comma-separated list of properties files :returns: config object """ # Initialize the config object config = ExtendedConfigParser() ...
python
def get_config_from_file(conf_properties_files): """Reads properties files and saves them to a config object :param conf_properties_files: comma-separated list of properties files :returns: config object """ # Initialize the config object config = ExtendedConfigParser() ...
['def', 'get_config_from_file', '(', 'conf_properties_files', ')', ':', '# Initialize the config object', 'config', '=', 'ExtendedConfigParser', '(', ')', 'logger', '=', 'logging', '.', 'getLogger', '(', '__name__', ')', '# Configure properties (last files could override properties)', 'found', '=', 'False', 'files_list...
Reads properties files and saves them to a config object :param conf_properties_files: comma-separated list of properties files :returns: config object
['Reads', 'properties', 'files', 'and', 'saves', 'them', 'to', 'a', 'config', 'object']
train
https://github.com/Telefonica/toolium/blob/56847c243b3a98876df74c184b75e43f8810e475/toolium/config_parser.py#L99-L129
3,849
tensorflow/tensor2tensor
tensor2tensor/utils/decoding.py
decode_from_file
def decode_from_file(estimator, filename, hparams, decode_hp, decode_to_file=None, checkpoint_path=None): """Compute predictions on entries in filename and write them out.""" if not decode_hp.batch_size: dec...
python
def decode_from_file(estimator, filename, hparams, decode_hp, decode_to_file=None, checkpoint_path=None): """Compute predictions on entries in filename and write them out.""" if not decode_hp.batch_size: dec...
['def', 'decode_from_file', '(', 'estimator', ',', 'filename', ',', 'hparams', ',', 'decode_hp', ',', 'decode_to_file', '=', 'None', ',', 'checkpoint_path', '=', 'None', ')', ':', 'if', 'not', 'decode_hp', '.', 'batch_size', ':', 'decode_hp', '.', 'batch_size', '=', '32', 'tf', '.', 'logging', '.', 'info', '(', '"decod...
Compute predictions on entries in filename and write them out.
['Compute', 'predictions', 'on', 'entries', 'in', 'filename', 'and', 'write', 'them', 'out', '.']
train
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/decoding.py#L394-L559
3,850
StackStorm/pybind
pybind/slxos/v17r_1_01a/routing_system/ipv6/__init__.py
ipv6._set_receive
def _set_receive(self, v, load=False): """ Setter method for receive, mapped from YANG variable /routing_system/ipv6/receive (container) If this variable is read-only (config: false) in the source YANG file, then _set_receive is considered as a private method. Backends looking to populate this varia...
python
def _set_receive(self, v, load=False): """ Setter method for receive, mapped from YANG variable /routing_system/ipv6/receive (container) If this variable is read-only (config: false) in the source YANG file, then _set_receive is considered as a private method. Backends looking to populate this varia...
['def', '_set_receive', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'receive', '.', 'receive', ',', 'is_container', '=', "'container'", ','...
Setter method for receive, mapped from YANG variable /routing_system/ipv6/receive (container) If this variable is read-only (config: false) in the source YANG file, then _set_receive is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_recei...
['Setter', 'method', 'for', 'receive', 'mapped', 'from', 'YANG', 'variable', '/', 'routing_system', '/', 'ipv6', '/', 'receive', '(', 'container', ')', 'If', 'this', 'variable', 'is', 'read', '-', 'only', '(', 'config', ':', 'false', ')', 'in', 'the', 'source', 'YANG', 'file', 'then', '_set_receive', 'is', 'considered'...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17r_1_01a/routing_system/ipv6/__init__.py#L133-L154
3,851
Azure/azure-event-hubs-python
azure/eventprocessorhost/eh_partition_pump.py
EventHubPartitionPump.clean_up_clients_async
async def clean_up_clients_async(self): """ Resets the pump swallows all exceptions. """ if self.partition_receiver: if self.eh_client: await self.eh_client.stop_async() self.partition_receiver = None self.partition_receive_hand...
python
async def clean_up_clients_async(self): """ Resets the pump swallows all exceptions. """ if self.partition_receiver: if self.eh_client: await self.eh_client.stop_async() self.partition_receiver = None self.partition_receive_hand...
['async', 'def', 'clean_up_clients_async', '(', 'self', ')', ':', 'if', 'self', '.', 'partition_receiver', ':', 'if', 'self', '.', 'eh_client', ':', 'await', 'self', '.', 'eh_client', '.', 'stop_async', '(', ')', 'self', '.', 'partition_receiver', '=', 'None', 'self', '.', 'partition_receive_handler', '=', 'None', 'sel...
Resets the pump swallows all exceptions.
['Resets', 'the', 'pump', 'swallows', 'all', 'exceptions', '.']
train
https://github.com/Azure/azure-event-hubs-python/blob/737c5f966557ada2cf10fa0d8f3c19671ae96348/azure/eventprocessorhost/eh_partition_pump.py#L81-L90
3,852
pgmpy/pgmpy
pgmpy/factors/continuous/discretize.py
BaseDiscretizer.get_labels
def get_labels(self): """ Returns a list of strings representing the values about which the discretization method calculates the probabilty masses. Default value is the points - [low, low+step, low+2*step, ......... , high-step] unless the method is overridden by...
python
def get_labels(self): """ Returns a list of strings representing the values about which the discretization method calculates the probabilty masses. Default value is the points - [low, low+step, low+2*step, ......... , high-step] unless the method is overridden by...
['def', 'get_labels', '(', 'self', ')', ':', 'step', '=', '(', 'self', '.', 'high', '-', 'self', '.', 'low', ')', '/', 'self', '.', 'cardinality', 'labels', '=', '[', "'x={i}'", '.', 'format', '(', 'i', '=', 'str', '(', 'i', ')', ')', 'for', 'i', 'in', 'np', '.', 'round', '(', 'np', '.', 'arange', '(', 'self', '.', 'lo...
Returns a list of strings representing the values about which the discretization method calculates the probabilty masses. Default value is the points - [low, low+step, low+2*step, ......... , high-step] unless the method is overridden by a subclass. Examples ---...
['Returns', 'a', 'list', 'of', 'strings', 'representing', 'the', 'values', 'about', 'which', 'the', 'discretization', 'method', 'calculates', 'the', 'probabilty', 'masses', '.']
train
https://github.com/pgmpy/pgmpy/blob/9381a66aba3c3871d3ccd00672b148d17d63239e/pgmpy/factors/continuous/discretize.py#L67-L96
3,853
saltstack/salt
salt/modules/bridge.py
_bsd_bradd
def _bsd_bradd(br): ''' Internal, creates the bridge ''' kernel = __grains__['kernel'] ifconfig = _tool_path('ifconfig') if not br: return False if __salt__['cmd.retcode']('{0} {1} create up'.format(ifconfig, br), python_shell=False) != 0: ret...
python
def _bsd_bradd(br): ''' Internal, creates the bridge ''' kernel = __grains__['kernel'] ifconfig = _tool_path('ifconfig') if not br: return False if __salt__['cmd.retcode']('{0} {1} create up'.format(ifconfig, br), python_shell=False) != 0: ret...
['def', '_bsd_bradd', '(', 'br', ')', ':', 'kernel', '=', '__grains__', '[', "'kernel'", ']', 'ifconfig', '=', '_tool_path', '(', "'ifconfig'", ')', 'if', 'not', 'br', ':', 'return', 'False', 'if', '__salt__', '[', "'cmd.retcode'", ']', '(', "'{0} {1} create up'", '.', 'format', '(', 'ifconfig', ',', 'br', ')', ',', 'p...
Internal, creates the bridge
['Internal', 'creates', 'the', 'bridge']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bridge.py#L217-L238
3,854
influxdata/influxdb-python
influxdb/client.py
InfluxDBClient.grant_privilege
def grant_privilege(self, privilege, database, username): """Grant a privilege on a database to a user. :param privilege: the privilege to grant, one of 'read', 'write' or 'all'. The string is case-insensitive :type privilege: str :param database: the database to grant the p...
python
def grant_privilege(self, privilege, database, username): """Grant a privilege on a database to a user. :param privilege: the privilege to grant, one of 'read', 'write' or 'all'. The string is case-insensitive :type privilege: str :param database: the database to grant the p...
['def', 'grant_privilege', '(', 'self', ',', 'privilege', ',', 'database', ',', 'username', ')', ':', 'text', '=', '"GRANT {0} ON {1} TO {2}"', '.', 'format', '(', 'privilege', ',', 'quote_ident', '(', 'database', ')', ',', 'quote_ident', '(', 'username', ')', ')', 'self', '.', 'query', '(', 'text', ',', 'method', '=',...
Grant a privilege on a database to a user. :param privilege: the privilege to grant, one of 'read', 'write' or 'all'. The string is case-insensitive :type privilege: str :param database: the database to grant the privilege on :type database: str :param username: the ...
['Grant', 'a', 'privilege', 'on', 'a', 'database', 'to', 'a', 'user', '.']
train
https://github.com/influxdata/influxdb-python/blob/d5d12499f3755199d5eedd8b363450f1cf4073bd/influxdb/client.py#L890-L904
3,855
TC01/calcpkg
calcrepo/calcpkg.py
main
def main(): """Core function for the script""" commands = ['update', 'list', 'get', 'info', 'count', 'search', 'download'] parser = argparse.ArgumentParser(description="Command line access to software repositories for TI calculators, primarily ticalc.org and Cemetech") parser.add_argument("action", metavar="ACTION"...
python
def main(): """Core function for the script""" commands = ['update', 'list', 'get', 'info', 'count', 'search', 'download'] parser = argparse.ArgumentParser(description="Command line access to software repositories for TI calculators, primarily ticalc.org and Cemetech") parser.add_argument("action", metavar="ACTION"...
['def', 'main', '(', ')', ':', 'commands', '=', '[', "'update'", ',', "'list'", ',', "'get'", ',', "'info'", ',', "'count'", ',', "'search'", ',', "'download'", ']', 'parser', '=', 'argparse', '.', 'ArgumentParser', '(', 'description', '=', '"Command line access to software repositories for TI calculators, primarily ti...
Core function for the script
['Core', 'function', 'for', 'the', 'script']
train
https://github.com/TC01/calcpkg/blob/5168f606264620a090b42a64354331d208b00d5f/calcrepo/calcpkg.py#L12-L62
3,856
secdev/scapy
scapy/layers/tls/tools.py
_tls_aead_auth_decrypt
def _tls_aead_auth_decrypt(alg, c, read_seq_num): """ Provided with a TLSCiphertext instance c, the function applies AEAD cipher alg auth_decrypt function to c.data (and additional data) in order to authenticate the data and decrypt c.data. When those steps succeed, the result is a newly created TLS...
python
def _tls_aead_auth_decrypt(alg, c, read_seq_num): """ Provided with a TLSCiphertext instance c, the function applies AEAD cipher alg auth_decrypt function to c.data (and additional data) in order to authenticate the data and decrypt c.data. When those steps succeed, the result is a newly created TLS...
['def', '_tls_aead_auth_decrypt', '(', 'alg', ',', 'c', ',', 'read_seq_num', ')', ':', "# 'Deduce' TLSCompressed length from TLSCiphertext length", '# There is actually no guaranty of this equality, but this is defined as', '# such in TLS 1.2 specifications, and it works for GCM and CCM at least.', '#', 'plen', '=', 'c...
Provided with a TLSCiphertext instance c, the function applies AEAD cipher alg auth_decrypt function to c.data (and additional data) in order to authenticate the data and decrypt c.data. When those steps succeed, the result is a newly created TLSCompressed instance. On error, None is returned. Note that...
['Provided', 'with', 'a', 'TLSCiphertext', 'instance', 'c', 'the', 'function', 'applies', 'AEAD', 'cipher', 'alg', 'auth_decrypt', 'function', 'to', 'c', '.', 'data', '(', 'and', 'additional', 'data', ')', 'in', 'order', 'to', 'authenticate', 'the', 'data', 'and', 'decrypt', 'c', '.', 'data', '.', 'When', 'those', 'ste...
train
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/tools.py#L200-L225
3,857
mikedh/trimesh
trimesh/graph.py
smoothed
def smoothed(mesh, angle): """ Return a non- watertight version of the mesh which will render nicely with smooth shading by disconnecting faces at sharp angles to each other. Parameters --------- mesh : trimesh.Trimesh Source geometry angle : float Angle in radians, adjacent...
python
def smoothed(mesh, angle): """ Return a non- watertight version of the mesh which will render nicely with smooth shading by disconnecting faces at sharp angles to each other. Parameters --------- mesh : trimesh.Trimesh Source geometry angle : float Angle in radians, adjacent...
['def', 'smoothed', '(', 'mesh', ',', 'angle', ')', ':', '# if the mesh has no adjacent faces return a copy', 'if', 'len', '(', 'mesh', '.', 'face_adjacency', ')', '==', '0', ':', 'return', 'mesh', '.', 'copy', '(', ')', '# face pairs below angle threshold', 'angle_ok', '=', 'mesh', '.', 'face_adjacency_angles', '<=', ...
Return a non- watertight version of the mesh which will render nicely with smooth shading by disconnecting faces at sharp angles to each other. Parameters --------- mesh : trimesh.Trimesh Source geometry angle : float Angle in radians, adjacent faces which have normals below t...
['Return', 'a', 'non', '-', 'watertight', 'version', 'of', 'the', 'mesh', 'which', 'will', 'render', 'nicely', 'with', 'smooth', 'shading', 'by', 'disconnecting', 'faces', 'at', 'sharp', 'angles', 'to', 'each', 'other', '.']
train
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/graph.py#L728-L763
3,858
PlaidWeb/Publ
publ/queries.py
where_entry_visible
def where_entry_visible(query, date=None): """ Generate a where clause for currently-visible entries Arguments: date -- The date to generate it relative to (defaults to right now) """ return orm.select( e for e in query if e.status == model.PublishStatus.PUBLISHED.value or ...
python
def where_entry_visible(query, date=None): """ Generate a where clause for currently-visible entries Arguments: date -- The date to generate it relative to (defaults to right now) """ return orm.select( e for e in query if e.status == model.PublishStatus.PUBLISHED.value or ...
['def', 'where_entry_visible', '(', 'query', ',', 'date', '=', 'None', ')', ':', 'return', 'orm', '.', 'select', '(', 'e', 'for', 'e', 'in', 'query', 'if', 'e', '.', 'status', '==', 'model', '.', 'PublishStatus', '.', 'PUBLISHED', '.', 'value', 'or', '(', 'e', '.', 'status', '==', 'model', '.', 'PublishStatus', '.', 'S...
Generate a where clause for currently-visible entries Arguments: date -- The date to generate it relative to (defaults to right now)
['Generate', 'a', 'where', 'clause', 'for', 'currently', '-', 'visible', 'entries']
train
https://github.com/PlaidWeb/Publ/blob/ce7893632ddc3cb70b4978a41ffd7dd06fa13565/publ/queries.py#L10-L24
3,859
roboogle/gtkmvc3
gtkmvco/gtkmvc3/support/metaclasses.py
PropertyMeta.__create_log_props
def __create_log_props(cls, log_props, _getdict, _setdict): # @NoSelf """Creates all the logical property. The list of names of properties to be created is passed with frozenset log_props. The getter/setter information is taken from _{get,set}dict. This method resolves also wi...
python
def __create_log_props(cls, log_props, _getdict, _setdict): # @NoSelf """Creates all the logical property. The list of names of properties to be created is passed with frozenset log_props. The getter/setter information is taken from _{get,set}dict. This method resolves also wi...
['def', '__create_log_props', '(', 'cls', ',', 'log_props', ',', '_getdict', ',', '_setdict', ')', ':', '# @NoSelf', 'real_log_props', '=', 'set', '(', ')', 'resolved_getdict', '=', '{', '}', 'resolved_setdict', '=', '{', '}', 'for', '_dict_name', ',', '_dict', ',', '_resolved_dict', 'in', '(', '(', '"getter"', ',', '_...
Creates all the logical property. The list of names of properties to be created is passed with frozenset log_props. The getter/setter information is taken from _{get,set}dict. This method resolves also wildcards in names, and performs all checks to ensure correctness. ...
['Creates', 'all', 'the', 'logical', 'property', '.']
train
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/support/metaclasses.py#L225-L342
3,860
jaredLunde/vital-tools
vital/debug/__init__.py
ProgressBar.finish
def finish(self): """ Resets the progress bar and clears it from the terminal """ pct = floor(round(self.progress/self.size, 2)*100) pr = floor(pct*.33) bar = "".join([" " for x in range(pr-1)] + ["↦"]) subprogress = self.format_parent_bar() if self.parent_bar else "" fin...
python
def finish(self): """ Resets the progress bar and clears it from the terminal """ pct = floor(round(self.progress/self.size, 2)*100) pr = floor(pct*.33) bar = "".join([" " for x in range(pr-1)] + ["↦"]) subprogress = self.format_parent_bar() if self.parent_bar else "" fin...
['def', 'finish', '(', 'self', ')', ':', 'pct', '=', 'floor', '(', 'round', '(', 'self', '.', 'progress', '/', 'self', '.', 'size', ',', '2', ')', '*', '100', ')', 'pr', '=', 'floor', '(', 'pct', '*', '.33', ')', 'bar', '=', '""', '.', 'join', '(', '[', '" "', 'for', 'x', 'in', 'range', '(', 'pr', '-', '1', ')', ']', '...
Resets the progress bar and clears it from the terminal
['Resets', 'the', 'progress', 'bar', 'and', 'clears', 'it', 'from', 'the', 'terminal']
train
https://github.com/jaredLunde/vital-tools/blob/ea924c9bbb6ec22aa66f8095f018b1ee0099ac04/vital/debug/__init__.py#L1925-L1935
3,861
globality-corp/microcosm-flask
microcosm_flask/swagger/definitions.py
build_path
def build_path(operation, ns): """ Build a path URI for an operation. """ try: return ns.url_for(operation, _external=False) except BuildError as error: # we are missing some URI path parameters uri_templates = { argument: "{{{}}}".format(argument) fo...
python
def build_path(operation, ns): """ Build a path URI for an operation. """ try: return ns.url_for(operation, _external=False) except BuildError as error: # we are missing some URI path parameters uri_templates = { argument: "{{{}}}".format(argument) fo...
['def', 'build_path', '(', 'operation', ',', 'ns', ')', ':', 'try', ':', 'return', 'ns', '.', 'url_for', '(', 'operation', ',', '_external', '=', 'False', ')', 'except', 'BuildError', 'as', 'error', ':', '# we are missing some URI path parameters', 'uri_templates', '=', '{', 'argument', ':', '"{{{}}}"', '.', 'format', ...
Build a path URI for an operation.
['Build', 'a', 'path', 'URI', 'for', 'an', 'operation', '.']
train
https://github.com/globality-corp/microcosm-flask/blob/c2eaf57f03e7d041eea343751a4a90fcc80df418/microcosm_flask/swagger/definitions.py#L123-L137
3,862
NatLibFi/Skosify
skosify/check.py
hierarchy_cycles
def hierarchy_cycles(rdf, fix=False): """Check if the graph contains skos:broader cycles and optionally break these. :param Graph rdf: An rdflib.graph.Graph object. :param bool fix: Fix the problem by removing any skos:broader that overlaps with skos:broaderTransitive. """ top_concepts = so...
python
def hierarchy_cycles(rdf, fix=False): """Check if the graph contains skos:broader cycles and optionally break these. :param Graph rdf: An rdflib.graph.Graph object. :param bool fix: Fix the problem by removing any skos:broader that overlaps with skos:broaderTransitive. """ top_concepts = so...
['def', 'hierarchy_cycles', '(', 'rdf', ',', 'fix', '=', 'False', ')', ':', 'top_concepts', '=', 'sorted', '(', 'rdf', '.', 'subject_objects', '(', 'SKOS', '.', 'hasTopConcept', ')', ')', 'status', '=', '{', '}', 'for', 'cs', ',', 'root', 'in', 'top_concepts', ':', '_hierarchy_cycles_visit', '(', 'rdf', ',', 'root', ',...
Check if the graph contains skos:broader cycles and optionally break these. :param Graph rdf: An rdflib.graph.Graph object. :param bool fix: Fix the problem by removing any skos:broader that overlaps with skos:broaderTransitive.
['Check', 'if', 'the', 'graph', 'contains', 'skos', ':', 'broader', 'cycles', 'and', 'optionally', 'break', 'these', '.']
train
https://github.com/NatLibFi/Skosify/blob/1d269987f10df08e706272dcf6a86aef4abebcde/skosify/check.py#L37-L58
3,863
edublancas/sklearn-evaluation
sklearn_evaluation/plot/classification.py
confusion_matrix
def confusion_matrix(y_true, y_pred, target_names=None, normalize=False, cmap=None, ax=None): """ Plot confustion matrix. Parameters ---------- y_true : array-like, shape = [n_samples] Correct target values (ground truth). y_pred : array-like, shape = [n_samples] ...
python
def confusion_matrix(y_true, y_pred, target_names=None, normalize=False, cmap=None, ax=None): """ Plot confustion matrix. Parameters ---------- y_true : array-like, shape = [n_samples] Correct target values (ground truth). y_pred : array-like, shape = [n_samples] ...
['def', 'confusion_matrix', '(', 'y_true', ',', 'y_pred', ',', 'target_names', '=', 'None', ',', 'normalize', '=', 'False', ',', 'cmap', '=', 'None', ',', 'ax', '=', 'None', ')', ':', 'if', 'any', '(', '(', 'val', 'is', 'None', 'for', 'val', 'in', '(', 'y_true', ',', 'y_pred', ')', ')', ')', ':', 'raise', 'ValueError',...
Plot confustion matrix. Parameters ---------- y_true : array-like, shape = [n_samples] Correct target values (ground truth). y_pred : array-like, shape = [n_samples] Target predicted classes (estimator predictions). target_names : list List containing the names of the target...
['Plot', 'confustion', 'matrix', '.']
train
https://github.com/edublancas/sklearn-evaluation/blob/79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39/sklearn_evaluation/plot/classification.py#L13-L105
3,864
indico/indico-plugins
piwik/indico_piwik/queries/utils.py
get_json_from_remote_server
def get_json_from_remote_server(func, **kwargs): """ Safely manage calls to the remote server by encapsulating JSON creation from Piwik data. """ rawjson = func(**kwargs) if rawjson is None: # If the request failed we already logged in in PiwikRequest; # no need to get into the e...
python
def get_json_from_remote_server(func, **kwargs): """ Safely manage calls to the remote server by encapsulating JSON creation from Piwik data. """ rawjson = func(**kwargs) if rawjson is None: # If the request failed we already logged in in PiwikRequest; # no need to get into the e...
['def', 'get_json_from_remote_server', '(', 'func', ',', '*', '*', 'kwargs', ')', ':', 'rawjson', '=', 'func', '(', '*', '*', 'kwargs', ')', 'if', 'rawjson', 'is', 'None', ':', '# If the request failed we already logged in in PiwikRequest;', '# no need to get into the exception handler below.', 'return', '{', '}', 'try...
Safely manage calls to the remote server by encapsulating JSON creation from Piwik data.
['Safely', 'manage', 'calls', 'to', 'the', 'remote', 'server', 'by', 'encapsulating', 'JSON', 'creation', 'from', 'Piwik', 'data', '.']
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/piwik/indico_piwik/queries/utils.py#L22-L40
3,865
gbowerman/azurerm
examples/jumpbox.py
main
def main(): '''Main routine.''' # validate command line arguments arg_parser = argparse.ArgumentParser() arg_parser.add_argument('--vmname', '-n', required=True, action='store', help='Name') arg_parser.add_argument('--rgname', '-g', required=True, action='store', help='R...
python
def main(): '''Main routine.''' # validate command line arguments arg_parser = argparse.ArgumentParser() arg_parser.add_argument('--vmname', '-n', required=True, action='store', help='Name') arg_parser.add_argument('--rgname', '-g', required=True, action='store', help='R...
['def', 'main', '(', ')', ':', '# validate command line arguments', 'arg_parser', '=', 'argparse', '.', 'ArgumentParser', '(', ')', 'arg_parser', '.', 'add_argument', '(', "'--vmname'", ',', "'-n'", ',', 'required', '=', 'True', ',', 'action', '=', "'store'", ',', 'help', '=', "'Name'", ')', 'arg_parser', '.', 'add_arg...
Main routine.
['Main', 'routine', '.']
train
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/examples/jumpbox.py#L12-L245
3,866
lionheart/django-pyodbc
django_pyodbc/introspection.py
DatabaseIntrospection.get_table_description
def get_table_description(self, cursor, table_name, identity_check=True): """Returns a description of the table, with DB-API cursor.description interface. The 'auto_check' parameter has been added to the function argspec. If set to True, the function will check each of the table's fields for th...
python
def get_table_description(self, cursor, table_name, identity_check=True): """Returns a description of the table, with DB-API cursor.description interface. The 'auto_check' parameter has been added to the function argspec. If set to True, the function will check each of the table's fields for th...
['def', 'get_table_description', '(', 'self', ',', 'cursor', ',', 'table_name', ',', 'identity_check', '=', 'True', ')', ':', "# map pyodbc's cursor.columns to db-api cursor description", 'columns', '=', '[', '[', 'c', '[', '3', ']', ',', 'c', '[', '4', ']', ',', 'None', ',', 'c', '[', '6', ']', ',', 'c', '[', '6', ']'...
Returns a description of the table, with DB-API cursor.description interface. The 'auto_check' parameter has been added to the function argspec. If set to True, the function will check each of the table's fields for the IDENTITY property (the IDENTITY property is the MSSQL equivalent to an Auto...
['Returns', 'a', 'description', 'of', 'the', 'table', 'with', 'DB', '-', 'API', 'cursor', '.', 'description', 'interface', '.']
train
https://github.com/lionheart/django-pyodbc/blob/46adda7b0bfabfa2640f72592c6f6f407f78b363/django_pyodbc/introspection.py#L114-L137
3,867
googlemaps/google-maps-services-python
googlemaps/places.py
_autocomplete
def _autocomplete(client, url_part, input_text, session_token=None, offset=None, location=None, radius=None, language=None, types=None, components=None, strict_bounds=False): """ Internal handler for ``autocomplete`` and ``autocomplete_query``. See each method's docs for ...
python
def _autocomplete(client, url_part, input_text, session_token=None, offset=None, location=None, radius=None, language=None, types=None, components=None, strict_bounds=False): """ Internal handler for ``autocomplete`` and ``autocomplete_query``. See each method's docs for ...
['def', '_autocomplete', '(', 'client', ',', 'url_part', ',', 'input_text', ',', 'session_token', '=', 'None', ',', 'offset', '=', 'None', ',', 'location', '=', 'None', ',', 'radius', '=', 'None', ',', 'language', '=', 'None', ',', 'types', '=', 'None', ',', 'components', '=', 'None', ',', 'strict_bounds', '=', 'False'...
Internal handler for ``autocomplete`` and ``autocomplete_query``. See each method's docs for arg details.
['Internal', 'handler', 'for', 'autocomplete', 'and', 'autocomplete_query', '.', 'See', 'each', 'method', 's', 'docs', 'for', 'arg', 'details', '.']
train
https://github.com/googlemaps/google-maps-services-python/blob/7ed40b4d8df63479794c46ce29d03ed6083071d7/googlemaps/places.py#L517-L547
3,868
harmsm/PyCmdMessenger
PyCmdMessenger/PyCmdMessenger.py
CmdMessenger._send_byte
def _send_byte(self,value): """ Convert a numerical value into an integer, then to a byte object. Check bounds for byte. """ # Coerce to int. This will throw a ValueError if the value can't # actually be converted. if type(value) != int: new_value = i...
python
def _send_byte(self,value): """ Convert a numerical value into an integer, then to a byte object. Check bounds for byte. """ # Coerce to int. This will throw a ValueError if the value can't # actually be converted. if type(value) != int: new_value = i...
['def', '_send_byte', '(', 'self', ',', 'value', ')', ':', "# Coerce to int. This will throw a ValueError if the value can't", '# actually be converted.', 'if', 'type', '(', 'value', ')', '!=', 'int', ':', 'new_value', '=', 'int', '(', 'value', ')', 'if', 'self', '.', 'give_warnings', ':', 'w', '=', '"Coercing {} into ...
Convert a numerical value into an integer, then to a byte object. Check bounds for byte.
['Convert', 'a', 'numerical', 'value', 'into', 'an', 'integer', 'then', 'to', 'a', 'byte', 'object', '.', 'Check', 'bounds', 'for', 'byte', '.']
train
https://github.com/harmsm/PyCmdMessenger/blob/215d6f9402262662a14a2996f532934339639a5b/PyCmdMessenger/PyCmdMessenger.py#L341-L362
3,869
manahl/arctic
arctic/chunkstore/chunkstore.py
ChunkStore.__update
def __update(self, sym, item, metadata=None, combine_method=None, chunk_range=None, audit=None): ''' helper method used by update and append since they very closely resemble eachother. Really differ only by the combine method. append will combine existing date with new data (within a chu...
python
def __update(self, sym, item, metadata=None, combine_method=None, chunk_range=None, audit=None): ''' helper method used by update and append since they very closely resemble eachother. Really differ only by the combine method. append will combine existing date with new data (within a chu...
['def', '__update', '(', 'self', ',', 'sym', ',', 'item', ',', 'metadata', '=', 'None', ',', 'combine_method', '=', 'None', ',', 'chunk_range', '=', 'None', ',', 'audit', '=', 'None', ')', ':', 'if', 'not', 'isinstance', '(', 'item', ',', '(', 'DataFrame', ',', 'Series', ')', ')', ':', 'raise', 'Exception', '(', '"Can ...
helper method used by update and append since they very closely resemble eachother. Really differ only by the combine method. append will combine existing date with new data (within a chunk), whereas update will replace existing data with new data (within a chunk).
['helper', 'method', 'used', 'by', 'update', 'and', 'append', 'since', 'they', 'very', 'closely', 'resemble', 'eachother', '.', 'Really', 'differ', 'only', 'by', 'the', 'combine', 'method', '.', 'append', 'will', 'combine', 'existing', 'date', 'with', 'new', 'data', '(', 'within', 'a', 'chunk', ')', 'whereas', 'update'...
train
https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/chunkstore.py#L406-L491
3,870
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_vlan.py
brocade_vlan.vlan_classifier_group_rule_name
def vlan_classifier_group_rule_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") vlan = ET.SubElement(config, "vlan", xmlns="urn:brocade.com:mgmt:brocade-vlan") classifier = ET.SubElement(vlan, "classifier") group = ET.SubElement(classifier, "...
python
def vlan_classifier_group_rule_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") vlan = ET.SubElement(config, "vlan", xmlns="urn:brocade.com:mgmt:brocade-vlan") classifier = ET.SubElement(vlan, "classifier") group = ET.SubElement(classifier, "...
['def', 'vlan_classifier_group_rule_name', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'config', '=', 'ET', '.', 'Element', '(', '"config"', ')', 'vlan', '=', 'ET', '.', 'SubElement', '(', 'config', ',', '"vlan"', ',', 'xmlns', '=', '"urn:brocade.com:mgmt:brocade-vlan"', ')', 'classifier', '=', 'ET', '.', 'SubEleme...
Auto Generated Code
['Auto', 'Generated', 'Code']
train
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_vlan.py#L117-L134
3,871
mdsol/rwslib
rwslib/extras/audit_event/parser.py
parse
def parse(data, eventer): """Parse the XML data, firing events from the eventer""" parser = etree.XMLParser(target=ODMTargetParser(eventer)) return etree.XML(data, parser)
python
def parse(data, eventer): """Parse the XML data, firing events from the eventer""" parser = etree.XMLParser(target=ODMTargetParser(eventer)) return etree.XML(data, parser)
['def', 'parse', '(', 'data', ',', 'eventer', ')', ':', 'parser', '=', 'etree', '.', 'XMLParser', '(', 'target', '=', 'ODMTargetParser', '(', 'eventer', ')', ')', 'return', 'etree', '.', 'XML', '(', 'data', ',', 'parser', ')']
Parse the XML data, firing events from the eventer
['Parse', 'the', 'XML', 'data', 'firing', 'events', 'from', 'the', 'eventer']
train
https://github.com/mdsol/rwslib/blob/1a86bc072d408c009ed1de8bf6e98a1769f54d18/rwslib/extras/audit_event/parser.py#L284-L287
3,872
titusjan/argos
argos/repo/detailplugins/attr.py
AttributesPane._drawContents
def _drawContents(self, currentRti=None): """ Draws the attributes of the currentRTI """ #logger.debug("_drawContents: {}".format(currentRti)) table = self.table table.setUpdatesEnabled(False) try: table.clearContents() verticalHeader = table.verti...
python
def _drawContents(self, currentRti=None): """ Draws the attributes of the currentRTI """ #logger.debug("_drawContents: {}".format(currentRti)) table = self.table table.setUpdatesEnabled(False) try: table.clearContents() verticalHeader = table.verti...
['def', '_drawContents', '(', 'self', ',', 'currentRti', '=', 'None', ')', ':', '#logger.debug("_drawContents: {}".format(currentRti))', 'table', '=', 'self', '.', 'table', 'table', '.', 'setUpdatesEnabled', '(', 'False', ')', 'try', ':', 'table', '.', 'clearContents', '(', ')', 'verticalHeader', '=', 'table', '.', 've...
Draws the attributes of the currentRTI
['Draws', 'the', 'attributes', 'of', 'the', 'currentRTI']
train
https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/repo/detailplugins/attr.py#L51-L86
3,873
ungarj/tilematrix
tilematrix/tmx/main.py
tile
def tile(ctx, point, zoom): """Print Tile containing POINT..""" tile = TilePyramid( ctx.obj['grid'], tile_size=ctx.obj['tile_size'], metatiling=ctx.obj['metatiling'] ).tile_from_xy(*point, zoom=zoom) if ctx.obj['output_format'] == 'Tile': click.echo('%s %s %s' % tile.id) ...
python
def tile(ctx, point, zoom): """Print Tile containing POINT..""" tile = TilePyramid( ctx.obj['grid'], tile_size=ctx.obj['tile_size'], metatiling=ctx.obj['metatiling'] ).tile_from_xy(*point, zoom=zoom) if ctx.obj['output_format'] == 'Tile': click.echo('%s %s %s' % tile.id) ...
['def', 'tile', '(', 'ctx', ',', 'point', ',', 'zoom', ')', ':', 'tile', '=', 'TilePyramid', '(', 'ctx', '.', 'obj', '[', "'grid'", ']', ',', 'tile_size', '=', 'ctx', '.', 'obj', '[', "'tile_size'", ']', ',', 'metatiling', '=', 'ctx', '.', 'obj', '[', "'metatiling'", ']', ')', '.', 'tile_from_xy', '(', '*', 'point', ',...
Print Tile containing POINT..
['Print', 'Tile', 'containing', 'POINT', '..']
train
https://github.com/ungarj/tilematrix/blob/6f8cd3b85f61434a7ce5d7b635c3ad8f18ccb268/tilematrix/tmx/main.py#L71-L96
3,874
gem/oq-engine
openquake/hazardlib/near_fault.py
directp
def directp(node0, node1, node2, node3, hypocenter, reference, pp): """ Get the Direct Point and the corresponding E-path as described in Spudich et al. (2013). This method also provides a logical variable stating if the DPP calculation must consider the neighbouring patch. To define the intersectio...
python
def directp(node0, node1, node2, node3, hypocenter, reference, pp): """ Get the Direct Point and the corresponding E-path as described in Spudich et al. (2013). This method also provides a logical variable stating if the DPP calculation must consider the neighbouring patch. To define the intersectio...
['def', 'directp', '(', 'node0', ',', 'node1', ',', 'node2', ',', 'node3', ',', 'hypocenter', ',', 'reference', ',', 'pp', ')', ':', '# Find the intersection point Pd, by checking if the PdPh share the', '# same vector with PpPh, and PpPh >= PdPh', '# Transform to xyz coordinate', 'node0_xyz', '=', 'get_xyz_from_ll', ...
Get the Direct Point and the corresponding E-path as described in Spudich et al. (2013). This method also provides a logical variable stating if the DPP calculation must consider the neighbouring patch. To define the intersection point(Pd) of PpPh line segment and fault plane, we obtain the intersection...
['Get', 'the', 'Direct', 'Point', 'and', 'the', 'corresponding', 'E', '-', 'path', 'as', 'described', 'in', 'Spudich', 'et', 'al', '.', '(', '2013', ')', '.', 'This', 'method', 'also', 'provides', 'a', 'logical', 'variable', 'stating', 'if', 'the', 'DPP', 'calculation', 'must', 'consider', 'the', 'neighbouring', 'patch...
train
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/near_fault.py#L338-L484
3,875
danilobellini/audiolazy
audiolazy/lazy_itertools.py
accumulate
def accumulate(iterable): " Return series of accumulated sums. " iterator = iter(iterable) sum_data = next(iterator) yield sum_data for el in iterator: sum_data += el yield sum_data
python
def accumulate(iterable): " Return series of accumulated sums. " iterator = iter(iterable) sum_data = next(iterator) yield sum_data for el in iterator: sum_data += el yield sum_data
['def', 'accumulate', '(', 'iterable', ')', ':', 'iterator', '=', 'iter', '(', 'iterable', ')', 'sum_data', '=', 'next', '(', 'iterator', ')', 'yield', 'sum_data', 'for', 'el', 'in', 'iterator', ':', 'sum_data', '+=', 'el', 'yield', 'sum_data']
Return series of accumulated sums.
['Return', 'series', 'of', 'accumulated', 'sums', '.']
train
https://github.com/danilobellini/audiolazy/blob/dba0a278937909980ed40b976d866b8e97c35dee/audiolazy/lazy_itertools.py#L69-L76
3,876
JustinLovinger/optimal
optimal/algorithms/baseline.py
RandomReal._generate_solution
def _generate_solution(self): """Return a single random solution.""" return common.random_real_solution( self._solution_size, self._lower_bounds, self._upper_bounds)
python
def _generate_solution(self): """Return a single random solution.""" return common.random_real_solution( self._solution_size, self._lower_bounds, self._upper_bounds)
['def', '_generate_solution', '(', 'self', ')', ':', 'return', 'common', '.', 'random_real_solution', '(', 'self', '.', '_solution_size', ',', 'self', '.', '_lower_bounds', ',', 'self', '.', '_upper_bounds', ')']
Return a single random solution.
['Return', 'a', 'single', 'random', 'solution', '.']
train
https://github.com/JustinLovinger/optimal/blob/ab48a4961697338cc32d50e3a6b06ac989e39c3f/optimal/algorithms/baseline.py#L108-L111
3,877
resonai/ybt
yabt/buildcontext.py
BuildContext.register_target
def register_target(self, target: Target): """Register a `target` instance in this build context. A registered target is saved in the `targets` map and in the `targets_by_module` map, but is not added to the target graph until target extraction is completed (thread safety considerations...
python
def register_target(self, target: Target): """Register a `target` instance in this build context. A registered target is saved in the `targets` map and in the `targets_by_module` map, but is not added to the target graph until target extraction is completed (thread safety considerations...
['def', 'register_target', '(', 'self', ',', 'target', ':', 'Target', ')', ':', 'if', 'target', '.', 'name', 'in', 'self', '.', 'targets', ':', 'first', '=', 'self', '.', 'targets', '[', 'target', '.', 'name', ']', 'raise', 'NameError', '(', '\'Target with name "{0.name}" ({0.builder_name} from module \'', '\'"{1}") al...
Register a `target` instance in this build context. A registered target is saved in the `targets` map and in the `targets_by_module` map, but is not added to the target graph until target extraction is completed (thread safety considerations).
['Register', 'a', 'target', 'instance', 'in', 'this', 'build', 'context', '.']
train
https://github.com/resonai/ybt/blob/5b40df0922ef3383eb85f2b04a26a2db4b81b3fd/yabt/buildcontext.py#L148-L165
3,878
mozilla/django-tidings
tidings/models.py
multi_raw
def multi_raw(query, params, models, model_to_fields): """Scoop multiple model instances out of the DB at once, given a query that returns all fields of each. Return an iterable of sequences of model instances parallel to the ``models`` sequence of classes. For example:: [(<User such-and-such>...
python
def multi_raw(query, params, models, model_to_fields): """Scoop multiple model instances out of the DB at once, given a query that returns all fields of each. Return an iterable of sequences of model instances parallel to the ``models`` sequence of classes. For example:: [(<User such-and-such>...
['def', 'multi_raw', '(', 'query', ',', 'params', ',', 'models', ',', 'model_to_fields', ')', ':', 'cursor', '=', 'connections', '[', 'router', '.', 'db_for_read', '(', 'models', '[', '0', ']', ')', ']', '.', 'cursor', '(', ')', 'cursor', '.', 'execute', '(', 'query', ',', 'params', ')', 'rows', '=', 'cursor', '.', 'fe...
Scoop multiple model instances out of the DB at once, given a query that returns all fields of each. Return an iterable of sequences of model instances parallel to the ``models`` sequence of classes. For example:: [(<User such-and-such>, <Watch such-and-such>), ...]
['Scoop', 'multiple', 'model', 'instances', 'out', 'of', 'the', 'DB', 'at', 'once', 'given', 'a', 'query', 'that', 'returns', 'all', 'fields', 'of', 'each', '.']
train
https://github.com/mozilla/django-tidings/blob/b2895b3cdec6aae18315afcceb92bb16317f0f96/tidings/models.py#L16-L34
3,879
swistakm/graceful
src/graceful/authentication.py
BaseAuthenticationMiddleware.process_resource
def process_resource(self, req, resp, resource, uri_kwargs=None): """Process resource after routing to it. This is basic falcon middleware handler. Args: req (falcon.Request): request object resp (falcon.Response): response object resource (object): resource...
python
def process_resource(self, req, resp, resource, uri_kwargs=None): """Process resource after routing to it. This is basic falcon middleware handler. Args: req (falcon.Request): request object resp (falcon.Response): response object resource (object): resource...
['def', 'process_resource', '(', 'self', ',', 'req', ',', 'resp', ',', 'resource', ',', 'uri_kwargs', '=', 'None', ')', ':', 'if', "'user'", 'in', 'req', '.', 'context', ':', 'return', 'identifier', '=', 'self', '.', 'identify', '(', 'req', ',', 'resp', ',', 'resource', ',', 'uri_kwargs', ')', 'user', '=', 'self', '.',...
Process resource after routing to it. This is basic falcon middleware handler. Args: req (falcon.Request): request object resp (falcon.Response): response object resource (object): resource object matched by falcon router uri_kwargs (dict): additional ke...
['Process', 'resource', 'after', 'routing', 'to', 'it', '.']
train
https://github.com/swistakm/graceful/blob/d4678cb6349a5c843a5e58002fc80140821609e4/src/graceful/authentication.py#L288-L314
3,880
edx/event-tracking
eventtracking/django/__init__.py
DjangoTracker.create_backends_from_settings
def create_backends_from_settings(self): """ Expects the Django setting "EVENT_TRACKING_BACKENDS" to be defined and point to a dictionary of backend engine configurations. Example:: EVENT_TRACKING_BACKENDS = { 'default': { 'ENGINE': 'some...
python
def create_backends_from_settings(self): """ Expects the Django setting "EVENT_TRACKING_BACKENDS" to be defined and point to a dictionary of backend engine configurations. Example:: EVENT_TRACKING_BACKENDS = { 'default': { 'ENGINE': 'some...
['def', 'create_backends_from_settings', '(', 'self', ')', ':', 'config', '=', 'getattr', '(', 'settings', ',', 'DJANGO_BACKEND_SETTING_NAME', ',', '{', '}', ')', 'backends', '=', 'self', '.', 'instantiate_objects', '(', 'config', ')', 'return', 'backends']
Expects the Django setting "EVENT_TRACKING_BACKENDS" to be defined and point to a dictionary of backend engine configurations. Example:: EVENT_TRACKING_BACKENDS = { 'default': { 'ENGINE': 'some.arbitrary.Backend', 'OPTIONS': { ...
['Expects', 'the', 'Django', 'setting', 'EVENT_TRACKING_BACKENDS', 'to', 'be', 'defined', 'and', 'point', 'to', 'a', 'dictionary', 'of', 'backend', 'engine', 'configurations', '.']
train
https://github.com/edx/event-tracking/blob/8f993560545061d77f11615f5e3865b3916d5ea9/eventtracking/django/__init__.py#L31-L57
3,881
cmap/cmapPy
cmapPy/set_io/gmt.py
write
def write(gmt, out_path): """ Write a GMT to a text file. Args: gmt (GMT object): list of dicts out_path (string): output path Returns: None """ with open(out_path, 'w') as f: for _, each_dict in enumerate(gmt): f.write(each_dict[SET_IDENTIFIER_FIELD] +...
python
def write(gmt, out_path): """ Write a GMT to a text file. Args: gmt (GMT object): list of dicts out_path (string): output path Returns: None """ with open(out_path, 'w') as f: for _, each_dict in enumerate(gmt): f.write(each_dict[SET_IDENTIFIER_FIELD] +...
['def', 'write', '(', 'gmt', ',', 'out_path', ')', ':', 'with', 'open', '(', 'out_path', ',', "'w'", ')', 'as', 'f', ':', 'for', '_', ',', 'each_dict', 'in', 'enumerate', '(', 'gmt', ')', ':', 'f', '.', 'write', '(', 'each_dict', '[', 'SET_IDENTIFIER_FIELD', ']', '+', "'\\t'", ')', 'f', '.', 'write', '(', 'each_dict', ...
Write a GMT to a text file. Args: gmt (GMT object): list of dicts out_path (string): output path Returns: None
['Write', 'a', 'GMT', 'to', 'a', 'text', 'file', '.']
train
https://github.com/cmap/cmapPy/blob/59d833b64fd2c3a494cdf67fe1eb11fc8008bf76/cmapPy/set_io/gmt.py#L93-L109
3,882
gagneurlab/concise
concise/eval_metrics.py
tnr
def tnr(y_true, y_pred, round=True): """True negative rate `tn / (tn + fp)` """ y_true, y_pred = _mask_value_nan(y_true, y_pred) if round: y_true = np.round(y_true) y_pred = np.round(y_pred) c = skm.confusion_matrix(y_true, y_pred) return c[0, 0] / c[0].sum()
python
def tnr(y_true, y_pred, round=True): """True negative rate `tn / (tn + fp)` """ y_true, y_pred = _mask_value_nan(y_true, y_pred) if round: y_true = np.round(y_true) y_pred = np.round(y_pred) c = skm.confusion_matrix(y_true, y_pred) return c[0, 0] / c[0].sum()
['def', 'tnr', '(', 'y_true', ',', 'y_pred', ',', 'round', '=', 'True', ')', ':', 'y_true', ',', 'y_pred', '=', '_mask_value_nan', '(', 'y_true', ',', 'y_pred', ')', 'if', 'round', ':', 'y_true', '=', 'np', '.', 'round', '(', 'y_true', ')', 'y_pred', '=', 'np', '.', 'round', '(', 'y_pred', ')', 'c', '=', 'skm', '.', 'c...
True negative rate `tn / (tn + fp)`
['True', 'negative', 'rate', 'tn', '/', '(', 'tn', '+', 'fp', ')']
train
https://github.com/gagneurlab/concise/blob/d15262eb1e590008bc96ba31e93bfbdbfa1a9fd4/concise/eval_metrics.py#L90-L98
3,883
T-002/pycast
pycast/methods/exponentialsmoothing.py
HoltWintersMethod.initialTrendSmoothingFactors
def initialTrendSmoothingFactors(self, timeSeries): """ Calculate the initial Trend smoothing Factor b0. Explanation: http://en.wikipedia.org/wiki/Exponential_smoothing#Triple_exponential_smoothing :return: Returns the initial trend smoothing factor b0 """ result...
python
def initialTrendSmoothingFactors(self, timeSeries): """ Calculate the initial Trend smoothing Factor b0. Explanation: http://en.wikipedia.org/wiki/Exponential_smoothing#Triple_exponential_smoothing :return: Returns the initial trend smoothing factor b0 """ result...
['def', 'initialTrendSmoothingFactors', '(', 'self', ',', 'timeSeries', ')', ':', 'result', '=', '0.0', 'seasonLength', '=', 'self', '.', 'get_parameter', '(', '"seasonLength"', ')', 'k', '=', 'min', '(', 'len', '(', 'timeSeries', ')', '-', 'seasonLength', ',', 'seasonLength', ')', '#In case of only one full season, us...
Calculate the initial Trend smoothing Factor b0. Explanation: http://en.wikipedia.org/wiki/Exponential_smoothing#Triple_exponential_smoothing :return: Returns the initial trend smoothing factor b0
['Calculate', 'the', 'initial', 'Trend', 'smoothing', 'Factor', 'b0', '.']
train
https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/exponentialsmoothing.py#L453-L467
3,884
radjkarl/fancyWidgets
fancywidgets/pyQtBased/Dialogs.py
Dialogs.getSaveFileName
def getSaveFileName(self, *args, **kwargs): """ analogue to QtWidgets.QFileDialog.getSaveFileNameAndFilter but returns the filename + chosen file ending even if not typed in gui """ if 'directory' not in kwargs: if self.opts['save']: if self.opts['save...
python
def getSaveFileName(self, *args, **kwargs): """ analogue to QtWidgets.QFileDialog.getSaveFileNameAndFilter but returns the filename + chosen file ending even if not typed in gui """ if 'directory' not in kwargs: if self.opts['save']: if self.opts['save...
['def', 'getSaveFileName', '(', 'self', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'if', "'directory'", 'not', 'in', 'kwargs', ':', 'if', 'self', '.', 'opts', '[', "'save'", ']', ':', 'if', 'self', '.', 'opts', '[', "'save'", ']', ':', 'kwargs', '[', "'directory'", ']', '=', 'self', '.', 'opts', '[', "'save'"...
analogue to QtWidgets.QFileDialog.getSaveFileNameAndFilter but returns the filename + chosen file ending even if not typed in gui
['analogue', 'to', 'QtWidgets', '.', 'QFileDialog', '.', 'getSaveFileNameAndFilter', 'but', 'returns', 'the', 'filename', '+', 'chosen', 'file', 'ending', 'even', 'if', 'not', 'typed', 'in', 'gui']
train
https://github.com/radjkarl/fancyWidgets/blob/ffe0d5747c5296c78575f0e0909af915a4a5698f/fancywidgets/pyQtBased/Dialogs.py#L34-L59
3,885
AtteqCom/zsl
src/zsl/task/task_decorator.py
jsonp_wrap
def jsonp_wrap(callback_key='callback'): """ Format response to jsonp and add a callback to JSON data - a jsonp request """ def decorator_fn(f): @wraps(f) def jsonp_output_decorator(*args, **kwargs): task_data = _get_data_from_args(args) data = task_data.get_dat...
python
def jsonp_wrap(callback_key='callback'): """ Format response to jsonp and add a callback to JSON data - a jsonp request """ def decorator_fn(f): @wraps(f) def jsonp_output_decorator(*args, **kwargs): task_data = _get_data_from_args(args) data = task_data.get_dat...
['def', 'jsonp_wrap', '(', 'callback_key', '=', "'callback'", ')', ':', 'def', 'decorator_fn', '(', 'f', ')', ':', '@', 'wraps', '(', 'f', ')', 'def', 'jsonp_output_decorator', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'task_data', '=', '_get_data_from_args', '(', 'args', ')', 'data', '=', 'task_data', '.', ...
Format response to jsonp and add a callback to JSON data - a jsonp request
['Format', 'response', 'to', 'jsonp', 'and', 'add', 'a', 'callback', 'to', 'JSON', 'data', '-', 'a', 'jsonp', 'request']
train
https://github.com/AtteqCom/zsl/blob/ab51a96da1780ff642912396d4b85bdcb72560c1/src/zsl/task/task_decorator.py#L134-L162
3,886
Spinmob/spinmob
egg/_gui.py
DataboxPlot.plot
def plot(self): """ Sets the internal databox to the supplied value and plots it. If databox=None, this will plot the internal databox. """ # if we're disabled or have no data columns, clear everything! if not self.button_enabled.is_checked() or len(self) == 0: ...
python
def plot(self): """ Sets the internal databox to the supplied value and plots it. If databox=None, this will plot the internal databox. """ # if we're disabled or have no data columns, clear everything! if not self.button_enabled.is_checked() or len(self) == 0: ...
['def', 'plot', '(', 'self', ')', ':', "# if we're disabled or have no data columns, clear everything!", 'if', 'not', 'self', '.', 'button_enabled', '.', 'is_checked', '(', ')', 'or', 'len', '(', 'self', ')', '==', '0', ':', 'self', '.', '_set_number_of_plots', '(', '0', ')', 'return', 'self', '# if there is no script,...
Sets the internal databox to the supplied value and plots it. If databox=None, this will plot the internal databox.
['Sets', 'the', 'internal', 'databox', 'to', 'the', 'supplied', 'value', 'and', 'plots', 'it', '.', 'If', 'databox', '=', 'None', 'this', 'will', 'plot', 'the', 'internal', 'databox', '.']
train
https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2756-L2840
3,887
tuxu/python-samplerate
samplerate/converters.py
resample
def resample(input_data, ratio, converter_type='sinc_best', verbose=False): """Resample the signal in `input_data` at once. Parameters ---------- input_data : ndarray Input data. A single channel is provided as a 1D array of `num_frames` length. Input data with several channels is repre...
python
def resample(input_data, ratio, converter_type='sinc_best', verbose=False): """Resample the signal in `input_data` at once. Parameters ---------- input_data : ndarray Input data. A single channel is provided as a 1D array of `num_frames` length. Input data with several channels is repre...
['def', 'resample', '(', 'input_data', ',', 'ratio', ',', 'converter_type', '=', "'sinc_best'", ',', 'verbose', '=', 'False', ')', ':', 'from', 'samplerate', '.', 'lowlevel', 'import', 'src_simple', 'from', 'samplerate', '.', 'exceptions', 'import', 'ResamplingError', 'input_data', '=', 'np', '.', 'require', '(', 'inpu...
Resample the signal in `input_data` at once. Parameters ---------- input_data : ndarray Input data. A single channel is provided as a 1D array of `num_frames` length. Input data with several channels is represented as a 2D array of shape (`num_frames`, `num_channels`). For use with ...
['Resample', 'the', 'signal', 'in', 'input_data', 'at', 'once', '.']
train
https://github.com/tuxu/python-samplerate/blob/ed73d7a39e61bfb34b03dade14ffab59aa27922a/samplerate/converters.py#L31-L90
3,888
googlefonts/ufo2ft
Lib/ufo2ft/outlineCompiler.py
BaseOutlineCompiler._setupTable_hhea_or_vhea
def _setupTable_hhea_or_vhea(self, tag): """ Make the hhea table or the vhea table. This assume the hmtx or the vmtx were respectively made first. """ if tag not in self.tables: return if tag == "hhea": isHhea = True else: isHh...
python
def _setupTable_hhea_or_vhea(self, tag): """ Make the hhea table or the vhea table. This assume the hmtx or the vmtx were respectively made first. """ if tag not in self.tables: return if tag == "hhea": isHhea = True else: isHh...
['def', '_setupTable_hhea_or_vhea', '(', 'self', ',', 'tag', ')', ':', 'if', 'tag', 'not', 'in', 'self', '.', 'tables', ':', 'return', 'if', 'tag', '==', '"hhea"', ':', 'isHhea', '=', 'True', 'else', ':', 'isHhea', '=', 'False', 'self', '.', 'otf', '[', 'tag', ']', '=', 'table', '=', 'newTable', '(', 'tag', ')', 'mtxTa...
Make the hhea table or the vhea table. This assume the hmtx or the vmtx were respectively made first.
['Make', 'the', 'hhea', 'table', 'or', 'the', 'vhea', 'table', '.', 'This', 'assume', 'the', 'hmtx', 'or', 'the', 'vmtx', 'were', 'respectively', 'made', 'first', '.']
train
https://github.com/googlefonts/ufo2ft/blob/915b986558e87bee288765d9218cc1cd4ebf7f4c/Lib/ufo2ft/outlineCompiler.py#L635-L727
3,889
klahnakoski/pyLibrary
mo_json_config/__init__.py
get
def get(url): """ USE json.net CONVENTIONS TO LINK TO INLINE OTHER JSON """ url = text_type(url) if url.find("://") == -1: Log.error("{{url}} must have a prototcol (eg http://) declared", url=url) base = URL("") if url.startswith("file://") and url[7] != "/": if os.sep=="\\"...
python
def get(url): """ USE json.net CONVENTIONS TO LINK TO INLINE OTHER JSON """ url = text_type(url) if url.find("://") == -1: Log.error("{{url}} must have a prototcol (eg http://) declared", url=url) base = URL("") if url.startswith("file://") and url[7] != "/": if os.sep=="\\"...
['def', 'get', '(', 'url', ')', ':', 'url', '=', 'text_type', '(', 'url', ')', 'if', 'url', '.', 'find', '(', '"://"', ')', '==', '-', '1', ':', 'Log', '.', 'error', '(', '"{{url}} must have a prototcol (eg http://) declared"', ',', 'url', '=', 'url', ')', 'base', '=', 'URL', '(', '""', ')', 'if', 'url', '.', 'startswi...
USE json.net CONVENTIONS TO LINK TO INLINE OTHER JSON
['USE', 'json', '.', 'net', 'CONVENTIONS', 'TO', 'LINK', 'TO', 'INLINE', 'OTHER', 'JSON']
train
https://github.com/klahnakoski/pyLibrary/blob/fa2dcbc48fda8d26999baef400e9a98149e0b982/mo_json_config/__init__.py#L36-L58
3,890
eyurtsev/FlowCytometryTools
FlowCytometryTools/core/bases.py
MeasurementCollection.filter_by_IDs
def filter_by_IDs(self, ids, ID=None): """ Keep only Measurements with given IDs. """ fil = lambda x: x in ids return self.filter_by_attr('ID', fil, ID)
python
def filter_by_IDs(self, ids, ID=None): """ Keep only Measurements with given IDs. """ fil = lambda x: x in ids return self.filter_by_attr('ID', fil, ID)
['def', 'filter_by_IDs', '(', 'self', ',', 'ids', ',', 'ID', '=', 'None', ')', ':', 'fil', '=', 'lambda', 'x', ':', 'x', 'in', 'ids', 'return', 'self', '.', 'filter_by_attr', '(', "'ID'", ',', 'fil', ',', 'ID', ')']
Keep only Measurements with given IDs.
['Keep', 'only', 'Measurements', 'with', 'given', 'IDs', '.']
train
https://github.com/eyurtsev/FlowCytometryTools/blob/4355632508b875273d68c7e2972c17668bcf7b40/FlowCytometryTools/core/bases.py#L658-L663
3,891
oscarlazoarjona/fast
fast/bloch.py
observable
def observable(operator, rho, unfolding, complex=False): r"""Return an observable ammount. INPUT: - ``operator`` - An square matrix representing a hermitian operator \ in thesame basis as the density matrix. - ``rho`` - A density matrix in unfolded format, or a list of such \ density matrice...
python
def observable(operator, rho, unfolding, complex=False): r"""Return an observable ammount. INPUT: - ``operator`` - An square matrix representing a hermitian operator \ in thesame basis as the density matrix. - ``rho`` - A density matrix in unfolded format, or a list of such \ density matrice...
['def', 'observable', '(', 'operator', ',', 'rho', ',', 'unfolding', ',', 'complex', '=', 'False', ')', ':', 'if', 'len', '(', 'rho', '.', 'shape', ')', '==', '2', ':', 'return', 'np', '.', 'array', '(', '[', 'observable', '(', 'operator', ',', 'i', ',', 'unfolding', ')', 'for', 'i', 'in', 'rho', ']', ')', 'Ne', '=', '...
r"""Return an observable ammount. INPUT: - ``operator`` - An square matrix representing a hermitian operator \ in thesame basis as the density matrix. - ``rho`` - A density matrix in unfolded format, or a list of such \ density matrices. - ``unfolding`` - A mapping from matrix element indic...
['r', 'Return', 'an', 'observable', 'ammount', '.']
train
https://github.com/oscarlazoarjona/fast/blob/3e5400672af2a7b7cc616e7f4aa10d7672720222/fast/bloch.py#L3161-L3217
3,892
CyberReboot/vent
vent/extras/network_tap/ncontrol/paths.py
NICsR.on_get
def on_get(self, req, resp): """ Send a GET request to get the list of all available network interfaces """ resp.content_type = falcon.MEDIA_TEXT resp.status = falcon.HTTP_200 # connect to docker try: d_client = docker.from_env() except Except...
python
def on_get(self, req, resp): """ Send a GET request to get the list of all available network interfaces """ resp.content_type = falcon.MEDIA_TEXT resp.status = falcon.HTTP_200 # connect to docker try: d_client = docker.from_env() except Except...
['def', 'on_get', '(', 'self', ',', 'req', ',', 'resp', ')', ':', 'resp', '.', 'content_type', '=', 'falcon', '.', 'MEDIA_TEXT', 'resp', '.', 'status', '=', 'falcon', '.', 'HTTP_200', '# connect to docker', 'try', ':', 'd_client', '=', 'docker', '.', 'from_env', '(', ')', 'except', 'Exception', 'as', 'e', ':', '# pragm...
Send a GET request to get the list of all available network interfaces
['Send', 'a', 'GET', 'request', 'to', 'get', 'the', 'list', 'of', 'all', 'available', 'network', 'interfaces']
train
https://github.com/CyberReboot/vent/blob/9956a09146b11a89a0eabab3bc7ce8906d124885/vent/extras/network_tap/ncontrol/paths.py#L201-L225
3,893
jtwhite79/pyemu
pyemu/utils/helpers.py
PstFromFlopyModel.setup_hds
def setup_hds(self): """ setup modflow head save file observations for given kper (zero-based stress period index) and k (zero-based layer index) pairs using the kperk argument. Note ---- this can setup a shit-ton of observations this is useful for dataw...
python
def setup_hds(self): """ setup modflow head save file observations for given kper (zero-based stress period index) and k (zero-based layer index) pairs using the kperk argument. Note ---- this can setup a shit-ton of observations this is useful for dataw...
['def', 'setup_hds', '(', 'self', ')', ':', 'if', 'self', '.', 'hds_kperk', 'is', 'None', 'or', 'len', '(', 'self', '.', 'hds_kperk', ')', '==', '0', ':', 'return', 'from', '.', 'gw_utils', 'import', 'setup_hds_obs', '# if len(self.hds_kperk) == 2:', '# try:', '# if len(self.hds_kperk[0] == 2):', '# ...
setup modflow head save file observations for given kper (zero-based stress period index) and k (zero-based layer index) pairs using the kperk argument. Note ---- this can setup a shit-ton of observations this is useful for dataworth analyses or for monitoring ...
['setup', 'modflow', 'head', 'save', 'file', 'observations', 'for', 'given', 'kper', '(', 'zero', '-', 'based', 'stress', 'period', 'index', ')', 'and', 'k', '(', 'zero', '-', 'based', 'layer', 'index', ')', 'pairs', 'using', 'the', 'kperk', 'argument', '.']
train
https://github.com/jtwhite79/pyemu/blob/c504d8e7a4097cec07655a6318d275739bd8148a/pyemu/utils/helpers.py#L3272-L3321
3,894
touilleMan/marshmallow-mongoengine
marshmallow_mongoengine/conversion/fields.py
MetaFieldBuilder.build_marshmallow_field
def build_marshmallow_field(self, **kwargs): """ :return: The Marshmallow Field instanciated and configured """ field_kwargs = None for param in self.params: field_kwargs = param.apply(field_kwargs) field_kwargs.update(kwargs) return self.marshmallow_f...
python
def build_marshmallow_field(self, **kwargs): """ :return: The Marshmallow Field instanciated and configured """ field_kwargs = None for param in self.params: field_kwargs = param.apply(field_kwargs) field_kwargs.update(kwargs) return self.marshmallow_f...
['def', 'build_marshmallow_field', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'field_kwargs', '=', 'None', 'for', 'param', 'in', 'self', '.', 'params', ':', 'field_kwargs', '=', 'param', '.', 'apply', '(', 'field_kwargs', ')', 'field_kwargs', '.', 'update', '(', 'kwargs', ')', 'return', 'self', '.', 'marshmallow_f...
:return: The Marshmallow Field instanciated and configured
[':', 'return', ':', 'The', 'Marshmallow', 'Field', 'instanciated', 'and', 'configured']
train
https://github.com/touilleMan/marshmallow-mongoengine/blob/21223700ea1f1d0209c967761e5c22635ee721e7/marshmallow_mongoengine/conversion/fields.py#L25-L33
3,895
JoeVirtual/KonFoo
konfoo/core.py
Field.serialize
def serialize(self, buffer=bytearray(), index=Index(), **options): """ Serializes the `Field` to the byte *buffer* starting at the begin of the *buffer* or with the given *index* by packing the :attr:`value` of the `Field` to the byte *buffer* in accordance with the encoding *byte order*...
python
def serialize(self, buffer=bytearray(), index=Index(), **options): """ Serializes the `Field` to the byte *buffer* starting at the begin of the *buffer* or with the given *index* by packing the :attr:`value` of the `Field` to the byte *buffer* in accordance with the encoding *byte order*...
['def', 'serialize', '(', 'self', ',', 'buffer', '=', 'bytearray', '(', ')', ',', 'index', '=', 'Index', '(', ')', ',', '*', '*', 'options', ')', ':', 'self', '.', 'index', '=', 'index', 'buffer', '+=', 'self', '.', 'pack', '(', 'buffer', ',', '*', '*', 'options', ')', 'return', 'self', '.', 'index_field', '(', 'index'...
Serializes the `Field` to the byte *buffer* starting at the begin of the *buffer* or with the given *index* by packing the :attr:`value` of the `Field` to the byte *buffer* in accordance with the encoding *byte order* for the serialization and the encoding :attr:`byte_order` of the `Fiel...
['Serializes', 'the', 'Field', 'to', 'the', 'byte', '*', 'buffer', '*', 'starting', 'at', 'the', 'begin', 'of', 'the', '*', 'buffer', '*', 'or', 'with', 'the', 'given', '*', 'index', '*', 'by', 'packing', 'the', ':', 'attr', ':', 'value', 'of', 'the', 'Field', 'to', 'the', 'byte', '*', 'buffer', '*', 'in', 'accordance'...
train
https://github.com/JoeVirtual/KonFoo/blob/0c62ef5c2bed4deaf908b34082e4de2544532fdc/konfoo/core.py#L1778-L1805
3,896
saltstack/salt
salt/cache/localfs.py
list_
def list_(bank, cachedir): ''' Return an iterable object containing all entries stored in the specified bank. ''' base = os.path.join(cachedir, os.path.normpath(bank)) if not os.path.isdir(base): return [] try: items = os.listdir(base) except OSError as exc: raise Sal...
python
def list_(bank, cachedir): ''' Return an iterable object containing all entries stored in the specified bank. ''' base = os.path.join(cachedir, os.path.normpath(bank)) if not os.path.isdir(base): return [] try: items = os.listdir(base) except OSError as exc: raise Sal...
['def', 'list_', '(', 'bank', ',', 'cachedir', ')', ':', 'base', '=', 'os', '.', 'path', '.', 'join', '(', 'cachedir', ',', 'os', '.', 'path', '.', 'normpath', '(', 'bank', ')', ')', 'if', 'not', 'os', '.', 'path', '.', 'isdir', '(', 'base', ')', ':', 'return', '[', ']', 'try', ':', 'items', '=', 'os', '.', 'listdir', ...
Return an iterable object containing all entries stored in the specified bank.
['Return', 'an', 'iterable', 'object', 'containing', 'all', 'entries', 'stored', 'in', 'the', 'specified', 'bank', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/localfs.py#L148-L169
3,897
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
mag_roll
def mag_roll(RAW_IMU, inclination, declination): '''estimate roll from mag''' m = mag_rotation(RAW_IMU, inclination, declination) (r, p, y) = m.to_euler() return degrees(r)
python
def mag_roll(RAW_IMU, inclination, declination): '''estimate roll from mag''' m = mag_rotation(RAW_IMU, inclination, declination) (r, p, y) = m.to_euler() return degrees(r)
['def', 'mag_roll', '(', 'RAW_IMU', ',', 'inclination', ',', 'declination', ')', ':', 'm', '=', 'mag_rotation', '(', 'RAW_IMU', ',', 'inclination', ',', 'declination', ')', '(', 'r', ',', 'p', ',', 'y', ')', '=', 'm', '.', 'to_euler', '(', ')', 'return', 'degrees', '(', 'r', ')']
estimate roll from mag
['estimate', 'roll', 'from', 'mag']
train
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L370-L374
3,898
TUNE-Archive/freight_forwarder
freight_forwarder/registry/auth.py
Auth.load_dockercfg
def load_dockercfg(self): """ :return: """ if self.ssl_cert_path: self._validate_ssl_certs() if self.auth_type == 'registry_rubber': self.user, self.passwd = self._registry_rubber_uonce('add') self._config_path = self._create_dockercfg( ...
python
def load_dockercfg(self): """ :return: """ if self.ssl_cert_path: self._validate_ssl_certs() if self.auth_type == 'registry_rubber': self.user, self.passwd = self._registry_rubber_uonce('add') self._config_path = self._create_dockercfg( ...
['def', 'load_dockercfg', '(', 'self', ')', ':', 'if', 'self', '.', 'ssl_cert_path', ':', 'self', '.', '_validate_ssl_certs', '(', ')', 'if', 'self', '.', 'auth_type', '==', "'registry_rubber'", ':', 'self', '.', 'user', ',', 'self', '.', 'passwd', '=', 'self', '.', '_registry_rubber_uonce', '(', "'add'", ')', 'self', ...
:return:
[':', 'return', ':']
train
https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/registry/auth.py#L114-L148
3,899
openid/JWTConnect-Python-CryptoJWT
src/cryptojwt/tools/keygen.py
main
def main(): """ Main function""" parser = argparse.ArgumentParser(description='JSON Web Key (JWK) Generator') parser.add_argument('--kty', dest='kty', metavar='type', help='Key type', required=True) parser.a...
python
def main(): """ Main function""" parser = argparse.ArgumentParser(description='JSON Web Key (JWK) Generator') parser.add_argument('--kty', dest='kty', metavar='type', help='Key type', required=True) parser.a...
['def', 'main', '(', ')', ':', 'parser', '=', 'argparse', '.', 'ArgumentParser', '(', 'description', '=', "'JSON Web Key (JWK) Generator'", ')', 'parser', '.', 'add_argument', '(', "'--kty'", ',', 'dest', '=', "'kty'", ',', 'metavar', '=', "'type'", ',', 'help', '=', "'Key type'", ',', 'required', '=', 'True', ')', 'pa...
Main function
['Main', 'function']
train
https://github.com/openid/JWTConnect-Python-CryptoJWT/blob/8863cfbfe77ca885084870b234a66b55bd52930c/src/cryptojwt/tools/keygen.py#L22-L74