repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
emencia/dr-dump
drdump/builder.py
https://github.com/emencia/dr-dump/blob/f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b/drdump/builder.py#L117-L131
def _get_dump_item_context(self, index, name, opts): """ Return a formated dict context """ c = { 'item_no': index, 'label': name, 'name': name, 'models': ' '.join(opts['models']), 'natural_key': '', } if opts.ge...
[ "def", "_get_dump_item_context", "(", "self", ",", "index", ",", "name", ",", "opts", ")", ":", "c", "=", "{", "'item_no'", ":", "index", ",", "'label'", ":", "name", ",", "'name'", ":", "name", ",", "'models'", ":", "' '", ".", "join", "(", "opts", ...
Return a formated dict context
[ "Return", "a", "formated", "dict", "context" ]
python
train
28.8
watson-developer-cloud/python-sdk
ibm_watson/discovery_v1.py
https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/discovery_v1.py#L11804-L11816
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'query_id') and self.query_id is not None: _dict['query_id'] = self.query_id if hasattr(self, 'natural_language_query' ) and self.natural_language_query i...
[ "def", "_to_dict", "(", "self", ")", ":", "_dict", "=", "{", "}", "if", "hasattr", "(", "self", ",", "'query_id'", ")", "and", "self", ".", "query_id", "is", "not", "None", ":", "_dict", "[", "'query_id'", "]", "=", "self", ".", "query_id", "if", "...
Return a json dictionary representing this model.
[ "Return", "a", "json", "dictionary", "representing", "this", "model", "." ]
python
train
50.615385
AirSage/Petrel
petrel/petrel/topologybuilder.py
https://github.com/AirSage/Petrel/blob/c4be9b7da5916dcc028ddb88850e7703203eeb79/petrel/petrel/topologybuilder.py#L110-L126
def write(self, stream): """Writes the topology to a stream or file.""" topology = self.createTopology() def write_it(stream): transportOut = TMemoryBuffer() protocolOut = TBinaryProtocol.TBinaryProtocol(transportOut) topology.write(protocolOut) by...
[ "def", "write", "(", "self", ",", "stream", ")", ":", "topology", "=", "self", ".", "createTopology", "(", ")", "def", "write_it", "(", "stream", ")", ":", "transportOut", "=", "TMemoryBuffer", "(", ")", "protocolOut", "=", "TBinaryProtocol", ".", "TBinary...
Writes the topology to a stream or file.
[ "Writes", "the", "topology", "to", "a", "stream", "or", "file", "." ]
python
train
33.235294
keon/algorithms
algorithms/sort/meeting_rooms.py
https://github.com/keon/algorithms/blob/4d6569464a62a75c1357acc97e2dd32ee2f9f4a3/algorithms/sort/meeting_rooms.py#L12-L21
def can_attend_meetings(intervals): """ :type intervals: List[Interval] :rtype: bool """ intervals = sorted(intervals, key=lambda x: x.start) for i in range(1, len(intervals)): if intervals[i].start < intervals[i - 1].end: return False return True
[ "def", "can_attend_meetings", "(", "intervals", ")", ":", "intervals", "=", "sorted", "(", "intervals", ",", "key", "=", "lambda", "x", ":", "x", ".", "start", ")", "for", "i", "in", "range", "(", "1", ",", "len", "(", "intervals", ")", ")", ":", "...
:type intervals: List[Interval] :rtype: bool
[ ":", "type", "intervals", ":", "List", "[", "Interval", "]", ":", "rtype", ":", "bool" ]
python
train
28.6
saltstack/salt
salt/modules/file.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L5330-L5847
def manage_file(name, sfn, ret, source, source_sum, user, group, mode, attrs, saltenv, backup, makedirs=False, template=None, ...
[ "def", "manage_file", "(", "name", ",", "sfn", ",", "ret", ",", "source", ",", "source_sum", ",", "user", ",", "group", ",", "mode", ",", "attrs", ",", "saltenv", ",", "backup", ",", "makedirs", "=", "False", ",", "template", "=", "None", ",", "# pyl...
Checks the destination against what was retrieved with get_managed and makes the appropriate modifications (if necessary). name location to place the file sfn location of cached file on the minion This is the path to the file stored on the minion. This file is placed on th...
[ "Checks", "the", "destination", "against", "what", "was", "retrieved", "with", "get_managed", "and", "makes", "the", "appropriate", "modifications", "(", "if", "necessary", ")", "." ]
python
train
39.254826
TheHive-Project/Cortex-Analyzers
analyzers/StopForumSpam/stopforumspam_client.py
https://github.com/TheHive-Project/Cortex-Analyzers/blob/8dae6a8c4cf9af5554ae8c844985c4b44d4bd4bf/analyzers/StopForumSpam/stopforumspam_client.py#L47-L70
def get_data(self, datatype, data): """ Look for an IP address or an email address in the spammer database. :param datatype: Which type of data is to be looked up. Allowed values are 'ip' or 'mail'. :param data: The value to be looked up through the API. :type d...
[ "def", "get_data", "(", "self", ",", "datatype", ",", "data", ")", ":", "result", "=", "{", "}", "params", "=", "StopforumspamClient", ".", "_set_payload", "(", "datatype", ",", "data", ")", "response", "=", "self", ".", "client", ".", "get", "(", "'ht...
Look for an IP address or an email address in the spammer database. :param datatype: Which type of data is to be looked up. Allowed values are 'ip' or 'mail'. :param data: The value to be looked up through the API. :type datatype: str :type data: str :re...
[ "Look", "for", "an", "IP", "address", "or", "an", "email", "address", "in", "the", "spammer", "database", "." ]
python
train
38.291667
F5Networks/f5-common-python
f5/bigip/resource.py
https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/resource.py#L1068-L1086
def _load(self, **kwargs): """wrapped with load, override that in a subclass to customize""" if 'uri' in self._meta_data: error = "There was an attempt to assign a new uri to this "\ "resource, the _meta_data['uri'] is %s and it should"\ " not be chang...
[ "def", "_load", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "'uri'", "in", "self", ".", "_meta_data", ":", "error", "=", "\"There was an attempt to assign a new uri to this \"", "\"resource, the _meta_data['uri'] is %s and it should\"", "\" not be changed.\"", "...
wrapped with load, override that in a subclass to customize
[ "wrapped", "with", "load", "override", "that", "in", "a", "subclass", "to", "customize" ]
python
train
55
numberoverzero/bloop
bloop/search.py
https://github.com/numberoverzero/bloop/blob/4c95f5a0ff0802443a1c258bfaccecd1758363e7/bloop/search.py#L374-L379
def scanned(self): """Number of items that DynamoDB evaluated, before any filter was applied.""" if self.request["Select"] == "COUNT": while not self.exhausted: next(self, None) return self._scanned
[ "def", "scanned", "(", "self", ")", ":", "if", "self", ".", "request", "[", "\"Select\"", "]", "==", "\"COUNT\"", ":", "while", "not", "self", ".", "exhausted", ":", "next", "(", "self", ",", "None", ")", "return", "self", ".", "_scanned" ]
Number of items that DynamoDB evaluated, before any filter was applied.
[ "Number", "of", "items", "that", "DynamoDB", "evaluated", "before", "any", "filter", "was", "applied", "." ]
python
train
40.833333
DerwenAI/pytextrank
pytextrank/pytextrank.py
https://github.com/DerwenAI/pytextrank/blob/181ea41375d29922eb96768cf6550e57a77a0c95/pytextrank/pytextrank.py#L403-L411
def find_chunk (phrase, np): """ leverage noun phrase chunking """ for i in iter(range(0, len(phrase))): parsed_np = find_chunk_sub(phrase, np, i) if parsed_np: return parsed_np
[ "def", "find_chunk", "(", "phrase", ",", "np", ")", ":", "for", "i", "in", "iter", "(", "range", "(", "0", ",", "len", "(", "phrase", ")", ")", ")", ":", "parsed_np", "=", "find_chunk_sub", "(", "phrase", ",", "np", ",", "i", ")", "if", "parsed_n...
leverage noun phrase chunking
[ "leverage", "noun", "phrase", "chunking" ]
python
valid
23.777778
pre-commit/pre-commit
pre_commit/commands/autoupdate.py
https://github.com/pre-commit/pre-commit/blob/72f98d26e690da11dc2e41861d14c58eb21930cb/pre_commit/commands/autoupdate.py#L29-L73
def _update_repo(repo_config, store, tags_only): """Updates a repository to the tip of `master`. If the repository cannot be updated because a hook that is configured does not exist in `master`, this raises a RepositoryCannotBeUpdatedError Args: repo_config - A config for a repository """ ...
[ "def", "_update_repo", "(", "repo_config", ",", "store", ",", "tags_only", ")", ":", "repo_path", "=", "store", ".", "clone", "(", "repo_config", "[", "'repo'", "]", ",", "repo_config", "[", "'rev'", "]", ")", "cmd_output", "(", "'git'", ",", "'fetch'", ...
Updates a repository to the tip of `master`. If the repository cannot be updated because a hook that is configured does not exist in `master`, this raises a RepositoryCannotBeUpdatedError Args: repo_config - A config for a repository
[ "Updates", "a", "repository", "to", "the", "tip", "of", "master", ".", "If", "the", "repository", "cannot", "be", "updated", "because", "a", "hook", "that", "is", "configured", "does", "not", "exist", "in", "master", "this", "raises", "a", "RepositoryCannotB...
python
train
36.8
spyder-ide/spyder-kernels
spyder_kernels/console/kernel.py
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/console/kernel.py#L254-L259
def is_defined(self, obj, force_import=False): """Return True if object is defined in current namespace""" from spyder_kernels.utils.dochelpers import isdefined ns = self._get_current_namespace(with_magics=True) return isdefined(obj, force_import=force_import, namespace=ns)
[ "def", "is_defined", "(", "self", ",", "obj", ",", "force_import", "=", "False", ")", ":", "from", "spyder_kernels", ".", "utils", ".", "dochelpers", "import", "isdefined", "ns", "=", "self", ".", "_get_current_namespace", "(", "with_magics", "=", "True", ")...
Return True if object is defined in current namespace
[ "Return", "True", "if", "object", "is", "defined", "in", "current", "namespace" ]
python
train
50.333333
neherlab/treetime
treetime/clock_tree.py
https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/clock_tree.py#L463-L476
def timetree_likelihood(self): ''' Return the likelihood of the data given the current branch length in the tree ''' LH = 0 for node in self.tree.find_clades(order='preorder'): # sum the likelihood contributions of all branches if node.up is None: # root node ...
[ "def", "timetree_likelihood", "(", "self", ")", ":", "LH", "=", "0", "for", "node", "in", "self", ".", "tree", ".", "find_clades", "(", "order", "=", "'preorder'", ")", ":", "# sum the likelihood contributions of all branches", "if", "node", ".", "up", "is", ...
Return the likelihood of the data given the current branch length in the tree
[ "Return", "the", "likelihood", "of", "the", "data", "given", "the", "current", "branch", "length", "in", "the", "tree" ]
python
test
41.642857
zeth/inputs
inputs.py
https://github.com/zeth/inputs/blob/a46681dbf77d6ab07834f550e5855c1f50701f99/inputs.py#L3116-L3124
def _match_device(self): """If the LED is connected to an input device, associate the objects.""" for device in self.manager.all_devices: if (device.get_char_device_path() == self._character_device_path): self.device = device device...
[ "def", "_match_device", "(", "self", ")", ":", "for", "device", "in", "self", ".", "manager", ".", "all_devices", ":", "if", "(", "device", ".", "get_char_device_path", "(", ")", "==", "self", ".", "_character_device_path", ")", ":", "self", ".", "device",...
If the LED is connected to an input device, associate the objects.
[ "If", "the", "LED", "is", "connected", "to", "an", "input", "device", "associate", "the", "objects", "." ]
python
train
39.111111
QuantEcon/QuantEcon.py
quantecon/util/numba.py
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/util/numba.py#L75-L117
def comb_jit(N, k): """ Numba jitted function that computes N choose k. Return `0` if the outcome exceeds the maximum value of `np.intp` or if N < 0, k < 0, or k > N. Parameters ---------- N : scalar(int) k : scalar(int) Returns ------- val : scalar(int) """ # Fro...
[ "def", "comb_jit", "(", "N", ",", "k", ")", ":", "# From scipy.special._comb_int_long", "# github.com/scipy/scipy/blob/v1.0.0/scipy/special/_comb.pyx", "INTP_MAX", "=", "np", ".", "iinfo", "(", "np", ".", "intp", ")", ".", "max", "if", "N", "<", "0", "or", "k", ...
Numba jitted function that computes N choose k. Return `0` if the outcome exceeds the maximum value of `np.intp` or if N < 0, k < 0, or k > N. Parameters ---------- N : scalar(int) k : scalar(int) Returns ------- val : scalar(int)
[ "Numba", "jitted", "function", "that", "computes", "N", "choose", "k", ".", "Return", "0", "if", "the", "outcome", "exceeds", "the", "maximum", "value", "of", "np", ".", "intp", "or", "if", "N", "<", "0", "k", "<", "0", "or", "k", ">", "N", "." ]
python
train
18.44186
cdgriffith/Reusables
reusables/cli.py
https://github.com/cdgriffith/Reusables/blob/bc32f72e4baee7d76a6d58b88fcb23dd635155cd/reusables/cli.py#L175-L201
def tail(file_path, lines=10, encoding="utf-8", printed=True, errors='strict'): """ A really silly way to get the last N lines, defaults to 10. :param file_path: Path to file to read :param lines: Number of lines to read in :param encoding: defaults to utf-8 to decode as, will fail on bin...
[ "def", "tail", "(", "file_path", ",", "lines", "=", "10", ",", "encoding", "=", "\"utf-8\"", ",", "printed", "=", "True", ",", "errors", "=", "'strict'", ")", ":", "data", "=", "deque", "(", ")", "with", "open", "(", "file_path", ",", "\"rb\"", ")", ...
A really silly way to get the last N lines, defaults to 10. :param file_path: Path to file to read :param lines: Number of lines to read in :param encoding: defaults to utf-8 to decode as, will fail on binary :param printed: Automatically print the lines instead of returning it :param errors: Deco...
[ "A", "really", "silly", "way", "to", "get", "the", "last", "N", "lines", "defaults", "to", "10", "." ]
python
train
33.703704
idlesign/django-dev
django_dev/dev.py
https://github.com/idlesign/django-dev/blob/e21725a8f2e880d3d246656e0dc19df5dbbf572f/django_dev/dev.py#L266-L283
def create_manage_py(self, apps): """Creates manage.py file, with a given list of installed apps. :param list apps: """ self.logger.debug('Creating manage.py ...') with open(self._get_manage_py_path(), mode='w') as f: south_migration_modules = [] for app ...
[ "def", "create_manage_py", "(", "self", ",", "apps", ")", ":", "self", ".", "logger", ".", "debug", "(", "'Creating manage.py ...'", ")", "with", "open", "(", "self", ".", "_get_manage_py_path", "(", ")", ",", "mode", "=", "'w'", ")", "as", "f", ":", "...
Creates manage.py file, with a given list of installed apps. :param list apps:
[ "Creates", "manage", ".", "py", "file", "with", "a", "given", "list", "of", "installed", "apps", "." ]
python
train
35.666667
swevm/scaleio-py
scaleiopy/api/scaleio/cluster/sdc.py
https://github.com/swevm/scaleio-py/blob/d043a0137cb925987fd5c895a3210968ce1d9028/scaleiopy/api/scaleio/cluster/sdc.py#L75-L86
def get_sdc_by_guid(self, guid): """ Get ScaleIO SDC object by its id :param name: guid of SDC :return: ScaleIO SDC object :raise KeyError: No SDC with specified id found :rtype: SDC object """ for sdc in self.sdc: if sdc.guid == guid: ...
[ "def", "get_sdc_by_guid", "(", "self", ",", "guid", ")", ":", "for", "sdc", "in", "self", ".", "sdc", ":", "if", "sdc", ".", "guid", "==", "guid", ":", "return", "sdc", "raise", "KeyError", "(", "\"SDC with that GUID not found\"", ")" ]
Get ScaleIO SDC object by its id :param name: guid of SDC :return: ScaleIO SDC object :raise KeyError: No SDC with specified id found :rtype: SDC object
[ "Get", "ScaleIO", "SDC", "object", "by", "its", "id", ":", "param", "name", ":", "guid", "of", "SDC", ":", "return", ":", "ScaleIO", "SDC", "object", ":", "raise", "KeyError", ":", "No", "SDC", "with", "specified", "id", "found", ":", "rtype", ":", "...
python
train
31.833333
monarch-initiative/dipper
dipper/utils/CurieUtil.py
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/utils/CurieUtil.py#L39-L44
def get_curie_prefix(self, uri): ''' Return the CURIE's prefix:''' for key, value in self.uri_map.items(): if uri.startswith(key): return value return None
[ "def", "get_curie_prefix", "(", "self", ",", "uri", ")", ":", "for", "key", ",", "value", "in", "self", ".", "uri_map", ".", "items", "(", ")", ":", "if", "uri", ".", "startswith", "(", "key", ")", ":", "return", "value", "return", "None" ]
Return the CURIE's prefix:
[ "Return", "the", "CURIE", "s", "prefix", ":" ]
python
train
33.666667
spyder-ide/spyder
spyder/utils/programs.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L273-L339
def run_python_script_in_terminal(fname, wdir, args, interact, debug, python_args, executable=None): """ Run Python script in an external system terminal. :str wdir: working directory, may be empty. """ if executable is None: executable = get_python...
[ "def", "run_python_script_in_terminal", "(", "fname", ",", "wdir", ",", "args", ",", "interact", ",", "debug", ",", "python_args", ",", "executable", "=", "None", ")", ":", "if", "executable", "is", "None", ":", "executable", "=", "get_python_executable", "(",...
Run Python script in an external system terminal. :str wdir: working directory, may be empty.
[ "Run", "Python", "script", "in", "an", "external", "system", "terminal", ".", ":", "str", "wdir", ":", "working", "directory", "may", "be", "empty", "." ]
python
train
42.074627
streamlink/streamlink
src/streamlink/utils/__init__.py
https://github.com/streamlink/streamlink/blob/c8ed1daff14ac03195870238b9b900c1109dd5c1/src/streamlink/utils/__init__.py#L43-L49
def prepend_www(url): """Changes google.com to www.google.com""" parsed = urlparse(url) if parsed.netloc.split(".")[0] != "www": return parsed.scheme + "://www." + parsed.netloc + parsed.path else: return url
[ "def", "prepend_www", "(", "url", ")", ":", "parsed", "=", "urlparse", "(", "url", ")", "if", "parsed", ".", "netloc", ".", "split", "(", "\".\"", ")", "[", "0", "]", "!=", "\"www\"", ":", "return", "parsed", ".", "scheme", "+", "\"://www.\"", "+", ...
Changes google.com to www.google.com
[ "Changes", "google", ".", "com", "to", "www", ".", "google", ".", "com" ]
python
test
33.428571
HPENetworking/PYHPEIMC
build/lib/pyhpeimc/plat/termaccess.py
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/termaccess.py#L447-L497
def get_ip_scope_hosts( scopeId, auth, url): """ Function requires input of scope ID and returns list of allocated IP address for the specified scope :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhp...
[ "def", "get_ip_scope_hosts", "(", "scopeId", ",", "auth", ",", "url", ")", ":", "get_ip_scope_url", "=", "\"/imcrs/res/access/assignedIpScope/ip?size=10000&ipScopeId=\"", "+", "str", "(", "scopeId", ")", "f_url", "=", "url", "+", "get_ip_scope_url", "r", "=", "reque...
Function requires input of scope ID and returns list of allocated IP address for the specified scope :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass :param scopeId: Interger of teh ...
[ "Function", "requires", "input", "of", "scope", "ID", "and", "returns", "list", "of", "allocated", "IP", "address", "for", "the", "specified", "scope" ]
python
train
35.411765
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/model.py
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/model.py#L776-L786
def reset_for_retry(self, output_writer): """Reset self for shard retry. Args: output_writer: new output writer that contains new output files. """ self.input_reader = self.initial_input_reader self.slice_id = 0 self.retries += 1 self.output_writer = output_writer self.handler = s...
[ "def", "reset_for_retry", "(", "self", ",", "output_writer", ")", ":", "self", ".", "input_reader", "=", "self", ".", "initial_input_reader", "self", ".", "slice_id", "=", "0", "self", ".", "retries", "+=", "1", "self", ".", "output_writer", "=", "output_wri...
Reset self for shard retry. Args: output_writer: new output writer that contains new output files.
[ "Reset", "self", "for", "shard", "retry", "." ]
python
train
31.181818
pschmitt/pykeepass
pykeepass/kdbx_parsing/common.py
https://github.com/pschmitt/pykeepass/blob/85da3630d6e410b2a10d3e711cd69308b51d401d/pykeepass/kdbx_parsing/common.py#L146-L154
def compute_master(context): """Computes master key from transformed key and master seed. Used in payload decryption.""" # combine the transformed key with the header master seed to find the master_key master_key = hashlib.sha256( context._.header.value.dynamic_header.master_seed.data + ...
[ "def", "compute_master", "(", "context", ")", ":", "# combine the transformed key with the header master seed to find the master_key", "master_key", "=", "hashlib", ".", "sha256", "(", "context", ".", "_", ".", "header", ".", "value", ".", "dynamic_header", ".", "master...
Computes master key from transformed key and master seed. Used in payload decryption.
[ "Computes", "master", "key", "from", "transformed", "key", "and", "master", "seed", ".", "Used", "in", "payload", "decryption", "." ]
python
train
40.888889
aleju/imgaug
imgaug/augmenters/size.py
https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmenters/size.py#L958-L1154
def Pad(px=None, percent=None, pad_mode="constant", pad_cval=0, keep_size=True, sample_independently=True, name=None, deterministic=False, random_state=None): """ Augmenter that pads images, i.e. adds columns/rows to them. dtype support:: See ``imgaug.augmenters.size.CropAndPad``. Par...
[ "def", "Pad", "(", "px", "=", "None", ",", "percent", "=", "None", ",", "pad_mode", "=", "\"constant\"", ",", "pad_cval", "=", "0", ",", "keep_size", "=", "True", ",", "sample_independently", "=", "True", ",", "name", "=", "None", ",", "deterministic", ...
Augmenter that pads images, i.e. adds columns/rows to them. dtype support:: See ``imgaug.augmenters.size.CropAndPad``. Parameters ---------- px : None or int or imgaug.parameters.StochasticParameter or tuple, optional The number of pixels to pad on each side of the image. Eith...
[ "Augmenter", "that", "pads", "images", "i", ".", "e", ".", "adds", "columns", "/", "rows", "to", "them", "." ]
python
valid
45.700508
pywbem/pywbem
pywbem/cim_obj.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L5647-L5688
def tomof(self, indent=0, maxline=MAX_MOF_LINE): """ Return a MOF string with the declaration of this CIM method for use in a CIM class declaration. The order of parameters and qualifiers is preserved. Parameters: indent (:term:`integer`): Number of spaces to indent ...
[ "def", "tomof", "(", "self", ",", "indent", "=", "0", ",", "maxline", "=", "MAX_MOF_LINE", ")", ":", "mof", "=", "[", "]", "if", "self", ".", "qualifiers", ":", "mof", ".", "append", "(", "_qualifiers_tomof", "(", "self", ".", "qualifiers", ",", "ind...
Return a MOF string with the declaration of this CIM method for use in a CIM class declaration. The order of parameters and qualifiers is preserved. Parameters: indent (:term:`integer`): Number of spaces to indent each line of the returned string, counted in the line wit...
[ "Return", "a", "MOF", "string", "with", "the", "declaration", "of", "this", "CIM", "method", "for", "use", "in", "a", "CIM", "class", "declaration", "." ]
python
train
28.714286
collectiveacuity/labPack
labpack/messaging/telegram.py
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/messaging/telegram.py#L670-L686
def get_file(self, file_route, file_name=''): ''' a method to retrieve data for a file housed on telegram api :param file_route: string with route to file endpoint on telegram api :return: byte data stream with file data ''' title = '%s.get_file' % self.__class__.__nam...
[ "def", "get_file", "(", "self", ",", "file_route", ",", "file_name", "=", "''", ")", ":", "title", "=", "'%s.get_file'", "%", "self", ".", "__class__", ".", "__name__", "# construct file url\r", "file_url", "=", "'%s%s'", "%", "(", "self", ".", "file_endpoin...
a method to retrieve data for a file housed on telegram api :param file_route: string with route to file endpoint on telegram api :return: byte data stream with file data
[ "a", "method", "to", "retrieve", "data", "for", "a", "file", "housed", "on", "telegram", "api", ":", "param", "file_route", ":", "string", "with", "route", "to", "file", "endpoint", "on", "telegram", "api", ":", "return", ":", "byte", "data", "stream", "...
python
train
31.882353
adafruit/Adafruit_Python_LED_Backpack
Adafruit_LED_Backpack/AlphaNum4.py
https://github.com/adafruit/Adafruit_Python_LED_Backpack/blob/7356b4dd8b4bb162d60987878c2cb752fdd017d5/Adafruit_LED_Backpack/AlphaNum4.py#L133-L142
def set_digit_raw(self, pos, bitmask): """Set digit at position to raw bitmask value. Position should be a value of 0 to 3 with 0 being the left most digit on the display.""" if pos < 0 or pos > 3: # Ignore out of bounds digits. return # Set the digit bitmask val...
[ "def", "set_digit_raw", "(", "self", ",", "pos", ",", "bitmask", ")", ":", "if", "pos", "<", "0", "or", "pos", ">", "3", ":", "# Ignore out of bounds digits.", "return", "# Set the digit bitmask value at the appropriate position.", "# Also set bit 7 (decimal point) if dec...
Set digit at position to raw bitmask value. Position should be a value of 0 to 3 with 0 being the left most digit on the display.
[ "Set", "digit", "at", "position", "to", "raw", "bitmask", "value", ".", "Position", "should", "be", "a", "value", "of", "0", "to", "3", "with", "0", "being", "the", "left", "most", "digit", "on", "the", "display", "." ]
python
train
50.2
inasafe/inasafe
safe/metadata35/provenance/provenance.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/metadata35/provenance/provenance.py#L62-L74
def xml(self): """ the xml string representation. :return: the xml string :rtype: str """ xml = '<inasafe_provenance>\n' for step in self.steps: xml += step.xml xml += '</inasafe_provenance>\n' return xml
[ "def", "xml", "(", "self", ")", ":", "xml", "=", "'<inasafe_provenance>\\n'", "for", "step", "in", "self", ".", "steps", ":", "xml", "+=", "step", ".", "xml", "xml", "+=", "'</inasafe_provenance>\\n'", "return", "xml" ]
the xml string representation. :return: the xml string :rtype: str
[ "the", "xml", "string", "representation", "." ]
python
train
21.384615
xsleonard/pystmark
pystmark.py
https://github.com/xsleonard/pystmark/blob/329ccae1a7c8d57f28fa72cd8dbbee3e39413ed6/pystmark.py#L1202-L1210
def _request(self, url, **kwargs): '''Makes request to :func:`Interface.request` and caches it. :param url: endpoint url :params \*\*kwargs: kwargs to pass to :func:`requests.request` ''' response = super(Bounces, self)._request(url, **kwargs) self._last_response = respo...
[ "def", "_request", "(", "self", ",", "url", ",", "*", "*", "kwargs", ")", ":", "response", "=", "super", "(", "Bounces", ",", "self", ")", ".", "_request", "(", "url", ",", "*", "*", "kwargs", ")", "self", ".", "_last_response", "=", "response", "r...
Makes request to :func:`Interface.request` and caches it. :param url: endpoint url :params \*\*kwargs: kwargs to pass to :func:`requests.request`
[ "Makes", "request", "to", ":", "func", ":", "Interface", ".", "request", "and", "caches", "it", "." ]
python
train
37.666667
patchboard/patchboard-py
patchboard/base.py
https://github.com/patchboard/patchboard-py/blob/3d9f66f3f26d71e769cd3a578b760441a237ce4d/patchboard/base.py#L114-L127
def spawn(self, context=None): """ context may be a callable or a dict. """ if context is None: context = self.default_context if isinstance(context, collections.Callable): context = context() if not isinstance(context, collections.Mapping): ...
[ "def", "spawn", "(", "self", ",", "context", "=", "None", ")", ":", "if", "context", "is", "None", ":", "context", "=", "self", ".", "default_context", "if", "isinstance", "(", "context", ",", "collections", ".", "Callable", ")", ":", "context", "=", "...
context may be a callable or a dict.
[ "context", "may", "be", "a", "callable", "or", "a", "dict", "." ]
python
train
31.642857
davidcarboni/Flask-Sleuth
regex/regex.py
https://github.com/davidcarboni/Flask-Sleuth/blob/2191aa2a929ec43c0176ec51c7abef924b12d015/regex/regex.py#L76-L105
def parse(line): """ Parses a log line using the regexices above. :param line: A log line to be parsed. :return: If no match is found, None, otherwise a dict containing the values parsed from the log line. """ values = None matches = re.search(regex, line) if matches: # Standard...
[ "def", "parse", "(", "line", ")", ":", "values", "=", "None", "matches", "=", "re", ".", "search", "(", "regex", ",", "line", ")", "if", "matches", ":", "# Standard values", "values", "=", "{", "'date_time'", ":", "matches", ".", "group", "(", "DATE_TI...
Parses a log line using the regexices above. :param line: A log line to be parsed. :return: If no match is found, None, otherwise a dict containing the values parsed from the log line.
[ "Parses", "a", "log", "line", "using", "the", "regexices", "above", ".", ":", "param", "line", ":", "A", "log", "line", "to", "be", "parsed", ".", ":", "return", ":", "If", "no", "match", "is", "found", "None", "otherwise", "a", "dict", "containing", ...
python
train
34.6
Clinical-Genomics/scout
scout/adapter/mongo/case.py
https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/case.py#L253-L275
def delete_case(self, case_id=None, institute_id=None, display_name=None): """Delete a single case from database Args: institute_id(str) case_id(str) Returns: case_obj(dict): The case that was deleted """ query = {} if case_id: ...
[ "def", "delete_case", "(", "self", ",", "case_id", "=", "None", ",", "institute_id", "=", "None", ",", "display_name", "=", "None", ")", ":", "query", "=", "{", "}", "if", "case_id", ":", "query", "[", "'_id'", "]", "=", "case_id", "LOG", ".", "info"...
Delete a single case from database Args: institute_id(str) case_id(str) Returns: case_obj(dict): The case that was deleted
[ "Delete", "a", "single", "case", "from", "database" ]
python
test
33.956522
PagerDuty/pagerduty-api-python-client
pypd/models/user.py
https://github.com/PagerDuty/pagerduty-api-python-client/blob/f420b34ca9b29689cc2ecc9adca6dc5d56ae7161/pypd/models/user.py#L105-L112
def delete_notification_rule(self, id, **kwargs): """Get a notification rule for this user.""" endpoint = '{0}/{1}/notification_rules/{2}'.format( self.endpoint, self['id'], id, ) return self.request('DELETE', endpoint=endpoint, query_params=kwargs)
[ "def", "delete_notification_rule", "(", "self", ",", "id", ",", "*", "*", "kwargs", ")", ":", "endpoint", "=", "'{0}/{1}/notification_rules/{2}'", ".", "format", "(", "self", ".", "endpoint", ",", "self", "[", "'id'", "]", ",", "id", ",", ")", "return", ...
Get a notification rule for this user.
[ "Get", "a", "notification", "rule", "for", "this", "user", "." ]
python
train
38.75
ionelmc/python-cogen
examples/cogen-chat/ChatApp/chatapp/controllers/error.py
https://github.com/ionelmc/python-cogen/blob/83b0edb88425eba6e5bfda9f1dcd34642517e2a8/examples/cogen-chat/ChatApp/chatapp/controllers/error.py#L36-L41
def _serve_file(self, path): """Call Paste's FileApp (a WSGI application) to serve the file at the specified path """ fapp = paste.fileapp.FileApp(path) return fapp(request.environ, self.start_response)
[ "def", "_serve_file", "(", "self", ",", "path", ")", ":", "fapp", "=", "paste", ".", "fileapp", ".", "FileApp", "(", "path", ")", "return", "fapp", "(", "request", ".", "environ", ",", "self", ".", "start_response", ")" ]
Call Paste's FileApp (a WSGI application) to serve the file at the specified path
[ "Call", "Paste", "s", "FileApp", "(", "a", "WSGI", "application", ")", "to", "serve", "the", "file", "at", "the", "specified", "path" ]
python
train
40.333333
zsimic/runez
src/runez/config.py
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/config.py#L319-L335
def capped(value, minimum=None, maximum=None): """ Args: value: Value to cap minimum: If specified, value should not be lower than this minimum maximum: If specified, value should not be higher than this maximum Returns: `value` capped to `minimum` and `maximum` (if it is ou...
[ "def", "capped", "(", "value", ",", "minimum", "=", "None", ",", "maximum", "=", "None", ")", ":", "if", "minimum", "is", "not", "None", "and", "value", "<", "minimum", ":", "return", "minimum", "if", "maximum", "is", "not", "None", "and", "value", "...
Args: value: Value to cap minimum: If specified, value should not be lower than this minimum maximum: If specified, value should not be higher than this maximum Returns: `value` capped to `minimum` and `maximum` (if it is outside of those bounds)
[ "Args", ":", "value", ":", "Value", "to", "cap", "minimum", ":", "If", "specified", "value", "should", "not", "be", "lower", "than", "this", "minimum", "maximum", ":", "If", "specified", "value", "should", "not", "be", "higher", "than", "this", "maximum" ]
python
train
29.117647
mgaitan/tisu
tisu/gh.py
https://github.com/mgaitan/tisu/blob/7984e7ae414073ef43bb3984909ab7337471c851/tisu/gh.py#L30-L43
def get_milestone(self, title): """ given the title as str, looks for an existing milestone or create a new one, and return the object """ if not title: return GithubObject.NotSet if not hasattr(self, '_milestones'): self._milestones = {m.title: m ...
[ "def", "get_milestone", "(", "self", ",", "title", ")", ":", "if", "not", "title", ":", "return", "GithubObject", ".", "NotSet", "if", "not", "hasattr", "(", "self", ",", "'_milestones'", ")", ":", "self", ".", "_milestones", "=", "{", "m", ".", "title...
given the title as str, looks for an existing milestone or create a new one, and return the object
[ "given", "the", "title", "as", "str", "looks", "for", "an", "existing", "milestone", "or", "create", "a", "new", "one", "and", "return", "the", "object" ]
python
train
36.214286
ga4gh/ga4gh-client
ga4gh/client/cli.py
https://github.com/ga4gh/ga4gh-client/blob/d23b00b89112ef0930d45ee75aa3c6de3db615c5/ga4gh/client/cli.py#L528-L544
def _textOutput(self, gaObjects): """ Prints out the specified Variant objects in a VCF-like form. """ for variantAnnotation in gaObjects: print( variantAnnotation.id, variantAnnotation.variant_id, variantAnnotation.variant_annotation_set_id, ...
[ "def", "_textOutput", "(", "self", ",", "gaObjects", ")", ":", "for", "variantAnnotation", "in", "gaObjects", ":", "print", "(", "variantAnnotation", ".", "id", ",", "variantAnnotation", ".", "variant_id", ",", "variantAnnotation", ".", "variant_annotation_set_id", ...
Prints out the specified Variant objects in a VCF-like form.
[ "Prints", "out", "the", "specified", "Variant", "objects", "in", "a", "VCF", "-", "like", "form", "." ]
python
train
46.705882
PGower/PyCanvas
pycanvas/apis/courses.py
https://github.com/PGower/PyCanvas/blob/68520005382b440a1e462f9df369f54d364e21e8/pycanvas/apis/courses.py#L1230-L1250
def permissions(self, course_id, permissions=None): """ Permissions. Returns permission information for provided course & current_user """ path = {} data = {} params = {} # REQUIRED - PATH - course_id """ID""" path["course_id"...
[ "def", "permissions", "(", "self", ",", "course_id", ",", "permissions", "=", "None", ")", ":", "path", "=", "{", "}", "data", "=", "{", "}", "params", "=", "{", "}", "# REQUIRED - PATH - course_id\r", "\"\"\"ID\"\"\"", "path", "[", "\"course_id\"", "]", "...
Permissions. Returns permission information for provided course & current_user
[ "Permissions", ".", "Returns", "permission", "information", "for", "provided", "course", "&", "current_user" ]
python
train
38.809524
IdentityPython/pysaml2
example/sp-wsgi/sp.py
https://github.com/IdentityPython/pysaml2/blob/d3aa78eeb7d37c12688f783cb4db1c7263a14ad6/example/sp-wsgi/sp.py#L833-L875
def application(environ, start_response): """ The main WSGI application. Dispatch the current request to the functions from above. If nothing matches, call the `not_found` function. :param environ: The HTTP application environment :param start_response: The application to run when the handling...
[ "def", "application", "(", "environ", ",", "start_response", ")", ":", "path", "=", "environ", ".", "get", "(", "\"PATH_INFO\"", ",", "\"\"", ")", ".", "lstrip", "(", "\"/\"", ")", "logger", ".", "debug", "(", "\"<application> PATH: '%s'\"", ",", "path", "...
The main WSGI application. Dispatch the current request to the functions from above. If nothing matches, call the `not_found` function. :param environ: The HTTP application environment :param start_response: The application to run when the handling of the request is done :return: The respo...
[ "The", "main", "WSGI", "application", ".", "Dispatch", "the", "current", "request", "to", "the", "functions", "from", "above", "." ]
python
train
37.534884
defensio/defensio-python
defensio/__init__.py
https://github.com/defensio/defensio-python/blob/c1d2b64be941acb63c452a6d9a5526c59cb37007/defensio/__init__.py#L38-L44
def post_document(self, data): """ Create and analyze a new document data -- A Dictionary representing the new document """ data.update({ 'client' : CLIENT }) return self._call('POST', self._generate_url_path('documents'), data)
[ "def", "post_document", "(", "self", ",", "data", ")", ":", "data", ".", "update", "(", "{", "'client'", ":", "CLIENT", "}", ")", "return", "self", ".", "_call", "(", "'POST'", ",", "self", ".", "_generate_url_path", "(", "'documents'", ")", ",", "data...
Create and analyze a new document data -- A Dictionary representing the new document
[ "Create", "and", "analyze", "a", "new", "document", "data", "--", "A", "Dictionary", "representing", "the", "new", "document" ]
python
train
35.142857
sethmlarson/virtualbox-python
virtualbox/library_ext/machine.py
https://github.com/sethmlarson/virtualbox-python/blob/706c8e3f6e3aee17eb06458e73cbb4bc2d37878b/virtualbox/library_ext/machine.py#L64-L137
def clone(self, snapshot_name_or_id=None, mode=library.CloneMode.machine_state, options=None, name=None, uuid=None, groups=None, basefolder='', register=True): """Clone this Machine Options: snapshot_name_or_id - value can be either ISnapshot, name,...
[ "def", "clone", "(", "self", ",", "snapshot_name_or_id", "=", "None", ",", "mode", "=", "library", ".", "CloneMode", ".", "machine_state", ",", "options", "=", "None", ",", "name", "=", "None", ",", "uuid", "=", "None", ",", "groups", "=", "None", ",",...
Clone this Machine Options: snapshot_name_or_id - value can be either ISnapshot, name, or id mode - set the CloneMode value options - define the CloneOptions options name - define a name of the new VM uuid - set the uuid of the new VM grou...
[ "Clone", "this", "Machine" ]
python
train
36.72973
SuperCowPowers/workbench
workbench_apps/workbench_cli/help_content.py
https://github.com/SuperCowPowers/workbench/blob/710232756dd717f734253315e3d0b33c9628dafb/workbench_apps/workbench_cli/help_content.py#L71-L78
def help_dataframe_memory(self): """ Help for making a DataFrame with Workbench CLI """ help = '%sMaking a DataFrame: %s how to make a dataframe from memory_forensics sample' % (color.Yellow, color.Green) help += '\n\n%sMemory Images Example:' % (color.Green) help += '\n\t%s> load_samp...
[ "def", "help_dataframe_memory", "(", "self", ")", ":", "help", "=", "'%sMaking a DataFrame: %s how to make a dataframe from memory_forensics sample'", "%", "(", "color", ".", "Yellow", ",", "color", ".", "Green", ")", "help", "+=", "'\\n\\n%sMemory Images Example:'", "%",...
Help for making a DataFrame with Workbench CLI
[ "Help", "for", "making", "a", "DataFrame", "with", "Workbench", "CLI" ]
python
train
71.5
mommermi/callhorizons
callhorizons/callhorizons.py
https://github.com/mommermi/callhorizons/blob/fdd7ad9e87cac107c1b7f88e594d118210da3b1a/callhorizons/callhorizons.py#L327-L337
def iscomet(self): """`True` if `targetname` appears to be a comet. """ # treat this object as comet if there is a prefix/number if self.comet is not None: return self.comet elif self.asteroid is not None: return not self.asteroid else: return...
[ "def", "iscomet", "(", "self", ")", ":", "# treat this object as comet if there is a prefix/number", "if", "self", ".", "comet", "is", "not", "None", ":", "return", "self", ".", "comet", "elif", "self", ".", "asteroid", "is", "not", "None", ":", "return", "not...
`True` if `targetname` appears to be a comet.
[ "True", "if", "targetname", "appears", "to", "be", "a", "comet", "." ]
python
train
36.636364
chaoss/grimoirelab-manuscripts
manuscripts2/report.py
https://github.com/chaoss/grimoirelab-manuscripts/blob/94a3ad4f11bfbcd6c5190e01cb5d3e47a5187cd9/manuscripts2/report.py#L422-L494
def create_csv_fig_from_df(self, data_frames=[], filename=None, headers=[], index_label=None, fig_type=None, title=None, xlabel=None, ylabel=None, xfont=10, yfont=10, titlefont=15, fig_size=(8, 10), image_type="eps"): """ Joins all the datafa...
[ "def", "create_csv_fig_from_df", "(", "self", ",", "data_frames", "=", "[", "]", ",", "filename", "=", "None", ",", "headers", "=", "[", "]", ",", "index_label", "=", "None", ",", "fig_type", "=", "None", ",", "title", "=", "None", ",", "xlabel", "=", ...
Joins all the datafarames horizontally and creates a CSV and an image file from those dataframes. :param data_frames: a list of dataframes containing timeseries data from various metrics :param filename: the name of the csv and image file :param headers: a list of headers to be applied ...
[ "Joins", "all", "the", "datafarames", "horizontally", "and", "creates", "a", "CSV", "and", "an", "image", "file", "from", "those", "dataframes", "." ]
python
train
40.794521
andresriancho/w3af-api-client
w3af_api_client/log.py
https://github.com/andresriancho/w3af-api-client/blob/adeb79bad75264d754de69f0bb981b366da96f32/w3af_api_client/log.py#L110-L129
def log_entry_generator(log_instance): """ :yield: The next LogEntry from the REST API :raise: StopIteration when there are no more log entries to show, please note that if you call this again at a later time the REST API could have different results and more data could be returned ...
[ "def", "log_entry_generator", "(", "log_instance", ")", ":", "current_page_num", "=", "0", "while", "True", ":", "has_results", "=", "False", "for", "log_entry", "in", "log_instance", ".", "get_page", "(", "current_page_num", ")", ":", "has_results", "=", "True"...
:yield: The next LogEntry from the REST API :raise: StopIteration when there are no more log entries to show, please note that if you call this again at a later time the REST API could have different results and more data could be returned
[ ":", "yield", ":", "The", "next", "LogEntry", "from", "the", "REST", "API", ":", "raise", ":", "StopIteration", "when", "there", "are", "no", "more", "log", "entries", "to", "show", "please", "note", "that", "if", "you", "call", "this", "again", "at", ...
python
train
29.05
python-security/pyt
pyt/cfg/alias_helper.py
https://github.com/python-security/pyt/blob/efc0cfb716e40e0c8df4098f1cc8cf43723cd31f/pyt/cfg/alias_helper.py#L68-L76
def retrieve_import_alias_mapping(names_list): """Creates a dictionary mapping aliases to their respective name. import_alias_names is used in module_definitions.py and visit_Call""" import_alias_names = dict() for alias in names_list: if alias.asname: import_alias_names[alias.asnam...
[ "def", "retrieve_import_alias_mapping", "(", "names_list", ")", ":", "import_alias_names", "=", "dict", "(", ")", "for", "alias", "in", "names_list", ":", "if", "alias", ".", "asname", ":", "import_alias_names", "[", "alias", ".", "asname", "]", "=", "alias", ...
Creates a dictionary mapping aliases to their respective name. import_alias_names is used in module_definitions.py and visit_Call
[ "Creates", "a", "dictionary", "mapping", "aliases", "to", "their", "respective", "name", ".", "import_alias_names", "is", "used", "in", "module_definitions", ".", "py", "and", "visit_Call" ]
python
train
39.666667
log2timeline/plaso
plaso/parsers/xchatlog.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/parsers/xchatlog.py#L295-L326
def VerifyStructure(self, parser_mediator, line): """Verify that this file is a XChat log file. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. line (str): line from a text file. Returns: bool: True ...
[ "def", "VerifyStructure", "(", "self", ",", "parser_mediator", ",", "line", ")", ":", "try", ":", "structure", "=", "self", ".", "_HEADER", ".", "parseString", "(", "line", ")", "except", "pyparsing", ".", "ParseException", ":", "logger", ".", "debug", "("...
Verify that this file is a XChat log file. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. line (str): line from a text file. Returns: bool: True if the line is in the expected format, False if not.
[ "Verify", "that", "this", "file", "is", "a", "XChat", "log", "file", "." ]
python
train
30.625
IBMStreams/pypi.streamsx
streamsx/scripts/extract.py
https://github.com/IBMStreams/pypi.streamsx/blob/abd67b4757120f6f805787fba390f53e9df9cdd8/streamsx/scripts/extract.py#L506-L557
def _extract_from_toolkit(args): """ Look at all the modules in opt/python/streams (opt/python/streams/*.py) and extract any spl decorated function as an operator. """ extractor = _Extractor(args) if extractor._cmd_args.verbose: print("spl-python-extract:", __version__) print("T...
[ "def", "_extract_from_toolkit", "(", "args", ")", ":", "extractor", "=", "_Extractor", "(", "args", ")", "if", "extractor", ".", "_cmd_args", ".", "verbose", ":", "print", "(", "\"spl-python-extract:\"", ",", "__version__", ")", "print", "(", "\"Topology toolkit...
Look at all the modules in opt/python/streams (opt/python/streams/*.py) and extract any spl decorated function as an operator.
[ "Look", "at", "all", "the", "modules", "in", "opt", "/", "python", "/", "streams", "(", "opt", "/", "python", "/", "streams", "/", "*", ".", "py", ")", "and", "extract", "any", "spl", "decorated", "function", "as", "an", "operator", "." ]
python
train
39.865385
sprockets/sprockets.http
examples.py
https://github.com/sprockets/sprockets.http/blob/8baa4cdc1fa35a162ee226fd6cc4170a0ca0ecd3/examples.py#L10-L27
def get(self, status_code): """ Returns the requested status. :param int status_code: the status code to return :queryparam str reason: optional reason phrase """ status_code = int(status_code) if status_code >= 400: kwargs = {'status_code': status_c...
[ "def", "get", "(", "self", ",", "status_code", ")", ":", "status_code", "=", "int", "(", "status_code", ")", "if", "status_code", ">=", "400", ":", "kwargs", "=", "{", "'status_code'", ":", "status_code", "}", "if", "self", ".", "get_query_argument", "(", ...
Returns the requested status. :param int status_code: the status code to return :queryparam str reason: optional reason phrase
[ "Returns", "the", "requested", "status", "." ]
python
train
36.944444
oblalex/django-candv-choices
candv_x/django/choices/db.py
https://github.com/oblalex/django-candv-choices/blob/a299cefceebc2fb23e223dfcc63700dff572b6a0/candv_x/django/choices/db.py#L75-L85
def clean(self, value, model_instance): """ Convert the value's type and run validation. Validation errors from to_python and validate are propagated. The correct value is returned if no error is raised. """ #: return constant's name instead of constant itself val...
[ "def", "clean", "(", "self", ",", "value", ",", "model_instance", ")", ":", "#: return constant's name instead of constant itself", "value", "=", "self", ".", "to_python", "(", "value", ")", ".", "name", "self", ".", "validate", "(", "value", ",", "model_instanc...
Convert the value's type and run validation. Validation errors from to_python and validate are propagated. The correct value is returned if no error is raised.
[ "Convert", "the", "value", "s", "type", "and", "run", "validation", ".", "Validation", "errors", "from", "to_python", "and", "validate", "are", "propagated", ".", "The", "correct", "value", "is", "returned", "if", "no", "error", "is", "raised", "." ]
python
train
40.181818
ets-labs/python-dependency-injector
examples/miniapps/api_client/api.py
https://github.com/ets-labs/python-dependency-injector/blob/d04fe41eb17f667da38b97525e2d16c8f2d272fe/examples/miniapps/api_client/api.py#L12-L15
def call(self, operation, data): """Make some network operations.""" print('API call [{0}:{1}], method - {2}, data - {3}'.format( self.host, self.api_key, operation, repr(data)))
[ "def", "call", "(", "self", ",", "operation", ",", "data", ")", ":", "print", "(", "'API call [{0}:{1}], method - {2}, data - {3}'", ".", "format", "(", "self", ".", "host", ",", "self", ".", "api_key", ",", "operation", ",", "repr", "(", "data", ")", ")",...
Make some network operations.
[ "Make", "some", "network", "operations", "." ]
python
train
50.75
saltstack/salt
salt/modules/augeas_cfg.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/augeas_cfg.py#L475-L523
def ls(path, load_path=None): # pylint: disable=C0103 ''' List the direct children of a node CLI Example: .. code-block:: bash salt '*' augeas.ls /files/etc/passwd path The path to list .. versionadded:: 2016.3.0 load_path A colon-spearated list of directories ...
[ "def", "ls", "(", "path", ",", "load_path", "=", "None", ")", ":", "# pylint: disable=C0103", "def", "_match", "(", "path", ")", ":", "''' Internal match function '''", "try", ":", "matches", "=", "aug", ".", "match", "(", "salt", ".", "utils", ".", "strin...
List the direct children of a node CLI Example: .. code-block:: bash salt '*' augeas.ls /files/etc/passwd path The path to list .. versionadded:: 2016.3.0 load_path A colon-spearated list of directories that modules should be searched in. This is in addition to ...
[ "List", "the", "direct", "children", "of", "a", "node" ]
python
train
23.530612
pyparsing/pyparsing
examples/pymicko.py
https://github.com/pyparsing/pyparsing/blob/f0264bd8d1a548a50b3e5f7d99cfefd577942d14/examples/pymicko.py#L937-L946
def global_variable_action(self, text, loc, var): """Code executed after recognising a global variable""" exshared.setpos(loc, text) if DEBUG > 0: print("GLOBAL_VAR:",var) if DEBUG == 2: self.symtab.display() if DEBUG > 2: return index = self.sy...
[ "def", "global_variable_action", "(", "self", ",", "text", ",", "loc", ",", "var", ")", ":", "exshared", ".", "setpos", "(", "loc", ",", "text", ")", "if", "DEBUG", ">", "0", ":", "print", "(", "\"GLOBAL_VAR:\"", ",", "var", ")", "if", "DEBUG", "==",...
Code executed after recognising a global variable
[ "Code", "executed", "after", "recognising", "a", "global", "variable" ]
python
train
41.8
Infinidat/infi.recipe.console_scripts
src/infi/recipe/console_scripts/__init__.py
https://github.com/Infinidat/infi.recipe.console_scripts/blob/7beab59537654ee475527dbbd59b0aa49348ebd3/src/infi/recipe/console_scripts/__init__.py#L98-L113
def _get_matching_dist_in_location(dist, location): """ Check if `locations` contain only the one intended dist. Return the dist with metadata in the new location. """ # Getting the dist from the environment causes the # distribution meta data to be read. Cloning isn't # good enough. im...
[ "def", "_get_matching_dist_in_location", "(", "dist", ",", "location", ")", ":", "# Getting the dist from the environment causes the", "# distribution meta data to be read. Cloning isn't", "# good enough.", "import", "pkg_resources", "env", "=", "pkg_resources", ".", "Environment"...
Check if `locations` contain only the one intended dist. Return the dist with metadata in the new location.
[ "Check", "if", "locations", "contain", "only", "the", "one", "intended", "dist", ".", "Return", "the", "dist", "with", "metadata", "in", "the", "new", "location", "." ]
python
train
42.625
ChrisBeaumont/soupy
soupy.py
https://github.com/ChrisBeaumont/soupy/blob/795f2f61f711f574d5218fc8a3375d02bda1104f/soupy.py#L1064-L1069
def find_previous_siblings(self, *args, **kwargs): """ Like :meth:`find_all`, but searches through :attr:`previous_siblings` """ op = operator.methodcaller('find_previous_siblings', *args, **kwargs) return self._wrap_multi(op)
[ "def", "find_previous_siblings", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "op", "=", "operator", ".", "methodcaller", "(", "'find_previous_siblings'", ",", "*", "args", ",", "*", "*", "kwargs", ")", "return", "self", ".", "_wrap_...
Like :meth:`find_all`, but searches through :attr:`previous_siblings`
[ "Like", ":", "meth", ":", "find_all", "but", "searches", "through", ":", "attr", ":", "previous_siblings" ]
python
test
43.5
googleads/googleads-python-lib
examples/adwords/v201809/advanced_operations/add_multi_asset_responsive_display_ad.py
https://github.com/googleads/googleads-python-lib/blob/aa3b1b474b0f9789ca55ca46f4b2b57aeae38874/examples/adwords/v201809/advanced_operations/add_multi_asset_responsive_display_ad.py#L37-L70
def UploadImageAsset(client, url): """Uploads the image from the specified url. Args: client: An AdWordsClient instance. url: The image URL. Returns: The ID of the uploaded image. """ # Initialize appropriate service. asset_service = client.GetService('AssetService', version='v201809') # Do...
[ "def", "UploadImageAsset", "(", "client", ",", "url", ")", ":", "# Initialize appropriate service.", "asset_service", "=", "client", ".", "GetService", "(", "'AssetService'", ",", "version", "=", "'v201809'", ")", "# Download the image.", "image_request", "=", "reques...
Uploads the image from the specified url. Args: client: An AdWordsClient instance. url: The image URL. Returns: The ID of the uploaded image.
[ "Uploads", "the", "image", "from", "the", "specified", "url", "." ]
python
train
23.970588
weluse/django-nose-selenium
noseselenium/plugins.py
https://github.com/weluse/django-nose-selenium/blob/19a09b9455545f70271f884649323a38812793e6/noseselenium/plugins.py#L138-L170
def _inject_selenium(self, test): """ Injects a selenium instance into the method. """ from django.conf import settings test_case = get_test_case_class(test) test_case.selenium_plugin_started = True # Provide some reasonable default values sel = selenium...
[ "def", "_inject_selenium", "(", "self", ",", "test", ")", ":", "from", "django", ".", "conf", "import", "settings", "test_case", "=", "get_test_case_class", "(", "test", ")", "test_case", ".", "selenium_plugin_started", "=", "True", "# Provide some reasonable defaul...
Injects a selenium instance into the method.
[ "Injects", "a", "selenium", "instance", "into", "the", "method", "." ]
python
train
38.181818
craffel/mir_eval
mir_eval/separation.py
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/separation.py#L815-L824
def _bss_image_crit(s_true, e_spat, e_interf, e_artif): """Measurement of the separation quality for a given image in terms of filtered true source, spatial error, interference and artifacts. """ # energy ratios sdr = _safe_db(np.sum(s_true**2), np.sum((e_spat+e_interf+e_artif)**2)) isr = _safe_...
[ "def", "_bss_image_crit", "(", "s_true", ",", "e_spat", ",", "e_interf", ",", "e_artif", ")", ":", "# energy ratios", "sdr", "=", "_safe_db", "(", "np", ".", "sum", "(", "s_true", "**", "2", ")", ",", "np", ".", "sum", "(", "(", "e_spat", "+", "e_int...
Measurement of the separation quality for a given image in terms of filtered true source, spatial error, interference and artifacts.
[ "Measurement", "of", "the", "separation", "quality", "for", "a", "given", "image", "in", "terms", "of", "filtered", "true", "source", "spatial", "error", "interference", "and", "artifacts", "." ]
python
train
52.7
MrYsLab/PyMata
PyMata/pymata_command_handler.py
https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata_command_handler.py#L272-L284
def report_version(self, data): """ This method processes the report version message, sent asynchronously by Firmata when it starts up or after refresh_report_version() is called Use the api method api_get_version to retrieve this information :param data: Message data ...
[ "def", "report_version", "(", "self", ",", "data", ")", ":", "self", ".", "firmata_version", ".", "append", "(", "data", "[", "0", "]", ")", "# add major", "self", ".", "firmata_version", ".", "append", "(", "data", "[", "1", "]", ")" ]
This method processes the report version message, sent asynchronously by Firmata when it starts up or after refresh_report_version() is called Use the api method api_get_version to retrieve this information :param data: Message data from Firmata :return: No return val...
[ "This", "method", "processes", "the", "report", "version", "message", "sent", "asynchronously", "by", "Firmata", "when", "it", "starts", "up", "or", "after", "refresh_report_version", "()", "is", "called" ]
python
valid
36.769231
PaloAltoNetworks/pancloud
pancloud/httpclient.py
https://github.com/PaloAltoNetworks/pancloud/blob/c51e4c8aca3c988c60f062291007534edcb55285/pancloud/httpclient.py#L123-L145
def _apply_credentials(auto_refresh=True, credentials=None, headers=None): """Update Authorization header. Update request headers with latest `access_token`. Perform token `refresh` if token is ``None``. Args: auto_refresh (bool): Perform token re...
[ "def", "_apply_credentials", "(", "auto_refresh", "=", "True", ",", "credentials", "=", "None", ",", "headers", "=", "None", ")", ":", "token", "=", "credentials", ".", "get_credentials", "(", ")", ".", "access_token", "if", "auto_refresh", "is", "True", ":"...
Update Authorization header. Update request headers with latest `access_token`. Perform token `refresh` if token is ``None``. Args: auto_refresh (bool): Perform token refresh if access_token is ``None`` or expired. Defaults to ``True``. credentials (class): Read-only cr...
[ "Update", "Authorization", "header", "." ]
python
train
39.434783
boronine/discipline
discipline/models.py
https://github.com/boronine/discipline/blob/68bea9bc2198cc91cee49a6e2d0f3333cc9bf476/discipline/models.py#L798-L803
def get_for_content_type(self, ct): """Return the schema for the model of the given ContentType object""" try: return json.loads(self.state)[ct.app_label][ct.model] except KeyError: return None
[ "def", "get_for_content_type", "(", "self", ",", "ct", ")", ":", "try", ":", "return", "json", ".", "loads", "(", "self", ".", "state", ")", "[", "ct", ".", "app_label", "]", "[", "ct", ".", "model", "]", "except", "KeyError", ":", "return", "None" ]
Return the schema for the model of the given ContentType object
[ "Return", "the", "schema", "for", "the", "model", "of", "the", "given", "ContentType", "object" ]
python
train
39.333333
Jellyfish-AI/jf_agent
jf_agent/jira_download.py
https://github.com/Jellyfish-AI/jf_agent/blob/31203a294ad677c8ef9543b45509395537eb1f22/jf_agent/jira_download.py#L58-L73
def download_issuetypes(jira_connection, project_ids): ''' For Jira next-gen projects, issue types can be scoped to projects. For issue types that are scoped to projects, only extract the ones in the extracted projects. ''' print('downloading jira issue types... ', end='', flush=True) result...
[ "def", "download_issuetypes", "(", "jira_connection", ",", "project_ids", ")", ":", "print", "(", "'downloading jira issue types... '", ",", "end", "=", "''", ",", "flush", "=", "True", ")", "result", "=", "[", "]", "for", "it", "in", "jira_connection", ".", ...
For Jira next-gen projects, issue types can be scoped to projects. For issue types that are scoped to projects, only extract the ones in the extracted projects.
[ "For", "Jira", "next", "-", "gen", "projects", "issue", "types", "can", "be", "scoped", "to", "projects", ".", "For", "issue", "types", "that", "are", "scoped", "to", "projects", "only", "extract", "the", "ones", "in", "the", "extracted", "projects", "." ]
python
train
38.0625
MycroftAI/adapt
adapt/engine.py
https://github.com/MycroftAI/adapt/blob/334f23248b8e09fb9d84a88398424ec5bd3bae4c/adapt/engine.py#L299-L313
def register_entity(self, entity_value, entity_type, alias_of=None, domain=0): """ Register an entity to be tagged in potential parse results. Args: entity_value(str): the value/proper name of an entity instance (Ex: "The Big Bang Theory") entity_type(str...
[ "def", "register_entity", "(", "self", ",", "entity_value", ",", "entity_type", ",", "alias_of", "=", "None", ",", "domain", "=", "0", ")", ":", "if", "domain", "not", "in", "self", ".", "domains", ":", "self", ".", "register_domain", "(", "domain", "=",...
Register an entity to be tagged in potential parse results. Args: entity_value(str): the value/proper name of an entity instance (Ex: "The Big Bang Theory") entity_type(str): the type/tag of an entity instance (Ex: "Television Show") domain(str): a string rep...
[ "Register", "an", "entity", "to", "be", "tagged", "in", "potential", "parse", "results", "." ]
python
train
50.666667
pkgw/pwkit
pwkit/io.py
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/io.py#L791-L800
def read_json (self, mode='rt', **kwargs): """Use the :mod:`json` module to read in this file as a JSON-formatted data structure. Keyword arguments are passed to :func:`json.load`. Returns the read-in data structure. """ import json with self.open (mode=mode) as f: ...
[ "def", "read_json", "(", "self", ",", "mode", "=", "'rt'", ",", "*", "*", "kwargs", ")", ":", "import", "json", "with", "self", ".", "open", "(", "mode", "=", "mode", ")", "as", "f", ":", "return", "json", ".", "load", "(", "f", ",", "*", "*", ...
Use the :mod:`json` module to read in this file as a JSON-formatted data structure. Keyword arguments are passed to :func:`json.load`. Returns the read-in data structure.
[ "Use", "the", ":", "mod", ":", "json", "module", "to", "read", "in", "this", "file", "as", "a", "JSON", "-", "formatted", "data", "structure", ".", "Keyword", "arguments", "are", "passed", "to", ":", "func", ":", "json", ".", "load", ".", "Returns", ...
python
train
34.9
materialsproject/pymatgen
pymatgen/core/xcfunc.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/xcfunc.py#L149-L175
def from_type_name(cls, typ, name): """Build the object from (type, name).""" # Try aliases first. for k, nt in cls.defined_aliases.items(): if typ is not None and typ != nt.type: continue #print(name, nt.name) if name == nt.name: if len(k) == ...
[ "def", "from_type_name", "(", "cls", ",", "typ", ",", "name", ")", ":", "# Try aliases first.", "for", "k", ",", "nt", "in", "cls", ".", "defined_aliases", ".", "items", "(", ")", ":", "if", "typ", "is", "not", "None", "and", "typ", "!=", "nt", ".", ...
Build the object from (type, name).
[ "Build", "the", "object", "from", "(", "type", "name", ")", "." ]
python
train
43.851852
theiviaxx/python-perforce
perforce/api.py
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/api.py#L28-L39
def edit(filename, connection=None): """Checks out a file into the default changelist :param filename: File to check out :type filename: str :param connection: Connection object to use :type connection: :py:class:`Connection` """ c = connection or connect() rev = c.ls(filename) if r...
[ "def", "edit", "(", "filename", ",", "connection", "=", "None", ")", ":", "c", "=", "connection", "or", "connect", "(", ")", "rev", "=", "c", ".", "ls", "(", "filename", ")", "if", "rev", ":", "rev", "[", "0", "]", ".", "edit", "(", ")" ]
Checks out a file into the default changelist :param filename: File to check out :type filename: str :param connection: Connection object to use :type connection: :py:class:`Connection`
[ "Checks", "out", "a", "file", "into", "the", "default", "changelist" ]
python
train
27.833333
csparpa/pyowm
pyowm/agroapi10/agro_manager.py
https://github.com/csparpa/pyowm/blob/cdd59eb72f32f7238624ceef9b2e2329a5ebd472/pyowm/agroapi10/agro_manager.py#L302-L316
def stats_for_satellite_image(self, metaimage): """ Retrieves statistics for the satellite image described by the provided metadata. This is currently only supported 'EVI' and 'NDVI' presets :param metaimage: the satellite image's metadata, in the form of a `MetaImage` subtype instance ...
[ "def", "stats_for_satellite_image", "(", "self", ",", "metaimage", ")", ":", "if", "metaimage", ".", "preset", "!=", "PresetEnum", ".", "EVI", "and", "metaimage", ".", "preset", "!=", "PresetEnum", ".", "NDVI", ":", "raise", "ValueError", "(", "\"Unsupported i...
Retrieves statistics for the satellite image described by the provided metadata. This is currently only supported 'EVI' and 'NDVI' presets :param metaimage: the satellite image's metadata, in the form of a `MetaImage` subtype instance :type metaimage: a `pyowm.agroapi10.imagery.MetaImage` subty...
[ "Retrieves", "statistics", "for", "the", "satellite", "image", "described", "by", "the", "provided", "metadata", ".", "This", "is", "currently", "only", "supported", "EVI", "and", "NDVI", "presets" ]
python
train
52.666667
mabuchilab/QNET
src/qnet/algebra/core/algebraic_properties.py
https://github.com/mabuchilab/QNET/blob/cc20d26dad78691d34c67173e5cd67dcac94208a/src/qnet/algebra/core/algebraic_properties.py#L856-L944
def _deltasummation(term, ranges, i_range): """Partially execute a summation for `term` with a Kronecker Delta for one of the summation indices. This implements the solution to the core sub-problem in :func:`indexed_sum_over_kronecker` Args: term (QuantumExpression): term of the sum ...
[ "def", "_deltasummation", "(", "term", ",", "ranges", ",", "i_range", ")", ":", "from", "qnet", ".", "algebra", ".", "core", ".", "abstract_quantum_algebra", "import", "QuantumExpression", "idx", "=", "ranges", "[", "i_range", "]", ".", "index_symbol", "summan...
Partially execute a summation for `term` with a Kronecker Delta for one of the summation indices. This implements the solution to the core sub-problem in :func:`indexed_sum_over_kronecker` Args: term (QuantumExpression): term of the sum ranges (list): list of all summation index ranges...
[ "Partially", "execute", "a", "summation", "for", "term", "with", "a", "Kronecker", "Delta", "for", "one", "of", "the", "summation", "indices", "." ]
python
train
42.05618
honeybadger-io/honeybadger-python
honeybadger/contrib/django.py
https://github.com/honeybadger-io/honeybadger-python/blob/81519b40d3e446b62035f64e34900e08ff91938c/honeybadger/contrib/django.py#L71-L95
def generate_payload(self, config, context): """ Generate payload by checking Django request object. :param context: current context. :param config: honeybadger configuration. :return: a dict with the generated payload. """ request = current_request() pay...
[ "def", "generate_payload", "(", "self", ",", "config", ",", "context", ")", ":", "request", "=", "current_request", "(", ")", "payload", "=", "{", "'url'", ":", "request", ".", "build_absolute_uri", "(", ")", ",", "'component'", ":", "request", ".", "resol...
Generate payload by checking Django request object. :param context: current context. :param config: honeybadger configuration. :return: a dict with the generated payload.
[ "Generate", "payload", "by", "checking", "Django", "request", "object", ".", ":", "param", "context", ":", "current", "context", ".", ":", "param", "config", ":", "honeybadger", "configuration", ".", ":", "return", ":", "a", "dict", "with", "the", "generated...
python
train
34.76
CellProfiler/centrosome
centrosome/bg_compensate.py
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/bg_compensate.py#L358-L414
def bg_compensate(img, sigma, splinepoints, scale): '''Reads file, subtracts background. Returns [compensated image, background].''' from PIL import Image import pylab from matplotlib.image import pil_to_array from centrosome.filter import canny import matplotlib img = Image.open(img) ...
[ "def", "bg_compensate", "(", "img", ",", "sigma", ",", "splinepoints", ",", "scale", ")", ":", "from", "PIL", "import", "Image", "import", "pylab", "from", "matplotlib", ".", "image", "import", "pil_to_array", "from", "centrosome", ".", "filter", "import", "...
Reads file, subtracts background. Returns [compensated image, background].
[ "Reads", "file", "subtracts", "background", ".", "Returns", "[", "compensated", "image", "background", "]", "." ]
python
train
35.982456
JoelBender/bacpypes
py25/bacpypes/comm.py
https://github.com/JoelBender/bacpypes/blob/4111b8604a16fa2b7f80d8104a43b9f3e28dfc78/py25/bacpypes/comm.py#L472-L479
def indication(self, *args, **kwargs): """Downstream packet, send to current terminal.""" if not self.current_terminal: raise RuntimeError("no active terminal") if not isinstance(self.current_terminal, Server): raise RuntimeError("current terminal not a server") ...
[ "def", "indication", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "current_terminal", ":", "raise", "RuntimeError", "(", "\"no active terminal\"", ")", "if", "not", "isinstance", "(", "self", ".", "current_ter...
Downstream packet, send to current terminal.
[ "Downstream", "packet", "send", "to", "current", "terminal", "." ]
python
train
45.25
Pipoline/rocket-python
rocketchat/api.py
https://github.com/Pipoline/rocket-python/blob/643ece8a9db106922e019984a859ca04283262ff/rocketchat/api.py#L45-L57
def get_private_room_history(self, room_id, oldest=None, **kwargs): """ Get various history of specific private group in this case private :param room_id: :param kwargs: :return: """ return GetPrivateRoomHistory(settings=self.settings, **kwargs).call( ...
[ "def", "get_private_room_history", "(", "self", ",", "room_id", ",", "oldest", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "GetPrivateRoomHistory", "(", "settings", "=", "self", ".", "settings", ",", "*", "*", "kwargs", ")", ".", "call", "(...
Get various history of specific private group in this case private :param room_id: :param kwargs: :return:
[ "Get", "various", "history", "of", "specific", "private", "group", "in", "this", "case", "private" ]
python
train
29.461538
materialsproject/pymatgen
pymatgen/command_line/gulp_caller.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/gulp_caller.py#L239-L258
def buckingham_input(self, structure, keywords, library=None, uc=True, valence_dict=None): """ Gets a GULP input for an oxide structure and buckingham potential from library. Args: structure: pymatgen.core.structure.Structure keywords: GU...
[ "def", "buckingham_input", "(", "self", ",", "structure", ",", "keywords", ",", "library", "=", "None", ",", "uc", "=", "True", ",", "valence_dict", "=", "None", ")", ":", "gin", "=", "self", ".", "keyword_line", "(", "*", "keywords", ")", "gin", "+=",...
Gets a GULP input for an oxide structure and buckingham potential from library. Args: structure: pymatgen.core.structure.Structure keywords: GULP first line keywords. library (Default=None): File containing the species and potential. uc (Default=True): Un...
[ "Gets", "a", "GULP", "input", "for", "an", "oxide", "structure", "and", "buckingham", "potential", "from", "library", "." ]
python
train
39.1
mastro35/flows
flows/FlowsManager.py
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/FlowsManager.py#L258-L269
async def message_fetcher_coroutine(self, loop): """ Register callback for message fetcher coroutines """ Global.LOGGER.debug('registering callbacks for message fetcher coroutine') self.isrunning = True while self.isrunning: loop.call_soon(self._fetch_messages...
[ "async", "def", "message_fetcher_coroutine", "(", "self", ",", "loop", ")", ":", "Global", ".", "LOGGER", ".", "debug", "(", "'registering callbacks for message fetcher coroutine'", ")", "self", ".", "isrunning", "=", "True", "while", "self", ".", "isrunning", ":"...
Register callback for message fetcher coroutines
[ "Register", "callback", "for", "message", "fetcher", "coroutines" ]
python
train
42.25
spacetelescope/drizzlepac
drizzlepac/updatenpol.py
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/updatenpol.py#L85-L255
def update(input,refdir="jref$",local=None,interactive=False,wcsupdate=True): """ Updates headers of files given as input to point to the new reference files NPOLFILE and D2IMFILE required with the new C version of MultiDrizzle. Parameters ----------- input : string or list Name...
[ "def", "update", "(", "input", ",", "refdir", "=", "\"jref$\"", ",", "local", "=", "None", ",", "interactive", "=", "False", ",", "wcsupdate", "=", "True", ")", ":", "print", "(", "'UPDATENPOL Version'", ",", "__version__", "+", "'('", "+", "__version_date...
Updates headers of files given as input to point to the new reference files NPOLFILE and D2IMFILE required with the new C version of MultiDrizzle. Parameters ----------- input : string or list Name of input file or files acceptable forms: - single filename with or with...
[ "Updates", "headers", "of", "files", "given", "as", "input", "to", "point", "to", "the", "new", "reference", "files", "NPOLFILE", "and", "D2IMFILE", "required", "with", "the", "new", "C", "version", "of", "MultiDrizzle", "." ]
python
train
40.251462
andsor/pypercolate
percolate/hpc.py
https://github.com/andsor/pypercolate/blob/92478c1fc4d4ff5ae157f7607fd74f6f9ec360ac/percolate/hpc.py#L73-L307
def bond_sample_states( perc_graph, num_nodes, num_edges, seed, spanning_cluster=True, auxiliary_node_attributes=None, auxiliary_edge_attributes=None, spanning_sides=None, **kwargs ): ''' Generate successive sample states of the bond percolation model This is a :ref:`generator function <pyt...
[ "def", "bond_sample_states", "(", "perc_graph", ",", "num_nodes", ",", "num_edges", ",", "seed", ",", "spanning_cluster", "=", "True", ",", "auxiliary_node_attributes", "=", "None", ",", "auxiliary_edge_attributes", "=", "None", ",", "spanning_sides", "=", "None", ...
Generate successive sample states of the bond percolation model This is a :ref:`generator function <python:tut-generators>` to successively add one edge at a time from the graph to the percolation model. At each iteration, it calculates and returns the cluster statistics. CAUTION: it returns a referenc...
[ "Generate", "successive", "sample", "states", "of", "the", "bond", "percolation", "model" ]
python
valid
34.034043
marcomusy/vtkplotter
vtkplotter/actors.py
https://github.com/marcomusy/vtkplotter/blob/692c3396782722ec525bc1346a26999868c650c6/vtkplotter/actors.py#L639-L658
def addScalarBar3D( self, pos=(0, 0, 0), normal=(0, 0, 1), sx=0.1, sy=2, nlabels=9, ncols=256, cmap=None, c="k", alpha=1, ): """ Draw a 3D scalar bar to actor. .. hint:: |mesh_coloring| |mesh_coloring.py|_ ...
[ "def", "addScalarBar3D", "(", "self", ",", "pos", "=", "(", "0", ",", "0", ",", "0", ")", ",", "normal", "=", "(", "0", ",", "0", ",", "1", ")", ",", "sx", "=", "0.1", ",", "sy", "=", "2", ",", "nlabels", "=", "9", ",", "ncols", "=", "256...
Draw a 3D scalar bar to actor. .. hint:: |mesh_coloring| |mesh_coloring.py|_
[ "Draw", "a", "3D", "scalar", "bar", "to", "actor", "." ]
python
train
23.4
systemd/python-systemd
systemd/daemon.py
https://github.com/systemd/python-systemd/blob/c06c5d401d60ae9175367be0797a6c2b562ac5ba/systemd/daemon.py#L55-L71
def listen_fds(unset_environment=True): """Return a list of socket activated descriptors Example:: (in primary window) $ systemd-activate -l 2000 python3 -c \\ 'from systemd.daemon import listen_fds; print(listen_fds())' (in another window) $ telnet localhost 2000 (in p...
[ "def", "listen_fds", "(", "unset_environment", "=", "True", ")", ":", "num", "=", "_listen_fds", "(", "unset_environment", ")", "return", "list", "(", "range", "(", "LISTEN_FDS_START", ",", "LISTEN_FDS_START", "+", "num", ")", ")" ]
Return a list of socket activated descriptors Example:: (in primary window) $ systemd-activate -l 2000 python3 -c \\ 'from systemd.daemon import listen_fds; print(listen_fds())' (in another window) $ telnet localhost 2000 (in primary window) ... Execing python3 ...
[ "Return", "a", "list", "of", "socket", "activated", "descriptors" ]
python
train
28.235294
tanghaibao/jcvi
jcvi/formats/agp.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/formats/agp.py#L1457-L1492
def tpf(args): """ %prog tpf agpfile Print out a list of ids, one per line. Also known as the Tiling Path. AC225490.9 chr6 Can optionally output scaffold gaps. """ p = OptionParser(tpf.__doc__) p.add_option("--noversion", default=False, action="store_true", help="Remove t...
[ "def", "tpf", "(", "args", ")", ":", "p", "=", "OptionParser", "(", "tpf", ".", "__doc__", ")", "p", ".", "add_option", "(", "\"--noversion\"", ",", "default", "=", "False", ",", "action", "=", "\"store_true\"", ",", "help", "=", "\"Remove trailing accessi...
%prog tpf agpfile Print out a list of ids, one per line. Also known as the Tiling Path. AC225490.9 chr6 Can optionally output scaffold gaps.
[ "%prog", "tpf", "agpfile" ]
python
train
28.277778
beelit94/python-terraform
python_terraform/__init__.py
https://github.com/beelit94/python-terraform/blob/99950cb03c37abadb0d7e136452e43f4f17dd4e1/python_terraform/__init__.py#L155-L179
def init(self, dir_or_plan=None, backend_config=None, reconfigure=IsFlagged, backend=True, **kwargs): """ refer to https://www.terraform.io/docs/commands/init.html By default, this assumes you want to use backend config, and tries to init fresh. The flags -reconfigure and -...
[ "def", "init", "(", "self", ",", "dir_or_plan", "=", "None", ",", "backend_config", "=", "None", ",", "reconfigure", "=", "IsFlagged", ",", "backend", "=", "True", ",", "*", "*", "kwargs", ")", ":", "options", "=", "kwargs", "options", "[", "'backend_con...
refer to https://www.terraform.io/docs/commands/init.html By default, this assumes you want to use backend config, and tries to init fresh. The flags -reconfigure and -backend=true are default. :param dir_or_plan: relative path to the folder want to init :param backend_config: a dictio...
[ "refer", "to", "https", ":", "//", "www", ".", "terraform", ".", "io", "/", "docs", "/", "commands", "/", "init", ".", "html" ]
python
train
47.88
pypa/pipenv
pipenv/vendor/jinja2/utils.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/jinja2/utils.py#L341-L346
def copy(self): """Return a shallow copy of the instance.""" rv = self.__class__(self.capacity) rv._mapping.update(self._mapping) rv._queue = deque(self._queue) return rv
[ "def", "copy", "(", "self", ")", ":", "rv", "=", "self", ".", "__class__", "(", "self", ".", "capacity", ")", "rv", ".", "_mapping", ".", "update", "(", "self", ".", "_mapping", ")", "rv", ".", "_queue", "=", "deque", "(", "self", ".", "_queue", ...
Return a shallow copy of the instance.
[ "Return", "a", "shallow", "copy", "of", "the", "instance", "." ]
python
train
34.166667
RedHatQE/python-stitches
stitches/structure.py
https://github.com/RedHatQE/python-stitches/blob/957e9895e64ffd3b8157b38b9cce414969509288/stitches/structure.py#L30-L36
def reconnect_all(self): """ Re-establish connection to all instances """ for role in self.Instances.keys(): for connection in self.Instances[role]: connection.reconnect()
[ "def", "reconnect_all", "(", "self", ")", ":", "for", "role", "in", "self", ".", "Instances", ".", "keys", "(", ")", ":", "for", "connection", "in", "self", ".", "Instances", "[", "role", "]", ":", "connection", ".", "reconnect", "(", ")" ]
Re-establish connection to all instances
[ "Re", "-", "establish", "connection", "to", "all", "instances" ]
python
train
32.142857
PmagPy/PmagPy
pmagpy/convert_2_magic.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/convert_2_magic.py#L5360-L5875
def k15(k15file, dir_path='.', input_dir_path='', meas_file='measurements.txt', aniso_outfile='specimens.txt', samp_file="samples.txt", result_file ="rmag_anisotropy.txt", specnum=0, sample_naming_con='1', location="unknown", data_model_num=3): """ converts .k15 format data to Ma...
[ "def", "k15", "(", "k15file", ",", "dir_path", "=", "'.'", ",", "input_dir_path", "=", "''", ",", "meas_file", "=", "'measurements.txt'", ",", "aniso_outfile", "=", "'specimens.txt'", ",", "samp_file", "=", "\"samples.txt\"", ",", "result_file", "=", "\"rmag_ani...
converts .k15 format data to MagIC format. assumes Jelinek Kappabridge measurement scheme. Parameters ---------- k15file : str input file name dir_path : str output file directory, default "." input_dir_path : str input file directory IF different from dir_path, default...
[ "converts", ".", "k15", "format", "data", "to", "MagIC", "format", ".", "assumes", "Jelinek", "Kappabridge", "measurement", "scheme", "." ]
python
train
51.465116
mjirik/io3d
io3d/misc.py
https://github.com/mjirik/io3d/blob/ccaf3e378dcc967f2565d477fc27583fd0f61fcc/io3d/misc.py#L96-L118
def read_pkl_and_pklz(filename): """ Try read zipped or not zipped pickle file """ fcontent = None try: import gzip f = gzip.open(filename, 'rb') fcontent = f.read() f.close() except IOError as e: # if the problem is in not gzip file logger.info("I...
[ "def", "read_pkl_and_pklz", "(", "filename", ")", ":", "fcontent", "=", "None", "try", ":", "import", "gzip", "f", "=", "gzip", ".", "open", "(", "filename", ",", "'rb'", ")", "fcontent", "=", "f", ".", "read", "(", ")", "f", ".", "close", "(", ")"...
Try read zipped or not zipped pickle file
[ "Try", "read", "zipped", "or", "not", "zipped", "pickle", "file" ]
python
train
26.391304
horejsek/python-webdriverwrapper
webdriverwrapper/info.py
https://github.com/horejsek/python-webdriverwrapper/blob/a492f79ab60ed83d860dd817b6a0961500d7e3f5/webdriverwrapper/info.py#L52-L63
def check_expected_infos(self, test_method): """ This method is called after each test. It will read decorated informations and check if there are expected infos. You can set expected infos by decorators :py:func:`.expected_info_messages` and :py:func:`.allowed_info_messages`. ...
[ "def", "check_expected_infos", "(", "self", ",", "test_method", ")", ":", "f", "=", "lambda", "key", ",", "default", "=", "[", "]", ":", "getattr", "(", "test_method", ",", "key", ",", "default", ")", "expected_info_messages", "=", "f", "(", "EXPECTED_INFO...
This method is called after each test. It will read decorated informations and check if there are expected infos. You can set expected infos by decorators :py:func:`.expected_info_messages` and :py:func:`.allowed_info_messages`.
[ "This", "method", "is", "called", "after", "each", "test", ".", "It", "will", "read", "decorated", "informations", "and", "check", "if", "there", "are", "expected", "infos", "." ]
python
train
48.166667
inspirehep/inspire-schemas
inspire_schemas/builders/signatures.py
https://github.com/inspirehep/inspire-schemas/blob/34bc124b62fba565b6b40d1a3c15103a23a05edb/inspire_schemas/builders/signatures.py#L111-L136
def set_uid(self, uid, schema=None): """Set a unique ID. If a UID of a given schema already exists in a record it will be overwritten, otherwise it will be appended to the record. Args: uid (string): unique identifier. schema (Optional[string]): schema of the un...
[ "def", "set_uid", "(", "self", ",", "uid", ",", "schema", "=", "None", ")", ":", "try", ":", "uid", ",", "schema", "=", "author_id_normalize_and_schema", "(", "uid", ",", "schema", ")", "except", "UnknownUIDSchema", ":", "# Explicit schema wasn't provided, and t...
Set a unique ID. If a UID of a given schema already exists in a record it will be overwritten, otherwise it will be appended to the record. Args: uid (string): unique identifier. schema (Optional[string]): schema of the unique identifier. If ``None``, th...
[ "Set", "a", "unique", "ID", "." ]
python
train
37.846154
atlassian-api/atlassian-python-api
atlassian/bitbucket.py
https://github.com/atlassian-api/atlassian-python-api/blob/540d269905c3e7547b666fe30c647b2d512cf358/atlassian/bitbucket.py#L162-L173
def all_project_administrators(self): """ Get the list of project administrators :return: """ for project in self.project_list(): log.info('Processing project: {0} - {1}'.format(project.get('key'), project.get('name'))) yield { 'project_key...
[ "def", "all_project_administrators", "(", "self", ")", ":", "for", "project", "in", "self", ".", "project_list", "(", ")", ":", "log", ".", "info", "(", "'Processing project: {0} - {1}'", ".", "format", "(", "project", ".", "get", "(", "'key'", ")", ",", "...
Get the list of project administrators :return:
[ "Get", "the", "list", "of", "project", "administrators", ":", "return", ":" ]
python
train
50.166667
pycontribs/pyrax
pyrax/image.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/image.py#L294-L316
def update(self, img, value_dict): """ Accepts an image reference (object or ID) and dictionary of key/value pairs, where the key is an attribute of the image, and the value is the desired new value for that image. NOTE: There is a bug in Glance where the 'add' operation return...
[ "def", "update", "(", "self", ",", "img", ",", "value_dict", ")", ":", "img", "=", "self", ".", "get", "(", "img", ")", "uri", "=", "\"/%s/%s\"", "%", "(", "self", ".", "uri_base", ",", "utils", ".", "get_id", "(", "img", ")", ")", "body", "=", ...
Accepts an image reference (object or ID) and dictionary of key/value pairs, where the key is an attribute of the image, and the value is the desired new value for that image. NOTE: There is a bug in Glance where the 'add' operation returns a 409 if the property already exists, which c...
[ "Accepts", "an", "image", "reference", "(", "object", "or", "ID", ")", "and", "dictionary", "of", "key", "/", "value", "pairs", "where", "the", "key", "is", "an", "attribute", "of", "the", "image", "and", "the", "value", "is", "the", "desired", "new", ...
python
train
46.478261
tensorflow/tensor2tensor
tensor2tensor/models/research/autoencoders.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/autoencoders.py#L1214-L1234
def autoencoder_ordered_text(): """Ordered discrete autoencoder model for text.""" hparams = autoencoder_ordered_discrete() hparams.bottleneck_bits = 1024 hparams.bottleneck_shared_bits = 1024-64 hparams.bottleneck_shared_bits_start_warmup = 75000 hparams.bottleneck_shared_bits_stop_warmup = 275000 hparam...
[ "def", "autoencoder_ordered_text", "(", ")", ":", "hparams", "=", "autoencoder_ordered_discrete", "(", ")", "hparams", ".", "bottleneck_bits", "=", "1024", "hparams", ".", "bottleneck_shared_bits", "=", "1024", "-", "64", "hparams", ".", "bottleneck_shared_bits_start_...
Ordered discrete autoencoder model for text.
[ "Ordered", "discrete", "autoencoder", "model", "for", "text", "." ]
python
train
32.190476
chaosmail/python-fs
fs/fs.py
https://github.com/chaosmail/python-fs/blob/2567922ced9387e327e65f3244caff3b7af35684/fs/fs.py#L160-L163
def exists(path, **kwargs): """Check if file or directory exists""" import os.path return os.path.exists(path, **kwargs)
[ "def", "exists", "(", "path", ",", "*", "*", "kwargs", ")", ":", "import", "os", ".", "path", "return", "os", ".", "path", ".", "exists", "(", "path", ",", "*", "*", "kwargs", ")" ]
Check if file or directory exists
[ "Check", "if", "file", "or", "directory", "exists" ]
python
train
32.25
cdeboever3/cdpybio
cdpybio/analysis.py
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L47-L129
def generate_null_snvs(df, snvs, num_null_sets=5): """ Generate a set of null SNVs based on an input list of SNVs and categorical annotations. Parameters ---------- df : pandas.DataFrame Pandas dataframe where each column is a categorization of SNPs. The index should be SN...
[ "def", "generate_null_snvs", "(", "df", ",", "snvs", ",", "num_null_sets", "=", "5", ")", ":", "import", "numpy", "as", "np", "import", "random", "random", ".", "seed", "(", "20151007", ")", "input_snvs", "=", "list", "(", "set", "(", "df", ".", "index...
Generate a set of null SNVs based on an input list of SNVs and categorical annotations. Parameters ---------- df : pandas.DataFrame Pandas dataframe where each column is a categorization of SNPs. The index should be SNPs of the form chrom:pos. snvs : list List...
[ "Generate", "a", "set", "of", "null", "SNVs", "based", "on", "an", "input", "list", "of", "SNVs", "and", "categorical", "annotations", ".", "Parameters", "----------", "df", ":", "pandas", ".", "DataFrame", "Pandas", "dataframe", "where", "each", "column", "...
python
train
37.939759
tomasbasham/dominos
dominos/api.py
https://github.com/tomasbasham/dominos/blob/59729a8bdca0ae30a84115a0e93e9b1f259faf0e/dominos/api.py#L58-L69
def get_stores(self, search_term): ''' Search for dominos pizza stores using a search term. :param string search: Search term. :return: A list of nearby stores matching the search term. :rtype: list ''' params = {'SearchText': search_term} response = self...
[ "def", "get_stores", "(", "self", ",", "search_term", ")", ":", "params", "=", "{", "'SearchText'", ":", "search_term", "}", "response", "=", "self", ".", "__get", "(", "'/storefindermap/storesearch'", ",", "params", "=", "params", ")", "return", "Stores", "...
Search for dominos pizza stores using a search term. :param string search: Search term. :return: A list of nearby stores matching the search term. :rtype: list
[ "Search", "for", "dominos", "pizza", "stores", "using", "a", "search", "term", "." ]
python
test
33.416667
h2oai/h2o-3
h2o-py/h2o/model/model_base.py
https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/model_base.py#L547-L556
def coef(self): """ Return the coefficients which can be applied to the non-standardized data. Note: standardize = True by default, if set to False then coef() return the coefficients which are fit directly. """ tbl = self._model_json["output"]["coefficients_table"] if t...
[ "def", "coef", "(", "self", ")", ":", "tbl", "=", "self", ".", "_model_json", "[", "\"output\"", "]", "[", "\"coefficients_table\"", "]", "if", "tbl", "is", "None", ":", "return", "None", "return", "{", "name", ":", "coef", "for", "name", ",", "coef", ...
Return the coefficients which can be applied to the non-standardized data. Note: standardize = True by default, if set to False then coef() return the coefficients which are fit directly.
[ "Return", "the", "coefficients", "which", "can", "be", "applied", "to", "the", "non", "-", "standardized", "data", "." ]
python
test
43.1
lk-geimfari/mimesis
mimesis/providers/date.py
https://github.com/lk-geimfari/mimesis/blob/4b16ee7a8dba6281a904654a88dbb4b052869fc5/mimesis/providers/date.py#L245-L257
def timestamp(self, posix: bool = True, **kwargs) -> Union[str, int]: """Generate random timestamp. :param posix: POSIX time. :param kwargs: Kwargs for :meth:`~Datetime.datetime()`. :return: Timestamp. """ stamp = self.datetime(**kwargs) if posix: re...
[ "def", "timestamp", "(", "self", ",", "posix", ":", "bool", "=", "True", ",", "*", "*", "kwargs", ")", "->", "Union", "[", "str", ",", "int", "]", ":", "stamp", "=", "self", ".", "datetime", "(", "*", "*", "kwargs", ")", "if", "posix", ":", "re...
Generate random timestamp. :param posix: POSIX time. :param kwargs: Kwargs for :meth:`~Datetime.datetime()`. :return: Timestamp.
[ "Generate", "random", "timestamp", "." ]
python
train
30.307692
oasiswork/zimsoap
zimsoap/client.py
https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L444-L456
def get_preferences(self): """ Gets all the preferences of the current user :returns: a dict presenting the preferences by name, values are typed to str/bool/int/float regarding their content. """ pref_list = self.request('GetPrefs')['pref'] out = {} fo...
[ "def", "get_preferences", "(", "self", ")", ":", "pref_list", "=", "self", ".", "request", "(", "'GetPrefs'", ")", "[", "'pref'", "]", "out", "=", "{", "}", "for", "pref", "in", "pref_list", ":", "out", "[", "pref", "[", "'name'", "]", "]", "=", "u...
Gets all the preferences of the current user :returns: a dict presenting the preferences by name, values are typed to str/bool/int/float regarding their content.
[ "Gets", "all", "the", "preferences", "of", "the", "current", "user" ]
python
train
31.846154
caseyjlaw/rtpipe
rtpipe/parsesdm.py
https://github.com/caseyjlaw/rtpipe/blob/ac33e4332cf215091a63afbb3137850876d73ec0/rtpipe/parsesdm.py#L245-L265
def read_bdf(sdmfile, scannum, nskip=0, readints=0, bdfdir=''): """ Uses sdmpy to read a given range of integrations from sdm of given scan. readints=0 will read all of bdf (skipping nskip). """ assert os.path.exists(sdmfile), 'sdmfile %s does not exist' % sdmfile sdm = getsdm(sdmfile, bdfdir=bdf...
[ "def", "read_bdf", "(", "sdmfile", ",", "scannum", ",", "nskip", "=", "0", ",", "readints", "=", "0", ",", "bdfdir", "=", "''", ")", ":", "assert", "os", ".", "path", ".", "exists", "(", "sdmfile", ")", ",", "'sdmfile %s does not exist'", "%", "sdmfile...
Uses sdmpy to read a given range of integrations from sdm of given scan. readints=0 will read all of bdf (skipping nskip).
[ "Uses", "sdmpy", "to", "read", "a", "given", "range", "of", "integrations", "from", "sdm", "of", "given", "scan", "." ]
python
train
39.761905
tijme/not-your-average-web-crawler
nyawc/scrapers/HTMLSoupFormScraper.py
https://github.com/tijme/not-your-average-web-crawler/blob/d77c14e1616c541bb3980f649a7e6f8ed02761fb/nyawc/scrapers/HTMLSoupFormScraper.py#L146-L167
def __get_default_form_data_input(self, elements): """Get the default form data {key: value} for the given elements. Args: elements list(obj): Soup elements. Returns: obj: The {key: value} form data """ form_data = OrderedDict() for element in...
[ "def", "__get_default_form_data_input", "(", "self", ",", "elements", ")", ":", "form_data", "=", "OrderedDict", "(", ")", "for", "element", "in", "elements", ":", "default_value", "=", "self", ".", "__get_default_value_from_element", "(", "element", ")", "if", ...
Get the default form data {key: value} for the given elements. Args: elements list(obj): Soup elements. Returns: obj: The {key: value} form data
[ "Get", "the", "default", "form", "data", "{", "key", ":", "value", "}", "for", "the", "given", "elements", "." ]
python
train
24.136364
timothyb0912/pylogit
pylogit/choice_tools.py
https://github.com/timothyb0912/pylogit/blob/f83b0fd6debaa7358d87c3828428f6d4ead71357/pylogit/choice_tools.py#L718-L745
def get_original_order_unique_ids(id_array): """ Get the unique id's of id_array, in their original order of appearance. Parameters ---------- id_array : 1D ndarray. Should contain the ids that we want to extract the unique values from. Returns ------- original_order_unique_ids...
[ "def", "get_original_order_unique_ids", "(", "id_array", ")", ":", "assert", "isinstance", "(", "id_array", ",", "np", ".", "ndarray", ")", "assert", "len", "(", "id_array", ".", "shape", ")", "==", "1", "# Get the indices of the unique IDs in their order of appearanc...
Get the unique id's of id_array, in their original order of appearance. Parameters ---------- id_array : 1D ndarray. Should contain the ids that we want to extract the unique values from. Returns ------- original_order_unique_ids : 1D ndarray. Contains the unique ids from `id_a...
[ "Get", "the", "unique", "id", "s", "of", "id_array", "in", "their", "original", "order", "of", "appearance", "." ]
python
train
33.5
insomnia-lab/libreant
cli/libreant_db.py
https://github.com/insomnia-lab/libreant/blob/55d529435baf4c05a86b8341899e9f5e14e50245/cli/libreant_db.py#L127-L153
def import_volumes(source, ignore_conflicts, yes): '''Import volumes SOURCE must be a json file and must follow the same structure used in `libreant-db export`. Pass - to read from standard input. ''' volumes = json.load(source) tot = len(volumes) if not yes: click.confirm("Are you ...
[ "def", "import_volumes", "(", "source", ",", "ignore_conflicts", ",", "yes", ")", ":", "volumes", "=", "json", ".", "load", "(", "source", ")", "tot", "=", "len", "(", "volumes", ")", "if", "not", "yes", ":", "click", ".", "confirm", "(", "\"Are you su...
Import volumes SOURCE must be a json file and must follow the same structure used in `libreant-db export`. Pass - to read from standard input.
[ "Import", "volumes" ]
python
train
35.925926
woolfson-group/isambard
isambard/optimisation/evo_optimizers.py
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/evo_optimizers.py#L458-L470
def _initialize_pop(self, pop_size): """Generates the initial population and assigns fitnesses.""" self.initialize_cma_es(pop_size) self.toolbox.register("individual", self._make_individual) self.toolbox.register("generate", self._generate, self.toolbox.indi...
[ "def", "_initialize_pop", "(", "self", ",", "pop_size", ")", ":", "self", ".", "initialize_cma_es", "(", "pop_size", ")", "self", ".", "toolbox", ".", "register", "(", "\"individual\"", ",", "self", ".", "_make_individual", ")", "self", ".", "toolbox", ".", ...
Generates the initial population and assigns fitnesses.
[ "Generates", "the", "initial", "population", "and", "assigns", "fitnesses", "." ]
python
train
51.230769