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
tensorflow/lattice
784eca50cbdfedf39f183cc7d298c9fe376b69c0
tensorflow_lattice/python/linear_lib.py
python
assert_constraints
(weights, monotonicities, monotonic_dominances, range_dominances, input_min, input_max, normalization_order, eps=1e-4)
return asserts
Asserts that weights satisfy constraints. Args: weights: Weights of Linear layer. monotonicities: List or tuple of same length as number of elements in 'weights' of {-1, 0, 1} which represent monotonicity constraints per dimension. -1 stands for decreasing, 0 for no constraints, 1 for incre...
Asserts that weights satisfy constraints.
[ "Asserts", "that", "weights", "satisfy", "constraints", "." ]
def assert_constraints(weights, monotonicities, monotonic_dominances, range_dominances, input_min, input_max, normalization_order, eps=1e-4): """Asserts that...
[ "def", "assert_constraints", "(", "weights", ",", "monotonicities", ",", "monotonic_dominances", ",", "range_dominances", ",", "input_min", ",", "input_max", ",", "normalization_order", ",", "eps", "=", "1e-4", ")", ":", "asserts", "=", "[", "]", "if", "any", ...
https://github.com/tensorflow/lattice/blob/784eca50cbdfedf39f183cc7d298c9fe376b69c0/tensorflow_lattice/python/linear_lib.py#L114-L208
qiyuangong/leetcode
790f9ee86dcc7bf85be1bd9358f4c069b4a4c2f5
python/055_Jump_Game.py
python
Solution.canJump
(self, nums)
return not begin
:type nums: List[int] :rtype: bool
:type nums: List[int] :rtype: bool
[ ":", "type", "nums", ":", "List", "[", "int", "]", ":", "rtype", ":", "bool" ]
def canJump(self, nums): """ :type nums: List[int] :rtype: bool """ # greedy # https://leetcode.com/articles/jump-game/ length = len(nums) begin = length - 1 for i in reversed(range(length - 1)): if i + nums[i] >= begin: ...
[ "def", "canJump", "(", "self", ",", "nums", ")", ":", "# greedy", "# https://leetcode.com/articles/jump-game/", "length", "=", "len", "(", "nums", ")", "begin", "=", "length", "-", "1", "for", "i", "in", "reversed", "(", "range", "(", "length", "-", "1", ...
https://github.com/qiyuangong/leetcode/blob/790f9ee86dcc7bf85be1bd9358f4c069b4a4c2f5/python/055_Jump_Game.py#L2-L14
sztomi/code-generator
f9e1b108664a21728f1dc5b504f8966ea40ee9e0
src/clang/cindex.py
python
Cursor.canonical
(self)
return self._canonical
Return the canonical Cursor corresponding to this Cursor. The canonical cursor is the cursor which is representative for the underlying entity. For example, if you have multiple forward declarations for the same class, the canonical cursor for the forward declarations will be identical.
Return the canonical Cursor corresponding to this Cursor.
[ "Return", "the", "canonical", "Cursor", "corresponding", "to", "this", "Cursor", "." ]
def canonical(self): """Return the canonical Cursor corresponding to this Cursor. The canonical cursor is the cursor which is representative for the underlying entity. For example, if you have multiple forward declarations for the same class, the canonical cursor for the forward ...
[ "def", "canonical", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_canonical'", ")", ":", "self", ".", "_canonical", "=", "conf", ".", "lib", ".", "clang_getCanonicalCursor", "(", "self", ")", "return", "self", ".", "_canonical" ]
https://github.com/sztomi/code-generator/blob/f9e1b108664a21728f1dc5b504f8966ea40ee9e0/src/clang/cindex.py#L1260-L1271
clips/pattern
d25511f9ca7ed9356b801d8663b8b5168464e68f
pattern/vector/__init__.py
python
Model.distance
(self, document1, document2, *args, **kwargs)
return distance(document1.vector, document2.vector, *args, **kwargs)
Returns the distance (COSINE, EUCLIDEAN, ...) between two document vectors (0.0-1.0).
Returns the distance (COSINE, EUCLIDEAN, ...) between two document vectors (0.0-1.0).
[ "Returns", "the", "distance", "(", "COSINE", "EUCLIDEAN", "...", ")", "between", "two", "document", "vectors", "(", "0", ".", "0", "-", "1", ".", "0", ")", "." ]
def distance(self, document1, document2, *args, **kwargs): """ Returns the distance (COSINE, EUCLIDEAN, ...) between two document vectors (0.0-1.0). """ return distance(document1.vector, document2.vector, *args, **kwargs)
[ "def", "distance", "(", "self", ",", "document1", ",", "document2", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "distance", "(", "document1", ".", "vector", ",", "document2", ".", "vector", ",", "*", "args", ",", "*", "*", "kwargs"...
https://github.com/clips/pattern/blob/d25511f9ca7ed9356b801d8663b8b5168464e68f/pattern/vector/__init__.py#L1380-L1383
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/Centos_5.9/Crypto/Cipher/XOR.py
python
XORCipher.decrypt
(self, ciphertext)
return self._cipher.decrypt(ciphertext)
Decrypt a piece of data. :Parameters: ciphertext : byte string The piece of data to decrypt. It can be of any size. :Return: the decrypted data (byte string, as long as the ciphertext).
Decrypt a piece of data.
[ "Decrypt", "a", "piece", "of", "data", "." ]
def decrypt(self, ciphertext): """Decrypt a piece of data. :Parameters: ciphertext : byte string The piece of data to decrypt. It can be of any size. :Return: the decrypted data (byte string, as long as the ciphertext). """ return self._cipher.dec...
[ "def", "decrypt", "(", "self", ",", "ciphertext", ")", ":", "return", "self", ".", "_cipher", ".", "decrypt", "(", "ciphertext", ")" ]
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_5.9/Crypto/Cipher/XOR.py#L59-L68
vim-awesome/vim-awesome
7c59d43057b4ebb4cc32403518f6c53d2a3381a8
tools/scrape/vimorg.py
python
_get_inner_text
(html_node)
return lxml.html.tostring(html_node, encoding='utf-8', method='text', with_tail=False).decode('utf-8')
Returns the plaintext of an HTML node. This turns out to do exactly what we want: - strips out <br>s and other markup - replace <a> tags with just their text - converts HTML entities like &nbsp; and smart quotes into their unicode equivalents
Returns the plaintext of an HTML node.
[ "Returns", "the", "plaintext", "of", "an", "HTML", "node", "." ]
def _get_inner_text(html_node): """Returns the plaintext of an HTML node. This turns out to do exactly what we want: - strips out <br>s and other markup - replace <a> tags with just their text - converts HTML entities like &nbsp; and smart quotes into their unicode equivalents...
[ "def", "_get_inner_text", "(", "html_node", ")", ":", "return", "lxml", ".", "html", ".", "tostring", "(", "html_node", ",", "encoding", "=", "'utf-8'", ",", "method", "=", "'text'", ",", "with_tail", "=", "False", ")", ".", "decode", "(", "'utf-8'", ")"...
https://github.com/vim-awesome/vim-awesome/blob/7c59d43057b4ebb4cc32403518f6c53d2a3381a8/tools/scrape/vimorg.py#L158-L168
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/idlelib/pyshell.py
python
main
()
[]
def main(): import getopt from platform import system from idlelib import testing # bool value from idlelib import macosx global flist, root, use_subprocess capture_warnings(True) use_subprocess = True enable_shell = False enable_edit = False debug = False cmd = None s...
[ "def", "main", "(", ")", ":", "import", "getopt", "from", "platform", "import", "system", "from", "idlelib", "import", "testing", "# bool value", "from", "idlelib", "import", "macosx", "global", "flist", ",", "root", ",", "use_subprocess", "capture_warnings", "(...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/idlelib/pyshell.py#L1389-L1568
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
examples/onnx/pytorch/summarization/bart_onnx/generation_onnx.py
python
_create_traced_decoder
(decoder, input_ids, encoder_state, attention_mask, past=None)
[]
def _create_traced_decoder(decoder, input_ids, encoder_state, attention_mask, past=None): decoder_c = copy.deepcopy(decoder) decoder_for_onnx = DecoderForONNX(decoder_c) past_values = list(itertools.chain.from_iterable(past or ())) # Do this twice so we got 2 different decoders for further work. if...
[ "def", "_create_traced_decoder", "(", "decoder", ",", "input_ids", ",", "encoder_state", ",", "attention_mask", ",", "past", "=", "None", ")", ":", "decoder_c", "=", "copy", ".", "deepcopy", "(", "decoder", ")", "decoder_for_onnx", "=", "DecoderForONNX", "(", ...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/examples/onnx/pytorch/summarization/bart_onnx/generation_onnx.py#L79-L88
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/_vendor/cachecontrol/heuristics.py
python
BaseHeuristic.update_headers
(self, response)
return {}
Update the response headers with any new headers. NOTE: This SHOULD always include some Warning header to signify that the response was cached by the client, not by way of the provided headers.
Update the response headers with any new headers.
[ "Update", "the", "response", "headers", "with", "any", "new", "headers", "." ]
def update_headers(self, response): """Update the response headers with any new headers. NOTE: This SHOULD always include some Warning header to signify that the response was cached by the client, not by way of the provided headers. """ return {}
[ "def", "update_headers", "(", "self", ",", "response", ")", ":", "return", "{", "}" ]
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/_vendor/cachecontrol/heuristics.py#L33-L40
F8LEFT/DecLLVM
d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c
python/idaapi.py
python
casevec_t.has
(self, *args)
return _idaapi.casevec_t_has(self, *args)
has(self, x) -> bool
has(self, x) -> bool
[ "has", "(", "self", "x", ")", "-", ">", "bool" ]
def has(self, *args): """ has(self, x) -> bool """ return _idaapi.casevec_t_has(self, *args)
[ "def", "has", "(", "self", ",", "*", "args", ")", ":", "return", "_idaapi", ".", "casevec_t_has", "(", "self", ",", "*", "args", ")" ]
https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L1944-L1948
nsacyber/WALKOFF
52d3311abe99d64cd2a902eb998c5e398efe0e07
common/walkoff_client/walkoff_client/models/workflow_json.py
python
WorkflowJSON.to_dict
(self)
return result
Returns the model properties as a dict
Returns the model properties as a dict
[ "Returns", "the", "model", "properties", "as", "a", "dict" ]
def to_dict(self): """Returns the model properties as a dict""" result = {} for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if has...
[ "def", "to_dict", "(", "self", ")", ":", "result", "=", "{", "}", "for", "attr", ",", "_", "in", "six", ".", "iteritems", "(", "self", ".", "openapi_types", ")", ":", "value", "=", "getattr", "(", "self", ",", "attr", ")", "if", "isinstance", "(", ...
https://github.com/nsacyber/WALKOFF/blob/52d3311abe99d64cd2a902eb998c5e398efe0e07/common/walkoff_client/walkoff_client/models/workflow_json.py#L492-L514
facebookresearch/mmf
fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f
mmf/datasets/builders/vqacp_v2/dataset.py
python
VQACPv2Dataset.get_image_path
(self, image_id: Union[str, int], coco_split: str)
return image_path
[]
def get_image_path(self, image_id: Union[str, int], coco_split: str) -> str: base_paths = self._get_path_based_on_index(self.config, "images", self._index) base_paths = base_paths.split(",") if "train" in base_paths[0]: train_path = base_paths[0] val_path = base_paths[1] ...
[ "def", "get_image_path", "(", "self", ",", "image_id", ":", "Union", "[", "str", ",", "int", "]", ",", "coco_split", ":", "str", ")", "->", "str", ":", "base_paths", "=", "self", ".", "_get_path_based_on_index", "(", "self", ".", "config", ",", "\"images...
https://github.com/facebookresearch/mmf/blob/fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f/mmf/datasets/builders/vqacp_v2/dataset.py#L29-L46
sphinx-doc/sphinx
e79681c76843c1339863b365747079b2d662d0c1
sphinx/util/inspect.py
python
unpartial
(obj: Any)
return obj
Get an original object from partial object. This returns given object itself if not partial.
Get an original object from partial object.
[ "Get", "an", "original", "object", "from", "partial", "object", "." ]
def unpartial(obj: Any) -> Any: """Get an original object from partial object. This returns given object itself if not partial. """ while ispartial(obj): obj = obj.func return obj
[ "def", "unpartial", "(", "obj", ":", "Any", ")", "->", "Any", ":", "while", "ispartial", "(", "obj", ")", ":", "obj", "=", "obj", ".", "func", "return", "obj" ]
https://github.com/sphinx-doc/sphinx/blob/e79681c76843c1339863b365747079b2d662d0c1/sphinx/util/inspect.py#L250-L258
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/voice/v1/connection_policy/__init__.py
python
ConnectionPolicyInstance.update
(self, friendly_name=values.unset)
return self._proxy.update(friendly_name=friendly_name, )
Update the ConnectionPolicyInstance :param unicode friendly_name: A string to describe the resource :returns: The updated ConnectionPolicyInstance :rtype: twilio.rest.voice.v1.connection_policy.ConnectionPolicyInstance
Update the ConnectionPolicyInstance
[ "Update", "the", "ConnectionPolicyInstance" ]
def update(self, friendly_name=values.unset): """ Update the ConnectionPolicyInstance :param unicode friendly_name: A string to describe the resource :returns: The updated ConnectionPolicyInstance :rtype: twilio.rest.voice.v1.connection_policy.ConnectionPolicyInstance "...
[ "def", "update", "(", "self", ",", "friendly_name", "=", "values", ".", "unset", ")", ":", "return", "self", ".", "_proxy", ".", "update", "(", "friendly_name", "=", "friendly_name", ",", ")" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/voice/v1/connection_policy/__init__.py#L383-L392
ray-project/ray
703c1610348615dcb8c2d141a0c46675084660f5
python/ray/util/client/__init__.py
python
_ClientContext.connect
(self, conn_str: str, job_config: JobConfig = None, secure: bool = False, metadata: List[Tuple[str, str]] = None, connection_retries: int = 3, namespace: str = None, *, ignore_version: bool = ...
Connect the Ray Client to a server. Args: conn_str: Connection string, in the form "[host]:port" job_config: The job config of the server. secure: Whether to use a TLS secured gRPC channel metadata: gRPC metadata to send on connect connection_retries:...
Connect the Ray Client to a server.
[ "Connect", "the", "Ray", "Client", "to", "a", "server", "." ]
def connect(self, conn_str: str, job_config: JobConfig = None, secure: bool = False, metadata: List[Tuple[str, str]] = None, connection_retries: int = 3, namespace: str = None, *, ignore_versi...
[ "def", "connect", "(", "self", ",", "conn_str", ":", "str", ",", "job_config", ":", "JobConfig", "=", "None", ",", "secure", ":", "bool", "=", "False", ",", "metadata", ":", "List", "[", "Tuple", "[", "str", ",", "str", "]", "]", "=", "None", ",", ...
https://github.com/ray-project/ray/blob/703c1610348615dcb8c2d141a0c46675084660f5/python/ray/util/client/__init__.py#L28-L95
STVIR/pysot
9b07c521fd370ba38d35f35f76b275156564a681
vot_iter/vot_iter.py
python
warmup
(model)
[]
def warmup(model): for i in range(10): model.template(torch.FloatTensor(1,3,127,127).cuda())
[ "def", "warmup", "(", "model", ")", ":", "for", "i", "in", "range", "(", "10", ")", ":", "model", ".", "template", "(", "torch", ".", "FloatTensor", "(", "1", ",", "3", ",", "127", ",", "127", ")", ".", "cuda", "(", ")", ")" ]
https://github.com/STVIR/pysot/blob/9b07c521fd370ba38d35f35f76b275156564a681/vot_iter/vot_iter.py#L26-L28
iclavera/learning_to_adapt
bd7d99ba402521c96631e7d09714128f549db0f1
learning_to_adapt/mujoco_py/glfw.py
python
set_window_focus_callback
(window, cbfun)
Sets the focus callback for the specified window. Wrapper for: GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun);
Sets the focus callback for the specified window.
[ "Sets", "the", "focus", "callback", "for", "the", "specified", "window", "." ]
def set_window_focus_callback(window, cbfun): ''' Sets the focus callback for the specified window. Wrapper for: GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun); ''' window_addr = ctypes.cast(ctypes.pointer(window), c...
[ "def", "set_window_focus_callback", "(", "window", ",", "cbfun", ")", ":", "window_addr", "=", "ctypes", ".", "cast", "(", "ctypes", ".", "pointer", "(", "window", ")", ",", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_long", ")", ")", ".", "contents...
https://github.com/iclavera/learning_to_adapt/blob/bd7d99ba402521c96631e7d09714128f549db0f1/learning_to_adapt/mujoco_py/glfw.py#L1126-L1146
microsoft/ptvsd
99c8513921021d2cc7cd82e132b65c644c256768
src/ptvsd/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/kernel32.py
python
Handle.__init__
(self, aHandle = None, bOwnership = True)
@type aHandle: int @param aHandle: Win32 handle value. @type bOwnership: bool @param bOwnership: C{True} if we own the handle and we need to close it. C{False} if someone else will be calling L{CloseHandle}.
@type aHandle: int @param aHandle: Win32 handle value.
[ "@type", "aHandle", ":", "int", "@param", "aHandle", ":", "Win32", "handle", "value", "." ]
def __init__(self, aHandle = None, bOwnership = True): """ @type aHandle: int @param aHandle: Win32 handle value. @type bOwnership: bool @param bOwnership: C{True} if we own the handle and we need to close it. C{False} if someone else will be calling L{Cl...
[ "def", "__init__", "(", "self", ",", "aHandle", "=", "None", ",", "bOwnership", "=", "True", ")", ":", "super", "(", "Handle", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "_value", "=", "self", ".", "_normalize", "(", "aHandle", ")", ...
https://github.com/microsoft/ptvsd/blob/99c8513921021d2cc7cd82e132b65c644c256768/src/ptvsd/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/kernel32.py#L596-L610
chapmanb/bcbb
dbfb52711f0bfcc1d26c5a5b53c9ff4f50dc0027
nextgen/bcbio/utils.py
python
memoize_outfile
(ext=None, stem=None)
Memoization decorator. See docstring for transform_to and filter_to for details.
Memoization decorator.
[ "Memoization", "decorator", "." ]
def memoize_outfile(ext=None, stem=None): """ Memoization decorator. See docstring for transform_to and filter_to for details. """ if ext: return transform_to(ext) if stem: return filter_to(stem)
[ "def", "memoize_outfile", "(", "ext", "=", "None", ",", "stem", "=", "None", ")", ":", "if", "ext", ":", "return", "transform_to", "(", "ext", ")", "if", "stem", ":", "return", "filter_to", "(", "stem", ")" ]
https://github.com/chapmanb/bcbb/blob/dbfb52711f0bfcc1d26c5a5b53c9ff4f50dc0027/nextgen/bcbio/utils.py#L144-L153
taoxugit/AttnGAN
0d000e652b407e976cb88fab299e8566f3de8a37
code/model.py
python
conv1x1
(in_planes, out_planes, bias=False)
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=1, padding=0, bias=bias)
1x1 convolution with padding
1x1 convolution with padding
[ "1x1", "convolution", "with", "padding" ]
def conv1x1(in_planes, out_planes, bias=False): "1x1 convolution with padding" return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=1, padding=0, bias=bias)
[ "def", "conv1x1", "(", "in_planes", ",", "out_planes", ",", "bias", "=", "False", ")", ":", "return", "nn", ".", "Conv2d", "(", "in_planes", ",", "out_planes", ",", "kernel_size", "=", "1", ",", "stride", "=", "1", ",", "padding", "=", "0", ",", "bia...
https://github.com/taoxugit/AttnGAN/blob/0d000e652b407e976cb88fab299e8566f3de8a37/code/model.py#L26-L29
ladybug-tools/honeybee-legacy
bd62af4862fe022801fb87dbc8794fdf1dff73a9
src/Honeybee_generationsystem.py
python
checHBgenobjects
(PVHBSurfaces_,HBGenerationObjects_)
[]
def checHBgenobjects(PVHBSurfaces_,HBGenerationObjects_): try: PV_generation = hb_hive.callFromHoneybeeHive(PVHBSurfaces_) except: print "Only PVHBSurfaces_ from the Honeybee_Generator_PV component can be connected to PVHBSurfaces_!" w = gh.GH_RuntimeMessageLevel.W...
[ "def", "checHBgenobjects", "(", "PVHBSurfaces_", ",", "HBGenerationObjects_", ")", ":", "try", ":", "PV_generation", "=", "hb_hive", ".", "callFromHoneybeeHive", "(", "PVHBSurfaces_", ")", "except", ":", "print", "\"Only PVHBSurfaces_ from the Honeybee_Generator_PV componen...
https://github.com/ladybug-tools/honeybee-legacy/blob/bd62af4862fe022801fb87dbc8794fdf1dff73a9/src/Honeybee_generationsystem.py#L63-L82
grow/grow
97fc21730b6a674d5d33948d94968e79447ce433
grow/pods/pods.py
python
Pod.open_file
(self, pod_path, mode=None)
return self.storage.open(path, mode=mode)
[]
def open_file(self, pod_path, mode=None): path = self._normalize_path(pod_path) return self.storage.open(path, mode=mode)
[ "def", "open_file", "(", "self", ",", "pod_path", ",", "mode", "=", "None", ")", ":", "path", "=", "self", ".", "_normalize_path", "(", "pod_path", ")", "return", "self", ".", "storage", ".", "open", "(", "path", ",", "mode", "=", "mode", ")" ]
https://github.com/grow/grow/blob/97fc21730b6a674d5d33948d94968e79447ce433/grow/pods/pods.py#L844-L846
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py
python
ZMQStream.receiving
(self)
return self._recv_callback is not None
Returns True if we are currently receiving from the stream.
Returns True if we are currently receiving from the stream.
[ "Returns", "True", "if", "we", "are", "currently", "receiving", "from", "the", "stream", "." ]
def receiving(self): """Returns True if we are currently receiving from the stream.""" return self._recv_callback is not None
[ "def", "receiving", "(", "self", ")", ":", "return", "self", ".", "_recv_callback", "is", "not", "None" ]
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py#L389-L391
PaddlePaddle/PaddleSpeech
26524031d242876b7fdb71582b0b3a7ea45c7d9d
paddlespeech/t2s/modules/tacotron2/decoder.py
python
Postnet.forward
(self, xs)
return xs
Calculate forward propagation. Parameters ---------- xs : Tensor Batch of the sequences of padded input tensors (B, idim, Tmax). Returns ---------- Tensor Batch of padded output tensor. (B, odim, Tmax).
Calculate forward propagation.
[ "Calculate", "forward", "propagation", "." ]
def forward(self, xs): """Calculate forward propagation. Parameters ---------- xs : Tensor Batch of the sequences of padded input tensors (B, idim, Tmax). Returns ---------- Tensor Batch of padded output tensor. (B, odim, Tmax). ...
[ "def", "forward", "(", "self", ",", "xs", ")", ":", "for", "i", "in", "six", ".", "moves", ".", "range", "(", "len", "(", "self", ".", "postnet", ")", ")", ":", "xs", "=", "self", ".", "postnet", "[", "i", "]", "(", "xs", ")", "return", "xs" ...
https://github.com/PaddlePaddle/PaddleSpeech/blob/26524031d242876b7fdb71582b0b3a7ea45c7d9d/paddlespeech/t2s/modules/tacotron2/decoder.py#L182-L198
awslabs/autogluon
7309118f2ab1c9519f25acf61a283a95af95842b
tabular/src/autogluon/tabular/models/lgb/hyperparameters/searchspaces.py
python
get_default_searchspace
(problem_type, num_classes=None)
[]
def get_default_searchspace(problem_type, num_classes=None): if problem_type == BINARY: return get_searchspace_binary_baseline() elif problem_type == MULTICLASS: return get_searchspace_multiclass_baseline(num_classes=num_classes) elif problem_type == REGRESSION: return get_searchspac...
[ "def", "get_default_searchspace", "(", "problem_type", ",", "num_classes", "=", "None", ")", ":", "if", "problem_type", "==", "BINARY", ":", "return", "get_searchspace_binary_baseline", "(", ")", "elif", "problem_type", "==", "MULTICLASS", ":", "return", "get_search...
https://github.com/awslabs/autogluon/blob/7309118f2ab1c9519f25acf61a283a95af95842b/tabular/src/autogluon/tabular/models/lgb/hyperparameters/searchspaces.py#L8-L16
mdiazcl/fuzzbunch-debian
2b76c2249ade83a389ae3badb12a1bd09901fd2c
windows/Resources/Python/Core/Lib/idlelib/PyShell.py
python
PyShell._close
(self)
return
Extend EditorWindow._close(), shut down debugger and execution server
Extend EditorWindow._close(), shut down debugger and execution server
[ "Extend", "EditorWindow", ".", "_close", "()", "shut", "down", "debugger", "and", "execution", "server" ]
def _close(self): """Extend EditorWindow._close(), shut down debugger and execution server""" self.close_debugger() if use_subprocess: self.interp.kill_subprocess() sys.stdout = self.save_stdout sys.stderr = self.save_stderr sys.stdin = self.save_stdin ...
[ "def", "_close", "(", "self", ")", ":", "self", ".", "close_debugger", "(", ")", "if", "use_subprocess", ":", "self", ".", "interp", ".", "kill_subprocess", "(", ")", "sys", ".", "stdout", "=", "self", ".", "save_stdout", "sys", ".", "stderr", "=", "se...
https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/idlelib/PyShell.py#L871-L884
insarlab/MintPy
4357b8c726dec8a3f936770e3f3dda92882685b7
mintpy/tropo_pyaps3.py
python
check_exist_grib_file
(gfile_list, print_msg=True)
return gfile_exist
Check input list of grib files, and return the existing ones with right size.
Check input list of grib files, and return the existing ones with right size.
[ "Check", "input", "list", "of", "grib", "files", "and", "return", "the", "existing", "ones", "with", "right", "size", "." ]
def check_exist_grib_file(gfile_list, print_msg=True): """Check input list of grib files, and return the existing ones with right size.""" gfile_exist = ut.get_file_list(gfile_list) if gfile_exist: file_sizes = [os.path.getsize(i) for i in gfile_exist] # if os.path.getsize(i) > 10e6] if file...
[ "def", "check_exist_grib_file", "(", "gfile_list", ",", "print_msg", "=", "True", ")", ":", "gfile_exist", "=", "ut", ".", "get_file_list", "(", "gfile_list", ")", "if", "gfile_exist", ":", "file_sizes", "=", "[", "os", ".", "path", ".", "getsize", "(", "i...
https://github.com/insarlab/MintPy/blob/4357b8c726dec8a3f936770e3f3dda92882685b7/mintpy/tropo_pyaps3.py#L476-L507
mortcanty/CRCPython
35d0e9f96befd38d4a78671c868128440c74b0e6
src/auxil/png.py
python
read_pnm_header
(infile, supported=('P5','P6'))
return header[0], header[1], header[2], depth, header[3]
Read a PNM header, returning (format,width,height,depth,maxval). `width` and `height` are in pixels. `depth` is the number of channels in the image; for PBM and PGM it is synthesized as 1, for PPM as 3; for PAM images it is read from the header. `maxval` is synthesized (as 1) for PBM images.
Read a PNM header, returning (format,width,height,depth,maxval). `width` and `height` are in pixels. `depth` is the number of channels in the image; for PBM and PGM it is synthesized as 1, for PPM as 3; for PAM images it is read from the header. `maxval` is synthesized (as 1) for PBM images.
[ "Read", "a", "PNM", "header", "returning", "(", "format", "width", "height", "depth", "maxval", ")", ".", "width", "and", "height", "are", "in", "pixels", ".", "depth", "is", "the", "number", "of", "channels", "in", "the", "image", ";", "for", "PBM", "...
def read_pnm_header(infile, supported=('P5','P6')): """ Read a PNM header, returning (format,width,height,depth,maxval). `width` and `height` are in pixels. `depth` is the number of channels in the image; for PBM and PGM it is synthesized as 1, for PPM as 3; for PAM images it is read from the heade...
[ "def", "read_pnm_header", "(", "infile", ",", "supported", "=", "(", "'P5'", ",", "'P6'", ")", ")", ":", "# Generally, see http://netpbm.sourceforge.net/doc/ppm.html", "# and http://netpbm.sourceforge.net/doc/pam.html", "# Technically 'P7' must be followed by a newline, so by using",...
https://github.com/mortcanty/CRCPython/blob/35d0e9f96befd38d4a78671c868128440c74b0e6/src/auxil/png.py#L3160-L3235
adamcaudill/EquationGroupLeak
52fa871c89008566c27159bd48f2a8641260c984
Firewall/SCRIPTS/fw_wrapper/bananaglee.py
python
BananaGlee.do_shell
(self, module)
return
shell drops user to a BANANAGLEE shell
shell drops user to a BANANAGLEE shell
[ "shell", "drops", "user", "to", "a", "BANANAGLEE", "shell" ]
def do_shell(self, module): '''shell drops user to a BANANAGLEE shell''' self.logger.debug('user ran shell') tunnel_number = tools.openTunnel(self.sfile, self.logger) command = str(self.sfile['lp_bin']) + ' --lp ' + str(self.sfile['lp']) + ' --implant ' + str(self.sfile['implant'...
[ "def", "do_shell", "(", "self", ",", "module", ")", ":", "self", ".", "logger", ".", "debug", "(", "'user ran shell'", ")", "tunnel_number", "=", "tools", ".", "openTunnel", "(", "self", ".", "sfile", ",", "self", ".", "logger", ")", "command", "=", "s...
https://github.com/adamcaudill/EquationGroupLeak/blob/52fa871c89008566c27159bd48f2a8641260c984/Firewall/SCRIPTS/fw_wrapper/bananaglee.py#L517-L549
TkTech/notifico
484c411cba3cc00b69dbf462c2f038a2d9a44f84
notifico/services/hooks/bitbucket.py
python
BitbucketHook.form
(cls)
return BitbucketConfigForm
[]
def form(cls): return BitbucketConfigForm
[ "def", "form", "(", "cls", ")", ":", "return", "BitbucketConfigForm" ]
https://github.com/TkTech/notifico/blob/484c411cba3cc00b69dbf462c2f038a2d9a44f84/notifico/services/hooks/bitbucket.py#L199-L200
sk1418/zhuaxia
dbe310d5fee6525ee2880c06ba6d59cbe3d54206
zhuaxia/obj.py
python
Song.post_set
(self)
set type_txt, filename, abs_path
set type_txt, filename, abs_path
[ "set", "type_txt", "filename", "abs_path" ]
def post_set(self): """ set type_txt, filename, abs_path """ if self.song_name: artist_part = (self.artist_name + u"_") if self.artist_name else "" self.filename = artist_part + self.song_name + u'.mp3' self.lyric_filename = artist_part + self.song_name + u'.lrc' ...
[ "def", "post_set", "(", "self", ")", ":", "if", "self", ".", "song_name", ":", "artist_part", "=", "(", "self", ".", "artist_name", "+", "u\"_\"", ")", "if", "self", ".", "artist_name", "else", "\"\"", "self", ".", "filename", "=", "artist_part", "+", ...
https://github.com/sk1418/zhuaxia/blob/dbe310d5fee6525ee2880c06ba6d59cbe3d54206/zhuaxia/obj.py#L92-L109
google/clusterfuzz
f358af24f414daa17a3649b143e71ea71871ef59
src/appengine/handlers/cron/helpers/bot_manager.py
python
Resource.exists
(self)
Return whether or not the resource exists.
Return whether or not the resource exists.
[ "Return", "whether", "or", "not", "the", "resource", "exists", "." ]
def exists(self): """Return whether or not the resource exists.""" try: self.get() return True except NotFoundError: return False
[ "def", "exists", "(", "self", ")", ":", "try", ":", "self", ".", "get", "(", ")", "return", "True", "except", "NotFoundError", ":", "return", "False" ]
https://github.com/google/clusterfuzz/blob/f358af24f414daa17a3649b143e71ea71871ef59/src/appengine/handlers/cron/helpers/bot_manager.py#L106-L112
google/encrypted-bigquery-client
ff5ec7cd27d4c305cd039639d058a3be47c12604
src/load_lib.py
python
_ValidateExtendedSchema
(schema)
Validates extended bigquery table schema. Does some basic checks to catch errors in extended table schema. It checks that an 'encrypt' subfield is entered for each field. Args: schema: extended bigquery table schema. Raises: EncryptConvertError: when schema contains unexpected types.
Validates extended bigquery table schema.
[ "Validates", "extended", "bigquery", "table", "schema", "." ]
def _ValidateExtendedSchema(schema): """Validates extended bigquery table schema. Does some basic checks to catch errors in extended table schema. It checks that an 'encrypt' subfield is entered for each field. Args: schema: extended bigquery table schema. Raises: EncryptConvertError: when schema con...
[ "def", "_ValidateExtendedSchema", "(", "schema", ")", ":", "for", "column", "in", "schema", ":", "if", "not", "isinstance", "(", "column", ",", "dict", ")", ":", "raise", "EncryptConvertError", "(", "'found a non dictionary element in schema: %s'", "%", "column", ...
https://github.com/google/encrypted-bigquery-client/blob/ff5ec7cd27d4c305cd039639d058a3be47c12604/src/load_lib.py#L182-L254
bert-nmt/bert-nmt
fcb616d28091ac23c9c16f30e6870fe90b8576d6
fairseq/progress_bar.py
python
format_stat
(stat)
return stat
[]
def format_stat(stat): if isinstance(stat, Number): stat = '{:g}'.format(stat) elif isinstance(stat, AverageMeter): stat = '{:.3f}'.format(stat.avg) elif isinstance(stat, TimeMeter): stat = '{:g}'.format(round(stat.avg)) elif isinstance(stat, StopwatchMeter): stat = '{:g}...
[ "def", "format_stat", "(", "stat", ")", ":", "if", "isinstance", "(", "stat", ",", "Number", ")", ":", "stat", "=", "'{:g}'", ".", "format", "(", "stat", ")", "elif", "isinstance", "(", "stat", ",", "AverageMeter", ")", ":", "stat", "=", "'{:.3f}'", ...
https://github.com/bert-nmt/bert-nmt/blob/fcb616d28091ac23c9c16f30e6870fe90b8576d6/fairseq/progress_bar.py#L59-L68
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/pkgutil.py
python
walk_packages
(path=None, prefix='', onerror=None)
Yields (module_loader, name, ispkg) for all modules recursively on path, or, if path is None, all accessible modules. 'path' should be either None or a list of paths to look for modules in. 'prefix' is a string to output on the front of every module name on output. Note that this function mus...
Yields (module_loader, name, ispkg) for all modules recursively on path, or, if path is None, all accessible modules.
[ "Yields", "(", "module_loader", "name", "ispkg", ")", "for", "all", "modules", "recursively", "on", "path", "or", "if", "path", "is", "None", "all", "accessible", "modules", "." ]
def walk_packages(path=None, prefix='', onerror=None): """Yields (module_loader, name, ispkg) for all modules recursively on path, or, if path is None, all accessible modules. 'path' should be either None or a list of paths to look for modules in. 'prefix' is a string to output on the front of eve...
[ "def", "walk_packages", "(", "path", "=", "None", ",", "prefix", "=", "''", ",", "onerror", "=", "None", ")", ":", "def", "seen", "(", "p", ",", "m", "=", "{", "}", ")", ":", "if", "p", "in", "m", ":", "return", "True", "m", "[", "p", "]", ...
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/pkgutil.py#L71-L126
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/Ubuntu_13/paramiko/rsakey.py
python
RSAKey.can_sign
(self)
return self.d is not None
[]
def can_sign(self): return self.d is not None
[ "def", "can_sign", "(", "self", ")", ":", "return", "self", ".", "d", "is", "not", "None" ]
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Ubuntu_13/paramiko/rsakey.py#L85-L86
brandon-rhodes/python-sgp4
7f3319534852791d60e34efc1b83340cf4a7fc76
sgp4/io.py
python
compute_checksum
(line)
return sum((int(c) if c.isdigit() else c == '-') for c in line[0:68]) % 10
Compute the TLE checksum for the given line.
Compute the TLE checksum for the given line.
[ "Compute", "the", "TLE", "checksum", "for", "the", "given", "line", "." ]
def compute_checksum(line): """Compute the TLE checksum for the given line.""" return sum((int(c) if c.isdigit() else c == '-') for c in line[0:68]) % 10
[ "def", "compute_checksum", "(", "line", ")", ":", "return", "sum", "(", "(", "int", "(", "c", ")", "if", "c", ".", "isdigit", "(", ")", "else", "c", "==", "'-'", ")", "for", "c", "in", "line", "[", "0", ":", "68", "]", ")", "%", "10" ]
https://github.com/brandon-rhodes/python-sgp4/blob/7f3319534852791d60e34efc1b83340cf4a7fc76/sgp4/io.py#L268-L270
microsoft/debugpy
be8dd607f6837244e0b565345e497aff7a0c08bf
src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/window.py
python
Window.get_parent
(self)
@see: L{get_children} @rtype: L{Window} or None @return: Parent window. Returns C{None} if the window has no parent. @raise WindowsError: An error occured while processing this request.
[]
def get_parent(self): """ @see: L{get_children} @rtype: L{Window} or None @return: Parent window. Returns C{None} if the window has no parent. @raise WindowsError: An error occured while processing this request. """ hWnd = win32.GetParent( self.get_handle() ) ...
[ "def", "get_parent", "(", "self", ")", ":", "hWnd", "=", "win32", ".", "GetParent", "(", "self", ".", "get_handle", "(", ")", ")", "if", "hWnd", ":", "return", "self", ".", "__get_window", "(", "hWnd", ")" ]
https://github.com/microsoft/debugpy/blob/be8dd607f6837244e0b565345e497aff7a0c08bf/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/window.py#L425-L434
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
apps/beeswax/gen-py/hive_metastore/ThriftHiveMetastore.py
python
Client.rename_partition
(self, db_name, tbl_name, part_vals, new_part)
Parameters: - db_name - tbl_name - part_vals - new_part
Parameters: - db_name - tbl_name - part_vals - new_part
[ "Parameters", ":", "-", "db_name", "-", "tbl_name", "-", "part_vals", "-", "new_part" ]
def rename_partition(self, db_name, tbl_name, part_vals, new_part): """ Parameters: - db_name - tbl_name - part_vals - new_part """ self.send_rename_partition(db_name, tbl_name, part_vals, new_part) self.recv_rename_partition()
[ "def", "rename_partition", "(", "self", ",", "db_name", ",", "tbl_name", ",", "part_vals", ",", "new_part", ")", ":", "self", ".", "send_rename_partition", "(", "db_name", ",", "tbl_name", ",", "part_vals", ",", "new_part", ")", "self", ".", "recv_rename_parti...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/apps/beeswax/gen-py/hive_metastore/ThriftHiveMetastore.py#L4038-L4048
CedricGuillemet/Imogen
ee417b42747ed5b46cb11b02ef0c3630000085b3
bin/Lib/_pydecimal.py
python
Context.divmod
(self, a, b)
Return (a // b, a % b). >>> ExtendedContext.divmod(Decimal(8), Decimal(3)) (Decimal('2'), Decimal('2')) >>> ExtendedContext.divmod(Decimal(8), Decimal(4)) (Decimal('2'), Decimal('0')) >>> ExtendedContext.divmod(8, 4) (Decimal('2'), Decimal('0')) >>> ExtendedConte...
Return (a // b, a % b).
[ "Return", "(", "a", "//", "b", "a", "%", "b", ")", "." ]
def divmod(self, a, b): """Return (a // b, a % b). >>> ExtendedContext.divmod(Decimal(8), Decimal(3)) (Decimal('2'), Decimal('2')) >>> ExtendedContext.divmod(Decimal(8), Decimal(4)) (Decimal('2'), Decimal('0')) >>> ExtendedContext.divmod(8, 4) (Decimal('2'), Deci...
[ "def", "divmod", "(", "self", ",", "a", ",", "b", ")", ":", "a", "=", "_convert_other", "(", "a", ",", "raiseit", "=", "True", ")", "r", "=", "a", ".", "__divmod__", "(", "b", ",", "context", "=", "self", ")", "if", "r", "is", "NotImplemented", ...
https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/_pydecimal.py#L4414-L4433
microsoft/unilm
65f15af2a307ebb64cfb25adf54375b002e6fe8d
infoxlm/fairseq/fairseq/models/fairseq_decoder.py
python
FairseqDecoder.max_positions
(self)
return 1e6
Maximum input length supported by the decoder.
Maximum input length supported by the decoder.
[ "Maximum", "input", "length", "supported", "by", "the", "decoder", "." ]
def max_positions(self): """Maximum input length supported by the decoder.""" return 1e6
[ "def", "max_positions", "(", "self", ")", ":", "return", "1e6" ]
https://github.com/microsoft/unilm/blob/65f15af2a307ebb64cfb25adf54375b002e6fe8d/infoxlm/fairseq/fairseq/models/fairseq_decoder.py#L72-L74
mgear-dev/mgear
06ddc26c5adb5eab07ca470c7fafa77404c8a1de
scripts/mgear/maya/shifter/guide.py
python
Main.addPropertyParamenters
(self, parent)
return parent
Add attributes from the parameter definition list Arguments: parent (dagNode): The object to add the attributes. Returns: dagNode: parent with the attributes.
Add attributes from the parameter definition list
[ "Add", "attributes", "from", "the", "parameter", "definition", "list" ]
def addPropertyParamenters(self, parent): """Add attributes from the parameter definition list Arguments: parent (dagNode): The object to add the attributes. Returns: dagNode: parent with the attributes. """ for scriptName in self.paramNames: ...
[ "def", "addPropertyParamenters", "(", "self", ",", "parent", ")", ":", "for", "scriptName", "in", "self", ".", "paramNames", ":", "paramDef", "=", "self", ".", "paramDefs", "[", "scriptName", "]", "paramDef", ".", "create", "(", "parent", ")", "return", "p...
https://github.com/mgear-dev/mgear/blob/06ddc26c5adb5eab07ca470c7fafa77404c8a1de/scripts/mgear/maya/shifter/guide.py#L62-L77
ocelma/python-recsys
6c6343c6f57271e745773ab6aefea0a5d29f0620
recsys/evaluation/baseclass.py
python
Evaluation.load
(self, ground_truth, test)
Loads both the ground truth and the test lists. The two lists must have the same length. :param ground_truth: a list of real values (aka ground truth). E.g: [3.0, 1.0, 5.0, 2.0, 3.0] :type ground_truth: list :param test: a list of predicted values. E.g: [2.3, 0.9, 4.9, 0.9, 1.5] :type ...
Loads both the ground truth and the test lists. The two lists must have the same length.
[ "Loads", "both", "the", "ground", "truth", "and", "the", "test", "lists", ".", "The", "two", "lists", "must", "have", "the", "same", "length", "." ]
def load(self, ground_truth, test): """ Loads both the ground truth and the test lists. The two lists must have the same length. :param ground_truth: a list of real values (aka ground truth). E.g: [3.0, 1.0, 5.0, 2.0, 3.0] :type ground_truth: list :param test: a list of predicte...
[ "def", "load", "(", "self", ",", "ground_truth", ",", "test", ")", ":", "self", ".", "load_ground_truth", "(", "ground_truth", ")", "self", ".", "load_test", "(", "test", ")" ]
https://github.com/ocelma/python-recsys/blob/6c6343c6f57271e745773ab6aefea0a5d29f0620/recsys/evaluation/baseclass.py#L64-L74
ARM-DOE/pyart
72affe5b669f1996cd3cc39ec7d8dd29b838bd48
pyart/correct/dealias.py
python
dealias_fourdd
( radar, last_radar=None, sonde_profile=None, gatefilter=False, filt=1, rsl_badval=131072.0, keep_original=False, set_limits=True, vel_field=None, corr_vel_field=None, last_vel_field=None, debug=False, max_shear=0.05, sign=1, **kwargs)
return vr_corr
Dealias Doppler velocities using the 4DD algorithm. Dealias the Doppler velocities field using the University of Washington 4DD algorithm utilizing information from a previous volume scan and/or sounding data. Either last_radar or sonde_profile must be provided. For best results provide both a previous...
Dealias Doppler velocities using the 4DD algorithm.
[ "Dealias", "Doppler", "velocities", "using", "the", "4DD", "algorithm", "." ]
def dealias_fourdd( radar, last_radar=None, sonde_profile=None, gatefilter=False, filt=1, rsl_badval=131072.0, keep_original=False, set_limits=True, vel_field=None, corr_vel_field=None, last_vel_field=None, debug=False, max_shear=0.05, sign=1, **kwargs): """ Dealias Doppler veloc...
[ "def", "dealias_fourdd", "(", "radar", ",", "last_radar", "=", "None", ",", "sonde_profile", "=", "None", ",", "gatefilter", "=", "False", ",", "filt", "=", "1", ",", "rsl_badval", "=", "131072.0", ",", "keep_original", "=", "False", ",", "set_limits", "="...
https://github.com/ARM-DOE/pyart/blob/72affe5b669f1996cd3cc39ec7d8dd29b838bd48/pyart/correct/dealias.py#L19-L244
salabim/salabim
e0de846b042daf2dc71aaf43d8adc6486b57f376
salabim_exp.py
python
test39
()
[]
def test39(): class C(sim.Component): def process(self): yield self.request(r, s="y") env = sim.Environment(trace=True) x = sim.Uniform(4) r = sim.Resource() C() env.run(4)
[ "def", "test39", "(", ")", ":", "class", "C", "(", "sim", ".", "Component", ")", ":", "def", "process", "(", "self", ")", ":", "yield", "self", ".", "request", "(", "r", ",", "s", "=", "\"y\"", ")", "env", "=", "sim", ".", "Environment", "(", "...
https://github.com/salabim/salabim/blob/e0de846b042daf2dc71aaf43d8adc6486b57f376/salabim_exp.py#L3083-L3092
vinojjayasundara/textcaps
ca9c1988b19618d578d22aab854b1b5843a5d0d1
textcaps_emnist_bal.py
python
dataGeneration.remove_missclassifications
(self)
return (x_train, y_train), (x_test, y_test), x_recon
Removing the wrongly classified samples from the training set. We do not alter the testing set. :return: dataset with miss classified samples removed and the initial reconstructions.
Removing the wrongly classified samples from the training set. We do not alter the testing set. :return: dataset with miss classified samples removed and the initial reconstructions.
[ "Removing", "the", "wrongly", "classified", "samples", "from", "the", "training", "set", ".", "We", "do", "not", "alter", "the", "testing", "set", ".", ":", "return", ":", "dataset", "with", "miss", "classified", "samples", "removed", "and", "the", "initial"...
def remove_missclassifications(self): """ Removing the wrongly classified samples from the training set. We do not alter the testing set. :return: dataset with miss classified samples removed and the initial reconstructions. """ model = self.model data = self.data ...
[ "def", "remove_missclassifications", "(", "self", ")", ":", "model", "=", "self", ".", "model", "data", "=", "self", ".", "data", "args", "=", "self", ".", "args", "(", "x_train", ",", "y_train", ")", ",", "(", "x_test", ",", "y_test", ")", "=", "dat...
https://github.com/vinojjayasundara/textcaps/blob/ca9c1988b19618d578d22aab854b1b5843a5d0d1/textcaps_emnist_bal.py#L183-L201
equinor/segyio
a98c2bc21d238de00b9b65be331d7a011d8a6372
python/segyio/trace.py
python
Trace.__setitem__
(self, i, val)
trace[i] = val Write the ith trace of the file, starting at 0. It accepts any array_like, but val must be at least as big as the underlying data trace. If val is longer than the underlying trace, it is essentially truncated. For the best performance, val should be a nu...
trace[i] = val
[ "trace", "[", "i", "]", "=", "val" ]
def __setitem__(self, i, val): """trace[i] = val Write the ith trace of the file, starting at 0. It accepts any array_like, but val must be at least as big as the underlying data trace. If val is longer than the underlying trace, it is essentially truncated. Fo...
[ "def", "__setitem__", "(", "self", ",", "i", ",", "val", ")", ":", "if", "isinstance", "(", "i", ",", "slice", ")", ":", "for", "j", ",", "x", "in", "zip", "(", "range", "(", "*", "i", ".", "indices", "(", "len", "(", "self", ")", ")", ")", ...
https://github.com/equinor/segyio/blob/a98c2bc21d238de00b9b65be331d7a011d8a6372/python/segyio/trace.py#L236-L290
googleapis/python-dialogflow
e48ea001b7c8a4a5c1fe4b162bad49ea397458e9
google/cloud/dialogflow_v2beta1/services/answer_records/client.py
python
AnswerRecordsClient.answer_record_path
(project: str, answer_record: str,)
return "projects/{project}/answerRecords/{answer_record}".format( project=project, answer_record=answer_record, )
Returns a fully-qualified answer_record string.
Returns a fully-qualified answer_record string.
[ "Returns", "a", "fully", "-", "qualified", "answer_record", "string", "." ]
def answer_record_path(project: str, answer_record: str,) -> str: """Returns a fully-qualified answer_record string.""" return "projects/{project}/answerRecords/{answer_record}".format( project=project, answer_record=answer_record, )
[ "def", "answer_record_path", "(", "project", ":", "str", ",", "answer_record", ":", "str", ",", ")", "->", "str", ":", "return", "\"projects/{project}/answerRecords/{answer_record}\"", ".", "format", "(", "project", "=", "project", ",", "answer_record", "=", "answ...
https://github.com/googleapis/python-dialogflow/blob/e48ea001b7c8a4a5c1fe4b162bad49ea397458e9/google/cloud/dialogflow_v2beta1/services/answer_records/client.py#L166-L170
apple/ccs-calendarserver
13c706b985fb728b9aab42dc0fef85aae21921c3
simplugin/caldavclient.py
python
BaseAppleClient.addInvite
(self, href, component)
Add an event that is an invite - i.e., has attendees. We will do attendee lookups and freebusy checks on each attendee to simulate what happens when an organizer creates a new invite.
Add an event that is an invite - i.e., has attendees. We will do attendee lookups and freebusy checks on each attendee to simulate what happens when an organizer creates a new invite.
[ "Add", "an", "event", "that", "is", "an", "invite", "-", "i", ".", "e", ".", "has", "attendees", ".", "We", "will", "do", "attendee", "lookups", "and", "freebusy", "checks", "on", "each", "attendee", "to", "simulate", "what", "happens", "when", "an", "...
def addInvite(self, href, component): """ Add an event that is an invite - i.e., has attendees. We will do attendee lookups and freebusy checks on each attendee to simulate what happens when an organizer creates a new invite. """ # Do lookup and free busy of each attendee (not s...
[ "def", "addInvite", "(", "self", ",", "href", ",", "component", ")", ":", "# Do lookup and free busy of each attendee (not self)", "attendees", "=", "list", "(", "component", ".", "mainComponent", "(", ")", ".", "properties", "(", "'ATTENDEE'", ")", ")", "for", ...
https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/simplugin/caldavclient.py#L1562-L1576
shawn-sterling/graphios
f5f0a1da1a3bcfd4204c13a8d3b68be27e55b4ec
graphios_backends.py
python
influxdb.build_path
(self, m)
return path
Returns a path
Returns a path
[ "Returns", "a", "path" ]
def build_path(self, m): """ Returns a path """ path = "" if m.METRICBASEPATH != "": path += "%s." % m.METRICBASEPATH if m.GRAPHITEPREFIX != "": path += "%s." % m.GRAPHITEPREFIX path += "%s." % m.HOSTNAME if m.SERVICEDESC != "": path...
[ "def", "build_path", "(", "self", ",", "m", ")", ":", "path", "=", "\"\"", "if", "m", ".", "METRICBASEPATH", "!=", "\"\"", ":", "path", "+=", "\"%s.\"", "%", "m", ".", "METRICBASEPATH", "if", "m", ".", "GRAPHITEPREFIX", "!=", "\"\"", ":", "path", "+=...
https://github.com/shawn-sterling/graphios/blob/f5f0a1da1a3bcfd4204c13a8d3b68be27e55b4ec/graphios_backends.py#L530-L549
beancount/beancount
cb3526a1af95b3b5be70347470c381b5a86055fe
experiments/docs_rst/convert_docs.py
python
GetDocxBlocks
(filename: str, convert: callable=None)
return blocks
Get the list of blocks formatted with a fixed-width font from the docs file. Note that this will include short blocks which aren't necessarily blockquotes.
Get the list of blocks formatted with a fixed-width font from the docs file. Note that this will include short blocks which aren't necessarily blockquotes.
[ "Get", "the", "list", "of", "blocks", "formatted", "with", "a", "fixed", "-", "width", "font", "from", "the", "docs", "file", ".", "Note", "that", "this", "will", "include", "short", "blocks", "which", "aren", "t", "necessarily", "blockquotes", "." ]
def GetDocxBlocks(filename: str, convert: callable=None) -> List[str]: """Get the list of blocks formatted with a fixed-width font from the docs file. Note that this will include short blocks which aren't necessarily blockquotes.""" with zipfile.ZipFile(filename, 'r') as myzip: with myzip.open('...
[ "def", "GetDocxBlocks", "(", "filename", ":", "str", ",", "convert", ":", "callable", "=", "None", ")", "->", "List", "[", "str", "]", ":", "with", "zipfile", ".", "ZipFile", "(", "filename", ",", "'r'", ")", "as", "myzip", ":", "with", "myzip", ".",...
https://github.com/beancount/beancount/blob/cb3526a1af95b3b5be70347470c381b5a86055fe/experiments/docs_rst/convert_docs.py#L55-L93
golismero/golismero
7d605b937e241f51c1ca4f47b20f755eeefb9d76
thirdparty_libs/django/core/cache/backends/base.py
python
BaseCache.delete_many
(self, keys, version=None)
Set a bunch of values in the cache at once. For certain backends (memcached), this is much more efficient than calling delete() multiple times.
Set a bunch of values in the cache at once. For certain backends (memcached), this is much more efficient than calling delete() multiple times.
[ "Set", "a", "bunch", "of", "values", "in", "the", "cache", "at", "once", ".", "For", "certain", "backends", "(", "memcached", ")", "this", "is", "much", "more", "efficient", "than", "calling", "delete", "()", "multiple", "times", "." ]
def delete_many(self, keys, version=None): """ Set a bunch of values in the cache at once. For certain backends (memcached), this is much more efficient than calling delete() multiple times. """ for key in keys: self.delete(key, version=version)
[ "def", "delete_many", "(", "self", ",", "keys", ",", "version", "=", "None", ")", ":", "for", "key", "in", "keys", ":", "self", ".", "delete", "(", "key", ",", "version", "=", "version", ")" ]
https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/django/core/cache/backends/base.py#L175-L182
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/models/roberta/modeling_roberta.py
python
RobertaAttention.__init__
(self, config, position_embedding_type=None)
[]
def __init__(self, config, position_embedding_type=None): super().__init__() self.self = RobertaSelfAttention(config, position_embedding_type=position_embedding_type) self.output = RobertaSelfOutput(config) self.pruned_heads = set()
[ "def", "__init__", "(", "self", ",", "config", ",", "position_embedding_type", "=", "None", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "self", "=", "RobertaSelfAttention", "(", "config", ",", "position_embedding_type", "=", "positio...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/roberta/modeling_roberta.py#L305-L309
harvard-lil/capstone
f15c98fce0b50b74616c40f862146d858b54be5d
capstone/scripts/extract_cites.py
python
clean_text
(text)
return text
Prepare text for cite extraction by normalizing punctuation and unicode characters. >>> assert clean_text("“”–—´ ‘ ’ñâüÍí") == '''""--' ' 'nauIi'''
Prepare text for cite extraction by normalizing punctuation and unicode characters. >>> assert clean_text("“”–—´ ‘ ’ñâüÍí") == '''""--' ' 'nauIi'''
[ "Prepare", "text", "for", "cite", "extraction", "by", "normalizing", "punctuation", "and", "unicode", "characters", ".", ">>>", "assert", "clean_text", "(", "“”–—´", "‘", "’ñâüÍí", ")", "==", "--", "nauIi" ]
def clean_text(text): """ Prepare text for cite extraction by normalizing punctuation and unicode characters. >>> assert clean_text("“”–—´ ‘ ’ñâüÍí") == '''""--' ' 'nauIi''' """ # normalize punctuation text = clean_punctuation(text) # strip unicode Nonspacing Marks (umlauts, accents,...
[ "def", "clean_text", "(", "text", ")", ":", "# normalize punctuation", "text", "=", "clean_punctuation", "(", "text", ")", "# strip unicode Nonspacing Marks (umlauts, accents, etc., usually OCR speckles)", "text", "=", "''", ".", "join", "(", "c", "for", "c", "in", "u...
https://github.com/harvard-lil/capstone/blob/f15c98fce0b50b74616c40f862146d858b54be5d/capstone/scripts/extract_cites.py#L329-L338
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/cloud/clouds/virtualbox.py
python
list_nodes_full
(kwargs=None, call=None)
return machines
All information available about all nodes should be returned in this function. The fields in the list_nodes() function should also be returned, even if they would not normally be provided by the cloud provider. This is because some functions both within Salt and 3rd party will break if an expected field is...
All information available about all nodes should be returned in this function. The fields in the list_nodes() function should also be returned, even if they would not normally be provided by the cloud provider.
[ "All", "information", "available", "about", "all", "nodes", "should", "be", "returned", "in", "this", "function", ".", "The", "fields", "in", "the", "list_nodes", "()", "function", "should", "also", "be", "returned", "even", "if", "they", "would", "not", "no...
def list_nodes_full(kwargs=None, call=None): """ All information available about all nodes should be returned in this function. The fields in the list_nodes() function should also be returned, even if they would not normally be provided by the cloud provider. This is because some functions both wit...
[ "def", "list_nodes_full", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "==", "\"action\"", ":", "raise", "SaltCloudSystemExit", "(", "\"The list_nodes_full function must be called with -f or --function.\"", ")", "machines", "=", "{", ...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/cloud/clouds/virtualbox.py#L251-L287
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
dist/lib/python2.7/logging/__init__.py
python
Filterer.filter
(self, record)
return rv
Determine if a record is loggable by consulting all the filters. The default is to allow the record to be logged; any filter can veto this and the record is then dropped. Returns a zero value if a record is to be dropped, else non-zero.
Determine if a record is loggable by consulting all the filters.
[ "Determine", "if", "a", "record", "is", "loggable", "by", "consulting", "all", "the", "filters", "." ]
def filter(self, record): """ Determine if a record is loggable by consulting all the filters. The default is to allow the record to be logged; any filter can veto this and the record is then dropped. Returns a zero value if a record is to be dropped, else non-zero. """ ...
[ "def", "filter", "(", "self", ",", "record", ")", ":", "rv", "=", "1", "for", "f", "in", "self", ".", "filters", ":", "if", "not", "f", ".", "filter", "(", "record", ")", ":", "rv", "=", "0", "break", "return", "rv" ]
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/logging/__init__.py#L594-L607
jgyates/genmon
2cb2ed2945f55cd8c259b09ccfa9a51e23f1341e
genmonlib/custom_controller.py
python
CustomController.InitDevice
(self)
[]
def InitDevice(self): try: self.IdentifyController() self.MasterEmulation() self.SetupTiles() self.InitComplete = True self.InitCompleteEvent.set() except Exception as e1: self.LogErrorLine("Error in InitDevice: " + str(e1))
[ "def", "InitDevice", "(", "self", ")", ":", "try", ":", "self", ".", "IdentifyController", "(", ")", "self", ".", "MasterEmulation", "(", ")", "self", ".", "SetupTiles", "(", ")", "self", ".", "InitComplete", "=", "True", "self", ".", "InitCompleteEvent", ...
https://github.com/jgyates/genmon/blob/2cb2ed2945f55cd8c259b09ccfa9a51e23f1341e/genmonlib/custom_controller.py#L217-L226
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/database_migration/database_migration_client_composite_operations.py
python
DatabaseMigrationClientCompositeOperations.delete_job_and_wait_for_state
(self, job_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={})
Calls :py:func:`~oci.database_migration.DatabaseMigrationClient.delete_job` and waits for the :py:class:`~oci.database_migration.models.Job` acted upon to enter the given state(s). :param str job_id: (required) The OCID of the job :param list[str] wait_for_states: An ar...
Calls :py:func:`~oci.database_migration.DatabaseMigrationClient.delete_job` and waits for the :py:class:`~oci.database_migration.models.Job` acted upon to enter the given state(s).
[ "Calls", ":", "py", ":", "func", ":", "~oci", ".", "database_migration", ".", "DatabaseMigrationClient", ".", "delete_job", "and", "waits", "for", "the", ":", "py", ":", "class", ":", "~oci", ".", "database_migration", ".", "models", ".", "Job", "acted", "...
def delete_job_and_wait_for_state(self, job_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.database_migration.DatabaseMigrationClient.delete_job` and waits for the :py:class:`~oci.database_migration.models.Job` acted upon to enter the given state(s). ...
[ "def", "delete_job_and_wait_for_state", "(", "self", ",", "job_id", ",", "wait_for_states", "=", "[", "]", ",", "operation_kwargs", "=", "{", "}", ",", "waiter_kwargs", "=", "{", "}", ")", ":", "initial_get_result", "=", "self", ".", "client", ".", "get_job"...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/database_migration/database_migration_client_composite_operations.py#L273-L318
google/grr
8ad8a4d2c5a93c92729206b7771af19d92d4f915
grr/server/grr_response_server/gui/api_plugins/hunt.py
python
ApiListHuntErrorsHandler._MatchFlowAgainstFilter
(self, flow_obj, filter_str)
return False
[]
def _MatchFlowAgainstFilter(self, flow_obj, filter_str): for attr in self._FLOW_ATTRS_TO_MATCH: if filter_str in flow_obj.Get(attr): return True return False
[ "def", "_MatchFlowAgainstFilter", "(", "self", ",", "flow_obj", ",", "filter_str", ")", ":", "for", "attr", "in", "self", ".", "_FLOW_ATTRS_TO_MATCH", ":", "if", "filter_str", "in", "flow_obj", ".", "Get", "(", "attr", ")", ":", "return", "True", "return", ...
https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/gui/api_plugins/hunt.py#L802-L807
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/google/appengine/api/blobstore/blobstore_stub.py
python
BlobstoreServiceStub.storage
(self)
return self.__storage
Access BlobStorage used by service stub. Returns: BlobStorage instance used by blobstore service stub.
Access BlobStorage used by service stub.
[ "Access", "BlobStorage", "used", "by", "service", "stub", "." ]
def storage(self): """Access BlobStorage used by service stub. Returns: BlobStorage instance used by blobstore service stub. """ return self.__storage
[ "def", "storage", "(", "self", ")", ":", "return", "self", ".", "__storage" ]
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/api/blobstore/blobstore_stub.py#L208-L214
KalleHallden/AutoTimer
2d954216700c4930baa154e28dbddc34609af7ce
env/lib/python2.7/site-packages/objc/_convenience_nsobject.py
python
kvc.__getattr__
(self, key)
[]
def __getattr__(self, key): try: return self.__object.valueForKey_(key) except KeyError as msg: if (hasattr(msg, '_pyobjc_info_') and msg._pyobjc_info_['name'] == 'NSUnknownKeyException'): raise AttributeError(key) raise
[ "def", "__getattr__", "(", "self", ",", "key", ")", ":", "try", ":", "return", "self", ".", "__object", ".", "valueForKey_", "(", "key", ")", "except", "KeyError", "as", "msg", ":", "if", "(", "hasattr", "(", "msg", ",", "'_pyobjc_info_'", ")", "and", ...
https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/objc/_convenience_nsobject.py#L75-L83
pm4py/pm4py-core
7807b09a088b02199cd0149d724d0e28793971bf
pm4py/objects/log/util/prefix_matrix.py
python
get_variants_matrix_from_variants_list
(variants_list, activities, parameters=None)
return variants_mat, activities
Gets a numeric matrix where each row is associated to a different set of activities happening in the (complete) variants of the log, along with the count of the particular situation Parameters ------------- variants_list List of variants contained in the log, along with their count acti...
Gets a numeric matrix where each row is associated to a different set of activities happening in the (complete) variants of the log, along with the count of the particular situation
[ "Gets", "a", "numeric", "matrix", "where", "each", "row", "is", "associated", "to", "a", "different", "set", "of", "activities", "happening", "in", "the", "(", "complete", ")", "variants", "of", "the", "log", "along", "with", "the", "count", "of", "the", ...
def get_variants_matrix_from_variants_list(variants_list, activities, parameters=None): """ Gets a numeric matrix where each row is associated to a different set of activities happening in the (complete) variants of the log, along with the count of the particular situation Parameters ----------...
[ "def", "get_variants_matrix_from_variants_list", "(", "variants_list", ",", "activities", ",", "parameters", "=", "None", ")", ":", "if", "parameters", "is", "None", ":", "parameters", "=", "{", "}", "keep_unique", "=", "parameters", "[", "KEEP_UNIQUE", "]", "if...
https://github.com/pm4py/pm4py-core/blob/7807b09a088b02199cd0149d724d0e28793971bf/pm4py/objects/log/util/prefix_matrix.py#L33-L68
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/django/db/backends/sqlite3/introspection.py
python
DatabaseIntrospection.get_relations
(self, cursor, table_name)
return relations
Return a dictionary of {field_name: (field_name_other_table, other_table)} representing all relationships to the given table.
Return a dictionary of {field_name: (field_name_other_table, other_table)} representing all relationships to the given table.
[ "Return", "a", "dictionary", "of", "{", "field_name", ":", "(", "field_name_other_table", "other_table", ")", "}", "representing", "all", "relationships", "to", "the", "given", "table", "." ]
def get_relations(self, cursor, table_name): """ Return a dictionary of {field_name: (field_name_other_table, other_table)} representing all relationships to the given table. """ # Dictionary of relations to return relations = {} # Schema for this table c...
[ "def", "get_relations", "(", "self", ",", "cursor", ",", "table_name", ")", ":", "# Dictionary of relations to return", "relations", "=", "{", "}", "# Schema for this table", "cursor", ".", "execute", "(", "\"SELECT sql FROM sqlite_master WHERE tbl_name = %s AND type = %s\"",...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/db/backends/sqlite3/introspection.py#L101-L154
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/django/db/models/sql/query.py
python
Query.has_results
(self, using)
return compiler.has_results()
[]
def has_results(self, using): q = self.clone() if not q.distinct: if q.group_by is True: q.add_fields((f.attname for f in self.model._meta.concrete_fields), False) q.set_group_by() q.clear_select_clause() q.clear_ordering(True) q.se...
[ "def", "has_results", "(", "self", ",", "using", ")", ":", "q", "=", "self", ".", "clone", "(", ")", "if", "not", "q", ".", "distinct", ":", "if", "q", ".", "group_by", "is", "True", ":", "q", ".", "add_fields", "(", "(", "f", ".", "attname", "...
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/db/models/sql/query.py#L507-L517
rembo10/headphones
b3199605be1ebc83a7a8feab6b1e99b64014187c
lib/cherrypy/lib/encoding.py
python
compress
(body, compress_level)
Compress 'body' at the given compress_level.
Compress 'body' at the given compress_level.
[ "Compress", "body", "at", "the", "given", "compress_level", "." ]
def compress(body, compress_level): """Compress 'body' at the given compress_level.""" import zlib # See http://www.gzip.org/zlib/rfc-gzip.html yield ntob('\x1f\x8b') # ID1 and ID2: gzip marker yield ntob('\x08') # CM: compression method yield ntob('\x00') # FLG: none ...
[ "def", "compress", "(", "body", ",", "compress_level", ")", ":", "import", "zlib", "# See http://www.gzip.org/zlib/rfc-gzip.html", "yield", "ntob", "(", "'\\x1f\\x8b'", ")", "# ID1 and ID2: gzip marker", "yield", "ntob", "(", "'\\x08'", ")", "# CM: compression method", ...
https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/cherrypy/lib/encoding.py#L271-L298
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/numpy/polynomial/laguerre.py
python
lagvander
(x, deg)
return np.rollaxis(v, 0, v.ndim)
Pseudo-Vandermonde matrix of given degree. Returns the pseudo-Vandermonde matrix of degree `deg` and sample points `x`. The pseudo-Vandermonde matrix is defined by .. math:: V[..., i] = L_i(x) where `0 <= i <= deg`. The leading indices of `V` index the elements of `x` and the last index is the de...
Pseudo-Vandermonde matrix of given degree.
[ "Pseudo", "-", "Vandermonde", "matrix", "of", "given", "degree", "." ]
def lagvander(x, deg) : """Pseudo-Vandermonde matrix of given degree. Returns the pseudo-Vandermonde matrix of degree `deg` and sample points `x`. The pseudo-Vandermonde matrix is defined by .. math:: V[..., i] = L_i(x) where `0 <= i <= deg`. The leading indices of `V` index the elements of `...
[ "def", "lagvander", "(", "x", ",", "deg", ")", ":", "ideg", "=", "int", "(", "deg", ")", "if", "ideg", "!=", "deg", ":", "raise", "ValueError", "(", "\"deg must be integer\"", ")", "if", "ideg", "<", "0", ":", "raise", "ValueError", "(", "\"deg must be...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/numpy/polynomial/laguerre.py#L1177-L1236
hyperspy/hyperspy
1ffb3fab33e607045a37f30c1463350b72617e10
hyperspy/drawing/signal1d.py
python
Signal1DLine.update
(self, force_replot=False, render_figure=True, update_ylimits=False)
Update the current spectrum figure Parameters ---------- force_replot : bool If True, close and open the figure. Default is False. render_figure : bool If True, render the figure. Useful to avoid firing matplotlib drawing events too often. Default is ...
Update the current spectrum figure
[ "Update", "the", "current", "spectrum", "figure" ]
def update(self, force_replot=False, render_figure=True, update_ylimits=False): """Update the current spectrum figure Parameters ---------- force_replot : bool If True, close and open the figure. Default is False. render_figure : bool If Tr...
[ "def", "update", "(", "self", ",", "force_replot", "=", "False", ",", "render_figure", "=", "True", ",", "update_ylimits", "=", "False", ")", ":", "if", "force_replot", "is", "True", ":", "self", ".", "close", "(", ")", "self", ".", "plot", "(", "data_...
https://github.com/hyperspy/hyperspy/blob/1ffb3fab33e607045a37f30c1463350b72617e10/hyperspy/drawing/signal1d.py#L452-L528
Tencent/bk-bcs-saas
2b437bf2f5fd5ce2078f7787c3a12df609f7679d
bcs-app/backend/components/paas_cc.py
python
get_project_nodes
(access_token, project_id, is_master=False)
return {info["inner_ip"]: True for info in data}
获取项目下已经添加的Master和Node
获取项目下已经添加的Master和Node
[ "获取项目下已经添加的Master和Node" ]
def get_project_nodes(access_token, project_id, is_master=False): """获取项目下已经添加的Master和Node""" # add filter for master or node # node filter # filter_status = [CommonStatus.InitialCheckFailed, CommonStatus.InitialFailed, CommonStatus.Removed] # if is_master: filter_status = [CommonStatus.Removed]...
[ "def", "get_project_nodes", "(", "access_token", ",", "project_id", ",", "is_master", "=", "False", ")", ":", "# add filter for master or node", "# node filter", "# filter_status = [CommonStatus.InitialCheckFailed, CommonStatus.InitialFailed, CommonStatus.Removed]", "# if is_master:", ...
https://github.com/Tencent/bk-bcs-saas/blob/2b437bf2f5fd5ce2078f7787c3a12df609f7679d/bcs-app/backend/components/paas_cc.py#L253-L278
iagcl/watchmen
d329b357e6fde3ad91e972988b160a33c12afc2a
elasticsearch/roll_indexes/packages/urllib3/packages/six.py
python
_SixMetaPathImporter.get_code
(self, fullname)
return None
Return None Required, if is_package is implemented
Return None
[ "Return", "None" ]
def get_code(self, fullname): """Return None Required, if is_package is implemented""" self.__get_module(fullname) # eventually raises ImportError return None
[ "def", "get_code", "(", "self", ",", "fullname", ")", ":", "self", ".", "__get_module", "(", "fullname", ")", "# eventually raises ImportError", "return", "None" ]
https://github.com/iagcl/watchmen/blob/d329b357e6fde3ad91e972988b160a33c12afc2a/elasticsearch/roll_indexes/packages/urllib3/packages/six.py#L218-L223
geekan/scrapy-examples
edb1cb116bd6def65a6ef01f953b58eb43e54305
underdev/twitch/twitch/pipelines.py
python
JsonWithEncodingPipeline.process_item
(self, item, spider)
return item
[]
def process_item(self, item, spider): line = json.dumps(OrderedDict(item), ensure_ascii=False, sort_keys=False) + "\n" self.file.write(line) return item
[ "def", "process_item", "(", "self", ",", "item", ",", "spider", ")", ":", "line", "=", "json", ".", "dumps", "(", "OrderedDict", "(", "item", ")", ",", "ensure_ascii", "=", "False", ",", "sort_keys", "=", "False", ")", "+", "\"\\n\"", "self", ".", "f...
https://github.com/geekan/scrapy-examples/blob/edb1cb116bd6def65a6ef01f953b58eb43e54305/underdev/twitch/twitch/pipelines.py#L22-L25
PixarAnimationStudios/OpenTimelineIO
990a54ccbe6488180a93753370fc87902b982962
src/py-opentimelineio/opentimelineio/hooks.py
python
available_hookscripts
()
return plugins.ActiveManifest().hook_scripts
Return the HookScripts objects that have been registered.
Return the HookScripts objects that have been registered.
[ "Return", "the", "HookScripts", "objects", "that", "have", "been", "registered", "." ]
def available_hookscripts(): """Return the HookScripts objects that have been registered.""" return plugins.ActiveManifest().hook_scripts
[ "def", "available_hookscripts", "(", ")", ":", "return", "plugins", ".", "ActiveManifest", "(", ")", ".", "hook_scripts" ]
https://github.com/PixarAnimationStudios/OpenTimelineIO/blob/990a54ccbe6488180a93753370fc87902b982962/src/py-opentimelineio/opentimelineio/hooks.py#L146-L148
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/sklearn/grid_search.py
python
BaseSearchCV.predict_log_proba
(self, X)
return self.best_estimator_.predict_log_proba(X)
Call predict_log_proba on the estimator with the best found parameters. Only available if ``refit=True`` and the underlying estimator supports ``predict_log_proba``. Parameters ----------- X : indexable, length n_samples Must fulfill the input assumptions of the ...
Call predict_log_proba on the estimator with the best found parameters.
[ "Call", "predict_log_proba", "on", "the", "estimator", "with", "the", "best", "found", "parameters", "." ]
def predict_log_proba(self, X): """Call predict_log_proba on the estimator with the best found parameters. Only available if ``refit=True`` and the underlying estimator supports ``predict_log_proba``. Parameters ----------- X : indexable, length n_samples Mu...
[ "def", "predict_log_proba", "(", "self", ",", "X", ")", ":", "return", "self", ".", "best_estimator_", ".", "predict_log_proba", "(", "X", ")" ]
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/sklearn/grid_search.py#L474-L487
PaddlePaddle/Research
2da0bd6c72d60e9df403aff23a7802779561c4a1
NLP/UNIMO/src/utils/optimization.py
python
optimization
(loss, warmup_steps, num_train_steps, learning_rate, train_program, weight_decay, scheduler='linear_warmup_decay', use_fp16=False, use_dynamic_loss_scaling=False, init...
return scheduled_lr, loss_scaling
optimization funxtion
optimization funxtion
[ "optimization", "funxtion" ]
def optimization(loss, warmup_steps, num_train_steps, learning_rate, train_program, weight_decay, scheduler='linear_warmup_decay', use_fp16=False, use_dynamic_loss_scaling=False, ...
[ "def", "optimization", "(", "loss", ",", "warmup_steps", ",", "num_train_steps", ",", "learning_rate", ",", "train_program", ",", "weight_decay", ",", "scheduler", "=", "'linear_warmup_decay'", ",", "use_fp16", "=", "False", ",", "use_dynamic_loss_scaling", "=", "Fa...
https://github.com/PaddlePaddle/Research/blob/2da0bd6c72d60e9df403aff23a7802779561c4a1/NLP/UNIMO/src/utils/optimization.py#L52-L139
clips/pattern
d25511f9ca7ed9356b801d8663b8b5168464e68f
pattern/text/search.py
python
find
(function, iterable)
Returns the first item in the list for which function(item) is True, None otherwise.
Returns the first item in the list for which function(item) is True, None otherwise.
[ "Returns", "the", "first", "item", "in", "the", "list", "for", "which", "function", "(", "item", ")", "is", "True", "None", "otherwise", "." ]
def find(function, iterable): """ Returns the first item in the list for which function(item) is True, None otherwise. """ for x in iterable: if function(x) is True: return x
[ "def", "find", "(", "function", ",", "iterable", ")", ":", "for", "x", "in", "iterable", ":", "if", "function", "(", "x", ")", "is", "True", ":", "return", "x" ]
https://github.com/clips/pattern/blob/d25511f9ca7ed9356b801d8663b8b5168464e68f/pattern/text/search.py#L145-L150
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/preview/understand/assistant/task/sample.py
python
SampleInstance.date_updated
(self)
return self._properties['date_updated']
:returns: The date that this resource was last updated :rtype: datetime
:returns: The date that this resource was last updated :rtype: datetime
[ ":", "returns", ":", "The", "date", "that", "this", "resource", "was", "last", "updated", ":", "rtype", ":", "datetime" ]
def date_updated(self): """ :returns: The date that this resource was last updated :rtype: datetime """ return self._properties['date_updated']
[ "def", "date_updated", "(", "self", ")", ":", "return", "self", ".", "_properties", "[", "'date_updated'", "]" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/preview/understand/assistant/task/sample.py#L391-L396
mesonbuild/meson
a22d0f9a0a787df70ce79b05d0c45de90a970048
mesonbuild/compilers/objcpp.py
python
ClangObjCPPCompiler.get_options
(self)
return opts
[]
def get_options(self) -> 'coredata.KeyedOptionDictType': opts = super().get_options() opts.update({ OptionKey('std', machine=self.for_machine, lang='cpp'): coredata.UserComboOption( 'C++ language standard to use', ['none', 'c++98', 'c++11', 'c++14', 'c++17', '...
[ "def", "get_options", "(", "self", ")", "->", "'coredata.KeyedOptionDictType'", ":", "opts", "=", "super", "(", ")", ".", "get_options", "(", ")", "opts", ".", "update", "(", "{", "OptionKey", "(", "'std'", ",", "machine", "=", "self", ".", "for_machine", ...
https://github.com/mesonbuild/meson/blob/a22d0f9a0a787df70ce79b05d0c45de90a970048/mesonbuild/compilers/objcpp.py#L88-L97
opendatateam/udata
a295cab3c0e8f086fea1853655011f361ac81b77
udata/features/transfer/actions.py
python
refuse_transfer
(transfer, comment=None)
return transfer
Refuse an incoming a transfer request
Refuse an incoming a transfer request
[ "Refuse", "an", "incoming", "a", "transfer", "request" ]
def refuse_transfer(transfer, comment=None): '''Refuse an incoming a transfer request''' TransferResponsePermission(transfer).test() transfer.responded = datetime.now() transfer.responder = current_user._get_current_object() transfer.status = 'refused' transfer.response_comment = comment tr...
[ "def", "refuse_transfer", "(", "transfer", ",", "comment", "=", "None", ")", ":", "TransferResponsePermission", "(", "transfer", ")", ".", "test", "(", ")", "transfer", ".", "responded", "=", "datetime", ".", "now", "(", ")", "transfer", ".", "responder", ...
https://github.com/opendatateam/udata/blob/a295cab3c0e8f086fea1853655011f361ac81b77/udata/features/transfer/actions.py#L55-L65
ctxis/CAPE
dae9fa6a254ecdbabeb7eb0d2389fa63722c1e82
modules/reporting/mmdef.py
python
MMDef.createIpObject
(self, ip)
return maec.IPObject( id="%s-%s" % (ip, ip), startAddress=maec.IPAddress( type_="ipv4", valueOf_=ip ...
Creates an single IP object, not an IP range object. @param ip: IP address @return: IP object
Creates an single IP object, not an IP range object.
[ "Creates", "an", "single", "IP", "object", "not", "an", "IP", "range", "object", "." ]
def createIpObject(self, ip): """Creates an single IP object, not an IP range object. @param ip: IP address @return: IP object """ return maec.IPObject( id="%s-%s" % (ip, ip), startAddress=maec.IPAddress( ...
[ "def", "createIpObject", "(", "self", ",", "ip", ")", ":", "return", "maec", ".", "IPObject", "(", "id", "=", "\"%s-%s\"", "%", "(", "ip", ",", "ip", ")", ",", "startAddress", "=", "maec", ".", "IPAddress", "(", "type_", "=", "\"ipv4\"", ",", "valueO...
https://github.com/ctxis/CAPE/blob/dae9fa6a254ecdbabeb7eb0d2389fa63722c1e82/modules/reporting/mmdef.py#L199-L214
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/nova/nova/network/manager.py
python
NetworkManager.get_vifs_by_instance
(self, context, instance_id)
return [dict(vif.iteritems()) for vif in vifs]
Returns the vifs associated with an instance.
Returns the vifs associated with an instance.
[ "Returns", "the", "vifs", "associated", "with", "an", "instance", "." ]
def get_vifs_by_instance(self, context, instance_id): """Returns the vifs associated with an instance.""" # NOTE(vish): This is no longer used but can't be removed until # we major version the network_rpcapi to 2.0. instance = self.db.instance_get(context, instance_id) ...
[ "def", "get_vifs_by_instance", "(", "self", ",", "context", ",", "instance_id", ")", ":", "# NOTE(vish): This is no longer used but can't be removed until", "# we major version the network_rpcapi to 2.0.", "instance", "=", "self", ".", "db", ".", "instance_get", "("...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/nova/nova/network/manager.py#L1337-L1344
facebookresearch/hydra
9b2f4d54b328d1551aa70a241a1d638cbe046367
hydra/_internal/core_plugins/importlib_resources_config_source.py
python
ImportlibResourcesConfigSource.scheme
()
return "pkg"
[]
def scheme() -> str: return "pkg"
[ "def", "scheme", "(", ")", "->", "str", ":", "return", "\"pkg\"" ]
https://github.com/facebookresearch/hydra/blob/9b2f4d54b328d1551aa70a241a1d638cbe046367/hydra/_internal/core_plugins/importlib_resources_config_source.py#L30-L31
PyCQA/astroid
a815443f62faae05249621a396dcf0afd884a619
astroid/brain/brain_namedtuple_enum.py
python
infer_enum
(node, context=None)
return iter([class_node.instantiate_class()])
Specific inference function for enum Call node.
Specific inference function for enum Call node.
[ "Specific", "inference", "function", "for", "enum", "Call", "node", "." ]
def infer_enum(node, context=None): """Specific inference function for enum Call node.""" enum_meta = extract_node( """ class EnumMeta(object): 'docstring' def __call__(self, node): class EnumAttribute(object): name = '' value = 0 ...
[ "def", "infer_enum", "(", "node", ",", "context", "=", "None", ")", ":", "enum_meta", "=", "extract_node", "(", "\"\"\"\n class EnumMeta(object):\n 'docstring'\n def __call__(self, node):\n class EnumAttribute(object):\n name = ''\n ...
https://github.com/PyCQA/astroid/blob/a815443f62faae05249621a396dcf0afd884a619/astroid/brain/brain_namedtuple_enum.py#L296-L333
syssi/xiaomi_airconditioningcompanion
7f63dd65b8b39a5f322fa8a090ef6c7eaf9cbb8c
custom_components/xiaomi_miio_airconditioningcompanion/climate.py
python
XiaomiAirConditioningCompanion.fan_modes
(self)
return [speed.name.lower() for speed in FanSpeed]
Return the list of available fan modes.
Return the list of available fan modes.
[ "Return", "the", "list", "of", "available", "fan", "modes", "." ]
def fan_modes(self): """Return the list of available fan modes.""" from miio.airconditioningcompanion import FanSpeed return [speed.name.lower() for speed in FanSpeed]
[ "def", "fan_modes", "(", "self", ")", ":", "from", "miio", ".", "airconditioningcompanion", "import", "FanSpeed", "return", "[", "speed", ".", "name", ".", "lower", "(", ")", "for", "speed", "in", "FanSpeed", "]" ]
https://github.com/syssi/xiaomi_airconditioningcompanion/blob/7f63dd65b8b39a5f322fa8a090ef6c7eaf9cbb8c/custom_components/xiaomi_miio_airconditioningcompanion/climate.py#L460-L464
HymanLiuTS/flaskTs
286648286976e85d9b9a5873632331efcafe0b21
flasky/lib/python2.7/site-packages/flask_sqlalchemy/__init__.py
python
SQLAlchemy.drop_all
(self, bind='__all__', app=None)
Drops all tables. .. versionchanged:: 0.12 Parameters were added
Drops all tables.
[ "Drops", "all", "tables", "." ]
def drop_all(self, bind='__all__', app=None): """Drops all tables. .. versionchanged:: 0.12 Parameters were added """ self._execute_for_all_tables(app, bind, 'drop_all')
[ "def", "drop_all", "(", "self", ",", "bind", "=", "'__all__'", ",", "app", "=", "None", ")", ":", "self", ".", "_execute_for_all_tables", "(", "app", ",", "bind", ",", "'drop_all'", ")" ]
https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/flask_sqlalchemy/__init__.py#L974-L980
beetbox/beets
2fea53c34dd505ba391cb345424e0613901c8025
beetsplug/beatport.py
python
BeatportClient.get_authorize_url
(self)
return self.api.authorization_url( self._make_url('/identity/1/oauth/authorize'))
Generate the URL for the user to authorize the application. Retrieves a request token from the Beatport API and returns the corresponding authorization URL on their end that the user has to visit. This is the first step of the initial authorization process with the API. Once th...
Generate the URL for the user to authorize the application.
[ "Generate", "the", "URL", "for", "the", "user", "to", "authorize", "the", "application", "." ]
def get_authorize_url(self): """ Generate the URL for the user to authorize the application. Retrieves a request token from the Beatport API and returns the corresponding authorization URL on their end that the user has to visit. This is the first step of the initial authorizat...
[ "def", "get_authorize_url", "(", "self", ")", ":", "self", ".", "api", ".", "fetch_request_token", "(", "self", ".", "_make_url", "(", "'/identity/1/oauth/request-token'", ")", ")", "return", "self", ".", "api", ".", "authorization_url", "(", "self", ".", "_ma...
https://github.com/beetbox/beets/blob/2fea53c34dd505ba391cb345424e0613901c8025/beetsplug/beatport.py#L78-L96
timkpaine/pyEX
254acd2b0cf7cb7183100106f4ecc11d1860c46a
pyEX/stocks/company.py
python
companyDF
(*args, **kwargs)
return _companyToDF(company(*args, **kwargs))
[]
def companyDF(*args, **kwargs): return _companyToDF(company(*args, **kwargs))
[ "def", "companyDF", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_companyToDF", "(", "company", "(", "*", "args", ",", "*", "*", "kwargs", ")", ")" ]
https://github.com/timkpaine/pyEX/blob/254acd2b0cf7cb7183100106f4ecc11d1860c46a/pyEX/stocks/company.py#L54-L55
GoogleCloudPlatform/PerfKitBenchmarker
6e3412d7d5e414b8ca30ed5eaf970cef1d919a67
perfkitbenchmarker/container_service.py
python
KubernetesPod.WaitForExit
(self, timeout: int = None)
return _WaitForExit()
Gets the finished running container.
Gets the finished running container.
[ "Gets", "the", "finished", "running", "container", "." ]
def WaitForExit(self, timeout: int = None) -> Dict[str, Any]: """Gets the finished running container.""" @vm_util.Retry( timeout=timeout, retryable_exceptions=(RetriableContainerException,)) def _WaitForExit(): # Inspect the pod's status to determine if it succeeded, has failed, or is #...
[ "def", "WaitForExit", "(", "self", ",", "timeout", ":", "int", "=", "None", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "@", "vm_util", ".", "Retry", "(", "timeout", "=", "timeout", ",", "retryable_exceptions", "=", "(", "RetriableContainerExcep...
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/6e3412d7d5e414b8ca30ed5eaf970cef1d919a67/perfkitbenchmarker/container_service.py#L599-L635
evennia/evennia
fa79110ba6b219932f22297838e8ac72ebc0be0e
evennia/contrib/evscaperoom/commands.py
python
CmdEvscapeRoom._search
(self, query, required)
This implements the various search modes Args: query (str): The search query required (bool or None): This defines if query *must* be found to match a single local Object or not. If None, a non-match means returning the query unchanged. When ...
This implements the various search modes
[ "This", "implements", "the", "various", "search", "modes" ]
def _search(self, query, required): """ This implements the various search modes Args: query (str): The search query required (bool or None): This defines if query *must* be found to match a single local Object or not. If None, a non-match...
[ "def", "_search", "(", "self", ",", "query", ",", "required", ")", ":", "if", "required", "is", "False", ":", "return", "None", ",", "query", "matches", "=", "self", ".", "caller", ".", "search", "(", "query", ",", "quiet", "=", "True", ")", "if", ...
https://github.com/evennia/evennia/blob/fa79110ba6b219932f22297838e8ac72ebc0be0e/evennia/contrib/evscaperoom/commands.py#L127-L163
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/asyncio/locks.py
python
Semaphore.locked
(self)
return self._value == 0
Returns True if semaphore can not be acquired immediately.
Returns True if semaphore can not be acquired immediately.
[ "Returns", "True", "if", "semaphore", "can", "not", "be", "acquired", "immediately", "." ]
def locked(self): """Returns True if semaphore can not be acquired immediately.""" return self._value == 0
[ "def", "locked", "(", "self", ")", ":", "return", "self", ".", "_value", "==", "0" ]
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/asyncio/locks.py#L368-L370
20c/vaping
6c4f669e2e75619cc826ea4a910627567a99580c
src/vaping/asyncio_backport.py
python
_patch_loop
(loop)
return tasks
This function is designed to work around https://bugs.python.org/issue36607 It's job is to keep a thread safe variable tasks up to date with any tasks that are created for the given loop. This then lets you cancel them as _all_tasks was intended for. We also need to patch the {get,set}_task_factory fu...
This function is designed to work around https://bugs.python.org/issue36607
[ "This", "function", "is", "designed", "to", "work", "around", "https", ":", "//", "bugs", ".", "python", ".", "org", "/", "issue36607" ]
def _patch_loop(loop): """ This function is designed to work around https://bugs.python.org/issue36607 It's job is to keep a thread safe variable tasks up to date with any tasks that are created for the given loop. This then lets you cancel them as _all_tasks was intended for. We also need to ...
[ "def", "_patch_loop", "(", "loop", ")", ":", "tasks", "=", "weakref", ".", "WeakSet", "(", ")", "task_factory", "=", "[", "None", "]", "def", "_set_task_factory", "(", "factory", ")", ":", "task_factory", "[", "0", "]", "=", "factory", "def", "_get_task_...
https://github.com/20c/vaping/blob/6c4f669e2e75619cc826ea4a910627567a99580c/src/vaping/asyncio_backport.py#L30-L70
p2pool/p2pool
53c438bbada06b9d4a9a465bc13f7694a7a322b7
SOAPpy/Types.py
python
anyType._setActor
(self, val)
[]
def _setActor(self, val): self._setAttr((NS.ENV, "actor"), val)
[ "def", "_setActor", "(", "self", ",", "val", ")", ":", "self", ".", "_setAttr", "(", "(", "NS", ".", "ENV", ",", "\"actor\"", ")", ",", "val", ")" ]
https://github.com/p2pool/p2pool/blob/53c438bbada06b9d4a9a465bc13f7694a7a322b7/SOAPpy/Types.py#L170-L171
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/encodings/mac_cyrillic.py
python
IncrementalEncoder.encode
(self, input, final=False)
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
[]
def encode(self, input, final=False): return codecs.charmap_encode(input,self.errors,encoding_table)[0]
[ "def", "encode", "(", "self", ",", "input", ",", "final", "=", "False", ")", ":", "return", "codecs", ".", "charmap_encode", "(", "input", ",", "self", ".", "errors", ",", "encoding_table", ")", "[", "0", "]" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/encodings/mac_cyrillic.py#L18-L19
aleju/imgaug
0101108d4fed06bc5056c4a03e2bcb0216dac326
imgaug/augmenters/geometric.py
python
Affine.get_parameters
(self)
return [ self.scale, self.translate, self.rotate, self.shear, self.order, self.cval, self.mode, self.backend, self.fit_output ]
See :func:`~imgaug.augmenters.meta.Augmenter.get_parameters`.
See :func:`~imgaug.augmenters.meta.Augmenter.get_parameters`.
[ "See", ":", "func", ":", "~imgaug", ".", "augmenters", ".", "meta", ".", "Augmenter", ".", "get_parameters", "." ]
def get_parameters(self): """See :func:`~imgaug.augmenters.meta.Augmenter.get_parameters`.""" return [ self.scale, self.translate, self.rotate, self.shear, self.order, self.cval, self.mode, self.backend, self.fit_output ]
[ "def", "get_parameters", "(", "self", ")", ":", "return", "[", "self", ".", "scale", ",", "self", ".", "translate", ",", "self", ".", "rotate", ",", "self", ".", "shear", ",", "self", ".", "order", ",", "self", ".", "cval", ",", "self", ".", "mode"...
https://github.com/aleju/imgaug/blob/0101108d4fed06bc5056c4a03e2bcb0216dac326/imgaug/augmenters/geometric.py#L1633-L1638
NVIDIA/DeepLearningExamples
589604d49e016cd9ef4525f7abcc9c7b826cfc5e
TensorFlow/Detection/SSD/models/research/object_detection/core/box_coder.py
python
BoxCoder._encode
(self, boxes, anchors)
Method to be overriden by implementations. Args: boxes: BoxList holding N boxes to be encoded anchors: BoxList of N anchors Returns: a tensor representing N relative-encoded boxes
Method to be overriden by implementations.
[ "Method", "to", "be", "overriden", "by", "implementations", "." ]
def _encode(self, boxes, anchors): """Method to be overriden by implementations. Args: boxes: BoxList holding N boxes to be encoded anchors: BoxList of N anchors Returns: a tensor representing N relative-encoded boxes """ pass
[ "def", "_encode", "(", "self", ",", "boxes", ",", "anchors", ")", ":", "pass" ]
https://github.com/NVIDIA/DeepLearningExamples/blob/589604d49e016cd9ef4525f7abcc9c7b826cfc5e/TensorFlow/Detection/SSD/models/research/object_detection/core/box_coder.py#L89-L99
hasanirtiza/Pedestron
3bdcf8476edc0741f28a80dd4cb161ac532507ee
tools/ECPB/create_tfrecords.py
python
ExampleCreator.encode_png
(self, img)
return self._sess.run(self._encoded, feed_dict={self._encode_data: img})
[]
def encode_png(self, img): assert len(img.shape) == 3 assert img.shape[2] == 3 return self._sess.run(self._encoded, feed_dict={self._encode_data: img})
[ "def", "encode_png", "(", "self", ",", "img", ")", ":", "assert", "len", "(", "img", ".", "shape", ")", "==", "3", "assert", "img", ".", "shape", "[", "2", "]", "==", "3", "return", "self", ".", "_sess", ".", "run", "(", "self", ".", "_encoded", ...
https://github.com/hasanirtiza/Pedestron/blob/3bdcf8476edc0741f28a80dd4cb161ac532507ee/tools/ECPB/create_tfrecords.py#L80-L83
pypa/setuptools
9f37366aab9cd8f6baa23e6a77cfdb8daf97757e
pkg_resources/_vendor/pyparsing.py
python
ParseResults.haskeys
( self )
return bool(self.__tokdict)
Since keys() returns an iterator, this method is helpful in bypassing code that looks for the existence of any defined results names.
Since keys() returns an iterator, this method is helpful in bypassing code that looks for the existence of any defined results names.
[ "Since", "keys", "()", "returns", "an", "iterator", "this", "method", "is", "helpful", "in", "bypassing", "code", "that", "looks", "for", "the", "existence", "of", "any", "defined", "results", "names", "." ]
def haskeys( self ): """Since keys() returns an iterator, this method is helpful in bypassing code that looks for the existence of any defined results names.""" return bool(self.__tokdict)
[ "def", "haskeys", "(", "self", ")", ":", "return", "bool", "(", "self", ".", "__tokdict", ")" ]
https://github.com/pypa/setuptools/blob/9f37366aab9cd8f6baa23e6a77cfdb8daf97757e/pkg_resources/_vendor/pyparsing.py#L506-L509
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/com.oracle.graal.python.benchmarks/python/meso/raytrace-simple.py
python
Point.isPoint
(self)
return True
[]
def isPoint(self): return True
[ "def", "isPoint", "(", "self", ")", ":", "return", "True" ]
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/com.oracle.graal.python.benchmarks/python/meso/raytrace-simple.py#L129-L130
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
asdl/format.py
python
PrintTree
(node, f)
[]
def PrintTree(node, f): # type: (hnode_t, ColorOutput) -> None pp = _PrettyPrinter(100) # max_col pp.PrintNode(node, f, 0)
[ "def", "PrintTree", "(", "node", ",", "f", ")", ":", "# type: (hnode_t, ColorOutput) -> None", "pp", "=", "_PrettyPrinter", "(", "100", ")", "# max_col", "pp", ".", "PrintNode", "(", "node", ",", "f", ",", "0", ")" ]
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/asdl/format.py#L491-L494
danforthcenter/plantcv
aecd599d917884770aa0c7dec15bc9d1c53f36c4
plantcv/plantcv/visualize/obj_size_ecdf.py
python
obj_size_ecdf
(mask, title=None)
return fig_ecdf
Plot empirical cumulative distribution for object size based on binary mask. Inputs: mask = binary mask title = a custom title for the plot (default=None) Returns: fig_ecdf = empirical cumulative distribution function plot :param mask: numpy.ndarray :param title: str :return fig_ecdf...
Plot empirical cumulative distribution for object size based on binary mask.
[ "Plot", "empirical", "cumulative", "distribution", "for", "object", "size", "based", "on", "binary", "mask", "." ]
def obj_size_ecdf(mask, title=None): """ Plot empirical cumulative distribution for object size based on binary mask. Inputs: mask = binary mask title = a custom title for the plot (default=None) Returns: fig_ecdf = empirical cumulative distribution function plot :param mask: numpy.n...
[ "def", "obj_size_ecdf", "(", "mask", ",", "title", "=", "None", ")", ":", "objects", ",", "_", "=", "cv2", ".", "findContours", "(", "mask", ",", "cv2", ".", "RETR_TREE", ",", "cv2", ".", "CHAIN_APPROX_NONE", ")", "[", "-", "2", ":", "]", "areas", ...
https://github.com/danforthcenter/plantcv/blob/aecd599d917884770aa0c7dec15bc9d1c53f36c4/plantcv/plantcv/visualize/obj_size_ecdf.py#L12-L45
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/zope.interface/src/zope/interface/interfaces.py
python
IInterface.validateInvariants
(obj, errors=None)
Validate invariants Validate object to defined invariants. If errors is None, raises first Invalid error; if errors is a list, appends all errors to list, then raises Invalid with the errors as the first element of the "args" tuple.
Validate invariants
[ "Validate", "invariants" ]
def validateInvariants(obj, errors=None): """Validate invariants Validate object to defined invariants. If errors is None, raises first Invalid error; if errors is a list, appends all errors to list, then raises Invalid with the errors as the first element of the "args" tuple."...
[ "def", "validateInvariants", "(", "obj", ",", "errors", "=", "None", ")", ":" ]
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/zope.interface/src/zope/interface/interfaces.py#L281-L287
realpython/book2-exercises
cde325eac8e6d8cff2316601c2e5b36bb46af7d0
web2py/venv/lib/python2.7/site-packages/wheel/metadata.py
python
dedent_description
(pkg_info)
return description_dedent
Dedent and convert pkg_info['Description'] to Unicode.
Dedent and convert pkg_info['Description'] to Unicode.
[ "Dedent", "and", "convert", "pkg_info", "[", "Description", "]", "to", "Unicode", "." ]
def dedent_description(pkg_info): """ Dedent and convert pkg_info['Description'] to Unicode. """ description = pkg_info['Description'] # Python 3 Unicode handling, sorta. surrogates = False if not isinstance(description, str): surrogates = True description = pkginfo_unicode(...
[ "def", "dedent_description", "(", "pkg_info", ")", ":", "description", "=", "pkg_info", "[", "'Description'", "]", "# Python 3 Unicode handling, sorta.", "surrogates", "=", "False", "if", "not", "isinstance", "(", "description", ",", "str", ")", ":", "surrogates", ...
https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py/venv/lib/python2.7/site-packages/wheel/metadata.py#L303-L328