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
google/tangent
tangent/cfg.py
https://github.com/google/tangent/blob/6533e83af09de7345d1b438512679992f080dcc9/tangent/cfg.py#L236-L244
def forward(node, analysis): """Perform a given analysis on all functions within an AST.""" if not isinstance(analysis, Forward): raise TypeError('not a valid forward analysis object') for succ in gast.walk(node): if isinstance(succ, gast.FunctionDef): cfg_obj = CFG.build_cfg(succ) analysis.vi...
[ "def", "forward", "(", "node", ",", "analysis", ")", ":", "if", "not", "isinstance", "(", "analysis", ",", "Forward", ")", ":", "raise", "TypeError", "(", "'not a valid forward analysis object'", ")", "for", "succ", "in", "gast", ".", "walk", "(", "node", ...
Perform a given analysis on all functions within an AST.
[ "Perform", "a", "given", "analysis", "on", "all", "functions", "within", "an", "AST", "." ]
python
train
38.222222
saltstack/salt
salt/cloud/clouds/xen.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L972-L981
def _get_sr(name=None, session=None): ''' Get XEN sr (storage repo) object reference ''' if session is None: session = _get_session() srs = session.xenapi.SR.get_by_name_label(name) if len(srs) == 1: return srs[0] return None
[ "def", "_get_sr", "(", "name", "=", "None", ",", "session", "=", "None", ")", ":", "if", "session", "is", "None", ":", "session", "=", "_get_session", "(", ")", "srs", "=", "session", ".", "xenapi", ".", "SR", ".", "get_by_name_label", "(", "name", "...
Get XEN sr (storage repo) object reference
[ "Get", "XEN", "sr", "(", "storage", "repo", ")", "object", "reference" ]
python
train
26
jim-easterbrook/pywws
src/pywws/weatherstation.py
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/weatherstation.py#L725-L729
def get_raw_fixed_block(self, unbuffered=False): """Get the raw "fixed block" of settings and min/max data.""" if unbuffered or not self._fixed_block: self._fixed_block = self._read_fixed_block() return self._fixed_block
[ "def", "get_raw_fixed_block", "(", "self", ",", "unbuffered", "=", "False", ")", ":", "if", "unbuffered", "or", "not", "self", ".", "_fixed_block", ":", "self", ".", "_fixed_block", "=", "self", ".", "_read_fixed_block", "(", ")", "return", "self", ".", "_...
Get the raw "fixed block" of settings and min/max data.
[ "Get", "the", "raw", "fixed", "block", "of", "settings", "and", "min", "/", "max", "data", "." ]
python
train
50.4
CalebBell/fluids
fluids/particle_size_distribution.py
https://github.com/CalebBell/fluids/blob/57f556752e039f1d3e5a822f408c184783db2828/fluids/particle_size_distribution.py#L1881-L1905
def fit(self, x0=None, distribution='lognormal', n=None, **kwargs): '''Incomplete method to fit experimental values to a curve. It is very hard to get good initial guesses, which are really required for this. Differential evolution is promissing. This API is likely to change in the futur...
[ "def", "fit", "(", "self", ",", "x0", "=", "None", ",", "distribution", "=", "'lognormal'", ",", "n", "=", "None", ",", "*", "*", "kwargs", ")", ":", "dist", "=", "{", "'lognormal'", ":", "PSDLognormal", ",", "'GGS'", ":", "PSDGatesGaudinSchuhman", ","...
Incomplete method to fit experimental values to a curve. It is very hard to get good initial guesses, which are really required for this. Differential evolution is promissing. This API is likely to change in the future.
[ "Incomplete", "method", "to", "fit", "experimental", "values", "to", "a", "curve", ".", "It", "is", "very", "hard", "to", "get", "good", "initial", "guesses", "which", "are", "really", "required", "for", "this", ".", "Differential", "evolution", "is", "promi...
python
train
45.2
sepandhaghighi/pycm
pycm/pycm_compare.py
https://github.com/sepandhaghighi/pycm/blob/cb03258afd6a821d10acba73c965aaac174bedcd/pycm/pycm_compare.py#L108-L132
def save_report( self, name, address=True): """ Save Compare report in .comp (flat file format). :param name: filename :type name : str :param address: flag for address return :type address : bool :return: saving Status as dict...
[ "def", "save_report", "(", "self", ",", "name", ",", "address", "=", "True", ")", ":", "try", ":", "message", "=", "None", "file", "=", "open", "(", "name", "+", "\".comp\"", ",", "\"w\"", ")", "report", "=", "compare_report_print", "(", "self", ".", ...
Save Compare report in .comp (flat file format). :param name: filename :type name : str :param address: flag for address return :type address : bool :return: saving Status as dict {"Status":bool , "Message":str}
[ "Save", "Compare", "report", "in", ".", "comp", "(", "flat", "file", "format", ")", "." ]
python
train
32.68
openstack/proliantutils
proliantutils/redfish/redfish.py
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/redfish.py#L962-L973
def unset_iscsi_info(self): """Disable iSCSI boot option in UEFI boot mode. :raises: IloCommandNotSupportedInBiosError, if the system is in the BIOS boot mode. """ if(self._is_boot_mode_uefi()): iscsi_info = {'iSCSIConnection': 'Disabled'} self._...
[ "def", "unset_iscsi_info", "(", "self", ")", ":", "if", "(", "self", ".", "_is_boot_mode_uefi", "(", ")", ")", ":", "iscsi_info", "=", "{", "'iSCSIConnection'", ":", "'Disabled'", "}", "self", ".", "_change_iscsi_target_settings", "(", "iscsi_info", ")", "else...
Disable iSCSI boot option in UEFI boot mode. :raises: IloCommandNotSupportedInBiosError, if the system is in the BIOS boot mode.
[ "Disable", "iSCSI", "boot", "option", "in", "UEFI", "boot", "mode", "." ]
python
train
41.666667
watson-developer-cloud/python-sdk
ibm_watson/discovery_v1.py
https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/discovery_v1.py#L8527-L8544
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'notice_id') and self.notice_id is not None: _dict['notice_id'] = self.notice_id if hasattr(self, 'created') and self.created is not None: _dict['created'] = da...
[ "def", "_to_dict", "(", "self", ")", ":", "_dict", "=", "{", "}", "if", "hasattr", "(", "self", ",", "'notice_id'", ")", "and", "self", ".", "notice_id", "is", "not", "None", ":", "_dict", "[", "'notice_id'", "]", "=", "self", ".", "notice_id", "if",...
Return a json dictionary representing this model.
[ "Return", "a", "json", "dictionary", "representing", "this", "model", "." ]
python
train
51.777778
Diviyan-Kalainathan/CausalDiscoveryToolbox
cdt/causality/pairwise/IGCI.py
https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/pairwise/IGCI.py#L96-L115
def predict_proba(self, a, b, **kwargs): """Evaluate a pair using the IGCI model. :param a: Input variable 1D :param b: Input variable 1D :param kwargs: {refMeasure: Scaling method (gaussian, integral or None), estimator: method used to evaluate the pairs (entrop...
[ "def", "predict_proba", "(", "self", ",", "a", ",", "b", ",", "*", "*", "kwargs", ")", ":", "estimators", "=", "{", "'entropy'", ":", "lambda", "x", ",", "y", ":", "eval_entropy", "(", "y", ")", "-", "eval_entropy", "(", "x", ")", ",", "'integral'"...
Evaluate a pair using the IGCI model. :param a: Input variable 1D :param b: Input variable 1D :param kwargs: {refMeasure: Scaling method (gaussian, integral or None), estimator: method used to evaluate the pairs (entropy or integral)} :return: Return value of the...
[ "Evaluate", "a", "pair", "using", "the", "IGCI", "model", "." ]
python
valid
48.45
Knoema/knoema-python-driver
knoema/api_client.py
https://github.com/Knoema/knoema-python-driver/blob/e98b13db3e4df51c208c272e2977bfbe4c6e5532/knoema/api_client.py#L181-L218
def upload(self, file_path, dataset=None, public=False): """Use this function to upload data to Knoema dataset.""" upload_status = self.upload_file(file_path) err_msg = 'Dataset has not been uploaded to the remote host' if not upload_status.successful: msg = '{}, becau...
[ "def", "upload", "(", "self", ",", "file_path", ",", "dataset", "=", "None", ",", "public", "=", "False", ")", ":", "upload_status", "=", "self", ".", "upload_file", "(", "file_path", ")", "err_msg", "=", "'Dataset has not been uploaded to the remote host'", "if...
Use this function to upload data to Knoema dataset.
[ "Use", "this", "function", "to", "upload", "data", "to", "Knoema", "dataset", "." ]
python
train
48
ChargePoint/pydnp3
examples/master_cmd.py
https://github.com/ChargePoint/pydnp3/blob/5bcd8240d1fc0aa1579e71f2efcab63b4c61c547/examples/master_cmd.py#L142-L144
def do_scan_all(self, line): """Call ScanAllObjects. Command syntax is: scan_all""" self.application.master.ScanAllObjects(opendnp3.GroupVariationID(2, 1), opendnp3.TaskConfig().Default())
[ "def", "do_scan_all", "(", "self", ",", "line", ")", ":", "self", ".", "application", ".", "master", ".", "ScanAllObjects", "(", "opendnp3", ".", "GroupVariationID", "(", "2", ",", "1", ")", ",", "opendnp3", ".", "TaskConfig", "(", ")", ".", "Default", ...
Call ScanAllObjects. Command syntax is: scan_all
[ "Call", "ScanAllObjects", ".", "Command", "syntax", "is", ":", "scan_all" ]
python
valid
67.333333
iwanbk/nyamuk
nyamuk/nyamuk.py
https://github.com/iwanbk/nyamuk/blob/ac4c6028de288a4c8e0b332ae16eae889deb643d/nyamuk/nyamuk.py#L302-L327
def handle_connack(self): """Handle incoming CONNACK command.""" self.logger.info("CONNACK reveived") ret, flags = self.in_packet.read_byte() if ret != NC.ERR_SUCCESS: self.logger.error("error read byte") return ret # useful for v3.1.1 only ...
[ "def", "handle_connack", "(", "self", ")", ":", "self", ".", "logger", ".", "info", "(", "\"CONNACK reveived\"", ")", "ret", ",", "flags", "=", "self", ".", "in_packet", ".", "read_byte", "(", ")", "if", "ret", "!=", "NC", ".", "ERR_SUCCESS", ":", "sel...
Handle incoming CONNACK command.
[ "Handle", "incoming", "CONNACK", "command", "." ]
python
train
30.769231
lambdamusic/Ontospy
ontospy/core/ontospy.py
https://github.com/lambdamusic/Ontospy/blob/eb46cb13792b2b87f21babdf976996318eec7571/ontospy/core/ontospy.py#L804-L839
def get_skos(self, id=None, uri=None, match=None): """ get the saved skos concept with given ID or via other methods... Note: it tries to guess what is being passed as above """ if not id and not uri and not match: return None if type(id) == type("string"):...
[ "def", "get_skos", "(", "self", ",", "id", "=", "None", ",", "uri", "=", "None", ",", "match", "=", "None", ")", ":", "if", "not", "id", "and", "not", "uri", "and", "not", "match", ":", "return", "None", "if", "type", "(", "id", ")", "==", "typ...
get the saved skos concept with given ID or via other methods... Note: it tries to guess what is being passed as above
[ "get", "the", "saved", "skos", "concept", "with", "given", "ID", "or", "via", "other", "methods", "..." ]
python
train
31.166667
ampl/amplpy
amplpy/variable.py
https://github.com/ampl/amplpy/blob/39df6954049a11a8f666aed26853259b4687099a/amplpy/variable.py#L38-L50
def fix(self, value=None): """ Fix all instances of this variable to a value if provided or to their current value otherwise. Args: value: value to be set. """ if value is None: self._impl.fix() else: self._impl.fix(value)
[ "def", "fix", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "None", ":", "self", ".", "_impl", ".", "fix", "(", ")", "else", ":", "self", ".", "_impl", ".", "fix", "(", "value", ")" ]
Fix all instances of this variable to a value if provided or to their current value otherwise. Args: value: value to be set.
[ "Fix", "all", "instances", "of", "this", "variable", "to", "a", "value", "if", "provided", "or", "to", "their", "current", "value", "otherwise", "." ]
python
train
23.384615
seperman/deepdiff
deepdiff/diff.py
https://github.com/seperman/deepdiff/blob/a66879190fadc671632f154c1fcb82f5c3cef800/deepdiff/diff.py#L247-L320
def __diff_dict(self, level, parents_ids=frozenset({}), print_as_attribute=False, override=False, override_t1=None, override_t2=None): """Difference of 2 dictionaries""" if override: ...
[ "def", "__diff_dict", "(", "self", ",", "level", ",", "parents_ids", "=", "frozenset", "(", "{", "}", ")", ",", "print_as_attribute", "=", "False", ",", "override", "=", "False", ",", "override_t1", "=", "None", ",", "override_t2", "=", "None", ")", ":",...
Difference of 2 dictionaries
[ "Difference", "of", "2", "dictionaries" ]
python
train
40.175676
Becksteinlab/GromacsWrapper
gromacs/utilities.py
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L526-L543
def _init_filename(self, filename=None, ext=None): """Initialize the current filename :attr:`FileUtils.real_filename` of the object. Bit of a hack. - The first invocation must have ``filename != None``; this will set a default filename with suffix :attr:`FileUtils.default_extension` ...
[ "def", "_init_filename", "(", "self", ",", "filename", "=", "None", ",", "ext", "=", "None", ")", ":", "extension", "=", "ext", "or", "self", ".", "default_extension", "filename", "=", "self", ".", "filename", "(", "filename", ",", "ext", "=", "extension...
Initialize the current filename :attr:`FileUtils.real_filename` of the object. Bit of a hack. - The first invocation must have ``filename != None``; this will set a default filename with suffix :attr:`FileUtils.default_extension` unless another one was supplied. - Subseque...
[ "Initialize", "the", "current", "filename", ":", "attr", ":", "FileUtils", ".", "real_filename", "of", "the", "object", "." ]
python
valid
43.333333
gouthambs/Flask-Blogging
flask_blogging/sqlastorage.py
https://github.com/gouthambs/Flask-Blogging/blob/6636b8941175e9910f116a329521f96b8b05a9ac/flask_blogging/sqlastorage.py#L609-L636
def _create_user_posts_table(self): """ Creates the table to store association info between user and blog posts. :return: """ with self._engine.begin() as conn: user_posts_table_name = self._table_name("user_posts") if not conn.dialect.has_table(co...
[ "def", "_create_user_posts_table", "(", "self", ")", ":", "with", "self", ".", "_engine", ".", "begin", "(", ")", "as", "conn", ":", "user_posts_table_name", "=", "self", ".", "_table_name", "(", "\"user_posts\"", ")", "if", "not", "conn", ".", "dialect", ...
Creates the table to store association info between user and blog posts. :return:
[ "Creates", "the", "table", "to", "store", "association", "info", "between", "user", "and", "blog", "posts", ".", ":", "return", ":" ]
python
train
49.785714
peercoin/peercoin_rpc
peercoin_rpc/peercoin_rpc.py
https://github.com/peercoin/peercoin_rpc/blob/6edd854c7fd607ad9f6f4d5eb8b8b7c7fd8c16cc/peercoin_rpc/peercoin_rpc.py#L251-L263
def signrawtransaction(self, rawtxhash, parent_tx_outputs=None, private_key=None): """signrawtransaction returns status and rawtxhash : rawtxhash - serialized transaction (hex) : parent_tx_outputs - outputs being spent by this transaction : private_key - a private key to sign this transa...
[ "def", "signrawtransaction", "(", "self", ",", "rawtxhash", ",", "parent_tx_outputs", "=", "None", ",", "private_key", "=", "None", ")", ":", "if", "not", "parent_tx_outputs", "and", "not", "private_key", ":", "return", "self", ".", "req", "(", "\"signrawtrans...
signrawtransaction returns status and rawtxhash : rawtxhash - serialized transaction (hex) : parent_tx_outputs - outputs being spent by this transaction : private_key - a private key to sign this transaction with
[ "signrawtransaction", "returns", "status", "and", "rawtxhash", ":", "rawtxhash", "-", "serialized", "transaction", "(", "hex", ")", ":", "parent_tx_outputs", "-", "outputs", "being", "spent", "by", "this", "transaction", ":", "private_key", "-", "a", "private", ...
python
train
45.153846
MycroftAI/adapt
adapt/context.py
https://github.com/MycroftAI/adapt/blob/334f23248b8e09fb9d84a88398424ec5bd3bae4c/adapt/context.py#L48-L71
def metadata_matches(self, query={}): """ Returns key matches to metadata This will check every key in query for a matching key in metadata returning true if every key is in metadata. query without keys return false. Args: query(object): metadata for matchi...
[ "def", "metadata_matches", "(", "self", ",", "query", "=", "{", "}", ")", ":", "result", "=", "len", "(", "query", ".", "keys", "(", ")", ")", ">", "0", "for", "key", "in", "query", ".", "keys", "(", ")", ":", "result", "=", "result", "and", "q...
Returns key matches to metadata This will check every key in query for a matching key in metadata returning true if every key is in metadata. query without keys return false. Args: query(object): metadata for matching Returns: bool: Tru...
[ "Returns", "key", "matches", "to", "metadata" ]
python
train
31
ajbosco/dag-factory
dagfactory/dagbuilder.py
https://github.com/ajbosco/dag-factory/blob/cc7cfe74e62f82859fe38d527e95311a2805723b/dagfactory/dagbuilder.py#L24-L43
def get_dag_params(self) -> Dict[str, Any]: """ Merges default config with dag config, sets dag_id, and extropolates dag_start_date :returns: dict of dag parameters """ try: dag_params: Dict[str, Any] = utils.merge_configs(self.dag_config, self.default_config) ...
[ "def", "get_dag_params", "(", "self", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "try", ":", "dag_params", ":", "Dict", "[", "str", ",", "Any", "]", "=", "utils", ".", "merge_configs", "(", "self", ".", "dag_config", ",", "self", ".", "de...
Merges default config with dag config, sets dag_id, and extropolates dag_start_date :returns: dict of dag parameters
[ "Merges", "default", "config", "with", "dag", "config", "sets", "dag_id", "and", "extropolates", "dag_start_date" ]
python
train
49.1
spyder-ide/spyder
spyder/plugins/explorer/widgets.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L604-L636
def delete_file(self, fname, multiple, yes_to_all): """Delete file""" if multiple: buttons = QMessageBox.Yes|QMessageBox.YesToAll| \ QMessageBox.No|QMessageBox.Cancel else: buttons = QMessageBox.Yes|QMessageBox.No if yes_to_all is None...
[ "def", "delete_file", "(", "self", ",", "fname", ",", "multiple", ",", "yes_to_all", ")", ":", "if", "multiple", ":", "buttons", "=", "QMessageBox", ".", "Yes", "|", "QMessageBox", ".", "YesToAll", "|", "QMessageBox", ".", "No", "|", "QMessageBox", ".", ...
Delete file
[ "Delete", "file" ]
python
train
43.181818
chop-dbhi/varify-data-warehouse
vdw/raw/utils/stream.py
https://github.com/chop-dbhi/varify-data-warehouse/blob/1600ee1bc5fae6c68fd03b23624467298570cca8/vdw/raw/utils/stream.py#L99-L117
def process_line(self, record): "Process a single record. This assumes only a single sample output." cleaned = [] for key in self.vcf_fields: out = self.process_column(key, getattr(record, key)) if isinstance(out, (list, tuple)): cleaned.extend(out) ...
[ "def", "process_line", "(", "self", ",", "record", ")", ":", "cleaned", "=", "[", "]", "for", "key", "in", "self", ".", "vcf_fields", ":", "out", "=", "self", ".", "process_column", "(", "key", ",", "getattr", "(", "record", ",", "key", ")", ")", "...
Process a single record. This assumes only a single sample output.
[ "Process", "a", "single", "record", ".", "This", "assumes", "only", "a", "single", "sample", "output", "." ]
python
train
32.631579
Opentrons/opentrons
api/src/opentrons/system/nmcli.py
https://github.com/Opentrons/opentrons/blob/a7c15cc2636ecb64ab56c7edc1d8a57163aaeadf/api/src/opentrons/system/nmcli.py#L262-L284
async def available_ssids() -> List[Dict[str, Any]]: """ List the visible (broadcasting SSID) wireless networks. Returns a list of the SSIDs. They may contain spaces and should be escaped if later passed to a shell. """ fields = ['ssid', 'signal', 'active', 'security'] cmd = ['--terse', ...
[ "async", "def", "available_ssids", "(", ")", "->", "List", "[", "Dict", "[", "str", ",", "Any", "]", "]", ":", "fields", "=", "[", "'ssid'", ",", "'signal'", ",", "'active'", ",", "'security'", "]", "cmd", "=", "[", "'--terse'", ",", "'--fields'", ",...
List the visible (broadcasting SSID) wireless networks. Returns a list of the SSIDs. They may contain spaces and should be escaped if later passed to a shell.
[ "List", "the", "visible", "(", "broadcasting", "SSID", ")", "wireless", "networks", "." ]
python
train
35.521739
KE-works/pykechain
pykechain/models/team.py
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/team.py#L136-L138
def scopes(self, **kwargs): """Scopes associated to the team.""" return self._client.scopes(team=self.id, **kwargs)
[ "def", "scopes", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_client", ".", "scopes", "(", "team", "=", "self", ".", "id", ",", "*", "*", "kwargs", ")" ]
Scopes associated to the team.
[ "Scopes", "associated", "to", "the", "team", "." ]
python
train
43
aliyun/aliyun-odps-python-sdk
odps/df/expr/expressions.py
https://github.com/aliyun/aliyun-odps-python-sdk/blob/4b0de18f5864386df6068f26f026e62f932c41e4/odps/df/expr/expressions.py#L1050-L1060
def head(self, n=None, **kwargs): """ Return the first n rows. Execute at once. :param n: :return: result frame :rtype: :class:`odps.df.backends.frame.ResultFrame` """ if n is None: n = options.display.max_rows return self._handle_delay_call('...
[ "def", "head", "(", "self", ",", "n", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "n", "is", "None", ":", "n", "=", "options", ".", "display", ".", "max_rows", "return", "self", ".", "_handle_delay_call", "(", "'execute'", ",", "self", ",...
Return the first n rows. Execute at once. :param n: :return: result frame :rtype: :class:`odps.df.backends.frame.ResultFrame`
[ "Return", "the", "first", "n", "rows", ".", "Execute", "at", "once", "." ]
python
train
31.181818
wkentaro/pytorch-fcn
torchfcn/utils.py
https://github.com/wkentaro/pytorch-fcn/blob/97189cbccb2c9b8bd776b356a1fd4b6c03f67d79/torchfcn/utils.py#L12-L34
def label_accuracy_score(label_trues, label_preds, n_class): """Returns accuracy score evaluation result. - overall accuracy - mean accuracy - mean IU - fwavacc """ hist = np.zeros((n_class, n_class)) for lt, lp in zip(label_trues, label_preds): hist += _fast_hist(lt.fla...
[ "def", "label_accuracy_score", "(", "label_trues", ",", "label_preds", ",", "n_class", ")", ":", "hist", "=", "np", ".", "zeros", "(", "(", "n_class", ",", "n_class", ")", ")", "for", "lt", ",", "lp", "in", "zip", "(", "label_trues", ",", "label_preds", ...
Returns accuracy score evaluation result. - overall accuracy - mean accuracy - mean IU - fwavacc
[ "Returns", "accuracy", "score", "evaluation", "result", "." ]
python
train
36.478261
AtteqCom/zsl
src/zsl/resource/json_server_resource.py
https://github.com/AtteqCom/zsl/blob/ab51a96da1780ff642912396d4b85bdcb72560c1/src/zsl/resource/json_server_resource.py#L95-L120
def _create_filter_by(self): """Transform the json-server filter arguments to model-resource ones.""" filter_by = [] for name, values in request.args.copy().lists(): # copy.lists works in py2 and py3 if name not in _SKIPPED_ARGUMENTS: column = _re_column_name.search...
[ "def", "_create_filter_by", "(", "self", ")", ":", "filter_by", "=", "[", "]", "for", "name", ",", "values", "in", "request", ".", "args", ".", "copy", "(", ")", ".", "lists", "(", ")", ":", "# copy.lists works in py2 and py3", "if", "name", "not", "in",...
Transform the json-server filter arguments to model-resource ones.
[ "Transform", "the", "json", "-", "server", "filter", "arguments", "to", "model", "-", "resource", "ones", "." ]
python
train
42.230769
futapi/fut
fut/core.py
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L994-L1072
def search(self, ctype, level=None, category=None, assetId=None, defId=None, min_price=None, max_price=None, min_buy=None, max_buy=None, league=None, club=None, position=None, zone=None, nationality=None, rare=False, playStyle=None, start=0, page_size=itemsPerPage['transferM...
[ "def", "search", "(", "self", ",", "ctype", ",", "level", "=", "None", ",", "category", "=", "None", ",", "assetId", "=", "None", ",", "defId", "=", "None", ",", "min_price", "=", "None", ",", "max_price", "=", "None", ",", "min_buy", "=", "None", ...
Prepare search request, send and return parsed data as a dict. :param ctype: [development / ? / ?] Card type. :param level: (optional) [?/?/gold] Card level. :param category: (optional) [fitness/?/?] Card category. :param assetId: (optional) Asset id. :param defId: (optional) De...
[ "Prepare", "search", "request", "send", "and", "return", "parsed", "data", "as", "a", "dict", "." ]
python
valid
38.911392
SheffieldML/GPy
GPy/kern/src/sde_stationary.py
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/sde_stationary.py#L191-L220
def sde(self): """ Return the state space representation of the covariance. """ variance = float(self.variance.values) lengthscale = float(self.lengthscale) F = np.array(((-1.0/lengthscale,),)) L = np.array(((1.0,),)) Qc = np.array( ((2.0*variance/lengt...
[ "def", "sde", "(", "self", ")", ":", "variance", "=", "float", "(", "self", ".", "variance", ".", "values", ")", "lengthscale", "=", "float", "(", "self", ".", "lengthscale", ")", "F", "=", "np", ".", "array", "(", "(", "(", "-", "1.0", "/", "len...
Return the state space representation of the covariance.
[ "Return", "the", "state", "space", "representation", "of", "the", "covariance", "." ]
python
train
26.566667
assamite/creamas
creamas/vote.py
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/vote.py#L265-L272
def get_managers(self): """Get managers for the slave environments. """ if self._single_env: return None if not hasattr(self, '_managers'): self._managers = self.env.get_slave_managers() return self._managers
[ "def", "get_managers", "(", "self", ")", ":", "if", "self", ".", "_single_env", ":", "return", "None", "if", "not", "hasattr", "(", "self", ",", "'_managers'", ")", ":", "self", ".", "_managers", "=", "self", ".", "env", ".", "get_slave_managers", "(", ...
Get managers for the slave environments.
[ "Get", "managers", "for", "the", "slave", "environments", "." ]
python
train
33.125
Scifabric/pbs
helpers.py
https://github.com/Scifabric/pbs/blob/3e5d5f3f0f5d20f740eaacc4d6e872a0c9fb8b38/helpers.py#L233-L277
def _add_helpingmaterials(config, helping_file, helping_type): """Add helping materials to a project.""" try: project = find_project_by_short_name(config.project['short_name'], config.pbclient, config.all) ...
[ "def", "_add_helpingmaterials", "(", "config", ",", "helping_file", ",", "helping_type", ")", ":", "try", ":", "project", "=", "find_project_by_short_name", "(", "config", ".", "project", "[", "'short_name'", "]", ",", "config", ".", "pbclient", ",", "config", ...
Add helping materials to a project.
[ "Add", "helping", "materials", "to", "a", "project", "." ]
python
train
52.422222
dfm/ugly
ugly/models.py
https://github.com/dfm/ugly/blob/bc09834849184552619ee926d7563ed37630accb/ugly/models.py#L53-L62
def decrypt_email(enc_email): """ The inverse of :func:`encrypt_email`. :param enc_email: The encrypted email address. """ aes = SimpleAES(flask.current_app.config["AES_KEY"]) return aes.decrypt(enc_email)
[ "def", "decrypt_email", "(", "enc_email", ")", ":", "aes", "=", "SimpleAES", "(", "flask", ".", "current_app", ".", "config", "[", "\"AES_KEY\"", "]", ")", "return", "aes", ".", "decrypt", "(", "enc_email", ")" ]
The inverse of :func:`encrypt_email`. :param enc_email: The encrypted email address.
[ "The", "inverse", "of", ":", "func", ":", "encrypt_email", "." ]
python
train
23
gem/oq-engine
openquake/calculators/views.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/calculators/views.py#L605-L628
def view_task_hazard(token, dstore): """ Display info about a given task. Here are a few examples of usage:: $ oq show task_hazard:0 # the fastest task $ oq show task_hazard:-1 # the slowest task """ tasks = set(dstore['task_info']) if 'source_data' not in dstore: return 'Missin...
[ "def", "view_task_hazard", "(", "token", ",", "dstore", ")", ":", "tasks", "=", "set", "(", "dstore", "[", "'task_info'", "]", ")", "if", "'source_data'", "not", "in", "dstore", ":", "return", "'Missing source_data'", "if", "'classical_split_filter'", "in", "t...
Display info about a given task. Here are a few examples of usage:: $ oq show task_hazard:0 # the fastest task $ oq show task_hazard:-1 # the slowest task
[ "Display", "info", "about", "a", "given", "task", ".", "Here", "are", "a", "few", "examples", "of", "usage", "::" ]
python
train
44.083333
neherlab/treetime
treetime/treeanc.py
https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/treeanc.py#L1835-L1855
def optimal_marginal_branch_length(self, node, tol=1e-10): ''' calculate the marginal distribution of sequence states on both ends of the branch leading to node, Parameters ---------- node : PhyloTree.Clade TreeNode, attached to the branch. Returns ...
[ "def", "optimal_marginal_branch_length", "(", "self", ",", "node", ",", "tol", "=", "1e-10", ")", ":", "if", "node", ".", "up", "is", "None", ":", "return", "self", ".", "one_mutation", "pp", ",", "pc", "=", "self", ".", "marginal_branch_profile", "(", "...
calculate the marginal distribution of sequence states on both ends of the branch leading to node, Parameters ---------- node : PhyloTree.Clade TreeNode, attached to the branch. Returns ------- branch_length : float branch length of the bra...
[ "calculate", "the", "marginal", "distribution", "of", "sequence", "states", "on", "both", "ends", "of", "the", "branch", "leading", "to", "node" ]
python
test
32.47619
HPENetworking/PYHPEIMC
archived/pyhpimc.py
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/archived/pyhpimc.py#L741-L760
def get_trap_definitions(): """Takes in no param as input to fetch SNMP TRAP definitions from HP IMC RESTFUL API :param None :return: object of type list containing the device asset details """ # checks to see if the imc credentials are already available if auth is None or url is None: s...
[ "def", "get_trap_definitions", "(", ")", ":", "# checks to see if the imc credentials are already available", "if", "auth", "is", "None", "or", "url", "is", "None", ":", "set_imc_creds", "(", ")", "global", "r", "get_trap_def_url", "=", "\"/imcrs/fault/trapDefine/sync/que...
Takes in no param as input to fetch SNMP TRAP definitions from HP IMC RESTFUL API :param None :return: object of type list containing the device asset details
[ "Takes", "in", "no", "param", "as", "input", "to", "fetch", "SNMP", "TRAP", "definitions", "from", "HP", "IMC", "RESTFUL", "API", ":", "param", "None", ":", "return", ":", "object", "of", "type", "list", "containing", "the", "device", "asset", "details" ]
python
train
40.55
dogoncouch/lightcli
lightcli.py
https://github.com/dogoncouch/lightcli/blob/e63093dfc4f983ec9c9571ff186bf114c1f782c3/lightcli.py#L83-L117
def long_input(prompt='Multi-line input\n' + \ 'Enter EOF on a blank line to end ' + \ '(ctrl-D in *nix, ctrl-Z in windows)', maxlines = None, maxlength = None): """Get a multi-line string as input""" lines = [] print(prompt) lnum = 1 try: while True: ...
[ "def", "long_input", "(", "prompt", "=", "'Multi-line input\\n'", "+", "'Enter EOF on a blank line to end '", "+", "'(ctrl-D in *nix, ctrl-Z in windows)'", ",", "maxlines", "=", "None", ",", "maxlength", "=", "None", ")", ":", "lines", "=", "[", "]", "print", "(", ...
Get a multi-line string as input
[ "Get", "a", "multi", "-", "line", "string", "as", "input" ]
python
test
26.171429
neighbordog/deviantart
deviantart/api.py
https://github.com/neighbordog/deviantart/blob/5612f1d5e2139a48c9d793d7fd19cde7e162d7b1/deviantart/api.py#L1644-L1658
def delete_notes(self, noteids): """Delete a note or notes :param noteids: The noteids to delete """ if self.standard_grant_type is not "authorization_code": raise DeviantartError("Authentication through Authorization Code (Grant Type) is required in order to connect to th...
[ "def", "delete_notes", "(", "self", ",", "noteids", ")", ":", "if", "self", ".", "standard_grant_type", "is", "not", "\"authorization_code\"", ":", "raise", "DeviantartError", "(", "\"Authentication through Authorization Code (Grant Type) is required in order to connect to this...
Delete a note or notes :param noteids: The noteids to delete
[ "Delete", "a", "note", "or", "notes" ]
python
train
29.933333
disqus/overseer
overseer/views.py
https://github.com/disqus/overseer/blob/b37573aba33b20aa86f89eb0c7e6f4d9905bedef/overseer/views.py#L192-L213
def verify_subscription(request, ident): """ Verifies an unverified subscription and create or appends to an existing subscription. """ try: unverified = UnverifiedSubscription.objects.get(ident=ident) except UnverifiedSubscription.DoesNotExist: return respond('overseer/inva...
[ "def", "verify_subscription", "(", "request", ",", "ident", ")", ":", "try", ":", "unverified", "=", "UnverifiedSubscription", ".", "objects", ".", "get", "(", "ident", "=", "ident", ")", "except", "UnverifiedSubscription", ".", "DoesNotExist", ":", "return", ...
Verifies an unverified subscription and create or appends to an existing subscription.
[ "Verifies", "an", "unverified", "subscription", "and", "create", "or", "appends", "to", "an", "existing", "subscription", "." ]
python
train
31.090909
saltstack/salt
salt/netapi/rest_cherrypy/app.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L1045-L1074
def hypermedia_in(): ''' Unserialize POST/PUT data of a specified Content-Type. The following custom processors all are intended to format Low State data and will place that data structure into the request object. :raises HTTPError: if the request contains a Content-Type that we do not hav...
[ "def", "hypermedia_in", "(", ")", ":", "# Be liberal in what you accept", "ct_in_map", "=", "{", "'application/x-www-form-urlencoded'", ":", "urlencoded_processor", ",", "'application/json'", ":", "json_processor", ",", "'application/x-yaml'", ":", "yaml_processor", ",", "'...
Unserialize POST/PUT data of a specified Content-Type. The following custom processors all are intended to format Low State data and will place that data structure into the request object. :raises HTTPError: if the request contains a Content-Type that we do not have a processor for
[ "Unserialize", "POST", "/", "PUT", "data", "of", "a", "specified", "Content", "-", "Type", "." ]
python
train
38.833333
althonos/InstaLooter
instalooter/cli/time.py
https://github.com/althonos/InstaLooter/blob/e894d8da368dd57423dd0fda4ac479ea2ea0c3c1/instalooter/cli/time.py#L10-L26
def date_from_isoformat(isoformat_date): """Convert an ISO-8601 date into a `datetime.date` object. Argument: isoformat_date (str): a date in ISO-8601 format (YYYY-MM-DD) Returns: ~datetime.date: the object corresponding to the given ISO date. Raises: ValueError: when the date...
[ "def", "date_from_isoformat", "(", "isoformat_date", ")", ":", "year", ",", "month", ",", "day", "=", "isoformat_date", ".", "split", "(", "'-'", ")", "return", "datetime", ".", "date", "(", "int", "(", "year", ")", ",", "int", "(", "month", ")", ",", ...
Convert an ISO-8601 date into a `datetime.date` object. Argument: isoformat_date (str): a date in ISO-8601 format (YYYY-MM-DD) Returns: ~datetime.date: the object corresponding to the given ISO date. Raises: ValueError: when the date could not be converted successfully. See A...
[ "Convert", "an", "ISO", "-", "8601", "date", "into", "a", "datetime", ".", "date", "object", "." ]
python
train
32.176471
inveniosoftware/invenio-stats
invenio_stats/utils.py
https://github.com/inveniosoftware/invenio-stats/blob/d877ae5462084abb4a28a20f1ebb3d636769c1bc/invenio_stats/utils.py#L42-L64
def get_user(): """User information. .. note:: **Privacy note** A users IP address, user agent string, and user id (if logged in) is sent to a message queue, where it is stored for about 5 minutes. The information is used to: - Detect robot visits from the user agent string. ...
[ "def", "get_user", "(", ")", ":", "return", "dict", "(", "ip_address", "=", "request", ".", "remote_addr", ",", "user_agent", "=", "request", ".", "user_agent", ".", "string", ",", "user_id", "=", "(", "current_user", ".", "get_id", "(", ")", "if", "curr...
User information. .. note:: **Privacy note** A users IP address, user agent string, and user id (if logged in) is sent to a message queue, where it is stored for about 5 minutes. The information is used to: - Detect robot visits from the user agent string. - Generate an anonymi...
[ "User", "information", "." ]
python
valid
31.956522
arviz-devs/arviz
arviz/data/base.py
https://github.com/arviz-devs/arviz/blob/d04d8da07f029fd2931f48d2f7f324cf393e5277/arviz/data/base.py#L146-L180
def dict_to_dataset(data, *, attrs=None, library=None, coords=None, dims=None): """Convert a dictionary of numpy arrays to an xarray.Dataset. Parameters ---------- data : dict[str] -> ndarray Data to convert. Keys are variable names. attrs : dict Json serializable metadata to attach...
[ "def", "dict_to_dataset", "(", "data", ",", "*", ",", "attrs", "=", "None", ",", "library", "=", "None", ",", "coords", "=", "None", ",", "dims", "=", "None", ")", ":", "if", "dims", "is", "None", ":", "dims", "=", "{", "}", "data_vars", "=", "{"...
Convert a dictionary of numpy arrays to an xarray.Dataset. Parameters ---------- data : dict[str] -> ndarray Data to convert. Keys are variable names. attrs : dict Json serializable metadata to attach to the dataset, in addition to defaults. library : module Library used for...
[ "Convert", "a", "dictionary", "of", "numpy", "arrays", "to", "an", "xarray", ".", "Dataset", "." ]
python
train
31.828571
raamana/mrivis
mrivis/base.py
https://github.com/raamana/mrivis/blob/199ad096b8a1d825f69109e7218a81b2f1cec756/mrivis/base.py#L647-L710
def transform_and_attach(self, image_list, func, show=True): """ Displays the transformed (combined) version of the cross-sections from each image, (same slice and dimension). So if you input n>=1 images, ...
[ "def", "transform_and_attach", "(", "self", ",", "image_list", ",", "func", ",", "show", "=", "True", ")", ":", "if", "not", "callable", "(", "func", ")", ":", "raise", "TypeError", "(", "'func must be callable!'", ")", "if", "not", "isinstance", "(", "ima...
Displays the transformed (combined) version of the cross-sections from each image, (same slice and dimension). So if you input n>=1 images, n slices are obtained from each image, which are passed to the func (callable) provided, and the result will be displayed in the corresponding c...
[ "Displays", "the", "transformed", "(", "combined", ")", "version", "of", "the", "cross", "-", "sections", "from", "each", "image", "(", "same", "slice", "and", "dimension", ")", ".", "So", "if", "you", "input", "n", ">", "=", "1", "images", "n", "slice...
python
train
41.71875
saltstack/salt
salt/modules/keystoneng.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L164-L180
def group_update(auth=None, **kwargs): ''' Update a group CLI Example: .. code-block:: bash salt '*' keystoneng.group_update name=group1 description='new description' salt '*' keystoneng.group_create name=group2 domain_id=b62e76fbeeff4e8fb77073f591cf211e new_name=newgroupname ...
[ "def", "group_update", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "if", "'new_name'", "in", "kwargs", ":", "kwargs", "...
Update a group CLI Example: .. code-block:: bash salt '*' keystoneng.group_update name=group1 description='new description' salt '*' keystoneng.group_create name=group2 domain_id=b62e76fbeeff4e8fb77073f591cf211e new_name=newgroupname salt '*' keystoneng.group_create name=0e4febc2a5ab4...
[ "Update", "a", "group" ]
python
train
35
jnrbsn/daemonocle
daemonocle/core.py
https://github.com/jnrbsn/daemonocle/blob/a1e09bc99608eab8dfe024c6741b7ecb7143f717/daemonocle/core.py#L569-L586
def list_actions(cls): """Get a list of exposed actions that are callable via the ``do_action()`` method.""" # Make sure these are always at the beginning of the list actions = ['start', 'stop', 'restart', 'status'] # Iterate over the instance attributes checking for actions that...
[ "def", "list_actions", "(", "cls", ")", ":", "# Make sure these are always at the beginning of the list", "actions", "=", "[", "'start'", ",", "'stop'", ",", "'restart'", ",", "'status'", "]", "# Iterate over the instance attributes checking for actions that", "# have been expo...
Get a list of exposed actions that are callable via the ``do_action()`` method.
[ "Get", "a", "list", "of", "exposed", "actions", "that", "are", "callable", "via", "the", "do_action", "()", "method", "." ]
python
train
41.888889
numenta/nupic
src/nupic/algorithms/spatial_pooler.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/spatial_pooler.py#L954-L962
def _updateMinDutyCycles(self): """ Updates the minimum duty cycles defining normal activity for a column. A column with activity duty cycle below this minimum threshold is boosted. """ if self._globalInhibition or self._inhibitionRadius > self._numInputs: self._updateMinDutyCyclesGlobal() ...
[ "def", "_updateMinDutyCycles", "(", "self", ")", ":", "if", "self", ".", "_globalInhibition", "or", "self", ".", "_inhibitionRadius", ">", "self", ".", "_numInputs", ":", "self", ".", "_updateMinDutyCyclesGlobal", "(", ")", "else", ":", "self", ".", "_updateMi...
Updates the minimum duty cycles defining normal activity for a column. A column with activity duty cycle below this minimum threshold is boosted.
[ "Updates", "the", "minimum", "duty", "cycles", "defining", "normal", "activity", "for", "a", "column", ".", "A", "column", "with", "activity", "duty", "cycle", "below", "this", "minimum", "threshold", "is", "boosted", "." ]
python
valid
39.666667
pantsbuild/pants
src/python/pants/backend/jvm/tasks/coursier_resolve.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/backend/jvm/tasks/coursier_resolve.py#L104-L185
def resolve(self, targets, compile_classpath, sources, javadoc, executor): """ This is the core function for coursier resolve. Validation strategy: 1. All targets are going through the `invalidated` to get fingerprinted in the target level. No cache is fetched at this stage because it is disabl...
[ "def", "resolve", "(", "self", ",", "targets", ",", "compile_classpath", ",", "sources", ",", "javadoc", ",", "executor", ")", ":", "manager", "=", "JarDependencyManagement", ".", "global_instance", "(", ")", "jar_targets", "=", "manager", ".", "targets_by_artif...
This is the core function for coursier resolve. Validation strategy: 1. All targets are going through the `invalidated` to get fingerprinted in the target level. No cache is fetched at this stage because it is disabled. 2. Once each target is fingerprinted, we combine them into a `VersionedTargetSe...
[ "This", "is", "the", "core", "function", "for", "coursier", "resolve", "." ]
python
train
51.085366
apache/incubator-heron
heron/tools/common/src/python/utils/classpath.py
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/classpath.py#L27-L48
def valid_path(path): ''' Check if an entry in the class path exists as either a directory or a file ''' # check if the suffic of classpath suffix exists as directory if path.endswith('*'): Log.debug('Checking classpath entry suffix as directory: %s', path[:-1]) if os.path.isdir(path[:-1]): retu...
[ "def", "valid_path", "(", "path", ")", ":", "# check if the suffic of classpath suffix exists as directory", "if", "path", ".", "endswith", "(", "'*'", ")", ":", "Log", ".", "debug", "(", "'Checking classpath entry suffix as directory: %s'", ",", "path", "[", ":", "-"...
Check if an entry in the class path exists as either a directory or a file
[ "Check", "if", "an", "entry", "in", "the", "class", "path", "exists", "as", "either", "a", "directory", "or", "a", "file" ]
python
valid
29.681818
aio-libs/aiomysql
aiomysql/cursors.py
https://github.com/aio-libs/aiomysql/blob/131fb9f914739ff01a24b402d29bfd719f2d1a8b/aiomysql/cursors.py#L626-L633
async def fetchone(self): """ Fetch next row """ self._check_executed() row = await self._read_next() if row is None: return self._rownumber += 1 return row
[ "async", "def", "fetchone", "(", "self", ")", ":", "self", ".", "_check_executed", "(", ")", "row", "=", "await", "self", ".", "_read_next", "(", ")", "if", "row", "is", "None", ":", "return", "self", ".", "_rownumber", "+=", "1", "return", "row" ]
Fetch next row
[ "Fetch", "next", "row" ]
python
train
26.125
bio2bel/bio2bel
src/bio2bel/exthook.py
https://github.com/bio2bel/bio2bel/blob/d80762d891fa18b248709ff0b0f97ebb65ec64c2/src/bio2bel/exthook.py#L44-L52
def load_module(self, fullname): """Load a module if its name starts with :code:`self.group` and is registered.""" if fullname in sys.modules: return sys.modules[fullname] end_name = fullname[len(self._group_with_dot):] for entry_point in iter_entry_points(group=self.group, n...
[ "def", "load_module", "(", "self", ",", "fullname", ")", ":", "if", "fullname", "in", "sys", ".", "modules", ":", "return", "sys", ".", "modules", "[", "fullname", "]", "end_name", "=", "fullname", "[", "len", "(", "self", ".", "_group_with_dot", ")", ...
Load a module if its name starts with :code:`self.group` and is registered.
[ "Load", "a", "module", "if", "its", "name", "starts", "with", ":", "code", ":", "self", ".", "group", "and", "is", "registered", "." ]
python
valid
47.333333
mikedh/trimesh
trimesh/path/creation.py
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/path/creation.py#L74-L108
def circle(radius=None, center=None, **kwargs): """ Create a Path2D containing a single or multiple rectangles with the specified bounds. Parameters -------------- bounds : (2, 2) float, or (m, 2, 2) float Minimum XY, Maximum XY Returns ------------- rect : Path2D Path ...
[ "def", "circle", "(", "radius", "=", "None", ",", "center", "=", "None", ",", "*", "*", "kwargs", ")", ":", "from", ".", "path", "import", "Path2D", "if", "center", "is", "None", ":", "center", "=", "[", "0.0", ",", "0.0", "]", "else", ":", "cent...
Create a Path2D containing a single or multiple rectangles with the specified bounds. Parameters -------------- bounds : (2, 2) float, or (m, 2, 2) float Minimum XY, Maximum XY Returns ------------- rect : Path2D Path containing specified rectangles
[ "Create", "a", "Path2D", "containing", "a", "single", "or", "multiple", "rectangles", "with", "the", "specified", "bounds", "." ]
python
train
25.857143
pantsbuild/pants
src/python/pants/java/nailgun_executor.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/java/nailgun_executor.py#L169-L186
def _get_nailgun_client(self, jvm_options, classpath, stdout, stderr, stdin): """This (somewhat unfortunately) is the main entrypoint to this class via the Runner. It handles creation of the running nailgun server as well as creation of the client.""" classpath = self._nailgun_classpath + classpath n...
[ "def", "_get_nailgun_client", "(", "self", ",", "jvm_options", ",", "classpath", ",", "stdout", ",", "stderr", ",", "stdin", ")", ":", "classpath", "=", "self", ".", "_nailgun_classpath", "+", "classpath", "new_fingerprint", "=", "self", ".", "_fingerprint", "...
This (somewhat unfortunately) is the main entrypoint to this class via the Runner. It handles creation of the running nailgun server as well as creation of the client.
[ "This", "(", "somewhat", "unfortunately", ")", "is", "the", "main", "entrypoint", "to", "this", "class", "via", "the", "Runner", ".", "It", "handles", "creation", "of", "the", "running", "nailgun", "server", "as", "well", "as", "creation", "of", "the", "cl...
python
train
51
apache/incubator-heron
heron/tools/tracker/src/python/javaobj.py
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/javaobj.py#L217-L235
def readObject(self): """read object""" try: _, res = self._read_and_exec_opcode(ident=0) position_bak = self.object_stream.tell() the_rest = self.object_stream.read() if len(the_rest): log_error("Warning!!!!: Stream still has %s bytes left.\ Enable debug mode of logging to see ...
[ "def", "readObject", "(", "self", ")", ":", "try", ":", "_", ",", "res", "=", "self", ".", "_read_and_exec_opcode", "(", "ident", "=", "0", ")", "position_bak", "=", "self", ".", "object_stream", ".", "tell", "(", ")", "the_rest", "=", "self", ".", "...
read object
[ "read", "object" ]
python
valid
30.473684
thoth-station/solver
thoth/solver/python/python.py
https://github.com/thoth-station/solver/blob/de9bd6e744cb4d5f70320ba77d6875ccb8b876c4/thoth/solver/python/python.py#L59-L63
def _get_environment_details(python_bin: str) -> list: """Get information about packages in environment where packages get installed.""" cmd = "{} -m pipdeptree --json".format(python_bin) output = run_command(cmd, is_json=True).stdout return [_create_entry(entry) for entry in output]
[ "def", "_get_environment_details", "(", "python_bin", ":", "str", ")", "->", "list", ":", "cmd", "=", "\"{} -m pipdeptree --json\"", ".", "format", "(", "python_bin", ")", "output", "=", "run_command", "(", "cmd", ",", "is_json", "=", "True", ")", ".", "stdo...
Get information about packages in environment where packages get installed.
[ "Get", "information", "about", "packages", "in", "environment", "where", "packages", "get", "installed", "." ]
python
train
59.2
apache/spark
python/pyspark/cloudpickle.py
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/cloudpickle.py#L799-L816
def save_attrgetter(self, obj): """attrgetter serializer""" class Dummy(object): def __init__(self, attrs, index=None): self.attrs = attrs self.index = index def __getattribute__(self, item): attrs = object.__getattribute__(self, "a...
[ "def", "save_attrgetter", "(", "self", ",", "obj", ")", ":", "class", "Dummy", "(", "object", ")", ":", "def", "__init__", "(", "self", ",", "attrs", ",", "index", "=", "None", ")", ":", "self", ".", "attrs", "=", "attrs", "self", ".", "index", "="...
attrgetter serializer
[ "attrgetter", "serializer" ]
python
train
40.666667
digidotcom/python-devicecloud
devicecloud/sci.py
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/sci.py#L133-L220
def send_sci(self, operation, target, payload, reply=None, synchronous=None, sync_timeout=None, cache=None, allow_offline=None, wait_for_reconnect=None): """Send SCI request to 1 or more targets :param str operation: The operation is one of {send_message, update_firmware, disconnect, q...
[ "def", "send_sci", "(", "self", ",", "operation", ",", "target", ",", "payload", ",", "reply", "=", "None", ",", "synchronous", "=", "None", ",", "sync_timeout", "=", "None", ",", "cache", "=", "None", ",", "allow_offline", "=", "None", ",", "wait_for_re...
Send SCI request to 1 or more targets :param str operation: The operation is one of {send_message, update_firmware, disconnect, query_firmware_targets, file_system, data_service, and reboot} :param target: The device(s) to be targeted with this request :type target: :class:`~.Target...
[ "Send", "SCI", "request", "to", "1", "or", "more", "targets" ]
python
train
41.806818
scopus-api/scopus
scopus/author_retrieval.py
https://github.com/scopus-api/scopus/blob/27ce02dd3095bfdab9d3e8475543d7c17767d1ab/scopus/author_retrieval.py#L45-L51
def classificationgroup(self): """List with (subject group ID, number of documents)-tuples.""" path = ['author-profile', 'classificationgroup', 'classifications', 'classification'] out = [(item['$'], item['@frequency']) for item in listify(chained_get(self._json, p...
[ "def", "classificationgroup", "(", "self", ")", ":", "path", "=", "[", "'author-profile'", ",", "'classificationgroup'", ",", "'classifications'", ",", "'classification'", "]", "out", "=", "[", "(", "item", "[", "'$'", "]", ",", "item", "[", "'@frequency'", ...
List with (subject group ID, number of documents)-tuples.
[ "List", "with", "(", "subject", "group", "ID", "number", "of", "documents", ")", "-", "tuples", "." ]
python
train
50.142857
Erotemic/utool
utool/util_class.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_class.py#L53-L116
def inject_instance(self, classkey=None, allow_override=False, verbose=VERBOSE_CLASS, strict=True): """ Injects an instance (self) of type (classkey) with all functions registered to (classkey) call this in the __init__ class function Args: self: the class instance ...
[ "def", "inject_instance", "(", "self", ",", "classkey", "=", "None", ",", "allow_override", "=", "False", ",", "verbose", "=", "VERBOSE_CLASS", ",", "strict", "=", "True", ")", ":", "import", "utool", "as", "ut", "if", "verbose", ":", "print", "(", "'[ut...
Injects an instance (self) of type (classkey) with all functions registered to (classkey) call this in the __init__ class function Args: self: the class instance classkey: key for a class, preferably the class type itself, but it doesnt have to be SeeAlso: make_cla...
[ "Injects", "an", "instance", "(", "self", ")", "of", "type", "(", "classkey", ")", "with", "all", "functions", "registered", "to", "(", "classkey", ")" ]
python
train
42.53125
gregreen/dustmaps
dustmaps/unstructured_map.py
https://github.com/gregreen/dustmaps/blob/c8f571a71da0d951bf8ea865621bee14492bdfd9/dustmaps/unstructured_map.py#L72-L103
def _coords2vec(self, coords): """ Converts from sky coordinates to unit vectors. Before conversion to unit vectors, the coordiantes are transformed to the coordinate system used internally by the :obj:`UnstructuredDustMap`, which can be set during initialization of the class. ...
[ "def", "_coords2vec", "(", "self", ",", "coords", ")", ":", "# c = coords.transform_to(self._frame)", "# vec = np.empty((c.shape[0], 2), dtype='f8')", "# vec[:,0] = coordinates.Longitude(coords.l, wrap_angle=360.*units.deg).deg[:]", "# vec[:,1] = coords.b.deg[:]", "# return np.radians(vec)",...
Converts from sky coordinates to unit vectors. Before conversion to unit vectors, the coordiantes are transformed to the coordinate system used internally by the :obj:`UnstructuredDustMap`, which can be set during initialization of the class. Args: coords (:obj:`astropy.coor...
[ "Converts", "from", "sky", "coordinates", "to", "unit", "vectors", ".", "Before", "conversion", "to", "unit", "vectors", "the", "coordiantes", "are", "transformed", "to", "the", "coordinate", "system", "used", "internally", "by", "the", ":", "obj", ":", "Unstr...
python
train
38.8125
ciena/afkak
afkak/client.py
https://github.com/ciena/afkak/blob/6f5e05ba6f135ea3c29cdb80efda009f7845569a/afkak/client.py#L803-L846
def _make_request_to_broker(self, broker, requestId, request, **kwArgs): """Send a request to the specified broker.""" def _timeout_request(broker, requestId): """The time we allotted for the request expired, cancel it.""" try: # FIXME: This should be done by call...
[ "def", "_make_request_to_broker", "(", "self", ",", "broker", ",", "requestId", ",", "request", ",", "*", "*", "kwArgs", ")", ":", "def", "_timeout_request", "(", "broker", ",", "requestId", ")", ":", "\"\"\"The time we allotted for the request expired, cancel it.\"\"...
Send a request to the specified broker.
[ "Send", "a", "request", "to", "the", "specified", "broker", "." ]
python
train
48.590909
LudovicRousseau/pyscard
smartcard/wx/CardAndReaderTreePanel.py
https://github.com/LudovicRousseau/pyscard/blob/62e675028086c75656444cc21d563d9f08ebf8e7/smartcard/wx/CardAndReaderTreePanel.py#L300-L318
def OnRemoveReaders(self, removedreaders): """Called when a reader is removed. Removes the reader from the smartcard readers tree.""" self.mutex.acquire() try: parentnode = self.root for readertoremove in removedreaders: (childReader, cookie) = sel...
[ "def", "OnRemoveReaders", "(", "self", ",", "removedreaders", ")", ":", "self", ".", "mutex", ".", "acquire", "(", ")", "try", ":", "parentnode", "=", "self", ".", "root", "for", "readertoremove", "in", "removedreaders", ":", "(", "childReader", ",", "cook...
Called when a reader is removed. Removes the reader from the smartcard readers tree.
[ "Called", "when", "a", "reader", "is", "removed", ".", "Removes", "the", "reader", "from", "the", "smartcard", "readers", "tree", "." ]
python
train
41.315789
pybel/pybel
src/pybel/tokens.py
https://github.com/pybel/pybel/blob/c8a7a1bdae4c475fa2a8c77f3a9a5f6d79556ca0/src/pybel/tokens.py#L48-L76
def _fusion_to_dsl(tokens) -> FusionBase: """Convert a PyParsing data dictionary to a PyBEL fusion data dictionary. :param tokens: A PyParsing data dictionary representing a fusion :type tokens: ParseResult """ func = tokens[FUNCTION] fusion_dsl = FUNC_TO_FUSION_DSL[func] member_dsl = FUNC_...
[ "def", "_fusion_to_dsl", "(", "tokens", ")", "->", "FusionBase", ":", "func", "=", "tokens", "[", "FUNCTION", "]", "fusion_dsl", "=", "FUNC_TO_FUSION_DSL", "[", "func", "]", "member_dsl", "=", "FUNC_TO_DSL", "[", "func", "]", "partner_5p", "=", "member_dsl", ...
Convert a PyParsing data dictionary to a PyBEL fusion data dictionary. :param tokens: A PyParsing data dictionary representing a fusion :type tokens: ParseResult
[ "Convert", "a", "PyParsing", "data", "dictionary", "to", "a", "PyBEL", "fusion", "data", "dictionary", "." ]
python
train
29.413793
sffjunkie/astral
src/astral.py
https://github.com/sffjunkie/astral/blob/b0aa63fce692357cd33c2bf36c69ed5b6582440c/src/astral.py#L1684-L1707
def _get_geocoding(self, key, location): """Lookup the Google geocoding API information for `key`""" url = self._location_query_base % quote_plus(key) if self.api_key: url += "&key=%s" % self.api_key data = self._read_from_url(url) response = json.loads(data) ...
[ "def", "_get_geocoding", "(", "self", ",", "key", ",", "location", ")", ":", "url", "=", "self", ".", "_location_query_base", "%", "quote_plus", "(", "key", ")", "if", "self", ".", "api_key", ":", "url", "+=", "\"&key=%s\"", "%", "self", ".", "api_key", ...
Lookup the Google geocoding API information for `key`
[ "Lookup", "the", "Google", "geocoding", "API", "information", "for", "key" ]
python
train
44.625
Kaggle/kaggle-api
kaggle/api/kaggle_api.py
https://github.com/Kaggle/kaggle-api/blob/65f14b1386470c5784d4753e491478e7537660d9/kaggle/api/kaggle_api.py#L2443-L2473
def kernels_list(self, **kwargs): # noqa: E501 """List kernels # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.kernels_list(async_req=True) >>> result = thread.get() ...
[ "def", "kernels_list", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", ".", "kernels_list_with_http_info", ...
List kernels # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.kernels_list(async_req=True) >>> result = thread.get() :param async_req bool :param int page: Page numbe...
[ "List", "kernels", "#", "noqa", ":", "E501" ]
python
train
48.580645
AtteqCom/zsl
src/zsl/utils/string_helper.py
https://github.com/AtteqCom/zsl/blob/ab51a96da1780ff642912396d4b85bdcb72560c1/src/zsl/utils/string_helper.py#L85-L104
def addslashes(s, escaped_chars=None): """Add slashes for given characters. Default is for ``\`` and ``'``. :param s: string :param escaped_chars: list of characters to prefix with a slash ``\`` :return: string with slashed characters :rtype: str :Example: >>> addslashes("'") "...
[ "def", "addslashes", "(", "s", ",", "escaped_chars", "=", "None", ")", ":", "if", "escaped_chars", "is", "None", ":", "escaped_chars", "=", "[", "\"\\\\\"", ",", "\"'\"", ",", "]", "# l = [\"\\\\\", '\"', \"'\", \"\\0\", ]", "for", "i", "in", "escaped_chars", ...
Add slashes for given characters. Default is for ``\`` and ``'``. :param s: string :param escaped_chars: list of characters to prefix with a slash ``\`` :return: string with slashed characters :rtype: str :Example: >>> addslashes("'") "\\'"
[ "Add", "slashes", "for", "given", "characters", ".", "Default", "is", "for", "\\", "and", "." ]
python
train
25.8
oursky/norecaptcha
norecaptcha/captcha.py
https://github.com/oursky/norecaptcha/blob/6323054bf42c1bf35c5d7a7def4729cb32518860/norecaptcha/captcha.py#L98-L151
def submit(recaptcha_response_field, secret_key, remoteip, verify_server=VERIFY_SERVER): """ Submits a reCAPTCHA request for verification. Returns RecaptchaResponse for the request recaptcha_response_field -- The value from the form secret_key -- your reCAPTCHA secr...
[ "def", "submit", "(", "recaptcha_response_field", ",", "secret_key", ",", "remoteip", ",", "verify_server", "=", "VERIFY_SERVER", ")", ":", "if", "not", "(", "recaptcha_response_field", "and", "len", "(", "recaptcha_response_field", ")", ")", ":", "return", "Recap...
Submits a reCAPTCHA request for verification. Returns RecaptchaResponse for the request recaptcha_response_field -- The value from the form secret_key -- your reCAPTCHA secret key remoteip -- the user's ip address
[ "Submits", "a", "reCAPTCHA", "request", "for", "verification", ".", "Returns", "RecaptchaResponse", "for", "the", "request" ]
python
train
27.574074
dw/mitogen
ansible_mitogen/connection.py
https://github.com/dw/mitogen/blob/a7fdb55e1300a7e0a5e404b09eb730cf9a525da7/ansible_mitogen/connection.py#L152-L165
def _connect_docker(spec): """ Return ContextService arguments for a Docker connection. """ return { 'method': 'docker', 'kwargs': { 'username': spec.remote_user(), 'container': spec.remote_addr(), 'python_path': spec.python_path(), 'connec...
[ "def", "_connect_docker", "(", "spec", ")", ":", "return", "{", "'method'", ":", "'docker'", ",", "'kwargs'", ":", "{", "'username'", ":", "spec", ".", "remote_user", "(", ")", ",", "'container'", ":", "spec", ".", "remote_addr", "(", ")", ",", "'python_...
Return ContextService arguments for a Docker connection.
[ "Return", "ContextService", "arguments", "for", "a", "Docker", "connection", "." ]
python
train
30.714286
rafaelsierra/django-json-mixin-form
src/sierra/dj/mixins/forms.py
https://github.com/rafaelsierra/django-json-mixin-form/blob/004149a1077eba8c072ebbfb6eb6b86a57564ecf/src/sierra/dj/mixins/forms.py#L84-L97
def form_invalid(self, form): '''Builds the JSON for the errors''' response = {self.errors_key: {}} response[self.non_field_errors_key] = form.non_field_errors() response.update(self.get_hidden_fields_errors(form)) for field in form.visible_fields(): if field.errors:...
[ "def", "form_invalid", "(", "self", ",", "form", ")", ":", "response", "=", "{", "self", ".", "errors_key", ":", "{", "}", "}", "response", "[", "self", ".", "non_field_errors_key", "]", "=", "form", ".", "non_field_errors", "(", ")", "response", ".", ...
Builds the JSON for the errors
[ "Builds", "the", "JSON", "for", "the", "errors" ]
python
train
37.571429
arne-cl/discoursegraphs
src/discoursegraphs/readwrite/salt/saltxmi.py
https://github.com/arne-cl/discoursegraphs/blob/842f0068a3190be2c75905754521b176b25a54fb/src/discoursegraphs/readwrite/salt/saltxmi.py#L141-L164
def _extract_elements(self, tree, element_type): """ extracts all element of type `element_type from the `_ElementTree` representation of a SaltXML document and adds them to the corresponding `SaltDocument` attributes, i.e. `self.nodes`, `self.edges` and `self.layers`. P...
[ "def", "_extract_elements", "(", "self", ",", "tree", ",", "element_type", ")", ":", "# creates a new attribute, e.g. 'self.nodes' and assigns it an", "# empty list", "setattr", "(", "self", ",", "element_type", ",", "[", "]", ")", "etree_elements", "=", "get_elements",...
extracts all element of type `element_type from the `_ElementTree` representation of a SaltXML document and adds them to the corresponding `SaltDocument` attributes, i.e. `self.nodes`, `self.edges` and `self.layers`. Parameters ---------- tree : lxml.etree._ElementTree ...
[ "extracts", "all", "element", "of", "type", "element_type", "from", "the", "_ElementTree", "representation", "of", "a", "SaltXML", "document", "and", "adds", "them", "to", "the", "corresponding", "SaltDocument", "attributes", "i", ".", "e", ".", "self", ".", "...
python
train
45.916667
theolind/pymysensors
mysensors/gateway_tcp.py
https://github.com/theolind/pymysensors/blob/a139ab6e2f6b71ebaf37282f69bfd0f7fe6193b6/mysensors/gateway_tcp.py#L53-L65
def get_gateway_id(self): """Return a unique id for the gateway.""" host, _ = self.server_address try: ip_address = ipaddress.ip_address(host) except ValueError: # Only hosts using ip address supports unique id. return None if ip_address.versio...
[ "def", "get_gateway_id", "(", "self", ")", ":", "host", ",", "_", "=", "self", ".", "server_address", "try", ":", "ip_address", "=", "ipaddress", ".", "ip_address", "(", "host", ")", "except", "ValueError", ":", "# Only hosts using ip address supports unique id.",...
Return a unique id for the gateway.
[ "Return", "a", "unique", "id", "for", "the", "gateway", "." ]
python
train
33.461538
xeroc/python-graphenelib
graphenebase/account.py
https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenebase/account.py#L482-L492
def from_pubkey(cls, pubkey, compressed=False, version=56, prefix=None): # Ensure this is a public key pubkey = PublicKey(pubkey) if compressed: pubkey = pubkey.compressed() else: pubkey = pubkey.uncompressed() """ Derive address using ``RIPEMD160(SHA256(...
[ "def", "from_pubkey", "(", "cls", ",", "pubkey", ",", "compressed", "=", "False", ",", "version", "=", "56", ",", "prefix", "=", "None", ")", ":", "# Ensure this is a public key", "pubkey", "=", "PublicKey", "(", "pubkey", ")", "if", "compressed", ":", "pu...
Derive address using ``RIPEMD160(SHA256(x))``
[ "Derive", "address", "using", "RIPEMD160", "(", "SHA256", "(", "x", "))" ]
python
valid
41.727273
release-engineering/productmd
productmd/images.py
https://github.com/release-engineering/productmd/blob/49256bf2e8c84124f42346241140b986ad7bfc38/productmd/images.py#L178-L204
def add(self, variant, arch, image): """ Assign an :class:`.Image` object to variant and arch. :param variant: compose variant UID :type variant: str :param arch: compose architecture :type arch: str :param image: image :type image: :class:`....
[ "def", "add", "(", "self", ",", "variant", ",", "arch", ",", "image", ")", ":", "if", "arch", "not", "in", "productmd", ".", "common", ".", "RPM_ARCHES", ":", "raise", "ValueError", "(", "\"Arch not found in RPM_ARCHES: %s\"", "%", "arch", ")", "if", "arch...
Assign an :class:`.Image` object to variant and arch. :param variant: compose variant UID :type variant: str :param arch: compose architecture :type arch: str :param image: image :type image: :class:`.Image`
[ "Assign", "an", ":", "class", ":", ".", "Image", "object", "to", "variant", "and", "arch", "." ]
python
train
50.444444
ggaughan/pipe2py
pipe2py/modules/piperename.py
https://github.com/ggaughan/pipe2py/blob/4767d6d1fd354d2a35e6528594b8deb8a033eed4/pipe2py/modules/piperename.py#L74-L100
def pipe_rename(context=None, _INPUT=None, conf=None, **kwargs): """An operator that renames or copies fields in the input source. Not loopable. Parameters ---------- context : pipe2py.Context object _INPUT : pipe2py.modules pipe like object (iterable of items) conf : { 'RULE': [ ...
[ "def", "pipe_rename", "(", "context", "=", "None", ",", "_INPUT", "=", "None", ",", "conf", "=", "None", ",", "*", "*", "kwargs", ")", ":", "splits", "=", "get_splits", "(", "_INPUT", ",", "conf", "[", "'RULE'", "]", ",", "*", "*", "cdicts", "(", ...
An operator that renames or copies fields in the input source. Not loopable. Parameters ---------- context : pipe2py.Context object _INPUT : pipe2py.modules pipe like object (iterable of items) conf : { 'RULE': [ { 'op': {'value': 'rename or copy'}, ...
[ "An", "operator", "that", "renames", "or", "copies", "fields", "in", "the", "input", "source", ".", "Not", "loopable", "." ]
python
train
27.888889
androguard/androguard
androguard/decompiler/dad/graph.py
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/decompiler/dad/graph.py#L332-L392
def dom_lt(graph): """Dominator algorithm from Lengauer-Tarjan""" def _dfs(v, n): semi[v] = n = n + 1 vertex[n] = label[v] = v ancestor[v] = 0 for w in graph.all_sucs(v): if not semi[w]: parent[w] = v n = _dfs(w, n) pred[w]...
[ "def", "dom_lt", "(", "graph", ")", ":", "def", "_dfs", "(", "v", ",", "n", ")", ":", "semi", "[", "v", "]", "=", "n", "=", "n", "+", "1", "vertex", "[", "n", "]", "=", "label", "[", "v", "]", "=", "v", "ancestor", "[", "v", "]", "=", "...
Dominator algorithm from Lengauer-Tarjan
[ "Dominator", "algorithm", "from", "Lengauer", "-", "Tarjan" ]
python
train
24.065574
saltstack/salt
salt/modules/boto_rds.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_rds.py#L525-L572
def describe(name, tags=None, region=None, key=None, keyid=None, profile=None): ''' Return RDS instance details. CLI example:: salt myminion boto_rds.describe myrds ''' res = __salt__['boto_rds.exists'](name, tags, region, key, keyid, pro...
[ "def", "describe", "(", "name", ",", "tags", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "res", "=", "__salt__", "[", "'boto_rds.exists'", "]", "(", "name", ","...
Return RDS instance details. CLI example:: salt myminion boto_rds.describe myrds
[ "Return", "RDS", "instance", "details", "." ]
python
train
39.583333
chimera0/accel-brain-code
Reinforcement-Learning/pyqlearning/functionapproximator/lstm_fa.py
https://github.com/chimera0/accel-brain-code/blob/03661f6f544bed656269fcd4b3c23c9061629daa/Reinforcement-Learning/pyqlearning/functionapproximator/lstm_fa.py#L159-L179
def inference_q(self, next_action_arr): ''' Infernce Q-Value. Args: next_action_arr: `np.ndarray` of action. Returns: `np.ndarray` of Q-Values. ''' q_arr = next_action_arr.reshape((next_action_arr.shape[0], -1)) self._...
[ "def", "inference_q", "(", "self", ",", "next_action_arr", ")", ":", "q_arr", "=", "next_action_arr", ".", "reshape", "(", "(", "next_action_arr", ".", "shape", "[", "0", "]", ",", "-", "1", ")", ")", "self", ".", "__q_arr_list", ".", "append", "(", "q...
Infernce Q-Value. Args: next_action_arr: `np.ndarray` of action. Returns: `np.ndarray` of Q-Values.
[ "Infernce", "Q", "-", "Value", ".", "Args", ":", "next_action_arr", ":", "np", ".", "ndarray", "of", "action", ".", "Returns", ":", "np", ".", "ndarray", "of", "Q", "-", "Values", "." ]
python
train
35.47619
tanghaibao/jcvi
jcvi/formats/agp.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/formats/agp.py#L933-L967
def format(args): """ %prog format oldagpfile newagpfile Reformat AGP file. --switch will replace the ids in the AGP file. """ from jcvi.formats.base import DictFile p = OptionParser(format.__doc__) p.add_option("--switchcomponent", help="Switch component id based on") ...
[ "def", "format", "(", "args", ")", ":", "from", "jcvi", ".", "formats", ".", "base", "import", "DictFile", "p", "=", "OptionParser", "(", "format", ".", "__doc__", ")", "p", ".", "add_option", "(", "\"--switchcomponent\"", ",", "help", "=", "\"Switch compo...
%prog format oldagpfile newagpfile Reformat AGP file. --switch will replace the ids in the AGP file.
[ "%prog", "format", "oldagpfile", "newagpfile" ]
python
train
30.257143
jalanb/pysyte
pysyte/bash/git.py
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/bash/git.py#L217-L232
def log(args, number=None, oneline=False, quiet=False): """Run a "git log ..." command, and return stdout args is anything which can be added after a normal "git log ..." it can be blank number, if true-ish, will be added as a "-n" option oneline, if true-ish, will add the "--oneline" option ...
[ "def", "log", "(", "args", ",", "number", "=", "None", ",", "oneline", "=", "False", ",", "quiet", "=", "False", ")", ":", "options", "=", "' '", ".", "join", "(", "[", "number", "and", "str", "(", "'-n %s'", "%", "number", ")", "or", "''", ",", ...
Run a "git log ..." command, and return stdout args is anything which can be added after a normal "git log ..." it can be blank number, if true-ish, will be added as a "-n" option oneline, if true-ish, will add the "--oneline" option
[ "Run", "a", "git", "log", "...", "command", "and", "return", "stdout" ]
python
train
34.125
potash/drain
drain/model.py
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/model.py#L242-L292
def y_subset(y, query=None, aux=None, subset=None, dropna=False, outcome='true', k=None, p=None, ascending=False, score='score', p_of='notnull'): """ Subset a model "y" dataframe Args: query: operates on y, or aux if present subset: takes a dataframe or index thereof and subsets...
[ "def", "y_subset", "(", "y", ",", "query", "=", "None", ",", "aux", "=", "None", ",", "subset", "=", "None", ",", "dropna", "=", "False", ",", "outcome", "=", "'true'", ",", "k", "=", "None", ",", "p", "=", "None", ",", "ascending", "=", "False",...
Subset a model "y" dataframe Args: query: operates on y, or aux if present subset: takes a dataframe or index thereof and subsets to that dropna: means drop missing outcomes return: top k (count) or p (proportion) if specified p_of: specifies what the proportion is relative t...
[ "Subset", "a", "model", "y", "dataframe", "Args", ":", "query", ":", "operates", "on", "y", "or", "aux", "if", "present", "subset", ":", "takes", "a", "dataframe", "or", "index", "thereof", "and", "subsets", "to", "that", "dropna", ":", "means", "drop", ...
python
train
32.921569
dunovank/jupyter-themes
jupyterthemes/stylefx.py
https://github.com/dunovank/jupyter-themes/blob/421016c2e4fed75fa1830d664c10478d9bd25ed1/jupyterthemes/stylefx.py#L329-L364
def toggle_settings( toolbar=False, nbname=False, hideprompt=False, kernellogo=False): """Toggle main notebook toolbar (e.g., buttons), filename, and kernel logo.""" toggle = '' if toolbar: toggle += 'div#maintoolbar {margin-left: 8px !important;}\n' toggle += '.toolbar.containe...
[ "def", "toggle_settings", "(", "toolbar", "=", "False", ",", "nbname", "=", "False", ",", "hideprompt", "=", "False", ",", "kernellogo", "=", "False", ")", ":", "toggle", "=", "''", "if", "toolbar", ":", "toggle", "+=", "'div#maintoolbar {margin-left: 8px !imp...
Toggle main notebook toolbar (e.g., buttons), filename, and kernel logo.
[ "Toggle", "main", "notebook", "toolbar", "(", "e", ".", "g", ".", "buttons", ")", "filename", "and", "kernel", "logo", "." ]
python
train
48.166667
bitesofcode/projexui
projexui/widgets/xrichtextedit/xrichtextedit.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xrichtextedit/xrichtextedit.py#L548-L556
def setFontFamily(self, family): """ Sets the current font family to the inputed family. :param family | <str> """ self.blockSignals(True) self.editor().setFontFamily(family) self.blockSignals(False)
[ "def", "setFontFamily", "(", "self", ",", "family", ")", ":", "self", ".", "blockSignals", "(", "True", ")", "self", ".", "editor", "(", ")", ".", "setFontFamily", "(", "family", ")", "self", ".", "blockSignals", "(", "False", ")" ]
Sets the current font family to the inputed family. :param family | <str>
[ "Sets", "the", "current", "font", "family", "to", "the", "inputed", "family", ".", ":", "param", "family", "|", "<str", ">" ]
python
train
29.888889
yueyoum/social-oauth
example/_bottle.py
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L825-L852
def wsgi(self, environ, start_response): """ The bottle WSGI-interface. """ try: environ['bottle.app'] = self request.bind(environ) response.bind() out = self._cast(self._handle(environ), request, response) # rfc2616 section 4.3 if ...
[ "def", "wsgi", "(", "self", ",", "environ", ",", "start_response", ")", ":", "try", ":", "environ", "[", "'bottle.app'", "]", "=", "self", "request", ".", "bind", "(", "environ", ")", "response", ".", "bind", "(", ")", "out", "=", "self", ".", "_cast...
The bottle WSGI-interface.
[ "The", "bottle", "WSGI", "-", "interface", "." ]
python
train
46.071429
inveniosoftware/invenio-github
invenio_github/api.py
https://github.com/inveniosoftware/invenio-github/blob/ec42fd6a06079310dcbe2c46d9fd79d5197bbe26/invenio_github/api.py#L107-L131
def init_account(self): """Setup a new GitHub account.""" ghuser = self.api.me() # Setup local access tokens to be used by the webhooks hook_token = ProviderToken.create_personal( 'github-webhook', self.user_id, scopes=['webhooks:event'], i...
[ "def", "init_account", "(", "self", ")", ":", "ghuser", "=", "self", ".", "api", ".", "me", "(", ")", "# Setup local access tokens to be used by the webhooks", "hook_token", "=", "ProviderToken", ".", "create_personal", "(", "'github-webhook'", ",", "self", ".", "...
Setup a new GitHub account.
[ "Setup", "a", "new", "GitHub", "account", "." ]
python
train
31.32
apache/spark
python/pyspark/sql/functions.py
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/functions.py#L1856-L1867
def translate(srcCol, matching, replace): """A function translate any character in the `srcCol` by a character in `matching`. The characters in `replace` is corresponding to the characters in `matching`. The translate will happen when any character in the string matching with the character in the `match...
[ "def", "translate", "(", "srcCol", ",", "matching", ",", "replace", ")", ":", "sc", "=", "SparkContext", ".", "_active_spark_context", "return", "Column", "(", "sc", ".", "_jvm", ".", "functions", ".", "translate", "(", "_to_java_column", "(", "srcCol", ")",...
A function translate any character in the `srcCol` by a character in `matching`. The characters in `replace` is corresponding to the characters in `matching`. The translate will happen when any character in the string matching with the character in the `matching`. >>> spark.createDataFrame([('translate...
[ "A", "function", "translate", "any", "character", "in", "the", "srcCol", "by", "a", "character", "in", "matching", ".", "The", "characters", "in", "replace", "is", "corresponding", "to", "the", "characters", "in", "matching", ".", "The", "translate", "will", ...
python
train
51
atztogo/phonopy
phonopy/api_phonopy.py
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L1107-L1168
def set_mesh(self, mesh, shift=None, is_time_reversal=True, is_mesh_symmetry=True, is_eigenvectors=False, is_gamma_center=False, run_immediately=True): """Phonon calculations on sampling mesh g...
[ "def", "set_mesh", "(", "self", ",", "mesh", ",", "shift", "=", "None", ",", "is_time_reversal", "=", "True", ",", "is_mesh_symmetry", "=", "True", ",", "is_eigenvectors", "=", "False", ",", "is_gamma_center", "=", "False", ",", "run_immediately", "=", "True...
Phonon calculations on sampling mesh grids Parameters ---------- mesh: array_like Mesh numbers along a, b, c axes. dtype='intc' shape=(3,) shift: array_like, optional, default None (no shift) Mesh shifts along a*, b*, c* axes with respect ...
[ "Phonon", "calculations", "on", "sampling", "mesh", "grids" ]
python
train
42.290323
bpsmith/tia
tia/rlab/builder.py
https://github.com/bpsmith/tia/blob/a7043b6383e557aeea8fc7112bbffd6e36a230e9/tia/rlab/builder.py#L262-L264
def table_formatter(self, dataframe, inc_header=1, inc_index=1): """Return a table formatter for the dataframe. Saves the user the need to import this class""" return TableFormatter(dataframe, inc_header=inc_header, inc_index=inc_index)
[ "def", "table_formatter", "(", "self", ",", "dataframe", ",", "inc_header", "=", "1", ",", "inc_index", "=", "1", ")", ":", "return", "TableFormatter", "(", "dataframe", ",", "inc_header", "=", "inc_header", ",", "inc_index", "=", "inc_index", ")" ]
Return a table formatter for the dataframe. Saves the user the need to import this class
[ "Return", "a", "table", "formatter", "for", "the", "dataframe", ".", "Saves", "the", "user", "the", "need", "to", "import", "this", "class" ]
python
train
83.333333
saltstack/salt
salt/client/ssh/client.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/client.py#L43-L64
def _prep_ssh( self, tgt, fun, arg=(), timeout=None, tgt_type='glob', kwarg=None, **kwargs): ''' Prepare the arguments ''' opts = copy.deepcopy(self.opts) opts.update(kwargs) i...
[ "def", "_prep_ssh", "(", "self", ",", "tgt", ",", "fun", ",", "arg", "=", "(", ")", ",", "timeout", "=", "None", ",", "tgt_type", "=", "'glob'", ",", "kwarg", "=", "None", ",", "*", "*", "kwargs", ")", ":", "opts", "=", "copy", ".", "deepcopy", ...
Prepare the arguments
[ "Prepare", "the", "arguments" ]
python
train
26.5
nerdvegas/rez
src/rez/solver.py
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L2137-L2157
def dump(self): """Print a formatted summary of the current solve state.""" from rez.utils.formatting import columnise rows = [] for i, phase in enumerate(self.phase_stack): rows.append((self._depth_label(i), phase.status, str(phase))) print "status: %s (%s)" % (sel...
[ "def", "dump", "(", "self", ")", ":", "from", "rez", ".", "utils", ".", "formatting", "import", "columnise", "rows", "=", "[", "]", "for", "i", ",", "phase", "in", "enumerate", "(", "self", ".", "phase_stack", ")", ":", "rows", ".", "append", "(", ...
Print a formatted summary of the current solve state.
[ "Print", "a", "formatted", "summary", "of", "the", "current", "solve", "state", "." ]
python
train
36.857143
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L850-L866
def collation(self, collation): """Adds a :class:`~pymongo.collation.Collation` to this query. This option is only supported on MongoDB 3.4 and above. Raises :exc:`TypeError` if `collation` is not an instance of :class:`~pymongo.collation.Collation` or a ``dict``. Raises :exc:`...
[ "def", "collation", "(", "self", ",", "collation", ")", ":", "self", ".", "__check_okay_to_chain", "(", ")", "self", ".", "__collation", "=", "validate_collation_or_none", "(", "collation", ")", "return", "self" ]
Adds a :class:`~pymongo.collation.Collation` to this query. This option is only supported on MongoDB 3.4 and above. Raises :exc:`TypeError` if `collation` is not an instance of :class:`~pymongo.collation.Collation` or a ``dict``. Raises :exc:`~pymongo.errors.InvalidOperation` if this :...
[ "Adds", "a", ":", "class", ":", "~pymongo", ".", "collation", ".", "Collation", "to", "this", "query", "." ]
python
train
41.058824
zqfang/GSEApy
gseapy/gsea.py
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L858-L933
def gsea(data, gene_sets, cls, outdir='GSEA_', min_size=15, max_size=500, permutation_num=1000, weighted_score_type=1,permutation_type='gene_set', method='log2_ratio_of_classes', ascending=False, processes=1, figsize=(6.5,6), format='pdf', graph_num=20, no_plot=False, seed=None, verbose=False...
[ "def", "gsea", "(", "data", ",", "gene_sets", ",", "cls", ",", "outdir", "=", "'GSEA_'", ",", "min_size", "=", "15", ",", "max_size", "=", "500", ",", "permutation_num", "=", "1000", ",", "weighted_score_type", "=", "1", ",", "permutation_type", "=", "'g...
Run Gene Set Enrichment Analysis. :param data: Gene expression data table, Pandas DataFrame, gct file. :param gene_sets: Enrichr Library name or .gmt gene sets file or dict of gene sets. Same input with GSEA. :param cls: A list or a .cls file format required for GSEA. :param str outdir: Results output ...
[ "Run", "Gene", "Set", "Enrichment", "Analysis", "." ]
python
test
53.394737
pyviz/holoviews
holoviews/plotting/util.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/util.py#L616-L626
def linear_gradient(start_hex, finish_hex, n=10): """ Interpolates the color gradient between to hex colors """ s = hex2rgb(start_hex) f = hex2rgb(finish_hex) gradient = [s] for t in range(1, n): curr_vector = [int(s[j] + (float(t)/(n-1))*(f[j]-s[j])) for j in range(3)] gradi...
[ "def", "linear_gradient", "(", "start_hex", ",", "finish_hex", ",", "n", "=", "10", ")", ":", "s", "=", "hex2rgb", "(", "start_hex", ")", "f", "=", "hex2rgb", "(", "finish_hex", ")", "gradient", "=", "[", "s", "]", "for", "t", "in", "range", "(", "...
Interpolates the color gradient between to hex colors
[ "Interpolates", "the", "color", "gradient", "between", "to", "hex", "colors" ]
python
train
36.090909
glormph/msstitch
src/app/lookups/sqlite/protpeptable.py
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/lookups/sqlite/protpeptable.py#L224-L298
def prepare_mergetable_sql(self, precursor=False, isobaric=False, probability=False, fdr=False, pep=False): """Dynamically build SQL query to generate entries for the multi-set merged protein and peptide tables. E.g. SELECT g.gene_acc, pc.channel_name, pc.amount_p...
[ "def", "prepare_mergetable_sql", "(", "self", ",", "precursor", "=", "False", ",", "isobaric", "=", "False", ",", "probability", "=", "False", ",", "fdr", "=", "False", ",", "pep", "=", "False", ")", ":", "featcol", "=", "self", ".", "colmap", "[", "se...
Dynamically build SQL query to generate entries for the multi-set merged protein and peptide tables. E.g. SELECT g.gene_acc, pc.channel_name, pc.amount_psms_name, giq.quantvalue giq.amount_psms gfdr.fdr FROM genes AS g JOIN biosets AS bs JOIN gene_tables AS gt ON ...
[ "Dynamically", "build", "SQL", "query", "to", "generate", "entries", "for", "the", "multi", "-", "set", "merged", "protein", "and", "peptide", "tables", ".", "E", ".", "g", "." ]
python
train
48.146667
pallets/werkzeug
src/werkzeug/routing.py
https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/routing.py#L1979-L1990
def allowed_methods(self, path_info=None): """Returns the valid methods that match for a given path. .. versionadded:: 0.7 """ try: self.match(path_info, method="--") except MethodNotAllowed as e: return e.valid_methods except HTTPException: ...
[ "def", "allowed_methods", "(", "self", ",", "path_info", "=", "None", ")", ":", "try", ":", "self", ".", "match", "(", "path_info", ",", "method", "=", "\"--\"", ")", "except", "MethodNotAllowed", "as", "e", ":", "return", "e", ".", "valid_methods", "exc...
Returns the valid methods that match for a given path. .. versionadded:: 0.7
[ "Returns", "the", "valid", "methods", "that", "match", "for", "a", "given", "path", "." ]
python
train
28.166667
jotacor/ComunioPy
ComunioPy/__init__.py
https://github.com/jotacor/ComunioPy/blob/2dd71e3e197b497980ea7b9cfbec1da64dca3ed0/ComunioPy/__init__.py#L146-L154
def info_community(self,teamid): '''Get comunity info using a ID''' headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain",'Referer': 'http://'+self.domain+'/standings.phtml',"User-Agent": user_agent} req = self.session.get('http://'+self.domain+'/teamInfo.phtml?ti...
[ "def", "info_community", "(", "self", ",", "teamid", ")", ":", "headers", "=", "{", "\"Content-type\"", ":", "\"application/x-www-form-urlencoded\"", ",", "\"Accept\"", ":", "\"text/plain\"", ",", "'Referer'", ":", "'http://'", "+", "self", ".", "domain", "+", "...
Get comunity info using a ID
[ "Get", "comunity", "info", "using", "a", "ID" ]
python
train
72.333333
HacKanCuBa/passphrase-py
passphrase/passphrase.py
https://github.com/HacKanCuBa/passphrase-py/blob/219d6374338ed9a1475b4f09b0d85212376f11e0/passphrase/passphrase.py#L300-L322
def import_words_from_file(self, inputfile: str, is_diceware: bool) -> None: """Import words for the wordlist from a given file. The file can have a single column with words or be diceware-like (two columns). Keyword argumen...
[ "def", "import_words_from_file", "(", "self", ",", "inputfile", ":", "str", ",", "is_diceware", ":", "bool", ")", "->", "None", ":", "if", "not", "Aux", ".", "isfile_notempty", "(", "inputfile", ")", ":", "raise", "FileNotFoundError", "(", "'Input file does no...
Import words for the wordlist from a given file. The file can have a single column with words or be diceware-like (two columns). Keyword arguments: inputfile -- A string with the path to the wordlist file to load, or the value 'internal' to load the internal one. is_dic...
[ "Import", "words", "for", "the", "wordlist", "from", "a", "given", "file", "." ]
python
train
40.347826
alkivi-sas/python-alkivi-logger
alkivi/logger/logger.py
https://github.com/alkivi-sas/python-alkivi-logger/blob/e96d5a987a5c8789c51d4fa7541709e05b1f51e1/alkivi/logger/logger.py#L88-L91
def warn(self, message, *args, **kwargs): """Send email and syslog by default ... """ self._log(logging.WARNING, message, *args, **kwargs)
[ "def", "warn", "(", "self", ",", "message", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_log", "(", "logging", ".", "WARNING", ",", "message", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Send email and syslog by default ...
[ "Send", "email", "and", "syslog", "by", "default", "..." ]
python
train
39.75
databio/pypiper
pypiper/utils.py
https://github.com/databio/pypiper/blob/00e6c2b94033c4187d47ff14c5580bbfc2ff097f/pypiper/utils.py#L31-L54
def add_pypiper_args(parser, groups=("pypiper", ), args=None, required=None, all_args=False): """ Use this to add standardized pypiper arguments to your python pipeline. There are two ways to use `add_pypiper_args`: by specifying argument groups, or by specifying individual argumen...
[ "def", "add_pypiper_args", "(", "parser", ",", "groups", "=", "(", "\"pypiper\"", ",", ")", ",", "args", "=", "None", ",", "required", "=", "None", ",", "all_args", "=", "False", ")", ":", "args_to_add", "=", "_determine_args", "(", "argument_groups", "=",...
Use this to add standardized pypiper arguments to your python pipeline. There are two ways to use `add_pypiper_args`: by specifying argument groups, or by specifying individual arguments. Specifying argument groups will add multiple arguments to your parser; these convenient argument groupings make it ...
[ "Use", "this", "to", "add", "standardized", "pypiper", "arguments", "to", "your", "python", "pipeline", "." ]
python
train
57.25
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L685-L715
def profile_args(_args): """Return args for v1, v2, or v3 structure. Args: _args (dict): The args section from the profile. Returns: dict: A collapsed version of the args dict. """ # TODO: clean this up in a way that works for both py2/3 if ( ...
[ "def", "profile_args", "(", "_args", ")", ":", "# TODO: clean this up in a way that works for both py2/3", "if", "(", "_args", ".", "get", "(", "'app'", ",", "{", "}", ")", ".", "get", "(", "'optional'", ")", "is", "not", "None", "or", "_args", ".", "get", ...
Return args for v1, v2, or v3 structure. Args: _args (dict): The args section from the profile. Returns: dict: A collapsed version of the args dict.
[ "Return", "args", "for", "v1", "v2", "or", "v3", "structure", "." ]
python
train
36.354839
ibis-project/ibis
ibis/expr/types.py
https://github.com/ibis-project/ibis/blob/1e39a5fd9ef088b45c155e8a5f541767ee8ef2e7/ibis/expr/types.py#L350-L363
def to_projection(self): """ Promote this column expression to a table projection """ roots = self._root_tables() if len(roots) > 1: raise com.RelationError( 'Cannot convert array expression ' 'involving multiple base table references '...
[ "def", "to_projection", "(", "self", ")", ":", "roots", "=", "self", ".", "_root_tables", "(", ")", "if", "len", "(", "roots", ")", ">", "1", ":", "raise", "com", ".", "RelationError", "(", "'Cannot convert array expression '", "'involving multiple base table re...
Promote this column expression to a table projection
[ "Promote", "this", "column", "expression", "to", "a", "table", "projection" ]
python
train
30.857143
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v20/ardupilotmega.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v20/ardupilotmega.py#L9730-L9742
def set_mag_offsets_encode(self, target_system, target_component, mag_ofs_x, mag_ofs_y, mag_ofs_z): ''' Deprecated. Use MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS instead. Set the magnetometer offsets target_system : System ID (uint8_t) ...
[ "def", "set_mag_offsets_encode", "(", "self", ",", "target_system", ",", "target_component", ",", "mag_ofs_x", ",", "mag_ofs_y", ",", "mag_ofs_z", ")", ":", "return", "MAVLink_set_mag_offsets_message", "(", "target_system", ",", "target_component", ",", "mag_ofs_x", "...
Deprecated. Use MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS instead. Set the magnetometer offsets target_system : System ID (uint8_t) target_component : Component ID (uint8_t) mag_ofs_x : magnetometer X offset (int16_t) ...
[ "Deprecated", ".", "Use", "MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS", "instead", ".", "Set", "the", "magnetometer", "offsets" ]
python
train
56.307692
MostAwesomeDude/blackjack
blackjack.py
https://github.com/MostAwesomeDude/blackjack/blob/1346642e353719ab68c0dc3573aa33b688431bf8/blackjack.py#L351-L361
def pop_min(self): """ Remove the minimum value and return it. """ if self.root is NULL: raise KeyError("pop from an empty blackjack") self.root, value = self.root.delete_min() self._len -= 1 return value
[ "def", "pop_min", "(", "self", ")", ":", "if", "self", ".", "root", "is", "NULL", ":", "raise", "KeyError", "(", "\"pop from an empty blackjack\"", ")", "self", ".", "root", ",", "value", "=", "self", ".", "root", ".", "delete_min", "(", ")", "self", "...
Remove the minimum value and return it.
[ "Remove", "the", "minimum", "value", "and", "return", "it", "." ]
python
train
24