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
cclib/cclib
81cd4a81cc4a3bbed7016b3e417ca9bff8ad3a92
cclib/method/volume.py
python
Volume.write
(self, filename, fformat="Cube")
Write the volume to a file.
Write the volume to a file.
[ "Write", "the", "volume", "to", "a", "file", "." ]
def write(self, filename, fformat="Cube"): """Write the volume to a file.""" fformat = fformat.lower() writers = { "vtk": self.writeasvtk, "cube": self.writeascube, } if fformat not in writers: raise RuntimeError("File format must be either ...
[ "def", "write", "(", "self", ",", "filename", ",", "fformat", "=", "\"Cube\"", ")", ":", "fformat", "=", "fformat", ".", "lower", "(", ")", "writers", "=", "{", "\"vtk\"", ":", "self", ".", "writeasvtk", ",", "\"cube\"", ":", "self", ".", "writeascube"...
https://github.com/cclib/cclib/blob/81cd4a81cc4a3bbed7016b3e417ca9bff8ad3a92/cclib/method/volume.py#L190-L203
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
ansible/roles/lib_oa_utils/filter_plugins/oo_filters.py
python
FilterModule.filters
(self)
return { "lib_utils_oo_select_keys": lib_utils_oo_select_keys, "lib_utils_oo_select_keys_from_list": lib_utils_oo_select_keys_from_list, "lib_utils_oo_collect": lib_utils_oo_collect, "lib_utils_oo_pdb": lib_utils_oo_pdb, "lib_utils_oo_prepend_strings_in_list":...
returns a mapping of filters to methods
returns a mapping of filters to methods
[ "returns", "a", "mapping", "of", "filters", "to", "methods" ]
def filters(self): """ returns a mapping of filters to methods """ return { "lib_utils_oo_select_keys": lib_utils_oo_select_keys, "lib_utils_oo_select_keys_from_list": lib_utils_oo_select_keys_from_list, "lib_utils_oo_collect": lib_utils_oo_collect, "lib_u...
[ "def", "filters", "(", "self", ")", ":", "return", "{", "\"lib_utils_oo_select_keys\"", ":", "lib_utils_oo_select_keys", ",", "\"lib_utils_oo_select_keys_from_list\"", ":", "lib_utils_oo_select_keys_from_list", ",", "\"lib_utils_oo_collect\"", ":", "lib_utils_oo_collect", ",", ...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_oa_utils/filter_plugins/oo_filters.py#L689-L719
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/partition_tuple.py
python
PartitionTuple.contains
(self, mu)
return mu.level()<=self.level() and all(self[c].contains(mu[c]) for c in range(len(mu)))
r""" Return ``True`` if this partition tuple contains `\mu`. If `\lambda=(\lambda^{(1)}, \ldots, \lambda^{(l)})` and `\mu=(\mu^{(1)}, \ldots, \mu^{(m)})` are two partition tuples then `\lambda` contains `\mu` if `m \leq l` and `\mu^{(i)}_r \leq \lambda^{(i)}_r` for `1 \leq i \le...
r""" Return ``True`` if this partition tuple contains `\mu`.
[ "r", "Return", "True", "if", "this", "partition", "tuple", "contains", "\\", "mu", "." ]
def contains(self, mu): r""" Return ``True`` if this partition tuple contains `\mu`. If `\lambda=(\lambda^{(1)}, \ldots, \lambda^{(l)})` and `\mu=(\mu^{(1)}, \ldots, \mu^{(m)})` are two partition tuples then `\lambda` contains `\mu` if `m \leq l` and `\mu^{(i)}_r \leq \l...
[ "def", "contains", "(", "self", ",", "mu", ")", ":", "return", "mu", ".", "level", "(", ")", "<=", "self", ".", "level", "(", ")", "and", "all", "(", "self", "[", "c", "]", ".", "contains", "(", "mu", "[", "c", "]", ")", "for", "c", "in", "...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/partition_tuple.py#L1333-L1347
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/cinder/cinder/openstack/common/excutils.py
python
save_and_reraise_exception
()
Save current exception, run some code and then re-raise. In some cases the exception context can be cleared, resulting in None being attempted to be re-raised after an exception handler is run. This can happen when eventlet switches greenthreads or when running an exception handler, code raises and cat...
Save current exception, run some code and then re-raise.
[ "Save", "current", "exception", "run", "some", "code", "and", "then", "re", "-", "raise", "." ]
def save_and_reraise_exception(): """Save current exception, run some code and then re-raise. In some cases the exception context can be cleared, resulting in None being attempted to be re-raised after an exception handler is run. This can happen when eventlet switches greenthreads or when running an ...
[ "def", "save_and_reraise_exception", "(", ")", ":", "type_", ",", "value", ",", "tb", "=", "sys", ".", "exc_info", "(", ")", "try", ":", "yield", "except", "Exception", ":", "logging", ".", "error", "(", "_", "(", "'Original exception being dropped: %s'", ")...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/cinder/cinder/openstack/common/excutils.py#L31-L51
matrix-org/synapse
8e57584a5859a9002759963eb546d523d2498a01
synapse/config/oidc.py
python
_parse_oidc_config_dict
( oidc_config: JsonDict, config_path: Tuple[str, ...] )
return OidcProviderConfig( idp_id=idp_id, idp_name=oidc_config.get("idp_name", "OIDC"), idp_icon=idp_icon, idp_brand=oidc_config.get("idp_brand"), discover=oidc_config.get("discover", True), issuer=oidc_config["issuer"], client_id=oidc_config["client_id"], ...
Take the configuration dict and parse it into an OidcProviderConfig Raises: ConfigError if the configuration is malformed.
Take the configuration dict and parse it into an OidcProviderConfig
[ "Take", "the", "configuration", "dict", "and", "parse", "it", "into", "an", "OidcProviderConfig" ]
def _parse_oidc_config_dict( oidc_config: JsonDict, config_path: Tuple[str, ...] ) -> "OidcProviderConfig": """Take the configuration dict and parse it into an OidcProviderConfig Raises: ConfigError if the configuration is malformed. """ ump_config = oidc_config.get("user_mapping_provider",...
[ "def", "_parse_oidc_config_dict", "(", "oidc_config", ":", "JsonDict", ",", "config_path", ":", "Tuple", "[", "str", ",", "...", "]", ")", "->", "\"OidcProviderConfig\"", ":", "ump_config", "=", "oidc_config", ".", "get", "(", "\"user_mapping_provider\"", ",", "...
https://github.com/matrix-org/synapse/blob/8e57584a5859a9002759963eb546d523d2498a01/synapse/config/oidc.py#L391-L495
ucsb-seclab/karonte
427ac313e596f723e40768b95d13bd7a9fc92fd8
tool/bdg/binary_dependency_graph.py
python
BdgNode.set_orphan
(self)
[]
def set_orphan(self): self._orphan = True
[ "def", "set_orphan", "(", "self", ")", ":", "self", ".", "_orphan", "=", "True" ]
https://github.com/ucsb-seclab/karonte/blob/427ac313e596f723e40768b95d13bd7a9fc92fd8/tool/bdg/binary_dependency_graph.py#L117-L118
intel/virtual-storage-manager
00706ab9701acbd0d5e04b19cc80c6b66a2973b8
source/python-vsmclient/vsmclient/v1/servers.py
python
Server.delete
(self)
Delete this server.
Delete this server.
[ "Delete", "this", "server", "." ]
def delete(self): """Delete this server.""" self.manager.delete(self)
[ "def", "delete", "(", "self", ")", ":", "self", ".", "manager", ".", "delete", "(", "self", ")" ]
https://github.com/intel/virtual-storage-manager/blob/00706ab9701acbd0d5e04b19cc80c6b66a2973b8/source/python-vsmclient/vsmclient/v1/servers.py#L28-L30
spyder-ide/spyder
55da47c032dfcf519600f67f8b30eab467f965e7
spyder/widgets/mixins.py
python
GetHelpMixin.show_object_info
(self, text, call=False, force=False)
Show signature calltip and/or docstring in the Help plugin
Show signature calltip and/or docstring in the Help plugin
[ "Show", "signature", "calltip", "and", "/", "or", "docstring", "in", "the", "Help", "plugin" ]
def show_object_info(self, text, call=False, force=False): """Show signature calltip and/or docstring in the Help plugin""" text = to_text_string(text) # Show docstring help_enabled = self.help_enabled or force if help_enabled: doc = { 'name': text, ...
[ "def", "show_object_info", "(", "self", ",", "text", ",", "call", "=", "False", ",", "force", "=", "False", ")", ":", "text", "=", "to_text_string", "(", "text", ")", "# Show docstring", "help_enabled", "=", "self", ".", "help_enabled", "or", "force", "if"...
https://github.com/spyder-ide/spyder/blob/55da47c032dfcf519600f67f8b30eab467f965e7/spyder/widgets/mixins.py#L1474-L1515
jython/frozen-mirror
b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99
lib-python/2.7/bdb.py
python
Bdb.set_next
(self, frame)
Stop on the next line in or below the given frame.
Stop on the next line in or below the given frame.
[ "Stop", "on", "the", "next", "line", "in", "or", "below", "the", "given", "frame", "." ]
def set_next(self, frame): """Stop on the next line in or below the given frame.""" self._set_stopinfo(frame, None)
[ "def", "set_next", "(", "self", ",", "frame", ")", ":", "self", ".", "_set_stopinfo", "(", "frame", ",", "None", ")" ]
https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/bdb.py#L204-L206
missionpinball/mpf
8e6b74cff4ba06d2fec9445742559c1068b88582
mpf/core/bcp/bcp_pickle_client.py
python
BcpPickleClient.accept_connection
(self, receiver, sender)
Create client for incoming connection.
Create client for incoming connection.
[ "Create", "client", "for", "incoming", "connection", "." ]
def accept_connection(self, receiver, sender): """Create client for incoming connection.""" self._receiver = receiver self._sender = sender
[ "def", "accept_connection", "(", "self", ",", "receiver", ",", "sender", ")", ":", "self", ".", "_receiver", "=", "receiver", "self", ".", "_sender", "=", "sender" ]
https://github.com/missionpinball/mpf/blob/8e6b74cff4ba06d2fec9445742559c1068b88582/mpf/core/bcp/bcp_pickle_client.py#L51-L54
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/pip/_vendor/html5lib/_inputstream.py
python
EncodingParser.getAttribute
(self)
Return a name,value pair for the next attribute in the stream, if one is found, or None
Return a name,value pair for the next attribute in the stream, if one is found, or None
[ "Return", "a", "name", "value", "pair", "for", "the", "next", "attribute", "in", "the", "stream", "if", "one", "is", "found", "or", "None" ]
def getAttribute(self): """Return a name,value pair for the next attribute in the stream, if one is found, or None""" data = self.data # Step 1 (skip chars) c = data.skip(spaceCharactersBytes | frozenset([b"/"])) assert c is None or len(c) == 1 # Step 2 if...
[ "def", "getAttribute", "(", "self", ")", ":", "data", "=", "self", ".", "data", "# Step 1 (skip chars)", "c", "=", "data", ".", "skip", "(", "spaceCharactersBytes", "|", "frozenset", "(", "[", "b\"/\"", "]", ")", ")", "assert", "c", "is", "None", "or", ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pip/_vendor/html5lib/_inputstream.py#L792-L866
apache/libcloud
90971e17bfd7b6bb97b2489986472c531cc8e140
libcloud/compute/drivers/nttcis.py
python
NttCisNodeDriver.ex_set_firewall_rule_state
(self, rule, state)
return response_code in ["IN_PROGRESS", "OK"]
Change the state (enabled or disabled) of a rule :param rule: The rule to delete :type rule: :class:`NttCisFirewallRule` :param state: The desired state enabled (True) or disabled (False) :type state: ``bool`` :rtype: ``bool``
Change the state (enabled or disabled) of a rule
[ "Change", "the", "state", "(", "enabled", "or", "disabled", ")", "of", "a", "rule" ]
def ex_set_firewall_rule_state(self, rule, state): """ Change the state (enabled or disabled) of a rule :param rule: The rule to delete :type rule: :class:`NttCisFirewallRule` :param state: The desired state enabled (True) or disabled (False) :type state: ``bool`` ...
[ "def", "ex_set_firewall_rule_state", "(", "self", ",", "rule", ",", "state", ")", ":", "update_node", "=", "ET", ".", "Element", "(", "\"editFirewallRule\"", ",", "{", "\"xmlns\"", ":", "TYPES_URN", "}", ")", "update_node", ".", "set", "(", "\"id\"", ",", ...
https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/compute/drivers/nttcis.py#L2573-L2594
theupdateframework/python-tuf
45cf6076e3da7ff47968975f8106c4d6a03f9d4c
tuf/keydb.py
python
get_key
(keyid, repository_name='default')
<Purpose> Return the key belonging to 'keyid'. <Arguments> keyid: An object conformant to 'securesystemslib.formats.KEYID_SCHEMA'. It is used as an identifier for keys. repository_name: The name of the repository to get the key. If not supplied, the key is retrieved from the 'd...
<Purpose> Return the key belonging to 'keyid'.
[ "<Purpose", ">", "Return", "the", "key", "belonging", "to", "keyid", "." ]
def get_key(keyid, repository_name='default'): """ <Purpose> Return the key belonging to 'keyid'. <Arguments> keyid: An object conformant to 'securesystemslib.formats.KEYID_SCHEMA'. It is used as an identifier for keys. repository_name: The name of the repository to get the key. ...
[ "def", "get_key", "(", "keyid", ",", "repository_name", "=", "'default'", ")", ":", "# Does 'keyid' have the correct format?", "# This check will ensure 'keyid' has the appropriate number of objects", "# and object types, and that all dict keys are properly named.", "# Raise 'securesystems...
https://github.com/theupdateframework/python-tuf/blob/45cf6076e3da7ff47968975f8106c4d6a03f9d4c/tuf/keydb.py#L293-L341
chebee7i/nxpd
a0797cd0ee4f8584c9ee49bab45e63f6ed05613a
nxpd/pydot/__init__.py
python
Graph.get_type
(self)
return self.obj_dict['type']
Get the graph's type, 'graph' or 'digraph'.
Get the graph's type, 'graph' or 'digraph'.
[ "Get", "the", "graph", "s", "type", "graph", "or", "digraph", "." ]
def get_type(self): """Get the graph's type, 'graph' or 'digraph'.""" return self.obj_dict['type']
[ "def", "get_type", "(", "self", ")", ":", "return", "self", ".", "obj_dict", "[", "'type'", "]" ]
https://github.com/chebee7i/nxpd/blob/a0797cd0ee4f8584c9ee49bab45e63f6ed05613a/nxpd/pydot/__init__.py#L1175-L1178
OpenMDAO/OpenMDAO1
791a6fbbb7d266f3dcbc1f7bde3ae03a70dc1317
openmdao/recorders/recording_manager.py
python
RecordingManager.append
(self, recorder)
Add a recorder for recording. Args ---- recorder : `BaseRecorder` Recorder instance.
Add a recorder for recording.
[ "Add", "a", "recorder", "for", "recording", "." ]
def append(self, recorder): """ Add a recorder for recording. Args ---- recorder : `BaseRecorder` Recorder instance. """ self._recorders.append(recorder)
[ "def", "append", "(", "self", ",", "recorder", ")", ":", "self", ".", "_recorders", ".", "append", "(", "recorder", ")" ]
https://github.com/OpenMDAO/OpenMDAO1/blob/791a6fbbb7d266f3dcbc1f7bde3ae03a70dc1317/openmdao/recorders/recording_manager.py#L34-L42
fepegar/torchio
3e07b78da16d6db4da7193325b3f9cb31fc0911a
torchio/external/due.py
python
InactiveDueCreditCollector.dcite
(self, *args, **kwargs)
return nondecorating_decorator
If I could cite I would
If I could cite I would
[ "If", "I", "could", "cite", "I", "would" ]
def dcite(self, *args, **kwargs): """If I could cite I would""" def nondecorating_decorator(func): return func return nondecorating_decorator
[ "def", "dcite", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "nondecorating_decorator", "(", "func", ")", ":", "return", "func", "return", "nondecorating_decorator" ]
https://github.com/fepegar/torchio/blob/3e07b78da16d6db4da7193325b3f9cb31fc0911a/torchio/external/due.py#L37-L41
Qirky/FoxDot
76318f9630bede48ff3994146ed644affa27bfa4
FoxDot/lib/OSC.py
python
OSCStreamingClient._transmitMsgWithTimeout
(self, msg)
[]
def _transmitMsgWithTimeout(self, msg): if not isinstance(msg, OSCMessage): raise TypeError("'msg' argument is not an OSCMessage or OSCBundle object") binary = msg.getBinary() length = len(binary) # prepend length of packet before the actual message (big endian) len_big_endian = array.array('c', '\0' * 4) ...
[ "def", "_transmitMsgWithTimeout", "(", "self", ",", "msg", ")", ":", "if", "not", "isinstance", "(", "msg", ",", "OSCMessage", ")", ":", "raise", "TypeError", "(", "\"'msg' argument is not an OSCMessage or OSCBundle object\"", ")", "binary", "=", "msg", ".", "getB...
https://github.com/Qirky/FoxDot/blob/76318f9630bede48ff3994146ed644affa27bfa4/FoxDot/lib/OSC.py#L2829-L2841
mitogen-hq/mitogen
5b505f524a7ae170fe68613841ab92b299613d3f
ansible_mitogen/runner.py
python
shlex_split_b
(s)
return [t for t in shlex.split(s, comments=True)]
Use shlex.split() to split characters in some single-byte encoding, without knowing what that encoding is. The input is bytes, the output is a list of bytes.
Use shlex.split() to split characters in some single-byte encoding, without knowing what that encoding is. The input is bytes, the output is a list of bytes.
[ "Use", "shlex", ".", "split", "()", "to", "split", "characters", "in", "some", "single", "-", "byte", "encoding", "without", "knowing", "what", "that", "encoding", "is", ".", "The", "input", "is", "bytes", "the", "output", "is", "a", "list", "of", "bytes...
def shlex_split_b(s): """ Use shlex.split() to split characters in some single-byte encoding, without knowing what that encoding is. The input is bytes, the output is a list of bytes. """ assert isinstance(s, mitogen.core.BytesType) if mitogen.core.PY3: return [ t.encode(...
[ "def", "shlex_split_b", "(", "s", ")", ":", "assert", "isinstance", "(", "s", ",", "mitogen", ".", "core", ".", "BytesType", ")", "if", "mitogen", ".", "core", ".", "PY3", ":", "return", "[", "t", ".", "encode", "(", "'latin1'", ")", "for", "t", "i...
https://github.com/mitogen-hq/mitogen/blob/5b505f524a7ae170fe68613841ab92b299613d3f/ansible_mitogen/runner.py#L105-L118
cloudmarker/cloudmarker
0dd2daadfa0203b3d1062e5067b14e4e0f189697
cloudmarker/events/azpostgreslogconnectionsevent.py
python
AzPostgresLogConnectionsEvent.__init__
(self)
Create an instance of :class:`AzPostgresLogConnectionsEvent`.
Create an instance of :class:`AzPostgresLogConnectionsEvent`.
[ "Create", "an", "instance", "of", ":", "class", ":", "AzPostgresLogConnectionsEvent", "." ]
def __init__(self): """Create an instance of :class:`AzPostgresLogConnectionsEvent`."""
[ "def", "__init__", "(", "self", ")", ":" ]
https://github.com/cloudmarker/cloudmarker/blob/0dd2daadfa0203b3d1062e5067b14e4e0f189697/cloudmarker/events/azpostgreslogconnectionsevent.py#L20-L21
calliope-project/calliope
9d588fa98ec8eb11065ebb43bcc90d07657b0d43
calliope/backend/pyomo/constraints/milp.py
python
storage_capacity_max_purchase_milp_constraint_rule
(backend_model, node, tech)
Set maximum storage capacity. The first valid case is applied: .. container:: scrolling-wrapper .. math:: \\boldsymbol{storage_{cap}}(loc::tech) \\begin{cases} = storage_{cap, equals}(loc::tech) \\times \\boldsymbol{purchased},& \\text{if }...
Set maximum storage capacity.
[ "Set", "maximum", "storage", "capacity", "." ]
def storage_capacity_max_purchase_milp_constraint_rule(backend_model, node, tech): """ Set maximum storage capacity. The first valid case is applied: .. container:: scrolling-wrapper .. math:: \\boldsymbol{storage_{cap}}(loc::tech) \\begin{cases} = sto...
[ "def", "storage_capacity_max_purchase_milp_constraint_rule", "(", "backend_model", ",", "node", ",", "tech", ")", ":", "storage_cap_max", "=", "get_param", "(", "backend_model", ",", "\"storage_cap_max\"", ",", "(", "node", ",", "tech", ")", ")", "storage_cap_equals",...
https://github.com/calliope-project/calliope/blob/9d588fa98ec8eb11065ebb43bcc90d07657b0d43/calliope/backend/pyomo/constraints/milp.py#L298-L333
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/idlelib/configdialog.py
python
GenPage.init_validators
(self)
[]
def init_validators(self): digits_or_empty_re = re.compile(r'[0-9]*') def is_digits_or_empty(s): "Return 's is blank or contains only digits'" return digits_or_empty_re.fullmatch(s) is not None self.digits_only = (self.register(is_digits_or_empty), '%P',)
[ "def", "init_validators", "(", "self", ")", ":", "digits_or_empty_re", "=", "re", ".", "compile", "(", "r'[0-9]*'", ")", "def", "is_digits_or_empty", "(", "s", ")", ":", "\"Return 's is blank or contains only digits'\"", "return", "digits_or_empty_re", ".", "fullmatch...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/idlelib/configdialog.py#L1786-L1791
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.py
python
ignore_patterns
(*patterns)
return _ignore_patterns
Function that can be used as copytree() ignore parameter. Patterns is a sequence of glob-style patterns that are used to exclude files
Function that can be used as copytree() ignore parameter.
[ "Function", "that", "can", "be", "used", "as", "copytree", "()", "ignore", "parameter", "." ]
def ignore_patterns(*patterns): """Function that can be used as copytree() ignore parameter. Patterns is a sequence of glob-style patterns that are used to exclude files""" def _ignore_patterns(path, names): ignored_names = [] for pattern in patterns: ignored_names.extend(fn...
[ "def", "ignore_patterns", "(", "*", "patterns", ")", ":", "def", "_ignore_patterns", "(", "path", ",", "names", ")", ":", "ignored_names", "=", "[", "]", "for", "pattern", "in", "patterns", ":", "ignored_names", ".", "extend", "(", "fnmatch", ".", "filter"...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.py#L152-L162
rll/rllab
ba78e4c16dc492982e648f117875b22af3965579
rllab/algos/cma_es_lib.py
python
OOOptimizer.stop
(self)
abstract method, return satisfied termination conditions in a dictionary like ``{'termination reason': value, ...}``, for example ``{'tolfun': 1e-12}``, or the empty dictionary ``{}``. The implementation of `stop()` should prevent an infinite loop.
abstract method, return satisfied termination conditions in a dictionary like ``{'termination reason': value, ...}``, for example ``{'tolfun': 1e-12}``, or the empty dictionary ``{}``. The implementation of `stop()` should prevent an infinite loop.
[ "abstract", "method", "return", "satisfied", "termination", "conditions", "in", "a", "dictionary", "like", "{", "termination", "reason", ":", "value", "...", "}", "for", "example", "{", "tolfun", ":", "1e", "-", "12", "}", "or", "the", "empty", "dictionary",...
def stop(self): """abstract method, return satisfied termination conditions in a dictionary like ``{'termination reason': value, ...}``, for example ``{'tolfun': 1e-12}``, or the empty dictionary ``{}``. The implementation of `stop()` should prevent an infinite loop. """...
[ "def", "stop", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "'method stop() is not implemented'", ")" ]
https://github.com/rll/rllab/blob/ba78e4c16dc492982e648f117875b22af3965579/rllab/algos/cma_es_lib.py#L1982-L1990
edgewall/trac
beb3e4eaf1e0a456d801a50a8614ecab06de29fc
tracopt/versioncontrol/svn/svn_fs.py
python
SubversionRepository.get_node
(self, path, rev=None)
return SubversionNode(path, rev, self, self.pool)
Produce a `SubversionNode` from given path and optionally revision specifications. No revision given means use the latest.
Produce a `SubversionNode` from given path and optionally revision specifications. No revision given means use the latest.
[ "Produce", "a", "SubversionNode", "from", "given", "path", "and", "optionally", "revision", "specifications", ".", "No", "revision", "given", "means", "use", "the", "latest", "." ]
def get_node(self, path, rev=None): """Produce a `SubversionNode` from given path and optionally revision specifications. No revision given means use the latest. """ path = path or '' if path and path != '/' and path[-1] == '/': path = path[:-1] rev = self.nor...
[ "def", "get_node", "(", "self", ",", "path", ",", "rev", "=", "None", ")", ":", "path", "=", "path", "or", "''", "if", "path", "and", "path", "!=", "'/'", "and", "path", "[", "-", "1", "]", "==", "'/'", ":", "path", "=", "path", "[", ":", "-"...
https://github.com/edgewall/trac/blob/beb3e4eaf1e0a456d801a50a8614ecab06de29fc/tracopt/versioncontrol/svn/svn_fs.py#L411-L419
Yam-cn/pyalgotrade-cn
d8ba00e9a2bb609e3e925db17a9a97929c57f672
pyalgotrade/talibext/indicator.py
python
CDLGAPSIDESIDEWHITE
(barDs, count)
return call_talib_with_ohlc(barDs, count, talib.CDLGAPSIDESIDEWHITE)
Up/Down-gap side-by-side white lines
Up/Down-gap side-by-side white lines
[ "Up", "/", "Down", "-", "gap", "side", "-", "by", "-", "side", "white", "lines" ]
def CDLGAPSIDESIDEWHITE(barDs, count): """Up/Down-gap side-by-side white lines""" return call_talib_with_ohlc(barDs, count, talib.CDLGAPSIDESIDEWHITE)
[ "def", "CDLGAPSIDESIDEWHITE", "(", "barDs", ",", "count", ")", ":", "return", "call_talib_with_ohlc", "(", "barDs", ",", "count", ",", "talib", ".", "CDLGAPSIDESIDEWHITE", ")" ]
https://github.com/Yam-cn/pyalgotrade-cn/blob/d8ba00e9a2bb609e3e925db17a9a97929c57f672/pyalgotrade/talibext/indicator.py#L325-L327
misterch0c/shadowbroker
e3a069bea47a2c1009697941ac214adc6f90aa8d
windows/Resources/Python/Core/Lib/pydoc.py
python
Helper.getline
(self, prompt)
Read one line, using raw_input when available.
Read one line, using raw_input when available.
[ "Read", "one", "line", "using", "raw_input", "when", "available", "." ]
def getline(self, prompt): """Read one line, using raw_input when available.""" if self.input is sys.stdin: return raw_input(prompt) else: self.output.write(prompt) self.output.flush() return self.input.readline()
[ "def", "getline", "(", "self", ",", "prompt", ")", ":", "if", "self", ".", "input", "is", "sys", ".", "stdin", ":", "return", "raw_input", "(", "prompt", ")", "else", ":", "self", ".", "output", ".", "write", "(", "prompt", ")", "self", ".", "outpu...
https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/pydoc.py#L1656-L1663
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/Centos_5.9/paramiko/sftp_server.py
python
SFTPServer._convert_pflags
(self, pflags)
return flags
convert SFTP-style open() flags to python's os.open() flags
convert SFTP-style open() flags to python's os.open() flags
[ "convert", "SFTP", "-", "style", "open", "()", "flags", "to", "python", "s", "os", ".", "open", "()", "flags" ]
def _convert_pflags(self, pflags): "convert SFTP-style open() flags to python's os.open() flags" if (pflags & SFTP_FLAG_READ) and (pflags & SFTP_FLAG_WRITE): flags = os.O_RDWR elif pflags & SFTP_FLAG_WRITE: flags = os.O_WRONLY else: flags = os.O_RDONLY...
[ "def", "_convert_pflags", "(", "self", ",", "pflags", ")", ":", "if", "(", "pflags", "&", "SFTP_FLAG_READ", ")", "and", "(", "pflags", "&", "SFTP_FLAG_WRITE", ")", ":", "flags", "=", "os", ".", "O_RDWR", "elif", "pflags", "&", "SFTP_FLAG_WRITE", ":", "fl...
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_5.9/paramiko/sftp_server.py#L298-L314
usb-tools/ViewSB
0318dc7b3d7da290a841b1681e62a0654c8c82e6
viewsb/frontends/tui.py
python
VSBPacketNode.load_child_keys
(self)
return list(range(len(packet.subordinate_packets)))
Return all of the child packet indices for the given node.
Return all of the child packet indices for the given node.
[ "Return", "all", "of", "the", "child", "packet", "indices", "for", "the", "given", "node", "." ]
def load_child_keys(self): """ Return all of the child packet indices for the given node. """ # Our child packets are just organized into a list, # so we can just return a range of the same length as our list. packet = self.get_value() return list(range(len(packet.subordinate_pa...
[ "def", "load_child_keys", "(", "self", ")", ":", "# Our child packets are just organized into a list,", "# so we can just return a range of the same length as our list.", "packet", "=", "self", ".", "get_value", "(", ")", "return", "list", "(", "range", "(", "len", "(", "...
https://github.com/usb-tools/ViewSB/blob/0318dc7b3d7da290a841b1681e62a0654c8c82e6/viewsb/frontends/tui.py#L529-L535
CedricGuillemet/Imogen
ee417b42747ed5b46cb11b02ef0c3630000085b3
bin/Lib/asyncio/unix_events.py
python
_UnixSelectorEventLoop.remove_signal_handler
(self, sig)
return True
Remove a handler for a signal. UNIX only. Return True if a signal handler was removed, False if not.
Remove a handler for a signal. UNIX only.
[ "Remove", "a", "handler", "for", "a", "signal", ".", "UNIX", "only", "." ]
def remove_signal_handler(self, sig): """Remove a handler for a signal. UNIX only. Return True if a signal handler was removed, False if not. """ self._check_signal(sig) try: del self._signal_handlers[sig] except KeyError: return False i...
[ "def", "remove_signal_handler", "(", "self", ",", "sig", ")", ":", "self", ".", "_check_signal", "(", "sig", ")", "try", ":", "del", "self", ".", "_signal_handlers", "[", "sig", "]", "except", "KeyError", ":", "return", "False", "if", "sig", "==", "signa...
https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/asyncio/unix_events.py#L130-L160
Yelp/clusterman
54beef89c01a2681aafd1fbb93b6ad5f6252d6cf
clusterman/simulator/simulated_spot_fleet_resource_group.py
python
SimulatedSpotFleetResourceGroup.modify_target_capacity
(self, target_capacity, *, dry_run=False)
Modify the requested capacity for a particular spot fleet :param target_capacity: desired capacity after this operation
Modify the requested capacity for a particular spot fleet
[ "Modify", "the", "requested", "capacity", "for", "a", "particular", "spot", "fleet" ]
def modify_target_capacity(self, target_capacity, *, dry_run=False): """ Modify the requested capacity for a particular spot fleet :param target_capacity: desired capacity after this operation """ if dry_run: return curr_capacity = self.fulfilled_capacity se...
[ "def", "modify_target_capacity", "(", "self", ",", "target_capacity", ",", "*", ",", "dry_run", "=", "False", ")", ":", "if", "dry_run", ":", "return", "curr_capacity", "=", "self", ".", "fulfilled_capacity", "self", ".", "__target_capacity", "=", "target_capaci...
https://github.com/Yelp/clusterman/blob/54beef89c01a2681aafd1fbb93b6ad5f6252d6cf/clusterman/simulator/simulated_spot_fleet_resource_group.py#L86-L97
blawar/nut
2cf351400418399a70164987e28670309f6c9cb5
nut/aes128.py
python
AESXTS.decrypt_sector
(self, data, tweak)
return out
[]
def decrypt_sector(self, data, tweak): if len(data) % self.block_size: raise ValueError('Data is not aligned to block size!') out = b'' tweak = self.K2.encrypt(uhx('%032X' % tweak)) while data: a = self.K1.decrypt(sxor(data[:0x10], tweak)) out += sxor(tweak, a) _t = int(hx(tweak[::-1]), 16) _t <<...
[ "def", "decrypt_sector", "(", "self", ",", "data", ",", "tweak", ")", ":", "if", "len", "(", "data", ")", "%", "self", ".", "block_size", ":", "raise", "ValueError", "(", "'Data is not aligned to block size!'", ")", "out", "=", "b''", "tweak", "=", "self",...
https://github.com/blawar/nut/blob/2cf351400418399a70164987e28670309f6c9cb5/nut/aes128.py#L136-L150
iwonbigbro/gsync
03db22fe826f073e56877918b0acb7b4ba908f18
libgsync/drive/__init__.py
python
DriveFileObject.write
(self, data)
Writes data into the file at the current offset. Currently not supported by Google Drive API.
Writes data into the file at the current offset.
[ "Writes", "data", "into", "the", "file", "at", "the", "current", "offset", "." ]
def write(self, data): """ Writes data into the file at the current offset. Currently not supported by Google Drive API. """ data = data # static_cast<void>(data) for pylint self._required_open() self._required_modes([ "w", "a" ])
[ "def", "write", "(", "self", ",", "data", ")", ":", "data", "=", "data", "# static_cast<void>(data) for pylint", "self", ".", "_required_open", "(", ")", "self", ".", "_required_modes", "(", "[", "\"w\"", ",", "\"a\"", "]", ")" ]
https://github.com/iwonbigbro/gsync/blob/03db22fe826f073e56877918b0acb7b4ba908f18/libgsync/drive/__init__.py#L226-L234
SteveDoyle2/pyNastran
eda651ac2d4883d95a34951f8a002ff94f642a1a
pyNastran/dev/bdf_vectorized/cards/elements/solid/cpenta15.py
python
CPENTA15.update
(self, maps)
maps = { 'node_id' : nid_map, 'property' : pid_map, }
maps = { 'node_id' : nid_map, 'property' : pid_map, }
[ "maps", "=", "{", "node_id", ":", "nid_map", "property", ":", "pid_map", "}" ]
def update(self, maps): """ maps = { 'node_id' : nid_map, 'property' : pid_map, } """ if self.n: eid_map = maps['element'] nid_map = maps['node'] pid_map = maps['property'] for i, (eid, pid, nids) in enumerat...
[ "def", "update", "(", "self", ",", "maps", ")", ":", "if", "self", ".", "n", ":", "eid_map", "=", "maps", "[", "'element'", "]", "nid_map", "=", "maps", "[", "'node'", "]", "pid_map", "=", "maps", "[", "'property'", "]", "for", "i", ",", "(", "ei...
https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/dev/bdf_vectorized/cards/elements/solid/cpenta15.py#L59-L88
iopsgroup/imoocc
de810eb6d4c1697b7139305925a5b0ba21225f3f
extra_apps/xadmin/plugins/xversion.py
python
BaseReversionView._order_version_queryset
(self, queryset)
return queryset.order_by("pk")
Applies the correct ordering to the given version queryset.
Applies the correct ordering to the given version queryset.
[ "Applies", "the", "correct", "ordering", "to", "the", "given", "version", "queryset", "." ]
def _order_version_queryset(self, queryset): """Applies the correct ordering to the given version queryset.""" if self.history_latest_first: return queryset.order_by("-pk") return queryset.order_by("pk")
[ "def", "_order_version_queryset", "(", "self", ",", "queryset", ")", ":", "if", "self", ".", "history_latest_first", ":", "return", "queryset", ".", "order_by", "(", "\"-pk\"", ")", "return", "queryset", ".", "order_by", "(", "\"pk\"", ")" ]
https://github.com/iopsgroup/imoocc/blob/de810eb6d4c1697b7139305925a5b0ba21225f3f/extra_apps/xadmin/plugins/xversion.py#L176-L180
KalleHallden/AutoTimer
2d954216700c4930baa154e28dbddc34609af7ce
env/lib/python2.7/site-packages/pip/_internal/req/req_file.py
python
parse_requirements
( filename, # type: str finder=None, # type: Optional[PackageFinder] comes_from=None, # type: Optional[str] options=None, # type: Optional[optparse.Values] session=None, # type: Optional[PipSession] constraint=False, # type: bool wheel_cache=None, # type: Optional[WheelCache] use_...
Parse a requirements file and yield InstallRequirement instances. :param filename: Path or url of requirements file. :param finder: Instance of pip.index.PackageFinder. :param comes_from: Origin description of requirements. :param options: cli options. :param session: Instance of p...
Parse a requirements file and yield InstallRequirement instances.
[ "Parse", "a", "requirements", "file", "and", "yield", "InstallRequirement", "instances", "." ]
def parse_requirements( filename, # type: str finder=None, # type: Optional[PackageFinder] comes_from=None, # type: Optional[str] options=None, # type: Optional[optparse.Values] session=None, # type: Optional[PipSession] constraint=False, # type: bool wheel_cache=None, # type: Optiona...
[ "def", "parse_requirements", "(", "filename", ",", "# type: str", "finder", "=", "None", ",", "# type: Optional[PackageFinder]", "comes_from", "=", "None", ",", "# type: Optional[str]", "options", "=", "None", ",", "# type: Optional[optparse.Values]", "session", "=", "N...
https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pip/_internal/req/req_file.py#L74-L114
openstack/neutron
fb229fb527ac8b95526412f7762d90826ac41428
neutron/services/trunk/utils.py
python
get_agent_types_by_host
(context, host)
return agent_types
Return the agent types registered on the host.
Return the agent types registered on the host.
[ "Return", "the", "agent", "types", "registered", "on", "the", "host", "." ]
def get_agent_types_by_host(context, host): """Return the agent types registered on the host.""" agent_types = [] core_plugin = directory.get_plugin() if extensions.is_extension_supported(core_plugin, 'agent'): agents = core_plugin.get_agents( context.elevated(), filters={'host': [ho...
[ "def", "get_agent_types_by_host", "(", "context", ",", "host", ")", ":", "agent_types", "=", "[", "]", "core_plugin", "=", "directory", ".", "get_plugin", "(", ")", "if", "extensions", ".", "is_extension_supported", "(", "core_plugin", ",", "'agent'", ")", ":"...
https://github.com/openstack/neutron/blob/fb229fb527ac8b95526412f7762d90826ac41428/neutron/services/trunk/utils.py#L21-L29
man-group/PythonTrainingExercises
00a2435649fcf53fdafede2d10b40f08463728fe
Beginners/ListsTuples/solutions.py
python
select_first_items
()
return [v[0] for v in x]
Select first item on each list.
Select first item on each list.
[ "Select", "first", "item", "on", "each", "list", "." ]
def select_first_items(): """Select first item on each list.""" x = [('A','x'), ('B','y'), ('C','z')] return [v[0] for v in x]
[ "def", "select_first_items", "(", ")", ":", "x", "=", "[", "(", "'A'", ",", "'x'", ")", ",", "(", "'B'", ",", "'y'", ")", ",", "(", "'C'", ",", "'z'", ")", "]", "return", "[", "v", "[", "0", "]", "for", "v", "in", "x", "]" ]
https://github.com/man-group/PythonTrainingExercises/blob/00a2435649fcf53fdafede2d10b40f08463728fe/Beginners/ListsTuples/solutions.py#L130-L133
jieter/django-tables2
ce392ee2ee341d7180345a6113919cf9a3925f16
django_tables2/columns/base.py
python
Library.register
(self, column)
return column
[]
def register(self, column): if not hasattr(column, "from_field"): raise ImproperlyConfigured( "{} is not a subclass of Column".format(column.__class__.__name__) ) self.columns.append(column) return column
[ "def", "register", "(", "self", ",", "column", ")", ":", "if", "not", "hasattr", "(", "column", ",", "\"from_field\"", ")", ":", "raise", "ImproperlyConfigured", "(", "\"{} is not a subclass of Column\"", ".", "format", "(", "column", ".", "__class__", ".", "_...
https://github.com/jieter/django-tables2/blob/ce392ee2ee341d7180345a6113919cf9a3925f16/django_tables2/columns/base.py#L26-L32
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/mpmath/ctx_base.py
python
StandardBaseContext.fneg
(ctx, x, **kwargs)
return -ctx.convert(x)
[]
def fneg(ctx, x, **kwargs): return -ctx.convert(x)
[ "def", "fneg", "(", "ctx", ",", "x", ",", "*", "*", "kwargs", ")", ":", "return", "-", "ctx", ".", "convert", "(", "x", ")" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/mpmath/ctx_base.py#L80-L81
PySimpleGUI/PySimpleGUI
6c0d1fb54f493d45e90180b322fbbe70f7a5af3c
DemoPrograms/Demo_User_Settings.py
python
settings_window
()
Create and interact with a "settings window". You can a similar pair of functions to your code to add a "settings" feature.
Create and interact with a "settings window". You can a similar pair of functions to your code to add a "settings" feature.
[ "Create", "and", "interact", "with", "a", "settings", "window", ".", "You", "can", "a", "similar", "pair", "of", "functions", "to", "your", "code", "to", "add", "a", "settings", "feature", "." ]
def settings_window(): """ Create and interact with a "settings window". You can a similar pair of functions to your code to add a "settings" feature. """ window = make_window() current_theme = sg.theme() while True: event, values = window.read() if event in (sg.WINDOW_CLOS...
[ "def", "settings_window", "(", ")", ":", "window", "=", "make_window", "(", ")", "current_theme", "=", "sg", ".", "theme", "(", ")", "while", "True", ":", "event", ",", "values", "=", "window", ".", "read", "(", ")", "if", "event", "in", "(", "sg", ...
https://github.com/PySimpleGUI/PySimpleGUI/blob/6c0d1fb54f493d45e90180b322fbbe70f7a5af3c/DemoPrograms/Demo_User_Settings.py#L52-L76
savon-noir/python-libnmap
8f442747a7a16969309d6f7653ad1b13a3a99bae
libnmap/plugins/s3.py
python
NmapS3Plugin.getall
(self, dict_filter=None)
return nmapreportlist
:rtype: List of tuple :return: list of key/report :todo: add a filter capability
:rtype: List of tuple :return: list of key/report :todo: add a filter capability
[ ":", "rtype", ":", "List", "of", "tuple", ":", "return", ":", "list", "of", "key", "/", "report", ":", "todo", ":", "add", "a", "filter", "capability" ]
def getall(self, dict_filter=None): """ :rtype: List of tuple :return: list of key/report :todo: add a filter capability """ nmapreportlist = [] for key in bucket_lister(self.bucket): if isinstance(key, Key): nmapreportjson = json.loads...
[ "def", "getall", "(", "self", ",", "dict_filter", "=", "None", ")", ":", "nmapreportlist", "=", "[", "]", "for", "key", "in", "bucket_lister", "(", "self", ".", "bucket", ")", ":", "if", "isinstance", "(", "key", ",", "Key", ")", ":", "nmapreportjson",...
https://github.com/savon-noir/python-libnmap/blob/8f442747a7a16969309d6f7653ad1b13a3a99bae/libnmap/plugins/s3.py#L117-L129
savio-code/fern-wifi-cracker
0da03aba988c66dfa131a45824568abb84b7704a
Fern-Wifi-Cracker/core/wpa.py
python
wpa_attack_dialog.wpa_key_found
(self)
[]
def wpa_key_found(self): icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("%s/resources/wifi_4.png"%(os.getcwd()))) self.attack_button.setIcon(icon) self.attack_button.setText('Attack') self.new_automate_key() wpa_key_read = reader('/tmp/fern-log/WPA-DUMP/wpa_key.txt')...
[ "def", "wpa_key_found", "(", "self", ")", ":", "icon", "=", "QtGui", ".", "QIcon", "(", ")", "icon", ".", "addPixmap", "(", "QtGui", ".", "QPixmap", "(", "\"%s/resources/wifi_4.png\"", "%", "(", "os", ".", "getcwd", "(", ")", ")", ")", ")", "self", "...
https://github.com/savio-code/fern-wifi-cracker/blob/0da03aba988c66dfa131a45824568abb84b7704a/Fern-Wifi-Cracker/core/wpa.py#L429-L452
mila-iqia/myia
56774a39579b4ec4123f44843ad4ca688acc859b
myia/abstract/ref.py
python
Context.__init__
(self, parent, g, argkey)
Initialize the Context.
Initialize the Context.
[ "Initialize", "the", "Context", "." ]
def __init__(self, parent, g, argkey): """Initialize the Context.""" assert argkey is not None self.parent = parent self.graph = g self.argkey = argkey self.parent_cache = dict(parent.parent_cache) if parent else {} self.parent_cache[g] = self self._hash =...
[ "def", "__init__", "(", "self", ",", "parent", ",", "g", ",", "argkey", ")", ":", "assert", "argkey", "is", "not", "None", "self", ".", "parent", "=", "parent", "self", ".", "graph", "=", "g", "self", ".", "argkey", "=", "argkey", "self", ".", "par...
https://github.com/mila-iqia/myia/blob/56774a39579b4ec4123f44843ad4ca688acc859b/myia/abstract/ref.py#L26-L34
fastnlp/fastNLP
fb645d370f4cc1b00c7dbb16c1ff4542327c46e5
fastNLP/modules/encoder/_elmo.py
python
ElmobiLm.forward
(self, inputs, seq_len)
return output
r""" :param inputs: batch_size x max_len x embed_size :param seq_len: batch_size :return: torch.FloatTensor. num_layers x batch_size x max_len x hidden_size
r"""
[ "r" ]
def forward(self, inputs, seq_len): r""" :param inputs: batch_size x max_len x embed_size :param seq_len: batch_size :return: torch.FloatTensor. num_layers x batch_size x max_len x hidden_size """ max_len = inputs.size(1) sort_lens, sort_idx = torch.sort(seq_len,...
[ "def", "forward", "(", "self", ",", "inputs", ",", "seq_len", ")", ":", "max_len", "=", "inputs", ".", "size", "(", "1", ")", "sort_lens", ",", "sort_idx", "=", "torch", ".", "sort", "(", "seq_len", ",", "dim", "=", "0", ",", "descending", "=", "Tr...
https://github.com/fastnlp/fastNLP/blob/fb645d370f4cc1b00c7dbb16c1ff4542327c46e5/fastNLP/modules/encoder/_elmo.py#L309-L323
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/lib2to3/pytree.py
python
Leaf._prefix_getter
(self)
return self._prefix
The whitespace and comments preceding this token in the input.
The whitespace and comments preceding this token in the input.
[ "The", "whitespace", "and", "comments", "preceding", "this", "token", "in", "the", "input", "." ]
def _prefix_getter(self): """ The whitespace and comments preceding this token in the input. """ return self._prefix
[ "def", "_prefix_getter", "(", "self", ")", ":", "return", "self", ".", "_prefix" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/lib2to3/pytree.py#L417-L421
magenta/magenta
be6558f1a06984faff6d6949234f5fe9ad0ffdb5
magenta/models/gansynth/lib/data_normalizer.py
python
SpecgramsSimpleNormalizer.compute
(self, data_np)
return np.asarray([m_a, m_b, p_a, p_b])
[]
def compute(self, data_np): m_a, m_b = _range_normalizer(data_np[:, :, :, 0], self._margin) p_a, p_b = _range_normalizer(data_np[:, :, :, 1], self._margin) return np.asarray([m_a, m_b, p_a, p_b])
[ "def", "compute", "(", "self", ",", "data_np", ")", ":", "m_a", ",", "m_b", "=", "_range_normalizer", "(", "data_np", "[", ":", ",", ":", ",", ":", ",", "0", "]", ",", "self", ".", "_margin", ")", "p_a", ",", "p_b", "=", "_range_normalizer", "(", ...
https://github.com/magenta/magenta/blob/be6558f1a06984faff6d6949234f5fe9ad0ffdb5/magenta/models/gansynth/lib/data_normalizer.py#L154-L157
sukeesh/Jarvis
2dc2a550b59ea86cca5dfb965661b6fc4cabd434
jarviscli/plugins/converted.py
python
do_umbrella
(self, s)
will inform you if you might need an umbrella or not.
will inform you if you might need an umbrella or not.
[ "will", "inform", "you", "if", "you", "might", "need", "an", "umbrella", "or", "not", "." ]
def do_umbrella(self, s): """will inform you if you might need an umbrella or not.""" self = self._jarvis s = 'umbrella' weather_pinpoint.main(self.memory, self, s)
[ "def", "do_umbrella", "(", "self", ",", "s", ")", ":", "self", "=", "self", ".", "_jarvis", "s", "=", "'umbrella'", "weather_pinpoint", ".", "main", "(", "self", ".", "memory", ",", "self", ",", "s", ")" ]
https://github.com/sukeesh/Jarvis/blob/2dc2a550b59ea86cca5dfb965661b6fc4cabd434/jarviscli/plugins/converted.py#L82-L87
tdeboissiere/DeepLearningImplementations
5c4094880fc6992cca2d6e336463b2525026f6e2
DeconvNet/KerasDeconv.py
python
DeconvNet.get_layers
(self)
return list_layers_name
Returns the layers of the network :returns: returns the layers of the network :rtype: list
Returns the layers of the network
[ "Returns", "the", "layers", "of", "the", "network" ]
def get_layers(self): """Returns the layers of the network :returns: returns the layers of the network :rtype: list """ list_layers = self.model.layers list_layers_name = [l.name for l in list_layers] return list_layers_name
[ "def", "get_layers", "(", "self", ")", ":", "list_layers", "=", "self", ".", "model", ".", "layers", "list_layers_name", "=", "[", "l", ".", "name", "for", "l", "in", "list_layers", "]", "return", "list_layers_name" ]
https://github.com/tdeboissiere/DeepLearningImplementations/blob/5c4094880fc6992cca2d6e336463b2525026f6e2/DeconvNet/KerasDeconv.py#L156-L165
presslabs/gitfs
12886ec5b9c7e103bfcab0cd37a8333873382fae
gitfs/views/current.py
python
CurrentView.mkdir
(self, path, mode)
return result
[]
def mkdir(self, path, mode): result = super(CurrentView, self).mkdir(path, mode) keep_path = "{}/.keep".format(path) full_path = self.repo._full_path(keep_path) if not os.path.exists(keep_path): global writers fh = os.open(full_path, os.O_WRONLY | os.O_CREAT) ...
[ "def", "mkdir", "(", "self", ",", "path", ",", "mode", ")", ":", "result", "=", "super", "(", "CurrentView", ",", "self", ")", ".", "mkdir", "(", "path", ",", "mode", ")", "keep_path", "=", "\"{}/.keep\"", ".", "format", "(", "path", ")", "full_path"...
https://github.com/presslabs/gitfs/blob/12886ec5b9c7e103bfcab0cd37a8333873382fae/gitfs/views/current.py#L109-L131
kpreid/shinysdr
25022d36903ff67e036e82a22b6555a12a4d8e8a
shinysdr/math.py
python
to_dB
(x)
return 10 * log10(x)
Convert multiplicative value to dB value.
Convert multiplicative value to dB value.
[ "Convert", "multiplicative", "value", "to", "dB", "value", "." ]
def to_dB(x): """Convert multiplicative value to dB value.""" return 10 * log10(x)
[ "def", "to_dB", "(", "x", ")", ":", "return", "10", "*", "log10", "(", "x", ")" ]
https://github.com/kpreid/shinysdr/blob/25022d36903ff67e036e82a22b6555a12a4d8e8a/shinysdr/math.py#L37-L39
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/app_manager/models.py
python
LoadUpdateAction.get_paths
(self)
[]
def get_paths(self): for path in super(LoadUpdateAction, self).get_paths(): yield path for path in self.preload.keys(): yield path
[ "def", "get_paths", "(", "self", ")", ":", "for", "path", "in", "super", "(", "LoadUpdateAction", ",", "self", ")", ".", "get_paths", "(", ")", ":", "yield", "path", "for", "path", "in", "self", ".", "preload", ".", "keys", "(", ")", ":", "yield", ...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/app_manager/models.py#L552-L557
django-cms/django-cms
272d62ced15a86c9d34eb21700e6358bb08388ea
cms/utils/placeholder.py
python
get_placeholder_conf
(setting, placeholder, template=None, default=None)
return default
Returns the placeholder configuration for a given setting. The key would for example be 'plugins' or 'name'. Resulting value will be the last from: CMS_PLACEHOLDER_CONF[None] (global) CMS_PLACEHOLDER_CONF['template'] (if template is given) CMS_PLACEHOLDER_CONF['placeholder'] CMS_PLACEHOLDER_CO...
Returns the placeholder configuration for a given setting. The key would for example be 'plugins' or 'name'.
[ "Returns", "the", "placeholder", "configuration", "for", "a", "given", "setting", ".", "The", "key", "would", "for", "example", "be", "plugins", "or", "name", "." ]
def get_placeholder_conf(setting, placeholder, template=None, default=None): """ Returns the placeholder configuration for a given setting. The key would for example be 'plugins' or 'name'. Resulting value will be the last from: CMS_PLACEHOLDER_CONF[None] (global) CMS_PLACEHOLDER_CONF['templat...
[ "def", "get_placeholder_conf", "(", "setting", ",", "placeholder", ",", "template", "=", "None", ",", "default", "=", "None", ")", ":", "if", "placeholder", ":", "keys", "=", "[", "]", "placeholder_conf", "=", "get_cms_setting", "(", "'PLACEHOLDER_CONF'", ")",...
https://github.com/django-cms/django-cms/blob/272d62ced15a86c9d34eb21700e6358bb08388ea/cms/utils/placeholder.py#L35-L78
ReceiptManager/receipt-parser-legacy
3da117b993311e296860fc1b08aab51d7afcefaa
receipt_parser_core/enhancer.py
python
find_images
(folder)
:param folder: str Path to folder to search :return: generator of str List of images in folder
:param folder: str Path to folder to search :return: generator of str List of images in folder
[ ":", "param", "folder", ":", "str", "Path", "to", "folder", "to", "search", ":", "return", ":", "generator", "of", "str", "List", "of", "images", "in", "folder" ]
def find_images(folder): """ :param folder: str Path to folder to search :return: generator of str List of images in folder """ for file in os.listdir(folder): full_path = os.path.join(folder, file) if os.path.isfile(full_path): try: _ = I...
[ "def", "find_images", "(", "folder", ")", ":", "for", "file", "in", "os", ".", "listdir", "(", "folder", ")", ":", "full_path", "=", "os", ".", "path", ".", "join", "(", "folder", ",", "file", ")", "if", "os", ".", "path", ".", "isfile", "(", "fu...
https://github.com/ReceiptManager/receipt-parser-legacy/blob/3da117b993311e296860fc1b08aab51d7afcefaa/receipt_parser_core/enhancer.py#L52-L67
ChunyuanLI/Optimus
f63f4a7ca10aea022978500a37d72dd53a37a576
code/examples/big_ae/run_lm_vae_pretraining.py
python
train
(args, train_dataloader, model_vae, encoder_tokenizer, decoder_tokenizer, table_name)
return global_step, tr_loss / global_step
Train the model
Train the model
[ "Train", "the", "model" ]
def train(args, train_dataloader, model_vae, encoder_tokenizer, decoder_tokenizer, table_name): """ Train the model """ if args.local_rank in [-1, 0]: tb_writer = SummaryWriter() args.train_batch_size = args.per_gpu_train_batch_size * max(1, args.n_gpu) # train_sampler = RandomSampler(train_dat...
[ "def", "train", "(", "args", ",", "train_dataloader", ",", "model_vae", ",", "encoder_tokenizer", ",", "decoder_tokenizer", ",", "table_name", ")", ":", "if", "args", ".", "local_rank", "in", "[", "-", "1", ",", "0", "]", ":", "tb_writer", "=", "SummaryWri...
https://github.com/ChunyuanLI/Optimus/blob/f63f4a7ca10aea022978500a37d72dd53a37a576/code/examples/big_ae/run_lm_vae_pretraining.py#L122-L372
etetoolkit/ete
2b207357dc2a40ccad7bfd8f54964472c72e4726
ete3/phyloxml/_phyloxml.py
python
Accession.exportLiteral
(self, outfile, level, name_='Accession')
[]
def exportLiteral(self, outfile, level, name_='Accession'): level += 1 self.exportLiteralAttributes(outfile, level, [], name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) showIndent(outfile, level) outfile.write('valueOf_ = """%s""",\n' % ...
[ "def", "exportLiteral", "(", "self", ",", "outfile", ",", "level", ",", "name_", "=", "'Accession'", ")", ":", "level", "+=", "1", "self", ".", "exportLiteralAttributes", "(", "outfile", ",", "level", ",", "[", "]", ",", "name_", ")", "if", "self", "."...
https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/phyloxml/_phyloxml.py#L1783-L1789
sphinx-doc/sphinx
e79681c76843c1339863b365747079b2d662d0c1
sphinx/util/inspect.py
python
evaluate_signature
(sig: inspect.Signature, globalns: Dict = None, localns: Dict = None )
return sig.replace(parameters=parameters, return_annotation=return_annotation)
Evaluate unresolved type annotations in a signature object.
Evaluate unresolved type annotations in a signature object.
[ "Evaluate", "unresolved", "type", "annotations", "in", "a", "signature", "object", "." ]
def evaluate_signature(sig: inspect.Signature, globalns: Dict = None, localns: Dict = None ) -> inspect.Signature: """Evaluate unresolved type annotations in a signature object.""" def evaluate_forwardref(ref: ForwardRef, globalns: Dict, localns: Dict) -> Any: """Evaluate a forwar...
[ "def", "evaluate_signature", "(", "sig", ":", "inspect", ".", "Signature", ",", "globalns", ":", "Dict", "=", "None", ",", "localns", ":", "Dict", "=", "None", ")", "->", "inspect", ".", "Signature", ":", "def", "evaluate_forwardref", "(", "ref", ":", "F...
https://github.com/sphinx-doc/sphinx/blob/e79681c76843c1339863b365747079b2d662d0c1/sphinx/util/inspect.py#L699-L743
pytroll/satpy
09e51f932048f98cce7919a4ff8bd2ec01e1ae98
satpy/readers/modis_l2.py
python
ModisL2HDFFileHandler.is_imapp_mask_byte1
(self)
return "mask_byte1" in self.filetype_info["file_type"]
Get if this file is the IMAPP 'mask_byte1' file type.
Get if this file is the IMAPP 'mask_byte1' file type.
[ "Get", "if", "this", "file", "is", "the", "IMAPP", "mask_byte1", "file", "type", "." ]
def is_imapp_mask_byte1(self): """Get if this file is the IMAPP 'mask_byte1' file type.""" return "mask_byte1" in self.filetype_info["file_type"]
[ "def", "is_imapp_mask_byte1", "(", "self", ")", ":", "return", "\"mask_byte1\"", "in", "self", ".", "filetype_info", "[", "\"file_type\"", "]" ]
https://github.com/pytroll/satpy/blob/09e51f932048f98cce7919a4ff8bd2ec01e1ae98/satpy/readers/modis_l2.py#L73-L75
cournape/Bento
37de23d784407a7c98a4a15770ffc570d5f32d70
bento/commands/dependency.py
python
CommandDataProvider.__getitem__
(self, command_name)
return self._data[command_name]
[]
def __getitem__(self, command_name): return self._data[command_name]
[ "def", "__getitem__", "(", "self", ",", "command_name", ")", ":", "return", "self", ".", "_data", "[", "command_name", "]" ]
https://github.com/cournape/Bento/blob/37de23d784407a7c98a4a15770ffc570d5f32d70/bento/commands/dependency.py#L94-L95
cyrozap/python-vipaccess
787ac6ee1e0b80f35fb7710c17f2fe6b3329882b
vipaccess/utils.py
python
get_token_from_response
(response_xml)
Retrieve relevant token details from Symantec's provisioning response.
Retrieve relevant token details from Symantec's provisioning response.
[ "Retrieve", "relevant", "token", "details", "from", "Symantec", "s", "provisioning", "response", "." ]
def get_token_from_response(response_xml): '''Retrieve relevant token details from Symantec's provisioning response.''' # Define an arbitrary namespace "vipservice" because xpath doesn't like it # when it's "None" namespace = {'vipservice':'http://www.verisign.com/2006/08/vipservice'} tree = et...
[ "def", "get_token_from_response", "(", "response_xml", ")", ":", "# Define an arbitrary namespace \"vipservice\" because xpath doesn't like it", "# when it's \"None\"", "namespace", "=", "{", "'vipservice'", ":", "'http://www.verisign.com/2006/08/vipservice'", "}", "tree", "=", "et...
https://github.com/cyrozap/python-vipaccess/blob/787ac6ee1e0b80f35fb7710c17f2fe6b3329882b/vipaccess/utils.py#L149-L210
w3h/isf
6faf0a3df185465ec17369c90ccc16e2a03a1870
lib/thirdparty/nmap/nmap.py
python
PortScannerHostDict.sctp
(self, port)
return self['sctp'][port]
:returns: info for sctp port
:returns: info for sctp port
[ ":", "returns", ":", "info", "for", "sctp", "port" ]
def sctp(self, port): """ :returns: info for sctp port """ assert type(port) is int, 'Wrong type for [port], should be an int [was {0}]'.format(type(port)) return self['sctp'][port]
[ "def", "sctp", "(", "self", ",", "port", ")", ":", "assert", "type", "(", "port", ")", "is", "int", ",", "'Wrong type for [port], should be an int [was {0}]'", ".", "format", "(", "type", "(", "port", ")", ")", "return", "self", "[", "'sctp'", "]", "[", ...
https://github.com/w3h/isf/blob/6faf0a3df185465ec17369c90ccc16e2a03a1870/lib/thirdparty/nmap/nmap.py#L1035-L1042
lmco/laikaboss
eb04b4c4fe7bf3fc86c26b8a37451d99e6fc9c17
laikaboss/util.py
python
get_module_arguments
(sm)
return module, arg_dict
Extracts arguments from scan module declarations inside the yara dispatcher. Format is: SCAN_MODULE(arg1=value1,arg2=value2, arg3=value3) Arguments: sm --- a string in the format above Returns: A tuple containing the module name and a dictionary containing key value pairs.
Extracts arguments from scan module declarations inside the yara dispatcher. Format is: SCAN_MODULE(arg1=value1,arg2=value2, arg3=value3) Arguments: sm --- a string in the format above
[ "Extracts", "arguments", "from", "scan", "module", "declarations", "inside", "the", "yara", "dispatcher", ".", "Format", "is", ":", "SCAN_MODULE", "(", "arg1", "=", "value1", "arg2", "=", "value2", "arg3", "=", "value3", ")", "Arguments", ":", "sm", "---", ...
def get_module_arguments(sm): ''' Extracts arguments from scan module declarations inside the yara dispatcher. Format is: SCAN_MODULE(arg1=value1,arg2=value2, arg3=value3) Arguments: sm --- a string in the format above Returns: A tuple containing the module name and a dictionary co...
[ "def", "get_module_arguments", "(", "sm", ")", ":", "# Set default values", "arg_dict", "=", "{", "}", "module", "=", "\"\"", "# Look for parentheses, indicating arguments exist", "open_paren", "=", "sm", ".", "find", "(", "'('", ")", "try", ":", "if", "open_paren...
https://github.com/lmco/laikaboss/blob/eb04b4c4fe7bf3fc86c26b8a37451d99e6fc9c17/laikaboss/util.py#L450-L483
pyamg/pyamg
e3fb6feaad2358e681f2f4affae3205bfe9a2350
pyamg/relaxation/smoothing.py
python
setup_cgnr
(lvl, tol=1e-12, maxiter=1, M=None, callback=None, residuals=None)
return smoother
Set up CGNR smoothing.
Set up CGNR smoothing.
[ "Set", "up", "CGNR", "smoothing", "." ]
def setup_cgnr(lvl, tol=1e-12, maxiter=1, M=None, callback=None, residuals=None): """Set up CGNR smoothing.""" def smoother(A, x, b): x[:] = ( cgnr( A, b, x0=x, tol=tol, maxiter=maxiter, ...
[ "def", "setup_cgnr", "(", "lvl", ",", "tol", "=", "1e-12", ",", "maxiter", "=", "1", ",", "M", "=", "None", ",", "callback", "=", "None", ",", "residuals", "=", "None", ")", ":", "def", "smoother", "(", "A", ",", "x", ",", "b", ")", ":", "x", ...
https://github.com/pyamg/pyamg/blob/e3fb6feaad2358e681f2f4affae3205bfe9a2350/pyamg/relaxation/smoothing.py#L668-L683
smicallef/spiderfoot
fd4bf9394c9ab3ecc90adc3115c56349fb23165b
sfscan.py
python
SpiderFootScanner.__init__
(self, scanName, scanId, targetValue, targetType, moduleList, globalOpts, start=True)
Initialize SpiderFootScanner object. Args: scanName (str): name of the scan scanId (str): unique ID of the scan targetValue (str): scan target targetType (str): scan target type moduleList (list): list of modules to run globalOpts (dict): ...
Initialize SpiderFootScanner object.
[ "Initialize", "SpiderFootScanner", "object", "." ]
def __init__(self, scanName, scanId, targetValue, targetType, moduleList, globalOpts, start=True): """Initialize SpiderFootScanner object. Args: scanName (str): name of the scan scanId (str): unique ID of the scan targetValue (str): scan target targetType...
[ "def", "__init__", "(", "self", ",", "scanName", ",", "scanId", ",", "targetValue", ",", "targetType", ",", "moduleList", ",", "globalOpts", ",", "start", "=", "True", ")", ":", "if", "not", "isinstance", "(", "globalOpts", ",", "dict", ")", ":", "raise"...
https://github.com/smicallef/spiderfoot/blob/fd4bf9394c9ab3ecc90adc3115c56349fb23165b/sfscan.py#L54-L219
IdentityPython/pysaml2
6badb32d212257bd83ffcc816f9b625f68281b47
src/saml2/samlp.py
python
new_id_from_string
(xml_string)
return saml2.create_class_from_xml_string(NewID, xml_string)
[]
def new_id_from_string(xml_string): return saml2.create_class_from_xml_string(NewID, xml_string)
[ "def", "new_id_from_string", "(", "xml_string", ")", ":", "return", "saml2", ".", "create_class_from_xml_string", "(", "NewID", ",", "xml_string", ")" ]
https://github.com/IdentityPython/pysaml2/blob/6badb32d212257bd83ffcc816f9b625f68281b47/src/saml2/samlp.py#L247-L248
tenpy/tenpy
bbdd3dbbdb511948eb0e6ba7ff619ac6ca657fff
tenpy/networks/mps.py
python
MPSEnvironment.get_RP
(self, i, store=True)
return RP
Calculate RP at given site from nearest available one. The returned ``RP_i`` corresponds to the following contraction, where the M's and the N's are in the 'B' form:: | 'vL' ->---M[i+1]-- ... --M[L-1]----. | | | | | ...
Calculate RP at given site from nearest available one.
[ "Calculate", "RP", "at", "given", "site", "from", "nearest", "available", "one", "." ]
def get_RP(self, i, store=True): """Calculate RP at given site from nearest available one. The returned ``RP_i`` corresponds to the following contraction, where the M's and the N's are in the 'B' form:: | 'vL' ->---M[i+1]-- ... --M[L-1]----. | | ...
[ "def", "get_RP", "(", "self", ",", "i", ",", "store", "=", "True", ")", ":", "# find nearest available RP to the right.", "for", "i0", "in", "range", "(", "i", ",", "i", "+", "self", ".", "L", ")", ":", "key", "=", "self", ".", "_RP_keys", "[", "self...
https://github.com/tenpy/tenpy/blob/bbdd3dbbdb511948eb0e6ba7ff619ac6ca657fff/tenpy/networks/mps.py#L4287-L4328
coin-or/rbfopt
3ba5320a23f04ac3729eff7b55527f2f1e6f9fdd
src/rbfopt/rbfopt_user_black_box.py
python
RbfoptUserBlackBox.get_var_upper
(self)
return self.var_upper
Return the array of upper bounds on the variables. Returns ------- List[float] Upper bounds of the decision variables.
Return the array of upper bounds on the variables.
[ "Return", "the", "array", "of", "upper", "bounds", "on", "the", "variables", "." ]
def get_var_upper(self): """Return the array of upper bounds on the variables. Returns ------- List[float] Upper bounds of the decision variables. """ return self.var_upper
[ "def", "get_var_upper", "(", "self", ")", ":", "return", "self", ".", "var_upper" ]
https://github.com/coin-or/rbfopt/blob/3ba5320a23f04ac3729eff7b55527f2f1e6f9fdd/src/rbfopt/rbfopt_user_black_box.py#L106-L114
SteveDoyle2/pyNastran
eda651ac2d4883d95a34951f8a002ff94f642a1a
pyNastran/op2/op2.py
python
OP2._is_op2_case_equal
(self, table_type: str, key, a_obj, b_obj, stop_on_failure: bool=True, debug: bool=False)
return True
Helper method for ``assert_op2_equal`` Parameters ---------- table_type : str the type of table (e.g., ``displacements``) key : subcase_id / tuple_obj subcase_id : int the subcase_id tuple_obj : Tuple(???, ???, ...) the...
Helper method for ``assert_op2_equal``
[ "Helper", "method", "for", "assert_op2_equal" ]
def _is_op2_case_equal(self, table_type: str, key, a_obj, b_obj, stop_on_failure: bool=True, debug: bool=False) -> bool: """ Helper method for ``assert_op2_equal`` Parameters ---------- table_type : str the type o...
[ "def", "_is_op2_case_equal", "(", "self", ",", "table_type", ":", "str", ",", "key", ",", "a_obj", ",", "b_obj", ",", "stop_on_failure", ":", "bool", "=", "True", ",", "debug", ":", "bool", "=", "False", ")", "->", "bool", ":", "# check the name (e.g., Rea...
https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/op2/op2.py#L251-L331
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_env.py
python
Yedit.process_edits
(edits, yamlfile)
return {'changed': len(results) > 0, 'results': results}
run through a list of edits and process them one-by-one
run through a list of edits and process them one-by-one
[ "run", "through", "a", "list", "of", "edits", "and", "process", "them", "one", "-", "by", "-", "one" ]
def process_edits(edits, yamlfile): '''run through a list of edits and process them one-by-one''' results = [] for edit in edits: value = Yedit.parse_value(edit['value'], edit.get('value_type', '')) if edit.get('action') == 'update': # pylint: disable=line...
[ "def", "process_edits", "(", "edits", ",", "yamlfile", ")", ":", "results", "=", "[", "]", "for", "edit", "in", "edits", ":", "value", "=", "Yedit", ".", "parse_value", "(", "edit", "[", "'value'", "]", ",", "edit", ".", "get", "(", "'value_type'", "...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_env.py#L715-L740
beetbox/beets
2fea53c34dd505ba391cb345424e0613901c8025
beetsplug/beatport.py
python
BeatportPlugin.candidates
(self, items, artist, release, va_likely, extra_tags=None)
Returns a list of AlbumInfo objects for beatport search results matching release and artist (if not various).
Returns a list of AlbumInfo objects for beatport search results matching release and artist (if not various).
[ "Returns", "a", "list", "of", "AlbumInfo", "objects", "for", "beatport", "search", "results", "matching", "release", "and", "artist", "(", "if", "not", "various", ")", "." ]
def candidates(self, items, artist, release, va_likely, extra_tags=None): """Returns a list of AlbumInfo objects for beatport search results matching release and artist (if not various). """ if va_likely: query = release else: query = f'{artist} {release}'...
[ "def", "candidates", "(", "self", ",", "items", ",", "artist", ",", "release", ",", "va_likely", ",", "extra_tags", "=", "None", ")", ":", "if", "va_likely", ":", "query", "=", "release", "else", ":", "query", "=", "f'{artist} {release}'", "try", ":", "r...
https://github.com/beetbox/beets/blob/2fea53c34dd505ba391cb345424e0613901c8025/beetsplug/beatport.py#L353-L365
fossasia/x-mario-center
fe67afe28d995dcf4e2498e305825a4859566172
softwarecenter/ui/gtk3/panes/availablepane.py
python
AvailablePane.on_db_reopen
(self, db)
Called when the database is reopened.
Called when the database is reopened.
[ "Called", "when", "the", "database", "is", "reopened", "." ]
def on_db_reopen(self, db): """Called when the database is reopened.""" super(AvailablePane, self).on_db_reopen(db) self.refresh_apps() if self.app_details_view: self.app_details_view.refresh_app()
[ "def", "on_db_reopen", "(", "self", ",", "db", ")", ":", "super", "(", "AvailablePane", ",", "self", ")", ".", "on_db_reopen", "(", "db", ")", "self", ".", "refresh_apps", "(", ")", "if", "self", ".", "app_details_view", ":", "self", ".", "app_details_vi...
https://github.com/fossasia/x-mario-center/blob/fe67afe28d995dcf4e2498e305825a4859566172/softwarecenter/ui/gtk3/panes/availablepane.py#L599-L604
Antergos/Cnchi
13ac2209da9432d453e0097cf48a107640b563a9
src/pages/wireless.py
python
Wireless.state_changed
(self, _unused, state)
State has changed
State has changed
[ "State", "has", "changed" ]
def state_changed(self, _unused, state): """ State has changed """ print("state_changed") self.state = state if not self.use_wireless.get_active(): return if state != nm.NM_STATE_CONNECTING: # TODO: Hide and stop spinner pass else: ...
[ "def", "state_changed", "(", "self", ",", "_unused", ",", "state", ")", ":", "print", "(", "\"state_changed\"", ")", "self", ".", "state", "=", "state", "if", "not", "self", ".", "use_wireless", ".", "get_active", "(", ")", ":", "return", "if", "state", ...
https://github.com/Antergos/Cnchi/blob/13ac2209da9432d453e0097cf48a107640b563a9/src/pages/wireless.py#L133-L148
brainiak/brainiak
ee093597c6c11597b0a59e95b48d2118e40394a5
brainiak/fcma/classifier.py
python
Classifier._generate_training_data
(self, X1, X2, num_training_samples)
return data
Generate training data for the classifier. Compute the correlation, do the normalization if necessary, and compute the kernel matrix if the classifier is sklearn.svm.SVC with precomputed kernel. Parameters ---------- X1: a list of numpy array in shape [num_TRs, num_voxe...
Generate training data for the classifier.
[ "Generate", "training", "data", "for", "the", "classifier", "." ]
def _generate_training_data(self, X1, X2, num_training_samples): """Generate training data for the classifier. Compute the correlation, do the normalization if necessary, and compute the kernel matrix if the classifier is sklearn.svm.SVC with precomputed kernel. Parameters ...
[ "def", "_generate_training_data", "(", "self", ",", "X1", ",", "X2", ",", "num_training_samples", ")", ":", "if", "not", "(", "isinstance", "(", "self", ".", "clf", ",", "sklearn", ".", "svm", ".", "SVC", ")", "and", "self", ".", "clf", ".", "kernel", ...
https://github.com/brainiak/brainiak/blob/ee093597c6c11597b0a59e95b48d2118e40394a5/brainiak/fcma/classifier.py#L350-L424
tensorflow/datasets
2e496976d7d45550508395fb2f35cf958c8a3414
tensorflow_datasets/image_classification/mnist.py
python
MNIST._split_generators
(self, dl_manager)
return [ tfds.core.SplitGenerator( name=tfds.Split.TRAIN, gen_kwargs=dict( num_examples=_TRAIN_EXAMPLES, data_path=mnist_files["train_data"], label_path=mnist_files["train_labels"], )), tfds.core.SplitGenerator( ...
Returns SplitGenerators.
Returns SplitGenerators.
[ "Returns", "SplitGenerators", "." ]
def _split_generators(self, dl_manager): """Returns SplitGenerators.""" # Download the full MNIST Database filenames = { "train_data": _MNIST_TRAIN_DATA_FILENAME, "train_labels": _MNIST_TRAIN_LABELS_FILENAME, "test_data": _MNIST_TEST_DATA_FILENAME, "test_labels": _MNIST_TEST_...
[ "def", "_split_generators", "(", "self", ",", "dl_manager", ")", ":", "# Download the full MNIST Database", "filenames", "=", "{", "\"train_data\"", ":", "_MNIST_TRAIN_DATA_FILENAME", ",", "\"train_labels\"", ":", "_MNIST_TRAIN_LABELS_FILENAME", ",", "\"test_data\"", ":", ...
https://github.com/tensorflow/datasets/blob/2e496976d7d45550508395fb2f35cf958c8a3414/tensorflow_datasets/image_classification/mnist.py#L109-L138
hydroshare/hydroshare
7ba563b55412f283047fb3ef6da367d41dec58c6
hs_tools_resource/models.py
python
SupportedSharingStatus._add_sharing_status
(cls, meta_instance, sharing_status_list)
[]
def _add_sharing_status(cls, meta_instance, sharing_status_list): for sharing_status in sharing_status_list: # there are three possibilities for res_type_str values: # list of SupportedSharingStatusChoices object or # list of string (during normal create or update) or ...
[ "def", "_add_sharing_status", "(", "cls", ",", "meta_instance", ",", "sharing_status_list", ")", ":", "for", "sharing_status", "in", "sharing_status_list", ":", "# there are three possibilities for res_type_str values:", "# list of SupportedSharingStatusChoices object or", "# list ...
https://github.com/hydroshare/hydroshare/blob/7ba563b55412f283047fb3ef6da367d41dec58c6/hs_tools_resource/models.py#L392-L418
PlasmaPy/PlasmaPy
78d63e341216475ce3318e1409296480407c9019
plasmapy/formulary/parameters.py
python
thermal_pressure
(T: u.K, n: u.m ** -3)
return n * k_B * T
r""" Return the thermal pressure for a Maxwellian distribution. **Aliases:** `pth_` Parameters ---------- T : `~astropy.units.Quantity` The particle temperature in either kelvin or energy per particle. n : `~astropy.units.Quantity` The particle number density in units converti...
r""" Return the thermal pressure for a Maxwellian distribution.
[ "r", "Return", "the", "thermal", "pressure", "for", "a", "Maxwellian", "distribution", "." ]
def thermal_pressure(T: u.K, n: u.m ** -3) -> u.Pa: r""" Return the thermal pressure for a Maxwellian distribution. **Aliases:** `pth_` Parameters ---------- T : `~astropy.units.Quantity` The particle temperature in either kelvin or energy per particle. n : `~astropy.units.Quantit...
[ "def", "thermal_pressure", "(", "T", ":", "u", ".", "K", ",", "n", ":", "u", ".", "m", "**", "-", "3", ")", "->", "u", ".", "Pa", ":", "return", "n", "*", "k_B", "*", "T" ]
https://github.com/PlasmaPy/PlasmaPy/blob/78d63e341216475ce3318e1409296480407c9019/plasmapy/formulary/parameters.py#L697-L740
Azure/azure-devops-cli-extension
11334cd55806bef0b99c3bee5a438eed71e44037
azure-devops/azext_devops/devops_sdk/v5_1/extension_management/extension_management_client.py
python
ExtensionManagementClient.uninstall_extension_by_name
(self, publisher_name, extension_name, reason=None, reason_code=None)
UninstallExtensionByName. [Preview API] Uninstall the specified extension from the account / project collection. :param str publisher_name: Name of the publisher. Example: "fabrikam". :param str extension_name: Name of the extension. Example: "ops-tools". :param str reason: :para...
UninstallExtensionByName. [Preview API] Uninstall the specified extension from the account / project collection. :param str publisher_name: Name of the publisher. Example: "fabrikam". :param str extension_name: Name of the extension. Example: "ops-tools". :param str reason: :para...
[ "UninstallExtensionByName", ".", "[", "Preview", "API", "]", "Uninstall", "the", "specified", "extension", "from", "the", "account", "/", "project", "collection", ".", ":", "param", "str", "publisher_name", ":", "Name", "of", "the", "publisher", ".", "Example", ...
def uninstall_extension_by_name(self, publisher_name, extension_name, reason=None, reason_code=None): """UninstallExtensionByName. [Preview API] Uninstall the specified extension from the account / project collection. :param str publisher_name: Name of the publisher. Example: "fabrikam". ...
[ "def", "uninstall_extension_by_name", "(", "self", ",", "publisher_name", ",", "extension_name", ",", "reason", "=", "None", ",", "reason_code", "=", "None", ")", ":", "route_values", "=", "{", "}", "if", "publisher_name", "is", "not", "None", ":", "route_valu...
https://github.com/Azure/azure-devops-cli-extension/blob/11334cd55806bef0b99c3bee5a438eed71e44037/azure-devops/azext_devops/devops_sdk/v5_1/extension_management/extension_management_client.py#L111-L133
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/SQLAlchemy-1.3.17/lib/sqlalchemy/sql/schema.py
python
Index.bind
(self)
return self.table.bind
Return the connectable associated with this Index.
Return the connectable associated with this Index.
[ "Return", "the", "connectable", "associated", "with", "this", "Index", "." ]
def bind(self): """Return the connectable associated with this Index.""" return self.table.bind
[ "def", "bind", "(", "self", ")", ":", "return", "self", ".", "table", ".", "bind" ]
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/SQLAlchemy-1.3.17/lib/sqlalchemy/sql/schema.py#L3814-L3817
dropbox/dropbox-sdk-python
015437429be224732990041164a21a0501235db1
dropbox/team_log.py
python
EventDetails.get_emm_create_usage_report_details
(self)
return self._value
Only call this if :meth:`is_emm_create_usage_report_details` is true. :rtype: EmmCreateUsageReportDetails
Only call this if :meth:`is_emm_create_usage_report_details` is true.
[ "Only", "call", "this", "if", ":", "meth", ":", "is_emm_create_usage_report_details", "is", "true", "." ]
def get_emm_create_usage_report_details(self): """ Only call this if :meth:`is_emm_create_usage_report_details` is true. :rtype: EmmCreateUsageReportDetails """ if not self.is_emm_create_usage_report_details(): raise AttributeError("tag 'emm_create_usage_report_detai...
[ "def", "get_emm_create_usage_report_details", "(", "self", ")", ":", "if", "not", "self", ".", "is_emm_create_usage_report_details", "(", ")", ":", "raise", "AttributeError", "(", "\"tag 'emm_create_usage_report_details' not set\"", ")", "return", "self", ".", "_value" ]
https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L19309-L19317
electricitymap/electricitymap-contrib
3099e873e1da4c95c7c86f7b14a4e2ac13094cc8
parsers/CA_NB.py
python
fetch_exchange
(zone_key1, zone_key2, session=None, target_datetime=None, logger=None)
return data
Requests the last known power exchange (in MW) between two regions.
Requests the last known power exchange (in MW) between two regions.
[ "Requests", "the", "last", "known", "power", "exchange", "(", "in", "MW", ")", "between", "two", "regions", "." ]
def fetch_exchange(zone_key1, zone_key2, session=None, target_datetime=None, logger=None) -> dict: """Requests the last known power exchange (in MW) between two regions.""" if target_datetime: raise NotImplementedError('This parser is not yet able to parse past dates') sorted_zone_keys = '->'.j...
[ "def", "fetch_exchange", "(", "zone_key1", ",", "zone_key2", ",", "session", "=", "None", ",", "target_datetime", "=", "None", ",", "logger", "=", "None", ")", "->", "dict", ":", "if", "target_datetime", ":", "raise", "NotImplementedError", "(", "'This parser ...
https://github.com/electricitymap/electricitymap-contrib/blob/3099e873e1da4c95c7c86f7b14a4e2ac13094cc8/parsers/CA_NB.py#L78-L113
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/ckafka/v20190819/ckafka_client.py
python
CkafkaClient.DescribeInstancesDetail
(self, request)
用户账户下获取实例列表详情 :param request: Request instance for DescribeInstancesDetail. :type request: :class:`tencentcloud.ckafka.v20190819.models.DescribeInstancesDetailRequest` :rtype: :class:`tencentcloud.ckafka.v20190819.models.DescribeInstancesDetailResponse`
用户账户下获取实例列表详情
[ "用户账户下获取实例列表详情" ]
def DescribeInstancesDetail(self, request): """用户账户下获取实例列表详情 :param request: Request instance for DescribeInstancesDetail. :type request: :class:`tencentcloud.ckafka.v20190819.models.DescribeInstancesDetailRequest` :rtype: :class:`tencentcloud.ckafka.v20190819.models.DescribeInstancesDe...
[ "def", "DescribeInstancesDetail", "(", "self", ",", "request", ")", ":", "try", ":", "params", "=", "request", ".", "_serialize", "(", ")", "body", "=", "self", ".", "call", "(", "\"DescribeInstancesDetail\"", ",", "params", ")", "response", "=", "json", "...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/ckafka/v20190819/ckafka_client.py#L729-L754
tensorflow/models
6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3
research/attention_ocr/python/data_provider.py
python
preprocess_image
(image, augment=False, central_crop_size=None, num_towers=4)
return image
Normalizes image to have values in a narrow range around zero. Args: image: a [H x W x 3] uint8 tensor. augment: optional, if True do random image distortion. central_crop_size: A tuple (crop_width, crop_height). num_towers: optional, number of shots of the same image in the input image. Returns: ...
Normalizes image to have values in a narrow range around zero.
[ "Normalizes", "image", "to", "have", "values", "in", "a", "narrow", "range", "around", "zero", "." ]
def preprocess_image(image, augment=False, central_crop_size=None, num_towers=4): """Normalizes image to have values in a narrow range around zero. Args: image: a [H x W x 3] uint8 tensor. augment: optional, if True do random image distortion. central_crop_size: A tuple (crop_width...
[ "def", "preprocess_image", "(", "image", ",", "augment", "=", "False", ",", "central_crop_size", "=", "None", ",", "num_towers", "=", "4", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "variable_scope", "(", "'PreprocessImage'", ")", ":", "image",...
https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/research/attention_ocr/python/data_provider.py#L119-L148
modoboa/modoboa
9065b7a5679fee149fc6f6f0e1760699c194cf89
modoboa/transport/forms.py
python
TransportForm.__init__
(self, *args, **kwargs)
Set backend list.
Set backend list.
[ "Set", "backend", "list", "." ]
def __init__(self, *args, **kwargs): """Set backend list.""" super(TransportForm, self).__init__(*args, **kwargs) self.fields["service"].choices = backends.manager.get_backend_list() settings = backends.manager.get_all_backend_settings() for name, backend_settings in settings.ite...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", "TransportForm", ",", "self", ")", ".", "__init__", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "fields", "[", "\"service\"", "]", ...
https://github.com/modoboa/modoboa/blob/9065b7a5679fee149fc6f6f0e1760699c194cf89/modoboa/transport/forms.py#L65-L71
brython-dev/brython
9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3
www/src/Lib/uuid.py
python
_netbios_getnode
()
return _windll_getnode()
[DEPRECATED] Get the hardware address on Windows.
[DEPRECATED] Get the hardware address on Windows.
[ "[", "DEPRECATED", "]", "Get", "the", "hardware", "address", "on", "Windows", "." ]
def _netbios_getnode(): """[DEPRECATED] Get the hardware address on Windows.""" # bpo-40501: UuidCreateSequential() is now the only supported approach return _windll_getnode()
[ "def", "_netbios_getnode", "(", ")", ":", "# bpo-40501: UuidCreateSequential() is now the only supported approach", "return", "_windll_getnode", "(", ")" ]
https://github.com/brython-dev/brython/blob/9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3/www/src/Lib/uuid.py#L564-L567
sdispater/orator
0666e522be914db285b6936e3c36801fc1a9c2e7
orator/query/builder.py
python
QueryBuilder.lock_for_update
(self)
return self.lock(True)
Lock the selected rows in the table for updating. :return: The current QueryBuilder instance :rtype: QueryBuilder
Lock the selected rows in the table for updating.
[ "Lock", "the", "selected", "rows", "in", "the", "table", "for", "updating", "." ]
def lock_for_update(self): """ Lock the selected rows in the table for updating. :return: The current QueryBuilder instance :rtype: QueryBuilder """ return self.lock(True)
[ "def", "lock_for_update", "(", "self", ")", ":", "return", "self", ".", "lock", "(", "True", ")" ]
https://github.com/sdispater/orator/blob/0666e522be914db285b6936e3c36801fc1a9c2e7/orator/query/builder.py#L952-L959
SickChill/SickChill
01020f3636d01535f60b83464d8127ea0efabfc7
sickchill/views/api/webapi.py
python
CMDFailed.run
(self)
return _responds(RESULT_SUCCESS, sql_results)
Get the failed downloads
Get the failed downloads
[ "Get", "the", "failed", "downloads" ]
def run(self): """Get the failed downloads""" failed_db_con = db.DBConnection("failed.db", row_type="dict") u_limit = min(int(self.limit), 100) if u_limit == 0: sql_results = failed_db_con.select("SELECT * FROM failed") else: sql_results = failed_db_con....
[ "def", "run", "(", "self", ")", ":", "failed_db_con", "=", "db", ".", "DBConnection", "(", "\"failed.db\"", ",", "row_type", "=", "\"dict\"", ")", "u_limit", "=", "min", "(", "int", "(", "self", ".", "limit", ")", ",", "100", ")", "if", "u_limit", "=...
https://github.com/SickChill/SickChill/blob/01020f3636d01535f60b83464d8127ea0efabfc7/sickchill/views/api/webapi.py#L1200-L1211
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/core/groupby/groupby.py
python
_GroupBy.groups
(self)
return self.grouper.groups
Dict {group name -> group labels}.
Dict {group name -> group labels}.
[ "Dict", "{", "group", "name", "-", ">", "group", "labels", "}", "." ]
def groups(self): """ Dict {group name -> group labels}. """ self._assure_grouper() return self.grouper.groups
[ "def", "groups", "(", "self", ")", ":", "self", ".", "_assure_grouper", "(", ")", "return", "self", ".", "grouper", ".", "groups" ]
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/core/groupby/groupby.py#L385-L390
yoda-pa/yoda
e6b4325737b877488af4d1bf0b86eb1d98b88aed
modules/diary.py
python
today_entry_check
()
check if today's diary entry file exists. If not, create
check if today's diary entry file exists. If not, create
[ "check", "if", "today", "s", "diary", "entry", "file", "exists", ".", "If", "not", "create" ]
def today_entry_check(): """ check if today's diary entry file exists. If not, create """ if not os.path.exists(DIARY_CONFIG_FOLDER_PATH): try: os.makedirs(DIARY_CONFIG_FOLDER_PATH) except OSError as exc: # Guard against race condition if exc.errno != errno.EEXIS...
[ "def", "today_entry_check", "(", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "DIARY_CONFIG_FOLDER_PATH", ")", ":", "try", ":", "os", ".", "makedirs", "(", "DIARY_CONFIG_FOLDER_PATH", ")", "except", "OSError", "as", "exc", ":", "# Guard agai...
https://github.com/yoda-pa/yoda/blob/e6b4325737b877488af4d1bf0b86eb1d98b88aed/modules/diary.py#L90-L99
wakatime/komodo-wakatime
8923c04ded9fa64d7374fadd8cde3a6fadfe053d
components/wakatime/packages/urllib3/fields.py
python
RequestField._render_part
(self, name, value)
return format_header_param(name, value)
Overridable helper function to format a single header parameter. :param name: The name of the parameter, a string expected to be ASCII only. :param value: The value of the parameter, provided as a unicode string.
Overridable helper function to format a single header parameter.
[ "Overridable", "helper", "function", "to", "format", "a", "single", "header", "parameter", "." ]
def _render_part(self, name, value): """ Overridable helper function to format a single header parameter. :param name: The name of the parameter, a string expected to be ASCII only. :param value: The value of the parameter, provided as a unicode string. "...
[ "def", "_render_part", "(", "self", ",", "name", ",", "value", ")", ":", "return", "format_header_param", "(", "name", ",", "value", ")" ]
https://github.com/wakatime/komodo-wakatime/blob/8923c04ded9fa64d7374fadd8cde3a6fadfe053d/components/wakatime/packages/urllib3/fields.py#L105-L114
openstack/openstacksdk
58384268487fa854f21c470b101641ab382c9897
openstack/image/v2/_proxy.py
python
Proxy.get_image
(self, image)
return self._get(_image.Image, image)
Get a single image :param image: The value can be the ID of a image or a :class:`~openstack.image.v2.image.Image` instance. :returns: One :class:`~openstack.image.v2.image.Image` :raises: :class:`~openstack.exceptions.ResourceNotFound` when no resource ca...
Get a single image
[ "Get", "a", "single", "image" ]
def get_image(self, image): """Get a single image :param image: The value can be the ID of a image or a :class:`~openstack.image.v2.image.Image` instance. :returns: One :class:`~openstack.image.v2.image.Image` :raises: :class:`~openstack.exceptions.ResourceNotFoun...
[ "def", "get_image", "(", "self", ",", "image", ")", ":", "return", "self", ".", "_get", "(", "_image", ".", "Image", ",", "image", ")" ]
https://github.com/openstack/openstacksdk/blob/58384268487fa854f21c470b101641ab382c9897/openstack/image/v2/_proxy.py#L482-L492
Shunichi09/PythonLinearNonlinearControl
eb0bf0c78251e372a9db9fa6a888583a11d0ee12
PythonLinearNonlinearControl/envs/env.py
python
Env.reset
(self, init_x=None)
return self.curr_x, {}
reset state Returns: init_x (numpy.ndarray): initial state, shape(state_size, ) info (dict): information
reset state Returns: init_x (numpy.ndarray): initial state, shape(state_size, ) info (dict): information
[ "reset", "state", "Returns", ":", "init_x", "(", "numpy", ".", "ndarray", ")", ":", "initial", "state", "shape", "(", "state_size", ")", "info", "(", "dict", ")", ":", "information" ]
def reset(self, init_x=None): """ reset state Returns: init_x (numpy.ndarray): initial state, shape(state_size, ) info (dict): information """ self.step_count = 0 self.curr_x = np.zeros(self.config["state_size"]) if init_x is not None: ...
[ "def", "reset", "(", "self", ",", "init_x", "=", "None", ")", ":", "self", ".", "step_count", "=", "0", "self", ".", "curr_x", "=", "np", ".", "zeros", "(", "self", ".", "config", "[", "\"state_size\"", "]", ")", "if", "init_x", "is", "not", "None"...
https://github.com/Shunichi09/PythonLinearNonlinearControl/blob/eb0bf0c78251e372a9db9fa6a888583a11d0ee12/PythonLinearNonlinearControl/envs/env.py#L23-L40
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
cpython/Lib/numbers.py
python
Complex.imag
(self)
Retrieve the imaginary component of this number. This should subclass Real.
Retrieve the imaginary component of this number.
[ "Retrieve", "the", "imaginary", "component", "of", "this", "number", "." ]
def imag(self): """Retrieve the imaginary component of this number. This should subclass Real. """ raise NotImplementedError
[ "def", "imag", "(", "self", ")", ":", "raise", "NotImplementedError" ]
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/numbers.py#L65-L70
leo-editor/leo-editor
383d6776d135ef17d73d935a2f0ecb3ac0e99494
leo/plugins/obsolete/tkGui.py
python
leoTkinterMenu.add_separator
(self,menu)
Wrapper for the Tkinter add_separator menu method.
Wrapper for the Tkinter add_separator menu method.
[ "Wrapper", "for", "the", "Tkinter", "add_separator", "menu", "method", "." ]
def add_separator(self,menu): """Wrapper for the Tkinter add_separator menu method.""" if menu: menu.add_separator()
[ "def", "add_separator", "(", "self", ",", "menu", ")", ":", "if", "menu", ":", "menu", ".", "add_separator", "(", ")" ]
https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/plugins/obsolete/tkGui.py#L5974-L5979
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/distutils/dist.py
python
DistributionMetadata.get_author
(self)
return self.author or "UNKNOWN"
[]
def get_author(self): return self.author or "UNKNOWN"
[ "def", "get_author", "(", "self", ")", ":", "return", "self", ".", "author", "or", "\"UNKNOWN\"" ]
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/distutils/dist.py#L1159-L1160
lsbardel/python-stdnet
78db5320bdedc3f28c5e4f38cda13a4469e35db7
stdnet/backends/__init__.py
python
get_connection_string
(scheme, address, params)
return scheme + '://' + address
[]
def get_connection_string(scheme, address, params): if address: address = ':'.join((str(b) for b in address)) else: address = '' if params: address += '?' + urlencode(params) return scheme + '://' + address
[ "def", "get_connection_string", "(", "scheme", ",", "address", ",", "params", ")", ":", "if", "address", ":", "address", "=", "':'", ".", "join", "(", "(", "str", "(", "b", ")", "for", "b", "in", "address", ")", ")", "else", ":", "address", "=", "'...
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/__init__.py#L60-L67
mushorg/glastopf
d17fcb6d8d5fb082af7ea3ef1abbe173895568d9
distribute_setup.py
python
_build_install_args
(options)
return install_args
Build the arguments to 'python setup.py install' on the distribute package
Build the arguments to 'python setup.py install' on the distribute package
[ "Build", "the", "arguments", "to", "python", "setup", ".", "py", "install", "on", "the", "distribute", "package" ]
def _build_install_args(options): """ Build the arguments to 'python setup.py install' on the distribute package """ install_args = [] if options.user_install: if sys.version_info < (2, 6): log.warn("--user requires Python 2.6 or later") raise SystemExit(1) in...
[ "def", "_build_install_args", "(", "options", ")", ":", "install_args", "=", "[", "]", "if", "options", ".", "user_install", ":", "if", "sys", ".", "version_info", "<", "(", "2", ",", "6", ")", ":", "log", ".", "warn", "(", "\"--user requires Python 2.6 or...
https://github.com/mushorg/glastopf/blob/d17fcb6d8d5fb082af7ea3ef1abbe173895568d9/distribute_setup.py#L511-L521
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/axes/_base.py
python
_AxesBase._on_units_changed
(self, scalex=False, scaley=False)
Callback for processing changes to axis units. Currently forces updates of data limits and view limits.
Callback for processing changes to axis units.
[ "Callback", "for", "processing", "changes", "to", "axis", "units", "." ]
def _on_units_changed(self, scalex=False, scaley=False): """ Callback for processing changes to axis units. Currently forces updates of data limits and view limits. """ self.relim() self.autoscale_view(scalex=scalex, scaley=scaley)
[ "def", "_on_units_changed", "(", "self", ",", "scalex", "=", "False", ",", "scaley", "=", "False", ")", ":", "self", ".", "relim", "(", ")", "self", ".", "autoscale_view", "(", "scalex", "=", "scalex", ",", "scaley", "=", "scaley", ")" ]
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/axes/_base.py#L2035-L2042
ales-tsurko/cells
4cf7e395cd433762bea70cdc863a346f3a6fe1d0
packaging/macos/python/lib/python3.7/tkinter/__init__.py
python
Misc.winfo_ismapped
(self)
return self.tk.getint( self.tk.call('winfo', 'ismapped', self._w))
Return true if this widget is mapped.
Return true if this widget is mapped.
[ "Return", "true", "if", "this", "widget", "is", "mapped", "." ]
def winfo_ismapped(self): """Return true if this widget is mapped.""" return self.tk.getint( self.tk.call('winfo', 'ismapped', self._w))
[ "def", "winfo_ismapped", "(", "self", ")", ":", "return", "self", ".", "tk", ".", "getint", "(", "self", ".", "tk", ".", "call", "(", "'winfo'", ",", "'ismapped'", ",", "self", ".", "_w", ")", ")" ]
https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/tkinter/__init__.py#L1008-L1011
jimmysong/pb-exercises
c5e64075c47503a40063aa836c06a452af14246d
session5/complete/tx.py
python
TxOut.serialize
(self)
return result
Returns the byte serialization of the transaction output
Returns the byte serialization of the transaction output
[ "Returns", "the", "byte", "serialization", "of", "the", "transaction", "output" ]
def serialize(self): '''Returns the byte serialization of the transaction output''' # serialize amount, 8 bytes, little endian result = int_to_little_endian(self.amount, 8) # serialize the script_pubkey result += self.script_pubkey.serialize() return result
[ "def", "serialize", "(", "self", ")", ":", "# serialize amount, 8 bytes, little endian", "result", "=", "int_to_little_endian", "(", "self", ".", "amount", ",", "8", ")", "# serialize the script_pubkey", "result", "+=", "self", ".", "script_pubkey", ".", "serialize", ...
https://github.com/jimmysong/pb-exercises/blob/c5e64075c47503a40063aa836c06a452af14246d/session5/complete/tx.py#L317-L323
ifwe/digsby
f5fe00244744aa131e07f09348d10563f3d8fa99
digsby/src/msn/MSNConversation.py
python
MSNConversation.send_typing_status
(self, status)
Status can be None, 'typed' or 'typing'. But, for MSN only 'typing' is understood.
Status can be None, 'typed' or 'typing'. But, for MSN only 'typing' is understood.
[ "Status", "can", "be", "None", "typed", "or", "typing", ".", "But", "for", "MSN", "only", "typing", "is", "understood", "." ]
def send_typing_status(self, status): """ Status can be None, 'typed' or 'typing'. But, for MSN only 'typing' is understood. """ self._stop_exit_timer() getattr(self, 'send_typing_status_%s' % self.type, self.send_typing_status_im)(status)
[ "def", "send_typing_status", "(", "self", ",", "status", ")", ":", "self", ".", "_stop_exit_timer", "(", ")", "getattr", "(", "self", ",", "'send_typing_status_%s'", "%", "self", ".", "type", ",", "self", ".", "send_typing_status_im", ")", "(", "status", ")"...
https://github.com/ifwe/digsby/blob/f5fe00244744aa131e07f09348d10563f3d8fa99/digsby/src/msn/MSNConversation.py#L812-L818
biopython/biopython
2dd97e71762af7b046d7f7f8a4f1e38db6b06c86
Bio/SearchIO/HmmerIO/hmmer3_text.py
python
Hmmer3TextParser._parse_qresult
(self)
Parse a HMMER3 query block (PRIVATE).
Parse a HMMER3 query block (PRIVATE).
[ "Parse", "a", "HMMER3", "query", "block", "(", "PRIVATE", ")", "." ]
def _parse_qresult(self): """Parse a HMMER3 query block (PRIVATE).""" self._read_until(lambda line: line.startswith("Query:")) while self.line: regx = re.search(_QRE_ID_LEN, self.line) while not regx: self.line = read_forward(self.handle) ...
[ "def", "_parse_qresult", "(", "self", ")", ":", "self", ".", "_read_until", "(", "lambda", "line", ":", "line", ".", "startswith", "(", "\"Query:\"", ")", ")", "while", "self", ".", "line", ":", "regx", "=", "re", ".", "search", "(", "_QRE_ID_LEN", ","...
https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/SearchIO/HmmerIO/hmmer3_text.py#L98-L158