nwo
stringlengths
5
106
sha
stringlengths
40
40
path
stringlengths
4
174
language
stringclasses
1 value
identifier
stringlengths
1
140
parameters
stringlengths
0
87.7k
argument_list
stringclasses
1 value
return_statement
stringlengths
0
426k
docstring
stringlengths
0
64.3k
docstring_summary
stringlengths
0
26.3k
docstring_tokens
list
function
stringlengths
18
4.83M
function_tokens
list
url
stringlengths
83
304
nortikin/sverchok
7b460f01317c15f2681bfa3e337c5e7346f3711b
node_tree.py
python
add_use_fake_user_to_trees
()
When ever space node editor switches to another tree or creates new one, this function will set True to `use_fake_user` of all Sverchok trees
When ever space node editor switches to another tree or creates new one, this function will set True to `use_fake_user` of all Sverchok trees
[ "When", "ever", "space", "node", "editor", "switches", "to", "another", "tree", "or", "creates", "new", "one", "this", "function", "will", "set", "True", "to", "use_fake_user", "of", "all", "Sverchok", "trees" ]
def add_use_fake_user_to_trees(): """When ever space node editor switches to another tree or creates new one, this function will set True to `use_fake_user` of all Sverchok trees""" def set_fake_user(): [setattr(t, 'use_fake_user', True) for t in bpy.data.node_groups if t.bl_idname == 'SverchCustomT...
[ "def", "add_use_fake_user_to_trees", "(", ")", ":", "def", "set_fake_user", "(", ")", ":", "[", "setattr", "(", "t", ",", "'use_fake_user'", ",", "True", ")", "for", "t", "in", "bpy", ".", "data", ".", "node_groups", "if", "t", ".", "bl_idname", "==", ...
https://github.com/nortikin/sverchok/blob/7b460f01317c15f2681bfa3e337c5e7346f3711b/node_tree.py#L564-L570
fzlee/alipay
0f8eab30fea7adb43284182cc6bcac08f51b2e08
alipay/__init__.py
python
ISVAliPay.app_auth_token
(self)
return self._app_auth_token
[]
def app_auth_token(self): # 没有则换取token if not self._app_auth_token: result = self.api_alipay_open_auth_token_app(self._app_auth_code) self._app_auth_token = result.get("app_auth_token") if not self._app_auth_token: msg = "Get auth token by auth code fa...
[ "def", "app_auth_token", "(", "self", ")", ":", "# 没有则换取token", "if", "not", "self", ".", "_app_auth_token", ":", "result", "=", "self", ".", "api_alipay_open_auth_token_app", "(", "self", ".", "_app_auth_code", ")", "self", ".", "_app_auth_token", "=", "result"...
https://github.com/fzlee/alipay/blob/0f8eab30fea7adb43284182cc6bcac08f51b2e08/alipay/__init__.py#L810-L818
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/tkinter/__init__.py
python
Canvas.create_text
(self, *args, **kw)
return self._create('text', args, kw)
Create text with coordinates x1,y1.
Create text with coordinates x1,y1.
[ "Create", "text", "with", "coordinates", "x1", "y1", "." ]
def create_text(self, *args, **kw): """Create text with coordinates x1,y1.""" return self._create('text', args, kw)
[ "def", "create_text", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "return", "self", ".", "_create", "(", "'text'", ",", "args", ",", "kw", ")" ]
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/tkinter/__init__.py#L2350-L2352
alteryx/featuretools
d59e11082962f163540fd6e185901f65c506326a
featuretools/feature_base/feature_base.py
python
Feature.__new__
(self, base, dataframe_name=None, groupby=None, parent_dataframe_name=None, primitive=None, use_previous=None, where=None)
[]
def __new__(self, base, dataframe_name=None, groupby=None, parent_dataframe_name=None, primitive=None, use_previous=None, where=None): # either direct or identity if primitive is None and dataframe_name is None: return IdentityFeature(base) elif primitive is None and ...
[ "def", "__new__", "(", "self", ",", "base", ",", "dataframe_name", "=", "None", ",", "groupby", "=", "None", ",", "parent_dataframe_name", "=", "None", ",", "primitive", "=", "None", ",", "use_previous", "=", "None", ",", "where", "=", "None", ")", ":", ...
https://github.com/alteryx/featuretools/blob/d59e11082962f163540fd6e185901f65c506326a/featuretools/feature_base/feature_base.py#L737-L758
JetBrains/python-skeletons
95ad24b666e475998e5d1cc02ed53a2188036167
sqlite3.py
python
connect
(database, timeout=5.0, detect_types=0, isolation_level=None, check_same_thread=False, factory=None, cached_statements=100)
return sqlite3.Connection()
Opens a connection to the SQLite database file database. :type database: bytes | unicode :type timeout: float :type detect_types: int :type isolation_level: string | None :type check_same_thread: bool :type factory: (() -> sqlite3.Connection) | None :rtype: sqlite3.Connection
Opens a connection to the SQLite database file database.
[ "Opens", "a", "connection", "to", "the", "SQLite", "database", "file", "database", "." ]
def connect(database, timeout=5.0, detect_types=0, isolation_level=None, check_same_thread=False, factory=None, cached_statements=100): """Opens a connection to the SQLite database file database. :type database: bytes | unicode :type timeout: float :type detect_types: int :type isolatio...
[ "def", "connect", "(", "database", ",", "timeout", "=", "5.0", ",", "detect_types", "=", "0", ",", "isolation_level", "=", "None", ",", "check_same_thread", "=", "False", ",", "factory", "=", "None", ",", "cached_statements", "=", "100", ")", ":", "return"...
https://github.com/JetBrains/python-skeletons/blob/95ad24b666e475998e5d1cc02ed53a2188036167/sqlite3.py#L7-L19
beeware/ouroboros
a29123c6fab6a807caffbb7587cf548e0c370296
ouroboros/tkinter/__init__.py
python
Text.window_cget
(self, index, option)
return self.tk.call(self._w, 'window', 'cget', index, option)
Return the value of OPTION of an embedded window at INDEX.
Return the value of OPTION of an embedded window at INDEX.
[ "Return", "the", "value", "of", "OPTION", "of", "an", "embedded", "window", "at", "INDEX", "." ]
def window_cget(self, index, option): """Return the value of OPTION of an embedded window at INDEX.""" if option[:1] != '-': option = '-' + option if option[-1:] == '_': option = option[:-1] return self.tk.call(self._w, 'window', 'cget', index, option)
[ "def", "window_cget", "(", "self", ",", "index", ",", "option", ")", ":", "if", "option", "[", ":", "1", "]", "!=", "'-'", ":", "option", "=", "'-'", "+", "option", "if", "option", "[", "-", "1", ":", "]", "==", "'_'", ":", "option", "=", "opti...
https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/tkinter/__init__.py#L3281-L3287
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/google/appengine/api/search/simple_search_stub.py
python
SearchServiceStub._GetNamespace
(self, namespace)
return namespace_manager.get_namespace()
Get namespace name. Args: namespace: Namespace provided in request arguments. Returns: If namespace is None, returns the name of the current global namespace. If namespace is not None, returns namespace.
Get namespace name.
[ "Get", "namespace", "name", "." ]
def _GetNamespace(self, namespace): """Get namespace name. Args: namespace: Namespace provided in request arguments. Returns: If namespace is None, returns the name of the current global namespace. If namespace is not None, returns namespace. """ if namespace is not None: r...
[ "def", "_GetNamespace", "(", "self", ",", "namespace", ")", ":", "if", "namespace", "is", "not", "None", ":", "return", "namespace", "return", "namespace_manager", ".", "get_namespace", "(", ")" ]
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/api/search/simple_search_stub.py#L617-L629
Yelp/mrjob
091572e87bc24cc64be40278dd0f5c3617c98d4b
mrjob/job.py
python
MRJob._runner_class
(self)
return _runner_class(self.options.runner or 'inline')
Runner class as indicated by ``--runner``. Defaults to ``'inline'``.
Runner class as indicated by ``--runner``. Defaults to ``'inline'``.
[ "Runner", "class", "as", "indicated", "by", "--", "runner", ".", "Defaults", "to", "inline", "." ]
def _runner_class(self): """Runner class as indicated by ``--runner``. Defaults to ``'inline'``. """ return _runner_class(self.options.runner or 'inline')
[ "def", "_runner_class", "(", "self", ")", ":", "return", "_runner_class", "(", "self", ".", "options", ".", "runner", "or", "'inline'", ")" ]
https://github.com/Yelp/mrjob/blob/091572e87bc24cc64be40278dd0f5c3617c98d4b/mrjob/job.py#L715-L718
KalleHallden/AutoTimer
2d954216700c4930baa154e28dbddc34609af7ce
env/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.py
python
Node.insertBefore
(self, node, refNode)
Insert node as a child of the current node, before refNode in the list of child nodes. Raises ValueError if refNode is not a child of the current node :arg node: the node to insert :arg refNode: the child node to insert the node before
Insert node as a child of the current node, before refNode in the list of child nodes. Raises ValueError if refNode is not a child of the current node
[ "Insert", "node", "as", "a", "child", "of", "the", "current", "node", "before", "refNode", "in", "the", "list", "of", "child", "nodes", ".", "Raises", "ValueError", "if", "refNode", "is", "not", "a", "child", "of", "the", "current", "node" ]
def insertBefore(self, node, refNode): """Insert node as a child of the current node, before refNode in the list of child nodes. Raises ValueError if refNode is not a child of the current node :arg node: the node to insert :arg refNode: the child node to insert the node before ...
[ "def", "insertBefore", "(", "self", ",", "node", ",", "refNode", ")", ":", "raise", "NotImplementedError" ]
https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.py#L77-L87
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/rings/number_field/number_field.py
python
NumberField_generic.is_relative
(self)
return not self.is_absolute()
EXAMPLES:: sage: K.<a> = NumberField(x^10 - 2) sage: K.is_absolute() True sage: K.is_relative() False
EXAMPLES::
[ "EXAMPLES", "::" ]
def is_relative(self): """ EXAMPLES:: sage: K.<a> = NumberField(x^10 - 2) sage: K.is_absolute() True sage: K.is_relative() False """ return not self.is_absolute()
[ "def", "is_relative", "(", "self", ")", ":", "return", "not", "self", ".", "is_absolute", "(", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/number_field/number_field.py#L2560-L2570
wikilinks/neleval
68f68414f6a82e3d86761b8d3083e537582bfa7f
neleval/tac.py
python
read_excluded_spans
(path)
return excluded
[]
def read_excluded_spans(path): if path is None: return set() excluded = set() with open(path) as f: for l in f: doc_id, start, end = l.strip().split('\t')[:3] for i in range(int(start), int(end) + 1): excluded.add((doc_id, str(i))) return excluded
[ "def", "read_excluded_spans", "(", "path", ")", ":", "if", "path", "is", "None", ":", "return", "set", "(", ")", "excluded", "=", "set", "(", ")", "with", "open", "(", "path", ")", "as", "f", ":", "for", "l", "in", "f", ":", "doc_id", ",", "start...
https://github.com/wikilinks/neleval/blob/68f68414f6a82e3d86761b8d3083e537582bfa7f/neleval/tac.py#L106-L116
rhinstaller/anaconda
63edc8680f1b05cbfe11bef28703acba808c5174
pyanaconda/core/configuration/anaconda.py
python
AnacondaConfiguration.from_defaults
(cls)
return config
Get the default Anaconda configuration. :return: an instance of AnacondaConfiguration
Get the default Anaconda configuration.
[ "Get", "the", "default", "Anaconda", "configuration", "." ]
def from_defaults(cls): """Get the default Anaconda configuration. :return: an instance of AnacondaConfiguration """ config = cls() config.set_from_defaults() return config
[ "def", "from_defaults", "(", "cls", ")", ":", "config", "=", "cls", "(", ")", "config", ".", "set_from_defaults", "(", ")", "return", "config" ]
https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/core/configuration/anaconda.py#L139-L146
entropy1337/infernal-twin
10995cd03312e39a48ade0f114ebb0ae3a711bb8
Modules/build/pip/build/lib.linux-i686-2.7/pip/_vendor/pkg_resources/__init__.py
python
parse_requirements
(strs)
Yield ``Requirement`` objects for each specification in `strs` `strs` must be a string, or a (possibly-nested) iterable thereof.
Yield ``Requirement`` objects for each specification in `strs`
[ "Yield", "Requirement", "objects", "for", "each", "specification", "in", "strs" ]
def parse_requirements(strs): """Yield ``Requirement`` objects for each specification in `strs` `strs` must be a string, or a (possibly-nested) iterable thereof. """ # create a steppable iterator, so we can handle \-continuations lines = iter(yield_lines(strs)) def scan_list(ITEM, TERMINATOR, ...
[ "def", "parse_requirements", "(", "strs", ")", ":", "# create a steppable iterator, so we can handle \\-continuations", "lines", "=", "iter", "(", "yield_lines", "(", "strs", ")", ")", "def", "scan_list", "(", "ITEM", ",", "TERMINATOR", ",", "line", ",", "p", ",",...
https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/build/pip/build/lib.linux-i686-2.7/pip/_vendor/pkg_resources/__init__.py#L2865-L2926
jazzband/django-dbbackup
3a4cdbf2b8a70ac319655ad08dd8fc5e8c0f38d8
dbbackup/utils.py
python
datefmt_to_regex
(datefmt)
return re.compile(r'(%s)' % new_string)
Convert a strftime format string to a regex. :param datefmt: strftime format string :type datefmt: ``str`` :returns: Equivalent regex :rtype: ``re.compite``
Convert a strftime format string to a regex.
[ "Convert", "a", "strftime", "format", "string", "to", "a", "regex", "." ]
def datefmt_to_regex(datefmt): """ Convert a strftime format string to a regex. :param datefmt: strftime format string :type datefmt: ``str`` :returns: Equivalent regex :rtype: ``re.compite`` """ new_string = datefmt for pat, reg in PATTERN_MATCHNG: new_string = new_string....
[ "def", "datefmt_to_regex", "(", "datefmt", ")", ":", "new_string", "=", "datefmt", "for", "pat", ",", "reg", "in", "PATTERN_MATCHNG", ":", "new_string", "=", "new_string", ".", "replace", "(", "pat", ",", "reg", ")", "return", "re", ".", "compile", "(", ...
https://github.com/jazzband/django-dbbackup/blob/3a4cdbf2b8a70ac319655ad08dd8fc5e8c0f38d8/dbbackup/utils.py#L325-L338
hyperledger/aries-cloudagent-python
2f36776e99f6053ae92eed8123b5b1b2e891c02a
aries_cloudagent/core/plugin_registry.py
python
PluginRegistry.register_package
(self, package_name: str)
return list( filter( None, ( self.register_plugin(module_name) for module_name in module_names if module_name.split(".")[-1] != "tests" ), ) )
Register all modules (sub-packages) under a given package name.
Register all modules (sub-packages) under a given package name.
[ "Register", "all", "modules", "(", "sub", "-", "packages", ")", "under", "a", "given", "package", "name", "." ]
def register_package(self, package_name: str) -> Sequence[ModuleType]: """Register all modules (sub-packages) under a given package name.""" try: module_names = ClassLoader.scan_subpackages(package_name) except ModuleLoadError: LOGGER.error("Plugin module package not foun...
[ "def", "register_package", "(", "self", ",", "package_name", ":", "str", ")", "->", "Sequence", "[", "ModuleType", "]", ":", "try", ":", "module_names", "=", "ClassLoader", ".", "scan_subpackages", "(", "package_name", ")", "except", "ModuleLoadError", ":", "L...
https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/core/plugin_registry.py#L180-L196
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
common/lib/xmodule/xmodule/x_module.py
python
ModuleSystemShim.anonymous_student_id
(self)
return None
Returns the anonymous user ID for the current user and course. Deprecated in favor of the user service.
Returns the anonymous user ID for the current user and course.
[ "Returns", "the", "anonymous", "user", "ID", "for", "the", "current", "user", "and", "course", "." ]
def anonymous_student_id(self): """ Returns the anonymous user ID for the current user and course. Deprecated in favor of the user service. """ warnings.warn( 'runtime.anonymous_student_id is deprecated. Please use the user service instead.', DeprecationW...
[ "def", "anonymous_student_id", "(", "self", ")", ":", "warnings", ".", "warn", "(", "'runtime.anonymous_student_id is deprecated. Please use the user service instead.'", ",", "DeprecationWarning", ",", "stacklevel", "=", "3", ",", ")", "user_service", "=", "self", ".", ...
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/common/lib/xmodule/xmodule/x_module.py#L1753-L1766
KalleHallden/AutoTimer
2d954216700c4930baa154e28dbddc34609af7ce
env/lib/python2.7/site.py
python
execsitecustomize
()
Run custom site specific code, if available.
Run custom site specific code, if available.
[ "Run", "custom", "site", "specific", "code", "if", "available", "." ]
def execsitecustomize(): """Run custom site specific code, if available.""" try: import sitecustomize except ImportError: pass
[ "def", "execsitecustomize", "(", ")", ":", "try", ":", "import", "sitecustomize", "except", "ImportError", ":", "pass" ]
https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site.py#L550-L555
linkedin/iris
af929ee35b8aaccef99c0ee775707e45d56ea784
src/iris/vendors/iris_hipchat.py
python
iris_hipchat.parse_destination
(self, destination)
return room_id, token, mention
Determine room_id, token and user to mention We accept 3 formats: - Just a mention (@testuser) - Room_id and Token (12341;a20asdfgjahdASDfaskw) - Room_id, Token and mention (12341;a20asdfgjahdASDfaskw;@testuser)
Determine room_id, token and user to mention We accept 3 formats: - Just a mention (
[ "Determine", "room_id", "token", "and", "user", "to", "mention", "We", "accept", "3", "formats", ":", "-", "Just", "a", "mention", "(" ]
def parse_destination(self, destination): """Determine room_id, token and user to mention We accept 3 formats: - Just a mention (@testuser) - Room_id and Token (12341;a20asdfgjahdASDfaskw) - Room_id, Token and mention (12341;a20asdfgjahdASDfaskw;@testuser) ...
[ "def", "parse_destination", "(", "self", ",", "destination", ")", ":", "room_id", "=", "self", ".", "room_id", "token", "=", "self", ".", "token", "mention", "=", "\"\"", "if", "destination", ".", "startswith", "(", "\"@\"", ")", ":", "mention", "=", "de...
https://github.com/linkedin/iris/blob/af929ee35b8aaccef99c0ee775707e45d56ea784/src/iris/vendors/iris_hipchat.py#L47-L80
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/calendar.py
python
format
(cols, colwidth=_colwidth, spacing=_spacing)
Prints multi-column formatting for year calendars
Prints multi-column formatting for year calendars
[ "Prints", "multi", "-", "column", "formatting", "for", "year", "calendars" ]
def format(cols, colwidth=_colwidth, spacing=_spacing): """Prints multi-column formatting for year calendars""" print formatstring(cols, colwidth, spacing)
[ "def", "format", "(", "cols", ",", "colwidth", "=", "_colwidth", ",", "spacing", "=", "_spacing", ")", ":", "print", "formatstring", "(", "cols", ",", "colwidth", ",", "spacing", ")" ]
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/calendar.py#L595-L597
tensorflow/lingvo
ce10019243d954c3c3ebe739f7589b5eebfdf907
lingvo/tools/gke_launch.py
python
_get_or_add
(cfg, name)
return cfg[name]
Gets cfg[name], or adds 'name' with an empty dict if not present.
Gets cfg[name], or adds 'name' with an empty dict if not present.
[ "Gets", "cfg", "[", "name", "]", "or", "adds", "name", "with", "an", "empty", "dict", "if", "not", "present", "." ]
def _get_or_add(cfg, name): """Gets cfg[name], or adds 'name' with an empty dict if not present.""" if name not in cfg: cfg.update({name: {}}) return cfg[name]
[ "def", "_get_or_add", "(", "cfg", ",", "name", ")", ":", "if", "name", "not", "in", "cfg", ":", "cfg", ".", "update", "(", "{", "name", ":", "{", "}", "}", ")", "return", "cfg", "[", "name", "]" ]
https://github.com/tensorflow/lingvo/blob/ce10019243d954c3c3ebe739f7589b5eebfdf907/lingvo/tools/gke_launch.py#L122-L126
peterbrittain/asciimatics
9a490faddf484ee5b9b845316f921f5888b23b18
asciimatics/exceptions.py
python
StopApplication.__init__
(self, message)
:param message: Error message for this exception.
:param message: Error message for this exception.
[ ":", "param", "message", ":", "Error", "message", "for", "this", "exception", "." ]
def __init__(self, message): """ :param message: Error message for this exception. """ super(StopApplication, self).__init__() self._message = message
[ "def", "__init__", "(", "self", ",", "message", ")", ":", "super", "(", "StopApplication", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "_message", "=", "message" ]
https://github.com/peterbrittain/asciimatics/blob/9a490faddf484ee5b9b845316f921f5888b23b18/asciimatics/exceptions.py#L47-L52
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_adm_registry.py
python
Utils.openshift_installed
()
return rpmquery.count() > 0
check if openshift is installed
check if openshift is installed
[ "check", "if", "openshift", "is", "installed" ]
def openshift_installed(): ''' check if openshift is installed ''' import rpm transaction_set = rpm.TransactionSet() rpmquery = transaction_set.dbMatch("name", "atomic-openshift") return rpmquery.count() > 0
[ "def", "openshift_installed", "(", ")", ":", "import", "rpm", "transaction_set", "=", "rpm", ".", "TransactionSet", "(", ")", "rpmquery", "=", "transaction_set", ".", "dbMatch", "(", "\"name\"", ",", "\"atomic-openshift\"", ")", "return", "rpmquery", ".", "count...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_adm_registry.py#L1432-L1439
deepset-ai/haystack
79fdda8a7cf393d774803608a4874f2a6e63cf6f
ui/SessionState.py
python
get
(**kwargs)
return this_session._custom_session_state
Gets a SessionState object for the current session. Creates a new object if necessary. Parameters ---------- **kwargs : any Default values you want to add to the session state, if we're creating a new one. Example ------- >>> session_state = get(user_name='', favorite_color='...
Gets a SessionState object for the current session. Creates a new object if necessary. Parameters ---------- **kwargs : any Default values you want to add to the session state, if we're creating a new one. Example ------- >>> session_state = get(user_name='', favorite_color='...
[ "Gets", "a", "SessionState", "object", "for", "the", "current", "session", ".", "Creates", "a", "new", "object", "if", "necessary", ".", "Parameters", "----------", "**", "kwargs", ":", "any", "Default", "values", "you", "want", "to", "add", "to", "the", "...
def get(**kwargs): """Gets a SessionState object for the current session. Creates a new object if necessary. Parameters ---------- **kwargs : any Default values you want to add to the session state, if we're creating a new one. Example ------- >>> session_state = get(user...
[ "def", "get", "(", "*", "*", "kwargs", ")", ":", "# Hack to get the session object from Streamlit.", "ctx", "=", "ReportThread", ".", "get_report_ctx", "(", ")", "this_session", "=", "None", "current_server", "=", "Server", ".", "get_current", "(", ")", "if", "h...
https://github.com/deepset-ai/haystack/blob/79fdda8a7cf393d774803608a4874f2a6e63cf6f/ui/SessionState.py#L46-L105
naftaliharris/tauthon
5587ceec329b75f7caf6d65a036db61ac1bae214
Lib/distutils/text_file.py
python
TextFile.warn
(self, msg, line=None)
Print (to stderr) a warning message tied to the current logical line in the current file. If the current logical line in the file spans multiple physical lines, the warning refers to the whole range, eg. "lines 3-5". If 'line' supplied, it overrides the current line number;...
Print (to stderr) a warning message tied to the current logical line in the current file. If the current logical line in the file spans multiple physical lines, the warning refers to the whole range, eg. "lines 3-5". If 'line' supplied, it overrides the current line number;...
[ "Print", "(", "to", "stderr", ")", "a", "warning", "message", "tied", "to", "the", "current", "logical", "line", "in", "the", "current", "file", ".", "If", "the", "current", "logical", "line", "in", "the", "file", "spans", "multiple", "physical", "lines", ...
def warn (self, msg, line=None): """Print (to stderr) a warning message tied to the current logical line in the current file. If the current logical line in the file spans multiple physical lines, the warning refers to the whole range, eg. "lines 3-5". If 'line' supplied, it o...
[ "def", "warn", "(", "self", ",", "msg", ",", "line", "=", "None", ")", ":", "sys", ".", "stderr", ".", "write", "(", "\"warning: \"", "+", "self", ".", "gen_error", "(", "msg", ",", "line", ")", "+", "\"\\n\"", ")" ]
https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/distutils/text_file.py#L150-L158
sovrasov/flops-counter.pytorch
29621c81b3afc21450c1e20d04f88f098c0681a8
ptflops/flops_counter.py
python
accumulate_flops
(self)
[]
def accumulate_flops(self): if is_supported_instance(self): return self.__flops__ else: sum = 0 for m in self.children(): sum += m.accumulate_flops() return sum
[ "def", "accumulate_flops", "(", "self", ")", ":", "if", "is_supported_instance", "(", "self", ")", ":", "return", "self", ".", "__flops__", "else", ":", "sum", "=", "0", "for", "m", "in", "self", ".", "children", "(", ")", ":", "sum", "+=", "m", ".",...
https://github.com/sovrasov/flops-counter.pytorch/blob/29621c81b3afc21450c1e20d04f88f098c0681a8/ptflops/flops_counter.py#L95-L102
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/multiprocessing/__init__.py
python
RawValue
(typecode_or_type, *args)
return RawValue(typecode_or_type, *args)
Returns a shared object
Returns a shared object
[ "Returns", "a", "shared", "object" ]
def RawValue(typecode_or_type, *args): ''' Returns a shared object ''' from multiprocessing.sharedctypes import RawValue return RawValue(typecode_or_type, *args)
[ "def", "RawValue", "(", "typecode_or_type", ",", "*", "args", ")", ":", "from", "multiprocessing", ".", "sharedctypes", "import", "RawValue", "return", "RawValue", "(", "typecode_or_type", ",", "*", "args", ")" ]
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/multiprocessing/__init__.py#L234-L239
awslabs/gluon-ts
066ec3b7f47aa4ee4c061a28f35db7edbad05a98
src/gluonts/mx/util.py
python
cumsum
( F, x: Tensor, exclusive: bool = False, reverse: bool = False )
return cumulative_sum.squeeze(axis=exp_dim)
r""" Find cumulative sum on the last axis by multiplying with lower triangular ones-matrix: .. math:: \operatorname{cumsum}(x) = \begin{cases} \operatorname{ltr\_ones} \times x & \text{for cumulative sum}\\ x \times \operatorname{ltr\_ones} & \text{for...
r""" Find cumulative sum on the last axis by multiplying with lower triangular ones-matrix:
[ "r", "Find", "cumulative", "sum", "on", "the", "last", "axis", "by", "multiplying", "with", "lower", "triangular", "ones", "-", "matrix", ":" ]
def cumsum( F, x: Tensor, exclusive: bool = False, reverse: bool = False ) -> Tensor: r""" Find cumulative sum on the last axis by multiplying with lower triangular ones-matrix: .. math:: \operatorname{cumsum}(x) = \begin{cases} \operatorname{ltr\_ones} \times x &...
[ "def", "cumsum", "(", "F", ",", "x", ":", "Tensor", ",", "exclusive", ":", "bool", "=", "False", ",", "reverse", ":", "bool", "=", "False", ")", "->", "Tensor", ":", "# Create a new axis (for matrix multiplication) either at last location or", "# last-but-one locati...
https://github.com/awslabs/gluon-ts/blob/066ec3b7f47aa4ee4c061a28f35db7edbad05a98/src/gluonts/mx/util.py#L331-L401
CamDavidsonPilon/lifelines
9be26a9a8720e8536e9828e954bb91d559a3016f
lifelines/statistics.py
python
power_under_cph
(n_exp, n_con, p_exp, p_con, postulated_hazard_ratio, alpha=0.05)
return stats.norm.cdf( np.sqrt(k * m) * abs(postulated_hazard_ratio - 1) / (k * postulated_hazard_ratio + 1) - z(1 - alpha / 2.0) )
This computes the power of the hypothesis test that the two groups, experiment and control, have different hazards (that is, the relative hazard ratio is different from 1.) Parameters ---------- n_exp : integer size of the experiment group. n_con : integer size of the control grou...
This computes the power of the hypothesis test that the two groups, experiment and control, have different hazards (that is, the relative hazard ratio is different from 1.)
[ "This", "computes", "the", "power", "of", "the", "hypothesis", "test", "that", "the", "two", "groups", "experiment", "and", "control", "have", "different", "hazards", "(", "that", "is", "the", "relative", "hazard", "ratio", "is", "different", "from", "1", "....
def power_under_cph(n_exp, n_con, p_exp, p_con, postulated_hazard_ratio, alpha=0.05) -> float: """ This computes the power of the hypothesis test that the two groups, experiment and control, have different hazards (that is, the relative hazard ratio is different from 1.) Parameters ---------- ...
[ "def", "power_under_cph", "(", "n_exp", ",", "n_con", ",", "p_exp", ",", "p_con", ",", "postulated_hazard_ratio", ",", "alpha", "=", "0.05", ")", "->", "float", ":", "def", "z", "(", "p", ")", ":", "return", "stats", ".", "norm", ".", "ppf", "(", "p"...
https://github.com/CamDavidsonPilon/lifelines/blob/9be26a9a8720e8536e9828e954bb91d559a3016f/lifelines/statistics.py#L288-L338
pyrocko/pyrocko
b6baefb7540fb7fce6ed9b856ec0c413961a4320
src/plot/gmtpy.py
python
escape_shell_args
(args)
return ' '.join([escape_shell_arg(x) for x in args])
This function should be used for debugging output only - it could be insecure.
This function should be used for debugging output only - it could be insecure.
[ "This", "function", "should", "be", "used", "for", "debugging", "output", "only", "-", "it", "could", "be", "insecure", "." ]
def escape_shell_args(args): ''' This function should be used for debugging output only - it could be insecure. ''' return ' '.join([escape_shell_arg(x) for x in args])
[ "def", "escape_shell_args", "(", "args", ")", ":", "return", "' '", ".", "join", "(", "[", "escape_shell_arg", "(", "x", ")", "for", "x", "in", "args", "]", ")" ]
https://github.com/pyrocko/pyrocko/blob/b6baefb7540fb7fce6ed9b856ec0c413961a4320/src/plot/gmtpy.py#L214-L220
wbond/packagecontrol.io
9f5eb7e3392e6bc2ad979ad32d3dd27ef9c00b20
app/lib/package_control/providers/gitlab_repository_provider.py
python
GitLabRepositoryProvider.get_packages
(self, invalid_sources=None)
Uses the GitLab API to construct necessary info for a package :param invalid_sources: A list of URLs that should be ignored :raises: DownloaderException: when there is an issue download package info ClientException: when there is an issue parsing package info ...
Uses the GitLab API to construct necessary info for a package
[ "Uses", "the", "GitLab", "API", "to", "construct", "necessary", "info", "for", "a", "package" ]
def get_packages(self, invalid_sources=None): """ Uses the GitLab API to construct necessary info for a package :param invalid_sources: A list of URLs that should be ignored :raises: DownloaderException: when there is an issue download package info C...
[ "def", "get_packages", "(", "self", ",", "invalid_sources", "=", "None", ")", ":", "if", "'get_packages'", "in", "self", ".", "cache", ":", "for", "key", ",", "value", "in", "self", ".", "cache", "[", "'get_packages'", "]", ".", "items", "(", ")", ":",...
https://github.com/wbond/packagecontrol.io/blob/9f5eb7e3392e6bc2ad979ad32d3dd27ef9c00b20/app/lib/package_control/providers/gitlab_repository_provider.py#L91-L174
dask/dask
c2b962fec1ba45440fe928869dc64cfe9cc36506
dask/dataframe/indexing.py
python
_LocIndexer._loc
(self, iindexer, cindexer)
Helper function for the .loc accessor
Helper function for the .loc accessor
[ "Helper", "function", "for", "the", ".", "loc", "accessor" ]
def _loc(self, iindexer, cindexer): """Helper function for the .loc accessor""" if isinstance(iindexer, Series): return self._loc_series(iindexer, cindexer) elif isinstance(iindexer, Array): return self._loc_array(iindexer, cindexer) elif callable(iindexer): ...
[ "def", "_loc", "(", "self", ",", "iindexer", ",", "cindexer", ")", ":", "if", "isinstance", "(", "iindexer", ",", "Series", ")", ":", "return", "self", ".", "_loc_series", "(", "iindexer", ",", "cindexer", ")", "elif", "isinstance", "(", "iindexer", ",",...
https://github.com/dask/dask/blob/c2b962fec1ba45440fe928869dc64cfe9cc36506/dask/dataframe/indexing.py#L102-L140
shuup/shuup
25f78cfe370109b9885b903e503faac295c7b7f2
shuup/front/providers/form_def.py
python
FormDefProvider.get_definitions
(self, **kwargs)
return []
:return: list of `FormDefinition`s :rtype: list[shuup.front.providers.form_def.FormDefinition]
:return: list of `FormDefinition`s :rtype: list[shuup.front.providers.form_def.FormDefinition]
[ ":", "return", ":", "list", "of", "FormDefinition", "s", ":", "rtype", ":", "list", "[", "shuup", ".", "front", ".", "providers", ".", "form_def", ".", "FormDefinition", "]" ]
def get_definitions(self, **kwargs): """ :return: list of `FormDefinition`s :rtype: list[shuup.front.providers.form_def.FormDefinition] """ return []
[ "def", "get_definitions", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "[", "]" ]
https://github.com/shuup/shuup/blob/25f78cfe370109b9885b903e503faac295c7b7f2/shuup/front/providers/form_def.py#L43-L48
yihui-he/KL-Loss
66c0ed9e886a2218f4cf88c0efd4f40199bff54a
detectron/utils/py_cpu_nms.py
python
py_cpu_nms
(dets, thresh)
return keep
Pure Python NMS baseline.
Pure Python NMS baseline.
[ "Pure", "Python", "NMS", "baseline", "." ]
def py_cpu_nms(dets, thresh): """Pure Python NMS baseline.""" x1 = dets[:, 0] y1 = dets[:, 1] x2 = dets[:, 2] y2 = dets[:, 3] scores = dets[:, 4] areas = (x2 - x1 + 1) * (y2 - y1 + 1) order = scores.argsort()[::-1] keep = [] while order.size > 0: i = order[0] ke...
[ "def", "py_cpu_nms", "(", "dets", ",", "thresh", ")", ":", "x1", "=", "dets", "[", ":", ",", "0", "]", "y1", "=", "dets", "[", ":", ",", "1", "]", "x2", "=", "dets", "[", ":", ",", "2", "]", "y2", "=", "dets", "[", ":", ",", "3", "]", "...
https://github.com/yihui-he/KL-Loss/blob/66c0ed9e886a2218f4cf88c0efd4f40199bff54a/detectron/utils/py_cpu_nms.py#L175-L203
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/geometry/line.py
python
LinearEntity.intersection
(self, o)
return o.intersection(self)
The intersection with another geometrical entity. Parameters ========== o : Point or LinearEntity Returns ======= intersection : list of geometrical entities See Also ======== sympy.geometry.point.Point Examples ======== ...
The intersection with another geometrical entity.
[ "The", "intersection", "with", "another", "geometrical", "entity", "." ]
def intersection(self, o): """The intersection with another geometrical entity. Parameters ========== o : Point or LinearEntity Returns ======= intersection : list of geometrical entities See Also ======== sympy.geometry.point.Point ...
[ "def", "intersection", "(", "self", ",", "o", ")", ":", "if", "isinstance", "(", "o", ",", "Point", ")", ":", "if", "o", "in", "self", ":", "return", "[", "o", "]", "else", ":", "return", "[", "]", "elif", "isinstance", "(", "o", ",", "LinearEnti...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/geometry/line.py#L625-L779
fossasia/x-mario-center
fe67afe28d995dcf4e2498e305825a4859566172
softwarecenter/backend/piston/rnrclient_pristine.py
python
RatingsAndReviewsAPI.review_stats
(self, origin='any', distroseries='any', days=None, valid_days=(1, 3, 7))
return self._get(url, scheme=PUBLIC_API_SCHEME)
Fetch ratings for a particular distroseries
Fetch ratings for a particular distroseries
[ "Fetch", "ratings", "for", "a", "particular", "distroseries" ]
def review_stats(self, origin='any', distroseries='any', days=None, valid_days=(1, 3, 7)): """Fetch ratings for a particular distroseries""" url = 'review-stats/{0}/{1}/'.format(origin, distroseries) if days is not None: # the server only knows valid_days (1,3,7) currently ...
[ "def", "review_stats", "(", "self", ",", "origin", "=", "'any'", ",", "distroseries", "=", "'any'", ",", "days", "=", "None", ",", "valid_days", "=", "(", "1", ",", "3", ",", "7", ")", ")", ":", "url", "=", "'review-stats/{0}/{1}/'", ".", "format", "...
https://github.com/fossasia/x-mario-center/blob/fe67afe28d995dcf4e2498e305825a4859566172/softwarecenter/backend/piston/rnrclient_pristine.py#L85-L97
CGCookie/retopoflow
3d8b3a47d1d661f99ab0aeb21d31370bf15de35e
retopoflow/rftool_knife/knife.py
python
Knife.main_enter
(self)
[]
def main_enter(self): self.quick_knife = False self.update_state_info()
[ "def", "main_enter", "(", "self", ")", ":", "self", ".", "quick_knife", "=", "False", "self", ".", "update_state_info", "(", ")" ]
https://github.com/CGCookie/retopoflow/blob/3d8b3a47d1d661f99ab0aeb21d31370bf15de35e/retopoflow/rftool_knife/knife.py#L152-L154
git-cola/git-cola
b48b8028e0c3baf47faf7b074b9773737358163d
cola/core.py
python
run_command
(cmd, *args, **kwargs)
return (exit_code, output or UStr('', ENCODING), errors or UStr('', ENCODING))
Run the given command to completion, and return its results. This provides a simpler interface to the subprocess module. The results are formatted as a 3-tuple: (exit_code, output, errors) The other arguments are passed on to start_command().
Run the given command to completion, and return its results.
[ "Run", "the", "given", "command", "to", "completion", "and", "return", "its", "results", "." ]
def run_command(cmd, *args, **kwargs): """Run the given command to completion, and return its results. This provides a simpler interface to the subprocess module. The results are formatted as a 3-tuple: (exit_code, output, errors) The other arguments are passed on to start_command(). """ encod...
[ "def", "run_command", "(", "cmd", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "encoding", "=", "kwargs", ".", "pop", "(", "'encoding'", ",", "None", ")", "process", "=", "start_command", "(", "cmd", ",", "*", "args", ",", "*", "*", "kwargs...
https://github.com/git-cola/git-cola/blob/b48b8028e0c3baf47faf7b074b9773737358163d/cola/core.py#L263-L277
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/celery/utils/collections.py
python
ChainMap.__delitem__
(self, key)
[]
def __delitem__(self, key): # type: (Any) -> None try: del self.changes[self._key(key)] except KeyError: raise KeyError('Key not found in first mapping: {0!r}'.format(key))
[ "def", "__delitem__", "(", "self", ",", "key", ")", ":", "# type: (Any) -> None", "try", ":", "del", "self", ".", "changes", "[", "self", ".", "_key", "(", "key", ")", "]", "except", "KeyError", ":", "raise", "KeyError", "(", "'Key not found in first mapping...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/celery/utils/collections.py#L289-L294
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/xml/dom/minidom.py
python
Node.getUserData
(self, key)
[]
def getUserData(self, key): try: return self._user_data[key][0] except (AttributeError, KeyError): return None
[ "def", "getUserData", "(", "self", ",", "key", ")", ":", "try", ":", "return", "self", ".", "_user_data", "[", "key", "]", "[", "0", "]", "except", "(", "AttributeError", ",", "KeyError", ")", ":", "return", "None" ]
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/xml/dom/minidom.py#L230-L234
openstack/nova
b49b7663e1c3073917d5844b81d38db8e86d05c4
nova/compute/api.py
python
HostAPI.service_get_all
(self, context, filters=None, set_zones=False, all_cells=False, cell_down_support=False)
return ret_services
Returns a list of services, optionally filtering the results. If specified, 'filters' should be a dictionary containing services attributes and matching values. Ie, to get a list of services for the 'compute' topic, use filters={'topic': 'compute'}. If all_cells=True, then scan all ce...
Returns a list of services, optionally filtering the results.
[ "Returns", "a", "list", "of", "services", "optionally", "filtering", "the", "results", "." ]
def service_get_all(self, context, filters=None, set_zones=False, all_cells=False, cell_down_support=False): """Returns a list of services, optionally filtering the results. If specified, 'filters' should be a dictionary containing services attributes and matching values...
[ "def", "service_get_all", "(", "self", ",", "context", ",", "filters", "=", "None", ",", "set_zones", "=", "False", ",", "all_cells", "=", "False", ",", "cell_down_support", "=", "False", ")", ":", "if", "filters", "is", "None", ":", "filters", "=", "{",...
https://github.com/openstack/nova/blob/b49b7663e1c3073917d5844b81d38db8e86d05c4/nova/compute/api.py#L5918-L5977
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/django/contrib/localflavor/in_/forms.py
python
INStateSelect.__init__
(self, attrs=None)
[]
def __init__(self, attrs=None): super(INStateSelect, self).__init__(attrs, choices=STATE_CHOICES)
[ "def", "__init__", "(", "self", ",", "attrs", "=", "None", ")", ":", "super", "(", "INStateSelect", ",", "self", ")", ".", "__init__", "(", "attrs", ",", "choices", "=", "STATE_CHOICES", ")" ]
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/django/contrib/localflavor/in_/forms.py#L88-L89
tensortrade-org/tensortrade
019128713afd37590e3958a56db3ab0a3e6abe4c
tensortrade/feed/api/float/operations.py
python
truediv
(s1: "Stream[float]", s2: "Stream[float]")
return BinOp(np.divide, dtype="float")(s1, s2)
Computes the division of two float streams. Parameters ---------- s1 : `Stream[float]` The first float stream. s2 : `Stream[float]` or float The second float stream. Returns ------- `Stream[float]` A stream created from dividing `s1` by `s2`.
Computes the division of two float streams.
[ "Computes", "the", "division", "of", "two", "float", "streams", "." ]
def truediv(s1: "Stream[float]", s2: "Stream[float]") -> "Stream[float]": """Computes the division of two float streams. Parameters ---------- s1 : `Stream[float]` The first float stream. s2 : `Stream[float]` or float The second float stream. Returns ------- `Stream[flo...
[ "def", "truediv", "(", "s1", ":", "\"Stream[float]\"", ",", "s2", ":", "\"Stream[float]\"", ")", "->", "\"Stream[float]\"", ":", "if", "np", ".", "isscalar", "(", "s2", ")", ":", "s2", "=", "Stream", ".", "constant", "(", "s2", ",", "dtype", "=", "\"fl...
https://github.com/tensortrade-org/tensortrade/blob/019128713afd37590e3958a56db3ab0a3e6abe4c/tensortrade/feed/api/float/operations.py#L140-L158
snarfed/granary
ab085de2aef0cff8ac31a99b5e21443a249e8419
granary/atom.py
python
_prepare_activity
(a, reader=True)
Preprocesses an activity to prepare it to be rendered as Atom. Modifies a in place. Args: a: ActivityStreams 1 activity dict reader: boolean, whether the output will be rendered in a feed reader. Currently just includes location if True, not otherwise.
Preprocesses an activity to prepare it to be rendered as Atom.
[ "Preprocesses", "an", "activity", "to", "prepare", "it", "to", "be", "rendered", "as", "Atom", "." ]
def _prepare_activity(a, reader=True): """Preprocesses an activity to prepare it to be rendered as Atom. Modifies a in place. Args: a: ActivityStreams 1 activity dict reader: boolean, whether the output will be rendered in a feed reader. Currently just includes location if True, not otherwise. "...
[ "def", "_prepare_activity", "(", "a", ",", "reader", "=", "True", ")", ":", "act_type", "=", "source", ".", "object_type", "(", "a", ")", "obj", "=", "util", ".", "get_first", "(", "a", ",", "'object'", ",", "default", "=", "{", "}", ")", "primary", ...
https://github.com/snarfed/granary/blob/ab085de2aef0cff8ac31a99b5e21443a249e8419/granary/atom.py#L339-L429
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/insights/v1/call_summaries.py
python
CallSummariesInstance.call_type
(self)
return self._properties['call_type']
:returns: The call_type :rtype: CallSummariesInstance.CallType
:returns: The call_type :rtype: CallSummariesInstance.CallType
[ ":", "returns", ":", "The", "call_type", ":", "rtype", ":", "CallSummariesInstance", ".", "CallType" ]
def call_type(self): """ :returns: The call_type :rtype: CallSummariesInstance.CallType """ return self._properties['call_type']
[ "def", "call_type", "(", "self", ")", ":", "return", "self", ".", "_properties", "[", "'call_type'", "]" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/insights/v1/call_summaries.py#L393-L398
stoq/stoq
c26991644d1affcf96bc2e0a0434796cabdf8448
stoq/lib/gui/fiscalprinter.py
python
FiscalPrinterHelper.close_till
(self, close_db=True, close_ecf=True)
return retval
Closes the till There are 3 possibilities for parameters combination: * *total close*: Both *close_db* and *close_ecf* are ``True``. The till on both will be closed. * *partial close*: Both *close_db* and *close_ecf* are ``False``. It's more like a till verification....
Closes the till
[ "Closes", "the", "till" ]
def close_till(self, close_db=True, close_ecf=True): """Closes the till There are 3 possibilities for parameters combination: * *total close*: Both *close_db* and *close_ecf* are ``True``. The till on both will be closed. * *partial close*: Both *close_db* and *close_ecf...
[ "def", "close_till", "(", "self", ",", "close_db", "=", "True", ",", "close_ecf", "=", "True", ")", ":", "is_partial", "=", "not", "close_db", "and", "not", "close_ecf", "manager", "=", "get_plugin_manager", "(", ")", "# This behavior is only because of ECF", "i...
https://github.com/stoq/stoq/blob/c26991644d1affcf96bc2e0a0434796cabdf8448/stoq/lib/gui/fiscalprinter.py#L140-L198
intake/intake
bc1d43524f9f0c38ccc5285d1f3fa02c37339372
intake/utils.py
python
yaml_load
(stream)
Parse YAML in a context where duplicate keys raise exception
Parse YAML in a context where duplicate keys raise exception
[ "Parse", "YAML", "in", "a", "context", "where", "duplicate", "keys", "raise", "exception" ]
def yaml_load(stream): """Parse YAML in a context where duplicate keys raise exception""" with no_duplicate_yaml(): return yaml.safe_load(stream)
[ "def", "yaml_load", "(", "stream", ")", ":", "with", "no_duplicate_yaml", "(", ")", ":", "return", "yaml", ".", "safe_load", "(", "stream", ")" ]
https://github.com/intake/intake/blob/bc1d43524f9f0c38ccc5285d1f3fa02c37339372/intake/utils.py#L75-L78
wndhydrnt/python-oauth2
d1f75e321bac049291925b9ee345bf4218f5b7a9
oauth2/store/memory.py
python
TokenStore.delete_code
(self, code)
Deletes an authorization code after use :param code: The authorization code.
Deletes an authorization code after use :param code: The authorization code.
[ "Deletes", "an", "authorization", "code", "after", "use", ":", "param", "code", ":", "The", "authorization", "code", "." ]
def delete_code(self, code): """ Deletes an authorization code after use :param code: The authorization code. """ if code in self.auth_codes: del self.auth_codes[code]
[ "def", "delete_code", "(", "self", ",", "code", ")", ":", "if", "code", "in", "self", ".", "auth_codes", ":", "del", "self", ".", "auth_codes", "[", "code", "]" ]
https://github.com/wndhydrnt/python-oauth2/blob/d1f75e321bac049291925b9ee345bf4218f5b7a9/oauth2/store/memory.py#L115-L121
wwqgtxx/wwqLyParse
33136508e52821babd9294fdecffbdf02d73a6fc
wwqLyParse/lib/python-3.7.2-embed-win32/Crypto/Math/Primality.py
python
lucas_test
(candidate)
return COMPOSITE
Perform a Lucas primality test on an integer. The test is specified in Section C.3.3 of `FIPS PUB 186-4`__. :Parameters: candidate : integer The number to test for primality. :Returns: ``Primality.COMPOSITE`` or ``Primality.PROBABLY_PRIME``. .. __: http://nvlpubs.nist.gov/nistpub...
Perform a Lucas primality test on an integer.
[ "Perform", "a", "Lucas", "primality", "test", "on", "an", "integer", "." ]
def lucas_test(candidate): """Perform a Lucas primality test on an integer. The test is specified in Section C.3.3 of `FIPS PUB 186-4`__. :Parameters: candidate : integer The number to test for primality. :Returns: ``Primality.COMPOSITE`` or ``Primality.PROBABLY_PRIME``. .. _...
[ "def", "lucas_test", "(", "candidate", ")", ":", "if", "not", "isinstance", "(", "candidate", ",", "Integer", ")", ":", "candidate", "=", "Integer", "(", "candidate", ")", "# Step 1", "if", "candidate", "in", "(", "1", ",", "2", ",", "3", ",", "5", "...
https://github.com/wwqgtxx/wwqLyParse/blob/33136508e52821babd9294fdecffbdf02d73a6fc/wwqLyParse/lib/python-3.7.2-embed-win32/Crypto/Math/Primality.py#L116-L210
blinktrade/bitex
a4896e7faef9c4aa0ca5325f18b77db67003764e
apps/mailer/mandrill.py
python
Tags.all_time_series
(self, )
return self.master.call('tags/all-time-series', _params)
Return the recent history (hourly stats for the last 30 days) for all tags Returns: array. the array of history information:: [] (struct): the stats for a single hour:: [].time (string): the hour as a UTC date string in YYYY-MM-DD HH:MM:SS format ...
Return the recent history (hourly stats for the last 30 days) for all tags
[ "Return", "the", "recent", "history", "(", "hourly", "stats", "for", "the", "last", "30", "days", ")", "for", "all", "tags" ]
def all_time_series(self, ): """Return the recent history (hourly stats for the last 30 days) for all tags Returns: array. the array of history information:: [] (struct): the stats for a single hour:: [].time (string): the hour as a UTC date string in YYYY-...
[ "def", "all_time_series", "(", "self", ",", ")", ":", "_params", "=", "{", "}", "return", "self", ".", "master", ".", "call", "(", "'tags/all-time-series'", ",", "_params", ")" ]
https://github.com/blinktrade/bitex/blob/a4896e7faef9c4aa0ca5325f18b77db67003764e/apps/mailer/mandrill.py#L1263-L1287
pandas-dev/pandas
5ba7d714014ae8feaccc0dd4a98890828cf2832d
pandas/core/computation/pytables.py
python
FilterBinOp.format
(self)
return [self.filter]
return the actual filter format
return the actual filter format
[ "return", "the", "actual", "filter", "format" ]
def format(self): """return the actual filter format""" return [self.filter]
[ "def", "format", "(", "self", ")", ":", "return", "[", "self", ".", "filter", "]" ]
https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/core/computation/pytables.py#L283-L285
numba/numba
bf480b9e0da858a65508c2b17759a72ee6a44c51
numba/core/pythonapi.py
python
PythonAPI.dict_new
(self, presize=0)
[]
def dict_new(self, presize=0): if presize == 0: fnty = Type.function(self.pyobj, ()) fn = self._get_function(fnty, name="PyDict_New") return self.builder.call(fn, ()) else: fnty = Type.function(self.pyobj, [self.py_ssize_t]) fn = self._get_func...
[ "def", "dict_new", "(", "self", ",", "presize", "=", "0", ")", ":", "if", "presize", "==", "0", ":", "fnty", "=", "Type", ".", "function", "(", "self", ".", "pyobj", ",", "(", ")", ")", "fn", "=", "self", ".", "_get_function", "(", "fnty", ",", ...
https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/core/pythonapi.py#L426-L435
ldx/python-iptables
542efdb739b4e3ef6f28274d23b506bf0027eec2
iptc/easy.py
python
get_rule
(table, chain, position=0, ipv6=False, raise_exc=True)
Get a rule from a chain in a given position. 0=all rules, 1=first, n=nth position
Get a rule from a chain in a given position. 0=all rules, 1=first, n=nth position
[ "Get", "a", "rule", "from", "a", "chain", "in", "a", "given", "position", ".", "0", "=", "all", "rules", "1", "=", "first", "n", "=", "nth", "position" ]
def get_rule(table, chain, position=0, ipv6=False, raise_exc=True): """ Get a rule from a chain in a given position. 0=all rules, 1=first, n=nth position """ try: if position == 0: # Return all rules return dump_chain(table, chain, ipv6) elif position > 0: # R...
[ "def", "get_rule", "(", "table", ",", "chain", ",", "position", "=", "0", ",", "ipv6", "=", "False", ",", "raise_exc", "=", "True", ")", ":", "try", ":", "if", "position", "==", "0", ":", "# Return all rules", "return", "dump_chain", "(", "table", ",",...
https://github.com/ldx/python-iptables/blob/542efdb739b4e3ef6f28274d23b506bf0027eec2/iptc/easy.py#L120-L137
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/core.py
python
State.name
(self)
return self.attributes.get(ATTR_FRIENDLY_NAME) or self.object_id.replace( "_", " " )
Name of this state.
Name of this state.
[ "Name", "of", "this", "state", "." ]
def name(self) -> str: """Name of this state.""" return self.attributes.get(ATTR_FRIENDLY_NAME) or self.object_id.replace( "_", " " )
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "self", ".", "attributes", ".", "get", "(", "ATTR_FRIENDLY_NAME", ")", "or", "self", ".", "object_id", ".", "replace", "(", "\"_\"", ",", "\" \"", ")" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/core.py#L1060-L1064
pallets/werkzeug
9efe8c00dcb2b6fc086961ba304729db01912652
src/werkzeug/routing.py
python
Rule.get_empty_kwargs
(self)
return dict( defaults=defaults, subdomain=self.subdomain, methods=self.methods, build_only=self.build_only, endpoint=self.endpoint, strict_slashes=self.strict_slashes, redirect_to=self.redirect_to, alias=self.alias, ...
Provides kwargs for instantiating empty copy with empty() Use this method to provide custom keyword arguments to the subclass of ``Rule`` when calling ``some_rule.empty()``. Helpful when the subclass has custom keyword arguments that are needed at instantiation. Must return a ``dict``...
Provides kwargs for instantiating empty copy with empty()
[ "Provides", "kwargs", "for", "instantiating", "empty", "copy", "with", "empty", "()" ]
def get_empty_kwargs(self) -> t.Mapping[str, t.Any]: """ Provides kwargs for instantiating empty copy with empty() Use this method to provide custom keyword arguments to the subclass of ``Rule`` when calling ``some_rule.empty()``. Helpful when the subclass has custom keyword ar...
[ "def", "get_empty_kwargs", "(", "self", ")", "->", "t", ".", "Mapping", "[", "str", ",", "t", ".", "Any", "]", ":", "defaults", "=", "None", "if", "self", ".", "defaults", ":", "defaults", "=", "dict", "(", "self", ".", "defaults", ")", "return", "...
https://github.com/pallets/werkzeug/blob/9efe8c00dcb2b6fc086961ba304729db01912652/src/werkzeug/routing.py#L747-L772
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/cinder/cinder/volume/drivers/emc/emc_smis_iscsi.py
python
EMCSMISISCSIDriver.create_volume_from_snapshot
(self, volume, snapshot)
Creates a volume from a snapshot.
Creates a volume from a snapshot.
[ "Creates", "a", "volume", "from", "a", "snapshot", "." ]
def create_volume_from_snapshot(self, volume, snapshot): """Creates a volume from a snapshot.""" self.common.create_volume_from_snapshot(volume, snapshot)
[ "def", "create_volume_from_snapshot", "(", "self", ",", "volume", ",", "snapshot", ")", ":", "self", ".", "common", ".", "create_volume_from_snapshot", "(", "volume", ",", "snapshot", ")" ]
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/cinder/cinder/volume/drivers/emc/emc_smis_iscsi.py#L55-L57
natashamjaques/neural_chat
ddb977bb4602a67c460d02231e7bbf7b2cb49a97
ParlAI/parlai/core/worlds.py
python
BatchWorld.display
(self)
return s
Display the full batch.
Display the full batch.
[ "Display", "the", "full", "batch", "." ]
def display(self): """Display the full batch.""" s = "[--batchsize " + str(len(self.worlds)) + "--]\n" for i, w in enumerate(self.worlds): s += "[batch world " + str(i) + ":]\n" s += w.display() + '\n' s += "[--end of batch--]" return s
[ "def", "display", "(", "self", ")", ":", "s", "=", "\"[--batchsize \"", "+", "str", "(", "len", "(", "self", ".", "worlds", ")", ")", "+", "\"--]\\n\"", "for", "i", ",", "w", "in", "enumerate", "(", "self", ".", "worlds", ")", ":", "s", "+=", "\"...
https://github.com/natashamjaques/neural_chat/blob/ddb977bb4602a67c460d02231e7bbf7b2cb49a97/ParlAI/parlai/core/worlds.py#L750-L757
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/tkinter/ttk.py
python
Treeview.parent
(self, item)
return self.tk.call(self._w, "parent", item)
Returns the ID of the parent of item, or '' if item is at the top level of the hierarchy.
Returns the ID of the parent of item, or '' if item is at the top level of the hierarchy.
[ "Returns", "the", "ID", "of", "the", "parent", "of", "item", "or", "if", "item", "is", "at", "the", "top", "level", "of", "the", "hierarchy", "." ]
def parent(self, item): """Returns the ID of the parent of item, or '' if item is at the top level of the hierarchy.""" return self.tk.call(self._w, "parent", item)
[ "def", "parent", "(", "self", ",", "item", ")", ":", "return", "self", ".", "tk", ".", "call", "(", "self", ".", "_w", ",", "\"parent\"", ",", "item", ")" ]
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/tkinter/ttk.py#L1372-L1375
IBM/lale
b4d6829c143a4735b06083a0e6c70d2cca244162
lale/operators.py
python
TrainedOperator.__rshift__
(self, other: Union[Any, "Operator"])
[]
def __rshift__(self, other: Union[Any, "Operator"]) -> "PlannedPipeline": ...
[ "def", "__rshift__", "(", "self", ",", "other", ":", "Union", "[", "Any", ",", "\"Operator\"", "]", ")", "->", "\"PlannedPipeline\"", ":", "..." ]
https://github.com/IBM/lale/blob/b4d6829c143a4735b06083a0e6c70d2cca244162/lale/operators.py#L1054-L1055
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/min/pty.py
python
slave_open
(tty_name)
return result
slave_open(tty_name) -> slave_fd Open the pty slave and acquire the controlling terminal, returning opened filedescriptor. Deprecated, use openpty() instead.
slave_open(tty_name) -> slave_fd Open the pty slave and acquire the controlling terminal, returning opened filedescriptor. Deprecated, use openpty() instead.
[ "slave_open", "(", "tty_name", ")", "-", ">", "slave_fd", "Open", "the", "pty", "slave", "and", "acquire", "the", "controlling", "terminal", "returning", "opened", "filedescriptor", ".", "Deprecated", "use", "openpty", "()", "instead", "." ]
def slave_open(tty_name): """slave_open(tty_name) -> slave_fd Open the pty slave and acquire the controlling terminal, returning opened filedescriptor. Deprecated, use openpty() instead.""" result = os.open(tty_name, os.O_RDWR) try: from fcntl import ioctl, I_PUSH except ImportError...
[ "def", "slave_open", "(", "tty_name", ")", ":", "result", "=", "os", ".", "open", "(", "tty_name", ",", "os", ".", "O_RDWR", ")", "try", ":", "from", "fcntl", "import", "ioctl", ",", "I_PUSH", "except", "ImportError", ":", "return", "result", "try", ":...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/pty.py#L66-L82
jobovy/galpy
8e6a230bbe24ce16938db10053f92eb17fe4bb52
galpy/potential/MovingObjectPotential.py
python
MovingObjectPotential._phiforce
(self,R,z,phi=0.,t=0.)
return -RF*R*(numpy.cos(phi)*yd-numpy.sin(phi)*xd)/Rdist
NAME: _phiforce PURPOSE: evaluate the azimuthal force for this potential INPUT: R - Galactocentric cylindrical radius z - vertical height phi - azimuth t - time OUTPUT: the azimuthal force HISTORY: 20...
NAME: _phiforce PURPOSE: evaluate the azimuthal force for this potential INPUT: R - Galactocentric cylindrical radius z - vertical height phi - azimuth t - time OUTPUT: the azimuthal force HISTORY: 20...
[ "NAME", ":", "_phiforce", "PURPOSE", ":", "evaluate", "the", "azimuthal", "force", "for", "this", "potential", "INPUT", ":", "R", "-", "Galactocentric", "cylindrical", "radius", "z", "-", "vertical", "height", "phi", "-", "azimuth", "t", "-", "time", "OUTPUT...
def _phiforce(self,R,z,phi=0.,t=0.): """ NAME: _phiforce PURPOSE: evaluate the azimuthal force for this potential INPUT: R - Galactocentric cylindrical radius z - vertical height phi - azimuth t - time OUTPUT: ...
[ "def", "_phiforce", "(", "self", ",", "R", ",", "z", ",", "phi", "=", "0.", ",", "t", "=", "0.", ")", ":", "#Cylindrical distance", "Rdist", "=", "_cylR", "(", "R", ",", "phi", ",", "self", ".", "_orb", ".", "R", "(", "t", ")", ",", "self", "...
https://github.com/jobovy/galpy/blob/8e6a230bbe24ce16938db10053f92eb17fe4bb52/galpy/potential/MovingObjectPotential.py#L143-L169
dbrattli/aioreactive
e057264a5905964c68d443b98b3e602279b3b9ed
aioreactive/create.py
python
empty
()
return AsyncAnonymousObservable(subscribe_async)
Returns an observable sequence with no elements.
Returns an observable sequence with no elements.
[ "Returns", "an", "observable", "sequence", "with", "no", "elements", "." ]
def empty() -> AsyncObservable[Any]: """Returns an observable sequence with no elements.""" async def subscribe_async(aobv: AsyncObserver[Any]) -> AsyncDisposable: await aobv.aclose() return AsyncDisposable.empty() return AsyncAnonymousObservable(subscribe_async)
[ "def", "empty", "(", ")", "->", "AsyncObservable", "[", "Any", "]", ":", "async", "def", "subscribe_async", "(", "aobv", ":", "AsyncObserver", "[", "Any", "]", ")", "->", "AsyncDisposable", ":", "await", "aobv", ".", "aclose", "(", ")", "return", "AsyncD...
https://github.com/dbrattli/aioreactive/blob/e057264a5905964c68d443b98b3e602279b3b9ed/aioreactive/create.py#L115-L122
ifwe/digsby
f5fe00244744aa131e07f09348d10563f3d8fa99
digsby/src/plugins/feed_trends/feed_trends.py
python
OneRiotAdSource.request_ads
(self, success, error=None)
requests a set of ads from oneriot
requests a set of ads from oneriot
[ "requests", "a", "set", "of", "ads", "from", "oneriot" ]
def request_ads(self, success, error=None): '''requests a set of ads from oneriot''' def on_success(req, resp): try: data = resp.read() ads = NewsItemList.from_xml(data, filter_html=True) log.info('got %d ads', len(ads) if ads else 0) ...
[ "def", "request_ads", "(", "self", ",", "success", ",", "error", "=", "None", ")", ":", "def", "on_success", "(", "req", ",", "resp", ")", ":", "try", ":", "data", "=", "resp", ".", "read", "(", ")", "ads", "=", "NewsItemList", ".", "from_xml", "("...
https://github.com/ifwe/digsby/blob/f5fe00244744aa131e07f09348d10563f3d8fa99/digsby/src/plugins/feed_trends/feed_trends.py#L910-L928
alberanid/imdbpy
88cf37772186e275eff212857f512669086b382c
imdb/helpers.py
python
makeObject2Txt
(movieTxt=None, personTxt=None, characterTxt=None, companyTxt=None, joiner=' / ', applyToValues=lambda x: x, _recurse=True)
return object2txt
Return a function useful to pretty-print Movie, Person, Character and Company instances. *movieTxt* -- how to format a Movie object. *personTxt* -- how to format a Person object. *characterTxt* -- how to format a Character object. *companyTxt* -- how to format a Company object. *joiner* -- stri...
Return a function useful to pretty-print Movie, Person, Character and Company instances.
[ "Return", "a", "function", "useful", "to", "pretty", "-", "print", "Movie", "Person", "Character", "and", "Company", "instances", "." ]
def makeObject2Txt(movieTxt=None, personTxt=None, characterTxt=None, companyTxt=None, joiner=' / ', applyToValues=lambda x: x, _recurse=True): """"Return a function useful to pretty-print Movie, Person, Character and Company instances. *movieTxt* -- how to format a Mov...
[ "def", "makeObject2Txt", "(", "movieTxt", "=", "None", ",", "personTxt", "=", "None", ",", "characterTxt", "=", "None", ",", "companyTxt", "=", "None", ",", "joiner", "=", "' / '", ",", "applyToValues", "=", "lambda", "x", ":", "x", ",", "_recurse", "=",...
https://github.com/alberanid/imdbpy/blob/88cf37772186e275eff212857f512669086b382c/imdb/helpers.py#L118-L202
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Lib/plat-mac/aetools.py
python
TalkTo.__init__
(self, signature=None, start=0, timeout=0)
Create a communication channel with a particular application. Addressing the application is done by specifying either a 4-byte signature, an AEDesc or an object that will __aepack__ to an AEDesc.
Create a communication channel with a particular application.
[ "Create", "a", "communication", "channel", "with", "a", "particular", "application", "." ]
def __init__(self, signature=None, start=0, timeout=0): """Create a communication channel with a particular application. Addressing the application is done by specifying either a 4-byte signature, an AEDesc or an object that will __aepack__ to an AEDesc. """ self.target_...
[ "def", "__init__", "(", "self", ",", "signature", "=", "None", ",", "start", "=", "0", ",", "timeout", "=", "0", ")", ":", "self", ".", "target_signature", "=", "None", "if", "signature", "is", "None", ":", "signature", "=", "self", ".", "_signature", ...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/plat-mac/aetools.py#L163-L189
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.py
python
decode
(input, fallback_encoding, errors='replace')
return encoding.codec_info.decode(input, errors)[0], encoding
Decode a single string. :param input: A byte string :param fallback_encoding: An :class:`Encoding` object or a label string. The encoding to use if :obj:`input` does note have a BOM. :param errors: Type of error handling. See :func:`codecs.register`. :raises: :exc:`~exceptions.LookupErr...
Decode a single string.
[ "Decode", "a", "single", "string", "." ]
def decode(input, fallback_encoding, errors='replace'): """ Decode a single string. :param input: A byte string :param fallback_encoding: An :class:`Encoding` object or a label string. The encoding to use if :obj:`input` does note have a BOM. :param errors: Type of error handling. S...
[ "def", "decode", "(", "input", ",", "fallback_encoding", ",", "errors", "=", "'replace'", ")", ":", "# Fail early if `encoding` is an invalid label.", "fallback_encoding", "=", "_get_encoding", "(", "fallback_encoding", ")", "bom_encoding", ",", "input", "=", "_detect_b...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pip/_vendor/webencodings/__init__.py#L139-L158
kanzure/nanoengineer
874e4c9f8a9190f093625b267f9767e19f82e6c4
cad/src/ne1_ui/MWsemantics.py
python
MWsemantics._init_after_geometry_is_set
(self)
return
Do whatever initialization of self needs to wait until its geometry has been set. [Should be called only once, after geometry is set; can be called before self is shown. As of 070531, this is called directly from main.py, after our __init__ but before we're first shown.]
Do whatever initialization of self needs to wait until its geometry has been set. [Should be called only once, after geometry is set; can be called before self is shown. As of 070531, this is called directly from main.py, after our __init__ but before we're first shown.]
[ "Do", "whatever", "initialization", "of", "self", "needs", "to", "wait", "until", "its", "geometry", "has", "been", "set", ".", "[", "Should", "be", "called", "only", "once", "after", "geometry", "is", "set", ";", "can", "be", "called", "before", "self", ...
def _init_after_geometry_is_set(self): #bruce 060104 renamed this from startRun and replaced its docstring. """ Do whatever initialization of self needs to wait until its geometry has been set. [Should be called only once, after geometry is set; can be called before self is shown. As of...
[ "def", "_init_after_geometry_is_set", "(", "self", ")", ":", "#bruce 060104 renamed this from startRun and replaced its docstring.", "# older docstring:", "# After the main window(its size and location) has been setup, begin to run the program from this method.", "# [Huaicai 11/1/05: try to fix th...
https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/ne1_ui/MWsemantics.py#L628-L640
cool-RR/python_toolbox
cb9ef64b48f1d03275484d707dc5079b6701ad0c
python_toolbox/third_party/envelopes/envelope.py
python
Envelope.clear_headers
(self)
Clears custom headers.
Clears custom headers.
[ "Clears", "custom", "headers", "." ]
def clear_headers(self): """Clears custom headers.""" self._headers = {}
[ "def", "clear_headers", "(", "self", ")", ":", "self", ".", "_headers", "=", "{", "}" ]
https://github.com/cool-RR/python_toolbox/blob/cb9ef64b48f1d03275484d707dc5079b6701ad0c/python_toolbox/third_party/envelopes/envelope.py#L225-L227
tao12345666333/tornado-zh
e9e8519beb147d9e1290f6a4fa7d61123d1ecb1c
tornado/iostream.py
python
BaseIOStream.write_to_fd
(self, data)
Attempts to write ``data`` to the underlying file. Returns the number of bytes written.
Attempts to write ``data`` to the underlying file.
[ "Attempts", "to", "write", "data", "to", "the", "underlying", "file", "." ]
def write_to_fd(self, data): """Attempts to write ``data`` to the underlying file. Returns the number of bytes written. """ raise NotImplementedError()
[ "def", "write_to_fd", "(", "self", ",", "data", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/tao12345666333/tornado-zh/blob/e9e8519beb147d9e1290f6a4fa7d61123d1ecb1c/tornado/iostream.py#L202-L207
google/tangent
6533e83af09de7345d1b438512679992f080dcc9
tangent/funcsigs.py
python
Signature.replace
(self, parameters=_void, return_annotation=_void)
return type(self)(parameters, return_annotation=return_annotation)
Creates a customized copy of the Signature. Pass 'parameters' and/or 'return_annotation' arguments to override them in the new copy.
Creates a customized copy of the Signature. Pass 'parameters' and/or 'return_annotation' arguments to override them in the new copy.
[ "Creates", "a", "customized", "copy", "of", "the", "Signature", ".", "Pass", "parameters", "and", "/", "or", "return_annotation", "arguments", "to", "override", "them", "in", "the", "new", "copy", "." ]
def replace(self, parameters=_void, return_annotation=_void): '''Creates a customized copy of the Signature. Pass 'parameters' and/or 'return_annotation' arguments to override them in the new copy. ''' if parameters is _void: parameters = self.parameters.values() if return_annotation is ...
[ "def", "replace", "(", "self", ",", "parameters", "=", "_void", ",", "return_annotation", "=", "_void", ")", ":", "if", "parameters", "is", "_void", ":", "parameters", "=", "self", ".", "parameters", ".", "values", "(", ")", "if", "return_annotation", "is"...
https://github.com/google/tangent/blob/6533e83af09de7345d1b438512679992f080dcc9/tangent/funcsigs.py#L626-L639
shiweibsw/Translation-Tools
2fbbf902364e557fa7017f9a74a8797b7440c077
venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/html5lib/treebuilders/base.py
python
TreeBuilder.insertElementTable
(self, token)
return element
Create an element and insert it into the tree
Create an element and insert it into the tree
[ "Create", "an", "element", "and", "insert", "it", "into", "the", "tree" ]
def insertElementTable(self, token): """Create an element and insert it into the tree""" element = self.createElement(token) if self.openElements[-1].name not in tableInsertModeElements: return self.insertElementNormal(token) else: # We should be in the InTable mo...
[ "def", "insertElementTable", "(", "self", ",", "token", ")", ":", "element", "=", "self", ".", "createElement", "(", "token", ")", "if", "self", ".", "openElements", "[", "-", "1", "]", ".", "name", "not", "in", "tableInsertModeElements", ":", "return", ...
https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/html5lib/treebuilders/base.py#L302-L316
jachris/cook
dd451e11f9aef05ba54bd57cf03e941526ffceef
cook/misc.py
python
run
( command, outputs, inputs=None, message=None, env=None, timeout=None, cwd=None )
[]
def run( command, outputs, inputs=None, message=None, env=None, timeout=None, cwd=None ): inputs = core.resolve(inputs or []) outputs = core.build(outputs) command[0] = core.which(command[0]) yield core.publish( inputs=inputs + [command[0]], outputs=outputs, message=mess...
[ "def", "run", "(", "command", ",", "outputs", ",", "inputs", "=", "None", ",", "message", "=", "None", ",", "env", "=", "None", ",", "timeout", "=", "None", ",", "cwd", "=", "None", ")", ":", "inputs", "=", "core", ".", "resolve", "(", "inputs", ...
https://github.com/jachris/cook/blob/dd451e11f9aef05ba54bd57cf03e941526ffceef/cook/misc.py#L5-L28
aparo/django-elasticsearch
8fd25bd86b58cfc0d6490cfac08e4846ab4ddf97
django_elasticsearch/manager.py
python
QuerySet.exec_js
(self, code, *fields, **options)
return collection.database.eval(code, *fields)
Execute a Javascript function on the server. A list of fields may be provided, which will be translated to their correct names and supplied as the arguments to the function. A few extra variables are added to the function's scope: ``collection``, which is the name of the collection in us...
Execute a Javascript function on the server. A list of fields may be provided, which will be translated to their correct names and supplied as the arguments to the function. A few extra variables are added to the function's scope: ``collection``, which is the name of the collection in us...
[ "Execute", "a", "Javascript", "function", "on", "the", "server", ".", "A", "list", "of", "fields", "may", "be", "provided", "which", "will", "be", "translated", "to", "their", "correct", "names", "and", "supplied", "as", "the", "arguments", "to", "the", "f...
def exec_js(self, code, *fields, **options): """ Execute a Javascript function on the server. A list of fields may be provided, which will be translated to their correct names and supplied as the arguments to the function. A few extra variables are added to the function's scope: ...
[ "def", "exec_js", "(", "self", ",", "code", ",", "*", "fields", ",", "*", "*", "options", ")", ":", "# code = self._sub_js_fields(code)", "fields", "=", "[", "QuerySet", ".", "_translate_field_name", "(", "self", ".", "_document", ",", "f", ")", "for"...
https://github.com/aparo/django-elasticsearch/blob/8fd25bd86b58cfc0d6490cfac08e4846ab4ddf97/django_elasticsearch/manager.py#L727-L767
XX-net/XX-Net
a9898cfcf0084195fb7e69b6bc834e59aecdf14f
python3.8.2/Lib/distutils/cmd.py
python
Command.get_sub_commands
(self)
return commands
Determine the sub-commands that are relevant in the current distribution (ie., that need to be run). This is based on the 'sub_commands' class attribute: each tuple in that list may include a method that we call to determine if the subcommand needs to be run for the current distribution...
Determine the sub-commands that are relevant in the current distribution (ie., that need to be run). This is based on the 'sub_commands' class attribute: each tuple in that list may include a method that we call to determine if the subcommand needs to be run for the current distribution...
[ "Determine", "the", "sub", "-", "commands", "that", "are", "relevant", "in", "the", "current", "distribution", "(", "ie", ".", "that", "need", "to", "be", "run", ")", ".", "This", "is", "based", "on", "the", "sub_commands", "class", "attribute", ":", "ea...
def get_sub_commands(self): """Determine the sub-commands that are relevant in the current distribution (ie., that need to be run). This is based on the 'sub_commands' class attribute: each tuple in that list may include a method that we call to determine if the subcommand needs to be ...
[ "def", "get_sub_commands", "(", "self", ")", ":", "commands", "=", "[", "]", "for", "(", "cmd_name", ",", "method", ")", "in", "self", ".", "sub_commands", ":", "if", "method", "is", "None", "or", "method", "(", "self", ")", ":", "commands", ".", "ap...
https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/distutils/cmd.py#L315-L326
CalebBell/thermo
572a47d1b03d49fe609b8d5f826fa6a7cde00828
thermo/utils/tp_dependent_property.py
python
TPDependentProperty.test_method_validity_P
(self, T, P, method)
return validity
r'''Method to test the validity of a specified method for a given temperature. Demo function for testing only; must be implemented according to the methods available for each individual method. Include the interpolation check here. Parameters ---------- T : float ...
r'''Method to test the validity of a specified method for a given temperature. Demo function for testing only; must be implemented according to the methods available for each individual method. Include the interpolation check here.
[ "r", "Method", "to", "test", "the", "validity", "of", "a", "specified", "method", "for", "a", "given", "temperature", ".", "Demo", "function", "for", "testing", "only", ";", "must", "be", "implemented", "according", "to", "the", "methods", "available", "for"...
def test_method_validity_P(self, T, P, method): r'''Method to test the validity of a specified method for a given temperature. Demo function for testing only; must be implemented according to the methods available for each individual method. Include the interpolation check here. ...
[ "def", "test_method_validity_P", "(", "self", ",", "T", ",", "P", ",", "method", ")", ":", "if", "method", "in", "self", ".", "tabular_data_P", ":", "if", "self", ".", "tabular_extrapolation_permitted", ":", "validity", "=", "True", "else", ":", "Ts", ",",...
https://github.com/CalebBell/thermo/blob/572a47d1b03d49fe609b8d5f826fa6a7cde00828/thermo/utils/tp_dependent_property.py#L322-L353
OpenEndedGroup/Field
4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c
Contents/lib/python/tokenize.py
python
tokenize
(readline, tokeneater=printtoken)
The tokenize() function accepts two parameters: one representing the input stream, and one providing an output mechanism for tokenize(). The first parameter, readline, must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the functio...
The tokenize() function accepts two parameters: one representing the input stream, and one providing an output mechanism for tokenize().
[ "The", "tokenize", "()", "function", "accepts", "two", "parameters", ":", "one", "representing", "the", "input", "stream", "and", "one", "providing", "an", "output", "mechanism", "for", "tokenize", "()", "." ]
def tokenize(readline, tokeneater=printtoken): """ The tokenize() function accepts two parameters: one representing the input stream, and one providing an output mechanism for tokenize(). The first parameter, readline, must be a callable object which provides the same interface as the readline() me...
[ "def", "tokenize", "(", "readline", ",", "tokeneater", "=", "printtoken", ")", ":", "try", ":", "tokenize_loop", "(", "readline", ",", "tokeneater", ")", "except", "StopTokenizing", ":", "pass" ]
https://github.com/OpenEndedGroup/Field/blob/4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c/Contents/lib/python/tokenize.py#L139-L155
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit - MAC OSX/tools/inject/lib/core/common.py
python
findDynamicContent
(firstPage, secondPage)
This function checks if the provided pages have dynamic content. If they are dynamic, proper markings will be made
This function checks if the provided pages have dynamic content. If they are dynamic, proper markings will be made
[ "This", "function", "checks", "if", "the", "provided", "pages", "have", "dynamic", "content", ".", "If", "they", "are", "dynamic", "proper", "markings", "will", "be", "made" ]
def findDynamicContent(firstPage, secondPage): """ This function checks if the provided pages have dynamic content. If they are dynamic, proper markings will be made """ if not firstPage or not secondPage: return infoMsg = "searching for dynamic content" logger.info(infoMsg) b...
[ "def", "findDynamicContent", "(", "firstPage", ",", "secondPage", ")", ":", "if", "not", "firstPage", "or", "not", "secondPage", ":", "return", "infoMsg", "=", "\"searching for dynamic content\"", "logger", ".", "info", "(", "infoMsg", ")", "blocks", "=", "Seque...
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/inject/lib/core/common.py#L2564-L2608
F8LEFT/DecLLVM
d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c
python/idaapi.py
python
idainfo.__init__
(self, *args)
__init__(self) -> idainfo
__init__(self) -> idainfo
[ "__init__", "(", "self", ")", "-", ">", "idainfo" ]
def __init__(self, *args): """ __init__(self) -> idainfo """ this = _idaapi.new_idainfo(*args) try: self.this.append(this) except: self.this = this
[ "def", "__init__", "(", "self", ",", "*", "args", ")", ":", "this", "=", "_idaapi", ".", "new_idainfo", "(", "*", "args", ")", "try", ":", "self", ".", "this", ".", "append", "(", "this", ")", "except", ":", "self", ".", "this", "=", "this" ]
https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L2803-L2809
GoogleCloudPlatform/professional-services
0c707aa97437f3d154035ef8548109b7882f71da
tools/quota-monitoring-alerting/python/main.py
python
metrics_save
()
return save_metrics(request)
Endpoint to recieve metric save request(s).
Endpoint to recieve metric save request(s).
[ "Endpoint", "to", "recieve", "metric", "save", "request", "(", "s", ")", "." ]
def metrics_save(): """Endpoint to recieve metric save request(s).""" return save_metrics(request)
[ "def", "metrics_save", "(", ")", ":", "return", "save_metrics", "(", "request", ")" ]
https://github.com/GoogleCloudPlatform/professional-services/blob/0c707aa97437f3d154035ef8548109b7882f71da/tools/quota-monitoring-alerting/python/main.py#L125-L127
PaddlePaddle/PaddleHub
107ee7e1a49d15e9c94da3956475d88a53fc165f
modules/text/language_model/lda_novel/model.py
python
TopicModel.word_topic_value
(self, word_id, topic_id)
return word_dict[topic_id]
Return value of specific word under specific topic in the model.
Return value of specific word under specific topic in the model.
[ "Return", "value", "of", "specific", "word", "under", "specific", "topic", "in", "the", "model", "." ]
def word_topic_value(self, word_id, topic_id): """Return value of specific word under specific topic in the model. """ word_dict = self.__word_topic[word_id] if topic_id not in word_dict: return 0 return word_dict[topic_id]
[ "def", "word_topic_value", "(", "self", ",", "word_id", ",", "topic_id", ")", ":", "word_dict", "=", "self", ".", "__word_topic", "[", "word_id", "]", "if", "topic_id", "not", "in", "word_dict", ":", "return", "0", "return", "word_dict", "[", "topic_id", "...
https://github.com/PaddlePaddle/PaddleHub/blob/107ee7e1a49d15e9c94da3956475d88a53fc165f/modules/text/language_model/lda_novel/model.py#L49-L55
openstack/openstacksdk
58384268487fa854f21c470b101641ab382c9897
openstack/placement/v1/_proxy.py
python
Proxy.delete_resource_class
(self, resource_class, ignore_missing=True)
Delete a resource class :param resource_class: The value can be either the ID of a resource class or an :class:`~openstack.placement.v1.resource_class.ResourceClass`, instance. :param bool ignore_missing: When set to ``False`` :class:`~openstack.exception...
Delete a resource class
[ "Delete", "a", "resource", "class" ]
def delete_resource_class(self, resource_class, ignore_missing=True): """Delete a resource class :param resource_class: The value can be either the ID of a resource class or an :class:`~openstack.placement.v1.resource_class.ResourceClass`, instance. :param bo...
[ "def", "delete_resource_class", "(", "self", ",", "resource_class", ",", "ignore_missing", "=", "True", ")", ":", "self", ".", "_delete", "(", "_resource_class", ".", "ResourceClass", ",", "resource_class", ",", "ignore_missing", "=", "ignore_missing", ",", ")" ]
https://github.com/openstack/openstacksdk/blob/58384268487fa854f21c470b101641ab382c9897/openstack/placement/v1/_proxy.py#L34-L53
nickoala/telepot
4bfe4eeb5e48b40e72976ee085a1b0a941ef3cf2
telepot/aio/__init__.py
python
Bot.getStickerSet
(self, name)
return await self._api_request('getStickerSet', _rectify(p))
See: https://core.telegram.org/bots/api#getstickerset
See: https://core.telegram.org/bots/api#getstickerset
[ "See", ":", "https", ":", "//", "core", ".", "telegram", ".", "org", "/", "bots", "/", "api#getstickerset" ]
async def getStickerSet(self, name): """ See: https://core.telegram.org/bots/api#getstickerset """ p = _strip(locals()) return await self._api_request('getStickerSet', _rectify(p))
[ "async", "def", "getStickerSet", "(", "self", ",", "name", ")", ":", "p", "=", "_strip", "(", "locals", "(", ")", ")", "return", "await", "self", ".", "_api_request", "(", "'getStickerSet'", ",", "_rectify", "(", "p", ")", ")" ]
https://github.com/nickoala/telepot/blob/4bfe4eeb5e48b40e72976ee085a1b0a941ef3cf2/telepot/aio/__init__.py#L525-L530
petl-developers/petl
012cc7faf79d2fa8147a2cfe3a8b39b110f77051
petl/transform/unpacks.py
python
unpack
(table, field, newfields=None, include_original=False, missing=None)
return UnpackView(table, field, newfields=newfields, include_original=include_original, missing=missing)
Unpack data values that are lists or tuples. E.g.:: >>> import petl as etl >>> table1 = [['foo', 'bar'], ... [1, ['a', 'b']], ... [2, ['c', 'd']], ... [3, ['e', 'f']]] >>> table2 = etl.unpack(table1, 'bar', ['baz', 'quux']) >>> table...
Unpack data values that are lists or tuples. E.g.::
[ "Unpack", "data", "values", "that", "are", "lists", "or", "tuples", ".", "E", ".", "g", ".", "::" ]
def unpack(table, field, newfields=None, include_original=False, missing=None): """ Unpack data values that are lists or tuples. E.g.:: >>> import petl as etl >>> table1 = [['foo', 'bar'], ... [1, ['a', 'b']], ... [2, ['c', 'd']], ... [3, ['...
[ "def", "unpack", "(", "table", ",", "field", ",", "newfields", "=", "None", ",", "include_original", "=", "False", ",", "missing", "=", "None", ")", ":", "return", "UnpackView", "(", "table", ",", "field", ",", "newfields", "=", "newfields", ",", "includ...
https://github.com/petl-developers/petl/blob/012cc7faf79d2fa8147a2cfe3a8b39b110f77051/petl/transform/unpacks.py#L12-L43
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials
5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e
deep-learning/multi-frameworks/common/utils.py
python
yield_mb_tn
(X, y, batchsize=64, shuffle=False)
Function yields mini-batches for time-series, layout=TN
Function yields mini-batches for time-series, layout=TN
[ "Function", "yields", "mini", "-", "batches", "for", "time", "-", "series", "layout", "=", "TN" ]
def yield_mb_tn(X, y, batchsize=64, shuffle=False): """ Function yields mini-batches for time-series, layout=TN """ if shuffle: X, y = shuffle_data(X, y) # Reshape X = np.swapaxes(X, 0, 1) # Only complete batches are submitted for i in range(X.shape[-1] // batchsize): yield X[......
[ "def", "yield_mb_tn", "(", "X", ",", "y", ",", "batchsize", "=", "64", ",", "shuffle", "=", "False", ")", ":", "if", "shuffle", ":", "X", ",", "y", "=", "shuffle_data", "(", "X", ",", "y", ")", "# Reshape", "X", "=", "np", ".", "swapaxes", "(", ...
https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/deep-learning/multi-frameworks/common/utils.py#L126-L134
aiogram/aiogram
4d2d81138681d730270819579f22b3a0001c43a5
aiogram/types/chat.py
python
ChatActions.upload_photo
(cls, sleep=None)
Do upload_photo :param sleep: sleep timeout :return:
Do upload_photo
[ "Do", "upload_photo" ]
async def upload_photo(cls, sleep=None): """ Do upload_photo :param sleep: sleep timeout :return: """ await cls._do(cls.UPLOAD_PHOTO, sleep)
[ "async", "def", "upload_photo", "(", "cls", ",", "sleep", "=", "None", ")", ":", "await", "cls", ".", "_do", "(", "cls", ".", "UPLOAD_PHOTO", ",", "sleep", ")" ]
https://github.com/aiogram/aiogram/blob/4d2d81138681d730270819579f22b3a0001c43a5/aiogram/types/chat.py#L801-L808
kbandla/dpkt
7a91ae53bb20563607f32e6781ef40d2efe6520d
dpkt/pcapng.py
python
_padded
(s)
return struct_pack('%ss' % _align32b(len(s)), s)
Return bytes `s` padded with zeroes to align to the 32-bit boundary
Return bytes `s` padded with zeroes to align to the 32-bit boundary
[ "Return", "bytes", "s", "padded", "with", "zeroes", "to", "align", "to", "the", "32", "-", "bit", "boundary" ]
def _padded(s): """Return bytes `s` padded with zeroes to align to the 32-bit boundary""" return struct_pack('%ss' % _align32b(len(s)), s)
[ "def", "_padded", "(", "s", ")", ":", "return", "struct_pack", "(", "'%ss'", "%", "_align32b", "(", "len", "(", "s", ")", ")", ",", "s", ")" ]
https://github.com/kbandla/dpkt/blob/7a91ae53bb20563607f32e6781ef40d2efe6520d/dpkt/pcapng.py#L95-L97
barseghyanartur/django-elasticsearch-dsl-drf
8fe35265d44501269b2603570773be47f20fa471
examples/simple/books/models/city.py
python
City.location_field_indexing
(self)
return { 'lat': self.latitude, 'lon': self.longitude, }
Location for indexing. Used in Elasticsearch indexing/tests of `geo_distance` native filter.
Location for indexing.
[ "Location", "for", "indexing", "." ]
def location_field_indexing(self): """Location for indexing. Used in Elasticsearch indexing/tests of `geo_distance` native filter. """ return { 'lat': self.latitude, 'lon': self.longitude, }
[ "def", "location_field_indexing", "(", "self", ")", ":", "return", "{", "'lat'", ":", "self", ".", "latitude", ",", "'lon'", ":", "self", ".", "longitude", ",", "}" ]
https://github.com/barseghyanartur/django-elasticsearch-dsl-drf/blob/8fe35265d44501269b2603570773be47f20fa471/examples/simple/books/models/city.py#L41-L49
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/numpy/lib/type_check.py
python
imag
(val)
return asanyarray(val).imag
Return the imaginary part of the elements of the array. Parameters ---------- val : array_like Input array. Returns ------- out : ndarray Output array. If `val` is real, the type of `val` is used for the output. If `val` has complex elements, the returned type is float...
Return the imaginary part of the elements of the array.
[ "Return", "the", "imaginary", "part", "of", "the", "elements", "of", "the", "array", "." ]
def imag(val): """ Return the imaginary part of the elements of the array. Parameters ---------- val : array_like Input array. Returns ------- out : ndarray Output array. If `val` is real, the type of `val` is used for the output. If `val` has complex elements,...
[ "def", "imag", "(", "val", ")", ":", "return", "asanyarray", "(", "val", ")", ".", "imag" ]
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/numpy/lib/type_check.py#L141-L170
nltk/nltk
3f74ac55681667d7ef78b664557487145f51eb02
nltk/tree/parented.py
python
ParentedTree.parent
(self)
return self._parent
The parent of this tree, or None if it has no parent.
The parent of this tree, or None if it has no parent.
[ "The", "parent", "of", "this", "tree", "or", "None", "if", "it", "has", "no", "parent", "." ]
def parent(self): """The parent of this tree, or None if it has no parent.""" return self._parent
[ "def", "parent", "(", "self", ")", ":", "return", "self", ".", "_parent" ]
https://github.com/nltk/nltk/blob/3f74ac55681667d7ef78b664557487145f51eb02/nltk/tree/parented.py#L325-L327
bjmayor/hacker
e3ce2ad74839c2733b27dac6c0f495e0743e1866
venv/lib/python3.5/site-packages/pkg_resources/__init__.py
python
IResourceProvider.get_resource_string
(manager, resource_name)
Return a string containing the contents of `resource_name` `manager` must be an ``IResourceManager``
Return a string containing the contents of `resource_name`
[ "Return", "a", "string", "containing", "the", "contents", "of", "resource_name" ]
def get_resource_string(manager, resource_name): """Return a string containing the contents of `resource_name` `manager` must be an ``IResourceManager``"""
[ "def", "get_resource_string", "(", "manager", ",", "resource_name", ")", ":" ]
https://github.com/bjmayor/hacker/blob/e3ce2ad74839c2733b27dac6c0f495e0743e1866/venv/lib/python3.5/site-packages/pkg_resources/__init__.py#L614-L617
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/Django/django/contrib/gis/sitemaps/kml.py
python
KMLSitemap.get_urls
(self, page=1, site=None)
return urls
This method is overrridden so the appropriate `geo_format` attribute is placed on each URL element.
This method is overrridden so the appropriate `geo_format` attribute is placed on each URL element.
[ "This", "method", "is", "overrridden", "so", "the", "appropriate", "geo_format", "attribute", "is", "placed", "on", "each", "URL", "element", "." ]
def get_urls(self, page=1, site=None): """ This method is overrridden so the appropriate `geo_format` attribute is placed on each URL element. """ urls = Sitemap.get_urls(self, page=page, site=site) for url in urls: url['geo_format'] = self.geo_format return urls
[ "def", "get_urls", "(", "self", ",", "page", "=", "1", ",", "site", "=", "None", ")", ":", "urls", "=", "Sitemap", ".", "get_urls", "(", "self", ",", "page", "=", "page", ",", "site", "=", "site", ")", "for", "url", "in", "urls", ":", "url", "[...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/Django/django/contrib/gis/sitemaps/kml.py#L43-L50
CaptainEven/RepNet-MDNet-VehicleReID
d3d184331206ca4bdb5ea399e5b90a9ccc53b400
InitRepNet.py
python
ArcFC.__init__
(self, in_features, out_features, s=30.0, m=0.50, easy_margin=False)
ArcMargin :param in_features: :param out_features: :param s: :param m: :param easy_margin:
ArcMargin :param in_features: :param out_features: :param s: :param m: :param easy_margin:
[ "ArcMargin", ":", "param", "in_features", ":", ":", "param", "out_features", ":", ":", "param", "s", ":", ":", "param", "m", ":", ":", "param", "easy_margin", ":" ]
def __init__(self, in_features, out_features, s=30.0, m=0.50, easy_margin=False): """ ArcMargin :param in_features: :param out_features: :param s: :param m: :param easy_margin: ...
[ "def", "__init__", "(", "self", ",", "in_features", ",", "out_features", ",", "s", "=", "30.0", ",", "m", "=", "0.50", ",", "easy_margin", "=", "False", ")", ":", "super", "(", "ArcFC", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "in_...
https://github.com/CaptainEven/RepNet-MDNet-VehicleReID/blob/d3d184331206ca4bdb5ea399e5b90a9ccc53b400/InitRepNet.py#L31-L61
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/sklearn/model_selection/_search.py
python
ParameterGrid.__getitem__
(self, ind)
Get the parameters that would be ``ind``th in iteration Parameters ---------- ind : int The iteration index Returns ------- params : dict of string to any Equal to list(self)[ind]
Get the parameters that would be ``ind``th in iteration
[ "Get", "the", "parameters", "that", "would", "be", "ind", "th", "in", "iteration" ]
def __getitem__(self, ind): """Get the parameters that would be ``ind``th in iteration Parameters ---------- ind : int The iteration index Returns ------- params : dict of string to any Equal to list(self)[ind] """ # This ...
[ "def", "__getitem__", "(", "self", ",", "ind", ")", ":", "# This is used to make discrete sampling without replacement memory", "# efficient.", "for", "sub_grid", "in", "self", ".", "param_grid", ":", "# XXX: could memoize information used here", "if", "not", "sub_grid", ":...
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/sklearn/model_selection/_search.py#L122-L161
google/coursebuilder-core
08f809db3226d9269e30d5edd0edd33bd22041f4
coursebuilder/controllers/sites.py
python
set_path_info
(path)
Stores PATH_INFO in thread local.
Stores PATH_INFO in thread local.
[ "Stores", "PATH_INFO", "in", "thread", "local", "." ]
def set_path_info(path): """Stores PATH_INFO in thread local.""" if not path: raise Exception('Use \'unset()\' instead.') if has_path_info(): raise Exception('Expected no path set.') try: PATH_INFO_THREAD_LOCAL.path = path PATH_INFO_THREAD_LOCAL.old_namespace = namespace_...
[ "def", "set_path_info", "(", "path", ")", ":", "if", "not", "path", ":", "raise", "Exception", "(", "'Use \\'unset()\\' instead.'", ")", "if", "has_path_info", "(", ")", ":", "raise", "Exception", "(", "'Expected no path set.'", ")", "try", ":", "PATH_INFO_THREA...
https://github.com/google/coursebuilder-core/blob/08f809db3226d9269e30d5edd0edd33bd22041f4/coursebuilder/controllers/sites.py#L999-L1014
OfflineIMAP/offlineimap
e70d3992a0e9bb0fcdf3c94e1edf25a4124dfcd2
offlineimap/bundled_imaplib2.py
python
IMAP4._CRAM_MD5_AUTH
(self, challenge)
return self.user + " " + hmac.HMAC(pwd, challenge, 'md5').hexdigest()
Authobject to use with CRAM-MD5 authentication.
Authobject to use with CRAM-MD5 authentication.
[ "Authobject", "to", "use", "with", "CRAM", "-", "MD5", "authentication", "." ]
def _CRAM_MD5_AUTH(self, challenge): """Authobject to use with CRAM-MD5 authentication.""" import hmac pwd = (self.password.encode('ASCII') if isinstance(self.password, str) else self.password) return self.user + " " + hmac.HMAC(pwd, challenge...
[ "def", "_CRAM_MD5_AUTH", "(", "self", ",", "challenge", ")", ":", "import", "hmac", "pwd", "=", "(", "self", ".", "password", ".", "encode", "(", "'ASCII'", ")", "if", "isinstance", "(", "self", ".", "password", ",", "str", ")", "else", "self", ".", ...
https://github.com/OfflineIMAP/offlineimap/blob/e70d3992a0e9bb0fcdf3c94e1edf25a4124dfcd2/offlineimap/bundled_imaplib2.py#L974-L979
giantbranch/python-hacker-code
addbc8c73e7e6fb9e4fcadcec022fa1d3da4b96d
我手敲的代码(中文注释)/chapter11/immlib/immlib.py
python
Debugger.setBreakpoint
(self, address)
return debugger.Setbreakpoint(address, flags, "")
Set a Breakpoint. @type address: DWORD @param address: Address for the breakpoint
Set a Breakpoint.
[ "Set", "a", "Breakpoint", "." ]
def setBreakpoint(self, address): """ Set a Breakpoint. @type address: DWORD @param address: Address for the breakpoint """ flags = BpFlags["TY_ACTIVE"] return debugger.Setbreakpoint(address, flags, "")
[ "def", "setBreakpoint", "(", "self", ",", "address", ")", ":", "flags", "=", "BpFlags", "[", "\"TY_ACTIVE\"", "]", "return", "debugger", ".", "Setbreakpoint", "(", "address", ",", "flags", ",", "\"\"", ")" ]
https://github.com/giantbranch/python-hacker-code/blob/addbc8c73e7e6fb9e4fcadcec022fa1d3da4b96d/我手敲的代码(中文注释)/chapter11/immlib/immlib.py#L1889-L1897
rembo10/headphones
b3199605be1ebc83a7a8feab6b1e99b64014187c
lib/yaml/constructor.py
python
Constructor.construct_python_str
(self, node)
return self.construct_scalar(node).encode('utf-8')
[]
def construct_python_str(self, node): return self.construct_scalar(node).encode('utf-8')
[ "def", "construct_python_str", "(", "self", ",", "node", ")", ":", "return", "self", ".", "construct_scalar", "(", "node", ")", ".", "encode", "(", "'utf-8'", ")" ]
https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/yaml/constructor.py#L469-L470
tahoe-lafs/tahoe-lafs
766a53b5208c03c45ca0a98e97eee76870276aa1
src/allmydata/interfaces.py
python
IDirectoryNode.get_readonly_uri
()
The dirnode ('1') URI returned by this method can be used in set_uri() on a different directory ('2') to 'mount' a reference to this directory ('1') under the other ('2'). This URI is just a string, so it can be passed around through email or other out-of-band protocol.
The dirnode ('1') URI returned by this method can be used in set_uri() on a different directory ('2') to 'mount' a reference to this directory ('1') under the other ('2'). This URI is just a string, so it can be passed around through email or other out-of-band protocol.
[ "The", "dirnode", "(", "1", ")", "URI", "returned", "by", "this", "method", "can", "be", "used", "in", "set_uri", "()", "on", "a", "different", "directory", "(", "2", ")", "to", "mount", "a", "reference", "to", "this", "directory", "(", "1", ")", "un...
def get_readonly_uri(): """ The dirnode ('1') URI returned by this method can be used in set_uri() on a different directory ('2') to 'mount' a reference to this directory ('1') under the other ('2'). This URI is just a string, so it can be passed around through email or other out...
[ "def", "get_readonly_uri", "(", ")", ":" ]
https://github.com/tahoe-lafs/tahoe-lafs/blob/766a53b5208c03c45ca0a98e97eee76870276aa1/src/allmydata/interfaces.py#L1307-L1314
theislab/anndata
664e32b0aa6625fe593370d37174384c05abfd4e
anndata/_io/specs/methods.py
python
write_recarray
(f, k, elem, dataset_kwargs=MappingProxyType({}))
[]
def write_recarray(f, k, elem, dataset_kwargs=MappingProxyType({})): f.create_dataset(k, data=_to_hdf5_vlen_strings(elem), **dataset_kwargs)
[ "def", "write_recarray", "(", "f", ",", "k", ",", "elem", ",", "dataset_kwargs", "=", "MappingProxyType", "(", "{", "}", ")", ")", ":", "f", ".", "create_dataset", "(", "k", ",", "data", "=", "_to_hdf5_vlen_strings", "(", "elem", ")", ",", "*", "*", ...
https://github.com/theislab/anndata/blob/664e32b0aa6625fe593370d37174384c05abfd4e/anndata/_io/specs/methods.py#L397-L398
tribe29/checkmk
6260f2512e159e311f426e16b84b19d0b8e9ad0c
cmk/gui/watolib/host_attributes.py
python
ABCHostAttribute.filter_matches
(self, crit: Any, value: Any, hostname: HostName)
return crit == value
Checks if the give value matches the search attributes that are represented by the current HTML variables.
Checks if the give value matches the search attributes that are represented by the current HTML variables.
[ "Checks", "if", "the", "give", "value", "matches", "the", "search", "attributes", "that", "are", "represented", "by", "the", "current", "HTML", "variables", "." ]
def filter_matches(self, crit: Any, value: Any, hostname: HostName) -> bool: """Checks if the give value matches the search attributes that are represented by the current HTML variables.""" return crit == value
[ "def", "filter_matches", "(", "self", ",", "crit", ":", "Any", ",", "value", ":", "Any", ",", "hostname", ":", "HostName", ")", "->", "bool", ":", "return", "crit", "==", "value" ]
https://github.com/tribe29/checkmk/blob/6260f2512e159e311f426e16b84b19d0b8e9ad0c/cmk/gui/watolib/host_attributes.py#L359-L362
fluentpython/notebooks
0f6e1e8d1686743dacd9281df7c5b5921812010a
attic/sequences/str_concat.py
python
list_joiner
(lines)
return ''.join(parts)
[]
def list_joiner(lines): parts = [] for line in lines: parts.append(line) return ''.join(parts)
[ "def", "list_joiner", "(", "lines", ")", ":", "parts", "=", "[", "]", "for", "line", "in", "lines", ":", "parts", ".", "append", "(", "line", ")", "return", "''", ".", "join", "(", "parts", ")" ]
https://github.com/fluentpython/notebooks/blob/0f6e1e8d1686743dacd9281df7c5b5921812010a/attic/sequences/str_concat.py#L26-L30