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
ntoll/foox
4a1aeb642088ec001ca89f5d9c626b802043194f
foox/ga.py
python
Genome.breed
(self, other)
return crossover(self, other, self.__class__)
Returns two new offspring bred from this and another instance. Uses the crossover function.
Returns two new offspring bred from this and another instance. Uses the crossover function.
[ "Returns", "two", "new", "offspring", "bred", "from", "this", "and", "another", "instance", ".", "Uses", "the", "crossover", "function", "." ]
def breed(self, other): """ Returns two new offspring bred from this and another instance. Uses the crossover function. """ return crossover(self, other, self.__class__)
[ "def", "breed", "(", "self", ",", "other", ")", ":", "return", "crossover", "(", "self", ",", "other", ",", "self", ".", "__class__", ")" ]
https://github.com/ntoll/foox/blob/4a1aeb642088ec001ca89f5d9c626b802043194f/foox/ga.py#L104-L109
tensorflow/tfx
b4a6b83269815ed12ba9df9e9154c7376fef2ea0
tfx/orchestration/experimental/kubernetes/kubernetes_remote_runner.py
python
_serialize_pipeline
(pipeline: tfx_pipeline.Pipeline)
return json.dumps({ 'pipeline_name': pipeline.pipeline_info.pipeline_name, 'pipeline_root': pipeline.pipeline_info.pipeline_root, 'enable_cache': pipeline.enable_cache, 'components': serialized_components, 'downstream_ids': downstream_ids, ...
Serializes a TFX pipeline. To be replaced with the the TFX Intermediate Representation: tensorflow/community#271. This serialization procedure extracts from the pipeline properties necessary for reconstructing the pipeline instance from within the cluster. For properties such as components and metadata confi...
Serializes a TFX pipeline.
[ "Serializes", "a", "TFX", "pipeline", "." ]
def _serialize_pipeline(pipeline: tfx_pipeline.Pipeline) -> str: """Serializes a TFX pipeline. To be replaced with the the TFX Intermediate Representation: tensorflow/community#271. This serialization procedure extracts from the pipeline properties necessary for reconstructing the pipeline instance from with...
[ "def", "_serialize_pipeline", "(", "pipeline", ":", "tfx_pipeline", ".", "Pipeline", ")", "->", "str", ":", "serialized_components", "=", "[", "]", "for", "component", "in", "pipeline", ".", "components", ":", "serialized_components", ".", "append", "(", "json_u...
https://github.com/tensorflow/tfx/blob/b4a6b83269815ed12ba9df9e9154c7376fef2ea0/tfx/orchestration/experimental/kubernetes/kubernetes_remote_runner.py#L166-L208
NaturalHistoryMuseum/inselect
196a3ae2a0ed4e2c7cb667aaba9a6be1bcd90ca6
data/com/clearimage64.py
python
ICiBarcodes.__call__
(self, n=defaultNamedNotOptArg)
return ret
Barcode Item (1-based)
Barcode Item (1-based)
[ "Barcode", "Item", "(", "1", "-", "based", ")" ]
def __call__(self, n=defaultNamedNotOptArg): 'Barcode Item (1-based)' ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((3, 1),),n ) if ret is not None: ret = Dispatch(ret, '__call__', '{4ED88240-0BE1-11D4-B5F6-009FC6000000}') return ret
[ "def", "__call__", "(", "self", ",", "n", "=", "defaultNamedNotOptArg", ")", ":", "ret", "=", "self", ".", "_oleobj_", ".", "InvokeTypes", "(", "0", ",", "LCID", ",", "2", ",", "(", "9", ",", "0", ")", ",", "(", "(", "3", ",", "1", ")", ",", ...
https://github.com/NaturalHistoryMuseum/inselect/blob/196a3ae2a0ed4e2c7cb667aaba9a6be1bcd90ca6/data/com/clearimage64.py#L523-L529
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/user_importer/validation.py
python
RoleValidator.validate_spec
(self, spec)
[]
def validate_spec(self, spec): role = spec.get('role') if role and role not in self.allowed_roles: return self.error_message.format(role)
[ "def", "validate_spec", "(", "self", ",", "spec", ")", ":", "role", "=", "spec", ".", "get", "(", "'role'", ")", "if", "role", "and", "role", "not", "in", "self", ".", "allowed_roles", ":", "return", "self", ".", "error_message", ".", "format", "(", ...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/user_importer/validation.py#L259-L262
jpype-project/jpype
bbdca907d053f1e04e4dcd414d4ebce8f9da6313
jpype/dbapi2.py
python
Cursor.lastrowid
(self)
Get the id of the last row inserted. This is not supported on all JDBC drivers. The ``.execute*()`` must have been executed with keys set to True. Returns: None if there is no rowid, the rowid if only one row was inserted, or a list of row ids if multiple rows were insert...
Get the id of the last row inserted.
[ "Get", "the", "id", "of", "the", "last", "row", "inserted", "." ]
def lastrowid(self): """ Get the id of the last row inserted. This is not supported on all JDBC drivers. The ``.execute*()`` must have been executed with keys set to True. Returns: None if there is no rowid, the rowid if only one row was inserted, or a list of row...
[ "def", "lastrowid", "(", "self", ")", ":", "if", "self", ".", "_last", "is", "not", "None", ":", "return", "self", ".", "_last", "with", "self", ".", "_statement", ".", "getGeneratedKeys", "(", ")", "as", "rs", ":", "if", "rs", ".", "isClosed", "(", ...
https://github.com/jpype-project/jpype/blob/bbdca907d053f1e04e4dcd414d4ebce8f9da6313/jpype/dbapi2.py#L1274-L1298
nathanlopez/Stitch
8e22e91c94237959c02d521aab58dc7e3d994cea
PyLib/avscan_win.py
python
windefnd_scan
()
[]
def windefnd_scan(): defender = reg_exists('SOFTWARE\\Microsoft\\Windows Defender') if not defender: defender = reg_exists('SOFTWARE\\Policies\\Microsoft\\Windows Defender') if not defender: return False else: return True
[ "def", "windefnd_scan", "(", ")", ":", "defender", "=", "reg_exists", "(", "'SOFTWARE\\\\Microsoft\\\\Windows Defender'", ")", "if", "not", "defender", ":", "defender", "=", "reg_exists", "(", "'SOFTWARE\\\\Policies\\\\Microsoft\\\\Windows Defender'", ")", "if", "not", ...
https://github.com/nathanlopez/Stitch/blob/8e22e91c94237959c02d521aab58dc7e3d994cea/PyLib/avscan_win.py#L252-L256
lepture/flask-oauthlib
d8369c8ae06150d37da2eba951ae9646235f940b
flask_oauthlib/contrib/client/application.py
python
BaseApplication.client
(self)
return self._make_client_with_token(token)
The lazy-created OAuth session with the return value of :meth:`tokengetter`. :returns: The OAuth session instance or ``None`` while token missing.
The lazy-created OAuth session with the return value of :meth:`tokengetter`.
[ "The", "lazy", "-", "created", "OAuth", "session", "with", "the", "return", "value", "of", ":", "meth", ":", "tokengetter", "." ]
def client(self): """The lazy-created OAuth session with the return value of :meth:`tokengetter`. :returns: The OAuth session instance or ``None`` while token missing. """ token = self.obtain_token() if token is None: raise AccessTokenNotFound return ...
[ "def", "client", "(", "self", ")", ":", "token", "=", "self", ".", "obtain_token", "(", ")", "if", "token", "is", "None", ":", "raise", "AccessTokenNotFound", "return", "self", ".", "_make_client_with_token", "(", "token", ")" ]
https://github.com/lepture/flask-oauthlib/blob/d8369c8ae06150d37da2eba951ae9646235f940b/flask_oauthlib/contrib/client/application.py#L77-L86
openstack/swift
b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100
swift/container/backend.py
python
ContainerBroker._load_root_info
(self)
Load the root container name and account for the container represented by this broker. The root container path, if set, is stored in sysmeta under the key ``X-Container-Sysmeta-Shard-Root``. If this sysmeta is not set then the container is considered to be a root container and ``_root_a...
Load the root container name and account for the container represented by this broker.
[ "Load", "the", "root", "container", "name", "and", "account", "for", "the", "container", "represented", "by", "this", "broker", "." ]
def _load_root_info(self): """ Load the root container name and account for the container represented by this broker. The root container path, if set, is stored in sysmeta under the key ``X-Container-Sysmeta-Shard-Root``. If this sysmeta is not set then the container is ...
[ "def", "_load_root_info", "(", "self", ")", ":", "hdr", ",", "path", "=", "self", ".", "_get_root_meta", "(", ")", "if", "not", "path", ":", "# Ensure account/container get populated", "self", ".", "_populate_instance_cache", "(", ")", "self", ".", "_root_accoun...
https://github.com/openstack/swift/blob/b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100/swift/container/backend.py#L2140-L2166
Qirky/Troop
529c5eb14e456f683e6d23fd4adcddc8446aa115
src/interface/interface.py
python
Interface.mouse_left_release
(self, event=None)
return "break"
Updates the server on where the local peer's marker is when the mouse release event is triggered
Updates the server on where the local peer's marker is when the mouse release event is triggered
[ "Updates", "the", "server", "on", "where", "the", "local", "peer", "s", "marker", "is", "when", "the", "mouse", "release", "event", "is", "triggered" ]
def mouse_left_release(self, event=None): """ Updates the server on where the local peer's marker is when the mouse release event is triggered """ index = self.left_mouse.release(event) self.text.marker.move(index) self.add_to_send_queue( MSG_SET_MARK(self.text.marker.id, index) ) ...
[ "def", "mouse_left_release", "(", "self", ",", "event", "=", "None", ")", ":", "index", "=", "self", ".", "left_mouse", ".", "release", "(", "event", ")", "self", ".", "text", ".", "marker", ".", "move", "(", "index", ")", "self", ".", "add_to_send_que...
https://github.com/Qirky/Troop/blob/529c5eb14e456f683e6d23fd4adcddc8446aa115/src/interface/interface.py#L1295-L1310
cornellius-gp/gpytorch
61f643eb8b487aef332c818f661fbcdb1df576ca
gpytorch/lazy/lazy_tensor.py
python
LazyTensor.logdet
(self)
return res
Computes an (approximate) log determinant of the matrix NOTE: Don't overwrite this function! Instead, overwrite inv_quad_logdet Returns: - scalar: log determinant
Computes an (approximate) log determinant of the matrix
[ "Computes", "an", "(", "approximate", ")", "log", "determinant", "of", "the", "matrix" ]
def logdet(self): """ Computes an (approximate) log determinant of the matrix NOTE: Don't overwrite this function! Instead, overwrite inv_quad_logdet Returns: - scalar: log determinant """ _, res = self.inv_quad_logdet(inv_quad_rhs=None, logdet=True)...
[ "def", "logdet", "(", "self", ")", ":", "_", ",", "res", "=", "self", ".", "inv_quad_logdet", "(", "inv_quad_rhs", "=", "None", ",", "logdet", "=", "True", ")", "return", "res" ]
https://github.com/cornellius-gp/gpytorch/blob/61f643eb8b487aef332c818f661fbcdb1df576ca/gpytorch/lazy/lazy_tensor.py#L1375-L1386
kevoreilly/CAPEv2
6cf79c33264624b3604d4cd432cde2a6b4536de6
analyzer/windows/modules/auxiliary/disguise.py
python
Disguise.disable_scs
(self)
Put here all sc related configuration
Put here all sc related configuration
[ "Put", "here", "all", "sc", "related", "configuration" ]
def disable_scs(self): """Put here all sc related configuration""" commands = [["sc", "stop", "ClickToRunSvc"], ["sc", "config", "ClickToRunSvc", "start=", "disabled"]] for command in commands: try: output = subprocess.check_output(command, stderr=subprocess.STDOUT) ...
[ "def", "disable_scs", "(", "self", ")", ":", "commands", "=", "[", "[", "\"sc\"", ",", "\"stop\"", ",", "\"ClickToRunSvc\"", "]", ",", "[", "\"sc\"", ",", "\"config\"", ",", "\"ClickToRunSvc\"", ",", "\"start=\"", ",", "\"disabled\"", "]", "]", "for", "com...
https://github.com/kevoreilly/CAPEv2/blob/6cf79c33264624b3604d4cd432cde2a6b4536de6/analyzer/windows/modules/auxiliary/disguise.py#L45-L53
axcore/tartube
36dd493642923fe8b9190a41db596c30c043ae90
tartube/config.py
python
SystemPrefWin.on_invidious_mirror_changed
(self, entry)
Called from callback in self.on_invidious_mirror_changed(). Sets the Invidious mirror to use. Args: entry (Gtk.Entry): The widget changed
Called from callback in self.on_invidious_mirror_changed().
[ "Called", "from", "callback", "in", "self", ".", "on_invidious_mirror_changed", "()", "." ]
def on_invidious_mirror_changed(self, entry): """Called from callback in self.on_invidious_mirror_changed(). Sets the Invidious mirror to use. Args: entry (Gtk.Entry): The widget changed """ self.app_obj.set_custom_invidious_mirror(entry.get_text())
[ "def", "on_invidious_mirror_changed", "(", "self", ",", "entry", ")", ":", "self", ".", "app_obj", ".", "set_custom_invidious_mirror", "(", "entry", ".", "get_text", "(", ")", ")" ]
https://github.com/axcore/tartube/blob/36dd493642923fe8b9190a41db596c30c043ae90/tartube/config.py#L25885-L25897
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/finite_state_machine.py
python
Automaton.minimization
(self, algorithm=None)
Return the minimization of the input automaton as a new automaton. INPUT: - ``algorithm`` -- Either Moore's algorithm (by ``algorithm='Moore'`` or as default for deterministic automata) or Brzozowski's algorithm (when ``algorithm='Brzozowski'`` or when the automaton is no...
Return the minimization of the input automaton as a new automaton.
[ "Return", "the", "minimization", "of", "the", "input", "automaton", "as", "a", "new", "automaton", "." ]
def minimization(self, algorithm=None): """ Return the minimization of the input automaton as a new automaton. INPUT: - ``algorithm`` -- Either Moore's algorithm (by ``algorithm='Moore'`` or as default for deterministic automata) or Brzozowski's algorithm (when ...
[ "def", "minimization", "(", "self", ",", "algorithm", "=", "None", ")", ":", "deterministic", "=", "self", ".", "is_deterministic", "(", ")", "if", "algorithm", "==", "\"Moore\"", "or", "(", "algorithm", "is", "None", "and", "deterministic", ")", ":", "ret...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/finite_state_machine.py#L11381-L11454
glutanimate/review-heatmap
c758478125b60a81c66c87c35b12b7968ec0a348
src/review_heatmap/libaddon/_vendor/logging/__init__.py
python
LoggerAdapter.__init__
(self, logger, extra)
Initialize the adapter with a logger and a dict-like object which provides contextual information. This constructor signature allows easy stacking of LoggerAdapters, if so desired. You can effectively pass keyword arguments as shown in the following example: adapter = LoggerAda...
Initialize the adapter with a logger and a dict-like object which provides contextual information. This constructor signature allows easy stacking of LoggerAdapters, if so desired.
[ "Initialize", "the", "adapter", "with", "a", "logger", "and", "a", "dict", "-", "like", "object", "which", "provides", "contextual", "information", ".", "This", "constructor", "signature", "allows", "easy", "stacking", "of", "LoggerAdapters", "if", "so", "desire...
def __init__(self, logger, extra): """ Initialize the adapter with a logger and a dict-like object which provides contextual information. This constructor signature allows easy stacking of LoggerAdapters, if so desired. You can effectively pass keyword arguments as shown in the ...
[ "def", "__init__", "(", "self", ",", "logger", ",", "extra", ")", ":", "self", ".", "logger", "=", "logger", "self", ".", "extra", "=", "extra" ]
https://github.com/glutanimate/review-heatmap/blob/c758478125b60a81c66c87c35b12b7968ec0a348/src/review_heatmap/libaddon/_vendor/logging/__init__.py#L1596-L1608
matthew-brett/transforms3d
f185e866ecccb66c545559bc9f2e19cb5025e0ab
original/transformations.py
python
euler_from_quaternion
(quaternion, axes='sxyz')
return euler_from_matrix(quaternion_matrix(quaternion), axes)
Return Euler angles from quaternion for specified axis sequence. >>> angles = euler_from_quaternion([0.99810947, 0.06146124, 0, 0]) >>> numpy.allclose(angles, [0.123, 0, 0]) True
Return Euler angles from quaternion for specified axis sequence.
[ "Return", "Euler", "angles", "from", "quaternion", "for", "specified", "axis", "sequence", "." ]
def euler_from_quaternion(quaternion, axes='sxyz'): """Return Euler angles from quaternion for specified axis sequence. >>> angles = euler_from_quaternion([0.99810947, 0.06146124, 0, 0]) >>> numpy.allclose(angles, [0.123, 0, 0]) True """ return euler_from_matrix(quaternion_matrix(quaternion), ...
[ "def", "euler_from_quaternion", "(", "quaternion", ",", "axes", "=", "'sxyz'", ")", ":", "return", "euler_from_matrix", "(", "quaternion_matrix", "(", "quaternion", ")", ",", "axes", ")" ]
https://github.com/matthew-brett/transforms3d/blob/f185e866ecccb66c545559bc9f2e19cb5025e0ab/original/transformations.py#L1170-L1178
exodrifter/unity-python
bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d
Lib/_pyio.py
python
open
(file, mode="r", buffering=-1, encoding=None, errors=None, newline=None, closefd=True)
r"""Open file and return a stream. Raise IOError upon failure. file is either a text or byte string giving the name (and the path if the file isn't in the current working directory) of the file to be opened or an integer file descriptor of the file to be wrapped. (If a file descriptor is given, it is ...
r"""Open file and return a stream. Raise IOError upon failure.
[ "r", "Open", "file", "and", "return", "a", "stream", ".", "Raise", "IOError", "upon", "failure", "." ]
def open(file, mode="r", buffering=-1, encoding=None, errors=None, newline=None, closefd=True): r"""Open file and return a stream. Raise IOError upon failure. file is either a text or byte string giving the name (and the path if the file isn't in the current working directory) of the fi...
[ "def", "open", "(", "file", ",", "mode", "=", "\"r\"", ",", "buffering", "=", "-", "1", ",", "encoding", "=", "None", ",", "errors", "=", "None", ",", "newline", "=", "None", ",", "closefd", "=", "True", ")", ":", "if", "not", "isinstance", "(", ...
https://github.com/exodrifter/unity-python/blob/bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d/Lib/_pyio.py#L44-L234
aws/aws-parallelcluster
f1fe5679a01c524e7ea904c329bd6d17318c6cd9
cli/src/pcluster/api/controllers/cluster_instances_controller.py
python
delete_cluster_instances
(cluster_name, region=None, force=None)
Initiate the forced termination of all cluster compute nodes. Does not work with AWS Batch clusters. :param cluster_name: Name of the cluster :type cluster_name: str :param region: AWS Region that the operation corresponds to. :type region: str :param force: Force the deletion also when the cluster...
Initiate the forced termination of all cluster compute nodes. Does not work with AWS Batch clusters.
[ "Initiate", "the", "forced", "termination", "of", "all", "cluster", "compute", "nodes", ".", "Does", "not", "work", "with", "AWS", "Batch", "clusters", "." ]
def delete_cluster_instances(cluster_name, region=None, force=None): """ Initiate the forced termination of all cluster compute nodes. Does not work with AWS Batch clusters. :param cluster_name: Name of the cluster :type cluster_name: str :param region: AWS Region that the operation corresponds to....
[ "def", "delete_cluster_instances", "(", "cluster_name", ",", "region", "=", "None", ",", "force", "=", "None", ")", ":", "cluster", "=", "Cluster", "(", "cluster_name", ")", "try", ":", "if", "not", "check_cluster_version", "(", "cluster", ")", ":", "raise",...
https://github.com/aws/aws-parallelcluster/blob/f1fe5679a01c524e7ea904c329bd6d17318c6cd9/cli/src/pcluster/api/controllers/cluster_instances_controller.py#L29-L56
ambujraj/hacktoberfest2018
53df2cac8b3404261131a873352ec4f2ffa3544d
MAC_changer/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/distlib/metadata.py
python
LegacyMetadata.get
(self, name, default=_MISSING)
return self._fields[name]
Get a metadata field.
Get a metadata field.
[ "Get", "a", "metadata", "field", "." ]
def get(self, name, default=_MISSING): """Get a metadata field.""" name = self._convert_name(name) if name not in self._fields: if default is _MISSING: default = self._default_value(name) return default if name in _UNICODEFIELDS: value ...
[ "def", "get", "(", "self", ",", "name", ",", "default", "=", "_MISSING", ")", ":", "name", "=", "self", ".", "_convert_name", "(", "name", ")", "if", "name", "not", "in", "self", ".", "_fields", ":", "if", "default", "is", "_MISSING", ":", "default",...
https://github.com/ambujraj/hacktoberfest2018/blob/53df2cac8b3404261131a873352ec4f2ffa3544d/MAC_changer/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/distlib/metadata.py#L488-L515
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/vendor/distlib/_backport/shutil.py
python
unpack_archive
(filename, extract_dir=None, format=None)
Unpack an archive. `filename` is the name of the archive. `extract_dir` is the name of the target directory, where the archive is unpacked. If not provided, the current working directory is used. `format` is the archive format: one of "zip", "tar", or "gztar". Or any other registered format. If n...
Unpack an archive.
[ "Unpack", "an", "archive", "." ]
def unpack_archive(filename, extract_dir=None, format=None): """Unpack an archive. `filename` is the name of the archive. `extract_dir` is the name of the target directory, where the archive is unpacked. If not provided, the current working directory is used. `format` is the archive format: one o...
[ "def", "unpack_archive", "(", "filename", ",", "extract_dir", "=", "None", ",", "format", "=", "None", ")", ":", "if", "extract_dir", "is", "None", ":", "extract_dir", "=", "os", ".", "getcwd", "(", ")", "if", "format", "is", "not", "None", ":", "try",...
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/distlib/_backport/shutil.py#L730-L764
kadalu/kadalu
5d91d92830553b47d3729adc3c7f69ce6fd45e2d
operator/main.py
python
deploy_server_pods
(obj)
Deploy server pods depending on type of Hosting Volume and other options specified
Deploy server pods depending on type of Hosting Volume and other options specified
[ "Deploy", "server", "pods", "depending", "on", "type", "of", "Hosting", "Volume", "and", "other", "options", "specified" ]
def deploy_server_pods(obj): """ Deploy server pods depending on type of Hosting Volume and other options specified """ # Deploy server pod volname = obj["metadata"]["name"] voltype = obj["spec"]["type"] pv_reclaim_policy = obj["spec"].get("pvReclaimPolicy", "delete") tolerations = o...
[ "def", "deploy_server_pods", "(", "obj", ")", ":", "# Deploy server pod", "volname", "=", "obj", "[", "\"metadata\"", "]", "[", "\"name\"", "]", "voltype", "=", "obj", "[", "\"spec\"", "]", "[", "\"type\"", "]", "pv_reclaim_policy", "=", "obj", "[", "\"spec\...
https://github.com/kadalu/kadalu/blob/5d91d92830553b47d3729adc3c7f69ce6fd45e2d/operator/main.py#L404-L460
francisck/DanderSpritz_docs
86bb7caca5a957147f120b18bb5c31f299914904
Python/Core/Lib/random.py
python
Random.sample
(self, population, k)
return result
Chooses k unique random elements from a population sequence. Returns a new list containing elements from the population while leaving the original population unchanged. The resulting list is in selection order so that all sub-slices will also be valid random samples. This allo...
Chooses k unique random elements from a population sequence. Returns a new list containing elements from the population while leaving the original population unchanged. The resulting list is in selection order so that all sub-slices will also be valid random samples. This allo...
[ "Chooses", "k", "unique", "random", "elements", "from", "a", "population", "sequence", ".", "Returns", "a", "new", "list", "containing", "elements", "from", "the", "population", "while", "leaving", "the", "original", "population", "unchanged", ".", "The", "resul...
def sample(self, population, k): """Chooses k unique random elements from a population sequence. Returns a new list containing elements from the population while leaving the original population unchanged. The resulting list is in selection order so that all sub-slices will also...
[ "def", "sample", "(", "self", ",", "population", ",", "k", ")", ":", "n", "=", "len", "(", "population", ")", "if", "not", "0", "<=", "k", "<=", "n", ":", "raise", "ValueError", "(", "'sample larger than population'", ")", "random", "=", "self", ".", ...
https://github.com/francisck/DanderSpritz_docs/blob/86bb7caca5a957147f120b18bb5c31f299914904/Python/Core/Lib/random.py#L244-L294
dpp/simply_lift
cf49f7dcce81c7f1557314dd0f0bb08aaedc73da
elyxer.py
python
BinomialCell.constant
(self, constant)
Set a constant as only contents.
Set a constant as only contents.
[ "Set", "a", "constant", "as", "only", "contents", "." ]
def constant(self, constant): "Set a constant as only contents." self.contents = [FormulaConstant(constant)]
[ "def", "constant", "(", "self", ",", "constant", ")", ":", "self", ".", "contents", "=", "[", "FormulaConstant", "(", "constant", ")", "]" ]
https://github.com/dpp/simply_lift/blob/cf49f7dcce81c7f1557314dd0f0bb08aaedc73da/elyxer.py#L8563-L8565
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/api/resources/auth.py
python
ODataAuthentication._get_auth_decorator
(self, request)
return self.decorator_map[determine_authtype_from_header(request, default=BASIC)]
[]
def _get_auth_decorator(self, request): return self.decorator_map[determine_authtype_from_header(request, default=BASIC)]
[ "def", "_get_auth_decorator", "(", "self", ",", "request", ")", ":", "return", "self", ".", "decorator_map", "[", "determine_authtype_from_header", "(", "request", ",", "default", "=", "BASIC", ")", "]" ]
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/api/resources/auth.py#L170-L171
nltk/nltk_contrib
c9da2c29777ca9df650740145f1f4a375ccac961
nltk_contrib/mit/six863/parse/cfg.py
python
Production.__eq__
(self, other)
return (isinstance(other, self.__class__) and self._lhs == other._lhs and self._rhs == other._rhs)
@return: true if this C{Production} is equal to C{other}. @rtype: C{boolean}
[]
def __eq__(self, other): """ @return: true if this C{Production} is equal to C{other}. @rtype: C{boolean} """ return (isinstance(other, self.__class__) and self._lhs == other._lhs and self._rhs == other._rhs)
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "return", "(", "isinstance", "(", "other", ",", "self", ".", "__class__", ")", "and", "self", ".", "_lhs", "==", "other", ".", "_lhs", "and", "self", ".", "_rhs", "==", "other", ".", "_rhs", ")"...
https://github.com/nltk/nltk_contrib/blob/c9da2c29777ca9df650740145f1f4a375ccac961/nltk_contrib/mit/six863/parse/cfg.py#L271-L278
hellohaptik/chatbot_ner
742104790170ae5b73c583c94db6786549337dc4
ner_v1/api.py
python
shopping_size
(request)
return HttpResponse(json.dumps({'data': entity_output}), content_type='application/json')
This functionality calls the get_shopping_size() functionality to detect size. It is called through api call Attributes: request: url parameters
This functionality calls the get_shopping_size() functionality to detect size. It is called through api call
[ "This", "functionality", "calls", "the", "get_shopping_size", "()", "functionality", "to", "detect", "size", ".", "It", "is", "called", "through", "api", "call" ]
def shopping_size(request): """This functionality calls the get_shopping_size() functionality to detect size. It is called through api call Attributes: request: url parameters """ try: parameters_dict = parse_parameters_from_request(request) entity_output = get_shopping_size(pa...
[ "def", "shopping_size", "(", "request", ")", ":", "try", ":", "parameters_dict", "=", "parse_parameters_from_request", "(", "request", ")", "entity_output", "=", "get_shopping_size", "(", "parameters_dict", "[", "PARAMETER_MESSAGE", "]", ",", "parameters_dict", "[", ...
https://github.com/hellohaptik/chatbot_ner/blob/742104790170ae5b73c583c94db6786549337dc4/ner_v1/api.py#L465-L483
anchore/anchore-engine
bb18b70e0cbcad58beb44cd439d00067d8f7ea8b
anchore_engine/services/catalog/service.py
python
handle_import_gc
(*args, **kwargs)
Cleanup import operations that are expired or complete and reclaim resources :param args: :param kwargs: :return:
Cleanup import operations that are expired or complete and reclaim resources
[ "Cleanup", "import", "operations", "that", "are", "expired", "or", "complete", "and", "reclaim", "resources" ]
def handle_import_gc(*args, **kwargs): """ Cleanup import operations that are expired or complete and reclaim resources :param args: :param kwargs: :return: """ watcher = str(kwargs["mythread"]["taskType"]) handler_success = True timer = time.time() logger.debug("FIRING: " + s...
[ "def", "handle_import_gc", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "watcher", "=", "str", "(", "kwargs", "[", "\"mythread\"", "]", "[", "\"taskType\"", "]", ")", "handler_success", "=", "True", "timer", "=", "time", ".", "time", "(", ")", ...
https://github.com/anchore/anchore-engine/blob/bb18b70e0cbcad58beb44cd439d00067d8f7ea8b/anchore_engine/services/catalog/service.py#L2637-L2666
EventGhost/EventGhost
177be516849e74970d2e13cda82244be09f277ce
lib27/site-packages/tornado/web.py
python
RequestHandler.write_error
(self, status_code, **kwargs)
Override to implement custom error pages. ``write_error`` may call `write`, `render`, `set_header`, etc to produce output as usual. If this error was caused by an uncaught exception (including HTTPError), an ``exc_info`` triple will be available as ``kwargs["exc_info"]``. Note...
Override to implement custom error pages.
[ "Override", "to", "implement", "custom", "error", "pages", "." ]
def write_error(self, status_code, **kwargs): """Override to implement custom error pages. ``write_error`` may call `write`, `render`, `set_header`, etc to produce output as usual. If this error was caused by an uncaught exception (including HTTPError), an ``exc_info`` triple w...
[ "def", "write_error", "(", "self", ",", "status_code", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "settings", ".", "get", "(", "\"serve_traceback\"", ")", "and", "\"exc_info\"", "in", "kwargs", ":", "# in debug mode, try to send a traceback", "self", ...
https://github.com/EventGhost/EventGhost/blob/177be516849e74970d2e13cda82244be09f277ce/lib27/site-packages/tornado/web.py#L980-L1003
thu-coai/ConvLab-2
ad32b76022fa29cbc2f24cbefbb855b60492985e
convlab2/policy/hdsa/multiwoz/transformer/LSTM.py
python
LSTMDecoder.forward
(self, tgt_seq, enc_output, act_vecs)
return proba
Given the user sentence, user belief state and database pointer, encode the sentence, decide what policy vector construct and feed it as the first hiddent state to the decoder.
Given the user sentence, user belief state and database pointer, encode the sentence, decide what policy vector construct and feed it as the first hiddent state to the decoder.
[ "Given", "the", "user", "sentence", "user", "belief", "state", "and", "database", "pointer", "encode", "the", "sentence", "decide", "what", "policy", "vector", "construct", "and", "feed", "it", "as", "the", "first", "hiddent", "state", "to", "the", "decoder", ...
def forward(self, tgt_seq, enc_output, act_vecs): """Given the user sentence, user belief state and database pointer, encode the sentence, decide what policy vector construct and feed it as the first hiddent state to the decoder.""" target_length = tgt_seq.size(1) batch_size = tg...
[ "def", "forward", "(", "self", ",", "tgt_seq", ",", "enc_output", ",", "act_vecs", ")", ":", "target_length", "=", "tgt_seq", ".", "size", "(", "1", ")", "batch_size", "=", "tgt_seq", ".", "size", "(", "0", ")", "decoder_hidden", "=", "enc_output", "[", ...
https://github.com/thu-coai/ConvLab-2/blob/ad32b76022fa29cbc2f24cbefbb855b60492985e/convlab2/policy/hdsa/multiwoz/transformer/LSTM.py#L207-L230
nuxeo/FunkLoad
8a3a44c20398098d03197baeef27a4177858df1b
src/funkload/PatchWebunit.py
python
decodeCookies
(url, server, headers, cookies)
Decode cookies into the supplied cookies dictionary, according to RFC 6265. Relevant specs: http://www.ietf.org/rfc/rfc2109.txt (obsolete) http://www.ietf.org/rfc/rfc2965.txt (obsolete) http://www.ietf.org/rfc/rfc6265.txt (proposed standard)
Decode cookies into the supplied cookies dictionary, according to RFC 6265.
[ "Decode", "cookies", "into", "the", "supplied", "cookies", "dictionary", "according", "to", "RFC", "6265", "." ]
def decodeCookies(url, server, headers, cookies): """Decode cookies into the supplied cookies dictionary, according to RFC 6265. Relevant specs: http://www.ietf.org/rfc/rfc2109.txt (obsolete) http://www.ietf.org/rfc/rfc2965.txt (obsolete) http://www.ietf.org/rfc/rfc6265.txt (proposed standard) ...
[ "def", "decodeCookies", "(", "url", ",", "server", ",", "headers", ",", "cookies", ")", ":", "# see rfc 6265, section 5.1.4", "# empty path => '/'", "# path must begin with '/', so we only weed out the rightmost '/'", "request_path", "=", "urlparse", ".", "urlparse", "(", "...
https://github.com/nuxeo/FunkLoad/blob/8a3a44c20398098d03197baeef27a4177858df1b/src/funkload/PatchWebunit.py#L175-L237
openstack/keystone
771c943ad2116193e7bb118c74993c829d93bd71
keystone/assignment/backends/sql.py
python
Assignment._get_assignment_types
(self, user, group, project, domain)
return actor_types or target_types
Return a list of role assignment types based on provided entities. If one of user or group (the "actor") as well as one of project or domain (the "target") are provided, the list will contain the role assignment type for that specific pair of actor and target. If only an actor or targe...
Return a list of role assignment types based on provided entities.
[ "Return", "a", "list", "of", "role", "assignment", "types", "based", "on", "provided", "entities", "." ]
def _get_assignment_types(self, user, group, project, domain): """Return a list of role assignment types based on provided entities. If one of user or group (the "actor") as well as one of project or domain (the "target") are provided, the list will contain the role assignment type for ...
[ "def", "_get_assignment_types", "(", "self", ",", "user", ",", "group", ",", "project", ",", "domain", ")", ":", "actor_types", "=", "[", "]", "if", "user", ":", "actor_types", "=", "self", ".", "_get_user_assignment_types", "(", ")", "elif", "group", ":",...
https://github.com/openstack/keystone/blob/771c943ad2116193e7bb118c74993c829d93bd71/keystone/assignment/backends/sql.py#L158-L196
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/http/cookiejar.py
python
_warn_unhandled_exception
()
[]
def _warn_unhandled_exception(): # There are a few catch-all except: statements in this module, for # catching input that's bad in unexpected ways. Warn if any # exceptions are caught there. import io, warnings, traceback f = io.StringIO() traceback.print_exc(None, f) msg = f.getvalue() ...
[ "def", "_warn_unhandled_exception", "(", ")", ":", "# There are a few catch-all except: statements in this module, for", "# catching input that's bad in unexpected ways. Warn if any", "# exceptions are caught there.", "import", "io", ",", "warnings", ",", "traceback", "f", "=", "io"...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/http/cookiejar.py#L60-L68
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/django-celery/djcelery/utils.py
python
naturaldate
(date)
return OLDER_AGO % {"number": count, "type": type_}
Convert datetime into a human natural date string.
Convert datetime into a human natural date string.
[ "Convert", "datetime", "into", "a", "human", "natural", "date", "string", "." ]
def naturaldate(date): """Convert datetime into a human natural date string.""" if not date: return '' now = datetime.now() today = datetime(now.year, now.month, now.day) delta = now - date delta_midnight = today - date days = delta.days hours = round(delta.seconds / 3600, 0) ...
[ "def", "naturaldate", "(", "date", ")", ":", "if", "not", "date", ":", "return", "''", "now", "=", "datetime", ".", "now", "(", ")", "today", "=", "datetime", "(", "now", ".", "year", ",", "now", ".", "month", ",", "now", ".", "day", ")", "delta"...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/django-celery/djcelery/utils.py#L30-L67
Tencent/Metis
bf50841faf36cf29378c7b774e6abe4327596bbd
time_series_detector/algorithm/statistic.py
python
Statistic.__init__
(self, index=3)
:param index: multiple of standard deviation :param type: int or float
:param index: multiple of standard deviation :param type: int or float
[ ":", "param", "index", ":", "multiple", "of", "standard", "deviation", ":", "param", "type", ":", "int", "or", "float" ]
def __init__(self, index=3): """ :param index: multiple of standard deviation :param type: int or float """ self.index = index
[ "def", "__init__", "(", "self", ",", "index", "=", "3", ")", ":", "self", ".", "index", "=", "index" ]
https://github.com/Tencent/Metis/blob/bf50841faf36cf29378c7b774e6abe4327596bbd/time_series_detector/algorithm/statistic.py#L24-L29
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
lib/cloudinary/api.py
python
transformations
(**options)
return call_api("get", uri, params, **options)
[]
def transformations(**options): uri = ["transformations"] params = only(options, "named", "next_cursor", "max_results") return call_api("get", uri, params, **options)
[ "def", "transformations", "(", "*", "*", "options", ")", ":", "uri", "=", "[", "\"transformations\"", "]", "params", "=", "only", "(", "options", ",", "\"named\"", ",", "\"next_cursor\"", ",", "\"max_results\"", ")", "return", "call_api", "(", "\"get\"", ","...
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/cloudinary/api.py#L277-L281
vprusso/youtube_tutorials
a3f2fadfc408aafbf4505bcd5f2f4a41d670b44d
data_structures/linked_list/singularly_linked_list/linked_list_tail_to_head.py
python
LinkedList.rotate
(self, k)
[]
def rotate(self, k): p = self.head q = self.head prev = None count = 0 while p and count < k: prev = p p = p.next q = q.next count += 1 p = prev while q: prev = q q = q....
[ "def", "rotate", "(", "self", ",", "k", ")", ":", "p", "=", "self", ".", "head", "q", "=", "self", ".", "head", "prev", "=", "None", "count", "=", "0", "while", "p", "and", "count", "<", "k", ":", "prev", "=", "p", "p", "=", "p", ".", "next...
https://github.com/vprusso/youtube_tutorials/blob/a3f2fadfc408aafbf4505bcd5f2f4a41d670b44d/data_structures/linked_list/singularly_linked_list/linked_list_tail_to_head.py#L258-L278
vertexproject/synapse
8173f43cb5fba5ca2648d12a659afb432139b0a7
synapse/lib/coro.py
python
waittask
(task, timeout=None)
Await a task without cancelling it when you time out. Returns: boolean: True if the task completed before the timeout.
Await a task without cancelling it when you time out.
[ "Await", "a", "task", "without", "cancelling", "it", "when", "you", "time", "out", "." ]
async def waittask(task, timeout=None): ''' Await a task without cancelling it when you time out. Returns: boolean: True if the task completed before the timeout. ''' futu = asyncio.get_running_loop().create_future() task.add_done_callback(futu.set_result) try: await asyncio...
[ "async", "def", "waittask", "(", "task", ",", "timeout", "=", "None", ")", ":", "futu", "=", "asyncio", ".", "get_running_loop", "(", ")", ".", "create_future", "(", ")", "task", ".", "add_done_callback", "(", "futu", ".", "set_result", ")", "try", ":", ...
https://github.com/vertexproject/synapse/blob/8173f43cb5fba5ca2648d12a659afb432139b0a7/synapse/lib/coro.py#L101-L116
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/enphase_envoy/sensor.py
python
Envoy.unique_id
(self)
Return the unique id of the sensor.
Return the unique id of the sensor.
[ "Return", "the", "unique", "id", "of", "the", "sensor", "." ]
def unique_id(self): """Return the unique id of the sensor.""" if self._serial_number: return self._serial_number if self._device_serial_number: return f"{self._device_serial_number}_{self.entity_description.key}"
[ "def", "unique_id", "(", "self", ")", ":", "if", "self", ".", "_serial_number", ":", "return", "self", ".", "_serial_number", "if", "self", ".", "_device_serial_number", ":", "return", "f\"{self._device_serial_number}_{self.entity_description.key}\"" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/enphase_envoy/sensor.py#L93-L98
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/_vendor/distlib/_backport/shutil.py
python
_unpack_zipfile
(filename, extract_dir)
Unpack zip `filename` to `extract_dir`
Unpack zip `filename` to `extract_dir`
[ "Unpack", "zip", "filename", "to", "extract_dir" ]
def _unpack_zipfile(filename, extract_dir): """Unpack zip `filename` to `extract_dir` """ try: import zipfile except ImportError: raise ReadError('zlib not supported, cannot unpack this archive.') if not zipfile.is_zipfile(filename): raise ReadError("%s is not a zip file" % ...
[ "def", "_unpack_zipfile", "(", "filename", ",", "extract_dir", ")", ":", "try", ":", "import", "zipfile", "except", "ImportError", ":", "raise", "ReadError", "(", "'zlib not supported, cannot unpack this archive.'", ")", "if", "not", "zipfile", ".", "is_zipfile", "(...
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/_vendor/distlib/_backport/shutil.py#L660-L695
mars-project/mars
6afd7ed86db77f29cc9470485698ef192ecc6d33
mars/learn/decomposition/_pca.py
python
PCA._fit_full
(self, X, n_components, session=None, run_kwargs=None)
return U, S, V
Fit the model by computing full SVD on X
Fit the model by computing full SVD on X
[ "Fit", "the", "model", "by", "computing", "full", "SVD", "on", "X" ]
def _fit_full(self, X, n_components, session=None, run_kwargs=None): """Fit the model by computing full SVD on X""" n_samples, n_features = X.shape if n_components == "mle": if n_samples < n_features: raise ValueError( "n_components='mle' is only ...
[ "def", "_fit_full", "(", "self", ",", "X", ",", "n_components", ",", "session", "=", "None", ",", "run_kwargs", "=", "None", ")", ":", "n_samples", ",", "n_features", "=", "X", ".", "shape", "if", "n_components", "==", "\"mle\"", ":", "if", "n_samples", ...
https://github.com/mars-project/mars/blob/6afd7ed86db77f29cc9470485698ef192ecc6d33/mars/learn/decomposition/_pca.py#L442-L513
s-leger/archipack
5a6243bf1edf08a6b429661ce291dacb551e5f8a
pygeos/prepared.py
python
PreparedPolygonContainsProperly.__init__
(self, prep)
* Creates an instance of this operation. * * @param prep the PreparedPolygon to evaluate
* Creates an instance of this operation. * *
[ "*", "Creates", "an", "instance", "of", "this", "operation", ".", "*", "*" ]
def __init__(self, prep): """ * Creates an instance of this operation. * * @param prep the PreparedPolygon to evaluate """ AbstractPreparedPolygonContains.__init__(self, prep)
[ "def", "__init__", "(", "self", ",", "prep", ")", ":", "AbstractPreparedPolygonContains", ".", "__init__", "(", "self", ",", "prep", ")" ]
https://github.com/s-leger/archipack/blob/5a6243bf1edf08a6b429661ce291dacb551e5f8a/pygeos/prepared.py#L1140-L1146
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/babel/messages/plurals.py
python
get_plural
(locale=LC_CTYPE)
return _PluralTuple(tup)
A tuple with the information catalogs need to perform proper pluralization. The first item of the tuple is the number of plural forms, the second the plural expression. >>> get_plural(locale='en') (2, '(n != 1)') >>> get_plural(locale='ga') (5, '(n==1 ? 0 : n==2 ? 1 : n>=3 && n<=6 ? 2 : n>=7 &...
A tuple with the information catalogs need to perform proper pluralization. The first item of the tuple is the number of plural forms, the second the plural expression.
[ "A", "tuple", "with", "the", "information", "catalogs", "need", "to", "perform", "proper", "pluralization", ".", "The", "first", "item", "of", "the", "tuple", "is", "the", "number", "of", "plural", "forms", "the", "second", "the", "plural", "expression", "."...
def get_plural(locale=LC_CTYPE): """A tuple with the information catalogs need to perform proper pluralization. The first item of the tuple is the number of plural forms, the second the plural expression. >>> get_plural(locale='en') (2, '(n != 1)') >>> get_plural(locale='ga') (5, '(n==1 ? ...
[ "def", "get_plural", "(", "locale", "=", "LC_CTYPE", ")", ":", "locale", "=", "Locale", ".", "parse", "(", "locale", ")", "try", ":", "tup", "=", "PLURALS", "[", "str", "(", "locale", ")", "]", "except", "KeyError", ":", "try", ":", "tup", "=", "PL...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/babel/messages/plurals.py#L223-L257
qxf2/qxf2-page-object-model
8b2978e5bd2a5413d581f9e29a2098e5f5e742fd
page_objects/footer_object.py
python
Footer_Object.get_copyright
(self)
return copyright_slug
Get the current copyright
Get the current copyright
[ "Get", "the", "current", "copyright" ]
def get_copyright(self): "Get the current copyright" copyright_slug = str(self.get_text(self.copyright_text)) copyright_slug = copyright_slug.strip() #NOTE: We strip out the special '&copy; copyright_slug = 'Qxf2' + copyright_slug[:-1].split('Qxf2')[-1] return copyright_...
[ "def", "get_copyright", "(", "self", ")", ":", "copyright_slug", "=", "str", "(", "self", ".", "get_text", "(", "self", ".", "copyright_text", ")", ")", "copyright_slug", "=", "copyright_slug", ".", "strip", "(", ")", "#NOTE: We strip out the special '&copy;", "...
https://github.com/qxf2/qxf2-page-object-model/blob/8b2978e5bd2a5413d581f9e29a2098e5f5e742fd/page_objects/footer_object.py#L38-L45
pyjs/pyjs
6c4a3d3a67300cd5df7f95a67ca9dcdc06950523
pyjs/lib/codecs.py
python
StreamWriter.write
(self, object)
Writes the object's contents encoded to self.stream.
Writes the object's contents encoded to self.stream.
[ "Writes", "the", "object", "s", "contents", "encoded", "to", "self", ".", "stream", "." ]
def write(self, object): """ Writes the object's contents encoded to self.stream. """ data, consumed = self.encode(object, self.errors) self.stream.write(data)
[ "def", "write", "(", "self", ",", "object", ")", ":", "data", ",", "consumed", "=", "self", ".", "encode", "(", "object", ",", "self", ".", "errors", ")", "self", ".", "stream", ".", "write", "(", "data", ")" ]
https://github.com/pyjs/pyjs/blob/6c4a3d3a67300cd5df7f95a67ca9dcdc06950523/pyjs/lib/codecs.py#L342-L347
OpenEndedGroup/Field
4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c
Contents/lib/python/decimal.py
python
Context.compare_signal
(self, a, b)
return a.compare_signal(b, context=self)
Compares the values of the two operands numerically. It's pretty much like compare(), but all NaNs signal, with signaling NaNs taking precedence over quiet NaNs. >>> c = ExtendedContext >>> c.compare_signal(Decimal('2.1'), Decimal('3')) Decimal("-1") >>> c.compare_signa...
Compares the values of the two operands numerically.
[ "Compares", "the", "values", "of", "the", "two", "operands", "numerically", "." ]
def compare_signal(self, a, b): """Compares the values of the two operands numerically. It's pretty much like compare(), but all NaNs signal, with signaling NaNs taking precedence over quiet NaNs. >>> c = ExtendedContext >>> c.compare_signal(Decimal('2.1'), Decimal('3')) ...
[ "def", "compare_signal", "(", "self", ",", "a", ",", "b", ")", ":", "return", "a", ".", "compare_signal", "(", "b", ",", "context", "=", "self", ")" ]
https://github.com/OpenEndedGroup/Field/blob/4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c/Contents/lib/python/decimal.py#L3612-L3638
aestrivex/bctpy
32c7fe7345b281c2d4e184f5379c425c36f3bbc7
bct/algorithms/core.py
python
kcore_bu
(CIJ, k, peel=False)
The k-core is the largest subnetwork comprising nodes of degree at least k. This function computes the k-core for a given binary undirected connection matrix by recursively peeling off nodes with degree lower than k, until no such nodes remain. Parameters ---------- CIJ : NxN np.ndarray ...
The k-core is the largest subnetwork comprising nodes of degree at least k. This function computes the k-core for a given binary undirected connection matrix by recursively peeling off nodes with degree lower than k, until no such nodes remain.
[ "The", "k", "-", "core", "is", "the", "largest", "subnetwork", "comprising", "nodes", "of", "degree", "at", "least", "k", ".", "This", "function", "computes", "the", "k", "-", "core", "for", "a", "given", "binary", "undirected", "connection", "matrix", "by...
def kcore_bu(CIJ, k, peel=False): ''' The k-core is the largest subnetwork comprising nodes of degree at least k. This function computes the k-core for a given binary undirected connection matrix by recursively peeling off nodes with degree lower than k, until no such nodes remain. Parameters ...
[ "def", "kcore_bu", "(", "CIJ", ",", "k", ",", "peel", "=", "False", ")", ":", "if", "peel", ":", "peelorder", ",", "peellevel", "=", "(", "[", "]", ",", "[", "]", ")", "iter", "=", "0", "CIJkcore", "=", "CIJ", ".", "copy", "(", ")", "while", ...
https://github.com/aestrivex/bctpy/blob/32c7fe7345b281c2d4e184f5379c425c36f3bbc7/bct/algorithms/core.py#L309-L374
pycook/cmdb
99b053cd9f9eba7fb76965514931ab4127f2d2c7
cmdb-api/api/commands/click_cmdb.py
python
del_user
(user)
delete a user Example: flask del-user -u <username>
delete a user
[ "delete", "a", "user" ]
def del_user(user): """ delete a user Example: flask del-user -u <username> """ assert user is not None from api.models.acl import User u = User.get_by(username=user, first=True, to_dict=False) u and UserCRUD.delete(u.uid)
[ "def", "del_user", "(", "user", ")", ":", "assert", "user", "is", "not", "None", "from", "api", ".", "models", ".", "acl", "import", "User", "u", "=", "User", ".", "get_by", "(", "username", "=", "user", ",", "first", "=", "True", ",", "to_dict", "...
https://github.com/pycook/cmdb/blob/99b053cd9f9eba7fb76965514931ab4127f2d2c7/cmdb-api/api/commands/click_cmdb.py#L187-L197
avocado-framework/avocado
1f9b3192e8ba47d029c33fe21266bd113d17811f
avocado/utils/software_manager/backends/yum.py
python
YumBackend.upgrade
(self, name=None)
Upgrade all available packages. Optionally, upgrade individual packages. :param name: optional parameter wildcard spec to upgrade :type name: str
Upgrade all available packages.
[ "Upgrade", "all", "available", "packages", "." ]
def upgrade(self, name=None): """ Upgrade all available packages. Optionally, upgrade individual packages. :param name: optional parameter wildcard spec to upgrade :type name: str """ if not name: r_cmd = self.base_command + 'update' else: ...
[ "def", "upgrade", "(", "self", ",", "name", "=", "None", ")", ":", "if", "not", "name", ":", "r_cmd", "=", "self", ".", "base_command", "+", "'update'", "else", ":", "r_cmd", "=", "self", ".", "base_command", "+", "'update'", "+", "' '", "+", "name",...
https://github.com/avocado-framework/avocado/blob/1f9b3192e8ba47d029c33fe21266bd113d17811f/avocado/utils/software_manager/backends/yum.py#L170-L188
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/nova/nova/network/linux_net.py
python
IptablesManager._apply
(self)
Apply the current in-memory set of iptables rules. This will blow away any rules left over from previous runs of the same component of Nova, and replace them with our current set of rules. This happens atomically, thanks to iptables-restore.
Apply the current in-memory set of iptables rules.
[ "Apply", "the", "current", "in", "-", "memory", "set", "of", "iptables", "rules", "." ]
def _apply(self): """Apply the current in-memory set of iptables rules. This will blow away any rules left over from previous runs of the same component of Nova, and replace them with our current set of rules. This happens atomically, thanks to iptables-restore. """ s =...
[ "def", "_apply", "(", "self", ")", ":", "s", "=", "[", "(", "'iptables'", ",", "self", ".", "ipv4", ")", "]", "if", "CONF", ".", "use_ipv6", ":", "s", "+=", "[", "(", "'ip6tables'", ",", "self", ".", "ipv6", ")", "]", "for", "cmd", ",", "tables...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/nova/nova/network/linux_net.py#L396-L420
SpockBotMC/SpockBot
f89911551f18357720034fbaa52837a0d09f66ea
spockbot/mcp/nbt.py
python
TagIntArray._render_buffer
(self, buffer)
[]
def _render_buffer(self, buffer): length = len(self.value) self.update_fmt(length) TagInt(length)._render_buffer(buffer) buffer.write(self.fmt.pack(*self.value))
[ "def", "_render_buffer", "(", "self", ",", "buffer", ")", ":", "length", "=", "len", "(", "self", ".", "value", ")", "self", ".", "update_fmt", "(", "length", ")", "TagInt", "(", "length", ")", ".", "_render_buffer", "(", "buffer", ")", "buffer", ".", ...
https://github.com/SpockBotMC/SpockBot/blob/f89911551f18357720034fbaa52837a0d09f66ea/spockbot/mcp/nbt.py#L244-L248
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/misc/sage_input.py
python
SIE_unary._sie_format
(self, sif)
return '%s%s' % (fop, sif.format(self._sie_operand, prec)), rprec
r""" Return the formatted string value of this expression, and the precedence of the top-level operator in the expression. EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBuilder() sage: sif = Sage...
r""" Return the formatted string value of this expression, and the precedence of the top-level operator in the expression.
[ "r", "Return", "the", "formatted", "string", "value", "of", "this", "expression", "and", "the", "precedence", "of", "the", "top", "-", "level", "operator", "in", "the", "expression", "." ]
def _sie_format(self, sif): r""" Return the formatted string value of this expression, and the precedence of the top-level operator in the expression. EXAMPLES:: sage: from sage.misc.sage_input import SageInputBuilder, SageInputFormatter sage: sib = SageInputBu...
[ "def", "_sie_format", "(", "self", ",", "sif", ")", ":", "op", "=", "self", ".", "_sie_op", "fop", "=", "op", "rprec", "=", "None", "if", "op", "==", "'-'", ":", "# We print -(a*b) as -a*b, even though that will parse as", "# (-a)*b.", "prec", "=", "_prec_muld...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/misc/sage_input.py#L2533-L2613
natashamjaques/neural_chat
ddb977bb4602a67c460d02231e7bbf7b2cb49a97
ParlAI/parlai/agents/legacy_agents/seq2seq/torch_agent_v1.py
python
Beam.get_pretty_hypothesis
(list_of_hypotails)
return hypothesis
Return prettier version of the hypotheses.
Return prettier version of the hypotheses.
[ "Return", "prettier", "version", "of", "the", "hypotheses", "." ]
def get_pretty_hypothesis(list_of_hypotails): """Return prettier version of the hypotheses.""" hypothesis = [] for i in list_of_hypotails: hypothesis.append(i.tokenid) hypothesis = torch.stack(list(reversed(hypothesis))) return hypothesis
[ "def", "get_pretty_hypothesis", "(", "list_of_hypotails", ")", ":", "hypothesis", "=", "[", "]", "for", "i", "in", "list_of_hypotails", ":", "hypothesis", ".", "append", "(", "i", ".", "tokenid", ")", "hypothesis", "=", "torch", ".", "stack", "(", "list", ...
https://github.com/natashamjaques/neural_chat/blob/ddb977bb4602a67c460d02231e7bbf7b2cb49a97/ParlAI/parlai/agents/legacy_agents/seq2seq/torch_agent_v1.py#L1213-L1221
bjodah/chempy
c26738a40fc0a11c17aee9c8b21a772185a828d4
chempy/kinetics/integrated.py
python
binary_rev
(t, kf, kb, prod, major, minor, backend=None)
return (x4 * x8 + x5 * x8 + x7 * (x2 + x6)) / (2 * kf * (x6 + x7))
Analytic product transient of a reversible 2-to-1 reaction. Product concentration vs time from second order reversible kinetics. Parameters ---------- t : float, Symbol or array_like Time. kf : number or Symbol Forward (bimolecular) rate constant. kb : number or Symbol ...
Analytic product transient of a reversible 2-to-1 reaction.
[ "Analytic", "product", "transient", "of", "a", "reversible", "2", "-", "to", "-", "1", "reaction", "." ]
def binary_rev(t, kf, kb, prod, major, minor, backend=None): """Analytic product transient of a reversible 2-to-1 reaction. Product concentration vs time from second order reversible kinetics. Parameters ---------- t : float, Symbol or array_like Time. kf : number or Symbol For...
[ "def", "binary_rev", "(", "t", ",", "kf", ",", "kb", ",", "prod", ",", "major", ",", "minor", ",", "backend", "=", "None", ")", ":", "# see _integrated.ipynb for derivation", "be", "=", "get_backend", "(", "backend", ")", "X", ",", "Y", ",", "Z", "=", ...
https://github.com/bjodah/chempy/blob/c26738a40fc0a11c17aee9c8b21a772185a828d4/chempy/kinetics/integrated.py#L108-L143
blockcypher/blockcypher-python
337f9e7b8fd05a4fbb646a1e6599fe30acca47cb
blockcypher/api.py
python
get_wallet_addresses
(wallet_name, api_key, is_hd_wallet=False, zero_balance=None, used=None, omit_addresses=False, coin_symbol='btc')
return get_valid_json(r)
Returns a list of wallet addresses as well as some meta-data
Returns a list of wallet addresses as well as some meta-data
[ "Returns", "a", "list", "of", "wallet", "addresses", "as", "well", "as", "some", "meta", "-", "data" ]
def get_wallet_addresses(wallet_name, api_key, is_hd_wallet=False, zero_balance=None, used=None, omit_addresses=False, coin_symbol='btc'): ''' Returns a list of wallet addresses as well as some meta-data ''' assert is_valid_coin_symbol(coin_symbol) assert api_key assert len(wallet_name) ...
[ "def", "get_wallet_addresses", "(", "wallet_name", ",", "api_key", ",", "is_hd_wallet", "=", "False", ",", "zero_balance", "=", "None", ",", "used", "=", "None", ",", "omit_addresses", "=", "False", ",", "coin_symbol", "=", "'btc'", ")", ":", "assert", "is_v...
https://github.com/blockcypher/blockcypher-python/blob/337f9e7b8fd05a4fbb646a1e6599fe30acca47cb/blockcypher/api.py#L1162-L1190
tintinweb/pub
11e20a260ec3c462cc2e15c4b4869438262203b1
pocs/cve-2016-3115/poc.py
python
SSHX11fwdExploit.exploit_fwd_write_
(self, path, data)
return path
adds display with protocolname containing userdata. badchars=<space>
adds display with protocolname containing userdata. badchars=<space>
[ "adds", "display", "with", "protocolname", "containing", "userdata", ".", "badchars", "=", "<space", ">" ]
def exploit_fwd_write_(self, path, data): ''' adds display with protocolname containing userdata. badchars=<space> ''' dummy_dispname = "127.0.0.250:65500" ret = self.exploit('\nadd %s %s aa'%(dummy_dispname, data)) if ret.count('bad "add" command line')>1: ...
[ "def", "exploit_fwd_write_", "(", "self", ",", "path", ",", "data", ")", ":", "dummy_dispname", "=", "\"127.0.0.250:65500\"", "ret", "=", "self", ".", "exploit", "(", "'\\nadd %s %s aa'", "%", "(", "dummy_dispname", ",", "data", ")", ")", "if", "ret", ".", ...
https://github.com/tintinweb/pub/blob/11e20a260ec3c462cc2e15c4b4869438262203b1/pocs/cve-2016-3115/poc.py#L62-L72
python-openxml/python-docx
36cac78de080d412e9e50d56c2784e33655cad59
docx/text/run.py
python
Run.text
(self)
return self._r.text
String formed by concatenating the text equivalent of each run content child element into a Python string. Each ``<w:t>`` element adds the text characters it contains. A ``<w:tab/>`` element adds a ``\\t`` character. A ``<w:cr/>`` or ``<w:br>`` element each add a ``\\n`` character. Note ...
String formed by concatenating the text equivalent of each run content child element into a Python string. Each ``<w:t>`` element adds the text characters it contains. A ``<w:tab/>`` element adds a ``\\t`` character. A ``<w:cr/>`` or ``<w:br>`` element each add a ``\\n`` character. Note ...
[ "String", "formed", "by", "concatenating", "the", "text", "equivalent", "of", "each", "run", "content", "child", "element", "into", "a", "Python", "string", ".", "Each", "<w", ":", "t", ">", "element", "adds", "the", "text", "characters", "it", "contains", ...
def text(self): """ String formed by concatenating the text equivalent of each run content child element into a Python string. Each ``<w:t>`` element adds the text characters it contains. A ``<w:tab/>`` element adds a ``\\t`` character. A ``<w:cr/>`` or ``<w:br>`` element each ad...
[ "def", "text", "(", "self", ")", ":", "return", "self", ".", "_r", ".", "text" ]
https://github.com/python-openxml/python-docx/blob/36cac78de080d412e9e50d56c2784e33655cad59/docx/text/run.py#L142-L159
nurv/BicaVM
da805e5464490d783597f13dcc5e9fcd568a3ab7
webserver/web/session.py
python
Session._processor
(self, handler)
Application processor to setup session for every request
Application processor to setup session for every request
[ "Application", "processor", "to", "setup", "session", "for", "every", "request" ]
def _processor(self, handler): """Application processor to setup session for every request""" self._cleanup() self._load() try: return handler() finally: self._save()
[ "def", "_processor", "(", "self", ",", "handler", ")", ":", "self", ".", "_cleanup", "(", ")", "self", ".", "_load", "(", ")", "try", ":", "return", "handler", "(", ")", "finally", ":", "self", ".", "_save", "(", ")" ]
https://github.com/nurv/BicaVM/blob/da805e5464490d783597f13dcc5e9fcd568a3ab7/webserver/web/session.py#L53-L61
openrazer/openrazer
1615f8516e8014bad7f78c781c91e6529679718f
daemon/openrazer_daemon/dbus_services/dbus_methods/chroma_keyboard.py
python
set_starlight_single_effect
(self, red, green, blue, speed)
Set starlight mode
Set starlight mode
[ "Set", "starlight", "mode" ]
def set_starlight_single_effect(self, red, green, blue, speed): """ Set starlight mode """ self.logger.debug("DBus call set_starlight_single") driver_path = self.get_driver_path('matrix_effect_starlight') with open(driver_path, 'wb') as driver_file: driver_file.write(bytes([speed, red,...
[ "def", "set_starlight_single_effect", "(", "self", ",", "red", ",", "green", ",", "blue", ",", "speed", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"DBus call set_starlight_single\"", ")", "driver_path", "=", "self", ".", "get_driver_path", "(", "'ma...
https://github.com/openrazer/openrazer/blob/1615f8516e8014bad7f78c781c91e6529679718f/daemon/openrazer_daemon/dbus_services/dbus_methods/chroma_keyboard.py#L594-L611
Delta-ML/delta
31dfebc8f20b7cb282b62f291ff25a87e403cc86
egs/conll2003/pretrain/v1/local/tokenization.py
python
_is_whitespace
(char)
return False
Checks whether `chars` is a whitespace character.
Checks whether `chars` is a whitespace character.
[ "Checks", "whether", "chars", "is", "a", "whitespace", "character", "." ]
def _is_whitespace(char): """Checks whether `chars` is a whitespace character.""" # \t, \n, and \r are technically contorl characters but we treat them # as whitespace since they are generally considered as such. if char == " " or char == "\t" or char == "\n" or char == "\r": return True cat = unicodedata...
[ "def", "_is_whitespace", "(", "char", ")", ":", "# \\t, \\n, and \\r are technically contorl characters but we treat them", "# as whitespace since they are generally considered as such.", "if", "char", "==", "\" \"", "or", "char", "==", "\"\\t\"", "or", "char", "==", "\"\\n\"",...
https://github.com/Delta-ML/delta/blob/31dfebc8f20b7cb282b62f291ff25a87e403cc86/egs/conll2003/pretrain/v1/local/tokenization.py#L362-L371
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/models/mobilebert/modeling_tf_mobilebert.py
python
TFOutputBottleneck.call
(self, hidden_states, residual_tensor, training=False)
return layer_outputs
[]
def call(self, hidden_states, residual_tensor, training=False): layer_outputs = self.dense(hidden_states) layer_outputs = self.dropout(layer_outputs, training=training) layer_outputs = self.LayerNorm(layer_outputs + residual_tensor) return layer_outputs
[ "def", "call", "(", "self", ",", "hidden_states", ",", "residual_tensor", ",", "training", "=", "False", ")", ":", "layer_outputs", "=", "self", ".", "dense", "(", "hidden_states", ")", "layer_outputs", "=", "self", ".", "dropout", "(", "layer_outputs", ",",...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/mobilebert/modeling_tf_mobilebert.py#L343-L347
a312863063/seeprettyface-ganerator-dongman
f21440d04dcd94a1e8abb25905c25566ed0fe06f
dnnlib/tflib/tfutil.py
python
shape_to_list
(shape: Iterable[tf.Dimension])
return [dim.value for dim in shape]
Convert a Tensorflow shape to a list of ints.
Convert a Tensorflow shape to a list of ints.
[ "Convert", "a", "Tensorflow", "shape", "to", "a", "list", "of", "ints", "." ]
def shape_to_list(shape: Iterable[tf.Dimension]) -> List[Union[int, None]]: """Convert a Tensorflow shape to a list of ints.""" return [dim.value for dim in shape]
[ "def", "shape_to_list", "(", "shape", ":", "Iterable", "[", "tf", ".", "Dimension", "]", ")", "->", "List", "[", "Union", "[", "int", ",", "None", "]", "]", ":", "return", "[", "dim", ".", "value", "for", "dim", "in", "shape", "]" ]
https://github.com/a312863063/seeprettyface-ganerator-dongman/blob/f21440d04dcd94a1e8abb25905c25566ed0fe06f/dnnlib/tflib/tfutil.py#L34-L36
vanheeringen-lab/genomepy
4c10e69b6886cf52381caf6498395391834a675b
genomepy/genome/sequences.py
python
track2fasta
( self, track, fastafile=None, stranded=False, extend_up=0, extend_down=0 # noqa )
Return a list of fasta sequences as Sequence objects as directed from the track(s). Parameters ---------- track: list/region file/bed file region(s) you wish to translate to fasta. Example input files can be found in genomepy/tests/data/regions.* fastafile: bool , optional ...
Return a list of fasta sequences as Sequence objects as directed from the track(s).
[ "Return", "a", "list", "of", "fasta", "sequences", "as", "Sequence", "objects", "as", "directed", "from", "the", "track", "(", "s", ")", "." ]
def track2fasta( self, track, fastafile=None, stranded=False, extend_up=0, extend_down=0 # noqa ): """ Return a list of fasta sequences as Sequence objects as directed from the track(s). Parameters ---------- track: list/region file/bed file region(s) you wish to translate to fasta...
[ "def", "track2fasta", "(", "self", ",", "track", ",", "fastafile", "=", "None", ",", "stranded", "=", "False", ",", "extend_up", "=", "0", ",", "extend_down", "=", "0", "# noqa", ")", ":", "track_type", "=", "get_track_type", "(", "track", ")", "if", "...
https://github.com/vanheeringen-lab/genomepy/blob/4c10e69b6886cf52381caf6498395391834a675b/genomepy/genome/sequences.py#L13-L53
MaurizioFD/RecSys2019_DeepLearning_Evaluation
0fb6b7f5c396f8525316ed66cf9c9fdb03a5fa9b
CNN_on_embeddings/IJCAI/CFM_github/LoadData.py
python
LoadData.get_length
(self)
return length_user + 1, length_item + 1
map the user fields in all files, kept in self.user_fields dictionary :return:
map the user fields in all files, kept in self.user_fields dictionary :return:
[ "map", "the", "user", "fields", "in", "all", "files", "kept", "in", "self", ".", "user_fields", "dictionary", ":", "return", ":" ]
def get_length(self): ''' map the user fields in all files, kept in self.user_fields dictionary :return: ''' length_user = 0 length_item = 0 f = open(self.trainfile) line = f.readline() while line: user_features = line.strip().split(','...
[ "def", "get_length", "(", "self", ")", ":", "length_user", "=", "0", "length_item", "=", "0", "f", "=", "open", "(", "self", ".", "trainfile", ")", "line", "=", "f", ".", "readline", "(", ")", "while", "line", ":", "user_features", "=", "line", ".", ...
https://github.com/MaurizioFD/RecSys2019_DeepLearning_Evaluation/blob/0fb6b7f5c396f8525316ed66cf9c9fdb03a5fa9b/CNN_on_embeddings/IJCAI/CFM_github/LoadData.py#L38-L60
python-rope/rope
bcdfe6b70b1437d976e21c56b6ec1281b22823aa
rope/refactor/extract.py
python
_ExtractRefactoring.get_changes
(self, extracted_name, similar=False, global_=False, kind=None)
return changes
Get the changes this refactoring makes :parameters: - `extracted_name`: target name, when starts with @ - set kind to classmethod, $ - staticmethod - `similar`: if `True`, similar expressions/statements are also replaced. - `global_`: if `True`, the...
Get the changes this refactoring makes
[ "Get", "the", "changes", "this", "refactoring", "makes" ]
def get_changes(self, extracted_name, similar=False, global_=False, kind=None): """Get the changes this refactoring makes :parameters: - `extracted_name`: target name, when starts with @ - set kind to classmethod, $ - staticmethod - `similar`: if `True`, similar expr...
[ "def", "get_changes", "(", "self", ",", "extracted_name", ",", "similar", "=", "False", ",", "global_", "=", "False", ",", "kind", "=", "None", ")", ":", "extracted_name", ",", "kind", "=", "self", ".", "_get_kind_from_name", "(", "extracted_name", ",", "k...
https://github.com/python-rope/rope/blob/bcdfe6b70b1437d976e21c56b6ec1281b22823aa/rope/refactor/extract.py#L57-L86
projectweekend/Pi-GPIO-Server
28df768578f6bd27771d6855ecd2d3804a34e142
pi_gpio/urls.py
python
index
(path)
return render_template('index.html')
[]
def index(path): global EVENT_MANAGER if EVENT_MANAGER is None: EVENT_MANAGER = PinEventManager() EVENT_MANAGER.register_gpio_events() return render_template('index.html')
[ "def", "index", "(", "path", ")", ":", "global", "EVENT_MANAGER", "if", "EVENT_MANAGER", "is", "None", ":", "EVENT_MANAGER", "=", "PinEventManager", "(", ")", "EVENT_MANAGER", ".", "register_gpio_events", "(", ")", "return", "render_template", "(", "'index.html'",...
https://github.com/projectweekend/Pi-GPIO-Server/blob/28df768578f6bd27771d6855ecd2d3804a34e142/pi_gpio/urls.py#L17-L22
facebookresearch/mmf
fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f
mmf/models/uniter.py
python
UNITERForPretraining._get_feature_mask
(self, image_mask, sentence_len)
return concat_mask
[]
def _get_feature_mask(self, image_mask, sentence_len): bs = image_mask.size(0) padding_for_txt = torch.zeros((bs, sentence_len)).to(image_mask) concat_mask = torch.cat([padding_for_txt, image_mask], dim=-1) return concat_mask
[ "def", "_get_feature_mask", "(", "self", ",", "image_mask", ",", "sentence_len", ")", ":", "bs", "=", "image_mask", ".", "size", "(", "0", ")", "padding_for_txt", "=", "torch", ".", "zeros", "(", "(", "bs", ",", "sentence_len", ")", ")", ".", "to", "("...
https://github.com/facebookresearch/mmf/blob/fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f/mmf/models/uniter.py#L506-L510
dreadatour/Flake8Lint
8703c5633ac3fab4bd116da82aae7ff7bbc795c0
contrib/pydocstyle.py
python
ConfigurationParser._get_section_name
(cls, parser)
return None
Parse options from relevant section.
Parse options from relevant section.
[ "Parse", "options", "from", "relevant", "section", "." ]
def _get_section_name(cls, parser): """Parse options from relevant section.""" for section_name in cls.POSSIBLE_SECTION_NAMES: if parser.has_section(section_name): return section_name return None
[ "def", "_get_section_name", "(", "cls", ",", "parser", ")", ":", "for", "section_name", "in", "cls", ".", "POSSIBLE_SECTION_NAMES", ":", "if", "parser", ".", "has_section", "(", "section_name", ")", ":", "return", "section_name", "return", "None" ]
https://github.com/dreadatour/Flake8Lint/blob/8703c5633ac3fab4bd116da82aae7ff7bbc795c0/contrib/pydocstyle.py#L1055-L1061
exodrifter/unity-python
bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d
Lib/bdb.py
python
checkfuncname
(b, frame)
return True
Check whether we should break here because of `b.funcname`.
Check whether we should break here because of `b.funcname`.
[ "Check", "whether", "we", "should", "break", "here", "because", "of", "b", ".", "funcname", "." ]
def checkfuncname(b, frame): """Check whether we should break here because of `b.funcname`.""" if not b.funcname: # Breakpoint was set via line number. if b.line != frame.f_lineno: # Breakpoint was set at a line with a def statement and the function # defined is called: d...
[ "def", "checkfuncname", "(", "b", ",", "frame", ")", ":", "if", "not", "b", ".", "funcname", ":", "# Breakpoint was set via line number.", "if", "b", ".", "line", "!=", "frame", ".", "f_lineno", ":", "# Breakpoint was set at a line with a def statement and the functio...
https://github.com/exodrifter/unity-python/blob/bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d/Lib/bdb.py#L533-L557
researchmm/tasn
5dba8ccc096cedc63913730eeea14a9647911129
tasn-mxnet/example/sparse/linear_classification/weighted_softmax_ce.py
python
WeightedSoftmaxCrossEntropyLoss.backward
(self, req, out_grad, in_data, out_data, in_grad, aux)
Implements backward computation req : list of {'null', 'write', 'inplace', 'add'}, how to assign to in_grad out_grad : list of NDArray, gradient w.r.t. output data. in_grad : list of NDArray, gradient w.r.t. input data. This is the output buffer.
Implements backward computation
[ "Implements", "backward", "computation" ]
def backward(self, req, out_grad, in_data, out_data, in_grad, aux): """Implements backward computation req : list of {'null', 'write', 'inplace', 'add'}, how to assign to in_grad out_grad : list of NDArray, gradient w.r.t. output data. in_grad : list of NDArray, gradient w.r.t. input da...
[ "def", "backward", "(", "self", ",", "req", ",", "out_grad", ",", "in_data", ",", "out_data", ",", "in_grad", ",", "aux", ")", ":", "label", "=", "in_data", "[", "1", "]", "pred", "=", "out_data", "[", "0", "]", "dx", "=", "pred", "-", "mx", ".",...
https://github.com/researchmm/tasn/blob/5dba8ccc096cedc63913730eeea14a9647911129/tasn-mxnet/example/sparse/linear_classification/weighted_softmax_ce.py#L44-L57
blampe/IbPy
cba912d2ecc669b0bf2980357ea7942e49c0825e
ib/ext/EWrapperMsgGenerator.py
python
EWrapperMsgGenerator.accountDownloadEnd
(cls, accountName)
return "accountDownloadEnd: " + accountName
generated source for method accountDownloadEnd
generated source for method accountDownloadEnd
[ "generated", "source", "for", "method", "accountDownloadEnd" ]
def accountDownloadEnd(cls, accountName): """ generated source for method accountDownloadEnd """ return "accountDownloadEnd: " + accountName
[ "def", "accountDownloadEnd", "(", "cls", ",", "accountName", ")", ":", "return", "\"accountDownloadEnd: \"", "+", "accountName" ]
https://github.com/blampe/IbPy/blob/cba912d2ecc669b0bf2980357ea7942e49c0825e/ib/ext/EWrapperMsgGenerator.py#L256-L258
playframework/play1
0ecac3bc2421ae2dbec27a368bf671eda1c9cba5
python/Lib/ntpath.py
python
expandvars
(path)
return res
Expand shell variables of the forms $var, ${var} and %var%. Unknown variables are left unchanged.
Expand shell variables of the forms $var, ${var} and %var%.
[ "Expand", "shell", "variables", "of", "the", "forms", "$var", "$", "{", "var", "}", "and", "%var%", "." ]
def expandvars(path): """Expand shell variables of the forms $var, ${var} and %var%. Unknown variables are left unchanged.""" if '$' not in path and '%' not in path: return path import string varchars = string.ascii_letters + string.digits + '_-' if isinstance(path, _unicode): e...
[ "def", "expandvars", "(", "path", ")", ":", "if", "'$'", "not", "in", "path", "and", "'%'", "not", "in", "path", ":", "return", "path", "import", "string", "varchars", "=", "string", ".", "ascii_letters", "+", "string", ".", "digits", "+", "'_-'", "if"...
https://github.com/playframework/play1/blob/0ecac3bc2421ae2dbec27a368bf671eda1c9cba5/python/Lib/ntpath.py#L327-L408
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/library/oc_version.py
python
OpenShiftCLI.__init__
(self, namespace, kubeconfig='/etc/origin/master/admin.kubeconfig', verbose=False, all_namespaces=False)
Constructor for OpenshiftCLI
Constructor for OpenshiftCLI
[ "Constructor", "for", "OpenshiftCLI" ]
def __init__(self, namespace, kubeconfig='/etc/origin/master/admin.kubeconfig', verbose=False, all_namespaces=False): ''' Constructor for OpenshiftCLI ''' self.namespace = namespace self.verbose = verbose self.kubeconfig...
[ "def", "__init__", "(", "self", ",", "namespace", ",", "kubeconfig", "=", "'/etc/origin/master/admin.kubeconfig'", ",", "verbose", "=", "False", ",", "all_namespaces", "=", "False", ")", ":", "self", ".", "namespace", "=", "namespace", "self", ".", "verbose", ...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/library/oc_version.py#L842-L852
ubuntu/ubuntu-make
939668aad1f4c38ffb74cce55b3678f6fded5c71
umake/frameworks/__init__.py
python
BaseFramework.mark_in_config
(self)
Mark the installation as installed in the config file
Mark the installation as installed in the config file
[ "Mark", "the", "installation", "as", "installed", "in", "the", "config", "file" ]
def mark_in_config(self): """Mark the installation as installed in the config file""" config = ConfigHandler().config config.setdefault("frameworks", {})\ .setdefault(self.category.prog_name, {})\ .setdefault(self.prog_name, {})["path"] = self.install_path Con...
[ "def", "mark_in_config", "(", "self", ")", ":", "config", "=", "ConfigHandler", "(", ")", ".", "config", "config", ".", "setdefault", "(", "\"frameworks\"", ",", "{", "}", ")", ".", "setdefault", "(", "self", ".", "category", ".", "prog_name", ",", "{", ...
https://github.com/ubuntu/ubuntu-make/blob/939668aad1f4c38ffb74cce55b3678f6fded5c71/umake/frameworks/__init__.py#L273-L279
crossbario/autobahn-python
fa9f2da0c5005574e63456a3a04f00e405744014
autobahn/wamp/message.py
python
Welcome.marshal
(self)
return [Welcome.MESSAGE_TYPE, self.session, details]
Marshal this object into a raw message for subsequent serialization to bytes. :returns: The serialized raw message. :rtype: list
Marshal this object into a raw message for subsequent serialization to bytes.
[ "Marshal", "this", "object", "into", "a", "raw", "message", "for", "subsequent", "serialization", "to", "bytes", "." ]
def marshal(self): """ Marshal this object into a raw message for subsequent serialization to bytes. :returns: The serialized raw message. :rtype: list """ details = {} details.update(self.custom) if self.realm: details['realm'] = self.realm ...
[ "def", "marshal", "(", "self", ")", ":", "details", "=", "{", "}", "details", ".", "update", "(", "self", ".", "custom", ")", "if", "self", ".", "realm", ":", "details", "[", "'realm'", "]", "=", "self", ".", "realm", "if", "self", ".", "authid", ...
https://github.com/crossbario/autobahn-python/blob/fa9f2da0c5005574e63456a3a04f00e405744014/autobahn/wamp/message.py#L974-L1020
kamilion/customizer
1442e1b9df81f2f917eda0ef0b48faadcec421ce
installer.py
python
is_tool_installed
(tool)
Checks if a tool is installed. Returns bool.
Checks if a tool is installed. Returns bool.
[ "Checks", "if", "a", "tool", "is", "installed", ".", "Returns", "bool", "." ]
def is_tool_installed(tool): """ Checks if a tool is installed. Returns bool. """ try: subprocess.call([tool, "--version"], stdout=DEVNULL, stdin=DEVNULL, stderr=DEVNULL) except OSError as errmsg: if errmsg.errno == errno.ENOENT: return False ...
[ "def", "is_tool_installed", "(", "tool", ")", ":", "try", ":", "subprocess", ".", "call", "(", "[", "tool", ",", "\"--version\"", "]", ",", "stdout", "=", "DEVNULL", ",", "stdin", "=", "DEVNULL", ",", "stderr", "=", "DEVNULL", ")", "except", "OSError", ...
https://github.com/kamilion/customizer/blob/1442e1b9df81f2f917eda0ef0b48faadcec421ce/installer.py#L642-L655
compiler-explorer/infra
949b6bc12981c3953162aca5bae9047f6bb8f114
bin/lib/cli/runner.py
python
runner_discoveryexists
(environment: str, version: str)
return res == 0
Check if a discovery json file exists.
Check if a discovery json file exists.
[ "Check", "if", "a", "discovery", "json", "file", "exists", "." ]
def runner_discoveryexists(environment: str, version: str): """Check if a discovery json file exists.""" if environment == 'prod': s3path = f's3://compiler-explorer/dist/discovery/release/{version}.json' else: s3path = f's3://compiler-explorer/dist/discovery/{environment}/{version}.json' ...
[ "def", "runner_discoveryexists", "(", "environment", ":", "str", ",", "version", ":", "str", ")", ":", "if", "environment", "==", "'prod'", ":", "s3path", "=", "f's3://compiler-explorer/dist/discovery/release/{version}.json'", "else", ":", "s3path", "=", "f's3://compi...
https://github.com/compiler-explorer/infra/blob/949b6bc12981c3953162aca5bae9047f6bb8f114/bin/lib/cli/runner.py#L64-L71
Jenyay/outwiker
50530cf7b3f71480bb075b2829bc0669773b835b
plugins/snippets/snippets/libs/jinja2/nodes.py
python
Node.find
(self, node_type)
Find the first node of a given type. If no such node exists the return value is `None`.
Find the first node of a given type. If no such node exists the return value is `None`.
[ "Find", "the", "first", "node", "of", "a", "given", "type", ".", "If", "no", "such", "node", "exists", "the", "return", "value", "is", "None", "." ]
def find(self, node_type): """Find the first node of a given type. If no such node exists the return value is `None`. """ for result in self.find_all(node_type): return result
[ "def", "find", "(", "self", ",", "node_type", ")", ":", "for", "result", "in", "self", ".", "find_all", "(", "node_type", ")", ":", "return", "result" ]
https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/plugins/snippets/snippets/libs/jinja2/nodes.py#L177-L182
XX-net/XX-Net
a9898cfcf0084195fb7e69b6bc834e59aecdf14f
python3.8.2/Lib/site-packages/pycparser/c_generator.py
python
CGenerator._generate_type
(self, n, modifiers=[], emit_declname = True)
Recursive generation from a type node. n is the type node. modifiers collects the PtrDecl, ArrayDecl and FuncDecl modifiers encountered on the way down to a TypeDecl, to allow proper generation from it.
Recursive generation from a type node. n is the type node. modifiers collects the PtrDecl, ArrayDecl and FuncDecl modifiers encountered on the way down to a TypeDecl, to allow proper generation from it.
[ "Recursive", "generation", "from", "a", "type", "node", ".", "n", "is", "the", "type", "node", ".", "modifiers", "collects", "the", "PtrDecl", "ArrayDecl", "and", "FuncDecl", "modifiers", "encountered", "on", "the", "way", "down", "to", "a", "TypeDecl", "to"...
def _generate_type(self, n, modifiers=[], emit_declname = True): """ Recursive generation from a type node. n is the type node. modifiers collects the PtrDecl, ArrayDecl and FuncDecl modifiers encountered on the way down to a TypeDecl, to allow proper generation from it. ...
[ "def", "_generate_type", "(", "self", ",", "n", ",", "modifiers", "=", "[", "]", ",", "emit_declname", "=", "True", ")", ":", "typ", "=", "type", "(", "n", ")", "#~ print(n, modifiers)", "if", "typ", "==", "c_ast", ".", "TypeDecl", ":", "s", "=", "''...
https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/site-packages/pycparser/c_generator.py#L371-L422
PaddlePaddle/PaddleClas
d089b69869b24b3051d200048979e17d4775624e
ppcls/arch/backbone/legendary_models/pp_lcnet.py
python
PPLCNet_x2_0
(pretrained=False, use_ssld=False, **kwargs)
return model
PPLCNet_x2_0 Args: pretrained: bool=False or str. If `True` load pretrained parameters, `False` otherwise. If str, means the path of the pretrained model. use_ssld: bool=False. Whether using distillation pretrained model when pretrained=True. Returns: model: nn.Layer....
PPLCNet_x2_0 Args: pretrained: bool=False or str. If `True` load pretrained parameters, `False` otherwise. If str, means the path of the pretrained model. use_ssld: bool=False. Whether using distillation pretrained model when pretrained=True. Returns: model: nn.Layer....
[ "PPLCNet_x2_0", "Args", ":", "pretrained", ":", "bool", "=", "False", "or", "str", ".", "If", "True", "load", "pretrained", "parameters", "False", "otherwise", ".", "If", "str", "means", "the", "path", "of", "the", "pretrained", "model", ".", "use_ssld", "...
def PPLCNet_x2_0(pretrained=False, use_ssld=False, **kwargs): """ PPLCNet_x2_0 Args: pretrained: bool=False or str. If `True` load pretrained parameters, `False` otherwise. If str, means the path of the pretrained model. use_ssld: bool=False. Whether using distillation pr...
[ "def", "PPLCNet_x2_0", "(", "pretrained", "=", "False", ",", "use_ssld", "=", "False", ",", "*", "*", "kwargs", ")", ":", "model", "=", "PPLCNet", "(", "scale", "=", "2.0", ",", "*", "*", "kwargs", ")", "_load_pretrained", "(", "pretrained", ",", "mode...
https://github.com/PaddlePaddle/PaddleClas/blob/d089b69869b24b3051d200048979e17d4775624e/ppcls/arch/backbone/legendary_models/pp_lcnet.py#L372-L384
embassynetwork/modernomad
22dc048d947d538d27e02793763c69ad4942dd2f
modernomad/core/emails/messages.py
python
announce
(request, location_slug)
return HttpResponse(status=200)
email all people signed up for event activity notifications at this location.
email all people signed up for event activity notifications at this location.
[ "email", "all", "people", "signed", "up", "for", "event", "activity", "notifications", "at", "this", "location", "." ]
def announce(request, location_slug): ''' email all people signed up for event activity notifications at this location.''' # fail gracefully if location does not exist try: location = get_location(location_slug) except: # XXX TODO reject and bounce back to sender? logger.error('...
[ "def", "announce", "(", "request", ",", "location_slug", ")", ":", "# fail gracefully if location does not exist", "try", ":", "location", "=", "get_location", "(", "location_slug", ")", "except", ":", "# XXX TODO reject and bounce back to sender?", "logger", ".", "error"...
https://github.com/embassynetwork/modernomad/blob/22dc048d947d538d27e02793763c69ad4942dd2f/modernomad/core/emails/messages.py#L842-L880
spyder-ide/spyder
55da47c032dfcf519600f67f8b30eab467f965e7
spyder/plugins/variableexplorer/widgets/dataframeeditor.py
python
DataFrameEditor.eventFilter
(self, obj, event)
return False
Override eventFilter to catch resize event.
Override eventFilter to catch resize event.
[ "Override", "eventFilter", "to", "catch", "resize", "event", "." ]
def eventFilter(self, obj, event): """Override eventFilter to catch resize event.""" if obj == self.dataTable and event.type() == QEvent.Resize: self._resizeVisibleColumnsToContents() return False
[ "def", "eventFilter", "(", "self", ",", "obj", ",", "event", ")", ":", "if", "obj", "==", "self", ".", "dataTable", "and", "event", ".", "type", "(", ")", "==", "QEvent", ".", "Resize", ":", "self", ".", "_resizeVisibleColumnsToContents", "(", ")", "re...
https://github.com/spyder-ide/spyder/blob/55da47c032dfcf519600f67f8b30eab467f965e7/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L1235-L1239
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/partition_tuple.py
python
PartitionTuples_level.__iter__
(self)
r""" Iterate through the infinite class of partition tuples of fixed level. EXAMPLES:: sage: parts=PartitionTuples(3) sage: [parts[k] for k in range(20)] [([], [], []), ([1], [], []), ([], [1], []), ([], [], [1]), ...
r""" Iterate through the infinite class of partition tuples of fixed level.
[ "r", "Iterate", "through", "the", "infinite", "class", "of", "partition", "tuples", "of", "fixed", "level", "." ]
def __iter__(self): r""" Iterate through the infinite class of partition tuples of fixed level. EXAMPLES:: sage: parts=PartitionTuples(3) sage: [parts[k] for k in range(20)] [([], [], []), ([1], [], []), ([], [1], []), ...
[ "def", "__iter__", "(", "self", ")", ":", "for", "size", "in", "NN", ":", "for", "mu", "in", "PartitionTuples_level_size", "(", "self", ".", "_level", ",", "size", ")", ":", "yield", "self", ".", "element_class", "(", "self", ",", "list", "(", "mu", ...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/partition_tuple.py#L2196-L2227
mwaskom/seaborn
77e3b6b03763d24cc99a8134ee9a6f43b32b8e7b
seaborn/_core.py
python
SemanticMapping.map
(cls, plotter, *args, **kwargs)
return plotter
[]
def map(cls, plotter, *args, **kwargs): # This method is assigned the __init__ docstring method_name = "_{}_map".format(cls.__name__[:-7].lower()) setattr(plotter, method_name, cls(plotter, *args, **kwargs)) return plotter
[ "def", "map", "(", "cls", ",", "plotter", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# This method is assigned the __init__ docstring", "method_name", "=", "\"_{}_map\"", ".", "format", "(", "cls", ".", "__name__", "[", ":", "-", "7", "]", ".", ...
https://github.com/mwaskom/seaborn/blob/77e3b6b03763d24cc99a8134ee9a6f43b32b8e7b/seaborn/_core.py#L52-L56
SCons/scons
309f0234d1d9cc76955818be47c5c722f577dac6
SCons/Environment.py
python
SubstitutionEnvironment.setdefault
(self, key, default=None)
return self._dict.setdefault(key, default)
Emulates the setdefault() method of dictionaries.
Emulates the setdefault() method of dictionaries.
[ "Emulates", "the", "setdefault", "()", "method", "of", "dictionaries", "." ]
def setdefault(self, key, default=None): """Emulates the setdefault() method of dictionaries.""" return self._dict.setdefault(key, default)
[ "def", "setdefault", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "return", "self", ".", "_dict", ".", "setdefault", "(", "key", ",", "default", ")" ]
https://github.com/SCons/scons/blob/309f0234d1d9cc76955818be47c5c722f577dac6/SCons/Environment.py#L431-L433
YU1ut/MixMatch-pytorch
cc7ef42cffe61288d06eec1428268b384674009a
utils/misc.py
python
get_mean_and_std
(dataset)
return mean, std
Compute the mean and std value of dataset.
Compute the mean and std value of dataset.
[ "Compute", "the", "mean", "and", "std", "value", "of", "dataset", "." ]
def get_mean_and_std(dataset): '''Compute the mean and std value of dataset.''' dataloader = trainloader = torch.utils.data.DataLoader(dataset, batch_size=1, shuffle=True, num_workers=2) mean = torch.zeros(3) std = torch.zeros(3) print('==> Computing mean and std..') for inputs, targets in data...
[ "def", "get_mean_and_std", "(", "dataset", ")", ":", "dataloader", "=", "trainloader", "=", "torch", ".", "utils", ".", "data", ".", "DataLoader", "(", "dataset", ",", "batch_size", "=", "1", ",", "shuffle", "=", "True", ",", "num_workers", "=", "2", ")"...
https://github.com/YU1ut/MixMatch-pytorch/blob/cc7ef42cffe61288d06eec1428268b384674009a/utils/misc.py#L19-L32
007gzs/dingtalk-sdk
7979da2e259fdbc571728cae2425a04dbc65850a
dingtalk/client/api/taobao.py
python
TbXuNiYuanXian.taobao_taotv_carousel_playlist_get
( self, channel_id='', system_info='' )
return self._top_request( "taobao.taotv.carousel.playlist.get", { "channel_id": channel_id, "system_info": system_info } )
根据频道ID获取频道下节目单以及当前播放 根据频道ID获取频道下节目单以及当前播放,包括所有视频源的视频 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=35819 :param channel_id: 频道ID :param system_info: 设备信息
根据频道ID获取频道下节目单以及当前播放 根据频道ID获取频道下节目单以及当前播放,包括所有视频源的视频 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=35819
[ "根据频道ID获取频道下节目单以及当前播放", "根据频道ID获取频道下节目单以及当前播放,包括所有视频源的视频", "文档地址:https", ":", "//", "open", "-", "doc", ".", "dingtalk", ".", "com", "/", "docs", "/", "api", ".", "htm?apiId", "=", "35819" ]
def taobao_taotv_carousel_playlist_get( self, channel_id='', system_info='' ): """ 根据频道ID获取频道下节目单以及当前播放 根据频道ID获取频道下节目单以及当前播放,包括所有视频源的视频 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=35819 :param channel_id: 频道ID :param syst...
[ "def", "taobao_taotv_carousel_playlist_get", "(", "self", ",", "channel_id", "=", "''", ",", "system_info", "=", "''", ")", ":", "return", "self", ".", "_top_request", "(", "\"taobao.taotv.carousel.playlist.get\"", ",", "{", "\"channel_id\"", ":", "channel_id", ",",...
https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L53126-L53145
numba/numba
bf480b9e0da858a65508c2b17759a72ee6a44c51
numba/cuda/cudadrv/driver.py
python
_ActiveContext.__exit__
(self, exc_type, exc_val, exc_tb)
[]
def __exit__(self, exc_type, exc_val, exc_tb): if self._is_top: delattr(self._tls_cache, 'ctx_devnum')
[ "def", "__exit__", "(", "self", ",", "exc_type", ",", "exc_val", ",", "exc_tb", ")", ":", "if", "self", ".", "_is_top", ":", "delattr", "(", "self", ".", "_tls_cache", ",", "'ctx_devnum'", ")" ]
https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/cuda/cudadrv/driver.py#L505-L507
pypa/bandersnatch
2e3eb53029ddb8f205f85242d724ae492040c1ce
src/bandersnatch_storage_plugins/swift.py
python
SwiftPath._parse_args
(cls, args: Sequence[str])
return cls._flavour.parse_parts(parts)
[]
def _parse_args(cls, args: Sequence[str]) -> Tuple[Optional[str], str, List[str]]: # This is useful when you don't want to create an instance, just # canonicalize some constructor arguments. parts: List[str] = [] for a in args: a = os.fspath(a) if isinstance(a, st...
[ "def", "_parse_args", "(", "cls", ",", "args", ":", "Sequence", "[", "str", "]", ")", "->", "Tuple", "[", "Optional", "[", "str", "]", ",", "str", ",", "List", "[", "str", "]", "]", ":", "# This is useful when you don't want to create an instance, just", "# ...
https://github.com/pypa/bandersnatch/blob/2e3eb53029ddb8f205f85242d724ae492040c1ce/src/bandersnatch_storage_plugins/swift.py#L272-L289
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/histogram/marker/_colorbar.py
python
ColorBar.tickmode
(self)
return self["tickmode"]
Sets the tick mode for this axis. If "auto", the number of ticks is set via `nticks`. If "linear", the placement of the ticks is determined by a starting position `tick0` and a tick step `dtick` ("linear" is the default value if `tick0` and `dtick` are provided). If "array", the placemen...
Sets the tick mode for this axis. If "auto", the number of ticks is set via `nticks`. If "linear", the placement of the ticks is determined by a starting position `tick0` and a tick step `dtick` ("linear" is the default value if `tick0` and `dtick` are provided). If "array", the placemen...
[ "Sets", "the", "tick", "mode", "for", "this", "axis", ".", "If", "auto", "the", "number", "of", "ticks", "is", "set", "via", "nticks", ".", "If", "linear", "the", "placement", "of", "the", "ticks", "is", "determined", "by", "a", "starting", "position", ...
def tickmode(self): """ Sets the tick mode for this axis. If "auto", the number of ticks is set via `nticks`. If "linear", the placement of the ticks is determined by a starting position `tick0` and a tick step `dtick` ("linear" is the default value if `tick0` and `dtick`...
[ "def", "tickmode", "(", "self", ")", ":", "return", "self", "[", "\"tickmode\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/histogram/marker/_colorbar.py#L948-L966
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
etcd/datadog_checks/etcd/config_models/defaults.py
python
instance_aws_host
(field, value)
return get_default_field_value(field, value)
[]
def instance_aws_host(field, value): return get_default_field_value(field, value)
[ "def", "instance_aws_host", "(", "field", ",", "value", ")", ":", "return", "get_default_field_value", "(", "field", ",", "value", ")" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/etcd/datadog_checks/etcd/config_models/defaults.py#L41-L42
hexway/apple_bleee
1f8022959be660b561e6004b808dd93fa252bc90
npyscreen/fm_form_edit_loop.py
python
FormDefaultEditLoop.edit
(self)
Edit the fields until the user selects the ok button added in the lower right corner. Button will be removed when editing finishes
Edit the fields until the user selects the ok button added in the lower right corner. Button will be removed when editing finishes
[ "Edit", "the", "fields", "until", "the", "user", "selects", "the", "ok", "button", "added", "in", "the", "lower", "right", "corner", ".", "Button", "will", "be", "removed", "when", "editing", "finishes" ]
def edit(self): """Edit the fields until the user selects the ok button added in the lower right corner. Button will be removed when editing finishes""" # Add ok button. Will remove later tmp_rely, tmp_relx = self.nextrely, self.nextrelx my, mx = self.curses_pad.getmaxyx() ...
[ "def", "edit", "(", "self", ")", ":", "# Add ok button. Will remove later", "tmp_rely", ",", "tmp_relx", "=", "self", ".", "nextrely", ",", "self", ".", "nextrelx", "my", ",", "mx", "=", "self", ".", "curses_pad", ".", "getmaxyx", "(", ")", "ok_button_text",...
https://github.com/hexway/apple_bleee/blob/1f8022959be660b561e6004b808dd93fa252bc90/npyscreen/fm_form_edit_loop.py#L51-L108
giantbranch/python-hacker-code
addbc8c73e7e6fb9e4fcadcec022fa1d3da4b96d
我手敲的代码(中文注释)/chapter11/volatility-2.3/volatility/debug.py
python
post_mortem
(level = 1)
Provides a command line interface to python after an exception's occurred
Provides a command line interface to python after an exception's occurred
[ "Provides", "a", "command", "line", "interface", "to", "python", "after", "an", "exception", "s", "occurred" ]
def post_mortem(level = 1): """Provides a command line interface to python after an exception's occurred""" if config.DEBUG >= level: pdb.post_mortem()
[ "def", "post_mortem", "(", "level", "=", "1", ")", ":", "if", "config", ".", "DEBUG", ">=", "level", ":", "pdb", ".", "post_mortem", "(", ")" ]
https://github.com/giantbranch/python-hacker-code/blob/addbc8c73e7e6fb9e4fcadcec022fa1d3da4b96d/我手敲的代码(中文注释)/chapter11/volatility-2.3/volatility/debug.py#L94-L97
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/opsi/operations_insights_client.py
python
OperationsInsightsClient.disable_database_insight
(self, database_insight_id, **kwargs)
Disables a database in Operations Insights. Database metric collection and analysis will be stopped. :param str database_insight_id: (required) Unique database insight identifier :param str if_match: (optional) Used for optimistic concurrency control. In the update or delete c...
Disables a database in Operations Insights. Database metric collection and analysis will be stopped.
[ "Disables", "a", "database", "in", "Operations", "Insights", ".", "Database", "metric", "collection", "and", "analysis", "will", "be", "stopped", "." ]
def disable_database_insight(self, database_insight_id, **kwargs): """ Disables a database in Operations Insights. Database metric collection and analysis will be stopped. :param str database_insight_id: (required) Unique database insight identifier :param str if_match: (o...
[ "def", "disable_database_insight", "(", "self", ",", "database_insight_id", ",", "*", "*", "kwargs", ")", ":", "resource_path", "=", "\"/databaseInsights/{databaseInsightId}/actions/disable\"", "method", "=", "\"POST\"", "# Don't accept unknown kwargs", "expected_kwargs", "="...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/opsi/operations_insights_client.py#L1765-L1859
enthought/mayavi
2103a273568b8f0bd62328801aafbd6252543ae8
tvtk/tools/ivtk.py
python
SceneWithBrowser._create_rhs
(self, parent)
return self.scene.control
Creates the right hand side or bottom depending on the style. 's' and 'scene' are bound to the Scene instance.
Creates the right hand side or bottom depending on the style. 's' and 'scene' are bound to the Scene instance.
[ "Creates", "the", "right", "hand", "side", "or", "bottom", "depending", "on", "the", "style", ".", "s", "and", "scene", "are", "bound", "to", "the", "Scene", "instance", "." ]
def _create_rhs(self, parent): """ Creates the right hand side or bottom depending on the style. 's' and 'scene' are bound to the Scene instance.""" self._create_scene(parent) self.scene.renderer.background = 0.5, 0.5, 0.5 return self.scene.control
[ "def", "_create_rhs", "(", "self", ",", "parent", ")", ":", "self", ".", "_create_scene", "(", "parent", ")", "self", ".", "scene", ".", "renderer", ".", "background", "=", "0.5", ",", "0.5", ",", "0.5", "return", "self", ".", "scene", ".", "control" ]
https://github.com/enthought/mayavi/blob/2103a273568b8f0bd62328801aafbd6252543ae8/tvtk/tools/ivtk.py#L213-L218
google/pytype
fa43edc95dd42ade6e3147d6580d63e778c9d506
pytype/context.py
python
Context.join_cfg_nodes
(self, nodes)
Get a new node to which the given nodes have been joined.
Get a new node to which the given nodes have been joined.
[ "Get", "a", "new", "node", "to", "which", "the", "given", "nodes", "have", "been", "joined", "." ]
def join_cfg_nodes(self, nodes): """Get a new node to which the given nodes have been joined.""" assert nodes if len(nodes) == 1: return nodes[0] else: ret = self.program.NewCFGNode(self.vm.frame and self.vm.frame.current_opcode and ...
[ "def", "join_cfg_nodes", "(", "self", ",", "nodes", ")", ":", "assert", "nodes", "if", "len", "(", "nodes", ")", "==", "1", ":", "return", "nodes", "[", "0", "]", "else", ":", "ret", "=", "self", ".", "program", ".", "NewCFGNode", "(", "self", ".",...
https://github.com/google/pytype/blob/fa43edc95dd42ade6e3147d6580d63e778c9d506/pytype/context.py#L113-L124
Pagure/pagure
512f23f5cd1f965276969747792edeb1215cba68
alembic/versions/e18d5b78d782_add_ci_job_attribute_to_the_hook_pagure_.py
python
downgrade
()
Revert the ci_job column added
Revert the ci_job column added
[ "Revert", "the", "ci_job", "column", "added" ]
def downgrade(): ''' Revert the ci_job column added''' con = op.get_bind() results = con.execute('SELECT id, ci_url, ci_job FROM hook_pagure_ci') for id, url, job in results: ci_url = url + '/job/' + job + '/' op.execute( "UPDATE hook_pagure_ci SET ci_url='{}' WHERE id = '{...
[ "def", "downgrade", "(", ")", ":", "con", "=", "op", ".", "get_bind", "(", ")", "results", "=", "con", ".", "execute", "(", "'SELECT id, ci_url, ci_job FROM hook_pagure_ci'", ")", "for", "id", ",", "url", ",", "job", "in", "results", ":", "ci_url", "=", ...
https://github.com/Pagure/pagure/blob/512f23f5cd1f965276969747792edeb1215cba68/alembic/versions/e18d5b78d782_add_ci_job_attribute_to_the_hook_pagure_.py#L40-L51
tosher/Mediawiker
81bf97cace59bedcb1668e7830b85c36e014428e
lib/Crypto.lin.x64/Crypto/Util/RFC1751.py
python
_extract
(key, start, length)
return reduce(lambda x,y: x*2+ord(y)-48, k, 0)
Extract a bitstring(2.x)/bytestring(2.x) from a string of binary digits, and return its numeric value.
Extract a bitstring(2.x)/bytestring(2.x) from a string of binary digits, and return its numeric value.
[ "Extract", "a", "bitstring", "(", "2", ".", "x", ")", "/", "bytestring", "(", "2", ".", "x", ")", "from", "a", "string", "of", "binary", "digits", "and", "return", "its", "numeric", "value", "." ]
def _extract(key, start, length): """Extract a bitstring(2.x)/bytestring(2.x) from a string of binary digits, and return its numeric value.""" k=key[start:start+length] return reduce(lambda x,y: x*2+ord(y)-48, k, 0)
[ "def", "_extract", "(", "key", ",", "start", ",", "length", ")", ":", "k", "=", "key", "[", "start", ":", "start", "+", "length", "]", "return", "reduce", "(", "lambda", "x", ",", "y", ":", "x", "*", "2", "+", "ord", "(", "y", ")", "-", "48",...
https://github.com/tosher/Mediawiker/blob/81bf97cace59bedcb1668e7830b85c36e014428e/lib/Crypto.lin.x64/Crypto/Util/RFC1751.py#L41-L45
astropy/photutils
3caa48e4e4d139976ed7457dc41583fb2c56ba20
photutils/segmentation/catalog.py
python
SourceCatalog.inertia_tensor
(self)
return tensor.reshape((tensor.shape[0], 2, 2)) * u.pix**2
The inertia tensor of the source for the rotation around its center of mass.
The inertia tensor of the source for the rotation around its center of mass.
[ "The", "inertia", "tensor", "of", "the", "source", "for", "the", "rotation", "around", "its", "center", "of", "mass", "." ]
def inertia_tensor(self): """ The inertia tensor of the source for the rotation around its center of mass. """ moments = self.moments_central if self.isscalar: moments = moments[np.newaxis, :] mu_02 = moments[:, 0, 2] mu_11 = -moments[:, 1, 1] ...
[ "def", "inertia_tensor", "(", "self", ")", ":", "moments", "=", "self", ".", "moments_central", "if", "self", ".", "isscalar", ":", "moments", "=", "moments", "[", "np", ".", "newaxis", ",", ":", "]", "mu_02", "=", "moments", "[", ":", ",", "0", ",",...
https://github.com/astropy/photutils/blob/3caa48e4e4d139976ed7457dc41583fb2c56ba20/photutils/segmentation/catalog.py#L1666-L1678
bjmayor/hacker
e3ce2ad74839c2733b27dac6c0f495e0743e1866
venv/lib/python3.5/site-packages/setuptools/glob.py
python
escape
(pathname)
return drive + pathname
Escape all special characters.
Escape all special characters.
[ "Escape", "all", "special", "characters", "." ]
def escape(pathname): """Escape all special characters. """ # Escaping is done by wrapping any of "*?[" between square brackets. # Metacharacters do not work in the drive part and shouldn't be escaped. drive, pathname = os.path.splitdrive(pathname) if isinstance(pathname, binary_type): p...
[ "def", "escape", "(", "pathname", ")", ":", "# Escaping is done by wrapping any of \"*?[\" between square brackets.", "# Metacharacters do not work in the drive part and shouldn't be escaped.", "drive", ",", "pathname", "=", "os", ".", "path", ".", "splitdrive", "(", "pathname", ...
https://github.com/bjmayor/hacker/blob/e3ce2ad74839c2733b27dac6c0f495e0743e1866/venv/lib/python3.5/site-packages/setuptools/glob.py#L166-L176
getlogbook/logbook
3e0badb395ed8d0038d02996d38aa0505441327e
logbook/base.py
python
LogRecord.calling_frame
(self)
return frm
The frame in which the record has been created. This only exists for as long the log record is not closed.
The frame in which the record has been created. This only exists for as long the log record is not closed.
[ "The", "frame", "in", "which", "the", "record", "has", "been", "created", ".", "This", "only", "exists", "for", "as", "long", "the", "log", "record", "is", "not", "closed", "." ]
def calling_frame(self): """The frame in which the record has been created. This only exists for as long the log record is not closed. """ frm = self.frame globs = globals() while frm is not None and frm.f_globals is globs: frm = frm.f_back for _ in ...
[ "def", "calling_frame", "(", "self", ")", ":", "frm", "=", "self", ".", "frame", "globs", "=", "globals", "(", ")", "while", "frm", "is", "not", "None", "and", "frm", ".", "f_globals", "is", "globs", ":", "frm", "=", "frm", ".", "f_back", "for", "_...
https://github.com/getlogbook/logbook/blob/3e0badb395ed8d0038d02996d38aa0505441327e/logbook/base.py#L595-L610
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/sms/views.py
python
ChatMessageHistory.get
(self, request, *args, **kwargs)
return HttpResponse(json.dumps(data))
[]
def get(self, request, *args, **kwargs): if not self.contact: return HttpResponse('[]') data, last_sms = self.get_response_data(request.couch_user.get_id) if last_sms: try: self.update_last_read_message(request.couch_user.get_id, last_sms) exc...
[ "def", "get", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "contact", ":", "return", "HttpResponse", "(", "'[]'", ")", "data", ",", "last_sms", "=", "self", ".", "get_response_data", "(",...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/sms/views.py#L896-L907