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
DxCx/plugin.video.9anime
34358c2f701e5ddf19d3276926374a16f63f7b6a
resources/lib/ui/js2py/base.py
python
PyJs.__unicode__
(self)
return self.to_string().value
[]
def __unicode__(self): return self.to_string().value
[ "def", "__unicode__", "(", "self", ")", ":", "return", "self", ".", "to_string", "(", ")", ".", "value" ]
https://github.com/DxCx/plugin.video.9anime/blob/34358c2f701e5ddf19d3276926374a16f63f7b6a/resources/lib/ui/js2py/base.py#L905-L906
QUANTAXIS/QUANTAXIS
d6eccb97c8385854aa596d6ba8d70ec0655519ff
QUANTAXIS/QASU/save_binance.py
python
QA_SU_save_data_binance_callback
(data, freq)
异步获取数据回调用的 MongoDB 存储函数
异步获取数据回调用的 MongoDB 存储函数
[ "异步获取数据回调用的", "MongoDB", "存储函数" ]
def QA_SU_save_data_binance_callback(data, freq): """ 异步获取数据回调用的 MongoDB 存储函数 """ symbol_template = Binance_SYMBOL QA_util_log_info( 'SYMBOL "{}" Recived "{}" from {} to {} in total {} klines'.format( data.iloc[0].symbol, freq, time.strftime( ...
[ "def", "QA_SU_save_data_binance_callback", "(", "data", ",", "freq", ")", ":", "symbol_template", "=", "Binance_SYMBOL", "QA_util_log_info", "(", "'SYMBOL \"{}\" Recived \"{}\" from {} to {} in total {} klines'", ".", "format", "(", "data", ".", "iloc", "[", "0", "]", "...
https://github.com/QUANTAXIS/QUANTAXIS/blob/d6eccb97c8385854aa596d6ba8d70ec0655519ff/QUANTAXIS/QASU/save_binance.py#L541-L638
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/argparse.py
python
_get_action_name
(argument)
[]
def _get_action_name(argument): if argument is None: return None elif argument.option_strings: return '/'.join(argument.option_strings) elif argument.metavar not in (None, SUPPRESS): return argument.metavar elif argument.dest not in (None, SUPPRESS): return argument.dest...
[ "def", "_get_action_name", "(", "argument", ")", ":", "if", "argument", "is", "None", ":", "return", "None", "elif", "argument", ".", "option_strings", ":", "return", "'/'", ".", "join", "(", "argument", ".", "option_strings", ")", "elif", "argument", ".", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/argparse.py#L672-L682
postgres/pgadmin4
374c5e952fa594d749fadf1f88076c1cba8c5f64
web/pgadmin/tools/datagrid/__init__.py
python
_connect
(conn, **kwargs)
return status, msg, is_ask_password, user, role, password
Connect the database. :param conn: Connection instance. :param kwargs: user, role and password data from user. :return:
Connect the database. :param conn: Connection instance. :param kwargs: user, role and password data from user. :return:
[ "Connect", "the", "database", ".", ":", "param", "conn", ":", "Connection", "instance", ".", ":", "param", "kwargs", ":", "user", "role", "and", "password", "data", "from", "user", ".", ":", "return", ":" ]
def _connect(conn, **kwargs): """ Connect the database. :param conn: Connection instance. :param kwargs: user, role and password data from user. :return: """ user = None role = None password = None is_ask_password = False if 'user' in kwargs and 'role' in kwargs: user...
[ "def", "_connect", "(", "conn", ",", "*", "*", "kwargs", ")", ":", "user", "=", "None", "role", "=", "None", "password", "=", "None", "is_ask_password", "=", "False", "if", "'user'", "in", "kwargs", "and", "'role'", "in", "kwargs", ":", "user", "=", ...
https://github.com/postgres/pgadmin4/blob/374c5e952fa594d749fadf1f88076c1cba8c5f64/web/pgadmin/tools/datagrid/__init__.py#L344-L366
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/venv/lib/python3.7/site-packages/pip/_vendor/distlib/database.py
python
Distribution.__repr__
(self)
return '<Distribution %s (%s)%s>' % (self.name, self.version, suffix)
Return a textual representation of this instance,
Return a textual representation of this instance,
[ "Return", "a", "textual", "representation", "of", "this", "instance" ]
def __repr__(self): """ Return a textual representation of this instance, """ if self.source_url: suffix = ' [%s]' % self.source_url else: suffix = '' return '<Distribution %s (%s)%s>' % (self.name, self.version, suffix)
[ "def", "__repr__", "(", "self", ")", ":", "if", "self", ".", "source_url", ":", "suffix", "=", "' [%s]'", "%", "self", ".", "source_url", "else", ":", "suffix", "=", "''", "return", "'<Distribution %s (%s)%s>'", "%", "(", "self", ".", "name", ",", "self"...
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/venv/lib/python3.7/site-packages/pip/_vendor/distlib/database.py#L441-L449
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/scipy/fftpack/pseudo_diffs.py
python
ihilbert
(x)
return -hilbert(x)
Return inverse Hilbert transform of a periodic sequence x. If ``x_j`` and ``y_j`` are Fourier coefficients of periodic functions x and y, respectively, then:: y_j = -sqrt(-1)*sign(j) * x_j y_0 = 0
Return inverse Hilbert transform of a periodic sequence x.
[ "Return", "inverse", "Hilbert", "transform", "of", "a", "periodic", "sequence", "x", "." ]
def ihilbert(x): """ Return inverse Hilbert transform of a periodic sequence x. If ``x_j`` and ``y_j`` are Fourier coefficients of periodic functions x and y, respectively, then:: y_j = -sqrt(-1)*sign(j) * x_j y_0 = 0 """ return -hilbert(x)
[ "def", "ihilbert", "(", "x", ")", ":", "return", "-", "hilbert", "(", "x", ")" ]
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/scipy/fftpack/pseudo_diffs.py#L252-L263
itailang/SampleNet
442459abc54f9e14f0966a169a094a98febd32eb
reconstruction/src/samplenet_pointnet_ae.py
python
SampleNetPointNetAE.reconstruct
(self, X, GT=None, S=None, compute_loss=True)
return self.sess.run( (self.x_reconstr, loss, loss_ae, loss_simplification, loss_projection), feed_dict=feed_dict, )
Use AE to reconstruct given data. GT will be used to measure the loss (e.g., if X is a noisy version of the GT)
Use AE to reconstruct given data. GT will be used to measure the loss (e.g., if X is a noisy version of the GT)
[ "Use", "AE", "to", "reconstruct", "given", "data", ".", "GT", "will", "be", "used", "to", "measure", "the", "loss", "(", "e", ".", "g", ".", "if", "X", "is", "a", "noisy", "version", "of", "the", "GT", ")" ]
def reconstruct(self, X, GT=None, S=None, compute_loss=True): """Use AE to reconstruct given data. GT will be used to measure the loss (e.g., if X is a noisy version of the GT)""" if compute_loss: loss = self.loss loss_ae = self.loss_ae loss_simplification = s...
[ "def", "reconstruct", "(", "self", ",", "X", ",", "GT", "=", "None", ",", "S", "=", "None", ",", "compute_loss", "=", "True", ")", ":", "if", "compute_loss", ":", "loss", "=", "self", ".", "loss", "loss_ae", "=", "self", ".", "loss_ae", "loss_simplif...
https://github.com/itailang/SampleNet/blob/442459abc54f9e14f0966a169a094a98febd32eb/reconstruction/src/samplenet_pointnet_ae.py#L265-L289
trakt/Plex-Trakt-Scrobbler
aeb0bfbe62fad4b06c164f1b95581da7f35dce0b
Trakttv.bundle/Contents/Libraries/Linux/x86_64/ucs4/cryptography/x509/base.py
python
CertificateSigningRequestBuilder.sign
(self, private_key, algorithm, backend)
return backend.create_x509_csr(self, private_key, algorithm)
Signs the request using the requestor's private key.
Signs the request using the requestor's private key.
[ "Signs", "the", "request", "using", "the", "requestor", "s", "private", "key", "." ]
def sign(self, private_key, algorithm, backend): """ Signs the request using the requestor's private key. """ if self._subject_name is None: raise ValueError("A CertificateSigningRequest must have a subject") return backend.create_x509_csr(self, private_key, algorithm...
[ "def", "sign", "(", "self", ",", "private_key", ",", "algorithm", ",", "backend", ")", ":", "if", "self", ".", "_subject_name", "is", "None", ":", "raise", "ValueError", "(", "\"A CertificateSigningRequest must have a subject\"", ")", "return", "backend", ".", "...
https://github.com/trakt/Plex-Trakt-Scrobbler/blob/aeb0bfbe62fad4b06c164f1b95581da7f35dce0b/Trakttv.bundle/Contents/Libraries/Linux/x86_64/ucs4/cryptography/x509/base.py#L368-L374
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
osh/word_.py
python
_RightMostSpanForPart
(part)
[]
def _RightMostSpanForPart(part): # type: (word_part_t) -> int UP_part = part with tagswitch(part) as case: if case(word_part_e.ShArrayLiteral): part = cast(sh_array_literal, UP_part) # TODO: Return ) return LeftMostSpanForWord(part.words[0]) # Hm this is a=(1 2 3) elif case(word_part_e...
[ "def", "_RightMostSpanForPart", "(", "part", ")", ":", "# type: (word_part_t) -> int", "UP_part", "=", "part", "with", "tagswitch", "(", "part", ")", "as", "case", ":", "if", "case", "(", "word_part_e", ".", "ShArrayLiteral", ")", ":", "part", "=", "cast", "...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/osh/word_.py#L214-L267
MDudek-ICS/TRISIS-TRITON-HATMAN
15a00af7fd1040f0430729d024427601f84886a1
decompiled_code/library/pdb.py
python
Pdb.user_call
(self, frame, argument_list)
return
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: return if self.stop_here(frame): print >> self.stdout, '--Call--' self...
[ "def", "user_call", "(", "self", ",", "frame", ",", "argument_list", ")", ":", "if", "self", ".", "_wait_for_mainpyfile", ":", "return", "if", "self", ".", "stop_here", "(", "frame", ")", ":", "print", ">>", "self", ".", "stdout", ",", "'--Call--'", "sel...
https://github.com/MDudek-ICS/TRISIS-TRITON-HATMAN/blob/15a00af7fd1040f0430729d024427601f84886a1/decompiled_code/library/pdb.py#L122-L130
mdiazcl/fuzzbunch-debian
2b76c2249ade83a389ae3badb12a1bd09901fd2c
windows/Resources/Python/Core/Lib/random.py
python
Random.randrange
(self, start, stop=None, step=1, int=int, default=None, maxwidth=1 << BPF)
return istart + istep * int(self.random() * n)
Choose a random item from range(start, stop[, step]). This fixes the problem with randint() which includes the endpoint; in Python this is usually not what you want. Do not supply the 'int', 'default', and 'maxwidth' arguments.
Choose a random item from range(start, stop[, step]). This fixes the problem with randint() which includes the endpoint; in Python this is usually not what you want. Do not supply the 'int', 'default', and 'maxwidth' arguments.
[ "Choose", "a", "random", "item", "from", "range", "(", "start", "stop", "[", "step", "]", ")", ".", "This", "fixes", "the", "problem", "with", "randint", "()", "which", "includes", "the", "endpoint", ";", "in", "Python", "this", "is", "usually", "not", ...
def randrange(self, start, stop=None, step=1, int=int, default=None, maxwidth=1 << BPF): """Choose a random item from range(start, stop[, step]). This fixes the problem with randint() which includes the endpoint; in Python this is usually not what you want. Do not supply the 'in...
[ "def", "randrange", "(", "self", ",", "start", ",", "stop", "=", "None", ",", "step", "=", "1", ",", "int", "=", "int", ",", "default", "=", "None", ",", "maxwidth", "=", "1", "<<", "BPF", ")", ":", "istart", "=", "int", "(", "start", ")", "if"...
https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/random.py#L157-L196
rizar/attention-lvcsr
1ae52cafdd8419874846f9544a299eef9c758f3b
libs/Theano/theano/tensor/type.py
python
TensorType.value_zeros
(self, shape)
return numpy.zeros(shape, dtype=self.dtype)
Create an numpy ndarray full of 0 values.
Create an numpy ndarray full of 0 values.
[ "Create", "an", "numpy", "ndarray", "full", "of", "0", "values", "." ]
def value_zeros(self, shape): """ Create an numpy ndarray full of 0 values. """ return numpy.zeros(shape, dtype=self.dtype)
[ "def", "value_zeros", "(", "self", ",", "shape", ")", ":", "return", "numpy", ".", "zeros", "(", "shape", ",", "dtype", "=", "self", ".", "dtype", ")" ]
https://github.com/rizar/attention-lvcsr/blob/1ae52cafdd8419874846f9544a299eef9c758f3b/libs/Theano/theano/tensor/type.py#L629-L634
IntelAI/models
1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c
models/language_translation/tensorflow/transformer_mlperf/training/bfloat16/transformer/utils/dataset.py
python
_parse_example
(serialized_example)
return inputs, targets
Return inputs and targets Tensors from a serialized tf.Example.
Return inputs and targets Tensors from a serialized tf.Example.
[ "Return", "inputs", "and", "targets", "Tensors", "from", "a", "serialized", "tf", ".", "Example", "." ]
def _parse_example(serialized_example): """Return inputs and targets Tensors from a serialized tf.Example.""" data_fields = { "inputs": tf.io.VarLenFeature(tf.int64), "targets": tf.io.VarLenFeature(tf.int64) } parsed = tf.io.parse_single_example(serialized=serialized_example, features=data_fields) ...
[ "def", "_parse_example", "(", "serialized_example", ")", ":", "data_fields", "=", "{", "\"inputs\"", ":", "tf", ".", "io", ".", "VarLenFeature", "(", "tf", ".", "int64", ")", ",", "\"targets\"", ":", "tf", ".", "io", ".", "VarLenFeature", "(", "tf", ".",...
https://github.com/IntelAI/models/blob/1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c/models/language_translation/tensorflow/transformer_mlperf/training/bfloat16/transformer/utils/dataset.py#L77-L86
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/hqwebapp/templatetags/hq_shared_tags.py
python
add_days
(date, days=1)
Return a date with some days added
Return a date with some days added
[ "Return", "a", "date", "with", "some", "days", "added" ]
def add_days(date, days=1): '''Return a date with some days added''' span = timedelta(days=days) try: return date + span except: return datetime.strptime(date, '%m/%d/%Y').date() + span
[ "def", "add_days", "(", "date", ",", "days", "=", "1", ")", ":", "span", "=", "timedelta", "(", "days", "=", "days", ")", "try", ":", "return", "date", "+", "span", "except", ":", "return", "datetime", ".", "strptime", "(", "date", ",", "'%m/%d/%Y'",...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/hqwebapp/templatetags/hq_shared_tags.py#L74-L80
CvvT/dumpDex
92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1
python/idaapi.py
python
is_weak_name
(*args)
return _idaapi.is_weak_name(*args)
is_weak_name(ea) -> bool
is_weak_name(ea) -> bool
[ "is_weak_name", "(", "ea", ")", "-", ">", "bool" ]
def is_weak_name(*args): """ is_weak_name(ea) -> bool """ return _idaapi.is_weak_name(*args)
[ "def", "is_weak_name", "(", "*", "args", ")", ":", "return", "_idaapi", ".", "is_weak_name", "(", "*", "args", ")" ]
https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idaapi.py#L47353-L47357
timonwong/OmniMarkupPreviewer
21921ac7a99d2b5924a2219b33679a5b53621392
OmniMarkupLib/Renderers/libs/python2/docutils/parsers/rst/directives/__init__.py
python
flag
(argument)
Check for a valid flag option (no argument) and return ``None``. (Directive option conversion function.) Raise ``ValueError`` if an argument is found.
Check for a valid flag option (no argument) and return ``None``. (Directive option conversion function.)
[ "Check", "for", "a", "valid", "flag", "option", "(", "no", "argument", ")", "and", "return", "None", ".", "(", "Directive", "option", "conversion", "function", ".", ")" ]
def flag(argument): """ Check for a valid flag option (no argument) and return ``None``. (Directive option conversion function.) Raise ``ValueError`` if an argument is found. """ if argument and argument.strip(): raise ValueError('no argument is allowed; "%s" supplied' % argument) e...
[ "def", "flag", "(", "argument", ")", ":", "if", "argument", "and", "argument", ".", "strip", "(", ")", ":", "raise", "ValueError", "(", "'no argument is allowed; \"%s\" supplied'", "%", "argument", ")", "else", ":", "return", "None" ]
https://github.com/timonwong/OmniMarkupPreviewer/blob/21921ac7a99d2b5924a2219b33679a5b53621392/OmniMarkupLib/Renderers/libs/python2/docutils/parsers/rst/directives/__init__.py#L141-L151
vslavik/bakefile
0757295c3e4ac23cd1e0767c77c14c2256ed16e1
3rdparty/antlr3/python-runtime/antlr3/treewizard.py
python
TreeWizard.parse
(self, t, pattern, labels=None)
return self._parse(t, tpattern, labels)
Given a pattern like (ASSIGN %lhs:ID %rhs:.) with optional labels on the various nodes and '.' (dot) as the node/subtree wildcard, return true if the pattern matches and fill the labels Map with the labels pointing at the appropriate nodes. Return false if the pattern is malformed or th...
Given a pattern like (ASSIGN %lhs:ID %rhs:.) with optional labels on the various nodes and '.' (dot) as the node/subtree wildcard, return true if the pattern matches and fill the labels Map with the labels pointing at the appropriate nodes. Return false if the pattern is malformed or th...
[ "Given", "a", "pattern", "like", "(", "ASSIGN", "%lhs", ":", "ID", "%rhs", ":", ".", ")", "with", "optional", "labels", "on", "the", "various", "nodes", "and", ".", "(", "dot", ")", "as", "the", "node", "/", "subtree", "wildcard", "return", "true", "...
def parse(self, t, pattern, labels=None): """ Given a pattern like (ASSIGN %lhs:ID %rhs:.) with optional labels on the various nodes and '.' (dot) as the node/subtree wildcard, return true if the pattern matches and fill the labels Map with the labels pointing at the appropriate ...
[ "def", "parse", "(", "self", ",", "t", ",", "pattern", ",", "labels", "=", "None", ")", ":", "tokenizer", "=", "TreePatternLexer", "(", "pattern", ")", "parser", "=", "TreePatternParser", "(", "tokenizer", ",", "self", ",", "TreePatternTreeAdaptor", "(", "...
https://github.com/vslavik/bakefile/blob/0757295c3e4ac23cd1e0767c77c14c2256ed16e1/3rdparty/antlr3/python-runtime/antlr3/treewizard.py#L521-L537
zhuifengshen/xmind
be2966776f2a7262b6a9960682380571a2e91ccf
xmind/utils.py
python
get_abs_path
(path)
return join_path(fp, fn)
Return the absolute path of a file If path contains a start point (eg Unix '/') then use the specified start point instead of the current working directory. The starting point of the file path is allowed to begin with a tilde "~", which will be replaced with the user's home directory.
Return the absolute path of a file
[ "Return", "the", "absolute", "path", "of", "a", "file" ]
def get_abs_path(path): """ Return the absolute path of a file If path contains a start point (eg Unix '/') then use the specified start point instead of the current working directory. The starting point of the file path is allowed to begin with a tilde "~", which will be replaced w...
[ "def", "get_abs_path", "(", "path", ")", ":", "fp", ",", "fn", "=", "os", ".", "path", ".", "split", "(", "path", ")", "if", "not", "fp", ":", "fp", "=", "os", ".", "getcwd", "(", ")", "fp", "=", "os", ".", "path", ".", "abspath", "(", "os", ...
https://github.com/zhuifengshen/xmind/blob/be2966776f2a7262b6a9960682380571a2e91ccf/xmind/utils.py#L49-L64
nlloyd/SubliminalCollaborator
5c619e17ddbe8acb9eea8996ec038169ddcd50a1
libs/twisted/application/app.py
python
ServerOptions.opt_spew
(self)
Print an insanely verbose log of everything that happens. Useful when debugging freezes or locks in complex code.
Print an insanely verbose log of everything that happens. Useful when debugging freezes or locks in complex code.
[ "Print", "an", "insanely", "verbose", "log", "of", "everything", "that", "happens", ".", "Useful", "when", "debugging", "freezes", "or", "locks", "in", "complex", "code", "." ]
def opt_spew(self): """ Print an insanely verbose log of everything that happens. Useful when debugging freezes or locks in complex code.""" sys.settrace(util.spewer) try: import threading except ImportError: return threading.settrace(util....
[ "def", "opt_spew", "(", "self", ")", ":", "sys", ".", "settrace", "(", "util", ".", "spewer", ")", "try", ":", "import", "threading", "except", "ImportError", ":", "return", "threading", ".", "settrace", "(", "util", ".", "spewer", ")" ]
https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/application/app.py#L599-L608
eventable/vobject
498555a553155ea9b26aace93332ae79365ecb31
docs/build/lib/vobject/vcard.py
python
VCard3_0.generateImplicitParameters
(cls, obj)
Create PRODID, VERSION, and VTIMEZONEs if needed. VTIMEZONEs will need to exist whenever TZID parameters exist or when datetimes with tzinfo exist.
Create PRODID, VERSION, and VTIMEZONEs if needed.
[ "Create", "PRODID", "VERSION", "and", "VTIMEZONEs", "if", "needed", "." ]
def generateImplicitParameters(cls, obj): """ Create PRODID, VERSION, and VTIMEZONEs if needed. VTIMEZONEs will need to exist whenever TZID parameters exist or when datetimes with tzinfo exist. """ if not hasattr(obj, 'version'): obj.add(ContentLine('VERSION'...
[ "def", "generateImplicitParameters", "(", "cls", ",", "obj", ")", ":", "if", "not", "hasattr", "(", "obj", ",", "'version'", ")", ":", "obj", ".", "add", "(", "ContentLine", "(", "'VERSION'", ",", "[", "]", ",", "cls", ".", "versionString", ")", ")" ]
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/docs/build/lib/vobject/vcard.py#L185-L193
softlayer/softlayer-python
cdef7d63c66413197a9a97b0414de9f95887a82a
SoftLayer/managers/network.py
python
NetworkManager.set_tags_subnet
(self, subnet_id, tags)
return self.subnet.setTags(tags, id=subnet_id)
Tag a subnet by passing in one or more tags separated by a comma. :param int subnet_id: The ID of the subnet. :param string tags: Comma separated list of tags.
Tag a subnet by passing in one or more tags separated by a comma.
[ "Tag", "a", "subnet", "by", "passing", "in", "one", "or", "more", "tags", "separated", "by", "a", "comma", "." ]
def set_tags_subnet(self, subnet_id, tags): """Tag a subnet by passing in one or more tags separated by a comma. :param int subnet_id: The ID of the subnet. :param string tags: Comma separated list of tags. """ return self.subnet.setTags(tags, id=subnet_id)
[ "def", "set_tags_subnet", "(", "self", ",", "subnet_id", ",", "tags", ")", ":", "return", "self", ".", "subnet", ".", "setTags", "(", "tags", ",", "id", "=", "subnet_id", ")" ]
https://github.com/softlayer/softlayer-python/blob/cdef7d63c66413197a9a97b0414de9f95887a82a/SoftLayer/managers/network.py#L269-L275
stepjam/PyRep
d778d5d4ffa3be366d4e699f6e2941553fd47ecc
pyrep/objects/shape.py
python
Shape.import_shape
(cls, filename: str, scaling_factor=1.0, keep_identical_vertices=False, ignore_color=False, ignore_texture=False, reorient_bounding_box=False, ignore_up_vector=False)
return cls(handle)
Imports a shape with visuals from a file. :param filename: The location of the file to import. :param scaling_factor: The scaling factor to apply to the imported vertices :param keep_identical_vertices: Keep identical vertices. :param ignore_color: Do not preserve colors. :param...
Imports a shape with visuals from a file.
[ "Imports", "a", "shape", "with", "visuals", "from", "a", "file", "." ]
def import_shape(cls, filename: str, scaling_factor=1.0, keep_identical_vertices=False, ignore_color=False, ignore_texture=False, reorient_bounding_box=False, ignore_up_vector=False) -> 'Shape': """Imports a shape with visuals from a file. ...
[ "def", "import_shape", "(", "cls", ",", "filename", ":", "str", ",", "scaling_factor", "=", "1.0", ",", "keep_identical_vertices", "=", "False", ",", "ignore_color", "=", "False", ",", "ignore_texture", "=", "False", ",", "reorient_bounding_box", "=", "False", ...
https://github.com/stepjam/PyRep/blob/d778d5d4ffa3be366d4e699f6e2941553fd47ecc/pyrep/objects/shape.py#L82-L114
mkelly12/google_closure_compiler
74572d592f5364504615853ef2a2dd0d4f5cabe0
bin/calcdeps.py
python
Compile
(compiler_jar_path, source_paths, out, flags=None)
Prepares command-line call to Closure compiler. Args: compiler_jar_path: Path to the Closure compiler .jar file. source_paths: Source paths to build, in order. flags: A list of additional flags to pass on to Closure compiler.
Prepares command-line call to Closure compiler.
[ "Prepares", "command", "-", "line", "call", "to", "Closure", "compiler", "." ]
def Compile(compiler_jar_path, source_paths, out, flags=None): """Prepares command-line call to Closure compiler. Args: compiler_jar_path: Path to the Closure compiler .jar file. source_paths: Source paths to build, in order. flags: A list of additional flags to pass on to Closure compiler. """ arg...
[ "def", "Compile", "(", "compiler_jar_path", ",", "source_paths", ",", "out", ",", "flags", "=", "None", ")", ":", "args", "=", "[", "'java'", ",", "'-jar'", ",", "compiler_jar_path", "]", "for", "path", "in", "source_paths", ":", "args", "+=", "[", "'--j...
https://github.com/mkelly12/google_closure_compiler/blob/74572d592f5364504615853ef2a2dd0d4f5cabe0/bin/calcdeps.py#L309-L331
dipy/dipy
be956a529465b28085f8fc435a756947ddee1c89
dipy/denoise/patch2self.py
python
_extract_3d_patches
(arr, patch_radius)
return np.array(all_patches).T
Extract 3D patches from 4D DWI data. Parameters ---------- arr : ndarray The 4D noisy DWI data to be denoised. patch_radius : int or 1D array The radius of the local patch to be taken around each voxel (in voxels). Returns -------- all_patches : ndarray All...
Extract 3D patches from 4D DWI data.
[ "Extract", "3D", "patches", "from", "4D", "DWI", "data", "." ]
def _extract_3d_patches(arr, patch_radius): """ Extract 3D patches from 4D DWI data. Parameters ---------- arr : ndarray The 4D noisy DWI data to be denoised. patch_radius : int or 1D array The radius of the local patch to be taken around each voxel (in voxels). Return...
[ "def", "_extract_3d_patches", "(", "arr", ",", "patch_radius", ")", ":", "if", "isinstance", "(", "patch_radius", ",", "int", ")", ":", "patch_radius", "=", "np", ".", "ones", "(", "3", ",", "dtype", "=", "int", ")", "*", "patch_radius", "if", "len", "...
https://github.com/dipy/dipy/blob/be956a529465b28085f8fc435a756947ddee1c89/dipy/denoise/patch2self.py#L112-L162
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
lms/djangoapps/courseware/masquerade.py
python
is_masquerading_as_specific_student
(user, course_key)
return bool(course_masquerade and course_masquerade.user_name)
Returns whether the user is a staff member masquerading as a specific student.
Returns whether the user is a staff member masquerading as a specific student.
[ "Returns", "whether", "the", "user", "is", "a", "staff", "member", "masquerading", "as", "a", "specific", "student", "." ]
def is_masquerading_as_specific_student(user, course_key): """ Returns whether the user is a staff member masquerading as a specific student. """ course_masquerade = get_course_masquerade(user, course_key) return bool(course_masquerade and course_masquerade.user_name)
[ "def", "is_masquerading_as_specific_student", "(", "user", ",", "course_key", ")", ":", "course_masquerade", "=", "get_course_masquerade", "(", "user", ",", "course_key", ")", "return", "bool", "(", "course_masquerade", "and", "course_masquerade", ".", "user_name", ")...
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/lms/djangoapps/courseware/masquerade.py#L348-L353
python-zk/kazoo
f585d605eea0a37a08aae95a8cc259b80da2ecf0
kazoo/client.py
python
KazooClient.set_acls
(self, path, acls, version=-1)
return self.set_acls_async(path, acls, version).get()
Set the ACL for the node of the given path. Set the ACL for the node of the given path if such a node exists and the given version matches the version of the node. :param path: Path for the node. :param acls: List of :class:`~kazoo.security.ACL` objects to set. ...
Set the ACL for the node of the given path.
[ "Set", "the", "ACL", "for", "the", "node", "of", "the", "given", "path", "." ]
def set_acls(self, path, acls, version=-1): """Set the ACL for the node of the given path. Set the ACL for the node of the given path if such a node exists and the given version matches the version of the node. :param path: Path for the node. :param acls: List of :class:`~kazoo...
[ "def", "set_acls", "(", "self", ",", "path", ",", "acls", ",", "version", "=", "-", "1", ")", ":", "return", "self", ".", "set_acls_async", "(", "path", ",", "acls", ",", "version", ")", ".", "get", "(", ")" ]
https://github.com/python-zk/kazoo/blob/f585d605eea0a37a08aae95a8cc259b80da2ecf0/kazoo/client.py#L1277-L1304
glumpy/glumpy
46a7635c08d3a200478397edbe0371a6c59cd9d7
glumpy/gloo/snippet.py
python
Snippet.next
(self)
return None
Next snippet in the arihmetic chain.
Next snippet in the arihmetic chain.
[ "Next", "snippet", "in", "the", "arihmetic", "chain", "." ]
def next(self): """ Next snippet in the arihmetic chain. """ if self._next: return self._next[1] return None
[ "def", "next", "(", "self", ")", ":", "if", "self", ".", "_next", ":", "return", "self", ".", "_next", "[", "1", "]", "return", "None" ]
https://github.com/glumpy/glumpy/blob/46a7635c08d3a200478397edbe0371a6c59cd9d7/glumpy/gloo/snippet.py#L193-L198
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
examples/legacy/pytorch-lightning/lightning_base.py
python
BaseTransformer.setup
(self, mode)
[]
def setup(self, mode): if mode == "test": self.dataset_size = len(self.test_dataloader().dataset) else: self.train_loader = self.get_dataloader("train", self.hparams.train_batch_size, shuffle=True) self.dataset_size = len(self.train_dataloader().dataset)
[ "def", "setup", "(", "self", ",", "mode", ")", ":", "if", "mode", "==", "\"test\"", ":", "self", ".", "dataset_size", "=", "len", "(", "self", ".", "test_dataloader", "(", ")", ".", "dataset", ")", "else", ":", "self", ".", "train_loader", "=", "self...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/examples/legacy/pytorch-lightning/lightning_base.py#L170-L175
SanPen/GridCal
d3f4566d2d72c11c7e910c9d162538ef0e60df31
src/GridCal/Engine/Simulations/LinearFactors/linear_analysis_ts_driver.py
python
LinearAnalysisTimeSeries.run
(self)
Run the time series simulation @return:
Run the time series simulation
[ "Run", "the", "time", "series", "simulation" ]
def run(self): """ Run the time series simulation @return: """ self.__cancel__ = False a = time.time() if self.end_ is None: self.end_ = len(self.grid.time_profile) time_indices = np.arange(self.start_, self.end_ + 1) ts_numeric_circu...
[ "def", "run", "(", "self", ")", ":", "self", ".", "__cancel__", "=", "False", "a", "=", "time", ".", "time", "(", ")", "if", "self", ".", "end_", "is", "None", ":", "self", ".", "end_", "=", "len", "(", "self", ".", "grid", ".", "time_profile", ...
https://github.com/SanPen/GridCal/blob/d3f4566d2d72c11c7e910c9d162538ef0e60df31/src/GridCal/Engine/Simulations/LinearFactors/linear_analysis_ts_driver.py#L179-L217
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/binary_tree.py
python
BinaryTree.tamari_sorting_tuple
(self, reverse=False)
return (u1 + (n2,) + u2, n1 + 1 + n2)
r""" Return the Tamari sorting tuple of ``self`` and the size of ``self``. This is a pair `(w, n)`, where `n` is the number of nodes of ``self``, and `w` is an `n`-tuple whose `i`-th entry is the number of all nodes among the descendants of the right child of the `i`-th ...
r""" Return the Tamari sorting tuple of ``self`` and the size of ``self``.
[ "r", "Return", "the", "Tamari", "sorting", "tuple", "of", "self", "and", "the", "size", "of", "self", "." ]
def tamari_sorting_tuple(self, reverse=False): r""" Return the Tamari sorting tuple of ``self`` and the size of ``self``. This is a pair `(w, n)`, where `n` is the number of nodes of ``self``, and `w` is an `n`-tuple whose `i`-th entry is the number of all nodes among th...
[ "def", "tamari_sorting_tuple", "(", "self", ",", "reverse", "=", "False", ")", ":", "if", "not", "self", ":", "return", "tuple", "(", ")", ",", "0", "if", "not", "reverse", ":", "t1", ",", "t2", "=", "self", "else", ":", "t2", ",", "t1", "=", "se...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/binary_tree.py#L1408-L1463
xdress/xdress
eb7f0a02b3edf617d401939ede7f0d713a88917f
xdress/clang/cindex.py
python
Cursor.get_tokens
(self)
return TokenGroup.get_tokens(self._tu, self.extent)
Obtain Token instances formulating that compose this Cursor. This is a generator for Token instances. It returns all tokens which occupy the extent this cursor occupies.
Obtain Token instances formulating that compose this Cursor.
[ "Obtain", "Token", "instances", "formulating", "that", "compose", "this", "Cursor", "." ]
def get_tokens(self): """Obtain Token instances formulating that compose this Cursor. This is a generator for Token instances. It returns all tokens which occupy the extent this cursor occupies. """ return TokenGroup.get_tokens(self._tu, self.extent)
[ "def", "get_tokens", "(", "self", ")", ":", "return", "TokenGroup", ".", "get_tokens", "(", "self", ".", "_tu", ",", "self", ".", "extent", ")" ]
https://github.com/xdress/xdress/blob/eb7f0a02b3edf617d401939ede7f0d713a88917f/xdress/clang/cindex.py#L1533-L1539
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/users/views.py
python
UserBasedCF.generate_dataset
(self, filename2, pivot=1.0)
load rating data and split it to training set and test set
load rating data and split it to training set and test set
[ "load", "rating", "data", "and", "split", "it", "to", "training", "set", "and", "test", "set" ]
def generate_dataset(self, filename2, pivot=1.0): ''' load rating data and split it to training set and test set ''' trainset_len = 0 testset_len = 0 for line in self.loadfile(filename2): # user, movie, rating, _ = line.split('::') user, movie, rating = line.spli...
[ "def", "generate_dataset", "(", "self", ",", "filename2", ",", "pivot", "=", "1.0", ")", ":", "trainset_len", "=", "0", "testset_len", "=", "0", "for", "line", "in", "self", ".", "loadfile", "(", "filename2", ")", ":", "# user, movie, rating, _ = line.split(':...
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/users/views.py#L254-L274
AstroPrint/AstroBox
e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75
src/astroprint/software.py
python
SoftwareManager.restartServer
(self)
return True
[]
def restartServer(self): if platformStr == "linux" or platformStr == "linux2": actions = self._settings.get(["system", "actions"]) for a in actions: if a['action'] == 'reboot': #Call to Popen will start the restart command but return inmediately before it completes threading.Timer(1.0, subprocess....
[ "def", "restartServer", "(", "self", ")", ":", "if", "platformStr", "==", "\"linux\"", "or", "platformStr", "==", "\"linux2\"", ":", "actions", "=", "self", ".", "_settings", ".", "get", "(", "[", "\"system\"", ",", "\"actions\"", "]", ")", "for", "a", "...
https://github.com/AstroPrint/AstroBox/blob/e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75/src/astroprint/software.py#L601-L623
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/mailbox.py
python
_ProxyFile.tell
(self)
return self._pos
Return the position.
Return the position.
[ "Return", "the", "position", "." ]
def tell(self): """Return the position.""" return self._pos
[ "def", "tell", "(", "self", ")", ":", "return", "self", ".", "_pos" ]
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/mailbox.py#L1959-L1961
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/scipy/integrate/quadrature.py
python
romberg
(function, a, b, args=(), tol=1.48e-8, rtol=1.48e-8, show=False, divmax=10, vec_func=False)
return result
Romberg integration of a callable function or method. Returns the integral of `function` (a function of one variable) over the interval (`a`, `b`). If `show` is 1, the triangular array of the intermediate results will be printed. If `vec_func` is True (default is False), then `function` is assume...
Romberg integration of a callable function or method.
[ "Romberg", "integration", "of", "a", "callable", "function", "or", "method", "." ]
def romberg(function, a, b, args=(), tol=1.48e-8, rtol=1.48e-8, show=False, divmax=10, vec_func=False): """ Romberg integration of a callable function or method. Returns the integral of `function` (a function of one variable) over the interval (`a`, `b`). If `show` is 1, the triangular...
[ "def", "romberg", "(", "function", ",", "a", ",", "b", ",", "args", "=", "(", ")", ",", "tol", "=", "1.48e-8", ",", "rtol", "=", "1.48e-8", ",", "show", "=", "False", ",", "divmax", "=", "10", ",", "vec_func", "=", "False", ")", ":", "if", "np"...
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/scipy/integrate/quadrature.py#L593-L710
MontrealCorpusTools/Montreal-Forced-Aligner
63473f9a4fabd31eec14e1e5022882f85cfdaf31
montreal_forced_aligner/helper.py
python
TerminalPrinter.indent_string
(self)
return " " * self.indent_size * self.indent_level
Indent string to use in formatting the output messages
Indent string to use in formatting the output messages
[ "Indent", "string", "to", "use", "in", "formatting", "the", "output", "messages" ]
def indent_string(self) -> str: """Indent string to use in formatting the output messages""" return " " * self.indent_size * self.indent_level
[ "def", "indent_string", "(", "self", ")", "->", "str", ":", "return", "\" \"", "*", "self", ".", "indent_size", "*", "self", ".", "indent_level" ]
https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/63473f9a4fabd31eec14e1e5022882f85cfdaf31/montreal_forced_aligner/helper.py#L183-L185
galaxyproject/galaxy
4c03520f05062e0f4a1b3655dc0b7452fda69943
lib/galaxy/webapps/galaxy/api/pages.py
python
PagesController.share_with_users
(self, trans, id, payload, **kwd)
return self.service.shareable_service.share_with_users(trans, id, payload)
* PUT /api/pages/{id}/share_with_users
* PUT /api/pages/{id}/share_with_users
[ "*", "PUT", "/", "api", "/", "pages", "/", "{", "id", "}", "/", "share_with_users" ]
def share_with_users(self, trans, id, payload, **kwd): """ * PUT /api/pages/{id}/share_with_users """ payload = ShareWithPayload(**payload) return self.service.shareable_service.share_with_users(trans, id, payload)
[ "def", "share_with_users", "(", "self", ",", "trans", ",", "id", ",", "payload", ",", "*", "*", "kwd", ")", ":", "payload", "=", "ShareWithPayload", "(", "*", "*", "payload", ")", "return", "self", ".", "service", ".", "shareable_service", ".", "share_wi...
https://github.com/galaxyproject/galaxy/blob/4c03520f05062e0f4a1b3655dc0b7452fda69943/lib/galaxy/webapps/galaxy/api/pages.py#L349-L354
selfteaching/selfteaching-python-camp
9982ee964b984595e7d664b07c389cddaf158f1e
19100205/Ceasar1978/pip-19.0.3/src/pip/_internal/pep425tags.py
python
get_darwin_arches
(major, minor, machine)
return arches
Return a list of supported arches (including group arches) for the given major, minor and machine architecture of an macOS machine.
Return a list of supported arches (including group arches) for the given major, minor and machine architecture of an macOS machine.
[ "Return", "a", "list", "of", "supported", "arches", "(", "including", "group", "arches", ")", "for", "the", "given", "major", "minor", "and", "machine", "architecture", "of", "an", "macOS", "machine", "." ]
def get_darwin_arches(major, minor, machine): # type: (int, int, str) -> List[str] """Return a list of supported arches (including group arches) for the given major, minor and machine architecture of an macOS machine. """ arches = [] def _supports_arch(major, minor, arch): # type: (int,...
[ "def", "get_darwin_arches", "(", "major", ",", "minor", ",", "machine", ")", ":", "# type: (int, int, str) -> List[str]", "arches", "=", "[", "]", "def", "_supports_arch", "(", "major", ",", "minor", ",", "arch", ")", ":", "# type: (int, int, str) -> bool", "# Loo...
https://github.com/selfteaching/selfteaching-python-camp/blob/9982ee964b984595e7d664b07c389cddaf158f1e/19100205/Ceasar1978/pip-19.0.3/src/pip/_internal/pep425tags.py#L199-L259
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/xbox/media_player.py
python
XboxMediaPlayer.media_image_remotely_accessible
(self)
return True
If the image url is remotely accessible.
If the image url is remotely accessible.
[ "If", "the", "image", "url", "is", "remotely", "accessible", "." ]
def media_image_remotely_accessible(self) -> bool: """If the image url is remotely accessible.""" return True
[ "def", "media_image_remotely_accessible", "(", "self", ")", "->", "bool", ":", "return", "True" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/xbox/media_player.py#L159-L161
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_version.py
python
Yedit.delete
(self, path, index=None, value=None)
return (True, self.yaml_dict)
remove path from a dict
remove path from a dict
[ "remove", "path", "from", "a", "dict" ]
def delete(self, path, index=None, value=None): ''' remove path from a dict''' try: entry = Yedit.get_entry(self.yaml_dict, path, self.separator) except KeyError: entry = None if entry is None: return (False, self.yaml_dict) result = Yedit.re...
[ "def", "delete", "(", "self", ",", "path", ",", "index", "=", "None", ",", "value", "=", "None", ")", ":", "try", ":", "entry", "=", "Yedit", ".", "get_entry", "(", "self", ".", "yaml_dict", ",", "path", ",", "self", ".", "separator", ")", "except"...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_version.py#L443-L457
JacquesLucke/animation_nodes
b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1
animation_nodes/sockets/sequence.py
python
SequenceSocket.assignActiveSequence
(self)
[]
def assignActiveSequence(self): sequenceEditor = self.nodeTree.scene.sequence_editor if not sequenceEditor: return sequence = sequenceEditor.active_strip if sequence: self.sequenceName = sequence.name
[ "def", "assignActiveSequence", "(", "self", ")", ":", "sequenceEditor", "=", "self", ".", "nodeTree", ".", "scene", ".", "sequence_editor", "if", "not", "sequenceEditor", ":", "return", "sequence", "=", "sequenceEditor", ".", "active_strip", "if", "sequence", ":...
https://github.com/JacquesLucke/animation_nodes/blob/b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1/animation_nodes/sockets/sequence.py#L39-L45
Mergifyio/mergify-engine
3a7a0a63927740d67fb58430182cf75a0511ddd3
mergify_engine/duplicate_pull.py
python
duplicate
( ctxt: context.Context, branch_name: github_types.GitHubRefType, *, title_template: str, body_template: str, bot_account: typing.Optional[github_types.GitHubLogin] = None, labels: typing.Optional[List[str]] = None, label_conflicts: typing.Optional[str] = None, ignore_conflicts: bool...
return duplicate_pr
Duplicate a pull request. :param pull: The pull request. :type pull: py:class:mergify_engine.context.Context :param title_template: The pull request title template. :param body_template: The pull request body template. :param branch: The branch to copy to. :param labels: The list of labels to a...
Duplicate a pull request.
[ "Duplicate", "a", "pull", "request", "." ]
async def duplicate( ctxt: context.Context, branch_name: github_types.GitHubRefType, *, title_template: str, body_template: str, bot_account: typing.Optional[github_types.GitHubLogin] = None, labels: typing.Optional[List[str]] = None, label_conflicts: typing.Optional[str] = None, ign...
[ "async", "def", "duplicate", "(", "ctxt", ":", "context", ".", "Context", ",", "branch_name", ":", "github_types", ".", "GitHubRefType", ",", "*", ",", "title_template", ":", "str", ",", "body_template", ":", "str", ",", "bot_account", ":", "typing", ".", ...
https://github.com/Mergifyio/mergify-engine/blob/3a7a0a63927740d67fb58430182cf75a0511ddd3/mergify_engine/duplicate_pull.py#L216-L440
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/idlelib/configdialog.py
python
ConfigDialog.deactivate_current_config
(self)
Remove current key bindings. Iterate over window instances defined in parent and remove the keybindings.
Remove current key bindings. Iterate over window instances defined in parent and remove the keybindings.
[ "Remove", "current", "key", "bindings", ".", "Iterate", "over", "window", "instances", "defined", "in", "parent", "and", "remove", "the", "keybindings", "." ]
def deactivate_current_config(self): """Remove current key bindings. Iterate over window instances defined in parent and remove the keybindings. """ # Before a config is saved, some cleanup of current # config must be done - remove the previous keybindings. win_in...
[ "def", "deactivate_current_config", "(", "self", ")", ":", "# Before a config is saved, some cleanup of current", "# config must be done - remove the previous keybindings.", "win_instances", "=", "self", ".", "parent", ".", "instance_dict", ".", "keys", "(", ")", "for", "inst...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/idlelib/configdialog.py#L217-L226
SoCo/SoCo
e83fef84d2645d05265dbd574598518655a9c125
soco/core.py
python
SoCo.switch_to_line_in
(self, source=None)
Switch the speaker's input to line-in. Args: source (SoCo): The speaker whose line-in should be played. Default is line-in from the speaker itself.
Switch the speaker's input to line-in.
[ "Switch", "the", "speaker", "s", "input", "to", "line", "-", "in", "." ]
def switch_to_line_in(self, source=None): """Switch the speaker's input to line-in. Args: source (SoCo): The speaker whose line-in should be played. Default is line-in from the speaker itself. """ if source: uid = source.uid else: ...
[ "def", "switch_to_line_in", "(", "self", ",", "source", "=", "None", ")", ":", "if", "source", ":", "uid", "=", "source", ".", "uid", "else", ":", "uid", "=", "self", ".", "uid", "self", ".", "avTransport", ".", "SetAVTransportURI", "(", "[", "(", "\...
https://github.com/SoCo/SoCo/blob/e83fef84d2645d05265dbd574598518655a9c125/soco/core.py#L1650-L1668
Tuhinshubhra/CMSeeK
d22deab1e22cebd458af9d69e57f6e276ec11e84
deepscans/wp/init.py
python
start
(id, url, ua, ga, source, detection_method)
return
id = ID of the cms url = URL of target ua = User Agent ga = [0/1] is GENERATOR meta tag available source = source code
id = ID of the cms url = URL of target ua = User Agent ga = [0/1] is GENERATOR meta tag available source = source code
[ "id", "=", "ID", "of", "the", "cms", "url", "=", "URL", "of", "target", "ua", "=", "User", "Agent", "ga", "=", "[", "0", "/", "1", "]", "is", "GENERATOR", "meta", "tag", "available", "source", "=", "source", "code" ]
def start(id, url, ua, ga, source, detection_method): ''' id = ID of the cms url = URL of target ua = User Agent ga = [0/1] is GENERATOR meta tag available source = source code ''' ## Do shits later [update from later: i forgot what shit i had to do ;___;] if id == "wp": # r...
[ "def", "start", "(", "id", ",", "url", ",", "ua", ",", "ga", ",", "source", ",", "detection_method", ")", ":", "## Do shits later [update from later: i forgot what shit i had to do ;___;]", "if", "id", "==", "\"wp\"", ":", "# referenced before assignment fix", "vulnss",...
https://github.com/Tuhinshubhra/CMSeeK/blob/d22deab1e22cebd458af9d69e57f6e276ec11e84/deepscans/wp/init.py#L21-L340
hypothesis/h
25ef1b8d94889df86ace5a084f1aa0effd9f4e25
h/streamer/websocket.py
python
handle_message
(message, session=None)
Handle an incoming message from a client websocket. Receives a :py:class:`~h.streamer.websocket.Message` instance, which holds references to the :py:class:`~h.streamer.websocket.WebSocket` instance associated with the client connection, as well as the message payload. It updates state on the :py:class...
Handle an incoming message from a client websocket.
[ "Handle", "an", "incoming", "message", "from", "a", "client", "websocket", "." ]
def handle_message(message, session=None): """ Handle an incoming message from a client websocket. Receives a :py:class:`~h.streamer.websocket.Message` instance, which holds references to the :py:class:`~h.streamer.websocket.WebSocket` instance associated with the client connection, as well as the ...
[ "def", "handle_message", "(", "message", ",", "session", "=", "None", ")", ":", "payload", "=", "message", ".", "payload", "type_", "=", "payload", ".", "get", "(", "\"type\"", ")", "# FIXME: This code is here to tolerate old and deprecated message formats.", "if", ...
https://github.com/hypothesis/h/blob/25ef1b8d94889df86ace5a084f1aa0effd9f4e25/h/streamer/websocket.py#L92-L119
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/27/Lib/optparse.py
python
_match_abbrev
(s, wordmap)
_match_abbrev(s : string, wordmap : {string : Option}) -> string Return the string key in 'wordmap' for which 's' is an unambiguous abbreviation. If 's' is found to be ambiguous or doesn't match any of 'words', raise BadOptionError.
_match_abbrev(s : string, wordmap : {string : Option}) -> string
[ "_match_abbrev", "(", "s", ":", "string", "wordmap", ":", "{", "string", ":", "Option", "}", ")", "-", ">", "string" ]
def _match_abbrev(s, wordmap): """_match_abbrev(s : string, wordmap : {string : Option}) -> string Return the string key in 'wordmap' for which 's' is an unambiguous abbreviation. If 's' is found to be ambiguous or doesn't match any of 'words', raise BadOptionError. """ # Is there an exact mat...
[ "def", "_match_abbrev", "(", "s", ",", "wordmap", ")", ":", "# Is there an exact match?", "if", "s", "in", "wordmap", ":", "return", "s", "else", ":", "# Isolate all words with s as a prefix.", "possibilities", "=", "[", "word", "for", "word", "in", "wordmap", "...
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/optparse.py#L1675-L1697
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/Centos_5.9/paramiko/transport.py
python
Transport.add_server_key
(self, key)
Add a host key to the list of keys used for server mode. When behaving as a server, the host key is used to sign certain packets during the SSH2 negotiation, so that the client can trust that we are who we say we are. Because this is used for signing, the key must contain private key i...
Add a host key to the list of keys used for server mode. When behaving as a server, the host key is used to sign certain packets during the SSH2 negotiation, so that the client can trust that we are who we say we are. Because this is used for signing, the key must contain private key i...
[ "Add", "a", "host", "key", "to", "the", "list", "of", "keys", "used", "for", "server", "mode", ".", "When", "behaving", "as", "a", "server", "the", "host", "key", "is", "used", "to", "sign", "certain", "packets", "during", "the", "SSH2", "negotiation", ...
def add_server_key(self, key): """ Add a host key to the list of keys used for server mode. When behaving as a server, the host key is used to sign certain packets during the SSH2 negotiation, so that the client can trust that we are who we say we are. Because this is used for ...
[ "def", "add_server_key", "(", "self", ",", "key", ")", ":", "self", ".", "server_key_dict", "[", "key", ".", "get_name", "(", ")", "]", "=", "key" ]
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_5.9/paramiko/transport.py#L535-L548
NordicSemiconductor/pc-nrfutil
d08e742128f2a3dac522601bc6b9f9b2b63952df
nordicsemi/lister/windows/structures.py
python
GUID.__str__
(self)
return str(self._guid)
[]
def __str__(self): return str(self._guid)
[ "def", "__str__", "(", "self", ")", ":", "return", "str", "(", "self", ".", "_guid", ")" ]
https://github.com/NordicSemiconductor/pc-nrfutil/blob/d08e742128f2a3dac522601bc6b9f9b2b63952df/nordicsemi/lister/windows/structures.py#L72-L73
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/jinja2/loaders.py
python
DictLoader.get_source
(self, environment, template)
[]
def get_source(self, environment, template): if template in self.mapping: source = self.mapping[template] return source, None, lambda: source == self.mapping.get(template) raise TemplateNotFound(template)
[ "def", "get_source", "(", "self", ",", "environment", ",", "template", ")", ":", "if", "template", "in", "self", ".", "mapping", ":", "source", "=", "self", ".", "mapping", "[", "template", "]", "return", "source", ",", "None", ",", "lambda", ":", "sou...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/jinja2/loaders.py#L282-L286
jesseweisberg/moveo_ros
b9282bdadbf2505a26d3b94b91e60a98d86efa34
object_detector_app/object_detection/core/target_assigner.py
python
TargetAssigner._create_regression_targets
(self, anchors, groundtruth_boxes, match)
return reg_targets
Returns a regression target for each anchor. Args: anchors: a BoxList representing N anchors groundtruth_boxes: a BoxList representing M groundtruth_boxes match: a matcher.Match object Returns: reg_targets: a float32 tensor with shape [N, box_code_dimension]
Returns a regression target for each anchor.
[ "Returns", "a", "regression", "target", "for", "each", "anchor", "." ]
def _create_regression_targets(self, anchors, groundtruth_boxes, match): """Returns a regression target for each anchor. Args: anchors: a BoxList representing N anchors groundtruth_boxes: a BoxList representing M groundtruth_boxes match: a matcher.Match object Returns: reg_targets:...
[ "def", "_create_regression_targets", "(", "self", ",", "anchors", ",", "groundtruth_boxes", ",", "match", ")", ":", "matched_anchor_indices", "=", "match", ".", "matched_column_indices", "(", ")", "unmatched_ignored_anchor_indices", "=", "(", "match", ".", "unmatched_...
https://github.com/jesseweisberg/moveo_ros/blob/b9282bdadbf2505a26d3b94b91e60a98d86efa34/object_detector_app/object_detection/core/target_assigner.py#L184-L212
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/library/openshift_container_binary_sync.py
python
BinarySyncer.raw_image
(self)
return self._image
Returns the image as it was originally passed in to the instance. .. note:: This image string will only work directly with the atomic command. :returns: The original image passed in. :rtype: str
Returns the image as it was originally passed in to the instance.
[ "Returns", "the", "image", "as", "it", "was", "originally", "passed", "in", "to", "the", "instance", "." ]
def raw_image(self): """ Returns the image as it was originally passed in to the instance. .. note:: This image string will only work directly with the atomic command. :returns: The original image passed in. :rtype: str """ return self._image
[ "def", "raw_image", "(", "self", ")", ":", "return", "self", ".", "_image" ]
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/library/openshift_container_binary_sync.py#L148-L158
lixinsu/RCZoo
37fcb7962fbd4c751c561d4a0c84173881ea8339
reader/multi_fusionnet/vector.py
python
batchify
(batch)
return x1, x1_p, x1_e, x1_c, x1_mask, x2, x2_p, x2_e, x2_c, x2_mask, x1_f ,yy_s, yy_e, ids
Gather a batch of individual examples into one batch.
Gather a batch of individual examples into one batch.
[ "Gather", "a", "batch", "of", "individual", "examples", "into", "one", "batch", "." ]
def batchify(batch): """Gather a batch of individual examples into one batch.""" ids = [ex[-1] for ex in batch] docs = [ex[2] for ex in batch] dc = [ex[3] for ex in batch] dp = [ex[4] for ex in batch] de = [ex[5] for ex in batch] df = [ex[10] for ex in batch] word_len = dc[0].size(1) ...
[ "def", "batchify", "(", "batch", ")", ":", "ids", "=", "[", "ex", "[", "-", "1", "]", "for", "ex", "in", "batch", "]", "docs", "=", "[", "ex", "[", "2", "]", "for", "ex", "in", "batch", "]", "dc", "=", "[", "ex", "[", "3", "]", "for", "ex...
https://github.com/lixinsu/RCZoo/blob/37fcb7962fbd4c751c561d4a0c84173881ea8339/reader/multi_fusionnet/vector.py#L92-L156
man-group/mdf
4b2c78084467791ad883c0b4c53832ad70fc96ef
mdf/viewer/frame.py
python
MDFViewerFrame.GetRootContext
(self)
return ctx
returns the root context for use from PyCrust as 'get_ctx()'
returns the root context for use from PyCrust as 'get_ctx()'
[ "returns", "the", "root", "context", "for", "use", "from", "PyCrust", "as", "get_ctx", "()" ]
def GetRootContext(self): """ returns the root context for use from PyCrust as 'get_ctx()' """ tree = self._dag_tree data = tree.GetPyData(tree.GetRootItem()) if not data: return ctx, node = data return ctx
[ "def", "GetRootContext", "(", "self", ")", ":", "tree", "=", "self", ".", "_dag_tree", "data", "=", "tree", ".", "GetPyData", "(", "tree", ".", "GetRootItem", "(", ")", ")", "if", "not", "data", ":", "return", "ctx", ",", "node", "=", "data", "return...
https://github.com/man-group/mdf/blob/4b2c78084467791ad883c0b4c53832ad70fc96ef/mdf/viewer/frame.py#L640-L650
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/pkg_resources/__init__.py
python
Distribution.has_version
(self)
return True
[]
def has_version(self): try: self.version except ValueError: issue_warning("Unbuilt egg for " + repr(self)) return False return True
[ "def", "has_version", "(", "self", ")", ":", "try", ":", "self", ".", "version", "except", "ValueError", ":", "issue_warning", "(", "\"Unbuilt egg for \"", "+", "repr", "(", "self", ")", ")", "return", "False", "return", "True" ]
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/pkg_resources/__init__.py#L2739-L2745
SigmaHQ/sigma
6f7d28b52a6468b2430e8d7dfefb79dc01e2f1af
tools/sigma/backends/mdatp.py
python
WindowsDefenderATPBackend.generateANDNode
(self, node)
[]
def generateANDNode(self, node): generated = [ self.generateNode(val) for val in node ] filtered = [] for g in generated: if g and g.startswith("ActionType"): if not any([i for i in filtered if i.startswith("ActionType")]): filtered.append(g) ...
[ "def", "generateANDNode", "(", "self", ",", "node", ")", ":", "generated", "=", "[", "self", ".", "generateNode", "(", "val", ")", "for", "val", "in", "node", "]", "filtered", "=", "[", "]", "for", "g", "in", "generated", ":", "if", "g", "and", "g"...
https://github.com/SigmaHQ/sigma/blob/6f7d28b52a6468b2430e8d7dfefb79dc01e2f1af/tools/sigma/backends/mdatp.py#L173-L189
SpaceNetChallenge/SpaceNet_Off_Nadir_Solutions
014c4ca27a70b5907a183e942228004c989dcbe4
cannab/train50_9ch_fold.py
python
ValData.__init__
(self, image_ids)
[]
def __init__(self, image_ids): super().__init__() self.image_ids = image_ids
[ "def", "__init__", "(", "self", ",", "image_ids", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "image_ids", "=", "image_ids" ]
https://github.com/SpaceNetChallenge/SpaceNet_Off_Nadir_Solutions/blob/014c4ca27a70b5907a183e942228004c989dcbe4/cannab/train50_9ch_fold.py#L210-L212
JetBrains/python-skeletons
95ad24b666e475998e5d1cc02ed53a2188036167
py/path/__init__.py
python
LocalPath.setmtime
(self, mtime=None)
set modification time for the given path. if 'mtime' is None (the default) then the file's mtime is set to current time. Note that the resolution for 'mtime' is platform dependent.
set modification time for the given path. if 'mtime' is None (the default) then the file's mtime is set to current time.
[ "set", "modification", "time", "for", "the", "given", "path", ".", "if", "mtime", "is", "None", "(", "the", "default", ")", "then", "the", "file", "s", "mtime", "is", "set", "to", "current", "time", "." ]
def setmtime(self, mtime=None): """ set modification time for the given path. if 'mtime' is None (the default) then the file's mtime is set to current time. Note that the resolution for 'mtime' is platform dependent. """
[ "def", "setmtime", "(", "self", ",", "mtime", "=", "None", ")", ":" ]
https://github.com/JetBrains/python-skeletons/blob/95ad24b666e475998e5d1cc02ed53a2188036167/py/path/__init__.py#L280-L285
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/yeelightsunflower/light.py
python
SunflowerBulb.name
(self)
return f"sunflower_{self._light.zid}"
Return the display name of this light.
Return the display name of this light.
[ "Return", "the", "display", "name", "of", "this", "light", "." ]
def name(self): """Return the display name of this light.""" return f"sunflower_{self._light.zid}"
[ "def", "name", "(", "self", ")", ":", "return", "f\"sunflower_{self._light.zid}\"" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/yeelightsunflower/light.py#L61-L63
googlecolab/colabtools
b7b3566363e2f0bad9ad256ae317314ba5bd42f8
google/colab/_tensorflow_magics.py
python
_TFVersionManager._set_version
(self, version)
Perform version change by manipulating PATH/PYTHONPATH.
Perform version change by manipulating PATH/PYTHONPATH.
[ "Perform", "version", "change", "by", "manipulating", "PATH", "/", "PYTHONPATH", "." ]
def _set_version(self, version): """Perform version change by manipulating PATH/PYTHONPATH.""" old_python_path = _get_python_path(self._version) new_python_path = _get_python_path(version) old_os_path = _get_os_path(self._version) new_os_path = _get_os_path(version) # Fix up `sys.path`, for Py...
[ "def", "_set_version", "(", "self", ",", "version", ")", ":", "old_python_path", "=", "_get_python_path", "(", "self", ".", "_version", ")", "new_python_path", "=", "_get_python_path", "(", "version", ")", "old_os_path", "=", "_get_os_path", "(", "self", ".", ...
https://github.com/googlecolab/colabtools/blob/b7b3566363e2f0bad9ad256ae317314ba5bd42f8/google/colab/_tensorflow_magics.py#L153-L177
xonsh/xonsh
b76d6f994f22a4078f602f8b386f4ec280c8461f
xonsh/tools.py
python
is_completion_mode
(x)
return x in CANONIC_COMPLETION_MODES
Enumerated values of $COMPLETION_MODE
Enumerated values of $COMPLETION_MODE
[ "Enumerated", "values", "of", "$COMPLETION_MODE" ]
def is_completion_mode(x): """Enumerated values of $COMPLETION_MODE""" return x in CANONIC_COMPLETION_MODES
[ "def", "is_completion_mode", "(", "x", ")", ":", "return", "x", "in", "CANONIC_COMPLETION_MODES" ]
https://github.com/xonsh/xonsh/blob/b76d6f994f22a4078f602f8b386f4ec280c8461f/xonsh/tools.py#L1655-L1657
lifting-bits/mcsema
b7492e2ffb9f2fa64b5ef269753ba1d134bdf2f2
tools/mcsema_disass/ida7/table.py
python
get_ida_jump_table_reader
(builder, si)
return True
Try to trust IDA's ability to recognize a jump table and its entries, and return an appropriate jump table entry reader.
Try to trust IDA's ability to recognize a jump table and its entries, and return an appropriate jump table entry reader.
[ "Try", "to", "trust", "IDA", "s", "ability", "to", "recognize", "a", "jump", "table", "and", "its", "entries", "and", "return", "an", "appropriate", "jump", "table", "entry", "reader", "." ]
def get_ida_jump_table_reader(builder, si): """Try to trust IDA's ability to recognize a jump table and its entries, and return an appropriate jump table entry reader.""" builder.table_ea = si.jumps DEBUG("IDA inferred jump table base: {:x}".format(builder.table_ea)) builder.entry_size = si.get_jtable_eleme...
[ "def", "get_ida_jump_table_reader", "(", "builder", ",", "si", ")", ":", "builder", ".", "table_ea", "=", "si", ".", "jumps", "DEBUG", "(", "\"IDA inferred jump table base: {:x}\"", ".", "format", "(", "builder", ".", "table_ea", ")", ")", "builder", ".", "ent...
https://github.com/lifting-bits/mcsema/blob/b7492e2ffb9f2fa64b5ef269753ba1d134bdf2f2/tools/mcsema_disass/ida7/table.py#L327-L380
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/pyparsing.py
python
ParseResults.values
( self )
return [ v[-1][0] for v in self.__tokdict.values() ]
Returns all named result values.
Returns all named result values.
[ "Returns", "all", "named", "result", "values", "." ]
def values( self ): """Returns all named result values.""" return [ v[-1][0] for v in self.__tokdict.values() ]
[ "def", "values", "(", "self", ")", ":", "return", "[", "v", "[", "-", "1", "]", "[", "0", "]", "for", "v", "in", "self", ".", "__tokdict", ".", "values", "(", ")", "]" ]
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/pyparsing.py#L400-L402
CoinAlpha/hummingbot
36f6149c1644c07cd36795b915f38b8f49b798e7
hummingbot/script/script_base.py
python
ScriptBase.round_by_step
(a_number: Decimal, step_size: Decimal)
return (a_number // step_size) * step_size
Rounds the number down by the step size, e.g. round_by_step(1.8, 0.25) = 1.75 :param a_number: A number to round :param step_size: The step size. :returns rounded number.
Rounds the number down by the step size, e.g. round_by_step(1.8, 0.25) = 1.75 :param a_number: A number to round :param step_size: The step size. :returns rounded number.
[ "Rounds", "the", "number", "down", "by", "the", "step", "size", "e", ".", "g", ".", "round_by_step", "(", "1", ".", "8", "0", ".", "25", ")", "=", "1", ".", "75", ":", "param", "a_number", ":", "A", "number", "to", "round", ":", "param", "step_si...
def round_by_step(a_number: Decimal, step_size: Decimal): """ Rounds the number down by the step size, e.g. round_by_step(1.8, 0.25) = 1.75 :param a_number: A number to round :param step_size: The step size. :returns rounded number. """ return (a_number // step_si...
[ "def", "round_by_step", "(", "a_number", ":", "Decimal", ",", "step_size", ":", "Decimal", ")", ":", "return", "(", "a_number", "//", "step_size", ")", "*", "step_size" ]
https://github.com/CoinAlpha/hummingbot/blob/36f6149c1644c07cd36795b915f38b8f49b798e7/hummingbot/script/script_base.py#L172-L179
aiidateam/aiida-core
c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2
aiida/engine/processes/futures.py
python
ProcessFuture.__init__
( self, pk: int, loop: Optional[asyncio.AbstractEventLoop] = None, poll_interval: Union[None, int, float] = None, communicator: Optional[kiwipy.Communicator] = None )
Construct a future for a process node being finished. If a None poll_interval is supplied polling will not be used. If a communicator is supplied it will be used to listen for broadcast messages. :param pk: process pk :param loop: An event loop :param poll_interval: optional po...
Construct a future for a process node being finished.
[ "Construct", "a", "future", "for", "a", "process", "node", "being", "finished", "." ]
def __init__( self, pk: int, loop: Optional[asyncio.AbstractEventLoop] = None, poll_interval: Union[None, int, float] = None, communicator: Optional[kiwipy.Communicator] = None ): """Construct a future for a process node being finished. If a None poll_interva...
[ "def", "__init__", "(", "self", ",", "pk", ":", "int", ",", "loop", ":", "Optional", "[", "asyncio", ".", "AbstractEventLoop", "]", "=", "None", ",", "poll_interval", ":", "Union", "[", "None", ",", "int", ",", "float", "]", "=", "None", ",", "commun...
https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/engine/processes/futures.py#L27-L74
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/lighthouse/v20200324/models.py
python
InquirePriceCreateBlueprintResponse.__init__
(self)
r""" :param BlueprintPrice: 自定义镜像的价格参数。 :type BlueprintPrice: :class:`tencentcloud.lighthouse.v20200324.models.BlueprintPrice` :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
r""" :param BlueprintPrice: 自定义镜像的价格参数。 :type BlueprintPrice: :class:`tencentcloud.lighthouse.v20200324.models.BlueprintPrice` :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
[ "r", ":", "param", "BlueprintPrice", ":", "自定义镜像的价格参数。", ":", "type", "BlueprintPrice", ":", ":", "class", ":", "tencentcloud", ".", "lighthouse", ".", "v20200324", ".", "models", ".", "BlueprintPrice", ":", "param", "RequestId", ":", "唯一请求", "ID,每次请求都会返回。定位问题时需...
def __init__(self): r""" :param BlueprintPrice: 自定义镜像的价格参数。 :type BlueprintPrice: :class:`tencentcloud.lighthouse.v20200324.models.BlueprintPrice` :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str """ self.BlueprintPrice = None ...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "BlueprintPrice", "=", "None", "self", ".", "RequestId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/lighthouse/v20200324/models.py#L3322-L3330
lisa-lab/pylearn2
af81e5c362f0df4df85c3e54e23b2adeec026055
pylearn2/models/vae/__init__.py
python
VAE.sample
(self, num_samples, return_sample_means=True, **kwargs)
Sample from the model's learned distribution Parameters ---------- num_samples : int Number of samples return_sample_means : bool, optional Whether to return the conditional expectations :math:`\\mathbb{E}[p_\\theta(\\mathbf{x} \\mid \\mathbf{h})]` in...
Sample from the model's learned distribution
[ "Sample", "from", "the", "model", "s", "learned", "distribution" ]
def sample(self, num_samples, return_sample_means=True, **kwargs): """ Sample from the model's learned distribution Parameters ---------- num_samples : int Number of samples return_sample_means : bool, optional Whether to return the conditional ex...
[ "def", "sample", "(", "self", ",", "num_samples", ",", "return_sample_means", "=", "True", ",", "*", "*", "kwargs", ")", ":", "# Sample from p(z)", "z", "=", "self", ".", "sample_from_p_z", "(", "num_samples", "=", "num_samples", ",", "*", "*", "kwargs", "...
https://github.com/lisa-lab/pylearn2/blob/af81e5c362f0df4df85c3e54e23b2adeec026055/pylearn2/models/vae/__init__.py#L205-L233
bendmorris/static-python
2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473
Lib/logging/__init__.py
python
Manager.__init__
(self, rootnode)
Initialize the manager with the root node of the logger hierarchy.
Initialize the manager with the root node of the logger hierarchy.
[ "Initialize", "the", "manager", "with", "the", "root", "node", "of", "the", "logger", "hierarchy", "." ]
def __init__(self, rootnode): """ Initialize the manager with the root node of the logger hierarchy. """ self.root = rootnode self.disable = 0 self.emittedNoHandlerWarning = False self.loggerDict = {} self.loggerClass = None self.logRecordFactory =...
[ "def", "__init__", "(", "self", ",", "rootnode", ")", ":", "self", ".", "root", "=", "rootnode", "self", ".", "disable", "=", "0", "self", ".", "emittedNoHandlerWarning", "=", "False", "self", ".", "loggerDict", "=", "{", "}", "self", ".", "loggerClass",...
https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/logging/__init__.py#L1089-L1098
Thinklab-SJTU/R3Det_Tensorflow
3e092fa65dee2b9f7722b0985b3791811a1de5ae
libs/networks/slim_nets/inception_utils.py
python
inception_arg_scope
(weight_decay=0.00004, use_batch_norm=True, batch_norm_decay=0.9997, batch_norm_epsilon=0.001)
Defines the default arg scope for inception models. Args: weight_decay: The weight decay to use for regularizing the model. use_batch_norm: "If `True`, batch_norm is applied after each convolution. batch_norm_decay: Decay for batch norm moving average. batch_norm_epsilon: Small float added to varianc...
Defines the default arg scope for inception models.
[ "Defines", "the", "default", "arg", "scope", "for", "inception", "models", "." ]
def inception_arg_scope(weight_decay=0.00004, use_batch_norm=True, batch_norm_decay=0.9997, batch_norm_epsilon=0.001): """Defines the default arg scope for inception models. Args: weight_decay: The weight decay to use for regularizing the ...
[ "def", "inception_arg_scope", "(", "weight_decay", "=", "0.00004", ",", "use_batch_norm", "=", "True", ",", "batch_norm_decay", "=", "0.9997", ",", "batch_norm_epsilon", "=", "0.001", ")", ":", "batch_norm_params", "=", "{", "# Decay for the moving averages.", "'decay...
https://github.com/Thinklab-SJTU/R3Det_Tensorflow/blob/3e092fa65dee2b9f7722b0985b3791811a1de5ae/libs/networks/slim_nets/inception_utils.py#L32-L71
Qirky/Troop
529c5eb14e456f683e6d23fd4adcddc8446aa115
src/interface/interface.py
python
Interface.move_marker_home
(self)
return
Moves the cursor to the beginning of a line
Moves the cursor to the beginning of a line
[ "Moves", "the", "cursor", "to", "the", "beginning", "of", "a", "line" ]
def move_marker_home(self): """ Moves the cursor to the beginning of a line """ tcl_index = self.text.number_index_to_tcl(self.text.marker.get_index_num()) x, y, w, h = self.text.bbox(tcl_index) index = self.text.tcl_index_to_number( self.text.index("@{},{}".format(1, y)) ) self....
[ "def", "move_marker_home", "(", "self", ")", ":", "tcl_index", "=", "self", ".", "text", ".", "number_index_to_tcl", "(", "self", ".", "text", ".", "marker", ".", "get_index_num", "(", ")", ")", "x", ",", "y", ",", "w", ",", "h", "=", "self", ".", ...
https://github.com/Qirky/Troop/blob/529c5eb14e456f683e6d23fd4adcddc8446aa115/src/interface/interface.py#L956-L962
Source-Python-Dev-Team/Source.Python
d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
addons/source-python/Python3/imaplib.py
python
IMAP4.login_cram_md5
(self, user, password)
return self.authenticate('CRAM-MD5', self._CRAM_MD5_AUTH)
Force use of CRAM-MD5 authentication. (typ, [data]) = <instance>.login_cram_md5(user, password)
Force use of CRAM-MD5 authentication.
[ "Force", "use", "of", "CRAM", "-", "MD5", "authentication", "." ]
def login_cram_md5(self, user, password): """ Force use of CRAM-MD5 authentication. (typ, [data]) = <instance>.login_cram_md5(user, password) """ self.user, self.password = user, password return self.authenticate('CRAM-MD5', self._CRAM_MD5_AUTH)
[ "def", "login_cram_md5", "(", "self", ",", "user", ",", "password", ")", ":", "self", ".", "user", ",", "self", ".", "password", "=", "user", ",", "password", "return", "self", ".", "authenticate", "(", "'CRAM-MD5'", ",", "self", ".", "_CRAM_MD5_AUTH", "...
https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/imaplib.py#L595-L601
areed1192/td-ameritrade-python-api
3378ca89f464df80a5b651f3e365f2f7d9c758d7
td/utils.py
python
StatePath.json_settings_path
(self)
return self.settings_directory.joinpath(self.credenitals_file_name)
Generates a path to the `.td_python_library/td_state.json` file. Returns: ---- {pathlib.PurePath} -- A PurePath object pointing to the `.td_python_library/td_state.json` file.
Generates a path to the `.td_python_library/td_state.json` file.
[ "Generates", "a", "path", "to", "the", ".", "td_python_library", "/", "td_state", ".", "json", "file", "." ]
def json_settings_path(self): """Generates a path to the `.td_python_library/td_state.json` file. Returns: ---- {pathlib.PurePath} -- A PurePath object pointing to the `.td_python_library/td_state.json` file. """ return self.settings_directory.joinpath(self....
[ "def", "json_settings_path", "(", "self", ")", ":", "return", "self", ".", "settings_directory", ".", "joinpath", "(", "self", ".", "credenitals_file_name", ")" ]
https://github.com/areed1192/td-ameritrade-python-api/blob/3378ca89f464df80a5b651f3e365f2f7d9c758d7/td/utils.py#L105-L113
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Tools/gdb/libpython.py
python
PyObjectPtr.get_gdb_type
(cls)
return gdb.lookup_type(cls._typename).pointer()
[]
def get_gdb_type(cls): return gdb.lookup_type(cls._typename).pointer()
[ "def", "get_gdb_type", "(", "cls", ")", ":", "return", "gdb", ".", "lookup_type", "(", "cls", ".", "_typename", ")", ".", "pointer", "(", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Tools/gdb/libpython.py#L362-L363
scipy/scipy
e0a749f01e79046642ccfdc419edbf9e7ca141ad
scipy/stats/_multivariate.py
python
invwishart_gen._mode
(self, dim, df, scale)
return scale / (df + dim + 1)
Mode of the inverse Wishart distribution. Parameters ---------- dim : int Dimension of the scale matrix %(_doc_default_callparams)s Notes ----- As this function does no argument checking, it should not be called directly; use 'mode' instead.
Mode of the inverse Wishart distribution.
[ "Mode", "of", "the", "inverse", "Wishart", "distribution", "." ]
def _mode(self, dim, df, scale): """Mode of the inverse Wishart distribution. Parameters ---------- dim : int Dimension of the scale matrix %(_doc_default_callparams)s Notes ----- As this function does no argument checking, it should not be ...
[ "def", "_mode", "(", "self", ",", "dim", ",", "df", ",", "scale", ")", ":", "return", "scale", "/", "(", "df", "+", "dim", "+", "1", ")" ]
https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/scipy/stats/_multivariate.py#L2605-L2620
espnet/espnet
ea411f3f627b8f101c211e107d0ff7053344ac80
espnet2/utils/griffin_lim.py
python
Spectrogram2Waveform.__init__
( self, n_fft: int, n_shift: int, fs: int = None, n_mels: int = None, win_length: int = None, window: Optional[str] = "hann", fmin: int = None, fmax: int = None, griffin_lim_iters: Optional[int] = 8, )
Initialize module. Args: fs: Sampling frequency. n_fft: The number of FFT points. n_shift: Shift size in points. n_mels: The number of mel basis. win_length: Window length in points. window: Window function type. f_min: Minimum...
Initialize module.
[ "Initialize", "module", "." ]
def __init__( self, n_fft: int, n_shift: int, fs: int = None, n_mels: int = None, win_length: int = None, window: Optional[str] = "hann", fmin: int = None, fmax: int = None, griffin_lim_iters: Optional[int] = 8, ): """Initialize...
[ "def", "__init__", "(", "self", ",", "n_fft", ":", "int", ",", "n_shift", ":", "int", ",", "fs", ":", "int", "=", "None", ",", "n_mels", ":", "int", "=", "None", ",", "win_length", ":", "int", "=", "None", ",", "window", ":", "Optional", "[", "st...
https://github.com/espnet/espnet/blob/ea411f3f627b8f101c211e107d0ff7053344ac80/espnet2/utils/griffin_lim.py#L113-L164
tensorflow/tensorboard
61d11d99ef034c30ba20b6a7840c8eededb9031c
tensorboard/plugins/hparams/list_session_groups.py
python
_MetricStats.__init__
(self)
[]
def __init__(self): self.total = 0 self.count = 0 self.total_step = 0 self.total_wall_time_secs = 0.0
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "total", "=", "0", "self", ".", "count", "=", "0", "self", ".", "total_step", "=", "0", "self", ".", "total_wall_time_secs", "=", "0.0" ]
https://github.com/tensorflow/tensorboard/blob/61d11d99ef034c30ba20b6a7840c8eededb9031c/tensorboard/plugins/hparams/list_session_groups.py#L588-L592
PaddlePaddle/Research
2da0bd6c72d60e9df403aff23a7802779561c4a1
CV/PaddleReid/reid/data/shared_queue/sharedmemory.py
python
SharedMemoryMgr.malloc
(self, size, wait=True)
return SharedBuffer(self._id, size, start, alloc_status=alloc_status)
malloc a new SharedBuffer Args: size (int): buffer size to be malloc wait (bool): whether to wait when no enough memory Returns: SharedBuffer Raises: SharedMemoryError when not found available memory
malloc a new SharedBuffer
[ "malloc", "a", "new", "SharedBuffer" ]
def malloc(self, size, wait=True): """ malloc a new SharedBuffer Args: size (int): buffer size to be malloc wait (bool): whether to wait when no enough memory Returns: SharedBuffer Raises: SharedMemoryError when not found available memor...
[ "def", "malloc", "(", "self", ",", "size", ",", "wait", "=", "True", ")", ":", "page_num", "=", "int", "(", "math", ".", "ceil", "(", "size", "/", "self", ".", "_page_size", ")", ")", "size", "=", "page_num", "*", "self", ".", "_page_size", "start"...
https://github.com/PaddlePaddle/Research/blob/2da0bd6c72d60e9df403aff23a7802779561c4a1/CV/PaddleReid/reid/data/shared_queue/sharedmemory.py#L428-L469
aiidateam/aiida-core
c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2
aiida/tools/archive/implementations/sqlite/writer.py
python
ArchiveAppenderSqlZip.__enter__
(self)
return self
Start appending to the archive
Start appending to the archive
[ "Start", "appending", "to", "the", "archive" ]
def __enter__(self) -> 'ArchiveAppenderSqlZip': """Start appending to the archive""" # the file should already exist if not self._path.exists(): raise FileNotFoundError(f'Archive {self._path} does not exist') # the file should be an archive with the correct version ve...
[ "def", "__enter__", "(", "self", ")", "->", "'ArchiveAppenderSqlZip'", ":", "# the file should already exist", "if", "not", "self", ".", "_path", ".", "exists", "(", ")", ":", "raise", "FileNotFoundError", "(", "f'Archive {self._path} does not exist'", ")", "# the fil...
https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/tools/archive/implementations/sqlite/writer.py#L223-L267
MaslowCNC/GroundControl
294a05dea5b9753383e24b07ea47d78e76e49422
Simulation/kinematics.py
python
Kinematics.recomputeGeometry
(self)
Some variables are computed on class creation for the geometry of the machine to reduce overhead, calling this function regenerates those values.
Some variables are computed on class creation for the geometry of the machine to reduce overhead, calling this function regenerates those values.
[ "Some", "variables", "are", "computed", "on", "class", "creation", "for", "the", "geometry", "of", "the", "machine", "to", "reduce", "overhead", "calling", "this", "function", "regenerates", "those", "values", "." ]
def recomputeGeometry(self): ''' Some variables are computed on class creation for the geometry of the machine to reduce overhead, calling this function regenerates those values. ''' self.h = math.sqrt((self.l/2)*(self.l/2) + self.s * self.s) self.Theta = math.atan(2*self...
[ "def", "recomputeGeometry", "(", "self", ")", ":", "self", ".", "h", "=", "math", ".", "sqrt", "(", "(", "self", ".", "l", "/", "2", ")", "*", "(", "self", ".", "l", "/", "2", ")", "+", "self", ".", "s", "*", "self", ".", "s", ")", "self", ...
https://github.com/MaslowCNC/GroundControl/blob/294a05dea5b9753383e24b07ea47d78e76e49422/Simulation/kinematics.py#L110-L121
biolab/orange3
41685e1c7b1d1babe680113685a2d44bcc9fec0b
Orange/widgets/data/owcsvimport.py
python
guess_data_type
(col: pd.Series)
return col
Guess column types. Logic is same than in guess_data_type from io_utils module. This function only change the dtype of the column such that later correct Orange.data.variable is used. Logic: - if can converted to date-time (ISO) -> TimeVariable - if numeric (only numbers) - only values {0, 1...
Guess column types. Logic is same than in guess_data_type from io_utils module. This function only change the dtype of the column such that later correct Orange.data.variable is used. Logic: - if can converted to date-time (ISO) -> TimeVariable - if numeric (only numbers) - only values {0, 1...
[ "Guess", "column", "types", ".", "Logic", "is", "same", "than", "in", "guess_data_type", "from", "io_utils", "module", ".", "This", "function", "only", "change", "the", "dtype", "of", "the", "column", "such", "that", "later", "correct", "Orange", ".", "data"...
def guess_data_type(col: pd.Series) -> pd.Series: """ Guess column types. Logic is same than in guess_data_type from io_utils module. This function only change the dtype of the column such that later correct Orange.data.variable is used. Logic: - if can converted to date-time (ISO) -> TimeVariab...
[ "def", "guess_data_type", "(", "col", ":", "pd", ".", "Series", ")", "->", "pd", ".", "Series", ":", "def", "parse_dates", "(", "s", ")", ":", "\"\"\"\n This is an extremely fast approach to datetime parsing.\n For large data, the same dates are often repeated. ...
https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/data/owcsvimport.py#L1607-L1657
shiweibsw/Translation-Tools
2fbbf902364e557fa7017f9a74a8797b7440c077
venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py
python
get_distribution
(dist)
return dist
Return a current distribution object for a Requirement or string
Return a current distribution object for a Requirement or string
[ "Return", "a", "current", "distribution", "object", "for", "a", "Requirement", "or", "string" ]
def get_distribution(dist): """Return a current distribution object for a Requirement or string""" if isinstance(dist, six.string_types): dist = Requirement.parse(dist) if isinstance(dist, Requirement): dist = get_provider(dist) if not isinstance(dist, Distribution): raise TypeEr...
[ "def", "get_distribution", "(", "dist", ")", ":", "if", "isinstance", "(", "dist", ",", "six", ".", "string_types", ")", ":", "dist", "=", "Requirement", ".", "parse", "(", "dist", ")", "if", "isinstance", "(", "dist", ",", "Requirement", ")", ":", "di...
https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py#L553-L561
Clarifai/clarifai-python
7cd160e56799b5a4b04616a1a75961b974d2e6dc
clarifai/rest/client.py
python
Workflow.predict_by_bytes
( self, # type: Workflow raw_bytes, # type: bytes lang=None, # type: typing.Optional[str] is_video=False, # type: typing.Optional[bool] min_value=None, # type: typing.Optional[float] max_concepts=None, # type: typing.Optional[int] select_concepts=None # type: typing.Opti...
return res
predict a model with image raw bytes Args: raw_bytes: raw bytes of an image lang: language to predict, if the translation is available is_video: whether this is a video min_value: threshold to cut the predictions, 0-1.0 max_concepts: max concepts to keep in the predictions, 0-200 ...
predict a model with image raw bytes
[ "predict", "a", "model", "with", "image", "raw", "bytes" ]
def predict_by_bytes( self, # type: Workflow raw_bytes, # type: bytes lang=None, # type: typing.Optional[str] is_video=False, # type: typing.Optional[bool] min_value=None, # type: typing.Optional[float] max_concepts=None, # type: typing.Optional[int] select_concepts=None ...
[ "def", "predict_by_bytes", "(", "self", ",", "# type: Workflow", "raw_bytes", ",", "# type: bytes", "lang", "=", "None", ",", "# type: typing.Optional[str]", "is_video", "=", "False", ",", "# type: typing.Optional[bool]", "min_value", "=", "None", ",", "# type: typing.O...
https://github.com/Clarifai/clarifai-python/blob/7cd160e56799b5a4b04616a1a75961b974d2e6dc/clarifai/rest/client.py#L829-L867
lovelylain/pyctp
fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d
example/pyctp2/trader/trade_command_queue.py
python
TradeCommandQueueStub.__init__
(self, env, account)
[]
def __init__(self, env, account): BaseTradeCommandQueue.__init__(self,env,account) self.lock = threading.Lock()
[ "def", "__init__", "(", "self", ",", "env", ",", "account", ")", ":", "BaseTradeCommandQueue", ".", "__init__", "(", "self", ",", "env", ",", "account", ")", "self", ".", "lock", "=", "threading", ".", "Lock", "(", ")" ]
https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/example/pyctp2/trader/trade_command_queue.py#L300-L302
shiyanlou/louplus-python
4c61697259e286e3d9116c3299f170d019ba3767
taobei/challenge-07/tbmall/handlers/product.py
python
product_info
(id)
return json_response(product=ProductSchema().dump(product))
查询商品
查询商品
[ "查询商品" ]
def product_info(id): """查询商品 """ product = Product.query.get(id) if product is None: return json_response(ResponseCode.NOT_FOUND) return json_response(product=ProductSchema().dump(product))
[ "def", "product_info", "(", "id", ")", ":", "product", "=", "Product", ".", "query", ".", "get", "(", "id", ")", "if", "product", "is", "None", ":", "return", "json_response", "(", "ResponseCode", ".", "NOT_FOUND", ")", "return", "json_response", "(", "p...
https://github.com/shiyanlou/louplus-python/blob/4c61697259e286e3d9116c3299f170d019ba3767/taobei/challenge-07/tbmall/handlers/product.py#L65-L73
openstack/nova
b49b7663e1c3073917d5844b81d38db8e86d05c4
nova/api/openstack/compute/servers.py
python
ServersController._get_server
(self, context, req, instance_uuid, is_detail=False, cell_down_support=False, columns_to_join=None)
return instance
Utility function for looking up an instance by uuid. :param context: request context for auth :param req: HTTP request. :param instance_uuid: UUID of the server instance to get :param is_detail: True if you plan on showing the details of the instance in the response, False o...
Utility function for looking up an instance by uuid.
[ "Utility", "function", "for", "looking", "up", "an", "instance", "by", "uuid", "." ]
def _get_server(self, context, req, instance_uuid, is_detail=False, cell_down_support=False, columns_to_join=None): """Utility function for looking up an instance by uuid. :param context: request context for auth :param req: HTTP request. :param instance_uuid: UUID o...
[ "def", "_get_server", "(", "self", ",", "context", ",", "req", ",", "instance_uuid", ",", "is_detail", "=", "False", ",", "cell_down_support", "=", "False", ",", "columns_to_join", "=", "None", ")", ":", "expected_attrs", "=", "[", "'flavor'", ",", "'numa_to...
https://github.com/openstack/nova/blob/b49b7663e1c3073917d5844b81d38db8e86d05c4/nova/api/openstack/compute/servers.py#L351-L381
dropbox/dropbox-sdk-python
015437429be224732990041164a21a0501235db1
dropbox/team_log.py
python
FederationStatusChangeAdditionalInfo.is_organization_name
(self)
return self._tag == 'organization_name'
Check if the union tag is ``organization_name``. :rtype: bool
Check if the union tag is ``organization_name``.
[ "Check", "if", "the", "union", "tag", "is", "organization_name", "." ]
def is_organization_name(self): """ Check if the union tag is ``organization_name``. :rtype: bool """ return self._tag == 'organization_name'
[ "def", "is_organization_name", "(", "self", ")", ":", "return", "self", ".", "_tag", "==", "'organization_name'" ]
https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L44566-L44572
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
lib/dns/resolver.py
python
_Resolution.query_result
(self, response, ex)
[]
def query_result(self, response, ex): # # returns an (answer: Answer, end_loop: bool) tuple. # if ex: # Exception during I/O or from_wire() assert response is None self.errors.append((self.nameserver, self.tcp_attempt, self.port, ...
[ "def", "query_result", "(", "self", ",", "response", ",", "ex", ")", ":", "#", "# returns an (answer: Answer, end_loop: bool) tuple.", "#", "if", "ex", ":", "# Exception during I/O or from_wire()", "assert", "response", "is", "None", "self", ".", "errors", ".", "app...
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/dns/resolver.py#L609-L669
iosband/ts_tutorial
f28d3bbe88b16a2e61faab9ffe4ae7387880b16a
src/ensemble_nn/agent_nn.py
python
TwoLayerNNDropout.pick_action
(self, observation)
return action
Select the greedy action according to the output of a stochastic forward pass.
Select the greedy action according to the output of a stochastic forward pass.
[ "Select", "the", "greedy", "action", "according", "to", "the", "output", "of", "a", "stochastic", "forward", "pass", "." ]
def pick_action(self, observation): """Select the greedy action according to the output of a stochastic forward pass.""" model_out, _ = self._model_forward(self.actions) action = np.argmax(model_out) return action
[ "def", "pick_action", "(", "self", ",", "observation", ")", ":", "model_out", ",", "_", "=", "self", ".", "_model_forward", "(", "self", ".", "actions", ")", "action", "=", "np", ".", "argmax", "(", "model_out", ")", "return", "action" ]
https://github.com/iosband/ts_tutorial/blob/f28d3bbe88b16a2e61faab9ffe4ae7387880b16a/src/ensemble_nn/agent_nn.py#L257-L262
BlackLight/platypush
a6b552504e2ac327c94f3a28b607061b6b60cf36
platypush/plugins/lcd/__init__.py
python
LcdPlugin.write
(self, value: int)
Write a raw byte to the LCD. :param value: Byte to be sent.
Write a raw byte to the LCD.
[ "Write", "a", "raw", "byte", "to", "the", "LCD", "." ]
def write(self, value: int): """ Write a raw byte to the LCD. :param value: Byte to be sent. """ self._init_lcd() self.lcd.write(value)
[ "def", "write", "(", "self", ",", "value", ":", "int", ")", ":", "self", ".", "_init_lcd", "(", ")", "self", ".", "lcd", ".", "write", "(", "value", ")" ]
https://github.com/BlackLight/platypush/blob/a6b552504e2ac327c94f3a28b607061b6b60cf36/platypush/plugins/lcd/__init__.py#L202-L209
vispy/vispy
26256fdc2574259dd227022fbce0767cae4e244b
vispy/gloo/wrappers.py
python
BaseGlooFunctions.set_polygon_offset
(self, factor=0., units=0.)
Set the scale and units used to calculate depth values Parameters ---------- factor : float Scale factor used to create a variable depth offset for each polygon. units : float Multiplied by an implementation-specific value to create a cons...
Set the scale and units used to calculate depth values
[ "Set", "the", "scale", "and", "units", "used", "to", "calculate", "depth", "values" ]
def set_polygon_offset(self, factor=0., units=0.): """Set the scale and units used to calculate depth values Parameters ---------- factor : float Scale factor used to create a variable depth offset for each polygon. units : float Multiplied by...
[ "def", "set_polygon_offset", "(", "self", ",", "factor", "=", "0.", ",", "units", "=", "0.", ")", ":", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", "'glPolygonOffset'", ",", "float", "(", "factor", ")", ",", "float", "(", "units", ")", ")...
https://github.com/vispy/vispy/blob/26256fdc2574259dd227022fbce0767cae4e244b/vispy/gloo/wrappers.py#L162-L175
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-1.4/django/db/models/sql/aggregates.py
python
Aggregate.__init__
(self, col, source=None, is_summary=False, **extra)
Instantiate an SQL aggregate * col is a column reference describing the subject field of the aggregate. It can be an alias, or a tuple describing a table and column name. * source is the underlying field or aggregate definition for the column reference. If the aggrega...
Instantiate an SQL aggregate
[ "Instantiate", "an", "SQL", "aggregate" ]
def __init__(self, col, source=None, is_summary=False, **extra): """Instantiate an SQL aggregate * col is a column reference describing the subject field of the aggregate. It can be an alias, or a tuple describing a table and column name. * source is the underlying field...
[ "def", "__init__", "(", "self", ",", "col", ",", "source", "=", "None", ",", "is_summary", "=", "False", ",", "*", "*", "extra", ")", ":", "self", ".", "col", "=", "col", "self", ".", "source", "=", "source", "self", ".", "is_summary", "=", "is_sum...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.4/django/db/models/sql/aggregates.py#L19-L63
ghostop14/sparrow-wifi
4b8289773ea4304872062f65a6ffc9352612b08e
sparrow-wifi.py
python
Divider.mouseMoveEvent
(self, event)
[]
def mouseMoveEvent(self, event): if event.buttons() == Qt.LeftButton: newPos = self.mapToParent(event.pos()) newPos.setX(1) self.move(newPos) self.mainWin.resizeEvent(event)
[ "def", "mouseMoveEvent", "(", "self", ",", "event", ")", ":", "if", "event", ".", "buttons", "(", ")", "==", "Qt", ".", "LeftButton", ":", "newPos", "=", "self", ".", "mapToParent", "(", "event", ".", "pos", "(", ")", ")", "newPos", ".", "setX", "(...
https://github.com/ghostop14/sparrow-wifi/blob/4b8289773ea4304872062f65a6ffc9352612b08e/sparrow-wifi.py#L411-L417
mediacloud/backend
d36b489e4fbe6e44950916a04d9543a1d6cd5df0
apps/topics-base/src/python/topics_base/stories.py
python
copy_story_to_new_medium
(db: DatabaseHandler, topic: dict, old_story: dict, new_medium: dict)
return story
Copy story to new medium. Copy the given story, assigning the new media_id and copying over the download, extracted text, and so on. Return the new story.
Copy story to new medium.
[ "Copy", "story", "to", "new", "medium", "." ]
def copy_story_to_new_medium(db: DatabaseHandler, topic: dict, old_story: dict, new_medium: dict) -> dict: """Copy story to new medium. Copy the given story, assigning the new media_id and copying over the download, extracted text, and so on. Return the new story. """ story = { 'url': old_...
[ "def", "copy_story_to_new_medium", "(", "db", ":", "DatabaseHandler", ",", "topic", ":", "dict", ",", "old_story", ":", "dict", ",", "new_medium", ":", "dict", ")", "->", "dict", ":", "story", "=", "{", "'url'", ":", "old_story", "[", "'url'", "]", ",", ...
https://github.com/mediacloud/backend/blob/d36b489e4fbe6e44950916a04d9543a1d6cd5df0/apps/topics-base/src/python/topics_base/stories.py#L577-L639
missionpinball/mpf
8e6b74cff4ba06d2fec9445742559c1068b88582
mpf/platforms/lisy/lisy.py
python
LisyHardwarePlatform._watchdog
(self)
Periodically send watchdog.
Periodically send watchdog.
[ "Periodically", "send", "watchdog", "." ]
async def _watchdog(self): """Periodically send watchdog.""" while True: # send watchdog async with self._bus_lock: self.send_byte(LisyDefines.GeneralWatchdog) response = await self._read_byte() if response != 0: ...
[ "async", "def", "_watchdog", "(", "self", ")", ":", "while", "True", ":", "# send watchdog", "async", "with", "self", ".", "_bus_lock", ":", "self", ".", "send_byte", "(", "LisyDefines", ".", "GeneralWatchdog", ")", "response", "=", "await", "self", ".", "...
https://github.com/missionpinball/mpf/blob/8e6b74cff4ba06d2fec9445742559c1068b88582/mpf/platforms/lisy/lisy.py#L592-L602
bibanon/tubeup
7078d287ac00437fc1209daaf2dd1fe40ec9ca74
tubeup/TubeUp.py
python
TubeUp.archive_urls
(self, urls, custom_meta=None, cookie_file=None, proxy=None, ydl_username=None, ydl_password=None, use_download_archive=False)
Download and upload videos from youtube_dl supported sites to archive.org :param urls: List of url that will be downloaded and uploaded to archive.org :param custom_meta: A custom metadata that will be used when ...
Download and upload videos from youtube_dl supported sites to archive.org
[ "Download", "and", "upload", "videos", "from", "youtube_dl", "supported", "sites", "to", "archive", ".", "org" ]
def archive_urls(self, urls, custom_meta=None, cookie_file=None, proxy=None, ydl_username=None, ydl_password=None, use_download_archive=False): """ Download and upload videos from youtube_dl supported sites to archive.org :p...
[ "def", "archive_urls", "(", "self", ",", "urls", ",", "custom_meta", "=", "None", ",", "cookie_file", "=", "None", ",", "proxy", "=", "None", ",", "ydl_username", "=", "None", ",", "ydl_password", "=", "None", ",", "use_download_archive", "=", "False", ")"...
https://github.com/bibanon/tubeup/blob/7078d287ac00437fc1209daaf2dd1fe40ec9ca74/tubeup/TubeUp.py#L357-L387
PyMVPA/PyMVPA
76c476b3de8264b0bb849bf226da5674d659564e
mvpa2/clfs/stats.py
python
MCNullDist.__init__
(self, permutator, dist_class=Nonparametric, measure=None, **kwargs)
Initialize Monte-Carlo Permutation Null-hypothesis testing Parameters ---------- permutator : Node Node instance that generates permuted datasets. dist_class : class This can be any class which provides parameters estimate using `fit()` method to initialize...
Initialize Monte-Carlo Permutation Null-hypothesis testing
[ "Initialize", "Monte", "-", "Carlo", "Permutation", "Null", "-", "hypothesis", "testing" ]
def __init__(self, permutator, dist_class=Nonparametric, measure=None, **kwargs): """Initialize Monte-Carlo Permutation Null-hypothesis testing Parameters ---------- permutator : Node Node instance that generates permuted datasets. dist_class : class ...
[ "def", "__init__", "(", "self", ",", "permutator", ",", "dist_class", "=", "Nonparametric", ",", "measure", "=", "None", ",", "*", "*", "kwargs", ")", ":", "NullDist", ".", "__init__", "(", "self", ",", "*", "*", "kwargs", ")", "self", ".", "_dist_clas...
https://github.com/PyMVPA/PyMVPA/blob/76c476b3de8264b0bb849bf226da5674d659564e/mvpa2/clfs/stats.py#L328-L351
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/pip/_vendor/chardet/charsetprober.py
python
CharSetProber.filter_with_english_letters
(buf)
return filtered
Returns a copy of ``buf`` that retains only the sequences of English alphabet and high byte characters that are not between <> characters. Also retains English alphabet and high byte characters immediately before occurrences of >. This filter can be applied to all scripts which contain ...
Returns a copy of ``buf`` that retains only the sequences of English alphabet and high byte characters that are not between <> characters. Also retains English alphabet and high byte characters immediately before occurrences of >.
[ "Returns", "a", "copy", "of", "buf", "that", "retains", "only", "the", "sequences", "of", "English", "alphabet", "and", "high", "byte", "characters", "that", "are", "not", "between", "<", ">", "characters", ".", "Also", "retains", "English", "alphabet", "and...
def filter_with_english_letters(buf): """ Returns a copy of ``buf`` that retains only the sequences of English alphabet and high byte characters that are not between <> characters. Also retains English alphabet and high byte characters immediately before occurrences of >. ...
[ "def", "filter_with_english_letters", "(", "buf", ")", ":", "filtered", "=", "bytearray", "(", ")", "in_tag", "=", "False", "prev", "=", "0", "for", "curr", "in", "range", "(", "len", "(", "buf", ")", ")", ":", "# Slice here to get bytes instead of an int with...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pip/_vendor/chardet/charsetprober.py#L104-L145
polakowo/vectorbt
6638735c131655760474d72b9f045d1dbdbd8fe9
vectorbt/utils/schedule_.py
python
ScheduleManager.async_start
(self, sleep: int = 1)
Async run pending jobs in a loop.
Async run pending jobs in a loop.
[ "Async", "run", "pending", "jobs", "in", "a", "loop", "." ]
async def async_start(self, sleep: int = 1) -> None: """Async run pending jobs in a loop.""" logger.info("Starting schedule manager in the background with jobs %s", str(self.scheduler.jobs)) logger.info("Jobs: %s", str(self.scheduler.jobs)) try: while True: aw...
[ "async", "def", "async_start", "(", "self", ",", "sleep", ":", "int", "=", "1", ")", "->", "None", ":", "logger", ".", "info", "(", "\"Starting schedule manager in the background with jobs %s\"", ",", "str", "(", "self", ".", "scheduler", ".", "jobs", ")", "...
https://github.com/polakowo/vectorbt/blob/6638735c131655760474d72b9f045d1dbdbd8fe9/vectorbt/utils/schedule_.py#L250-L259
chipmuenk/pyfda
665310b8548a940a575c0e5ff4bba94608d9ac26
pyfda/libs/pyfda_lib.py
python
fil_save
(fil_dict: dict, arg, format_in: str, sender: str, convert: bool = True)
Save filter design ``arg`` given in the format specified as ``format_in`` in the dictionary ``fil_dict``. The format can be either poles / zeros / gain, filter coefficients (polynomes) or second-order sections. Convert the filter design to the other formats if ``convert`` is True. Parameters -----...
Save filter design ``arg`` given in the format specified as ``format_in`` in the dictionary ``fil_dict``. The format can be either poles / zeros / gain, filter coefficients (polynomes) or second-order sections.
[ "Save", "filter", "design", "arg", "given", "in", "the", "format", "specified", "as", "format_in", "in", "the", "dictionary", "fil_dict", ".", "The", "format", "can", "be", "either", "poles", "/", "zeros", "/", "gain", "filter", "coefficients", "(", "polynom...
def fil_save(fil_dict: dict, arg, format_in: str, sender: str, convert: bool = True) -> None: """ Save filter design ``arg`` given in the format specified as ``format_in`` in the dictionary ``fil_dict``. The format can be either poles / zeros / gain, filter coefficients (polynomes) or secon...
[ "def", "fil_save", "(", "fil_dict", ":", "dict", ",", "arg", ",", "format_in", ":", "str", ",", "sender", ":", "str", ",", "convert", ":", "bool", "=", "True", ")", "->", "None", ":", "if", "format_in", "==", "'sos'", ":", "fil_dict", "[", "'sos'", ...
https://github.com/chipmuenk/pyfda/blob/665310b8548a940a575c0e5ff4bba94608d9ac26/pyfda/libs/pyfda_lib.py#L1302-L1455
PaddlePaddle/PaddleX
2bab73f81ab54e328204e7871e6ae4a82e719f5d
paddlex/paddleseg/models/backbones/xception_deeplab.py
python
Xception_Block.forward
(self, inputs)
return x + skip
[]
def forward(self, inputs): if not self.activation_fn_in_separable_conv: x = F.relu(inputs) x = self._conv1(x) x = F.relu(x) x = self._conv2(x) x = F.relu(x) x = self._conv3(x) else: x = self._conv1(inputs) x ...
[ "def", "forward", "(", "self", ",", "inputs", ")", ":", "if", "not", "self", ".", "activation_fn_in_separable_conv", ":", "x", "=", "F", ".", "relu", "(", "inputs", ")", "x", "=", "self", ".", "_conv1", "(", "x", ")", "x", "=", "F", ".", "relu", ...
https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/paddlex/paddleseg/models/backbones/xception_deeplab.py#L228-L246