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
ronhanson/python-tbx
tbx/file.py
https://github.com/ronhanson/python-tbx/blob/87f72ae0cadecafbcd144f1e930181fba77f6b83/tbx/file.py#L45-L65
def full_file_list_with_sequence(scan_path): """ Returns a list of all files in a folder and its subfolders (only files). """ file_list = [] path = os.path.abspath(scan_path) for root, dirs, files in os.walk(path): if len(files) != 0 and not '.svn' in root and not '.git' in roo...
[ "def", "full_file_list_with_sequence", "(", "scan_path", ")", ":", "file_list", "=", "[", "]", "path", "=", "os", ".", "path", ".", "abspath", "(", "scan_path", ")", "for", "root", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "path", ")", ...
Returns a list of all files in a folder and its subfolders (only files).
[ "Returns", "a", "list", "of", "all", "files", "in", "a", "folder", "and", "its", "subfolders", "(", "only", "files", ")", "." ]
python
train
msfrank/cifparser
cifparser/valuetree.py
https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L228-L246
def get_field(self, path, name): """ Retrieves the value of the field at the specified path. :param path: str or Path instance :param name: :type name: str :return: :raises ValueError: A component of path is a field name. :raises KeyError: A component of ...
[ "def", "get_field", "(", "self", ",", "path", ",", "name", ")", ":", "try", ":", "value", "=", "self", ".", "get", "(", "path", ",", "name", ")", "if", "not", "isinstance", "(", "value", ",", "str", ")", ":", "raise", "TypeError", "(", ")", "retu...
Retrieves the value of the field at the specified path. :param path: str or Path instance :param name: :type name: str :return: :raises ValueError: A component of path is a field name. :raises KeyError: A component of path doesn't exist. :raises TypeError: The fi...
[ "Retrieves", "the", "value", "of", "the", "field", "at", "the", "specified", "path", "." ]
python
train
nickhand/classylss
classylss/__init__.py
https://github.com/nickhand/classylss/blob/b297cb25bc47ffed845470fe1c052346ea96cddd/classylss/__init__.py#L60-L99
def load_ini(filename): """ Read a CLASS ``.ini`` file, returning a dictionary of parameters Parameters ---------- filename : str the name of an existing parameter file to load, or one included as part of the CLASS source Returns ------- dict : the input paramet...
[ "def", "load_ini", "(", "filename", ")", ":", "# also look in data dir", "path", "=", "_find_file", "(", "filename", ")", "pars", "=", "{", "}", "with", "open", "(", "path", ",", "'r'", ")", "as", "ff", ":", "# loop over lines", "for", "lineno", ",", "li...
Read a CLASS ``.ini`` file, returning a dictionary of parameters Parameters ---------- filename : str the name of an existing parameter file to load, or one included as part of the CLASS source Returns ------- dict : the input parameters loaded from file
[ "Read", "a", "CLASS", ".", "ini", "file", "returning", "a", "dictionary", "of", "parameters" ]
python
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Taskmaster.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Taskmaster.py#L271-L285
def executed_without_callbacks(self): """ Called when the task has been successfully executed and the Taskmaster instance doesn't want to call the Node's callback methods. """ T = self.tm.trace if T: T.write(self.trace_message('Task.executed_without_callbacks()', ...
[ "def", "executed_without_callbacks", "(", "self", ")", ":", "T", "=", "self", ".", "tm", ".", "trace", "if", "T", ":", "T", ".", "write", "(", "self", ".", "trace_message", "(", "'Task.executed_without_callbacks()'", ",", "self", ".", "node", ")", ")", "...
Called when the task has been successfully executed and the Taskmaster instance doesn't want to call the Node's callback methods.
[ "Called", "when", "the", "task", "has", "been", "successfully", "executed", "and", "the", "Taskmaster", "instance", "doesn", "t", "want", "to", "call", "the", "Node", "s", "callback", "methods", "." ]
python
train
Azure/azure-cosmos-python
azure/cosmos/auth.py
https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/auth.py#L69-L114
def __GetAuthorizationTokenUsingMasterKey(verb, resource_id_or_fullname, resource_type, headers, master_key): """Gets the authorization token using `mas...
[ "def", "__GetAuthorizationTokenUsingMasterKey", "(", "verb", ",", "resource_id_or_fullname", ",", "resource_type", ",", "headers", ",", "master_key", ")", ":", "# decodes the master key which is encoded in base64 ", "key", "=", "base64", ".", "b64decode", "(", "master_ke...
Gets the authorization token using `master_key. :param str verb: :param str resource_id_or_fullname: :param str resource_type: :param dict headers: :param str master_key: :return: The authorization token. :rtype: dict
[ "Gets", "the", "authorization", "token", "using", "master_key", "." ]
python
train
rsmuc/health_monitoring_plugins
health_monitoring_plugins/check_snmp_ilo4/check_snmp_ilo4.py
https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_ilo4/check_snmp_ilo4.py#L350-L369
def check_power_redundancy(): """ Check if the power supplies are redundant The check is skipped if --noPowerRedundancy is set """ # skip the check if --noPowerRedundancy is set if power_redundancy_flag: # walk the data ps_redundant_data = walk_data(sess, oid_ps_redundant...
[ "def", "check_power_redundancy", "(", ")", ":", "# skip the check if --noPowerRedundancy is set", "if", "power_redundancy_flag", ":", "# walk the data ", "ps_redundant_data", "=", "walk_data", "(", "sess", ",", "oid_ps_redundant", ",", "helper", ")", "[", "0", "]",...
Check if the power supplies are redundant The check is skipped if --noPowerRedundancy is set
[ "Check", "if", "the", "power", "supplies", "are", "redundant", "The", "check", "is", "skipped", "if", "--", "noPowerRedundancy", "is", "set" ]
python
train
pywbem/pywbem
attic/cimxml_parse.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/attic/cimxml_parse.py#L319-L334
def parse_namespace(parser, event, node): #pylint: disable=unused-argument """Parse the CIM/XML NAMESPACE element and return the value of the CIMName attribute <!ELEMENT NAMESPACE EMPTY> <!ATTLIST NAMESPACE %CIMName; """ name = _get_required_attribute(node, ...
[ "def", "parse_namespace", "(", "parser", ",", "event", ",", "node", ")", ":", "#pylint: disable=unused-argument", "name", "=", "_get_required_attribute", "(", "node", ",", "'NAME'", ")", "(", "next_event", ",", "next_node", ")", "=", "six", ".", "next", "(", ...
Parse the CIM/XML NAMESPACE element and return the value of the CIMName attribute <!ELEMENT NAMESPACE EMPTY> <!ATTLIST NAMESPACE %CIMName;
[ "Parse", "the", "CIM", "/", "XML", "NAMESPACE", "element", "and", "return", "the", "value", "of", "the", "CIMName", "attribute", "<!ELEMENT", "NAMESPACE", "EMPTY", ">", "<!ATTLIST", "NAMESPACE", "%CIMName", ";" ]
python
train
assamite/creamas
creamas/util.py
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/util.py#L173-L190
def split_addrs(addrs): '''Split addresses into dictionaries by hosts and ports. :param list addrs: A list of addresses. :returns: A dictionary of dictionaries, where ``dict[HOST][PORT]`` holds a list of all agent addresses in that environment. ''' splitted = {} for addr in add...
[ "def", "split_addrs", "(", "addrs", ")", ":", "splitted", "=", "{", "}", "for", "addr", "in", "addrs", ":", "host", ",", "port", ",", "_", "=", "_addr_key", "(", "addr", ")", "if", "host", "not", "in", "splitted", ":", "splitted", "[", "host", "]",...
Split addresses into dictionaries by hosts and ports. :param list addrs: A list of addresses. :returns: A dictionary of dictionaries, where ``dict[HOST][PORT]`` holds a list of all agent addresses in that environment.
[ "Split", "addresses", "into", "dictionaries", "by", "hosts", "and", "ports", "." ]
python
train
fabioz/PyDev.Debugger
_pydevd_bundle/pydevd_api.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydevd_bundle/pydevd_api.py#L513-L518
def request_get_variable_json(self, py_db, request, thread_id): ''' :param VariablesRequest request: ''' py_db.post_method_as_internal_command( thread_id, internal_get_variable_json, request)
[ "def", "request_get_variable_json", "(", "self", ",", "py_db", ",", "request", ",", "thread_id", ")", ":", "py_db", ".", "post_method_as_internal_command", "(", "thread_id", ",", "internal_get_variable_json", ",", "request", ")" ]
:param VariablesRequest request:
[ ":", "param", "VariablesRequest", "request", ":" ]
python
train
frispete/keyrings.cryptfile
keyrings/cryptfile/convert.py
https://github.com/frispete/keyrings.cryptfile/blob/cfa80d4848a5c3c0aeee41a954b2b120c80e69b2/keyrings/cryptfile/convert.py#L132-L142
def main(argv=None): """Main command line interface.""" if argv is None: argv = sys.argv[1:] cli = CommandLineTool() try: return cli.run(argv) except KeyboardInterrupt: print('Canceled') return 3
[ "def", "main", "(", "argv", "=", "None", ")", ":", "if", "argv", "is", "None", ":", "argv", "=", "sys", ".", "argv", "[", "1", ":", "]", "cli", "=", "CommandLineTool", "(", ")", "try", ":", "return", "cli", ".", "run", "(", "argv", ")", "except...
Main command line interface.
[ "Main", "command", "line", "interface", "." ]
python
test
yyuu/botornado
boto/sqs/queue.py
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/sqs/queue.py#L287-L302
def count_slow(self, page_size=10, vtimeout=10): """ Deprecated. This is the old 'count' method that actually counts the messages by reading them all. This gives an accurate count but is very slow for queues with non-trivial number of messasges. Instead, use get_attribute('Appr...
[ "def", "count_slow", "(", "self", ",", "page_size", "=", "10", ",", "vtimeout", "=", "10", ")", ":", "n", "=", "0", "l", "=", "self", ".", "get_messages", "(", "page_size", ",", "vtimeout", ")", "while", "l", ":", "for", "m", "in", "l", ":", "n",...
Deprecated. This is the old 'count' method that actually counts the messages by reading them all. This gives an accurate count but is very slow for queues with non-trivial number of messasges. Instead, use get_attribute('ApproximateNumberOfMessages') to take advantage of the new SQS ca...
[ "Deprecated", ".", "This", "is", "the", "old", "count", "method", "that", "actually", "counts", "the", "messages", "by", "reading", "them", "all", ".", "This", "gives", "an", "accurate", "count", "but", "is", "very", "slow", "for", "queues", "with", "non",...
python
train
mlouielu/twstock
twstock/legacy.py
https://github.com/mlouielu/twstock/blob/cddddcc084d2d00497d591ab3059e3205b755825/twstock/legacy.py#L119-L122
def best_buy_3(self): """三日均價由下往上 """ return self.data.continuous(self.data.moving_average(self.data.price, 3)) == 1
[ "def", "best_buy_3", "(", "self", ")", ":", "return", "self", ".", "data", ".", "continuous", "(", "self", ".", "data", ".", "moving_average", "(", "self", ".", "data", ".", "price", ",", "3", ")", ")", "==", "1" ]
三日均價由下往上
[ "三日均價由下往上" ]
python
train
AtteqCom/zsl
src/zsl/resource/json_server_resource.py
https://github.com/AtteqCom/zsl/blob/ab51a96da1780ff642912396d4b85bdcb72560c1/src/zsl/resource/json_server_resource.py#L47-L71
def _get_link_pages(page, per_page, count, page_url): # type: (int, int, int, str) -> Dict[str, str] """Create link header for page metadata. :param page: current page :param per_page: page limit :param count: count of all resources :param page_url: url for resources :return: dictionary wit...
[ "def", "_get_link_pages", "(", "page", ",", "per_page", ",", "count", ",", "page_url", ")", ":", "# type: (int, int, int, str) -> Dict[str, str]", "current_page", "=", "_page_arg", "(", "page", ")", "links", "=", "{", "}", "end", "=", "page", "*", "per_page", ...
Create link header for page metadata. :param page: current page :param per_page: page limit :param count: count of all resources :param page_url: url for resources :return: dictionary with name of the link as key and its url as value
[ "Create", "link", "header", "for", "page", "metadata", "." ]
python
train
google/grr
grr/core/grr_response_core/lib/rdfvalues/paths.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/rdfvalues/paths.py#L298-L314
def InterpolateGrouping(self, pattern): """Interpolate inline globbing groups.""" components = [] offset = 0 for match in GROUPING_PATTERN.finditer(pattern): components.append([pattern[offset:match.start()]]) # Expand the attribute into the set of possibilities: alternatives = match.g...
[ "def", "InterpolateGrouping", "(", "self", ",", "pattern", ")", ":", "components", "=", "[", "]", "offset", "=", "0", "for", "match", "in", "GROUPING_PATTERN", ".", "finditer", "(", "pattern", ")", ":", "components", ".", "append", "(", "[", "pattern", "...
Interpolate inline globbing groups.
[ "Interpolate", "inline", "globbing", "groups", "." ]
python
train
PmagPy/PmagPy
dev_setup.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dev_setup.py#L56-L96
def unix_install(): """ Edits or creates .bashrc, .bash_profile, and .profile files in the users HOME directory in order to add your current directory (hopefully your PmagPy directory) and assorted lower directories in the PmagPy/programs directory to your PATH environment variable. It also adds the...
[ "def", "unix_install", "(", ")", ":", "PmagPyDir", "=", "os", ".", "path", ".", "abspath", "(", "\".\"", ")", "COMMAND", "=", "\"\"\"\\n\nfor d in %s/programs/*/ \"%s/programs/\"; do\n case \":$PATH:\" in\n *\":$d:\"*) :;; # already there\n *) PMAGPATHS=\"$PMAGPATHS:$d\";; #...
Edits or creates .bashrc, .bash_profile, and .profile files in the users HOME directory in order to add your current directory (hopefully your PmagPy directory) and assorted lower directories in the PmagPy/programs directory to your PATH environment variable. It also adds the PmagPy and the PmagPy/progr...
[ "Edits", "or", "creates", ".", "bashrc", ".", "bash_profile", "and", ".", "profile", "files", "in", "the", "users", "HOME", "directory", "in", "order", "to", "add", "your", "current", "directory", "(", "hopefully", "your", "PmagPy", "directory", ")", "and", ...
python
train
lucasmaystre/choix
choix/mm.py
https://github.com/lucasmaystre/choix/blob/05a57a10bb707338113a9d91601ca528ead7a881/choix/mm.py#L198-L252
def choicerank( digraph, traffic_in, traffic_out, weight=None, initial_params=None, alpha=1.0, max_iter=10000, tol=1e-8): """Compute the MAP estimate of a network choice model's parameters. This function computes the maximum-a-posteriori (MAP) estimate of model parameters given a network st...
[ "def", "choicerank", "(", "digraph", ",", "traffic_in", ",", "traffic_out", ",", "weight", "=", "None", ",", "initial_params", "=", "None", ",", "alpha", "=", "1.0", ",", "max_iter", "=", "10000", ",", "tol", "=", "1e-8", ")", ":", "import", "networkx", ...
Compute the MAP estimate of a network choice model's parameters. This function computes the maximum-a-posteriori (MAP) estimate of model parameters given a network structure and node-level traffic data (see :ref:`data-network`), using the ChoiceRank algorithm [MG17]_, [KTVV15]_. The nodes are assumed ...
[ "Compute", "the", "MAP", "estimate", "of", "a", "network", "choice", "model", "s", "parameters", "." ]
python
train
openstack/horizon
openstack_dashboard/utils/config.py
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/utils/config.py#L26-L38
def load_config(files=None, root_path=None, local_path=None): """Load the configuration from specified files.""" config = cfg.ConfigOpts() config.register_opts([ cfg.Opt('root_path', default=root_path), cfg.Opt('local_path', default=local_path), ]) # XXX register actual config group...
[ "def", "load_config", "(", "files", "=", "None", ",", "root_path", "=", "None", ",", "local_path", "=", "None", ")", ":", "config", "=", "cfg", ".", "ConfigOpts", "(", ")", "config", ".", "register_opts", "(", "[", "cfg", ".", "Opt", "(", "'root_path'"...
Load the configuration from specified files.
[ "Load", "the", "configuration", "from", "specified", "files", "." ]
python
train
peerplays-network/python-peerplays
peerplays/peerplays.py
https://github.com/peerplays-network/python-peerplays/blob/188f04238e7e21d5f73e9b01099eea44289ef6b7/peerplays/peerplays.py#L1533-L1556
def bet_cancel(self, bet_to_cancel, account=None, **kwargs): """ Cancel a bet :param str bet_to_cancel: The identifier that identifies the bet to cancel :param str account: (optional) the account that owns the bet (defaults to ``default_account``) ...
[ "def", "bet_cancel", "(", "self", ",", "bet_to_cancel", ",", "account", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "account", ":", "if", "\"default_account\"", "in", "self", ".", "config", ":", "account", "=", "self", ".", "config", "...
Cancel a bet :param str bet_to_cancel: The identifier that identifies the bet to cancel :param str account: (optional) the account that owns the bet (defaults to ``default_account``)
[ "Cancel", "a", "bet" ]
python
train
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/tools/mavplayback.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/tools/mavplayback.py#L100-L109
def button(self, name, filename, command): '''add a button''' try: img = LoadImage(filename) b = Tkinter.Button(self.frame, image=img, command=command) b.image = img except Exception: b = Tkinter.Button(self.frame, text=filename, command=command) ...
[ "def", "button", "(", "self", ",", "name", ",", "filename", ",", "command", ")", ":", "try", ":", "img", "=", "LoadImage", "(", "filename", ")", "b", "=", "Tkinter", ".", "Button", "(", "self", ".", "frame", ",", "image", "=", "img", ",", "command"...
add a button
[ "add", "a", "button" ]
python
train
twitterdev/search-tweets-python
searchtweets/utils.py
https://github.com/twitterdev/search-tweets-python/blob/7875afb4f3ee125a9fdcf2e50b5ae761da5f46b5/searchtweets/utils.py#L60-L84
def merge_dicts(*dicts): """ Helpful function to merge / combine dictionaries and return a new dictionary. Args: dicts (list or Iterable): iterable set of dictionaries for merging. Returns: dict: dict with all keys from the passed list. Later dictionaries in the sequence wi...
[ "def", "merge_dicts", "(", "*", "dicts", ")", ":", "def", "_merge_dicts", "(", "dict1", ",", "dict2", ")", ":", "merged", "=", "dict1", ".", "copy", "(", ")", "merged", ".", "update", "(", "dict2", ")", "return", "merged", "return", "reduce", "(", "_...
Helpful function to merge / combine dictionaries and return a new dictionary. Args: dicts (list or Iterable): iterable set of dictionaries for merging. Returns: dict: dict with all keys from the passed list. Later dictionaries in the sequence will override duplicate keys from previ...
[ "Helpful", "function", "to", "merge", "/", "combine", "dictionaries", "and", "return", "a", "new", "dictionary", "." ]
python
train
SBRG/ssbio
ssbio/biopython/Bio/Struct/Protein.py
https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/biopython/Bio/Struct/Protein.py#L92-L131
def check_missing_atoms(self, template=None, ha_only=True): """ Checks for missing atoms based on a template. Default: Searches for missing heavy atoms (not Hydrogen) based on Bio.Struct.protein_residues Arguments: - template, dictionary, keys are residue names, values...
[ "def", "check_missing_atoms", "(", "self", ",", "template", "=", "None", ",", "ha_only", "=", "True", ")", ":", "missing_atoms", "=", "{", "}", "if", "not", "template", ":", "import", "protein_residues", "template", "=", "protein_residues", ".", "normal", "#...
Checks for missing atoms based on a template. Default: Searches for missing heavy atoms (not Hydrogen) based on Bio.Struct.protein_residues Arguments: - template, dictionary, keys are residue names, values list of atom names. - ha_only, boolean, default True, restrict check ...
[ "Checks", "for", "missing", "atoms", "based", "on", "a", "template", ".", "Default", ":", "Searches", "for", "missing", "heavy", "atoms", "(", "not", "Hydrogen", ")", "based", "on", "Bio", ".", "Struct", ".", "protein_residues", "Arguments", ":", "-", "tem...
python
train
SeabornGames/RequestClient
seaborn/request_client/api_call.py
https://github.com/SeabornGames/RequestClient/blob/21aeb951ddfdb6ee453ad0edc896ff224e06425d/seaborn/request_client/api_call.py#L568-L586
def time_report_item(self, label, message=None): """ This will return a dictionary for the given message based on timestamps :param label: :param message: str of the message to find the timestamp :return: dict of times """ next_ = TIMESTAMPS_ORDER[TIMESTAMP...
[ "def", "time_report_item", "(", "self", ",", "label", ",", "message", "=", "None", ")", ":", "next_", "=", "TIMESTAMPS_ORDER", "[", "TIMESTAMPS_ORDER", ".", "index", "(", "label", ")", "+", "1", "]", "while", "next_", "not", "in", "self", ".", "_timestam...
This will return a dictionary for the given message based on timestamps :param label: :param message: str of the message to find the timestamp :return: dict of times
[ "This", "will", "return", "a", "dictionary", "for", "the", "given", "message", "based", "on", "timestamps", ":", "param", "label", ":", ":", "param", "message", ":", "str", "of", "the", "message", "to", "find", "the", "timestamp", ":", "return", ":", "di...
python
train
limodou/uliweb
uliweb/core/SimpleFrame.py
https://github.com/limodou/uliweb/blob/34472f25e4bc0b954a35346672f94e84ef18b076/uliweb/core/SimpleFrame.py#L405-L424
def get_app_dir(app): """ Get an app's directory """ path = __app_dirs__.get(app) if path is not None: return path else: p = app.split('.') try: path = pkg.resource_filename(p[0], '') except ImportError as e: log.error("Can't import app %s"...
[ "def", "get_app_dir", "(", "app", ")", ":", "path", "=", "__app_dirs__", ".", "get", "(", "app", ")", "if", "path", "is", "not", "None", ":", "return", "path", "else", ":", "p", "=", "app", ".", "split", "(", "'.'", ")", "try", ":", "path", "=", ...
Get an app's directory
[ "Get", "an", "app", "s", "directory" ]
python
train
noxdafox/vminspect
vminspect/timeline.py
https://github.com/noxdafox/vminspect/blob/e685282564877e2d1950f1e09b292f4f4db1dbcd/vminspect/timeline.py#L216-L233
def generate_timeline(usnjrnl, filesystem_content): """Aggregates the data collected from the USN journal and the filesystem content. """ journal_content = defaultdict(list) for event in usnjrnl: journal_content[event.inode].append(event) for event in usnjrnl: try: ...
[ "def", "generate_timeline", "(", "usnjrnl", ",", "filesystem_content", ")", ":", "journal_content", "=", "defaultdict", "(", "list", ")", "for", "event", "in", "usnjrnl", ":", "journal_content", "[", "event", ".", "inode", "]", ".", "append", "(", "event", "...
Aggregates the data collected from the USN journal and the filesystem content.
[ "Aggregates", "the", "data", "collected", "from", "the", "USN", "journal", "and", "the", "filesystem", "content", "." ]
python
train
barrust/mediawiki
mediawiki/mediawiki.py
https://github.com/barrust/mediawiki/blob/292e0be6c752409062dceed325d74839caf16a9b/mediawiki/mediawiki.py#L543-L572
def prefixsearch(self, prefix, results=10): """ Perform a prefix search using the provided prefix string Args: prefix (str): Prefix string to use for search results (int): Number of pages with the prefix to return Returns: list: List of pa...
[ "def", "prefixsearch", "(", "self", ",", "prefix", ",", "results", "=", "10", ")", ":", "self", ".", "_check_query", "(", "prefix", ",", "\"Prefix must be specified\"", ")", "query_params", "=", "{", "\"list\"", ":", "\"prefixsearch\"", ",", "\"pssearch\"", ":...
Perform a prefix search using the provided prefix string Args: prefix (str): Prefix string to use for search results (int): Number of pages with the prefix to return Returns: list: List of page titles Note: **Per the do...
[ "Perform", "a", "prefix", "search", "using", "the", "provided", "prefix", "string" ]
python
train
ArchiveTeam/wpull
wpull/document/sitemap.py
https://github.com/ArchiveTeam/wpull/blob/ddf051aa3322479325ba20aa778cb2cb97606bf5/wpull/document/sitemap.py#L37-L41
def is_response(cls, response): '''Return whether the document is likely to be a Sitemap.''' if response.body: if cls.is_file(response.body): return True
[ "def", "is_response", "(", "cls", ",", "response", ")", ":", "if", "response", ".", "body", ":", "if", "cls", ".", "is_file", "(", "response", ".", "body", ")", ":", "return", "True" ]
Return whether the document is likely to be a Sitemap.
[ "Return", "whether", "the", "document", "is", "likely", "to", "be", "a", "Sitemap", "." ]
python
train
jasonrbriggs/stomp.py
stomp/protocol.py
https://github.com/jasonrbriggs/stomp.py/blob/643843c5fbf25fd24339dd0e69a9411c3d8b94c7/stomp/protocol.py#L68-L85
def begin(self, transaction=None, headers=None, **keyword_headers): """ Begin a transaction. :param str transaction: the identifier for the transaction (optional - if not specified a unique transaction id will be generated) :param dict headers: a map of any additional header...
[ "def", "begin", "(", "self", ",", "transaction", "=", "None", ",", "headers", "=", "None", ",", "*", "*", "keyword_headers", ")", ":", "headers", "=", "utils", ".", "merge_headers", "(", "[", "headers", ",", "keyword_headers", "]", ")", "if", "not", "t...
Begin a transaction. :param str transaction: the identifier for the transaction (optional - if not specified a unique transaction id will be generated) :param dict headers: a map of any additional headers the broker requires :param keyword_headers: any additional headers the broker ...
[ "Begin", "a", "transaction", "." ]
python
train
evhub/coconut
coconut/compiler/util.py
https://github.com/evhub/coconut/blob/ff97177344e7604e89a0a98a977a87ed2a56fc6d/coconut/compiler/util.py#L65-L100
def evaluate_tokens(tokens): """Evaluate the given tokens in the computation graph.""" if isinstance(tokens, str): return tokens elif isinstance(tokens, ParseResults): # evaluate the list portion of the ParseResults toklist, name, asList, modal = tokens.__getnewargs__() new_t...
[ "def", "evaluate_tokens", "(", "tokens", ")", ":", "if", "isinstance", "(", "tokens", ",", "str", ")", ":", "return", "tokens", "elif", "isinstance", "(", "tokens", ",", "ParseResults", ")", ":", "# evaluate the list portion of the ParseResults", "toklist", ",", ...
Evaluate the given tokens in the computation graph.
[ "Evaluate", "the", "given", "tokens", "in", "the", "computation", "graph", "." ]
python
train
wbond/asn1crypto
asn1crypto/core.py
https://github.com/wbond/asn1crypto/blob/ecda20176f55d37021cbca1f6da9083a8e491197/asn1crypto/core.py#L3221-L3234
def _is_mutated(self): """ :return: A boolean - if the sequence or any children (recursively) have been mutated """ mutated = self._mutated if self.children is not None: for child in self.children: if isinstance(child, Sequence...
[ "def", "_is_mutated", "(", "self", ")", ":", "mutated", "=", "self", ".", "_mutated", "if", "self", ".", "children", "is", "not", "None", ":", "for", "child", "in", "self", ".", "children", ":", "if", "isinstance", "(", "child", ",", "Sequence", ")", ...
:return: A boolean - if the sequence or any children (recursively) have been mutated
[ ":", "return", ":", "A", "boolean", "-", "if", "the", "sequence", "or", "any", "children", "(", "recursively", ")", "have", "been", "mutated" ]
python
train
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiV4VirtualInterface.py
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiV4VirtualInterface.py#L89-L99
def create(self, virtual_interfaces): """ Method to create Virtual Interfaces :param Virtual Interfaces: List containing Virtual Interfaces desired to be created on database :return: None """ data = {'virtual_interfaces': virtual_interfaces} return super(ApiV4Vi...
[ "def", "create", "(", "self", ",", "virtual_interfaces", ")", ":", "data", "=", "{", "'virtual_interfaces'", ":", "virtual_interfaces", "}", "return", "super", "(", "ApiV4VirtualInterface", ",", "self", ")", ".", "post", "(", "'api/v4/virtual-interface/'", ",", ...
Method to create Virtual Interfaces :param Virtual Interfaces: List containing Virtual Interfaces desired to be created on database :return: None
[ "Method", "to", "create", "Virtual", "Interfaces" ]
python
train
nion-software/nionswift
nion/swift/Facade.py
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1156-L1172
def set_metadata_value(self, key: str, value: typing.Any) -> None: """Set the metadata value for the given key. There are a set of predefined keys that, when used, will be type checked and be interoperable with other applications. Please consult reference documentation for valid keys. ...
[ "def", "set_metadata_value", "(", "self", ",", "key", ":", "str", ",", "value", ":", "typing", ".", "Any", ")", "->", "None", ":", "self", ".", "_data_item", ".", "set_metadata_value", "(", "key", ",", "value", ")" ]
Set the metadata value for the given key. There are a set of predefined keys that, when used, will be type checked and be interoperable with other applications. Please consult reference documentation for valid keys. If using a custom key, we recommend structuring your keys in the '<group>.<att...
[ "Set", "the", "metadata", "value", "for", "the", "given", "key", "." ]
python
train
spacetelescope/drizzlepac
drizzlepac/util.py
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/util.py#L680-L743
def getDefaultConfigObj(taskname,configObj,input_dict={},loadOnly=True): """ Return default configObj instance for task updated with user-specified values from input_dict. Parameters ---------- taskname : string Name of task to load into TEAL configObj : string ...
[ "def", "getDefaultConfigObj", "(", "taskname", ",", "configObj", ",", "input_dict", "=", "{", "}", ",", "loadOnly", "=", "True", ")", ":", "if", "configObj", "is", "None", ":", "# Start by grabbing the default values without using the GUI", "# This insures that all subs...
Return default configObj instance for task updated with user-specified values from input_dict. Parameters ---------- taskname : string Name of task to load into TEAL configObj : string The valid values for 'configObj' would be:: None ...
[ "Return", "default", "configObj", "instance", "for", "task", "updated", "with", "user", "-", "specified", "values", "from", "input_dict", "." ]
python
train
albertz/py_better_exchook
better_exchook.py
https://github.com/albertz/py_better_exchook/blob/3d524a027d7fc4e83e47e39a1978849561da69b3/better_exchook.py#L219-L260
def simple_debug_shell(globals, locals): """ :param dict[str] globals: :param dict[str] locals: :return: nothing """ try: import readline except ImportError: pass # ignore compile_string_fn = "<simple_debug_shell input>" while True: try: s = raw_i...
[ "def", "simple_debug_shell", "(", "globals", ",", "locals", ")", ":", "try", ":", "import", "readline", "except", "ImportError", ":", "pass", "# ignore", "compile_string_fn", "=", "\"<simple_debug_shell input>\"", "while", "True", ":", "try", ":", "s", "=", "raw...
:param dict[str] globals: :param dict[str] locals: :return: nothing
[ ":", "param", "dict", "[", "str", "]", "globals", ":", ":", "param", "dict", "[", "str", "]", "locals", ":", ":", "return", ":", "nothing" ]
python
train
shaypal5/pdutil
pdutil/display/display.py
https://github.com/shaypal5/pdutil/blob/231059634643af2558d22070f89767410978cf56/pdutil/display/display.py#L9-L42
def df_string(df, percentage_columns=(), format_map=None, **kwargs): """Return a nicely formatted string for the given dataframe. Arguments --------- df : pandas.DataFrame A dataframe object. percentage_columns : iterable A list of cloumn names to be displayed with a percentage sign...
[ "def", "df_string", "(", "df", ",", "percentage_columns", "=", "(", ")", ",", "format_map", "=", "None", ",", "*", "*", "kwargs", ")", ":", "formatters_map", "=", "{", "}", "for", "col", ",", "dtype", "in", "df", ".", "dtypes", ".", "iteritems", "(",...
Return a nicely formatted string for the given dataframe. Arguments --------- df : pandas.DataFrame A dataframe object. percentage_columns : iterable A list of cloumn names to be displayed with a percentage sign. Returns ------- str A nicely formatted string for the...
[ "Return", "a", "nicely", "formatted", "string", "for", "the", "given", "dataframe", "." ]
python
train
sethmlarson/virtualbox-python
virtualbox/library_ext/virtual_system_description.py
https://github.com/sethmlarson/virtualbox-python/blob/706c8e3f6e3aee17eb06458e73cbb4bc2d37878b/virtualbox/library_ext/virtual_system_description.py#L18-L48
def set_final_value(self, description_type, value): """Set the value for the given description type. in description_type type :class:`VirtualSystemDescriptionType` in value type str """ types, _, _, vbox_values, extra_config = self.get_description() # find offset to de...
[ "def", "set_final_value", "(", "self", ",", "description_type", ",", "value", ")", ":", "types", ",", "_", ",", "_", ",", "vbox_values", ",", "extra_config", "=", "self", ".", "get_description", "(", ")", "# find offset to description type", "for", "offset", "...
Set the value for the given description type. in description_type type :class:`VirtualSystemDescriptionType` in value type str
[ "Set", "the", "value", "for", "the", "given", "description", "type", "." ]
python
train
fboender/ansible-cmdb
src/ansiblecmdb/ansible.py
https://github.com/fboender/ansible-cmdb/blob/ebd960ac10684e8c9ec2b12751bba2c4c9504ab7/src/ansiblecmdb/ansible.py#L363-L390
def get_hosts(self): """ Return a list of parsed hosts info, with the limit applied if required. """ limited_hosts = {} if self.limit is not None: # Find hosts and groups of hosts to include for include in self.limit['include']: # Include w...
[ "def", "get_hosts", "(", "self", ")", ":", "limited_hosts", "=", "{", "}", "if", "self", ".", "limit", "is", "not", "None", ":", "# Find hosts and groups of hosts to include", "for", "include", "in", "self", ".", "limit", "[", "'include'", "]", ":", "# Inclu...
Return a list of parsed hosts info, with the limit applied if required.
[ "Return", "a", "list", "of", "parsed", "hosts", "info", "with", "the", "limit", "applied", "if", "required", "." ]
python
train
anomaly/vishnu
vishnu/cipher.py
https://github.com/anomaly/vishnu/blob/5b3a6a69beedc8554cc506ddfab273760d61dc65/vishnu/cipher.py#L62-L72
def decrypt(self, encrypted): """ Base64 decodes the data and then decrypts using AES. :param encrypted: :return: """ decoded = b64decode(encrypted) init_vec = decoded[:AES.block_size] cipher = AES.new(self._key, AES.MODE_CBC, init_vec) return AES...
[ "def", "decrypt", "(", "self", ",", "encrypted", ")", ":", "decoded", "=", "b64decode", "(", "encrypted", ")", "init_vec", "=", "decoded", "[", ":", "AES", ".", "block_size", "]", "cipher", "=", "AES", ".", "new", "(", "self", ".", "_key", ",", "AES"...
Base64 decodes the data and then decrypts using AES. :param encrypted: :return:
[ "Base64", "decodes", "the", "data", "and", "then", "decrypts", "using", "AES", ".", ":", "param", "encrypted", ":", ":", "return", ":" ]
python
train
bpsmith/tia
tia/bbg/bbg_com.py
https://github.com/bpsmith/tia/blob/a7043b6383e557aeea8fc7112bbffd6e36a230e9/tia/bbg/bbg_com.py#L406-L417
def on_security_data_node(self, node): """process a securityData node - FIXME: currently not handling relateDate node """ sid = XmlHelper.get_child_value(node, 'security') farr = node.GetElement('fieldData') dmap = defaultdict(list) for i in range(farr.NumValues): pt ...
[ "def", "on_security_data_node", "(", "self", ",", "node", ")", ":", "sid", "=", "XmlHelper", ".", "get_child_value", "(", "node", ",", "'security'", ")", "farr", "=", "node", ".", "GetElement", "(", "'fieldData'", ")", "dmap", "=", "defaultdict", "(", "lis...
process a securityData node - FIXME: currently not handling relateDate node
[ "process", "a", "securityData", "node", "-", "FIXME", ":", "currently", "not", "handling", "relateDate", "node" ]
python
train
manns/pyspread
pyspread/src/gui/_dialogs.py
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L881-L907
def OnApply(self, event): """Event handler for Apply button""" # See if we have valid python try: ast.parse(self.macros) except: # Grab the traceback and print it for the user s = StringIO() e = exc_info() # usr_tb will more th...
[ "def", "OnApply", "(", "self", ",", "event", ")", ":", "# See if we have valid python", "try", ":", "ast", ".", "parse", "(", "self", ".", "macros", ")", "except", ":", "# Grab the traceback and print it for the user", "s", "=", "StringIO", "(", ")", "e", "=",...
Event handler for Apply button
[ "Event", "handler", "for", "Apply", "button" ]
python
train
wndhydrnt/python-oauth2
oauth2/grant.py
https://github.com/wndhydrnt/python-oauth2/blob/abe3bf5f27bda2ff737cab387b040e2e6e85c2e2/oauth2/grant.py#L56-L66
def json_error_response(error, response, status_code=400): """ Formats an error as a response containing a JSON body. """ msg = {"error": error.error, "error_description": error.explanation} response.status_code = status_code response.add_header("Content-Type", "application/json") response....
[ "def", "json_error_response", "(", "error", ",", "response", ",", "status_code", "=", "400", ")", ":", "msg", "=", "{", "\"error\"", ":", "error", ".", "error", ",", "\"error_description\"", ":", "error", ".", "explanation", "}", "response", ".", "status_cod...
Formats an error as a response containing a JSON body.
[ "Formats", "an", "error", "as", "a", "response", "containing", "a", "JSON", "body", "." ]
python
train
saltstack/salt
salt/utils/win_pdh.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_pdh.py#L183-L191
def add_to_query(self, query): ''' Add the current path to the query Args: query (obj): The handle to the query to add the counter ''' self.handle = win32pdh.AddCounter(query, self.path)
[ "def", "add_to_query", "(", "self", ",", "query", ")", ":", "self", ".", "handle", "=", "win32pdh", ".", "AddCounter", "(", "query", ",", "self", ".", "path", ")" ]
Add the current path to the query Args: query (obj): The handle to the query to add the counter
[ "Add", "the", "current", "path", "to", "the", "query" ]
python
train
fermiPy/fermipy
fermipy/irfs.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/irfs.py#L915-L932
def calc_wtd_exp(skydir, ltc, event_class, event_types, egy_bins, cth_bins, fn, nbin=16): """Calculate the effective exposure. Parameters ---------- skydir : `~astropy.coordinates.SkyCoord` ltc : `~fermipy.irfs.LTCube` nbin : int Number of points per decade with w...
[ "def", "calc_wtd_exp", "(", "skydir", ",", "ltc", ",", "event_class", ",", "event_types", ",", "egy_bins", ",", "cth_bins", ",", "fn", ",", "nbin", "=", "16", ")", ":", "cnts", "=", "calc_counts_edisp", "(", "skydir", ",", "ltc", ",", "event_class", ",",...
Calculate the effective exposure. Parameters ---------- skydir : `~astropy.coordinates.SkyCoord` ltc : `~fermipy.irfs.LTCube` nbin : int Number of points per decade with which to sample true energy.
[ "Calculate", "the", "effective", "exposure", "." ]
python
train
bovee/Aston
aston/trace/math_chromatograms.py
https://github.com/bovee/Aston/blob/007630fdf074690373d03398fe818260d3d3cf5a/aston/trace/math_chromatograms.py#L6-L11
def molmz(df, noise=10000): """ The mz of the molecular ion. """ d = ((df.values > noise) * df.columns).max(axis=1) return Trace(d, df.index, name='molmz')
[ "def", "molmz", "(", "df", ",", "noise", "=", "10000", ")", ":", "d", "=", "(", "(", "df", ".", "values", ">", "noise", ")", "*", "df", ".", "columns", ")", ".", "max", "(", "axis", "=", "1", ")", "return", "Trace", "(", "d", ",", "df", "."...
The mz of the molecular ion.
[ "The", "mz", "of", "the", "molecular", "ion", "." ]
python
train
nikhilkumarsingh/gnewsclient
gnewsclient/gnewsclient.py
https://github.com/nikhilkumarsingh/gnewsclient/blob/65422f1dee9408f1b51ae6a2ee08ae478432e1d5/gnewsclient/gnewsclient.py#L36-L51
def params_dict(self): """ function to get params dict for HTTP request """ location_code = 'US' language_code = 'en' if len(self.location): location_code = locationMap[process.extractOne(self.location, self.locations)[0]] if len(self.language): ...
[ "def", "params_dict", "(", "self", ")", ":", "location_code", "=", "'US'", "language_code", "=", "'en'", "if", "len", "(", "self", ".", "location", ")", ":", "location_code", "=", "locationMap", "[", "process", ".", "extractOne", "(", "self", ".", "locatio...
function to get params dict for HTTP request
[ "function", "to", "get", "params", "dict", "for", "HTTP", "request" ]
python
train
ejeschke/ginga
ginga/ImageView.py
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1866-L1881
def offset_to_window(self, off_x, off_y): """Convert data offset to window coordinates. Parameters ---------- off_x, off_y : float or ndarray Data offsets. Returns ------- coord : tuple Offset in window coordinates in the form of ``(x, y)...
[ "def", "offset_to_window", "(", "self", ",", "off_x", ",", "off_y", ")", ":", "arr_pts", "=", "np", ".", "asarray", "(", "(", "off_x", ",", "off_y", ")", ")", ".", "T", "return", "self", ".", "tform", "[", "'cartesian_to_native'", "]", ".", "to_", "(...
Convert data offset to window coordinates. Parameters ---------- off_x, off_y : float or ndarray Data offsets. Returns ------- coord : tuple Offset in window coordinates in the form of ``(x, y)``.
[ "Convert", "data", "offset", "to", "window", "coordinates", "." ]
python
train
titusjan/argos
argos/config/configitemdelegate.py
https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/config/configitemdelegate.py#L92-L109
def setModelData(self, editor, model, index): """ Gets data from the editor widget and stores it in the specified model at the item index. Does this by calling getEditorValue of the config tree item at the index. :type editor: QWidget :type model: ConfigTreeModel ...
[ "def", "setModelData", "(", "self", ",", "editor", ",", "model", ",", "index", ")", ":", "try", ":", "data", "=", "editor", ".", "getData", "(", ")", "except", "InvalidInputError", "as", "ex", ":", "logger", ".", "warn", "(", "ex", ")", "else", ":", ...
Gets data from the editor widget and stores it in the specified model at the item index. Does this by calling getEditorValue of the config tree item at the index. :type editor: QWidget :type model: ConfigTreeModel :type index: QModelIndex Reimplemented from ...
[ "Gets", "data", "from", "the", "editor", "widget", "and", "stores", "it", "in", "the", "specified", "model", "at", "the", "item", "index", ".", "Does", "this", "by", "calling", "getEditorValue", "of", "the", "config", "tree", "item", "at", "the", "index", ...
python
train
robotframework/Rammbock
src/Rammbock/rammbock.py
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/rammbock.py#L164-L172
def embed_seqdiag_sequence(self): """Create a message sequence diagram png file to output folder and embed the image to log file. You need to have seqdiag installed to create the sequence diagram. See http://blockdiag.com/en/seqdiag/ """ test_name = BuiltIn().replace_variables('${TEST N...
[ "def", "embed_seqdiag_sequence", "(", "self", ")", ":", "test_name", "=", "BuiltIn", "(", ")", ".", "replace_variables", "(", "'${TEST NAME}'", ")", "outputdir", "=", "BuiltIn", "(", ")", ".", "replace_variables", "(", "'${OUTPUTDIR}'", ")", "path", "=", "os",...
Create a message sequence diagram png file to output folder and embed the image to log file. You need to have seqdiag installed to create the sequence diagram. See http://blockdiag.com/en/seqdiag/
[ "Create", "a", "message", "sequence", "diagram", "png", "file", "to", "output", "folder", "and", "embed", "the", "image", "to", "log", "file", "." ]
python
train
log2timeline/plaso
plaso/cli/tools.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/cli/tools.py#L180-L190
def _PromptUserForInput(self, input_text): """Prompts user for an input. Args: input_text (str): text used for prompting the user for input. Returns: str: input read from the user. """ self._output_writer.Write('{0:s}: '.format(input_text)) return self._input_reader.Read()
[ "def", "_PromptUserForInput", "(", "self", ",", "input_text", ")", ":", "self", ".", "_output_writer", ".", "Write", "(", "'{0:s}: '", ".", "format", "(", "input_text", ")", ")", "return", "self", ".", "_input_reader", ".", "Read", "(", ")" ]
Prompts user for an input. Args: input_text (str): text used for prompting the user for input. Returns: str: input read from the user.
[ "Prompts", "user", "for", "an", "input", "." ]
python
train
tensorflow/cleverhans
examples/nips17_adversarial_competition/eval_infra/code/eval_lib/classification_results.py
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/examples/nips17_adversarial_competition/eval_infra/code/eval_lib/classification_results.py#L286-L292
def init_from_datastore(self): """Initializes data by reading it from the datastore.""" self._data = {} client = self._datastore_client for entity in client.query_fetch(kind=KIND_CLASSIFICATION_BATCH): class_batch_id = entity.key.flat_path[-1] self.data[class_batch_id] = dict(entity)
[ "def", "init_from_datastore", "(", "self", ")", ":", "self", ".", "_data", "=", "{", "}", "client", "=", "self", ".", "_datastore_client", "for", "entity", "in", "client", ".", "query_fetch", "(", "kind", "=", "KIND_CLASSIFICATION_BATCH", ")", ":", "class_ba...
Initializes data by reading it from the datastore.
[ "Initializes", "data", "by", "reading", "it", "from", "the", "datastore", "." ]
python
train
mitsei/dlkit
dlkit/json_/learning/objects.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/objects.py#L877-L887
def get_courses_metadata(self): """Gets the metadata for the courses. return: (osid.Metadata) - metadata for the courses *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.learning.ActivityForm.get_assets_metadata_template ...
[ "def", "get_courses_metadata", "(", "self", ")", ":", "# Implemented from template for osid.learning.ActivityForm.get_assets_metadata_template", "metadata", "=", "dict", "(", "self", ".", "_mdata", "[", "'courses'", "]", ")", "metadata", ".", "update", "(", "{", "'exist...
Gets the metadata for the courses. return: (osid.Metadata) - metadata for the courses *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "metadata", "for", "the", "courses", "." ]
python
train
Erotemic/utool
utool/util_cache.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_cache.py#L906-L910
def get_global_shelf_fpath(appname='default', ensure=False): """ Returns the filepath to the global shelf """ global_cache_dir = get_global_cache_dir(appname, ensure=ensure) shelf_fpath = join(global_cache_dir, meta_util_constants.global_cache_fname) return shelf_fpath
[ "def", "get_global_shelf_fpath", "(", "appname", "=", "'default'", ",", "ensure", "=", "False", ")", ":", "global_cache_dir", "=", "get_global_cache_dir", "(", "appname", ",", "ensure", "=", "ensure", ")", "shelf_fpath", "=", "join", "(", "global_cache_dir", ","...
Returns the filepath to the global shelf
[ "Returns", "the", "filepath", "to", "the", "global", "shelf" ]
python
train
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L1142-L1168
def cleanlines(self): """Cleaned code lines. Implemented cleanups: * eventually remove method version * remove docstrings * remove comments * remove empty lines * remove line brackes within brackets * replace `modelutils` with nothing ...
[ "def", "cleanlines", "(", "self", ")", ":", "code", "=", "inspect", ".", "getsource", "(", "self", ".", "func", ")", "code", "=", "'\\n'", ".", "join", "(", "code", ".", "split", "(", "'\"\"\"'", ")", "[", ":", ":", "2", "]", ")", "code", "=", ...
Cleaned code lines. Implemented cleanups: * eventually remove method version * remove docstrings * remove comments * remove empty lines * remove line brackes within brackets * replace `modelutils` with nothing * remove complete lines contain...
[ "Cleaned", "code", "lines", "." ]
python
train
Danielhiversen/pyTibber
tibber/__init__.py
https://github.com/Danielhiversen/pyTibber/blob/114ebc3dd49f6affd93665b0862d4cbdea03e9ef/tibber/__init__.py#L493-L500
def price_unit(self): """Return the price unit.""" currency = self.currency consumption_unit = self.consumption_unit if not currency or not consumption_unit: _LOGGER.error("Could not find price_unit.") return " " return currency + "/" + consumption_unit
[ "def", "price_unit", "(", "self", ")", ":", "currency", "=", "self", ".", "currency", "consumption_unit", "=", "self", ".", "consumption_unit", "if", "not", "currency", "or", "not", "consumption_unit", ":", "_LOGGER", ".", "error", "(", "\"Could not find price_u...
Return the price unit.
[ "Return", "the", "price", "unit", "." ]
python
valid
saltstack/salt
salt/modules/boto_efs.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_efs.py#L340-L365
def delete_tags(filesystemid, tags, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Deletes the specified tags from a file system. filesystemid (string) - ID of the file system for whose ...
[ "def", "delete_tags", "(", "filesystemid", ",", "tags", ",", "keyid", "=", "None", ",", "key", "=", "None", ",", "profile", "=", "None", ",", "region", "=", "None", ",", "*", "*", "kwargs", ")", ":", "client", "=", "_get_conn", "(", "key", "=", "ke...
Deletes the specified tags from a file system. filesystemid (string) - ID of the file system for whose tags will be removed. tags (list[string]) - The tag keys to delete to the file system CLI Example: .. code-block:: bash salt 'my-minion' boto_efs.delete_tags
[ "Deletes", "the", "specified", "tags", "from", "a", "file", "system", "." ]
python
train
IBMStreams/pypi.streamsx
streamsx/rest_primitives.py
https://github.com/IBMStreams/pypi.streamsx/blob/abd67b4757120f6f805787fba390f53e9df9cdd8/streamsx/rest_primitives.py#L1859-L1875
def create_application_configuration(self, name, properties, description=None): """Create an application configuration. Args: name (str, optional): Only return application configurations containing property **name** that matches `name`. `name` can be a .. versionadded 1.12 "...
[ "def", "create_application_configuration", "(", "self", ",", "name", ",", "properties", ",", "description", "=", "None", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'applicationConfigurations'", ")", ":", "raise", "NotImplementedError", "(", ")", "cv", ...
Create an application configuration. Args: name (str, optional): Only return application configurations containing property **name** that matches `name`. `name` can be a .. versionadded 1.12
[ "Create", "an", "application", "configuration", "." ]
python
train
bitesofcode/projexui
projexui/widgets/xtreewidget/xtreewidget.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtreewidget/xtreewidget.py#L321-L330
def __setUserMinimumSize( self, section, oldSize, newSize ): """ Records the user minimum size for a column. :param section | <int> oldSize | <int> newSize | <int> """ if self.isVisible(): self._columnMini...
[ "def", "__setUserMinimumSize", "(", "self", ",", "section", ",", "oldSize", ",", "newSize", ")", ":", "if", "self", ".", "isVisible", "(", ")", ":", "self", ".", "_columnMinimums", "[", "section", "]", "=", "newSize" ]
Records the user minimum size for a column. :param section | <int> oldSize | <int> newSize | <int>
[ "Records", "the", "user", "minimum", "size", "for", "a", "column", ".", ":", "param", "section", "|", "<int", ">", "oldSize", "|", "<int", ">", "newSize", "|", "<int", ">" ]
python
train
jtwhite79/pyemu
pyemu/utils/gw_utils.py
https://github.com/jtwhite79/pyemu/blob/c504d8e7a4097cec07655a6318d275739bd8148a/pyemu/utils/gw_utils.py#L2107-L2180
def modflow_sfr_gag_to_instruction_file(gage_output_file, ins_file=None, parse_filename=False): """writes an instruction file for an SFR gage output file to read Flow only at all times Parameters ---------- gage_output_file : str the gage output filename (ASCII). ...
[ "def", "modflow_sfr_gag_to_instruction_file", "(", "gage_output_file", ",", "ins_file", "=", "None", ",", "parse_filename", "=", "False", ")", ":", "if", "ins_file", "is", "None", ":", "ins_file", "=", "gage_output_file", "+", "'.ins'", "# navigate the file to be sure...
writes an instruction file for an SFR gage output file to read Flow only at all times Parameters ---------- gage_output_file : str the gage output filename (ASCII). ins_file : str the name of the instruction file to create. If None, the name ...
[ "writes", "an", "instruction", "file", "for", "an", "SFR", "gage", "output", "file", "to", "read", "Flow", "only", "at", "all", "times" ]
python
train
gwastro/pycbc-glue
pycbc_glue/pipeline.py
https://github.com/gwastro/pycbc-glue/blob/a3e906bae59fbfd707c3ff82e5d008d939ec5e24/pycbc_glue/pipeline.py#L1381-L1397
def write_job(self,fh): """ Write the DAG entry for this node's job to the DAG file descriptor. @param fh: descriptor of open DAG file. """ if isinstance(self.job(),CondorDAGManJob): # create an external subdag from this dag fh.write( ' '.join( ['SUBDAG EXTERNAL', self.__name, se...
[ "def", "write_job", "(", "self", ",", "fh", ")", ":", "if", "isinstance", "(", "self", ".", "job", "(", ")", ",", "CondorDAGManJob", ")", ":", "# create an external subdag from this dag", "fh", ".", "write", "(", "' '", ".", "join", "(", "[", "'SUBDAG EXTE...
Write the DAG entry for this node's job to the DAG file descriptor. @param fh: descriptor of open DAG file.
[ "Write", "the", "DAG", "entry", "for", "this", "node", "s", "job", "to", "the", "DAG", "file", "descriptor", "." ]
python
train
shaypal5/strct
strct/sortedlists/sortedlist.py
https://github.com/shaypal5/strct/blob/f3a301692d052ddb79331230b3c00625db1d83fc/strct/sortedlists/sortedlist.py#L110-L151
def find_range_in_section_list(start, end, section_list): """Returns all sections belonging to the given range. The given list is assumed to contain start points of consecutive sections, except for the final point, assumed to be the end point of the last section. For example, the list [5, 8, 30, 31] is...
[ "def", "find_range_in_section_list", "(", "start", ",", "end", ",", "section_list", ")", ":", "ind", "=", "find_range_ix_in_section_list", "(", "start", ",", "end", ",", "section_list", ")", "return", "section_list", "[", "ind", "[", "0", "]", ":", "ind", "[...
Returns all sections belonging to the given range. The given list is assumed to contain start points of consecutive sections, except for the final point, assumed to be the end point of the last section. For example, the list [5, 8, 30, 31] is interpreted as the following list of sections: [5-8), [8-30)...
[ "Returns", "all", "sections", "belonging", "to", "the", "given", "range", "." ]
python
train
swimlane/swimlane-python
swimlane/core/fields/usergroup.py
https://github.com/swimlane/swimlane-python/blob/588fc503a76799bcdb5aecdf2f64a6ee05e3922d/swimlane/core/fields/usergroup.py#L105-L110
def set_swimlane(self, value): """Workaround for reports returning an empty usergroup field as a single element list with no id/name""" if value == [{"$type": "Core.Models.Utilities.UserGroupSelection, Core"}]: value = [] return super(UserGroupField, self).set_swimlane(value)
[ "def", "set_swimlane", "(", "self", ",", "value", ")", ":", "if", "value", "==", "[", "{", "\"$type\"", ":", "\"Core.Models.Utilities.UserGroupSelection, Core\"", "}", "]", ":", "value", "=", "[", "]", "return", "super", "(", "UserGroupField", ",", "self", "...
Workaround for reports returning an empty usergroup field as a single element list with no id/name
[ "Workaround", "for", "reports", "returning", "an", "empty", "usergroup", "field", "as", "a", "single", "element", "list", "with", "no", "id", "/", "name" ]
python
train
spacetelescope/pysynphot
pysynphot/observation.py
https://github.com/spacetelescope/pysynphot/blob/a125ff956f4d94beb157bd51899747a13234bb97/pysynphot/observation.py#L26-L78
def check_overlap(a, b): """Check for wavelength overlap between two spectra. .. note:: Generalized from :meth:`pysynphot.spectrum.SpectralElement.check_overlap`. Parameters ---------- a, b : `~pysynphot.spectrum.SourceSpectrum` or `~pysynphot.spectrum.SpectralElement` Typi...
[ "def", "check_overlap", "(", "a", ",", "b", ")", ":", "if", "a", ".", "isAnalytic", "or", "b", ".", "isAnalytic", ":", "#then it's defined everywhere", "result", "=", "'full'", "else", ":", "#get the wavelength arrays", "waves", "=", "list", "(", ")", "for",...
Check for wavelength overlap between two spectra. .. note:: Generalized from :meth:`pysynphot.spectrum.SpectralElement.check_overlap`. Parameters ---------- a, b : `~pysynphot.spectrum.SourceSpectrum` or `~pysynphot.spectrum.SpectralElement` Typically a source spectrum, spectra...
[ "Check", "for", "wavelength", "overlap", "between", "two", "spectra", "." ]
python
train
google/transitfeed
misc/import_ch_zurich.py
https://github.com/google/transitfeed/blob/eb2991a3747ba541b2cb66502b305b6304a1f85f/misc/import_ch_zurich.py#L387-L400
def Write(self, outpath): "Writes a .zip file in Google Transit format." out = zipfile.ZipFile(outpath, mode="w", compression=zipfile.ZIP_DEFLATED) for filename, func in [('agency.txt', self.WriteAgency), ('calendar.txt', self.WriteCalendar), ('calendar_...
[ "def", "Write", "(", "self", ",", "outpath", ")", ":", "out", "=", "zipfile", ".", "ZipFile", "(", "outpath", ",", "mode", "=", "\"w\"", ",", "compression", "=", "zipfile", ".", "ZIP_DEFLATED", ")", "for", "filename", ",", "func", "in", "[", "(", "'a...
Writes a .zip file in Google Transit format.
[ "Writes", "a", ".", "zip", "file", "in", "Google", "Transit", "format", "." ]
python
train
pyviz/param
param/parameterized.py
https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1453-L1475
def get_param_values(self_,onlychanged=False): """ Return a list of name,value pairs for all Parameters of this object. When called on an instance with onlychanged set to True, will only return values that are not equal to the default value (onlychanged has no effect whe...
[ "def", "get_param_values", "(", "self_", ",", "onlychanged", "=", "False", ")", ":", "self_or_cls", "=", "self_", ".", "self_or_cls", "# CEB: we'd actually like to know whether a value has been", "# explicitly set on the instance, but I'm not sure that's easy", "# (would need to di...
Return a list of name,value pairs for all Parameters of this object. When called on an instance with onlychanged set to True, will only return values that are not equal to the default value (onlychanged has no effect when called on a class).
[ "Return", "a", "list", "of", "name", "value", "pairs", "for", "all", "Parameters", "of", "this", "object", "." ]
python
train
dh1tw/pyhamtools
pyhamtools/lookuplib.py
https://github.com/dh1tw/pyhamtools/blob/ee7e4b8732e23c298da10e07163748156c16d0fa/pyhamtools/lookuplib.py#L1084-L1119
def _extract_clublog_header(self, cty_xml_filename): """ Extract the header of the Clublog XML File """ cty_header = {} try: with open(cty_xml_filename, "r") as cty: raw_header = cty.readline() cty_date = re.search("date='.+'", raw_heade...
[ "def", "_extract_clublog_header", "(", "self", ",", "cty_xml_filename", ")", ":", "cty_header", "=", "{", "}", "try", ":", "with", "open", "(", "cty_xml_filename", ",", "\"r\"", ")", "as", "cty", ":", "raw_header", "=", "cty", ".", "readline", "(", ")", ...
Extract the header of the Clublog XML File
[ "Extract", "the", "header", "of", "the", "Clublog", "XML", "File" ]
python
train
jamescooke/flake8-aaa
src/flake8_aaa/helpers.py
https://github.com/jamescooke/flake8-aaa/blob/29938b96845fe32ced4358ba66af3b3be2a37794/src/flake8_aaa/helpers.py#L170-L178
def filter_arrange_nodes(nodes: List[ast.stmt], max_line_number: int) -> List[ast.stmt]: """ Finds all nodes that are before the ``max_line_number`` and are not docstrings or ``pass``. """ return [ node for node in nodes if node.lineno < max_line_number and not isinstance(node, ast.Pass) ...
[ "def", "filter_arrange_nodes", "(", "nodes", ":", "List", "[", "ast", ".", "stmt", "]", ",", "max_line_number", ":", "int", ")", "->", "List", "[", "ast", ".", "stmt", "]", ":", "return", "[", "node", "for", "node", "in", "nodes", "if", "node", ".", ...
Finds all nodes that are before the ``max_line_number`` and are not docstrings or ``pass``.
[ "Finds", "all", "nodes", "that", "are", "before", "the", "max_line_number", "and", "are", "not", "docstrings", "or", "pass", "." ]
python
train
Azure/azure-sdk-for-python
azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py
https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py#L1950-L1970
def share_vm_image(self, vm_image_name, permission): ''' Share an already replicated OS image. This operation is only for publishers. You have to be registered as image publisher with Windows Azure to be able to call this. vm_image_name: The name of the virtual machi...
[ "def", "share_vm_image", "(", "self", ",", "vm_image_name", ",", "permission", ")", ":", "_validate_not_none", "(", "'vm_image_name'", ",", "vm_image_name", ")", "_validate_not_none", "(", "'permission'", ",", "permission", ")", "path", "=", "self", ".", "_get_sha...
Share an already replicated OS image. This operation is only for publishers. You have to be registered as image publisher with Windows Azure to be able to call this. vm_image_name: The name of the virtual machine image to share permission: The sharing permission:...
[ "Share", "an", "already", "replicated", "OS", "image", ".", "This", "operation", "is", "only", "for", "publishers", ".", "You", "have", "to", "be", "registered", "as", "image", "publisher", "with", "Windows", "Azure", "to", "be", "able", "to", "call", "thi...
python
test
mongodb/mongo-python-driver
pymongo/client_session.py
https://github.com/mongodb/mongo-python-driver/blob/c29c21449e3aae74154207058cf85fd94018d4cd/pymongo/client_session.py#L382-L502
def with_transaction(self, callback, read_concern=None, write_concern=None, read_preference=None): """Execute a callback in a transaction. This method starts a transaction on this session, executes ``callback`` once, and then commits the transaction. For example:: ...
[ "def", "with_transaction", "(", "self", ",", "callback", ",", "read_concern", "=", "None", ",", "write_concern", "=", "None", ",", "read_preference", "=", "None", ")", ":", "start_time", "=", "monotonic", ".", "time", "(", ")", "while", "True", ":", "self"...
Execute a callback in a transaction. This method starts a transaction on this session, executes ``callback`` once, and then commits the transaction. For example:: def callback(session): orders = session.client.db.orders inventory = session.client.db.inventory ...
[ "Execute", "a", "callback", "in", "a", "transaction", "." ]
python
train
DLR-RM/RAFCON
source/rafcon/utils/geometry.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/utils/geometry.py#L70-L89
def point_in_triangle(p, v1, v2, v3): """Checks whether a point is within the given triangle The function checks, whether the given point p is within the triangle defined by the the three corner point v1, v2 and v3. This is done by checking whether the point is on all three half-planes defined by the t...
[ "def", "point_in_triangle", "(", "p", ",", "v1", ",", "v2", ",", "v3", ")", ":", "def", "_test", "(", "p1", ",", "p2", ",", "p3", ")", ":", "return", "(", "p1", "[", "0", "]", "-", "p3", "[", "0", "]", ")", "*", "(", "p2", "[", "1", "]", ...
Checks whether a point is within the given triangle The function checks, whether the given point p is within the triangle defined by the the three corner point v1, v2 and v3. This is done by checking whether the point is on all three half-planes defined by the three edges of the triangle. :param p: The...
[ "Checks", "whether", "a", "point", "is", "within", "the", "given", "triangle" ]
python
train
google/grr
grr/server/grr_response_server/signed_binary_utils.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/signed_binary_utils.py#L113-L149
def WriteSignedBinaryBlobs(binary_urn, blobs, token = None): """Saves signed blobs to the datastore. If a signed binary with the given URN already exists, its contents will get overwritten. Args: binary_urn: RDFURN that should serve as a unique identif...
[ "def", "WriteSignedBinaryBlobs", "(", "binary_urn", ",", "blobs", ",", "token", "=", "None", ")", ":", "if", "_ShouldUseLegacyDatastore", "(", ")", ":", "aff4", ".", "FACTORY", ".", "Delete", "(", "binary_urn", ",", "token", "=", "token", ")", "with", "dat...
Saves signed blobs to the datastore. If a signed binary with the given URN already exists, its contents will get overwritten. Args: binary_urn: RDFURN that should serve as a unique identifier for the binary. blobs: An Iterable of signed blobs to write to the datastore. token: ACL token to use with t...
[ "Saves", "signed", "blobs", "to", "the", "datastore", "." ]
python
train
slimkrazy/python-google-places
googleplaces/__init__.py
https://github.com/slimkrazy/python-google-places/blob/d4b7363e1655cdc091a6253379f6d2a95b827881/googleplaces/__init__.py#L922-L930
def vicinity(self): """Returns a feature name of a nearby location. Often this feature refers to a street or neighborhood within the given results. """ if self._vicinity == '' and self.details != None and 'vicinity' in self.details: self._vicinity = self.details['vic...
[ "def", "vicinity", "(", "self", ")", ":", "if", "self", ".", "_vicinity", "==", "''", "and", "self", ".", "details", "!=", "None", "and", "'vicinity'", "in", "self", ".", "details", ":", "self", ".", "_vicinity", "=", "self", ".", "details", "[", "'v...
Returns a feature name of a nearby location. Often this feature refers to a street or neighborhood within the given results.
[ "Returns", "a", "feature", "name", "of", "a", "nearby", "location", "." ]
python
train
deep-compute/basescript
basescript/log.py
https://github.com/deep-compute/basescript/blob/f7233963c5291530fcb2444a7f45b556e6407b90/basescript/log.py#L177-L186
def critical(self, event=None, *args, **kw): """ Process event and call :meth:`logging.Logger.critical` with the result. """ if not self._logger.isEnabledFor(logging.CRITICAL): return kw = self._add_base_info(kw) kw['level'] = "critical" return self._...
[ "def", "critical", "(", "self", ",", "event", "=", "None", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "if", "not", "self", ".", "_logger", ".", "isEnabledFor", "(", "logging", ".", "CRITICAL", ")", ":", "return", "kw", "=", "self", ".", "_a...
Process event and call :meth:`logging.Logger.critical` with the result.
[ "Process", "event", "and", "call", ":", "meth", ":", "logging", ".", "Logger", ".", "critical", "with", "the", "result", "." ]
python
train
awacha/credolib
credolib/procedures.py
https://github.com/awacha/credolib/blob/11c0be3eea7257d3d6e13697d3e76ce538f2f1b2/credolib/procedures.py#L136-L367
def summarize(reintegrate=True, dist_tolerance=3, qranges=None, samples=None, raw=False, late_radavg=True, graph_ncols=3, std_multiplier=3, graph_extension='png', graph_dpi=80, correlmatrix_colormap='coolwarm', image_colormap='viridis', correlmatrix_logarithmic=Tr...
[ "def", "summarize", "(", "reintegrate", "=", "True", ",", "dist_tolerance", "=", "3", ",", "qranges", "=", "None", ",", "samples", "=", "None", ",", "raw", "=", "False", ",", "late_radavg", "=", "True", ",", "graph_ncols", "=", "3", ",", "std_multiplier"...
Summarize scattering patterns and curves for all samples defined by the global `allsamplenames`. Inputs: reintegrate (bool, default=True): if the curves are to be obained by reintegrating the patterns. Otherwise 1D curves are loaded. dist_tolerance (float, default=3): sample-to...
[ "Summarize", "scattering", "patterns", "and", "curves", "for", "all", "samples", "defined", "by", "the", "global", "allsamplenames", ".", "Inputs", ":", "reintegrate", "(", "bool", "default", "=", "True", ")", ":", "if", "the", "curves", "are", "to", "be", ...
python
train
saltstack/salt
salt/modules/nova.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L292-L324
def volume_create(name, size=100, snapshot=None, voltype=None, profile=None, **kwargs): ''' Create a block storage volume name Name of the new volume (must be first) size Volume size snapshot Block storage snapshot id voltype Type of storage profile ...
[ "def", "volume_create", "(", "name", ",", "size", "=", "100", ",", "snapshot", "=", "None", ",", "voltype", "=", "None", ",", "profile", "=", "None", ",", "*", "*", "kwargs", ")", ":", "conn", "=", "_auth", "(", "profile", ",", "*", "*", "kwargs", ...
Create a block storage volume name Name of the new volume (must be first) size Volume size snapshot Block storage snapshot id voltype Type of storage profile Profile to build on CLI Example: .. code-block:: bash salt '*' nova.volume_cre...
[ "Create", "a", "block", "storage", "volume" ]
python
train
justquick/django-native-tags
native_tags/registry.py
https://github.com/justquick/django-native-tags/blob/d40b976ee1cb13faeb04f0dedf02933d4274abf2/native_tags/registry.py#L100-L107
def unregister(self, bucket, name): """ Remove the function from the registry by name """ assert bucket in self, 'Bucket %s is unknown' % bucket if not name in self[bucket]: raise NotRegistered('The function %s is not registered' % name) del self[bucket][name]
[ "def", "unregister", "(", "self", ",", "bucket", ",", "name", ")", ":", "assert", "bucket", "in", "self", ",", "'Bucket %s is unknown'", "%", "bucket", "if", "not", "name", "in", "self", "[", "bucket", "]", ":", "raise", "NotRegistered", "(", "'The functio...
Remove the function from the registry by name
[ "Remove", "the", "function", "from", "the", "registry", "by", "name" ]
python
train
Microsoft/nni
examples/trials/network_morphism/FashionMNIST/utils.py
https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/examples/trials/network_morphism/FashionMNIST/utils.py#L116-L137
def data_transforms_cifar10(args): """ data_transforms for cifar10 dataset """ cifar_mean = [0.49139968, 0.48215827, 0.44653124] cifar_std = [0.24703233, 0.24348505, 0.26158768] train_transform = transforms.Compose( [ transforms.RandomCrop(32, padding=4), transforms...
[ "def", "data_transforms_cifar10", "(", "args", ")", ":", "cifar_mean", "=", "[", "0.49139968", ",", "0.48215827", ",", "0.44653124", "]", "cifar_std", "=", "[", "0.24703233", ",", "0.24348505", ",", "0.26158768", "]", "train_transform", "=", "transforms", ".", ...
data_transforms for cifar10 dataset
[ "data_transforms", "for", "cifar10", "dataset" ]
python
train
ejeschke/ginga
ginga/Bindings.py
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/Bindings.py#L1696-L1702
def ms_contrast_restore(self, viewer, event, data_x, data_y, msg=True): """An interactive way to restore the colormap contrast settings after a warp operation. """ if self.cancmap and (event.state == 'down'): self.restore_contrast(viewer, msg=msg) return True
[ "def", "ms_contrast_restore", "(", "self", ",", "viewer", ",", "event", ",", "data_x", ",", "data_y", ",", "msg", "=", "True", ")", ":", "if", "self", ".", "cancmap", "and", "(", "event", ".", "state", "==", "'down'", ")", ":", "self", ".", "restore_...
An interactive way to restore the colormap contrast settings after a warp operation.
[ "An", "interactive", "way", "to", "restore", "the", "colormap", "contrast", "settings", "after", "a", "warp", "operation", "." ]
python
train
HazyResearch/fonduer
src/fonduer/candidates/mentions.py
https://github.com/HazyResearch/fonduer/blob/4520f86a716f03dcca458a9f4bddac75b4e7068f/src/fonduer/candidates/mentions.py#L246-L260
def apply(self, doc): """ Generate MentionCaptions from a Document by parsing all of its Captions. :param doc: The ``Document`` to parse. :type doc: ``Document`` :raises TypeError: If the input doc is not of type ``Document``. """ if not isinstance(doc, Document)...
[ "def", "apply", "(", "self", ",", "doc", ")", ":", "if", "not", "isinstance", "(", "doc", ",", "Document", ")", ":", "raise", "TypeError", "(", "\"Input Contexts to MentionCaptions.apply() must be of type Document\"", ")", "for", "caption", "in", "doc", ".", "ca...
Generate MentionCaptions from a Document by parsing all of its Captions. :param doc: The ``Document`` to parse. :type doc: ``Document`` :raises TypeError: If the input doc is not of type ``Document``.
[ "Generate", "MentionCaptions", "from", "a", "Document", "by", "parsing", "all", "of", "its", "Captions", "." ]
python
train
oseledets/ttpy
tt/amen/amen_mv.py
https://github.com/oseledets/ttpy/blob/b440f6299a6338de4aea67f3d839d613f4ef1374/tt/amen/amen_mv.py#L480-L608
def _compute_next_Phi(Phi_prev, x, y, direction, A=None, extnrm=None, return_norm=True): ''' Performs the recurrent Phi (or Psi) matrix computation Phi = Phi_prev * (x'Ay). If direction is 'lr', computes Psi if direction is 'rl', computes Phi A can be empty, then only x'y i...
[ "def", "_compute_next_Phi", "(", "Phi_prev", ",", "x", ",", "y", ",", "direction", ",", "A", "=", "None", ",", "extnrm", "=", "None", ",", "return_norm", "=", "True", ")", ":", "[", "rx1", ",", "n", ",", "rx2", "]", "=", "x", ".", "shape", "[", ...
Performs the recurrent Phi (or Psi) matrix computation Phi = Phi_prev * (x'Ay). If direction is 'lr', computes Psi if direction is 'rl', computes Phi A can be empty, then only x'y is computed. Phi1: rx1, ry1, ra1, or {rx1, ry1}_ra, or rx1, ry1 Phi2: ry2, ra2, rx2, or {ry2, rx2}_ra, or r...
[ "Performs", "the", "recurrent", "Phi", "(", "or", "Psi", ")", "matrix", "computation", "Phi", "=", "Phi_prev", "*", "(", "x", "Ay", ")", ".", "If", "direction", "is", "lr", "computes", "Psi", "if", "direction", "is", "rl", "computes", "Phi", "A", "can"...
python
train
juju/charm-helpers
charmhelpers/contrib/charmsupport/nrpe.py
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/charmsupport/nrpe.py#L355-L410
def add_init_service_checks(nrpe, services, unit_name, immediate_check=True): """ Add checks for each service in list :param NRPE nrpe: NRPE object to add check to :param list services: List of services to check :param str unit_name: Unit name to use in check description :param bool immediate_c...
[ "def", "add_init_service_checks", "(", "nrpe", ",", "services", ",", "unit_name", ",", "immediate_check", "=", "True", ")", ":", "for", "svc", "in", "services", ":", "# Don't add a check for these services from neutron-gateway", "if", "svc", "in", "[", "'ext-port'", ...
Add checks for each service in list :param NRPE nrpe: NRPE object to add check to :param list services: List of services to check :param str unit_name: Unit name to use in check description :param bool immediate_check: For sysv init, run the service check immediately
[ "Add", "checks", "for", "each", "service", "in", "list" ]
python
train
tcalmant/ipopo
pelix/internals/registry.py
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L163-L187
def _get_from_prototype(self, factory, svc_registration): # type: (Any, ServiceRegistration) -> Any """ Returns a service instance from a Prototype Service Factory :param factory: The service factory :param svc_registration: The ServiceRegistration object :return: The re...
[ "def", "_get_from_prototype", "(", "self", ",", "factory", ",", "svc_registration", ")", ":", "# type: (Any, ServiceRegistration) -> Any", "svc_ref", "=", "svc_registration", ".", "get_reference", "(", ")", "service", "=", "factory", ".", "get_service", "(", "self", ...
Returns a service instance from a Prototype Service Factory :param factory: The service factory :param svc_registration: The ServiceRegistration object :return: The requested service instance returned by the factory
[ "Returns", "a", "service", "instance", "from", "a", "Prototype", "Service", "Factory" ]
python
train
vaexio/vaex
packages/vaex-core/vaex/ext/readcol.py
https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/ext/readcol.py#L223-L236
def get_autotype(arr): """ Attempts to return a numpy array converted to the most sensible dtype Value errors will be caught and simply return the original array Tries to make dtype int, then float, then no change """ try: narr = arr.astype('float') if (narr < sys.maxsize).all() ...
[ "def", "get_autotype", "(", "arr", ")", ":", "try", ":", "narr", "=", "arr", ".", "astype", "(", "'float'", ")", "if", "(", "narr", "<", "sys", ".", "maxsize", ")", ".", "all", "(", ")", "and", "(", "narr", "%", "1", ")", ".", "sum", "(", ")"...
Attempts to return a numpy array converted to the most sensible dtype Value errors will be caught and simply return the original array Tries to make dtype int, then float, then no change
[ "Attempts", "to", "return", "a", "numpy", "array", "converted", "to", "the", "most", "sensible", "dtype", "Value", "errors", "will", "be", "caught", "and", "simply", "return", "the", "original", "array", "Tries", "to", "make", "dtype", "int", "then", "float"...
python
test
PredixDev/predixpy
predix/service.py
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/service.py#L113-L126
def _delete(self, uri): """ Simple DELETE operation for a given path. """ headers = self._get_headers() response = self.session.delete(uri, headers=headers) # Will return a 204 on successful delete if response.status_code == 204: return response ...
[ "def", "_delete", "(", "self", ",", "uri", ")", ":", "headers", "=", "self", ".", "_get_headers", "(", ")", "response", "=", "self", ".", "session", ".", "delete", "(", "uri", ",", "headers", "=", "headers", ")", "# Will return a 204 on successful delete", ...
Simple DELETE operation for a given path.
[ "Simple", "DELETE", "operation", "for", "a", "given", "path", "." ]
python
train
spyder-ide/spyder
spyder/plugins/explorer/widgets.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1052-L1057
def set_scrollbar_position(self, position): """Set scrollbar positions""" # Scrollbars will be restored after the expanded state self._scrollbar_positions = position if self._to_be_loaded is not None and len(self._to_be_loaded) == 0: self.restore_scrollbar_positions()
[ "def", "set_scrollbar_position", "(", "self", ",", "position", ")", ":", "# Scrollbars will be restored after the expanded state\r", "self", ".", "_scrollbar_positions", "=", "position", "if", "self", ".", "_to_be_loaded", "is", "not", "None", "and", "len", "(", "self...
Set scrollbar positions
[ "Set", "scrollbar", "positions" ]
python
train
python/performance
performance/benchmarks/bm_mdp.py
https://github.com/python/performance/blob/2a9524c0a5714e85106671bc61d750e800fe17db/performance/benchmarks/bm_mdp.py#L9-L33
def topoSort(roots, getParents): """Return a topological sorting of nodes in a graph. roots - list of root nodes to search from getParents - function which returns the parents of a given node """ results = [] visited = set() # Use iterative version to avoid stack limits for large datasets...
[ "def", "topoSort", "(", "roots", ",", "getParents", ")", ":", "results", "=", "[", "]", "visited", "=", "set", "(", ")", "# Use iterative version to avoid stack limits for large datasets", "stack", "=", "[", "(", "node", ",", "0", ")", "for", "node", "in", "...
Return a topological sorting of nodes in a graph. roots - list of root nodes to search from getParents - function which returns the parents of a given node
[ "Return", "a", "topological", "sorting", "of", "nodes", "in", "a", "graph", "." ]
python
test
bxlab/bx-python
lib/bx/intervals/random_intervals.py
https://github.com/bxlab/bx-python/blob/09cb725284803df90a468d910f2274628d8647de/lib/bx/intervals/random_intervals.py#L98-L212
def throw_random_private( lengths, regions, save_interval_func, allow_overlap=False, three_args=True ): """ (Internal function; we expect calls only through the interface functions above) `lengths`: A list containing the length of each interval to be generated. `regions`: A list of regions in ...
[ "def", "throw_random_private", "(", "lengths", ",", "regions", ",", "save_interval_func", ",", "allow_overlap", "=", "False", ",", "three_args", "=", "True", ")", ":", "# Implementation:", "# We keep a list of the regions, sorted from largest to smallest. We then", "# pl...
(Internal function; we expect calls only through the interface functions above) `lengths`: A list containing the length of each interval to be generated. `regions`: A list of regions in which intervals can be placed, sorted by decreasing length. Elements are triples of the form (length...
[ "(", "Internal", "function", ";", "we", "expect", "calls", "only", "through", "the", "interface", "functions", "above", ")", "lengths", ":", "A", "list", "containing", "the", "length", "of", "each", "interval", "to", "be", "generated", ".", "regions", ":", ...
python
train
LucidtechAI/las-sdk-python
las/api_client.py
https://github.com/LucidtechAI/las-sdk-python/blob/5f39dee7983baff28a1deb93c12d36414d835d12/las/api_client.py#L30-L57
def predict(self, document_path: str, model_name: str, consent_id: str = None) -> Prediction: """Run inference and create prediction on document. This method takes care of creating and uploading a document specified by document_path. as well as running inference using model specified by model_na...
[ "def", "predict", "(", "self", ",", "document_path", ":", "str", ",", "model_name", ":", "str", ",", "consent_id", ":", "str", "=", "None", ")", "->", "Prediction", ":", "content_type", "=", "self", ".", "_get_content_type", "(", "document_path", ")", "con...
Run inference and create prediction on document. This method takes care of creating and uploading a document specified by document_path. as well as running inference using model specified by model_name to create prediction on the document. >>> from las import ApiClient >>> api_client = ...
[ "Run", "inference", "and", "create", "prediction", "on", "document", ".", "This", "method", "takes", "care", "of", "creating", "and", "uploading", "a", "document", "specified", "by", "document_path", ".", "as", "well", "as", "running", "inference", "using", "m...
python
train
sentinel-hub/sentinelhub-py
sentinelhub/geopedia.py
https://github.com/sentinel-hub/sentinelhub-py/blob/08a83b7f1e289187159a643336995d8369860fea/sentinelhub/geopedia.py#L220-L228
def get_request(self, request): """Get a list of DownloadRequests for all data that are under the given field in the table of a Geopedia layer. :return: list of items which have to be downloaded :rtype: list(DownloadRequest) """ request.layer = self._parse_layer(request.layer, r...
[ "def", "get_request", "(", "self", ",", "request", ")", ":", "request", ".", "layer", "=", "self", ".", "_parse_layer", "(", "request", ".", "layer", ",", "return_wms_name", "=", "True", ")", "return", "super", "(", ")", ".", "get_request", "(", "request...
Get a list of DownloadRequests for all data that are under the given field in the table of a Geopedia layer. :return: list of items which have to be downloaded :rtype: list(DownloadRequest)
[ "Get", "a", "list", "of", "DownloadRequests", "for", "all", "data", "that", "are", "under", "the", "given", "field", "in", "the", "table", "of", "a", "Geopedia", "layer", "." ]
python
train
saltant-org/saltant-py
saltant/models/resource.py
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/resource.py#L194-L220
def validate_request_success( response_text, request_url, status_code, expected_status_code ): """Validates that a request was successful. Args: response_text (str): The response body of the request. request_url (str): The URL the request was made at. sta...
[ "def", "validate_request_success", "(", "response_text", ",", "request_url", ",", "status_code", ",", "expected_status_code", ")", ":", "try", ":", "assert", "status_code", "==", "expected_status_code", "except", "AssertionError", ":", "msg", "=", "(", "\"Request to {...
Validates that a request was successful. Args: response_text (str): The response body of the request. request_url (str): The URL the request was made at. status_code (int): The status code of the response. expected_status_code (int): The expected status code of t...
[ "Validates", "that", "a", "request", "was", "successful", "." ]
python
train
bitesofcode/projexui
projexui/widgets/xganttwidget/xganttwidget.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xganttwidget/xganttwidget.py#L255-L266
def centerOnDateTime(self, dtime): """ Centers the view on a given datetime for the gantt widget. :param dtime | <QDateTime> """ view = self.uiGanttVIEW scene = view.scene() point = view.mapToScene(0, 0) x = scene.datetimeXPos(dtime)...
[ "def", "centerOnDateTime", "(", "self", ",", "dtime", ")", ":", "view", "=", "self", ".", "uiGanttVIEW", "scene", "=", "view", ".", "scene", "(", ")", "point", "=", "view", ".", "mapToScene", "(", "0", ",", "0", ")", "x", "=", "scene", ".", "dateti...
Centers the view on a given datetime for the gantt widget. :param dtime | <QDateTime>
[ "Centers", "the", "view", "on", "a", "given", "datetime", "for", "the", "gantt", "widget", ".", ":", "param", "dtime", "|", "<QDateTime", ">" ]
python
train
sonyxperiadev/pygerrit
pygerrit/events.py
https://github.com/sonyxperiadev/pygerrit/blob/756300120b0f4f4af19e0f985566d82bc80b4359/pygerrit/events.py#L40-L56
def register(cls, name): """ Decorator to register the event identified by `name`. Return the decorated class. Raise GerritError if the event is already registered. """ def decorate(klazz): """ Decorator. """ if name in cls._events: rai...
[ "def", "register", "(", "cls", ",", "name", ")", ":", "def", "decorate", "(", "klazz", ")", ":", "\"\"\" Decorator. \"\"\"", "if", "name", "in", "cls", ".", "_events", ":", "raise", "GerritError", "(", "\"Duplicate event: %s\"", "%", "name", ")", "cls", "....
Decorator to register the event identified by `name`. Return the decorated class. Raise GerritError if the event is already registered.
[ "Decorator", "to", "register", "the", "event", "identified", "by", "name", "." ]
python
train
polyaxon/hestia
hestia/date_formatter.py
https://github.com/polyaxon/hestia/blob/382ed139cff8bf35c987cfc30a31b72c0d6b808e/hestia/date_formatter.py#L84-L96
def extract_datetime_hour(cls, datetime_str): """ Tries to extract a `datetime` object from the given string, including only hours. Raises `DateTimeFormatterException` if the extraction fails. """ if not datetime_str: raise DateTimeFormatterException('datetime_str mu...
[ "def", "extract_datetime_hour", "(", "cls", ",", "datetime_str", ")", ":", "if", "not", "datetime_str", ":", "raise", "DateTimeFormatterException", "(", "'datetime_str must a valid string'", ")", "try", ":", "return", "cls", ".", "_extract_timestamp", "(", "datetime_s...
Tries to extract a `datetime` object from the given string, including only hours. Raises `DateTimeFormatterException` if the extraction fails.
[ "Tries", "to", "extract", "a", "datetime", "object", "from", "the", "given", "string", "including", "only", "hours", "." ]
python
train
jaraco/rst.linker
rst/linker.py
https://github.com/jaraco/rst.linker/blob/5d0ff09756c325c46c471c217bdefcfd11ce1de4/rst/linker.py#L142-L153
def from_definition(cls, defn, names={}): """ A definition may contain the following members: - using: a dictionary of variables available for substitution - replace: a list of replacement definitions. """ repls = map(Repl.from_defn, defn.get('replace', [])) self...
[ "def", "from_definition", "(", "cls", ",", "defn", ",", "names", "=", "{", "}", ")", ":", "repls", "=", "map", "(", "Repl", ".", "from_defn", ",", "defn", ".", "get", "(", "'replace'", ",", "[", "]", ")", ")", "self", "=", "cls", "(", "repls", ...
A definition may contain the following members: - using: a dictionary of variables available for substitution - replace: a list of replacement definitions.
[ "A", "definition", "may", "contain", "the", "following", "members", ":" ]
python
train
maartenbreddels/ipyvolume
ipyvolume/examples.py
https://github.com/maartenbreddels/ipyvolume/blob/e68b72852b61276f8e6793bc8811f5b2432a155f/ipyvolume/examples.py#L161-L229
def brain( draw=True, show=True, fiducial=True, flat=True, inflated=True, subject='S1', interval=1000, uv=True, color=None ): """Show a human brain model. Requirement: $ pip install https://github.com/gallantlab/pycortex """ import ipyvolume as ipv try: import cortex excep...
[ "def", "brain", "(", "draw", "=", "True", ",", "show", "=", "True", ",", "fiducial", "=", "True", ",", "flat", "=", "True", ",", "inflated", "=", "True", ",", "subject", "=", "'S1'", ",", "interval", "=", "1000", ",", "uv", "=", "True", ",", "col...
Show a human brain model. Requirement: $ pip install https://github.com/gallantlab/pycortex
[ "Show", "a", "human", "brain", "model", "." ]
python
train
Parsl/parsl
parsl/providers/aws/aws.py
https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/providers/aws/aws.py#L207-L220
def write_state_file(self): """Save information that must persist to a file. We do not want to create a new VPC and new identical security groups, so we save information about them in a file between runs. """ fh = open('awsproviderstate.json', 'w') state = {} sta...
[ "def", "write_state_file", "(", "self", ")", ":", "fh", "=", "open", "(", "'awsproviderstate.json'", ",", "'w'", ")", "state", "=", "{", "}", "state", "[", "'vpcID'", "]", "=", "self", ".", "vpc_id", "state", "[", "'sgID'", "]", "=", "self", ".", "sg...
Save information that must persist to a file. We do not want to create a new VPC and new identical security groups, so we save information about them in a file between runs.
[ "Save", "information", "that", "must", "persist", "to", "a", "file", "." ]
python
valid
edoburu/sphinxcontrib-django
sphinxcontrib_django/docstrings.py
https://github.com/edoburu/sphinxcontrib-django/blob/5116ac7f1510a76b1ff58cf7f8d2fab7d8bbe2a9/sphinxcontrib_django/docstrings.py#L88-L110
def improve_model_docstring(app, what, name, obj, options, lines): """Hook that improves the autodoc docstrings for Django models. :type app: sphinx.application.Sphinx :param what: The parent type, ``class`` or ``module`` :type what: str :param name: The dotted path to the child method/attribute. ...
[ "def", "improve_model_docstring", "(", "app", ",", "what", ",", "name", ",", "obj", ",", "options", ",", "lines", ")", ":", "if", "what", "==", "'class'", ":", "_improve_class_docs", "(", "app", ",", "obj", ",", "lines", ")", "elif", "what", "==", "'at...
Hook that improves the autodoc docstrings for Django models. :type app: sphinx.application.Sphinx :param what: The parent type, ``class`` or ``module`` :type what: str :param name: The dotted path to the child method/attribute. :type name: str :param obj: The Python object that i s being docume...
[ "Hook", "that", "improves", "the", "autodoc", "docstrings", "for", "Django", "models", "." ]
python
train
singularityhub/singularity-cli
spython/main/parse/recipe.py
https://github.com/singularityhub/singularity-cli/blob/cb36b4504812ca87e29c6a40b222a545d1865799/spython/main/parse/recipe.py#L287-L305
def _write_script(path, lines, chmod=True): '''write a script with some lines content to path in the image. This is done by way of adding echo statements to the install section. Parameters ========== path: the path to the file to write lines: the lines to ...
[ "def", "_write_script", "(", "path", ",", "lines", ",", "chmod", "=", "True", ")", ":", "if", "len", "(", "lines", ")", ">", "0", ":", "lastline", "=", "lines", ".", "pop", "(", ")", "for", "line", "in", "lines", ":", "self", ".", "install", ".",...
write a script with some lines content to path in the image. This is done by way of adding echo statements to the install section. Parameters ========== path: the path to the file to write lines: the lines to echo to the file chmod: If true, change perm...
[ "write", "a", "script", "with", "some", "lines", "content", "to", "path", "in", "the", "image", ".", "This", "is", "done", "by", "way", "of", "adding", "echo", "statements", "to", "the", "install", "section", "." ]
python
train
nschloe/matplotlib2tikz
matplotlib2tikz/save.py
https://github.com/nschloe/matplotlib2tikz/blob/ac5daca6f38b834d757f6c6ae6cc34121956f46b/matplotlib2tikz/save.py#L337-L415
def _recurse(data, obj): """Iterates over all children of the current object, gathers the contents contributing to the resulting PGFPlots file, and returns those. """ content = _ContentManager() for child in obj.get_children(): # Some patches are Spines, too; skip those entirely. # S...
[ "def", "_recurse", "(", "data", ",", "obj", ")", ":", "content", "=", "_ContentManager", "(", ")", "for", "child", "in", "obj", ".", "get_children", "(", ")", ":", "# Some patches are Spines, too; skip those entirely.", "# See <https://github.com/nschloe/matplotlib2tikz...
Iterates over all children of the current object, gathers the contents contributing to the resulting PGFPlots file, and returns those.
[ "Iterates", "over", "all", "children", "of", "the", "current", "object", "gathers", "the", "contents", "contributing", "to", "the", "resulting", "PGFPlots", "file", "and", "returns", "those", "." ]
python
train
chrippa/python-librtmp
librtmp/stream.py
https://github.com/chrippa/python-librtmp/blob/6efefd5edd76cad7a3b53f7c87c1c7350448224d/librtmp/stream.py#L83-L92
def seek(self, time): """Attempts to seek in the stream. :param time: int, Time to seek to in seconds """ res = librtmp.RTMP_SendSeek(self.client.rtmp, time) if res < 1: raise RTMPError("Failed to seek")
[ "def", "seek", "(", "self", ",", "time", ")", ":", "res", "=", "librtmp", ".", "RTMP_SendSeek", "(", "self", ".", "client", ".", "rtmp", ",", "time", ")", "if", "res", "<", "1", ":", "raise", "RTMPError", "(", "\"Failed to seek\"", ")" ]
Attempts to seek in the stream. :param time: int, Time to seek to in seconds
[ "Attempts", "to", "seek", "in", "the", "stream", "." ]
python
train
data61/clkhash
clkhash/cli.py
https://github.com/data61/clkhash/blob/ec6398d6708a063de83f7c3d6286587bff8e7121/clkhash/cli.py#L99-L110
def status(server, output, verbose): """Connect to an entity matching server and check the service status. Use "-" to output status to stdout. """ if verbose: log("Connecting to Entity Matching Server: {}".format(server)) service_status = server_get_status(server) if verbose: l...
[ "def", "status", "(", "server", ",", "output", ",", "verbose", ")", ":", "if", "verbose", ":", "log", "(", "\"Connecting to Entity Matching Server: {}\"", ".", "format", "(", "server", ")", ")", "service_status", "=", "server_get_status", "(", "server", ")", "...
Connect to an entity matching server and check the service status. Use "-" to output status to stdout.
[ "Connect", "to", "an", "entity", "matching", "server", "and", "check", "the", "service", "status", "." ]
python
train
marcomusy/vtkplotter
vtkplotter/actors.py
https://github.com/marcomusy/vtkplotter/blob/692c3396782722ec525bc1346a26999868c650c6/vtkplotter/actors.py#L62-L114
def isosurface(image, smoothing=0, threshold=None, connectivity=False): """Return a ``vtkActor`` isosurface extracted from a ``vtkImageData`` object. :param float smoothing: gaussian filter to smooth vtkImageData, in units of sigmas :param threshold: value or list of values to draw the isosurface(s) ...
[ "def", "isosurface", "(", "image", ",", "smoothing", "=", "0", ",", "threshold", "=", "None", ",", "connectivity", "=", "False", ")", ":", "if", "smoothing", ":", "smImg", "=", "vtk", ".", "vtkImageGaussianSmooth", "(", ")", "smImg", ".", "SetDimensionalit...
Return a ``vtkActor`` isosurface extracted from a ``vtkImageData`` object. :param float smoothing: gaussian filter to smooth vtkImageData, in units of sigmas :param threshold: value or list of values to draw the isosurface(s) :type threshold: float, list :param bool connectivity: if True only keeps ...
[ "Return", "a", "vtkActor", "isosurface", "extracted", "from", "a", "vtkImageData", "object", "." ]
python
train