repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
wiheto/teneto
teneto/networkmeasures/fluctuability.py
https://github.com/wiheto/teneto/blob/80d7a83a9adc1714589b020627c45bd5b66248ab/teneto/networkmeasures/fluctuability.py#L8-L121
def fluctuability(netin, calc='global'): r""" Fluctuability of temporal networks. This is the variation of the network's edges over time. [fluct-1]_ This is the unique number of edges through time divided by the overall number of edges. Parameters ---------- netin : array or dict Temp...
[ "def", "fluctuability", "(", "netin", ",", "calc", "=", "'global'", ")", ":", "# Get input type (C or G)", "netin", ",", "_", "=", "process_input", "(", "netin", ",", "[", "'C'", ",", "'G'", ",", "'TN'", "]", ")", "netin", "[", "netin", "!=", "0", "]",...
r""" Fluctuability of temporal networks. This is the variation of the network's edges over time. [fluct-1]_ This is the unique number of edges through time divided by the overall number of edges. Parameters ---------- netin : array or dict Temporal network input (graphlet or contact) (net...
[ "r", "Fluctuability", "of", "temporal", "networks", ".", "This", "is", "the", "variation", "of", "the", "network", "s", "edges", "over", "time", ".", "[", "fluct", "-", "1", "]", "_", "This", "is", "the", "unique", "number", "of", "edges", "through", "...
python
train
photo/openphoto-python
trovebox/api/api_album.py
https://github.com/photo/openphoto-python/blob/209a1da27c8d8c88dbcf4ea6c6f57031ea1bc44b/trovebox/api/api_album.py#L24-L42
def cover_update(self, album, photo, **kwds): """ Endpoint: /album/<album_id>/cover/<photo_id>/update.json Update the cover photo of an album. Returns the updated album object. """ result = self._client.post("/album/%s/cover/%s/update.json" % ...
[ "def", "cover_update", "(", "self", ",", "album", ",", "photo", ",", "*", "*", "kwds", ")", ":", "result", "=", "self", ".", "_client", ".", "post", "(", "\"/album/%s/cover/%s/update.json\"", "%", "(", "self", ".", "_extract_id", "(", "album", ")", ",", ...
Endpoint: /album/<album_id>/cover/<photo_id>/update.json Update the cover photo of an album. Returns the updated album object.
[ "Endpoint", ":", "/", "album", "/", "<album_id", ">", "/", "cover", "/", "<photo_id", ">", "/", "update", ".", "json" ]
python
train
KnowledgeLinks/rdfframework
rdfframework/rml/processor.py
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/rml/processor.py#L397-L401
def add_to_triplestore(self, output): """Method attempts to add output to Blazegraph RDF Triplestore""" if len(output) > 0: result = self.ext_conn.load_data(data=output.serialize(), datatype='rdf')
[ "def", "add_to_triplestore", "(", "self", ",", "output", ")", ":", "if", "len", "(", "output", ")", ">", "0", ":", "result", "=", "self", ".", "ext_conn", ".", "load_data", "(", "data", "=", "output", ".", "serialize", "(", ")", ",", "datatype", "=",...
Method attempts to add output to Blazegraph RDF Triplestore
[ "Method", "attempts", "to", "add", "output", "to", "Blazegraph", "RDF", "Triplestore" ]
python
train
OCR-D/core
ocrd_models/ocrd_models/ocrd_file.py
https://github.com/OCR-D/core/blob/57e68c578526cb955fd2e368207f5386c459d91d/ocrd_models/ocrd_models/ocrd_file.py#L96-L104
def pageId(self, pageId): """ Set the ID of the physical page this file manifests. """ if pageId is None: return if self.mets is None: raise Exception("OcrdFile %s has no member 'mets' pointing to parent OcrdMets" % self) self.mets.set_physical_pag...
[ "def", "pageId", "(", "self", ",", "pageId", ")", ":", "if", "pageId", "is", "None", ":", "return", "if", "self", ".", "mets", "is", "None", ":", "raise", "Exception", "(", "\"OcrdFile %s has no member 'mets' pointing to parent OcrdMets\"", "%", "self", ")", "...
Set the ID of the physical page this file manifests.
[ "Set", "the", "ID", "of", "the", "physical", "page", "this", "file", "manifests", "." ]
python
train
facundobatista/yaswfp
yaswfp/swfparser.py
https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1383-L1391
def _get_struct_blurfilter(self): """Get the values for the BLURFILTER record.""" obj = _make_object("BlurFilter") obj.BlurX = unpack_fixed16(self._src) obj.BlurY = unpack_fixed16(self._src) bc = BitConsumer(self._src) obj.Passes = bc.u_get(5) obj.Reserved = bc.u_...
[ "def", "_get_struct_blurfilter", "(", "self", ")", ":", "obj", "=", "_make_object", "(", "\"BlurFilter\"", ")", "obj", ".", "BlurX", "=", "unpack_fixed16", "(", "self", ".", "_src", ")", "obj", ".", "BlurY", "=", "unpack_fixed16", "(", "self", ".", "_src",...
Get the values for the BLURFILTER record.
[ "Get", "the", "values", "for", "the", "BLURFILTER", "record", "." ]
python
train
ryan-roemer/django-cloud-browser
cloud_browser/cloud/google.py
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/cloud/google.py#L56-L64
def is_prefix(cls, result): """Return ``True`` if result is a prefix object. .. note:: Boto uses the S3 Prefix object for GS prefixes. """ from boto.s3.prefix import Prefix return isinstance(result, Prefix) or cls._is_gs_folder(result)
[ "def", "is_prefix", "(", "cls", ",", "result", ")", ":", "from", "boto", ".", "s3", ".", "prefix", "import", "Prefix", "return", "isinstance", "(", "result", ",", "Prefix", ")", "or", "cls", ".", "_is_gs_folder", "(", "result", ")" ]
Return ``True`` if result is a prefix object. .. note:: Boto uses the S3 Prefix object for GS prefixes.
[ "Return", "True", "if", "result", "is", "a", "prefix", "object", "." ]
python
train
googlemaps/google-maps-services-python
googlemaps/client.py
https://github.com/googlemaps/google-maps-services-python/blob/7ed40b4d8df63479794c46ce29d03ed6083071d7/googlemaps/client.py#L416-L430
def urlencode_params(params): """URL encodes the parameters. :param params: The parameters :type params: list of key/value tuples. :rtype: string """ # urlencode does not handle unicode strings in Python 2. # Firstly, normalize the values so they get encoded correctly. params = [(key, ...
[ "def", "urlencode_params", "(", "params", ")", ":", "# urlencode does not handle unicode strings in Python 2.", "# Firstly, normalize the values so they get encoded correctly.", "params", "=", "[", "(", "key", ",", "normalize_for_urlencode", "(", "val", ")", ")", "for", "key"...
URL encodes the parameters. :param params: The parameters :type params: list of key/value tuples. :rtype: string
[ "URL", "encodes", "the", "parameters", "." ]
python
train
paylogic/pip-accel
pip_accel/__init__.py
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/__init__.py#L323-L363
def decorate_arguments(self, arguments): """ Change pathnames of local files into ``file://`` URLs with ``#md5=...`` fragments. :param arguments: The command line arguments to ``pip install ...`` (a list of strings). :returns: A copy of the command line argumen...
[ "def", "decorate_arguments", "(", "self", ",", "arguments", ")", ":", "arguments", "=", "list", "(", "arguments", ")", "for", "i", ",", "value", "in", "enumerate", "(", "arguments", ")", ":", "is_constraint_file", "=", "(", "i", ">=", "1", "and", "match_...
Change pathnames of local files into ``file://`` URLs with ``#md5=...`` fragments. :param arguments: The command line arguments to ``pip install ...`` (a list of strings). :returns: A copy of the command line arguments with pathnames of local files rewritten ...
[ "Change", "pathnames", "of", "local", "files", "into", "file", ":", "//", "URLs", "with", "#md5", "=", "...", "fragments", "." ]
python
train
tadashi-aikawa/owlmixin
owlmixin/owlcollections.py
https://github.com/tadashi-aikawa/owlmixin/blob/7c4a042c3008abddc56a8e8e55ae930d276071f5/owlmixin/owlcollections.py#L477-L488
def reject(self, func): """ :param func: :type func: (K, T) -> bool :rtype: TList[T] Usage: >>> TDict(k1=1, k2=2, k3=3).reject(lambda k, v: v < 3) [3] """ return TList([v for k, v in self.items() if not func(k, v)])
[ "def", "reject", "(", "self", ",", "func", ")", ":", "return", "TList", "(", "[", "v", "for", "k", ",", "v", "in", "self", ".", "items", "(", ")", "if", "not", "func", "(", "k", ",", "v", ")", "]", ")" ]
:param func: :type func: (K, T) -> bool :rtype: TList[T] Usage: >>> TDict(k1=1, k2=2, k3=3).reject(lambda k, v: v < 3) [3]
[ ":", "param", "func", ":", ":", "type", "func", ":", "(", "K", "T", ")", "-", ">", "bool", ":", "rtype", ":", "TList", "[", "T", "]" ]
python
train
SmBe19/praw-OAuth2Util
OAuth2Util/OAuth2Util.py
https://github.com/SmBe19/praw-OAuth2Util/blob/ca0a2d4d7eefcc681aac92c9cd4b83cd9ea6c5fe/OAuth2Util/OAuth2Util.py#L208-L218
def _migrate_config(self, oldname=DEFAULT_CONFIG, newname=DEFAULT_CONFIG): """ Migrates the old config file format to the new one """ self._log("Your OAuth2Util config file is in an old format and needs " "to be changed. I tried as best as I could to migrate it.", logging.WARNING) with open(oldname, "r")...
[ "def", "_migrate_config", "(", "self", ",", "oldname", "=", "DEFAULT_CONFIG", ",", "newname", "=", "DEFAULT_CONFIG", ")", ":", "self", ".", "_log", "(", "\"Your OAuth2Util config file is in an old format and needs \"", "\"to be changed. I tried as best as I could to migrate it....
Migrates the old config file format to the new one
[ "Migrates", "the", "old", "config", "file", "format", "to", "the", "new", "one" ]
python
test
Clinical-Genomics/scout
scout/utils/acmg.py
https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/utils/acmg.py#L2-L55
def is_pathogenic(pvs, ps_terms, pm_terms, pp_terms): """Check if the criterias for Pathogenic is fullfilled The following are descriptions of Pathogenic clasification from ACMG paper: Pathogenic (i) 1 Very strong (PVS1) AND (a) ≥1 Strong (PS1–PS4) OR (b) ≥2 Moderate (PM1–PM6) OR ...
[ "def", "is_pathogenic", "(", "pvs", ",", "ps_terms", ",", "pm_terms", ",", "pp_terms", ")", ":", "if", "pvs", ":", "# Pathogenic (i)(a):", "if", "ps_terms", ":", "return", "True", "if", "pm_terms", ":", "# Pathogenic (i)(c):", "if", "pp_terms", ":", "return", ...
Check if the criterias for Pathogenic is fullfilled The following are descriptions of Pathogenic clasification from ACMG paper: Pathogenic (i) 1 Very strong (PVS1) AND (a) ≥1 Strong (PS1–PS4) OR (b) ≥2 Moderate (PM1–PM6) OR (c) 1 Moderate (PM1–PM6) and 1 supporting (PP1–PP5) OR ...
[ "Check", "if", "the", "criterias", "for", "Pathogenic", "is", "fullfilled" ]
python
test
jobovy/galpy
galpy/potential/FerrersPotential.py
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/potential/FerrersPotential.py#L467-L474
def _FracInt(x,y,z,a,b,c,tau,n): """Returns 1 x^2 y^2 z^2 -------------------------- (1 - ------- - ------- - -------)^n sqrt(tau+a)(tau+b)(tau+c)) tau+a tau+b tau+c """ denom = np.sqrt((a + tau)*(b + tau)*(c + tau)) return (1. - x**2...
[ "def", "_FracInt", "(", "x", ",", "y", ",", "z", ",", "a", ",", "b", ",", "c", ",", "tau", ",", "n", ")", ":", "denom", "=", "np", ".", "sqrt", "(", "(", "a", "+", "tau", ")", "*", "(", "b", "+", "tau", ")", "*", "(", "c", "+", "tau",...
Returns 1 x^2 y^2 z^2 -------------------------- (1 - ------- - ------- - -------)^n sqrt(tau+a)(tau+b)(tau+c)) tau+a tau+b tau+c
[ "Returns", "1", "x^2", "y^2", "z^2", "--------------------------", "(", "1", "-", "-------", "-", "-------", "-", "-------", ")", "^n", "sqrt", "(", "tau", "+", "a", ")", "(", "tau", "+", "b", ")", "(", "tau", "+", "c", "))", "tau", "+", "a", "ta...
python
train
fermiPy/fermipy
fermipy/diffuse/name_policy.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L404-L416
def mcube(self, **kwargs): """ return the name of a model cube file """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) kwargs_copy['dataset'] = kwargs.get('dataset', self.dataset(**kwargs)) kwargs_copy['component'] = kwargs.get( 'component', ...
[ "def", "mcube", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs_copy", "=", "self", ".", "base_dict", ".", "copy", "(", ")", "kwargs_copy", ".", "update", "(", "*", "*", "kwargs", ")", "kwargs_copy", "[", "'dataset'", "]", "=", "kwargs", ".",...
return the name of a model cube file
[ "return", "the", "name", "of", "a", "model", "cube", "file" ]
python
train
ibis-project/ibis
ibis/impala/client.py
https://github.com/ibis-project/ibis/blob/1e39a5fd9ef088b45c155e8a5f541767ee8ef2e7/ibis/impala/client.py#L1779-L1792
def exists_uda(self, name, database=None): """ Checks if a given UDAF exists within a specified database Parameters ---------- name : string, UDAF name database : string, database name Returns ------- if_exists : boolean """ retur...
[ "def", "exists_uda", "(", "self", ",", "name", ",", "database", "=", "None", ")", ":", "return", "len", "(", "self", ".", "list_udas", "(", "database", "=", "database", ",", "like", "=", "name", ")", ")", ">", "0" ]
Checks if a given UDAF exists within a specified database Parameters ---------- name : string, UDAF name database : string, database name Returns ------- if_exists : boolean
[ "Checks", "if", "a", "given", "UDAF", "exists", "within", "a", "specified", "database" ]
python
train
rocky/python3-trepan
trepan/processor/cmdproc.py
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdproc.py#L639-L674
def process_commands(self): """Handle debugger commands.""" if self.core.execution_status != 'No program': self.setup() self.location() pass leave_loop = run_hooks(self, self.preloop_hooks) self.continue_running = False while not leave_loop: ...
[ "def", "process_commands", "(", "self", ")", ":", "if", "self", ".", "core", ".", "execution_status", "!=", "'No program'", ":", "self", ".", "setup", "(", ")", "self", ".", "location", "(", ")", "pass", "leave_loop", "=", "run_hooks", "(", "self", ",", ...
Handle debugger commands.
[ "Handle", "debugger", "commands", "." ]
python
test
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/database.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/database.py#L392-L407
def batch_snapshot(self, read_timestamp=None, exact_staleness=None): """Return an object which wraps a batch read / query. :type read_timestamp: :class:`datetime.datetime` :param read_timestamp: Execute all reads at the given timestamp. :type exact_staleness: :class:`datetime.timedelta...
[ "def", "batch_snapshot", "(", "self", ",", "read_timestamp", "=", "None", ",", "exact_staleness", "=", "None", ")", ":", "return", "BatchSnapshot", "(", "self", ",", "read_timestamp", "=", "read_timestamp", ",", "exact_staleness", "=", "exact_staleness", ")" ]
Return an object which wraps a batch read / query. :type read_timestamp: :class:`datetime.datetime` :param read_timestamp: Execute all reads at the given timestamp. :type exact_staleness: :class:`datetime.timedelta` :param exact_staleness: Execute all reads at a timestamp that is ...
[ "Return", "an", "object", "which", "wraps", "a", "batch", "read", "/", "query", "." ]
python
train
hadrianl/huobi
huobitrade/service.py
https://github.com/hadrianl/huobi/blob/bbfa2036703ee84a76d5d8e9f89c25fc8a55f2c7/huobitrade/service.py#L63-L74
def get_kline(self, symbol, period, size=150, _async=False): """ 获取KLine :param symbol :param period: 可选值:{1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year } :param size: 可选值: [1,2000] :return: """ params = {'symbol': symbol, 'period': period, 'si...
[ "def", "get_kline", "(", "self", ",", "symbol", ",", "period", ",", "size", "=", "150", ",", "_async", "=", "False", ")", ":", "params", "=", "{", "'symbol'", ":", "symbol", ",", "'period'", ":", "period", ",", "'size'", ":", "size", "}", "url", "=...
获取KLine :param symbol :param period: 可选值:{1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year } :param size: 可选值: [1,2000] :return:
[ "获取KLine", ":", "param", "symbol", ":", "param", "period", ":", "可选值:", "{", "1min", "5min", "15min", "30min", "60min", "1day", "1mon", "1week", "1year", "}", ":", "param", "size", ":", "可选值:", "[", "1", "2000", "]", ":", "return", ":" ]
python
train
edoburu/django-private-storage
private_storage/servers.py
https://github.com/edoburu/django-private-storage/blob/35b718024fee75b0ed3400f601976b20246c7d05/private_storage/servers.py#L43-L56
def add_no_cache_headers(func): """ Makes sure the retrieved file is not cached on disk, or cached by proxy servers in between. This would circumvent any checking whether the user may even access the file. """ @wraps(func) def _dec(*args, **kwargs): response = func(*args, **kwargs) ...
[ "def", "add_no_cache_headers", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "_dec", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "response", "=", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", "response", "[", "'...
Makes sure the retrieved file is not cached on disk, or cached by proxy servers in between. This would circumvent any checking whether the user may even access the file.
[ "Makes", "sure", "the", "retrieved", "file", "is", "not", "cached", "on", "disk", "or", "cached", "by", "proxy", "servers", "in", "between", ".", "This", "would", "circumvent", "any", "checking", "whether", "the", "user", "may", "even", "access", "the", "f...
python
train
lextoumbourou/txstripe
txstripe/resource.py
https://github.com/lextoumbourou/txstripe/blob/a69e67f524258026fd1840655a0578311bba3b89/txstripe/resource.py#L52-L110
def make_request( ins, method, url, stripe_account=None, params=None, headers=None, **kwargs ): """ Return a deferred or handle error. For overriding in various classes. """ if txstripe.api_key is None: raise error.AuthenticationError( 'No API key provided. (HINT: set your A...
[ "def", "make_request", "(", "ins", ",", "method", ",", "url", ",", "stripe_account", "=", "None", ",", "params", "=", "None", ",", "headers", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "txstripe", ".", "api_key", "is", "None", ":", "raise"...
Return a deferred or handle error. For overriding in various classes.
[ "Return", "a", "deferred", "or", "handle", "error", "." ]
python
train
arista-eosplus/pyeapi
pyeapi/api/vlans.py
https://github.com/arista-eosplus/pyeapi/blob/96a74faef1fe3bd79c4e900aed29c9956a0587d6/pyeapi/api/vlans.py#L90-L112
def get(self, value): """Returns the VLAN configuration as a resource dict. Args: vid (string): The vlan identifier to retrieve from the running configuration. Valid values are in the range of 1 to 4095 Returns: A Python dict object cont...
[ "def", "get", "(", "self", ",", "value", ")", ":", "config", "=", "self", ".", "get_block", "(", "'vlan %s'", "%", "value", ")", "if", "not", "config", ":", "return", "None", "response", "=", "dict", "(", "vlan_id", "=", "value", ")", "response", "."...
Returns the VLAN configuration as a resource dict. Args: vid (string): The vlan identifier to retrieve from the running configuration. Valid values are in the range of 1 to 4095 Returns: A Python dict object containing the VLAN attributes as ...
[ "Returns", "the", "VLAN", "configuration", "as", "a", "resource", "dict", "." ]
python
train
polyaxon/polyaxon
polyaxon/db/models/pipelines.py
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/db/models/pipelines.py#L533-L547
def check_concurrency(self) -> bool: """Checks the concurrency of the operation run. Checks the concurrency of the operation run to validate if we can start a new operation run. Returns: boolean: Whether to start a new operation run or not. """ if not self.o...
[ "def", "check_concurrency", "(", "self", ")", "->", "bool", ":", "if", "not", "self", ".", "operation", ".", "concurrency", ":", "# No concurrency set", "return", "True", "ops_count", "=", "self", ".", "operation", ".", "runs", ".", "filter", "(", "status__s...
Checks the concurrency of the operation run. Checks the concurrency of the operation run to validate if we can start a new operation run. Returns: boolean: Whether to start a new operation run or not.
[ "Checks", "the", "concurrency", "of", "the", "operation", "run", "." ]
python
train
Duke-GCB/DukeDSClient
ddsc/cmdparser.py
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L359-L372
def register_add_user_command(self, add_user_func): """ Add the add-user command to the parser and call add_user_func(project_name, user_full_name, auth_role) when chosen. :param add_user_func: func Called when this option is chosen: upload_func(project_name, user_full_name, auth_role). ...
[ "def", "register_add_user_command", "(", "self", ",", "add_user_func", ")", ":", "description", "=", "\"Gives user permission to access a remote project.\"", "add_user_parser", "=", "self", ".", "subparsers", ".", "add_parser", "(", "'add-user'", ",", "description", "=", ...
Add the add-user command to the parser and call add_user_func(project_name, user_full_name, auth_role) when chosen. :param add_user_func: func Called when this option is chosen: upload_func(project_name, user_full_name, auth_role).
[ "Add", "the", "add", "-", "user", "command", "to", "the", "parser", "and", "call", "add_user_func", "(", "project_name", "user_full_name", "auth_role", ")", "when", "chosen", ".", ":", "param", "add_user_func", ":", "func", "Called", "when", "this", "option", ...
python
train
gccxml/pygccxml
pygccxml/declarations/type_traits.py
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L512-L524
def is_std_string(type_): """ Returns True, if type represents C++ `std::string`, False otherwise. """ if utils.is_str(type_): return type_ in string_equivalences type_ = remove_alias(type_) type_ = remove_reference(type_) type_ = remove_cv(type_) return type_.decl_string in s...
[ "def", "is_std_string", "(", "type_", ")", ":", "if", "utils", ".", "is_str", "(", "type_", ")", ":", "return", "type_", "in", "string_equivalences", "type_", "=", "remove_alias", "(", "type_", ")", "type_", "=", "remove_reference", "(", "type_", ")", "typ...
Returns True, if type represents C++ `std::string`, False otherwise.
[ "Returns", "True", "if", "type", "represents", "C", "++", "std", "::", "string", "False", "otherwise", "." ]
python
train
finklabs/korg
korg/pattern.py
https://github.com/finklabs/korg/blob/e931a673ce4bc79cdf26cb4f697fa23fa8a72e4f/korg/pattern.py#L73-L81
def _load_patterns(self, folders, pattern_dict=None): """Load all pattern from all the files in folders""" if pattern_dict is None: pattern_dict = {} for folder in folders: for file in os.listdir(folder): if regex.match('^[\w-]+$', file): ...
[ "def", "_load_patterns", "(", "self", ",", "folders", ",", "pattern_dict", "=", "None", ")", ":", "if", "pattern_dict", "is", "None", ":", "pattern_dict", "=", "{", "}", "for", "folder", "in", "folders", ":", "for", "file", "in", "os", ".", "listdir", ...
Load all pattern from all the files in folders
[ "Load", "all", "pattern", "from", "all", "the", "files", "in", "folders" ]
python
train
rigetti/grove
grove/alpha/jordan_gradient/gradient_utils.py
https://github.com/rigetti/grove/blob/dc6bf6ec63e8c435fe52b1e00f707d5ce4cdb9b3/grove/alpha/jordan_gradient/gradient_utils.py#L6-L27
def binary_float_to_decimal_float(number: Union[float, str]) -> float: """ Convert binary floating point to decimal floating point. :param number: Binary floating point. :return: Decimal floating point representation of binary floating point. """ if isinstance(number, str): if number[0]...
[ "def", "binary_float_to_decimal_float", "(", "number", ":", "Union", "[", "float", ",", "str", "]", ")", "->", "float", ":", "if", "isinstance", "(", "number", ",", "str", ")", ":", "if", "number", "[", "0", "]", "==", "'-'", ":", "n_sign", "=", "-",...
Convert binary floating point to decimal floating point. :param number: Binary floating point. :return: Decimal floating point representation of binary floating point.
[ "Convert", "binary", "floating", "point", "to", "decimal", "floating", "point", "." ]
python
train
mlperf/training
rnn_translator/pytorch/seq2seq/inference/inference.py
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/rnn_translator/pytorch/seq2seq/inference/inference.py#L273-L289
def run_sacrebleu(self, detok_eval_path, reference_path): """ Executes sacrebleu and returns BLEU score. :param detok_eval_path: path to the test file :param reference_path: path to the reference file """ if reference_path is None: reference_path = os.path.jo...
[ "def", "run_sacrebleu", "(", "self", ",", "detok_eval_path", ",", "reference_path", ")", ":", "if", "reference_path", "is", "None", ":", "reference_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "dataset_dir", ",", "config", ".", "TGT_TEST_TAR...
Executes sacrebleu and returns BLEU score. :param detok_eval_path: path to the test file :param reference_path: path to the reference file
[ "Executes", "sacrebleu", "and", "returns", "BLEU", "score", "." ]
python
train
QualiSystems/vCenterShell
package/cloudshell/cp/vcenter/commands/disconnect_dvswitch.py
https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/disconnect_dvswitch.py#L64-L99
def disconnect(self, si, logger, vcenter_data_model, vm_uuid, network_name=None, vm=None): """ disconnect network adapter of the vm. If 'network_name' = None - disconnect ALL interfaces :param <str> si: :param logger: :param VMwarevCenterResourceModel vcenter_data_model: ...
[ "def", "disconnect", "(", "self", ",", "si", ",", "logger", ",", "vcenter_data_model", ",", "vm_uuid", ",", "network_name", "=", "None", ",", "vm", "=", "None", ")", ":", "logger", ".", "debug", "(", "\"Disconnect Interface VM: '{0}' Network: '{1}' ...\"", ".", ...
disconnect network adapter of the vm. If 'network_name' = None - disconnect ALL interfaces :param <str> si: :param logger: :param VMwarevCenterResourceModel vcenter_data_model: :param <str> vm_uuid: the uuid of the vm :param <str | None> network_name: the name of the specific net...
[ "disconnect", "network", "adapter", "of", "the", "vm", ".", "If", "network_name", "=", "None", "-", "disconnect", "ALL", "interfaces", ":", "param", "<str", ">", "si", ":", ":", "param", "logger", ":", ":", "param", "VMwarevCenterResourceModel", "vcenter_data_...
python
train
treycucco/pyebnf
pyebnf/primitive.py
https://github.com/treycucco/pyebnf/blob/3634ddabbe5d73508bcc20f4a591f86a46634e1d/pyebnf/primitive.py#L320-L330
def _get_terminal(value, text): """Checks the beginning of text for a value. If it is found, a terminal ParseNode is returned filled out appropriately for the value it found. DeadEnd is raised if the value does not match. """ if text and text.startswith(value): return ParseNode(ParseNodeType.terminal, ...
[ "def", "_get_terminal", "(", "value", ",", "text", ")", ":", "if", "text", "and", "text", ".", "startswith", "(", "value", ")", ":", "return", "ParseNode", "(", "ParseNodeType", ".", "terminal", ",", "children", "=", "[", "value", "]", ",", "consumed", ...
Checks the beginning of text for a value. If it is found, a terminal ParseNode is returned filled out appropriately for the value it found. DeadEnd is raised if the value does not match.
[ "Checks", "the", "beginning", "of", "text", "for", "a", "value", ".", "If", "it", "is", "found", "a", "terminal", "ParseNode", "is", "returned", "filled", "out", "appropriately", "for", "the", "value", "it", "found", ".", "DeadEnd", "is", "raised", "if", ...
python
test
prometheus/client_python
prometheus_client/exposition.py
https://github.com/prometheus/client_python/blob/31f5557e2e84ca4ffa9a03abf6e3f4d0c8b8c3eb/prometheus_client/exposition.py#L190-L196
def start_http_server(port, addr='', registry=REGISTRY): """Starts an HTTP server for prometheus metrics as a daemon thread""" CustomMetricsHandler = MetricsHandler.factory(registry) httpd = _ThreadingSimpleServer((addr, port), CustomMetricsHandler) t = threading.Thread(target=httpd.serve_forever) t...
[ "def", "start_http_server", "(", "port", ",", "addr", "=", "''", ",", "registry", "=", "REGISTRY", ")", ":", "CustomMetricsHandler", "=", "MetricsHandler", ".", "factory", "(", "registry", ")", "httpd", "=", "_ThreadingSimpleServer", "(", "(", "addr", ",", "...
Starts an HTTP server for prometheus metrics as a daemon thread
[ "Starts", "an", "HTTP", "server", "for", "prometheus", "metrics", "as", "a", "daemon", "thread" ]
python
train
coldmind/django-postgres-pgpfields
django_postgres_pgpfields/managers.py
https://github.com/coldmind/django-postgres-pgpfields/blob/8ad7ab6254f06104012696fa7f99d0f6727fb667/django_postgres_pgpfields/managers.py#L22-L36
def get_queryset(self, *args, **kwargs): """Django queryset.extra() is used here to add decryption sql to query.""" select_sql = {} encrypted_fields = [] for f in self.model._meta.get_fields_with_model(): field = f[0] if isinstance(field, PGPMixin): ...
[ "def", "get_queryset", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "select_sql", "=", "{", "}", "encrypted_fields", "=", "[", "]", "for", "f", "in", "self", ".", "model", ".", "_meta", ".", "get_fields_with_model", "(", ")", ":"...
Django queryset.extra() is used here to add decryption sql to query.
[ "Django", "queryset", ".", "extra", "()", "is", "used", "here", "to", "add", "decryption", "sql", "to", "query", "." ]
python
train
cloudnull/cloudlib
cloudlib/http.py
https://github.com/cloudnull/cloudlib/blob/5038111ce02521caa2558117e3bae9e1e806d315/cloudlib/http.py#L118-L124
def _report_error(self, request, exp): """When making the request, if an error happens, log it.""" message = ( "Failure to perform %s due to [ %s ]" % (request, exp) ) self.log.fatal(message) raise requests.RequestException(message)
[ "def", "_report_error", "(", "self", ",", "request", ",", "exp", ")", ":", "message", "=", "(", "\"Failure to perform %s due to [ %s ]\"", "%", "(", "request", ",", "exp", ")", ")", "self", ".", "log", ".", "fatal", "(", "message", ")", "raise", "requests"...
When making the request, if an error happens, log it.
[ "When", "making", "the", "request", "if", "an", "error", "happens", "log", "it", "." ]
python
train
silver-castle/mach9
mach9/http.py
https://github.com/silver-castle/mach9/blob/7a623aab3c70d89d36ade6901b6307e115400c5e/mach9/http.py#L202-L231
def get_message(self, transport, http_version: str, method: bytes, url: bytes, headers: List[List[bytes]]) -> Dict[str, Any]: ''' http://channels.readthedocs.io/en/stable/asgi/www.html#request ''' url_obj = parse_url(url) if url_obj.schema is None: ...
[ "def", "get_message", "(", "self", ",", "transport", ",", "http_version", ":", "str", ",", "method", ":", "bytes", ",", "url", ":", "bytes", ",", "headers", ":", "List", "[", "List", "[", "bytes", "]", "]", ")", "->", "Dict", "[", "str", ",", "Any"...
http://channels.readthedocs.io/en/stable/asgi/www.html#request
[ "http", ":", "//", "channels", ".", "readthedocs", ".", "io", "/", "en", "/", "stable", "/", "asgi", "/", "www", ".", "html#request" ]
python
train
pvlib/pvlib-python
pvlib/tracking.py
https://github.com/pvlib/pvlib-python/blob/2e844a595b820b43d1170269781fa66bd0ccc8a3/pvlib/tracking.py#L153-L214
def get_irradiance(self, surface_tilt, surface_azimuth, solar_zenith, solar_azimuth, dni, ghi, dhi, dni_extra=None, airmass=None, model='haydavies', **kwargs): """ Uses the :func:`irradiance.get_total_irradiance` function to ca...
[ "def", "get_irradiance", "(", "self", ",", "surface_tilt", ",", "surface_azimuth", ",", "solar_zenith", ",", "solar_azimuth", ",", "dni", ",", "ghi", ",", "dhi", ",", "dni_extra", "=", "None", ",", "airmass", "=", "None", ",", "model", "=", "'haydavies'", ...
Uses the :func:`irradiance.get_total_irradiance` function to calculate the plane of array irradiance components on a tilted surface defined by the input data and ``self.albedo``. For a given set of solar zenith and azimuth angles, the surface tilt and azimuth parameters are typically de...
[ "Uses", "the", ":", "func", ":", "irradiance", ".", "get_total_irradiance", "function", "to", "calculate", "the", "plane", "of", "array", "irradiance", "components", "on", "a", "tilted", "surface", "defined", "by", "the", "input", "data", "and", "self", ".", ...
python
train
rdussurget/py-altimetry
altimetry/tools/interp_tools.py
https://github.com/rdussurget/py-altimetry/blob/57ce7f2d63c6bbc4993821af0bbe46929e3a2d98/altimetry/tools/interp_tools.py#L59-L85
def extrap1d(Z,mask): """ EXTRAP1D : Extrapolate values from a 1D vector at its beginning and end using reversal of this array @note : gaps in vector Z should be filled first as values from the vector are replicated out of edges @note : if isinstance(Z,np.ma.masked_array) : mask = Z.mask ...
[ "def", "extrap1d", "(", "Z", ",", "mask", ")", ":", "Zout", "=", "Z", ".", "copy", "(", ")", "N", "=", "len", "(", "Zout", ")", "ind", "=", "np", ".", "arange", "(", "N", ")", "xout", "=", "ind", "[", "mask", "]", "hist", "=", "(", "~", "...
EXTRAP1D : Extrapolate values from a 1D vector at its beginning and end using reversal of this array @note : gaps in vector Z should be filled first as values from the vector are replicated out of edges @note : if isinstance(Z,np.ma.masked_array) : mask = Z.mask @param Z: 1D vector to extrapo...
[ "EXTRAP1D", ":", "Extrapolate", "values", "from", "a", "1D", "vector", "at", "its", "beginning", "and", "end", "using", "reversal", "of", "this", "array" ]
python
train
bjmorgan/lattice_mc
lattice_mc/simulation.py
https://github.com/bjmorgan/lattice_mc/blob/7fa7be85f2f23a2d8dfd0830ecdb89d0dbf2bfd5/lattice_mc/simulation.py#L152-L179
def run( self, for_time=None ): """ Run the simulation. Args: for_time (:obj:Float, optional): If `for_time` is set, then run the simulation until a set amount of time has passed. Otherwise, run the simulation for a set number of jumps. Defaults to None. Returns: ...
[ "def", "run", "(", "self", ",", "for_time", "=", "None", ")", ":", "self", ".", "for_time", "=", "for_time", "try", ":", "self", ".", "is_initialised", "(", ")", "except", "AttributeError", ":", "raise", "if", "self", ".", "number_of_equilibration_jumps", ...
Run the simulation. Args: for_time (:obj:Float, optional): If `for_time` is set, then run the simulation until a set amount of time has passed. Otherwise, run the simulation for a set number of jumps. Defaults to None. Returns: None
[ "Run", "the", "simulation", "." ]
python
train
orb-framework/orb
orb/core/column_types/reference.py
https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column_types/reference.py#L146-L155
def referenceModel(self): """ Returns the model that this column references. :return <Table> || None """ model = orb.system.model(self.__reference) if not model: raise orb.errors.ModelNotFound(schema=self.__reference) return model
[ "def", "referenceModel", "(", "self", ")", ":", "model", "=", "orb", ".", "system", ".", "model", "(", "self", ".", "__reference", ")", "if", "not", "model", ":", "raise", "orb", ".", "errors", ".", "ModelNotFound", "(", "schema", "=", "self", ".", "...
Returns the model that this column references. :return <Table> || None
[ "Returns", "the", "model", "that", "this", "column", "references", "." ]
python
train
census-instrumentation/opencensus-python
contrib/opencensus-ext-jaeger/opencensus/ext/jaeger/trace_exporter/__init__.py
https://github.com/census-instrumentation/opencensus-python/blob/992b223f7e34c5dcb65922b7d5c827e7a1351e7d/contrib/opencensus-ext-jaeger/opencensus/ext/jaeger/trace_exporter/__init__.py#L238-L244
def _convert_reftype_to_jaeger_reftype(ref): """Convert opencensus reference types to jaeger reference types.""" if ref == link_module.Type.CHILD_LINKED_SPAN: return jaeger.SpanRefType.CHILD_OF if ref == link_module.Type.PARENT_LINKED_SPAN: return jaeger.SpanRefType.FOLLOWS_FROM return N...
[ "def", "_convert_reftype_to_jaeger_reftype", "(", "ref", ")", ":", "if", "ref", "==", "link_module", ".", "Type", ".", "CHILD_LINKED_SPAN", ":", "return", "jaeger", ".", "SpanRefType", ".", "CHILD_OF", "if", "ref", "==", "link_module", ".", "Type", ".", "PAREN...
Convert opencensus reference types to jaeger reference types.
[ "Convert", "opencensus", "reference", "types", "to", "jaeger", "reference", "types", "." ]
python
train
resonai/ybt
setup.py
https://github.com/resonai/ybt/blob/5b40df0922ef3383eb85f2b04a26a2db4b81b3fd/setup.py#L16-L20
def get_readme(): """Read and return the content of the project README file.""" base_dir = path.abspath(path.dirname(__file__)) with open(path.join(base_dir, 'README.md'), encoding='utf-8') as readme_f: return readme_f.read()
[ "def", "get_readme", "(", ")", ":", "base_dir", "=", "path", ".", "abspath", "(", "path", ".", "dirname", "(", "__file__", ")", ")", "with", "open", "(", "path", ".", "join", "(", "base_dir", ",", "'README.md'", ")", ",", "encoding", "=", "'utf-8'", ...
Read and return the content of the project README file.
[ "Read", "and", "return", "the", "content", "of", "the", "project", "README", "file", "." ]
python
train
etingof/pysmi
pysmi/parser/smi.py
https://github.com/etingof/pysmi/blob/379a0a384c81875731be51a054bdacced6260fd8/pysmi/parser/smi.py#L759-L766
def p_BitNames(self, p): """BitNames : BitNames ',' LOWERCASE_IDENTIFIER | LOWERCASE_IDENTIFIER""" n = len(p) if n == 4: p[0] = ('BitNames', p[1][1] + [p[3]]) elif n == 2: p[0] = ('BitNames', [p[1]])
[ "def", "p_BitNames", "(", "self", ",", "p", ")", ":", "n", "=", "len", "(", "p", ")", "if", "n", "==", "4", ":", "p", "[", "0", "]", "=", "(", "'BitNames'", ",", "p", "[", "1", "]", "[", "1", "]", "+", "[", "p", "[", "3", "]", "]", ")...
BitNames : BitNames ',' LOWERCASE_IDENTIFIER | LOWERCASE_IDENTIFIER
[ "BitNames", ":", "BitNames", "LOWERCASE_IDENTIFIER", "|", "LOWERCASE_IDENTIFIER" ]
python
valid
xtrementl/focus
focus/plugin/modules/im.py
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/modules/im.py#L216-L244
def _linux_skype_status(status, message): """ Updates status and message for Skype IM application on Linux. `status` Status type. `message` Status message. """ try: iface = _dbus_get_interface('com.Skype.API', '/com/Sk...
[ "def", "_linux_skype_status", "(", "status", ",", "message", ")", ":", "try", ":", "iface", "=", "_dbus_get_interface", "(", "'com.Skype.API'", ",", "'/com/Skype'", ",", "'com.Skype.API'", ")", "if", "iface", ":", "# authenticate", "if", "iface", ".", "Invoke", ...
Updates status and message for Skype IM application on Linux. `status` Status type. `message` Status message.
[ "Updates", "status", "and", "message", "for", "Skype", "IM", "application", "on", "Linux", "." ]
python
train
fastai/fastai
fastai/data_block.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/data_block.py#L149-L152
def filter_by_func(self, func:Callable)->'ItemList': "Only keep elements for which `func` returns `True`." self.items = array([o for o in self.items if func(o)]) return self
[ "def", "filter_by_func", "(", "self", ",", "func", ":", "Callable", ")", "->", "'ItemList'", ":", "self", ".", "items", "=", "array", "(", "[", "o", "for", "o", "in", "self", ".", "items", "if", "func", "(", "o", ")", "]", ")", "return", "self" ]
Only keep elements for which `func` returns `True`.
[ "Only", "keep", "elements", "for", "which", "func", "returns", "True", "." ]
python
train
PyCQA/pylint
setup.py
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/setup.py#L142-L184
def install(**kwargs): """setup entry point""" if USE_SETUPTOOLS: if "--force-manifest" in sys.argv: sys.argv.remove("--force-manifest") packages = [modname] + get_packages(join(base_dir, "pylint"), modname) if USE_SETUPTOOLS: if install_requires: kwargs["install_...
[ "def", "install", "(", "*", "*", "kwargs", ")", ":", "if", "USE_SETUPTOOLS", ":", "if", "\"--force-manifest\"", "in", "sys", ".", "argv", ":", "sys", ".", "argv", ".", "remove", "(", "\"--force-manifest\"", ")", "packages", "=", "[", "modname", "]", "+",...
setup entry point
[ "setup", "entry", "point" ]
python
test
angr/angr
angr/keyed_region.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/keyed_region.py#L238-L248
def add_object(self, start, obj, object_size): """ Add/Store an object to this region at the given offset. :param start: :param obj: :param int object_size: Size of the object :return: """ self._store(start, obj, object_size, overwrite=False)
[ "def", "add_object", "(", "self", ",", "start", ",", "obj", ",", "object_size", ")", ":", "self", ".", "_store", "(", "start", ",", "obj", ",", "object_size", ",", "overwrite", "=", "False", ")" ]
Add/Store an object to this region at the given offset. :param start: :param obj: :param int object_size: Size of the object :return:
[ "Add", "/", "Store", "an", "object", "to", "this", "region", "at", "the", "given", "offset", "." ]
python
train
bspaans/python-mingus
mingus/midi/midi_track.py
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_track.py#L157-L166
def header(self): """Return the bytes for the header of track. The header contains the length of the track_data, so you'll have to call this function when you're done adding data (when you're not using get_midi_data). """ chunk_size = a2b_hex('%08x' % (len(self.track_dat...
[ "def", "header", "(", "self", ")", ":", "chunk_size", "=", "a2b_hex", "(", "'%08x'", "%", "(", "len", "(", "self", ".", "track_data", ")", "+", "len", "(", "self", ".", "end_of_track", "(", ")", ")", ")", ")", "return", "TRACK_HEADER", "+", "chunk_si...
Return the bytes for the header of track. The header contains the length of the track_data, so you'll have to call this function when you're done adding data (when you're not using get_midi_data).
[ "Return", "the", "bytes", "for", "the", "header", "of", "track", "." ]
python
train
horazont/aioxmpp
aioxmpp/entitycaps/caps390.py
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/entitycaps/caps390.py#L103-L121
def _process_extensions(exts): """ Generate the `Extensions String` from an iterable of data forms. :param exts: The data forms to generate the extensions string from. :type exts: :class:`~collections.abc.Iterable` of :class:`~.forms.xso.Data` :return: The `Extensions String` :rtype: :c...
[ "def", "_process_extensions", "(", "exts", ")", ":", "parts", "=", "[", "_process_form", "(", "form", ")", "for", "form", "in", "exts", "]", "parts", ".", "sort", "(", ")", "return", "b\"\"", ".", "join", "(", "parts", ")", "+", "b\"\\x1c\"" ]
Generate the `Extensions String` from an iterable of data forms. :param exts: The data forms to generate the extensions string from. :type exts: :class:`~collections.abc.Iterable` of :class:`~.forms.xso.Data` :return: The `Extensions String` :rtype: :class:`bytes` Generate the `Extensions ...
[ "Generate", "the", "Extensions", "String", "from", "an", "iterable", "of", "data", "forms", "." ]
python
train
ldomic/lintools
lintools/analysis/hbonds.py
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/hbonds.py#L153-L195
def determine_hbonds_for_drawing(self, analysis_cutoff): """ Since plotting all hydrogen bonds could lead to a messy plot, a cutoff has to be imple- mented. In this function the frequency of each hydrogen bond is summated and the total compared against analysis cutoff - a fraction multip...
[ "def", "determine_hbonds_for_drawing", "(", "self", ",", "analysis_cutoff", ")", ":", "self", ".", "frequency", "=", "defaultdict", "(", "int", ")", "for", "traj", "in", "self", ".", "hbonds_by_type", ":", "for", "bond", "in", "self", ".", "hbonds_by_type", ...
Since plotting all hydrogen bonds could lead to a messy plot, a cutoff has to be imple- mented. In this function the frequency of each hydrogen bond is summated and the total compared against analysis cutoff - a fraction multiplied by trajectory count. Those hydrogen bonds that are present for l...
[ "Since", "plotting", "all", "hydrogen", "bonds", "could", "lead", "to", "a", "messy", "plot", "a", "cutoff", "has", "to", "be", "imple", "-", "mented", ".", "In", "this", "function", "the", "frequency", "of", "each", "hydrogen", "bond", "is", "summated", ...
python
train
nicolargo/glances
glances/stats_server.py
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/stats_server.py#L41-L49
def update(self, input_stats=None): """Update the stats.""" input_stats = input_stats or {} # Force update of all the stats super(GlancesStatsServer, self).update() # Build all_stats variable (concatenation of all the stats) self.all_stats = self._set_stats(input_stats)
[ "def", "update", "(", "self", ",", "input_stats", "=", "None", ")", ":", "input_stats", "=", "input_stats", "or", "{", "}", "# Force update of all the stats", "super", "(", "GlancesStatsServer", ",", "self", ")", ".", "update", "(", ")", "# Build all_stats varia...
Update the stats.
[ "Update", "the", "stats", "." ]
python
train
saltstack/salt
salt/modules/boto_apigateway.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_apigateway.py#L1273-L1295
def delete_api_integration_response(restApiId, resourcePath, httpMethod, statusCode, region=None, key=None, keyid=None, profile=None): ''' Deletes an integration response for a given method in a given API CLI Example: .. code-block:: bash salt myminion boto...
[ "def", "delete_api_integration_response", "(", "restApiId", ",", "resourcePath", ",", "httpMethod", ",", "statusCode", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "try", ":", "resou...
Deletes an integration response for a given method in a given API CLI Example: .. code-block:: bash salt myminion boto_apigateway.delete_api_integration_response restApiId resourcePath httpMethod statusCode
[ "Deletes", "an", "integration", "response", "for", "a", "given", "method", "in", "a", "given", "API" ]
python
train
CRS-support/ftw
ftw/http.py
https://github.com/CRS-support/ftw/blob/1bbfd9b702e7e65532c1fd52bc82960556cefae5/ftw/http.py#L260-L282
def build_socket(self): """ Generate either an HTTPS or HTTP socket """ try: self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.settimeout(self.SOCKET_TIMEOUT) self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) ...
[ "def", "build_socket", "(", "self", ")", ":", "try", ":", "self", ".", "sock", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_STREAM", ")", "self", ".", "sock", ".", "settimeout", "(", "self", ".", "SOCKET_TIMEOU...
Generate either an HTTPS or HTTP socket
[ "Generate", "either", "an", "HTTPS", "or", "HTTP", "socket" ]
python
train
learningequality/ricecooker
ricecooker/classes/questions.py
https://github.com/learningequality/ricecooker/blob/2f0385282500cb77ef2894646c6f9ce11bd7a853/ricecooker/classes/questions.py#L136-L154
def parse_html(self, text): """ parse_html: Properly formats any img tags that might be in content Args: text (str): text to parse Returns: string with properly formatted images """ bs = BeautifulSoup(text, "html5lib") file_reg = re.compile(MARKDOW...
[ "def", "parse_html", "(", "self", ",", "text", ")", ":", "bs", "=", "BeautifulSoup", "(", "text", ",", "\"html5lib\"", ")", "file_reg", "=", "re", ".", "compile", "(", "MARKDOWN_IMAGE_REGEX", ",", "flags", "=", "re", ".", "IGNORECASE", ")", "tags", "=", ...
parse_html: Properly formats any img tags that might be in content Args: text (str): text to parse Returns: string with properly formatted images
[ "parse_html", ":", "Properly", "formats", "any", "img", "tags", "that", "might", "be", "in", "content", "Args", ":", "text", "(", "str", ")", ":", "text", "to", "parse", "Returns", ":", "string", "with", "properly", "formatted", "images" ]
python
train
yyuu/botornado
boto/ec2/autoscale/__init__.py
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/ec2/autoscale/__init__.py#L643-L667
def get_all_tags(self, filters=None, max_records=None, next_token=None): """ Lists the Auto Scaling group tags. This action supports pagination by returning a token if there are more pages to retrieve. To get the next page, call this action again with the returned token as t...
[ "def", "get_all_tags", "(", "self", ",", "filters", "=", "None", ",", "max_records", "=", "None", ",", "next_token", "=", "None", ")", ":", "params", "=", "{", "}", "if", "max_records", ":", "params", "[", "'MaxRecords'", "]", "=", "max_records", "if", ...
Lists the Auto Scaling group tags. This action supports pagination by returning a token if there are more pages to retrieve. To get the next page, call this action again with the returned token as the NextToken parameter. :type filters: dict :param filters: The value of the...
[ "Lists", "the", "Auto", "Scaling", "group", "tags", "." ]
python
train
Qiskit/qiskit-terra
qiskit/quantum_info/operators/pauli.py
https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/pauli.py#L273-L295
def to_spmatrix(self): r""" Convert Pauli to a sparse matrix representation (CSR format). Order is q_{n-1} .... q_0, i.e., $P_{n-1} \otimes ... P_0$ Returns: scipy.sparse.csr_matrix: a sparse matrix with CSR format that represnets the pauli. """ ...
[ "def", "to_spmatrix", "(", "self", ")", ":", "mat", "=", "sparse", ".", "coo_matrix", "(", "1", ")", "for", "z", ",", "x", "in", "zip", "(", "self", ".", "_z", ",", "self", ".", "_x", ")", ":", "if", "not", "z", "and", "not", "x", ":", "# I",...
r""" Convert Pauli to a sparse matrix representation (CSR format). Order is q_{n-1} .... q_0, i.e., $P_{n-1} \otimes ... P_0$ Returns: scipy.sparse.csr_matrix: a sparse matrix with CSR format that represnets the pauli.
[ "r", "Convert", "Pauli", "to", "a", "sparse", "matrix", "representation", "(", "CSR", "format", ")", "." ]
python
test
inveniosoftware/invenio-oaiserver
invenio_oaiserver/percolator.py
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/percolator.py#L118-L142
def get_record_sets(record): """Find matching sets.""" # get lists of sets with search_pattern equals to None but already in the # set list inside the record record_sets = set(record.get('_oai', {}).get('sets', [])) for spec in _build_cache(): if spec in record_sets: yield spec ...
[ "def", "get_record_sets", "(", "record", ")", ":", "# get lists of sets with search_pattern equals to None but already in the", "# set list inside the record", "record_sets", "=", "set", "(", "record", ".", "get", "(", "'_oai'", ",", "{", "}", ")", ".", "get", "(", "'...
Find matching sets.
[ "Find", "matching", "sets", "." ]
python
train
StaticCube/python-synology
SynologyDSM/SynologyDSM.py
https://github.com/StaticCube/python-synology/blob/a5446a052fc91a38f7589803dc7a654180db2566/SynologyDSM/SynologyDSM.py#L322-L327
def _get_disk(self, disk_id): """Returns a specific disk""" if self._data is not None: for disk in self._data["disks"]: if disk["id"] == disk_id: return disk
[ "def", "_get_disk", "(", "self", ",", "disk_id", ")", ":", "if", "self", ".", "_data", "is", "not", "None", ":", "for", "disk", "in", "self", ".", "_data", "[", "\"disks\"", "]", ":", "if", "disk", "[", "\"id\"", "]", "==", "disk_id", ":", "return"...
Returns a specific disk
[ "Returns", "a", "specific", "disk" ]
python
test
fumitoh/modelx
modelx/core/spacecontainer.py
https://github.com/fumitoh/modelx/blob/0180da34d052c44fb94dab9e115e218bbebfc9c3/modelx/core/spacecontainer.py#L41-L52
def cur_space(self, name=None): """Set the current space to Space ``name`` and return it. If called without arguments, the current space is returned. Otherwise, the current space is set to the space named ``name`` and the space is returned. """ if name is None: ...
[ "def", "cur_space", "(", "self", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "return", "self", ".", "_impl", ".", "model", ".", "currentspace", ".", "interface", "else", ":", "self", ".", "_impl", ".", "model", ".", "currents...
Set the current space to Space ``name`` and return it. If called without arguments, the current space is returned. Otherwise, the current space is set to the space named ``name`` and the space is returned.
[ "Set", "the", "current", "space", "to", "Space", "name", "and", "return", "it", "." ]
python
valid
gwastro/pycbc
pycbc/workflow/splittable.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/workflow/splittable.py#L121-L175
def setup_splittable_dax_generated(workflow, input_tables, out_dir, tags): ''' Function for setting up the splitting jobs as part of the workflow. Parameters ----------- workflow : pycbc.workflow.core.Workflow The Workflow instance that the jobs will be added to. input_tables : pycbc.wo...
[ "def", "setup_splittable_dax_generated", "(", "workflow", ",", "input_tables", ",", "out_dir", ",", "tags", ")", ":", "cp", "=", "workflow", ".", "cp", "# Get values from ini file", "try", ":", "num_splits", "=", "cp", ".", "get_opt_tags", "(", "\"workflow-splitta...
Function for setting up the splitting jobs as part of the workflow. Parameters ----------- workflow : pycbc.workflow.core.Workflow The Workflow instance that the jobs will be added to. input_tables : pycbc.workflow.core.FileList The input files to be split up. out_dir : path ...
[ "Function", "for", "setting", "up", "the", "splitting", "jobs", "as", "part", "of", "the", "workflow", "." ]
python
train
softlayer/softlayer-python
SoftLayer/CLI/virt/detail.py
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/detail.py#L24-L145
def cli(env, identifier, passwords=False, price=False): """Get details for a virtual server.""" vsi = SoftLayer.VSManager(env.client) table = formatting.KeyValueTable(['name', 'value']) table.align['name'] = 'r' table.align['value'] = 'l' vs_id = helpers.resolve_id(vsi.resolve_ids, identifier,...
[ "def", "cli", "(", "env", ",", "identifier", ",", "passwords", "=", "False", ",", "price", "=", "False", ")", ":", "vsi", "=", "SoftLayer", ".", "VSManager", "(", "env", ".", "client", ")", "table", "=", "formatting", ".", "KeyValueTable", "(", "[", ...
Get details for a virtual server.
[ "Get", "details", "for", "a", "virtual", "server", "." ]
python
train
awslabs/aws-sam-cli
samcli/commands/init/__init__.py
https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/init/__init__.py#L30-L76
def cli(ctx, location, runtime, dependency_manager, output_dir, name, no_input): """ \b Initialize a serverless application with a SAM template, folder structure for your Lambda functions, connected to an event source such as APIs, S3 Buckets or DynamoDB Tables. This application includes eve...
[ "def", "cli", "(", "ctx", ",", "location", ",", "runtime", ",", "dependency_manager", ",", "output_dir", ",", "name", ",", "no_input", ")", ":", "# All logic must be implemented in the `do_cli` method. This helps ease unit tests", "do_cli", "(", "ctx", ",", "location", ...
\b Initialize a serverless application with a SAM template, folder structure for your Lambda functions, connected to an event source such as APIs, S3 Buckets or DynamoDB Tables. This application includes everything you need to get started with serverless and eventually grow into a produc...
[ "\\", "b", "Initialize", "a", "serverless", "application", "with", "a", "SAM", "template", "folder", "structure", "for", "your", "Lambda", "functions", "connected", "to", "an", "event", "source", "such", "as", "APIs", "S3", "Buckets", "or", "DynamoDB", "Tables...
python
train
UDST/urbansim
urbansim/models/transition.py
https://github.com/UDST/urbansim/blob/79f815a6503e109f50be270cee92d0f4a34f49ef/urbansim/models/transition.py#L261-L335
def transition(self, data, year): """ Add or remove rows to/from a table according to the prescribed growth rate for this model and year. Parameters ---------- data : pandas.DataFrame Rows will be removed from or added to this table. year : None, opti...
[ "def", "transition", "(", "self", ",", "data", ",", "year", ")", ":", "logger", ".", "debug", "(", "'start: tabular transition'", ")", "if", "year", "not", "in", "self", ".", "_config_table", ".", "index", ":", "raise", "ValueError", "(", "'No targets for gi...
Add or remove rows to/from a table according to the prescribed growth rate for this model and year. Parameters ---------- data : pandas.DataFrame Rows will be removed from or added to this table. year : None, optional Here for compatibility with other tra...
[ "Add", "or", "remove", "rows", "to", "/", "from", "a", "table", "according", "to", "the", "prescribed", "growth", "rate", "for", "this", "model", "and", "year", "." ]
python
train
rupertford/melody
examples/PSyclone/psyclone.py
https://github.com/rupertford/melody/blob/d50459880a87fdd1802c6893f6e12b52d51b3b91/examples/PSyclone/psyclone.py#L129-L155
def options(self, my_psy): '''Returns all potential loop fusion options for the psy object provided''' # compute options dynamically here as they may depend on previous # changes to the psy tree my_options = [] invokes = my_psy.invokes.invoke_list #print "there ar...
[ "def", "options", "(", "self", ",", "my_psy", ")", ":", "# compute options dynamically here as they may depend on previous", "# changes to the psy tree", "my_options", "=", "[", "]", "invokes", "=", "my_psy", ".", "invokes", ".", "invoke_list", "#print \"there are {0} invok...
Returns all potential loop fusion options for the psy object provided
[ "Returns", "all", "potential", "loop", "fusion", "options", "for", "the", "psy", "object", "provided" ]
python
test
singularityhub/sregistry-cli
sregistry/main/hub/query.py
https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/hub/query.py#L20-L38
def search(self, query=None, **kwargs): '''query a Singularity registry for a list of images. If query is None, collections are listed. EXAMPLE QUERIES: [empty] list all collections in singularity hub vsoch do a general search for collection "vsoch" vsoch/dinosaur ...
[ "def", "search", "(", "self", ",", "query", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "query", "is", "not", "None", ":", "return", "self", ".", "_search_collection", "(", "query", ")", "# Search collections across all fields", "return", "self", ...
query a Singularity registry for a list of images. If query is None, collections are listed. EXAMPLE QUERIES: [empty] list all collections in singularity hub vsoch do a general search for collection "vsoch" vsoch/dinosaur list details of container vsoch/dinosaur ...
[ "query", "a", "Singularity", "registry", "for", "a", "list", "of", "images", ".", "If", "query", "is", "None", "collections", "are", "listed", "." ]
python
test
mnick/scikit-tensor
sktensor/core.py
https://github.com/mnick/scikit-tensor/blob/fe517e9661a08164b8d30d2dddf7c96aeeabcf36/sktensor/core.py#L297-L306
def flipsign(U): """ Flip sign of factor matrices such that largest magnitude element will be positive """ midx = abs(U).argmax(axis=0) for i in range(U.shape[1]): if U[midx[i], i] < 0: U[:, i] = -U[:, i] return U
[ "def", "flipsign", "(", "U", ")", ":", "midx", "=", "abs", "(", "U", ")", ".", "argmax", "(", "axis", "=", "0", ")", "for", "i", "in", "range", "(", "U", ".", "shape", "[", "1", "]", ")", ":", "if", "U", "[", "midx", "[", "i", "]", ",", ...
Flip sign of factor matrices such that largest magnitude element will be positive
[ "Flip", "sign", "of", "factor", "matrices", "such", "that", "largest", "magnitude", "element", "will", "be", "positive" ]
python
train
AnthonyBloomer/daftlistings
daftlistings/listing.py
https://github.com/AnthonyBloomer/daftlistings/blob/f6c1b52425bc740f443b5efe6632a4bf18ee997f/daftlistings/listing.py#L104-L118
def price_change(self): """ This method returns any price change. :return: """ try: if self._data_from_search: return self._data_from_search.find('div', {'class': 'price-changes-sr'}).text else: return self._ad_page_content....
[ "def", "price_change", "(", "self", ")", ":", "try", ":", "if", "self", ".", "_data_from_search", ":", "return", "self", ".", "_data_from_search", ".", "find", "(", "'div'", ",", "{", "'class'", ":", "'price-changes-sr'", "}", ")", ".", "text", "else", "...
This method returns any price change. :return:
[ "This", "method", "returns", "any", "price", "change", ".", ":", "return", ":" ]
python
train
cackharot/suds-py3
suds/store.py
https://github.com/cackharot/suds-py3/blob/7387ec7806e9be29aad0a711bea5cb3c9396469c/suds/store.py#L554-L566
def open(self, url): """ Open a document at the specified url. @param url: A document URL. @type url: str @return: A file pointer to the document. @rtype: StringIO """ protocol, location = self.split(url) if protocol == self.protocol: r...
[ "def", "open", "(", "self", ",", "url", ")", ":", "protocol", ",", "location", "=", "self", ".", "split", "(", "url", ")", "if", "protocol", "==", "self", ".", "protocol", ":", "return", "self", ".", "find", "(", "location", ")", "else", ":", "retu...
Open a document at the specified url. @param url: A document URL. @type url: str @return: A file pointer to the document. @rtype: StringIO
[ "Open", "a", "document", "at", "the", "specified", "url", "." ]
python
train
pywbem/pywbem
pywbem/tupleparse.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/tupleparse.py#L1839-L1847
def parse_expmethodresponse(self, tup_tree): # pylint: disable=unused-argument """ This function not implemented. """ raise CIMXMLParseError( _format("Internal Error: Parsing support for element {0!A} is not " "implemented", name(tup_tree)), ...
[ "def", "parse_expmethodresponse", "(", "self", ",", "tup_tree", ")", ":", "# pylint: disable=unused-argument", "raise", "CIMXMLParseError", "(", "_format", "(", "\"Internal Error: Parsing support for element {0!A} is not \"", "\"implemented\"", ",", "name", "(", "tup_tree", "...
This function not implemented.
[ "This", "function", "not", "implemented", "." ]
python
train
hovren/crisp
crisp/calibration.py
https://github.com/hovren/crisp/blob/65cae19e7cfae5a397859096c9ef666e0f4e7f1b/crisp/calibration.py#L160-L165
def parameter(self): """Return the current best value of a parameter""" D = {} for source in PARAM_SOURCE_ORDER: D.update(self.params[source]) return D
[ "def", "parameter", "(", "self", ")", ":", "D", "=", "{", "}", "for", "source", "in", "PARAM_SOURCE_ORDER", ":", "D", ".", "update", "(", "self", ".", "params", "[", "source", "]", ")", "return", "D" ]
Return the current best value of a parameter
[ "Return", "the", "current", "best", "value", "of", "a", "parameter" ]
python
train
pebble/libpebble2
libpebble2/communication/__init__.py
https://github.com/pebble/libpebble2/blob/23e2eb92cfc084e6f9e8c718711ac994ef606d18/libpebble2/communication/__init__.py#L79-L92
def run_sync(self): """ Runs the message loop until the Pebble disconnects. This method will block until the watch disconnects or a fatal error occurs. For alternatives that don't block forever, see :meth:`pump_reader` and :meth:`run_async`. """ while self.connected: ...
[ "def", "run_sync", "(", "self", ")", ":", "while", "self", ".", "connected", ":", "try", ":", "self", ".", "pump_reader", "(", ")", "except", "PacketDecodeError", "as", "e", ":", "logger", ".", "warning", "(", "\"Packet decode failed: %s\"", ",", "e", ")",...
Runs the message loop until the Pebble disconnects. This method will block until the watch disconnects or a fatal error occurs. For alternatives that don't block forever, see :meth:`pump_reader` and :meth:`run_async`.
[ "Runs", "the", "message", "loop", "until", "the", "Pebble", "disconnects", ".", "This", "method", "will", "block", "until", "the", "watch", "disconnects", "or", "a", "fatal", "error", "occurs", "." ]
python
train
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L6035-L6039
def htmlDocContentDumpFormatOutput(self, cur, encoding, format): """Dump an HTML document. """ if cur is None: cur__o = None else: cur__o = cur._o libxml2mod.htmlDocContentDumpFormatOutput(self._o, cur__o, encoding, format)
[ "def", "htmlDocContentDumpFormatOutput", "(", "self", ",", "cur", ",", "encoding", ",", "format", ")", ":", "if", "cur", "is", "None", ":", "cur__o", "=", "None", "else", ":", "cur__o", "=", "cur", ".", "_o", "libxml2mod", ".", "htmlDocContentDumpFormatOutpu...
Dump an HTML document.
[ "Dump", "an", "HTML", "document", "." ]
python
train
zagaran/mongobackup
mongobackup/backups.py
https://github.com/zagaran/mongobackup/blob/d090d0cca44ecd066974c4de80edca5f26b7eeea/mongobackup/backups.py#L37-L94
def backup(mongo_username, mongo_password, local_backup_directory_path, database=None, attached_directory_path=None, custom_prefix="backup", mongo_backup_directory_path="/tmp/mongo_dump", s3_bucket=None, s3_access_key_id=None, s3_secret_key=None, purge_local=None, purge_a...
[ "def", "backup", "(", "mongo_username", ",", "mongo_password", ",", "local_backup_directory_path", ",", "database", "=", "None", ",", "attached_directory_path", "=", "None", ",", "custom_prefix", "=", "\"backup\"", ",", "mongo_backup_directory_path", "=", "\"/tmp/mongo_...
Runs a backup operation to At Least a local directory. You must provide mongodb credentials along with a a directory for a dump operation and a directory to contain your compressed backup. backup_prefix: optionally provide a prefix to be prepended to your backups, by default the pr...
[ "Runs", "a", "backup", "operation", "to", "At", "Least", "a", "local", "directory", ".", "You", "must", "provide", "mongodb", "credentials", "along", "with", "a", "a", "directory", "for", "a", "dump", "operation", "and", "a", "directory", "to", "contain", ...
python
train
twilio/twilio-python
twilio/rest/serverless/v1/service/__init__.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/serverless/v1/service/__init__.py#L122-L145
def create(self, unique_name, friendly_name, include_credentials=values.unset): """ Create a new ServiceInstance :param unicode unique_name: The unique_name :param unicode friendly_name: The friendly_name :param bool include_credentials: The include_credentials :returns...
[ "def", "create", "(", "self", ",", "unique_name", ",", "friendly_name", ",", "include_credentials", "=", "values", ".", "unset", ")", ":", "data", "=", "values", ".", "of", "(", "{", "'UniqueName'", ":", "unique_name", ",", "'FriendlyName'", ":", "friendly_n...
Create a new ServiceInstance :param unicode unique_name: The unique_name :param unicode friendly_name: The friendly_name :param bool include_credentials: The include_credentials :returns: Newly created ServiceInstance :rtype: twilio.rest.serverless.v1.service.ServiceInstance
[ "Create", "a", "new", "ServiceInstance" ]
python
train
mwickert/scikit-dsp-comm
sk_dsp_comm/pyaudio_helper.py
https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/pyaudio_helper.py#L291-L298
def DSP_callback_toc(self): """ Add new toc time to the DSP_toc list. Will not be called if Tcapture = 0. """ if self.Tcapture > 0: self.DSP_toc.append(time.time()-self.start_time)
[ "def", "DSP_callback_toc", "(", "self", ")", ":", "if", "self", ".", "Tcapture", ">", "0", ":", "self", ".", "DSP_toc", ".", "append", "(", "time", ".", "time", "(", ")", "-", "self", ".", "start_time", ")" ]
Add new toc time to the DSP_toc list. Will not be called if Tcapture = 0.
[ "Add", "new", "toc", "time", "to", "the", "DSP_toc", "list", ".", "Will", "not", "be", "called", "if", "Tcapture", "=", "0", "." ]
python
valid
planetarypy/pvl
pvl/decoder.py
https://github.com/planetarypy/pvl/blob/ed92b284c4208439b033d28c9c176534c0faac0e/pvl/decoder.py#L489-L505
def parse_value(self, stream): """ Value ::= (SimpleValue | Set | Sequence) WSC UnitsExpression? """ if self.has_sequence(stream): value = self.parse_sequence(stream) elif self.has_set(stream): value = self.parse_set(stream) else: value...
[ "def", "parse_value", "(", "self", ",", "stream", ")", ":", "if", "self", ".", "has_sequence", "(", "stream", ")", ":", "value", "=", "self", ".", "parse_sequence", "(", "stream", ")", "elif", "self", ".", "has_set", "(", "stream", ")", ":", "value", ...
Value ::= (SimpleValue | Set | Sequence) WSC UnitsExpression?
[ "Value", "::", "=", "(", "SimpleValue", "|", "Set", "|", "Sequence", ")", "WSC", "UnitsExpression?" ]
python
train
zetaops/zengine
zengine/views/channel_management.py
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/views/channel_management.py#L195-L218
def move_complete_channel(self): """ Channels and theirs subscribers are moved completely to new channel or existing channel. """ to_channel = Channel.objects.get(self.current.task_data['target_channel_key']) chosen_channels = self.current.task_data['chosen_channels'] ...
[ "def", "move_complete_channel", "(", "self", ")", ":", "to_channel", "=", "Channel", ".", "objects", ".", "get", "(", "self", ".", "current", ".", "task_data", "[", "'target_channel_key'", "]", ")", "chosen_channels", "=", "self", ".", "current", ".", "task_...
Channels and theirs subscribers are moved completely to new channel or existing channel.
[ "Channels", "and", "theirs", "subscribers", "are", "moved", "completely", "to", "new", "channel", "or", "existing", "channel", "." ]
python
train
raff/dynash
dynash/dynash.py
https://github.com/raff/dynash/blob/a2b4fab67dd85ceaa9c1bb7604ebc1768a7fc28e/dynash/dynash.py#L317-L354
def do_describe(self, line): "describe [-c] {tablename}..." args = self.getargs(line) if '-c' in args: create_info = True args.remove('-c') else: create_info = False if not args: if self.table: args = [self.table.n...
[ "def", "do_describe", "(", "self", ",", "line", ")", ":", "args", "=", "self", ".", "getargs", "(", "line", ")", "if", "'-c'", "in", "args", ":", "create_info", "=", "True", "args", ".", "remove", "(", "'-c'", ")", "else", ":", "create_info", "=", ...
describe [-c] {tablename}...
[ "describe", "[", "-", "c", "]", "{", "tablename", "}", "..." ]
python
train
dropbox/stone
stone/backends/python_rsrc/stone_validators.py
https://github.com/dropbox/stone/blob/2e95cbcd1c48e05cca68c919fd8d24adec6b0f58/stone/backends/python_rsrc/stone_validators.py#L462-L470
def validate_with_permissions(self, val, caller_permissions): """ For a val to pass validation, val must be of the correct type and have all required permissioned fields present. Should only be called for callers with extra permissions. """ self.validate(val) self...
[ "def", "validate_with_permissions", "(", "self", ",", "val", ",", "caller_permissions", ")", ":", "self", ".", "validate", "(", "val", ")", "self", ".", "validate_fields_only_with_permissions", "(", "val", ",", "caller_permissions", ")", "return", "val" ]
For a val to pass validation, val must be of the correct type and have all required permissioned fields present. Should only be called for callers with extra permissions.
[ "For", "a", "val", "to", "pass", "validation", "val", "must", "be", "of", "the", "correct", "type", "and", "have", "all", "required", "permissioned", "fields", "present", ".", "Should", "only", "be", "called", "for", "callers", "with", "extra", "permissions"...
python
train
saltstack/salt
salt/modules/boto_apigateway.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_apigateway.py#L656-L681
def describe_api_deployments(restApiId, region=None, key=None, keyid=None, profile=None): ''' Gets information about the defined API Deployments. Return list of api deployments. CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_deployments restApiId ''' tr...
[ "def", "describe_api_deployments", "(", "restApiId", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "try", ":", "conn", "=", "_get_conn", "(", "region", "=", "region", ",", "key", ...
Gets information about the defined API Deployments. Return list of api deployments. CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_deployments restApiId
[ "Gets", "information", "about", "the", "defined", "API", "Deployments", ".", "Return", "list", "of", "api", "deployments", "." ]
python
train
schul-cloud/resources-api-v1
generators/python_client/schul_cloud_resources_api_v1/schema/__init__.py
https://github.com/schul-cloud/resources-api-v1/blob/58b2d7ba13669fa013ef81c0ffcffbf6b3fdb52d/generators/python_client/schul_cloud_resources_api_v1/schema/__init__.py#L57-L65
def validate(self, object): """Validate an object against the schema. This function just passes if the schema matches the object. If the object does not match the schema, a ValidationException is raised. This error allows debugging. """ resolver=self.get_resolver() ...
[ "def", "validate", "(", "self", ",", "object", ")", ":", "resolver", "=", "self", ".", "get_resolver", "(", ")", "jsonschema", ".", "validate", "(", "object", ",", "self", ".", "get_schema", "(", ")", ",", "resolver", "=", "resolver", ")" ]
Validate an object against the schema. This function just passes if the schema matches the object. If the object does not match the schema, a ValidationException is raised. This error allows debugging.
[ "Validate", "an", "object", "against", "the", "schema", "." ]
python
test
klmitch/framer
framer/framers.py
https://github.com/klmitch/framer/blob/bd34cee9737793dab61d1d8973930b64bd08acb4/framer/framers.py#L302-L334
def to_frame(self, data, state): """ Extract a single frame from the data buffer. The consumed data should be removed from the buffer. If no complete frame can be read, must raise a ``NoFrames`` exception. :param data: A ``bytearray`` instance containing the data so ...
[ "def", "to_frame", "(", "self", ",", "data", ",", "state", ")", ":", "# If we've read all the data, let the caller know", "if", "state", ".", "chunk_remaining", "<=", "0", ":", "raise", "exc", ".", "NoFrames", "(", ")", "# OK, how much data do we send on?", "data_le...
Extract a single frame from the data buffer. The consumed data should be removed from the buffer. If no complete frame can be read, must raise a ``NoFrames`` exception. :param data: A ``bytearray`` instance containing the data so far read. :param state: An instanc...
[ "Extract", "a", "single", "frame", "from", "the", "data", "buffer", ".", "The", "consumed", "data", "should", "be", "removed", "from", "the", "buffer", ".", "If", "no", "complete", "frame", "can", "be", "read", "must", "raise", "a", "NoFrames", "exception"...
python
train
linkedin/naarad
src/naarad/graphing/matplotlib_naarad.py
https://github.com/linkedin/naarad/blob/261e2c0760fd6a6b0ee59064180bd8e3674311fe/src/naarad/graphing/matplotlib_naarad.py#L74-L83
def highlight_region(plt, start_x, end_x): """ Highlight a region on the chart between the specified start and end x-co-ordinates. param pyplot plt: matplotlibk pyplot which contains the charts to be highlighted param string start_x : epoch time millis param string end_x : epoch time millis """ start_x = ...
[ "def", "highlight_region", "(", "plt", ",", "start_x", ",", "end_x", ")", ":", "start_x", "=", "convert_to_mdate", "(", "start_x", ")", "end_x", "=", "convert_to_mdate", "(", "end_x", ")", "plt", ".", "axvspan", "(", "start_x", ",", "end_x", ",", "color", ...
Highlight a region on the chart between the specified start and end x-co-ordinates. param pyplot plt: matplotlibk pyplot which contains the charts to be highlighted param string start_x : epoch time millis param string end_x : epoch time millis
[ "Highlight", "a", "region", "on", "the", "chart", "between", "the", "specified", "start", "and", "end", "x", "-", "co", "-", "ordinates", ".", "param", "pyplot", "plt", ":", "matplotlibk", "pyplot", "which", "contains", "the", "charts", "to", "be", "highli...
python
valid
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py#L163-L185
def add_fortran_to_env(env): """Add Builders and construction variables for Fortran to an Environment.""" try: FortranSuffixes = env['FORTRANFILESUFFIXES'] except KeyError: FortranSuffixes = ['.f', '.for', '.ftn'] #print("Adding %s to fortran suffixes" % FortranSuffixes) try: ...
[ "def", "add_fortran_to_env", "(", "env", ")", ":", "try", ":", "FortranSuffixes", "=", "env", "[", "'FORTRANFILESUFFIXES'", "]", "except", "KeyError", ":", "FortranSuffixes", "=", "[", "'.f'", ",", "'.for'", ",", "'.ftn'", "]", "#print(\"Adding %s to fortran suffi...
Add Builders and construction variables for Fortran to an Environment.
[ "Add", "Builders", "and", "construction", "variables", "for", "Fortran", "to", "an", "Environment", "." ]
python
train
tapilab/brandelion
brandelion/cli/analyze.py
https://github.com/tapilab/brandelion/blob/40a5a5333cf704182c8666d1fbbbdadc7ff88546/brandelion/cli/analyze.py#L314-L316
def _cosine(a, b): """ Return the len(a & b) / len(a) """ return 1. * len(a & b) / (math.sqrt(len(a)) * math.sqrt(len(b)))
[ "def", "_cosine", "(", "a", ",", "b", ")", ":", "return", "1.", "*", "len", "(", "a", "&", "b", ")", "/", "(", "math", ".", "sqrt", "(", "len", "(", "a", ")", ")", "*", "math", ".", "sqrt", "(", "len", "(", "b", ")", ")", ")" ]
Return the len(a & b) / len(a)
[ "Return", "the", "len", "(", "a", "&", "b", ")", "/", "len", "(", "a", ")" ]
python
train
raiden-network/raiden
raiden/blockchain/events.py
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/blockchain/events.py#L216-L223
def poll_blockchain_events(self, block_number: typing.BlockNumber): """ Poll for new blockchain events up to `block_number`. """ for event_listener in self.event_listeners: assert isinstance(event_listener.filter, StatelessFilter) for log_event in event_listener.filter.get_new_...
[ "def", "poll_blockchain_events", "(", "self", ",", "block_number", ":", "typing", ".", "BlockNumber", ")", ":", "for", "event_listener", "in", "self", ".", "event_listeners", ":", "assert", "isinstance", "(", "event_listener", ".", "filter", ",", "StatelessFilter"...
Poll for new blockchain events up to `block_number`.
[ "Poll", "for", "new", "blockchain", "events", "up", "to", "block_number", "." ]
python
train
SheffieldML/GPy
GPy/likelihoods/weibull.py
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/weibull.py#L52-L82
def logpdf_link(self, link_f, y, Y_metadata=None): """ Log Likelihood Function given link(f) .. math:: \\ln p(y_{i}|\lambda(f_{i})) = \\alpha_{i}\\log \\beta - \\log \\Gamma(\\alpha_{i}) + (\\alpha_{i} - 1)\\log y_{i} - \\beta y_{i}\\\\ \\alpha_{i} = \\beta y_{i} ...
[ "def", "logpdf_link", "(", "self", ",", "link_f", ",", "y", ",", "Y_metadata", "=", "None", ")", ":", "# alpha = self.gp_link.transf(gp)*self.beta sum(log(a) + (a-1).*log(y)- f - exp(-f).*y.^a)", "# return (1. - alpha)*np.log(obs) + self.beta*obs - alpha * np.log(self.beta) + np.log...
Log Likelihood Function given link(f) .. math:: \\ln p(y_{i}|\lambda(f_{i})) = \\alpha_{i}\\log \\beta - \\log \\Gamma(\\alpha_{i}) + (\\alpha_{i} - 1)\\log y_{i} - \\beta y_{i}\\\\ \\alpha_{i} = \\beta y_{i} :param link_f: latent variables (link(f)) :type link_f: Nx1 a...
[ "Log", "Likelihood", "Function", "given", "link", "(", "f", ")" ]
python
train
dpgaspar/Flask-AppBuilder
flask_appbuilder/api/__init__.py
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/api/__init__.py#L414-L432
def operation_helper( self, path=None, operations=None, methods=None, func=None, **kwargs ): """May mutate operations. :param str path: Path to the resource :param dict operations: A `dict` mapping HTTP methods to operation object. See :param list methods: A list of methods r...
[ "def", "operation_helper", "(", "self", ",", "path", "=", "None", ",", "operations", "=", "None", ",", "methods", "=", "None", ",", "func", "=", "None", ",", "*", "*", "kwargs", ")", ":", "for", "method", "in", "methods", ":", "yaml_doc_string", "=", ...
May mutate operations. :param str path: Path to the resource :param dict operations: A `dict` mapping HTTP methods to operation object. See :param list methods: A list of methods registered for this path
[ "May", "mutate", "operations", ".", ":", "param", "str", "path", ":", "Path", "to", "the", "resource", ":", "param", "dict", "operations", ":", "A", "dict", "mapping", "HTTP", "methods", "to", "operation", "object", ".", "See", ":", "param", "list", "met...
python
train
jonathf/chaospy
chaospy/distributions/approximation.py
https://github.com/jonathf/chaospy/blob/25ecfa7bf5608dc10c0b31d142ded0e3755f5d74/chaospy/distributions/approximation.py#L229-L315
def approximate_moment( dist, K, retall=False, control_var=None, rule="F", order=1000, **kws ): """ Approximation method for estimation of raw statistical moments. Args: dist : Dist Distribution domain with dim=len(dist) K ...
[ "def", "approximate_moment", "(", "dist", ",", "K", ",", "retall", "=", "False", ",", "control_var", "=", "None", ",", "rule", "=", "\"F\"", ",", "order", "=", "1000", ",", "*", "*", "kws", ")", ":", "dim", "=", "len", "(", "dist", ")", "shape", ...
Approximation method for estimation of raw statistical moments. Args: dist : Dist Distribution domain with dim=len(dist) K : numpy.ndarray The exponents of the moments of interest with shape (dim,K). control_var : Dist If provided will be used as a contro...
[ "Approximation", "method", "for", "estimation", "of", "raw", "statistical", "moments", "." ]
python
train
sethmlarson/virtualbox-python
virtualbox/library.py
https://github.com/sethmlarson/virtualbox-python/blob/706c8e3f6e3aee17eb06458e73cbb4bc2d37878b/virtualbox/library.py#L25006-L25042
def get_visible_region(self, rectangles, count): """Returns the visible region of this frame buffer. If the @a rectangles parameter is @c null then the value of the @a count parameter is ignored and the number of elements necessary to describe the current visible region is retur...
[ "def", "get_visible_region", "(", "self", ",", "rectangles", ",", "count", ")", ":", "if", "not", "isinstance", "(", "rectangles", ",", "basestring", ")", ":", "raise", "TypeError", "(", "\"rectangles can only be an instance of type basestring\"", ")", "if", "not", ...
Returns the visible region of this frame buffer. If the @a rectangles parameter is @c null then the value of the @a count parameter is ignored and the number of elements necessary to describe the current visible region is returned in @a countCopied. If @a rectangles is ...
[ "Returns", "the", "visible", "region", "of", "this", "frame", "buffer", ".", "If", "the", "@a", "rectangles", "parameter", "is", "@c", "null", "then", "the", "value", "of", "the", "@a", "count", "parameter", "is", "ignored", "and", "the", "number", "of", ...
python
train
bwohlberg/sporco
sporco/cnvrep.py
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/sporco/cnvrep.py#L541-L588
def mskWshape(W, cri): """Get appropriate internal shape (see :class:`CSC_ConvRepIndexing` and :class:`CDU_ConvRepIndexing`) for data fidelity term mask array `W`. The external shape of `W` depends on the external shape of input data array `S`. The simplest criterion for ensuring that the external ...
[ "def", "mskWshape", "(", "W", ",", "cri", ")", ":", "# Number of axes in W available for C and/or K axes", "ckdim", "=", "W", ".", "ndim", "-", "cri", ".", "dimN", "if", "ckdim", ">=", "2", ":", "# Both C and K axes are present in W", "shpW", "=", "W", ".", "s...
Get appropriate internal shape (see :class:`CSC_ConvRepIndexing` and :class:`CDU_ConvRepIndexing`) for data fidelity term mask array `W`. The external shape of `W` depends on the external shape of input data array `S`. The simplest criterion for ensuring that the external `W` is compatible with `S`...
[ "Get", "appropriate", "internal", "shape", "(", "see", ":", "class", ":", "CSC_ConvRepIndexing", "and", ":", "class", ":", "CDU_ConvRepIndexing", ")", "for", "data", "fidelity", "term", "mask", "array", "W", ".", "The", "external", "shape", "of", "W", "depen...
python
train
BD2KGenomics/toil-scripts
src/toil_scripts/gatk_germline/germline.py
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L135-L233
def gatk_germline_pipeline(job, samples, config): """ Runs the GATK best practices pipeline for germline SNP and INDEL discovery. Steps in Pipeline 0: Generate and preprocess BAM - Uploads processed BAM to output directory 1: Call Variants using HaplotypeCaller - Uploads GVCF 2:...
[ "def", "gatk_germline_pipeline", "(", "job", ",", "samples", ",", "config", ")", ":", "require", "(", "len", "(", "samples", ")", ">", "0", ",", "'No samples were provided!'", ")", "# Get total size of genome reference files. This is used for configuring disk size.", "gen...
Runs the GATK best practices pipeline for germline SNP and INDEL discovery. Steps in Pipeline 0: Generate and preprocess BAM - Uploads processed BAM to output directory 1: Call Variants using HaplotypeCaller - Uploads GVCF 2: Genotype VCF - Uploads VCF 3: Filter Variants usi...
[ "Runs", "the", "GATK", "best", "practices", "pipeline", "for", "germline", "SNP", "and", "INDEL", "discovery", "." ]
python
train
jbittel/django-mama-cas
mama_cas/services/__init__.py
https://github.com/jbittel/django-mama-cas/blob/03935d97442b46d8127ab9e1cd8deb96953fe156/mama_cas/services/__init__.py#L82-L91
def get_logout_url(service): """Get the configured logout URL for a given service identifier, if any.""" for backend in _get_backends(): try: return backend.get_logout_url(service) except AttributeError: raise NotImplementedError("%s.%s.get_logout_url() not implemented" %...
[ "def", "get_logout_url", "(", "service", ")", ":", "for", "backend", "in", "_get_backends", "(", ")", ":", "try", ":", "return", "backend", ".", "get_logout_url", "(", "service", ")", "except", "AttributeError", ":", "raise", "NotImplementedError", "(", "\"%s....
Get the configured logout URL for a given service identifier, if any.
[ "Get", "the", "configured", "logout", "URL", "for", "a", "given", "service", "identifier", "if", "any", "." ]
python
train
openstack/horizon
openstack_auth/policy.py
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_auth/policy.py#L86-L186
def check(actions, request, target=None): """Check user permission. Check if the user has permission to the action according to policy setting. :param actions: list of scope and action to do policy checks on, the composition of which is (scope, action). Multiple actions are treated as ...
[ "def", "check", "(", "actions", ",", "request", ",", "target", "=", "None", ")", ":", "if", "target", "is", "None", ":", "target", "=", "{", "}", "user", "=", "auth_utils", ".", "get_user", "(", "request", ")", "# Several service policy engines default to a ...
Check user permission. Check if the user has permission to the action according to policy setting. :param actions: list of scope and action to do policy checks on, the composition of which is (scope, action). Multiple actions are treated as a logical AND. * scope: service type man...
[ "Check", "user", "permission", "." ]
python
train
hhatto/autopep8
autopep8.py
https://github.com/hhatto/autopep8/blob/fda3bb39181437b6b8a0aa0185f21ae5f14385dd/autopep8.py#L1579-L1599
def _get_logical(source_lines, result, logical_start, logical_end): """Return the logical line corresponding to the result. Assumes input is already E702-clean. """ row = result['line'] - 1 col = result['column'] - 1 ls = None le = None for i in range(0, len(logical_start), 1): ...
[ "def", "_get_logical", "(", "source_lines", ",", "result", ",", "logical_start", ",", "logical_end", ")", ":", "row", "=", "result", "[", "'line'", "]", "-", "1", "col", "=", "result", "[", "'column'", "]", "-", "1", "ls", "=", "None", "le", "=", "No...
Return the logical line corresponding to the result. Assumes input is already E702-clean.
[ "Return", "the", "logical", "line", "corresponding", "to", "the", "result", "." ]
python
train
cltk/cltk
cltk/corpus/sanskrit/itrans/langinfo.py
https://github.com/cltk/cltk/blob/ed9c025b7ec43c949481173251b70e05e4dffd27/cltk/corpus/sanskrit/itrans/langinfo.py#L161-L166
def is_retroflex(c,lang): """ Is the character a retroflex """ o=get_offset(c,lang) return (o>=RETROFLEX_RANGE[0] and o<=RETROFLEX_RANGE[1])
[ "def", "is_retroflex", "(", "c", ",", "lang", ")", ":", "o", "=", "get_offset", "(", "c", ",", "lang", ")", "return", "(", "o", ">=", "RETROFLEX_RANGE", "[", "0", "]", "and", "o", "<=", "RETROFLEX_RANGE", "[", "1", "]", ")" ]
Is the character a retroflex
[ "Is", "the", "character", "a", "retroflex" ]
python
train
lextoumbourou/txstripe
txstripe/resource.py
https://github.com/lextoumbourou/txstripe/blob/a69e67f524258026fd1840655a0578311bba3b89/txstripe/resource.py#L187-L192
def all(cls, api_key=None, idempotency_key=None, stripe_account=None, **params): """Return a deferred.""" url = cls.class_url() return make_request( cls, 'get', url, stripe_acconut=None, params=params)
[ "def", "all", "(", "cls", ",", "api_key", "=", "None", ",", "idempotency_key", "=", "None", ",", "stripe_account", "=", "None", ",", "*", "*", "params", ")", ":", "url", "=", "cls", ".", "class_url", "(", ")", "return", "make_request", "(", "cls", ",...
Return a deferred.
[ "Return", "a", "deferred", "." ]
python
train
DarkEnergySurvey/ugali
ugali/analysis/search.py
https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/search.py#L73-L84
def createLabels2D(self): """ 2D labeling at zmax """ logger.debug(" Creating 2D labels...") self.zmax = np.argmax(self.values,axis=1) self.vmax = self.values[np.arange(len(self.pixels),dtype=int),self.zmax] kwargs=dict(pixels=self.pixels,values=self.vmax,nside=self.nside, ...
[ "def", "createLabels2D", "(", "self", ")", ":", "logger", ".", "debug", "(", "\" Creating 2D labels...\"", ")", "self", ".", "zmax", "=", "np", ".", "argmax", "(", "self", ".", "values", ",", "axis", "=", "1", ")", "self", ".", "vmax", "=", "self", ...
2D labeling at zmax
[ "2D", "labeling", "at", "zmax" ]
python
train
inveniosoftware/invenio-files-rest
invenio_files_rest/models.py
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/models.py#L1648-L1653
def get_or_create(cls, mp, part_number): """Get or create a part.""" obj = cls.get_or_none(mp, part_number) if obj: return obj return cls.create(mp, part_number)
[ "def", "get_or_create", "(", "cls", ",", "mp", ",", "part_number", ")", ":", "obj", "=", "cls", ".", "get_or_none", "(", "mp", ",", "part_number", ")", "if", "obj", ":", "return", "obj", "return", "cls", ".", "create", "(", "mp", ",", "part_number", ...
Get or create a part.
[ "Get", "or", "create", "a", "part", "." ]
python
train
MisterWil/abodepy
abodepy/devices/alarm.py
https://github.com/MisterWil/abodepy/blob/6f84bb428fd1da98855f55083cd427bebbcc57ae/abodepy/devices/alarm.py#L111-L115
def mode(self): """Get alarm mode.""" mode = self.get_value('mode').get(self.device_id, None) return mode.lower()
[ "def", "mode", "(", "self", ")", ":", "mode", "=", "self", ".", "get_value", "(", "'mode'", ")", ".", "get", "(", "self", ".", "device_id", ",", "None", ")", "return", "mode", ".", "lower", "(", ")" ]
Get alarm mode.
[ "Get", "alarm", "mode", "." ]
python
train
materialsproject/pymatgen
pymatgen/core/tensors.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L569-L610
def from_values_indices(cls, values, indices, populate=False, structure=None, voigt_rank=None, vsym=True, verbose=False): """ Creates a tensor from values and indices, with options for populating the remainder of the tensor. Args: ...
[ "def", "from_values_indices", "(", "cls", ",", "values", ",", "indices", ",", "populate", "=", "False", ",", "structure", "=", "None", ",", "voigt_rank", "=", "None", ",", "vsym", "=", "True", ",", "verbose", "=", "False", ")", ":", "# auto-detect voigt no...
Creates a tensor from values and indices, with options for populating the remainder of the tensor. Args: values (floats): numbers to place at indices indices (array-likes): indices to place values at populate (bool): whether to populate the tensor structu...
[ "Creates", "a", "tensor", "from", "values", "and", "indices", "with", "options", "for", "populating", "the", "remainder", "of", "the", "tensor", "." ]
python
train
pyviz/holoviews
holoviews/plotting/mpl/plot.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/mpl/plot.py#L154-L176
def _init_axis(self, fig, axis): """ Return an axis which may need to be initialized from a new figure. """ if not fig and self._create_fig: fig = plt.figure() l, b, r, t = self.fig_bounds inches = self.fig_inches fig.subplots_adjus...
[ "def", "_init_axis", "(", "self", ",", "fig", ",", "axis", ")", ":", "if", "not", "fig", "and", "self", ".", "_create_fig", ":", "fig", "=", "plt", ".", "figure", "(", ")", "l", ",", "b", ",", "r", ",", "t", "=", "self", ".", "fig_bounds", "inc...
Return an axis which may need to be initialized from a new figure.
[ "Return", "an", "axis", "which", "may", "need", "to", "be", "initialized", "from", "a", "new", "figure", "." ]
python
train
sleepyfran/itunespy
itunespy/ebook_artist.py
https://github.com/sleepyfran/itunespy/blob/0e7e931b135b5e0daae49ba68e9167ff4ac73eb5/itunespy/ebook_artist.py#L29-L34
def get_books(self): """ Retrieves all the books published by the artist :return: List. Books published by the artist """ return itunespy.lookup(id=self.artist_id, entity=itunespy.entities['ebook'])[1:]
[ "def", "get_books", "(", "self", ")", ":", "return", "itunespy", ".", "lookup", "(", "id", "=", "self", ".", "artist_id", ",", "entity", "=", "itunespy", ".", "entities", "[", "'ebook'", "]", ")", "[", "1", ":", "]" ]
Retrieves all the books published by the artist :return: List. Books published by the artist
[ "Retrieves", "all", "the", "books", "published", "by", "the", "artist", ":", "return", ":", "List", ".", "Books", "published", "by", "the", "artist" ]
python
train
trailofbits/manticore
manticore/utils/fallback_emulator.py
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/utils/fallback_emulator.py#L123-L136
def _hook_unmapped(self, uc, access, address, size, value, data): """ We hit an unmapped region; map it into unicorn. """ try: m = self._create_emulated_mapping(uc, address) except MemoryException as e: self._to_raise = e self._should_try_agai...
[ "def", "_hook_unmapped", "(", "self", ",", "uc", ",", "access", ",", "address", ",", "size", ",", "value", ",", "data", ")", ":", "try", ":", "m", "=", "self", ".", "_create_emulated_mapping", "(", "uc", ",", "address", ")", "except", "MemoryException", ...
We hit an unmapped region; map it into unicorn.
[ "We", "hit", "an", "unmapped", "region", ";", "map", "it", "into", "unicorn", "." ]
python
valid