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
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/ast.py
python
walk
(node)
Recursively yield all descendant nodes in the tree starting at *node* (including *node* itself), in no specified order. This is useful if you only want to modify nodes in place and don't care about the context.
Recursively yield all descendant nodes in the tree starting at *node* (including *node* itself), in no specified order. This is useful if you only want to modify nodes in place and don't care about the context.
[ "Recursively", "yield", "all", "descendant", "nodes", "in", "the", "tree", "starting", "at", "*", "node", "*", "(", "including", "*", "node", "*", "itself", ")", "in", "no", "specified", "order", ".", "This", "is", "useful", "if", "you", "only", "want", ...
def walk(node): """ Recursively yield all descendant nodes in the tree starting at *node* (including *node* itself), in no specified order. This is useful if you only want to modify nodes in place and don't care about the context. """ from collections import deque todo = deque([node]) w...
[ "def", "walk", "(", "node", ")", ":", "from", "collections", "import", "deque", "todo", "=", "deque", "(", "[", "node", "]", ")", "while", "todo", ":", "node", "=", "todo", ".", "popleft", "(", ")", "todo", ".", "extend", "(", "iter_child_nodes", "("...
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/ast.py#L207-L218
calebstewart/pwncat
d67865bdaac60dd0761d0698062e7b443a62c6db
pwncat/modules/windows/enumerate/domain/__init__.py
python
DomainObject.__getitem__
(self, name: str)
return self.domain[name]
Shortcut for getting properties from the `self.domain` property.
Shortcut for getting properties from the `self.domain` property.
[ "Shortcut", "for", "getting", "properties", "from", "the", "self", ".", "domain", "property", "." ]
def __getitem__(self, name: str): """Shortcut for getting properties from the `self.domain` property.""" return self.domain[name]
[ "def", "__getitem__", "(", "self", ",", "name", ":", "str", ")", ":", "return", "self", ".", "domain", "[", "name", "]" ]
https://github.com/calebstewart/pwncat/blob/d67865bdaac60dd0761d0698062e7b443a62c6db/pwncat/modules/windows/enumerate/domain/__init__.py#L18-L21
wechatpy/wechatpy
5f693a7e90156786c2540ad3c941d12cdf6d88ef
wechatpy/client/api/customservice.py
python
WeChatCustomService.get_session_list
(self, account)
return res
获取客服的会话列表 详情请参考 http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html :param account: 完整客服账号 :return: 客服的会话列表
获取客服的会话列表 详情请参考 http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html
[ "获取客服的会话列表", "详情请参考", "http", ":", "//", "mp", ".", "weixin", ".", "qq", ".", "com", "/", "wiki", "/", "2", "/", "6c20f3e323bdf5986cfcb33cbd3b829a", ".", "html" ]
def get_session_list(self, account): """ 获取客服的会话列表 详情请参考 http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html :param account: 完整客服账号 :return: 客服的会话列表 """ res = self._get( "https://api.weixin.qq.com/customservice/kfsession/getse...
[ "def", "get_session_list", "(", "self", ",", "account", ")", ":", "res", "=", "self", ".", "_get", "(", "\"https://api.weixin.qq.com/customservice/kfsession/getsessionlist\"", ",", "params", "=", "{", "\"kf_account\"", ":", "account", "}", ",", "result_processor", "...
https://github.com/wechatpy/wechatpy/blob/5f693a7e90156786c2540ad3c941d12cdf6d88ef/wechatpy/client/api/customservice.py#L149-L163
freelawproject/courtlistener
ab3ae7bb6e5e836b286749113e7dbb403d470912
cl/api/views.py
python
annotate_courts_with_counts
(courts, court_count_tuples)
return courts
Solr gives us a response like: court_count_tuples = [ ('ca2', 200), ('ca1', 42), ... ] Here we add an attribute to our court objects so they have these values.
Solr gives us a response like:
[ "Solr", "gives", "us", "a", "response", "like", ":" ]
def annotate_courts_with_counts(courts, court_count_tuples): """Solr gives us a response like: court_count_tuples = [ ('ca2', 200), ('ca1', 42), ... ] Here we add an attribute to our court objects so they have these values. """ # Convert the tuple to...
[ "def", "annotate_courts_with_counts", "(", "courts", ",", "court_count_tuples", ")", ":", "# Convert the tuple to a dict", "court_count_dict", "=", "{", "}", "for", "court_str", ",", "count", "in", "court_count_tuples", ":", "court_count_dict", "[", "court_str", "]", ...
https://github.com/freelawproject/courtlistener/blob/ab3ae7bb6e5e836b286749113e7dbb403d470912/cl/api/views.py#L24-L43
materialsproject/pymatgen
8128f3062a334a2edd240e4062b5b9bdd1ae6f58
pymatgen/io/vasp/help.py
python
VaspDoc.get_incar_tags
(cls)
return tags
Returns: All incar tags
Returns: All incar tags
[ "Returns", ":", "All", "incar", "tags" ]
def get_incar_tags(cls): """ Returns: All incar tags """ tags = [] for page in [ "http://www.vasp.at/wiki/index.php/Category:INCAR", "http://www.vasp.at/wiki/index.php?title=Category:INCAR&pagefrom=ML+FF+LCONF+DISCARD#mw-pages", ]: r = ...
[ "def", "get_incar_tags", "(", "cls", ")", ":", "tags", "=", "[", "]", "for", "page", "in", "[", "\"http://www.vasp.at/wiki/index.php/Category:INCAR\"", ",", "\"http://www.vasp.at/wiki/index.php?title=Category:INCAR&pagefrom=ML+FF+LCONF+DISCARD#mw-pages\"", ",", "]", ":", "r",...
https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/io/vasp/help.py#L69-L84
KoreLogicSecurity/mastiff
04d569e4fa59513572e77c74b049cad82f9b0310
mastiff/plugins/__init__.py
python
encode_multipart_formdata
(fields, files)
return content_type, body
fields is a sequence of (name, value) elements for regular form fields. files is a sequence of (name, filename, value) elements for data to be uploaded as files Return (content_type, body) ready for httplib.HTTP instance
fields is a sequence of (name, value) elements for regular form fields. files is a sequence of (name, filename, value) elements for data to be uploaded as files Return (content_type, body) ready for httplib.HTTP instance
[ "fields", "is", "a", "sequence", "of", "(", "name", "value", ")", "elements", "for", "regular", "form", "fields", ".", "files", "is", "a", "sequence", "of", "(", "name", "filename", "value", ")", "elements", "for", "data", "to", "be", "uploaded", "as", ...
def encode_multipart_formdata(fields, files): """ fields is a sequence of (name, value) elements for regular form fields. files is a sequence of (name, filename, value) elements for data to be uploaded as files Return (content_type, body) ready for httplib.HTTP instance """ BOUNDARY = '---------...
[ "def", "encode_multipart_formdata", "(", "fields", ",", "files", ")", ":", "BOUNDARY", "=", "'----------MASTIFF_STATIC_ANALYSIS_FRAMEWORK$'", "CRLF", "=", "'\\r\\n'", "L", "=", "[", "]", "for", "(", "key", ",", "value", ")", "in", "fields", ":", "L", ".", "a...
https://github.com/KoreLogicSecurity/mastiff/blob/04d569e4fa59513572e77c74b049cad82f9b0310/mastiff/plugins/__init__.py#L49-L73
khalim19/gimp-plugin-export-layers
b37255f2957ad322f4d332689052351cdea6e563
export_layers/pygimplib/_lib/future/future/backports/email/iterators.py
python
body_line_iterator
(msg, decode=False)
Iterate over the parts, returning string payloads line-by-line. Optional decode (default False) is passed through to .get_payload().
Iterate over the parts, returning string payloads line-by-line.
[ "Iterate", "over", "the", "parts", "returning", "string", "payloads", "line", "-", "by", "-", "line", "." ]
def body_line_iterator(msg, decode=False): """Iterate over the parts, returning string payloads line-by-line. Optional decode (default False) is passed through to .get_payload(). """ for subpart in msg.walk(): payload = subpart.get_payload(decode=decode) if isinstance(payload, str): ...
[ "def", "body_line_iterator", "(", "msg", ",", "decode", "=", "False", ")", ":", "for", "subpart", "in", "msg", ".", "walk", "(", ")", ":", "payload", "=", "subpart", ".", "get_payload", "(", "decode", "=", "decode", ")", "if", "isinstance", "(", "paylo...
https://github.com/khalim19/gimp-plugin-export-layers/blob/b37255f2957ad322f4d332689052351cdea6e563/export_layers/pygimplib/_lib/future/future/backports/email/iterators.py#L37-L46
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/protobuf-3.13.0/google/protobuf/internal/containers.py
python
RepeatedCompositeFieldContainer.__delitem__
(self, key)
Deletes the item at the specified position.
Deletes the item at the specified position.
[ "Deletes", "the", "item", "at", "the", "specified", "position", "." ]
def __delitem__(self, key): """Deletes the item at the specified position.""" del self._values[key] self._message_listener.Modified()
[ "def", "__delitem__", "(", "self", ",", "key", ")", ":", "del", "self", ".", "_values", "[", "key", "]", "self", ".", "_message_listener", ".", "Modified", "(", ")" ]
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/protobuf-3.13.0/google/protobuf/internal/containers.py#L438-L441
adamcaudill/EquationGroupLeak
52fa871c89008566c27159bd48f2a8641260c984
windows/fuzzbunch/fuzzbunch.py
python
Fuzzbunch.set_logdir
(self, log_dir=None)
Set the current log directory and create a new log file
Set the current log directory and create a new log file
[ "Set", "the", "current", "log", "directory", "and", "create", "a", "new", "log", "file" ]
def set_logdir(self, log_dir=None): """Set the current log directory and create a new log file""" if not log_dir: log_dir = os.path.normpath(self.default_logdir) base_dir = self.get_basedir() self.session.set_dirs(base_dir, log_dir) logname = "fuzzbunch-%s.log" % ut...
[ "def", "set_logdir", "(", "self", ",", "log_dir", "=", "None", ")", ":", "if", "not", "log_dir", ":", "log_dir", "=", "os", ".", "path", ".", "normpath", "(", "self", ".", "default_logdir", ")", "base_dir", "=", "self", ".", "get_basedir", "(", ")", ...
https://github.com/adamcaudill/EquationGroupLeak/blob/52fa871c89008566c27159bd48f2a8641260c984/windows/fuzzbunch/fuzzbunch.py#L133-L142
attardi/deepnl
e1ad450f2768a084f44b128de313f19c2f15100f
deepnl/utils.py
python
boundaries_to_arg_limits
(boundaries)
return np.array(limits, int)
Converts a sequence of IOBES tags delimiting arguments to an array of argument boundaries, used by the network.
Converts a sequence of IOBES tags delimiting arguments to an array of argument boundaries, used by the network.
[ "Converts", "a", "sequence", "of", "IOBES", "tags", "delimiting", "arguments", "to", "an", "array", "of", "argument", "boundaries", "used", "by", "the", "network", "." ]
def boundaries_to_arg_limits(boundaries): """ Converts a sequence of IOBES tags delimiting arguments to an array of argument boundaries, used by the network. """ limits = [] start = None for i, tag in enumerate(boundaries): if tag == 'S': limits.append([i, i]) ...
[ "def", "boundaries_to_arg_limits", "(", "boundaries", ")", ":", "limits", "=", "[", "]", "start", "=", "None", "for", "i", ",", "tag", "in", "enumerate", "(", "boundaries", ")", ":", "if", "tag", "==", "'S'", ":", "limits", ".", "append", "(", "[", "...
https://github.com/attardi/deepnl/blob/e1ad450f2768a084f44b128de313f19c2f15100f/deepnl/utils.py#L142-L158
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/python-graph-bench.py
python
test_accessibility_on_very_deep_graph
()
[]
def test_accessibility_on_very_deep_graph(): gr = graph() gr.add_nodes(range(0,311)) # 2001 for i in range(0,310): #2000 gr.add_edge((i,i+1)) recursionlimit = getrecursionlimit() accessibility(gr) assert getrecursionlimit() == recursionlimit
[ "def", "test_accessibility_on_very_deep_graph", "(", ")", ":", "gr", "=", "graph", "(", ")", "gr", ".", "add_nodes", "(", "range", "(", "0", ",", "311", ")", ")", "# 2001", "for", "i", "in", "range", "(", "0", ",", "310", ")", ":", "#2000", "gr", "...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/python-graph-bench.py#L16-L23
pyjs/pyjs
6c4a3d3a67300cd5df7f95a67ca9dcdc06950523
pyjs/runners/imputil.py
python
_timestamp
(pathname)
return long(s.st_mtime)
Return the file modification time as a Long.
Return the file modification time as a Long.
[ "Return", "the", "file", "modification", "time", "as", "a", "Long", "." ]
def _timestamp(pathname): "Return the file modification time as a Long." try: s = _os_stat(pathname) except OSError: return None return long(s.st_mtime)
[ "def", "_timestamp", "(", "pathname", ")", ":", "try", ":", "s", "=", "_os_stat", "(", "pathname", ")", "except", "OSError", ":", "return", "None", "return", "long", "(", "s", ".", "st_mtime", ")" ]
https://github.com/pyjs/pyjs/blob/6c4a3d3a67300cd5df7f95a67ca9dcdc06950523/pyjs/runners/imputil.py#L524-L530
shiweibsw/Translation-Tools
2fbbf902364e557fa7017f9a74a8797b7440c077
venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/cachecontrol/serialize.py
python
_b64_encode_str
(s)
return _b64_encode_bytes(s.encode("utf8"))
[]
def _b64_encode_str(s): return _b64_encode_bytes(s.encode("utf8"))
[ "def", "_b64_encode_str", "(", "s", ")", ":", "return", "_b64_encode_bytes", "(", "s", ".", "encode", "(", "\"utf8\"", ")", ")" ]
https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/cachecontrol/serialize.py#L15-L16
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/groups/perm_gps/symgp_conjugacy_class.py
python
SymmetricGroupConjugacyClassMixin.__init__
(self, domain, part)
Initialize ``self``. EXAMPLES:: sage: G = SymmetricGroup(5) sage: g = G([(1,2), (3,4,5)]) sage: C = G.conjugacy_class(Partition([3,2])) sage: type(C._part) <class 'sage.combinat.partition.Partitions_n_with_category.element_class'>
Initialize ``self``.
[ "Initialize", "self", "." ]
def __init__(self, domain, part): """ Initialize ``self``. EXAMPLES:: sage: G = SymmetricGroup(5) sage: g = G([(1,2), (3,4,5)]) sage: C = G.conjugacy_class(Partition([3,2])) sage: type(C._part) <class 'sage.combinat.partition.Partitio...
[ "def", "__init__", "(", "self", ",", "domain", ",", "part", ")", ":", "P", "=", "Partitions_n", "(", "len", "(", "domain", ")", ")", "self", ".", "_part", "=", "P", "(", "part", ")", "self", ".", "_domain", "=", "domain", "self", ".", "_set", "="...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/groups/perm_gps/symgp_conjugacy_class.py#L23-L38
mlcommons/ck
558a22c5970eb0d6708d0edc080e62a92566bab0
incubator/cdatabase/cdatabase/crepo.py
python
cRepo.__init__
(self, path: str)
Initialize cObject in a given path Args: path (str): Path to cDataBase
Initialize cObject in a given path
[ "Initialize", "cObject", "in", "a", "given", "path" ]
def __init__(self, path: str): """ Initialize cObject in a given path Args: path (str): Path to cDataBase """ self.path = path
[ "def", "__init__", "(", "self", ",", "path", ":", "str", ")", ":", "self", ".", "path", "=", "path" ]
https://github.com/mlcommons/ck/blob/558a22c5970eb0d6708d0edc080e62a92566bab0/incubator/cdatabase/cdatabase/crepo.py#L16-L25
phyllisstein/alp
cbc9e9fa2de19cfd72bc416b9c879b571dc92972
alp/request/requests/packages/urllib3/packages/ordered_dict.py
python
OrderedDict.setdefault
(self, key, default=None)
return default
od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od
od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od
[ "od", ".", "setdefault", "(", "k", "[", "d", "]", ")", "-", ">", "od", ".", "get", "(", "k", "d", ")", "also", "set", "od", "[", "k", "]", "=", "d", "if", "k", "not", "in", "od" ]
def setdefault(self, key, default=None): 'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od' if key in self: return self[key] self[key] = default return default
[ "def", "setdefault", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "if", "key", "in", "self", ":", "return", "self", "[", "key", "]", "self", "[", "key", "]", "=", "default", "return", "default" ]
https://github.com/phyllisstein/alp/blob/cbc9e9fa2de19cfd72bc416b9c879b571dc92972/alp/request/requests/packages/urllib3/packages/ordered_dict.py#L191-L196
scikit-hep/awkward-0.x
dd885bef15814f588b58944d2505296df4aaae0e
awkward0/arrow.py
python
_ParquetFile._init
(self)
[]
def _init(self): import pyarrow.parquet self.parquetfile = pyarrow.parquet.ParquetFile(self.file, metadata=self.metadata, common_metadata=self.common_metadata) self.type = schema2type(self.parquetfile.schema.to_arrow_schema())
[ "def", "_init", "(", "self", ")", ":", "import", "pyarrow", ".", "parquet", "self", ".", "parquetfile", "=", "pyarrow", ".", "parquet", ".", "ParquetFile", "(", "self", ".", "file", ",", "metadata", "=", "self", ".", "metadata", ",", "common_metadata", "...
https://github.com/scikit-hep/awkward-0.x/blob/dd885bef15814f588b58944d2505296df4aaae0e/awkward0/arrow.py#L532-L535
facebookincubator/OnlineSchemaChange
a63f6973221ba82d07e327af701813bc8c9707ec
core/lib/payload/copy.py
python
CopyPayload.checksum_column_list
(self)
return column_list
A list of non-pk column name suitable for comparing checksum
A list of non-pk column name suitable for comparing checksum
[ "A", "list", "of", "non", "-", "pk", "column", "name", "suitable", "for", "comparing", "checksum" ]
def checksum_column_list(self): """ A list of non-pk column name suitable for comparing checksum """ column_list = [] old_pk_name_list = [c.name for c in self._old_table.primary_key.column_list] for col in self._old_table.column_list: if col.name in old_pk_nam...
[ "def", "checksum_column_list", "(", "self", ")", ":", "column_list", "=", "[", "]", "old_pk_name_list", "=", "[", "c", ".", "name", "for", "c", "in", "self", ".", "_old_table", ".", "primary_key", ".", "column_list", "]", "for", "col", "in", "self", ".",...
https://github.com/facebookincubator/OnlineSchemaChange/blob/a63f6973221ba82d07e327af701813bc8c9707ec/core/lib/payload/copy.py#L227-L243
nipy/nibabel
4703f4d8e32be4cec30e829c2d93ebe54759bb62
nibabel/nifti1.py
python
Nifti1Header.get_qform
(self, coded=False)
return out
Return 4x4 affine matrix from qform parameters in header Parameters ---------- coded : bool, optional If True, return {affine or None}, and qform code. If False, just return affine. {affine or None} means, return None if qform code == 0, and affine otherwis...
Return 4x4 affine matrix from qform parameters in header
[ "Return", "4x4", "affine", "matrix", "from", "qform", "parameters", "in", "header" ]
def get_qform(self, coded=False): """ Return 4x4 affine matrix from qform parameters in header Parameters ---------- coded : bool, optional If True, return {affine or None}, and qform code. If False, just return affine. {affine or None} means, return None if qf...
[ "def", "get_qform", "(", "self", ",", "coded", "=", "False", ")", ":", "hdr", "=", "self", ".", "_structarr", "code", "=", "int", "(", "hdr", "[", "'qform_code'", "]", ")", "if", "code", "==", "0", "and", "coded", ":", "return", "None", ",", "0", ...
https://github.com/nipy/nibabel/blob/4703f4d8e32be4cec30e829c2d93ebe54759bb62/nibabel/nifti1.py#L892-L931
maoschanz/drawing
d4a69258570c7a120817484eaadac1145dedb62d
src/tools/transform_tools/abstract_transform_tool.py
python
AbstractCanvasTool.temp_preview
(self, is_selection, local_dx, local_dy)
Part of the previewing methods shared by all transform tools.
Part of the previewing methods shared by all transform tools.
[ "Part", "of", "the", "previewing", "methods", "shared", "by", "all", "transform", "tools", "." ]
def temp_preview(self, is_selection, local_dx, local_dy): """Part of the previewing methods shared by all transform tools.""" pixbuf = self.get_image().temp_pixbuf if is_selection: cairo_context = self.get_context() cairo_context.set_source_surface(self.get_surface(), 0, 0) cairo_context.paint() x = s...
[ "def", "temp_preview", "(", "self", ",", "is_selection", ",", "local_dx", ",", "local_dy", ")", ":", "pixbuf", "=", "self", ".", "get_image", "(", ")", ".", "temp_pixbuf", "if", "is_selection", ":", "cairo_context", "=", "self", ".", "get_context", "(", ")...
https://github.com/maoschanz/drawing/blob/d4a69258570c7a120817484eaadac1145dedb62d/src/tools/transform_tools/abstract_transform_tool.py#L67-L87
CLUEbenchmark/CLUEPretrainedModels
b384fd41665a8261f9c689c940cf750b3bc21fce
baselines/models/bert/optimization.py
python
AdamWeightDecayOptimizer.__init__
(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-6, exclude_from_weight_decay=None, name="AdamWeightDecayOptimizer")
Constructs a AdamWeightDecayOptimizer.
Constructs a AdamWeightDecayOptimizer.
[ "Constructs", "a", "AdamWeightDecayOptimizer", "." ]
def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-6, exclude_from_weight_decay=None, name="AdamWeightDecayOptimizer"): """Constructs a AdamWeightDecayOptimizer.""" ...
[ "def", "__init__", "(", "self", ",", "learning_rate", ",", "weight_decay_rate", "=", "0.0", ",", "beta_1", "=", "0.9", ",", "beta_2", "=", "0.999", ",", "epsilon", "=", "1e-6", ",", "exclude_from_weight_decay", "=", "None", ",", "name", "=", "\"AdamWeightDec...
https://github.com/CLUEbenchmark/CLUEPretrainedModels/blob/b384fd41665a8261f9c689c940cf750b3bc21fce/baselines/models/bert/optimization.py#L90-L106
pysathq/pysat
07bf3a5a4428d40eca804e7ebdf4f496aadf4213
pysat/_fileio.py
python
FileObject.close
(self)
Close a file pointer.
Close a file pointer.
[ "Close", "a", "file", "pointer", "." ]
def close(self): """ Close a file pointer. """ if self.fp: self.fp.close() self.fp = None if self.fp_extra: self.fp_extra.close() self.fp_extra = None self.ctype = None
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "fp", ":", "self", ".", "fp", ".", "close", "(", ")", "self", ".", "fp", "=", "None", "if", "self", ".", "fp_extra", ":", "self", ".", "fp_extra", ".", "close", "(", ")", "self", ".", ...
https://github.com/pysathq/pysat/blob/07bf3a5a4428d40eca804e7ebdf4f496aadf4213/pysat/_fileio.py#L147-L160
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/asn1crypto-0.24.0/asn1crypto/core.py
python
Boolean.set
(self, value)
Sets the value of the object :param value: True, False or another value that works with bool()
Sets the value of the object
[ "Sets", "the", "value", "of", "the", "object" ]
def set(self, value): """ Sets the value of the object :param value: True, False or another value that works with bool() """ self._native = bool(value) self.contents = b'\x00' if not value else b'\xff' self._header = None if self._trailer != ...
[ "def", "set", "(", "self", ",", "value", ")", ":", "self", ".", "_native", "=", "bool", "(", "value", ")", "self", ".", "contents", "=", "b'\\x00'", "if", "not", "value", "else", "b'\\xff'", "self", ".", "_header", "=", "None", "if", "self", ".", "...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/asn1crypto-0.24.0/asn1crypto/core.py#L1783-L1795
Source-Python-Dev-Team/Source.Python
d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
addons/source-python/packages/site-packages/sphinx/ext/autosummary/generate.py
python
find_autosummary_in_docstring
(name, module=None, filename=None)
return []
Find out what items are documented in the given object's docstring. See `find_autosummary_in_lines`.
Find out what items are documented in the given object's docstring.
[ "Find", "out", "what", "items", "are", "documented", "in", "the", "given", "object", "s", "docstring", "." ]
def find_autosummary_in_docstring(name, module=None, filename=None): """Find out what items are documented in the given object's docstring. See `find_autosummary_in_lines`. """ try: real_name, obj, parent, modname = import_by_name(name) lines = pydoc.getdoc(obj).splitlines() ret...
[ "def", "find_autosummary_in_docstring", "(", "name", ",", "module", "=", "None", ",", "filename", "=", "None", ")", ":", "try", ":", "real_name", ",", "obj", ",", "parent", ",", "modname", "=", "import_by_name", "(", "name", ")", "lines", "=", "pydoc", "...
https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/packages/site-packages/sphinx/ext/autosummary/generate.py#L232-L248
inkandswitch/livebook
93c8d467734787366ad084fc3566bf5cbe249c51
public/pypyjs/modules/tarfile.py
python
TarFile.taropen
(cls, name, mode="r", fileobj=None, **kwargs)
return cls(name, mode, fileobj, **kwargs)
Open uncompressed tar archive name for reading or writing.
Open uncompressed tar archive name for reading or writing.
[ "Open", "uncompressed", "tar", "archive", "name", "for", "reading", "or", "writing", "." ]
def taropen(cls, name, mode="r", fileobj=None, **kwargs): """Open uncompressed tar archive name for reading or writing. """ if mode not in ("r", "a", "w"): raise ValueError("mode must be 'r', 'a' or 'w'") return cls(name, mode, fileobj, **kwargs)
[ "def", "taropen", "(", "cls", ",", "name", ",", "mode", "=", "\"r\"", ",", "fileobj", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "mode", "not", "in", "(", "\"r\"", ",", "\"a\"", ",", "\"w\"", ")", ":", "raise", "ValueError", "(", "\"mo...
https://github.com/inkandswitch/livebook/blob/93c8d467734787366ad084fc3566bf5cbe249c51/public/pypyjs/modules/tarfile.py#L1709-L1714
modin-project/modin
0d9d14e6669be3dd6bb3b72222dbe6a6dffe1bee
modin/experimental/xgboost/xgboost_ray.py
python
create_actors
(num_actors)
return actors
Create ModinXGBoostActors. Parameters ---------- num_actors : int Number of actors to create. Returns ------- list List of pairs (ip, actor).
Create ModinXGBoostActors.
[ "Create", "ModinXGBoostActors", "." ]
def create_actors(num_actors): """ Create ModinXGBoostActors. Parameters ---------- num_actors : int Number of actors to create. Returns ------- list List of pairs (ip, actor). """ num_cpus_per_actor = _get_cpus_per_actor(num_actors) node_ips = [ key...
[ "def", "create_actors", "(", "num_actors", ")", ":", "num_cpus_per_actor", "=", "_get_cpus_per_actor", "(", "num_actors", ")", "node_ips", "=", "[", "key", "for", "key", "in", "ray", ".", "cluster_resources", "(", ")", ".", "keys", "(", ")", "if", "key", "...
https://github.com/modin-project/modin/blob/0d9d14e6669be3dd6bb3b72222dbe6a6dffe1bee/modin/experimental/xgboost/xgboost_ray.py#L255-L285
national-voter-file/national-voter-file
f8bae42418c9307150d10c9e71174defaefa4e60
src/python/national_voter_file/transformers/base.py
python
BaseTransformer.extract_race
(self, input_dict)
Inputs: input_dict: names of columns and corresponding values Outputs: Dictionary with following keys 'RACE'
Inputs: input_dict: names of columns and corresponding values Outputs: Dictionary with following keys 'RACE'
[ "Inputs", ":", "input_dict", ":", "names", "of", "columns", "and", "corresponding", "values", "Outputs", ":", "Dictionary", "with", "following", "keys", "RACE" ]
def extract_race(self, input_dict): """ Inputs: input_dict: names of columns and corresponding values Outputs: Dictionary with following keys 'RACE' """ raise NotImplementedError('Must implement extract_race method')
[ "def", "extract_race", "(", "self", ",", "input_dict", ")", ":", "raise", "NotImplementedError", "(", "'Must implement extract_race method'", ")" ]
https://github.com/national-voter-file/national-voter-file/blob/f8bae42418c9307150d10c9e71174defaefa4e60/src/python/national_voter_file/transformers/base.py#L725-L733
apache/tvm
6eb4ed813ebcdcd9558f0906a1870db8302ff1e0
python/tvm/topi/cuda/conv2d.py
python
conv2d_nchw
(cfg, data, kernel, strides, padding, dilation, out_dtype="float32")
return nn.conv2d_nchw(data, kernel, strides, padding, dilation, out_dtype)
Compute conv2d with NCHW layout
Compute conv2d with NCHW layout
[ "Compute", "conv2d", "with", "NCHW", "layout" ]
def conv2d_nchw(cfg, data, kernel, strides, padding, dilation, out_dtype="float32"): """Compute conv2d with NCHW layout""" return nn.conv2d_nchw(data, kernel, strides, padding, dilation, out_dtype)
[ "def", "conv2d_nchw", "(", "cfg", ",", "data", ",", "kernel", ",", "strides", ",", "padding", ",", "dilation", ",", "out_dtype", "=", "\"float32\"", ")", ":", "return", "nn", ".", "conv2d_nchw", "(", "data", ",", "kernel", ",", "strides", ",", "padding",...
https://github.com/apache/tvm/blob/6eb4ed813ebcdcd9558f0906a1870db8302ff1e0/python/tvm/topi/cuda/conv2d.py#L31-L33
aws-samples/aws-kube-codesuite
ab4e5ce45416b83bffb947ab8d234df5437f4fca
src/kubernetes/client/models/v2alpha1_horizontal_pod_autoscaler_spec.py
python
V2alpha1HorizontalPodAutoscalerSpec.metrics
(self)
return self._metrics
Gets the metrics of this V2alpha1HorizontalPodAutoscalerSpec. metrics contains the specifications for which to use to calculate the desired replica count (the maximum replica count across all metrics will be used). The desired replica count is calculated multiplying the ratio between the target value and the c...
Gets the metrics of this V2alpha1HorizontalPodAutoscalerSpec. metrics contains the specifications for which to use to calculate the desired replica count (the maximum replica count across all metrics will be used). The desired replica count is calculated multiplying the ratio between the target value and the c...
[ "Gets", "the", "metrics", "of", "this", "V2alpha1HorizontalPodAutoscalerSpec", ".", "metrics", "contains", "the", "specifications", "for", "which", "to", "use", "to", "calculate", "the", "desired", "replica", "count", "(", "the", "maximum", "replica", "count", "ac...
def metrics(self): """ Gets the metrics of this V2alpha1HorizontalPodAutoscalerSpec. metrics contains the specifications for which to use to calculate the desired replica count (the maximum replica count across all metrics will be used). The desired replica count is calculated multiplying the r...
[ "def", "metrics", "(", "self", ")", ":", "return", "self", ".", "_metrics" ]
https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v2alpha1_horizontal_pod_autoscaler_spec.py#L78-L86
psychopy/psychopy
01b674094f38d0e0bd51c45a6f66f671d7041696
psychopy/tools/gltools.py
python
SimpleMaterial.diffuseRGB
(self)
return self._diffuseRGB[:3]
Diffuse color of the material.
Diffuse color of the material.
[ "Diffuse", "color", "of", "the", "material", "." ]
def diffuseRGB(self): """Diffuse color of the material.""" return self._diffuseRGB[:3]
[ "def", "diffuseRGB", "(", "self", ")", ":", "return", "self", ".", "_diffuseRGB", "[", ":", "3", "]" ]
https://github.com/psychopy/psychopy/blob/01b674094f38d0e0bd51c45a6f66f671d7041696/psychopy/tools/gltools.py#L3299-L3301
futapi/fut
3792c9eee8f5884f38a02210e649c46c6c7a756d
fut/core.py
python
baseId
(resource_id, return_version=False)
return resource_id
Calculate base id and version from a resource id. :params resource_id: Resource id. :params return_version: (optional) True if You need version, returns (resource_id, version).
Calculate base id and version from a resource id.
[ "Calculate", "base", "id", "and", "version", "from", "a", "resource", "id", "." ]
def baseId(resource_id, return_version=False): """Calculate base id and version from a resource id. :params resource_id: Resource id. :params return_version: (optional) True if You need version, returns (resource_id, version). """ version = 0 resource_id = resource_id + 0xC4000000 # 3288334336...
[ "def", "baseId", "(", "resource_id", ",", "return_version", "=", "False", ")", ":", "version", "=", "0", "resource_id", "=", "resource_id", "+", "0xC4000000", "# 3288334336", "# TODO: version is broken due ^^, needs refactoring", "while", "resource_id", ">", "0x01000000...
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L52-L74
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/pycryptodomex-3.9.7/lib/Cryptodome/Cipher/_mode_siv.py
python
SivMode.verify
(self, received_mac_tag)
Validate the *binary* MAC tag. The caller invokes this function at the very end. This method checks if the decrypted message is indeed valid (that is, if the key is correct) and it has not been tampered with while in transit. :Parameters: received_mac_tag : bytes/byt...
Validate the *binary* MAC tag.
[ "Validate", "the", "*", "binary", "*", "MAC", "tag", "." ]
def verify(self, received_mac_tag): """Validate the *binary* MAC tag. The caller invokes this function at the very end. This method checks if the decrypted message is indeed valid (that is, if the key is correct) and it has not been tampered with while in transit. :Par...
[ "def", "verify", "(", "self", ",", "received_mac_tag", ")", ":", "if", "self", ".", "verify", "not", "in", "self", ".", "_next", ":", "raise", "TypeError", "(", "\"verify() cannot be called\"", "\" when encrypting a message\"", ")", "self", ".", "_next", "=", ...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/pycryptodomex-3.9.7/lib/Cryptodome/Cipher/_mode_siv.py#L226-L257
daoluan/decode-Django
d46a858b45b56de48b0355f50dd9e45402d04cfd
Django-1.5.1/django/contrib/gis/gdal/feature.py
python
Feature.fields
(self)
return [capi.get_field_name(capi.get_field_defn(self._layer._ldefn, i)) for i in xrange(self.num_fields)]
Returns a list of fields in the Feature.
Returns a list of fields in the Feature.
[ "Returns", "a", "list", "of", "fields", "in", "the", "Feature", "." ]
def fields(self): "Returns a list of fields in the Feature." return [capi.get_field_name(capi.get_field_defn(self._layer._ldefn, i)) for i in xrange(self.num_fields)]
[ "def", "fields", "(", "self", ")", ":", "return", "[", "capi", ".", "get_field_name", "(", "capi", ".", "get_field_defn", "(", "self", ".", "_layer", ".", "_ldefn", ",", "i", ")", ")", "for", "i", "in", "xrange", "(", "self", ".", "num_fields", ")", ...
https://github.com/daoluan/decode-Django/blob/d46a858b45b56de48b0355f50dd9e45402d04cfd/Django-1.5.1/django/contrib/gis/gdal/feature.py#L92-L95
robinhood/faust
01b4c0ad8390221db71751d80001b0fd879291e2
faust/types/settings/params.py
python
Param.on_set
(self, settings: Any, value: OT)
What happens when the setting is stored/set.
What happens when the setting is stored/set.
[ "What", "happens", "when", "the", "setting", "is", "stored", "/", "set", "." ]
def on_set(self, settings: Any, value: OT) -> None: """What happens when the setting is stored/set.""" settings.__dict__[self.storage_name] = value assert getattr(settings, self.storage_name) == value
[ "def", "on_set", "(", "self", ",", "settings", ":", "Any", ",", "value", ":", "OT", ")", "->", "None", ":", "settings", ".", "__dict__", "[", "self", ".", "storage_name", "]", "=", "value", "assert", "getattr", "(", "settings", ",", "self", ".", "sto...
https://github.com/robinhood/faust/blob/01b4c0ad8390221db71751d80001b0fd879291e2/faust/types/settings/params.py#L390-L393
QData/TextAttack
33c98738b84e88a46d9f01f17b85ec595863b43a
textattack/metrics/attack_metrics/attack_success_rate.py
python
AttackSuccessRate.calculate
(self, results)
return self.all_metrics
Calculates all metrics related to number of succesful, failed and skipped results in an attack. Args: results (``AttackResult`` objects): Attack results for each instance in dataset
Calculates all metrics related to number of succesful, failed and skipped results in an attack.
[ "Calculates", "all", "metrics", "related", "to", "number", "of", "succesful", "failed", "and", "skipped", "results", "in", "an", "attack", "." ]
def calculate(self, results): """Calculates all metrics related to number of succesful, failed and skipped results in an attack. Args: results (``AttackResult`` objects): Attack results for each instance in dataset """ self.results = results s...
[ "def", "calculate", "(", "self", ",", "results", ")", ":", "self", ".", "results", "=", "results", "self", ".", "total_attacks", "=", "len", "(", "self", ".", "results", ")", "for", "i", ",", "result", "in", "enumerate", "(", "self", ".", "results", ...
https://github.com/QData/TextAttack/blob/33c98738b84e88a46d9f01f17b85ec595863b43a/textattack/metrics/attack_metrics/attack_success_rate.py#L20-L51
fengsp/plan
1f7b212e041599c4399dd2077c9d65b35ea5e260
plan/output.py
python
Output.__init__
(self, output=None)
[]
def __init__(self, output=None): self.output = output
[ "def", "__init__", "(", "self", ",", "output", "=", "None", ")", ":", "self", ".", "output", "=", "output" ]
https://github.com/fengsp/plan/blob/1f7b212e041599c4399dd2077c9d65b35ea5e260/plan/output.py#L19-L20
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/wsgiref/util.py
python
setup_testing_defaults
(environ)
Update 'environ' with trivial defaults for testing purposes This adds various parameters required for WSGI, including HTTP_HOST, SERVER_NAME, SERVER_PORT, REQUEST_METHOD, SCRIPT_NAME, PATH_INFO, and all of the wsgi.* variables. It only supplies default values, and does not replace any existing setting...
Update 'environ' with trivial defaults for testing purposes
[ "Update", "environ", "with", "trivial", "defaults", "for", "testing", "purposes" ]
def setup_testing_defaults(environ): """Update 'environ' with trivial defaults for testing purposes This adds various parameters required for WSGI, including HTTP_HOST, SERVER_NAME, SERVER_PORT, REQUEST_METHOD, SCRIPT_NAME, PATH_INFO, and all of the wsgi.* variables. It only supplies default values, ...
[ "def", "setup_testing_defaults", "(", "environ", ")", ":", "environ", ".", "setdefault", "(", "'SERVER_NAME'", ",", "'127.0.0.1'", ")", "environ", ".", "setdefault", "(", "'SERVER_PROTOCOL'", ",", "'HTTP/1.0'", ")", "environ", ".", "setdefault", "(", "'HTTP_HOST'"...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/wsgiref/util.py#L124-L160
ponyriders/django-amazon-price-monitor
c45d9f48a5bf429bfe696fcd9fc3f41f388bac2d
price_monitor/management/commands/price_monitor_search.py
python
Command.handle
(self, *args, **options)
Searches for a product with the given ASIN.
Searches for a product with the given ASIN.
[ "Searches", "for", "a", "product", "with", "the", "given", "ASIN", "." ]
def handle(self, *args, **options): """Searches for a product with the given ASIN.""" asins = options['asins'] api = ProductAdvertisingAPI() pprint(api.item_lookup(asins), indent=4)
[ "def", "handle", "(", "self", ",", "*", "args", ",", "*", "*", "options", ")", ":", "asins", "=", "options", "[", "'asins'", "]", "api", "=", "ProductAdvertisingAPI", "(", ")", "pprint", "(", "api", ".", "item_lookup", "(", "asins", ")", ",", "indent...
https://github.com/ponyriders/django-amazon-price-monitor/blob/c45d9f48a5bf429bfe696fcd9fc3f41f388bac2d/price_monitor/management/commands/price_monitor_search.py#L23-L27
cool-RR/python_toolbox
cb9ef64b48f1d03275484d707dc5079b6701ad0c
python_toolbox/wx_tools/widgets/third_party/hypertreelist.py
python
HyperTreeList.SetForegroundColour
(self, colour)
return self._main_win.SetForegroundColour(colour)
Changes the foreground colour of L{HyperTreeList}. :param `colour`: the colour to be used as the foreground colour, pass `wx.NullColour` to reset to the default colour. :note: Overridden from `wx.PyControl`.
Changes the foreground colour of L{HyperTreeList}.
[ "Changes", "the", "foreground", "colour", "of", "L", "{", "HyperTreeList", "}", "." ]
def SetForegroundColour(self, colour): """ Changes the foreground colour of L{HyperTreeList}. :param `colour`: the colour to be used as the foreground colour, pass `wx.NullColour` to reset to the default colour. :note: Overridden from `wx.PyControl`. """ if no...
[ "def", "SetForegroundColour", "(", "self", ",", "colour", ")", ":", "if", "not", "self", ".", "_main_win", ":", "return", "False", "return", "self", ".", "_main_win", ".", "SetForegroundColour", "(", "colour", ")" ]
https://github.com/cool-RR/python_toolbox/blob/cb9ef64b48f1d03275484d707dc5079b6701ad0c/python_toolbox/wx_tools/widgets/third_party/hypertreelist.py#L4278-L4291
holoviz/holoviews
cc6b27f01710402fdfee2aeef1507425ca78c91f
holoviews/element/stats.py
python
StatisticsElement.dframe
(self, dimensions=None, multi_index=False)
return super().dframe(dimensions, False)
Convert dimension values to DataFrame. Returns a pandas dataframe of columns along each dimension, either completely flat or indexed by key dimensions. Args: dimensions: Dimensions to return as columns multi_index: Convert key dimensions to (multi-)index Return...
Convert dimension values to DataFrame.
[ "Convert", "dimension", "values", "to", "DataFrame", "." ]
def dframe(self, dimensions=None, multi_index=False): """Convert dimension values to DataFrame. Returns a pandas dataframe of columns along each dimension, either completely flat or indexed by key dimensions. Args: dimensions: Dimensions to return as columns mul...
[ "def", "dframe", "(", "self", ",", "dimensions", "=", "None", ",", "multi_index", "=", "False", ")", ":", "if", "dimensions", ":", "dimensions", "=", "[", "self", ".", "get_dimension", "(", "d", ",", "strict", "=", "True", ")", "for", "d", "in", "dim...
https://github.com/holoviz/holoviews/blob/cc6b27f01710402fdfee2aeef1507425ca78c91f/holoviews/element/stats.py#L113-L136
OpenEndedGroup/Field
4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c
Contents/lib/python/inspect.py
python
getclasstree
(classes, unique=0)
return walktree(roots, children, None)
Arrange the given list of classes into a hierarchy of nested lists. Where a nested list appears, it contains classes derived from the class whose entry immediately precedes the list. Each entry is a 2-tuple containing a class and a tuple of its base classes. If the 'unique' argument is true, exactly ...
Arrange the given list of classes into a hierarchy of nested lists.
[ "Arrange", "the", "given", "list", "of", "classes", "into", "a", "hierarchy", "of", "nested", "lists", "." ]
def getclasstree(classes, unique=0): """Arrange the given list of classes into a hierarchy of nested lists. Where a nested list appears, it contains classes derived from the class whose entry immediately precedes the list. Each entry is a 2-tuple containing a class and a tuple of its base classes. If...
[ "def", "getclasstree", "(", "classes", ",", "unique", "=", "0", ")", ":", "children", "=", "{", "}", "roots", "=", "[", "]", "for", "c", "in", "classes", ":", "if", "c", ".", "__bases__", ":", "for", "parent", "in", "c", ".", "__bases__", ":", "i...
https://github.com/OpenEndedGroup/Field/blob/4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c/Contents/lib/python/inspect.py#L656-L679
Runbook/runbook
7b68622f75ef09f654046f0394540025f3ee7445
src/monitors/checks/cloudflare-http-codes/cloudflare.py
python
del_rec
(email, key, zoneid, logger, recid)
Delete the specified DNS entry
Delete the specified DNS entry
[ "Delete", "the", "specified", "DNS", "entry" ]
def del_rec(email, key, zoneid, logger, recid): ''' Delete the specified DNS entry ''' headers = { 'X-Auth-Email' : email, 'X-Auth-Key' : key, 'Content-Type' : 'application/json' } url = "%s/zones/%s/dns_records/%s" % (baseurl, str(zoneid), str(recid)) try: req = requ...
[ "def", "del_rec", "(", "email", ",", "key", ",", "zoneid", ",", "logger", ",", "recid", ")", ":", "headers", "=", "{", "'X-Auth-Email'", ":", "email", ",", "'X-Auth-Key'", ":", "key", ",", "'Content-Type'", ":", "'application/json'", "}", "url", "=", "\"...
https://github.com/Runbook/runbook/blob/7b68622f75ef09f654046f0394540025f3ee7445/src/monitors/checks/cloudflare-http-codes/cloudflare.py#L140-L152
tensorflow/transform
bc5c3da6aebe9c8780da806e7e8103959c242863
tensorflow_transform/tf_utils.py
python
_num_terms_and_factors
(num_samples, dtype)
return (current_samples, current_pairs, current_triplets, current_quadruplets, l1_factors, l2_factors, l3_factors, l4_factors)
Computes counts and sample multipliers for the given number of samples. Args: num_samples: An integral type scalar `Tensor` containing the number of samples used to compute the L-moments. This must be non-negative. dtype: The dtype of the samples to process. This determines the output `Tensor`s dtype...
Computes counts and sample multipliers for the given number of samples.
[ "Computes", "counts", "and", "sample", "multipliers", "for", "the", "given", "number", "of", "samples", "." ]
def _num_terms_and_factors(num_samples, dtype): """Computes counts and sample multipliers for the given number of samples. Args: num_samples: An integral type scalar `Tensor` containing the number of samples used to compute the L-moments. This must be non-negative. dtype: The dtype of the samples to pr...
[ "def", "_num_terms_and_factors", "(", "num_samples", ",", "dtype", ")", ":", "has_pairs", "=", "tf", ".", "math", ".", "greater", "(", "num_samples", ",", "1", ")", "has_triplets", "=", "tf", ".", "math", ".", "greater", "(", "num_samples", ",", "2", ")"...
https://github.com/tensorflow/transform/blob/bc5c3da6aebe9c8780da806e7e8103959c242863/tensorflow_transform/tf_utils.py#L798-L855
google/deepvariant
9cf1c7b0e2342d013180aa153cba3c9331c9aef7
deepvariant/variant_caller.py
python
VariantCaller.make_gvcfs
(self, allele_count_summaries, include_med_dp=False)
Primary interface function for computing gVCF confidence at a site. Looks at the counts in the provided list of AlleleCountSummary protos and returns properly-formatted Variant protos containing gVCF reference blocks for all sites in allele_count_summaries. The returned Variant has reference_name, star...
Primary interface function for computing gVCF confidence at a site.
[ "Primary", "interface", "function", "for", "computing", "gVCF", "confidence", "at", "a", "site", "." ]
def make_gvcfs(self, allele_count_summaries, include_med_dp=False): """Primary interface function for computing gVCF confidence at a site. Looks at the counts in the provided list of AlleleCountSummary protos and returns properly-formatted Variant protos containing gVCF reference blocks for all sites i...
[ "def", "make_gvcfs", "(", "self", ",", "allele_count_summaries", ",", "include_med_dp", "=", "False", ")", ":", "def", "with_gq_and_likelihoods", "(", "summary_counts", ")", ":", "\"\"\"Returns summary_counts along with GQ and genotype likelihoods.\n\n If the reference base ...
https://github.com/google/deepvariant/blob/9cf1c7b0e2342d013180aa153cba3c9331c9aef7/deepvariant/variant_caller.py#L221-L346
openstack/sahara
c4f4d29847d5bcca83d49ef7e9a3378458462a79
sahara/service/trusts.py
python
delete_trust
(trustee, trust_id)
Delete a trust from a trustee :param trustee: The user to delete the trust from, this is an auth plugin. :param trust_id: The identifier of the trust to delete. :raises DeletionFailed: If the trust cannot be deleted.
Delete a trust from a trustee
[ "Delete", "a", "trust", "from", "a", "trustee" ]
def delete_trust(trustee, trust_id): '''Delete a trust from a trustee :param trustee: The user to delete the trust from, this is an auth plugin. :param trust_id: The identifier of the trust to delete. :raises DeletionFailed: If the trust cannot be deleted. ''' try: client = keystone....
[ "def", "delete_trust", "(", "trustee", ",", "trust_id", ")", ":", "try", ":", "client", "=", "keystone", ".", "client_from_auth", "(", "trustee", ")", "client", ".", "trusts", ".", "delete", "(", "trust_id", ")", "LOG", ".", "debug", "(", "'Deleted trust {...
https://github.com/openstack/sahara/blob/c4f4d29847d5bcca83d49ef7e9a3378458462a79/sahara/service/trusts.py#L102-L120
kupferlauncher/kupfer
1c1e9bcbce05a82f503f68f8b3955c20b02639b3
kupfer/plugin/tracker1.py
python
sparql_escape
(ustr)
return ustr.translate(sparql_escape_table)
Escape unicode string @ustr for insertion into a SPARQL query Implemented to behave like tracker_sparql_escape in libtracker-client
Escape unicode string @ustr for insertion into a SPARQL query
[ "Escape", "unicode", "string", "@ustr", "for", "insertion", "into", "a", "SPARQL", "query" ]
def sparql_escape(ustr): """Escape unicode string @ustr for insertion into a SPARQL query Implemented to behave like tracker_sparql_escape in libtracker-client """ sparql_escape_table = { ord('\t'): r'\t', ord('\n'): r'\n', ord('\r'): r'\r', ord('\b'): r'\b', ord...
[ "def", "sparql_escape", "(", "ustr", ")", ":", "sparql_escape_table", "=", "{", "ord", "(", "'\\t'", ")", ":", "r'\\t'", ",", "ord", "(", "'\\n'", ")", ":", "r'\\n'", ",", "ord", "(", "'\\r'", ")", ":", "r'\\r'", ",", "ord", "(", "'\\b'", ")", ":",...
https://github.com/kupferlauncher/kupfer/blob/1c1e9bcbce05a82f503f68f8b3955c20b02639b3/kupfer/plugin/tracker1.py#L93-L109
robotlearn/pyrobolearn
9cd7c060723fda7d2779fa255ac998c2c82b8436
pyrobolearn/simulators/middlewares/ros.py
python
ROS.get_joint_torques
(self, body_id, joint_ids)
Get the applied torque(s) on the given joint(s). "This is the motor torque applied during the last `step`. Note that this only applies in VELOCITY_CONTROL and POSITION_CONTROL. If you use TORQUE_CONTROL then the applied joint motor torque is exactly what you provide, so there is no need to report it sep...
Get the applied torque(s) on the given joint(s). "This is the motor torque applied during the last `step`. Note that this only applies in VELOCITY_CONTROL and POSITION_CONTROL. If you use TORQUE_CONTROL then the applied joint motor torque is exactly what you provide, so there is no need to report it sep...
[ "Get", "the", "applied", "torque", "(", "s", ")", "on", "the", "given", "joint", "(", "s", ")", ".", "This", "is", "the", "motor", "torque", "applied", "during", "the", "last", "step", ".", "Note", "that", "this", "only", "applies", "in", "VELOCITY_CON...
def get_joint_torques(self, body_id, joint_ids): """ Get the applied torque(s) on the given joint(s). "This is the motor torque applied during the last `step`. Note that this only applies in VELOCITY_CONTROL and POSITION_CONTROL. If you use TORQUE_CONTROL then the applied joint motor tor...
[ "def", "get_joint_torques", "(", "self", ",", "body_id", ",", "joint_ids", ")", ":", "robot", "=", "self", ".", "_robots", ".", "get", "(", "body_id", ")", "if", "robot", "is", "not", "None", ":", "return", "robot", ".", "get_joint_torques", "(", "joint_...
https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/simulators/middlewares/ros.py#L1518-L1536
ucas-vg/TinyBenchmark
bf6b83aa9a149ae15087eed4e9a7283f5cc67603
tiny_benchmark/maskrcnn_benchmark/modeling/rpn/inference.py
python
RPNPostProcessor.forward
(self, anchors, objectness, box_regression, targets=None)
return boxlists
Arguments: anchors: list[list[BoxList]] objectness: list[tensor] box_regression: list[tensor] Returns: boxlists (list[BoxList]): the post-processed anchors, after applying box decoding and NMS
Arguments: anchors: list[list[BoxList]] objectness: list[tensor] box_regression: list[tensor]
[ "Arguments", ":", "anchors", ":", "list", "[", "list", "[", "BoxList", "]]", "objectness", ":", "list", "[", "tensor", "]", "box_regression", ":", "list", "[", "tensor", "]" ]
def forward(self, anchors, objectness, box_regression, targets=None): """ Arguments: anchors: list[list[BoxList]] objectness: list[tensor] box_regression: list[tensor] Returns: boxlists (list[BoxList]): the post-processed anchors, after ...
[ "def", "forward", "(", "self", ",", "anchors", ",", "objectness", ",", "box_regression", ",", "targets", "=", "None", ")", ":", "sampled_boxes", "=", "[", "]", "num_levels", "=", "len", "(", "objectness", ")", "anchors", "=", "list", "(", "zip", "(", "...
https://github.com/ucas-vg/TinyBenchmark/blob/bf6b83aa9a149ae15087eed4e9a7283f5cc67603/tiny_benchmark/maskrcnn_benchmark/modeling/rpn/inference.py#L127-L154
overviewer/Minecraft-Overviewer
7171af587399fee9140eb83fb9b066acd251f57a
overviewer_core/world.py
python
RegionSet.get_chunk
(self, x, z)
return chunk_data
Returns a dictionary object representing the "Level" NBT Compound structure for a chunk given its x, z coordinates. The coordinates given are chunk coordinates. Raises ChunkDoesntExist exception if the given chunk does not exist. The returned dictionary corresponds to the "Level" struct...
Returns a dictionary object representing the "Level" NBT Compound structure for a chunk given its x, z coordinates. The coordinates given are chunk coordinates. Raises ChunkDoesntExist exception if the given chunk does not exist.
[ "Returns", "a", "dictionary", "object", "representing", "the", "Level", "NBT", "Compound", "structure", "for", "a", "chunk", "given", "its", "x", "z", "coordinates", ".", "The", "coordinates", "given", "are", "chunk", "coordinates", ".", "Raises", "ChunkDoesntEx...
def get_chunk(self, x, z): """Returns a dictionary object representing the "Level" NBT Compound structure for a chunk given its x, z coordinates. The coordinates given are chunk coordinates. Raises ChunkDoesntExist exception if the given chunk does not exist. The returned dictio...
[ "def", "get_chunk", "(", "self", ",", "x", ",", "z", ")", ":", "regionfile", "=", "self", ".", "_get_region_path", "(", "x", ",", "z", ")", "if", "regionfile", "is", "None", ":", "raise", "ChunkDoesntExist", "(", "\"Chunk %s,%s doesn't exist (and neither does ...
https://github.com/overviewer/Minecraft-Overviewer/blob/7171af587399fee9140eb83fb9b066acd251f57a/overviewer_core/world.py#L1639-L1812
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/functions/error.py
python
Function_Fresnel_cos.__init__
(self)
r""" The cosine Fresnel integral. It is defined by the integral .. MATH :: \operatorname{C}(x) = \int_0^x \cos\left(\frac{\pi t^2}{2}\right)\, dt for real `x`. Using power series expansions, it can be extended to the domain of complex numbers. See the :wikipedia:`...
r""" The cosine Fresnel integral.
[ "r", "The", "cosine", "Fresnel", "integral", "." ]
def __init__(self): r""" The cosine Fresnel integral. It is defined by the integral .. MATH :: \operatorname{C}(x) = \int_0^x \cos\left(\frac{\pi t^2}{2}\right)\, dt for real `x`. Using power series expansions, it can be extended to the domain of complex n...
[ "def", "__init__", "(", "self", ")", ":", "BuiltinFunction", ".", "__init__", "(", "self", ",", "\"fresnel_cos\"", ",", "nargs", "=", "1", ",", "latex_name", "=", "r\"\\operatorname{C}\"", ",", "conversions", "=", "dict", "(", "maxima", "=", "'fresnel_c'", "...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/functions/error.py#L674-L709
open-mmlab/mmfashion
0e26ab36847684fbf7f736c39df8d518129d9a69
configs/fashion_parsing_segmentation/inference.py
python
inference_detector
(model, img)
return result
Inference image(s) with the detector. Args: model (nn.Module): The loaded detector. imgs (str/ndarray or list[str/ndarray]): Either image files or loaded images. Returns: If imgs is a str, a generator will be returned, otherwise return the detection results directly...
Inference image(s) with the detector.
[ "Inference", "image", "(", "s", ")", "with", "the", "detector", "." ]
def inference_detector(model, img): """Inference image(s) with the detector. Args: model (nn.Module): The loaded detector. imgs (str/ndarray or list[str/ndarray]): Either image files or loaded images. Returns: If imgs is a str, a generator will be returned, otherwise re...
[ "def", "inference_detector", "(", "model", ",", "img", ")", ":", "cfg", "=", "model", ".", "cfg", "device", "=", "next", "(", "model", ".", "parameters", "(", ")", ")", ".", "device", "# model device", "# build the data pipeline", "test_pipeline", "=", "[", ...
https://github.com/open-mmlab/mmfashion/blob/0e26ab36847684fbf7f736c39df8d518129d9a69/configs/fashion_parsing_segmentation/inference.py#L62-L86
leo-editor/leo-editor
383d6776d135ef17d73d935a2f0ecb3ac0e99494
leo/plugins/qt_tree.py
python
LeoQtTree.endEditLabel
(self)
Override LeoTree.endEditLabel. Just end editing of the presently-selected QLineEdit! This will trigger the editingFinished_callback defined in createEditorForItem.
Override LeoTree.endEditLabel.
[ "Override", "LeoTree", ".", "endEditLabel", "." ]
def endEditLabel(self): """ Override LeoTree.endEditLabel. Just end editing of the presently-selected QLineEdit! This will trigger the editingFinished_callback defined in createEditorForItem. """ item = self.getCurrentItem() if not item: return ...
[ "def", "endEditLabel", "(", "self", ")", ":", "item", "=", "self", ".", "getCurrentItem", "(", ")", "if", "not", "item", ":", "return", "e", "=", "self", ".", "getTreeEditorForItem", "(", "item", ")", "if", "not", "e", ":", "return", "# Trigger the end-e...
https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/plugins/qt_tree.py#L1329-L1345
OpenMined/PySyft
f181ca02d307d57bfff9477610358df1a12e3ac9
packages/syft/src/syft/ast/static_attr.py
python
StaticAttribute.solve_get_value
(self)
return getattr(self.parent.object_ref, self.path_and_name.rsplit(".")[-1])
Local execution of the getter function is performed. The `solve_get_value` method executes the getter function on the AST. Raises: ValueError : If `path_and_name` is `None`. Returns: Value of the AST node
Local execution of the getter function is performed.
[ "Local", "execution", "of", "the", "getter", "function", "is", "performed", "." ]
def solve_get_value(self) -> Any: """Local execution of the getter function is performed. The `solve_get_value` method executes the getter function on the AST. Raises: ValueError : If `path_and_name` is `None`. Returns: Value of the AST node """ ...
[ "def", "solve_get_value", "(", "self", ")", "->", "Any", ":", "self", ".", "apply_node_changes", "(", ")", "if", "self", ".", "path_and_name", "is", "None", ":", "raise", "ValueError", "(", "\"path_and_name should not be None\"", ")", "return", "getattr", "(", ...
https://github.com/OpenMined/PySyft/blob/f181ca02d307d57bfff9477610358df1a12e3ac9/packages/syft/src/syft/ast/static_attr.py#L87-L103
python/cpython
e13cdca0f5224ec4e23bdd04bb3120506964bc8b
Lib/tkinter/__init__.py
python
Misc.bind_class
(self, className, sequence=None, func=None, add=None)
return self._bind(('bind', className), sequence, func, add, 0)
Bind to widgets with bindtag CLASSNAME at event SEQUENCE a call of function FUNC. An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will replace the previous function. See bind for the return value.
Bind to widgets with bindtag CLASSNAME at event SEQUENCE a call of function FUNC. An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will replace the previous function. See bind for the return value.
[ "Bind", "to", "widgets", "with", "bindtag", "CLASSNAME", "at", "event", "SEQUENCE", "a", "call", "of", "function", "FUNC", ".", "An", "additional", "boolean", "parameter", "ADD", "specifies", "whether", "FUNC", "will", "be", "called", "additionally", "to", "th...
def bind_class(self, className, sequence=None, func=None, add=None): """Bind to widgets with bindtag CLASSNAME at event SEQUENCE a call of function FUNC. An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether ...
[ "def", "bind_class", "(", "self", ",", "className", ",", "sequence", "=", "None", ",", "func", "=", "None", ",", "add", "=", "None", ")", ":", "return", "self", ".", "_bind", "(", "(", "'bind'", ",", "className", ")", ",", "sequence", ",", "func", ...
https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/tkinter/__init__.py#L1440-L1448
atlas0fd00m/CanCat
be8fb53b0583658aa8226de79f36c56309756778
cancat/envi/__init__.py
python
Emulator.intSubBase
(self, subtrahend, minuend, ssize, msize)
return (ssize, msize, sres, ures, ssubtra, usubtra)
Base for integer subtraction. Segmented such that order of operands can easily be overridden by subclasses. Does not set flags (arch-specific), and doesn't set the dest operand. That's up to the instruction implementation. So we can either do a BUNCH of crazyness with xor and shifting...
Base for integer subtraction. Segmented such that order of operands can easily be overridden by subclasses. Does not set flags (arch-specific), and doesn't set the dest operand. That's up to the instruction implementation.
[ "Base", "for", "integer", "subtraction", ".", "Segmented", "such", "that", "order", "of", "operands", "can", "easily", "be", "overridden", "by", "subclasses", ".", "Does", "not", "set", "flags", "(", "arch", "-", "specific", ")", "and", "doesn", "t", "set"...
def intSubBase(self, subtrahend, minuend, ssize, msize): ''' Base for integer subtraction. Segmented such that order of operands can easily be overridden by subclasses. Does not set flags (arch-specific), and doesn't set the dest operand. That's up to the instruction implementa...
[ "def", "intSubBase", "(", "self", ",", "subtrahend", ",", "minuend", ",", "ssize", ",", "msize", ")", ":", "usubtra", "=", "e_bits", ".", "unsigned", "(", "subtrahend", ",", "ssize", ")", "uminuend", "=", "e_bits", ".", "unsigned", "(", "minuend", ",", ...
https://github.com/atlas0fd00m/CanCat/blob/be8fb53b0583658aa8226de79f36c56309756778/cancat/envi/__init__.py#L787-L809
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-linux/x64/cffi/vengine_gen.py
python
VGenericEngine._loaded_gen_constant
(self, tp, name, module, library)
[]
def _loaded_gen_constant(self, tp, name, module, library): is_int = isinstance(tp, model.PrimitiveType) and tp.is_integer_type() value = self._load_constant(is_int, tp, name, module) setattr(library, name, value) type(library)._cffi_dir.append(name)
[ "def", "_loaded_gen_constant", "(", "self", ",", "tp", ",", "name", ",", "module", ",", "library", ")", ":", "is_int", "=", "isinstance", "(", "tp", ",", "model", ".", "PrimitiveType", ")", "and", "tp", ".", "is_integer_type", "(", ")", "value", "=", "...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/cffi/vengine_gen.py#L465-L469
edfungus/Crouton
ada98b3930192938a48909072b45cb84b945f875
clients/python_clients/venv/lib/python2.7/site-packages/pip/_vendor/distlib/locators.py
python
Locator.convert_url_to_download_info
(self, url, project_name)
return result
See if a URL is a candidate for a download URL for a project (the URL has typically been scraped from an HTML page). If it is, a dictionary is returned with keys "name", "version", "filename" and "url"; otherwise, None is returned.
See if a URL is a candidate for a download URL for a project (the URL has typically been scraped from an HTML page).
[ "See", "if", "a", "URL", "is", "a", "candidate", "for", "a", "download", "URL", "for", "a", "project", "(", "the", "URL", "has", "typically", "been", "scraped", "from", "an", "HTML", "page", ")", "." ]
def convert_url_to_download_info(self, url, project_name): """ See if a URL is a candidate for a download URL for a project (the URL has typically been scraped from an HTML page). If it is, a dictionary is returned with keys "name", "version", "filename" and "url"; otherwise, No...
[ "def", "convert_url_to_download_info", "(", "self", ",", "url", ",", "project_name", ")", ":", "def", "same_project", "(", "name1", ",", "name2", ")", ":", "name1", ",", "name2", "=", "name1", ".", "lower", "(", ")", ",", "name2", ".", "lower", "(", ")...
https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/python_clients/venv/lib/python2.7/site-packages/pip/_vendor/distlib/locators.py#L204-L279
jazzband/django-admin2
7770da8a4931db60326f87d9fa7a15b1ef704c4c
djadmin2/views.py
python
ModelListView._modify_queryset_for_ordering
(self, queryset)
return queryset
[]
def _modify_queryset_for_ordering(self, queryset): ordering = self.model_admin.get_ordering(self.request) if ordering: queryset = queryset.order_by(*ordering) return queryset
[ "def", "_modify_queryset_for_ordering", "(", "self", ",", "queryset", ")", ":", "ordering", "=", "self", ".", "model_admin", ".", "get_ordering", "(", "self", ".", "request", ")", "if", "ordering", ":", "queryset", "=", "queryset", ".", "order_by", "(", "*",...
https://github.com/jazzband/django-admin2/blob/7770da8a4931db60326f87d9fa7a15b1ef704c4c/djadmin2/views.py#L197-L201
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/ntpath.py
python
_get_altsep
(path)
[]
def _get_altsep(path): if isinstance(path, bytes): return b'/' else: return '/'
[ "def", "_get_altsep", "(", "path", ")", ":", "if", "isinstance", "(", "path", ",", "bytes", ")", ":", "return", "b'/'", "else", ":", "return", "'/'" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/ntpath.py#L50-L54
ni/nidaqmx-python
62fc6b48cbbb330fe1bcc9aedadc86610a1269b6
nidaqmx/task.py
python
Task.do_channels
(self)
return self._do_channels
:class:`nidaqmx._task_modules.do_channel_collection.DOChannelCollection`: Gets the collection of digital output channels for this task.
:class:`nidaqmx._task_modules.do_channel_collection.DOChannelCollection`: Gets the collection of digital output channels for this task.
[ ":", "class", ":", "nidaqmx", ".", "_task_modules", ".", "do_channel_collection", ".", "DOChannelCollection", ":", "Gets", "the", "collection", "of", "digital", "output", "channels", "for", "this", "task", "." ]
def do_channels(self): """ :class:`nidaqmx._task_modules.do_channel_collection.DOChannelCollection`: Gets the collection of digital output channels for this task. """ return self._do_channels
[ "def", "do_channels", "(", "self", ")", ":", "return", "self", ".", "_do_channels" ]
https://github.com/ni/nidaqmx-python/blob/62fc6b48cbbb330fe1bcc9aedadc86610a1269b6/nidaqmx/task.py#L319-L324
microsoft/nni
31f11f51249660930824e888af0d4e022823285c
nni/retiarii/graph.py
python
Model.get_nodes_by_label
(self, label: str)
return matched_nodes
Traverse all the nodes to find the matched node(s) with the given label. There could be multiple nodes with the same label. Name space name can uniquely identify a graph or node. NOTE: the implementation does not support the class abstraction
Traverse all the nodes to find the matched node(s) with the given label. There could be multiple nodes with the same label. Name space name can uniquely identify a graph or node.
[ "Traverse", "all", "the", "nodes", "to", "find", "the", "matched", "node", "(", "s", ")", "with", "the", "given", "label", ".", "There", "could", "be", "multiple", "nodes", "with", "the", "same", "label", ".", "Name", "space", "name", "can", "uniquely", ...
def get_nodes_by_label(self, label: str) -> List['Node']: """ Traverse all the nodes to find the matched node(s) with the given label. There could be multiple nodes with the same label. Name space name can uniquely identify a graph or node. NOTE: the implementation does not supp...
[ "def", "get_nodes_by_label", "(", "self", ",", "label", ":", "str", ")", "->", "List", "[", "'Node'", "]", ":", "matched_nodes", "=", "[", "]", "for", "graph", "in", "self", ".", "graphs", ".", "values", "(", ")", ":", "nodes", "=", "graph", ".", "...
https://github.com/microsoft/nni/blob/31f11f51249660930824e888af0d4e022823285c/nni/retiarii/graph.py#L179-L191
raffaele-forte/climber
5530a780446e35b1ce977bae140557050fe0b47c
Exscript/workqueue/Pipeline.py
python
Pipeline.wait
(self)
Waits for all currently running tasks to complete.
Waits for all currently running tasks to complete.
[ "Waits", "for", "all", "currently", "running", "tasks", "to", "complete", "." ]
def wait(self): """ Waits for all currently running tasks to complete. """ with self.condition: while self.working: self.condition.wait()
[ "def", "wait", "(", "self", ")", ":", "with", "self", ".", "condition", ":", "while", "self", ".", "working", ":", "self", ".", "condition", ".", "wait", "(", ")" ]
https://github.com/raffaele-forte/climber/blob/5530a780446e35b1ce977bae140557050fe0b47c/Exscript/workqueue/Pipeline.py#L188-L194
quay/quay
b7d325ed42827db9eda2d9f341cb5a6cdfd155a6
data/model/blob.py
python
initiate_upload
(namespace, repo_name, uuid, location_name, storage_metadata)
return initiate_upload_for_repo(repo, uuid, location_name, storage_metadata)
Initiates a blob upload for the repository with the given namespace and name, in a specific location.
Initiates a blob upload for the repository with the given namespace and name, in a specific location.
[ "Initiates", "a", "blob", "upload", "for", "the", "repository", "with", "the", "given", "namespace", "and", "name", "in", "a", "specific", "location", "." ]
def initiate_upload(namespace, repo_name, uuid, location_name, storage_metadata): """ Initiates a blob upload for the repository with the given namespace and name, in a specific location. """ repo = _basequery.get_existing_repository(namespace, repo_name) return initiate_upload_for_repo(repo, uu...
[ "def", "initiate_upload", "(", "namespace", ",", "repo_name", ",", "uuid", ",", "location_name", ",", "storage_metadata", ")", ":", "repo", "=", "_basequery", ".", "get_existing_repository", "(", "namespace", ",", "repo_name", ")", "return", "initiate_upload_for_rep...
https://github.com/quay/quay/blob/b7d325ed42827db9eda2d9f341cb5a6cdfd155a6/data/model/blob.py#L191-L197
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/matching/combo.py
python
ArrayUnionMatcher.skip_to_quality
(self, minquality)
return skipped
[]
def skip_to_quality(self, minquality): skipped = 0 while self.is_active() and self.block_quality() <= minquality: skipped += 1 self._docnum = self._limit self._read_part() if self.is_active(): self._find_next() return skipped
[ "def", "skip_to_quality", "(", "self", ",", "minquality", ")", ":", "skipped", "=", "0", "while", "self", ".", "is_active", "(", ")", "and", "self", ".", "block_quality", "(", ")", "<=", "minquality", ":", "skipped", "+=", "1", "self", ".", "_docnum", ...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/matching/combo.py#L276-L284
bjmayor/hacker
e3ce2ad74839c2733b27dac6c0f495e0743e1866
venv/lib/python3.5/site-packages/mechanize/_urllib2_fork.py
python
randombytes
(n)
Return n random bytes.
Return n random bytes.
[ "Return", "n", "random", "bytes", "." ]
def randombytes(n): """Return n random bytes.""" # Use /dev/urandom if it is available. Fall back to random module # if not. It might be worthwhile to extend this function to use # other platform-specific mechanisms for getting random bytes. if os.path.exists("/dev/urandom"): f = open("/de...
[ "def", "randombytes", "(", "n", ")", ":", "# Use /dev/urandom if it is available. Fall back to random module", "# if not. It might be worthwhile to extend this function to use", "# other platform-specific mechanisms for getting random bytes.", "if", "os", ".", "path", ".", "exists", ...
https://github.com/bjmayor/hacker/blob/e3ce2ad74839c2733b27dac6c0f495e0743e1866/venv/lib/python3.5/site-packages/mechanize/_urllib2_fork.py#L845-L857
yuanxiaosc/BERT-for-Sequence-Labeling-and-Text-Classification
2a6d2f9c732a362458030643e131540e7d1cdcca
bert/run_classifier.py
python
create_model
(bert_config, is_training, input_ids, input_mask, segment_ids, labels, num_labels, use_one_hot_embeddings)
Creates a classification model.
Creates a classification model.
[ "Creates", "a", "classification", "model", "." ]
def create_model(bert_config, is_training, input_ids, input_mask, segment_ids, labels, num_labels, use_one_hot_embeddings): """Creates a classification model.""" model = modeling.BertModel( config=bert_config, is_training=is_training, input_ids=input_ids, input_mask=input_ma...
[ "def", "create_model", "(", "bert_config", ",", "is_training", ",", "input_ids", ",", "input_mask", ",", "segment_ids", ",", "labels", ",", "num_labels", ",", "use_one_hot_embeddings", ")", ":", "model", "=", "modeling", ".", "BertModel", "(", "config", "=", "...
https://github.com/yuanxiaosc/BERT-for-Sequence-Labeling-and-Text-Classification/blob/2a6d2f9c732a362458030643e131540e7d1cdcca/bert/run_classifier.py#L574-L616
xtiankisutsa/MARA_Framework
ac4ac88bfd38f33ae8780a606ed09ab97177c562
tools/lobotomy/core/include/androguard/androguard/core/analysis/ganalysis.py
python
Graph.nodes_with_selfloops
(self)
return [ n for n,nbrs in self.adj.items() if n in nbrs ]
Return a list of nodes with self loops. A node with a self loop has an edge with both ends adjacent to that node. Returns ------- nodelist : list A list of nodes with self loops. See Also -------- selfloop_edges, number_of_selfloops ...
Return a list of nodes with self loops.
[ "Return", "a", "list", "of", "nodes", "with", "self", "loops", "." ]
def nodes_with_selfloops(self): """Return a list of nodes with self loops. A node with a self loop has an edge with both ends adjacent to that node. Returns ------- nodelist : list A list of nodes with self loops. See Also -------- s...
[ "def", "nodes_with_selfloops", "(", "self", ")", ":", "return", "[", "n", "for", "n", ",", "nbrs", "in", "self", ".", "adj", ".", "items", "(", ")", "if", "n", "in", "nbrs", "]" ]
https://github.com/xtiankisutsa/MARA_Framework/blob/ac4ac88bfd38f33ae8780a606ed09ab97177c562/tools/lobotomy/core/include/androguard/androguard/core/analysis/ganalysis.py#L1529-L1552
espnet/espnet
ea411f3f627b8f101c211e107d0ff7053344ac80
utils/generate_wav_from_fbank.py
python
TimeInvariantMLSAFilter.__call__
(self, y)
return self.mlsa_filter.synthesis(y, coef)
Apply time invariant MLSA filter. Args: y (ndarray): Waveform signal normalized from -1 to 1 (N,). Returns: y (ndarray): Filtered waveform signal normalized from -1 to 1 (N,).
Apply time invariant MLSA filter.
[ "Apply", "time", "invariant", "MLSA", "filter", "." ]
def __call__(self, y): """Apply time invariant MLSA filter. Args: y (ndarray): Waveform signal normalized from -1 to 1 (N,). Returns: y (ndarray): Filtered waveform signal normalized from -1 to 1 (N,). """ # check shape and type assert len(y.sha...
[ "def", "__call__", "(", "self", ",", "y", ")", ":", "# check shape and type", "assert", "len", "(", "y", ".", "shape", ")", "==", "1", "y", "=", "np", ".", "float64", "(", "y", ")", "# get frame number and then replicate mlsa coef", "num_frames", "=", "int",...
https://github.com/espnet/espnet/blob/ea411f3f627b8f101c211e107d0ff7053344ac80/utils/generate_wav_from_fbank.py#L55-L73
tensorflow/models
6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3
research/object_detection/models/faster_rcnn_inception_resnet_v2_feature_extractor.py
python
FasterRCNNInceptionResnetV2FeatureExtractor.restore_from_classification_checkpoint_fn
( self, first_stage_feature_extractor_scope, second_stage_feature_extractor_scope)
return variables_to_restore
Returns a map of variables to load from a foreign checkpoint. Note that this overrides the default implementation in faster_rcnn_meta_arch.FasterRCNNFeatureExtractor which does not work for InceptionResnetV2 checkpoints. TODO(jonathanhuang,rathodv): revisit whether it's possible to force the `Repe...
Returns a map of variables to load from a foreign checkpoint.
[ "Returns", "a", "map", "of", "variables", "to", "load", "from", "a", "foreign", "checkpoint", "." ]
def restore_from_classification_checkpoint_fn( self, first_stage_feature_extractor_scope, second_stage_feature_extractor_scope): """Returns a map of variables to load from a foreign checkpoint. Note that this overrides the default implementation in faster_rcnn_meta_arch.FasterRCNNFeatureE...
[ "def", "restore_from_classification_checkpoint_fn", "(", "self", ",", "first_stage_feature_extractor_scope", ",", "second_stage_feature_extractor_scope", ")", ":", "variables_to_restore", "=", "{", "}", "for", "variable", "in", "variables_helper", ".", "get_global_variables_saf...
https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/research/object_detection/models/faster_rcnn_inception_resnet_v2_feature_extractor.py#L171-L212
marinho/geraldo
868ebdce67176d9b6205cddc92476f642c783fff
site/newsite/site-geraldo/django/forms/formsets.py
python
BaseFormSet._construct_form
(self, i, **kwargs)
return form
Instantiates and returns the i-th form instance in a formset.
Instantiates and returns the i-th form instance in a formset.
[ "Instantiates", "and", "returns", "the", "i", "-", "th", "form", "instance", "in", "a", "formset", "." ]
def _construct_form(self, i, **kwargs): """ Instantiates and returns the i-th form instance in a formset. """ defaults = {'auto_id': self.auto_id, 'prefix': self.add_prefix(i)} if self.data or self.files: defaults['data'] = self.data defaults['files'] = se...
[ "def", "_construct_form", "(", "self", ",", "i", ",", "*", "*", "kwargs", ")", ":", "defaults", "=", "{", "'auto_id'", ":", "self", ".", "auto_id", ",", "'prefix'", ":", "self", ".", "add_prefix", "(", "i", ")", "}", "if", "self", ".", "data", "or"...
https://github.com/marinho/geraldo/blob/868ebdce67176d9b6205cddc92476f642c783fff/site/newsite/site-geraldo/django/forms/formsets.py#L78-L97
IntelPython/sdc
1ebf55c00ef38dfbd401a70b3945e352a5a38b87
sdc/io/np_io.py
python
get_file_size_overload
(fname)
[]
def get_file_size_overload(fname): if fname == string_type: return lambda fname: _get_file_size(fname._data)
[ "def", "get_file_size_overload", "(", "fname", ")", ":", "if", "fname", "==", "string_type", ":", "return", "lambda", "fname", ":", "_get_file_size", "(", "fname", ".", "_data", ")" ]
https://github.com/IntelPython/sdc/blob/1ebf55c00ef38dfbd401a70b3945e352a5a38b87/sdc/io/np_io.py#L179-L181
rspeer/wordfreq
11a3138cea5f46d2229a110c1774ac64a2fcd92b
wordfreq/__init__.py
python
available_languages
(wordlist='best')
return available
Given a wordlist name, return a dictionary of language codes to filenames, representing all the languages in which that wordlist is available.
Given a wordlist name, return a dictionary of language codes to filenames, representing all the languages in which that wordlist is available.
[ "Given", "a", "wordlist", "name", "return", "a", "dictionary", "of", "language", "codes", "to", "filenames", "representing", "all", "the", "languages", "in", "which", "that", "wordlist", "is", "available", "." ]
def available_languages(wordlist='best'): """ Given a wordlist name, return a dictionary of language codes to filenames, representing all the languages in which that wordlist is available. """ if wordlist == 'best': available = available_languages('small') available.update(available_...
[ "def", "available_languages", "(", "wordlist", "=", "'best'", ")", ":", "if", "wordlist", "==", "'best'", ":", "available", "=", "available_languages", "(", "'small'", ")", "available", ".", "update", "(", "available_languages", "(", "'large'", ")", ")", "retu...
https://github.com/rspeer/wordfreq/blob/11a3138cea5f46d2229a110c1774ac64a2fcd92b/wordfreq/__init__.py#L88-L110
titusjan/argos
5a9c31a8a9a2ca825bbf821aa1e685740e3682d7
argos/repo/rtiplugins/hdf5.py
python
H5pyFieldRti.__init__
(self, h5Dataset, nodeName, fileName='', iconColor=ICON_COLOR_UNDEF)
Constructor. The name of the field must be given to the nodeName parameter.
Constructor. The name of the field must be given to the nodeName parameter.
[ "Constructor", ".", "The", "name", "of", "the", "field", "must", "be", "given", "to", "the", "nodeName", "parameter", "." ]
def __init__(self, h5Dataset, nodeName, fileName='', iconColor=ICON_COLOR_UNDEF): """ Constructor. The name of the field must be given to the nodeName parameter. """ super(H5pyFieldRti, self).__init__(nodeName, fileName=fileName, iconColor=iconColor) check_class(h5Dataset, h5...
[ "def", "__init__", "(", "self", ",", "h5Dataset", ",", "nodeName", ",", "fileName", "=", "''", ",", "iconColor", "=", "ICON_COLOR_UNDEF", ")", ":", "super", "(", "H5pyFieldRti", ",", "self", ")", ".", "__init__", "(", "nodeName", ",", "fileName", "=", "f...
https://github.com/titusjan/argos/blob/5a9c31a8a9a2ca825bbf821aa1e685740e3682d7/argos/repo/rtiplugins/hdf5.py#L232-L238
reddit/baseplate.py
f29bd1ce0f1ec4962f65ecd5a2b016b1cd4fd5ac
baseplate/__init__.py
python
Baseplate.configure_context
(self, context_spec: Dict[str, Any])
Add a number of objects to each request's context object. Configure and attach multiple clients to the :py:class:`~baseplate.RequestContext` in one place. This takes a full configuration spec like :py:func:`baseplate.lib.config.parse_config` and will attach the specified structure onto ...
Add a number of objects to each request's context object.
[ "Add", "a", "number", "of", "objects", "to", "each", "request", "s", "context", "object", "." ]
def configure_context(self, context_spec: Dict[str, Any]) -> None: """Add a number of objects to each request's context object. Configure and attach multiple clients to the :py:class:`~baseplate.RequestContext` in one place. This takes a full configuration spec like :py:func:`baseplate....
[ "def", "configure_context", "(", "self", ",", "context_spec", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "None", ":", "cfg", "=", "config", ".", "parse_config", "(", "self", ".", "_app_config", ",", "context_spec", ")", "self", ".", "_context_c...
https://github.com/reddit/baseplate.py/blob/f29bd1ce0f1ec4962f65ecd5a2b016b1cd4fd5ac/baseplate/__init__.py#L379-L414
xiangyue9607/BioNEV
bf685e44f665bcb3afbde78fb1be0a966aa9c2bc
src/bionev/GAE/initialization.py
python
weight_variable_glorot
(input_dim, output_dim, name="")
return tf.Variable(initial, name=name)
Create a weight variable with Glorot & Bengio (AISTATS 2010) initialization.
Create a weight variable with Glorot & Bengio (AISTATS 2010) initialization.
[ "Create", "a", "weight", "variable", "with", "Glorot", "&", "Bengio", "(", "AISTATS", "2010", ")", "initialization", "." ]
def weight_variable_glorot(input_dim, output_dim, name=""): """Create a weight variable with Glorot & Bengio (AISTATS 2010) initialization. """ init_range = np.sqrt(6.0 / (input_dim + output_dim)) initial = tf.random_uniform([input_dim, output_dim], minval=-init_range, ...
[ "def", "weight_variable_glorot", "(", "input_dim", ",", "output_dim", ",", "name", "=", "\"\"", ")", ":", "init_range", "=", "np", ".", "sqrt", "(", "6.0", "/", "(", "input_dim", "+", "output_dim", ")", ")", "initial", "=", "tf", ".", "random_uniform", "...
https://github.com/xiangyue9607/BioNEV/blob/bf685e44f665bcb3afbde78fb1be0a966aa9c2bc/src/bionev/GAE/initialization.py#L7-L14
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/wagtail/wagtailadmin/views/home.py
python
RecentEditsPanel.__init__
(self, request)
[]
def __init__(self, request): self.request = request # Last n edited pages edit_count = getattr(settings, 'WAGTAILADMIN_RECENT_EDITS_LIMIT', 5) if connection.vendor == 'mysql': # MySQL can't handle the subselect created by the ORM version - # it fails with "This v...
[ "def", "__init__", "(", "self", ",", "request", ")", ":", "self", ".", "request", "=", "request", "# Last n edited pages", "edit_count", "=", "getattr", "(", "settings", ",", "'WAGTAILADMIN_RECENT_EDITS_LIMIT'", ",", "5", ")", "if", "connection", ".", "vendor", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail/wagtailadmin/views/home.py#L55-L85
yaqwsx/KiKit
14de7f60b64e6d03ce638e78d279915d09bb9ac7
kikit/plugin/__init__.py
python
enable
(all, plugin)
Enable given plugins. Specify none to disable all plugins.
Enable given plugins. Specify none to disable all plugins.
[ "Enable", "given", "plugins", ".", "Specify", "none", "to", "disable", "all", "plugins", "." ]
def enable(all, plugin): """ Enable given plugins. Specify none to disable all plugins. """ if all: plugins = availablePlugins else: pNames = [x[0] for x in availablePlugins] for p in plugin: if p not in pNames: sys.exit(f"Unknown plugin '{p}'. See...
[ "def", "enable", "(", "all", ",", "plugin", ")", ":", "if", "all", ":", "plugins", "=", "availablePlugins", "else", ":", "pNames", "=", "[", "x", "[", "0", "]", "for", "x", "in", "availablePlugins", "]", "for", "p", "in", "plugin", ":", "if", "p", ...
https://github.com/yaqwsx/KiKit/blob/14de7f60b64e6d03ce638e78d279915d09bb9ac7/kikit/plugin/__init__.py#L99-L120
adipandas/multi-object-tracker
8b327f6b15ee1af3c5e5ea74fbe162a1a8bc7b29
motrackers/utils/misc.py
python
iou
(bbox1, bbox2)
return iou_
Calculates the intersection-over-union of two bounding boxes. Source: https://github.com/bochinski/iou-tracker/blob/master/util.py Args: bbox1 (numpy.array or list[floats]): Bounding box of length 4 containing ``(x-top-left, y-top-left, x-bottom-right, y-bottom-right)``. bbox2 (nump...
Calculates the intersection-over-union of two bounding boxes. Source: https://github.com/bochinski/iou-tracker/blob/master/util.py
[ "Calculates", "the", "intersection", "-", "over", "-", "union", "of", "two", "bounding", "boxes", ".", "Source", ":", "https", ":", "//", "github", ".", "com", "/", "bochinski", "/", "iou", "-", "tracker", "/", "blob", "/", "master", "/", "util", ".", ...
def iou(bbox1, bbox2): """ Calculates the intersection-over-union of two bounding boxes. Source: https://github.com/bochinski/iou-tracker/blob/master/util.py Args: bbox1 (numpy.array or list[floats]): Bounding box of length 4 containing ``(x-top-left, y-top-left, x-bottom-right, y-b...
[ "def", "iou", "(", "bbox1", ",", "bbox2", ")", ":", "bbox1", "=", "[", "float", "(", "x", ")", "for", "x", "in", "bbox1", "]", "bbox2", "=", "[", "float", "(", "x", ")", "for", "x", "in", "bbox2", "]", "(", "x0_1", ",", "y0_1", ",", "x1_1", ...
https://github.com/adipandas/multi-object-tracker/blob/8b327f6b15ee1af3c5e5ea74fbe162a1a8bc7b29/motrackers/utils/misc.py#L37-L75
zhufz/nlp_research
b435319858520edcca7c0320dca3e0013087c276
tasks/task_base.py
python
TaskBase.read_data
(self)
you can load data in different formats for different task
you can load data in different formats for different task
[ "you", "can", "load", "data", "in", "different", "formats", "for", "different", "task" ]
def read_data(self): """you can load data in different formats for different task """ raise NotImplementedError('subclasses must override read_data()!')
[ "def", "read_data", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "'subclasses must override read_data()!'", ")" ]
https://github.com/zhufz/nlp_research/blob/b435319858520edcca7c0320dca3e0013087c276/tasks/task_base.py#L18-L21
TurboGears/tg2
f40a82d016d70ce560002593b4bb8f83b57f87b3
tg/configuration/utils.py
python
get_partial_dict
(prefix, dictionary, container_type=dict, ignore_missing=False, pop_keys=False)
Given a dictionary and a prefix, return a Bunch, with just items that start with prefix The returned dictionary will have 'prefix.' stripped so:: get_partial_dict('prefix', {'prefix.xyz':1, 'prefix.zyx':2, 'xy':3}) would return:: {'xyz':1,'zyx':2}
Given a dictionary and a prefix, return a Bunch, with just items that start with prefix
[ "Given", "a", "dictionary", "and", "a", "prefix", "return", "a", "Bunch", "with", "just", "items", "that", "start", "with", "prefix" ]
def get_partial_dict(prefix, dictionary, container_type=dict, ignore_missing=False, pop_keys=False): """Given a dictionary and a prefix, return a Bunch, with just items that start with prefix The returned dictionary will have 'prefix.' stripped so:: get_partial_dict('prefix',...
[ "def", "get_partial_dict", "(", "prefix", ",", "dictionary", ",", "container_type", "=", "dict", ",", "ignore_missing", "=", "False", ",", "pop_keys", "=", "False", ")", ":", "match", "=", "prefix", "+", "\".\"", "n", "=", "len", "(", "match", ")", "new_...
https://github.com/TurboGears/tg2/blob/f40a82d016d70ce560002593b4bb8f83b57f87b3/tg/configuration/utils.py#L52-L83
brainiak/brainiak
ee093597c6c11597b0a59e95b48d2118e40394a5
brainiak/factoranalysis/htfa.py
python
HTFA._mse_converged
(self)
Check convergence based on mean squared difference between prior and posterior Returns ------- converged : boolean Whether the parameter estimation converged. mse : float Mean squared error between prior and posterior.
Check convergence based on mean squared difference between prior and posterior
[ "Check", "convergence", "based", "on", "mean", "squared", "difference", "between", "prior", "and", "posterior" ]
def _mse_converged(self): """Check convergence based on mean squared difference between prior and posterior Returns ------- converged : boolean Whether the parameter estimation converged. mse : float Mean squared error between prior and post...
[ "def", "_mse_converged", "(", "self", ")", ":", "prior", "=", "self", ".", "global_prior_", "[", "0", ":", "self", ".", "prior_size", "]", "posterior", "=", "self", ".", "global_posterior_", "[", "0", ":", "self", ".", "prior_size", "]", "mse", "=", "m...
https://github.com/brainiak/brainiak/blob/ee093597c6c11597b0a59e95b48d2118e40394a5/brainiak/factoranalysis/htfa.py#L222-L244
microsoft/nni
31f11f51249660930824e888af0d4e022823285c
nni/experiment/experiment.py
python
Experiment.view
(experiment_id: str, port: int = 8080, non_blocking: bool = False)
View a stopped experiment. Parameters ---------- experiment_id The stopped experiment id. port The port of web UI. non_blocking If false, run in the foreground. If true, run in the background.
View a stopped experiment.
[ "View", "a", "stopped", "experiment", "." ]
def view(experiment_id: str, port: int = 8080, non_blocking: bool = False): """ View a stopped experiment. Parameters ---------- experiment_id The stopped experiment id. port The port of web UI. non_blocking If false, run in th...
[ "def", "view", "(", "experiment_id", ":", "str", ",", "port", ":", "int", "=", "8080", ",", "non_blocking", ":", "bool", "=", "False", ")", ":", "experiment", "=", "Experiment", ".", "_view", "(", "experiment_id", ")", "experiment", ".", "start", "(", ...
https://github.com/microsoft/nni/blob/31f11f51249660930824e888af0d4e022823285c/nni/experiment/experiment.py#L234-L258
bbfamily/abu
2de85ae57923a720dac99a545b4f856f6b87304b
abupy/IndicatorBu/ABuNDAtr.py
python
_calc_atr_from_pd
(high, low, close, time_period=14)
return atr.values
通过atr公式手动计算atr :param high: 最高价格序列,pd.Series或者np.array :param low: 最低价格序列,pd.Series或者np.array :param close: 收盘价格序列,pd.Series或者np.array :param time_period: atr的N值默认值14,int :return: atr值序列,np.array对象
通过atr公式手动计算atr :param high: 最高价格序列,pd.Series或者np.array :param low: 最低价格序列,pd.Series或者np.array :param close: 收盘价格序列,pd.Series或者np.array :param time_period: atr的N值默认值14,int :return: atr值序列,np.array对象
[ "通过atr公式手动计算atr", ":", "param", "high", ":", "最高价格序列,pd", ".", "Series或者np", ".", "array", ":", "param", "low", ":", "最低价格序列,pd", ".", "Series或者np", ".", "array", ":", "param", "close", ":", "收盘价格序列,pd", ".", "Series或者np", ".", "array", ":", "param", "time...
def _calc_atr_from_pd(high, low, close, time_period=14): """ 通过atr公式手动计算atr :param high: 最高价格序列,pd.Series或者np.array :param low: 最低价格序列,pd.Series或者np.array :param close: 收盘价格序列,pd.Series或者np.array :param time_period: atr的N值默认值14,int :return: atr值序列,np.array对象 """ if isinstance(close, ...
[ "def", "_calc_atr_from_pd", "(", "high", ",", "low", ",", "close", ",", "time_period", "=", "14", ")", ":", "if", "isinstance", "(", "close", ",", "pd", ".", "Series", ")", ":", "# shift(1)构成昨天收盘价格序列", "pre_close", "=", "close", ".", "shift", "(", "1", ...
https://github.com/bbfamily/abu/blob/2de85ae57923a720dac99a545b4f856f6b87304b/abupy/IndicatorBu/ABuNDAtr.py#L51-L85
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/packaging/_structures.py
python
Infinity.__ne__
(self, other)
return not isinstance(other, self.__class__)
[]
def __ne__(self, other): return not isinstance(other, self.__class__)
[ "def", "__ne__", "(", "self", ",", "other", ")", ":", "return", "not", "isinstance", "(", "other", ",", "self", ".", "__class__", ")" ]
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/packaging/_structures.py#L24-L25
samuelclay/NewsBlur
2c45209df01a1566ea105e04d499367f32ac9ad2
utils/image_functions.py
python
ImageOps.image_size
(cls, url, headers=None)
return None, None
[]
def image_size(cls, url, headers=None): if not headers: headers = {} req = urllib.request.Request(url, data=None, headers=headers) file = urllib.request.urlopen(req) size = file.headers.get("content-length") if size: size = int(size) p = ImageFile.Parser() ...
[ "def", "image_size", "(", "cls", ",", "url", ",", "headers", "=", "None", ")", ":", "if", "not", "headers", ":", "headers", "=", "{", "}", "req", "=", "urllib", ".", "request", ".", "Request", "(", "url", ",", "data", "=", "None", ",", "headers", ...
https://github.com/samuelclay/NewsBlur/blob/2c45209df01a1566ea105e04d499367f32ac9ad2/utils/image_functions.py#L75-L92
xiaoyufenfei/Efficient-Segmentation-Networks
0f0c32e7af3463d381cb184a158ff60e16f7fb9a
model/FPENet.py
python
conv3x3
(in_planes, out_planes, stride=1, padding=1, dilation=1, groups=1, bias=False)
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=padding, dilation=dilation, groups=groups,bias=bias)
3x3 convolution with padding
3x3 convolution with padding
[ "3x3", "convolution", "with", "padding" ]
def conv3x3(in_planes, out_planes, stride=1, padding=1, dilation=1, groups=1, bias=False): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=padding, dilation=dilation, groups=groups,bias=bias)
[ "def", "conv3x3", "(", "in_planes", ",", "out_planes", ",", "stride", "=", "1", ",", "padding", "=", "1", ",", "dilation", "=", "1", ",", "groups", "=", "1", ",", "bias", "=", "False", ")", ":", "return", "nn", ".", "Conv2d", "(", "in_planes", ",",...
https://github.com/xiaoyufenfei/Efficient-Segmentation-Networks/blob/0f0c32e7af3463d381cb184a158ff60e16f7fb9a/model/FPENet.py#L16-L19
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
lib/pyparsing/core.py
python
ParserElement.__invert__
(self)
return NotAny(self)
Implementation of ``~`` operator - returns :class:`NotAny`
Implementation of ``~`` operator - returns :class:`NotAny`
[ "Implementation", "of", "~", "operator", "-", "returns", ":", "class", ":", "NotAny" ]
def __invert__(self): """ Implementation of ``~`` operator - returns :class:`NotAny` """ return NotAny(self)
[ "def", "__invert__", "(", "self", ")", ":", "return", "NotAny", "(", "self", ")" ]
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/pyparsing/core.py#L1599-L1603
sabri-zaki/EasY_HaCk
2a39ac384dd0d6fc51c0dd22e8d38cece683fdb9
.modules/.metagoofil/hachoir_metadata/image.py
python
computeComprRate
(meta, compr_size)
Compute image compression rate. Skip size of color palette, focus on image pixels. Original size is width x height x bpp. Compressed size is an argument (in bits). Set "compr_data" with a string like "1.52x".
Compute image compression rate. Skip size of color palette, focus on image pixels. Original size is width x height x bpp. Compressed size is an argument (in bits).
[ "Compute", "image", "compression", "rate", ".", "Skip", "size", "of", "color", "palette", "focus", "on", "image", "pixels", ".", "Original", "size", "is", "width", "x", "height", "x", "bpp", ".", "Compressed", "size", "is", "an", "argument", "(", "in", "...
def computeComprRate(meta, compr_size): """ Compute image compression rate. Skip size of color palette, focus on image pixels. Original size is width x height x bpp. Compressed size is an argument (in bits). Set "compr_data" with a string like "1.52x". """ if not meta.has("width") \ or ...
[ "def", "computeComprRate", "(", "meta", ",", "compr_size", ")", ":", "if", "not", "meta", ".", "has", "(", "\"width\"", ")", "or", "not", "meta", ".", "has", "(", "\"height\"", ")", "or", "not", "meta", ".", "has", "(", "\"bits_per_pixel\"", ")", ":", ...
https://github.com/sabri-zaki/EasY_HaCk/blob/2a39ac384dd0d6fc51c0dd22e8d38cece683fdb9/.modules/.metagoofil/hachoir_metadata/image.py#L11-L26
qiucheng025/zao-
3a5edf3607b3a523f95746bc69b688090c76d89a
tools/lib_alignments/jobs_manual.py
python
MouseHandler.check_click_location
(self, pt_x, pt_y)
Check whether the point clicked is within an existing bounding box and set face_id
Check whether the point clicked is within an existing bounding box and set face_id
[ "Check", "whether", "the", "point", "clicked", "is", "within", "an", "existing", "bounding", "box", "and", "set", "face_id" ]
def check_click_location(self, pt_x, pt_y): """ Check whether the point clicked is within an existing bounding box and set face_id """ frame = self.media["frame_id"] alignments = self.alignments.get_faces_in_frame(frame) scale = self.interface.get_frame_scaling() pt_x...
[ "def", "check_click_location", "(", "self", ",", "pt_x", ",", "pt_y", ")", ":", "frame", "=", "self", ".", "media", "[", "\"frame_id\"", "]", "alignments", "=", "self", ".", "alignments", ".", "get_faces_in_frame", "(", "frame", ")", "scale", "=", "self", ...
https://github.com/qiucheng025/zao-/blob/3a5edf3607b3a523f95746bc69b688090c76d89a/tools/lib_alignments/jobs_manual.py#L899-L916
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/Ubuntu_13/paramiko/rsakey.py
python
RSAKey.__init__
(self, msg=None, data=None, filename=None, password=None, vals=None, file_obj=None)
[]
def __init__(self, msg=None, data=None, filename=None, password=None, vals=None, file_obj=None): self.n = None self.e = None self.d = None self.p = None self.q = None if file_obj is not None: self._from_private_key(file_obj, password) return ...
[ "def", "__init__", "(", "self", ",", "msg", "=", "None", ",", "data", "=", "None", ",", "filename", "=", "None", ",", "password", "=", "None", ",", "vals", "=", "None", ",", "file_obj", "=", "None", ")", ":", "self", ".", "n", "=", "None", "self"...
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Ubuntu_13/paramiko/rsakey.py#L41-L64
kkroening/ffmpeg-python
f3079726fae7b7b71e4175f79c5eeaddc1d205fb
ffmpeg/_filters.py
python
asplit
(stream)
return FilterNode(stream, asplit.__name__)
[]
def asplit(stream): return FilterNode(stream, asplit.__name__)
[ "def", "asplit", "(", "stream", ")", ":", "return", "FilterNode", "(", "stream", ",", "asplit", ".", "__name__", ")" ]
https://github.com/kkroening/ffmpeg-python/blob/f3079726fae7b7b71e4175f79c5eeaddc1d205fb/ffmpeg/_filters.py#L66-L67
pypa/pip
7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4
src/pip/_vendor/rich/progress.py
python
Progress.get_renderable
(self)
return renderable
Get a renderable for the progress display.
Get a renderable for the progress display.
[ "Get", "a", "renderable", "for", "the", "progress", "display", "." ]
def get_renderable(self) -> RenderableType: """Get a renderable for the progress display.""" renderable = Group(*self.get_renderables()) return renderable
[ "def", "get_renderable", "(", "self", ")", "->", "RenderableType", ":", "renderable", "=", "Group", "(", "*", "self", ".", "get_renderables", "(", ")", ")", "return", "renderable" ]
https://github.com/pypa/pip/blob/7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4/src/pip/_vendor/rich/progress.py#L868-L871
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/export/models/new.py
python
ExportInstance.wrap
(cls, data)
return export_instance
[]
def wrap(cls, data): from corehq.apps.export.views.utils import clean_odata_columns export_instance = super(ExportInstance, cls).wrap(data) if export_instance.is_odata_config: clean_odata_columns(export_instance) return export_instance
[ "def", "wrap", "(", "cls", ",", "data", ")", ":", "from", "corehq", ".", "apps", ".", "export", ".", "views", ".", "utils", "import", "clean_odata_columns", "export_instance", "=", "super", "(", "ExportInstance", ",", "cls", ")", ".", "wrap", "(", "data"...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/export/models/new.py#L793-L798
fake-name/ReadableWebProxy
ed5c7abe38706acc2684a1e6cd80242a03c5f010
WebMirror/management/DbManage.py
python
exposed_reset_walk_epochs
()
Set the walk epoch for all rows in the table to zero Useful when the walk interval has been changed to a larger value, as this can cause the next rewalk to be pushed far out into the future and block re-fetching for far longer then intended
Set the walk epoch for all rows in the table to zero
[ "Set", "the", "walk", "epoch", "for", "all", "rows", "in", "the", "table", "to", "zero" ]
def exposed_reset_walk_epochs(): ''' Set the walk epoch for all rows in the table to zero Useful when the walk interval has been changed to a larger value, as this can cause the next rewalk to be pushed far out into the future and block re-fetching for far longer then intended ''' commit_interval = 10000 st...
[ "def", "exposed_reset_walk_epochs", "(", ")", ":", "commit_interval", "=", "10000", "step", "=", "50000", "commit_every", "=", "30", "last_commit", "=", "time", ".", "time", "(", ")", "with", "db", ".", "session_context", "(", "override_timeout_ms", "=", "60",...
https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/DbManage.py#L289-L368
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-darwin/x64/pyasn1/type/univ.py
python
SequenceAndSetBase.getNameByPosition
(self, idx)
[]
def getNameByPosition(self, idx): if self._componentTypeLen: return self.componentType[idx].name
[ "def", "getNameByPosition", "(", "self", ",", "idx", ")", ":", "if", "self", ".", "_componentTypeLen", ":", "return", "self", ".", "componentType", "[", "idx", "]", ".", "name" ]
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/pyasn1/type/univ.py#L2494-L2496
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/library/oc_configmap.py
python
Yedit.exists
(self, path, value)
return entry == value
check if value exists at path
check if value exists at path
[ "check", "if", "value", "exists", "at", "path" ]
def exists(self, path, value): ''' check if value exists at path''' try: entry = Yedit.get_entry(self.yaml_dict, path, self.separator) except KeyError: entry = None if isinstance(entry, list): if value in entry: return True ...
[ "def", "exists", "(", "self", ",", "path", ",", "value", ")", ":", "try", ":", "entry", "=", "Yedit", ".", "get_entry", "(", "self", ".", "yaml_dict", ",", "path", ",", "self", ".", "separator", ")", "except", "KeyError", ":", "entry", "=", "None", ...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/library/oc_configmap.py#L498-L523
autotest/autotest
4614ae5f550cc888267b9a419e4b90deb54f8fae
client/shared/utils.py
python
configure
(extra=None, configure='./configure')
Run configure passing in the correct host, build, and target options. :param extra: extra command line arguments to pass to configure :param configure: which configure script to use
Run configure passing in the correct host, build, and target options.
[ "Run", "configure", "passing", "in", "the", "correct", "host", "build", "and", "target", "options", "." ]
def configure(extra=None, configure='./configure'): """ Run configure passing in the correct host, build, and target options. :param extra: extra command line arguments to pass to configure :param configure: which configure script to use """ args = [] if 'CHOST' in os.environ: args....
[ "def", "configure", "(", "extra", "=", "None", ",", "configure", "=", "'./configure'", ")", ":", "args", "=", "[", "]", "if", "'CHOST'", "in", "os", ".", "environ", ":", "args", ".", "append", "(", "'--host='", "+", "os", ".", "environ", "[", "'CHOST...
https://github.com/autotest/autotest/blob/4614ae5f550cc888267b9a419e4b90deb54f8fae/client/shared/utils.py#L2029-L2046
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
modules/pygsm/scanlinux.py
python
scan
()
return glob.glob('/dev/ttyS*') + glob.glob('/dev/ttyUSB*')
scan for available ports. return a list of device names.
scan for available ports. return a list of device names.
[ "scan", "for", "available", "ports", ".", "return", "a", "list", "of", "device", "names", "." ]
def scan(): """scan for available ports. return a list of device names.""" return glob.glob('/dev/ttyS*') + glob.glob('/dev/ttyUSB*')
[ "def", "scan", "(", ")", ":", "return", "glob", ".", "glob", "(", "'/dev/ttyS*'", ")", "+", "glob", ".", "glob", "(", "'/dev/ttyUSB*'", ")" ]
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/pygsm/scanlinux.py#L13-L15
kennethreitz/bake
3ee3d0ba2e7134035de01b803058e0d6033c00b2
bake/bakefile.py
python
Bakefile.iter_root_source_lines
(self)
The source of the 'root level' of the Bashfile.
The source of the 'root level' of the Bashfile.
[ "The", "source", "of", "the", "root", "level", "of", "the", "Bashfile", "." ]
def iter_root_source_lines(self): """The source of the 'root level' of the Bashfile.""" task_active = False for line in self.source_lines: if line: if self._is_declaration_line(line): task_active = True else: if ...
[ "def", "iter_root_source_lines", "(", "self", ")", ":", "task_active", "=", "False", "for", "line", "in", "self", ".", "source_lines", ":", "if", "line", ":", "if", "self", ".", "_is_declaration_line", "(", "line", ")", ":", "task_active", "=", "True", "el...
https://github.com/kennethreitz/bake/blob/3ee3d0ba2e7134035de01b803058e0d6033c00b2/bake/bakefile.py#L220-L232
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/models/m2m_100/tokenization_m2m_100.py
python
M2M100Tokenizer.save_vocabulary
(self, save_directory: str, filename_prefix: Optional[str] = None)
return (str(vocab_save_path), str(spm_save_path))
[]
def save_vocabulary(self, save_directory: str, filename_prefix: Optional[str] = None) -> Tuple[str]: save_dir = Path(save_directory) assert save_dir.is_dir(), f"{save_directory} should be a directory" vocab_save_path = save_dir / ( (filename_prefix + "-" if filename_prefix else "") +...
[ "def", "save_vocabulary", "(", "self", ",", "save_directory", ":", "str", ",", "filename_prefix", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "Tuple", "[", "str", "]", ":", "save_dir", "=", "Path", "(", "save_directory", ")", "assert", "sav...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/m2m_100/tokenization_m2m_100.py#L303-L318