repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
rocky/python3-trepan
trepan/processor/cmdfns.py
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdfns.py#L103-L118
def get_int(errmsg, arg, default=1, cmdname=None): """If arg is an int, use that otherwise take default.""" if arg: try: # eval() is used so we will allow arithmetic expressions, # variables etc. default = int(eval(arg)) except (SyntaxError, NameError, ValueEr...
[ "def", "get_int", "(", "errmsg", ",", "arg", ",", "default", "=", "1", ",", "cmdname", "=", "None", ")", ":", "if", "arg", ":", "try", ":", "# eval() is used so we will allow arithmetic expressions,", "# variables etc.", "default", "=", "int", "(", "eval", "("...
If arg is an int, use that otherwise take default.
[ "If", "arg", "is", "an", "int", "use", "that", "otherwise", "take", "default", "." ]
python
test
RudolfCardinal/pythonlib
cardinal_pythonlib/buildfunc.py
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/buildfunc.py#L56-L70
def download_if_not_exists(url: str, filename: str, skip_cert_verify: bool = True, mkdir: bool = True) -> None: """ Downloads a URL to a file, unless the file already exists. """ if os.path.isfile(filename): log.info("No need to download, alr...
[ "def", "download_if_not_exists", "(", "url", ":", "str", ",", "filename", ":", "str", ",", "skip_cert_verify", ":", "bool", "=", "True", ",", "mkdir", ":", "bool", "=", "True", ")", "->", "None", ":", "if", "os", ".", "path", ".", "isfile", "(", "fil...
Downloads a URL to a file, unless the file already exists.
[ "Downloads", "a", "URL", "to", "a", "file", "unless", "the", "file", "already", "exists", "." ]
python
train
mozilla-b2g/fxos-certsuite
mcts/tools/webidl/manifest_parser.py
https://github.com/mozilla-b2g/fxos-certsuite/blob/152a76c7c4c9d908524cf6e6fc25a498058f363d/mcts/tools/webidl/manifest_parser.py#L15-L36
def main(argv): """ This will generate you a manifest file, and you need to modify it! There are three category: files, untested, skipped. You can reference current manifest.json. usage: manifest_parser.py (GECKO LOCATION: /B2G/gecko/dom/webidl) The generated file can then be used with process...
[ "def", "main", "(", "argv", ")", ":", "argparser", "=", "argparse", ".", "ArgumentParser", "(", ")", "argparser", ".", "add_argument", "(", "\"gecko\"", ",", "help", "=", "\"/B2G/gecko/dom/webidl\"", ")", "args", "=", "argparser", ".", "parse_args", "(", "ar...
This will generate you a manifest file, and you need to modify it! There are three category: files, untested, skipped. You can reference current manifest.json. usage: manifest_parser.py (GECKO LOCATION: /B2G/gecko/dom/webidl) The generated file can then be used with process_idl.py
[ "This", "will", "generate", "you", "a", "manifest", "file", "and", "you", "need", "to", "modify", "it!", "There", "are", "three", "category", ":", "files", "untested", "skipped", ".", "You", "can", "reference", "current", "manifest", ".", "json", "." ]
python
train
matrix-org/matrix-python-sdk
matrix_client/api.py
https://github.com/matrix-org/matrix-python-sdk/blob/e734cce3ccd35f2d355c6a19a7a701033472498a/matrix_client/api.py#L376-L388
def send_message(self, room_id, text_content, msgtype="m.text", timestamp=None): """Perform PUT /rooms/$room_id/send/m.room.message Args: room_id (str): The room ID to send the event in. text_content (str): The m.text body to send. timestamp (int): Set origin_server_...
[ "def", "send_message", "(", "self", ",", "room_id", ",", "text_content", ",", "msgtype", "=", "\"m.text\"", ",", "timestamp", "=", "None", ")", ":", "return", "self", ".", "send_message_event", "(", "room_id", ",", "\"m.room.message\"", ",", "self", ".", "ge...
Perform PUT /rooms/$room_id/send/m.room.message Args: room_id (str): The room ID to send the event in. text_content (str): The m.text body to send. timestamp (int): Set origin_server_ts (For application services only)
[ "Perform", "PUT", "/", "rooms", "/", "$room_id", "/", "send", "/", "m", ".", "room", ".", "message" ]
python
train
mabuchilab/QNET
src/qnet/algebra/core/algebraic_properties.py
https://github.com/mabuchilab/QNET/blob/cc20d26dad78691d34c67173e5cd67dcac94208a/src/qnet/algebra/core/algebraic_properties.py#L856-L944
def _deltasummation(term, ranges, i_range): """Partially execute a summation for `term` with a Kronecker Delta for one of the summation indices. This implements the solution to the core sub-problem in :func:`indexed_sum_over_kronecker` Args: term (QuantumExpression): term of the sum ...
[ "def", "_deltasummation", "(", "term", ",", "ranges", ",", "i_range", ")", ":", "from", "qnet", ".", "algebra", ".", "core", ".", "abstract_quantum_algebra", "import", "QuantumExpression", "idx", "=", "ranges", "[", "i_range", "]", ".", "index_symbol", "summan...
Partially execute a summation for `term` with a Kronecker Delta for one of the summation indices. This implements the solution to the core sub-problem in :func:`indexed_sum_over_kronecker` Args: term (QuantumExpression): term of the sum ranges (list): list of all summation index ranges...
[ "Partially", "execute", "a", "summation", "for", "term", "with", "a", "Kronecker", "Delta", "for", "one", "of", "the", "summation", "indices", "." ]
python
train
cmbruns/pyopenvr
src/openvr/__init__.py
https://github.com/cmbruns/pyopenvr/blob/68395d26bb3df6ab1f0f059c38d441f962938be6/src/openvr/__init__.py#L5727-L5742
def hookScreenshot(self, numTypes): """ Called by the running VR application to indicate that it wishes to be in charge of screenshots. If the application does not call this, the Compositor will only support VRScreenshotType_Stereo screenshots that will be captured w...
[ "def", "hookScreenshot", "(", "self", ",", "numTypes", ")", ":", "fn", "=", "self", ".", "function_table", ".", "hookScreenshot", "pSupportedTypes", "=", "EVRScreenshotType", "(", ")", "result", "=", "fn", "(", "byref", "(", "pSupportedTypes", ")", ",", "num...
Called by the running VR application to indicate that it wishes to be in charge of screenshots. If the application does not call this, the Compositor will only support VRScreenshotType_Stereo screenshots that will be captured without notification to the running app. Once ho...
[ "Called", "by", "the", "running", "VR", "application", "to", "indicate", "that", "it", "wishes", "to", "be", "in", "charge", "of", "screenshots", ".", "If", "the", "application", "does", "not", "call", "this", "the", "Compositor", "will", "only", "support", ...
python
train
bcbio/bcbio-nextgen
bcbio/structural/regions.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L346-L364
def get_base_cnv_regions(data, work_dir, genome_default="transcripts1e4", include_gene_names=True): """Retrieve set of target regions for CNV analysis. Subsets to extended transcript regions for WGS experiments to avoid long runtimes. """ cov_interval = dd.get_coverage_interval(data) base_regio...
[ "def", "get_base_cnv_regions", "(", "data", ",", "work_dir", ",", "genome_default", "=", "\"transcripts1e4\"", ",", "include_gene_names", "=", "True", ")", ":", "cov_interval", "=", "dd", ".", "get_coverage_interval", "(", "data", ")", "base_regions", "=", "get_sv...
Retrieve set of target regions for CNV analysis. Subsets to extended transcript regions for WGS experiments to avoid long runtimes.
[ "Retrieve", "set", "of", "target", "regions", "for", "CNV", "analysis", "." ]
python
train
helgi/python-command
command/core.py
https://github.com/helgi/python-command/blob/c41fb8cdd9074b847c7bc5b5ee7f027508f52d7f/command/core.py#L212-L248
def which(program, environ=None): """ Find out if an executable exists in the supplied PATH. If so, the absolute path to the executable is returned. If not, an exception is raised. :type string :param program: Executable to be checked for :param dict :param environ: Any additional ENV ...
[ "def", "which", "(", "program", ",", "environ", "=", "None", ")", ":", "def", "is_exe", "(", "path", ")", ":", "\"\"\"\n Helper method to check if a file exists and is executable\n \"\"\"", "return", "isfile", "(", "path", ")", "and", "os", ".", "acces...
Find out if an executable exists in the supplied PATH. If so, the absolute path to the executable is returned. If not, an exception is raised. :type string :param program: Executable to be checked for :param dict :param environ: Any additional ENV variables required, specifically PATH :re...
[ "Find", "out", "if", "an", "executable", "exists", "in", "the", "supplied", "PATH", ".", "If", "so", "the", "absolute", "path", "to", "the", "executable", "is", "returned", ".", "If", "not", "an", "exception", "is", "raised", "." ]
python
train
uogbuji/versa
tools/py/pipeline/core_actions.py
https://github.com/uogbuji/versa/blob/f092ffc7ed363a5b170890955168500f32de0dd5/tools/py/pipeline/core_actions.py#L185-L319
def materialize(typ, rel=None, origin=None, unique=None, links=None, inverse=False, split=None, attributes=None): ''' Create a new resource related to the origin :param typ: IRI of the type for the resource to be materialized, which becomes the target of the main link, and the origin of any additio...
[ "def", "materialize", "(", "typ", ",", "rel", "=", "None", ",", "origin", "=", "None", ",", "unique", "=", "None", ",", "links", "=", "None", ",", "inverse", "=", "False", ",", "split", "=", "None", ",", "attributes", "=", "None", ")", ":", "links"...
Create a new resource related to the origin :param typ: IRI of the type for the resource to be materialized, which becomes the target of the main link, and the origin of any additional links given in the links param :param rel: IRI of the relationship between the origin and the materialized target...
[ "Create", "a", "new", "resource", "related", "to", "the", "origin" ]
python
train
portfors-lab/sparkle
sparkle/gui/stim/stimulusview.py
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/stim/stimulusview.py#L549-L556
def paint(self, painter, option, index): """Uses the :meth:`paint<sparkle.gui.stim.components.qcomponents.QStimulusComponent.paint>` method of the component it represents to fill in an appropriately sized rectange. :qtdoc:`Re-implemented<QStyledItemDelegate.paint>`""" component = index...
[ "def", "paint", "(", "self", ",", "painter", ",", "option", ",", "index", ")", ":", "component", "=", "index", ".", "model", "(", ")", ".", "data", "(", "index", ",", "role", "=", "QtCore", ".", "Qt", ".", "UserRole", ")", "painter", ".", "drawRect...
Uses the :meth:`paint<sparkle.gui.stim.components.qcomponents.QStimulusComponent.paint>` method of the component it represents to fill in an appropriately sized rectange. :qtdoc:`Re-implemented<QStyledItemDelegate.paint>`
[ "Uses", "the", ":", "meth", ":", "paint<sparkle", ".", "gui", ".", "stim", ".", "components", ".", "qcomponents", ".", "QStimulusComponent", ".", "paint", ">", "method", "of", "the", "component", "it", "represents", "to", "fill", "in", "an", "appropriately",...
python
train
saltstack/salt
salt/modules/win_system.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_system.py#L676-L698
def set_hostname(hostname): ''' Set the hostname of the windows minion, requires a restart before this will be updated. .. versionadded:: 2016.3.0 Args: hostname (str): The hostname to set Returns: bool: ``True`` if successful, otherwise ``False`` CLI Example: .. cod...
[ "def", "set_hostname", "(", "hostname", ")", ":", "with", "salt", ".", "utils", ".", "winapi", ".", "Com", "(", ")", ":", "conn", "=", "wmi", ".", "WMI", "(", ")", "comp", "=", "conn", ".", "Win32_ComputerSystem", "(", ")", "[", "0", "]", "return",...
Set the hostname of the windows minion, requires a restart before this will be updated. .. versionadded:: 2016.3.0 Args: hostname (str): The hostname to set Returns: bool: ``True`` if successful, otherwise ``False`` CLI Example: .. code-block:: bash salt 'minion-id'...
[ "Set", "the", "hostname", "of", "the", "windows", "minion", "requires", "a", "restart", "before", "this", "will", "be", "updated", "." ]
python
train
TrafficSenseMSD/SumoTools
sumolib/__init__.py
https://github.com/TrafficSenseMSD/SumoTools/blob/8607b4f885f1d1798e43240be643efe6dccccdaa/sumolib/__init__.py#L198-L206
def flush(self): """flushes all file contents to disc""" for fp in self.files: fp.flush() if isinstance(fp, int) or hasattr(fp, "fileno"): try: os.fsync(fp) except OSError: pass
[ "def", "flush", "(", "self", ")", ":", "for", "fp", "in", "self", ".", "files", ":", "fp", ".", "flush", "(", ")", "if", "isinstance", "(", "fp", ",", "int", ")", "or", "hasattr", "(", "fp", ",", "\"fileno\"", ")", ":", "try", ":", "os", ".", ...
flushes all file contents to disc
[ "flushes", "all", "file", "contents", "to", "disc" ]
python
train
job/aggregate6
aggregate6/aggregate6.py
https://github.com/job/aggregate6/blob/fa93046a39e397795d6258ea4c46033dee3df69b/aggregate6/aggregate6.py#L44-L61
def aggregate(l): """Aggregate a `list` of prefixes. Keyword arguments: l -- a python list of prefixes Example use: >>> aggregate(["10.0.0.0/8", "10.0.0.0/24"]) ['10.0.0.0/8'] """ tree = radix.Radix() for item in l: try: tree.add(item) except (ValueError...
[ "def", "aggregate", "(", "l", ")", ":", "tree", "=", "radix", ".", "Radix", "(", ")", "for", "item", "in", "l", ":", "try", ":", "tree", ".", "add", "(", "item", ")", "except", "(", "ValueError", ")", "as", "err", ":", "raise", "Exception", "(", ...
Aggregate a `list` of prefixes. Keyword arguments: l -- a python list of prefixes Example use: >>> aggregate(["10.0.0.0/8", "10.0.0.0/24"]) ['10.0.0.0/8']
[ "Aggregate", "a", "list", "of", "prefixes", "." ]
python
valid
log2timeline/plaso
plaso/cli/helpers/extraction.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/cli/helpers/extraction.py#L51-L76
def ParseOptions(cls, options, configuration_object): """Parses and validates options. Args: options (argparse.Namespace): parser options. configuration_object (CLITool): object to be configured by the argument helper. Raises: BadConfigObject: when the configuration object is o...
[ "def", "ParseOptions", "(", "cls", ",", "options", ",", "configuration_object", ")", ":", "if", "not", "isinstance", "(", "configuration_object", ",", "tools", ".", "CLITool", ")", ":", "raise", "errors", ".", "BadConfigObject", "(", "'Configuration object is not ...
Parses and validates options. Args: options (argparse.Namespace): parser options. configuration_object (CLITool): object to be configured by the argument helper. Raises: BadConfigObject: when the configuration object is of the wrong type.
[ "Parses", "and", "validates", "options", "." ]
python
train
cdeboever3/cdpybio
cdpybio/star.py
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/star.py#L137-L200
def _make_sj_out_panel(sj_outD, total_jxn_cov_cutoff=20): """Filter junctions from many sj_out files and make panel. Parameters ---------- sj_outD : dict Dict whose keys are sample names and values are sj_out dataframes total_jxn_cov_cutoff : int If the unique read coverage of a ju...
[ "def", "_make_sj_out_panel", "(", "sj_outD", ",", "total_jxn_cov_cutoff", "=", "20", ")", ":", "# num_jxns = dict()", "# # set of all junctions", "# jxnS = reduce(lambda x,y: set(x) | set(y),", "# [ sj_outD[k].index for k in sj_outD.keys() ])", "# jxn_keepS = set()", "# j...
Filter junctions from many sj_out files and make panel. Parameters ---------- sj_outD : dict Dict whose keys are sample names and values are sj_out dataframes total_jxn_cov_cutoff : int If the unique read coverage of a junction summed over all samples is not greater than or equ...
[ "Filter", "junctions", "from", "many", "sj_out", "files", "and", "make", "panel", "." ]
python
train
fermiPy/fermipy
fermipy/model_utils.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/model_utils.py#L41-L65
def get_function_spec(name): """Return a dictionary with the specification of a function: parameter names and defaults (value, bounds, scale, etc.). Returns ------- par_names : list List of parameter names for this function. norm_par : str Name of normalization parameter. ...
[ "def", "get_function_spec", "(", "name", ")", ":", "if", "not", "hasattr", "(", "get_function_spec", ",", "'fndict'", ")", ":", "modelfile", "=", "os", ".", "path", ".", "join", "(", "'$FERMIPY_ROOT'", ",", "'data'", ",", "'models.yaml'", ")", "modelfile", ...
Return a dictionary with the specification of a function: parameter names and defaults (value, bounds, scale, etc.). Returns ------- par_names : list List of parameter names for this function. norm_par : str Name of normalization parameter. default : dict Parameter def...
[ "Return", "a", "dictionary", "with", "the", "specification", "of", "a", "function", ":", "parameter", "names", "and", "defaults", "(", "value", "bounds", "scale", "etc", ".", ")", "." ]
python
train
mikedh/trimesh
trimesh/path/exchange/misc.py
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/path/exchange/misc.py#L151-L181
def faces_to_path(mesh, face_ids=None, **kwargs): """ Given a mesh and face indices find the outline edges and turn them into a Path3D. Parameters --------- mesh : trimesh.Trimesh Triangulated surface in 3D face_ids : (n,) int Indexes referencing mesh.faces Returns ----...
[ "def", "faces_to_path", "(", "mesh", ",", "face_ids", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "face_ids", "is", "None", ":", "edges", "=", "mesh", ".", "edges_sorted", "else", ":", "# take advantage of edge ordering to index as single row", "edges"...
Given a mesh and face indices find the outline edges and turn them into a Path3D. Parameters --------- mesh : trimesh.Trimesh Triangulated surface in 3D face_ids : (n,) int Indexes referencing mesh.faces Returns --------- kwargs : dict Kwargs for Path3D constructor
[ "Given", "a", "mesh", "and", "face", "indices", "find", "the", "outline", "edges", "and", "turn", "them", "into", "a", "Path3D", "." ]
python
train
marrow/WebCore
web/core/application.py
https://github.com/marrow/WebCore/blob/38d50f8022ca62976a1e5ff23f7714bd647b6532/web/core/application.py#L108-L147
def _configure(self, config): """Prepare the incoming configuration and ensure certain expected values are present. For example, this ensures BaseExtension is included in the extension list, and populates the logging config. """ config = config or dict() # We really need this to be there. if 'extensio...
[ "def", "_configure", "(", "self", ",", "config", ")", ":", "config", "=", "config", "or", "dict", "(", ")", "# We really need this to be there.", "if", "'extensions'", "not", "in", "config", ":", "config", "[", "'extensions'", "]", "=", "list", "(", ")", "...
Prepare the incoming configuration and ensure certain expected values are present. For example, this ensures BaseExtension is included in the extension list, and populates the logging config.
[ "Prepare", "the", "incoming", "configuration", "and", "ensure", "certain", "expected", "values", "are", "present", ".", "For", "example", "this", "ensures", "BaseExtension", "is", "included", "in", "the", "extension", "list", "and", "populates", "the", "logging", ...
python
train
CityOfZion/neo-python
neo/Wallets/Wallet.py
https://github.com/CityOfZion/neo-python/blob/fe90f62e123d720d4281c79af0598d9df9e776fb/neo/Wallets/Wallet.py#L135-L150
def AddContract(self, contract): """ Add a contract to the wallet. Args: contract (Contract): a contract of type neo.SmartContract.Contract. Raises: Exception: Invalid operation - public key mismatch. """ if not contract.PublicKeyHash.ToBytes() i...
[ "def", "AddContract", "(", "self", ",", "contract", ")", ":", "if", "not", "contract", ".", "PublicKeyHash", ".", "ToBytes", "(", ")", "in", "self", ".", "_keys", ".", "keys", "(", ")", ":", "raise", "Exception", "(", "'Invalid operation - public key mismatc...
Add a contract to the wallet. Args: contract (Contract): a contract of type neo.SmartContract.Contract. Raises: Exception: Invalid operation - public key mismatch.
[ "Add", "a", "contract", "to", "the", "wallet", "." ]
python
train
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_0/identity/identity_client.py
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_0/identity/identity_client.py#L73-L83
def delete_group(self, group_id): """DeleteGroup. :param str group_id: """ route_values = {} if group_id is not None: route_values['groupId'] = self._serialize.url('group_id', group_id, 'str') self._send(http_method='DELETE', location_id='59...
[ "def", "delete_group", "(", "self", ",", "group_id", ")", ":", "route_values", "=", "{", "}", "if", "group_id", "is", "not", "None", ":", "route_values", "[", "'groupId'", "]", "=", "self", ".", "_serialize", ".", "url", "(", "'group_id'", ",", "group_id...
DeleteGroup. :param str group_id:
[ "DeleteGroup", ".", ":", "param", "str", "group_id", ":" ]
python
train
etobella/python-xmlsig
src/xmlsig/utils.py
https://github.com/etobella/python-xmlsig/blob/120a50935a4d4c2c972cfa3f8519bbce7e30d67b/src/xmlsig/utils.py#L85-L102
def create_node(name, parent=None, ns='', tail=False, text=False): """ Creates a new node :param name: Node name :param parent: Node parent :param ns: Namespace to use :param tail: Tail to add :param text: Text of the node :return: New node """ node = etree.Element(etree.QName(ns...
[ "def", "create_node", "(", "name", ",", "parent", "=", "None", ",", "ns", "=", "''", ",", "tail", "=", "False", ",", "text", "=", "False", ")", ":", "node", "=", "etree", ".", "Element", "(", "etree", ".", "QName", "(", "ns", ",", "name", ")", ...
Creates a new node :param name: Node name :param parent: Node parent :param ns: Namespace to use :param tail: Tail to add :param text: Text of the node :return: New node
[ "Creates", "a", "new", "node", ":", "param", "name", ":", "Node", "name", ":", "param", "parent", ":", "Node", "parent", ":", "param", "ns", ":", "Namespace", "to", "use", ":", "param", "tail", ":", "Tail", "to", "add", ":", "param", "text", ":", "...
python
train
binilinlquad/bing-search-api
bing_search_api/api.py
https://github.com/binilinlquad/bing-search-api/blob/c3a296ad7d0050dc929eda9d9760df5c15faa51a/bing_search_api/api.py#L62-L71
def search_composite(self, query, source, payload=None): '''Shortcut search with composite source''' source = '+'.join(source) if payload is None: payload = dict(Sources=quote(source)) else: payload['Sources'] = quote(source) return self.search(query, 'C...
[ "def", "search_composite", "(", "self", ",", "query", ",", "source", ",", "payload", "=", "None", ")", ":", "source", "=", "'+'", ".", "join", "(", "source", ")", "if", "payload", "is", "None", ":", "payload", "=", "dict", "(", "Sources", "=", "quote...
Shortcut search with composite source
[ "Shortcut", "search", "with", "composite", "source" ]
python
train
bcbio/bcbio-nextgen
bcbio/cwl/defs.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/defs.py#L511-L602
def _variant_sv(checkpoints): """Structural variant workflow. """ if not checkpoints.get("sv"): return [], [] sv = [s("detect_sv", "batch-single", [["sv_batch_rec"]], [cwlout("sv_rec", "record", fields=[cwlout(["sv", "variantcaller"], ["string", "null"...
[ "def", "_variant_sv", "(", "checkpoints", ")", ":", "if", "not", "checkpoints", ".", "get", "(", "\"sv\"", ")", ":", "return", "[", "]", ",", "[", "]", "sv", "=", "[", "s", "(", "\"detect_sv\"", ",", "\"batch-single\"", ",", "[", "[", "\"sv_batch_rec\"...
Structural variant workflow.
[ "Structural", "variant", "workflow", "." ]
python
train
cltk/cltk
cltk/lemmatize/french/lemma.py
https://github.com/cltk/cltk/blob/ed9c025b7ec43c949481173251b70e05e4dffd27/cltk/lemmatize/french/lemma.py#L46-L74
def lemmatize(self, tokens): """define list of lemmas""" entries = self.entries forms_and_lemmas = self.forms_and_lemmas lemma_list = [x[0] for x in entries] """Provide a lemma for each token""" lemmatized = [] for token in tokens: """check for a matc...
[ "def", "lemmatize", "(", "self", ",", "tokens", ")", ":", "entries", "=", "self", ".", "entries", "forms_and_lemmas", "=", "self", ".", "forms_and_lemmas", "lemma_list", "=", "[", "x", "[", "0", "]", "for", "x", "in", "entries", "]", "\"\"\"Provide a lemma...
define list of lemmas
[ "define", "list", "of", "lemmas" ]
python
train
ladybug-tools/ladybug
ladybug/datacollection.py
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/datacollection.py#L903-L916
def _check_values(self, values): """Check values whenever they come through the values setter.""" assert isinstance(values, Iterable) and not isinstance( values, (str, dict, bytes, bytearray)), \ 'values should be a list or tuple. Got {}'.format(type(values)) if self.head...
[ "def", "_check_values", "(", "self", ",", "values", ")", ":", "assert", "isinstance", "(", "values", ",", "Iterable", ")", "and", "not", "isinstance", "(", "values", ",", "(", "str", ",", "dict", ",", "bytes", ",", "bytearray", ")", ")", ",", "'values ...
Check values whenever they come through the values setter.
[ "Check", "values", "whenever", "they", "come", "through", "the", "values", "setter", "." ]
python
train
saltstack/salt
salt/cloud/clouds/opennebula.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/opennebula.py#L4586-L4605
def _xml_to_dict(xml): ''' Helper function to covert xml into a data dictionary. xml The xml data to convert. ''' dicts = {} for item in xml: key = item.tag.lower() idx = 1 while key in dicts: key += six.text_type(idx) idx += 1 if ...
[ "def", "_xml_to_dict", "(", "xml", ")", ":", "dicts", "=", "{", "}", "for", "item", "in", "xml", ":", "key", "=", "item", ".", "tag", ".", "lower", "(", ")", "idx", "=", "1", "while", "key", "in", "dicts", ":", "key", "+=", "six", ".", "text_ty...
Helper function to covert xml into a data dictionary. xml The xml data to convert.
[ "Helper", "function", "to", "covert", "xml", "into", "a", "data", "dictionary", "." ]
python
train
openstack/horizon
horizon/tables/views.py
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/tables/views.py#L175-L188
def update_server_filter_action(self, request, table=None): """Update the table server side filter action. It is done based on the current filter. The filter info may be stored in the session and this will restore it. """ if not table: table = self.get_table() ...
[ "def", "update_server_filter_action", "(", "self", ",", "request", ",", "table", "=", "None", ")", ":", "if", "not", "table", ":", "table", "=", "self", ".", "get_table", "(", ")", "filter_info", "=", "self", ".", "get_server_filter_info", "(", "request", ...
Update the table server side filter action. It is done based on the current filter. The filter info may be stored in the session and this will restore it.
[ "Update", "the", "table", "server", "side", "filter", "action", "." ]
python
train
grahame/dividebatur
dividebatur/counter.py
https://github.com/grahame/dividebatur/blob/adc1f6e8013943471f1679e3c94f9448a1e4a472/dividebatur/counter.py#L301-L311
def get_initial_totals(self): "determine the initial total for each candidate. only call this at the start of round 1" candidate_votes = {} # initialise to zero for every individual candidate for candidate_id in self.candidate_ids: candidate_votes[candidate_id] = 0 fo...
[ "def", "get_initial_totals", "(", "self", ")", ":", "candidate_votes", "=", "{", "}", "# initialise to zero for every individual candidate", "for", "candidate_id", "in", "self", ".", "candidate_ids", ":", "candidate_votes", "[", "candidate_id", "]", "=", "0", "for", ...
determine the initial total for each candidate. only call this at the start of round 1
[ "determine", "the", "initial", "total", "for", "each", "candidate", ".", "only", "call", "this", "at", "the", "start", "of", "round", "1" ]
python
train
kennethreitz/requests-html
requests_html.py
https://github.com/kennethreitz/requests-html/blob/b59a9f2fb9333d7d467154a0fd82978efdb9d23b/requests_html.py#L541-L610
def render(self, retries: int = 8, script: str = None, wait: float = 0.2, scrolldown=False, sleep: int = 0, reload: bool = True, timeout: Union[float, int] = 8.0, keep_page: bool = False): """Reloads the response in Chromium, and replaces HTML content with an updated version, with JavaScript executed. ...
[ "def", "render", "(", "self", ",", "retries", ":", "int", "=", "8", ",", "script", ":", "str", "=", "None", ",", "wait", ":", "float", "=", "0.2", ",", "scrolldown", "=", "False", ",", "sleep", ":", "int", "=", "0", ",", "reload", ":", "bool", ...
Reloads the response in Chromium, and replaces HTML content with an updated version, with JavaScript executed. :param retries: The number of times to retry loading the page in Chromium. :param script: JavaScript to execute upon page load (optional). :param wait: The number of seconds to...
[ "Reloads", "the", "response", "in", "Chromium", "and", "replaces", "HTML", "content", "with", "an", "updated", "version", "with", "JavaScript", "executed", "." ]
python
train
phoebe-project/phoebe2
phoebe/backend/universe.py
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L2874-L2894
def pointing_vector(self, s, time): """ s is the spin vector in roche coordinates time is the current time """ t = time - self._t0 longitude = self._longitude + self._dlongdt * t # define the basis vectors in the spin (primed) coordinates in terms of # th...
[ "def", "pointing_vector", "(", "self", ",", "s", ",", "time", ")", ":", "t", "=", "time", "-", "self", ".", "_t0", "longitude", "=", "self", ".", "_longitude", "+", "self", ".", "_dlongdt", "*", "t", "# define the basis vectors in the spin (primed) coordinates...
s is the spin vector in roche coordinates time is the current time
[ "s", "is", "the", "spin", "vector", "in", "roche", "coordinates", "time", "is", "the", "current", "time" ]
python
train
sporteasy/python-poeditor
poeditor/client.py
https://github.com/sporteasy/python-poeditor/blob/e9c0a8ab08816903122f730b73ffaab46601076c/poeditor/client.py#L232-L240
def view_project_details(self, project_id): """ Returns project's details. """ data = self._run( url_path="projects/view", id=project_id ) return self._project_formatter(data['result']['project'])
[ "def", "view_project_details", "(", "self", ",", "project_id", ")", ":", "data", "=", "self", ".", "_run", "(", "url_path", "=", "\"projects/view\"", ",", "id", "=", "project_id", ")", "return", "self", ".", "_project_formatter", "(", "data", "[", "'result'"...
Returns project's details.
[ "Returns", "project", "s", "details", "." ]
python
train
lins05/slackbot
slackbot/dispatcher.py
https://github.com/lins05/slackbot/blob/7195d46b9e1dc4ecfae0bdcaa91461202689bfe5/slackbot/dispatcher.py#L173-L185
def unicode_compact(func): """ Make sure the first parameter of the decorated method to be a unicode object. """ @wraps(func) def wrapped(self, text, *a, **kw): if not isinstance(text, six.text_type): text = text.decode('utf-8') return func(self, text, *a, **kw) ...
[ "def", "unicode_compact", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapped", "(", "self", ",", "text", ",", "*", "a", ",", "*", "*", "kw", ")", ":", "if", "not", "isinstance", "(", "text", ",", "six", ".", "text_type", ")", ...
Make sure the first parameter of the decorated method to be a unicode object.
[ "Make", "sure", "the", "first", "parameter", "of", "the", "decorated", "method", "to", "be", "a", "unicode", "object", "." ]
python
train
indico/indico-plugins
piwik/indico_piwik/queries/graphs.py
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/piwik/indico_piwik/queries/graphs.py#L36-L48
def get_result(self): """Perform the call and return the graph data :return: Encoded PNG graph data string to be inserted in a `src` atribute of a HTML img tag. """ png = self.call() if png is None: return if png.startswith('GD extension must...
[ "def", "get_result", "(", "self", ")", ":", "png", "=", "self", ".", "call", "(", ")", "if", "png", "is", "None", ":", "return", "if", "png", ".", "startswith", "(", "'GD extension must be loaded'", ")", ":", "current_plugin", ".", "logger", ".", "warnin...
Perform the call and return the graph data :return: Encoded PNG graph data string to be inserted in a `src` atribute of a HTML img tag.
[ "Perform", "the", "call", "and", "return", "the", "graph", "data" ]
python
train
tensorflow/tensor2tensor
tensor2tensor/models/research/moe_experiments.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/moe_experiments.py#L64-L79
def xmoe_tr_1d(): """Mixture of experts (16 experts). 623M Params, einsum=1.09e13 Returns: a hparams """ hparams = xmoe_tr_dense_2k() hparams.encoder_layers = ["self_att", "moe_1d"] * 4 hparams.decoder_layers = ["self_att", "enc_att", "moe_1d"] * 4 hparams.layout = "batch:batch;experts:batch" h...
[ "def", "xmoe_tr_1d", "(", ")", ":", "hparams", "=", "xmoe_tr_dense_2k", "(", ")", "hparams", ".", "encoder_layers", "=", "[", "\"self_att\"", ",", "\"moe_1d\"", "]", "*", "4", "hparams", ".", "decoder_layers", "=", "[", "\"self_att\"", ",", "\"enc_att\"", ",...
Mixture of experts (16 experts). 623M Params, einsum=1.09e13 Returns: a hparams
[ "Mixture", "of", "experts", "(", "16", "experts", ")", "." ]
python
train
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/classtracker.py
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/classtracker.py#L298-L324
def _inject_constructor(self, cls, func, name, resolution_level, keep, trace): """ Modifying Methods in Place - after the recipe 15.7 in the Python Cookbook by Ken Seehof. The original constructors may be restored later. """ try: co...
[ "def", "_inject_constructor", "(", "self", ",", "cls", ",", "func", ",", "name", ",", "resolution_level", ",", "keep", ",", "trace", ")", ":", "try", ":", "constructor", "=", "cls", ".", "__init__", "except", "AttributeError", ":", "def", "constructor", "(...
Modifying Methods in Place - after the recipe 15.7 in the Python Cookbook by Ken Seehof. The original constructors may be restored later.
[ "Modifying", "Methods", "in", "Place", "-", "after", "the", "recipe", "15", ".", "7", "in", "the", "Python", "Cookbook", "by", "Ken", "Seehof", ".", "The", "original", "constructors", "may", "be", "restored", "later", "." ]
python
train
shoebot/shoebot
lib/web/wikipedia.py
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/wikipedia.py#L775-L792
def parse_gallery_images(self, markup): """ Parses images from the <gallery></gallery> section. Images inside <gallery> tags do not have outer "[[" brackets. Add these and then parse again. """ gallery = re.search(self.re["gallery"], markup) ...
[ "def", "parse_gallery_images", "(", "self", ",", "markup", ")", ":", "gallery", "=", "re", ".", "search", "(", "self", ".", "re", "[", "\"gallery\"", "]", ",", "markup", ")", "if", "gallery", ":", "gallery", "=", "gallery", ".", "group", "(", "1", ")...
Parses images from the <gallery></gallery> section. Images inside <gallery> tags do not have outer "[[" brackets. Add these and then parse again.
[ "Parses", "images", "from", "the", "<gallery", ">", "<", "/", "gallery", ">", "section", ".", "Images", "inside", "<gallery", ">", "tags", "do", "not", "have", "outer", "[[", "brackets", ".", "Add", "these", "and", "then", "parse", "again", "." ]
python
valid
ff0000/scarlet
scarlet/cms/actions.py
https://github.com/ff0000/scarlet/blob/6c37befd810916a2d7ffff2cdb2dab57bcb6d12e/scarlet/cms/actions.py#L421-L428
def get_object_url(self): """ Returns the url to link to the object The get_view_url will be called on the current bundle using 'edit` as the view name. """ return self.bundle.get_view_url('edit', self.request.user, {}, self.kwargs)
[ "def", "get_object_url", "(", "self", ")", ":", "return", "self", ".", "bundle", ".", "get_view_url", "(", "'edit'", ",", "self", ".", "request", ".", "user", ",", "{", "}", ",", "self", ".", "kwargs", ")" ]
Returns the url to link to the object The get_view_url will be called on the current bundle using 'edit` as the view name.
[ "Returns", "the", "url", "to", "link", "to", "the", "object", "The", "get_view_url", "will", "be", "called", "on", "the", "current", "bundle", "using", "edit", "as", "the", "view", "name", "." ]
python
train
cds-astro/mocpy
mocpy/tmoc/tmoc.py
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/tmoc/tmoc.py#L288-L300
def max_time(self): """ Get the `~astropy.time.Time` time of the tmoc last observation Returns ------- max_time : `~astropy.time.Time` time of the last observation """ max_time = Time(self._interval_set.max / TimeMOC.DAY_MICRO_SEC, format='jd', scal...
[ "def", "max_time", "(", "self", ")", ":", "max_time", "=", "Time", "(", "self", ".", "_interval_set", ".", "max", "/", "TimeMOC", ".", "DAY_MICRO_SEC", ",", "format", "=", "'jd'", ",", "scale", "=", "'tdb'", ")", "return", "max_time" ]
Get the `~astropy.time.Time` time of the tmoc last observation Returns ------- max_time : `~astropy.time.Time` time of the last observation
[ "Get", "the", "~astropy", ".", "time", ".", "Time", "time", "of", "the", "tmoc", "last", "observation" ]
python
train
src-d/jgit-spark-connector
python/sourced/engine/engine.py
https://github.com/src-d/jgit-spark-connector/blob/79d05a0bcf0da435685d6118828a8884e2fe4b94/python/sourced/engine/engine.py#L549-L559
def classify_languages(self): """ Returns a new DataFrame with the language data of any blob added to its row. >>> blobs_lang_df = blobs_df.classify_languages :rtype: BlobsWithLanguageDataFrame """ return BlobsWithLanguageDataFrame(self._engine_dataframe.classif...
[ "def", "classify_languages", "(", "self", ")", ":", "return", "BlobsWithLanguageDataFrame", "(", "self", ".", "_engine_dataframe", ".", "classifyLanguages", "(", ")", ",", "self", ".", "_session", ",", "self", ".", "_implicits", ")" ]
Returns a new DataFrame with the language data of any blob added to its row. >>> blobs_lang_df = blobs_df.classify_languages :rtype: BlobsWithLanguageDataFrame
[ "Returns", "a", "new", "DataFrame", "with", "the", "language", "data", "of", "any", "blob", "added", "to", "its", "row", "." ]
python
train
JoeVirtual/KonFoo
konfoo/core.py
https://github.com/JoeVirtual/KonFoo/blob/0c62ef5c2bed4deaf908b34082e4de2544532fdc/konfoo/core.py#L1220-L1235
def container_size(self): """ Returns the accumulated bit size of all fields in the `Sequence` as a tuple in the form of ``(number of bytes, remaining number of bits)``. """ length = 0 for name, item in enumerate(self): # Container if is_container(item): ...
[ "def", "container_size", "(", "self", ")", ":", "length", "=", "0", "for", "name", ",", "item", "in", "enumerate", "(", "self", ")", ":", "# Container", "if", "is_container", "(", "item", ")", ":", "byte_length", ",", "bit_length", "=", "item", ".", "c...
Returns the accumulated bit size of all fields in the `Sequence` as a tuple in the form of ``(number of bytes, remaining number of bits)``.
[ "Returns", "the", "accumulated", "bit", "size", "of", "all", "fields", "in", "the", "Sequence", "as", "a", "tuple", "in", "the", "form", "of", "(", "number", "of", "bytes", "remaining", "number", "of", "bits", ")", "." ]
python
train
iotile/coretools
transport_plugins/websocket/iotile_transport_websocket/generic/async_server.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/websocket/iotile_transport_websocket/generic/async_server.py#L191-L209
async def send_event(self, con, name, payload): """Send an event to a client connection. This method will push an event message to the client with the given name and payload. You need to have access to the the ``connection`` object for the client, which is only available once the clien...
[ "async", "def", "send_event", "(", "self", ",", "con", ",", "name", ",", "payload", ")", ":", "message", "=", "dict", "(", "type", "=", "\"event\"", ",", "name", "=", "name", ",", "payload", "=", "payload", ")", "encoded", "=", "pack", "(", "message"...
Send an event to a client connection. This method will push an event message to the client with the given name and payload. You need to have access to the the ``connection`` object for the client, which is only available once the client has connected and passed to self.prepare_conn(con...
[ "Send", "an", "event", "to", "a", "client", "connection", "." ]
python
train
BerkeleyAutomation/perception
perception/cnn.py
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/cnn.py#L95-L129
def _load(self): """ Loads a model into weights """ if self._model_filename is None: raise ValueError('Model filename not specified') # read the input image self._graph = tf.Graph() with self._graph.as_default(): # read in filenames reader = t...
[ "def", "_load", "(", "self", ")", ":", "if", "self", ".", "_model_filename", "is", "None", ":", "raise", "ValueError", "(", "'Model filename not specified'", ")", "# read the input image", "self", ".", "_graph", "=", "tf", ".", "Graph", "(", ")", "with", "se...
Loads a model into weights
[ "Loads", "a", "model", "into", "weights" ]
python
train
offu/WeRoBot
werobot/client.py
https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L937-L966
def send_miniprogrampage_message( self, user_id, title, appid, pagepath, thumb_media_id, kf_account=None ): """ 发送小程序卡片(要求小程序与公众号已关联) :param user_id: 用户 ID 。 就是你收到的 `Message` 的 source :param title: 小程序卡片的标题 :param appid: 小程序的 appid,要求小程序的 appid 需要与公众号有关联关系 :p...
[ "def", "send_miniprogrampage_message", "(", "self", ",", "user_id", ",", "title", ",", "appid", ",", "pagepath", ",", "thumb_media_id", ",", "kf_account", "=", "None", ")", ":", "data", "=", "{", "\"touser\"", ":", "user_id", ",", "\"msgtype\"", ":", "\"mini...
发送小程序卡片(要求小程序与公众号已关联) :param user_id: 用户 ID 。 就是你收到的 `Message` 的 source :param title: 小程序卡片的标题 :param appid: 小程序的 appid,要求小程序的 appid 需要与公众号有关联关系 :param pagepath: 小程序的页面路径,跟 app.json 对齐,支持参数,比如 pages/index/index?foo=bar :param thumb_media_id: 小程序卡片图片的媒体 ID,小程序卡片图片建议大小为 520*416 ...
[ "发送小程序卡片(要求小程序与公众号已关联)" ]
python
train
saltstack/salt
salt/modules/smartos_vmadm.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L752-L790
def update(vm, from_file=None, key='uuid', **kwargs): ''' Update a new vm vm : string vm to be updated from_file : string json file to update the vm with -- if present, all other options will be ignored key : string [uuid|alias|hostname] value type of 'vm' parameter kwar...
[ "def", "update", "(", "vm", ",", "from_file", "=", "None", ",", "key", "=", "'uuid'", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "}", "# prepare vmcfg", "vmcfg", "=", "{", "}", "kwargs", "=", "salt", ".", "utils", ".", "args", ".", "clea...
Update a new vm vm : string vm to be updated from_file : string json file to update the vm with -- if present, all other options will be ignored key : string [uuid|alias|hostname] value type of 'vm' parameter kwargs : string|int|... options to update for the vm CLI ...
[ "Update", "a", "new", "vm" ]
python
train
astroduff/commah
commah/commah.py
https://github.com/astroduff/commah/blob/3ec70338c5123a053c79ddcf2cb3beac26bc9137/commah/commah.py#L219-L235
def _int_growth(z, **cosmo): """ Returns integral of the linear growth factor from z=200 to z=z """ zmax = 200 if hasattr(z, "__len__"): for zval in z: assert(zval < zmax) else: assert(z < zmax) y, yerr = scipy.integrate.quad( lambda z: (1 + z)/(cosmo['omega_M_...
[ "def", "_int_growth", "(", "z", ",", "*", "*", "cosmo", ")", ":", "zmax", "=", "200", "if", "hasattr", "(", "z", ",", "\"__len__\"", ")", ":", "for", "zval", "in", "z", ":", "assert", "(", "zval", "<", "zmax", ")", "else", ":", "assert", "(", "...
Returns integral of the linear growth factor from z=200 to z=z
[ "Returns", "integral", "of", "the", "linear", "growth", "factor", "from", "z", "=", "200", "to", "z", "=", "z" ]
python
train
DEIB-GECO/PyGMQL
gmql/dataset/GMQLDataset.py
https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L1133-L1182
def union(self, other, left_name="LEFT", right_name="RIGHT"): """ *Wrapper of* ``UNION`` The UNION operation is used to integrate homogeneous or heterogeneous samples of two datasets within a single dataset; for each sample of either one of the input datasets, a sample is create...
[ "def", "union", "(", "self", ",", "other", ",", "left_name", "=", "\"LEFT\"", ",", "right_name", "=", "\"RIGHT\"", ")", ":", "if", "not", "isinstance", "(", "left_name", ",", "str", ")", "or", "not", "isinstance", "(", "right_name", ",", "str", ")", ":...
*Wrapper of* ``UNION`` The UNION operation is used to integrate homogeneous or heterogeneous samples of two datasets within a single dataset; for each sample of either one of the input datasets, a sample is created in the result as follows: * its metadata are the same as in...
[ "*", "Wrapper", "of", "*", "UNION" ]
python
train
glamp/bashplotlib
bashplotlib/utils/helpers.py
https://github.com/glamp/bashplotlib/blob/f7533172c4dc912b5accae42edd5c0f655d7468f/bashplotlib/utils/helpers.py#L36-L44
def printcolour(text, sameline=False, colour=get_colour("ENDC")): """ Print color text using escape codes """ if sameline: sep = '' else: sep = '\n' sys.stdout.write(get_colour(colour) + text + bcolours["ENDC"] + sep)
[ "def", "printcolour", "(", "text", ",", "sameline", "=", "False", ",", "colour", "=", "get_colour", "(", "\"ENDC\"", ")", ")", ":", "if", "sameline", ":", "sep", "=", "''", "else", ":", "sep", "=", "'\\n'", "sys", ".", "stdout", ".", "write", "(", ...
Print color text using escape codes
[ "Print", "color", "text", "using", "escape", "codes" ]
python
train
facelessuser/soupsieve
soupsieve/css_parser.py
https://github.com/facelessuser/soupsieve/blob/24859cc3e756ebf46b75547d49c6b4a7bf35ee82/soupsieve/css_parser.py#L754-L794
def parse_has_combinator(self, sel, m, has_selector, selectors, rel_type, index): """Parse combinator tokens.""" combinator = m.group('relation').strip() if not combinator: combinator = WS_COMBINATOR if combinator == COMMA_COMBINATOR: if not has_selector: ...
[ "def", "parse_has_combinator", "(", "self", ",", "sel", ",", "m", ",", "has_selector", ",", "selectors", ",", "rel_type", ",", "index", ")", ":", "combinator", "=", "m", ".", "group", "(", "'relation'", ")", ".", "strip", "(", ")", "if", "not", "combin...
Parse combinator tokens.
[ "Parse", "combinator", "tokens", "." ]
python
train
CityOfZion/neo-python
neo/Core/TX/Transaction.py
https://github.com/CityOfZion/neo-python/blob/fe90f62e123d720d4281c79af0598d9df9e776fb/neo/Core/TX/Transaction.py#L419-L429
def Deserialize(self, reader): """ Deserialize full object. Args: reader (neo.IO.BinaryReader): """ self.DeserializeUnsigned(reader) self.scripts = reader.ReadSerializableArray() self.OnDeserialized()
[ "def", "Deserialize", "(", "self", ",", "reader", ")", ":", "self", ".", "DeserializeUnsigned", "(", "reader", ")", "self", ".", "scripts", "=", "reader", ".", "ReadSerializableArray", "(", ")", "self", ".", "OnDeserialized", "(", ")" ]
Deserialize full object. Args: reader (neo.IO.BinaryReader):
[ "Deserialize", "full", "object", "." ]
python
train
aleju/imgaug
imgaug/augmentables/polys.py
https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L950-L971
def deepcopy(self, exterior=None, label=None): """ Create a deep copy of the Polygon object. Parameters ---------- exterior : list of Keypoint or list of tuple or (N,2) ndarray, optional List of points defining the polygon. See `imgaug.Polygon.__init__` for details. ...
[ "def", "deepcopy", "(", "self", ",", "exterior", "=", "None", ",", "label", "=", "None", ")", ":", "return", "Polygon", "(", "exterior", "=", "np", ".", "copy", "(", "self", ".", "exterior", ")", "if", "exterior", "is", "None", "else", "exterior", ",...
Create a deep copy of the Polygon object. Parameters ---------- exterior : list of Keypoint or list of tuple or (N,2) ndarray, optional List of points defining the polygon. See `imgaug.Polygon.__init__` for details. label : None or str If not None, then the labe...
[ "Create", "a", "deep", "copy", "of", "the", "Polygon", "object", "." ]
python
valid
IAMconsortium/pyam
pyam/timeseries.py
https://github.com/IAMconsortium/pyam/blob/4077929ca6e7be63a0e3ecf882c5f1da97b287bf/pyam/timeseries.py#L10-L32
def fill_series(x, year): """Returns the value of a timeseries (indexed over years) for a year by linear interpolation. Parameters ---------- x: pandas.Series a timeseries to be interpolated year: int year of interpolation """ x = x.dropna() if year in x.index and no...
[ "def", "fill_series", "(", "x", ",", "year", ")", ":", "x", "=", "x", ".", "dropna", "(", ")", "if", "year", "in", "x", ".", "index", "and", "not", "np", ".", "isnan", "(", "x", "[", "year", "]", ")", ":", "return", "x", "[", "year", "]", "...
Returns the value of a timeseries (indexed over years) for a year by linear interpolation. Parameters ---------- x: pandas.Series a timeseries to be interpolated year: int year of interpolation
[ "Returns", "the", "value", "of", "a", "timeseries", "(", "indexed", "over", "years", ")", "for", "a", "year", "by", "linear", "interpolation", "." ]
python
train
domainaware/parsedmarc
parsedmarc/__init__.py
https://github.com/domainaware/parsedmarc/blob/ecc9fd434c23d896ccd1f35795ccc047f946ed05/parsedmarc/__init__.py#L211-L339
def parse_aggregate_report_xml(xml, nameservers=None, timeout=2.0, parallel=False): """Parses a DMARC XML report string and returns a consistent OrderedDict Args: xml (str): A string of DMARC aggregate report XML nameservers (list): A list of one or more nameserve...
[ "def", "parse_aggregate_report_xml", "(", "xml", ",", "nameservers", "=", "None", ",", "timeout", "=", "2.0", ",", "parallel", "=", "False", ")", ":", "errors", "=", "[", "]", "try", ":", "xmltodict", ".", "parse", "(", "xml", ")", "[", "\"feedback\"", ...
Parses a DMARC XML report string and returns a consistent OrderedDict Args: xml (str): A string of DMARC aggregate report XML nameservers (list): A list of one or more nameservers to use (Cloudflare's public DNS resolvers by default) timeout (float): Sets the DNS timeout in seconds ...
[ "Parses", "a", "DMARC", "XML", "report", "string", "and", "returns", "a", "consistent", "OrderedDict" ]
python
test
jaraco/jaraco.text
jaraco/text.py
https://github.com/jaraco/jaraco.text/blob/0fe070e9241cb1fdb737516a3f57da94a2618376/jaraco/text.py#L368-L375
def common_prefix(s1, s2): """ Return the common prefix of two lines. """ index = min(len(s1), len(s2)) while s1[:index] != s2[:index]: index -= 1 return s1[:index]
[ "def", "common_prefix", "(", "s1", ",", "s2", ")", ":", "index", "=", "min", "(", "len", "(", "s1", ")", ",", "len", "(", "s2", ")", ")", "while", "s1", "[", ":", "index", "]", "!=", "s2", "[", ":", "index", "]", ":", "index", "-=", "1", "r...
Return the common prefix of two lines.
[ "Return", "the", "common", "prefix", "of", "two", "lines", "." ]
python
train
kevinconway/venvctrl
venvctrl/venv/base.py
https://github.com/kevinconway/venvctrl/blob/36d4e0e4d5ebced6385a6ade1198f4769ff2df41/venvctrl/venv/base.py#L125-L129
def dirs(self): """Get an iter of VenvDirs within the directory.""" contents = self.paths contents = (VenvDir(path.path) for path in contents if path.is_dir) return contents
[ "def", "dirs", "(", "self", ")", ":", "contents", "=", "self", ".", "paths", "contents", "=", "(", "VenvDir", "(", "path", ".", "path", ")", "for", "path", "in", "contents", "if", "path", ".", "is_dir", ")", "return", "contents" ]
Get an iter of VenvDirs within the directory.
[ "Get", "an", "iter", "of", "VenvDirs", "within", "the", "directory", "." ]
python
train
QUANTAXIS/QUANTAXIS
QUANTAXIS/QAARP/QAAccount.py
https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/QAAccount.py#L1850-L1857
def change_cash(self, money): """ 外部操作|高危| """ res = self.cash[-1] + money if res >= 0: # 高危操作 self.cash[-1] = res
[ "def", "change_cash", "(", "self", ",", "money", ")", ":", "res", "=", "self", ".", "cash", "[", "-", "1", "]", "+", "money", "if", "res", ">=", "0", ":", "# 高危操作", "self", ".", "cash", "[", "-", "1", "]", "=", "res" ]
外部操作|高危|
[ "外部操作|高危|" ]
python
train
Becksteinlab/GromacsWrapper
gromacs/fileformats/xvg.py
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/fileformats/xvg.py#L550-L635
def plot(self, **kwargs): """Plot xvg file data. The first column of the data is always taken as the abscissa X. Additional columns are plotted as ordinates Y1, Y2, ... In the special case that there is only a single column then this column is plotted against the index, i.e. (N...
[ "def", "plot", "(", "self", ",", "*", "*", "kwargs", ")", ":", "columns", "=", "kwargs", ".", "pop", "(", "'columns'", ",", "Ellipsis", ")", "# slice for everything", "maxpoints", "=", "kwargs", ".", "pop", "(", "'maxpoints'", ",", "self", ".", "maxpoint...
Plot xvg file data. The first column of the data is always taken as the abscissa X. Additional columns are plotted as ordinates Y1, Y2, ... In the special case that there is only a single column then this column is plotted against the index, i.e. (N, Y). :Keywords: *...
[ "Plot", "xvg", "file", "data", "." ]
python
valid
zimeon/iiif
iiif/static.py
https://github.com/zimeon/iiif/blob/9d10018d01202fa2a76dfa61598dc6eca07b471f/iiif/static.py#L370-L436
def write_html(self, html_dir='/tmp', include_osd=False, osd_width=500, osd_height=500): """Write HTML test page using OpenSeadragon for the tiles generated. Assumes that the generate(..) method has already been called to set up identifier etc. Parameters: html_dir ...
[ "def", "write_html", "(", "self", ",", "html_dir", "=", "'/tmp'", ",", "include_osd", "=", "False", ",", "osd_width", "=", "500", ",", "osd_height", "=", "500", ")", ":", "osd_config", "=", "self", ".", "get_osd_config", "(", "self", ".", "osd_version", ...
Write HTML test page using OpenSeadragon for the tiles generated. Assumes that the generate(..) method has already been called to set up identifier etc. Parameters: html_dir - output directory for HTML files, will be created if it does not already exist include_...
[ "Write", "HTML", "test", "page", "using", "OpenSeadragon", "for", "the", "tiles", "generated", "." ]
python
train
kwikteam/phy
phy/stats/ccg.py
https://github.com/kwikteam/phy/blob/7e9313dc364304b7d2bd03b92938347343703003/phy/stats/ccg.py#L57-L177
def correlograms(spike_times, spike_clusters, cluster_ids=None, sample_rate=1., bin_size=None, window_size=None, symmetrize=True, ): """Compute all pairwise cross-correlograms among the clusters ap...
[ "def", "correlograms", "(", "spike_times", ",", "spike_clusters", ",", "cluster_ids", "=", "None", ",", "sample_rate", "=", "1.", ",", "bin_size", "=", "None", ",", "window_size", "=", "None", ",", "symmetrize", "=", "True", ",", ")", ":", "assert", "sampl...
Compute all pairwise cross-correlograms among the clusters appearing in `spike_clusters`. Parameters ---------- spike_times : array-like Spike times in seconds. spike_clusters : array-like Spike-cluster mapping. cluster_ids : array-like The list of unique clusters, in a...
[ "Compute", "all", "pairwise", "cross", "-", "correlograms", "among", "the", "clusters", "appearing", "in", "spike_clusters", "." ]
python
train
numenta/nupic
src/nupic/algorithms/backtracking_tm_cpp.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/backtracking_tm_cpp.py#L625-L646
def getSegmentOnCell(self, c, i, segIdx): """ Overrides :meth:`nupic.algorithms.backtracking_tm.BacktrackingTM.getSegmentOnCell`. """ segList = self.cells4.getNonEmptySegList(c,i) seg = self.cells4.getSegment(c, i, segList[segIdx]) numSyn = seg.size() assert numSyn != 0 # Accumulate seg...
[ "def", "getSegmentOnCell", "(", "self", ",", "c", ",", "i", ",", "segIdx", ")", ":", "segList", "=", "self", ".", "cells4", ".", "getNonEmptySegList", "(", "c", ",", "i", ")", "seg", "=", "self", ".", "cells4", ".", "getSegment", "(", "c", ",", "i"...
Overrides :meth:`nupic.algorithms.backtracking_tm.BacktrackingTM.getSegmentOnCell`.
[ "Overrides", ":", "meth", ":", "nupic", ".", "algorithms", ".", "backtracking_tm", ".", "BacktrackingTM", ".", "getSegmentOnCell", "." ]
python
valid
ghcollin/multitables
multitables.py
https://github.com/ghcollin/multitables/blob/9654a45800289a20e66d2b0e0666149f0d370f93/multitables.py#L202-L217
def get(self): """ Fetch the next item in the queue. Blocks until an item is ready. :return: The next unsigned integer in the queue. """ with self.cvar: while True: if self.size.value > 0: rval = self.vals[self.tail.value] ...
[ "def", "get", "(", "self", ")", ":", "with", "self", ".", "cvar", ":", "while", "True", ":", "if", "self", ".", "size", ".", "value", ">", "0", ":", "rval", "=", "self", ".", "vals", "[", "self", ".", "tail", ".", "value", "]", "self", ".", "...
Fetch the next item in the queue. Blocks until an item is ready. :return: The next unsigned integer in the queue.
[ "Fetch", "the", "next", "item", "in", "the", "queue", ".", "Blocks", "until", "an", "item", "is", "ready", ".", ":", "return", ":", "The", "next", "unsigned", "integer", "in", "the", "queue", "." ]
python
test
QuantEcon/QuantEcon.py
quantecon/game_theory/vertex_enumeration.py
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/game_theory/vertex_enumeration.py#L88-L123
def _vertex_enumeration_gen(labelings_bits_tup, equations_tup, trans_recips): """ Main body of `vertex_enumeration_gen`. Parameters ---------- labelings_bits_tup : tuple(ndarray(np.uint64, ndim=1)) Tuple of ndarrays of integers representing labelings of the vertices of the best resp...
[ "def", "_vertex_enumeration_gen", "(", "labelings_bits_tup", ",", "equations_tup", ",", "trans_recips", ")", ":", "m", ",", "n", "=", "equations_tup", "[", "0", "]", ".", "shape", "[", "1", "]", "-", "1", ",", "equations_tup", "[", "1", "]", ".", "shape"...
Main body of `vertex_enumeration_gen`. Parameters ---------- labelings_bits_tup : tuple(ndarray(np.uint64, ndim=1)) Tuple of ndarrays of integers representing labelings of the vertices of the best response polytopes. equations_tup : tuple(ndarray(float, ndim=2)) Tuple of ndarra...
[ "Main", "body", "of", "vertex_enumeration_gen", "." ]
python
train
heikomuller/sco-client
scocli/modelrun.py
https://github.com/heikomuller/sco-client/blob/c4afab71297f73003379bba4c1679be9dcf7cef8/scocli/modelrun.py#L311-L365
def create(url, model_id, name, arguments, properties=None): """Create a new model run using the given SCO-API create model run Url. Parameters ---------- url : string Url to POST model run create model run request model_id : string Unique model identifie...
[ "def", "create", "(", "url", ",", "model_id", ",", "name", ",", "arguments", ",", "properties", "=", "None", ")", ":", "# Create list of model run arguments. Catch TypeErrors if arguments is", "# not a list.", "obj_args", "=", "[", "]", "try", ":", "for", "arg", "...
Create a new model run using the given SCO-API create model run Url. Parameters ---------- url : string Url to POST model run create model run request model_id : string Unique model identifier name : string User-defined name for model run ...
[ "Create", "a", "new", "model", "run", "using", "the", "given", "SCO", "-", "API", "create", "model", "run", "Url", "." ]
python
train
datastax/python-driver
cassandra/cluster.py
https://github.com/datastax/python-driver/blob/30a80d0b798b1f45f8cb77163b1fa791f3e3ca29/cassandra/cluster.py#L4386-L4400
def one(self): """ Return a single row of the results or None if empty. This is basically a shortcut to `result_set.current_rows[0]` and should only be used when you know a query returns a single row. Consider using an iterator if the ResultSet contains more than one row. ...
[ "def", "one", "(", "self", ")", ":", "row", "=", "None", "if", "self", ".", "_current_rows", ":", "try", ":", "row", "=", "self", ".", "_current_rows", "[", "0", "]", "except", "TypeError", ":", "# generator object is not subscriptable, PYTHON-1026", "row", ...
Return a single row of the results or None if empty. This is basically a shortcut to `result_set.current_rows[0]` and should only be used when you know a query returns a single row. Consider using an iterator if the ResultSet contains more than one row.
[ "Return", "a", "single", "row", "of", "the", "results", "or", "None", "if", "empty", ".", "This", "is", "basically", "a", "shortcut", "to", "result_set", ".", "current_rows", "[", "0", "]", "and", "should", "only", "be", "used", "when", "you", "know", ...
python
train
sorgerlab/indra
indra/sources/biopax/processor.py
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1398-L1404
def _is_small_molecule(pe): """Return True if the element is a small molecule""" val = isinstance(pe, _bp('SmallMolecule')) or \ isinstance(pe, _bpimpl('SmallMolecule')) or \ isinstance(pe, _bp('SmallMoleculeReference')) or \ isinstance(pe, _bpimpl('SmallMoleculeReference')) ...
[ "def", "_is_small_molecule", "(", "pe", ")", ":", "val", "=", "isinstance", "(", "pe", ",", "_bp", "(", "'SmallMolecule'", ")", ")", "or", "isinstance", "(", "pe", ",", "_bpimpl", "(", "'SmallMolecule'", ")", ")", "or", "isinstance", "(", "pe", ",", "_...
Return True if the element is a small molecule
[ "Return", "True", "if", "the", "element", "is", "a", "small", "molecule" ]
python
train
census-instrumentation/opencensus-python
opencensus/trace/stack_trace.py
https://github.com/census-instrumentation/opencensus-python/blob/992b223f7e34c5dcb65922b7d5c827e7a1351e7d/opencensus/trace/stack_trace.py#L86-L103
def format_stack_frame_json(self): """Convert StackFrame object to json format.""" stack_frame_json = {} stack_frame_json['function_name'] = get_truncatable_str( self.func_name) stack_frame_json['original_function_name'] = get_truncatable_str( self.original_func_n...
[ "def", "format_stack_frame_json", "(", "self", ")", ":", "stack_frame_json", "=", "{", "}", "stack_frame_json", "[", "'function_name'", "]", "=", "get_truncatable_str", "(", "self", ".", "func_name", ")", "stack_frame_json", "[", "'original_function_name'", "]", "="...
Convert StackFrame object to json format.
[ "Convert", "StackFrame", "object", "to", "json", "format", "." ]
python
train
googleapis/google-cloud-python
bigtable/google/cloud/bigtable/client.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigtable/google/cloud/bigtable/client.py#L230-L251
def instance_admin_client(self): """Getter for the gRPC stub used for the Table Admin API. For example: .. literalinclude:: snippets.py :start-after: [START bigtable_instance_admin_client] :end-before: [END bigtable_instance_admin_client] :rtype: :class:`.bigta...
[ "def", "instance_admin_client", "(", "self", ")", ":", "if", "self", ".", "_instance_admin_client", "is", "None", ":", "if", "not", "self", ".", "_admin", ":", "raise", "ValueError", "(", "\"Client is not an admin client.\"", ")", "self", ".", "_instance_admin_cli...
Getter for the gRPC stub used for the Table Admin API. For example: .. literalinclude:: snippets.py :start-after: [START bigtable_instance_admin_client] :end-before: [END bigtable_instance_admin_client] :rtype: :class:`.bigtable_admin_pb2.BigtableInstanceAdmin` ...
[ "Getter", "for", "the", "gRPC", "stub", "used", "for", "the", "Table", "Admin", "API", "." ]
python
train
pennersr/django-allauth
allauth/socialaccount/providers/base.py
https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/providers/base.py#L65-L99
def sociallogin_from_response(self, request, response): """ Instantiates and populates a `SocialLogin` model based on the data retrieved in `response`. The method does NOT save the model to the DB. Data for `SocialLogin` will be extracted from `response` with the help of...
[ "def", "sociallogin_from_response", "(", "self", ",", "request", ",", "response", ")", ":", "# NOTE: Avoid loading models at top due to registry boot...", "from", "allauth", ".", "socialaccount", ".", "models", "import", "SocialLogin", ",", "SocialAccount", "adapter", "="...
Instantiates and populates a `SocialLogin` model based on the data retrieved in `response`. The method does NOT save the model to the DB. Data for `SocialLogin` will be extracted from `response` with the help of the `.extract_uid()`, `.extract_extra_data()`, `.extract_common_fie...
[ "Instantiates", "and", "populates", "a", "SocialLogin", "model", "based", "on", "the", "data", "retrieved", "in", "response", ".", "The", "method", "does", "NOT", "save", "the", "model", "to", "the", "DB", "." ]
python
train
Azure/azure-uamqp-python
uamqp/client.py
https://github.com/Azure/azure-uamqp-python/blob/b67e4fcaf2e8a337636947523570239c10a58ae2/uamqp/client.py#L633-L651
def redirect(self, redirect, auth): """Redirect the client endpoint using a Link DETACH redirect response. :param redirect: The Link DETACH redirect details. :type redirect: ~uamqp.errors.LinkRedirect :param auth: Authentication credentials to the redirected endpoint. :t...
[ "def", "redirect", "(", "self", ",", "redirect", ",", "auth", ")", ":", "if", "self", ".", "_ext_connection", ":", "raise", "ValueError", "(", "\"Clients with a shared connection cannot be \"", "\"automatically redirected.\"", ")", "if", "self", ".", "message_handler"...
Redirect the client endpoint using a Link DETACH redirect response. :param redirect: The Link DETACH redirect details. :type redirect: ~uamqp.errors.LinkRedirect :param auth: Authentication credentials to the redirected endpoint. :type auth: ~uamqp.authentication.common.AMQPAuth
[ "Redirect", "the", "client", "endpoint", "using", "a", "Link", "DETACH", "redirect", "response", "." ]
python
train
rosenbrockc/fortpy
fortpy/isense/context.py
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/context.py#L348-L360
def _match_exec(self, i): """Looks at line 'i' for a subroutine or function definition.""" self.col_match = self.RE_EXEC.match(self._source[i]) if self.col_match is not None: if self.col_match.group("codetype") == "function": self.el_type = Function else: ...
[ "def", "_match_exec", "(", "self", ",", "i", ")", ":", "self", ".", "col_match", "=", "self", ".", "RE_EXEC", ".", "match", "(", "self", ".", "_source", "[", "i", "]", ")", "if", "self", ".", "col_match", "is", "not", "None", ":", "if", "self", "...
Looks at line 'i' for a subroutine or function definition.
[ "Looks", "at", "line", "i", "for", "a", "subroutine", "or", "function", "definition", "." ]
python
train
pypa/pipenv
pipenv/vendor/pathlib2/__init__.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pathlib2/__init__.py#L1647-L1656
def expanduser(self): """ Return a new path with expanded ~ and ~user constructs (as returned by os.path.expanduser) """ if (not (self._drv or self._root) and self._parts and self._parts[0][:1] == '~'): homedir = self._flavour.gethomedir(self._parts[0][1:]) ...
[ "def", "expanduser", "(", "self", ")", ":", "if", "(", "not", "(", "self", ".", "_drv", "or", "self", ".", "_root", ")", "and", "self", ".", "_parts", "and", "self", ".", "_parts", "[", "0", "]", "[", ":", "1", "]", "==", "'~'", ")", ":", "ho...
Return a new path with expanded ~ and ~user constructs (as returned by os.path.expanduser)
[ "Return", "a", "new", "path", "with", "expanded", "~", "and", "~user", "constructs", "(", "as", "returned", "by", "os", ".", "path", ".", "expanduser", ")" ]
python
train
dslackw/slpkg
slpkg/main.py
https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/main.py#L665-L682
def pkg_find(self): """Find packages from all enabled repositories """ flag = [] options = [ "-F", "--FIND" ] additional_options = ["--case-ins"] for arg in self.args: if arg in additional_options: flag.append(ar...
[ "def", "pkg_find", "(", "self", ")", ":", "flag", "=", "[", "]", "options", "=", "[", "\"-F\"", ",", "\"--FIND\"", "]", "additional_options", "=", "[", "\"--case-ins\"", "]", "for", "arg", "in", "self", ".", "args", ":", "if", "arg", "in", "additional_...
Find packages from all enabled repositories
[ "Find", "packages", "from", "all", "enabled", "repositories" ]
python
train
inasafe/inasafe
safe/gui/tools/help/peta_bencana_help.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/help/peta_bencana_help.py#L13-L26
def peta_bencana_help(): """Help message for PetaBencana dialog. .. versionadded:: 3.2.1 :returns: A message object containing helpful information. :rtype: messaging.message.Message """ message = m.Message() message.add(m.Brand()) message.add(heading()) message.add(content()) ...
[ "def", "peta_bencana_help", "(", ")", ":", "message", "=", "m", ".", "Message", "(", ")", "message", ".", "add", "(", "m", ".", "Brand", "(", ")", ")", "message", ".", "add", "(", "heading", "(", ")", ")", "message", ".", "add", "(", "content", "...
Help message for PetaBencana dialog. .. versionadded:: 3.2.1 :returns: A message object containing helpful information. :rtype: messaging.message.Message
[ "Help", "message", "for", "PetaBencana", "dialog", "." ]
python
train
Clinical-Genomics/scout
scout/server/blueprints/cases/views.py
https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/cases/views.py#L277-L311
def matchmaker_delete(institute_id, case_name): """Remove a case from MatchMaker""" # check that only authorized users can delete patients from MME user_obj = store.user(current_user.email) if 'mme_submitter' not in user_obj['roles']: flash('unauthorized request', 'warning') return redi...
[ "def", "matchmaker_delete", "(", "institute_id", ",", "case_name", ")", ":", "# check that only authorized users can delete patients from MME", "user_obj", "=", "store", ".", "user", "(", "current_user", ".", "email", ")", "if", "'mme_submitter'", "not", "in", "user_obj...
Remove a case from MatchMaker
[ "Remove", "a", "case", "from", "MatchMaker" ]
python
test
KelSolaar/Umbra
umbra/ui/visual_accelerators.py
https://github.com/KelSolaar/Umbra/blob/66f45f08d9d723787f1191989f8b0dda84b412ce/umbra/ui/visual_accelerators.py#L68-L102
def highlight_occurences(editor): """ Highlights given editor current line. :param editor: Document editor. :type editor: QWidget :return: Method success. :rtype: bool """ format = editor.language.theme.get("accelerator.occurence") if not format: return False extra_sel...
[ "def", "highlight_occurences", "(", "editor", ")", ":", "format", "=", "editor", ".", "language", ".", "theme", ".", "get", "(", "\"accelerator.occurence\"", ")", "if", "not", "format", ":", "return", "False", "extra_selections", "=", "editor", ".", "extraSele...
Highlights given editor current line. :param editor: Document editor. :type editor: QWidget :return: Method success. :rtype: bool
[ "Highlights", "given", "editor", "current", "line", "." ]
python
train
NICTA/revrand
revrand/basis_functions.py
https://github.com/NICTA/revrand/blob/4c1881b6c1772d2b988518e49dde954f165acfb6/revrand/basis_functions.py#L109-L152
def apply_grad(fun, grad): """ Apply a function that takes a gradient matrix to a sequence of 2 or 3 dimensional gradients. This is partucularly useful when the gradient of a basis concatenation object is quite complex, eg. >>> X = np.random.randn(100, 3) >>> y = np.random.randn(100) >...
[ "def", "apply_grad", "(", "fun", ",", "grad", ")", ":", "if", "issequence", "(", "grad", ")", ":", "fgrad", "=", "[", "apply_grad", "(", "fun", ",", "g", ")", "for", "g", "in", "grad", "]", "return", "fgrad", "if", "len", "(", "fgrad", ")", "!=",...
Apply a function that takes a gradient matrix to a sequence of 2 or 3 dimensional gradients. This is partucularly useful when the gradient of a basis concatenation object is quite complex, eg. >>> X = np.random.randn(100, 3) >>> y = np.random.randn(100) >>> N, d = X.shape >>> base = Random...
[ "Apply", "a", "function", "that", "takes", "a", "gradient", "matrix", "to", "a", "sequence", "of", "2", "or", "3", "dimensional", "gradients", "." ]
python
train
gwpy/gwpy
setup_utils.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/setup_utils.py#L110-L134
def get_gitpython_version(): """Determine the required version of GitPython Because of target systems running very, very old versions of setuptools, we only specify the actual version we need when we need it. """ # if not in git clone, it doesn't matter if not in_git_clone(): return 'Gi...
[ "def", "get_gitpython_version", "(", ")", ":", "# if not in git clone, it doesn't matter", "if", "not", "in_git_clone", "(", ")", ":", "return", "'GitPython'", "# otherwise, call out to get the git version", "try", ":", "gitv", "=", "subprocess", ".", "check_output", "(",...
Determine the required version of GitPython Because of target systems running very, very old versions of setuptools, we only specify the actual version we need when we need it.
[ "Determine", "the", "required", "version", "of", "GitPython" ]
python
train
spoqa/tsukkomi
tsukkomi/typed.py
https://github.com/spoqa/tsukkomi/blob/c67bd28a5211cdd11f8ac81f109c915f3b780445/tsukkomi/typed.py#L145-L161
def check_union(data: typing.Union, hint: type) -> bool: """Check argument type & return type of :class:`typing.Union`. since it raises check :class:`typing.Union` using `isinstance`, so compare in diffrent way :param data: union given as a argument :param hint: assumed type of given ``data`` ...
[ "def", "check_union", "(", "data", ":", "typing", ".", "Union", ",", "hint", ":", "type", ")", "->", "bool", ":", "r", "=", "any", "(", "check_type", "(", "data", ",", "t", ")", "[", "1", "]", "for", "t", "in", "hint", ".", "__union_params__", ")...
Check argument type & return type of :class:`typing.Union`. since it raises check :class:`typing.Union` using `isinstance`, so compare in diffrent way :param data: union given as a argument :param hint: assumed type of given ``data``
[ "Check", "argument", "type", "&", "return", "type", "of", ":", "class", ":", "typing", ".", "Union", ".", "since", "it", "raises", "check", ":", "class", ":", "typing", ".", "Union", "using", "isinstance", "so", "compare", "in", "diffrent", "way" ]
python
train
not-na/peng3d
peng3d/window.py
https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/window.py#L215-L222
def addMenu(self,menu): """ Adds a menu to the list of menus. """ # If there is no menu selected currently, this menu will automatically be made active. # Add the line above to the docstring if fixed self.menus[menu.name]=menu self.peng.sendEvent("peng3d:window.me...
[ "def", "addMenu", "(", "self", ",", "menu", ")", ":", "# If there is no menu selected currently, this menu will automatically be made active.", "# Add the line above to the docstring if fixed", "self", ".", "menus", "[", "menu", ".", "name", "]", "=", "menu", "self", ".", ...
Adds a menu to the list of menus.
[ "Adds", "a", "menu", "to", "the", "list", "of", "menus", "." ]
python
test
mitsei/dlkit
dlkit/json_/osid/metadata.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/metadata.py#L1025-L1039
def supports_heading_type(self, heading_type): """Tests if the given heading type is supported. arg: heading_type (osid.type.Type): a heading Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``HEADI...
[ "def", "supports_heading_type", "(", "self", ",", "heading_type", ")", ":", "# Implemented from template for osid.Metadata.supports_coordinate_type", "if", "self", ".", "_kwargs", "[", "'syntax'", "]", "not", "in", "[", "'``HEADING``'", "]", ":", "raise", "errors", "....
Tests if the given heading type is supported. arg: heading_type (osid.type.Type): a heading Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``HEADING`` raise: NullArgument - ``heading_type`` is ``...
[ "Tests", "if", "the", "given", "heading", "type", "is", "supported", "." ]
python
train
noxdafox/vminspect
vminspect/comparator.py
https://github.com/noxdafox/vminspect/blob/e685282564877e2d1950f1e09b292f4f4db1dbcd/vminspect/comparator.py#L128-L153
def compare_registry(self, concurrent=False): """Compares the Windows Registry contained within the two File Systems. It parses all the registry hive files contained within the disks and generates the following report. {'created_keys': {'\\Reg\\Key': (('Key', 'Type', 'Value'))} ...
[ "def", "compare_registry", "(", "self", ",", "concurrent", "=", "False", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"Comparing Windows registries.\"", ")", "self", ".", "_assert_windows", "(", ")", "return", "compare_registries", "(", "self", ".", "...
Compares the Windows Registry contained within the two File Systems. It parses all the registry hive files contained within the disks and generates the following report. {'created_keys': {'\\Reg\\Key': (('Key', 'Type', 'Value'))} 'deleted_keys': ['\\Reg\\Key', ...], ...
[ "Compares", "the", "Windows", "Registry", "contained", "within", "the", "two", "File", "Systems", "." ]
python
train
midasplatform/pydas
pydas/api.py
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L331-L346
def _create_folder(local_folder, parent_folder_id): """ Function for creating a remote folder and returning the id. This should be a building block for user-level functions. :param local_folder: full path to a local folder :type local_folder: string :param parent_folder_id: id of parent folder ...
[ "def", "_create_folder", "(", "local_folder", ",", "parent_folder_id", ")", ":", "new_folder", "=", "session", ".", "communicator", ".", "create_folder", "(", "session", ".", "token", ",", "os", ".", "path", ".", "basename", "(", "local_folder", ")", ",", "p...
Function for creating a remote folder and returning the id. This should be a building block for user-level functions. :param local_folder: full path to a local folder :type local_folder: string :param parent_folder_id: id of parent folder on the Midas Server instance, where the new folder will ...
[ "Function", "for", "creating", "a", "remote", "folder", "and", "returning", "the", "id", ".", "This", "should", "be", "a", "building", "block", "for", "user", "-", "level", "functions", "." ]
python
valid
limodou/uliweb
uliweb/contrib/jsonql/__init__.py
https://github.com/limodou/uliweb/blob/34472f25e4bc0b954a35346672f94e84ef18b076/uliweb/contrib/jsonql/__init__.py#L313-L336
def parse_entry(self, name): """ Parse query entry name, just like: { 'User[]:user' } 'User[]:user' is an entry name. :param name: :return: """ # calculate schema mode # if ':name' or '' or '[]:name' or '[]' found, it'll be t...
[ "def", "parse_entry", "(", "self", ",", "name", ")", ":", "# calculate schema mode", "# if ':name' or '' or '[]:name' or '[]' found, it'll be treat as multiple Schema query", "alias", "=", "name", "if", "':'", "in", "name", ":", "name", ",", "alias", "=", "name", ".", ...
Parse query entry name, just like: { 'User[]:user' } 'User[]:user' is an entry name. :param name: :return:
[ "Parse", "query", "entry", "name", "just", "like", ":", "{", "User", "[]", ":", "user", "}" ]
python
train
OpenTreeOfLife/peyotl
peyotl/phylesystem/helper.py
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/phylesystem/helper.py#L64-L76
def create_id2study_info(path, tag): """Searchers for *.json files in this repo and returns a map of study id ==> (`tag`, dir, study filepath) where `tag` is typically the shard name """ d = {} for triple in os.walk(path): root, files = triple[0], triple[2] for filename in files:...
[ "def", "create_id2study_info", "(", "path", ",", "tag", ")", ":", "d", "=", "{", "}", "for", "triple", "in", "os", ".", "walk", "(", "path", ")", ":", "root", ",", "files", "=", "triple", "[", "0", "]", ",", "triple", "[", "2", "]", "for", "fil...
Searchers for *.json files in this repo and returns a map of study id ==> (`tag`, dir, study filepath) where `tag` is typically the shard name
[ "Searchers", "for", "*", ".", "json", "files", "in", "this", "repo", "and", "returns", "a", "map", "of", "study", "id", "==", ">", "(", "tag", "dir", "study", "filepath", ")", "where", "tag", "is", "typically", "the", "shard", "name" ]
python
train
amzn/ion-python
amazon/ion/reader_binary.py
https://github.com/amzn/ion-python/blob/0b21fa3ba7755f55f745e4aa970d86343b82449d/amazon/ion/reader_binary.py#L334-L387
def _read_data_handler(length, whence, ctx, skip=False, stream_event=ION_STREAM_INCOMPLETE_EVENT): """Creates a co-routine for retrieving data up to a requested size. Args: length (int): The minimum length requested. whence (Coroutine): The co-routine to return to after the data is satisfied. ...
[ "def", "_read_data_handler", "(", "length", ",", "whence", ",", "ctx", ",", "skip", "=", "False", ",", "stream_event", "=", "ION_STREAM_INCOMPLETE_EVENT", ")", ":", "trans", "=", "None", "queue", "=", "ctx", ".", "queue", "if", "length", ">", "ctx", ".", ...
Creates a co-routine for retrieving data up to a requested size. Args: length (int): The minimum length requested. whence (Coroutine): The co-routine to return to after the data is satisfied. ctx (_HandlerContext): The context for the read. skip (Optional[bool]): Whether the request...
[ "Creates", "a", "co", "-", "routine", "for", "retrieving", "data", "up", "to", "a", "requested", "size", "." ]
python
train
mongodb/motor
motor/motor_gridfs.py
https://github.com/mongodb/motor/blob/6af22720723bde7c78eb8cb126962cfbfc034b2c/motor/motor_gridfs.py#L457-L514
def find(self, *args, **kwargs): """Find and return the files collection documents that match ``filter``. Returns a cursor that iterates across files matching arbitrary queries on the files collection. Can be combined with other modifiers for additional control. For example:: ...
[ "def", "find", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "cursor", "=", "self", ".", "delegate", ".", "find", "(", "*", "args", ",", "*", "*", "kwargs", ")", "grid_out_cursor", "=", "create_class_with_framework", "(", "AgnosticG...
Find and return the files collection documents that match ``filter``. Returns a cursor that iterates across files matching arbitrary queries on the files collection. Can be combined with other modifiers for additional control. For example:: cursor = bucket.find({"filename": ...
[ "Find", "and", "return", "the", "files", "collection", "documents", "that", "match", "filter", "." ]
python
train
bitlabstudio/django-subscribe
subscribe/templatetags/subscribe_tags.py
https://github.com/bitlabstudio/django-subscribe/blob/313de63fb4acda172e88b65c3327c793f98e8aa9/subscribe/templatetags/subscribe_tags.py#L35-L54
def is_subscribed(user, obj): """ Returns ``True`` if the user is subscribed to the given object. :param user: A ``User`` instance. :param obj: Any object. """ if not user.is_authenticated(): return False ctype = ContentType.objects.get_for_model(obj) try: Subscriptio...
[ "def", "is_subscribed", "(", "user", ",", "obj", ")", ":", "if", "not", "user", ".", "is_authenticated", "(", ")", ":", "return", "False", "ctype", "=", "ContentType", ".", "objects", ".", "get_for_model", "(", "obj", ")", "try", ":", "Subscription", "."...
Returns ``True`` if the user is subscribed to the given object. :param user: A ``User`` instance. :param obj: Any object.
[ "Returns", "True", "if", "the", "user", "is", "subscribed", "to", "the", "given", "object", "." ]
python
train
datastax/python-driver
cassandra/cqlengine/query.py
https://github.com/datastax/python-driver/blob/30a80d0b798b1f45f8cb77163b1fa791f3e3ca29/cassandra/cqlengine/query.py#L940-L946
def allow_filtering(self): """ Enables the (usually) unwise practive of querying on a clustering key without also defining a partition key """ clone = copy.deepcopy(self) clone._allow_filtering = True return clone
[ "def", "allow_filtering", "(", "self", ")", ":", "clone", "=", "copy", ".", "deepcopy", "(", "self", ")", "clone", ".", "_allow_filtering", "=", "True", "return", "clone" ]
Enables the (usually) unwise practive of querying on a clustering key without also defining a partition key
[ "Enables", "the", "(", "usually", ")", "unwise", "practive", "of", "querying", "on", "a", "clustering", "key", "without", "also", "defining", "a", "partition", "key" ]
python
train
zhanglab/psamm
psamm/gapfill.py
https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/gapfill.py#L52-L140
def gapfind(model, solver, epsilon=0.001, v_max=1000, implicit_sinks=True): """Identify compounds in the model that cannot be produced. Yields all compounds that cannot be produced. This method assumes implicit sinks for all compounds in the model so the only factor that influences whether a compound c...
[ "def", "gapfind", "(", "model", ",", "solver", ",", "epsilon", "=", "0.001", ",", "v_max", "=", "1000", ",", "implicit_sinks", "=", "True", ")", ":", "prob", "=", "solver", ".", "create_problem", "(", ")", "# Set integrality tolerance such that w constraints are...
Identify compounds in the model that cannot be produced. Yields all compounds that cannot be produced. This method assumes implicit sinks for all compounds in the model so the only factor that influences whether a compound can be produced is the presence of the compounds needed to produce it. Epsi...
[ "Identify", "compounds", "in", "the", "model", "that", "cannot", "be", "produced", "." ]
python
train
mar10/wsgidav
wsgidav/dav_provider.py
https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/dav_provider.py#L809-L814
def remove_all_properties(self, recursive): """Remove all associated dead properties.""" if self.provider.prop_manager: self.provider.prop_manager.remove_properties( self.get_ref_url(), self.environ )
[ "def", "remove_all_properties", "(", "self", ",", "recursive", ")", ":", "if", "self", ".", "provider", ".", "prop_manager", ":", "self", ".", "provider", ".", "prop_manager", ".", "remove_properties", "(", "self", ".", "get_ref_url", "(", ")", ",", "self", ...
Remove all associated dead properties.
[ "Remove", "all", "associated", "dead", "properties", "." ]
python
valid
manns/pyspread
pyspread/src/lib/_grid_cairo_renderer.py
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L962-L971
def draw(self): """Draws cell background to context""" self.context.set_source_rgb(*self._get_background_color()) self.context.rectangle(*self.rect) self.context.fill() # If show frozen is active, show frozen pattern if self.view_frozen and self.cell_attributes[self.key...
[ "def", "draw", "(", "self", ")", ":", "self", ".", "context", ".", "set_source_rgb", "(", "*", "self", ".", "_get_background_color", "(", ")", ")", "self", ".", "context", ".", "rectangle", "(", "*", "self", ".", "rect", ")", "self", ".", "context", ...
Draws cell background to context
[ "Draws", "cell", "background", "to", "context" ]
python
train
O365/python-o365
O365/utils/attachment.py
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/attachment.py#L140-L154
def to_api_data(self): """ Returns a dict to communicate with the server :rtype: dict """ data = {'@odata.type': self._gk( '{}_attachment_type'.format(self.attachment_type)), self._cc('name'): self.name} if self.attachment_type == 'file': dat...
[ "def", "to_api_data", "(", "self", ")", ":", "data", "=", "{", "'@odata.type'", ":", "self", ".", "_gk", "(", "'{}_attachment_type'", ".", "format", "(", "self", ".", "attachment_type", ")", ")", ",", "self", ".", "_cc", "(", "'name'", ")", ":", "self"...
Returns a dict to communicate with the server :rtype: dict
[ "Returns", "a", "dict", "to", "communicate", "with", "the", "server" ]
python
train
andresriancho/w3af-api-client
w3af_api_client/connection.py
https://github.com/andresriancho/w3af-api-client/blob/adeb79bad75264d754de69f0bb981b366da96f32/w3af_api_client/connection.py#L156-L178
def get_scans(self): """ :return: A list with all the Scan instances available in the remote API """ code, data = self.send_request('/scans/', method='GET') if code != 200: msg = 'Failed to retrieve scans. Unexpected code %s' raise APIException(msg % code...
[ "def", "get_scans", "(", "self", ")", ":", "code", ",", "data", "=", "self", ".", "send_request", "(", "'/scans/'", ",", "method", "=", "'GET'", ")", "if", "code", "!=", "200", ":", "msg", "=", "'Failed to retrieve scans. Unexpected code %s'", "raise", "APIE...
:return: A list with all the Scan instances available in the remote API
[ ":", "return", ":", "A", "list", "with", "all", "the", "Scan", "instances", "available", "in", "the", "remote", "API" ]
python
train
mamrhein/specification
specification/_extd_ast_expr.py
https://github.com/mamrhein/specification/blob/a4c09a0d286cda7a04e8a189f12e23edd97f64ea/specification/_extd_ast_expr.py#L124-L130
def wrap_expr(self, src: str, dfltChaining: bool) -> str: """Wrap `src` in parentheses if neccessary.""" diff_binding = self.op_man.diff_binding() if diff_binding < 0 or diff_binding == 0 and not dfltChaining: return self.parenthesize(src) else: return src
[ "def", "wrap_expr", "(", "self", ",", "src", ":", "str", ",", "dfltChaining", ":", "bool", ")", "->", "str", ":", "diff_binding", "=", "self", ".", "op_man", ".", "diff_binding", "(", ")", "if", "diff_binding", "<", "0", "or", "diff_binding", "==", "0"...
Wrap `src` in parentheses if neccessary.
[ "Wrap", "src", "in", "parentheses", "if", "neccessary", "." ]
python
train
ARMmbed/mbed-cloud-sdk-python
src/mbed_cloud/_backends/update_service/models/update_campaign_put_request.py
https://github.com/ARMmbed/mbed-cloud-sdk-python/blob/c0af86fb2cdd4dc7ed26f236139241067d293509/src/mbed_cloud/_backends/update_service/models/update_campaign_put_request.py#L174-L184
def root_manifest_id(self, root_manifest_id): """ Sets the root_manifest_id of this UpdateCampaignPutRequest. :param root_manifest_id: The root_manifest_id of this UpdateCampaignPutRequest. :type: str """ if root_manifest_id is not None and len(root_manifest_id) > 32: ...
[ "def", "root_manifest_id", "(", "self", ",", "root_manifest_id", ")", ":", "if", "root_manifest_id", "is", "not", "None", "and", "len", "(", "root_manifest_id", ")", ">", "32", ":", "raise", "ValueError", "(", "\"Invalid value for `root_manifest_id`, length must be le...
Sets the root_manifest_id of this UpdateCampaignPutRequest. :param root_manifest_id: The root_manifest_id of this UpdateCampaignPutRequest. :type: str
[ "Sets", "the", "root_manifest_id", "of", "this", "UpdateCampaignPutRequest", "." ]
python
train
KvasirSecurity/kvasirapi-python
KvasirAPI/jsonrpc/services.py
https://github.com/KvasirSecurity/kvasirapi-python/blob/ec8c5818bd5913f3afd150f25eaec6e7cc732f4c/KvasirAPI/jsonrpc/services.py#L44-L54
def info(self, svc_rec=None, ipaddr=None, proto=None, port=None): """ Information about a service. :param svc_rec: t_services.id :param ipaddr: IP Address :param proto: Protocol (tcp, udp, info) :param port: Port (0-65535) :return: [ service_id, host_id, ipv4, ip...
[ "def", "info", "(", "self", ",", "svc_rec", "=", "None", ",", "ipaddr", "=", "None", ",", "proto", "=", "None", ",", "port", "=", "None", ")", ":", "return", "self", ".", "send", ".", "service_info", "(", "svc_rec", ",", "ipaddr", ",", "proto", ","...
Information about a service. :param svc_rec: t_services.id :param ipaddr: IP Address :param proto: Protocol (tcp, udp, info) :param port: Port (0-65535) :return: [ service_id, host_id, ipv4, ipv6, hostname, proto, number, status, name, banner ]
[ "Information", "about", "a", "service", "." ]
python
train
aio-libs/aiodocker
aiodocker/services.py
https://github.com/aio-libs/aiodocker/blob/88d0285ddba8e606ff684278e0a831347209189c/aiodocker/services.py#L168-L182
async def inspect(self, service_id: str) -> Mapping[str, Any]: """ Inspect a service Args: service_id: ID or name of the service Returns: a dict with info about a service """ response = await self.docker._query_json( "services/{servi...
[ "async", "def", "inspect", "(", "self", ",", "service_id", ":", "str", ")", "->", "Mapping", "[", "str", ",", "Any", "]", ":", "response", "=", "await", "self", ".", "docker", ".", "_query_json", "(", "\"services/{service_id}\"", ".", "format", "(", "ser...
Inspect a service Args: service_id: ID or name of the service Returns: a dict with info about a service
[ "Inspect", "a", "service" ]
python
train
econ-ark/HARK
HARK/ConsumptionSaving/ConsGenIncProcessModel.py
https://github.com/econ-ark/HARK/blob/3d184153a189e618a87c9540df1cd12044039cc5/HARK/ConsumptionSaving/ConsGenIncProcessModel.py#L836-L868
def solve(self): ''' Solves a one period consumption saving problem with risky income, with persistent income explicitly tracked as a state variable. Parameters ---------- None Returns ------- solution : ConsumerSolution The solution ...
[ "def", "solve", "(", "self", ")", ":", "aLvl", ",", "pLvl", "=", "self", ".", "prepareToCalcEndOfPrdvP", "(", ")", "EndOfPrdvP", "=", "self", ".", "calcEndOfPrdvP", "(", ")", "if", "self", ".", "vFuncBool", ":", "self", ".", "makeEndOfPrdvFunc", "(", "En...
Solves a one period consumption saving problem with risky income, with persistent income explicitly tracked as a state variable. Parameters ---------- None Returns ------- solution : ConsumerSolution The solution to the one period problem, including ...
[ "Solves", "a", "one", "period", "consumption", "saving", "problem", "with", "risky", "income", "with", "persistent", "income", "explicitly", "tracked", "as", "a", "state", "variable", "." ]
python
train
suds-community/suds
suds/wsdl.py
https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/wsdl.py#L70-L82
def resolve(self, definitions): """ Resolve named references to other WSDL objects. Can be safely called multiple times. @param definitions: A definitions object. @type definitions: L{Definitions} """ if not self.__resolved: self.do_resolve(definiti...
[ "def", "resolve", "(", "self", ",", "definitions", ")", ":", "if", "not", "self", ".", "__resolved", ":", "self", ".", "do_resolve", "(", "definitions", ")", "self", ".", "__resolved", "=", "True" ]
Resolve named references to other WSDL objects. Can be safely called multiple times. @param definitions: A definitions object. @type definitions: L{Definitions}
[ "Resolve", "named", "references", "to", "other", "WSDL", "objects", "." ]
python
train
oxalorg/Stab
stab/watchman.py
https://github.com/oxalorg/Stab/blob/8f0ded780fd7a53a674835c9cb1b7ca08b98f562/stab/watchman.py#L24-L35
def should_build(self, fpath, meta): """ Checks if the file should be built or not Only skips layouts which are tagged as INCREMENTAL Rebuilds only those files with mtime changed since previous build """ if meta.get('layout', self.default_template) in self.inc_layout: ...
[ "def", "should_build", "(", "self", ",", "fpath", ",", "meta", ")", ":", "if", "meta", ".", "get", "(", "'layout'", ",", "self", ".", "default_template", ")", "in", "self", ".", "inc_layout", ":", "if", "self", ".", "prev_mtime", ".", "get", "(", "fp...
Checks if the file should be built or not Only skips layouts which are tagged as INCREMENTAL Rebuilds only those files with mtime changed since previous build
[ "Checks", "if", "the", "file", "should", "be", "built", "or", "not", "Only", "skips", "layouts", "which", "are", "tagged", "as", "INCREMENTAL", "Rebuilds", "only", "those", "files", "with", "mtime", "changed", "since", "previous", "build" ]
python
train
etoccalino/django-rest-framework-httpsignature
rest_framework_httpsignature/authentication.py
https://github.com/etoccalino/django-rest-framework-httpsignature/blob/03ac3c213153ae6084c84b8ff61e101798b342a4/rest_framework_httpsignature/authentication.py#L46-L56
def build_dict_to_sign(self, request, signature_headers): """Build a dict with headers and values used in the signature. "signature_headers" is a list of lowercase header names. """ d = {} for header in signature_headers: if header == '(request-target)': ...
[ "def", "build_dict_to_sign", "(", "self", ",", "request", ",", "signature_headers", ")", ":", "d", "=", "{", "}", "for", "header", "in", "signature_headers", ":", "if", "header", "==", "'(request-target)'", ":", "continue", "d", "[", "header", "]", "=", "r...
Build a dict with headers and values used in the signature. "signature_headers" is a list of lowercase header names.
[ "Build", "a", "dict", "with", "headers", "and", "values", "used", "in", "the", "signature", "." ]
python
train