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
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/assumptions/assume.py
python
Predicate.eval
(self, expr, assumptions=True)
return res
Evaluate self(expr) under the given assumptions. This uses only direct resolution methods, not logical inference.
Evaluate self(expr) under the given assumptions.
[ "Evaluate", "self", "(", "expr", ")", "under", "the", "given", "assumptions", "." ]
def eval(self, expr, assumptions=True): """ Evaluate self(expr) under the given assumptions. This uses only direct resolution methods, not logical inference. """ res, _res = None, None mro = inspect.getmro(type(expr)) for handler in self.handlers: cls...
[ "def", "eval", "(", "self", ",", "expr", ",", "assumptions", "=", "True", ")", ":", "res", ",", "_res", "=", "None", ",", "None", "mro", "=", "inspect", ".", "getmro", "(", "type", "(", "expr", ")", ")", "for", "handler", "in", "self", ".", "hand...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/assumptions/assume.py#L162-L188
Te-k/harpoon
654381fff282aacc7e3c8264fd4cead40eedf48d
harpoon/lib/archiveorg.py
python
ArchiveOrg.capture
(url)
Capture url in Web Archive
Capture url in Web Archive
[ "Capture", "url", "in", "Web", "Archive" ]
def capture(url): """ Capture url in Web Archive """ # Copied from https://github.com/motherboardgithub/mass_archive/blob/master/mass_archive.py res = requests.get("https://web.archive.org/save/%s" % url) if res.status_code == 200: result = res.headers['Conten...
[ "def", "capture", "(", "url", ")", ":", "# Copied from https://github.com/motherboardgithub/mass_archive/blob/master/mass_archive.py", "res", "=", "requests", ".", "get", "(", "\"https://web.archive.org/save/%s\"", "%", "url", ")", "if", "res", ".", "status_code", "==", "...
https://github.com/Te-k/harpoon/blob/654381fff282aacc7e3c8264fd4cead40eedf48d/harpoon/lib/archiveorg.py#L66-L77
mrkipling/maraschino
c6be9286937783ae01df2d6d8cebfc8b2734a7d7
lib/sqlalchemy/sql/expression.py
python
join
(left, right, onclause=None, isouter=False)
return Join(left, right, onclause, isouter)
Return a ``JOIN`` clause element (regular inner join). The returned object is an instance of :class:`.Join`. Similar functionality is also available via the :meth:`~.FromClause.join()` method on any :class:`.FromClause`. :param left: The left side of the join. :param right: The right side ...
Return a ``JOIN`` clause element (regular inner join).
[ "Return", "a", "JOIN", "clause", "element", "(", "regular", "inner", "join", ")", "." ]
def join(left, right, onclause=None, isouter=False): """Return a ``JOIN`` clause element (regular inner join). The returned object is an instance of :class:`.Join`. Similar functionality is also available via the :meth:`~.FromClause.join()` method on any :class:`.FromClause`. :param left: T...
[ "def", "join", "(", "left", ",", "right", ",", "onclause", "=", "None", ",", "isouter", "=", "False", ")", ":", "return", "Join", "(", "left", ",", "right", ",", "onclause", ",", "isouter", ")" ]
https://github.com/mrkipling/maraschino/blob/c6be9286937783ae01df2d6d8cebfc8b2734a7d7/lib/sqlalchemy/sql/expression.py#L136-L159
PyHDI/veriloggen
2382d200deabf59cfcfd741f5eba371010aaf2bb
veriloggen/core/vtypes.py
python
Reg.reset
(self)
return self.write(self.initval)
[]
def reset(self): if self.initval is None: return None return self.write(self.initval)
[ "def", "reset", "(", "self", ")", ":", "if", "self", ".", "initval", "is", "None", ":", "return", "None", "return", "self", ".", "write", "(", "self", ".", "initval", ")" ]
https://github.com/PyHDI/veriloggen/blob/2382d200deabf59cfcfd741f5eba371010aaf2bb/veriloggen/core/vtypes.py#L624-L627
twisted/twisted
dee676b040dd38b847ea6fb112a712cb5e119490
src/twisted/web/http.py
python
_GenericHTTPChannelProtocol.callLater
(self)
return self._channel.callLater
A value for the C{callLater} callback. This callback is used by the L{twisted.protocols.policies.TimeoutMixin} to handle timeouts.
A value for the C{callLater} callback. This callback is used by the L{twisted.protocols.policies.TimeoutMixin} to handle timeouts.
[ "A", "value", "for", "the", "C", "{", "callLater", "}", "callback", ".", "This", "callback", "is", "used", "by", "the", "L", "{", "twisted", ".", "protocols", ".", "policies", ".", "TimeoutMixin", "}", "to", "handle", "timeouts", "." ]
def callLater(self): """ A value for the C{callLater} callback. This callback is used by the L{twisted.protocols.policies.TimeoutMixin} to handle timeouts. """ return self._channel.callLater
[ "def", "callLater", "(", "self", ")", ":", "return", "self", ".", "_channel", ".", "callLater" ]
https://github.com/twisted/twisted/blob/dee676b040dd38b847ea6fb112a712cb5e119490/src/twisted/web/http.py#L3005-L3010
Huangying-Zhan/DF-VO
6a2ec43fc6209d9058ae1709d779c5ada68a31f3
libs/deep_models/flow/deep_flow.py
python
DeepFlow.resize_dense_flow
(self, flow, des_height, des_width)
return flow
Resized flow map with scaling Args: flow (tensor, [Nx2xHxW]): flow map des_height (int): destinated height des_widht (int): destinated width Returns: flow (tensor, [Nx2xH'xW']): resized flow
Resized flow map with scaling Args: flow (tensor, [Nx2xHxW]): flow map des_height (int): destinated height des_widht (int): destinated width
[ "Resized", "flow", "map", "with", "scaling", "Args", ":", "flow", "(", "tensor", "[", "Nx2xHxW", "]", ")", ":", "flow", "map", "des_height", "(", "int", ")", ":", "destinated", "height", "des_widht", "(", "int", ")", ":", "destinated", "width" ]
def resize_dense_flow(self, flow, des_height, des_width): """Resized flow map with scaling Args: flow (tensor, [Nx2xHxW]): flow map des_height (int): destinated height des_widht (int): destinated width Returns: flow (tensor, [Nx2xH'xW']):...
[ "def", "resize_dense_flow", "(", "self", ",", "flow", ",", "des_height", ",", "des_width", ")", ":", "# get height, width ratio", "ratio_height", "=", "float", "(", "des_height", "/", "flow", ".", "size", "(", "2", ")", ")", "ratio_width", "=", "float", "(",...
https://github.com/Huangying-Zhan/DF-VO/blob/6a2ec43fc6209d9058ae1709d779c5ada68a31f3/libs/deep_models/flow/deep_flow.py#L107-L129
aws/sagemaker-tensorflow-training-toolkit
38db16c9d3fcbda6f9d8bc31261398fb4617bfc8
benchmarks/horovod-resnet/train_imagenet_resnet_hvd.py
python
rank0log
(logger, *args, **kwargs)
[]
def rank0log(logger, *args, **kwargs): if hvd.rank() == 0: if logger: logger.info("".join([str(x) for x in list(args)])) else: print(*args, **kwargs)
[ "def", "rank0log", "(", "logger", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "hvd", ".", "rank", "(", ")", "==", "0", ":", "if", "logger", ":", "logger", ".", "info", "(", "\"\"", ".", "join", "(", "[", "str", "(", "x", ")", ...
https://github.com/aws/sagemaker-tensorflow-training-toolkit/blob/38db16c9d3fcbda6f9d8bc31261398fb4617bfc8/benchmarks/horovod-resnet/train_imagenet_resnet_hvd.py#L55-L60
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/interfaces/expect.py
python
Expect._before
(self, encoding=None, errors=None)
return bytes_to_str(self._expect.before, encoding, errors)
r""" Return the previous string that was sent through the interface. Returns ``str`` objects on both Python 2 and Python 3. The ``encoding`` and ``errors`` arguments are passed to :func:`sage.misc.cpython.bytes_to_str`. EXAMPLES:: sage: singular('2+3') ...
r""" Return the previous string that was sent through the interface.
[ "r", "Return", "the", "previous", "string", "that", "was", "sent", "through", "the", "interface", "." ]
def _before(self, encoding=None, errors=None): r""" Return the previous string that was sent through the interface. Returns ``str`` objects on both Python 2 and Python 3. The ``encoding`` and ``errors`` arguments are passed to :func:`sage.misc.cpython.bytes_to_str`. EX...
[ "def", "_before", "(", "self", ",", "encoding", "=", "None", ",", "errors", "=", "None", ")", ":", "return", "bytes_to_str", "(", "self", ".", "_expect", ".", "before", ",", "encoding", ",", "errors", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/interfaces/expect.py#L1063-L1079
cgre-aachen/gempy
6ad16c46fc6616c9f452fba85d31ce32decd8b10
gempy/core/xsolution.py
python
XSolution.set_meshes
(self, surfaces: Surfaces = None)
return self.meshes
Create xarray from the Surfaces object. In GemPy Engine we will set them directly.
Create xarray from the Surfaces object. In GemPy Engine we will set them directly.
[ "Create", "xarray", "from", "the", "Surfaces", "object", ".", "In", "GemPy", "Engine", "we", "will", "set", "them", "directly", "." ]
def set_meshes(self, surfaces: Surfaces = None): """Create xarray from the Surfaces object. In GemPy Engine we will set them directly. """ surf_ver_sim = surfaces.df[['id', 'vertices', 'edges']] vertex = [] simplex = [] ids = [] last_idx = 0 self...
[ "def", "set_meshes", "(", "self", ",", "surfaces", ":", "Surfaces", "=", "None", ")", ":", "surf_ver_sim", "=", "surfaces", ".", "df", "[", "[", "'id'", ",", "'vertices'", ",", "'edges'", "]", "]", "vertex", "=", "[", "]", "simplex", "=", "[", "]", ...
https://github.com/cgre-aachen/gempy/blob/6ad16c46fc6616c9f452fba85d31ce32decd8b10/gempy/core/xsolution.py#L71-L94
compas-dev/compas
0b33f8786481f710115fb1ae5fe79abc2a9a5175
src/compas/plugins.py
python
Importer.try_import
(self, module_name)
return module
Attempt to import a module, but do not raise in case of error. Parameters ---------- module_name : str Module to try to import. Returns ------- module If importable, it returns the imported module, otherwise ``None``.
Attempt to import a module, but do not raise in case of error.
[ "Attempt", "to", "import", "a", "module", "but", "do", "not", "raise", "in", "case", "of", "error", "." ]
def try_import(self, module_name): """Attempt to import a module, but do not raise in case of error. Parameters ---------- module_name : str Module to try to import. Returns ------- module If importable, it returns the imported module, ot...
[ "def", "try_import", "(", "self", ",", "module_name", ")", ":", "module", "=", "None", "try", ":", "module", "=", "__import__", "(", "module_name", ",", "fromlist", "=", "[", "'__name__'", "]", ",", "level", "=", "0", ")", "self", ".", "_cache", "[", ...
https://github.com/compas-dev/compas/blob/0b33f8786481f710115fb1ae5fe79abc2a9a5175/src/compas/plugins.py#L385-L410
wuhuikai/GP-GAN
6d1e6e51f4932bd8ba7ea8eccf640555f5c28246
updater.py
python
WassersteinUpdaterFramework.d_loss
(self, errD_real, errD_fake)
return errD
[]
def d_loss(self, errD_real, errD_fake): errD = errD_real - errD_fake chainer.report({'loss_real': errD_real}, self.D) chainer.report({'loss_fake': errD_fake}, self.D) chainer.report({'loss': errD}, self.D) return errD
[ "def", "d_loss", "(", "self", ",", "errD_real", ",", "errD_fake", ")", ":", "errD", "=", "errD_real", "-", "errD_fake", "chainer", ".", "report", "(", "{", "'loss_real'", ":", "errD_real", "}", ",", "self", ".", "D", ")", "chainer", ".", "report", "(",...
https://github.com/wuhuikai/GP-GAN/blob/6d1e6e51f4932bd8ba7ea8eccf640555f5c28246/updater.py#L14-L21
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/polys/euclidtools.py
python
dmp_rr_prs_gcd
(f, g, u, K)
return h, cff, cfg
Computes polynomial GCD using subresultants over a ring. Returns ``(h, cff, cfg)`` such that ``a = gcd(f, g)``, ``cff = quo(f, h)``, and ``cfg = quo(g, h)``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y, = ring("x,y", ZZ) >>> f = x**2 + 2*x*y + y**2 >>> g = x**2 ...
Computes polynomial GCD using subresultants over a ring.
[ "Computes", "polynomial", "GCD", "using", "subresultants", "over", "a", "ring", "." ]
def dmp_rr_prs_gcd(f, g, u, K): """ Computes polynomial GCD using subresultants over a ring. Returns ``(h, cff, cfg)`` such that ``a = gcd(f, g)``, ``cff = quo(f, h)``, and ``cfg = quo(g, h)``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y, = ring("x,y", ZZ) >...
[ "def", "dmp_rr_prs_gcd", "(", "f", ",", "g", ",", "u", ",", "K", ")", ":", "if", "not", "u", ":", "return", "dup_rr_prs_gcd", "(", "f", ",", "g", ",", "K", ")", "result", "=", "_dmp_rr_trivial_gcd", "(", "f", ",", "g", ",", "u", ",", "K", ")", ...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/polys/euclidtools.py#L1083-L1126
ethereum/trinity
6383280c5044feb06695ac2f7bc1100b7bcf4fe0
trinity/_utils/bloom.py
python
RollingBloom.__init__
(self, generation_size: int, max_generations: int)
[]
def __init__(self, generation_size: int, max_generations: int) -> None: if generation_size < 1: raise ValueError(f"generation_size must be a positive integer: got {generation_size}") if max_generations < 2: raise ValueError(f"max_generations must be 2 or more: got {max_generation...
[ "def", "__init__", "(", "self", ",", "generation_size", ":", "int", ",", "max_generations", ":", "int", ")", "->", "None", ":", "if", "generation_size", "<", "1", ":", "raise", "ValueError", "(", "f\"generation_size must be a positive integer: got {generation_size}\""...
https://github.com/ethereum/trinity/blob/6383280c5044feb06695ac2f7bc1100b7bcf4fe0/trinity/_utils/bloom.py#L10-L19
pypa/pip
7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4
src/pip/_vendor/pkg_resources/__init__.py
python
_is_unpacked_egg
(path)
return ( _is_egg_path(path) and os.path.isfile(os.path.join(path, 'EGG-INFO', 'PKG-INFO')) )
Determine if given path appears to be an unpacked egg.
Determine if given path appears to be an unpacked egg.
[ "Determine", "if", "given", "path", "appears", "to", "be", "an", "unpacked", "egg", "." ]
def _is_unpacked_egg(path): """ Determine if given path appears to be an unpacked egg. """ return ( _is_egg_path(path) and os.path.isfile(os.path.join(path, 'EGG-INFO', 'PKG-INFO')) )
[ "def", "_is_unpacked_egg", "(", "path", ")", ":", "return", "(", "_is_egg_path", "(", "path", ")", "and", "os", ".", "path", ".", "isfile", "(", "os", ".", "path", ".", "join", "(", "path", ",", "'EGG-INFO'", ",", "'PKG-INFO'", ")", ")", ")" ]
https://github.com/pypa/pip/blob/7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4/src/pip/_vendor/pkg_resources/__init__.py#L2360-L2367
HumanCompatibleAI/adversarial-policies
bba910b89149f1274bb9652a6f378b22c3c9b6c5
src/aprl/training/scheduling.py
python
Annealer.set_get_logs
(self, get_logs)
Set the get_logs attribute since passing into constructor may not be possible.
Set the get_logs attribute since passing into constructor may not be possible.
[ "Set", "the", "get_logs", "attribute", "since", "passing", "into", "constructor", "may", "not", "be", "possible", "." ]
def set_get_logs(self, get_logs): """Set the get_logs attribute since passing into constructor may not be possible.""" self.get_logs = get_logs
[ "def", "set_get_logs", "(", "self", ",", "get_logs", ")", ":", "self", ".", "get_logs", "=", "get_logs" ]
https://github.com/HumanCompatibleAI/adversarial-policies/blob/bba910b89149f1274bb9652a6f378b22c3c9b6c5/src/aprl/training/scheduling.py#L100-L102
dmarnerides/pydlt
b018f75b68af29645d0a5dae10b6d7255e53f867
dlt/config/opts.py
python
add_extras
(extras)
Adds extra options for the parser, in addition to the built-in ones. Args: extras (list or dict, optional): Extra command line arguments to parse. If a list is given, a new category `extras` is added with the listed arguments. If a dict is given, the keys contain the category ...
Adds extra options for the parser, in addition to the built-in ones.
[ "Adds", "extra", "options", "for", "the", "parser", "in", "addition", "to", "the", "built", "-", "in", "ones", "." ]
def add_extras(extras): """Adds extra options for the parser, in addition to the built-in ones. Args: extras (list or dict, optional): Extra command line arguments to parse. If a list is given, a new category `extras` is added with the listed arguments. If a dict is given, the k...
[ "def", "add_extras", "(", "extras", ")", ":", "if", "isinstance", "(", "extras", ",", "dict", ")", ":", "for", "x", "in", "extras", ":", "if", "x", "in", "parse", ".", "param_dict", ".", "keys", "(", ")", ":", "print", "(", "'WARNING: Parameter categor...
https://github.com/dmarnerides/pydlt/blob/b018f75b68af29645d0a5dae10b6d7255e53f867/dlt/config/opts.py#L72-L118
sumanj/frankencert
5bbaae85cab35882dec1672ef037a42e29180b40
pyopenssl-19.1.0/src/OpenSSL/SSL.py
python
Context.set_tlsext_servername_callback
(self, callback)
Specify a callback function to be called when clients specify a server name. :param callback: The callback function. It will be invoked with one argument, the Connection instance. .. versionadded:: 0.13
Specify a callback function to be called when clients specify a server name.
[ "Specify", "a", "callback", "function", "to", "be", "called", "when", "clients", "specify", "a", "server", "name", "." ]
def set_tlsext_servername_callback(self, callback): """ Specify a callback function to be called when clients specify a server name. :param callback: The callback function. It will be invoked with one argument, the Connection instance. .. versionadded:: 0.13 ...
[ "def", "set_tlsext_servername_callback", "(", "self", ",", "callback", ")", ":", "@", "wraps", "(", "callback", ")", "def", "wrapper", "(", "ssl", ",", "alert", ",", "arg", ")", ":", "callback", "(", "Connection", ".", "_reverse_mapping", "[", "ssl", "]", ...
https://github.com/sumanj/frankencert/blob/5bbaae85cab35882dec1672ef037a42e29180b40/pyopenssl-19.1.0/src/OpenSSL/SSL.py#L1386-L1404
thatbrguy/Pedestrian-Detection
b11c7d6bed0ff320811726fe1c429be26a87da9e
slim/preprocessing/vgg_preprocessing.py
python
_central_crop
(image_list, crop_height, crop_width)
return outputs
Performs central crops of the given image list. Args: image_list: a list of image tensors of the same dimension but possibly varying channel. crop_height: the height of the image following the crop. crop_width: the width of the image following the crop. Returns: the list of cropped images.
Performs central crops of the given image list.
[ "Performs", "central", "crops", "of", "the", "given", "image", "list", "." ]
def _central_crop(image_list, crop_height, crop_width): """Performs central crops of the given image list. Args: image_list: a list of image tensors of the same dimension but possibly varying channel. crop_height: the height of the image following the crop. crop_width: the width of the image foll...
[ "def", "_central_crop", "(", "image_list", ",", "crop_height", ",", "crop_width", ")", ":", "outputs", "=", "[", "]", "for", "image", "in", "image_list", ":", "image_height", "=", "tf", ".", "shape", "(", "image", ")", "[", "0", "]", "image_width", "=", ...
https://github.com/thatbrguy/Pedestrian-Detection/blob/b11c7d6bed0ff320811726fe1c429be26a87da9e/slim/preprocessing/vgg_preprocessing.py#L173-L195
ponty/PyVirtualDisplay
ec8ec5f7ae5503ebfa4af77a7b8048644270129b
pyvirtualdisplay/display.py
python
Display.pid
(self)
return self._obj.pid
PID (:attr:`subprocess.Popen.pid`) :rtype: int
PID (:attr:`subprocess.Popen.pid`)
[ "PID", "(", ":", "attr", ":", "subprocess", ".", "Popen", ".", "pid", ")" ]
def pid(self) -> int: """ PID (:attr:`subprocess.Popen.pid`) :rtype: int """ return self._obj.pid
[ "def", "pid", "(", "self", ")", "->", "int", ":", "return", "self", ".", "_obj", ".", "pid" ]
https://github.com/ponty/PyVirtualDisplay/blob/ec8ec5f7ae5503ebfa4af77a7b8048644270129b/pyvirtualdisplay/display.py#L101-L107
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/idlelib/PyShell.py
python
ModifiedInterpreter.interrupt_subprocess
(self)
[]
def interrupt_subprocess(self): threading.Thread(target=self.__request_interrupt).start()
[ "def", "interrupt_subprocess", "(", "self", ")", ":", "threading", ".", "Thread", "(", "target", "=", "self", ".", "__request_interrupt", ")", ".", "start", "(", ")" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/idlelib/PyShell.py#L466-L467
mchristopher/PokemonGo-DesktopMap
ec37575f2776ee7d64456e2a1f6b6b78830b4fe0
app/pywin/Lib/urllib2.py
python
HTTPPasswordMgr.reduce_uri
(self, uri, default_port=True)
return authority, path
Accept authority or URI and extract only the authority and path.
Accept authority or URI and extract only the authority and path.
[ "Accept", "authority", "or", "URI", "and", "extract", "only", "the", "authority", "and", "path", "." ]
def reduce_uri(self, uri, default_port=True): """Accept authority or URI and extract only the authority and path.""" # note HTTP URLs do not have a userinfo component parts = urlparse.urlsplit(uri) if parts[1]: # URI scheme = parts[0] authority = parts...
[ "def", "reduce_uri", "(", "self", ",", "uri", ",", "default_port", "=", "True", ")", ":", "# note HTTP URLs do not have a userinfo component", "parts", "=", "urlparse", ".", "urlsplit", "(", "uri", ")", "if", "parts", "[", "1", "]", ":", "# URI", "scheme", "...
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pywin/Lib/urllib2.py#L804-L825
MobSF/Mobile-Security-Framework-MobSF
33abc69b54689fb535c72c720b593dc7ed21a4cf
mobsf/DynamicAnalyzer/views/android/environment.py
python
Environment.get_device_packages
(self)
return device_packages
Get all packages from device.
Get all packages from device.
[ "Get", "all", "packages", "from", "device", "." ]
def get_device_packages(self): """Get all packages from device.""" device_packages = {} out = self.adb_command([ 'pm', 'list', 'packages', '-f', '-3'], True) for pkg_str in out.decode('utf-8').rstrip().split(): path_...
[ "def", "get_device_packages", "(", "self", ")", ":", "device_packages", "=", "{", "}", "out", "=", "self", ".", "adb_command", "(", "[", "'pm'", ",", "'list'", ",", "'packages'", ",", "'-f'", ",", "'-3'", "]", ",", "True", ")", "for", "pkg_str", "in", ...
https://github.com/MobSF/Mobile-Security-Framework-MobSF/blob/33abc69b54689fb535c72c720b593dc7ed21a4cf/mobsf/DynamicAnalyzer/views/android/environment.py#L416-L442
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/django/contrib/gis/utils/layermapping.py
python
LayerMapping.check_unique
(self, unique)
Checks the `unique` keyword parameter -- may be a sequence or string.
Checks the `unique` keyword parameter -- may be a sequence or string.
[ "Checks", "the", "unique", "keyword", "parameter", "--", "may", "be", "a", "sequence", "or", "string", "." ]
def check_unique(self, unique): "Checks the `unique` keyword parameter -- may be a sequence or string." if isinstance(unique, (list, tuple)): # List of fields to determine uniqueness with for attr in unique: if not attr in self.mapping: raise ValueError el...
[ "def", "check_unique", "(", "self", ",", "unique", ")", ":", "if", "isinstance", "(", "unique", ",", "(", "list", ",", "tuple", ")", ")", ":", "# List of fields to determine uniqueness with", "for", "attr", "in", "unique", ":", "if", "not", "attr", "in", "...
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/django/contrib/gis/utils/layermapping.py#L261-L271
ynvb/DIE
453fbdf137bfe0510e760df73441d41d35ea74d6
DIE/Lib/DbgImports.py
python
is_funcea_in_module
(self, func_ea, module_name)
return False
Check if function address is part of an imported module (For example: is SetTextColor part of GDI32)
Check if function address is part of an imported module (For example: is SetTextColor part of GDI32)
[ "Check", "if", "function", "address", "is", "part", "of", "an", "imported", "module", "(", "For", "example", ":", "is", "SetTextColor", "part", "of", "GDI32", ")" ]
def is_funcea_in_module(self, func_ea, module_name): """ Check if function address is part of an imported module (For example: is SetTextColor part of GDI32) """ if module_name.lower() in self.iat: for ea, name, ord in self.iat[module_name.lower()]: if ea == f...
[ "def", "is_funcea_in_module", "(", "self", ",", "func_ea", ",", "module_name", ")", ":", "if", "module_name", ".", "lower", "(", ")", "in", "self", ".", "iat", ":", "for", "ea", ",", "name", ",", "ord", "in", "self", ".", "iat", "[", "module_name", "...
https://github.com/ynvb/DIE/blob/453fbdf137bfe0510e760df73441d41d35ea74d6/DIE/Lib/DbgImports.py#L72-L81
landlab/landlab
a5dd80b8ebfd03d1ba87ef6c4368c409485f222c
landlab/components/spatial_precip/generate_spatial_precip.py
python
Singer_orographic_rainfall
(z_closest_node_to_center)
return wgts
Return a set of curve weights for a provided z, assuming an orographic rule following that presented in Singer & Michaelides 2017 & Singer et al. 2018 and applicable specifically to Walnut Gulch. i.e., there are three orographic divisions, divided at 1350 m and 1500 m. Parameters ---------- z_c...
Return a set of curve weights for a provided z, assuming an orographic rule following that presented in Singer & Michaelides 2017 & Singer et al. 2018 and applicable specifically to Walnut Gulch. i.e., there are three orographic divisions, divided at 1350 m and 1500 m.
[ "Return", "a", "set", "of", "curve", "weights", "for", "a", "provided", "z", "assuming", "an", "orographic", "rule", "following", "that", "presented", "in", "Singer", "&", "Michaelides", "2017", "&", "Singer", "et", "al", ".", "2018", "and", "applicable", ...
def Singer_orographic_rainfall(z_closest_node_to_center): """Return a set of curve weights for a provided z, assuming an orographic rule following that presented in Singer & Michaelides 2017 & Singer et al. 2018 and applicable specifically to Walnut Gulch. i.e., there are three orographic divisions, div...
[ "def", "Singer_orographic_rainfall", "(", "z_closest_node_to_center", ")", ":", "if", "z_closest_node_to_center", "<=", "1350", ":", "wgts", "=", "[", "0.0318", ",", "0.0759", ",", "0.0851", ",", "0.0941", ",", "0.0941", ",", "0.0941", ",", "0.0941", ",", "0.0...
https://github.com/landlab/landlab/blob/a5dd80b8ebfd03d1ba87ef6c4368c409485f222c/landlab/components/spatial_precip/generate_spatial_precip.py#L1627-L1686
gpodder/mygpo
7a028ad621d05d4ca0d58fd22fb92656c8835e43
mygpo/web/utils.py
python
get_page_list
(start, total, cur, show_max)
return ps
returns a list of pages to be linked for navigation in a paginated view >>> get_page_list(1, 100, 1, 10) [1, 2, 3, 4, 5, 6, '...', 98, 99, 100] >>> get_page_list(1, 995/10, 1, 10) [1, 2, 3, 4, 5, 6, '...', 98, 99, 100] >>> get_page_list(1, 100, 50, 10) [1, '...', 48, 49, 50, 51, '...', 98, 99...
returns a list of pages to be linked for navigation in a paginated view
[ "returns", "a", "list", "of", "pages", "to", "be", "linked", "for", "navigation", "in", "a", "paginated", "view" ]
def get_page_list(start, total, cur, show_max): """ returns a list of pages to be linked for navigation in a paginated view >>> get_page_list(1, 100, 1, 10) [1, 2, 3, 4, 5, 6, '...', 98, 99, 100] >>> get_page_list(1, 995/10, 1, 10) [1, 2, 3, 4, 5, 6, '...', 98, 99, 100] >>> get_page_list(...
[ "def", "get_page_list", "(", "start", ",", "total", ",", "cur", ",", "show_max", ")", ":", "# if we get \"total\" as a float (eg from total_entries / entries_per_page)", "# we round up", "total", "=", "math", ".", "ceil", "(", "total", ")", "if", "show_max", ">=", "...
https://github.com/gpodder/mygpo/blob/7a028ad621d05d4ca0d58fd22fb92656c8835e43/mygpo/web/utils.py#L72-L120
amaranth-lang/amaranth
7d611b8fc1d9e58853ff268ec38ff8f4131a9774
amaranth/build/run.py
python
BuildPlan.add_file
(self, filename, content)
Add ``content``, which can be a :class:`str`` or :class:`bytes`, to the build plan as ``filename``. The file name can be a relative path with directories separated by forward slashes (``/``).
Add ``content``, which can be a :class:`str`` or :class:`bytes`, to the build plan as ``filename``. The file name can be a relative path with directories separated by forward slashes (``/``).
[ "Add", "content", "which", "can", "be", "a", ":", "class", ":", "str", "or", ":", "class", ":", "bytes", "to", "the", "build", "plan", "as", "filename", ".", "The", "file", "name", "can", "be", "a", "relative", "path", "with", "directories", "separated...
def add_file(self, filename, content): """ Add ``content``, which can be a :class:`str`` or :class:`bytes`, to the build plan as ``filename``. The file name can be a relative path with directories separated by forward slashes (``/``). """ assert isinstance(filename, str) ...
[ "def", "add_file", "(", "self", ",", "filename", ",", "content", ")", ":", "assert", "isinstance", "(", "filename", ",", "str", ")", "and", "filename", "not", "in", "self", ".", "files", "self", ".", "files", "[", "filename", "]", "=", "content" ]
https://github.com/amaranth-lang/amaranth/blob/7d611b8fc1d9e58853ff268ec38ff8f4131a9774/amaranth/build/run.py#L29-L36
SmileyChris/django-countries
62ed634f2e96ea734416c07f4034f4f37b13e706
django_countries/fields.py
python
CountryField.get_prep_value
(self, value)
return super(CharField, self).get_prep_value(value)
Returns field's value prepared for saving into a database.
Returns field's value prepared for saving into a database.
[ "Returns", "field", "s", "value", "prepared", "for", "saving", "into", "a", "database", "." ]
def get_prep_value(self, value): "Returns field's value prepared for saving into a database." value = self.get_clean_value(value) if self.multiple: if value: value = ",".join(value) else: value = "" return super(CharField, self).get...
[ "def", "get_prep_value", "(", "self", ",", "value", ")", ":", "value", "=", "self", ".", "get_clean_value", "(", "value", ")", "if", "self", ".", "multiple", ":", "if", "value", ":", "value", "=", "\",\"", ".", "join", "(", "value", ")", "else", ":",...
https://github.com/SmileyChris/django-countries/blob/62ed634f2e96ea734416c07f4034f4f37b13e706/django_countries/fields.py#L325-L333
biolab/orange3
41685e1c7b1d1babe680113685a2d44bcc9fec0b
Orange/widgets/data/owoutliers.py
python
ParametersEditor.__init__
(self, parent)
[]
def __init__(self, parent): QWidget.__init__(self, parent) gui.OWComponent.__init__(self, parent) self.setMinimumWidth(300) layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout) self.param_box = gui.vBox(self, spacing=0)
[ "def", "__init__", "(", "self", ",", "parent", ")", ":", "QWidget", ".", "__init__", "(", "self", ",", "parent", ")", "gui", ".", "OWComponent", ".", "__init__", "(", "self", ",", "parent", ")", "self", ".", "setMinimumWidth", "(", "300", ")", "layout"...
https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/data/owoutliers.py#L60-L68
tensorflow/estimator
edb6e18703a0fa00182bcc72a056da6f5ce45e70
tensorflow_estimator/python/estimator/tpu/tpu_estimator.py
python
_add_item_to_params
(params, key, value)
Adds a new item into `params`.
Adds a new item into `params`.
[ "Adds", "a", "new", "item", "into", "params", "." ]
def _add_item_to_params(params, key, value): """Adds a new item into `params`.""" if hasattr(params, 'set_hparam'): # For HParams, we need to use special API. if key in params: params.set_hparam(key, value) else: params.add_hparam(key, value) else: # Now params is Python dict. para...
[ "def", "_add_item_to_params", "(", "params", ",", "key", ",", "value", ")", ":", "if", "hasattr", "(", "params", ",", "'set_hparam'", ")", ":", "# For HParams, we need to use special API.", "if", "key", "in", "params", ":", "params", ".", "set_hparam", "(", "k...
https://github.com/tensorflow/estimator/blob/edb6e18703a0fa00182bcc72a056da6f5ce45e70/tensorflow_estimator/python/estimator/tpu/tpu_estimator.py#L4243-L4253
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/prometheus_client/decorator.py
python
FunctionMaker.update
(self, func, **kw)
Update the signature of func with the data in self
Update the signature of func with the data in self
[ "Update", "the", "signature", "of", "func", "with", "the", "data", "in", "self" ]
def update(self, func, **kw): "Update the signature of func with the data in self" func.__name__ = self.name func.__doc__ = getattr(self, 'doc', None) func.__dict__ = getattr(self, 'dict', {}) func.__defaults__ = getattr(self, 'defaults', ()) func.__kwdefaults__ = getattr...
[ "def", "update", "(", "self", ",", "func", ",", "*", "*", "kw", ")", ":", "func", ".", "__name__", "=", "self", ".", "name", "func", ".", "__doc__", "=", "getattr", "(", "self", ",", "'doc'", ",", "None", ")", "func", ".", "__dict__", "=", "getat...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/prometheus_client/decorator.py#L153-L168
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/preview/understand/assistant/dialogue.py
python
DialogueInstance._proxy
(self)
return self._context
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context :returns: DialogueContext for this DialogueInstance :rtype: twilio.rest.preview.understand.assistant.dialogue.DialogueContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
[ "Generate", "an", "instance", "context", "for", "the", "instance", "the", "context", "is", "capable", "of", "performing", "various", "actions", ".", "All", "instance", "actions", "are", "proxied", "to", "the", "context" ]
def _proxy(self): """ Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context :returns: DialogueContext for this DialogueInstance :rtype: twilio.rest.preview.understand.assistant.dialog...
[ "def", "_proxy", "(", "self", ")", ":", "if", "self", ".", "_context", "is", "None", ":", "self", ".", "_context", "=", "DialogueContext", "(", "self", ".", "_version", ",", "assistant_sid", "=", "self", ".", "_solution", "[", "'assistant_sid'", "]", ","...
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/preview/understand/assistant/dialogue.py#L187-L201
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/gdata/src/gdata/contacts/service.py
python
ContactsService.ExecuteBatchProfiles
(self, batch_feed, url, converter=gdata.contacts.ProfilesFeedFromString)
return self.Post(batch_feed, url, converter=converter)
Sends a batch request feed to the server. Args: batch_feed: gdata.profiles.ProfilesFeed A feed containing batch request entries. Each entry contains the operation to be performed on the data contained in the entry. For example an entry with an operation type of insert will be us...
Sends a batch request feed to the server.
[ "Sends", "a", "batch", "request", "feed", "to", "the", "server", "." ]
def ExecuteBatchProfiles(self, batch_feed, url, converter=gdata.contacts.ProfilesFeedFromString): """Sends a batch request feed to the server. Args: batch_feed: gdata.profiles.ProfilesFeed A feed containing batch request entries. Each entry contains the operation to be perfor...
[ "def", "ExecuteBatchProfiles", "(", "self", ",", "batch_feed", ",", "url", ",", "converter", "=", "gdata", ".", "contacts", ".", "ProfilesFeedFromString", ")", ":", "return", "self", ".", "Post", "(", "batch_feed", ",", "url", ",", "converter", "=", "convert...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/gdata/src/gdata/contacts/service.py#L353-L372
wistbean/learn_python3_spider
73c873f4845f4385f097e5057407d03dd37a117b
stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py
python
_is_egg_path
(path)
return path.lower().endswith('.egg')
Determine if given path appears to be an egg.
Determine if given path appears to be an egg.
[ "Determine", "if", "given", "path", "appears", "to", "be", "an", "egg", "." ]
def _is_egg_path(path): """ Determine if given path appears to be an egg. """ return path.lower().endswith('.egg')
[ "def", "_is_egg_path", "(", "path", ")", ":", "return", "path", ".", "lower", "(", ")", ".", "endswith", "(", "'.egg'", ")" ]
https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py#L2256-L2260
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v1beta1_self_subject_rules_review_spec.py
python
V1beta1SelfSubjectRulesReviewSpec.__eq__
(self, other)
return self.to_dict() == other.to_dict()
Returns true if both objects are equal
Returns true if both objects are equal
[ "Returns", "true", "if", "both", "objects", "are", "equal" ]
def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, V1beta1SelfSubjectRulesReviewSpec): return False return self.to_dict() == other.to_dict()
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "V1beta1SelfSubjectRulesReviewSpec", ")", ":", "return", "False", "return", "self", ".", "to_dict", "(", ")", "==", "other", ".", "to_dict", "(", ")" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1beta1_self_subject_rules_review_spec.py#L110-L115
SHI-Labs/Decoupled-Classification-Refinement
16202b48eb9cbf79a9b130a98e8c209d4f24693e
faster_rcnn/core/DataParallelExecutorGroup.py
python
DataParallelExecutorGroup.update_metric
(self, eval_metric, labels)
Accumulate the performance according to `eval_metric` on all devices. Parameters ---------- eval_metric : EvalMetric The metric used for evaluation. labels : list of NDArray Typically comes from `label` of a `DataBatch`.
Accumulate the performance according to `eval_metric` on all devices.
[ "Accumulate", "the", "performance", "according", "to", "eval_metric", "on", "all", "devices", "." ]
def update_metric(self, eval_metric, labels): """Accumulate the performance according to `eval_metric` on all devices. Parameters ---------- eval_metric : EvalMetric The metric used for evaluation. labels : list of NDArray Typically comes from `label` of ...
[ "def", "update_metric", "(", "self", ",", "eval_metric", ",", "labels", ")", ":", "for", "texec", ",", "labels", "in", "zip", "(", "self", ".", "execs", ",", "labels", ")", ":", "eval_metric", ".", "update", "(", "labels", ",", "texec", ".", "outputs",...
https://github.com/SHI-Labs/Decoupled-Classification-Refinement/blob/16202b48eb9cbf79a9b130a98e8c209d4f24693e/faster_rcnn/core/DataParallelExecutorGroup.py#L470-L481
ivre/ivre
5728855b51c0ae2e59450a1c3a782febcad2128b
ivre/tools/httpd.py
python
server_static
(filepath: str)
return static_file(filepath, root=WEB_STATIC_PATH)
Serve the static (HTML, JS, CSS, ...) content.
Serve the static (HTML, JS, CSS, ...) content.
[ "Serve", "the", "static", "(", "HTML", "JS", "CSS", "...", ")", "content", "." ]
def server_static(filepath: str) -> HTTPResponse: """Serve the static (HTML, JS, CSS, ...) content.""" assert WEB_STATIC_PATH is not None return static_file(filepath, root=WEB_STATIC_PATH)
[ "def", "server_static", "(", "filepath", ":", "str", ")", "->", "HTTPResponse", ":", "assert", "WEB_STATIC_PATH", "is", "not", "None", "return", "static_file", "(", "filepath", ",", "root", "=", "WEB_STATIC_PATH", ")" ]
https://github.com/ivre/ivre/blob/5728855b51c0ae2e59450a1c3a782febcad2128b/ivre/tools/httpd.py#L90-L93
mediacloud/backend
d36b489e4fbe6e44950916a04d9543a1d6cd5df0
apps/common/src/python/mediawords/util/config/common.py
python
CommonConfig.user_agent
()
return UserAgentConfig()
UserAgent configuration.
UserAgent configuration.
[ "UserAgent", "configuration", "." ]
def user_agent() -> UserAgentConfig: """UserAgent configuration.""" return UserAgentConfig()
[ "def", "user_agent", "(", ")", "->", "UserAgentConfig", ":", "return", "UserAgentConfig", "(", ")" ]
https://github.com/mediacloud/backend/blob/d36b489e4fbe6e44950916a04d9543a1d6cd5df0/apps/common/src/python/mediawords/util/config/common.py#L504-L506
lad1337/XDM
0c1b7009fe00f06f102a6f67c793478f515e7efe
site-packages/logilab/astng/builder.py
python
ASTNGBuilder.add_from_names_to_locals
(self, node)
store imported names to the locals; resort the locals if coming from a delayed node
store imported names to the locals; resort the locals if coming from a delayed node
[ "store", "imported", "names", "to", "the", "locals", ";", "resort", "the", "locals", "if", "coming", "from", "a", "delayed", "node" ]
def add_from_names_to_locals(self, node): """store imported names to the locals; resort the locals if coming from a delayed node """ _key_func = lambda node: node.fromlineno def sort_locals(my_list): my_list.sort(key=_key_func) for (name, asname) in node.name...
[ "def", "add_from_names_to_locals", "(", "self", ",", "node", ")", ":", "_key_func", "=", "lambda", "node", ":", "node", ".", "fromlineno", "def", "sort_locals", "(", "my_list", ")", ":", "my_list", ".", "sort", "(", "key", "=", "_key_func", ")", "for", "...
https://github.com/lad1337/XDM/blob/0c1b7009fe00f06f102a6f67c793478f515e7efe/site-packages/logilab/astng/builder.py#L168-L187
OpenMDAO/OpenMDAO
f47eb5485a0bb5ea5d2ae5bd6da4b94dc6b296bd
openmdao/jacobians/dictionary_jacobian.py
python
DictionaryJacobian.__init__
(self, system, **kwargs)
Initialize all attributes.
Initialize all attributes.
[ "Initialize", "all", "attributes", "." ]
def __init__(self, system, **kwargs): """ Initialize all attributes. """ super().__init__(system, **kwargs) self._iter_keys = None # avoid circular import from openmdao.core.explicitcomponent import ExplicitComponent self._is_explicit = isinstance(system...
[ "def", "__init__", "(", "self", ",", "system", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "__init__", "(", "system", ",", "*", "*", "kwargs", ")", "self", ".", "_iter_keys", "=", "None", "# avoid circular import", "from", "openmdao", "....
https://github.com/OpenMDAO/OpenMDAO/blob/f47eb5485a0bb5ea5d2ae5bd6da4b94dc6b296bd/openmdao/jacobians/dictionary_jacobian.py#L28-L38
QQuick/Transcrypt
68b4b71d4ff3e4d58281b24e9e2dcc9fc766e822
transcrypt/modules/re/__init__.py
python
Regex.findall
(self, string, pos = 0, endpos = None)
return(ret)
Find All the matches to this regex in the passed string @return either: List of strings of the matched regex has 1 or 0 capture groups List of elements that are each a list of the groups matched at each location in the string. @see the python docs
Find All the matches to this regex in the passed string
[ "Find", "All", "the", "matches", "to", "this", "regex", "in", "the", "passed", "string" ]
def findall(self, string, pos = 0, endpos = None): """ Find All the matches to this regex in the passed string @return either: List of strings of the matched regex has 1 or 0 capture groups List of elements that are each a list of the groups matched at each lo...
[ "def", "findall", "(", "self", ",", "string", ",", "pos", "=", "0", ",", "endpos", "=", "None", ")", ":", "mlist", "=", "self", ".", "_findAllMatches", "(", "string", ",", "pos", ",", "endpos", ")", "def", "mSelect", "(", "m", ")", ":", "if", "("...
https://github.com/QQuick/Transcrypt/blob/68b4b71d4ff3e4d58281b24e9e2dcc9fc766e822/transcrypt/modules/re/__init__.py#L587-L612
Jenyay/outwiker
50530cf7b3f71480bb075b2829bc0669773b835b
src/outwiker/gui/controls/ultimatelistctrl.py
python
UltimateListItem.GetBackgroundColour
(self)
return (self.HasAttributes() and [self._attr.GetBackgroundColour()] or [wx.NullColour])[0]
Returns the background colour.
Returns the background colour.
[ "Returns", "the", "background", "colour", "." ]
def GetBackgroundColour(self): """ Returns the background colour. """ return (self.HasAttributes() and [self._attr.GetBackgroundColour()] or [wx.NullColour])[0]
[ "def", "GetBackgroundColour", "(", "self", ")", ":", "return", "(", "self", ".", "HasAttributes", "(", ")", "and", "[", "self", ".", "_attr", ".", "GetBackgroundColour", "(", ")", "]", "or", "[", "wx", ".", "NullColour", "]", ")", "[", "0", "]" ]
https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/src/outwiker/gui/controls/ultimatelistctrl.py#L1805-L1808
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_adm_router.py
python
DeploymentConfig.needs_update_volume
(self, volume, volume_mount)
return not all(results)
verify a volume update is needed
verify a volume update is needed
[ "verify", "a", "volume", "update", "is", "needed" ]
def needs_update_volume(self, volume, volume_mount): ''' verify a volume update is needed ''' exist_volume = self.find_volume_by_name(volume) exist_volume_mount = self.find_volume_by_name(volume, mounts=True) results = [] results.append(exist_volume['name'] == volume['name']) ...
[ "def", "needs_update_volume", "(", "self", ",", "volume", ",", "volume_mount", ")", ":", "exist_volume", "=", "self", ".", "find_volume_by_name", "(", "volume", ")", "exist_volume_mount", "=", "self", ".", "find_volume_by_name", "(", "volume", ",", "mounts", "="...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_adm_router.py#L2110-L2140
eugenevinitsky/sequential_social_dilemma_games
ef3dd2c3d838880e71daf7d13246f2e0342cd1ab
algorithms/ppo_scm.py
python
loss_with_scm
(policy, model, dist_class, train_batch)
return policy.loss_obj.loss
Calculate PPO loss with SCM and MOA loss :return: Combined PPO+MOA+SCM loss
Calculate PPO loss with SCM and MOA loss :return: Combined PPO+MOA+SCM loss
[ "Calculate", "PPO", "loss", "with", "SCM", "and", "MOA", "loss", ":", "return", ":", "Combined", "PPO", "+", "MOA", "+", "SCM", "loss" ]
def loss_with_scm(policy, model, dist_class, train_batch): """ Calculate PPO loss with SCM and MOA loss :return: Combined PPO+MOA+SCM loss """ _ = loss_with_moa(policy, model, dist_class, train_batch) scm_loss = setup_scm_loss(policy, train_batch) policy.scm_loss = scm_loss.total_loss ...
[ "def", "loss_with_scm", "(", "policy", ",", "model", ",", "dist_class", ",", "train_batch", ")", ":", "_", "=", "loss_with_moa", "(", "policy", ",", "model", ",", "dist_class", ",", "train_batch", ")", "scm_loss", "=", "setup_scm_loss", "(", "policy", ",", ...
https://github.com/eugenevinitsky/sequential_social_dilemma_games/blob/ef3dd2c3d838880e71daf7d13246f2e0342cd1ab/algorithms/ppo_scm.py#L41-L53
git-cola/git-cola
b48b8028e0c3baf47faf7b074b9773737358163d
cola/widgets/status.py
python
StatusTreeWidget.modified
(self)
return qtutils.get_selected_values(self, MODIFIED_IDX, self.m.modified)
[]
def modified(self): return qtutils.get_selected_values(self, MODIFIED_IDX, self.m.modified)
[ "def", "modified", "(", "self", ")", ":", "return", "qtutils", ".", "get_selected_values", "(", "self", ",", "MODIFIED_IDX", ",", "self", ".", "m", ".", "modified", ")" ]
https://github.com/git-cola/git-cola/blob/b48b8028e0c3baf47faf7b074b9773737358163d/cola/widgets/status.py#L1031-L1032
giantbranch/pwn_deploy_chroot
facb20a2bd61bfae2ef63218881102bd675d6861
initialize.py
python
isExistBeforeGetFlagAndPort
(filename, contentBefore)
return ret
[]
def isExistBeforeGetFlagAndPort(filename, contentBefore): filename_tmp = "" tmp_dict = "" ret = False for line in contentBefore: tmp_dict = json.loads(line) filename_tmp = tmp_dict["filename"] if filename == filename_tmp: ret = [tmp_dict["flag"], tmp_dict["port"]] ...
[ "def", "isExistBeforeGetFlagAndPort", "(", "filename", ",", "contentBefore", ")", ":", "filename_tmp", "=", "\"\"", "tmp_dict", "=", "\"\"", "ret", "=", "False", "for", "line", "in", "contentBefore", ":", "tmp_dict", "=", "json", ".", "loads", "(", "line", "...
https://github.com/giantbranch/pwn_deploy_chroot/blob/facb20a2bd61bfae2ef63218881102bd675d6861/initialize.py#L20-L29
internetarchive/brozzler
427908e8210fcbaab22ce8254bd8f8efb72d33c0
brozzler/robots.py
python
_reppy_rules_getitem
(self, agent)
return self.agents.get('*')
Find the user-agent token matching the supplied full user-agent, using a case-insensitive substring search.
Find the user-agent token matching the supplied full user-agent, using a case-insensitive substring search.
[ "Find", "the", "user", "-", "agent", "token", "matching", "the", "supplied", "full", "user", "-", "agent", "using", "a", "case", "-", "insensitive", "substring", "search", "." ]
def _reppy_rules_getitem(self, agent): ''' Find the user-agent token matching the supplied full user-agent, using a case-insensitive substring search. ''' lc_agent = agent.lower() for s in self.agents: if s in lc_agent: return self.agents[s] return self.agents.get('*')
[ "def", "_reppy_rules_getitem", "(", "self", ",", "agent", ")", ":", "lc_agent", "=", "agent", ".", "lower", "(", ")", "for", "s", "in", "self", ".", "agents", ":", "if", "s", "in", "lc_agent", ":", "return", "self", ".", "agents", "[", "s", "]", "r...
https://github.com/internetarchive/brozzler/blob/427908e8210fcbaab22ce8254bd8f8efb72d33c0/brozzler/robots.py#L37-L46
lovit/soynlp
503eaee28799e9a3baf01483c6fc59e0db524fa3
soynlp/utils/utils.py
python
get_available_memory
()
return 100 * mem.available / (mem.total)
It returns remained memory as percentage
It returns remained memory as percentage
[ "It", "returns", "remained", "memory", "as", "percentage" ]
def get_available_memory(): """It returns remained memory as percentage""" mem = psutil.virtual_memory() return 100 * mem.available / (mem.total)
[ "def", "get_available_memory", "(", ")", ":", "mem", "=", "psutil", ".", "virtual_memory", "(", ")", "return", "100", "*", "mem", ".", "available", "/", "(", "mem", ".", "total", ")" ]
https://github.com/lovit/soynlp/blob/503eaee28799e9a3baf01483c6fc59e0db524fa3/soynlp/utils/utils.py#L13-L17
openstack/zaqar
1726ac41b5369cc30e99fd652f29f5300b95d958
zaqar/storage/base.py
python
Subscription.create
(self, queue, subscriber, ttl, options, project=None)
Create a new subscription. :param queue:The source queue for notifications :type queue: str :param subscriber: The subscriber URI :type subscriber: str :param ttl: time to live for this subscription :type ttl: int :param options: Options used to configure this su...
Create a new subscription.
[ "Create", "a", "new", "subscription", "." ]
def create(self, queue, subscriber, ttl, options, project=None): """Create a new subscription. :param queue:The source queue for notifications :type queue: str :param subscriber: The subscriber URI :type subscriber: str :param ttl: time to live for this subscription ...
[ "def", "create", "(", "self", ",", "queue", ",", "subscriber", ",", "ttl", ",", "options", ",", "project", "=", "None", ")", ":", "raise", "NotImplementedError" ]
https://github.com/openstack/zaqar/blob/1726ac41b5369cc30e99fd652f29f5300b95d958/zaqar/storage/base.py#L657-L674
frescobaldi/frescobaldi
301cc977fc4ba7caa3df9e4bf905212ad5d06912
frescobaldi_app/actioncollection.py
python
ActionCollectionBase.defaultShortcuts
(self, name)
return self._defaults.get(name)
Returns the default shortcuts (list of QKeySequences) for the action. If not defined, returns None.
Returns the default shortcuts (list of QKeySequences) for the action.
[ "Returns", "the", "default", "shortcuts", "(", "list", "of", "QKeySequences", ")", "for", "the", "action", "." ]
def defaultShortcuts(self, name): """Returns the default shortcuts (list of QKeySequences) for the action. If not defined, returns None. """ return self._defaults.get(name)
[ "def", "defaultShortcuts", "(", "self", ",", "name", ")", ":", "return", "self", ".", "_defaults", ".", "get", "(", "name", ")" ]
https://github.com/frescobaldi/frescobaldi/blob/301cc977fc4ba7caa3df9e4bf905212ad5d06912/frescobaldi_app/actioncollection.py#L76-L82
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/twisted/twisted/internet/tcp.py
python
BaseClient.createInternetSocket
(self)
return s
(internal) Create a non-blocking socket using self.addressFamily, self.socketType.
(internal) Create a non-blocking socket using self.addressFamily, self.socketType.
[ "(", "internal", ")", "Create", "a", "non", "-", "blocking", "socket", "using", "self", ".", "addressFamily", "self", ".", "socketType", "." ]
def createInternetSocket(self): """(internal) Create a non-blocking socket using self.addressFamily, self.socketType. """ s = socket.socket(self.addressFamily, self.socketType) s.setblocking(0) fdesc._setCloseOnExec(s.fileno()) return s
[ "def", "createInternetSocket", "(", "self", ")", ":", "s", "=", "socket", ".", "socket", "(", "self", ".", "addressFamily", ",", "self", ".", "socketType", ")", "s", ".", "setblocking", "(", "0", ")", "fdesc", ".", "_setCloseOnExec", "(", "s", ".", "fi...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/internet/tcp.py#L606-L613
rotki/rotki
aafa446815cdd5e9477436d1b02bee7d01b398c8
rotkehlchen/data/importer.py
python
DataImporter._consume_nexo
(self, csv_row: Dict[str, Any], **kwargs: Any)
Consume CSV file from NEXO. This method can raise: - UnsupportedNexoEntry - UnknownAsset - DeserializationError - sqlcipher.IntegrityError from db_ledger.add_ledger_action
Consume CSV file from NEXO. This method can raise: - UnsupportedNexoEntry - UnknownAsset - DeserializationError - sqlcipher.IntegrityError from db_ledger.add_ledger_action
[ "Consume", "CSV", "file", "from", "NEXO", ".", "This", "method", "can", "raise", ":", "-", "UnsupportedNexoEntry", "-", "UnknownAsset", "-", "DeserializationError", "-", "sqlcipher", ".", "IntegrityError", "from", "db_ledger", ".", "add_ledger_action" ]
def _consume_nexo(self, csv_row: Dict[str, Any], **kwargs: Any) -> None: """ Consume CSV file from NEXO. This method can raise: - UnsupportedNexoEntry - UnknownAsset - DeserializationError - sqlcipher.IntegrityError from db_ledger.add_ledger_action """ ...
[ "def", "_consume_nexo", "(", "self", ",", "csv_row", ":", "Dict", "[", "str", ",", "Any", "]", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "ignored_entries", "=", "(", "'ExchangeToWithdraw'", ",", "'DepositToExchange'", ",", "'UnlockingTer...
https://github.com/rotki/rotki/blob/aafa446815cdd5e9477436d1b02bee7d01b398c8/rotkehlchen/data/importer.py#L931-L1038
jython/jython3
def4f8ec47cb7a9c799ea4c745f12badf92c5769
lib-python/3.5.1/logging/handlers.py
python
SocketHandler.__init__
(self, host, port)
Initializes the handler with a specific host address and port. When the attribute *closeOnError* is set to True - if a socket error occurs, the socket is silently closed and then reopened on the next logging call.
Initializes the handler with a specific host address and port.
[ "Initializes", "the", "handler", "with", "a", "specific", "host", "address", "and", "port", "." ]
def __init__(self, host, port): """ Initializes the handler with a specific host address and port. When the attribute *closeOnError* is set to True - if a socket error occurs, the socket is silently closed and then reopened on the next logging call. """ logging.H...
[ "def", "__init__", "(", "self", ",", "host", ",", "port", ")", ":", "logging", ".", "Handler", ".", "__init__", "(", "self", ")", "self", ".", "host", "=", "host", "self", ".", "port", "=", "port", "if", "port", "is", "None", ":", "self", ".", "a...
https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/logging/handlers.py#L486-L509
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/sphinx/sphinx/util/png.py
python
read_png_depth
(filename)
return result
Read the special tEXt chunk indicating the depth from a PNG file.
Read the special tEXt chunk indicating the depth from a PNG file.
[ "Read", "the", "special", "tEXt", "chunk", "indicating", "the", "depth", "from", "a", "PNG", "file", "." ]
def read_png_depth(filename): """Read the special tEXt chunk indicating the depth from a PNG file.""" result = None f = open(filename, 'rb') try: f.seek(- (LEN_IEND + LEN_DEPTH), 2) depthchunk = f.read(LEN_DEPTH) if not depthchunk.startswith(DEPTH_CHUNK_LEN + DEPTH_CHUNK_START): ...
[ "def", "read_png_depth", "(", "filename", ")", ":", "result", "=", "None", "f", "=", "open", "(", "filename", ",", "'rb'", ")", "try", ":", "f", ".", "seek", "(", "-", "(", "LEN_IEND", "+", "LEN_DEPTH", ")", ",", "2", ")", "depthchunk", "=", "f", ...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/sphinx/sphinx/util/png.py#L25-L38
zhanghan1990/zipline-chinese
86904cac4b6e928271f640910aa83675ce945b8b
zipline/pipeline/engine.py
python
PipelineEngine.run_pipeline
(self, pipeline, start_date, end_date)
Compute values for `pipeline` between `start_date` and `end_date`. Returns a DataFrame with a MultiIndex of (date, asset) pairs. Parameters ---------- pipeline : zipline.pipeline.Pipeline The pipeline to run. start_date : pd.Timestamp Start date of the c...
Compute values for `pipeline` between `start_date` and `end_date`.
[ "Compute", "values", "for", "pipeline", "between", "start_date", "and", "end_date", "." ]
def run_pipeline(self, pipeline, start_date, end_date): """ Compute values for `pipeline` between `start_date` and `end_date`. Returns a DataFrame with a MultiIndex of (date, asset) pairs. Parameters ---------- pipeline : zipline.pipeline.Pipeline The pipeli...
[ "def", "run_pipeline", "(", "self", ",", "pipeline", ",", "start_date", ",", "end_date", ")", ":", "raise", "NotImplementedError", "(", "\"run_pipeline\"", ")" ]
https://github.com/zhanghan1990/zipline-chinese/blob/86904cac4b6e928271f640910aa83675ce945b8b/zipline/pipeline/engine.py#L34-L63
microsoft/azure-devops-python-api
451cade4c475482792cbe9e522c1fee32393139e
azure-devops/azure/devops/released/git/git_client_base.py
python
GitClientBase.get_comment
(self, repository_id, pull_request_id, thread_id, comment_id, project=None)
return self._deserialize('Comment', response)
GetComment. Retrieve a comment associated with a specific thread in a pull request. :param str repository_id: The repository ID of the pull request's target branch. :param int pull_request_id: ID of the pull request. :param int thread_id: ID of the thread that the desired comment is in. ...
GetComment. Retrieve a comment associated with a specific thread in a pull request. :param str repository_id: The repository ID of the pull request's target branch. :param int pull_request_id: ID of the pull request. :param int thread_id: ID of the thread that the desired comment is in. ...
[ "GetComment", ".", "Retrieve", "a", "comment", "associated", "with", "a", "specific", "thread", "in", "a", "pull", "request", ".", ":", "param", "str", "repository_id", ":", "The", "repository", "ID", "of", "the", "pull", "request", "s", "target", "branch", ...
def get_comment(self, repository_id, pull_request_id, thread_id, comment_id, project=None): """GetComment. Retrieve a comment associated with a specific thread in a pull request. :param str repository_id: The repository ID of the pull request's target branch. :param int pull_request_id: ...
[ "def", "get_comment", "(", "self", ",", "repository_id", ",", "pull_request_id", ",", "thread_id", ",", "comment_id", ",", "project", "=", "None", ")", ":", "route_values", "=", "{", "}", "if", "project", "is", "not", "None", ":", "route_values", "[", "'pr...
https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/released/git/git_client_base.py#L1323-L1348
GalSim-developers/GalSim
a05d4ec3b8d8574f99d3b0606ad882cbba53f345
galsim/noise.py
python
BaseNoise.__div__
(self, variance_ratio)
return self.withScaledVariance(1./variance_ratio)
Equivalent to self * (1/variance_ratio)
Equivalent to self * (1/variance_ratio)
[ "Equivalent", "to", "self", "*", "(", "1", "/", "variance_ratio", ")" ]
def __div__(self, variance_ratio): """Equivalent to self * (1/variance_ratio)""" return self.withScaledVariance(1./variance_ratio)
[ "def", "__div__", "(", "self", ",", "variance_ratio", ")", ":", "return", "self", ".", "withScaledVariance", "(", "1.", "/", "variance_ratio", ")" ]
https://github.com/GalSim-developers/GalSim/blob/a05d4ec3b8d8574f99d3b0606ad882cbba53f345/galsim/noise.py#L184-L186
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/deap/tools/support.py
python
Statistics.compile
(self, data)
return entry
Apply to the input sequence *data* each registered function and return the results as a dictionnary. :param data: Sequence of objects on which the statistics are computed.
Apply to the input sequence *data* each registered function and return the results as a dictionnary. :param data: Sequence of objects on which the statistics are computed.
[ "Apply", "to", "the", "input", "sequence", "*", "data", "*", "each", "registered", "function", "and", "return", "the", "results", "as", "a", "dictionnary", ".", ":", "param", "data", ":", "Sequence", "of", "objects", "on", "which", "the", "statistics", "ar...
def compile(self, data): """Apply to the input sequence *data* each registered function and return the results as a dictionnary. :param data: Sequence of objects on which the statistics are computed. """ values = tuple(self.key(elem) for elem in data) e...
[ "def", "compile", "(", "self", ",", "data", ")", ":", "values", "=", "tuple", "(", "self", ".", "key", "(", "elem", ")", "for", "elem", "in", "data", ")", "entry", "=", "dict", "(", ")", "for", "key", ",", "func", "in", "self", ".", "functions", ...
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/deap/tools/support.py#L198-L209
openstack/manila
142990edc027e14839d5deaf4954dd6fc88de15e
manila/share/drivers/zfsonlinux/driver.py
python
ZFSonLinuxShareDriver.create_snapshot
(self, context, snapshot, share_server=None)
return {"provider_location": snapshot_name}
Is called to create a snapshot.
Is called to create a snapshot.
[ "Is", "called", "to", "create", "a", "snapshot", "." ]
def create_snapshot(self, context, snapshot, share_server=None): """Is called to create a snapshot.""" dataset_name = self.private_storage.get( snapshot['share_instance_id'], 'dataset_name') snapshot_tag = self._get_snapshot_name(snapshot['id']) snapshot_name = dataset_name +...
[ "def", "create_snapshot", "(", "self", ",", "context", ",", "snapshot", ",", "share_server", "=", "None", ")", ":", "dataset_name", "=", "self", ".", "private_storage", ".", "get", "(", "snapshot", "[", "'share_instance_id'", "]", ",", "'dataset_name'", ")", ...
https://github.com/openstack/manila/blob/142990edc027e14839d5deaf4954dd6fc88de15e/manila/share/drivers/zfsonlinux/driver.py#L541-L554
iTechArt/convtools-ita
25c1057e20581d957bec1339758325dc98fec43e
src/convtools/utils.py
python
BaseOptionsMeta.__init__
(cls, name, bases, kwargs)
[]
def __init__(cls, name, bases, kwargs): super().__init__(name, bases, kwargs) cls._option_attrs = { k: v for k, v in kwargs.items() if not k.startswith("_") and k not in {"clone", "to_defaults"} }
[ "def", "__init__", "(", "cls", ",", "name", ",", "bases", ",", "kwargs", ")", ":", "super", "(", ")", ".", "__init__", "(", "name", ",", "bases", ",", "kwargs", ")", "cls", ".", "_option_attrs", "=", "{", "k", ":", "v", "for", "k", ",", "v", "i...
https://github.com/iTechArt/convtools-ita/blob/25c1057e20581d957bec1339758325dc98fec43e/src/convtools/utils.py#L25-L31
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/common/lib/python2.7/site-packages/libxml2.py
python
htmlDefaultSAXHandlerInit
()
Initialize the default SAX handler
Initialize the default SAX handler
[ "Initialize", "the", "default", "SAX", "handler" ]
def htmlDefaultSAXHandlerInit(): """Initialize the default SAX handler """ libxml2mod.htmlDefaultSAXHandlerInit()
[ "def", "htmlDefaultSAXHandlerInit", "(", ")", ":", "libxml2mod", ".", "htmlDefaultSAXHandlerInit", "(", ")" ]
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/common/lib/python2.7/site-packages/libxml2.py#L842-L844
google/trax
d6cae2067dedd0490b78d831033607357e975015
trax/layers/research/efficient_attention.py
python
SelfAttention.forward_unbatched
(self, x, mask=None, *, weights, state, rng, update_state)
return out, state
Perform attention for a single batch element and head. Args: x: Inputs for a single example (subclasses may use different inputs) mask: Mask for the inputs. weights: Weights for a single attention head state: State for a single example & attention head pair. rng: PRNG key for the laye...
Perform attention for a single batch element and head.
[ "Perform", "attention", "for", "a", "single", "batch", "element", "and", "head", "." ]
def forward_unbatched(self, x, mask=None, *, weights, state, rng, update_state): """Perform attention for a single batch element and head. Args: x: Inputs for a single example (subclasses may use different inputs) mask: Mask for the inputs. weights: Weights for a singl...
[ "def", "forward_unbatched", "(", "self", ",", "x", ",", "mask", "=", "None", ",", "*", ",", "weights", ",", "state", ",", "rng", ",", "update_state", ")", ":", "del", "update_state", "attend_rng", ",", "output_rng", "=", "fastmath", ".", "random", ".", ...
https://github.com/google/trax/blob/d6cae2067dedd0490b78d831033607357e975015/trax/layers/research/efficient_attention.py#L1134-L1199
google-research/tapas
a3e069b50c71f50b12a6e5bb3dad10fb51f6fe68
tapas/run_task_main.py
python
_eval
( task, output_dir, model_dir, global_step = None, )
Evaluate dev and test predictions.
Evaluate dev and test predictions.
[ "Evaluate", "dev", "and", "test", "predictions", "." ]
def _eval( task, output_dir, model_dir, global_step = None, ): """Evaluate dev and test predictions.""" for test_set in TestSet: _eval_for_set( model_dir=model_dir, name=test_set.name.lower(), task=task, interaction_file=_get_test_interactions_file( ta...
[ "def", "_eval", "(", "task", ",", "output_dir", ",", "model_dir", ",", "global_step", "=", "None", ",", ")", ":", "for", "test_set", "in", "TestSet", ":", "_eval_for_set", "(", "model_dir", "=", "model_dir", ",", "name", "=", "test_set", ".", "name", "."...
https://github.com/google-research/tapas/blob/a3e069b50c71f50b12a6e5bb3dad10fb51f6fe68/tapas/run_task_main.py#L705-L749
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/config/configuration.py
python
ConfigNamespace.set_temp
(self, attr, value)
Temporarily set a configuration value. Parameters ---------- attr : str Configuration item name value : object The value to set temporarily. Examples -------- >>> import astropy >>> with astropy.conf.set_temp('use_color', False):...
Temporarily set a configuration value.
[ "Temporarily", "set", "a", "configuration", "value", "." ]
def set_temp(self, attr, value): """ Temporarily set a configuration value. Parameters ---------- attr : str Configuration item name value : object The value to set temporarily. Examples -------- >>> import astropy ...
[ "def", "set_temp", "(", "self", ",", "attr", ",", "value", ")", ":", "if", "hasattr", "(", "self", ",", "attr", ")", ":", "return", "self", ".", "__class__", ".", "__dict__", "[", "attr", "]", ".", "set_temp", "(", "value", ")", "raise", "AttributeEr...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/config/configuration.py#L95-L117
django-tastypie/django-tastypie
2802f0631ad6eed76dc698b4cb7193b97948e58b
tastypie/paginator.py
python
Paginator.get_next
(self, limit, offset, count)
return self._generate_uri(limit, offset + limit)
If a next page is available, will generate a URL to request that page. If not available, this returns ``None``.
If a next page is available, will generate a URL to request that page. If not available, this returns ``None``.
[ "If", "a", "next", "page", "is", "available", "will", "generate", "a", "URL", "to", "request", "that", "page", ".", "If", "not", "available", "this", "returns", "None", "." ]
def get_next(self, limit, offset, count): """ If a next page is available, will generate a URL to request that page. If not available, this returns ``None``. """ if offset + limit >= count: return None return self._generate_uri(limit, offset + limit)
[ "def", "get_next", "(", "self", ",", "limit", ",", "offset", ",", "count", ")", ":", "if", "offset", "+", "limit", ">=", "count", ":", "return", "None", "return", "self", ".", "_generate_uri", "(", "limit", ",", "offset", "+", "limit", ")" ]
https://github.com/django-tastypie/django-tastypie/blob/2802f0631ad6eed76dc698b4cb7193b97948e58b/tastypie/paginator.py#L142-L150
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/github/GitTreeElement.py
python
GitTreeElement.url
(self)
return self._url.value
:type: string
:type: string
[ ":", "type", ":", "string" ]
def url(self): """ :type: string """ return self._url.value
[ "def", "url", "(", "self", ")", ":", "return", "self", ".", "_url", ".", "value" ]
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/github/GitTreeElement.py#L82-L86
twisted/twisted
dee676b040dd38b847ea6fb112a712cb5e119490
src/twisted/protocols/ftp.py
python
IFTPShell.stat
(path, keys=())
Retrieve information about the given path. This is like list, except it will never return results about child paths.
Retrieve information about the given path.
[ "Retrieve", "information", "about", "the", "given", "path", "." ]
def stat(path, keys=()): """ Retrieve information about the given path. This is like list, except it will never return results about child paths. """
[ "def", "stat", "(", "path", ",", "keys", "=", "(", ")", ")", ":" ]
https://github.com/twisted/twisted/blob/dee676b040dd38b847ea6fb112a712cb5e119490/src/twisted/protocols/ftp.py#L1658-L1664
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
datadog_checks_dev/datadog_checks/dev/tooling/manifest_utils.py
python
ManifestV2.has_integration
(self)
return self._manifest_json.get_path("/assets/integration") is not None
[]
def has_integration(self): return self._manifest_json.get_path("/assets/integration") is not None
[ "def", "has_integration", "(", "self", ")", ":", "return", "self", ".", "_manifest_json", ".", "get_path", "(", "\"/assets/integration\"", ")", "is", "not", "None" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/datadog_checks_dev/datadog_checks/dev/tooling/manifest_utils.py#L163-L164
brian-team/brian2
c212a57cb992b766786b5769ebb830ff12d8a8ad
brian2/monitors/ratemonitor.py
python
PopulationRateMonitor.smooth_rate
(self, window='gaussian', width=None)
return Quantity(np.convolve(self.rate_, window * 1. / sum(window), mode='same'), dim=hertz.dim)
smooth_rate(self, window='gaussian', width=None) Return a smooth version of the population rate. Parameters ---------- window : str, ndarray The window to use for smoothing. Can be a string to chose a predefined window(``'flat'`` for a rectangular, and ``'gaussi...
smooth_rate(self, window='gaussian', width=None)
[ "smooth_rate", "(", "self", "window", "=", "gaussian", "width", "=", "None", ")" ]
def smooth_rate(self, window='gaussian', width=None): """ smooth_rate(self, window='gaussian', width=None) Return a smooth version of the population rate. Parameters ---------- window : str, ndarray The window to use for smoothing. Can be a string to chose a...
[ "def", "smooth_rate", "(", "self", ",", "window", "=", "'gaussian'", ",", "width", "=", "None", ")", ":", "if", "width", "is", "None", "and", "isinstance", "(", "window", ",", "str", ")", ":", "raise", "TypeError", "(", "\"Need a width when using a predefine...
https://github.com/brian-team/brian2/blob/c212a57cb992b766786b5769ebb830ff12d8a8ad/brian2/monitors/ratemonitor.py#L88-L158
aiidateam/aiida-core
c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2
aiida/backends/djsite/db/migrations/__init__.py
python
current_schema_version
()
return latest_migration.REVISION
Migrate the current schema version.
Migrate the current schema version.
[ "Migrate", "the", "current", "schema", "version", "." ]
def current_schema_version(): """Migrate the current schema version.""" # Have to use this ugly way of importing because the django migration # files start with numbers which are not a valid package name latest_migration = __import__(f'aiida.backends.djsite.db.migrations.{LATEST_MIGRATION}', fromlist=['...
[ "def", "current_schema_version", "(", ")", ":", "# Have to use this ugly way of importing because the django migration", "# files start with numbers which are not a valid package name", "latest_migration", "=", "__import__", "(", "f'aiida.backends.djsite.db.migrations.{LATEST_MIGRATION}'", "...
https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/backends/djsite/db/migrations/__init__.py#L80-L85
respeaker/get_started_with_respeaker
ec859759fcec7e683a5e09328a8ea307046f353d
files/usr/lib/python2.7/site-packages/tornado/websocket.py
python
WebSocketProtocol13.write_ping
(self, data)
Send ping frame.
Send ping frame.
[ "Send", "ping", "frame", "." ]
def write_ping(self, data): """Send ping frame.""" assert isinstance(data, bytes_type) self._write_frame(True, 0x9, data)
[ "def", "write_ping", "(", "self", ",", "data", ")", ":", "assert", "isinstance", "(", "data", ",", "bytes_type", ")", "self", ".", "_write_frame", "(", "True", ",", "0x9", ",", "data", ")" ]
https://github.com/respeaker/get_started_with_respeaker/blob/ec859759fcec7e683a5e09328a8ea307046f353d/files/usr/lib/python2.7/site-packages/tornado/websocket.py#L576-L579
jazzband/django-ddp
1e1954b06fe140346acea43582515991685e4e01
dddp/main.py
python
common_headers
(environ, **kwargs)
return [ # DDP doesn't use cookies or HTTP level auth, so CSRF attacks are # ineffective. We can safely allow cross-domain DDP connections and # developers may choose to allow anonymous access to publications and # RPC methods as they see fit. More to the point, developers should ...
Return list of common headers for SockJS HTTP responses.
Return list of common headers for SockJS HTTP responses.
[ "Return", "list", "of", "common", "headers", "for", "SockJS", "HTTP", "responses", "." ]
def common_headers(environ, **kwargs): """Return list of common headers for SockJS HTTP responses.""" return [ # DDP doesn't use cookies or HTTP level auth, so CSRF attacks are # ineffective. We can safely allow cross-domain DDP connections and # developers may choose to allow anonymous...
[ "def", "common_headers", "(", "environ", ",", "*", "*", "kwargs", ")", ":", "return", "[", "# DDP doesn't use cookies or HTTP level auth, so CSRF attacks are", "# ineffective. We can safely allow cross-domain DDP connections and", "# developers may choose to allow anonymous access to pu...
https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/main.py#L21-L34
lbryio/lbry-sdk
f78e3825ca0f130834d3876a824f9d380501ced8
lbry/extras/daemon/migrator/migrate3to4.py
python
migrate_blobs_db
(db_dir)
We migrate the blobs.db used in BlobManager to have a "should_announce" column, and set this to True for blobs that are sd_hash's or head blobs (first blob in stream)
We migrate the blobs.db used in BlobManager to have a "should_announce" column, and set this to True for blobs that are sd_hash's or head blobs (first blob in stream)
[ "We", "migrate", "the", "blobs", ".", "db", "used", "in", "BlobManager", "to", "have", "a", "should_announce", "column", "and", "set", "this", "to", "True", "for", "blobs", "that", "are", "sd_hash", "s", "or", "head", "blobs", "(", "first", "blob", "in",...
def migrate_blobs_db(db_dir): """ We migrate the blobs.db used in BlobManager to have a "should_announce" column, and set this to True for blobs that are sd_hash's or head blobs (first blob in stream) """ blobs_db = os.path.join(db_dir, "blobs.db") lbryfile_info_db = os.path.join(db_dir, 'lbryf...
[ "def", "migrate_blobs_db", "(", "db_dir", ")", ":", "blobs_db", "=", "os", ".", "path", ".", "join", "(", "db_dir", ",", "\"blobs.db\"", ")", "lbryfile_info_db", "=", "os", ".", "path", ".", "join", "(", "db_dir", ",", "'lbryfile_info.db'", ")", "# skip mi...
https://github.com/lbryio/lbry-sdk/blob/f78e3825ca0f130834d3876a824f9d380501ced8/lbry/extras/daemon/migrator/migrate3to4.py#L14-L85
YudeWang/deeplabv3plus-pytorch
64843da0d9cb14dbb0cd2775afda9c9ea8fffe53
lib/datasets/VOCDataset.py
python
VOCDataset.__len__
(self)
return len(self.name_list)
[]
def __len__(self): return len(self.name_list)
[ "def", "__len__", "(", "self", ")", ":", "return", "len", "(", "self", ".", "name_list", ")" ]
https://github.com/YudeWang/deeplabv3plus-pytorch/blob/64843da0d9cb14dbb0cd2775afda9c9ea8fffe53/lib/datasets/VOCDataset.py#L113-L114
fxsjy/jiebademo
ba3e5a34cd84b612e13f4dfb9f3ec037928c4339
jiebademo/bottle.py
python
BaseResponse.headerlist
(self)
return list(self.iter_headers())
WSGI conform list of (header, value) tuples.
WSGI conform list of (header, value) tuples.
[ "WSGI", "conform", "list", "of", "(", "header", "value", ")", "tuples", "." ]
def headerlist(self): ''' WSGI conform list of (header, value) tuples. ''' return list(self.iter_headers())
[ "def", "headerlist", "(", "self", ")", ":", "return", "list", "(", "self", ".", "iter_headers", "(", ")", ")" ]
https://github.com/fxsjy/jiebademo/blob/ba3e5a34cd84b612e13f4dfb9f3ec037928c4339/jiebademo/bottle.py#L1351-L1353
fonttools/fonttools
892322aaff6a89bea5927379ec06bc0da3dfb7df
Lib/fontTools/merge/__init__.py
python
Merger._postMerge
(self, font)
[]
def _postMerge(self, font): layoutPostMerge(font)
[ "def", "_postMerge", "(", "self", ",", "font", ")", ":", "layoutPostMerge", "(", "font", ")" ]
https://github.com/fonttools/fonttools/blob/892322aaff6a89bea5927379ec06bc0da3dfb7df/Lib/fontTools/merge/__init__.py#L155-L156
fbcotter/py3nvml
0aa41c0940c7d971381fddb8382266a819be9f75
py3nvml/py3nvml.py
python
NVMLError.__new__
(typ, value)
return obj
Maps value to a proper subclass of NVMLError. See _extractNVMLErrorsAsClasses function for more details
Maps value to a proper subclass of NVMLError. See _extractNVMLErrorsAsClasses function for more details
[ "Maps", "value", "to", "a", "proper", "subclass", "of", "NVMLError", ".", "See", "_extractNVMLErrorsAsClasses", "function", "for", "more", "details" ]
def __new__(typ, value): """ Maps value to a proper subclass of NVMLError. See _extractNVMLErrorsAsClasses function for more details """ if typ == NVMLError: typ = NVMLError._valClassMapping.get(value, typ) obj = Exception.__new__(typ) obj.value = valu...
[ "def", "__new__", "(", "typ", ",", "value", ")", ":", "if", "typ", "==", "NVMLError", ":", "typ", "=", "NVMLError", ".", "_valClassMapping", ".", "get", "(", "value", ",", "typ", ")", "obj", "=", "Exception", ".", "__new__", "(", "typ", ")", "obj", ...
https://github.com/fbcotter/py3nvml/blob/0aa41c0940c7d971381fddb8382266a819be9f75/py3nvml/py3nvml.py#L663-L672
markj3d/Red9_StudioPack
1d40a8bf84c45ce7eaefdd9ccfa3cdbeb1471919
core/Red9_PoseSaver.py
python
PoseData._collectNodeData
(self, node, key)
collect the attr data from the node and add it to the poseDict[key]
collect the attr data from the node and add it to the poseDict[key]
[ "collect", "the", "attr", "data", "from", "the", "node", "and", "add", "it", "to", "the", "poseDict", "[", "key", "]" ]
def _collectNodeData(self, node, key): ''' collect the attr data from the node and add it to the poseDict[key] ''' self._collectNodeData_attrs(node, key)
[ "def", "_collectNodeData", "(", "self", ",", "node", ",", "key", ")", ":", "self", ".", "_collectNodeData_attrs", "(", "node", ",", "key", ")" ]
https://github.com/markj3d/Red9_StudioPack/blob/1d40a8bf84c45ce7eaefdd9ccfa3cdbeb1471919/core/Red9_PoseSaver.py#L1048-L1052
brian-team/brian2
c212a57cb992b766786b5769ebb830ff12d8a8ad
brian2/codegen/generators/base.py
python
CodeGenerator.translate_statement_sequence
(self, scalar_statements, vector_statements)
return scalar_code, vector_code, kwds
Translate a sequence of `Statement` into the target language, taking care to declare variables, etc. if necessary. Returns a tuple ``(scalar_code, vector_code, kwds)`` where ``scalar_code`` is a list of the lines of code executed before the inner loop, ``vector_code`` is a list of th...
Translate a sequence of `Statement` into the target language, taking care to declare variables, etc. if necessary. Returns a tuple ``(scalar_code, vector_code, kwds)`` where ``scalar_code`` is a list of the lines of code executed before the inner loop, ``vector_code`` is a list of th...
[ "Translate", "a", "sequence", "of", "Statement", "into", "the", "target", "language", "taking", "care", "to", "declare", "variables", "etc", ".", "if", "necessary", ".", "Returns", "a", "tuple", "(", "scalar_code", "vector_code", "kwds", ")", "where", "scalar_...
def translate_statement_sequence(self, scalar_statements, vector_statements): """ Translate a sequence of `Statement` into the target language, taking care to declare variables, etc. if necessary. Returns a tuple ``(scalar_code, vector_code, kwds)`` where ``scalar_code`` is a...
[ "def", "translate_statement_sequence", "(", "self", ",", "scalar_statements", ",", "vector_statements", ")", ":", "scalar_code", "=", "{", "}", "vector_code", "=", "{", "}", "for", "name", ",", "block", "in", "scalar_statements", ".", "items", "(", ")", ":", ...
https://github.com/brian-team/brian2/blob/c212a57cb992b766786b5769ebb830ff12d8a8ad/brian2/codegen/generators/base.py#L116-L136
NeuralEnsemble/python-neo
34d4db8fb0dc950dbbc6defd7fb75e99ea877286
neo/io/neuroshareapiio.py
python
NeuroshareapiIO.read_epoch
(self, lazy=False, channel_index=0, t_start=0., segment_duration=0.)
return epa
function to read digital timestamps. this function reads the event onset and offset and outputs onset and duration. to get only onsets use the event array function
function to read digital timestamps. this function reads the event onset and offset and outputs onset and duration. to get only onsets use the event array function
[ "function", "to", "read", "digital", "timestamps", ".", "this", "function", "reads", "the", "event", "onset", "and", "offset", "and", "outputs", "onset", "and", "duration", ".", "to", "get", "only", "onsets", "use", "the", "event", "array", "function" ]
def read_epoch(self, lazy=False, channel_index=0, t_start=0., segment_duration=0.): """function to read digital timestamps. this function reads the event onset and offset and outputs onset and duration. to get only onsets use ...
[ "def", "read_epoch", "(", "self", ",", "lazy", "=", "False", ",", "channel_index", "=", "0", ",", "t_start", "=", "0.", ",", "segment_duration", "=", "0.", ")", ":", "assert", "not", "lazy", ",", "'Do not support lazy'", "# create temporary empty lists to store ...
https://github.com/NeuralEnsemble/python-neo/blob/34d4db8fb0dc950dbbc6defd7fb75e99ea877286/neo/io/neuroshareapiio.py#L390-L436
Fenixin/Minecraft-Region-Fixer
bfafd378ceb65116e4ea48cab24f1e6394051978
nbt/chunk.py
python
McRegionChunk.iter_block
(self)
[]
def iter_block(self): for y in range(0, 128): for z in range(0, 16): for x in range(0, 16): yield self.get_block(x, y, z)
[ "def", "iter_block", "(", "self", ")", ":", "for", "y", "in", "range", "(", "0", ",", "128", ")", ":", "for", "z", "in", "range", "(", "0", ",", "16", ")", ":", "for", "x", "in", "range", "(", "0", ",", "16", ")", ":", "yield", "self", ".",...
https://github.com/Fenixin/Minecraft-Region-Fixer/blob/bfafd378ceb65116e4ea48cab24f1e6394051978/nbt/chunk.py#L130-L134
cbrgm/telegram-robot-rss
58fe98de427121fdc152c8df0721f1891174e6c9
venv/lib/python2.7/site-packages/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/cbrgm/telegram-robot-rss/blob/58fe98de427121fdc152c8df0721f1891174e6c9/venv/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py#L483-L486
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/requests/utils.py
python
to_native_string
(string, encoding='ascii')
return out
Given a string object, regardless of type, returns a representation of that string in the native string type, encoding and decoding where necessary. This assumes ASCII unless told otherwise.
Given a string object, regardless of type, returns a representation of that string in the native string type, encoding and decoding where necessary. This assumes ASCII unless told otherwise.
[ "Given", "a", "string", "object", "regardless", "of", "type", "returns", "a", "representation", "of", "that", "string", "in", "the", "native", "string", "type", "encoding", "and", "decoding", "where", "necessary", ".", "This", "assumes", "ASCII", "unless", "to...
def to_native_string(string, encoding='ascii'): """Given a string object, regardless of type, returns a representation of that string in the native string type, encoding and decoding where necessary. This assumes ASCII unless told otherwise. """ if isinstance(string, builtin_str): out = stri...
[ "def", "to_native_string", "(", "string", ",", "encoding", "=", "'ascii'", ")", ":", "if", "isinstance", "(", "string", ",", "builtin_str", ")", ":", "out", "=", "string", "else", ":", "if", "is_py2", ":", "out", "=", "string", ".", "encode", "(", "enc...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/requests/utils.py#L762-L775
wenwei202/terngrad
ec4f75e9a3a1e1c4b2e6494d830fbdfdd2e03ddc
terngrad/inception/bingrad_common.py
python
clip_gradients_by_stddev
(grads_and_vars, clip_factor = 2.5)
return list(zip(clipped_gradients, variables))
Clip gradients to [-clip_factor*stddev, clip_factor*stddev].
Clip gradients to [-clip_factor*stddev, clip_factor*stddev].
[ "Clip", "gradients", "to", "[", "-", "clip_factor", "*", "stddev", "clip_factor", "*", "stddev", "]", "." ]
def clip_gradients_by_stddev(grads_and_vars, clip_factor = 2.5): """ Clip gradients to [-clip_factor*stddev, clip_factor*stddev].""" gradients, variables = zip(*grads_and_vars) clipped_gradients = [] for gradient in gradients: if gradient is None: clipped_gradients.append(None) ...
[ "def", "clip_gradients_by_stddev", "(", "grads_and_vars", ",", "clip_factor", "=", "2.5", ")", ":", "gradients", ",", "variables", "=", "zip", "(", "*", "grads_and_vars", ")", "clipped_gradients", "=", "[", "]", "for", "gradient", "in", "gradients", ":", "if",...
https://github.com/wenwei202/terngrad/blob/ec4f75e9a3a1e1c4b2e6494d830fbdfdd2e03ddc/terngrad/inception/bingrad_common.py#L111-L128
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/vpc/v20170312/models.py
python
Vpc.__init__
(self)
r""" :param VpcName: `VPC`名称。 :type VpcName: str :param VpcId: `VPC`实例`ID`,例如:vpc-azd4dt1c。 :type VpcId: str :param CidrBlock: `VPC`的`IPv4` `CIDR`。 :type CidrBlock: str :param IsDefault: 是否默认`VPC`。 :type IsDefault: bool :param EnableMulticast: 是否开启...
r""" :param VpcName: `VPC`名称。 :type VpcName: str :param VpcId: `VPC`实例`ID`,例如:vpc-azd4dt1c。 :type VpcId: str :param CidrBlock: `VPC`的`IPv4` `CIDR`。 :type CidrBlock: str :param IsDefault: 是否默认`VPC`。 :type IsDefault: bool :param EnableMulticast: 是否开启...
[ "r", ":", "param", "VpcName", ":", "VPC", "名称。", ":", "type", "VpcName", ":", "str", ":", "param", "VpcId", ":", "VPC", "实例", "ID", ",例如:vpc", "-", "azd4dt1c。", ":", "type", "VpcId", ":", "str", ":", "param", "CidrBlock", ":", "VPC", "的", "IPv4", "...
def __init__(self): r""" :param VpcName: `VPC`名称。 :type VpcName: str :param VpcId: `VPC`实例`ID`,例如:vpc-azd4dt1c。 :type VpcId: str :param CidrBlock: `VPC`的`IPv4` `CIDR`。 :type CidrBlock: str :param IsDefault: 是否默认`VPC`。 :type IsDefault: bool ...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "VpcName", "=", "None", "self", ".", "VpcId", "=", "None", "self", ".", "CidrBlock", "=", "None", "self", ".", "IsDefault", "=", "None", "self", ".", "EnableMulticast", "=", "None", "self", ".", ...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/vpc/v20170312/models.py#L19392-L19434
wwqgtxx/wwqLyParse
33136508e52821babd9294fdecffbdf02d73a6fc
wwqLyParse/lib/bs4_lib/bs4/element.py
python
Tag.encode_contents
( self, indent_level=None, encoding=DEFAULT_OUTPUT_ENCODING, formatter="minimal")
return contents.encode(encoding)
Renders the contents of this tag as a bytestring. :param indent_level: Each line of the rendering will be indented this many spaces. :param eventual_encoding: The bytestring will be in this encoding. :param formatter: The output formatter responsible for converting entit...
Renders the contents of this tag as a bytestring.
[ "Renders", "the", "contents", "of", "this", "tag", "as", "a", "bytestring", "." ]
def encode_contents( self, indent_level=None, encoding=DEFAULT_OUTPUT_ENCODING, formatter="minimal"): """Renders the contents of this tag as a bytestring. :param indent_level: Each line of the rendering will be indented this many spaces. :param eventual_encoding: The...
[ "def", "encode_contents", "(", "self", ",", "indent_level", "=", "None", ",", "encoding", "=", "DEFAULT_OUTPUT_ENCODING", ",", "formatter", "=", "\"minimal\"", ")", ":", "contents", "=", "self", ".", "decode_contents", "(", "indent_level", ",", "encoding", ",", ...
https://github.com/wwqgtxx/wwqLyParse/blob/33136508e52821babd9294fdecffbdf02d73a6fc/wwqLyParse/lib/bs4_lib/bs4/element.py#L1323-L1338
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/series/limits.py
python
Limit.doit
(self, **hints)
return limit(e, z, z0, str(dir))
Evaluates limit
Evaluates limit
[ "Evaluates", "limit" ]
def doit(self, **hints): """Evaluates limit""" e, z, z0, dir = self.args if hints.get('deep', True): e = e.doit(**hints) z = z.doit(**hints) z0 = z0.doit(**hints) return limit(e, z, z0, str(dir))
[ "def", "doit", "(", "self", ",", "*", "*", "hints", ")", ":", "e", ",", "z", ",", "z0", ",", "dir", "=", "self", ".", "args", "if", "hints", ".", "get", "(", "'deep'", ",", "True", ")", ":", "e", "=", "e", ".", "doit", "(", "*", "*", "hin...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/series/limits.py#L150-L157
danilobellini/audiolazy
dba0a278937909980ed40b976d866b8e97c35dee
audiolazy/lazy_analysis.py
python
envelope
(sig, cutoff=pi/512)
return lowpass(cutoff)(abs(thub(sig, 1)))
Envelope non-linear filter. This strategy make an ideal half wave rectification (get the absolute value of each signal) and pass the resulting data through a low pass filter. Parameters ---------- sig : The signal to be filtered. cutoff : Lowpass filter cutoff frequency, in rad/sample. Defaults to...
Envelope non-linear filter.
[ "Envelope", "non", "-", "linear", "filter", "." ]
def envelope(sig, cutoff=pi/512): """ Envelope non-linear filter. This strategy make an ideal half wave rectification (get the absolute value of each signal) and pass the resulting data through a low pass filter. Parameters ---------- sig : The signal to be filtered. cutoff : Lowpass filter cu...
[ "def", "envelope", "(", "sig", ",", "cutoff", "=", "pi", "/", "512", ")", ":", "return", "lowpass", "(", "cutoff", ")", "(", "abs", "(", "thub", "(", "sig", ",", "1", ")", ")", ")" ]
https://github.com/danilobellini/audiolazy/blob/dba0a278937909980ed40b976d866b8e97c35dee/audiolazy/lazy_analysis.py#L465-L489
cackharot/suds-py3
1d92cc6297efee31bfd94b50b99c431505d7de21
suds/resolver.py
python
NodeResolver.query
(self, name, node)
return (result, [])
blindly query the schema by name
blindly query the schema by name
[ "blindly", "query", "the", "schema", "by", "name" ]
def query(self, name, node): """ blindly query the schema by name """ log.debug('searching schema for (%s)', name) qref = qualify(name, node, node.namespace()) query = BlindQuery(qref) result = query.execute(self.schema) return (result, [])
[ "def", "query", "(", "self", ",", "name", ",", "node", ")", ":", "log", ".", "debug", "(", "'searching schema for (%s)'", ",", "name", ")", "qref", "=", "qualify", "(", "name", ",", "node", ",", "node", ".", "namespace", "(", ")", ")", "query", "=", ...
https://github.com/cackharot/suds-py3/blob/1d92cc6297efee31bfd94b50b99c431505d7de21/suds/resolver.py#L373-L379
facebookresearch/hydra
9b2f4d54b328d1551aa70a241a1d638cbe046367
hydra/_internal/core_plugins/importlib_resources_config_source.py
python
ImportlibResourcesConfigSource.is_group
(self, config_path: str)
return ret
[]
def is_group(self, config_path: str) -> bool: try: files = resources.files(self.path) # type:ignore except (ValueError, ModuleNotFoundError, TypeError): return False res = files.joinpath(config_path) ret = res.exists() and res.is_dir() assert isinstance(...
[ "def", "is_group", "(", "self", ",", "config_path", ":", "str", ")", "->", "bool", ":", "try", ":", "files", "=", "resources", ".", "files", "(", "self", ".", "path", ")", "# type:ignore", "except", "(", "ValueError", ",", "ModuleNotFoundError", ",", "Ty...
https://github.com/facebookresearch/hydra/blob/9b2f4d54b328d1551aa70a241a1d638cbe046367/hydra/_internal/core_plugins/importlib_resources_config_source.py#L71-L80
stanfordnlp/stanza
e44d1c88340e33bf9813e6f5a6bd24387eefc4b2
stanza/models/common/seq2seq_modules.py
python
DeepAttention.forward
(self, input, context, mask=None, attn_only=False)
return h_tilde, attn
input: batch x dim context: batch x sourceL x dim
input: batch x dim context: batch x sourceL x dim
[ "input", ":", "batch", "x", "dim", "context", ":", "batch", "x", "sourceL", "x", "dim" ]
def forward(self, input, context, mask=None, attn_only=False): """ input: batch x dim context: batch x sourceL x dim """ batch_size = context.size(0) source_len = context.size(1) dim = context.size(2) u = input.unsqueeze(1).expand_as(context).contiguous()....
[ "def", "forward", "(", "self", ",", "input", ",", "context", ",", "mask", "=", "None", ",", "attn_only", "=", "False", ")", ":", "batch_size", "=", "context", ".", "size", "(", "0", ")", "source_len", "=", "context", ".", "size", "(", "1", ")", "di...
https://github.com/stanfordnlp/stanza/blob/e44d1c88340e33bf9813e6f5a6bd24387eefc4b2/stanza/models/common/seq2seq_modules.py#L165-L192
OctoPrint/OctoPrint
4b12b0e6f06c3abfb31b1840a0605e2de8e911d2
src/octoprint/plugins/announcements/__init__.py
python
AnnouncementPlugin._get_channel_data_from_cache
(self, key, config)
return None
Fetch channel feed from cache.
Fetch channel feed from cache.
[ "Fetch", "channel", "feed", "from", "cache", "." ]
def _get_channel_data_from_cache(self, key, config): """Fetch channel feed from cache.""" channel_path = self._get_channel_cache_path(key) if os.path.exists(channel_path): if "ttl" in config and isinstance(config["ttl"], int): ttl = config["ttl"] else: ...
[ "def", "_get_channel_data_from_cache", "(", "self", ",", "key", ",", "config", ")", ":", "channel_path", "=", "self", ".", "_get_channel_cache_path", "(", "key", ")", "if", "os", ".", "path", ".", "exists", "(", "channel_path", ")", ":", "if", "\"ttl\"", "...
https://github.com/OctoPrint/OctoPrint/blob/4b12b0e6f06c3abfb31b1840a0605e2de8e911d2/src/octoprint/plugins/announcements/__init__.py#L425-L445
openembedded/openembedded-core
9154f71c7267e9731156c1dfd57397103e9e6a2b
scripts/lib/devtool/standard.py
python
_export_local_files
(srctree, rd, destdir, srctreebase)
return (updated, added, removed)
Copy local files from srctree to given location. Returns three-tuple of dicts: 1. updated - files that already exist in SRCURI 2. added - new files files that don't exist in SRCURI 3 removed - files that exist in SRCURI but not in exported files In each dict the key is the 'base...
Copy local files from srctree to given location. Returns three-tuple of dicts: 1. updated - files that already exist in SRCURI 2. added - new files files that don't exist in SRCURI 3 removed - files that exist in SRCURI but not in exported files In each dict the key is the 'base...
[ "Copy", "local", "files", "from", "srctree", "to", "given", "location", ".", "Returns", "three", "-", "tuple", "of", "dicts", ":", "1", ".", "updated", "-", "files", "that", "already", "exist", "in", "SRCURI", "2", ".", "added", "-", "new", "files", "f...
def _export_local_files(srctree, rd, destdir, srctreebase): """Copy local files from srctree to given location. Returns three-tuple of dicts: 1. updated - files that already exist in SRCURI 2. added - new files files that don't exist in SRCURI 3 removed - files that exist in SRCUR...
[ "def", "_export_local_files", "(", "srctree", ",", "rd", ",", "destdir", ",", "srctreebase", ")", ":", "import", "oe", ".", "recipeutils", "# Find out local files (SRC_URI files that exist in the \"recipe space\").", "# Local files that reside in srctree are not included in patch g...
https://github.com/openembedded/openembedded-core/blob/9154f71c7267e9731156c1dfd57397103e9e6a2b/scripts/lib/devtool/standard.py#L1387-L1486
debian-calibre/calibre
020fc81d3936a64b2ac51459ecb796666ab6a051
src/calibre/ebooks/rtf2xml/field_strings.py
python
FieldStrings.__sequence_func
(self, field_name, name, line)
return [None, None, my_string]
Requires: field_name --the name of the first word in the string. name --the changed name according to the dictionary. line -- the string to parse. Returns: A string with a value for the type and label attributes Logic: The type of sequence--whe...
Requires: field_name --the name of the first word in the string. name --the changed name according to the dictionary. line -- the string to parse. Returns: A string with a value for the type and label attributes Logic: The type of sequence--whe...
[ "Requires", ":", "field_name", "--", "the", "name", "of", "the", "first", "word", "in", "the", "string", ".", "name", "--", "the", "changed", "name", "according", "to", "the", "dictionary", ".", "line", "--", "the", "string", "to", "parse", ".", "Returns...
def __sequence_func(self, field_name, name, line): """ Requires: field_name --the name of the first word in the string. name --the changed name according to the dictionary. line -- the string to parse. Returns: A string with a value for the type an...
[ "def", "__sequence_func", "(", "self", ",", "field_name", ",", "name", ",", "line", ")", ":", "fields", "=", "line", ".", "split", "(", ")", "label", "=", "fields", "[", "1", "]", "my_string", "=", "'%s<label>%s'", "%", "(", "name", ",", "label", ")"...
https://github.com/debian-calibre/calibre/blob/020fc81d3936a64b2ac51459ecb796666ab6a051/src/calibre/ebooks/rtf2xml/field_strings.py#L589-L606
beetbox/beets
2fea53c34dd505ba391cb345424e0613901c8025
beets/library.py
python
Library.items
(self, query=None, sort=None)
return self._fetch(Item, query, sort or self.get_default_item_sort())
Get :class:`Item` objects matching the query.
Get :class:`Item` objects matching the query.
[ "Get", ":", "class", ":", "Item", "objects", "matching", "the", "query", "." ]
def items(self, query=None, sort=None): """Get :class:`Item` objects matching the query.""" return self._fetch(Item, query, sort or self.get_default_item_sort())
[ "def", "items", "(", "self", ",", "query", "=", "None", ",", "sort", "=", "None", ")", ":", "return", "self", ".", "_fetch", "(", "Item", ",", "query", ",", "sort", "or", "self", ".", "get_default_item_sort", "(", ")", ")" ]
https://github.com/beetbox/beets/blob/2fea53c34dd505ba391cb345424e0613901c8025/beets/library.py#L1549-L1551
deepgully/me
f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0
libs/sqlalchemy/sql/selectable.py
python
Select.append_from
(self, fromclause)
append the given FromClause expression to this select() construct's FROM clause. This is an **in-place** mutation method; the :meth:`~.Select.select_from` method is preferred, as it provides standard :term:`method chaining`.
append the given FromClause expression to this select() construct's FROM clause.
[ "append", "the", "given", "FromClause", "expression", "to", "this", "select", "()", "construct", "s", "FROM", "clause", "." ]
def append_from(self, fromclause): """append the given FromClause expression to this select() construct's FROM clause. This is an **in-place** mutation method; the :meth:`~.Select.select_from` method is preferred, as it provides standard :term:`method chaining`. """ ...
[ "def", "append_from", "(", "self", ",", "fromclause", ")", ":", "self", ".", "_reset_exported", "(", ")", "fromclause", "=", "_interpret_as_from", "(", "fromclause", ")", "self", ".", "_from_obj", "=", "self", ".", "_from_obj", ".", "union", "(", "[", "fro...
https://github.com/deepgully/me/blob/f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0/libs/sqlalchemy/sql/selectable.py#L2821-L2832
cyoon1729/RLcycle
5c65b9dd61a6fd5d6dfe92f0b3e04bf309828569
rlcycle/a3c/agent.py
python
A3CAgent._initialize
(self)
Set env specific configs and build learner.
Set env specific configs and build learner.
[ "Set", "env", "specific", "configs", "and", "build", "learner", "." ]
def _initialize(self): """Set env specific configs and build learner.""" self.experiment_info.env.state_dim = self.env.observation_space.shape[0] if self.experiment_info.env.is_discrete: self.experiment_info.env.action_dim = self.env.action_space.n else: self.expe...
[ "def", "_initialize", "(", "self", ")", ":", "self", ".", "experiment_info", ".", "env", ".", "state_dim", "=", "self", ".", "env", ".", "observation_space", ".", "shape", "[", "0", "]", "if", "self", ".", "experiment_info", ".", "env", ".", "is_discrete...
https://github.com/cyoon1729/RLcycle/blob/5c65b9dd61a6fd5d6dfe92f0b3e04bf309828569/rlcycle/a3c/agent.py#L35-L64
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/tornado-6.0.1-py3.7-macosx-12.1-iPad6,7.egg/tornado/web.py
python
RequestHandler.current_user
(self)
return self._current_user
The authenticated user for this request. This is set in one of two ways: * A subclass may override `get_current_user()`, which will be called automatically the first time ``self.current_user`` is accessed. `get_current_user()` will only be called once per request, and is ...
The authenticated user for this request.
[ "The", "authenticated", "user", "for", "this", "request", "." ]
def current_user(self) -> Any: """The authenticated user for this request. This is set in one of two ways: * A subclass may override `get_current_user()`, which will be called automatically the first time ``self.current_user`` is accessed. `get_current_user()` will only be ...
[ "def", "current_user", "(", "self", ")", "->", "Any", ":", "if", "not", "hasattr", "(", "self", ",", "\"_current_user\"", ")", ":", "self", ".", "_current_user", "=", "self", ".", "get_current_user", "(", ")", "return", "self", ".", "_current_user" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/tornado-6.0.1-py3.7-macosx-12.1-iPad6,7.egg/tornado/web.py#L1305-L1338
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/docutils/utils/math/math2html.py
python
ContainerSize.set
(self, width = None, height = None)
return self
Set the proper size with width and height.
Set the proper size with width and height.
[ "Set", "the", "proper", "size", "with", "width", "and", "height", "." ]
def set(self, width = None, height = None): "Set the proper size with width and height." self.setvalue('width', width) self.setvalue('height', height) return self
[ "def", "set", "(", "self", ",", "width", "=", "None", ",", "height", "=", "None", ")", ":", "self", ".", "setvalue", "(", "'width'", ",", "width", ")", "self", ".", "setvalue", "(", "'height'", ",", "height", ")", "return", "self" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/docutils/utils/math/math2html.py#L3423-L3427
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/pip/_vendor/distro.py
python
codename
()
return _distro.codename()
Return the codename for the release of the current Linux distribution, as a string. If the distribution does not have a codename, an empty string is returned. Note that the returned codename is not always really a codename. For example, openSUSE returns "x86_64". This function does not handle such ...
Return the codename for the release of the current Linux distribution, as a string.
[ "Return", "the", "codename", "for", "the", "release", "of", "the", "current", "Linux", "distribution", "as", "a", "string", "." ]
def codename(): """ Return the codename for the release of the current Linux distribution, as a string. If the distribution does not have a codename, an empty string is returned. Note that the returned codename is not always really a codename. For example, openSUSE returns "x86_64". This funct...
[ "def", "codename", "(", ")", ":", "return", "_distro", ".", "codename", "(", ")" ]
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/pip/_vendor/distro.py#L355-L376