repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
fredRos/pypmc
pypmc/sampler/markov_chain.py
https://github.com/fredRos/pypmc/blob/9138b67c976f0d58edd080353d16769a47794d09/pypmc/sampler/markov_chain.py#L169-L173
def _get_log_rho_metropolis_hastings(self, proposed_point, proposed_eval): """calculate log(metropolis ratio times hastings factor)""" return self._get_log_rho_metropolis(proposed_point, proposed_eval)\ - self.proposal.evaluate (proposed_point, self.current) \ + self.propo...
[ "def", "_get_log_rho_metropolis_hastings", "(", "self", ",", "proposed_point", ",", "proposed_eval", ")", ":", "return", "self", ".", "_get_log_rho_metropolis", "(", "proposed_point", ",", "proposed_eval", ")", "-", "self", ".", "proposal", ".", "evaluate", "(", "...
calculate log(metropolis ratio times hastings factor)
[ "calculate", "log", "(", "metropolis", "ratio", "times", "hastings", "factor", ")" ]
python
train
72.8
Capitains/MyCapytain
MyCapytain/resources/texts/remote/cts.py
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/texts/remote/cts.py#L134-L153
def getPassagePlus(self, reference=None): """ Retrieve a passage and informations around it and store it in the object :param reference: Reference of the passage :type reference: CtsReference or List of text_type :rtype: CtsPassage :returns: Object representing the passage ...
[ "def", "getPassagePlus", "(", "self", ",", "reference", "=", "None", ")", ":", "if", "reference", ":", "urn", "=", "\"{0}:{1}\"", ".", "format", "(", "self", ".", "urn", ",", "reference", ")", "else", ":", "urn", "=", "str", "(", "self", ".", "urn", ...
Retrieve a passage and informations around it and store it in the object :param reference: Reference of the passage :type reference: CtsReference or List of text_type :rtype: CtsPassage :returns: Object representing the passage :raises: *TypeError* when reference is not a list o...
[ "Retrieve", "a", "passage", "and", "informations", "around", "it", "and", "store", "it", "in", "the", "object" ]
python
train
41.2
saltstack/salt
salt/loader.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/loader.py#L1348-L1366
def missing_fun_string(self, function_name): ''' Return the error string for a missing function. This can range from "not available' to "__virtual__" returned False ''' mod_name = function_name.split('.')[0] if mod_name in self.loaded_modules: return '\'{0}\'...
[ "def", "missing_fun_string", "(", "self", ",", "function_name", ")", ":", "mod_name", "=", "function_name", ".", "split", "(", "'.'", ")", "[", "0", "]", "if", "mod_name", "in", "self", ".", "loaded_modules", ":", "return", "'\\'{0}\\' is not available.'", "."...
Return the error string for a missing function. This can range from "not available' to "__virtual__" returned False
[ "Return", "the", "error", "string", "for", "a", "missing", "function", "." ]
python
train
41.368421
Crypto-toolbox/bitex
bitex/api/WSS/bitfinex.py
https://github.com/Crypto-toolbox/bitex/blob/56d46ea3db6de5219a72dad9b052fbabc921232f/bitex/api/WSS/bitfinex.py#L801-L819
def ohlc(self, pair, timeframe=None, **kwargs): """ Subscribe to the passed pair's OHLC data channel. :param pair: str, Pair to request data for. :param timeframe: str, {1m, 5m, 15m, 30m, 1h, 3h, 6h, 12h, 1D, 7D, 14D, 1M} :param kwargs: :re...
[ "def", "ohlc", "(", "self", ",", "pair", ",", "timeframe", "=", "None", ",", "*", "*", "kwargs", ")", ":", "valid_tfs", "=", "[", "'1m'", ",", "'5m'", ",", "'15m'", ",", "'30m'", ",", "'1h'", ",", "'3h'", ",", "'6h'", ",", "'12h'", ",", "'1D'", ...
Subscribe to the passed pair's OHLC data channel. :param pair: str, Pair to request data for. :param timeframe: str, {1m, 5m, 15m, 30m, 1h, 3h, 6h, 12h, 1D, 7D, 14D, 1M} :param kwargs: :return:
[ "Subscribe", "to", "the", "passed", "pair", "s", "OHLC", "data", "channel", ".", ":", "param", "pair", ":", "str", "Pair", "to", "request", "data", "for", ".", ":", "param", "timeframe", ":", "str", "{", "1m", "5m", "15m", "30m", "1h", "3h", "6h", ...
python
train
41.421053
aio-libs/aioodbc
aioodbc/connection.py
https://github.com/aio-libs/aioodbc/blob/01245560828d4adce0d7d16930fa566102322a0a/aioodbc/connection.py#L15-L40
def connect(*, dsn, autocommit=False, ansi=False, timeout=0, loop=None, executor=None, echo=False, after_created=None, **kwargs): """Accepts an ODBC connection string and returns a new Connection object. The connection string can be passed as the string `str`, as a list of keywords,or a combina...
[ "def", "connect", "(", "*", ",", "dsn", ",", "autocommit", "=", "False", ",", "ansi", "=", "False", ",", "timeout", "=", "0", ",", "loop", "=", "None", ",", "executor", "=", "None", ",", "echo", "=", "False", ",", "after_created", "=", "None", ",",...
Accepts an ODBC connection string and returns a new Connection object. The connection string can be passed as the string `str`, as a list of keywords,or a combination of the two. Any keywords except autocommit, ansi, and timeout are simply added to the connection string. :param autocommit bool: False...
[ "Accepts", "an", "ODBC", "connection", "string", "and", "returns", "a", "new", "Connection", "object", "." ]
python
train
57.653846
raiden-network/raiden-contracts
raiden_contracts/utils/merkle.py
https://github.com/raiden-network/raiden-contracts/blob/a7e72a9477f2204b03f3706360ea8d9c0a8e7063/raiden_contracts/utils/merkle.py#L26-L49
def compute_merkle_tree(items: Iterable[bytes]) -> MerkleTree: """ Calculates the merkle root for a given list of items """ if not all(isinstance(l, bytes) and len(l) == 32 for l in items): raise ValueError('Not all items are hashes') leaves = sorted(items) if len(leaves) == 0: return ...
[ "def", "compute_merkle_tree", "(", "items", ":", "Iterable", "[", "bytes", "]", ")", "->", "MerkleTree", ":", "if", "not", "all", "(", "isinstance", "(", "l", ",", "bytes", ")", "and", "len", "(", "l", ")", "==", "32", "for", "l", "in", "items", ")...
Calculates the merkle root for a given list of items
[ "Calculates", "the", "merkle", "root", "for", "a", "given", "list", "of", "items" ]
python
train
33.041667
bcbio/bcbio-nextgen
bcbio/utils.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L337-L342
def remove_plus(orig): """Remove a fils, including biological index files. """ for ext in ["", ".idx", ".gbi", ".tbi", ".bai"]: if os.path.exists(orig + ext): remove_safe(orig + ext)
[ "def", "remove_plus", "(", "orig", ")", ":", "for", "ext", "in", "[", "\"\"", ",", "\".idx\"", ",", "\".gbi\"", ",", "\".tbi\"", ",", "\".bai\"", "]", ":", "if", "os", ".", "path", ".", "exists", "(", "orig", "+", "ext", ")", ":", "remove_safe", "(...
Remove a fils, including biological index files.
[ "Remove", "a", "fils", "including", "biological", "index", "files", "." ]
python
train
34.833333
vaexio/vaex
packages/vaex-core/vaex/dataframe.py
https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L3742-L3768
def trim(self, inplace=False): '''Return a DataFrame, where all columns are 'trimmed' by the active range. For the returned DataFrame, df.get_active_range() returns (0, df.length_original()). {note_copy} :param inplace: {inplace} :rtype: DataFrame ''' df = self...
[ "def", "trim", "(", "self", ",", "inplace", "=", "False", ")", ":", "df", "=", "self", "if", "inplace", "else", "self", ".", "copy", "(", ")", "for", "name", "in", "df", ":", "column", "=", "df", ".", "columns", ".", "get", "(", "name", ")", "i...
Return a DataFrame, where all columns are 'trimmed' by the active range. For the returned DataFrame, df.get_active_range() returns (0, df.length_original()). {note_copy} :param inplace: {inplace} :rtype: DataFrame
[ "Return", "a", "DataFrame", "where", "all", "columns", "are", "trimmed", "by", "the", "active", "range", "." ]
python
test
40.111111
ornlneutronimaging/ImagingReso
ImagingReso/resonance.py
https://github.com/ornlneutronimaging/ImagingReso/blob/2da5cd1f565b3128f59d86bcedfd9adc2b02218b/ImagingReso/resonance.py#L145-L196
def get_isotopic_ratio(self, compound='', element=''): """returns the list of isotopes for the element of the compound defined with their stoichiometric values Parameters: =========== compound: string (default is empty). If empty, all the stoichiometric will be displayed element...
[ "def", "get_isotopic_ratio", "(", "self", ",", "compound", "=", "''", ",", "element", "=", "''", ")", ":", "_stack", "=", "self", ".", "stack", "compound", "=", "str", "(", "compound", ")", "if", "compound", "==", "''", ":", "_list_compounds", "=", "_s...
returns the list of isotopes for the element of the compound defined with their stoichiometric values Parameters: =========== compound: string (default is empty). If empty, all the stoichiometric will be displayed element: string (default is same as compound). Raises: =...
[ "returns", "the", "list", "of", "isotopes", "for", "the", "element", "of", "the", "compound", "defined", "with", "their", "stoichiometric", "values" ]
python
train
40.326923
ga4gh/ga4gh-server
ga4gh/server/datarepo.py
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datarepo.py#L569-L578
def clearAnnouncements(self): """ Flushes the announcement table. """ try: q = models.Announcement.delete().where( models.Announcement.id > 0) q.execute() except Exception as e: raise exceptions.RepoManagerException(e)
[ "def", "clearAnnouncements", "(", "self", ")", ":", "try", ":", "q", "=", "models", ".", "Announcement", ".", "delete", "(", ")", ".", "where", "(", "models", ".", "Announcement", ".", "id", ">", "0", ")", "q", ".", "execute", "(", ")", "except", "...
Flushes the announcement table.
[ "Flushes", "the", "announcement", "table", "." ]
python
train
30.1
mattbierner/blotre-py
blotre.py
https://github.com/mattbierner/blotre-py/blob/c98228d1159bc651aad546e442b0acbf97b1e043/blotre.py#L121-L129
def get_authorization_url(self): """Get the authorization Url for the current client.""" return self._format_url( OAUTH2_ROOT + 'authorize', query = { 'response_type': 'code', 'client_id': self.client.get('client_id', ''), 'redirect...
[ "def", "get_authorization_url", "(", "self", ")", ":", "return", "self", ".", "_format_url", "(", "OAUTH2_ROOT", "+", "'authorize'", ",", "query", "=", "{", "'response_type'", ":", "'code'", ",", "'client_id'", ":", "self", ".", "client", ".", "get", "(", ...
Get the authorization Url for the current client.
[ "Get", "the", "authorization", "Url", "for", "the", "current", "client", "." ]
python
train
41
d11wtq/dockerpty
dockerpty/pty.py
https://github.com/d11wtq/dockerpty/blob/f8d17d893c6758b7cc25825e99f6b02202632a97/dockerpty/pty.py#L128-L151
def start(self, sockets=None, **kwargs): """ Present the PTY of the container inside the current process. This will take over the current process' TTY until the container's PTY is closed. """ pty_stdin, pty_stdout, pty_stderr = sockets or self.sockets() pumps = ...
[ "def", "start", "(", "self", ",", "sockets", "=", "None", ",", "*", "*", "kwargs", ")", ":", "pty_stdin", ",", "pty_stdout", ",", "pty_stderr", "=", "sockets", "or", "self", ".", "sockets", "(", ")", "pumps", "=", "[", "]", "if", "pty_stdin", "and", ...
Present the PTY of the container inside the current process. This will take over the current process' TTY until the container's PTY is closed.
[ "Present", "the", "PTY", "of", "the", "container", "inside", "the", "current", "process", "." ]
python
train
33.583333
gaqzi/py-gocd
gocd/api/response.py
https://github.com/gaqzi/py-gocd/blob/6fe5b62dea51e665c11a343aba5fc98e130c5c63/gocd/api/response.py#L91-L108
def payload(self): """ Returns: `str` when not json. `dict` when json. """ if self.is_json: if not self._body_parsed: if hasattr(self._body, 'decode'): body = self._body.decode('utf-8') else: ...
[ "def", "payload", "(", "self", ")", ":", "if", "self", ".", "is_json", ":", "if", "not", "self", ".", "_body_parsed", ":", "if", "hasattr", "(", "self", ".", "_body", ",", "'decode'", ")", ":", "body", "=", "self", ".", "_body", ".", "decode", "(",...
Returns: `str` when not json. `dict` when json.
[ "Returns", ":", "str", "when", "not", "json", ".", "dict", "when", "json", "." ]
python
valid
25.777778
pmorissette/ffn
ffn/core.py
https://github.com/pmorissette/ffn/blob/ef09f28b858b7ffcd2627ce6a4dc618183a6bc8a/ffn/core.py#L1429-L1486
def calc_mean_var_weights(returns, weight_bounds=(0., 1.), rf=0., covar_method='ledoit-wolf', options=None): """ Calculates the mean-variance weights given a DataFrame of returns. Args: * returns (DataFrame): Returns for ...
[ "def", "calc_mean_var_weights", "(", "returns", ",", "weight_bounds", "=", "(", "0.", ",", "1.", ")", ",", "rf", "=", "0.", ",", "covar_method", "=", "'ledoit-wolf'", ",", "options", "=", "None", ")", ":", "def", "fitness", "(", "weights", ",", "exp_rets...
Calculates the mean-variance weights given a DataFrame of returns. Args: * returns (DataFrame): Returns for multiple securities. * weight_bounds ((low, high)): Weigh limits for optimization. * rf (float): `Risk-free rate <https://www.investopedia.com/terms/r/risk-freerate.asp>`_ used in uti...
[ "Calculates", "the", "mean", "-", "variance", "weights", "given", "a", "DataFrame", "of", "returns", "." ]
python
train
36.965517
intel-analytics/BigDL
pyspark/bigdl/nn/layer.py
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/layer.py#L543-L557
def save_tensorflow(self, inputs, path, byte_order="little_endian", data_format="nhwc"): """ Save a model to protobuf files so that it can be used in tensorflow inference. When saving the model, placeholders will be added to the tf model as input nodes. So you need to pass in the names ...
[ "def", "save_tensorflow", "(", "self", ",", "inputs", ",", "path", ",", "byte_order", "=", "\"little_endian\"", ",", "data_format", "=", "\"nhwc\"", ")", ":", "callBigDlFunc", "(", "self", ".", "bigdl_type", ",", "\"saveTF\"", ",", "self", ".", "value", ",",...
Save a model to protobuf files so that it can be used in tensorflow inference. When saving the model, placeholders will be added to the tf model as input nodes. So you need to pass in the names and shapes of the placeholders. BigDL model doesn't have such information. The order of the placehold...
[ "Save", "a", "model", "to", "protobuf", "files", "so", "that", "it", "can", "be", "used", "in", "tensorflow", "inference", "." ]
python
test
63
ganguli-lab/proxalgs
proxalgs/operators.py
https://github.com/ganguli-lab/proxalgs/blob/74f54467ad072d3229edea93fa84ddd98dd77c67/proxalgs/operators.py#L272-L305
def tvd(x0, rho, gamma): """ Proximal operator for the total variation denoising penalty Requires scikit-image be installed Parameters ---------- x0 : array_like The starting or initial point used in the proximal update step rho : float Momentum parameter for the proximal ...
[ "def", "tvd", "(", "x0", ",", "rho", ",", "gamma", ")", ":", "try", ":", "from", "skimage", ".", "restoration", "import", "denoise_tv_bregman", "except", "ImportError", ":", "print", "(", "'Error: scikit-image not found. TVD will not work.'", ")", "return", "x0", ...
Proximal operator for the total variation denoising penalty Requires scikit-image be installed Parameters ---------- x0 : array_like The starting or initial point used in the proximal update step rho : float Momentum parameter for the proximal step (larger value -> stays closer to...
[ "Proximal", "operator", "for", "the", "total", "variation", "denoising", "penalty" ]
python
train
25.205882
PetrochukM/PyTorch-NLP
torchnlp/encoders/label_encoder.py
https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/label_encoder.py#L102-L117
def decode(self, encoded): """ Decodes ``encoded`` label. Args: encoded (torch.Tensor): Encoded label. Returns: object: Label decoded from ``encoded``. """ encoded = super().decode(encoded) if encoded.numel() > 1: raise ValueError( ...
[ "def", "decode", "(", "self", ",", "encoded", ")", ":", "encoded", "=", "super", "(", ")", ".", "decode", "(", "encoded", ")", "if", "encoded", ".", "numel", "(", ")", ">", "1", ":", "raise", "ValueError", "(", "'``decode`` decodes one label at a time, use...
Decodes ``encoded`` label. Args: encoded (torch.Tensor): Encoded label. Returns: object: Label decoded from ``encoded``.
[ "Decodes", "encoded", "label", "." ]
python
train
27.75
zhanglab/psamm
psamm/lpsolver/cplex.py
https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/lpsolver/cplex.py#L206-L221
def add_linear_constraints(self, *relations): """Add constraints to the problem Each constraint is represented by a Relation, and the expression in that relation can be a set expression. """ constraints = [] for relation in relations: if self._check_relation...
[ "def", "add_linear_constraints", "(", "self", ",", "*", "relations", ")", ":", "constraints", "=", "[", "]", "for", "relation", "in", "relations", ":", "if", "self", ".", "_check_relation", "(", "relation", ")", ":", "constraints", ".", "append", "(", "Con...
Add constraints to the problem Each constraint is represented by a Relation, and the expression in that relation can be a set expression.
[ "Add", "constraints", "to", "the", "problem" ]
python
train
34.0625
crate/crate-python
src/crate/client/blob.py
https://github.com/crate/crate-python/blob/68e39c95f5bbe88b74bbfa26de4347fc644636a8/src/crate/client/blob.py#L84-L91
def delete(self, digest): """ Delete a blob :param digest: the hex digest of the blob to be deleted :return: True if blob existed """ return self.conn.client.blob_del(self.container_name, digest)
[ "def", "delete", "(", "self", ",", "digest", ")", ":", "return", "self", ".", "conn", ".", "client", ".", "blob_del", "(", "self", ".", "container_name", ",", "digest", ")" ]
Delete a blob :param digest: the hex digest of the blob to be deleted :return: True if blob existed
[ "Delete", "a", "blob" ]
python
train
29.625
robmcmullen/atrcopy
atrcopy/segments.py
https://github.com/robmcmullen/atrcopy/blob/dafba8e74c718e95cf81fd72c184fa193ecec730/atrcopy/segments.py#L22-L45
def get_style_bits(match=False, comment=False, selected=False, data=False, diff=False, user=0): """ Return an int value that contains the specified style bits set. Available styles for each byte are: match: part of the currently matched search comment: user commented area selected: selected region...
[ "def", "get_style_bits", "(", "match", "=", "False", ",", "comment", "=", "False", ",", "selected", "=", "False", ",", "data", "=", "False", ",", "diff", "=", "False", ",", "user", "=", "0", ")", ":", "style_bits", "=", "0", "if", "user", ":", "sty...
Return an int value that contains the specified style bits set. Available styles for each byte are: match: part of the currently matched search comment: user commented area selected: selected region data: labeled in the disassembler as a data region (i.e. not disassembled)
[ "Return", "an", "int", "value", "that", "contains", "the", "specified", "style", "bits", "set", "." ]
python
train
31.625
viatoriche/microservices
microservices/queues/client.py
https://github.com/viatoriche/microservices/blob/3510563edd15dc6131b8a948d6062856cd904ac7/microservices/queues/client.py#L32-L42
def publish(self, message, routing_key=None): """Publish message to exchange :param message: message for publishing :type message: any serializable object :param routing_key: routing key for queue :return: None """ if routing_key is None: routing_key ...
[ "def", "publish", "(", "self", ",", "message", ",", "routing_key", "=", "None", ")", ":", "if", "routing_key", "is", "None", ":", "routing_key", "=", "self", ".", "routing_key", "return", "self", ".", "client", ".", "publish_to_exchange", "(", "self", ".",...
Publish message to exchange :param message: message for publishing :type message: any serializable object :param routing_key: routing key for queue :return: None
[ "Publish", "message", "to", "exchange" ]
python
train
38.909091
micolous/python-slackrealtime
src/slackrealtime/session.py
https://github.com/micolous/python-slackrealtime/blob/e9c94416f979a6582110ebba09c147de2bfe20a1/src/slackrealtime/session.py#L61-L75
def _find_resource_by_key(self, resource_list, key, value): """ Finds a resource by key, first case insensitive match. Returns tuple of (key, resource) Raises KeyError if the given key cannot be found. """ original = value value = unicode(value.upper()) for k, resource in resource_list.iteritems(): ...
[ "def", "_find_resource_by_key", "(", "self", ",", "resource_list", ",", "key", ",", "value", ")", ":", "original", "=", "value", "value", "=", "unicode", "(", "value", ".", "upper", "(", ")", ")", "for", "k", ",", "resource", "in", "resource_list", ".", ...
Finds a resource by key, first case insensitive match. Returns tuple of (key, resource) Raises KeyError if the given key cannot be found.
[ "Finds", "a", "resource", "by", "key", "first", "case", "insensitive", "match", "." ]
python
train
27.466667
AkihikoITOH/capybara
capybara/virtualenv/lib/python2.7/site-packages/setuptools/package_index.py
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/package_index.py#L90-L109
def distros_for_location(location, basename, metadata=None): """Yield egg or source distribution objects based on basename""" if basename.endswith('.egg.zip'): basename = basename[:-4] # strip the .zip if basename.endswith('.egg') and '-' in basename: # only one, unambiguous interpretatio...
[ "def", "distros_for_location", "(", "location", ",", "basename", ",", "metadata", "=", "None", ")", ":", "if", "basename", ".", "endswith", "(", "'.egg.zip'", ")", ":", "basename", "=", "basename", "[", ":", "-", "4", "]", "# strip the .zip", "if", "basena...
Yield egg or source distribution objects based on basename
[ "Yield", "egg", "or", "source", "distribution", "objects", "based", "on", "basename" ]
python
test
44.65
roclark/sportsreference
sportsreference/nfl/boxscore.py
https://github.com/roclark/sportsreference/blob/ea0bae432be76450e137671d2998eb38f962dffd/sportsreference/nfl/boxscore.py#L292-L321
def _retrieve_html_page(self, uri): """ Download the requested HTML page. Given a relative link, download the requested page and strip it of all comment tags before returning a pyquery object which will be used to parse the data. Parameters ---------- ur...
[ "def", "_retrieve_html_page", "(", "self", ",", "uri", ")", ":", "url", "=", "BOXSCORE_URL", "%", "uri", "try", ":", "url_data", "=", "pq", "(", "url", ")", "except", "HTTPError", ":", "return", "None", "# For NFL, a 404 page doesn't actually raise a 404 error, so...
Download the requested HTML page. Given a relative link, download the requested page and strip it of all comment tags before returning a pyquery object which will be used to parse the data. Parameters ---------- uri : string The relative link to the boxscore...
[ "Download", "the", "requested", "HTML", "page", "." ]
python
train
31.433333
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_notification_stream.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_notification_stream.py#L106-L116
def BGPNeighborPrefixExceeded_originator_switch_info_switchIpV4Address(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") BGPNeighborPrefixExceeded = ET.SubElement(config, "BGPNeighborPrefixExceeded", xmlns="http://brocade.com/ns/brocade-notification-stream") ...
[ "def", "BGPNeighborPrefixExceeded_originator_switch_info_switchIpV4Address", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "BGPNeighborPrefixExceeded", "=", "ET", ".", "SubElement", "(", "config", ",", ...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
58.818182
pandas-dev/pandas
pandas/core/resample.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/resample.py#L790-L800
def std(self, ddof=1, *args, **kwargs): """ Compute standard deviation of groups, excluding missing values. Parameters ---------- ddof : integer, default 1 Degrees of freedom. """ nv.validate_resampler_func('std', args, kwargs) return self._do...
[ "def", "std", "(", "self", ",", "ddof", "=", "1", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "nv", ".", "validate_resampler_func", "(", "'std'", ",", "args", ",", "kwargs", ")", "return", "self", ".", "_downsample", "(", "'std'", ",", "dd...
Compute standard deviation of groups, excluding missing values. Parameters ---------- ddof : integer, default 1 Degrees of freedom.
[ "Compute", "standard", "deviation", "of", "groups", "excluding", "missing", "values", "." ]
python
train
30.545455
BerkeleyAutomation/perception
perception/image.py
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L186-L194
def rosmsg(self): """:obj:`sensor_msgs.Image` : ROS Image """ from cv_bridge import CvBridge, CvBridgeError cv_bridge = CvBridge() try: return cv_bridge.cv2_to_imgmsg(self._data, encoding=self._encoding) except CvBridgeError as cv_bridge_exception: ...
[ "def", "rosmsg", "(", "self", ")", ":", "from", "cv_bridge", "import", "CvBridge", ",", "CvBridgeError", "cv_bridge", "=", "CvBridge", "(", ")", "try", ":", "return", "cv_bridge", ".", "cv2_to_imgmsg", "(", "self", ".", "_data", ",", "encoding", "=", "self...
:obj:`sensor_msgs.Image` : ROS Image
[ ":", "obj", ":", "sensor_msgs", ".", "Image", ":", "ROS", "Image" ]
python
train
40.111111
noahbenson/pimms
pimms/immutable.py
https://github.com/noahbenson/pimms/blob/9051b86d6b858a7a13511b72c48dc21bc903dab2/pimms/immutable.py#L119-L149
def _imm_getattribute(self, name): ''' An immutable's getattribute calculates lazy values when not yet cached in the object then adds them as attributes. ''' if _imm_is_init(self): return _imm_init_getattribute(self, name) else: dd = object.__getattribute__(self, '__dict__') ...
[ "def", "_imm_getattribute", "(", "self", ",", "name", ")", ":", "if", "_imm_is_init", "(", "self", ")", ":", "return", "_imm_init_getattribute", "(", "self", ",", "name", ")", "else", ":", "dd", "=", "object", ".", "__getattribute__", "(", "self", ",", "...
An immutable's getattribute calculates lazy values when not yet cached in the object then adds them as attributes.
[ "An", "immutable", "s", "getattribute", "calculates", "lazy", "values", "when", "not", "yet", "cached", "in", "the", "object", "then", "adds", "them", "as", "attributes", "." ]
python
train
38.645161
Clinical-Genomics/scout
scout/adapter/mongo/hgnc.py
https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/hgnc.py#L209-L216
def drop_genes(self, build=None): """Delete the genes collection""" if build: LOG.info("Dropping the hgnc_gene collection, build %s", build) self.hgnc_collection.delete_many({'build': build}) else: LOG.info("Dropping the hgnc_gene collection") self...
[ "def", "drop_genes", "(", "self", ",", "build", "=", "None", ")", ":", "if", "build", ":", "LOG", ".", "info", "(", "\"Dropping the hgnc_gene collection, build %s\"", ",", "build", ")", "self", ".", "hgnc_collection", ".", "delete_many", "(", "{", "'build'", ...
Delete the genes collection
[ "Delete", "the", "genes", "collection" ]
python
test
42
all-umass/graphs
graphs/mixins/label.py
https://github.com/all-umass/graphs/blob/4fbeb025dfe33340335f34300f58dd3809228822/graphs/mixins/label.py#L15-L25
def color_greedy(self): '''Returns a greedy vertex coloring as an array of ints.''' n = self.num_vertices() coloring = np.zeros(n, dtype=int) for i, nbrs in enumerate(self.adj_list()): nbr_colors = set(coloring[nbrs]) for c in count(1): if c not in nbr_colors: coloring[i] =...
[ "def", "color_greedy", "(", "self", ")", ":", "n", "=", "self", ".", "num_vertices", "(", ")", "coloring", "=", "np", ".", "zeros", "(", "n", ",", "dtype", "=", "int", ")", "for", "i", ",", "nbrs", "in", "enumerate", "(", "self", ".", "adj_list", ...
Returns a greedy vertex coloring as an array of ints.
[ "Returns", "a", "greedy", "vertex", "coloring", "as", "an", "array", "of", "ints", "." ]
python
train
31.636364
quantmind/pulsar
pulsar/apps/http/auth.py
https://github.com/quantmind/pulsar/blob/fee44e871954aa6ca36d00bb5a3739abfdb89b26/pulsar/apps/http/auth.py#L78-L121
def encode(self, method, uri): '''Called by the client to encode Authentication header.''' if not self.username or not self.password: return o = self.options qop = o.get('qop') realm = o.get('realm') nonce = o.get('nonce') entdig = None p_parse...
[ "def", "encode", "(", "self", ",", "method", ",", "uri", ")", ":", "if", "not", "self", ".", "username", "or", "not", "self", ".", "password", ":", "return", "o", "=", "self", ".", "options", "qop", "=", "o", ".", "get", "(", "'qop'", ")", "realm...
Called by the client to encode Authentication header.
[ "Called", "by", "the", "client", "to", "encode", "Authentication", "header", "." ]
python
train
37.909091
ConsenSys/mythril-classic
mythril/support/signatures.py
https://github.com/ConsenSys/mythril-classic/blob/27af71c34b2ce94f4fae5613ec457f93df1a8f56/mythril/support/signatures.py#L170-L183
def add(self, byte_sig: str, text_sig: str) -> None: """ Adds a new byte - text signature pair to the database. :param byte_sig: 4-byte signature string :param text_sig: resolved text signature :return: """ byte_sig = self._normalize_byte_sig(byte_sig) wit...
[ "def", "add", "(", "self", ",", "byte_sig", ":", "str", ",", "text_sig", ":", "str", ")", "->", "None", ":", "byte_sig", "=", "self", ".", "_normalize_byte_sig", "(", "byte_sig", ")", "with", "SQLiteDB", "(", "self", ".", "path", ")", "as", "cur", ":...
Adds a new byte - text signature pair to the database. :param byte_sig: 4-byte signature string :param text_sig: resolved text signature :return:
[ "Adds", "a", "new", "byte", "-", "text", "signature", "pair", "to", "the", "database", ".", ":", "param", "byte_sig", ":", "4", "-", "byte", "signature", "string", ":", "param", "text_sig", ":", "resolved", "text", "signature", ":", "return", ":" ]
python
train
42.714286
mozilla-iot/webthing-python
webthing/server.py
https://github.com/mozilla-iot/webthing-python/blob/65d467c89ed79d0bbc42b8b3c8f9e5a320edd237/webthing/server.py#L537-L552
def put(self, thing_id='0', action_name=None, action_id=None): """ Handle a PUT request. TODO: this is not yet defined in the spec thing_id -- ID of the thing this request is for action_name -- name of the action from the URL path action_id -- the action ID from the URL...
[ "def", "put", "(", "self", ",", "thing_id", "=", "'0'", ",", "action_name", "=", "None", ",", "action_id", "=", "None", ")", ":", "thing", "=", "self", ".", "get_thing", "(", "thing_id", ")", "if", "thing", "is", "None", ":", "self", ".", "set_status...
Handle a PUT request. TODO: this is not yet defined in the spec thing_id -- ID of the thing this request is for action_name -- name of the action from the URL path action_id -- the action ID from the URL path
[ "Handle", "a", "PUT", "request", "." ]
python
test
29.4375
pip-services3-python/pip-services3-components-python
pip_services3_components/config/YamlConfigReader.py
https://github.com/pip-services3-python/pip-services3-components-python/blob/1de9c1bb544cf1891111e9a5f5d67653f62c9b52/pip_services3_components/config/YamlConfigReader.py#L48-L76
def _read_object(self, correlation_id, parameters): """ Reads configuration file, parameterizes its content and converts it into JSON object. :param correlation_id: (optional) transaction id to trace execution through call chain. :param parameters: values to parameters the configuratio...
[ "def", "_read_object", "(", "self", ",", "correlation_id", ",", "parameters", ")", ":", "path", "=", "self", ".", "get_path", "(", ")", "if", "path", "==", "None", ":", "raise", "ConfigException", "(", "correlation_id", ",", "\"NO_PATH\"", ",", "\"Missing co...
Reads configuration file, parameterizes its content and converts it into JSON object. :param correlation_id: (optional) transaction id to trace execution through call chain. :param parameters: values to parameters the configuration. :return: a JSON object with configuration.
[ "Reads", "configuration", "file", "parameterizes", "its", "content", "and", "converts", "it", "into", "JSON", "object", "." ]
python
train
38.551724
MycroftAI/padatious
padatious/util.py
https://github.com/MycroftAI/padatious/blob/794a2530d6079bdd06e193edd0d30b2cc793e631/padatious/util.py#L33-L68
def tokenize(sentence): """ Converts a single sentence into a list of individual significant units Args: sentence (str): Input string ie. 'This is a sentence.' Returns: list<str>: List of tokens ie. ['this', 'is', 'a', 'sentence'] """ tokens = [] class Vars: start_po...
[ "def", "tokenize", "(", "sentence", ")", ":", "tokens", "=", "[", "]", "class", "Vars", ":", "start_pos", "=", "-", "1", "last_type", "=", "'o'", "def", "update", "(", "c", ",", "i", ")", ":", "if", "c", ".", "isalpha", "(", ")", "or", "c", "in...
Converts a single sentence into a list of individual significant units Args: sentence (str): Input string ie. 'This is a sentence.' Returns: list<str>: List of tokens ie. ['this', 'is', 'a', 'sentence']
[ "Converts", "a", "single", "sentence", "into", "a", "list", "of", "individual", "significant", "units", "Args", ":", "sentence", "(", "str", ")", ":", "Input", "string", "ie", ".", "This", "is", "a", "sentence", ".", "Returns", ":", "list<str", ">", ":",...
python
valid
26.277778
marshmallow-code/marshmallow-sqlalchemy
src/marshmallow_sqlalchemy/fields.py
https://github.com/marshmallow-code/marshmallow-sqlalchemy/blob/afe3a9ebd886791b662607499c180d2baaeaf617/src/marshmallow_sqlalchemy/fields.py#L9-L15
def get_primary_keys(model): """Get primary key properties for a SQLAlchemy model. :param model: SQLAlchemy model class """ mapper = model.__mapper__ return [mapper.get_property_by_column(column) for column in mapper.primary_key]
[ "def", "get_primary_keys", "(", "model", ")", ":", "mapper", "=", "model", ".", "__mapper__", "return", "[", "mapper", ".", "get_property_by_column", "(", "column", ")", "for", "column", "in", "mapper", ".", "primary_key", "]" ]
Get primary key properties for a SQLAlchemy model. :param model: SQLAlchemy model class
[ "Get", "primary", "key", "properties", "for", "a", "SQLAlchemy", "model", "." ]
python
test
34.857143
richardkiss/pycoin
pycoin/key/Key.py
https://github.com/richardkiss/pycoin/blob/1e8d0d9fe20ce0347b97847bb529cd1bd84c7442/pycoin/key/Key.py#L81-L93
def wif(self, is_compressed=None): """ Return the WIF representation of this key, if available. """ secret_exponent = self.secret_exponent() if secret_exponent is None: return None if is_compressed is None: is_compressed = self.is_compressed() ...
[ "def", "wif", "(", "self", ",", "is_compressed", "=", "None", ")", ":", "secret_exponent", "=", "self", ".", "secret_exponent", "(", ")", "if", "secret_exponent", "is", "None", ":", "return", "None", "if", "is_compressed", "is", "None", ":", "is_compressed",...
Return the WIF representation of this key, if available.
[ "Return", "the", "WIF", "representation", "of", "this", "key", "if", "available", "." ]
python
train
34.461538
jstitch/MambuPy
MambuPy/mambuutil.py
https://github.com/jstitch/MambuPy/blob/2af98cc12e7ed5ec183b3e97644e880e70b79ee8/MambuPy/mambuutil.py#L174-L195
def getrepaymentsurl(idcred, *args, **kwargs): """Request loan Repayments URL. If idcred is set, you'll get a response adequate for a MambuRepayments object. There's a MambuRepayment object too, but you'll get a list first and each element of it will be automatically converted to a MambuRepayment o...
[ "def", "getrepaymentsurl", "(", "idcred", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "url", "=", "getmambuurl", "(", "*", "args", ",", "*", "*", "kwargs", ")", "+", "\"loans/\"", "+", "idcred", "+", "\"/repayments\"", "return", "url" ]
Request loan Repayments URL. If idcred is set, you'll get a response adequate for a MambuRepayments object. There's a MambuRepayment object too, but you'll get a list first and each element of it will be automatically converted to a MambuRepayment object that you may use. If not set, you'll get a ...
[ "Request", "loan", "Repayments", "URL", "." ]
python
train
41.045455
empymod/empymod
empymod/utils.py
https://github.com/empymod/empymod/blob/4a78ca4191ed4b4d42d019ce715a9a3889dba1bc/empymod/utils.py#L1864-L1877
def _check_shape(var, name, shape, shape2=None): r"""Check that <var> has shape <shape>; if false raise ValueError(name)""" varshape = np.shape(var) if shape != varshape: if shape2: if shape2 != varshape: print('* ERROR :: Parameter ' + name + ' has wrong shape!' + ...
[ "def", "_check_shape", "(", "var", ",", "name", ",", "shape", ",", "shape2", "=", "None", ")", ":", "varshape", "=", "np", ".", "shape", "(", "var", ")", "if", "shape", "!=", "varshape", ":", "if", "shape2", ":", "if", "shape2", "!=", "varshape", "...
r"""Check that <var> has shape <shape>; if false raise ValueError(name)
[ "r", "Check", "that", "<var", ">", "has", "shape", "<shape", ">", ";", "if", "false", "raise", "ValueError", "(", "name", ")" ]
python
train
47.214286
reingart/pyafipws
wslsp.py
https://github.com/reingart/pyafipws/blob/ee87cfe4ac12285ab431df5fec257f103042d1ab/wslsp.py#L491-L504
def ConsultarUltimoComprobante(self, tipo_cbte=151, pto_vta=1): "Consulta el último No de Comprobante registrado" ret = self.client.consultarUltimoNroComprobantePorPtoVta( auth={ 'token': self.Token, 'sign': self.Sign, 'cuit': self.Cuit...
[ "def", "ConsultarUltimoComprobante", "(", "self", ",", "tipo_cbte", "=", "151", ",", "pto_vta", "=", "1", ")", ":", "ret", "=", "self", ".", "client", ".", "consultarUltimoNroComprobantePorPtoVta", "(", "auth", "=", "{", "'token'", ":", "self", ".", "Token",...
Consulta el último No de Comprobante registrado
[ "Consulta", "el", "último", "No", "de", "Comprobante", "registrado" ]
python
train
43.357143
vertexproject/synapse
synapse/lib/certdir.py
https://github.com/vertexproject/synapse/blob/22e67c5a8f6d7caddbcf34b39ab1bd2d6c4a6e0b/synapse/lib/certdir.py#L795-L812
def selfSignCert(self, cert, pkey): ''' Self-sign a certificate. Args: cert (OpenSSL.crypto.X509): The certificate to sign. pkey (OpenSSL.crypto.PKey): The PKey with which to sign the certificate. Examples: Sign a given certificate with a given priva...
[ "def", "selfSignCert", "(", "self", ",", "cert", ",", "pkey", ")", ":", "cert", ".", "set_issuer", "(", "cert", ".", "get_subject", "(", ")", ")", "cert", ".", "sign", "(", "pkey", ",", "self", ".", "signing_digest", ")" ]
Self-sign a certificate. Args: cert (OpenSSL.crypto.X509): The certificate to sign. pkey (OpenSSL.crypto.PKey): The PKey with which to sign the certificate. Examples: Sign a given certificate with a given private key: cdir.selfSignCert(mycert, myoth...
[ "Self", "-", "sign", "a", "certificate", "." ]
python
train
28.222222
vnmabus/dcor
dcor/_partial_dcor.py
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_partial_dcor.py#L73-L145
def partial_distance_correlation(x, y, z): # pylint:disable=too-many-locals """ Partial distance correlation estimator. Compute the estimator for the partial distance correlation of the random vectors corresponding to :math:`x` and :math:`y` with respect to the random variable corresponding to :ma...
[ "def", "partial_distance_correlation", "(", "x", ",", "y", ",", "z", ")", ":", "# pylint:disable=too-many-locals", "a", "=", "_u_distance_matrix", "(", "x", ")", "b", "=", "_u_distance_matrix", "(", "y", ")", "c", "=", "_u_distance_matrix", "(", "z", ")", "a...
Partial distance correlation estimator. Compute the estimator for the partial distance correlation of the random vectors corresponding to :math:`x` and :math:`y` with respect to the random variable corresponding to :math:`z`. Parameters ---------- x: array_like First random vector. The...
[ "Partial", "distance", "correlation", "estimator", "." ]
python
train
31.191781
kblin/ncbi-genome-download
ncbi_genome_download/core.py
https://github.com/kblin/ncbi-genome-download/blob/dc55382d351c29e1027be8fa3876701762c1d752/ncbi_genome_download/core.py#L499-L514
def download_file_job(entry, directory, checksums, filetype='genbank', symlink_path=None): """Generate a DownloadJob that actually triggers a file download.""" pattern = NgdConfig.get_fileending(filetype) filename, expected_checksum = get_name_and_checksum(checksums, pattern) base_url = convert_ftp_url(...
[ "def", "download_file_job", "(", "entry", ",", "directory", ",", "checksums", ",", "filetype", "=", "'genbank'", ",", "symlink_path", "=", "None", ")", ":", "pattern", "=", "NgdConfig", ".", "get_fileending", "(", "filetype", ")", "filename", ",", "expected_ch...
Generate a DownloadJob that actually triggers a file download.
[ "Generate", "a", "DownloadJob", "that", "actually", "triggers", "a", "file", "download", "." ]
python
train
44.375
saltstack/salt
salt/modules/drbd.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drbd.py#L237-L283
def status(name='all'): ''' Using drbdadm to show status of the DRBD devices, available in the latest drbd9. Support multiple nodes, multiple volumes. :type name: str :param name: Resource name. :return: drbd status of resource. :rtype: list(dict(res)) CLI Example: .....
[ "def", "status", "(", "name", "=", "'all'", ")", ":", "# Initialize for multiple times test cases", "global", "ret", "global", "resource", "ret", "=", "[", "]", "resource", "=", "{", "}", "cmd", "=", "[", "'drbdadm'", ",", "'status'", "]", "cmd", ".", "app...
Using drbdadm to show status of the DRBD devices, available in the latest drbd9. Support multiple nodes, multiple volumes. :type name: str :param name: Resource name. :return: drbd status of resource. :rtype: list(dict(res)) CLI Example: .. code-block:: bash salt '*'...
[ "Using", "drbdadm", "to", "show", "status", "of", "the", "DRBD", "devices", "available", "in", "the", "latest", "drbd9", ".", "Support", "multiple", "nodes", "multiple", "volumes", "." ]
python
train
25.361702
joelfrederico/SciSalt
scisalt/matplotlib/colorbar.py
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/matplotlib/colorbar.py#L13-L53
def colorbar(ax, im, fig=None, loc="right", size="5%", pad="3%"): """ Adds a polite colorbar that steals space so :func:`matplotlib.pyplot.tight_layout` works nicely. .. versionadded:: 1.3 Parameters ---------- ax : :class:`matplotlib.axis.Axis` The axis to plot to. im : :class:`m...
[ "def", "colorbar", "(", "ax", ",", "im", ",", "fig", "=", "None", ",", "loc", "=", "\"right\"", ",", "size", "=", "\"5%\"", ",", "pad", "=", "\"3%\"", ")", ":", "if", "fig", "is", "None", ":", "fig", "=", "ax", ".", "get_figure", "(", ")", "# _...
Adds a polite colorbar that steals space so :func:`matplotlib.pyplot.tight_layout` works nicely. .. versionadded:: 1.3 Parameters ---------- ax : :class:`matplotlib.axis.Axis` The axis to plot to. im : :class:`matplotlib.image.AxesImage` The plotted image to use for the colorbar. ...
[ "Adds", "a", "polite", "colorbar", "that", "steals", "space", "so", ":", "func", ":", "matplotlib", ".", "pyplot", ".", "tight_layout", "works", "nicely", "." ]
python
valid
34.097561
saltstack/salt
salt/modules/keystone.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystone.py#L721-L748
def tenant_get(tenant_id=None, name=None, profile=None, **connection_args): ''' Return a specific tenants (keystone tenant-get) CLI Examples: .. code-block:: bash salt '*' keystone.tenant_get c965f79c4f864eaaa9c3b41904e67082 salt '*' keystone.tenant_get tenant_id=c965f7...
[ "def", "tenant_get", "(", "tenant_id", "=", "None", ",", "name", "=", "None", ",", "profile", "=", "None", ",", "*", "*", "connection_args", ")", ":", "kstone", "=", "auth", "(", "profile", ",", "*", "*", "connection_args", ")", "ret", "=", "{", "}",...
Return a specific tenants (keystone tenant-get) CLI Examples: .. code-block:: bash salt '*' keystone.tenant_get c965f79c4f864eaaa9c3b41904e67082 salt '*' keystone.tenant_get tenant_id=c965f79c4f864eaaa9c3b41904e67082 salt '*' keystone.tenant_get name=nova
[ "Return", "a", "specific", "tenants", "(", "keystone", "tenant", "-", "get", ")" ]
python
train
35.714286
mfcloud/python-zvm-sdk
zvmconnector/connector.py
https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmconnector/connector.py#L89-L96
def send_request(self, api_name, *api_args, **api_kwargs): """Refer to SDK API documentation. :param api_name: SDK API name :param *api_args: SDK API sequence parameters :param **api_kwargs: SDK API keyword parameters """ return self.conn.request(api_name, *...
[ "def", "send_request", "(", "self", ",", "api_name", ",", "*", "api_args", ",", "*", "*", "api_kwargs", ")", ":", "return", "self", ".", "conn", ".", "request", "(", "api_name", ",", "*", "api_args", ",", "*", "*", "api_kwargs", ")" ]
Refer to SDK API documentation. :param api_name: SDK API name :param *api_args: SDK API sequence parameters :param **api_kwargs: SDK API keyword parameters
[ "Refer", "to", "SDK", "API", "documentation", "." ]
python
train
42
limodou/uliweb
uliweb/lib/werkzeug/security.py
https://github.com/limodou/uliweb/blob/34472f25e4bc0b954a35346672f94e84ef18b076/uliweb/lib/werkzeug/security.py#L108-L127
def safe_str_cmp(a, b): """This function compares strings in somewhat constant time. This requires that the length of at least one string is known in advance. Returns `True` if the two strings are equal or `False` if they are not. .. versionadded:: 0.7 """ if _builtin_safe_str_cmp is not None...
[ "def", "safe_str_cmp", "(", "a", ",", "b", ")", ":", "if", "_builtin_safe_str_cmp", "is", "not", "None", ":", "return", "_builtin_safe_str_cmp", "(", "a", ",", "b", ")", "if", "len", "(", "a", ")", "!=", "len", "(", "b", ")", ":", "return", "False", ...
This function compares strings in somewhat constant time. This requires that the length of at least one string is known in advance. Returns `True` if the two strings are equal or `False` if they are not. .. versionadded:: 0.7
[ "This", "function", "compares", "strings", "in", "somewhat", "constant", "time", ".", "This", "requires", "that", "the", "length", "of", "at", "least", "one", "string", "is", "known", "in", "advance", "." ]
python
train
30.95
Knio/dominate
dominate/dom_tag.py
https://github.com/Knio/dominate/blob/1eb88f9fd797658eef83568a548e2ef9b546807d/dominate/dom_tag.py#L382-L410
def clean_attribute(attribute): ''' Normalize attribute names for shorthand and work arounds for limitations in Python's syntax ''' # Shorthand attribute = { 'cls': 'class', 'className': 'class', 'class_name': 'class', 'fr': 'for', 'html_for': 'for', 'htmlFor...
[ "def", "clean_attribute", "(", "attribute", ")", ":", "# Shorthand", "attribute", "=", "{", "'cls'", ":", "'class'", ",", "'className'", ":", "'class'", ",", "'class_name'", ":", "'class'", ",", "'fr'", ":", "'for'", ",", "'html_for'", ":", "'for'", ",", "...
Normalize attribute names for shorthand and work arounds for limitations in Python's syntax
[ "Normalize", "attribute", "names", "for", "shorthand", "and", "work", "arounds", "for", "limitations", "in", "Python", "s", "syntax" ]
python
valid
26.275862
20c/xbahn
xbahn/engineer.py
https://github.com/20c/xbahn/blob/afb27b0576841338a366d7cac0200a782bd84be6/xbahn/engineer.py#L115-L127
def engineer_list_commands(self): """ Returns a list of all api end points (commands) exposed to engineer """ rv = [] for k in dir(self): attr = getattr(self,k) if type(getattr(attr, "engineer", None)) == dict: rv.append(k) ...
[ "def", "engineer_list_commands", "(", "self", ")", ":", "rv", "=", "[", "]", "for", "k", "in", "dir", "(", "self", ")", ":", "attr", "=", "getattr", "(", "self", ",", "k", ")", "if", "type", "(", "getattr", "(", "attr", ",", "\"engineer\"", ",", ...
Returns a list of all api end points (commands) exposed to engineer
[ "Returns", "a", "list", "of", "all", "api", "end", "points", "(", "commands", ")", "exposed", "to", "engineer" ]
python
train
24.538462
nickmckay/LiPD-utilities
Python/lipd/inferred_data.py
https://github.com/nickmckay/LiPD-utilities/blob/5dab6bbeffc5effd68e3a6beaca6b76aa928e860/Python/lipd/inferred_data.py#L257-L305
def get_inferred_data_table(table, pc): """ Table level: Dive down, calculate data, then return the new table with the inferred data. :param str pc: paleo or chron :param dict table: Metadata :return dict table: Metadata """ age = None if pc == "paleo": # Get the age values data...
[ "def", "get_inferred_data_table", "(", "table", ",", "pc", ")", ":", "age", "=", "None", "if", "pc", "==", "\"paleo\"", ":", "# Get the age values data first, since it's needed to calculate the other column data.", "age", "=", "_get_age", "(", "table", "[", "\"columns\"...
Table level: Dive down, calculate data, then return the new table with the inferred data. :param str pc: paleo or chron :param dict table: Metadata :return dict table: Metadata
[ "Table", "level", ":", "Dive", "down", "calculate", "data", "then", "return", "the", "new", "table", "with", "the", "inferred", "data", "." ]
python
train
47.22449
yjzhang/uncurl_python
uncurl/nb_clustering.py
https://github.com/yjzhang/uncurl_python/blob/55c58ca5670f87699d3bd5752fdfa4baa07724dd/uncurl/nb_clustering.py#L141-L186
def nb_cluster(data, k, P_init=None, R_init=None, assignments=None, means=None, max_iters=10): """ Performs negative binomial clustering on the given data. If some genes have mean > variance, then these genes are fitted to a Poisson distribution. Args: data (array): genes x cells k (int): n...
[ "def", "nb_cluster", "(", "data", ",", "k", ",", "P_init", "=", "None", ",", "R_init", "=", "None", ",", "assignments", "=", "None", ",", "means", "=", "None", ",", "max_iters", "=", "10", ")", ":", "genes", ",", "cells", "=", "data", ".", "shape",...
Performs negative binomial clustering on the given data. If some genes have mean > variance, then these genes are fitted to a Poisson distribution. Args: data (array): genes x cells k (int): number of clusters P_init (array): NB success prob param - genes x k. Default: random R_init...
[ "Performs", "negative", "binomial", "clustering", "on", "the", "given", "data", ".", "If", "some", "genes", "have", "mean", ">", "variance", "then", "these", "genes", "are", "fitted", "to", "a", "Poisson", "distribution", "." ]
python
train
48.652174
divio/django-filer
filer/admin/folderadmin.py
https://github.com/divio/django-filer/blob/946629087943d41eff290f07bfdf240b8853dd88/filer/admin/folderadmin.py#L75-L104
def get_form(self, request, obj=None, **kwargs): """ Returns a Form class for use in the admin add view. This is used by add_view and change_view. """ parent_id = request.GET.get('parent_id', None) if not parent_id: parent_id = request.POST.get('parent_id', No...
[ "def", "get_form", "(", "self", ",", "request", ",", "obj", "=", "None", ",", "*", "*", "kwargs", ")", ":", "parent_id", "=", "request", ".", "GET", ".", "get", "(", "'parent_id'", ",", "None", ")", "if", "not", "parent_id", ":", "parent_id", "=", ...
Returns a Form class for use in the admin add view. This is used by add_view and change_view.
[ "Returns", "a", "Form", "class", "for", "use", "in", "the", "admin", "add", "view", ".", "This", "is", "used", "by", "add_view", "and", "change_view", "." ]
python
train
42.633333
amzn/ion-python
amazon/ion/reader_text.py
https://github.com/amzn/ion-python/blob/0b21fa3ba7755f55f745e4aa970d86343b82449d/amazon/ion/reader_text.py#L400-L404
def set_quoted_text(self, quoted_text): """Sets the context's ``quoted_text`` flag. Useful when entering and exiting quoted text tokens.""" self.quoted_text = quoted_text self.line_comment = False return self
[ "def", "set_quoted_text", "(", "self", ",", "quoted_text", ")", ":", "self", ".", "quoted_text", "=", "quoted_text", "self", ".", "line_comment", "=", "False", "return", "self" ]
Sets the context's ``quoted_text`` flag. Useful when entering and exiting quoted text tokens.
[ "Sets", "the", "context", "s", "quoted_text", "flag", ".", "Useful", "when", "entering", "and", "exiting", "quoted", "text", "tokens", "." ]
python
train
47.2
ipfs/py-ipfs-api
ipfsapi/client.py
https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L2109-L2130
def add_bytes(self, data, **kwargs): """Adds a set of bytes as a file to IPFS. .. code-block:: python >>> c.add_bytes(b"Mary had a little lamb") 'QmZfF6C9j4VtoCsTp4KSrhYH47QMd3DNXVZBKaxJdhaPab' Also accepts and will stream generator objects. Parameters ...
[ "def", "add_bytes", "(", "self", ",", "data", ",", "*", "*", "kwargs", ")", ":", "body", ",", "headers", "=", "multipart", ".", "stream_bytes", "(", "data", ",", "self", ".", "chunk_size", ")", "return", "self", ".", "_client", ".", "request", "(", "...
Adds a set of bytes as a file to IPFS. .. code-block:: python >>> c.add_bytes(b"Mary had a little lamb") 'QmZfF6C9j4VtoCsTp4KSrhYH47QMd3DNXVZBKaxJdhaPab' Also accepts and will stream generator objects. Parameters ---------- data : bytes Con...
[ "Adds", "a", "set", "of", "bytes", "as", "a", "file", "to", "IPFS", "." ]
python
train
30.454545
SoftwareDefinedBuildings/XBOS
apps/Data_quality_analysis/Clean_Data.py
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L386-L412
def remove_end_NaN(self, data, var=None): """ Remove end NaN. CHECK: Note issue with multi-column df. Parameters ---------- data : pd.DataFrame() Input dataframe. var : list(str) List that specifies specific columns of data...
[ "def", "remove_end_NaN", "(", "self", ",", "data", ",", "var", "=", "None", ")", ":", "# Limit to one or some variables", "if", "var", ":", "end_ok_data", "=", "data", "[", "var", "]", ".", "last_valid_index", "(", ")", "else", ":", "end_ok_data", "=", "da...
Remove end NaN. CHECK: Note issue with multi-column df. Parameters ---------- data : pd.DataFrame() Input dataframe. var : list(str) List that specifies specific columns of dataframe. Returns ------- pd.Dat...
[ "Remove", "end", "NaN", ".", "CHECK", ":", "Note", "issue", "with", "multi", "-", "column", "df", ".", "Parameters", "----------", "data", ":", "pd", ".", "DataFrame", "()", "Input", "dataframe", ".", "var", ":", "list", "(", "str", ")", "List", "that"...
python
train
25.222222
miyakogi/wdom
wdom/document.py
https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/document.py#L31-L34
def getElementById(id: str) -> Optional[Node]: """Get element with ``id``.""" elm = Element._elements_with_id.get(id) return elm
[ "def", "getElementById", "(", "id", ":", "str", ")", "->", "Optional", "[", "Node", "]", ":", "elm", "=", "Element", ".", "_elements_with_id", ".", "get", "(", "id", ")", "return", "elm" ]
Get element with ``id``.
[ "Get", "element", "with", "id", "." ]
python
train
34.25
hydraplatform/hydra-base
hydra_base/lib/users.py
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/lib/users.py#L120-L130
def update_user_password(new_pwd_user_id, new_password,**kwargs): """ Update a user's password """ #check_perm(kwargs.get('user_id'), 'edit_user') try: user_i = db.DBSession.query(User).filter(User.id==new_pwd_user_id).one() user_i.password = bcrypt.hashpw(str(new_password).encod...
[ "def", "update_user_password", "(", "new_pwd_user_id", ",", "new_password", ",", "*", "*", "kwargs", ")", ":", "#check_perm(kwargs.get('user_id'), 'edit_user')", "try", ":", "user_i", "=", "db", ".", "DBSession", ".", "query", "(", "User", ")", ".", "filter", "(...
Update a user's password
[ "Update", "a", "user", "s", "password" ]
python
train
42.454545
saltstack/salt
salt/cloud/clouds/vmware.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L1484-L1498
def _get_hba_type(hba_type): ''' Convert a string representation of a HostHostBusAdapter into an object reference. ''' if hba_type == "parallel": return vim.host.ParallelScsiHba elif hba_type == "block": return vim.host.BlockHba elif hba_type == "iscsi": return vim.ho...
[ "def", "_get_hba_type", "(", "hba_type", ")", ":", "if", "hba_type", "==", "\"parallel\"", ":", "return", "vim", ".", "host", ".", "ParallelScsiHba", "elif", "hba_type", "==", "\"block\"", ":", "return", "vim", ".", "host", ".", "BlockHba", "elif", "hba_type...
Convert a string representation of a HostHostBusAdapter into an object reference.
[ "Convert", "a", "string", "representation", "of", "a", "HostHostBusAdapter", "into", "an", "object", "reference", "." ]
python
train
29.933333
fitnr/convertdate
convertdate/french_republican.py
https://github.com/fitnr/convertdate/blob/e920f168a87f99183b0aa7290d6c3af222582d43/convertdate/french_republican.py#L81-L95
def premier_da_la_annee(jd): '''Determine the year in the French revolutionary calendar in which a given Julian day falls. Returns Julian day number containing fall equinox (first day of the FR year)''' p = ephem.previous_fall_equinox(dublin.from_jd(jd)) previous = trunc(dublin.to_jd(p) - 0.5) + 0.5 ...
[ "def", "premier_da_la_annee", "(", "jd", ")", ":", "p", "=", "ephem", ".", "previous_fall_equinox", "(", "dublin", ".", "from_jd", "(", "jd", ")", ")", "previous", "=", "trunc", "(", "dublin", ".", "to_jd", "(", "p", ")", "-", "0.5", ")", "+", "0.5",...
Determine the year in the French revolutionary calendar in which a given Julian day falls. Returns Julian day number containing fall equinox (first day of the FR year)
[ "Determine", "the", "year", "in", "the", "French", "revolutionary", "calendar", "in", "which", "a", "given", "Julian", "day", "falls", ".", "Returns", "Julian", "day", "number", "containing", "fall", "equinox", "(", "first", "day", "of", "the", "FR", "year",...
python
train
39.466667
Diaoul/subliminal
subliminal/video.py
https://github.com/Diaoul/subliminal/blob/a952dfb2032eb0fd6eb1eb89f04080923c11c4cf/subliminal/video.py#L76-L81
def age(self): """Age of the video""" if self.exists: return datetime.utcnow() - datetime.utcfromtimestamp(os.path.getmtime(self.name)) return timedelta()
[ "def", "age", "(", "self", ")", ":", "if", "self", ".", "exists", ":", "return", "datetime", ".", "utcnow", "(", ")", "-", "datetime", ".", "utcfromtimestamp", "(", "os", ".", "path", ".", "getmtime", "(", "self", ".", "name", ")", ")", "return", "...
Age of the video
[ "Age", "of", "the", "video" ]
python
train
31
AlecAivazis/graphql-over-kafka
nautilus/services/apiGateway.py
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/services/apiGateway.py#L87-L109
def auth_criteria(self): """ This attribute provides the mapping of services to their auth requirement Returns: (dict) : the mapping from services to their auth requirements. """ # the dictionary we will return auth = {} # go over each at...
[ "def", "auth_criteria", "(", "self", ")", ":", "# the dictionary we will return", "auth", "=", "{", "}", "# go over each attribute of the service", "for", "attr", "in", "dir", "(", "self", ")", ":", "# make sure we could hit an infinite loop", "if", "attr", "!=", "'au...
This attribute provides the mapping of services to their auth requirement Returns: (dict) : the mapping from services to their auth requirements.
[ "This", "attribute", "provides", "the", "mapping", "of", "services", "to", "their", "auth", "requirement" ]
python
train
38.086957
IdentityPython/pyop
src/pyop/authz_state.py
https://github.com/IdentityPython/pyop/blob/7b1385964f079c39752fce5f2dbcf458b8a92e56/src/pyop/authz_state.py#L173-L188
def introspect_access_token(self, access_token_value): # type: (str) -> Dict[str, Union[str, List[str]]] """ Returns authorization data associated with the access token. See <a href="https://tools.ietf.org/html/rfc7662">"Token Introspection", Section 2.2</a>. """ if acces...
[ "def", "introspect_access_token", "(", "self", ",", "access_token_value", ")", ":", "# type: (str) -> Dict[str, Union[str, List[str]]]", "if", "access_token_value", "not", "in", "self", ".", "access_tokens", ":", "raise", "InvalidAccessToken", "(", "'{} unknown'", ".", "f...
Returns authorization data associated with the access token. See <a href="https://tools.ietf.org/html/rfc7662">"Token Introspection", Section 2.2</a>.
[ "Returns", "authorization", "data", "associated", "with", "the", "access", "token", ".", "See", "<a", "href", "=", "https", ":", "//", "tools", ".", "ietf", ".", "org", "/", "html", "/", "rfc7662", ">", "Token", "Introspection", "Section", "2", ".", "2<"...
python
train
47
Clinical-Genomics/scout
scout/server/blueprints/cases/views.py
https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/cases/views.py#L392-L398
def case_synopsis(institute_id, case_name): """Update (PUT) synopsis of a specific case.""" institute_obj, case_obj = institute_and_case(store, institute_id, case_name) user_obj = store.user(current_user.email) new_synopsis = request.form.get('synopsis') controllers.update_synopsis(store, institute_...
[ "def", "case_synopsis", "(", "institute_id", ",", "case_name", ")", ":", "institute_obj", ",", "case_obj", "=", "institute_and_case", "(", "store", ",", "institute_id", ",", "case_name", ")", "user_obj", "=", "store", ".", "user", "(", "current_user", ".", "em...
Update (PUT) synopsis of a specific case.
[ "Update", "(", "PUT", ")", "synopsis", "of", "a", "specific", "case", "." ]
python
test
55.714286
acutesoftware/AIKIF
aikif/web_app/page_programs.py
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/web_app/page_programs.py#L95-L104
def get_functions(fname): """ get a list of functions from a Python program """ txt = '' with open(fname, 'r') as f: for line in f: if line.strip()[0:4] == 'def ': txt += '<PRE>' + strip_text_after_string(strip_text_after_string(line, '#')[4:], ':') + '</PRE>\n' ...
[ "def", "get_functions", "(", "fname", ")", ":", "txt", "=", "''", "with", "open", "(", "fname", ",", "'r'", ")", "as", "f", ":", "for", "line", "in", "f", ":", "if", "line", ".", "strip", "(", ")", "[", "0", ":", "4", "]", "==", "'def '", ":"...
get a list of functions from a Python program
[ "get", "a", "list", "of", "functions", "from", "a", "Python", "program" ]
python
train
47.4
robehickman/simple-http-file-sync
shttpfs/server.py
https://github.com/robehickman/simple-http-file-sync/blob/fa29b3ee58e9504e1d3ddfc0c14047284bf9921d/shttpfs/server.py#L380-L425
def begin_commit(): """ Allow a client to begin a commit and acquire the write lock """ session_token = request.headers['session_token'] repository = request.headers['repository'] #=== current_user = have_authenticated_user(request.environ['REMOTE_ADDR'], repository, session_token) if curre...
[ "def", "begin_commit", "(", ")", ":", "session_token", "=", "request", ".", "headers", "[", "'session_token'", "]", "repository", "=", "request", ".", "headers", "[", "'repository'", "]", "#===", "current_user", "=", "have_authenticated_user", "(", "request", "....
Allow a client to begin a commit and acquire the write lock
[ "Allow", "a", "client", "to", "begin", "a", "commit", "and", "acquire", "the", "write", "lock" ]
python
train
54.652174
spyder-ide/spyder
spyder/config/base.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/base.py#L192-L219
def get_conf_path(filename=None): """Return absolute path to the config file with the specified filename.""" # Define conf_dir if running_under_pytest() or SAFE_MODE: # Use clean config dir if running tests or the user requests it. conf_dir = get_clean_conf_dir() elif sys.platform....
[ "def", "get_conf_path", "(", "filename", "=", "None", ")", ":", "# Define conf_dir\r", "if", "running_under_pytest", "(", ")", "or", "SAFE_MODE", ":", "# Use clean config dir if running tests or the user requests it.\r", "conf_dir", "=", "get_clean_conf_dir", "(", ")", "e...
Return absolute path to the config file with the specified filename.
[ "Return", "absolute", "path", "to", "the", "config", "file", "with", "the", "specified", "filename", "." ]
python
train
39.607143
opendatateam/udata
udata/utils.py
https://github.com/opendatateam/udata/blob/f016585af94b0ff6bd73738c700324adc8ba7f8f/udata/utils.py#L238-L242
def unique_string(length=UUID_LENGTH): '''Generate a unique string''' # We need a string at least as long as length string = str(uuid4()) * int(math.ceil(length / float(UUID_LENGTH))) return string[:length] if length else string
[ "def", "unique_string", "(", "length", "=", "UUID_LENGTH", ")", ":", "# We need a string at least as long as length", "string", "=", "str", "(", "uuid4", "(", ")", ")", "*", "int", "(", "math", ".", "ceil", "(", "length", "/", "float", "(", "UUID_LENGTH", ")...
Generate a unique string
[ "Generate", "a", "unique", "string" ]
python
train
48
pallets/werkzeug
src/werkzeug/http.py
https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L261-L275
def dump_options_header(header, options): """The reverse function to :func:`parse_options_header`. :param header: the header to dump :param options: a dict of options to append. """ segments = [] if header is not None: segments.append(header) for key, value in iteritems(options): ...
[ "def", "dump_options_header", "(", "header", ",", "options", ")", ":", "segments", "=", "[", "]", "if", "header", "is", "not", "None", ":", "segments", ".", "append", "(", "header", ")", "for", "key", ",", "value", "in", "iteritems", "(", "options", ")...
The reverse function to :func:`parse_options_header`. :param header: the header to dump :param options: a dict of options to append.
[ "The", "reverse", "function", "to", ":", "func", ":", "parse_options_header", "." ]
python
train
31.933333
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1513-L1519
def _onMenuButton(self, evt): """Handle menu button pressed.""" x, y = self.GetPositionTuple() w, h = self.GetSizeTuple() self.PopupMenuXY(self._menu, x, y+h-4) # When menu returned, indicate selection in button evt.Skip()
[ "def", "_onMenuButton", "(", "self", ",", "evt", ")", ":", "x", ",", "y", "=", "self", ".", "GetPositionTuple", "(", ")", "w", ",", "h", "=", "self", ".", "GetSizeTuple", "(", ")", "self", ".", "PopupMenuXY", "(", "self", ".", "_menu", ",", "x", ...
Handle menu button pressed.
[ "Handle", "menu", "button", "pressed", "." ]
python
train
38.857143
Naresh1318/crystal
crystal/app.py
https://github.com/Naresh1318/crystal/blob/6bb43fd1128296cc59b8ed3bc03064cc61c6bd88/crystal/app.py#L148-L175
def get_variables(): """ Send a dictionary of variables associated with the selected run. Usage description: This function is usually called to get and display the list of runs associated with a selected project available in the database for the user to view. :return: JSON, {<int_keys>: <run_n...
[ "def", "get_variables", "(", ")", ":", "assert", "request", ".", "method", "==", "\"POST\"", ",", "\"POST request expected received {}\"", ".", "format", "(", "request", ".", "method", ")", "if", "request", ".", "method", "==", "\"POST\"", ":", "try", ":", "...
Send a dictionary of variables associated with the selected run. Usage description: This function is usually called to get and display the list of runs associated with a selected project available in the database for the user to view. :return: JSON, {<int_keys>: <run_name>}
[ "Send", "a", "dictionary", "of", "variables", "associated", "with", "the", "selected", "run", "." ]
python
train
36.107143
scivision/lowtran
lowtran/base.py
https://github.com/scivision/lowtran/blob/9954d859e53437436103f9ab54a7e2602ecaa1b7/lowtran/base.py#L12-L27
def nm2lt7(short_nm: float, long_nm: float, step_cminv: float = 20) -> Tuple[float, float, float]: """converts wavelength in nm to cm^-1 minimum meaningful step is 20, but 5 is minimum before crashing lowtran short: shortest wavelength e.g. 200 nm long: longest wavelength e.g. 30000 nm step: step s...
[ "def", "nm2lt7", "(", "short_nm", ":", "float", ",", "long_nm", ":", "float", ",", "step_cminv", ":", "float", "=", "20", ")", "->", "Tuple", "[", "float", ",", "float", ",", "float", "]", ":", "short", "=", "1e7", "/", "short_nm", "long", "=", "1e...
converts wavelength in nm to cm^-1 minimum meaningful step is 20, but 5 is minimum before crashing lowtran short: shortest wavelength e.g. 200 nm long: longest wavelength e.g. 30000 nm step: step size in cm^-1 e.g. 20 output in cm^-1
[ "converts", "wavelength", "in", "nm", "to", "cm^", "-", "1", "minimum", "meaningful", "step", "is", "20", "but", "5", "is", "minimum", "before", "crashing", "lowtran" ]
python
train
31.1875
SMTG-UCL/sumo
sumo/plotting/bs_plotter.py
https://github.com/SMTG-UCL/sumo/blob/47aec6bbfa033a624435a65bd4edabd18bfb437f/sumo/plotting/bs_plotter.py#L201-L450
def get_projected_plot(self, selection, mode='rgb', interpolate_factor=4, circle_size=150, projection_cutoff=0.001, zero_to_efermi=True, ymin=-6., ymax=6., width=None, height=None, vbm_cbm_marker=False, ylabel='E...
[ "def", "get_projected_plot", "(", "self", ",", "selection", ",", "mode", "=", "'rgb'", ",", "interpolate_factor", "=", "4", ",", "circle_size", "=", "150", ",", "projection_cutoff", "=", "0.001", ",", "zero_to_efermi", "=", "True", ",", "ymin", "=", "-", "...
Get a :obj:`matplotlib.pyplot` of the projected band structure. If the system is spin polarised and ``mode = 'rgb'`` spin up and spin down bands are differentiated by solid and dashed lines, respectively. For the other modes, spin up and spin down are plotted separately. Args: ...
[ "Get", "a", ":", "obj", ":", "matplotlib", ".", "pyplot", "of", "the", "projected", "band", "structure", "." ]
python
train
49.572
Equitable/trump
trump/orm.py
https://github.com/Equitable/trump/blob/a2802692bc642fa32096374159eea7ceca2947b4/trump/orm.py#L786-L827
def get_converted(self, symbol, units='CAD', system=None, tag=None): """ Uses a Symbol's Dataframe, to build a new Dataframe, with the data converted to the new units Parameters ---------- symbol : str or tuple of the form (Dataframe, str) Str...
[ "def", "get_converted", "(", "self", ",", "symbol", ",", "units", "=", "'CAD'", ",", "system", "=", "None", ",", "tag", "=", "None", ")", ":", "if", "isinstance", "(", "symbol", ",", "(", "str", ",", "unicode", ")", ")", ":", "sym", "=", "self", ...
Uses a Symbol's Dataframe, to build a new Dataframe, with the data converted to the new units Parameters ---------- symbol : str or tuple of the form (Dataframe, str) String representing a symbol's name, or a dataframe with the data required to be ...
[ "Uses", "a", "Symbol", "s", "Dataframe", "to", "build", "a", "new", "Dataframe", "with", "the", "data", "converted", "to", "the", "new", "units", "Parameters", "----------", "symbol", ":", "str", "or", "tuple", "of", "the", "form", "(", "Dataframe", "str",...
python
train
40.214286
urinieto/msaf
msaf/pymf/cmd.py
https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/pymf/cmd.py#L72-L89
def factorize(self): """ Factorize s.t. CUR = data Updated Values -------------- .C : updated values for C. .U : updated values for U. .R : updated values for R. """ [prow, pcol] = self.sample_probability() self._rid = self.s...
[ "def", "factorize", "(", "self", ")", ":", "[", "prow", ",", "pcol", "]", "=", "self", ".", "sample_probability", "(", ")", "self", ".", "_rid", "=", "self", ".", "sample", "(", "self", ".", "_rrank", ",", "prow", ")", "self", ".", "_cid", "=", "...
Factorize s.t. CUR = data Updated Values -------------- .C : updated values for C. .U : updated values for U. .R : updated values for R.
[ "Factorize", "s", ".", "t", ".", "CUR", "=", "data" ]
python
test
23.888889
assemblerflow/flowcraft
flowcraft/generator/pipeline_parser.py
https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/pipeline_parser.py#L24-L55
def guess_process(query_str, process_map): """ Function to guess processes based on strings that are not available in process_map. If the string has typos and is somewhat similar (50%) to any process available in flowcraft it will print info to the terminal, suggesting the most similar processes ava...
[ "def", "guess_process", "(", "query_str", ",", "process_map", ")", ":", "save_list", "=", "[", "]", "# loops between the processes available in process_map", "for", "process", "in", "process_map", ":", "similarity", "=", "SequenceMatcher", "(", "None", ",", "process",...
Function to guess processes based on strings that are not available in process_map. If the string has typos and is somewhat similar (50%) to any process available in flowcraft it will print info to the terminal, suggesting the most similar processes available in flowcraft. Parameters ---------- ...
[ "Function", "to", "guess", "processes", "based", "on", "strings", "that", "are", "not", "available", "in", "process_map", ".", "If", "the", "string", "has", "typos", "and", "is", "somewhat", "similar", "(", "50%", ")", "to", "any", "process", "available", ...
python
test
37
erm0l0v/django-fake-model
django_fake_model/models.py
https://github.com/erm0l0v/django-fake-model/blob/42fb28ac3aa4db5f82b6cb97a7c2a92b83b36314/django_fake_model/models.py#L22-L43
def create_table(cls): """ create_table Manually create a temporary table for model in test data base. :return: """ schema_editor = getattr(connection, 'schema_editor', None) if schema_editor: with schema_editor() as schema_editor: sch...
[ "def", "create_table", "(", "cls", ")", ":", "schema_editor", "=", "getattr", "(", "connection", ",", "'schema_editor'", ",", "None", ")", "if", "schema_editor", ":", "with", "schema_editor", "(", ")", "as", "schema_editor", ":", "schema_editor", ".", "create_...
create_table Manually create a temporary table for model in test data base. :return:
[ "create_table" ]
python
train
29.772727
soimort/you-get
src/you_get/common.py
https://github.com/soimort/you-get/blob/b746ac01c9f39de94cac2d56f665285b0523b974/src/you_get/common.py#L319-L326
def ungzip(data): """Decompresses data for Content-Encoding: gzip. """ from io import BytesIO import gzip buffer = BytesIO(data) f = gzip.GzipFile(fileobj=buffer) return f.read()
[ "def", "ungzip", "(", "data", ")", ":", "from", "io", "import", "BytesIO", "import", "gzip", "buffer", "=", "BytesIO", "(", "data", ")", "f", "=", "gzip", ".", "GzipFile", "(", "fileobj", "=", "buffer", ")", "return", "f", ".", "read", "(", ")" ]
Decompresses data for Content-Encoding: gzip.
[ "Decompresses", "data", "for", "Content", "-", "Encoding", ":", "gzip", "." ]
python
test
24.875
molmod/molmod
molmod/molecular_graphs.py
https://github.com/molmod/molmod/blob/a7b5b4364ed514ad4c465856c05b5eda1cb561e0/molmod/molecular_graphs.py#L85-L176
def from_geometry(cls, molecule, do_orders=False, scaling=1.0): """Construct a MolecularGraph object based on interatomic distances All short distances are computed with the binning module and compared with a database of bond lengths. Based on this comparison, bonded atoms are ...
[ "def", "from_geometry", "(", "cls", ",", "molecule", ",", "do_orders", "=", "False", ",", "scaling", "=", "1.0", ")", ":", "from", "molmod", ".", "bonds", "import", "bonds", "unit_cell", "=", "molecule", ".", "unit_cell", "pair_search", "=", "PairSearchIntra...
Construct a MolecularGraph object based on interatomic distances All short distances are computed with the binning module and compared with a database of bond lengths. Based on this comparison, bonded atoms are detected. Before marking a pair of atoms A and B as bonded, it ...
[ "Construct", "a", "MolecularGraph", "object", "based", "on", "interatomic", "distances" ]
python
train
43.543478
yangl1996/libpagure
libpagure/libpagure.py
https://github.com/yangl1996/libpagure/blob/dd96ed29142407463790c66ed321984a6ea7465a/libpagure/libpagure.py#L197-L207
def request_info(self, request_id): """ Get information of a single pull request. :param request_id: the id of the request :return: """ request_url = "{}pull-request/{}".format(self.create_basic_url(), request_id) ...
[ "def", "request_info", "(", "self", ",", "request_id", ")", ":", "request_url", "=", "\"{}pull-request/{}\"", ".", "format", "(", "self", ".", "create_basic_url", "(", ")", ",", "request_id", ")", "return_value", "=", "self", ".", "_call_api", "(", "request_ur...
Get information of a single pull request. :param request_id: the id of the request :return:
[ "Get", "information", "of", "a", "single", "pull", "request", ".", ":", "param", "request_id", ":", "the", "id", "of", "the", "request", ":", "return", ":" ]
python
train
34.545455
ewiger/mlab
src/mlab/matlabcom.py
https://github.com/ewiger/mlab/blob/72a98adf6499f548848ad44c604f74d68f07fe4f/src/mlab/matlabcom.py#L92-L117
def get(self, names_to_get, convert_to_numpy=True): """ Loads the requested variables from the matlab com client. names_to_get can be either a variable name or a list of variable names. If it is a variable name, the values is returned. If it is a list, a dictionary of variable_name -> value is returned...
[ "def", "get", "(", "self", ",", "names_to_get", ",", "convert_to_numpy", "=", "True", ")", ":", "self", ".", "_check_open", "(", ")", "single_itme", "=", "isinstance", "(", "names_to_get", ",", "(", "unicode", ",", "str", ")", ")", "if", "single_itme", "...
Loads the requested variables from the matlab com client. names_to_get can be either a variable name or a list of variable names. If it is a variable name, the values is returned. If it is a list, a dictionary of variable_name -> value is returned. If convert_to_numpy is true, the method will all arra...
[ "Loads", "the", "requested", "variables", "from", "the", "matlab", "com", "client", "." ]
python
train
40.615385
Opentrons/opentrons
update-server/otupdate/balena/bootstrap.py
https://github.com/Opentrons/opentrons/blob/a7c15cc2636ecb64ab56c7edc1d8a57163aaeadf/update-server/otupdate/balena/bootstrap.py#L108-L135
async def _start_server(python, port, venv_site_pkgs=None, cwd=None) -> sp.Popen: """ Starts an update server sandboxed in the virtual env, and attempts to read the health endpoint with retries to determine when the server is available. If the number of retries is exceeded, the r...
[ "async", "def", "_start_server", "(", "python", ",", "port", ",", "venv_site_pkgs", "=", "None", ",", "cwd", "=", "None", ")", "->", "sp", ".", "Popen", ":", "log", ".", "info", "(", "\"Starting sandboxed update server on port {}\"", ".", "format", "(", "por...
Starts an update server sandboxed in the virtual env, and attempts to read the health endpoint with retries to determine when the server is available. If the number of retries is exceeded, the returned server process will already be terminated. :return: the server process
[ "Starts", "an", "update", "server", "sandboxed", "in", "the", "virtual", "env", "and", "attempts", "to", "read", "the", "health", "endpoint", "with", "retries", "to", "determine", "when", "the", "server", "is", "available", ".", "If", "the", "number", "of", ...
python
train
41.785714
millar/provstore-api
provstore/document.py
https://github.com/millar/provstore-api/blob/0dd506b4f0e00623b95a52caa70debe758817179/provstore/document.py#L311-L321
def created_at(self): """ :return: When the document was created :rtype: :py:class:`datetime.datetime` """ if self._created_at: return self._created_at elif not self.abstract: return self.read_meta()._created_at raise EmptyDocumentExceptio...
[ "def", "created_at", "(", "self", ")", ":", "if", "self", ".", "_created_at", ":", "return", "self", ".", "_created_at", "elif", "not", "self", ".", "abstract", ":", "return", "self", ".", "read_meta", "(", ")", ".", "_created_at", "raise", "EmptyDocumentE...
:return: When the document was created :rtype: :py:class:`datetime.datetime`
[ ":", "return", ":", "When", "the", "document", "was", "created", ":", "rtype", ":", ":", "py", ":", "class", ":", "datetime", ".", "datetime" ]
python
train
28.454545
imgix/imgix-python
imgix/urlbuilder.py
https://github.com/imgix/imgix-python/blob/117e0b169552695232689dd0443be7810263e5c5/imgix/urlbuilder.py#L95-L141
def create_url(self, path, params={}, opts={}): """ Create URL with supplied path and `opts` parameters dict. Parameters ---------- path : str opts : dict Dictionary specifying URL parameters. Non-imgix parameters are added to the URL unprocessed....
[ "def", "create_url", "(", "self", ",", "path", ",", "params", "=", "{", "}", ",", "opts", "=", "{", "}", ")", ":", "if", "opts", ":", "warnings", ".", "warn", "(", "'`opts` has been deprecated. Use `params` instead.'", ",", "DeprecationWarning", ",", "stackl...
Create URL with supplied path and `opts` parameters dict. Parameters ---------- path : str opts : dict Dictionary specifying URL parameters. Non-imgix parameters are added to the URL unprocessed. For a complete list of imgix supported parameters, visi...
[ "Create", "URL", "with", "supplied", "path", "and", "opts", "parameters", "dict", "." ]
python
valid
31.659574
PmagPy/PmagPy
programs/irm_unmix.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/irm_unmix.py#L287-L299
def fit_plots(ax,xfit,xraw,yfit,yraw): ''' #==================================================================== plot the fitted results for data fit and refit #==================================================================== ''' global _yfits_ _yfits_ = yfit ax.plot(xfit, yfit) ...
[ "def", "fit_plots", "(", "ax", ",", "xfit", ",", "xraw", ",", "yfit", ",", "yraw", ")", ":", "global", "_yfits_", "_yfits_", "=", "yfit", "ax", ".", "plot", "(", "xfit", ",", "yfit", ")", "ax", ".", "plot", "(", "xfit", ",", "np", ".", "sum", "...
#==================================================================== plot the fitted results for data fit and refit #====================================================================
[ "#", "====================================================================", "plot", "the", "fitted", "results", "for", "data", "fit", "and", "refit", "#", "====================================================================" ]
python
train
34.384615
sbg/sevenbridges-python
sevenbridges/models/automation.py
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/automation.py#L104-L122
def query(cls, automation=None, offset=None, limit=None, api=None): """ Query (List) apps. :param automation: Automation id. :param offset: Pagination offset. :param limit: Pagination limit. :param api: Api instance. :return: collection object """ ...
[ "def", "query", "(", "cls", ",", "automation", "=", "None", ",", "offset", "=", "None", ",", "limit", "=", "None", ",", "api", "=", "None", ")", ":", "automation_id", "=", "Transform", ".", "to_automation", "(", "automation", ")", "api", "=", "api", ...
Query (List) apps. :param automation: Automation id. :param offset: Pagination offset. :param limit: Pagination limit. :param api: Api instance. :return: collection object
[ "Query", "(", "List", ")", "apps", ".", ":", "param", "automation", ":", "Automation", "id", ".", ":", "param", "offset", ":", "Pagination", "offset", ".", ":", "param", "limit", ":", "Pagination", "limit", ".", ":", "param", "api", ":", "Api", "instan...
python
train
33.210526
jam31118/vis
vis/layout.py
https://github.com/jam31118/vis/blob/965ebec102c539b323d5756fef04153ac71e50d9/vis/layout.py#L47-L56
def get_text_alignment(pos): """Return 'verticalalignment'('va') and 'horizontalalignment'('ha') for given 'pos' (position)""" pos = pos.lower() # to make it case insensitive va, ha = None, None if pos == 'nw': va, ha = 'top', 'left' elif pos == 'ne': va, ha = 'top', 'right' elif pos == 'sw': v...
[ "def", "get_text_alignment", "(", "pos", ")", ":", "pos", "=", "pos", ".", "lower", "(", ")", "# to make it case insensitive", "va", ",", "ha", "=", "None", ",", "None", "if", "pos", "==", "'nw'", ":", "va", ",", "ha", "=", "'top'", ",", "'left'", "e...
Return 'verticalalignment'('va') and 'horizontalalignment'('ha') for given 'pos' (position)
[ "Return", "verticalalignment", "(", "va", ")", "and", "horizontalalignment", "(", "ha", ")", "for", "given", "pos", "(", "position", ")" ]
python
train
48.5
cmck/pybrowserstack-screenshots
client.py
https://github.com/cmck/pybrowserstack-screenshots/blob/598358fc5b9a41678b3f913f2c082a288011322d/client.py#L33-L38
def _build_sliced_filepath(filename, slice_count): """ append slice_count to the end of a filename """ root = os.path.splitext(filename)[0] ext = os.path.splitext(filename)[1] new_filepath = ''.join((root, str(slice_count), ext)) return _build_filepath_for_phantomcss(new_filepath)
[ "def", "_build_sliced_filepath", "(", "filename", ",", "slice_count", ")", ":", "root", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "[", "0", "]", "ext", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "[", "1", "]",...
append slice_count to the end of a filename
[ "append", "slice_count", "to", "the", "end", "of", "a", "filename" ]
python
train
49.333333
lingthio/Flask-User
flask_user/user_manager__views.py
https://github.com/lingthio/Flask-User/blob/a379fa0a281789618c484b459cb41236779b95b1/flask_user/user_manager__views.py#L546-L604
def reset_password_view(self, token): """ Verify the password reset token, Prompt for new password, and set the user's password.""" # Verify token if self.call_or_get(current_user.is_authenticated): logout_user() data_items = self.token_manager.verify_token( tok...
[ "def", "reset_password_view", "(", "self", ",", "token", ")", ":", "# Verify token", "if", "self", ".", "call_or_get", "(", "current_user", ".", "is_authenticated", ")", ":", "logout_user", "(", ")", "data_items", "=", "self", ".", "token_manager", ".", "verif...
Verify the password reset token, Prompt for new password, and set the user's password.
[ "Verify", "the", "password", "reset", "token", "Prompt", "for", "new", "password", "and", "set", "the", "user", "s", "password", "." ]
python
train
40.338983
dropbox/pyannotate
pyannotate_tools/fixes/fix_annotate.py
https://github.com/dropbox/pyannotate/blob/d128c76b8a86f208e5c78716f2a917003650cebc/pyannotate_tools/fixes/fix_annotate.py#L472-L481
def is_generator(self, node): """Traverse the tree below node looking for 'yield [expr]'.""" results = {} if self.yield_expr.match(node, results): return True for child in node.children: if child.type not in (syms.funcdef, syms.classdef): if self.i...
[ "def", "is_generator", "(", "self", ",", "node", ")", ":", "results", "=", "{", "}", "if", "self", ".", "yield_expr", ".", "match", "(", "node", ",", "results", ")", ":", "return", "True", "for", "child", "in", "node", ".", "children", ":", "if", "...
Traverse the tree below node looking for 'yield [expr]'.
[ "Traverse", "the", "tree", "below", "node", "looking", "for", "yield", "[", "expr", "]", "." ]
python
train
38.3
materialsproject/pymatgen
pymatgen/analysis/molecule_structure_comparator.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/molecule_structure_comparator.py#L127-L167
def _get_bonds(self, mol): """ Find all the bond in a molcule Args: mol: the molecule. pymatgen Molecule object Returns: List of tuple. Each tuple correspond to a bond represented by the id of the two end atoms. """ num_atoms = len(mo...
[ "def", "_get_bonds", "(", "self", ",", "mol", ")", ":", "num_atoms", "=", "len", "(", "mol", ")", "# index starting from 0", "if", "self", ".", "ignore_ionic_bond", ":", "covalent_atoms", "=", "[", "i", "for", "i", "in", "range", "(", "num_atoms", ")", "...
Find all the bond in a molcule Args: mol: the molecule. pymatgen Molecule object Returns: List of tuple. Each tuple correspond to a bond represented by the id of the two end atoms.
[ "Find", "all", "the", "bond", "in", "a", "molcule" ]
python
train
47.365854
gholt/swiftly
swiftly/cli/decrypt.py
https://github.com/gholt/swiftly/blob/5bcc1c65323b1caf1f85adbefd9fc4988c072149/swiftly/cli/decrypt.py#L31-L49
def cli_decrypt(context, key): """ Decrypts context.io_manager's stdin and sends that to context.io_manager's stdout. See :py:mod:`swiftly.cli.decrypt` for context usage information. See :py:class:`CLIDecrypt` for more information. """ with context.io_manager.with_stdout() as stdout: ...
[ "def", "cli_decrypt", "(", "context", ",", "key", ")", ":", "with", "context", ".", "io_manager", ".", "with_stdout", "(", ")", "as", "stdout", ":", "with", "context", ".", "io_manager", ".", "with_stdin", "(", ")", "as", "stdin", ":", "crypt_type", "=",...
Decrypts context.io_manager's stdin and sends that to context.io_manager's stdout. See :py:mod:`swiftly.cli.decrypt` for context usage information. See :py:class:`CLIDecrypt` for more information.
[ "Decrypts", "context", ".", "io_manager", "s", "stdin", "and", "sends", "that", "to", "context", ".", "io_manager", "s", "stdout", "." ]
python
test
36.157895
robgolding/django-radius
radiusauth/backends/radius.py
https://github.com/robgolding/django-radius/blob/5b90f4ae4cbd680988197386d882491317e6b20c/radiusauth/backends/radius.py#L149-L164
def get_django_user(self, username, password=None): """ Get the Django user with the given username, or create one if it doesn't already exist. If `password` is given, then set the user's password to that (regardless of whether the user was created or not). """ try: ...
[ "def", "get_django_user", "(", "self", ",", "username", ",", "password", "=", "None", ")", ":", "try", ":", "user", "=", "User", ".", "objects", ".", "get", "(", "username", "=", "username", ")", "except", "User", ".", "DoesNotExist", ":", "user", "=",...
Get the Django user with the given username, or create one if it doesn't already exist. If `password` is given, then set the user's password to that (regardless of whether the user was created or not).
[ "Get", "the", "Django", "user", "with", "the", "given", "username", "or", "create", "one", "if", "it", "doesn", "t", "already", "exist", ".", "If", "password", "is", "given", "then", "set", "the", "user", "s", "password", "to", "that", "(", "regardless",...
python
train
34.375
Alveo/pyalveo
pyalveo/cache.py
https://github.com/Alveo/pyalveo/blob/1e9eec22bc031bc9a08066f9966565a546e6242e/pyalveo/cache.py#L329-L355
def add_document(self, doc_url, data): """ Add the given document to the cache, updating the existing content data if the document is already present :type doc_url: String or Document :param doc_url: the URL of the document, or a Document object :type data: String :param...
[ "def", "add_document", "(", "self", ",", "doc_url", ",", "data", ")", ":", "file_path", "=", "self", ".", "__generate_filepath", "(", ")", "with", "open", "(", "file_path", ",", "'wb'", ")", "as", "f", ":", "f", ".", "write", "(", "data", ")", "c", ...
Add the given document to the cache, updating the existing content data if the document is already present :type doc_url: String or Document :param doc_url: the URL of the document, or a Document object :type data: String :param data: the document's content data
[ "Add", "the", "given", "document", "to", "the", "cache", "updating", "the", "existing", "content", "data", "if", "the", "document", "is", "already", "present" ]
python
train
36.62963
OpenHydrology/floodestimation
floodestimation/analysis.py
https://github.com/OpenHydrology/floodestimation/blob/782da7c5abd1348923129efe89fb70003ebb088c/floodestimation/analysis.py#L661-L698
def growth_curve(self, method='best', **method_options): """ Return QMED estimate using best available methodology depending on what catchment attributes are available. ====================== ====================== ================================================================== `meth...
[ "def", "growth_curve", "(", "self", ",", "method", "=", "'best'", ",", "*", "*", "method_options", ")", ":", "if", "method", "==", "'best'", ":", "if", "self", ".", "catchment", ".", "amax_records", ":", "# Gauged catchment, use enhanced single site", "self", ...
Return QMED estimate using best available methodology depending on what catchment attributes are available. ====================== ====================== ================================================================== `method` `method_options` notes ======================...
[ "Return", "QMED", "estimate", "using", "best", "available", "methodology", "depending", "on", "what", "catchment", "attributes", "are", "available", "." ]
python
train
61.631579
tensorlayer/tensorlayer
tensorlayer/prepro.py
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/prepro.py#L2376-L2429
def obj_box_coords_rescale(coords=None, shape=None): """Scale down a list of coordinates from pixel unit to the ratio of image size i.e. in the range of [0, 1]. Parameters ------------ coords : list of list of 4 ints or None For coordinates of more than one images .e.g.[[x, y, w, h], [x, y, w, ...
[ "def", "obj_box_coords_rescale", "(", "coords", "=", "None", ",", "shape", "=", "None", ")", ":", "if", "coords", "is", "None", ":", "coords", "=", "[", "]", "if", "shape", "is", "None", ":", "shape", "=", "[", "100", ",", "200", "]", "imh", ",", ...
Scale down a list of coordinates from pixel unit to the ratio of image size i.e. in the range of [0, 1]. Parameters ------------ coords : list of list of 4 ints or None For coordinates of more than one images .e.g.[[x, y, w, h], [x, y, w, h], ...]. shape : list of 2 int or None 【height,...
[ "Scale", "down", "a", "list", "of", "coordinates", "from", "pixel", "unit", "to", "the", "ratio", "of", "image", "size", "i", ".", "e", ".", "in", "the", "range", "of", "[", "0", "1", "]", "." ]
python
valid
28.518519
onelogin/python-saml
src/onelogin/saml2/auth.py
https://github.com/onelogin/python-saml/blob/9fe7a72da5b4caa1529c1640b52d2649447ce49b/src/onelogin/saml2/auth.py#L444-L457
def build_request_signature(self, saml_request, relay_state, sign_algorithm=OneLogin_Saml2_Constants.RSA_SHA1): """ Builds the Signature of the SAML Request. :param saml_request: The SAML Request :type saml_request: string :param relay_state: The target URL the user should be r...
[ "def", "build_request_signature", "(", "self", ",", "saml_request", ",", "relay_state", ",", "sign_algorithm", "=", "OneLogin_Saml2_Constants", ".", "RSA_SHA1", ")", ":", "return", "self", ".", "__build_signature", "(", "saml_request", ",", "relay_state", ",", "'SAM...
Builds the Signature of the SAML Request. :param saml_request: The SAML Request :type saml_request: string :param relay_state: The target URL the user should be redirected to :type relay_state: string :param sign_algorithm: Signature algorithm method :type sign_algorit...
[ "Builds", "the", "Signature", "of", "the", "SAML", "Request", "." ]
python
train
39.785714
alerta/python-alerta-client
alertaclient/commands/cmd_keys.py
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_keys.py#L10-L23
def cli(obj): """List API keys.""" client = obj['client'] if obj['output'] == 'json': r = client.http.get('/keys') click.echo(json.dumps(r['keys'], sort_keys=True, indent=4, ensure_ascii=False)) else: timezone = obj['timezone'] headers = { 'id': 'ID', 'key': ...
[ "def", "cli", "(", "obj", ")", ":", "client", "=", "obj", "[", "'client'", "]", "if", "obj", "[", "'output'", "]", "==", "'json'", ":", "r", "=", "client", ".", "http", ".", "get", "(", "'/keys'", ")", "click", ".", "echo", "(", "json", ".", "d...
List API keys.
[ "List", "API", "keys", "." ]
python
train
43.285714
ucfopen/canvasapi
canvasapi/requester.py
https://github.com/ucfopen/canvasapi/blob/319064b5fc97ba54250af683eb98723ef3f76cf8/canvasapi/requester.py#L117-L125
def _get_request(self, url, headers, params=None): """ Issue a GET request to the specified endpoint with the data provided. :param url: str :pararm headers: dict :param params: dict """ return self._session.get(url, headers=headers, params=params)
[ "def", "_get_request", "(", "self", ",", "url", ",", "headers", ",", "params", "=", "None", ")", ":", "return", "self", ".", "_session", ".", "get", "(", "url", ",", "headers", "=", "headers", ",", "params", "=", "params", ")" ]
Issue a GET request to the specified endpoint with the data provided. :param url: str :pararm headers: dict :param params: dict
[ "Issue", "a", "GET", "request", "to", "the", "specified", "endpoint", "with", "the", "data", "provided", "." ]
python
train
33
saltstack/salt
salt/renderers/jinja.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/jinja.py#L45-L77
def render(template_file, saltenv='base', sls='', argline='', context=None, tmplpath=None, **kws): ''' Render the template_file, passing the functions and grains into the Jinja rendering system. :rtype: string ''' from_str = argline == '-s' if not from_str and argl...
[ "def", "render", "(", "template_file", ",", "saltenv", "=", "'base'", ",", "sls", "=", "''", ",", "argline", "=", "''", ",", "context", "=", "None", ",", "tmplpath", "=", "None", ",", "*", "*", "kws", ")", ":", "from_str", "=", "argline", "==", "'-...
Render the template_file, passing the functions and grains into the Jinja rendering system. :rtype: string
[ "Render", "the", "template_file", "passing", "the", "functions", "and", "grains", "into", "the", "Jinja", "rendering", "system", "." ]
python
train
43