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
Source-Python-Dev-Team/Source.Python
d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
addons/source-python/packages/source-python/memory/manager.py
python
TypeManager.unregister_converter
(self, name)
Unregister a converter.
Unregister a converter.
[ "Unregister", "a", "converter", "." ]
def unregister_converter(self, name): """Unregister a converter.""" self.converters.pop(name, None)
[ "def", "unregister_converter", "(", "self", ",", "name", ")", ":", "self", ".", "converters", ".", "pop", "(", "name", ",", "None", ")" ]
https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/packages/source-python/memory/manager.py#L234-L236
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/numpy/ma/timer_comparison.py
python
ModuleTester.test_4
(self)
Test of take, transpose, inner, outer products.
Test of take, transpose, inner, outer products.
[ "Test", "of", "take", "transpose", "inner", "outer", "products", "." ]
def test_4(self): """ Test of take, transpose, inner, outer products. """ x = self.arange(24) y = np.arange(24) x[5:6] = self.masked x = x.reshape(2, 3, 4) y = y.reshape(2, 3, 4) assert self.allequal(np.transpose(y, (2, 0, 1)), self.transpose(x, (...
[ "def", "test_4", "(", "self", ")", ":", "x", "=", "self", ".", "arange", "(", "24", ")", "y", "=", "np", ".", "arange", "(", "24", ")", "x", "[", "5", ":", "6", "]", "=", "self", ".", "masked", "x", "=", "x", ".", "reshape", "(", "2", ","...
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/numpy/ma/timer_comparison.py#L215-L236
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/setuptools/command/build_py.py
python
build_py.build_package_data
(self)
Copy data files into build directory
Copy data files into build directory
[ "Copy", "data", "files", "into", "build", "directory" ]
def build_package_data(self): """Copy data files into build directory""" for package, src_dir, build_dir, filenames in self.data_files: for filename in filenames: target = os.path.join(build_dir, filename) self.mkpath(os.path.dirname(target)) s...
[ "def", "build_package_data", "(", "self", ")", ":", "for", "package", ",", "src_dir", ",", "build_dir", ",", "filenames", "in", "self", ".", "data_files", ":", "for", "filename", "in", "filenames", ":", "target", "=", "os", ".", "path", ".", "join", "(",...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/setuptools/command/build_py.py#L116-L127
misterch0c/shadowbroker
e3a069bea47a2c1009697941ac214adc6f90aa8d
windows/Resources/Python/Core/Lib/mailbox.py
python
MaildirMessage.set_date
(self, date)
Set delivery date of message, in seconds since the epoch.
Set delivery date of message, in seconds since the epoch.
[ "Set", "delivery", "date", "of", "message", "in", "seconds", "since", "the", "epoch", "." ]
def set_date(self, date): """Set delivery date of message, in seconds since the epoch.""" try: self._date = float(date) except ValueError: raise TypeError("can't convert to float: %s" % date)
[ "def", "set_date", "(", "self", ",", "date", ")", ":", "try", ":", "self", ".", "_date", "=", "float", "(", "date", ")", "except", "ValueError", ":", "raise", "TypeError", "(", "\"can't convert to float: %s\"", "%", "date", ")" ]
https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/mailbox.py#L1472-L1477
autotest/autotest
4614ae5f550cc888267b9a419e4b90deb54f8fae
server/setup.py
python
_get_files
(path)
return flist
Given a path, return all the files in there to package
Given a path, return all the files in there to package
[ "Given", "a", "path", "return", "all", "the", "files", "in", "there", "to", "package" ]
def _get_files(path): ''' Given a path, return all the files in there to package ''' flist = [] for root, _, files in sorted(os.walk(path)): for name in files: fullname = os.path.join(root, name) flist.append(fullname) return flist
[ "def", "_get_files", "(", "path", ")", ":", "flist", "=", "[", "]", "for", "root", ",", "_", ",", "files", "in", "sorted", "(", "os", ".", "walk", "(", "path", ")", ")", ":", "for", "name", "in", "files", ":", "fullname", "=", "os", ".", "path"...
https://github.com/autotest/autotest/blob/4614ae5f550cc888267b9a419e4b90deb54f8fae/server/setup.py#L19-L28
rossant/ipymd
d87c9ebc59d67fe78b0139ee00e0e5307682e303
ipymd/ext/six.py
python
add_move
(move)
Add an item to six.moves.
Add an item to six.moves.
[ "Add", "an", "item", "to", "six", ".", "moves", "." ]
def add_move(move): """Add an item to six.moves.""" setattr(_MovedItems, move.name, move)
[ "def", "add_move", "(", "move", ")", ":", "setattr", "(", "_MovedItems", ",", "move", ".", "name", ",", "move", ")" ]
https://github.com/rossant/ipymd/blob/d87c9ebc59d67fe78b0139ee00e0e5307682e303/ipymd/ext/six.py#L469-L471
wistbean/learn_python3_spider
73c873f4845f4385f097e5057407d03dd37a117b
stackoverflow/venv/lib/python3.6/site-packages/scrapy/shell.py
python
_request_deferred
(request)
return d
Wrap a request inside a Deferred. This function is harmful, do not use it until you know what you are doing. This returns a Deferred whose first pair of callbacks are the request callback and errback. The Deferred also triggers when the request callback/errback is executed (ie. when the request is dow...
Wrap a request inside a Deferred.
[ "Wrap", "a", "request", "inside", "a", "Deferred", "." ]
def _request_deferred(request): """Wrap a request inside a Deferred. This function is harmful, do not use it until you know what you are doing. This returns a Deferred whose first pair of callbacks are the request callback and errback. The Deferred also triggers when the request callback/errback i...
[ "def", "_request_deferred", "(", "request", ")", ":", "request_callback", "=", "request", ".", "callback", "request_errback", "=", "request", ".", "errback", "def", "_restore_callbacks", "(", "result", ")", ":", "request", ".", "callback", "=", "request_callback",...
https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/scrapy/shell.py#L170-L195
GRAAL-Research/domain_adversarial_neural_network
74eec5e0ae06bd6614bce048abba492c16a633e3
DANN.py
python
DANN.predict_domain
(self, X)
return np.array(output_layer < .5, dtype=int)
Compute and return the domain predictions for X, i.e., a 1D array of size len(X). the ith row of the array contains the predicted domain (0 or 1) for the ith example.
Compute and return the domain predictions for X, i.e., a 1D array of size len(X). the ith row of the array contains the predicted domain (0 or 1) for the ith example.
[ "Compute", "and", "return", "the", "domain", "predictions", "for", "X", "i", ".", "e", ".", "a", "1D", "array", "of", "size", "len", "(", "X", ")", ".", "the", "ith", "row", "of", "the", "array", "contains", "the", "predicted", "domain", "(", "0", ...
def predict_domain(self, X): """ Compute and return the domain predictions for X, i.e., a 1D array of size len(X). the ith row of the array contains the predicted domain (0 or 1) for the ith example. """ hidden_layer = self.sigmoid(np.dot(self.W, X.T) + self.b[:, np.newaxis]) ...
[ "def", "predict_domain", "(", "self", ",", "X", ")", ":", "hidden_layer", "=", "self", ".", "sigmoid", "(", "np", ".", "dot", "(", "self", ".", "W", ",", "X", ".", "T", ")", "+", "self", ".", "b", "[", ":", ",", "np", ".", "newaxis", "]", ")"...
https://github.com/GRAAL-Research/domain_adversarial_neural_network/blob/74eec5e0ae06bd6614bce048abba492c16a633e3/DANN.py#L203-L210
awslabs/gluon-ts
066ec3b7f47aa4ee4c061a28f35db7edbad05a98
src/gluonts/mx/distribution/bijection.py
python
Bijection.log_abs_det_jac
(self, x: Tensor, y: Tensor)
r""" Receives (x, y) and returns log of the absolute value of the Jacobian determinant .. math:: \log |dy/dx| Note that this is the Jacobian determinant of the forward transformation x -> y.
r""" Receives (x, y) and returns log of the absolute value of the Jacobian determinant
[ "r", "Receives", "(", "x", "y", ")", "and", "returns", "log", "of", "the", "absolute", "value", "of", "the", "Jacobian", "determinant" ]
def log_abs_det_jac(self, x: Tensor, y: Tensor) -> Tensor: r""" Receives (x, y) and returns log of the absolute value of the Jacobian determinant .. math:: \log |dy/dx| Note that this is the Jacobian determinant of the forward transformation x -> y. ...
[ "def", "log_abs_det_jac", "(", "self", ",", "x", ":", "Tensor", ",", "y", ":", "Tensor", ")", "->", "Tensor", ":", "raise", "NotImplementedError" ]
https://github.com/awslabs/gluon-ts/blob/066ec3b7f47aa4ee4c061a28f35db7edbad05a98/src/gluonts/mx/distribution/bijection.py#L49-L60
PMEAL/OpenPNM
c9514b858d1361b2090b2f9579280cbcd476c9b0
openpnm/models/physics/source_terms.py
python
linear
(target, X, A1='', A2='')
return values
r""" Calculates the rate, as well as slope and intercept of the following function at the given value of ``X``: .. math:: r = A_{1} X + A_{2} Parameters ---------- %(target_blurb)s X : str The dictionary key on the target object containing the the quantity o...
r""" Calculates the rate, as well as slope and intercept of the following function at the given value of ``X``:
[ "r", "Calculates", "the", "rate", "as", "well", "as", "slope", "and", "intercept", "of", "the", "following", "function", "at", "the", "given", "value", "of", "X", ":" ]
def linear(target, X, A1='', A2=''): r""" Calculates the rate, as well as slope and intercept of the following function at the given value of ``X``: .. math:: r = A_{1} X + A_{2} Parameters ---------- %(target_blurb)s X : str The dictionary key on the target obj...
[ "def", "linear", "(", "target", ",", "X", ",", "A1", "=", "''", ",", "A2", "=", "''", ")", ":", "A", "=", "_parse_args", "(", "target", "=", "target", ",", "key", "=", "A1", ",", "default", "=", "0.0", ")", "B", "=", "_parse_args", "(", "target...
https://github.com/PMEAL/OpenPNM/blob/c9514b858d1361b2090b2f9579280cbcd476c9b0/openpnm/models/physics/source_terms.py#L165-L212
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Tools/webchecker/wcgui.py
python
CheckerWindow.go
(self)
[]
def go(self): if self.__running: self.__parent.after_idle(self.dosomething) else: self.__checking.config(text="Idle") self.__start.config(state=NORMAL, relief=RAISED) self.__stop.config(state=DISABLED, relief=RAISED) self.__step.config(state=NO...
[ "def", "go", "(", "self", ")", ":", "if", "self", ".", "__running", ":", "self", ".", "__parent", ".", "after_idle", "(", "self", ".", "dosomething", ")", "else", ":", "self", ".", "__checking", ".", "config", "(", "text", "=", "\"Idle\"", ")", "self...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Tools/webchecker/wcgui.py#L219-L226
out0fmemory/GoAgent-Always-Available
c4254984fea633ce3d1893fe5901debd9f22c2a9
server/lib/google/appengine/ext/ndb/model.py
python
Model._get_or_insert_async
(*args, **kwds)
return internal_tasklet()
Transactionally retrieves an existing entity or creates a new one. This is the asynchronous version of Model._get_or_insert().
Transactionally retrieves an existing entity or creates a new one.
[ "Transactionally", "retrieves", "an", "existing", "entity", "or", "creates", "a", "new", "one", "." ]
def _get_or_insert_async(*args, **kwds): """Transactionally retrieves an existing entity or creates a new one. This is the asynchronous version of Model._get_or_insert(). """ # NOTE: The signature is really weird here because we want to support # models with properties named e.g. 'cls' or 'name'. ...
[ "def", "_get_or_insert_async", "(", "*", "args", ",", "*", "*", "kwds", ")", ":", "# NOTE: The signature is really weird here because we want to support", "# models with properties named e.g. 'cls' or 'name'.", "from", ".", "import", "tasklets", "cls", ",", "name", "=", "ar...
https://github.com/out0fmemory/GoAgent-Always-Available/blob/c4254984fea633ce3d1893fe5901debd9f22c2a9/server/lib/google/appengine/ext/ndb/model.py#L3500-L3543
log2timeline/plaso
fe2e316b8c76a0141760c0f2f181d84acb83abc2
plaso/multi_process/engine.py
python
MultiProcessEngine._QueryProcessStatus
(self, process)
return process_status
Queries a process to determine its status. Args: process (MultiProcessBaseProcess): process to query for its status. Returns: dict[str, str]: status values received from the worker process.
Queries a process to determine its status.
[ "Queries", "a", "process", "to", "determine", "its", "status", "." ]
def _QueryProcessStatus(self, process): """Queries a process to determine its status. Args: process (MultiProcessBaseProcess): process to query for its status. Returns: dict[str, str]: status values received from the worker process. """ process_is_alive = process.is_alive() if proc...
[ "def", "_QueryProcessStatus", "(", "self", ",", "process", ")", ":", "process_is_alive", "=", "process", ".", "is_alive", "(", ")", "if", "process_is_alive", ":", "rpc_client", "=", "self", ".", "_rpc_clients_per_pid", ".", "get", "(", "process", ".", "pid", ...
https://github.com/log2timeline/plaso/blob/fe2e316b8c76a0141760c0f2f181d84acb83abc2/plaso/multi_process/engine.py#L210-L225
web2py/web2py
095905c4e010a1426c729483d912e270a51b7ba8
gluon/utils.py
python
initialize_urandom
()
return unpacked_ctokens, have_urandom
This function and the web2py_uuid follow from the following discussion: `http://groups.google.com/group/web2py-developers/browse_thread/thread/7fd5789a7da3f09` At startup web2py compute a unique ID that identifies the machine by adding uuid.getnode() + int(time.time() * 1e3) This is a 48-bit number. I...
This function and the web2py_uuid follow from the following discussion: `http://groups.google.com/group/web2py-developers/browse_thread/thread/7fd5789a7da3f09`
[ "This", "function", "and", "the", "web2py_uuid", "follow", "from", "the", "following", "discussion", ":", "http", ":", "//", "groups", ".", "google", ".", "com", "/", "group", "/", "web2py", "-", "developers", "/", "browse_thread", "/", "thread", "/", "7fd...
def initialize_urandom(): """ This function and the web2py_uuid follow from the following discussion: `http://groups.google.com/group/web2py-developers/browse_thread/thread/7fd5789a7da3f09` At startup web2py compute a unique ID that identifies the machine by adding uuid.getnode() + int(time.time() ...
[ "def", "initialize_urandom", "(", ")", ":", "node_id", "=", "uuid", ".", "getnode", "(", ")", "microseconds", "=", "int", "(", "time", ".", "time", "(", ")", "*", "1e6", ")", "ctokens", "=", "[", "(", "(", "node_id", "+", "microseconds", ")", ">>", ...
https://github.com/web2py/web2py/blob/095905c4e010a1426c729483d912e270a51b7ba8/gluon/utils.py#L216-L262
beancount/beancount
cb3526a1af95b3b5be70347470c381b5a86055fe
beancount/query/shell.py
python
DispatchingShell.dispatch
(self, statement)
Dispatch the given statement to a suitable method. Args: statement: An instance provided by the parser. Returns: Whatever the invoked method happens to return.
Dispatch the given statement to a suitable method.
[ "Dispatch", "the", "given", "statement", "to", "a", "suitable", "method", "." ]
def dispatch(self, statement): """Dispatch the given statement to a suitable method. Args: statement: An instance provided by the parser. Returns: Whatever the invoked method happens to return. """ try: method = getattr(self, 'on_{}'.format(type(s...
[ "def", "dispatch", "(", "self", ",", "statement", ")", ":", "try", ":", "method", "=", "getattr", "(", "self", ",", "'on_{}'", ".", "format", "(", "type", "(", "statement", ")", ".", "__name__", ")", ")", "except", "AttributeError", ":", "print", "(", ...
https://github.com/beancount/beancount/blob/cb3526a1af95b3b5be70347470c381b5a86055fe/beancount/query/shell.py#L237-L251
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/insights/v1/call/summary.py
python
CallSummaryInstance.url
(self)
return self._properties['url']
:returns: The url :rtype: unicode
:returns: The url :rtype: unicode
[ ":", "returns", ":", "The", "url", ":", "rtype", ":", "unicode" ]
def url(self): """ :returns: The url :rtype: unicode """ return self._properties['url']
[ "def", "url", "(", "self", ")", ":", "return", "self", ".", "_properties", "[", "'url'", "]" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/insights/v1/call/summary.py#L355-L360
keikoproj/minion-manager
c4e89a5c4614f86f0e58acb919bb99cd9122c897
cloud_provider/aws/asg_mm.py
python
AWSAutoscalinGroupMM.get_instance_info
(self)
return self.instance_info
Returns the instances.
Returns the instances.
[ "Returns", "the", "instances", "." ]
def get_instance_info(self): """ Returns the instances. """ return self.instance_info
[ "def", "get_instance_info", "(", "self", ")", ":", "return", "self", ".", "instance_info" ]
https://github.com/keikoproj/minion-manager/blob/c4e89a5c4614f86f0e58acb919bb99cd9122c897/cloud_provider/aws/asg_mm.py#L76-L78
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/scipy/interpolate/interpolate.py
python
PPoly.from_bernstein_basis
(cls, bp, extrapolate=None)
return cls.construct_fast(c, bp.x, extrapolate)
Construct a piecewise polynomial in the power basis from a polynomial in Bernstein basis. Parameters ---------- bp : BPoly A Bernstein basis polynomial, as created by BPoly extrapolate : bool, optional Whether to extrapolate to ouf-of-bounds points based ...
Construct a piecewise polynomial in the power basis from a polynomial in Bernstein basis.
[ "Construct", "a", "piecewise", "polynomial", "in", "the", "power", "basis", "from", "a", "polynomial", "in", "Bernstein", "basis", "." ]
def from_bernstein_basis(cls, bp, extrapolate=None): """ Construct a piecewise polynomial in the power basis from a polynomial in Bernstein basis. Parameters ---------- bp : BPoly A Bernstein basis polynomial, as created by BPoly extrapolate : bool, o...
[ "def", "from_bernstein_basis", "(", "cls", ",", "bp", ",", "extrapolate", "=", "None", ")", ":", "dx", "=", "np", ".", "diff", "(", "bp", ".", "x", ")", "k", "=", "bp", ".", "c", ".", "shape", "[", "0", "]", "-", "1", "# polynomial order", "rest"...
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/scipy/interpolate/interpolate.py#L959-L988
yqyao/FCOS_PLUS
0d20ba34ccc316650d8c30febb2eb40cb6eaae37
maskrcnn_benchmark/modeling/roi_heads/mask_head/loss.py
python
MaskRCNNLossComputation.__init__
(self, proposal_matcher, discretization_size)
Arguments: proposal_matcher (Matcher) discretization_size (int)
Arguments: proposal_matcher (Matcher) discretization_size (int)
[ "Arguments", ":", "proposal_matcher", "(", "Matcher", ")", "discretization_size", "(", "int", ")" ]
def __init__(self, proposal_matcher, discretization_size): """ Arguments: proposal_matcher (Matcher) discretization_size (int) """ self.proposal_matcher = proposal_matcher self.discretization_size = discretization_size
[ "def", "__init__", "(", "self", ",", "proposal_matcher", ",", "discretization_size", ")", ":", "self", ".", "proposal_matcher", "=", "proposal_matcher", "self", ".", "discretization_size", "=", "discretization_size" ]
https://github.com/yqyao/FCOS_PLUS/blob/0d20ba34ccc316650d8c30febb2eb40cb6eaae37/maskrcnn_benchmark/modeling/roi_heads/mask_head/loss.py#L46-L53
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Tools/faqwiz/faqwiz.py
python
FaqWizard.do_recent
(self)
[]
def do_recent(self): if not self.ui.days: days = 1 else: days = float(self.ui.days) try: cutoff = now - days * 24 * 3600 except OverflowError: cutoff = 0 list = [] for file in self.dir.list(): entry = self.dir.op...
[ "def", "do_recent", "(", "self", ")", ":", "if", "not", "self", ".", "ui", ".", "days", ":", "days", "=", "1", "else", ":", "days", "=", "float", "(", "self", ".", "ui", ".", "days", ")", "try", ":", "cutoff", "=", "now", "-", "days", "*", "2...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Tools/faqwiz/faqwiz.py#L550-L581
openstack-archive/dragonflow
4dc36ed6490e2ed53b47dece883cdbd78ea96033
dragonflow/db/drivers/etcd_db_driver.py
python
_error_catcher
(self)
Catch low-level python exceptions, instead re-raising urllib3 variants, so that low-level exceptions are not leaked in the high-level api. On exit, release the connection back to the pool.
Catch low-level python exceptions, instead re-raising urllib3 variants, so that low-level exceptions are not leaked in the high-level api. On exit, release the connection back to the pool.
[ "Catch", "low", "-", "level", "python", "exceptions", "instead", "re", "-", "raising", "urllib3", "variants", "so", "that", "low", "-", "level", "exceptions", "are", "not", "leaked", "in", "the", "high", "-", "level", "api", ".", "On", "exit", "release", ...
def _error_catcher(self): """ Catch low-level python exceptions, instead re-raising urllib3 variants, so that low-level exceptions are not leaked in the high-level api. On exit, release the connection back to the pool. """ try: try: yield except SocketTimeout: ...
[ "def", "_error_catcher", "(", "self", ")", ":", "try", ":", "try", ":", "yield", "except", "SocketTimeout", ":", "# FIXME: Ideally we'd like to include the url in the", "# ReadTimeoutError but there is yet no clean way to", "# get at it from this context.", "raise", "exceptions",...
https://github.com/openstack-archive/dragonflow/blob/4dc36ed6490e2ed53b47dece883cdbd78ea96033/dragonflow/db/drivers/etcd_db_driver.py#L36-L87
openstack/magnum
fa298eeab19b1d87070d72c7c4fb26cd75b0781e
magnum/api/attr_validator.py
python
validate_federation_hostcluster
(cluster_uuid)
Validate Federation `hostcluster_id` parameter. If the parameter was not specified raise an `exceptions.InvalidParameterValue`. If the specified identifier does not identify any Cluster, raise `exception.ClusterNotFound`
Validate Federation `hostcluster_id` parameter.
[ "Validate", "Federation", "hostcluster_id", "parameter", "." ]
def validate_federation_hostcluster(cluster_uuid): """Validate Federation `hostcluster_id` parameter. If the parameter was not specified raise an `exceptions.InvalidParameterValue`. If the specified identifier does not identify any Cluster, raise `exception.ClusterNotFound` """ if cluster_uuid ...
[ "def", "validate_federation_hostcluster", "(", "cluster_uuid", ")", ":", "if", "cluster_uuid", "is", "not", "None", ":", "api_utils", ".", "get_resource", "(", "'Cluster'", ",", "cluster_uuid", ")", "else", ":", "raise", "exception", ".", "InvalidParameterValue", ...
https://github.com/openstack/magnum/blob/fa298eeab19b1d87070d72c7c4fb26cd75b0781e/magnum/api/attr_validator.py#L217-L229
wanggrun/Adaptively-Connected-Neural-Networks
e27066ef52301bdafa5932f43af8feeb23647edb
tensorpack-installed/tensorpack/graph_builder/training.py
python
SyncMultiGPUParameterServerBuilder.build
(self, get_grad_fn, get_opt_fn)
return train_op
Args: get_grad_fn (-> [(grad, var)]): get_opt_fn (-> tf.train.Optimizer): callable which returns an optimizer Returns: tf.Operation: the training op
Args: get_grad_fn (-> [(grad, var)]): get_opt_fn (-> tf.train.Optimizer): callable which returns an optimizer
[ "Args", ":", "get_grad_fn", "(", "-", ">", "[", "(", "grad", "var", ")", "]", ")", ":", "get_opt_fn", "(", "-", ">", "tf", ".", "train", ".", "Optimizer", ")", ":", "callable", "which", "returns", "an", "optimizer" ]
def build(self, get_grad_fn, get_opt_fn): """ Args: get_grad_fn (-> [(grad, var)]): get_opt_fn (-> tf.train.Optimizer): callable which returns an optimizer Returns: tf.Operation: the training op """ raw_devices = ['/gpu:{}'.format(k) for k in ...
[ "def", "build", "(", "self", ",", "get_grad_fn", ",", "get_opt_fn", ")", ":", "raw_devices", "=", "[", "'/gpu:{}'", ".", "format", "(", "k", ")", "for", "k", "in", "self", ".", "towers", "]", "if", "self", ".", "ps_device", "==", "'gpu'", ":", "devic...
https://github.com/wanggrun/Adaptively-Connected-Neural-Networks/blob/e27066ef52301bdafa5932f43af8feeb23647edb/tensorpack-installed/tensorpack/graph_builder/training.py#L134-L167
mozilla/kitsune
7c7cf9baed57aa776547aea744243ccad6ca91fb
kitsune/sumo/redis_utils.py
python
redis_client
(name)
return redis
Get a Redis client. Uses the name argument to lookup the connection string in the settings.REDIS_BACKEND dict.
Get a Redis client.
[ "Get", "a", "Redis", "client", "." ]
def redis_client(name): """Get a Redis client. Uses the name argument to lookup the connection string in the settings.REDIS_BACKEND dict. """ if name not in settings.REDIS_BACKENDS: raise RedisError("{k} is not defined in settings.REDIS_BACKENDS".format(k=name)) uri = settings.REDIS_BA...
[ "def", "redis_client", "(", "name", ")", ":", "if", "name", "not", "in", "settings", ".", "REDIS_BACKENDS", ":", "raise", "RedisError", "(", "\"{k} is not defined in settings.REDIS_BACKENDS\"", ".", "format", "(", "k", "=", "name", ")", ")", "uri", "=", "setti...
https://github.com/mozilla/kitsune/blob/7c7cf9baed57aa776547aea744243ccad6ca91fb/kitsune/sumo/redis_utils.py#L12-L56
CouchPotato/CouchPotatoServer
7260c12f72447ddb6f062367c6dfbda03ecd4e9c
libs/pytwitter/__init__.py
python
User.SetFriendsCount
(self, count)
Set the friend count for this user. Args: count: The number of users this user has befriended.
Set the friend count for this user.
[ "Set", "the", "friend", "count", "for", "this", "user", "." ]
def SetFriendsCount(self, count): '''Set the friend count for this user. Args: count: The number of users this user has befriended. ''' self._friends_count = count
[ "def", "SetFriendsCount", "(", "self", ",", "count", ")", ":", "self", ".", "_friends_count", "=", "count" ]
https://github.com/CouchPotato/CouchPotatoServer/blob/7260c12f72447ddb6f062367c6dfbda03ecd4e9c/libs/pytwitter/__init__.py#L1133-L1140
bitcraze/crazyflie-lib-python
876f0dc003b91ba5e4de05daae9d0b79cf600f81
cflib/crazyflie/high_level_commander.py
python
HighLevelCommander.stop
(self, group_mask=ALL_GROUPS)
stops the current trajectory (turns off the motors) :param group_mask: Mask for which CFs this should apply to :return:
stops the current trajectory (turns off the motors)
[ "stops", "the", "current", "trajectory", "(", "turns", "off", "the", "motors", ")" ]
def stop(self, group_mask=ALL_GROUPS): """ stops the current trajectory (turns off the motors) :param group_mask: Mask for which CFs this should apply to :return: """ self._send_packet(struct.pack('<BB', self.COMMAND_STOP, ...
[ "def", "stop", "(", "self", ",", "group_mask", "=", "ALL_GROUPS", ")", ":", "self", ".", "_send_packet", "(", "struct", ".", "pack", "(", "'<BB'", ",", "self", ".", "COMMAND_STOP", ",", "group_mask", ")", ")" ]
https://github.com/bitcraze/crazyflie-lib-python/blob/876f0dc003b91ba5e4de05daae9d0b79cf600f81/cflib/crazyflie/high_level_commander.py#L125-L134
thinkle/gourmet
8af29c8ded24528030e5ae2ea3461f61c1e5a575
gourmet/gtk_extras/pageable_store.py
python
PageableListStore.sort
(self, column, direction=FORWARD)
Add new sort term in direction. Note -- to remove term we use direction=OFF
Add new sort term in direction.
[ "Add", "new", "sort", "term", "in", "direction", "." ]
def sort (self, column, direction=FORWARD): """Add new sort term in direction. Note -- to remove term we use direction=OFF """ assert(direction in (self.FORWARD, self.REVERSE, self.OFF)) self.sort_dict[column]=direction if direction==self.OFF: self.parent_li...
[ "def", "sort", "(", "self", ",", "column", ",", "direction", "=", "FORWARD", ")", ":", "assert", "(", "direction", "in", "(", "self", ".", "FORWARD", ",", "self", ".", "REVERSE", ",", "self", ".", "OFF", ")", ")", "self", ".", "sort_dict", "[", "co...
https://github.com/thinkle/gourmet/blob/8af29c8ded24528030e5ae2ea3461f61c1e5a575/gourmet/gtk_extras/pageable_store.py#L165-L177
web2py/web2py
095905c4e010a1426c729483d912e270a51b7ba8
gluon/contrib/dbg.py
python
Qdb.user_call
(self, frame, argument_list)
This method is called when there is the remote possibility that we ever need to stop in this function.
This method is called when there is the remote possibility that we ever need to stop in this function.
[ "This", "method", "is", "called", "when", "there", "is", "the", "remote", "possibility", "that", "we", "ever", "need", "to", "stop", "in", "this", "function", "." ]
def user_call(self, frame, argument_list): """This method is called when there is the remote possibility that we ever need to stop in this function.""" if self._wait_for_mainpyfile or self._wait_for_breakpoint: return if self.stop_here(frame): self.interaction(fra...
[ "def", "user_call", "(", "self", ",", "frame", ",", "argument_list", ")", ":", "if", "self", ".", "_wait_for_mainpyfile", "or", "self", ".", "_wait_for_breakpoint", ":", "return", "if", "self", ".", "stop_here", "(", "frame", ")", ":", "self", ".", "intera...
https://github.com/web2py/web2py/blob/095905c4e010a1426c729483d912e270a51b7ba8/gluon/contrib/dbg.py#L121-L127
debian-calibre/calibre
020fc81d3936a64b2ac51459ecb796666ab6a051
src/calibre/ebooks/compression/tcr.py
python
TCRCompressor._free_unused_codes
(self)
Look for codes that do no not appear in the coded text and add them to the list of free codes.
Look for codes that do no not appear in the coded text and add them to the list of free codes.
[ "Look", "for", "codes", "that", "do", "no", "not", "appear", "in", "the", "coded", "text", "and", "add", "them", "to", "the", "list", "of", "free", "codes", "." ]
def _free_unused_codes(self): ''' Look for codes that do no not appear in the coded text and add them to the list of free codes. ''' for i in range(256): if i not in self.unused_codes: if int_to_byte(i) not in self.coded_txt: self.u...
[ "def", "_free_unused_codes", "(", "self", ")", ":", "for", "i", "in", "range", "(", "256", ")", ":", "if", "i", "not", "in", "self", ".", "unused_codes", ":", "if", "int_to_byte", "(", "i", ")", "not", "in", "self", ".", "coded_txt", ":", "self", "...
https://github.com/debian-calibre/calibre/blob/020fc81d3936a64b2ac51459ecb796666ab6a051/src/calibre/ebooks/compression/tcr.py#L48-L56
openmc-dev/openmc
0cf7d9283786677e324bfbdd0984a54d1c86dacc
openmc/tallies.py
python
Tallies.insert
(self, index, item)
Insert tally before index Parameters ---------- index : int Index in list item : openmc.Tally Tally to insert
Insert tally before index
[ "Insert", "tally", "before", "index" ]
def insert(self, index, item): """Insert tally before index Parameters ---------- index : int Index in list item : openmc.Tally Tally to insert """ super().insert(index, item)
[ "def", "insert", "(", "self", ",", "index", ",", "item", ")", ":", "super", "(", ")", ".", "insert", "(", "index", ",", "item", ")" ]
https://github.com/openmc-dev/openmc/blob/0cf7d9283786677e324bfbdd0984a54d1c86dacc/openmc/tallies.py#L3041-L3052
apache/libcloud
90971e17bfd7b6bb97b2489986472c531cc8e140
libcloud/compute/drivers/ec2.py
python
BaseEC2NodeDriver.ex_list_route_tables
(self, route_table_ids=None, filters=None)
return self._to_route_tables(response.object)
Describes one or more of a VPC's route tables. These are used to determine where network traffic is directed. :param route_table_ids: Returns only route tables matching the provided route table IDs. If not specified, a list of all the...
Describes one or more of a VPC's route tables. These are used to determine where network traffic is directed.
[ "Describes", "one", "or", "more", "of", "a", "VPC", "s", "route", "tables", ".", "These", "are", "used", "to", "determine", "where", "network", "traffic", "is", "directed", "." ]
def ex_list_route_tables(self, route_table_ids=None, filters=None): """ Describes one or more of a VPC's route tables. These are used to determine where network traffic is directed. :param route_table_ids: Returns only route tables matching the provi...
[ "def", "ex_list_route_tables", "(", "self", ",", "route_table_ids", "=", "None", ",", "filters", "=", "None", ")", ":", "params", "=", "{", "\"Action\"", ":", "\"DescribeRouteTables\"", "}", "if", "route_table_ids", ":", "params", ".", "update", "(", "self", ...
https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/compute/drivers/ec2.py#L4038-L4065
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-1.2/django/utils/regex_helper.py
python
flatten_result
(source)
return result, result_args
Turns the given source sequence into a list of reg-exp possibilities and their arguments. Returns a list of strings and a list of argument lists. Each of the two lists will be of the same length.
Turns the given source sequence into a list of reg-exp possibilities and their arguments. Returns a list of strings and a list of argument lists. Each of the two lists will be of the same length.
[ "Turns", "the", "given", "source", "sequence", "into", "a", "list", "of", "reg", "-", "exp", "possibilities", "and", "their", "arguments", ".", "Returns", "a", "list", "of", "strings", "and", "a", "list", "of", "argument", "lists", ".", "Each", "of", "th...
def flatten_result(source): """ Turns the given source sequence into a list of reg-exp possibilities and their arguments. Returns a list of strings and a list of argument lists. Each of the two lists will be of the same length. """ if source is None: return [u''], [[]] if isinstance(...
[ "def", "flatten_result", "(", "source", ")", ":", "if", "source", "is", "None", ":", "return", "[", "u''", "]", ",", "[", "[", "]", "]", "if", "isinstance", "(", "source", ",", "Group", ")", ":", "if", "source", "[", "1", "]", "is", "None", ":", ...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.2/django/utils/regex_helper.py#L276-L327
Mindwerks/worldengine
64dff8eb7824ce46b5b6cb8006bcef21822ef144
worldengine/draw.py
python
draw_simple_elevation
(world, sea_level, target)
This function can be used on a generic canvas (either an image to save on disk or a canvas part of a GUI)
This function can be used on a generic canvas (either an image to save on disk or a canvas part of a GUI)
[ "This", "function", "can", "be", "used", "on", "a", "generic", "canvas", "(", "either", "an", "image", "to", "save", "on", "disk", "or", "a", "canvas", "part", "of", "a", "GUI", ")" ]
def draw_simple_elevation(world, sea_level, target): """ This function can be used on a generic canvas (either an image to save on disk or a canvas part of a GUI) """ e = world.layers['elevation'].data c = numpy.empty(e.shape, dtype=numpy.float) has_ocean = not (sea_level is None or world.l...
[ "def", "draw_simple_elevation", "(", "world", ",", "sea_level", ",", "target", ")", ":", "e", "=", "world", ".", "layers", "[", "'elevation'", "]", ".", "data", "c", "=", "numpy", ".", "empty", "(", "e", ".", "shape", ",", "dtype", "=", "numpy", ".",...
https://github.com/Mindwerks/worldengine/blob/64dff8eb7824ce46b5b6cb8006bcef21822ef144/worldengine/draw.py#L323-L353
deepgully/me
f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0
libs/werkzeug/datastructures.py
python
WWWAuthenticate.set_digest
(self, realm, nonce, qop=('auth',), opaque=None, algorithm=None, stale=False)
Clear the auth info and enable digest auth.
Clear the auth info and enable digest auth.
[ "Clear", "the", "auth", "info", "and", "enable", "digest", "auth", "." ]
def set_digest(self, realm, nonce, qop=('auth',), opaque=None, algorithm=None, stale=False): """Clear the auth info and enable digest auth.""" d = { '__auth_type__': 'digest', 'realm': realm, 'nonce': nonce, 'qop...
[ "def", "set_digest", "(", "self", ",", "realm", ",", "nonce", ",", "qop", "=", "(", "'auth'", ",", ")", ",", "opaque", "=", "None", ",", "algorithm", "=", "None", ",", "stale", "=", "False", ")", ":", "d", "=", "{", "'__auth_type__'", ":", "'digest...
https://github.com/deepgully/me/blob/f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0/libs/werkzeug/datastructures.py#L2335-L2353
jliljebl/flowblade
995313a509b80e99eb1ad550d945bdda5995093b
flowblade-trunk/Flowblade/sequence.py
python
Sequence._mute_editable
(self)
[]
def _mute_editable(self): for i in range(1, len(self.tracks) - 1): track = self.tracks[i] track.set("hide", 3)
[ "def", "_mute_editable", "(", "self", ")", ":", "for", "i", "in", "range", "(", "1", ",", "len", "(", "self", ".", "tracks", ")", "-", "1", ")", ":", "track", "=", "self", ".", "tracks", "[", "i", "]", "track", ".", "set", "(", "\"hide\"", ",",...
https://github.com/jliljebl/flowblade/blob/995313a509b80e99eb1ad550d945bdda5995093b/flowblade-trunk/Flowblade/sequence.py#L891-L894
getsentry/sentry
83b1f25aac3e08075e0e2495bc29efaf35aca18a
src/sentry/utils/glob.py
python
glob_match
( value, pat, doublestar=False, ignorecase=False, path_normalize=False, allow_newline=True )
return sentry_relay.is_glob_match( value if value is not None else "", pat, double_star=doublestar, case_insensitive=ignorecase, path_normalize=path_normalize, allow_newline=allow_newline, )
A beefed up version of fnmatch.fnmatch
A beefed up version of fnmatch.fnmatch
[ "A", "beefed", "up", "version", "of", "fnmatch", ".", "fnmatch" ]
def glob_match( value, pat, doublestar=False, ignorecase=False, path_normalize=False, allow_newline=True ): """A beefed up version of fnmatch.fnmatch""" return sentry_relay.is_glob_match( value if value is not None else "", pat, double_star=doublestar, case_insensitive=ignore...
[ "def", "glob_match", "(", "value", ",", "pat", ",", "doublestar", "=", "False", ",", "ignorecase", "=", "False", ",", "path_normalize", "=", "False", ",", "allow_newline", "=", "True", ")", ":", "return", "sentry_relay", ".", "is_glob_match", "(", "value", ...
https://github.com/getsentry/sentry/blob/83b1f25aac3e08075e0e2495bc29efaf35aca18a/src/sentry/utils/glob.py#L4-L15
Textualize/rich
d39626143036188cb2c9e1619e836540f5b627f8
rich/jupyter.py
python
print
(*args: Any, **kwargs: Any)
return console.print(*args, **kwargs)
Proxy for Console print.
Proxy for Console print.
[ "Proxy", "for", "Console", "print", "." ]
def print(*args: Any, **kwargs: Any) -> None: """Proxy for Console print.""" console = get_console() return console.print(*args, **kwargs)
[ "def", "print", "(", "*", "args", ":", "Any", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "console", "=", "get_console", "(", ")", "return", "console", ".", "print", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/Textualize/rich/blob/d39626143036188cb2c9e1619e836540f5b627f8/rich/jupyter.py#L89-L92
ales-tsurko/cells
4cf7e395cd433762bea70cdc863a346f3a6fe1d0
packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/distlib/util.py
python
zip_dir
(directory)
return result
zip a directory tree into a BytesIO object
zip a directory tree into a BytesIO object
[ "zip", "a", "directory", "tree", "into", "a", "BytesIO", "object" ]
def zip_dir(directory): """zip a directory tree into a BytesIO object""" result = io.BytesIO() dlen = len(directory) with ZipFile(result, "w") as zf: for root, dirs, files in os.walk(directory): for name in files: full = os.path.join(root, name) rel = ...
[ "def", "zip_dir", "(", "directory", ")", ":", "result", "=", "io", ".", "BytesIO", "(", ")", "dlen", "=", "len", "(", "directory", ")", "with", "ZipFile", "(", "result", ",", "\"w\"", ")", "as", "zf", ":", "for", "root", ",", "dirs", ",", "files", ...
https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/distlib/util.py#L1253-L1264
spectacles/CodeComplice
8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62
libs/koXMLDatasetInfo.py
python
DatasetHandlerService.createDatasetHandler
(self, publicId, systemId, namespace)
return handler
[]
def createDatasetHandler(self, publicId, systemId, namespace): dataset = self.resolver.getDataset(publicId, systemId, namespace) if not dataset: handler = EmptyDatasetHandler() else: handler = DataSetHandler(namespace, dataset) if namespace: self.handl...
[ "def", "createDatasetHandler", "(", "self", ",", "publicId", ",", "systemId", ",", "namespace", ")", ":", "dataset", "=", "self", ".", "resolver", ".", "getDataset", "(", "publicId", ",", "systemId", ",", "namespace", ")", "if", "not", "dataset", ":", "han...
https://github.com/spectacles/CodeComplice/blob/8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62/libs/koXMLDatasetInfo.py#L165-L176
librahfacebook/Detection
84504d086634950224716f4de0e4c8a684493c34
object_detection/utils/config_util.py
python
update_input_reader_config
(configs, key_name=None, input_name=None, field_name=None, value=None, path_updater=_update_tf_record_input_path)
Updates specified input reader config field. Args: configs: Dictionary of configuration objects. See outputs from get_configs_from_pipeline_file() or get_configs_from_multiple_files(). key_name: Name of the input config we should update, either 'train_input_config' or 'eval_input_configs' inp...
Updates specified input reader config field.
[ "Updates", "specified", "input", "reader", "config", "field", "." ]
def update_input_reader_config(configs, key_name=None, input_name=None, field_name=None, value=None, path_updater=_update_tf_record_input_path): """Updates specifi...
[ "def", "update_input_reader_config", "(", "configs", ",", "key_name", "=", "None", ",", "input_name", "=", "None", ",", "field_name", "=", "None", ",", "value", "=", "None", ",", "path_updater", "=", "_update_tf_record_input_path", ")", ":", "if", "isinstance", ...
https://github.com/librahfacebook/Detection/blob/84504d086634950224716f4de0e4c8a684493c34/object_detection/utils/config_util.py#L581-L639
truenas/middleware
b11ec47d6340324f5a32287ffb4012e5d709b934
src/middlewared/middlewared/job.py
python
Job.run
(self, queue)
Run a Job and set state/result accordingly. This method is supposed to run in a greenlet.
Run a Job and set state/result accordingly. This method is supposed to run in a greenlet.
[ "Run", "a", "Job", "and", "set", "state", "/", "result", "accordingly", ".", "This", "method", "is", "supposed", "to", "run", "in", "a", "greenlet", "." ]
async def run(self, queue): """ Run a Job and set state/result accordingly. This method is supposed to run in a greenlet. """ if self.options["logs"]: self.logs_path = os.path.join(LOGS_DIR, f"{self.id}.log") self.start_logging() try: ...
[ "async", "def", "run", "(", "self", ",", "queue", ")", ":", "if", "self", ".", "options", "[", "\"logs\"", "]", ":", "self", ".", "logs_path", "=", "os", ".", "path", ".", "join", "(", "LOGS_DIR", ",", "f\"{self.id}.log\"", ")", "self", ".", "start_l...
https://github.com/truenas/middleware/blob/b11ec47d6340324f5a32287ffb4012e5d709b934/src/middlewared/middlewared/job.py#L405-L445
shmilylty/OneForAll
48591142a641e80f8a64ab215d11d06b696702d7
brute.py
python
gen_word_subdomains
(expression, path)
return subdomains
Generate subdomains based on word mode :param str expression: generate subdomains expression :param str path: path of wordlist :return set subdomains: list of subdomains
Generate subdomains based on word mode
[ "Generate", "subdomains", "based", "on", "word", "mode" ]
def gen_word_subdomains(expression, path): """ Generate subdomains based on word mode :param str expression: generate subdomains expression :param str path: path of wordlist :return set subdomains: list of subdomains """ subdomains = gen_subdomains(expression, path) logger.log('DEB...
[ "def", "gen_word_subdomains", "(", "expression", ",", "path", ")", ":", "subdomains", "=", "gen_subdomains", "(", "expression", ",", "path", ")", "logger", ".", "log", "(", "'DEBUG'", ",", "f'Dictionary based on word mode size: {len(subdomains)}'", ")", "return", "s...
https://github.com/shmilylty/OneForAll/blob/48591142a641e80f8a64ab215d11d06b696702d7/brute.py#L89-L99
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/django/contrib/gis/db/models/aggregates.py
python
Extent3D.__init__
(self, expression, **extra)
[]
def __init__(self, expression, **extra): super(Extent3D, self).__init__(expression, output_field=ExtentField(), **extra)
[ "def", "__init__", "(", "self", ",", "expression", ",", "*", "*", "extra", ")", ":", "super", "(", "Extent3D", ",", "self", ")", ".", "__init__", "(", "expression", ",", "output_field", "=", "ExtentField", "(", ")", ",", "*", "*", "extra", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/contrib/gis/db/models/aggregates.py#L56-L57
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/unifi/unifi_entity_base.py
python
UniFiBase.async_will_remove_from_hass
(self)
Disconnect object when removed.
Disconnect object when removed.
[ "Disconnect", "object", "when", "removed", "." ]
async def async_will_remove_from_hass(self) -> None: """Disconnect object when removed.""" _LOGGER.debug( "Removing %s entity %s (%s)", self.TYPE, self.entity_id, self.key, ) self._item.remove_callback(self.async_update_callback) se...
[ "async", "def", "async_will_remove_from_hass", "(", "self", ")", "->", "None", ":", "_LOGGER", ".", "debug", "(", "\"Removing %s entity %s (%s)\"", ",", "self", ".", "TYPE", ",", "self", ".", "entity_id", ",", "self", ".", "key", ",", ")", "self", ".", "_i...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/unifi/unifi_entity_base.py#L49-L58
nltk/nltk
3f74ac55681667d7ef78b664557487145f51eb02
nltk/parse/projectivedependencyparser.py
python
ProbabilisticProjectiveDependencyParser.train
(self, graphs)
Trains a ProbabilisticDependencyGrammar based on the list of input DependencyGraphs. This model is an implementation of Eisner's (1996) Model C, which derives its statistics from head-word, head-tag, child-word, and child-tag relationships. :param graphs: A list of dependency graphs to...
Trains a ProbabilisticDependencyGrammar based on the list of input DependencyGraphs. This model is an implementation of Eisner's (1996) Model C, which derives its statistics from head-word, head-tag, child-word, and child-tag relationships.
[ "Trains", "a", "ProbabilisticDependencyGrammar", "based", "on", "the", "list", "of", "input", "DependencyGraphs", ".", "This", "model", "is", "an", "implementation", "of", "Eisner", "s", "(", "1996", ")", "Model", "C", "which", "derives", "its", "statistics", ...
def train(self, graphs): """ Trains a ProbabilisticDependencyGrammar based on the list of input DependencyGraphs. This model is an implementation of Eisner's (1996) Model C, which derives its statistics from head-word, head-tag, child-word, and child-tag relationships. ...
[ "def", "train", "(", "self", ",", "graphs", ")", ":", "productions", "=", "[", "]", "events", "=", "defaultdict", "(", "int", ")", "tags", "=", "{", "}", "for", "dg", "in", "graphs", ":", "for", "node_index", "in", "range", "(", "1", ",", "len", ...
https://github.com/nltk/nltk/blob/3f74ac55681667d7ef78b664557487145f51eb02/nltk/parse/projectivedependencyparser.py#L439-L523
alan-turing-institute/sktime
79cc513346b1257a6f3fa8e4ed855b5a2a7de716
sktime/transformations/series/compose.py
python
OptionalPassthrough._transform
(self, X, y=None)
return X
Transform X and return a transformed version. private _transform containing the core logic, called from transform Parameters ---------- X : Series or Panel of mtype X_inner_mtype if X_inner_mtype is list, _transform must support all types in it Data to be transf...
Transform X and return a transformed version.
[ "Transform", "X", "and", "return", "a", "transformed", "version", "." ]
def _transform(self, X, y=None): """Transform X and return a transformed version. private _transform containing the core logic, called from transform Parameters ---------- X : Series or Panel of mtype X_inner_mtype if X_inner_mtype is list, _transform must support a...
[ "def", "_transform", "(", "self", ",", "X", ",", "y", "=", "None", ")", ":", "if", "not", "self", ".", "passthrough", ":", "X", "=", "self", ".", "transformer_", ".", "_transform", "(", "X", ",", "y", ")", "return", "X" ]
https://github.com/alan-turing-institute/sktime/blob/79cc513346b1257a6f3fa8e4ed855b5a2a7de716/sktime/transformations/series/compose.py#L131-L150
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-darwin/x64/tornado/web.py
python
RequestHandler._clear_headers_for_304
(self)
[]
def _clear_headers_for_304(self): # 304 responses should not contain entity headers (defined in # http://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html#sec7.1) # not explicitly allowed by # http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.5 headers = ["Allow", "Cont...
[ "def", "_clear_headers_for_304", "(", "self", ")", ":", "# 304 responses should not contain entity headers (defined in", "# http://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html#sec7.1)", "# not explicitly allowed by", "# http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.5", "header...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/tornado/web.py#L1685-L1694
akanimax/msg-stylegan-tf
41fb4eb29a78d1b8ee5aeaa0719592a28d01bce9
dnnlib/tflib/optimizer.py
python
Optimizer.get_loss_scaling_var
(self, device: str)
return self._dev_ls_var[device]
Get or create variable representing log2 of the current dynamic loss scaling factor.
Get or create variable representing log2 of the current dynamic loss scaling factor.
[ "Get", "or", "create", "variable", "representing", "log2", "of", "the", "current", "dynamic", "loss", "scaling", "factor", "." ]
def get_loss_scaling_var(self, device: str) -> Union[tf.Variable, None]: """Get or create variable representing log2 of the current dynamic loss scaling factor.""" if not self.use_loss_scaling: return None if device not in self._dev_ls_var: with tfutil.absolute_name_scop...
[ "def", "get_loss_scaling_var", "(", "self", ",", "device", ":", "str", ")", "->", "Union", "[", "tf", ".", "Variable", ",", "None", "]", ":", "if", "not", "self", ".", "use_loss_scaling", ":", "return", "None", "if", "device", "not", "in", "self", ".",...
https://github.com/akanimax/msg-stylegan-tf/blob/41fb4eb29a78d1b8ee5aeaa0719592a28d01bce9/dnnlib/tflib/optimizer.py#L240-L253
mkeeter/kokopelli
c99b7909e138c42c7d5c99927f5031f021bffd77
koko/fab/image.py
python
Image.threshold
(self, z)
return out
@brief Thresholds a heightmap at a given depth. @brief Can only be called on an 8, 16, or 32-bit image. @param z Z depth (in image units) @returns Thresholded image (8-bit, single-channel)
[]
def threshold(self, z): """ @brief Thresholds a heightmap at a given depth. @brief Can only be called on an 8, 16, or 32-bit image. @param z Z depth (in image units) @returns Thresholded image (8-bit, single-channel) """ out = self.__class__(self.width, self....
[ "def", "threshold", "(", "self", ",", "z", ")", ":", "out", "=", "self", ".", "__class__", "(", "self", ".", "width", ",", "self", ".", "height", ",", "channels", "=", "1", ",", "depth", "=", "8", ")", "for", "b", "in", "[", "'xmin'", ",", "'xm...
https://github.com/mkeeter/kokopelli/blob/c99b7909e138c42c7d5c99927f5031f021bffd77/koko/fab/image.py#L397-L417
magic282/NQG
3006ff8b29684adead2eec82c304d81b5907fa74
seq2seq_pt/s2s/xinit.py
python
xavier_normal
(tensor, gain=1)
return tensor.normal_(0, std)
Fills the input Tensor or Variable with values according to the method described in "Understanding the difficulty of training deep feedforward neural networks" - Glorot, X. & Bengio, Y. (2010), using a normal distribution. The resulting tensor will have values sampled from :math:`N(0, std)` where :math:`std...
Fills the input Tensor or Variable with values according to the method described in "Understanding the difficulty of training deep feedforward neural networks" - Glorot, X. & Bengio, Y. (2010), using a normal distribution. The resulting tensor will have values sampled from :math:`N(0, std)` where :math:`std...
[ "Fills", "the", "input", "Tensor", "or", "Variable", "with", "values", "according", "to", "the", "method", "described", "in", "Understanding", "the", "difficulty", "of", "training", "deep", "feedforward", "neural", "networks", "-", "Glorot", "X", ".", "&", "Be...
def xavier_normal(tensor, gain=1): """Fills the input Tensor or Variable with values according to the method described in "Understanding the difficulty of training deep feedforward neural networks" - Glorot, X. & Bengio, Y. (2010), using a normal distribution. The resulting tensor will have values sampled f...
[ "def", "xavier_normal", "(", "tensor", ",", "gain", "=", "1", ")", ":", "if", "isinstance", "(", "tensor", ",", "Variable", ")", ":", "xavier_normal", "(", "tensor", ".", "data", ",", "gain", "=", "gain", ")", "return", "tensor", "fan_in", ",", "fan_ou...
https://github.com/magic282/NQG/blob/3006ff8b29684adead2eec82c304d81b5907fa74/seq2seq_pt/s2s/xinit.py#L203-L223
sydney0zq/PTSNet
1a9be3eb12216be354a77294cde75f330d278796
coupled_otn_opn/tracking/maskrcnn/lib/utils/segms.py
python
polys_to_boxes
(polys)
return boxes_from_polys
Convert a list of polygons into an array of tight bounding boxes.
Convert a list of polygons into an array of tight bounding boxes.
[ "Convert", "a", "list", "of", "polygons", "into", "an", "array", "of", "tight", "bounding", "boxes", "." ]
def polys_to_boxes(polys): """Convert a list of polygons into an array of tight bounding boxes.""" boxes_from_polys = np.zeros((len(polys), 4), dtype=np.float32) for i in range(len(polys)): poly = polys[i] x0 = min(min(p[::2]) for p in poly) x1 = max(max(p[::2]) for p in poly) y0 = min(min(p[1::2]...
[ "def", "polys_to_boxes", "(", "polys", ")", ":", "boxes_from_polys", "=", "np", ".", "zeros", "(", "(", "len", "(", "polys", ")", ",", "4", ")", ",", "dtype", "=", "np", ".", "float32", ")", "for", "i", "in", "range", "(", "len", "(", "polys", ")...
https://github.com/sydney0zq/PTSNet/blob/1a9be3eb12216be354a77294cde75f330d278796/coupled_otn_opn/tracking/maskrcnn/lib/utils/segms.py#L120-L131
keiffster/program-y
8c99b56f8c32f01a7b9887b5daae9465619d0385
src/programy/services/rest/generic/service.py
python
GenericService.__init__
(self, configuration)
[]
def __init__(self, configuration): RESTService.__init__(self, configuration)
[ "def", "__init__", "(", "self", ",", "configuration", ")", ":", "RESTService", ".", "__init__", "(", "self", ",", "configuration", ")" ]
https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/services/rest/generic/service.py#L58-L59
blampe/IbPy
cba912d2ecc669b0bf2980357ea7942e49c0825e
ib/ext/ScannerSubscription.py
python
ScannerSubscription.spRatingAbove
(self)
return self.m_spRatingAbove
generated source for method spRatingAbove
generated source for method spRatingAbove
[ "generated", "source", "for", "method", "spRatingAbove" ]
def spRatingAbove(self): """ generated source for method spRatingAbove """ return self.m_spRatingAbove
[ "def", "spRatingAbove", "(", "self", ")", ":", "return", "self", ".", "m_spRatingAbove" ]
https://github.com/blampe/IbPy/blob/cba912d2ecc669b0bf2980357ea7942e49c0825e/ib/ext/ScannerSubscription.py#L99-L101
cheshirekow/cmake_format
eff5df1f41c665ea7cac799396042e4f406ef09a
cmakelang/lint/basic_checker.py
python
statement_is_fundef
(node)
return funname in ("function", "macro")
Return true if a statement node is for a function or macro definition.
Return true if a statement node is for a function or macro definition.
[ "Return", "true", "if", "a", "statement", "node", "is", "for", "a", "function", "or", "macro", "definition", "." ]
def statement_is_fundef(node): """Return true if a statement node is for a function or macro definition. """ tokens = node.get_semantic_tokens() if not tokens: return False funname = tokens[0].spelling.lower() return funname in ("function", "macro")
[ "def", "statement_is_fundef", "(", "node", ")", ":", "tokens", "=", "node", ".", "get_semantic_tokens", "(", ")", "if", "not", "tokens", ":", "return", "False", "funname", "=", "tokens", "[", "0", "]", ".", "spelling", ".", "lower", "(", ")", "return", ...
https://github.com/cheshirekow/cmake_format/blob/eff5df1f41c665ea7cac799396042e4f406ef09a/cmakelang/lint/basic_checker.py#L71-L78
Gallopsled/pwntools
1573957cc8b1957399b7cc9bfae0c6f80630d5d4
pwnlib/context/__init__.py
python
LocalNoarchContext
(function)
return setter
Same as LocalContext, but resets arch to :const:`'none'` by default Example: >>> @LocalNoarchContext ... def printArch(): ... print(context.arch) >>> printArch() none
Same as LocalContext, but resets arch to :const:`'none'` by default
[ "Same", "as", "LocalContext", "but", "resets", "arch", "to", ":", "const", ":", "none", "by", "default" ]
def LocalNoarchContext(function): """ Same as LocalContext, but resets arch to :const:`'none'` by default Example: >>> @LocalNoarchContext ... def printArch(): ... print(context.arch) >>> printArch() none """ @functools.wraps(function) def setter(*a,...
[ "def", "LocalNoarchContext", "(", "function", ")", ":", "@", "functools", ".", "wraps", "(", "function", ")", "def", "setter", "(", "*", "a", ",", "*", "*", "kw", ")", ":", "kw", ".", "setdefault", "(", "'arch'", ",", "'none'", ")", "with", "context"...
https://github.com/Gallopsled/pwntools/blob/1573957cc8b1957399b7cc9bfae0c6f80630d5d4/pwnlib/context/__init__.py#L1532-L1549
hyperledger/aries-cloudagent-python
2f36776e99f6053ae92eed8123b5b1b2e891c02a
aries_cloudagent/ledger/base.py
python
BaseLedger.get_revoc_reg_delta
( self, revoc_reg_id: str, timestamp_from=0, timestamp_to=None )
Look up a revocation registry delta by ID.
Look up a revocation registry delta by ID.
[ "Look", "up", "a", "revocation", "registry", "delta", "by", "ID", "." ]
async def get_revoc_reg_delta( self, revoc_reg_id: str, timestamp_from=0, timestamp_to=None ) -> Tuple[dict, int]: """Look up a revocation registry delta by ID."""
[ "async", "def", "get_revoc_reg_delta", "(", "self", ",", "revoc_reg_id", ":", "str", ",", "timestamp_from", "=", "0", ",", "timestamp_to", "=", "None", ")", "->", "Tuple", "[", "dict", ",", "int", "]", ":" ]
https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/ledger/base.py#L254-L257
venth/aws-adfs
73810a6f60b1a0b1f00921889f163654954fd06f
aws_adfs/account_aliases_fetcher.py
python
account_aliases
(session, username, password, auth_method, saml_response, config)
return accounts
[]
def account_aliases(session, username, password, auth_method, saml_response, config): alias_response = session.post( 'https://signin.aws.amazon.com/saml', verify=config.ssl_verification, headers={ 'Accept-Language': 'en', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WO...
[ "def", "account_aliases", "(", "session", ",", "username", ",", "password", ",", "auth_method", ",", "saml_response", ",", "config", ")", ":", "alias_response", "=", "session", ".", "post", "(", "'https://signin.aws.amazon.com/saml'", ",", "verify", "=", "config",...
https://github.com/venth/aws-adfs/blob/73810a6f60b1a0b1f00921889f163654954fd06f/aws_adfs/account_aliases_fetcher.py#L11-L55
steeve/xbmctorrent
e6bcb1037668959e1e3cb5ba8cf3e379c6638da9
resources/site-packages/xbmcswift2/cli/create.py
python
validate_pluginid
(value)
return all(c in valid for c in value)
Returns True if the provided value is a valid pluglin id
Returns True if the provided value is a valid pluglin id
[ "Returns", "True", "if", "the", "provided", "value", "is", "a", "valid", "pluglin", "id" ]
def validate_pluginid(value): '''Returns True if the provided value is a valid pluglin id''' valid = string.ascii_letters + string.digits + '.' return all(c in valid for c in value)
[ "def", "validate_pluginid", "(", "value", ")", ":", "valid", "=", "string", ".", "ascii_letters", "+", "string", ".", "digits", "+", "'.'", "return", "all", "(", "c", "in", "valid", "for", "c", "in", "value", ")" ]
https://github.com/steeve/xbmctorrent/blob/e6bcb1037668959e1e3cb5ba8cf3e379c6638da9/resources/site-packages/xbmcswift2/cli/create.py#L60-L63
robcarver17/pysystemtrade
b0385705b7135c52d39cb6d2400feece881bcca9
systems/system_cache.py
python
base_system_cache
(protected=False, not_pickable=False)
return decorate
:param protected: is this protected from casual deletion? :param not_pickable: can this not be saved using the pickle function (complex objects) :return: decorator function
[]
def base_system_cache(protected=False, not_pickable=False): """ :param protected: is this protected from casual deletion? :param not_pickable: can this not be saved using the pickle function (complex objects) :return: decorator function """ # this pattern from Beazleys book; function inside fu...
[ "def", "base_system_cache", "(", "protected", "=", "False", ",", "not_pickable", "=", "False", ")", ":", "# this pattern from Beazleys book; function inside function to get", "# arguments to wrapper", "def", "decorate", "(", "func", ")", ":", "@", "wraps", "(", "func", ...
https://github.com/robcarver17/pysystemtrade/blob/b0385705b7135c52d39cb6d2400feece881bcca9/systems/system_cache.py#L741-L774
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/django/core/serializers/pyyaml.py
python
Deserializer
(stream_or_string, **options)
Deserialize a stream or string of YAML data.
Deserialize a stream or string of YAML data.
[ "Deserialize", "a", "stream", "or", "string", "of", "YAML", "data", "." ]
def Deserializer(stream_or_string, **options): """ Deserialize a stream or string of YAML data. """ if isinstance(stream_or_string, bytes): stream_or_string = stream_or_string.decode('utf-8') if isinstance(stream_or_string, six.string_types): stream = StringIO(stream_or_string) e...
[ "def", "Deserializer", "(", "stream_or_string", ",", "*", "*", "options", ")", ":", "if", "isinstance", "(", "stream_or_string", ",", "bytes", ")", ":", "stream_or_string", "=", "stream_or_string", ".", "decode", "(", "'utf-8'", ")", "if", "isinstance", "(", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/core/serializers/pyyaml.py#L67-L84
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/models/electra/modeling_flax_electra.py
python
FlaxElectraOutput.setup
(self)
[]
def setup(self): self.dense = nn.Dense( self.config.hidden_size, kernel_init=jax.nn.initializers.normal(self.config.initializer_range), dtype=self.dtype, ) self.dropout = nn.Dropout(rate=self.config.hidden_dropout_prob) self.LayerNorm = nn.LayerNorm(ep...
[ "def", "setup", "(", "self", ")", ":", "self", ".", "dense", "=", "nn", ".", "Dense", "(", "self", ".", "config", ".", "hidden_size", ",", "kernel_init", "=", "jax", ".", "nn", ".", "initializers", ".", "normal", "(", "self", ".", "config", ".", "i...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/electra/modeling_flax_electra.py#L354-L361
ales-tsurko/cells
4cf7e395cd433762bea70cdc863a346f3a6fe1d0
packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/pyparsing.py
python
originalTextFor
(expr, asString=True)
return matchExpr
Helper to return the original, untokenized text for a given expression. Useful to restore the parsed fields of an HTML start tag into the raw tag text itself, or to revert separate tokens with intervening whitespace back to the original matching input text. By default, returns astring containing the or...
Helper to return the original, untokenized text for a given expression. Useful to restore the parsed fields of an HTML start tag into the raw tag text itself, or to revert separate tokens with intervening whitespace back to the original matching input text. By default, returns astring containing the or...
[ "Helper", "to", "return", "the", "original", "untokenized", "text", "for", "a", "given", "expression", ".", "Useful", "to", "restore", "the", "parsed", "fields", "of", "an", "HTML", "start", "tag", "into", "the", "raw", "tag", "text", "itself", "or", "to",...
def originalTextFor(expr, asString=True): """Helper to return the original, untokenized text for a given expression. Useful to restore the parsed fields of an HTML start tag into the raw tag text itself, or to revert separate tokens with intervening whitespace back to the original matching input text. ...
[ "def", "originalTextFor", "(", "expr", ",", "asString", "=", "True", ")", ":", "locMarker", "=", "Empty", "(", ")", ".", "setParseAction", "(", "lambda", "s", ",", "loc", ",", "t", ":", "loc", ")", "endlocMarker", "=", "locMarker", ".", "copy", "(", ...
https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/pyparsing.py#L5173-L5213
bert-nmt/bert-nmt
fcb616d28091ac23c9c16f30e6870fe90b8576d6
fairseq/optim/fairseq_optimizer.py
python
FairseqOptimizer.optimizer
(self)
return self._optimizer
Return a torch.optim.optimizer.Optimizer instance.
Return a torch.optim.optimizer.Optimizer instance.
[ "Return", "a", "torch", ".", "optim", ".", "optimizer", ".", "Optimizer", "instance", "." ]
def optimizer(self): """Return a torch.optim.optimizer.Optimizer instance.""" if not hasattr(self, '_optimizer'): raise NotImplementedError if not isinstance(self._optimizer, torch.optim.Optimizer): raise ValueError('_optimizer must be an instance of torch.optim.Optimizer...
[ "def", "optimizer", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_optimizer'", ")", ":", "raise", "NotImplementedError", "if", "not", "isinstance", "(", "self", ".", "_optimizer", ",", "torch", ".", "optim", ".", "Optimizer", ")", "...
https://github.com/bert-nmt/bert-nmt/blob/fcb616d28091ac23c9c16f30e6870fe90b8576d6/fairseq/optim/fairseq_optimizer.py#L26-L32
cuthbertLab/music21
bd30d4663e52955ed922c10fdf541419d8c67671
music21/analysis/metrical.py
python
thomassenMelodicAccent
(streamIn)
adds a attribute melodicAccent to each note of a :class:`~music21.stream.Stream` object according to the method postulated in Joseph M. Thomassen, "Melodic accent: Experiments and a tentative model," ''Journal of the Acoustical Society of America'', Vol. 71, No. 6 (1982) pp. 1598-1605; with, Erratum, ''Jour...
adds a attribute melodicAccent to each note of a :class:`~music21.stream.Stream` object according to the method postulated in Joseph M. Thomassen, "Melodic accent: Experiments and a tentative model," ''Journal of the Acoustical Society of America'', Vol. 71, No. 6 (1982) pp. 1598-1605; with, Erratum, ''Jour...
[ "adds", "a", "attribute", "melodicAccent", "to", "each", "note", "of", "a", ":", "class", ":", "~music21", ".", "stream", ".", "Stream", "object", "according", "to", "the", "method", "postulated", "in", "Joseph", "M", ".", "Thomassen", "Melodic", "accent", ...
def thomassenMelodicAccent(streamIn): ''' adds a attribute melodicAccent to each note of a :class:`~music21.stream.Stream` object according to the method postulated in Joseph M. Thomassen, "Melodic accent: Experiments and a tentative model," ''Journal of the Acoustical Society of America'', Vol. 71, No....
[ "def", "thomassenMelodicAccent", "(", "streamIn", ")", ":", "# we use .ps instead of Intervals for speed, since", "# we just need perceived contours", "maxNotes", "=", "len", "(", "streamIn", ")", "-", "1", "p2Accent", "=", "1.0", "for", "i", ",", "n", "in", "enumerat...
https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/analysis/metrical.py#L74-L157
joschabach/micropsi2
74a2642d20da9da1d64acc5e4c11aeabee192a27
micropsi_server/bottle.py
python
Router.build
(self, _name, *anons, **query)
Build an URL by filling the wildcards in a rule.
Build an URL by filling the wildcards in a rule.
[ "Build", "an", "URL", "by", "filling", "the", "wildcards", "in", "a", "rule", "." ]
def build(self, _name, *anons, **query): ''' Build an URL by filling the wildcards in a rule. ''' builder = self.builder.get(_name) if not builder: raise RouteBuildError("No route with that name.", _name) try: for i, value in enumerate(anons): query['anon%d'%i] = value ...
[ "def", "build", "(", "self", ",", "_name", ",", "*", "anons", ",", "*", "*", "query", ")", ":", "builder", "=", "self", ".", "builder", ".", "get", "(", "_name", ")", "if", "not", "builder", ":", "raise", "RouteBuildError", "(", "\"No route with that n...
https://github.com/joschabach/micropsi2/blob/74a2642d20da9da1d64acc5e4c11aeabee192a27/micropsi_server/bottle.py#L400-L409
jgilhutton/PyxieWPS
ba590343a73db98f898bda8b56b43928ac90947f
pyxiewps-EN-swearing-version.py
python
help
()
Help information
Help information
[ "Help", "information" ]
def help(): """ Help information """ print print ' Examples:' print print "\tpyxiewps -p -t 6 -c 7 -P -o file.txt -f" print "\tpyxiewps --use-pixie --time 6 --channel 7 --prompt --output file.txt" print "\tpyxiewps -m STATIC" print "\tpyxiewps --mode DRIVE" print print ' Individual options:...
[ "def", "help", "(", ")", ":", "print", "print", "' Examples:'", "print", "print", "\"\\tpyxiewps -p -t 6 -c 7 -P -o file.txt -f\"", "print", "\"\\tpyxiewps --use-pixie --time 6 --channel 7 --prompt --output file.txt\"", "print", "\"\\tpyxiewps -m STATIC\"", "print", "\"\\tpyxiewps -...
https://github.com/jgilhutton/PyxieWPS/blob/ba590343a73db98f898bda8b56b43928ac90947f/pyxiewps-EN-swearing-version.py#L175-L242
orakaro/rainbowstream
96141fac10675e0775d703f65a59c4477a48c57e
rainbowstream/rainbow.py
python
urlopen
()
Open url
Open url
[ "Open", "url" ]
def urlopen(): """ Open url """ t = Twitter(auth=authen()) try: if not g['stuff'].isdigit(): return tid = c['tweet_dict'][int(g['stuff'])] tweet = t.statuses.show(id=tid) urls = tweet['entities']['urls'] if not urls: printNicely(light_m...
[ "def", "urlopen", "(", ")", ":", "t", "=", "Twitter", "(", "auth", "=", "authen", "(", ")", ")", "try", ":", "if", "not", "g", "[", "'stuff'", "]", ".", "isdigit", "(", ")", ":", "return", "tid", "=", "c", "[", "'tweet_dict'", "]", "[", "int", ...
https://github.com/orakaro/rainbowstream/blob/96141fac10675e0775d703f65a59c4477a48c57e/rainbowstream/rainbow.py#L836-L856
MaurizioFD/RecSys2019_DeepLearning_Evaluation
0fb6b7f5c396f8525316ed66cf9c9fdb03a5fa9b
Conferences/SIGIR/CMN_our_interface/Pinterest/PinterestICCVReader.py
python
Dataset_NeuralCollaborativeFiltering.load_rating_file_as_matrix
(self, filename)
return mat
Read .rating file and Return dok matrix. The first line of .rating file is: num_users\t num_items
Read .rating file and Return dok matrix. The first line of .rating file is: num_users\t num_items
[ "Read", ".", "rating", "file", "and", "Return", "dok", "matrix", ".", "The", "first", "line", "of", ".", "rating", "file", "is", ":", "num_users", "\\", "t", "num_items" ]
def load_rating_file_as_matrix(self, filename): ''' Read .rating file and Return dok matrix. The first line of .rating file is: num_users\t num_items ''' # Get number of users and items num_users, num_items = 0, 0 with open(filename, "r") as f: line = ...
[ "def", "load_rating_file_as_matrix", "(", "self", ",", "filename", ")", ":", "# Get number of users and items", "num_users", ",", "num_items", "=", "0", ",", "0", "with", "open", "(", "filename", ",", "\"r\"", ")", "as", "f", ":", "line", "=", "f", ".", "r...
https://github.com/MaurizioFD/RecSys2019_DeepLearning_Evaluation/blob/0fb6b7f5c396f8525316ed66cf9c9fdb03a5fa9b/Conferences/SIGIR/CMN_our_interface/Pinterest/PinterestICCVReader.py#L155-L180
iclavera/learning_to_adapt
bd7d99ba402521c96631e7d09714128f549db0f1
learning_to_adapt/mujoco_py/mjtypes.py
python
MjvGeomWrapper.category
(self, value)
[]
def category(self, value): self._wrapped.contents.category = value
[ "def", "category", "(", "self", ",", "value", ")", ":", "self", ".", "_wrapped", ".", "contents", ".", "category", "=", "value" ]
https://github.com/iclavera/learning_to_adapt/blob/bd7d99ba402521c96631e7d09714128f549db0f1/learning_to_adapt/mujoco_py/mjtypes.py#L1526-L1527
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/scipy/io/matlab/mio4.py
python
VarReader4.read_full_array
(self, hdr)
return self.read_sub_array(hdr)
Full (rather than sparse) matrix getter Read matrix (array) can be real or complex Parameters ---------- hdr : ``VarHeader4`` instance Returns ------- arr : ndarray complex array if ``hdr.is_complex`` is True, otherwise a real numeric ar...
Full (rather than sparse) matrix getter
[ "Full", "(", "rather", "than", "sparse", ")", "matrix", "getter" ]
def read_full_array(self, hdr): ''' Full (rather than sparse) matrix getter Read matrix (array) can be real or complex Parameters ---------- hdr : ``VarHeader4`` instance Returns ------- arr : ndarray complex array if ``hdr.is_complex`` is T...
[ "def", "read_full_array", "(", "self", ",", "hdr", ")", ":", "if", "hdr", ".", "is_complex", ":", "# avoid array copy to save memory", "res", "=", "self", ".", "read_sub_array", "(", "hdr", ",", "copy", "=", "False", ")", "res_j", "=", "self", ".", "read_s...
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/scipy/io/matlab/mio4.py#L187-L207
mesalock-linux/mesapy
ed546d59a21b36feb93e2309d5c6b75aa0ad95c9
pypy/interpreter/baseobjspace.py
python
ObjSpace.unpackiterable
(self, w_iterable, expected_length=-1)
Unpack an iterable into a real (interpreter-level) list. Raise an OperationError(w_ValueError) if the length is wrong.
Unpack an iterable into a real (interpreter-level) list.
[ "Unpack", "an", "iterable", "into", "a", "real", "(", "interpreter", "-", "level", ")", "list", "." ]
def unpackiterable(self, w_iterable, expected_length=-1): """Unpack an iterable into a real (interpreter-level) list. Raise an OperationError(w_ValueError) if the length is wrong.""" w_iterator = self.iter(w_iterable) if expected_length == -1: if self.is_generator(w_iterator...
[ "def", "unpackiterable", "(", "self", ",", "w_iterable", ",", "expected_length", "=", "-", "1", ")", ":", "w_iterator", "=", "self", ".", "iter", "(", "w_iterable", ")", "if", "expected_length", "==", "-", "1", ":", "if", "self", ".", "is_generator", "("...
https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/pypy/interpreter/baseobjspace.py#L912-L927
sfepy/sfepy
02ec7bb2ab39ee1dfe1eb4cd509f0ffb7dcc8b25
sfepy/discrete/problem.py
python
Problem.get_tss_functions
(self, state0, update_bcs=True, update_materials=True, save_results=True, step_hook=None, post_process_hook=None)
return init_fun, prestep_fun, poststep_fun
Get the problem-dependent functions required by the time-stepping solver during the solution process. Parameters ---------- state0 : State The state holding the problem variables. update_bcs : bool, optional If True, update the boundary conditions in each...
Get the problem-dependent functions required by the time-stepping solver during the solution process.
[ "Get", "the", "problem", "-", "dependent", "functions", "required", "by", "the", "time", "-", "stepping", "solver", "during", "the", "solution", "process", "." ]
def get_tss_functions(self, state0, update_bcs=True, update_materials=True, save_results=True, step_hook=None, post_process_hook=None): """ Get the problem-dependent functions required by the time-stepping solver during the solution process. ...
[ "def", "get_tss_functions", "(", "self", ",", "state0", ",", "update_bcs", "=", "True", ",", "update_materials", "=", "True", ",", "save_results", "=", "True", ",", "step_hook", "=", "None", ",", "post_process_hook", "=", "None", ")", ":", "is_save", "=", ...
https://github.com/sfepy/sfepy/blob/02ec7bb2ab39ee1dfe1eb4cd509f0ffb7dcc8b25/sfepy/discrete/problem.py#L1200-L1289
morganstanley/treadmill
f18267c665baf6def4374d21170198f63ff1cde4
lib/python/treadmill/scheduler/__init__.py
python
zero_capacity
()
return np.zeros(DIMENSION_COUNT)
Returns zero capacity vector.
Returns zero capacity vector.
[ "Returns", "zero", "capacity", "vector", "." ]
def zero_capacity(): """Returns zero capacity vector. """ assert DIMENSION_COUNT is not None, 'Dimension count not set.' return np.zeros(DIMENSION_COUNT)
[ "def", "zero_capacity", "(", ")", ":", "assert", "DIMENSION_COUNT", "is", "not", "None", ",", "'Dimension count not set.'", "return", "np", ".", "zeros", "(", "DIMENSION_COUNT", ")" ]
https://github.com/morganstanley/treadmill/blob/f18267c665baf6def4374d21170198f63ff1cde4/lib/python/treadmill/scheduler/__init__.py#L60-L64
wikimedia/pywikibot
81a01ffaec7271bf5b4b170f85a80388420a4e78
pywikibot/page/__init__.py
python
BaseLink.fromPage
(cls, page)
return cls(title, namespace=page.namespace(), site=page.site)
Create a BaseLink to a Page. :param page: target pywikibot.page.Page :type page: pywikibot.page.Page :rtype: pywikibot.page.BaseLink
Create a BaseLink to a Page.
[ "Create", "a", "BaseLink", "to", "a", "Page", "." ]
def fromPage(cls, page): """ Create a BaseLink to a Page. :param page: target pywikibot.page.Page :type page: pywikibot.page.Page :rtype: pywikibot.page.BaseLink """ title = page.title(with_ns=False, allow_interwiki=False, ...
[ "def", "fromPage", "(", "cls", ",", "page", ")", ":", "title", "=", "page", ".", "title", "(", "with_ns", "=", "False", ",", "allow_interwiki", "=", "False", ",", "with_section", "=", "False", ")", "return", "cls", "(", "title", ",", "namespace", "=", ...
https://github.com/wikimedia/pywikibot/blob/81a01ffaec7271bf5b4b170f85a80388420a4e78/pywikibot/page/__init__.py#L5219-L5232
google-research/language
61fa7260ac7d690d11ef72ca863e45a37c0bdc80
language/bert_extraction/steal_bert_classifier/models/run_classifier.py
python
MnliProcessor.get_train_examples
(self, data_dir)
return self._create_examples( self._read_tsv(os.path.join(data_dir, "train.tsv")), "train")
See base class.
See base class.
[ "See", "base", "class", "." ]
def get_train_examples(self, data_dir): """See base class.""" return self._create_examples( self._read_tsv(os.path.join(data_dir, "train.tsv")), "train")
[ "def", "get_train_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"train.tsv\"", ")", ")", ",", "\"train\"", ")" ]
https://github.com/google-research/language/blob/61fa7260ac7d690d11ef72ca863e45a37c0bdc80/language/bert_extraction/steal_bert_classifier/models/run_classifier.py#L267-L270
IntelLabs/coach
dea46ae0d22b0a0cd30b9fc138a4a2642e1b9d9d
rl_coach/core_types.py
python
Episode.is_empty
(self)
return self.length() == 0
Check if the episode is empty :return: A boolean value determining if the episode is empty or not
Check if the episode is empty
[ "Check", "if", "the", "episode", "is", "empty" ]
def is_empty(self) -> bool: """ Check if the episode is empty :return: A boolean value determining if the episode is empty or not """ return self.length() == 0
[ "def", "is_empty", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "length", "(", ")", "==", "0" ]
https://github.com/IntelLabs/coach/blob/dea46ae0d22b0a0cd30b9fc138a4a2642e1b9d9d/rl_coach/core_types.py#L727-L733
Germey/CookiesPool
baf1989fcbe56634907ce9c923d74a022740ee87
cookiespool/api.py
python
add
(name, username, password)
return result
添加用户, 访问地址如 /weibo/add/user/password
添加用户, 访问地址如 /weibo/add/user/password
[ "添加用户", "访问地址如", "/", "weibo", "/", "add", "/", "user", "/", "password" ]
def add(name, username, password): """ 添加用户, 访问地址如 /weibo/add/user/password """ g = get_conn() result = getattr(g, name + '_account').set(username, password) return result
[ "def", "add", "(", "name", ",", "username", ",", "password", ")", ":", "g", "=", "get_conn", "(", ")", "result", "=", "getattr", "(", "g", ",", "name", "+", "'_account'", ")", ".", "set", "(", "username", ",", "password", ")", "return", "result" ]
https://github.com/Germey/CookiesPool/blob/baf1989fcbe56634907ce9c923d74a022740ee87/cookiespool/api.py#L40-L46
SCons/scons
309f0234d1d9cc76955818be47c5c722f577dac6
SCons/cpp.py
python
FunctionEvaluator.__call__
(self, *values)
return eval(statement, globals(), localvars)
Evaluates the expansion of a #define macro function called with the specified values.
Evaluates the expansion of a #define macro function called with the specified values.
[ "Evaluates", "the", "expansion", "of", "a", "#define", "macro", "function", "called", "with", "the", "specified", "values", "." ]
def __call__(self, *values): """ Evaluates the expansion of a #define macro function called with the specified values. """ if len(self.args) != len(values): raise ValueError("Incorrect number of arguments to `%s'" % self.name) # Create a dictionary that maps t...
[ "def", "__call__", "(", "self", ",", "*", "values", ")", ":", "if", "len", "(", "self", ".", "args", ")", "!=", "len", "(", "values", ")", ":", "raise", "ValueError", "(", "\"Incorrect number of arguments to `%s'\"", "%", "self", ".", "name", ")", "# Cre...
https://github.com/SCons/scons/blob/309f0234d1d9cc76955818be47c5c722f577dac6/SCons/cpp.py#L197-L213
eBay/accelerator
218d9a5e4451ac72b9e65df6c5b32e37d25136c8
accelerator/standard_methods/a_dataset_sort.py
python
prepare
(job, params)
return dw, ds_list, sort_idx
[]
def prepare(job, params): if options.trigger_column: assert options.sort_across_slices, 'trigger_column is meaningless without sort_across_slices' assert options.trigger_column in options.sort_columns, 'can only trigger on a column that is sorted on' d = datasets.source ds_list = d.chain(stop_ds={datasets.previo...
[ "def", "prepare", "(", "job", ",", "params", ")", ":", "if", "options", ".", "trigger_column", ":", "assert", "options", ".", "sort_across_slices", ",", "'trigger_column is meaningless without sort_across_slices'", "assert", "options", ".", "trigger_column", "in", "op...
https://github.com/eBay/accelerator/blob/218d9a5e4451ac72b9e65df6c5b32e37d25136c8/accelerator/standard_methods/a_dataset_sort.py#L126-L203
openstack/python-keystoneclient
100253d52e0c62dffffddb6f046ad660a9bce1a9
keystoneclient/v2_0/tokens.py
python
TokenManager.validate
(self, token)
return self._get('/tokens/%s' % base.getid(token), 'access')
Validate a token. :param token: Token to be validated. :rtype: :py:class:`.Token`
Validate a token.
[ "Validate", "a", "token", "." ]
def validate(self, token): """Validate a token. :param token: Token to be validated. :rtype: :py:class:`.Token` """ return self._get('/tokens/%s' % base.getid(token), 'access')
[ "def", "validate", "(", "self", ",", "token", ")", ":", "return", "self", ".", "_get", "(", "'/tokens/%s'", "%", "base", ".", "getid", "(", "token", ")", ",", "'access'", ")" ]
https://github.com/openstack/python-keystoneclient/blob/100253d52e0c62dffffddb6f046ad660a9bce1a9/keystoneclient/v2_0/tokens.py#L77-L85
nlloyd/SubliminalCollaborator
5c619e17ddbe8acb9eea8996ec038169ddcd50a1
libs/twisted/web/static.py
python
File.render_GET
(self, request)
return server.NOT_DONE_YET
Begin sending the contents of this L{File} (or a subset of the contents, based on the 'range' header) to the given request.
Begin sending the contents of this L{File} (or a subset of the contents, based on the 'range' header) to the given request.
[ "Begin", "sending", "the", "contents", "of", "this", "L", "{", "File", "}", "(", "or", "a", "subset", "of", "the", "contents", "based", "on", "the", "range", "header", ")", "to", "the", "given", "request", "." ]
def render_GET(self, request): """ Begin sending the contents of this L{File} (or a subset of the contents, based on the 'range' header) to the given request. """ self.restat(False) if self.type is None: self.type, self.encoding = getTypeAndEncoding(self.base...
[ "def", "render_GET", "(", "self", ",", "request", ")", ":", "self", ".", "restat", "(", "False", ")", "if", "self", ".", "type", "is", "None", ":", "self", ".", "type", ",", "self", ".", "encoding", "=", "getTypeAndEncoding", "(", "self", ".", "basen...
https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/web/static.py#L593-L634
jimmyleaf/ocr_tensorflow_cnn
aedd35bc49366c4a02a8068ec37b611a50d60db8
genIDCard.py
python
put_chinese_text.draw_text
(self, image, pos, text, text_size, text_color)
return img
draw chinese(or not) text with ttf :param image: image(numpy.ndarray) to draw text :param pos: where to draw text :param text: the context, for chinese should be unicode type :param text_size: text size :param text_color:text color :return: image
draw chinese(or not) text with ttf :param image: image(numpy.ndarray) to draw text :param pos: where to draw text :param text: the context, for chinese should be unicode type :param text_size: text size :param text_color:text color :return: image
[ "draw", "chinese", "(", "or", "not", ")", "text", "with", "ttf", ":", "param", "image", ":", "image", "(", "numpy", ".", "ndarray", ")", "to", "draw", "text", ":", "param", "pos", ":", "where", "to", "draw", "text", ":", "param", "text", ":", "the"...
def draw_text(self, image, pos, text, text_size, text_color): ''' draw chinese(or not) text with ttf :param image: image(numpy.ndarray) to draw text :param pos: where to draw text :param text: the context, for chinese should be unicode type :param text_size...
[ "def", "draw_text", "(", "self", ",", "image", ",", "pos", ",", "text", ",", "text_size", ",", "text_color", ")", ":", "self", ".", "_face", ".", "set_char_size", "(", "text_size", "*", "64", ")", "metrics", "=", "self", ".", "_face", ".", "size", "a...
https://github.com/jimmyleaf/ocr_tensorflow_cnn/blob/aedd35bc49366c4a02a8068ec37b611a50d60db8/genIDCard.py#L18-L40
matrix-org/synapse
8e57584a5859a9002759963eb546d523d2498a01
synapse/federation/transport/client.py
python
TransportLayerClient.send_knock_v1
( self, destination: str, room_id: str, event_id: str, content: JsonDict, )
return await self.client.put_json( destination=destination, path=path, data=content )
Sends a signed knock membership event to a remote server. This is the second step for knocking after make_knock. Args: destination: The remote homeserver. room_id: The ID of the room to knock on. event_id: The ID of the knock membership event that we're sending. ...
Sends a signed knock membership event to a remote server. This is the second step for knocking after make_knock.
[ "Sends", "a", "signed", "knock", "membership", "event", "to", "a", "remote", "server", ".", "This", "is", "the", "second", "step", "for", "knocking", "after", "make_knock", "." ]
async def send_knock_v1( self, destination: str, room_id: str, event_id: str, content: JsonDict, ) -> JsonDict: """ Sends a signed knock membership event to a remote server. This is the second step for knocking after make_knock. Args: ...
[ "async", "def", "send_knock_v1", "(", "self", ",", "destination", ":", "str", ",", "room_id", ":", "str", ",", "event_id", ":", "str", ",", "content", ":", "JsonDict", ",", ")", "->", "JsonDict", ":", "path", "=", "_create_v1_path", "(", "\"/send_knock/%s/...
https://github.com/matrix-org/synapse/blob/8e57584a5859a9002759963eb546d523d2498a01/synapse/federation/transport/client.py#L393-L424
gepd/Deviot
150caea06108369b30210eb287a580fcff4904af
platformio/project_recognition.py
python
ProjectRecognition.get_temp_project_path
(self)
return temp
Temp Project Path Path of project in a temporal folder, this folder do not neccessarilly exits Returns: [str] -- temp_path/project_name/
Temp Project Path
[ "Temp", "Project", "Path" ]
def get_temp_project_path(self): """Temp Project Path Path of project in a temporal folder, this folder do not neccessarilly exits Returns: [str] -- temp_path/project_name/ """ file_name = self.get_file_name(ext=False) if(not file_name): ...
[ "def", "get_temp_project_path", "(", "self", ")", ":", "file_name", "=", "self", ".", "get_file_name", "(", "ext", "=", "False", ")", "if", "(", "not", "file_name", ")", ":", "return", "None", "ext", "=", "self", ".", "get_file_extension", "(", ")", "if"...
https://github.com/gepd/Deviot/blob/150caea06108369b30210eb287a580fcff4904af/platformio/project_recognition.py#L75-L104
fake-name/ReadableWebProxy
ed5c7abe38706acc2684a1e6cd80242a03c5f010
WebMirror/management/rss_parser_funcs/feed_parse_extractTrackestWordpressCom.py
python
extractTrackestWordpressCom
(item)
return False
Parser for 'trackest.wordpress.com'
Parser for 'trackest.wordpress.com'
[ "Parser", "for", "trackest", ".", "wordpress", ".", "com" ]
def extractTrackestWordpressCom(item): ''' Parser for 'trackest.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('Legend of Fu Yao Chapter Update', 'Legend of Fu Yao', ...
[ "def", "extractTrackestWordpressCom", "(", "item", ")", ":", "vol", ",", "chp", ",", "frag", ",", "postfix", "=", "extractVolChapterFragmentPostfix", "(", "item", "[", "'title'", "]", ")", "if", "not", "(", "chp", "or", "vol", ")", "or", "\"preview\"", "in...
https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/rss_parser_funcs/feed_parse_extractTrackestWordpressCom.py#L1-L19
meetbill/zabbix_manager
739e5b51facf19cc6bda2b50f29108f831cf833e
ZabbixTool/lib_zabbix/w_lib/mylib/xlwt/Worksheet.py
python
Worksheet.get_merged_ranges
(self)
return self.__merged_ranges
[]
def get_merged_ranges(self): return self.__merged_ranges
[ "def", "get_merged_ranges", "(", "self", ")", ":", "return", "self", ".", "__merged_ranges" ]
https://github.com/meetbill/zabbix_manager/blob/739e5b51facf19cc6bda2b50f29108f831cf833e/ZabbixTool/lib_zabbix/w_lib/mylib/xlwt/Worksheet.py#L241-L242
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/nifi/models/process_group_dto.py
python
ProcessGroupDTO.parameter_context
(self, parameter_context)
Sets the parameter_context of this ProcessGroupDTO. The Parameter Context that this Process Group is bound to. :param parameter_context: The parameter_context of this ProcessGroupDTO. :type: ParameterContextReferenceEntity
Sets the parameter_context of this ProcessGroupDTO. The Parameter Context that this Process Group is bound to.
[ "Sets", "the", "parameter_context", "of", "this", "ProcessGroupDTO", ".", "The", "Parameter", "Context", "that", "this", "Process", "Group", "is", "bound", "to", "." ]
def parameter_context(self, parameter_context): """ Sets the parameter_context of this ProcessGroupDTO. The Parameter Context that this Process Group is bound to. :param parameter_context: The parameter_context of this ProcessGroupDTO. :type: ParameterContextReferenceEntity ...
[ "def", "parameter_context", "(", "self", ",", "parameter_context", ")", ":", "self", ".", "_parameter_context", "=", "parameter_context" ]
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/process_group_dto.py#L402-L411
WerWolv/EdiZon_CheatsConfigsAndScripts
d16d36c7509c01dca770f402babd83ff2e9ae6e7
Scripts/lib/python3.5/imp.py
python
source_from_cache
(path)
return util.source_from_cache(path)
**DEPRECATED** Given the path to a .pyc. file, return the path to its .py file. The .pyc file does not need to exist; this simply returns the path to the .py file calculated to correspond to the .pyc file. If path does not conform to PEP 3147 format, ValueError will be raised. If sys.implementati...
**DEPRECATED**
[ "**", "DEPRECATED", "**" ]
def source_from_cache(path): """**DEPRECATED** Given the path to a .pyc. file, return the path to its .py file. The .pyc file does not need to exist; this simply returns the path to the .py file calculated to correspond to the .pyc file. If path does not conform to PEP 3147 format, ValueError wil...
[ "def", "source_from_cache", "(", "path", ")", ":", "return", "util", ".", "source_from_cache", "(", "path", ")" ]
https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/imp.py#L91-L102
leancloud/satori
701caccbd4fe45765001ca60435c0cb499477c03
satori-rules/plugin/libs/redis/client.py
python
StrictRedis.decr
(self, name, amount=1)
return self.execute_command('DECRBY', name, amount)
Decrements the value of ``key`` by ``amount``. If no key exists, the value will be initialized as 0 - ``amount``
Decrements the value of ``key`` by ``amount``. If no key exists, the value will be initialized as 0 - ``amount``
[ "Decrements", "the", "value", "of", "key", "by", "amount", ".", "If", "no", "key", "exists", "the", "value", "will", "be", "initialized", "as", "0", "-", "amount" ]
def decr(self, name, amount=1): """ Decrements the value of ``key`` by ``amount``. If no key exists, the value will be initialized as 0 - ``amount`` """ return self.execute_command('DECRBY', name, amount)
[ "def", "decr", "(", "self", ",", "name", ",", "amount", "=", "1", ")", ":", "return", "self", ".", "execute_command", "(", "'DECRBY'", ",", "name", ",", "amount", ")" ]
https://github.com/leancloud/satori/blob/701caccbd4fe45765001ca60435c0cb499477c03/satori-rules/plugin/libs/redis/client.py#L832-L837
tensorflow/graphics
86997957324bfbdd85848daae989b4c02588faa0
tensorflow_graphics/io/exr.py
python
write_exr
(filename, values, channel_names)
Writes the values in a multi-channel ndarray into an EXR file. Args: filename: The filename of the output file values: A numpy ndarray with shape [height, width, channels] channel_names: A list of strings with length = channels Raises: TypeError: If the numpy array has an unsupported type. Val...
Writes the values in a multi-channel ndarray into an EXR file.
[ "Writes", "the", "values", "in", "a", "multi", "-", "channel", "ndarray", "into", "an", "EXR", "file", "." ]
def write_exr(filename, values, channel_names): """Writes the values in a multi-channel ndarray into an EXR file. Args: filename: The filename of the output file values: A numpy ndarray with shape [height, width, channels] channel_names: A list of strings with length = channels Raises: TypeError...
[ "def", "write_exr", "(", "filename", ",", "values", ",", "channel_names", ")", ":", "if", "values", ".", "shape", "[", "-", "1", "]", "!=", "len", "(", "channel_names", ")", ":", "raise", "ValueError", "(", "'Number of channels in values does not match channel n...
https://github.com/tensorflow/graphics/blob/86997957324bfbdd85848daae989b4c02588faa0/tensorflow_graphics/io/exr.py#L114-L143
wbond/oscrypto
d40c62577706682a0f6da5616ad09964f1c9137d
oscrypto/_win/symmetric.py
python
_bcrypt_decrypt
(cipher, key, data, iv, padding)
Decrypts AES/RC4/RC2/3DES/DES ciphertext via CNG :param cipher: A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key", "rc2", "rc4" :param key: The encryption key - a byte string 5-16 bytes long :param data: The ciphertext - a byte string :param iv: ...
Decrypts AES/RC4/RC2/3DES/DES ciphertext via CNG
[ "Decrypts", "AES", "/", "RC4", "/", "RC2", "/", "3DES", "/", "DES", "ciphertext", "via", "CNG" ]
def _bcrypt_decrypt(cipher, key, data, iv, padding): """ Decrypts AES/RC4/RC2/3DES/DES ciphertext via CNG :param cipher: A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key", "rc2", "rc4" :param key: The encryption key - a byte string 5-16 bytes long :param...
[ "def", "_bcrypt_decrypt", "(", "cipher", ",", "key", ",", "data", ",", "iv", ",", "padding", ")", ":", "key_handle", "=", "None", "try", ":", "key_handle", "=", "_bcrypt_create_key_handle", "(", "cipher", ",", "key", ")", "if", "iv", "is", "None", ":", ...
https://github.com/wbond/oscrypto/blob/d40c62577706682a0f6da5616ad09964f1c9137d/oscrypto/_win/symmetric.py#L1086-L1166
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/python-openid/openid/association.py
python
Association.getMessageSignature
(self, message)
return oidutil.toBase64(self.sign(pairs))
Return the signature of a message. If I am not a sign-all association, the message must have a signed list. @return: the signature, base64 encoded @rtype: str @raises ValueError: If there is no signed list and I am not a sign-all type of association.
Return the signature of a message.
[ "Return", "the", "signature", "of", "a", "message", "." ]
def getMessageSignature(self, message): """Return the signature of a message. If I am not a sign-all association, the message must have a signed list. @return: the signature, base64 encoded @rtype: str @raises ValueError: If there is no signed list and I am not a sign...
[ "def", "getMessageSignature", "(", "self", ",", "message", ")", ":", "pairs", "=", "self", ".", "_makePairs", "(", "message", ")", "return", "oidutil", ".", "toBase64", "(", "self", ".", "sign", "(", "pairs", ")", ")" ]
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/python-openid/openid/association.py#L482-L496
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/xml/etree/ElementPath.py
python
findtext
(elem, path, default=None, namespaces=None)
[]
def findtext(elem, path, default=None, namespaces=None): try: elem = next(iterfind(elem, path, namespaces)) return elem.text or "" except StopIteration: return default
[ "def", "findtext", "(", "elem", ",", "path", ",", "default", "=", "None", ",", "namespaces", "=", "None", ")", ":", "try", ":", "elem", "=", "next", "(", "iterfind", "(", "elem", ",", "path", ",", "namespaces", ")", ")", "return", "elem", ".", "tex...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/xml/etree/ElementPath.py#L298-L303
Calysto/calysto_scheme
15bf81987870bcae1264e5a0a06feb9a8ee12b8b
calysto_scheme/scheme.py
python
literal_q_hat
(asexp)
return (((asexp).car) is (atom_tag)) and ((number_q(untag_atom_hat(asexp))) or (boolean_q(untag_atom_hat(asexp))) or (((untag_atom_hat(asexp)) is symbol_emptylist)) or (char_q(untag_atom_hat(asexp))) or (string_q(untag_atom_hat(asexp))))
[]
def literal_q_hat(asexp): return (((asexp).car) is (atom_tag)) and ((number_q(untag_atom_hat(asexp))) or (boolean_q(untag_atom_hat(asexp))) or (((untag_atom_hat(asexp)) is symbol_emptylist)) or (char_q(untag_atom_hat(asexp))) or (string_q(untag_atom_hat(asexp))))
[ "def", "literal_q_hat", "(", "asexp", ")", ":", "return", "(", "(", "(", "asexp", ")", ".", "car", ")", "is", "(", "atom_tag", ")", ")", "and", "(", "(", "number_q", "(", "untag_atom_hat", "(", "asexp", ")", ")", ")", "or", "(", "boolean_q", "(", ...
https://github.com/Calysto/calysto_scheme/blob/15bf81987870bcae1264e5a0a06feb9a8ee12b8b/calysto_scheme/scheme.py#L6838-L6839
UFAL-DSG/tgen
3c43c0e29faa7ea3857a6e490d9c28a8daafc7d0
tgen/cluster.py
python
Job.__try_command
(self, cmd)
return output
\ Try to run a command and return its output. If the command fails, throw a RuntimeError.
\ Try to run a command and return its output. If the command fails, throw a RuntimeError.
[ "\\", "Try", "to", "run", "a", "command", "and", "return", "its", "output", ".", "If", "the", "command", "fails", "throw", "a", "RuntimeError", "." ]
def __try_command(self, cmd): """\ Try to run a command and return its output. If the command fails, throw a RuntimeError. """ status, output = subprocess.getstatusoutput(cmd) if status != 0: raise RuntimeError('Command \'' + cmd + '\' failed. Status: ' + ...
[ "def", "__try_command", "(", "self", ",", "cmd", ")", ":", "status", ",", "output", "=", "subprocess", ".", "getstatusoutput", "(", "cmd", ")", "if", "status", "!=", "0", ":", "raise", "RuntimeError", "(", "'Command \\''", "+", "cmd", "+", "'\\' failed. St...
https://github.com/UFAL-DSG/tgen/blob/3c43c0e29faa7ea3857a6e490d9c28a8daafc7d0/tgen/cluster.py#L374-L383
rembo10/headphones
b3199605be1ebc83a7a8feab6b1e99b64014187c
lib/cherrypy/wsgiserver/wsgiserver2.py
python
WSGIPathInfoDispatcher.__call__
(self, environ, start_response)
return ['']
[]
def __call__(self, environ, start_response): path = environ["PATH_INFO"] or "/" for p, app in self.apps: # The apps list should be sorted by length, descending. if path.startswith(p + "/") or path == p: environ = environ.copy() environ["SCRIPT_NAME...
[ "def", "__call__", "(", "self", ",", "environ", ",", "start_response", ")", ":", "path", "=", "environ", "[", "\"PATH_INFO\"", "]", "or", "\"/\"", "for", "p", ",", "app", "in", "self", ".", "apps", ":", "# The apps list should be sorted by length, descending.", ...
https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/cherrypy/wsgiserver/wsgiserver2.py#L2471-L2483
fake-name/ReadableWebProxy
ed5c7abe38706acc2684a1e6cd80242a03c5f010
WebMirror/management/rss_parser_funcs/feed_parse_extractLazyNanaseruTranslation.py
python
extractLazyNanaseruTranslation
(item)
return False
Parser for 'Lazy Nanaseru Translation'
Parser for 'Lazy Nanaseru Translation'
[ "Parser", "for", "Lazy", "Nanaseru", "Translation" ]
def extractLazyNanaseruTranslation(item): """ Parser for 'Lazy Nanaseru Translation' """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or 'preview' in item['title'].lower(): return None if 'WATTT' in item['tags']: return buildReleaseMessageWithType(item, 'WATTT'...
[ "def", "extractLazyNanaseruTranslation", "(", "item", ")", ":", "vol", ",", "chp", ",", "frag", ",", "postfix", "=", "extractVolChapterFragmentPostfix", "(", "item", "[", "'title'", "]", ")", "if", "not", "(", "chp", "or", "vol", ")", "or", "'preview'", "i...
https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/rss_parser_funcs/feed_parse_extractLazyNanaseruTranslation.py#L1-L10
raveberry/raveberry
df0186c94b238b57de86d3fd5c595dcd08a7c708
backend/core/musiq/playlist_provider.py
python
PlaylistProvider.persist
(self, session_key: str, archive: bool = True)
[]
def persist(self, session_key: str, archive: bool = True) -> None: if self.is_radio(): return assert self.id if self.title is None: logging.warning("Persisting a playlist with no title (id %s)", self.id) self.title = "" with transaction.atomic(): ...
[ "def", "persist", "(", "self", ",", "session_key", ":", "str", ",", "archive", ":", "bool", "=", "True", ")", "->", "None", ":", "if", "self", ".", "is_radio", "(", ")", ":", "return", "assert", "self", ".", "id", "if", "self", ".", "title", "is", ...
https://github.com/raveberry/raveberry/blob/df0186c94b238b57de86d3fd5c595dcd08a7c708/backend/core/musiq/playlist_provider.py#L150-L183
pythonarcade/arcade
1ee3eb1900683213e8e8df93943327c2ea784564
doc/tutorials/pymunk_platformer/pymunk_demo_platformer_02.py
python
GameWindow.setup
(self)
Set up everything with the game
Set up everything with the game
[ "Set", "up", "everything", "with", "the", "game" ]
def setup(self): """ Set up everything with the game """ pass
[ "def", "setup", "(", "self", ")", ":", "pass" ]
https://github.com/pythonarcade/arcade/blob/1ee3eb1900683213e8e8df93943327c2ea784564/doc/tutorials/pymunk_platformer/pymunk_demo_platformer_02.py#L38-L40
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/DigitalGuardian/Integrations/DigitalGuardian/DigitalGuardian.py
python
check_componentlist_entry
()
Does the componentlist_entry exist in the component list identified by componentlist_name Sets DigitalGuardian.Componentlist.Found flag.
Does the componentlist_entry exist in the component list identified by componentlist_name
[ "Does", "the", "componentlist_entry", "exist", "in", "the", "component", "list", "identified", "by", "componentlist_name" ]
def check_componentlist_entry(): """ Does the componentlist_entry exist in the component list identified by componentlist_name Sets DigitalGuardian.Componentlist.Found flag. """ componentlist_name = demisto.args().get('componentlist_name', None) componentlist_entry = demisto.args().get('compone...
[ "def", "check_componentlist_entry", "(", ")", ":", "componentlist_name", "=", "demisto", ".", "args", "(", ")", ".", "get", "(", "'componentlist_name'", ",", "None", ")", "componentlist_entry", "=", "demisto", ".", "args", "(", ")", ".", "get", "(", "'compon...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/DigitalGuardian/Integrations/DigitalGuardian/DigitalGuardian.py#L162-L192