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
shichao-an/leetcode-python
6c523ef4759a57433e10271b584eece16f9f05f3
construct_binary_tree_from_preorder_and_inorder_traversal/solution.py
python
Solution.buildTree
(self, preorder, inorder)
[]
def buildTree(self, preorder, inorder): if len(inorder) == 0: return None else: root_val = preorder.pop(0) root_index = inorder.index(root_val) left_tree = self.buildTree(preorder, inorder[:root_index]) right_tree = self.buildTree(preorder, ino...
[ "def", "buildTree", "(", "self", ",", "preorder", ",", "inorder", ")", ":", "if", "len", "(", "inorder", ")", "==", "0", ":", "return", "None", "else", ":", "root_val", "=", "preorder", ".", "pop", "(", "0", ")", "root_index", "=", "inorder", ".", ...
https://github.com/shichao-an/leetcode-python/blob/6c523ef4759a57433e10271b584eece16f9f05f3/construct_binary_tree_from_preorder_and_inorder_traversal/solution.py#L12-L23
zzzeek/mako
12819efda61b0c478a700670575c951b6cde7383
mako/util.py
python
parse_encoding
(fp)
Deduce the encoding of a Python source file (binary mode) from magic comment. It does this in the same way as the `Python interpreter`__ .. __: http://docs.python.org/ref/encodings.html The ``fp`` argument should be a seekable file object in binary mode.
Deduce the encoding of a Python source file (binary mode) from magic comment.
[ "Deduce", "the", "encoding", "of", "a", "Python", "source", "file", "(", "binary", "mode", ")", "from", "magic", "comment", "." ]
def parse_encoding(fp): """Deduce the encoding of a Python source file (binary mode) from magic comment. It does this in the same way as the `Python interpreter`__ .. __: http://docs.python.org/ref/encodings.html The ``fp`` argument should be a seekable file object in binary mode. """ pos...
[ "def", "parse_encoding", "(", "fp", ")", ":", "pos", "=", "fp", ".", "tell", "(", ")", "fp", ".", "seek", "(", "0", ")", "try", ":", "line1", "=", "fp", ".", "readline", "(", ")", "has_bom", "=", "line1", ".", "startswith", "(", "codecs", ".", ...
https://github.com/zzzeek/mako/blob/12819efda61b0c478a700670575c951b6cde7383/mako/util.py#L241-L287
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/twisted/twisted/enterprise/adbapi.py
python
ConnectionPool.close
(self)
Close all pool connections and shutdown the pool.
Close all pool connections and shutdown the pool.
[ "Close", "all", "pool", "connections", "and", "shutdown", "the", "pool", "." ]
def close(self): """ Close all pool connections and shutdown the pool. """ if self.shutdownID: self._reactor.removeSystemEventTrigger(self.shutdownID) self.shutdownID = None if self.startID: self._reactor.removeSystemEventTrigger(self.startID) ...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "shutdownID", ":", "self", ".", "_reactor", ".", "removeSystemEventTrigger", "(", "self", ".", "shutdownID", ")", "self", ".", "shutdownID", "=", "None", "if", "self", ".", "startID", ":", "self",...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/enterprise/adbapi.py#L374-L384
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/sqlalchemy/sql/elements.py
python
_is_column
(col)
return isinstance(col, ColumnElement)
True if ``col`` is an instance of :class:`.ColumnElement`.
True if ``col`` is an instance of :class:`.ColumnElement`.
[ "True", "if", "col", "is", "an", "instance", "of", ":", "class", ":", ".", "ColumnElement", "." ]
def _is_column(col): """True if ``col`` is an instance of :class:`.ColumnElement`.""" return isinstance(col, ColumnElement)
[ "def", "_is_column", "(", "col", ")", ":", "return", "isinstance", "(", "col", ",", "ColumnElement", ")" ]
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/sqlalchemy/sql/elements.py#L3384-L3387
WPO-Foundation/wptagent
94470f007294213f900dcd9a207678b5b9fce5d3
internal/safari_ios.py
python
iWptBrowser.process_optimization_results
(self, page_data, requests, optimization_results)
Merge the data from the optimization checks file
Merge the data from the optimization checks file
[ "Merge", "the", "data", "from", "the", "optimization", "checks", "file" ]
def process_optimization_results(self, page_data, requests, optimization_results): """Merge the data from the optimization checks file""" if optimization_results and not self.must_exit: page_data['score_cache'] = -1 page_data['score_cdn'] = -1 page_data['score_gzip'] ...
[ "def", "process_optimization_results", "(", "self", ",", "page_data", ",", "requests", ",", "optimization_results", ")", ":", "if", "optimization_results", "and", "not", "self", ".", "must_exit", ":", "page_data", "[", "'score_cache'", "]", "=", "-", "1", "page_...
https://github.com/WPO-Foundation/wptagent/blob/94470f007294213f900dcd9a207678b5b9fce5d3/internal/safari_ios.py#L1482-L1575
jython/jython3
def4f8ec47cb7a9c799ea4c745f12badf92c5769
lib-python/3.5.1/logging/__init__.py
python
Handler.__init__
(self, level=NOTSET)
Initializes the instance - basically setting the formatter to None and the filter list to empty.
Initializes the instance - basically setting the formatter to None and the filter list to empty.
[ "Initializes", "the", "instance", "-", "basically", "setting", "the", "formatter", "to", "None", "and", "the", "filter", "list", "to", "empty", "." ]
def __init__(self, level=NOTSET): """ Initializes the instance - basically setting the formatter to None and the filter list to empty. """ Filterer.__init__(self) self._name = None self.level = _checkLevel(level) self.formatter = None # Add the han...
[ "def", "__init__", "(", "self", ",", "level", "=", "NOTSET", ")", ":", "Filterer", ".", "__init__", "(", "self", ")", "self", ".", "_name", "=", "None", "self", ".", "level", "=", "_checkLevel", "(", "level", ")", "self", ".", "formatter", "=", "None...
https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/logging/__init__.py#L761-L772
scipy/scipy
e0a749f01e79046642ccfdc419edbf9e7ca141ad
scipy/cluster/hierarchy.py
python
is_valid_linkage
(Z, warning=False, throw=False, name=None)
return valid
Check the validity of a linkage matrix. A linkage matrix is valid if it is a 2-D array (type double) with :math:`n` rows and 4 columns. The first two columns must contain indices between 0 and :math:`2n-1`. For a given row ``i``, the following two expressions have to hold: .. math:: 0 \\l...
Check the validity of a linkage matrix.
[ "Check", "the", "validity", "of", "a", "linkage", "matrix", "." ]
def is_valid_linkage(Z, warning=False, throw=False, name=None): """ Check the validity of a linkage matrix. A linkage matrix is valid if it is a 2-D array (type double) with :math:`n` rows and 4 columns. The first two columns must contain indices between 0 and :math:`2n-1`. For a given row ``i``, t...
[ "def", "is_valid_linkage", "(", "Z", ",", "warning", "=", "False", ",", "throw", "=", "False", ",", "name", "=", "None", ")", ":", "Z", "=", "np", ".", "asarray", "(", "Z", ",", "order", "=", "'c'", ")", "valid", "=", "True", "name_str", "=", "\"...
https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/scipy/cluster/hierarchy.py#L2178-L2300
DxCx/plugin.video.9anime
34358c2f701e5ddf19d3276926374a16f63f7b6a
resources/lib/ui/js2py/es6/babel.py
python
PyJs_anonymous_1425_
(require, module, exports, this, arguments, var=var)
[]
def PyJs_anonymous_1425_(require, module, exports, this, arguments, var=var): var = Scope({u'this':this, u'require':require, u'exports':exports, u'module':module, u'arguments':arguments}, var) var.registers([u'require', u'exports', u'module']) var.get(u'require')(Js(u'../modules/es6.object.to-string')) ...
[ "def", "PyJs_anonymous_1425_", "(", "require", ",", "module", ",", "exports", ",", "this", ",", "arguments", ",", "var", "=", "var", ")", ":", "var", "=", "Scope", "(", "{", "u'this'", ":", "this", ",", "u'require'", ":", "require", ",", "u'exports'", ...
https://github.com/DxCx/plugin.video.9anime/blob/34358c2f701e5ddf19d3276926374a16f63f7b6a/resources/lib/ui/js2py/es6/babel.py#L17012-L17018
Breakthrough/DVR-Scan
ea5f5f68cd48d03f7fcfb12b5c77fdb8147895a5
dvr_scan/scanner.py
python
ScanContext.set_output
(self, scan_only=True, comp_file=None, codec='XVID', draw_timecode=False)
Sets the path and encoder codec to use when exporting videos. Arguments: scan_only (bool): If True, only scans input for motion, but does not write any video(s) to disk. In this case, comp_file and codec are ignored. Note that the default value here ...
Sets the path and encoder codec to use when exporting videos.
[ "Sets", "the", "path", "and", "encoder", "codec", "to", "use", "when", "exporting", "videos", "." ]
def set_output(self, scan_only=True, comp_file=None, codec='XVID', draw_timecode=False): # type: (bool, str, str) -> None """ Sets the path and encoder codec to use when exporting videos. Arguments: scan_only (bool): If True, only scans input for motion, but does not...
[ "def", "set_output", "(", "self", ",", "scan_only", "=", "True", ",", "comp_file", "=", "None", ",", "codec", "=", "'XVID'", ",", "draw_timecode", "=", "False", ")", ":", "# type: (bool, str, str) -> None", "self", ".", "_scan_only", "=", "scan_only", "self", ...
https://github.com/Breakthrough/DVR-Scan/blob/ea5f5f68cd48d03f7fcfb12b5c77fdb8147895a5/dvr_scan/scanner.py#L117-L142
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
plexpy/helpers.py
python
sort_attrs
(attr)
return len(a), a
[]
def sort_attrs(attr): if isinstance(attr, (list, tuple)): a = attr[0].split('.') else: a = attr.split('.') return len(a), a
[ "def", "sort_attrs", "(", "attr", ")", ":", "if", "isinstance", "(", "attr", ",", "(", "list", ",", "tuple", ")", ")", ":", "a", "=", "attr", "[", "0", "]", ".", "split", "(", "'.'", ")", "else", ":", "a", "=", "attr", ".", "split", "(", "'.'...
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/plexpy/helpers.py#L1300-L1305
duerrp/pyexperiment
c426565d870d944bd5b9712629d8f1ba2527c67f
pyexperiment/Logger.py
python
Logger.__init__
(self, console_level=logging.INFO, filename=None, file_level=logging.DEBUG, no_backups=5)
Initializer
Initializer
[ "Initializer" ]
def __init__(self, console_level=logging.INFO, filename=None, file_level=logging.DEBUG, no_backups=5): """Initializer """ # Initialize the base class, the minimal level makes sure no # logs are missed super(Logge...
[ "def", "__init__", "(", "self", ",", "console_level", "=", "logging", ".", "INFO", ",", "filename", "=", "None", ",", "file_level", "=", "logging", ".", "DEBUG", ",", "no_backups", "=", "5", ")", ":", "# Initialize the base class, the minimal level makes sure no",...
https://github.com/duerrp/pyexperiment/blob/c426565d870d944bd5b9712629d8f1ba2527c67f/pyexperiment/Logger.py#L196-L242
OctoPrint/OctoPrint
4b12b0e6f06c3abfb31b1840a0605e2de8e911d2
src/octoprint/vendor/zeroconf.py
python
DNSCache.get
(self, entry)
Gets an entry by key. Will return None if there is no matching entry.
Gets an entry by key. Will return None if there is no matching entry.
[ "Gets", "an", "entry", "by", "key", ".", "Will", "return", "None", "if", "there", "is", "no", "matching", "entry", "." ]
def get(self, entry): """Gets an entry by key. Will return None if there is no matching entry.""" try: list_ = self.cache[entry.key] for cached_entry in list_: if entry.__eq__(cached_entry): return cached_entry except (KeyError...
[ "def", "get", "(", "self", ",", "entry", ")", ":", "try", ":", "list_", "=", "self", ".", "cache", "[", "entry", ".", "key", "]", "for", "cached_entry", "in", "list_", ":", "if", "entry", ".", "__eq__", "(", "cached_entry", ")", ":", "return", "cac...
https://github.com/OctoPrint/OctoPrint/blob/4b12b0e6f06c3abfb31b1840a0605e2de8e911d2/src/octoprint/vendor/zeroconf.py#L1078-L1087
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/idlelib/ParenMatch.py
python
ParenMatch.restore_event
(self, event=None)
[]
def restore_event(self, event=None): self.text.tag_delete("paren") self.deactivate_restore() self.counter += 1
[ "def", "restore_event", "(", "self", ",", "event", "=", "None", ")", ":", "self", ".", "text", ".", "tag_delete", "(", "\"paren\"", ")", "self", ".", "deactivate_restore", "(", ")", "self", ".", "counter", "+=", "1" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/idlelib/ParenMatch.py#L117-L120
tensorflow/tensor2tensor
2a33b152d7835af66a6d20afe7961751047e28dd
tensor2tensor/layers/message_passing_attention.py
python
_compute_edge_transforms
(node_states, depth, num_transforms, name="transform")
return x
Helper function that computes transformation for keys and values. Let B be the number of batches. Let N be the number of nodes in the graph. Let D be the size of the node hidden states. Let K be the size of the attention keys/queries (total_key_depth). Let V be the size of the attention values (total_value_d...
Helper function that computes transformation for keys and values.
[ "Helper", "function", "that", "computes", "transformation", "for", "keys", "and", "values", "." ]
def _compute_edge_transforms(node_states, depth, num_transforms, name="transform"): """Helper function that computes transformation for keys and values. Let B be the number of batches. Let N be the number of nodes in the graph...
[ "def", "_compute_edge_transforms", "(", "node_states", ",", "depth", ",", "num_transforms", ",", "name", "=", "\"transform\"", ")", ":", "node_shapes", "=", "common_layers", ".", "shape_list", "(", "node_states", ")", "x", "=", "common_layers", ".", "dense", "("...
https://github.com/tensorflow/tensor2tensor/blob/2a33b152d7835af66a6d20afe7961751047e28dd/tensor2tensor/layers/message_passing_attention.py#L251-L301
clalancette/oz
1ab43e88033efa774815c6ebb59ae2841f2980e9
oz/OpenSUSE.py
python
get_class
(tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None)
Factory method for OpenSUSE installs.
Factory method for OpenSUSE installs.
[ "Factory", "method", "for", "OpenSUSE", "installs", "." ]
def get_class(tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None): """ Factory method for OpenSUSE installs. """ if tdl.update in version_to_config.keys(): return OpenSUSEGuest(tdl, config, auto, output_disk, netdev, diskbus, ...
[ "def", "get_class", "(", "tdl", ",", "config", ",", "auto", ",", "output_disk", "=", "None", ",", "netdev", "=", "None", ",", "diskbus", "=", "None", ",", "macaddress", "=", "None", ")", ":", "if", "tdl", ".", "update", "in", "version_to_config", ".", ...
https://github.com/clalancette/oz/blob/1ab43e88033efa774815c6ebb59ae2841f2980e9/oz/OpenSUSE.py#L538-L545
arrow-py/arrow
e43524088f78efacb425524445a886600660d854
arrow/locales.py
python
HebrewLocale.describe_multi
( self, timeframes: Sequence[Tuple[TimeFrameLiteral, Union[int, float]]], only_distance: bool = False, )
return humanized
Describes a delta within multiple timeframes in plain language. In Hebrew, the and word behaves a bit differently. :param timeframes: a list of string, quantity pairs each representing a timeframe and delta. :param only_distance: return only distance eg: "2 hours and 11 seconds" without "in" or...
Describes a delta within multiple timeframes in plain language. In Hebrew, the and word behaves a bit differently.
[ "Describes", "a", "delta", "within", "multiple", "timeframes", "in", "plain", "language", ".", "In", "Hebrew", "the", "and", "word", "behaves", "a", "bit", "differently", "." ]
def describe_multi( self, timeframes: Sequence[Tuple[TimeFrameLiteral, Union[int, float]]], only_distance: bool = False, ) -> str: """Describes a delta within multiple timeframes in plain language. In Hebrew, the and word behaves a bit differently. :param timeframes:...
[ "def", "describe_multi", "(", "self", ",", "timeframes", ":", "Sequence", "[", "Tuple", "[", "TimeFrameLiteral", ",", "Union", "[", "int", ",", "float", "]", "]", "]", ",", "only_distance", ":", "bool", "=", "False", ",", ")", "->", "str", ":", "humani...
https://github.com/arrow-py/arrow/blob/e43524088f78efacb425524445a886600660d854/arrow/locales.py#L3489-L3517
OpenShot/openshot-qt
bbd2dd040a4e2a6120791e6c65ae0ddf212cb73d
src/classes/info.py
python
get_default_path
(varname)
return _path_defaults.get(varname, None)
Return the default value of the named info.FOO_PATH attribute, even if it's been modified
Return the default value of the named info.FOO_PATH attribute, even if it's been modified
[ "Return", "the", "default", "value", "of", "the", "named", "info", ".", "FOO_PATH", "attribute", "even", "if", "it", "s", "been", "modified" ]
def get_default_path(varname): """Return the default value of the named info.FOO_PATH attribute, even if it's been modified""" return _path_defaults.get(varname, None)
[ "def", "get_default_path", "(", "varname", ")", ":", "return", "_path_defaults", ".", "get", "(", "varname", ",", "None", ")" ]
https://github.com/OpenShot/openshot-qt/blob/bbd2dd040a4e2a6120791e6c65ae0ddf212cb73d/src/classes/info.py#L223-L226
huawei-noah/vega
d9f13deede7f2b584e4b1d32ffdb833856129989
vega/datasets/transforms/Compose.py
python
ComposeAll.__init__
(self, transforms)
Construct the Compose class.
Construct the Compose class.
[ "Construct", "the", "Compose", "class", "." ]
def __init__(self, transforms): """Construct the Compose class.""" self.transforms = transforms
[ "def", "__init__", "(", "self", ",", "transforms", ")", ":", "self", ".", "transforms", "=", "transforms" ]
https://github.com/huawei-noah/vega/blob/d9f13deede7f2b584e4b1d32ffdb833856129989/vega/datasets/transforms/Compose.py#L46-L48
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/plugwise/binary_sensor.py
python
SmileBinarySensor.__init__
(self, api, coordinator, name, dev_id, binary_sensor)
Initialise the binary_sensor.
Initialise the binary_sensor.
[ "Initialise", "the", "binary_sensor", "." ]
def __init__(self, api, coordinator, name, dev_id, binary_sensor): """Initialise the binary_sensor.""" super().__init__(api, coordinator, name, dev_id) self._binary_sensor = binary_sensor self._icon = None self._is_on = False if dev_id == self._api.heater_id: ...
[ "def", "__init__", "(", "self", ",", "api", ",", "coordinator", ",", "name", ",", "dev_id", ",", "binary_sensor", ")", ":", "super", "(", ")", ".", "__init__", "(", "api", ",", "coordinator", ",", "name", ",", "dev_id", ")", "self", ".", "_binary_senso...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/plugwise/binary_sensor.py#L78-L96
1012598167/flask_mongodb_game
60c7e0351586656ec38f851592886338e50b4110
python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/distlib/_backport/tarfile.py
python
TarFile.extractall
(self, path=".", members=None)
Extract all members from the archive to the current working directory and set owner, modification time and permissions on directories afterwards. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by getmember...
Extract all members from the archive to the current working directory and set owner, modification time and permissions on directories afterwards. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by getmember...
[ "Extract", "all", "members", "from", "the", "archive", "to", "the", "current", "working", "directory", "and", "set", "owner", "modification", "time", "and", "permissions", "on", "directories", "afterwards", ".", "path", "specifies", "a", "different", "directory", ...
def extractall(self, path=".", members=None): """Extract all members from the archive to the current working directory and set owner, modification time and permissions on directories afterwards. `path' specifies a different directory to extract to. `members' is optional and must...
[ "def", "extractall", "(", "self", ",", "path", "=", "\".\"", ",", "members", "=", "None", ")", ":", "directories", "=", "[", "]", "if", "members", "is", "None", ":", "members", "=", "self", "for", "tarinfo", "in", "members", ":", "if", "tarinfo", "."...
https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/distlib/_backport/tarfile.py#L2126-L2162
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_adm_csr.py
python
Yedit.run_ansible
(params)
return {'failed': True, 'msg': 'Unkown state passed'}
perform the idempotent crud operations
perform the idempotent crud operations
[ "perform", "the", "idempotent", "crud", "operations" ]
def run_ansible(params): '''perform the idempotent crud operations''' yamlfile = Yedit(filename=params['src'], backup=params['backup'], content_type=params['content_type'], backup_ext=params['backup_ext'], ...
[ "def", "run_ansible", "(", "params", ")", ":", "yamlfile", "=", "Yedit", "(", "filename", "=", "params", "[", "'src'", "]", ",", "backup", "=", "params", "[", "'backup'", "]", ",", "content_type", "=", "params", "[", "'content_type'", "]", ",", "backup_e...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_adm_csr.py#L741-L839
openstack/sahara
c4f4d29847d5bcca83d49ef7e9a3378458462a79
sahara/service/castellan/sahara_key_manager.py
python
SaharaKeyManager.get
(self, context, key_id, **kwargs)
return key.Passphrase(passphrase=key_id)
get a key since sahara is not actually storing key UUIDs the key_id to this function should actually be the key payload. this function will simply return a new SaharaKey based on that value.
get a key
[ "get", "a", "key" ]
def get(self, context, key_id, **kwargs): """get a key since sahara is not actually storing key UUIDs the key_id to this function should actually be the key payload. this function will simply return a new SaharaKey based on that value. """ return key.Passphrase(passphras...
[ "def", "get", "(", "self", ",", "context", ",", "key_id", ",", "*", "*", "kwargs", ")", ":", "return", "key", ".", "Passphrase", "(", "passphrase", "=", "key_id", ")" ]
https://github.com/openstack/sahara/blob/c4f4d29847d5bcca83d49ef7e9a3378458462a79/sahara/service/castellan/sahara_key_manager.py#L61-L68
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/combinatorics/permutations.py
python
Permutation.__invert__
(self)
return _af_new(_af_invert(self._array_form))
Return the inverse of the permutation. A permutation multiplied by its inverse is the identity permutation. Examples ======== >>> from sympy.combinatorics.permutations import Permutation >>> p = Permutation([[2,0], [3,1]]) >>> ~p Permutation([2, 3, 0, 1]) ...
Return the inverse of the permutation.
[ "Return", "the", "inverse", "of", "the", "permutation", "." ]
def __invert__(self): """ Return the inverse of the permutation. A permutation multiplied by its inverse is the identity permutation. Examples ======== >>> from sympy.combinatorics.permutations import Permutation >>> p = Permutation([[2,0], [3,1]]) >>> ...
[ "def", "__invert__", "(", "self", ")", ":", "return", "_af_new", "(", "_af_invert", "(", "self", ".", "_array_form", ")", ")" ]
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/combinatorics/permutations.py#L1449-L1467
inkandswitch/livebook
93c8d467734787366ad084fc3566bf5cbe249c51
public/pypyjs/modules/inspect.py
python
getdoc
(object)
return cleandoc(doc)
Get the documentation string for an object. All tabs are expanded to spaces. To clean up docstrings that are indented to line up with blocks of code, any whitespace than can be uniformly removed from the second line onwards is removed.
Get the documentation string for an object.
[ "Get", "the", "documentation", "string", "for", "an", "object", "." ]
def getdoc(object): """Get the documentation string for an object. All tabs are expanded to spaces. To clean up docstrings that are indented to line up with blocks of code, any whitespace than can be uniformly removed from the second line onwards is removed.""" try: doc = object.__doc__ ...
[ "def", "getdoc", "(", "object", ")", ":", "try", ":", "doc", "=", "object", ".", "__doc__", "except", "AttributeError", ":", "return", "None", "if", "not", "isinstance", "(", "doc", ",", "types", ".", "StringTypes", ")", ":", "return", "None", "return", ...
https://github.com/inkandswitch/livebook/blob/93c8d467734787366ad084fc3566bf5cbe249c51/public/pypyjs/modules/inspect.py#L355-L367
hzlzh/AlfredWorkflow.com
7055f14f6922c80ea5943839eb0caff11ae57255
Sources/Workflows/jc-weather/requests/api.py
python
head
(url, **kwargs)
return request('head', url, **kwargs)
Sends a HEAD request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes.
Sends a HEAD request. Returns :class:`Response` object.
[ "Sends", "a", "HEAD", "request", ".", "Returns", ":", "class", ":", "Response", "object", "." ]
def head(url, **kwargs): """Sends a HEAD request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. """ return request('head', url, **kwargs)
[ "def", "head", "(", "url", ",", "*", "*", "kwargs", ")", ":", "return", "request", "(", "'head'", ",", "url", ",", "*", "*", "kwargs", ")" ]
https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/jc-weather/requests/api.py#L69-L76
googleapis/python-dialogflow
e48ea001b7c8a4a5c1fe4b162bad49ea397458e9
google/cloud/dialogflow_v2/services/entity_types/transports/grpc.py
python
EntityTypesGrpcTransport.close
(self)
[]
def close(self): self.grpc_channel.close()
[ "def", "close", "(", "self", ")", ":", "self", ".", "grpc_channel", ".", "close", "(", ")" ]
https://github.com/googleapis/python-dialogflow/blob/e48ea001b7c8a4a5c1fe4b162bad49ea397458e9/google/cloud/dialogflow_v2/services/entity_types/transports/grpc.py#L603-L604
pajbot/pajbot
d387a48b799ae600c0dcf42788f7d3667ced275c
pajbot/managers/emote.py
python
GenericChannelEmoteManager.match_global_emote
(self, word: str)
return self.global_lookup_table.get(word, None)
Attempts to find a matching emote equaling the given word from the global emotes known to this manager. Returns None if no emote was matched
Attempts to find a matching emote equaling the given word from the global emotes known to this manager. Returns None if no emote was matched
[ "Attempts", "to", "find", "a", "matching", "emote", "equaling", "the", "given", "word", "from", "the", "global", "emotes", "known", "to", "this", "manager", ".", "Returns", "None", "if", "no", "emote", "was", "matched" ]
def match_global_emote(self, word: str) -> Optional[Emote]: """Attempts to find a matching emote equaling the given word from the global emotes known to this manager. Returns None if no emote was matched""" return self.global_lookup_table.get(word, None)
[ "def", "match_global_emote", "(", "self", ",", "word", ":", "str", ")", "->", "Optional", "[", "Emote", "]", ":", "return", "self", ".", "global_lookup_table", ".", "get", "(", "word", ",", "None", ")" ]
https://github.com/pajbot/pajbot/blob/d387a48b799ae600c0dcf42788f7d3667ced275c/pajbot/managers/emote.py#L101-L104
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
dist/lib/python2.7/numbers.py
python
Real.imag
(self)
return 0
Real numbers have no imaginary component.
Real numbers have no imaginary component.
[ "Real", "numbers", "have", "no", "imaginary", "component", "." ]
def imag(self): """Real numbers have no imaginary component.""" return 0
[ "def", "imag", "(", "self", ")", ":", "return", "0" ]
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/numbers.py#L259-L261
TropComplique/FaceBoxes-tensorflow
0dde35eda1cb3dab6586b94c583029162ec37aa5
src/training_target_creation.py
python
_create_targets
(anchors, groundtruth_boxes, matches)
return reg_targets
Returns regression targets for each anchor. Arguments: anchors: a float tensor with shape [num_anchors, 4]. groundtruth_boxes: a float tensor with shape [N, 4]. matches: a int tensor with shape [num_anchors]. Returns: reg_targets: a float tensor with shape [num_anchors, 4].
Returns regression targets for each anchor.
[ "Returns", "regression", "targets", "for", "each", "anchor", "." ]
def _create_targets(anchors, groundtruth_boxes, matches): """Returns regression targets for each anchor. Arguments: anchors: a float tensor with shape [num_anchors, 4]. groundtruth_boxes: a float tensor with shape [N, 4]. matches: a int tensor with shape [num_anchors]. Returns: ...
[ "def", "_create_targets", "(", "anchors", ",", "groundtruth_boxes", ",", "matches", ")", ":", "matched_anchor_indices", "=", "tf", ".", "where", "(", "tf", ".", "greater_equal", "(", "matches", ",", "0", ")", ")", "# shape [num_matches, 1]", "matched_anchor_indice...
https://github.com/TropComplique/FaceBoxes-tensorflow/blob/0dde35eda1cb3dab6586b94c583029162ec37aa5/src/training_target_creation.py#L83-L115
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/subprocess.py
python
Popen.poll
(self)
return self._internal_poll()
[]
def poll(self): return self._internal_poll()
[ "def", "poll", "(", "self", ")", ":", "return", "self", ".", "_internal_poll", "(", ")" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/subprocess.py#L822-L823
anxiangsir/deeplabv3-Tensorflow
f7f13da2705bacfab1cf4afe37923be5e914bac3
color_utils.py
python
color_predicts
(img)
return color
给class图上色
给class图上色
[ "给class图上色" ]
def color_predicts(img): ''' 给class图上色 ''' # img = cv2.imread(label_path,cv2.CAP_MODE_GRAY) color = np.ones([img.shape[0], img.shape[1], 3]) color[img==0] = [255, 255, 255] #其他,白色,0 color[img==1] = [0, 255, 0] #植被,绿色,1 color[img==2] = [0, 0, 0] #道路,黑色,2 color[img==3] = [1...
[ "def", "color_predicts", "(", "img", ")", ":", "# img = cv2.imread(label_path,cv2.CAP_MODE_GRAY)", "color", "=", "np", ".", "ones", "(", "[", "img", ".", "shape", "[", "0", "]", ",", "img", ".", "shape", "[", "1", "]", ",", "3", "]", ")", "color", "[",...
https://github.com/anxiangsir/deeplabv3-Tensorflow/blob/f7f13da2705bacfab1cf4afe37923be5e914bac3/color_utils.py#L5-L19
rougier/ten-rules
fc1cce48f19a3ca85986a509b62493b3be7926b4
projections.py
python
polar_to_logpolar
(rho, theta)
return x, y
Polar to logpolar coordinates.
Polar to logpolar coordinates.
[ "Polar", "to", "logpolar", "coordinates", "." ]
def polar_to_logpolar(rho, theta): ''' Polar to logpolar coordinates. ''' # Shift in the SC mapping function in deg A = 3.0 # Collicular magnification along u axe in mm/rad Bx = 1.4 # Collicular magnification along v axe in mm/rad By = 1.8 xmin, xmax = 0.0, 4.80743279742 ymin, ymax ...
[ "def", "polar_to_logpolar", "(", "rho", ",", "theta", ")", ":", "# Shift in the SC mapping function in deg", "A", "=", "3.0", "# Collicular magnification along u axe in mm/rad", "Bx", "=", "1.4", "# Collicular magnification along v axe in mm/rad", "By", "=", "1.8", "xmin", ...
https://github.com/rougier/ten-rules/blob/fc1cce48f19a3ca85986a509b62493b3be7926b4/projections.py#L52-L68
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/sympy/matrices/densesolve.py
python
forward_substitution
(lower_triangle, variable, constant, K)
return variable
Performs forward substitution given a lower triangular matrix, a vector of variables and a vector of constants. Examples ======== >>> from sympy.matrices.densesolve import forward_substitution >>> from sympy import QQ >>> from sympy import Dummy >>> x, y, z = Dummy('x'), Dummy('y'), Dummy(...
Performs forward substitution given a lower triangular matrix, a vector of variables and a vector of constants.
[ "Performs", "forward", "substitution", "given", "a", "lower", "triangular", "matrix", "a", "vector", "of", "variables", "and", "a", "vector", "of", "constants", "." ]
def forward_substitution(lower_triangle, variable, constant, K): """ Performs forward substitution given a lower triangular matrix, a vector of variables and a vector of constants. Examples ======== >>> from sympy.matrices.densesolve import forward_substitution >>> from sympy import QQ ...
[ "def", "forward_substitution", "(", "lower_triangle", ",", "variable", ",", "constant", ",", "K", ")", ":", "copy_lower_triangle", "=", "copy", ".", "deepcopy", "(", "lower_triangle", ")", "nrow", "=", "len", "(", "copy_lower_triangle", ")", "for", "i", "in", ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/matrices/densesolve.py#L366-L406
khalim19/gimp-plugin-export-layers
b37255f2957ad322f4d332689052351cdea6e563
export_layers/pygimplib/_lib/python_standard_modules/logging/handlers.py
python
NTEventLogHandler.emit
(self, record)
Emit a record. Determine the message ID, event category and event type. Then log the message in the NT event log.
Emit a record.
[ "Emit", "a", "record", "." ]
def emit(self, record): """ Emit a record. Determine the message ID, event category and event type. Then log the message in the NT event log. """ if self._welu: try: id = self.getMessageID(record) cat = self.getEventCategory(re...
[ "def", "emit", "(", "self", ",", "record", ")", ":", "if", "self", ".", "_welu", ":", "try", ":", "id", "=", "self", ".", "getMessageID", "(", "record", ")", "cat", "=", "self", ".", "getEventCategory", "(", "record", ")", "type", "=", "self", ".",...
https://github.com/khalim19/gimp-plugin-export-layers/blob/b37255f2957ad322f4d332689052351cdea6e563/export_layers/pygimplib/_lib/python_standard_modules/logging/handlers.py#L1033-L1050
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
python
NullProvider.get_resource_stream
(self, manager, resource_name)
return io.BytesIO(self.get_resource_string(manager, resource_name))
[]
def get_resource_stream(self, manager, resource_name): return io.BytesIO(self.get_resource_string(manager, resource_name))
[ "def", "get_resource_stream", "(", "self", ",", "manager", ",", "resource_name", ")", ":", "return", "io", ".", "BytesIO", "(", "self", ".", "get_resource_string", "(", "manager", ",", "resource_name", ")", ")" ]
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L1397-L1398
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/sre_parse.py
python
State.checklookbehindgroup
(self, gid, source)
[]
def checklookbehindgroup(self, gid, source): if self.lookbehindgroups is not None: if not self.checkgroup(gid): raise source.error('cannot refer to an open group') if gid >= self.lookbehindgroups: raise source.error('cannot refer to group defined in the sa...
[ "def", "checklookbehindgroup", "(", "self", ",", "gid", ",", "source", ")", ":", "if", "self", ".", "lookbehindgroups", "is", "not", "None", ":", "if", "not", "self", ".", "checkgroup", "(", "gid", ")", ":", "raise", "source", ".", "error", "(", "'cann...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/sre_parse.py#L101-L107
Maicius/QQZoneMood
e529f386865bed141f43c5825a3f1dc7cfa161b9
src/spider/QQZoneFriendSpider.py
python
QQZoneFriendSpider.clean_friend_data
(self)
清洗好友数据,生成csv :return:
清洗好友数据,生成csv :return:
[ "清洗好友数据,生成csv", ":", "return", ":" ]
def clean_friend_data(self): """ 清洗好友数据,生成csv :return: """ try: if len(self.friend_list) == 0: self.load_friend_data() friend_total_num = len(self.friend_list) print("valid friend num:", friend_total_num) friend_list...
[ "def", "clean_friend_data", "(", "self", ")", ":", "try", ":", "if", "len", "(", "self", ".", "friend_list", ")", "==", "0", ":", "self", ".", "load_friend_data", "(", ")", "friend_total_num", "=", "len", "(", "self", ".", "friend_list", ")", "print", ...
https://github.com/Maicius/QQZoneMood/blob/e529f386865bed141f43c5825a3f1dc7cfa161b9/src/spider/QQZoneFriendSpider.py#L234-L289
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/logging/handlers.py
python
NTEventLogHandler.emit
(self, record)
Emit a record. Determine the message ID, event category and event type. Then log the message in the NT event log.
Emit a record.
[ "Emit", "a", "record", "." ]
def emit(self, record): """ Emit a record. Determine the message ID, event category and event type. Then log the message in the NT event log. """ if self._welu: try: id = self.getMessageID(record) cat = self.getEventCategory(re...
[ "def", "emit", "(", "self", ",", "record", ")", ":", "if", "self", ".", "_welu", ":", "try", ":", "id", "=", "self", ".", "getMessageID", "(", "record", ")", "cat", "=", "self", ".", "getEventCategory", "(", "record", ")", "type", "=", "self", ".",...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/logging/handlers.py#L1094-L1109
bugy/script-server
9a57ce15903c81bcb537b872f1330ee55ba31563
src/execution/executor.py
python
ScriptExecutor.get_return_code
(self)
return self.process_wrapper.get_return_code()
[]
def get_return_code(self): return self.process_wrapper.get_return_code()
[ "def", "get_return_code", "(", "self", ")", ":", "return", "self", ".", "process_wrapper", ".", "get_return_code", "(", ")" ]
https://github.com/bugy/script-server/blob/9a57ce15903c81bcb537b872f1330ee55ba31563/src/execution/executor.py#L170-L171
facebookresearch/Large-Scale-VRD
7ababfe1023941c3653d7aebe9f835a47f5e8277
lib/utils/model_convert_utils.py
python
pairwise
(iterable)
return zip(a, b)
s -> (s0,s1), (s1,s2), (s2, s3), ...
s -> (s0,s1), (s1,s2), (s2, s3), ...
[ "s", "-", ">", "(", "s0", "s1", ")", "(", "s1", "s2", ")", "(", "s2", "s3", ")", "..." ]
def pairwise(iterable): "s -> (s0,s1), (s1,s2), (s2, s3), ..." from itertools import tee a, b = tee(iterable) next(b, None) return zip(a, b)
[ "def", "pairwise", "(", "iterable", ")", ":", "from", "itertools", "import", "tee", "a", ",", "b", "=", "tee", "(", "iterable", ")", "next", "(", "b", ",", "None", ")", "return", "zip", "(", "a", ",", "b", ")" ]
https://github.com/facebookresearch/Large-Scale-VRD/blob/7ababfe1023941c3653d7aebe9f835a47f5e8277/lib/utils/model_convert_utils.py#L127-L132
postgres/pgadmin4
374c5e952fa594d749fadf1f88076c1cba8c5f64
web/pgadmin/tools/import_export_servers/__init__.py
python
save
()
return make_json_response(success=1)
This function is used to import or export based on the data
This function is used to import or export based on the data
[ "This", "function", "is", "used", "to", "import", "or", "export", "based", "on", "the", "data" ]
def save(): """ This function is used to import or export based on the data """ required_args = [ 'type', 'filename' ] data = request.form if request.form else json.loads(request.data.decode()) for arg in required_args: if arg not in data: return make_json_respon...
[ "def", "save", "(", ")", ":", "required_args", "=", "[", "'type'", ",", "'filename'", "]", "data", "=", "request", ".", "form", "if", "request", ".", "form", "else", "json", ".", "loads", "(", "request", ".", "data", ".", "decode", "(", ")", ")", "...
https://github.com/postgres/pgadmin4/blob/374c5e952fa594d749fadf1f88076c1cba8c5f64/web/pgadmin/tools/import_export_servers/__init__.py#L188-L222
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
python
EntryPoint.__str__
(self)
return s
[]
def __str__(self): s = "%s = %s" % (self.name, self.module_name) if self.attrs: s += ':' + '.'.join(self.attrs) if self.extras: s += ' [%s]' % ','.join(self.extras) return s
[ "def", "__str__", "(", "self", ")", ":", "s", "=", "\"%s = %s\"", "%", "(", "self", ".", "name", ",", "self", ".", "module_name", ")", "if", "self", ".", "attrs", ":", "s", "+=", "':'", "+", "'.'", ".", "join", "(", "self", ".", "attrs", ")", "...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L2294-L2300
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/pandas-0.24.2-py3.7-macosx-10.9-x86_64.egg/pandas/io/pytables.py
python
HDFStore.select_column
(self, key, column, **kwargs)
return self.get_storer(key).read_column(column=column, **kwargs)
return a single column from the table. This is generally only useful to select an indexable Parameters ---------- key : object column: the column of interest Exceptions ---------- raises KeyError if the column is not found (or key is not a valid ...
return a single column from the table. This is generally only useful to select an indexable
[ "return", "a", "single", "column", "from", "the", "table", ".", "This", "is", "generally", "only", "useful", "to", "select", "an", "indexable" ]
def select_column(self, key, column, **kwargs): """ return a single column from the table. This is generally only useful to select an indexable Parameters ---------- key : object column: the column of interest Exceptions ---------- raises...
[ "def", "select_column", "(", "self", ",", "key", ",", "column", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "get_storer", "(", "key", ")", ".", "read_column", "(", "column", "=", "column", ",", "*", "*", "kwargs", ")" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pandas-0.24.2-py3.7-macosx-10.9-x86_64.egg/pandas/io/pytables.py#L758-L776
hippich/Bitcoin-Poker-Room
b89e8c2df7a57d19d1aa6deff3f6a92ebe8134fa
lib/ppn/pokernetwork/pokerservice.py
python
PokerService.getTableBestByCriteria
(self, serial, currency_serial = None, variant = None, betting_structure = None, min_players = 0)
return bestTable
Return a PokerTable object optimal table based on the given criteria in list_table_query_str plus the amount of currency the user represented by serial has. The caller is assured that the user represented by serial can afford at least the minimum buy-in for the table returned (if one is...
Return a PokerTable object optimal table based on the given criteria in list_table_query_str plus the amount of currency the user represented by serial has. The caller is assured that the user represented by serial can afford at least the minimum buy-in for the table returned (if one is...
[ "Return", "a", "PokerTable", "object", "optimal", "table", "based", "on", "the", "given", "criteria", "in", "list_table_query_str", "plus", "the", "amount", "of", "currency", "the", "user", "represented", "by", "serial", "has", ".", "The", "caller", "is", "ass...
def getTableBestByCriteria(self, serial, currency_serial = None, variant = None, betting_structure = None, min_players = 0): """Return a PokerTable object optimal table based on the given criteria in list_table_query_str plus the amount of currency the user represe...
[ "def", "getTableBestByCriteria", "(", "self", ",", "serial", ",", "currency_serial", "=", "None", ",", "variant", "=", "None", ",", "betting_structure", "=", "None", ",", "min_players", "=", "0", ")", ":", "bestTable", "=", "None", "# money_results dict is used ...
https://github.com/hippich/Bitcoin-Poker-Room/blob/b89e8c2df7a57d19d1aa6deff3f6a92ebe8134fa/lib/ppn/pokernetwork/pokerservice.py#L2551-L2625
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/sympy/printing/pretty/pretty.py
python
PrettyPrinter._print_matrix_contents
(self, e)
return D
This method factors out what is essentially grid printing.
This method factors out what is essentially grid printing.
[ "This", "method", "factors", "out", "what", "is", "essentially", "grid", "printing", "." ]
def _print_matrix_contents(self, e): """ This method factors out what is essentially grid printing. """ M = e # matrix Ms = {} # i,j -> pretty(M[i,j]) for i in range(M.rows): for j in range(M.cols): Ms[i, j] = self._print(M[i, j]) #...
[ "def", "_print_matrix_contents", "(", "self", ",", "e", ")", ":", "M", "=", "e", "# matrix", "Ms", "=", "{", "}", "# i,j -> pretty(M[i,j])", "for", "i", "in", "range", "(", "M", ".", "rows", ")", ":", "for", "j", "in", "range", "(", "M", ".", "cols...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/printing/pretty/pretty.py#L657-L724
mesonbuild/meson
a22d0f9a0a787df70ce79b05d0c45de90a970048
mesonbuild/modules/windows.py
python
initialize
(interp: 'Interpreter')
return WindowsModule(interp)
[]
def initialize(interp: 'Interpreter') -> WindowsModule: return WindowsModule(interp)
[ "def", "initialize", "(", "interp", ":", "'Interpreter'", ")", "->", "WindowsModule", ":", "return", "WindowsModule", "(", "interp", ")" ]
https://github.com/mesonbuild/meson/blob/a22d0f9a0a787df70ce79b05d0c45de90a970048/mesonbuild/modules/windows.py#L207-L208
WerWolv/EdiZon_CheatsConfigsAndScripts
d16d36c7509c01dca770f402babd83ff2e9ae6e7
Scripts/lib/python3.5/email/generator.py
python
Generator.__init__
(self, outfp, mangle_from_=None, maxheaderlen=None, *, policy=None)
Create the generator for message flattening. outfp is the output file-like object for writing the message to. It must have a write() method. Optional mangle_from_ is a flag that, when True (the default if policy is not set), escapes From_ lines in the body of the message by putting ...
Create the generator for message flattening.
[ "Create", "the", "generator", "for", "message", "flattening", "." ]
def __init__(self, outfp, mangle_from_=None, maxheaderlen=None, *, policy=None): """Create the generator for message flattening. outfp is the output file-like object for writing the message to. It must have a write() method. Optional mangle_from_ is a flag that, when ...
[ "def", "__init__", "(", "self", ",", "outfp", ",", "mangle_from_", "=", "None", ",", "maxheaderlen", "=", "None", ",", "*", ",", "policy", "=", "None", ")", ":", "if", "mangle_from_", "is", "None", ":", "mangle_from_", "=", "True", "if", "policy", "is"...
https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/email/generator.py#L36-L66
postlund/pyatv
4ed1f5539f37d86d80272663d1f2ea34a6c41ec4
pyatv/scripts/atvproxy.py
python
CompanionAppleTVProxy.enable_encryption
(self, output_key: bytes, input_key: bytes)
Enable encryption with the specified keys.
Enable encryption with the specified keys.
[ "Enable", "encryption", "with", "the", "specified", "keys", "." ]
def enable_encryption(self, output_key: bytes, input_key: bytes) -> None: """Enable encryption with the specified keys.""" self.chacha = chacha20.Chacha20Cipher(output_key, input_key, nonce_length=12)
[ "def", "enable_encryption", "(", "self", ",", "output_key", ":", "bytes", ",", "input_key", ":", "bytes", ")", "->", "None", ":", "self", ".", "chacha", "=", "chacha20", ".", "Chacha20Cipher", "(", "output_key", ",", "input_key", ",", "nonce_length", "=", ...
https://github.com/postlund/pyatv/blob/4ed1f5539f37d86d80272663d1f2ea34a6c41ec4/pyatv/scripts/atvproxy.py#L178-L180
realpython/book2-exercises
cde325eac8e6d8cff2316601c2e5b36bb46af7d0
web2py-rest/gluon/html.py
python
DIV.__setitem__
(self, i, value)
Sets attribute with name 'i' or component #i. Args: i: index. If i is a string: the name of the attribute otherwise references to number of the component value: the new value
Sets attribute with name 'i' or component #i.
[ "Sets", "attribute", "with", "name", "i", "or", "component", "#i", "." ]
def __setitem__(self, i, value): """ Sets attribute with name 'i' or component #i. Args: i: index. If i is a string: the name of the attribute otherwise references to number of the component value: the new value """ self._setnode(value) ...
[ "def", "__setitem__", "(", "self", ",", "i", ",", "value", ")", ":", "self", ".", "_setnode", "(", "value", ")", "if", "isinstance", "(", "i", ",", "(", "str", ",", "unicode", ")", ")", ":", "self", ".", "attributes", "[", "i", "]", "=", "value",...
https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py-rest/gluon/html.py#L791-L804
spyder-ide/spyder
55da47c032dfcf519600f67f8b30eab467f965e7
spyder/utils/programs.py
python
_get_mac_application_icon_path
(app_bundle_path)
return icon_path
Parse mac application bundle and return path for *.icns file.
Parse mac application bundle and return path for *.icns file.
[ "Parse", "mac", "application", "bundle", "and", "return", "path", "for", "*", ".", "icns", "file", "." ]
def _get_mac_application_icon_path(app_bundle_path): """Parse mac application bundle and return path for *.icns file.""" import plistlib contents_path = info_path = os.path.join(app_bundle_path, 'Contents') info_path = os.path.join(contents_path, 'Info.plist') pl = {} if os.path.isfile(info_pat...
[ "def", "_get_mac_application_icon_path", "(", "app_bundle_path", ")", ":", "import", "plistlib", "contents_path", "=", "info_path", "=", "os", ".", "path", ".", "join", "(", "app_bundle_path", ",", "'Contents'", ")", "info_path", "=", "os", ".", "path", ".", "...
https://github.com/spyder-ide/spyder/blob/55da47c032dfcf519600f67f8b30eab467f965e7/spyder/utils/programs.py#L311-L337
samdroid-apps/something-for-reddit
071733a9e6050d0d171e6620c189b7860af56bab
redditisgtk/gtkutil.py
python
process_shortcuts
(shortcuts, event: Gdk.Event)
Shortcuts is a dict of: accelerator string: (self._function, [arguments]) Accelerator is passed to Gtk.accelerator_parse Event is the GdkEvent
Shortcuts is a dict of: accelerator string: (self._function, [arguments])
[ "Shortcuts", "is", "a", "dict", "of", ":", "accelerator", "string", ":", "(", "self", ".", "_function", "[", "arguments", "]", ")" ]
def process_shortcuts(shortcuts, event: Gdk.Event): ''' Shortcuts is a dict of: accelerator string: (self._function, [arguments]) Accelerator is passed to Gtk.accelerator_parse Event is the GdkEvent ''' if event.type != Gdk.EventType.KEY_PRESS: return for accel_string, value...
[ "def", "process_shortcuts", "(", "shortcuts", ",", "event", ":", "Gdk", ".", "Event", ")", ":", "if", "event", ".", "type", "!=", "Gdk", ".", "EventType", ".", "KEY_PRESS", ":", "return", "for", "accel_string", ",", "value", "in", "shortcuts", ".", "item...
https://github.com/samdroid-apps/something-for-reddit/blob/071733a9e6050d0d171e6620c189b7860af56bab/redditisgtk/gtkutil.py#L22-L44
AzureAD/microsoft-authentication-library-for-python
a18c2231896d8a050ad181461928f4dbd818049f
msal/oauth2cli/oauth2.py
python
Client.obtain_token_by_device_flow
(self, flow, exit_condition=lambda flow: flow.get("expires_at", 0) < time.time(), **kwargs)
Obtain token by a device flow object, with customizable polling effect. Args: flow (dict): An object previously generated by initiate_device_flow(...). Its content WILL BE CHANGED by this method during each run. We share this object with you, so that ...
Obtain token by a device flow object, with customizable polling effect.
[ "Obtain", "token", "by", "a", "device", "flow", "object", "with", "customizable", "polling", "effect", "." ]
def obtain_token_by_device_flow(self, flow, exit_condition=lambda flow: flow.get("expires_at", 0) < time.time(), **kwargs): # type: (dict, Callable) -> dict """Obtain token by a device flow object, with customizable polling effect. Args: flow (dic...
[ "def", "obtain_token_by_device_flow", "(", "self", ",", "flow", ",", "exit_condition", "=", "lambda", "flow", ":", "flow", ".", "get", "(", "\"expires_at\"", ",", "0", ")", "<", "time", ".", "time", "(", ")", ",", "*", "*", "kwargs", ")", ":", "# type:...
https://github.com/AzureAD/microsoft-authentication-library-for-python/blob/a18c2231896d8a050ad181461928f4dbd818049f/msal/oauth2cli/oauth2.py#L354-L390
pyg-team/pytorch_geometric
b920e9a3a64e22c8356be55301c88444ff051cae
torch_geometric/nn/fx.py
python
Transformer.find_by_name
(self, name: str)
return None
[]
def find_by_name(self, name: str) -> Optional[Node]: for node in self.graph.nodes: if node.name == name: return node return None
[ "def", "find_by_name", "(", "self", ",", "name", ":", "str", ")", "->", "Optional", "[", "Node", "]", ":", "for", "node", "in", "self", ".", "graph", ".", "nodes", ":", "if", "node", ".", "name", "==", "name", ":", "return", "node", "return", "None...
https://github.com/pyg-team/pytorch_geometric/blob/b920e9a3a64e22c8356be55301c88444ff051cae/torch_geometric/nn/fx.py#L211-L215
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/idlelib/squeezer.py
python
count_lines_with_wrapping
(s, linewidth=80)
return linecount
Count the number of lines in a given string. Lines are counted as if the string was wrapped so that lines are never over linewidth characters long. Tabs are considered tabwidth characters long.
Count the number of lines in a given string.
[ "Count", "the", "number", "of", "lines", "in", "a", "given", "string", "." ]
def count_lines_with_wrapping(s, linewidth=80): """Count the number of lines in a given string. Lines are counted as if the string was wrapped so that lines are never over linewidth characters long. Tabs are considered tabwidth characters long. """ tabwidth = 8 # Currently always true in Shel...
[ "def", "count_lines_with_wrapping", "(", "s", ",", "linewidth", "=", "80", ")", ":", "tabwidth", "=", "8", "# Currently always true in Shell.", "pos", "=", "0", "linecount", "=", "1", "current_column", "=", "0", "for", "m", "in", "re", ".", "finditer", "(", ...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/idlelib/squeezer.py#L28-L81
ncbi-nlp/bluebert
ccc828c74e0eed942fd1ececff3638babc38269c
bert/tokenization.py
python
BasicTokenizer.tokenize
(self, text)
return output_tokens
Tokenizes a piece of text.
Tokenizes a piece of text.
[ "Tokenizes", "a", "piece", "of", "text", "." ]
def tokenize(self, text): """Tokenizes a piece of text.""" text = convert_to_unicode(text) text = self._clean_text(text) # This was added on November 1st, 2018 for the multilingual and Chinese # models. This is also applied to the English models now, but it doesn't # matter since the English mo...
[ "def", "tokenize", "(", "self", ",", "text", ")", ":", "text", "=", "convert_to_unicode", "(", "text", ")", "text", "=", "self", ".", "_clean_text", "(", "text", ")", "# This was added on November 1st, 2018 for the multilingual and Chinese", "# models. This is also appl...
https://github.com/ncbi-nlp/bluebert/blob/ccc828c74e0eed942fd1ececff3638babc38269c/bert/tokenization.py#L196-L218
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/models/visual_bert/modeling_visual_bert.py
python
VisualBertSelfOutput.forward
(self, hidden_states, input_tensor)
return hidden_states
[]
def forward(self, hidden_states, input_tensor): hidden_states = self.dense(hidden_states) hidden_states = self.dropout(hidden_states) hidden_states = self.LayerNorm(hidden_states + input_tensor) return hidden_states
[ "def", "forward", "(", "self", ",", "hidden_states", ",", "input_tensor", ")", ":", "hidden_states", "=", "self", ".", "dense", "(", "hidden_states", ")", "hidden_states", "=", "self", ".", "dropout", "(", "hidden_states", ")", "hidden_states", "=", "self", ...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/visual_bert/modeling_visual_bert.py#L276-L280
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/netrc.py
python
netrc._parse
(self, file, fp, default_netrc)
[]
def _parse(self, file, fp, default_netrc): lexer = shlex.shlex(fp) lexer.wordchars += r"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~""" lexer.commenters = lexer.commenters.replace('#', '') while 1: # Look for a machine, default, or macdef top-level keyword saved_lineno = le...
[ "def", "_parse", "(", "self", ",", "file", ",", "fp", ",", "default_netrc", ")", ":", "lexer", "=", "shlex", ".", "shlex", "(", "fp", ")", "lexer", ".", "wordchars", "+=", "r\"\"\"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~\"\"\"", "lexer", ".", "commenters", "=", "l...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/netrc.py#L32-L111
PaddlePaddle/PaddleX
2bab73f81ab54e328204e7871e6ae4a82e719f5d
paddlex/ppdet/data/transform/autoaugment_utils.py
python
unwrap
(image, replace)
return image.astype(np.uint8)
Unwraps an image produced by wrap. Where there is a 0 in the last channel for every spatial position, the rest of the three channels in that spatial dimension are grayed (set to 128). Operations like translate and shear on a wrapped Tensor will leave 0s in empty locations. Some transformations lo...
Unwraps an image produced by wrap.
[ "Unwraps", "an", "image", "produced", "by", "wrap", "." ]
def unwrap(image, replace): """Unwraps an image produced by wrap. Where there is a 0 in the last channel for every spatial position, the rest of the three channels in that spatial dimension are grayed (set to 128). Operations like translate and shear on a wrapped Tensor will leave 0s in empty lo...
[ "def", "unwrap", "(", "image", ",", "replace", ")", ":", "image_shape", "=", "image", ".", "shape", "# Flatten the spatial dimensions.", "flattened_image", "=", "np", ".", "reshape", "(", "image", ",", "[", "-", "1", ",", "image_shape", "[", "2", "]", "]",...
https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/paddlex/ppdet/data/transform/autoaugment_utils.py#L1149-L1188
makerbot/ReplicatorG
d6f2b07785a5a5f1e172fb87cb4303b17c575d5d
skein_engines/skeinforge-35/fabmetheus_utilities/geometry/geometry_utilities/booleansolid.py
python
addLoopsXSegmentIntersections
( lineLoopsIntersections, loops, segmentFirstX, segmentSecondX, segmentYMirror, y )
Add intersections of the loops with the x segment.
Add intersections of the loops with the x segment.
[ "Add", "intersections", "of", "the", "loops", "with", "the", "x", "segment", "." ]
def addLoopsXSegmentIntersections( lineLoopsIntersections, loops, segmentFirstX, segmentSecondX, segmentYMirror, y ): "Add intersections of the loops with the x segment." for loop in loops: addLoopXSegmentIntersections( lineLoopsIntersections, loop, segmentFirstX, segmentSecondX, segmentYMirror, y )
[ "def", "addLoopsXSegmentIntersections", "(", "lineLoopsIntersections", ",", "loops", ",", "segmentFirstX", ",", "segmentSecondX", ",", "segmentYMirror", ",", "y", ")", ":", "for", "loop", "in", "loops", ":", "addLoopXSegmentIntersections", "(", "lineLoopsIntersections",...
https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-35/fabmetheus_utilities/geometry/geometry_utilities/booleansolid.py#L82-L85
open-mmlab/mmskeleton
b4c076baa9e02e69b5876c49fa7c509866d902c7
mmskeleton/datasets/utils/video_demo.py
python
VideoDemo.skeleton_preprocess
(image, bboxes, skeleton_cfg)
return result, meta
[]
def skeleton_preprocess(image, bboxes, skeleton_cfg): # output collector result_list = [] meta = dict() meta['scale'] = [] meta['rotation'] = [] meta['center'] = [] meta['score'] = [] # preprocess config image_size = skeleton_cfg.image_size ...
[ "def", "skeleton_preprocess", "(", "image", ",", "bboxes", ",", "skeleton_cfg", ")", ":", "# output collector", "result_list", "=", "[", "]", "meta", "=", "dict", "(", ")", "meta", "[", "'scale'", "]", "=", "[", "]", "meta", "[", "'rotation'", "]", "=", ...
https://github.com/open-mmlab/mmskeleton/blob/b4c076baa9e02e69b5876c49fa7c509866d902c7/mmskeleton/datasets/utils/video_demo.py#L36-L79
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/requests/requests/packages/urllib3/packages/six.py
python
_add_doc
(func, doc)
Add documentation to a function.
Add documentation to a function.
[ "Add", "documentation", "to", "a", "function", "." ]
def _add_doc(func, doc): """Add documentation to a function.""" func.__doc__ = doc
[ "def", "_add_doc", "(", "func", ",", "doc", ")", ":", "func", ".", "__doc__", "=", "doc" ]
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/requests/requests/packages/urllib3/packages/six.py#L67-L69
comadan/FM_FTRL
a86c51d11d86b7e4a9e6b3db5b50351849e61fb2
FM_FTRL_machine.py
python
FM_FTRL_machine.init_fm
(self, i)
initialize the factorization weight vector for variable i.
initialize the factorization weight vector for variable i.
[ "initialize", "the", "factorization", "weight", "vector", "for", "variable", "i", "." ]
def init_fm(self, i): ''' initialize the factorization weight vector for variable i. ''' if i not in self.n_fm: self.n_fm[i] = [0.] * self.fm_dim self.w_fm[i] = [0.] * self.fm_dim self.z_fm[i] = [0.] * self.fm_dim for k in range(self.f...
[ "def", "init_fm", "(", "self", ",", "i", ")", ":", "if", "i", "not", "in", "self", ".", "n_fm", ":", "self", ".", "n_fm", "[", "i", "]", "=", "[", "0.", "]", "*", "self", ".", "fm_dim", "self", ".", "w_fm", "[", "i", "]", "=", "[", "0.", ...
https://github.com/comadan/FM_FTRL/blob/a86c51d11d86b7e4a9e6b3db5b50351849e61fb2/FM_FTRL_machine.py#L43-L52
WerWolv/EdiZon_CheatsConfigsAndScripts
d16d36c7509c01dca770f402babd83ff2e9ae6e7
Scripts/lib/python3.5/pydoc.py
python
HTMLDoc.section
(self, title, fgcol, bgcol, contents, width=6, prelude='', marginalia=None, gap='&nbsp;')
return result + '\n<td width="100%%">%s</td></tr></table>' % contents
Format a section with a heading.
Format a section with a heading.
[ "Format", "a", "section", "with", "a", "heading", "." ]
def section(self, title, fgcol, bgcol, contents, width=6, prelude='', marginalia=None, gap='&nbsp;'): """Format a section with a heading.""" if marginalia is None: marginalia = '<tt>' + '&nbsp;' * width + '</tt>' result = '''<p> <table width="100%%" cellspacing=0 cell...
[ "def", "section", "(", "self", ",", "title", ",", "fgcol", ",", "bgcol", ",", "contents", ",", "width", "=", "6", ",", "prelude", "=", "''", ",", "marginalia", "=", "None", ",", "gap", "=", "'&nbsp;'", ")", ":", "if", "marginalia", "is", "None", ":...
https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/pydoc.py#L488-L508
Kozea/WeasyPrint
6cce2978165134e37683cb5b3d156cac6a11a7f9
weasyprint/css/validation/expanders.py
python
expand_flex_flow
(name, tokens)
Expand the ``flex-flow`` property.
Expand the ``flex-flow`` property.
[ "Expand", "the", "flex", "-", "flow", "property", "." ]
def expand_flex_flow(name, tokens): """Expand the ``flex-flow`` property.""" if len(tokens) == 2: for sorted_tokens in tokens, tokens[::-1]: direction = flex_direction([sorted_tokens[0]]) wrap = flex_wrap([sorted_tokens[1]]) if direction and wrap: yiel...
[ "def", "expand_flex_flow", "(", "name", ",", "tokens", ")", ":", "if", "len", "(", "tokens", ")", "==", "2", ":", "for", "sorted_tokens", "in", "tokens", ",", "tokens", "[", ":", ":", "-", "1", "]", ":", "direction", "=", "flex_direction", "(", "[", ...
https://github.com/Kozea/WeasyPrint/blob/6cce2978165134e37683cb5b3d156cac6a11a7f9/weasyprint/css/validation/expanders.py#L626-L649
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/Lib/MimeWriter.py
python
MimeWriter.flushheaders
(self)
Writes out and forgets all headers accumulated so far. This is useful if you don't need a body part at all; for example, for a subpart of type message/rfc822 that's (mis)used to store some header-like information.
Writes out and forgets all headers accumulated so far.
[ "Writes", "out", "and", "forgets", "all", "headers", "accumulated", "so", "far", "." ]
def flushheaders(self): """Writes out and forgets all headers accumulated so far. This is useful if you don't need a body part at all; for example, for a subpart of type message/rfc822 that's (mis)used to store some header-like information. """ self._fp.writelines(self....
[ "def", "flushheaders", "(", "self", ")", ":", "self", ".", "_fp", ".", "writelines", "(", "self", ".", "_headers", ")", "self", ".", "_headers", "=", "[", "]" ]
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/MimeWriter.py#L117-L126
HymanLiuTS/flaskTs
286648286976e85d9b9a5873632331efcafe0b21
flasky/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.py
python
subqueryload
(loadopt, attr)
return loadopt.set_relationship_strategy(attr, {"lazy": "subquery"})
Indicate that the given attribute should be loaded using subquery eager loading. This function is part of the :class:`.Load` interface and supports both method-chained and standalone operation. examples:: # subquery-load the "orders" collection on "User" query(User).options(subquerylo...
Indicate that the given attribute should be loaded using subquery eager loading.
[ "Indicate", "that", "the", "given", "attribute", "should", "be", "loaded", "using", "subquery", "eager", "loading", "." ]
def subqueryload(loadopt, attr): """Indicate that the given attribute should be loaded using subquery eager loading. This function is part of the :class:`.Load` interface and supports both method-chained and standalone operation. examples:: # subquery-load the "orders" collection on "User...
[ "def", "subqueryload", "(", "loadopt", ",", "attr", ")", ":", "return", "loadopt", ".", "set_relationship_strategy", "(", "attr", ",", "{", "\"lazy\"", ":", "\"subquery\"", "}", ")" ]
https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/sqlalchemy/orm/strategy_options.py#L770-L801
opensistemas-hub/osbrain
a9abc82fb194348cceaabb897b394821fee2f135
osbrain/agent.py
python
Agent.log_info
(self, message, logger='_logger')
Log an info message. Parameters ---------- message : str Message to log. logger : str Alias of the logger.
Log an info message.
[ "Log", "an", "info", "message", "." ]
def log_info(self, message, logger='_logger'): """ Log an info message. Parameters ---------- message : str Message to log. logger : str Alias of the logger. """ self._log_message('INFO', message, logger)
[ "def", "log_info", "(", "self", ",", "message", ",", "logger", "=", "'_logger'", ")", ":", "self", ".", "_log_message", "(", "'INFO'", ",", "message", ",", "logger", ")" ]
https://github.com/opensistemas-hub/osbrain/blob/a9abc82fb194348cceaabb897b394821fee2f135/osbrain/agent.py#L551-L562
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/Centos_5.9/Crypto/Random/Fortuna/SHAd256.py
python
_SHAd256.update
(self, data)
[]
def update(self, data): self._h.update(data)
[ "def", "update", "(", "self", ",", "data", ")", ":", "self", ".", "_h", ".", "update", "(", "data", ")" ]
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_5.9/Crypto/Random/Fortuna/SHAd256.py#L83-L84
bendmorris/static-python
2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473
Lib/decimal.py
python
Decimal.__ceil__
(self)
return int(self._rescale(0, ROUND_CEILING))
Return the ceiling of self, as an integer. For a finite Decimal instance self, return the least integer n such that n >= self. If self is infinite or a NaN then a Python exception is raised.
Return the ceiling of self, as an integer.
[ "Return", "the", "ceiling", "of", "self", "as", "an", "integer", "." ]
def __ceil__(self): """Return the ceiling of self, as an integer. For a finite Decimal instance self, return the least integer n such that n >= self. If self is infinite or a NaN then a Python exception is raised. """ if self._is_special: if self.is_nan(): ...
[ "def", "__ceil__", "(", "self", ")", ":", "if", "self", ".", "_is_special", ":", "if", "self", ".", "is_nan", "(", ")", ":", "raise", "ValueError", "(", "\"cannot round a NaN\"", ")", "else", ":", "raise", "OverflowError", "(", "\"cannot round an infinity\"", ...
https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/decimal.py#L1897-L1910
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/xml/dom/minidom.py
python
NamedNodeMap.itemsNS
(self)
return L
[]
def itemsNS(self): L = [] for node in self._attrs.values(): L.append(((node.namespaceURI, node.localName), node.value)) return L
[ "def", "itemsNS", "(", "self", ")", ":", "L", "=", "[", "]", "for", "node", "in", "self", ".", "_attrs", ".", "values", "(", ")", ":", "L", ".", "append", "(", "(", "(", "node", ".", "namespaceURI", ",", "node", ".", "localName", ")", ",", "nod...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/xml/dom/minidom.py#L502-L506
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/motion_blinds/cover.py
python
MotionTDBUDevice.stop_cover
(self, **kwargs)
Stop the cover.
Stop the cover.
[ "Stop", "the", "cover", "." ]
def stop_cover(self, **kwargs): """Stop the cover.""" self._blind.Stop(motor=self._motor_key)
[ "def", "stop_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_blind", ".", "Stop", "(", "motor", "=", "self", ".", "_motor_key", ")" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/motion_blinds/cover.py#L316-L318
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AdminServer/appscale/admin/instance_manager/utils.py
python
remove_logrotate
(project_id)
Removes logrotate script for the given project. Args: project_id: A string, the name of the project to remove logrotate for.
Removes logrotate script for the given project.
[ "Removes", "logrotate", "script", "for", "the", "given", "project", "." ]
def remove_logrotate(project_id): """ Removes logrotate script for the given project. Args: project_id: A string, the name of the project to remove logrotate for. """ app_logrotate_script = "{0}/appscale-{1}".\ format(LOGROTATE_CONFIG_DIR, project_id) logger.debug("Removing script: {}".format(app_log...
[ "def", "remove_logrotate", "(", "project_id", ")", ":", "app_logrotate_script", "=", "\"{0}/appscale-{1}\"", ".", "format", "(", "LOGROTATE_CONFIG_DIR", ",", "project_id", ")", "logger", ".", "debug", "(", "\"Removing script: {}\"", ".", "format", "(", "app_logrotate_...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AdminServer/appscale/admin/instance_manager/utils.py#L106-L120
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/plat-irix6/IN.py
python
IN_CLASSB
(i)
return (((__int32_t)(i) & 0xc0000000) == 0x80000000)
[]
def IN_CLASSB(i): return (((__int32_t)(i) & 0xc0000000) == 0x80000000)
[ "def", "IN_CLASSB", "(", "i", ")", ":", "return", "(", "(", "(", "__int32_t", ")", "(", "i", ")", "&", "0xc0000000", ")", "==", "0x80000000", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/plat-irix6/IN.py#L191-L191
osmr/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
keras_/kerascv/models/common.py
python
channel_shuffle_lambda
(channels, groups, **kwargs)
return nn.Lambda(channel_shuffle, arguments={"groups": groups}, **kwargs)
Channel shuffle layer. This is a wrapper over the same operation. It is designed to save the number of groups. Parameters: ---------- channels : int Number of channels. groups : int Number of groups. Returns: ------- Layer Channel shuffle layer.
Channel shuffle layer. This is a wrapper over the same operation. It is designed to save the number of groups.
[ "Channel", "shuffle", "layer", ".", "This", "is", "a", "wrapper", "over", "the", "same", "operation", ".", "It", "is", "designed", "to", "save", "the", "number", "of", "groups", "." ]
def channel_shuffle_lambda(channels, groups, **kwargs): """ Channel shuffle layer. This is a wrapper over the same operation. It is designed to save the number of groups. Parameters: ---------- channels : int Number of channels. grou...
[ "def", "channel_shuffle_lambda", "(", "channels", ",", "groups", ",", "*", "*", "kwargs", ")", ":", "assert", "(", "channels", "%", "groups", "==", "0", ")", "return", "nn", ".", "Lambda", "(", "channel_shuffle", ",", "arguments", "=", "{", "\"groups\"", ...
https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/keras_/kerascv/models/common.py#L1322-L1342
rlvaugh/Impractical_Python_Projects
ff9065e94430dc4ecf76d2c9e78f05fae499213e
Chapter_13/practice_45.py
python
Particle.vector
(self)
Calculate particle vector at launch.
Calculate particle vector at launch.
[ "Calculate", "particle", "vector", "at", "launch", "." ]
def vector(self): """Calculate particle vector at launch.""" angles = [65, 55, 45, 35, 25] # 90 is vertical orient = random.choice(angles) if orient == 45: self.color = WHITE else: self.color = GRAY radians = math.radians(orient) self.dx =...
[ "def", "vector", "(", "self", ")", ":", "angles", "=", "[", "65", ",", "55", ",", "45", ",", "35", ",", "25", "]", "# 90 is vertical", "orient", "=", "random", ".", "choice", "(", "angles", ")", "if", "orient", "==", "45", ":", "self", ".", "colo...
https://github.com/rlvaugh/Impractical_Python_Projects/blob/ff9065e94430dc4ecf76d2c9e78f05fae499213e/Chapter_13/practice_45.py#L40-L50
inasafe/inasafe
355eb2ce63f516b9c26af0c86a24f99e53f63f87
safe/gui/tools/wizard/step_kw43_threshold.py
python
StepKwThreshold.set_widgets
(self)
Set widgets on the Threshold tab.
Set widgets on the Threshold tab.
[ "Set", "widgets", "on", "the", "Threshold", "tab", "." ]
def set_widgets(self): """Set widgets on the Threshold tab.""" clear_layout(self.gridLayoutThreshold) # Set text in the label layer_purpose = self.parent.step_kw_purpose.selected_purpose() layer_subcategory = self.parent.step_kw_subcategory.\ selected_subcategory() ...
[ "def", "set_widgets", "(", "self", ")", ":", "clear_layout", "(", "self", ".", "gridLayoutThreshold", ")", "# Set text in the label", "layer_purpose", "=", "self", ".", "parent", ".", "step_kw_purpose", ".", "selected_purpose", "(", ")", "layer_subcategory", "=", ...
https://github.com/inasafe/inasafe/blob/355eb2ce63f516b9c26af0c86a24f99e53f63f87/safe/gui/tools/wizard/step_kw43_threshold.py#L93-L222
feisuzhu/thbattle
ac0dee1b2d86de7664289cf432b157ef25427ba1
src/pyglet/app/base.py
python
EventLoop.idle
(self)
return self.clock.get_sleep_time(True)
Called during each iteration of the event loop. The method is called immediately after any window events (i.e., after any user input). The method can return a duration after which the idle method will be called again. The method may be called earlier if the user creates more input eve...
Called during each iteration of the event loop.
[ "Called", "during", "each", "iteration", "of", "the", "event", "loop", "." ]
def idle(self): '''Called during each iteration of the event loop. The method is called immediately after any window events (i.e., after any user input). The method can return a duration after which the idle method will be called again. The method may be called earlier if the ...
[ "def", "idle", "(", "self", ")", ":", "dt", "=", "self", ".", "clock", ".", "update_time", "(", ")", "redraw_all", "=", "self", ".", "clock", ".", "call_scheduled_functions", "(", "dt", ")", "# Redraw all windows", "for", "window", "in", "app", ".", "win...
https://github.com/feisuzhu/thbattle/blob/ac0dee1b2d86de7664289cf432b157ef25427ba1/src/pyglet/app/base.py#L248-L285
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/twisted/twisted/words/protocols/irc.py
python
IRCClient.joined
(self, channel)
Called when I finish joining a channel. channel has the starting character (C{'#'}, C{'&'}, C{'!'}, or C{'+'}) intact.
Called when I finish joining a channel.
[ "Called", "when", "I", "finish", "joining", "a", "channel", "." ]
def joined(self, channel): """ Called when I finish joining a channel. channel has the starting character (C{'#'}, C{'&'}, C{'!'}, or C{'+'}) intact. """
[ "def", "joined", "(", "self", ",", "channel", ")", ":" ]
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/words/protocols/irc.py#L1182-L1188
rietveld-codereview/rietveld
82e415f6a291c58c714d3869c7a1de818546c7d5
third_party/oauth2client/client.py
python
OAuth2Credentials.refresh
(self, http)
Forces a refresh of the access_token. Args: http: httplib2.Http, an http object to be used to make the refresh request.
Forces a refresh of the access_token.
[ "Forces", "a", "refresh", "of", "the", "access_token", "." ]
def refresh(self, http): """Forces a refresh of the access_token. Args: http: httplib2.Http, an http object to be used to make the refresh request. """ self._refresh(http.request)
[ "def", "refresh", "(", "self", ",", "http", ")", ":", "self", ".", "_refresh", "(", "http", ".", "request", ")" ]
https://github.com/rietveld-codereview/rietveld/blob/82e415f6a291c58c714d3869c7a1de818546c7d5/third_party/oauth2client/client.py#L509-L516
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/django/views/generic/list.py
python
MultipleObjectMixin.paginate_queryset
(self, queryset, page_size)
Paginate the queryset, if needed.
Paginate the queryset, if needed.
[ "Paginate", "the", "queryset", "if", "needed", "." ]
def paginate_queryset(self, queryset, page_size): """ Paginate the queryset, if needed. """ paginator = self.get_paginator( queryset, page_size, orphans=self.get_paginate_orphans(), allow_empty_first_page=self.get_allow_empty()) page_kwarg = self.page_kwar...
[ "def", "paginate_queryset", "(", "self", ",", "queryset", ",", "page_size", ")", ":", "paginator", "=", "self", ".", "get_paginator", "(", "queryset", ",", "page_size", ",", "orphans", "=", "self", ".", "get_paginate_orphans", "(", ")", ",", "allow_empty_first...
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/views/generic/list.py#L62-L85
ChangeMyUsername/algorithms-sedgewick-python
d3ccd86c93016c7fee270ad02e1a823d205cea80
chapter_2/module_2_2.py
python
MergeSort.insertion_sort
( self, seq: MutableSequence[CT], low: int, high: int)
Insertion sort, apply this method with certain size array to improve performance. Args: seq (MutableSequence[CT]): sorting array low (int): start index high (int): end index >>> merge_sort = MergeSort() >>> sequence = [0, 4, 7, 1, -3, 9] >>> ...
Insertion sort, apply this method with certain size array to improve performance.
[ "Insertion", "sort", "apply", "this", "method", "with", "certain", "size", "array", "to", "improve", "performance", "." ]
def insertion_sort( self, seq: MutableSequence[CT], low: int, high: int) -> None: """Insertion sort, apply this method with certain size array to improve performance. Args: seq (MutableSequence[CT]): sorting array low (int): start index high (int)...
[ "def", "insertion_sort", "(", "self", ",", "seq", ":", "MutableSequence", "[", "CT", "]", ",", "low", ":", "int", ",", "high", ":", "int", ")", "->", "None", ":", "for", "i", "in", "range", "(", "low", "+", "1", ",", "high", "+", "1", ")", ":",...
https://github.com/ChangeMyUsername/algorithms-sedgewick-python/blob/d3ccd86c93016c7fee270ad02e1a823d205cea80/chapter_2/module_2_2.py#L65-L87
pytorch/opacus
5c83d59fc169e93667946204f7a6859827a38ace
opacus/accountants/analysis/rdp.py
python
compute_rdp
( *, q: float, noise_multiplier: float, steps: int, orders: Union[List[float], float] )
return rdp * steps
r"""Computes Renyi Differential Privacy (RDP) guarantees of the Sampled Gaussian Mechanism (SGM) iterated ``steps`` times. Args: q: Sampling rate of SGM. noise_multiplier: The ratio of the standard deviation of the additive Gaussian noise to the L2-sensitivity of the function ...
r"""Computes Renyi Differential Privacy (RDP) guarantees of the Sampled Gaussian Mechanism (SGM) iterated ``steps`` times.
[ "r", "Computes", "Renyi", "Differential", "Privacy", "(", "RDP", ")", "guarantees", "of", "the", "Sampled", "Gaussian", "Mechanism", "(", "SGM", ")", "iterated", "steps", "times", "." ]
def compute_rdp( *, q: float, noise_multiplier: float, steps: int, orders: Union[List[float], float] ) -> Union[List[float], float]: r"""Computes Renyi Differential Privacy (RDP) guarantees of the Sampled Gaussian Mechanism (SGM) iterated ``steps`` times. Args: q: Sampling rate of SGM. ...
[ "def", "compute_rdp", "(", "*", ",", "q", ":", "float", ",", "noise_multiplier", ":", "float", ",", "steps", ":", "int", ",", "orders", ":", "Union", "[", "List", "[", "float", "]", ",", "float", "]", ")", "->", "Union", "[", "List", "[", "float", ...
https://github.com/pytorch/opacus/blob/5c83d59fc169e93667946204f7a6859827a38ace/opacus/accountants/analysis/rdp.py#L250-L274
numenta/nupic
b9ebedaf54f49a33de22d8d44dff7c765cdb5548
src/nupic/frameworks/opf/prediction_metrics_manager.py
python
MetricsManager.getMetrics
(self)
return result
Gets the current metric values :returns: (dict) where each key is the metric-name, and the values are it scalar value. Same as the output of :meth:`~nupic.frameworks.opf.prediction_metrics_manager.MetricsManager.update`
Gets the current metric values
[ "Gets", "the", "current", "metric", "values" ]
def getMetrics(self): """ Gets the current metric values :returns: (dict) where each key is the metric-name, and the values are it scalar value. Same as the output of :meth:`~nupic.frameworks.opf.prediction_metrics_manager.MetricsManager.update` """ result = {} f...
[ "def", "getMetrics", "(", "self", ")", ":", "result", "=", "{", "}", "for", "metricObj", ",", "label", "in", "zip", "(", "self", ".", "__metrics", ",", "self", ".", "__metricLabels", ")", ":", "value", "=", "metricObj", ".", "getMetric", "(", ")", "r...
https://github.com/numenta/nupic/blob/b9ebedaf54f49a33de22d8d44dff7c765cdb5548/src/nupic/frameworks/opf/prediction_metrics_manager.py#L159-L174
google/qkeras
e0faa69b3a3d99850b06c5793e6831b7d9b83306
qkeras/autoqkeras/autoqkeras_internal.py
python
AutoQKeras.fit
(self, *fit_args, **fit_kwargs)
Invokes tuner fit algorithm.
Invokes tuner fit algorithm.
[ "Invokes", "tuner", "fit", "algorithm", "." ]
def fit(self, *fit_args, **fit_kwargs): """Invokes tuner fit algorithm.""" callbacks = fit_kwargs.get("callbacks", None) if callbacks is None: callbacks = [] epochs = fit_kwargs.get("epochs", None) if epochs is None: epochs = 10 if not self._has_earlystopping(callbacks): c...
[ "def", "fit", "(", "self", ",", "*", "fit_args", ",", "*", "*", "fit_kwargs", ")", ":", "callbacks", "=", "fit_kwargs", ".", "get", "(", "\"callbacks\"", ",", "None", ")", "if", "callbacks", "is", "None", ":", "callbacks", "=", "[", "]", "epochs", "=...
https://github.com/google/qkeras/blob/e0faa69b3a3d99850b06c5793e6831b7d9b83306/qkeras/autoqkeras/autoqkeras_internal.py#L948-L968
mrlesmithjr/Ansible
d44f0dc0d942bdf3bf7334b307e6048f0ee16e36
roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/requests/utils.py
python
from_key_val_list
(value)
return OrderedDict(value)
Take an object and test to see if it can be represented as a dictionary. Unless it can not be represented as such, return an OrderedDict, e.g., :: >>> from_key_val_list([('key', 'val')]) OrderedDict([('key', 'val')]) >>> from_key_val_list('string') ValueError: need more tha...
Take an object and test to see if it can be represented as a dictionary. Unless it can not be represented as such, return an OrderedDict, e.g.,
[ "Take", "an", "object", "and", "test", "to", "see", "if", "it", "can", "be", "represented", "as", "a", "dictionary", ".", "Unless", "it", "can", "not", "be", "represented", "as", "such", "return", "an", "OrderedDict", "e", ".", "g", "." ]
def from_key_val_list(value): """Take an object and test to see if it can be represented as a dictionary. Unless it can not be represented as such, return an OrderedDict, e.g., :: >>> from_key_val_list([('key', 'val')]) OrderedDict([('key', 'val')]) >>> from_key_val_list('strin...
[ "def", "from_key_val_list", "(", "value", ")", ":", "if", "value", "is", "None", ":", "return", "None", "if", "isinstance", "(", "value", ",", "(", "str", ",", "bytes", ",", "bool", ",", "int", ")", ")", ":", "raise", "ValueError", "(", "'cannot encode...
https://github.com/mrlesmithjr/Ansible/blob/d44f0dc0d942bdf3bf7334b307e6048f0ee16e36/roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/requests/utils.py#L219-L241
KhronosGroup/OpenXR-SDK-Source
76756e2e7849b15466d29bee7d80cada92865550
specification/scripts/spec_tools/consistency_tools.py
python
XMLChecker.is_api_type
(self, member_elem)
return self.conventions.type_prefix in membertext
Return true if the member/parameter ElementTree passed is from this API. May override or extend.
Return true if the member/parameter ElementTree passed is from this API.
[ "Return", "true", "if", "the", "member", "/", "parameter", "ElementTree", "passed", "is", "from", "this", "API", "." ]
def is_api_type(self, member_elem): """Return true if the member/parameter ElementTree passed is from this API. May override or extend.""" membertext = "".join(member_elem.itertext()) return self.conventions.type_prefix in membertext
[ "def", "is_api_type", "(", "self", ",", "member_elem", ")", ":", "membertext", "=", "\"\"", ".", "join", "(", "member_elem", ".", "itertext", "(", ")", ")", "return", "self", ".", "conventions", ".", "type_prefix", "in", "membertext" ]
https://github.com/KhronosGroup/OpenXR-SDK-Source/blob/76756e2e7849b15466d29bee7d80cada92865550/specification/scripts/spec_tools/consistency_tools.py#L118-L124
Lawouach/WebSocket-for-Python
a3e6d157b7bb1da1009e66aa750170f1c07aa143
example/websensors/app.py
python
render_template
(template)
Renders a mako template to HTML and sets the CherryPy response's body with it.
Renders a mako template to HTML and sets the CherryPy response's body with it.
[ "Renders", "a", "mako", "template", "to", "HTML", "and", "sets", "the", "CherryPy", "response", "s", "body", "with", "it", "." ]
def render_template(template): """ Renders a mako template to HTML and sets the CherryPy response's body with it. """ if cherrypy.response.status > 399: return data = cherrypy.response.body or {} template = lookup.get_template(template) if template and isinstance(data, dict): ...
[ "def", "render_template", "(", "template", ")", ":", "if", "cherrypy", ".", "response", ".", "status", ">", "399", ":", "return", "data", "=", "cherrypy", ".", "response", ".", "body", "or", "{", "}", "template", "=", "lookup", ".", "get_template", "(", ...
https://github.com/Lawouach/WebSocket-for-Python/blob/a3e6d157b7bb1da1009e66aa750170f1c07aa143/example/websensors/app.py#L194-L206
riffnshred/nhl-led-scoreboard
14baa7f0691ca507e4c6f7f2ec02e50ccd1ed9e1
src/nhl_api/game.py
python
Overview.__init__
(self, data)
[]
def __init__(self, data): # loop through data for x in data: # set information as correct data type try: setattr(self, x, int(data[x])) except ValueError: try: setattr(self, x, float(data[x])) except ...
[ "def", "__init__", "(", "self", ",", "data", ")", ":", "# loop through data", "for", "x", "in", "data", ":", "# set information as correct data type", "try", ":", "setattr", "(", "self", ",", "x", ",", "int", "(", "data", "[", "x", "]", ")", ")", "except...
https://github.com/riffnshred/nhl-led-scoreboard/blob/14baa7f0691ca507e4c6f7f2ec02e50ccd1ed9e1/src/nhl_api/game.py#L172-L198
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/util.py
python
resolve
(module_name, dotted_path)
return result
[]
def resolve(module_name, dotted_path): if module_name in sys.modules: mod = sys.modules[module_name] else: mod = __import__(module_name) if dotted_path is None: result = mod else: parts = dotted_path.split('.') result = getattr(mod, parts.pop(0)) for p in ...
[ "def", "resolve", "(", "module_name", ",", "dotted_path", ")", ":", "if", "module_name", "in", "sys", ".", "modules", ":", "mod", "=", "sys", ".", "modules", "[", "module_name", "]", "else", ":", "mod", "=", "__import__", "(", "module_name", ")", "if", ...
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/util.py#L519-L531
mautrix/telegram
9f48eca5a6654bc38012cb761ecaaaf416aabdd0
mautrix_telegram/portal.py
python
Portal._send_bridge_error
( self, sender: u.User, err: Exception, event_id: EventID, event_type: EventType, message_type: MessageType | None = None, msg: str | None = None, )
[]
async def _send_bridge_error( self, sender: u.User, err: Exception, event_id: EventID, event_type: EventType, message_type: MessageType | None = None, msg: str | None = None, ) -> None: sender.send_remote_checkpoint( MessageSendCheckpointSt...
[ "async", "def", "_send_bridge_error", "(", "self", ",", "sender", ":", "u", ".", "User", ",", "err", ":", "Exception", ",", "event_id", ":", "EventID", ",", "event_type", ":", "EventType", ",", "message_type", ":", "MessageType", "|", "None", "=", "None", ...
https://github.com/mautrix/telegram/blob/9f48eca5a6654bc38012cb761ecaaaf416aabdd0/mautrix_telegram/portal.py#L1685-L1706
bikalims/bika.lims
35e4bbdb5a3912cae0b5eb13e51097c8b0486349
bika/lims/browser/widgets/artemplateanalyseswidget.py
python
ARTemplateAnalysesView.__init__
(self, context, request, fieldvalue=[], allow_edit=False)
[]
def __init__(self, context, request, fieldvalue=[], allow_edit=False): super(ARTemplateAnalysesView, self).__init__(context, request) self.catalog = "bika_setup_catalog" self.contentFilter = {'portal_type': 'AnalysisService', 'sort_on': 'sortable_title', ...
[ "def", "__init__", "(", "self", ",", "context", ",", "request", ",", "fieldvalue", "=", "[", "]", ",", "allow_edit", "=", "False", ")", ":", "super", "(", "ARTemplateAnalysesView", ",", "self", ")", ".", "__init__", "(", "context", ",", "request", ")", ...
https://github.com/bikalims/bika.lims/blob/35e4bbdb5a3912cae0b5eb13e51097c8b0486349/bika/lims/browser/widgets/artemplateanalyseswidget.py#L25-L90
DetectionTeamUCAS/RRPN_Faster-RCNN_Tensorflow
cca574844df5fc8bbf380227725a4e3106fbc48c
libs/losses/losses.py
python
smooth_l1_loss_rcnn
(bbox_pred, bbox_targets, label, num_classes, sigma=1.0)
return bbox_loss
:param bbox_pred: [-1, (cfgs.CLS_NUM +1) * 5] :param bbox_targets:[-1, (cfgs.CLS_NUM +1) * 5] :param label:[-1] :param num_classes: :param sigma: :return:
[]
def smooth_l1_loss_rcnn(bbox_pred, bbox_targets, label, num_classes, sigma=1.0): ''' :param bbox_pred: [-1, (cfgs.CLS_NUM +1) * 5] :param bbox_targets:[-1, (cfgs.CLS_NUM +1) * 5] :param label:[-1] :param num_classes: :param sigma: :return: ''' outside_mask = tf.stop_gradient(tf.to_...
[ "def", "smooth_l1_loss_rcnn", "(", "bbox_pred", ",", "bbox_targets", ",", "label", ",", "num_classes", ",", "sigma", "=", "1.0", ")", ":", "outside_mask", "=", "tf", ".", "stop_gradient", "(", "tf", ".", "to_float", "(", "tf", ".", "greater", "(", "label",...
https://github.com/DetectionTeamUCAS/RRPN_Faster-RCNN_Tensorflow/blob/cca574844df5fc8bbf380227725a4e3106fbc48c/libs/losses/losses.py#L60-L92
lutris/lutris
66675a4d5537f6b2a2ba2b6df0b3cdf8924c823a
lutris/installer/commands.py
python
CommandsMixin._killable_process
(self, func, *args, **kwargs)
Run function `func` in a separate, killable process.
Run function `func` in a separate, killable process.
[ "Run", "function", "func", "in", "a", "separate", "killable", "process", "." ]
def _killable_process(self, func, *args, **kwargs): """Run function `func` in a separate, killable process.""" with multiprocessing.Pool(1) as process: result_obj = process.apply_async(func, args, kwargs) self.abort_current_task = process.terminate result = result_obj...
[ "def", "_killable_process", "(", "self", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "with", "multiprocessing", ".", "Pool", "(", "1", ")", "as", "process", ":", "result_obj", "=", "process", ".", "apply_async", "(", "func", ",", ...
https://github.com/lutris/lutris/blob/66675a4d5537f6b2a2ba2b6df0b3cdf8924c823a/lutris/installer/commands.py#L516-L524
alberanid/imdbpy
88cf37772186e275eff212857f512669086b382c
imdb/parser/http/movieParser.py
python
makeSplitter
(lstrip=None, sep='|', comments=True, origNotesSep=' (', newNotesSep='::(', strip=None)
return splitter
Return a splitter function suitable for a given set of data.
Return a splitter function suitable for a given set of data.
[ "Return", "a", "splitter", "function", "suitable", "for", "a", "given", "set", "of", "data", "." ]
def makeSplitter(lstrip=None, sep='|', comments=True, origNotesSep=' (', newNotesSep='::(', strip=None): """Return a splitter function suitable for a given set of data.""" def splitter(x): if not x: return x x = x.strip() if not x: return x ...
[ "def", "makeSplitter", "(", "lstrip", "=", "None", ",", "sep", "=", "'|'", ",", "comments", "=", "True", ",", "origNotesSep", "=", "' ('", ",", "newNotesSep", "=", "'::('", ",", "strip", "=", "None", ")", ":", "def", "splitter", "(", "x", ")", ":", ...
https://github.com/alberanid/imdbpy/blob/88cf37772186e275eff212857f512669086b382c/imdb/parser/http/movieParser.py#L144-L164
kirthevasank/nasbot
3c745dc986be30e3721087c8fa768099032a0802
utils/oper_utils.py
python
random_sample
(obj, bounds, max_evals, vectorised=True)
return rand_pts, obj_vals
Optimises a function by randomly sampling and choosing its maximum.
Optimises a function by randomly sampling and choosing its maximum.
[ "Optimises", "a", "function", "by", "randomly", "sampling", "and", "choosing", "its", "maximum", "." ]
def random_sample(obj, bounds, max_evals, vectorised=True): """ Optimises a function by randomly sampling and choosing its maximum. """ dim = len(bounds) rand_pts = map_to_bounds(np.random.random((int(max_evals), dim)), bounds) if vectorised: obj_vals = obj(rand_pts) else: obj_vals = np.array([obj(x) ...
[ "def", "random_sample", "(", "obj", ",", "bounds", ",", "max_evals", ",", "vectorised", "=", "True", ")", ":", "dim", "=", "len", "(", "bounds", ")", "rand_pts", "=", "map_to_bounds", "(", "np", ".", "random", ".", "random", "(", "(", "int", "(", "ma...
https://github.com/kirthevasank/nasbot/blob/3c745dc986be30e3721087c8fa768099032a0802/utils/oper_utils.py#L44-L52
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/agw/ultimatelistctrl.py
python
UltimateListItemAttr.HasFooterFont
(self)
return self._footerFont.IsOk()
Returns ``True`` if the currently set font for the footer item is valid.
Returns ``True`` if the currently set font for the footer item is valid.
[ "Returns", "True", "if", "the", "currently", "set", "font", "for", "the", "footer", "item", "is", "valid", "." ]
def HasFooterFont(self): """ Returns ``True`` if the currently set font for the footer item is valid. """ return self._footerFont.IsOk()
[ "def", "HasFooterFont", "(", "self", ")", ":", "return", "self", ".", "_footerFont", ".", "IsOk", "(", ")" ]
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/ultimatelistctrl.py#L1286-L1292
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/recorder/util.py
python
async_migration_in_progress
(hass: HomeAssistant)
return hass.data[DATA_INSTANCE].migration_in_progress
Determine is a migration is in progress. This is a thin wrapper that allows us to change out the implementation later.
Determine is a migration is in progress.
[ "Determine", "is", "a", "migration", "is", "in", "progress", "." ]
def async_migration_in_progress(hass: HomeAssistant) -> bool: """Determine is a migration is in progress. This is a thin wrapper that allows us to change out the implementation later. """ if DATA_INSTANCE not in hass.data: return False return hass.data[DATA_INSTANCE].migration_in_progre...
[ "def", "async_migration_in_progress", "(", "hass", ":", "HomeAssistant", ")", "->", "bool", ":", "if", "DATA_INSTANCE", "not", "in", "hass", ".", "data", ":", "return", "False", "return", "hass", ".", "data", "[", "DATA_INSTANCE", "]", ".", "migration_in_progr...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/recorder/util.py#L482-L490
SoCo/SoCo
e83fef84d2645d05265dbd574598518655a9c125
soco/soap.py
python
SoapMessage.prepare
(self)
return (headers, data)
Prepare the SOAP message for sending to the server.
Prepare the SOAP message for sending to the server.
[ "Prepare", "the", "SOAP", "message", "for", "sending", "to", "the", "server", "." ]
def prepare(self): """Prepare the SOAP message for sending to the server.""" headers = self.prepare_headers(self.http_headers, self.soap_action) soap_header = self.prepare_soap_header(self.soap_header) soap_body = self.prepare_soap_body(self.method, self.parameters, self.namespace) ...
[ "def", "prepare", "(", "self", ")", ":", "headers", "=", "self", ".", "prepare_headers", "(", "self", ".", "http_headers", ",", "self", ".", "soap_action", ")", "soap_header", "=", "self", ".", "prepare_soap_header", "(", "self", ".", "soap_header", ")", "...
https://github.com/SoCo/SoCo/blob/e83fef84d2645d05265dbd574598518655a9c125/soco/soap.py#L257-L264
annoviko/pyclustering
bf4f51a472622292627ec8c294eb205585e50f52
pyclustering/core/som_wrapper.py
python
som_get_awards
(som_pointer)
return result
! @brief Returns list of amount of captured objects by each neuron. @param[in] som_pointer (c_pointer): pointer to object of self-organized map.
!
[ "!" ]
def som_get_awards(som_pointer): """! @brief Returns list of amount of captured objects by each neuron. @param[in] som_pointer (c_pointer): pointer to object of self-organized map. """ ccore = ccore_library.get() ccore.som_get_awards.restype = POINTER(pyclustering_package) ...
[ "def", "som_get_awards", "(", "som_pointer", ")", ":", "ccore", "=", "ccore_library", ".", "get", "(", ")", "ccore", ".", "som_get_awards", ".", "restype", "=", "POINTER", "(", "pyclustering_package", ")", "package", "=", "ccore", ".", "som_get_awards", "(", ...
https://github.com/annoviko/pyclustering/blob/bf4f51a472622292627ec8c294eb205585e50f52/pyclustering/core/som_wrapper.py#L204-L218
dcramer/django-sphinx
0071d1cae5390d0ec8c669786ca3c7275abb6410
djangosphinx/apis/api278/__init__.py
python
SphinxClient.SetFilter
( self, attribute, values, exclude=0 )
Set values set filter. Only match records where 'attribute' value is in given 'values' set.
Set values set filter. Only match records where 'attribute' value is in given 'values' set.
[ "Set", "values", "set", "filter", ".", "Only", "match", "records", "where", "attribute", "value", "is", "in", "given", "values", "set", "." ]
def SetFilter ( self, attribute, values, exclude=0 ): """ Set values set filter. Only match records where 'attribute' value is in given 'values' set. """ assert(isinstance(attribute, str)) assert iter(values) for value in values: assert(isinstance(value, (int, long))) self._filters.append ( { 'type...
[ "def", "SetFilter", "(", "self", ",", "attribute", ",", "values", ",", "exclude", "=", "0", ")", ":", "assert", "(", "isinstance", "(", "attribute", ",", "str", ")", ")", "assert", "iter", "(", "values", ")", "for", "value", "in", "values", ":", "ass...
https://github.com/dcramer/django-sphinx/blob/0071d1cae5390d0ec8c669786ca3c7275abb6410/djangosphinx/apis/api278/__init__.py#L364-L375