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
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/django/middleware/csrf.py
python
_get_failure_view
()
return get_callable(settings.CSRF_FAILURE_VIEW)
Returns the view to be used for CSRF rejections
Returns the view to be used for CSRF rejections
[ "Returns", "the", "view", "to", "be", "used", "for", "CSRF", "rejections" ]
def _get_failure_view(): """ Returns the view to be used for CSRF rejections """ return get_callable(settings.CSRF_FAILURE_VIEW)
[ "def", "_get_failure_view", "(", ")", ":", "return", "get_callable", "(", "settings", ".", "CSRF_FAILURE_VIEW", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/middleware/csrf.py#L37-L41
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
asdl/typed_arith_parse.py
python
MakeShellParserSpec
()
return spec
Create a parser. Compare the code below with this table of C operator precedence: http://en.cppreference.com/w/c/language/operator_precedence
Create a parser.
[ "Create", "a", "parser", "." ]
def MakeShellParserSpec(): # type: () -> tdop.ParserSpec """ Create a parser. Compare the code below with this table of C operator precedence: http://en.cppreference.com/w/c/language/operator_precedence """ spec = tdop.ParserSpec() spec.Left(31, LeftIncDec, ['++', '--']) spec.Left(31, LeftFuncCall, ...
[ "def", "MakeShellParserSpec", "(", ")", ":", "# type: () -> tdop.ParserSpec", "spec", "=", "tdop", ".", "ParserSpec", "(", ")", "spec", ".", "Left", "(", "31", ",", "LeftIncDec", ",", "[", "'++'", ",", "'--'", "]", ")", "spec", ".", "Left", "(", "31", ...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/asdl/typed_arith_parse.py#L157-L207
jina-ai/jina
c77a492fcd5adba0fc3de5347bea83dd4e7d8087
jina/peapods/peas/jinad.py
python
JinaDPea.wait_for_ready_or_shutdown
( timeout: Optional[float], ready_or_shutdown_event: Union['multiprocessing.Event', 'threading.Event'], ctrl_address: str, **kwargs, )
return False
Check if the runtime has successfully started :param timeout: The time to wait before readiness or failure is determined :param ctrl_address: the address where the control message needs to be sent :param ready_or_shutdown_event: the multiprocessing event to detect if the process failed or is re...
Check if the runtime has successfully started
[ "Check", "if", "the", "runtime", "has", "successfully", "started" ]
def wait_for_ready_or_shutdown( timeout: Optional[float], ready_or_shutdown_event: Union['multiprocessing.Event', 'threading.Event'], ctrl_address: str, **kwargs, ): """ Check if the runtime has successfully started :param timeout: The time to wait before rea...
[ "def", "wait_for_ready_or_shutdown", "(", "timeout", ":", "Optional", "[", "float", "]", ",", "ready_or_shutdown_event", ":", "Union", "[", "'multiprocessing.Event'", ",", "'threading.Event'", "]", ",", "ctrl_address", ":", "str", ",", "*", "*", "kwargs", ",", "...
https://github.com/jina-ai/jina/blob/c77a492fcd5adba0fc3de5347bea83dd4e7d8087/jina/peapods/peas/jinad.py#L241-L266
pySTEPS/pysteps
bd9478538249e1d64036a721ceb934085d6e1da9
pysteps/verification/detcatscores.py
python
det_cat_fct_accum
(contab, pred, obs)
Accumulate the frequency of "yes" and "no" forecasts and observations in the contingency table. Parameters ---------- contab: dict A contingency table object initialized with pysteps.verification.detcatscores.det_cat_fct_init. pred: array_like Array of predictions. NaNs are igno...
Accumulate the frequency of "yes" and "no" forecasts and observations in the contingency table.
[ "Accumulate", "the", "frequency", "of", "yes", "and", "no", "forecasts", "and", "observations", "in", "the", "contingency", "table", "." ]
def det_cat_fct_accum(contab, pred, obs): """Accumulate the frequency of "yes" and "no" forecasts and observations in the contingency table. Parameters ---------- contab: dict A contingency table object initialized with pysteps.verification.detcatscores.det_cat_fct_init. pred: array...
[ "def", "det_cat_fct_accum", "(", "contab", ",", "pred", ",", "obs", ")", ":", "pred", "=", "np", ".", "asarray", "(", "pred", ".", "copy", "(", ")", ")", "obs", "=", "np", ".", "asarray", "(", "obs", ".", "copy", "(", ")", ")", "axis", "=", "tu...
https://github.com/pySTEPS/pysteps/blob/bd9478538249e1d64036a721ceb934085d6e1da9/pysteps/verification/detcatscores.py#L143-L214
Abjad/abjad
d0646dfbe83db3dc5ab268f76a0950712b87b7fd
abjad/parsers/parser.py
python
LilyPondSyntacticalDefinition.p_script_abbreviation__Chr46
(self, p)
script_abbreviation : '.
script_abbreviation : '.
[ "script_abbreviation", ":", "." ]
def p_script_abbreviation__Chr46(self, p): "script_abbreviation : '.'" kind = self.client._current_module["dashDot"]["articulation-type"] p[0] = Articulation(kind)
[ "def", "p_script_abbreviation__Chr46", "(", "self", ",", "p", ")", ":", "kind", "=", "self", ".", "client", ".", "_current_module", "[", "\"dashDot\"", "]", "[", "\"articulation-type\"", "]", "p", "[", "0", "]", "=", "Articulation", "(", "kind", ")" ]
https://github.com/Abjad/abjad/blob/d0646dfbe83db3dc5ab268f76a0950712b87b7fd/abjad/parsers/parser.py#L6309-L6312
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/root_system/integrable_representations.py
python
IntegrableRepresentation._freudenthal_roots_imaginary
(self, nu)
r""" Iterate over the set of imaginary roots `\alpha \in \Delta^+` in ``self`` such that `\nu - \alpha \in Q^+`. INPUT: - ``nu`` -- an element in `Q` EXAMPLES:: sage: Lambda = RootSystem(['B',3,1]).weight_lattice(extended=true).fundamental_weights() sa...
r""" Iterate over the set of imaginary roots `\alpha \in \Delta^+` in ``self`` such that `\nu - \alpha \in Q^+`.
[ "r", "Iterate", "over", "the", "set", "of", "imaginary", "roots", "\\", "alpha", "\\", "in", "\\", "Delta^", "+", "in", "self", "such", "that", "\\", "nu", "-", "\\", "alpha", "\\", "in", "Q^", "+", "." ]
def _freudenthal_roots_imaginary(self, nu): r""" Iterate over the set of imaginary roots `\alpha \in \Delta^+` in ``self`` such that `\nu - \alpha \in Q^+`. INPUT: - ``nu`` -- an element in `Q` EXAMPLES:: sage: Lambda = RootSystem(['B',3,1]).weight_lattice...
[ "def", "_freudenthal_roots_imaginary", "(", "self", ",", "nu", ")", ":", "l", "=", "self", ".", "_from_weight_helper", "(", "nu", ")", "kp", "=", "min", "(", "l", "[", "i", "]", "//", "self", ".", "_a", "[", "i", "]", "for", "i", "in", "self", "....
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/root_system/integrable_representations.py#L607-L628
pyg-team/pytorch_geometric
b920e9a3a64e22c8356be55301c88444ff051cae
examples/glnn.py
python
test_student
()
return accs
[]
def test_student(): mlp.eval() pred = mlp(data.x).argmax(dim=-1) accs = [] for _, mask in data('train_mask', 'val_mask', 'test_mask'): accs.append(int((pred[mask] == data.y[mask]).sum()) / int(mask.sum())) return accs
[ "def", "test_student", "(", ")", ":", "mlp", ".", "eval", "(", ")", "pred", "=", "mlp", "(", "data", ".", "x", ")", ".", "argmax", "(", "dim", "=", "-", "1", ")", "accs", "=", "[", "]", "for", "_", ",", "mask", "in", "data", "(", "'train_mask...
https://github.com/pyg-team/pytorch_geometric/blob/b920e9a3a64e22c8356be55301c88444ff051cae/examples/glnn.py#L79-L85
bjmayor/hacker
e3ce2ad74839c2733b27dac6c0f495e0743e1866
venv/lib/python3.5/site-packages/pkg_resources/_vendor/pyparsing.py
python
lineno
(loc,strg)
return strg.count("\n",0,loc) + 1
Returns current line number within a string, counting newlines as line separators. The first line is number 1. Note: the default parsing behavior is to expand tabs in the input string before starting the parsing process. See L{I{ParserElement.parseString}<ParserElement.parseString>} for more information o...
Returns current line number within a string, counting newlines as line separators. The first line is number 1.
[ "Returns", "current", "line", "number", "within", "a", "string", "counting", "newlines", "as", "line", "separators", ".", "The", "first", "line", "is", "number", "1", "." ]
def lineno(loc,strg): """Returns current line number within a string, counting newlines as line separators. The first line is number 1. Note: the default parsing behavior is to expand tabs in the input string before starting the parsing process. See L{I{ParserElement.parseString}<ParserElement.parseStrin...
[ "def", "lineno", "(", "loc", ",", "strg", ")", ":", "return", "strg", ".", "count", "(", "\"\\n\"", ",", "0", ",", "loc", ")", "+", "1" ]
https://github.com/bjmayor/hacker/blob/e3ce2ad74839c2733b27dac6c0f495e0743e1866/venv/lib/python3.5/site-packages/pkg_resources/_vendor/pyparsing.py#L958-L968
citronneur/rdpy
cef16a9f64d836a3221a344ca7d571644280d829
rdpy/protocol/rdp/rdp.py
python
RDPClientController.setAutologon
(self)
@summary: enable autologon
[]
def setAutologon(self): """ @summary: enable autologon """ self._secLayer._info.flag |= sec.InfoFlag.INFO_AUTOLOGON
[ "def", "setAutologon", "(", "self", ")", ":", "self", ".", "_secLayer", ".", "_info", ".", "flag", "|=", "sec", ".", "InfoFlag", ".", "INFO_AUTOLOGON" ]
https://github.com/citronneur/rdpy/blob/cef16a9f64d836a3221a344ca7d571644280d829/rdpy/protocol/rdp/rdp.py#L124-L128
leo-editor/leo-editor
383d6776d135ef17d73d935a2f0ecb3ac0e99494
leo/core/leoImport.py
python
LeoImportCommands.importFreeMind
(self, files)
Import a list of .mm.html files exported from FreeMind: http://freemind.sourceforge.net/wiki/index.php/Main_Page
Import a list of .mm.html files exported from FreeMind: http://freemind.sourceforge.net/wiki/index.php/Main_Page
[ "Import", "a", "list", "of", ".", "mm", ".", "html", "files", "exported", "from", "FreeMind", ":", "http", ":", "//", "freemind", ".", "sourceforge", ".", "net", "/", "wiki", "/", "index", ".", "php", "/", "Main_Page" ]
def importFreeMind(self, files): """ Import a list of .mm.html files exported from FreeMind: http://freemind.sourceforge.net/wiki/index.php/Main_Page """ FreeMindImporter(self.c).import_files(files)
[ "def", "importFreeMind", "(", "self", ",", "files", ")", ":", "FreeMindImporter", "(", "self", ".", "c", ")", ".", "import_files", "(", "files", ")" ]
https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/core/leoImport.py#L851-L856
savon-noir/python-libnmap
8f442747a7a16969309d6f7653ad1b13a3a99bae
libnmap/objects/os.py
python
NmapOSFingerprint.ports_used
(self)
return self.__ports_used
Return an array of OSFPPortUsed object with the ports used to perform the os fingerprint. This dict might contain another dict embedded containing the ports_reason values.
Return an array of OSFPPortUsed object with the ports used to perform the os fingerprint. This dict might contain another dict embedded containing the ports_reason values.
[ "Return", "an", "array", "of", "OSFPPortUsed", "object", "with", "the", "ports", "used", "to", "perform", "the", "os", "fingerprint", ".", "This", "dict", "might", "contain", "another", "dict", "embedded", "containing", "the", "ports_reason", "values", "." ]
def ports_used(self): """ Return an array of OSFPPortUsed object with the ports used to perform the os fingerprint. This dict might contain another dict embedded containing the ports_reason values. """ return self.__ports_used
[ "def", "ports_used", "(", "self", ")", ":", "return", "self", ".", "__ports_used" ]
https://github.com/savon-noir/python-libnmap/blob/8f442747a7a16969309d6f7653ad1b13a3a99bae/libnmap/objects/os.py#L370-L376
ambujraj/hacktoberfest2018
53df2cac8b3404261131a873352ec4f2ffa3544d
MAC_changer/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/distlib/_backport/shutil.py
python
make_archive
(base_name, format, root_dir=None, base_dir=None, verbose=0, dry_run=0, owner=None, group=None, logger=None)
return filename
Create an archive file (eg. zip or tar). 'base_name' is the name of the file to create, minus any format-specific extension; 'format' is the archive format: one of "zip", "tar", "bztar" or "gztar". 'root_dir' is a directory that will be the root directory of the archive; ie. we typically chdir int...
Create an archive file (eg. zip or tar).
[ "Create", "an", "archive", "file", "(", "eg", ".", "zip", "or", "tar", ")", "." ]
def make_archive(base_name, format, root_dir=None, base_dir=None, verbose=0, dry_run=0, owner=None, group=None, logger=None): """Create an archive file (eg. zip or tar). 'base_name' is the name of the file to create, minus any format-specific extension; 'format' is the archive format: one ...
[ "def", "make_archive", "(", "base_name", ",", "format", ",", "root_dir", "=", "None", ",", "base_dir", "=", "None", ",", "verbose", "=", "0", ",", "dry_run", "=", "0", ",", "owner", "=", "None", ",", "group", "=", "None", ",", "logger", "=", "None", ...
https://github.com/ambujraj/hacktoberfest2018/blob/53df2cac8b3404261131a873352ec4f2ffa3544d/MAC_changer/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/distlib/_backport/shutil.py#L544-L596
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/tkinter/ttk.py
python
Widget.__init__
(self, master, widgetname, kw=None)
Constructs a Ttk Widget with the parent master. STANDARD OPTIONS class, cursor, takefocus, style SCROLLABLE WIDGET OPTIONS xscrollcommand, yscrollcommand LABEL WIDGET OPTIONS text, textvariable, underline, image, compound, width WIDGET STATES ...
Constructs a Ttk Widget with the parent master.
[ "Constructs", "a", "Ttk", "Widget", "with", "the", "parent", "master", "." ]
def __init__(self, master, widgetname, kw=None): """Constructs a Ttk Widget with the parent master. STANDARD OPTIONS class, cursor, takefocus, style SCROLLABLE WIDGET OPTIONS xscrollcommand, yscrollcommand LABEL WIDGET OPTIONS text, textvariable,...
[ "def", "__init__", "(", "self", ",", "master", ",", "widgetname", ",", "kw", "=", "None", ")", ":", "master", "=", "setup_master", "(", "master", ")", "if", "not", "getattr", "(", "master", ",", "'_tile_loaded'", ",", "False", ")", ":", "# Load tile now,...
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/tkinter/ttk.py#L529-L553
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/pip/commands/search.py
python
transform_hits
(hits)
return list(packages.values())
The list from pypi is really a list of versions. We want a list of packages with the list of versions stored inline. This converts the list from pypi into one we can use.
The list from pypi is really a list of versions. We want a list of packages with the list of versions stored inline. This converts the list from pypi into one we can use.
[ "The", "list", "from", "pypi", "is", "really", "a", "list", "of", "versions", ".", "We", "want", "a", "list", "of", "packages", "with", "the", "list", "of", "versions", "stored", "inline", ".", "This", "converts", "the", "list", "from", "pypi", "into", ...
def transform_hits(hits): """ The list from pypi is really a list of versions. We want a list of packages with the list of versions stored inline. This converts the list from pypi into one we can use. """ packages = OrderedDict() for hit in hits: name = hit['name'] summary = ...
[ "def", "transform_hits", "(", "hits", ")", ":", "packages", "=", "OrderedDict", "(", ")", "for", "hit", "in", "hits", ":", "name", "=", "hit", "[", "'name'", "]", "summary", "=", "hit", "[", "'summary'", "]", "version", "=", "hit", "[", "'version'", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/pip/commands/search.py#L66-L91
iopsgroup/imoocc
de810eb6d4c1697b7139305925a5b0ba21225f3f
scanhosts/modules/paramiko1_9/transport.py
python
Transport.get_log_channel
(self)
return self.log_name
Return the channel name used for this transport's logging. @return: channel name. @rtype: str @since: 1.2
Return the channel name used for this transport's logging.
[ "Return", "the", "channel", "name", "used", "for", "this", "transport", "s", "logging", "." ]
def get_log_channel(self): """ Return the channel name used for this transport's logging. @return: channel name. @rtype: str @since: 1.2 """ return self.log_name
[ "def", "get_log_channel", "(", "self", ")", ":", "return", "self", ".", "log_name" ]
https://github.com/iopsgroup/imoocc/blob/de810eb6d4c1697b7139305925a5b0ba21225f3f/scanhosts/modules/paramiko1_9/transport.py#L1324-L1333
hyde/hyde
7f415402cc3e007a746eb2b5bc102281fdb415bd
hyde/site.py
python
RootNode.add_resource
(self, a_file)
return resource
Adds a file to the parent node. Also adds to to the hashtable of path to resource associations for quick lookup.
Adds a file to the parent node. Also adds to to the hashtable of path to resource associations for quick lookup.
[ "Adds", "a", "file", "to", "the", "parent", "node", ".", "Also", "adds", "to", "to", "the", "hashtable", "of", "path", "to", "resource", "associations", "for", "quick", "lookup", "." ]
def add_resource(self, a_file): """ Adds a file to the parent node. Also adds to to the hashtable of path to resource associations for quick lookup. """ afile = File(a_file) resource = self.resource_from_path(afile) if resource: logger.debug("Resour...
[ "def", "add_resource", "(", "self", ",", "a_file", ")", ":", "afile", "=", "File", "(", "a_file", ")", "resource", "=", "self", ".", "resource_from_path", "(", "afile", ")", "if", "resource", ":", "logger", ".", "debug", "(", "\"Resource exists at [%s]\"", ...
https://github.com/hyde/hyde/blob/7f415402cc3e007a746eb2b5bc102281fdb415bd/hyde/site.py#L331-L361
allegroai/clearml
5953dc6eefadcdfcc2bdbb6a0da32be58823a5af
clearml/utilities/pigar/utils.py
python
compare_version
(version1, version2)
return 0
Compare version number, such as 1.1.1 and 1.1b2.0.
Compare version number, such as 1.1.1 and 1.1b2.0.
[ "Compare", "version", "number", "such", "as", "1", ".", "1", ".", "1", "and", "1", ".", "1b2", ".", "0", "." ]
def compare_version(version1, version2): """Compare version number, such as 1.1.1 and 1.1b2.0.""" v1, v2 = list(), list() for item in version1.split('.'): if item.isdigit(): v1.append(int(item)) else: v1.extend([i for i in _group_alnum(item)]) for item in version...
[ "def", "compare_version", "(", "version1", ",", "version2", ")", ":", "v1", ",", "v2", "=", "list", "(", ")", ",", "list", "(", ")", "for", "item", "in", "version1", ".", "split", "(", "'.'", ")", ":", "if", "item", ".", "isdigit", "(", ")", ":",...
https://github.com/allegroai/clearml/blob/5953dc6eefadcdfcc2bdbb6a0da32be58823a5af/clearml/utilities/pigar/utils.py#L68-L94
python/cpython
e13cdca0f5224ec4e23bdd04bb3120506964bc8b
Lib/numbers.py
python
Integral.__rxor__
(self, other)
other ^ self
other ^ self
[ "other", "^", "self" ]
def __rxor__(self, other): """other ^ self""" raise NotImplementedError
[ "def", "__rxor__", "(", "self", ",", "other", ")", ":", "raise", "NotImplementedError" ]
https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/numbers.py#L359-L361
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/mailbox.py
python
_sync_flush
(f)
Ensure changes to file f are physically on disk.
Ensure changes to file f are physically on disk.
[ "Ensure", "changes", "to", "file", "f", "are", "physically", "on", "disk", "." ]
def _sync_flush(f): """Ensure changes to file f are physically on disk.""" f.flush() if hasattr(os, 'fsync'): os.fsync(f.fileno())
[ "def", "_sync_flush", "(", "f", ")", ":", "f", ".", "flush", "(", ")", "if", "hasattr", "(", "os", ",", "'fsync'", ")", ":", "os", ".", "fsync", "(", "f", ".", "fileno", "(", ")", ")" ]
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/mailbox.py#L2141-L2145
UKPLab/coling2018-graph-neural-networks-question-answering
389558d6570195debea570834944507de4f21d65
questionanswering/train_model.py
python
train
(config_file_path, seed, gpuid, model_description, experiment_tag)
[]
def train(config_file_path, seed, gpuid, model_description, experiment_tag): config, logger = config_utils.load_config(config_file_path, seed, gpuid) if "training" not in config: print("Training parameters not in the config file!") sys.exit() results_logger = None if 'log.results' in co...
[ "def", "train", "(", "config_file_path", ",", "seed", ",", "gpuid", ",", "model_description", ",", "experiment_tag", ")", ":", "config", ",", "logger", "=", "config_utils", ".", "load_config", "(", "config_file_path", ",", "seed", ",", "gpuid", ")", "if", "\...
https://github.com/UKPLab/coling2018-graph-neural-networks-question-answering/blob/389558d6570195debea570834944507de4f21d65/questionanswering/train_model.py#L30-L174
pwnieexpress/pwn_plug_sources
1a23324f5dc2c3de20f9c810269b6a29b2758cad
src/set/src/core/scapy.py
python
autorun_commands
(cmds,my_globals=None,verb=0)
return _
[]
def autorun_commands(cmds,my_globals=None,verb=0): sv = conf.verb import __builtin__ try: if my_globals is None: my_globals = globals() conf.verb = verb interp = ScapyAutorunInterpreter(my_globals) cmd = "" cmds = cmds.splitlines() cmds.append("") ...
[ "def", "autorun_commands", "(", "cmds", ",", "my_globals", "=", "None", ",", "verb", "=", "0", ")", ":", "sv", "=", "conf", ".", "verb", "import", "__builtin__", "try", ":", "if", "my_globals", "is", "None", ":", "my_globals", "=", "globals", "(", ")",...
https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/set/src/core/scapy.py#L13187-L13218
getpelican/pelican
0384c9bc071dd82b9dbe29fb73521587311bfc84
pelican/generators.py
python
ArticlesGenerator.generate_period_archives
(self, write)
Generate per-year, per-month, and per-day archives.
Generate per-year, per-month, and per-day archives.
[ "Generate", "per", "-", "year", "per", "-", "month", "and", "per", "-", "day", "archives", "." ]
def generate_period_archives(self, write): """Generate per-year, per-month, and per-day archives.""" try: template = self.get_template('period_archives') except PelicanTemplateNotFound: template = self.get_template('archives') period_save_as = { 'year...
[ "def", "generate_period_archives", "(", "self", ",", "write", ")", ":", "try", ":", "template", "=", "self", ".", "get_template", "(", "'period_archives'", ")", "except", "PelicanTemplateNotFound", ":", "template", "=", "self", ".", "get_template", "(", "'archiv...
https://github.com/getpelican/pelican/blob/0384c9bc071dd82b9dbe29fb73521587311bfc84/pelican/generators.py#L479-L543
Unidata/MetPy
1153590f397ae23adfea66c4adb0a206872fa0ad
src/metpy/plots/wx_symbols.py
python
CodePointMapping._safe_pop
(lst)
return lst.pop(0) if lst else None
Safely pop from a list. Returns None if list empty.
Safely pop from a list.
[ "Safely", "pop", "from", "a", "list", "." ]
def _safe_pop(lst): """Safely pop from a list. Returns None if list empty. """ return lst.pop(0) if lst else None
[ "def", "_safe_pop", "(", "lst", ")", ":", "return", "lst", ".", "pop", "(", "0", ")", "if", "lst", "else", "None" ]
https://github.com/Unidata/MetPy/blob/1153590f397ae23adfea66c4adb0a206872fa0ad/src/metpy/plots/wx_symbols.py#L118-L124
sopel-irc/sopel
787baa6e39f9dad57d94600c92e10761c41b21ef
sopel/irc/backends.py
python
AsynchatBackend.collect_incoming_data
(self, data)
Try to make sense of incoming data as Unicode. :param bytes data: the incoming raw bytes The incoming line is discarded (and thus ignored) if guessing the text encoding and decoding it fails.
Try to make sense of incoming data as Unicode.
[ "Try", "to", "make", "sense", "of", "incoming", "data", "as", "Unicode", "." ]
def collect_incoming_data(self, data): """Try to make sense of incoming data as Unicode. :param bytes data: the incoming raw bytes The incoming line is discarded (and thus ignored) if guessing the text encoding and decoding it fails. """ data += self.get_terminator() ...
[ "def", "collect_incoming_data", "(", "self", ",", "data", ")", ":", "data", "+=", "self", ".", "get_terminator", "(", ")", "# We can't trust clients to pass valid Unicode.", "try", ":", "data", "=", "str", "(", "data", ",", "encoding", "=", "'utf-8'", ")", "ex...
https://github.com/sopel-irc/sopel/blob/787baa6e39f9dad57d94600c92e10761c41b21ef/sopel/irc/backends.py#L191-L223
quay/quay
b7d325ed42827db9eda2d9f341cb5a6cdfd155a6
notifications/notificationmethod.py
python
NotificationMethod.perform
(self, notification_obj, event_handler, notification_data)
Performs the notification method. notification_obj: The notification namedtuple. event_handler: The NotificationEvent handler. notification_data: The dict of notification data placed in the queue.
Performs the notification method.
[ "Performs", "the", "notification", "method", "." ]
def perform(self, notification_obj, event_handler, notification_data): """ Performs the notification method. notification_obj: The notification namedtuple. event_handler: The NotificationEvent handler. notification_data: The dict of notification data placed in the queue. ...
[ "def", "perform", "(", "self", ",", "notification_obj", ",", "event_handler", ",", "notification_data", ")", ":", "raise", "NotImplementedError" ]
https://github.com/quay/quay/blob/b7d325ed42827db9eda2d9f341cb5a6cdfd155a6/notifications/notificationmethod.py#L67-L75
EdwardTyantov/ultrasound-nerve-segmentation
84a614009cdce6426628b7dbf159fc5a445fe302
submission.py
python
run_length_enc
(label)
return ' '.join([str(r) for r in res])
[]
def run_length_enc(label): from itertools import chain x = label.transpose().flatten() y = np.where(x > 0)[0] if len(y) < 10: # consider as empty return '' z = np.where(np.diff(y) > 1)[0] start = np.insert(y[z+1], 0, y[0]) end = np.append(y[z], y[-1]) length = end - start re...
[ "def", "run_length_enc", "(", "label", ")", ":", "from", "itertools", "import", "chain", "x", "=", "label", ".", "transpose", "(", ")", ".", "flatten", "(", ")", "y", "=", "np", ".", "where", "(", "x", ">", "0", ")", "[", "0", "]", "if", "len", ...
https://github.com/EdwardTyantov/ultrasound-nerve-segmentation/blob/84a614009cdce6426628b7dbf159fc5a445fe302/submission.py#L15-L27
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/integrate/_ivp/common.py
python
num_jac
(fun, t, y, f, threshold, factor, sparsity=None)
Finite differences Jacobian approximation tailored for ODE solvers. This function computes finite difference approximation to the Jacobian matrix of `fun` with respect to `y` using forward differences. The Jacobian matrix has shape (n, n) and its element (i, j) is equal to ``d f_i / d y_j``. A spe...
Finite differences Jacobian approximation tailored for ODE solvers.
[ "Finite", "differences", "Jacobian", "approximation", "tailored", "for", "ODE", "solvers", "." ]
def num_jac(fun, t, y, f, threshold, factor, sparsity=None): """Finite differences Jacobian approximation tailored for ODE solvers. This function computes finite difference approximation to the Jacobian matrix of `fun` with respect to `y` using forward differences. The Jacobian matrix has shape (n, n) ...
[ "def", "num_jac", "(", "fun", ",", "t", ",", "y", ",", "f", ",", "threshold", ",", "factor", ",", "sparsity", "=", "None", ")", ":", "y", "=", "np", ".", "asarray", "(", "y", ")", "n", "=", "y", ".", "shape", "[", "0", "]", "if", "n", "==",...
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/integrate/_ivp/common.py#L248-L320
spulec/moto
a688c0032596a7dfef122b69a08f2bec3be2e481
moto/kms/responses.py
python
KmsResponse.tag_resource
(self)
return json.dumps(result)
https://docs.aws.amazon.com/kms/latest/APIReference/API_TagResource.html
https://docs.aws.amazon.com/kms/latest/APIReference/API_TagResource.html
[ "https", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "kms", "/", "latest", "/", "APIReference", "/", "API_TagResource", ".", "html" ]
def tag_resource(self): """https://docs.aws.amazon.com/kms/latest/APIReference/API_TagResource.html""" key_id = self.parameters.get("KeyId") tags = self.parameters.get("Tags") self._validate_cmk_id(key_id) result = self.kms_backend.tag_resource(key_id, tags) return json...
[ "def", "tag_resource", "(", "self", ")", ":", "key_id", "=", "self", ".", "parameters", ".", "get", "(", "\"KeyId\"", ")", "tags", "=", "self", ".", "parameters", ".", "get", "(", "\"Tags\"", ")", "self", ".", "_validate_cmk_id", "(", "key_id", ")", "r...
https://github.com/spulec/moto/blob/a688c0032596a7dfef122b69a08f2bec3be2e481/moto/kms/responses.py#L130-L138
aichallenge/aichallenge
4237971f22767ef7f439d297e4e6ad7c458415dc
setup/worker_setup.py
python
install_dmd
(download_base)
Install the D language
Install the D language
[ "Install", "the", "D", "language" ]
def install_dmd(download_base): """ Install the D language """ if os.path.exists("/usr/bin/dmd"): return install_apt_packages("gcc-multilib") with CD("/root"): run_cmd("curl '%s/dmd.deb' > dmd.deb" % (download_base,)) run_cmd("dpkg -i dmd.deb")
[ "def", "install_dmd", "(", "download_base", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "\"/usr/bin/dmd\"", ")", ":", "return", "install_apt_packages", "(", "\"gcc-multilib\"", ")", "with", "CD", "(", "\"/root\"", ")", ":", "run_cmd", "(", "\"curl...
https://github.com/aichallenge/aichallenge/blob/4237971f22767ef7f439d297e4e6ad7c458415dc/setup/worker_setup.py#L116-L123
mims-harvard/nimfa
3564bf6fe46b4904e828ac1d9b99f5af1fc25ed1
nimfa/methods/factorization/snmf.py
python
Snmf.fro_error
(self)
return 0.5 * rec_err ** 2 + self.eta * w_norm ** 2 + self.beta * hc_norm
Compute NMF objective value with additional sparsity constraints.
Compute NMF objective value with additional sparsity constraints.
[ "Compute", "NMF", "objective", "value", "with", "additional", "sparsity", "constraints", "." ]
def fro_error(self): """Compute NMF objective value with additional sparsity constraints.""" rec_err = norm(self.V - dot(self.W, self.H), "fro") w_norm = norm(self.W, "fro") hc_norm = sum(norm(self.H[:, j], 1) ** 2 for j in self.H.shape[1]) return 0.5 * rec_err ** 2 + self.eta * ...
[ "def", "fro_error", "(", "self", ")", ":", "rec_err", "=", "norm", "(", "self", ".", "V", "-", "dot", "(", "self", ".", "W", ",", "self", ".", "H", ")", ",", "\"fro\"", ")", "w_norm", "=", "norm", "(", "self", ".", "W", ",", "\"fro\"", ")", "...
https://github.com/mims-harvard/nimfa/blob/3564bf6fe46b4904e828ac1d9b99f5af1fc25ed1/nimfa/methods/factorization/snmf.py#L310-L315
robcarver17/pysystemtrade
b0385705b7135c52d39cb6d2400feece881bcca9
sysdata/production/capital.py
python
totalCapitalCalculationData.modify_account_values
( self, broker_account_value: float = arg_not_supplied, total_capital: float = arg_not_supplied, maximum_capital: float = arg_not_supplied, acc_pandl: float = arg_not_supplied, date: datetime.datetime = arg_not_supplied, are_you_sure: bool = False, )
Allow any account valuation to be modified Be careful! Only use if you really know what you are doing :param value: new_maximum_account_value :return: None
Allow any account valuation to be modified Be careful! Only use if you really know what you are doing
[ "Allow", "any", "account", "valuation", "to", "be", "modified", "Be", "careful!", "Only", "use", "if", "you", "really", "know", "what", "you", "are", "doing" ]
def modify_account_values( self, broker_account_value: float = arg_not_supplied, total_capital: float = arg_not_supplied, maximum_capital: float = arg_not_supplied, acc_pandl: float = arg_not_supplied, date: datetime.datetime = arg_not_supplied, are_you_sure: bool...
[ "def", "modify_account_values", "(", "self", ",", "broker_account_value", ":", "float", "=", "arg_not_supplied", ",", "total_capital", ":", "float", "=", "arg_not_supplied", ",", "maximum_capital", ":", "float", "=", "arg_not_supplied", ",", "acc_pandl", ":", "float...
https://github.com/robcarver17/pysystemtrade/blob/b0385705b7135c52d39cb6d2400feece881bcca9/sysdata/production/capital.py#L462-L495
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/ctypes/macholib/dyld.py
python
dyld_library_path
(env=None)
return dyld_env(env, 'DYLD_LIBRARY_PATH')
[]
def dyld_library_path(env=None): return dyld_env(env, 'DYLD_LIBRARY_PATH')
[ "def", "dyld_library_path", "(", "env", "=", "None", ")", ":", "return", "dyld_env", "(", "env", ",", "'DYLD_LIBRARY_PATH'", ")" ]
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/ctypes/macholib/dyld.py#L47-L48
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/dns/dns_client_composite_operations.py
python
DnsClientCompositeOperations.update_resolver_and_wait_for_state
(self, resolver_id, update_resolver_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={})
Calls :py:func:`~oci.dns.DnsClient.update_resolver` and waits for the :py:class:`~oci.dns.models.Resolver` acted upon to enter the given state(s). :param str resolver_id: (required) The OCID of the target resolver. :param oci.dns.models.UpdateResolverDetails update_resolver_details...
Calls :py:func:`~oci.dns.DnsClient.update_resolver` and waits for the :py:class:`~oci.dns.models.Resolver` acted upon to enter the given state(s).
[ "Calls", ":", "py", ":", "func", ":", "~oci", ".", "dns", ".", "DnsClient", ".", "update_resolver", "and", "waits", "for", "the", ":", "py", ":", "class", ":", "~oci", ".", "dns", ".", "models", ".", "Resolver", "acted", "upon", "to", "enter", "the",...
def update_resolver_and_wait_for_state(self, resolver_id, update_resolver_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.dns.DnsClient.update_resolver` and waits for the :py:class:`~oci.dns.models.Resolver` acted upon to enter the given state(s). ...
[ "def", "update_resolver_and_wait_for_state", "(", "self", ",", "resolver_id", ",", "update_resolver_details", ",", "wait_for_states", "=", "[", "]", ",", "operation_kwargs", "=", "{", "}", ",", "waiter_kwargs", "=", "{", "}", ")", ":", "operation_result", "=", "...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/dns/dns_client_composite_operations.py#L492-L531
YosaiProject/yosai
7f96aa6b837ceae9bf3d7387cd7e35f5ab032575
yosai/core/subject/subject.py
python
Yosai.requires_guest
(fn)
return wrap
Requires that the calling Subject be NOT (yet) recognized in the system as a user -- the Subject is not yet authenticated nor remembered through RememberMe services. This method essentially ensures that subject.identifiers IS None :raises UnauthenticatedException: indicating that the d...
Requires that the calling Subject be NOT (yet) recognized in the system as a user -- the Subject is not yet authenticated nor remembered through RememberMe services.
[ "Requires", "that", "the", "calling", "Subject", "be", "NOT", "(", "yet", ")", "recognized", "in", "the", "system", "as", "a", "user", "--", "the", "Subject", "is", "not", "yet", "authenticated", "nor", "remembered", "through", "RememberMe", "services", "." ...
def requires_guest(fn): """ Requires that the calling Subject be NOT (yet) recognized in the system as a user -- the Subject is not yet authenticated nor remembered through RememberMe services. This method essentially ensures that subject.identifiers IS None :raises Una...
[ "def", "requires_guest", "(", "fn", ")", ":", "@", "functools", ".", "wraps", "(", "fn", ")", "def", "wrap", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "subject", "=", "Yosai", ".", "get_current_subject", "(", ")", "if", "subject", ".", "...
https://github.com/YosaiProject/yosai/blob/7f96aa6b837ceae9bf3d7387cd7e35f5ab032575/yosai/core/subject/subject.py#L889-L915
aws-samples/aws-kube-codesuite
ab4e5ce45416b83bffb947ab8d234df5437f4fca
src/kubernetes/client/models/v1_pod_affinity_term.py
python
V1PodAffinityTerm.to_dict
(self)
return result
Returns the model properties as a dict
Returns the model properties as a dict
[ "Returns", "the", "model", "properties", "as", "a", "dict" ]
def to_dict(self): """ Returns the model properties as a dict """ result = {} for attr, _ in iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to...
[ "def", "to_dict", "(", "self", ")", ":", "result", "=", "{", "}", "for", "attr", ",", "_", "in", "iteritems", "(", "self", ".", "swagger_types", ")", ":", "value", "=", "getattr", "(", "self", ",", "attr", ")", "if", "isinstance", "(", "value", ","...
https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1_pod_affinity_term.py#L118-L142
tobspr/RenderPipeline
d8c38c0406a63298f4801782a8e44e9c1e467acf
rpcore/common_resources.py
python
CommonResources._setup_inputs
(self)
Creates commonly used shader inputs such as the current mvp and registers them to the stage manager so they can be used for rendering
Creates commonly used shader inputs such as the current mvp and registers them to the stage manager so they can be used for rendering
[ "Creates", "commonly", "used", "shader", "inputs", "such", "as", "the", "current", "mvp", "and", "registers", "them", "to", "the", "stage", "manager", "so", "they", "can", "be", "used", "for", "rendering" ]
def _setup_inputs(self): """ Creates commonly used shader inputs such as the current mvp and registers them to the stage manager so they can be used for rendering """ self._input_ubo = GroupedInputBlock("MainSceneData") inputs = ( ("camera_pos", "vec3"), ("view_p...
[ "def", "_setup_inputs", "(", "self", ")", ":", "self", ".", "_input_ubo", "=", "GroupedInputBlock", "(", "\"MainSceneData\"", ")", "inputs", "=", "(", "(", "\"camera_pos\"", ",", "\"vec3\"", ")", ",", "(", "\"view_proj_mat_no_jitter\"", ",", "\"mat4\"", ")", "...
https://github.com/tobspr/RenderPipeline/blob/d8c38c0406a63298f4801782a8e44e9c1e467acf/rpcore/common_resources.py#L65-L108
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit - MAC OSX/scripts/sshbackdoors/modules/poison.py
python
Poison.exploit
(self)
[]
def exploit(self): name = self.get_value("name") loc = self.get_value("location") password = self.target.pword poison = open("tmp/%s" % name, "w") poison.write("#!/bin/bash\n( %s & ) > /dev/null 2>&1 && %s/share/%s $@" % (self.backdoor.get_command(), loc, name)) ...
[ "def", "exploit", "(", "self", ")", ":", "name", "=", "self", ".", "get_value", "(", "\"name\"", ")", "loc", "=", "self", ".", "get_value", "(", "\"location\"", ")", "password", "=", "self", ".", "target", ".", "pword", "poison", "=", "open", "(", "\...
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/scripts/sshbackdoors/modules/poison.py#L15-L28
CvvT/dumpDex
92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1
python/idaapi.py
python
udt_member_t.set_virtbase
(self, *args)
return _idaapi.udt_member_t_set_virtbase(self, *args)
set_virtbase(self)
set_virtbase(self)
[ "set_virtbase", "(", "self", ")" ]
def set_virtbase(self, *args): """ set_virtbase(self) """ return _idaapi.udt_member_t_set_virtbase(self, *args)
[ "def", "set_virtbase", "(", "self", ",", "*", "args", ")", ":", "return", "_idaapi", ".", "udt_member_t_set_virtbase", "(", "self", ",", "*", "args", ")" ]
https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idaapi.py#L31521-L31525
materialsproject/pymatgen
8128f3062a334a2edd240e4062b5b9bdd1ae6f58
pymatgen/core/tensors.py
python
SquareTensor.__new__
(cls, input_array, vscale=None)
return obj.view(cls)
Create a SquareTensor object. Note that the constructor uses __new__ rather than __init__ according to the standard method of subclassing numpy ndarrays. Error is thrown when the class is initialized with non-square matrix. Args: input_array (3x3 array-like): the 3x3 array...
Create a SquareTensor object. Note that the constructor uses __new__ rather than __init__ according to the standard method of subclassing numpy ndarrays. Error is thrown when the class is initialized with non-square matrix.
[ "Create", "a", "SquareTensor", "object", ".", "Note", "that", "the", "constructor", "uses", "__new__", "rather", "than", "__init__", "according", "to", "the", "standard", "method", "of", "subclassing", "numpy", "ndarrays", ".", "Error", "is", "thrown", "when", ...
def __new__(cls, input_array, vscale=None): """ Create a SquareTensor object. Note that the constructor uses __new__ rather than __init__ according to the standard method of subclassing numpy ndarrays. Error is thrown when the class is initialized with non-square matrix. ...
[ "def", "__new__", "(", "cls", ",", "input_array", ",", "vscale", "=", "None", ")", ":", "obj", "=", "super", "(", ")", ".", "__new__", "(", "cls", ",", "input_array", ",", "vscale", ",", "check_rank", "=", "2", ")", "return", "obj", ".", "view", "(...
https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/core/tensors.py#L882-L897
celery/celery
95015a1d5a60d94d8e1e02da4b9cf16416c747e2
celery/backends/mongodb.py
python
MongoBackend._restore_group
(self, group_id)
Get the result for a group by id.
Get the result for a group by id.
[ "Get", "the", "result", "for", "a", "group", "by", "id", "." ]
def _restore_group(self, group_id): """Get the result for a group by id.""" obj = self.group_collection.find_one({'_id': group_id}) if obj: return { 'task_id': obj['_id'], 'date_done': obj['date_done'], 'result': [ s...
[ "def", "_restore_group", "(", "self", ",", "group_id", ")", ":", "obj", "=", "self", ".", "group_collection", ".", "find_one", "(", "{", "'_id'", ":", "group_id", "}", ")", "if", "obj", ":", "return", "{", "'task_id'", ":", "obj", "[", "'_id'", "]", ...
https://github.com/celery/celery/blob/95015a1d5a60d94d8e1e02da4b9cf16416c747e2/celery/backends/mongodb.py#L220-L231
mlrun/mlrun
4c120719d64327a34b7ee1ab08fb5e01b258b00a
mlrun/frameworks/_common/model_handler.py
python
ModelHandler.set_context
(self, context: MLClientCtx)
Set this handler MLRun context. :param context: The context to set to.
Set this handler MLRun context.
[ "Set", "this", "handler", "MLRun", "context", "." ]
def set_context(self, context: MLClientCtx): """ Set this handler MLRun context. :param context: The context to set to. """ self._context = context
[ "def", "set_context", "(", "self", ",", "context", ":", "MLClientCtx", ")", ":", "self", ".", "_context", "=", "context" ]
https://github.com/mlrun/mlrun/blob/4c120719d64327a34b7ee1ab08fb5e01b258b00a/mlrun/frameworks/_common/model_handler.py#L241-L247
albertz/music-player
d23586f5bf657cbaea8147223be7814d117ae73d
src/UserAttrib.py
python
iterUserAttribs
(obj)
return attribs
[]
def iterUserAttribs(obj): attribs = [] for attribName in dir(obj.__class__): attrib = getattr(obj.__class__, attribName) if attrib.__class__.__name__ == "UserAttrib": attribs += [attrib] attribs.sort(key = lambda attr: attr.index) return attribs
[ "def", "iterUserAttribs", "(", "obj", ")", ":", "attribs", "=", "[", "]", "for", "attribName", "in", "dir", "(", "obj", ".", "__class__", ")", ":", "attrib", "=", "getattr", "(", "obj", ".", "__class__", ",", "attribName", ")", "if", "attrib", ".", "...
https://github.com/albertz/music-player/blob/d23586f5bf657cbaea8147223be7814d117ae73d/src/UserAttrib.py#L133-L140
beeware/ouroboros
a29123c6fab6a807caffbb7587cf548e0c370296
ouroboros/tkinter/__init__.py
python
Menu.post
(self, x, y)
Display a menu at position X,Y.
Display a menu at position X,Y.
[ "Display", "a", "menu", "at", "position", "X", "Y", "." ]
def post(self, x, y): """Display a menu at position X,Y.""" self.tk.call(self._w, 'post', x, y)
[ "def", "post", "(", "self", ",", "x", ",", "y", ")", ":", "self", ".", "tk", ".", "call", "(", "self", ".", "_w", ",", "'post'", ",", "x", ",", "y", ")" ]
https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/tkinter/__init__.py#L2813-L2815
serverdensity/sd-agent
66f0031b6be369c28e69414eb6172b5685a5110e
graphite.py
python
GraphiteConnection._processMetric
(self, metric, datapoint)
Parse the metric name to fetch (host, metric, device) and send the datapoint to Server Density
Parse the metric name to fetch (host, metric, device) and send the datapoint to Server Density
[ "Parse", "the", "metric", "name", "to", "fetch", "(", "host", "metric", "device", ")", "and", "send", "the", "datapoint", "to", "Server", "Density" ]
def _processMetric(self, metric, datapoint): """Parse the metric name to fetch (host, metric, device) and send the datapoint to Server Density""" log.debug("New metric: %s, values: %s" % (metric, datapoint)) (metric, host, device) = self._parseMetric(metric) if metric is not...
[ "def", "_processMetric", "(", "self", ",", "metric", ",", "datapoint", ")", ":", "log", ".", "debug", "(", "\"New metric: %s, values: %s\"", "%", "(", "metric", ",", "datapoint", ")", ")", "(", "metric", ",", "host", ",", "device", ")", "=", "self", ".",...
https://github.com/serverdensity/sd-agent/blob/66f0031b6be369c28e69414eb6172b5685a5110e/graphite.py#L88-L96
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/scipy/stats/mstats_basic.py
python
plotting_positions
(data, alpha=0.4, beta=0.4)
return ma.array(plpos, mask=data._mask)
Returns plotting positions (or empirical percentile points) for the data. Plotting positions are defined as ``(i-alpha)/(n+1-alpha-beta)``, where: - i is the rank order statistics - n is the number of unmasked values along the given axis - `alpha` and `beta` are two parameters. Typical...
Returns plotting positions (or empirical percentile points) for the data.
[ "Returns", "plotting", "positions", "(", "or", "empirical", "percentile", "points", ")", "for", "the", "data", "." ]
def plotting_positions(data, alpha=0.4, beta=0.4): """ Returns plotting positions (or empirical percentile points) for the data. Plotting positions are defined as ``(i-alpha)/(n+1-alpha-beta)``, where: - i is the rank order statistics - n is the number of unmasked values along the given axi...
[ "def", "plotting_positions", "(", "data", ",", "alpha", "=", "0.4", ",", "beta", "=", "0.4", ")", ":", "data", "=", "ma", ".", "array", "(", "data", ",", "copy", "=", "False", ")", ".", "reshape", "(", "1", ",", "-", "1", ")", "n", "=", "data",...
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/scipy/stats/mstats_basic.py#L2433-L2481
P1sec/pycrate
d12bbccf1df8c9c7891a26967a9d2635610ec5b8
pycrate_mobile/SCCP.py
python
parse_SCMG
(buf)
return Msg, 0
Parses an SCMG message bytes' buffer Args: buf: SCMG message bytes' buffer Returns: element, err: 2-tuple element: Element instance, if err is null (no error) element: None, if err is not null err: 0 no error, 1 invalid message type, 2 message parsin...
Parses an SCMG message bytes' buffer Args: buf: SCMG message bytes' buffer Returns: element, err: 2-tuple element: Element instance, if err is null (no error) element: None, if err is not null err: 0 no error, 1 invalid message type, 2 message parsin...
[ "Parses", "an", "SCMG", "message", "bytes", "buffer", "Args", ":", "buf", ":", "SCMG", "message", "bytes", "buffer", "Returns", ":", "element", "err", ":", "2", "-", "tuple", "element", ":", "Element", "instance", "if", "err", "is", "null", "(", "no", ...
def parse_SCMG(buf): """Parses an SCMG message bytes' buffer Args: buf: SCMG message bytes' buffer Returns: element, err: 2-tuple element: Element instance, if err is null (no error) element: None, if err is not null err: 0 no error, 1 invalid me...
[ "def", "parse_SCMG", "(", "buf", ")", ":", "if", "not", "buf", ":", "return", "None", ",", "1", "if", "python_version", "<", "3", ":", "try", ":", "Msg", "=", "SCMGTypeClasses", "[", "ord", "(", "buf", "[", "0", "]", ")", "]", "(", ")", "except",...
https://github.com/P1sec/pycrate/blob/d12bbccf1df8c9c7891a26967a9d2635610ec5b8/pycrate_mobile/SCCP.py#L1603-L1631
MycroftAI/mycroft-core
3d963cee402e232174850f36918313e87313fb13
mycroft/skills/common_iot_skill.py
python
CommonIoTSkill._run_request
(self, message: Message)
Given a message, extracts the IoTRequest and callback_data and sends them to the run_request method. Args: message: Message
Given a message, extracts the IoTRequest and callback_data and sends them to the run_request method.
[ "Given", "a", "message", "extracts", "the", "IoTRequest", "and", "callback_data", "and", "sends", "them", "to", "the", "run_request", "method", "." ]
def _run_request(self, message: Message): """ Given a message, extracts the IoTRequest and callback_data and sends them to the run_request method. Args: message: Message """ request = IoTRequest.from_dict(message.data[IoTRequest.__name__]) cal...
[ "def", "_run_request", "(", "self", ",", "message", ":", "Message", ")", ":", "request", "=", "IoTRequest", ".", "from_dict", "(", "message", ".", "data", "[", "IoTRequest", ".", "__name__", "]", ")", "callback_data", "=", "message", ".", "data", "[", "\...
https://github.com/MycroftAI/mycroft-core/blob/3d963cee402e232174850f36918313e87313fb13/mycroft/skills/common_iot_skill.py#L410-L421
thinkle/gourmet
8af29c8ded24528030e5ae2ea3461f61c1e5a575
gourmet/plugins/import_export/mealmaster_plugin/mealmaster_importer.py
python
mmf_importer.find_unit_field
(self, fields, fields_is_numfield)
[]
def find_unit_field (self, fields, fields_is_numfield): testtimer = TimeAction('mealmaster_importer.find_unit_field',10) if 0 < fields[0][1]-fields[0][0] <= self.unit_length and len(fields)>1: testtimer.end() return fields[0] testtimer.end()
[ "def", "find_unit_field", "(", "self", ",", "fields", ",", "fields_is_numfield", ")", ":", "testtimer", "=", "TimeAction", "(", "'mealmaster_importer.find_unit_field'", ",", "10", ")", "if", "0", "<", "fields", "[", "0", "]", "[", "1", "]", "-", "fields", ...
https://github.com/thinkle/gourmet/blob/8af29c8ded24528030e5ae2ea3461f61c1e5a575/gourmet/plugins/import_export/mealmaster_plugin/mealmaster_importer.py#L346-L351
NaturalHistoryMuseum/inselect
196a3ae2a0ed4e2c7cb667aaba9a6be1bcd90ca6
inselect/lib/sparse_date.py
python
SparseDate.downsample
(self, to)
Returns self downsampled. 'to' should be one of 'year', 'month', 'day' or None
Returns self downsampled. 'to' should be one of 'year', 'month', 'day' or None
[ "Returns", "self", "downsampled", ".", "to", "should", "be", "one", "of", "year", "month", "day", "or", "None" ]
def downsample(self, to): """Returns self downsampled. 'to' should be one of 'year', 'month', 'day' or None """ if to not in self._LEVELS: raise ValueError('Not a valid resolution [{0}]'.format(to)) else: return self._downsample_to_level(self._LEVELS[to])
[ "def", "downsample", "(", "self", ",", "to", ")", ":", "if", "to", "not", "in", "self", ".", "_LEVELS", ":", "raise", "ValueError", "(", "'Not a valid resolution [{0}]'", ".", "format", "(", "to", ")", ")", "else", ":", "return", "self", ".", "_downsampl...
https://github.com/NaturalHistoryMuseum/inselect/blob/196a3ae2a0ed4e2c7cb667aaba9a6be1bcd90ca6/inselect/lib/sparse_date.py#L108-L115
Arelle/Arelle
20f3d8a8afd41668e1520799acd333349ce0ba17
arelle/ModelInstanceObject.py
python
ModelContext.entityIdentifierHash
(self)
(int) -- hash of entityIdentifier
(int) -- hash of entityIdentifier
[ "(", "int", ")", "--", "hash", "of", "entityIdentifier" ]
def entityIdentifierHash(self): """(int) -- hash of entityIdentifier""" try: return self._entityIdentifierHash except AttributeError: self._entityIdentifierHash = hash(self.entityIdentifier) return self._entityIdentifierHash
[ "def", "entityIdentifierHash", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_entityIdentifierHash", "except", "AttributeError", ":", "self", ".", "_entityIdentifierHash", "=", "hash", "(", "self", ".", "entityIdentifier", ")", "return", "self", "."...
https://github.com/Arelle/Arelle/blob/20f3d8a8afd41668e1520799acd333349ce0ba17/arelle/ModelInstanceObject.py#L1015-L1021
ilius/pyglossary
d599b3beda3ae17642af5debd83bb991148e6425
pyglossary/plugins/ebook_mobi.py
python
GroupStateBySize.add
(self, entry: "BaseEntry")
[]
def add(self, entry: "BaseEntry") -> None: word = entry.l_word defi = entry.defi content = self.writer.format_group_content(word, defi) self.group_contents.append(content) self.group_size += len(content.encode("utf-8"))
[ "def", "add", "(", "self", ",", "entry", ":", "\"BaseEntry\"", ")", "->", "None", ":", "word", "=", "entry", ".", "l_word", "defi", "=", "entry", ".", "defi", "content", "=", "self", ".", "writer", ".", "format_group_content", "(", "word", ",", "defi",...
https://github.com/ilius/pyglossary/blob/d599b3beda3ae17642af5debd83bb991148e6425/pyglossary/plugins/ebook_mobi.py#L105-L110
openstack/barbican
a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce
barbican/common/utils.py
python
is_multiple_backends_enabled
()
return secretstore_conf.secretstore.enable_multiple_secret_stores
[]
def is_multiple_backends_enabled(): try: secretstore_conf = config.get_module_config('secretstore') except KeyError: # Ensure module is initialized from barbican.plugin.interface import secret_store # noqa: F401 secretstore_conf = config.get_module_config('secretstore') retu...
[ "def", "is_multiple_backends_enabled", "(", ")", ":", "try", ":", "secretstore_conf", "=", "config", ".", "get_module_config", "(", "'secretstore'", ")", "except", "KeyError", ":", "# Ensure module is initialized", "from", "barbican", ".", "plugin", ".", "interface", ...
https://github.com/openstack/barbican/blob/a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce/barbican/common/utils.py#L202-L209
007gzs/dingtalk-sdk
7979da2e259fdbc571728cae2425a04dbc65850a
dingtalk/client/api/taobao.py
python
TbALiJianKangHuiYuanGuanLi.alibaba_alihealth_uic_swipeface_syncdata
( self, tp_user_id, lack_sleep_hours='0', black_eye_level='0', eye_bag_swollen_level='0', fish_tail='0', lip_color='' )
return self._top_request( "alibaba.alihealth.uic.swipeface.syncdata", { "tp_user_id": tp_user_id, "lack_sleep_hours": lack_sleep_hours, "black_eye_level": black_eye_level, "eye_bag_swollen_level": eye_bag_swollen_level, ...
刷脸测睡眠数据同步 刷脸测睡眠数据同步,三方数据回传 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=40703 :param tp_user_id: 用户ID :param lack_sleep_hours: 缺觉小时数 :param black_eye_level: 黑圆圈级别 :param eye_bag_swollen_level: 眼袋级别 :param fish_tail: 鱼尾纹数 :param lip_color: 嘴唇颜色
刷脸测睡眠数据同步 刷脸测睡眠数据同步,三方数据回传 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=40703
[ "刷脸测睡眠数据同步", "刷脸测睡眠数据同步,三方数据回传", "文档地址:https", ":", "//", "open", "-", "doc", ".", "dingtalk", ".", "com", "/", "docs", "/", "api", ".", "htm?apiId", "=", "40703" ]
def alibaba_alihealth_uic_swipeface_syncdata( self, tp_user_id, lack_sleep_hours='0', black_eye_level='0', eye_bag_swollen_level='0', fish_tail='0', lip_color='' ): """ 刷脸测睡眠数据同步 刷脸测睡眠数据同步,三方数据回传 文档地址...
[ "def", "alibaba_alihealth_uic_swipeface_syncdata", "(", "self", ",", "tp_user_id", ",", "lack_sleep_hours", "=", "'0'", ",", "black_eye_level", "=", "'0'", ",", "eye_bag_swollen_level", "=", "'0'", ",", "fish_tail", "=", "'0'", ",", "lip_color", "=", "''", ")", ...
https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L91935-L91966
sqall01/alertR
e1d1a83e54f876cc4cd7bd87387e05cb75d4dc13
managerClientDatabase/lib/globalData/systemData.py
python
SystemData.clear_data
(self)
Clears the complete system data storage.
Clears the complete system data storage.
[ "Clears", "the", "complete", "system", "data", "storage", "." ]
def clear_data(self): """ Clears the complete system data storage. """ with self._data_lock: for option in list(self._options.values()): self._delete_option_by_type(option.type) # Delete all sensor alerts stored (faster doing it directly than indi...
[ "def", "clear_data", "(", "self", ")", ":", "with", "self", ".", "_data_lock", ":", "for", "option", "in", "list", "(", "self", ".", "_options", ".", "values", "(", ")", ")", ":", "self", ".", "_delete_option_by_type", "(", "option", ".", "type", ")", ...
https://github.com/sqall01/alertR/blob/e1d1a83e54f876cc4cd7bd87387e05cb75d4dc13/managerClientDatabase/lib/globalData/systemData.py#L279-L301
Nuitka/Nuitka
39262276993757fa4e299f497654065600453fc9
nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Node/__init__.py
python
BuildInfoBase.merge
(self, other)
Merge the fields of another object into this object. Already existing information is overwritten by the other instance's data. WARNING: If a '__dict__' slot is added, it should be updated instead of replaced.
Merge the fields of another object into this object. Already existing information is overwritten by the other instance's data. WARNING: If a '__dict__' slot is added, it should be updated instead of replaced.
[ "Merge", "the", "fields", "of", "another", "object", "into", "this", "object", ".", "Already", "existing", "information", "is", "overwritten", "by", "the", "other", "instance", "s", "data", ".", "WARNING", ":", "If", "a", "__dict__", "slot", "is", "added", ...
def merge(self, other): """ Merge the fields of another object into this object. Already existing information is overwritten by the other instance's data. WARNING: If a '__dict__' slot is added, it should be updated instead of replaced. """ state = other.__getstat...
[ "def", "merge", "(", "self", ",", "other", ")", ":", "state", "=", "other", ".", "__getstate__", "(", ")", "self", ".", "__setstate__", "(", "state", ")" ]
https://github.com/Nuitka/Nuitka/blob/39262276993757fa4e299f497654065600453fc9/nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Node/__init__.py#L463-L471
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/boto-2.46.1/boto/sns/connection.py
python
SNSConnection.create_platform_application
(self, name=None, platform=None, attributes=None)
return self._make_request(action='CreatePlatformApplication', params=params)
The `CreatePlatformApplication` action creates a platform application object for one of the supported push notification services, such as APNS and GCM, to which devices and mobile apps may register. You must specify PlatformPrincipal and PlatformCredential attributes when using the ...
The `CreatePlatformApplication` action creates a platform application object for one of the supported push notification services, such as APNS and GCM, to which devices and mobile apps may register. You must specify PlatformPrincipal and PlatformCredential attributes when using the ...
[ "The", "CreatePlatformApplication", "action", "creates", "a", "platform", "application", "object", "for", "one", "of", "the", "supported", "push", "notification", "services", "such", "as", "APNS", "and", "GCM", "to", "which", "devices", "and", "mobile", "apps", ...
def create_platform_application(self, name=None, platform=None, attributes=None): """ The `CreatePlatformApplication` action creates a platform application object for one of the supported push notification services, such as APNS and GCM, to which devic...
[ "def", "create_platform_application", "(", "self", ",", "name", "=", "None", ",", "platform", "=", "None", ",", "attributes", "=", "None", ")", ":", "params", "=", "{", "}", "if", "name", "is", "not", "None", ":", "params", "[", "'Name'", "]", "=", "...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/boto-2.46.1/boto/sns/connection.py#L442-L487
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/benchmark/benchmark_utils.py
python
Benchmark.environment_info
(self)
return self._environment_info
[]
def environment_info(self): if self._environment_info is None: info = {} info["transformers_version"] = version info["framework"] = self.framework if self.framework == "PyTorch": info["use_torchscript"] = self.args.torchscript if self.f...
[ "def", "environment_info", "(", "self", ")", ":", "if", "self", ".", "_environment_info", "is", "None", ":", "info", "=", "{", "}", "info", "[", "\"transformers_version\"", "]", "=", "version", "info", "[", "\"framework\"", "]", "=", "self", ".", "framewor...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/benchmark/benchmark_utils.py#L779-L835
gramps-project/gramps
04d4651a43eb210192f40a9f8c2bad8ee8fa3753
gramps/plugins/lib/libpersonview.py
python
BasePersonView.add_tag
(self, transaction, person_handle, tag_handle)
Add the given tag to the given person.
Add the given tag to the given person.
[ "Add", "the", "given", "tag", "to", "the", "given", "person", "." ]
def add_tag(self, transaction, person_handle, tag_handle): """ Add the given tag to the given person. """ person = self.dbstate.db.get_person_from_handle(person_handle) person.add_tag(tag_handle) self.dbstate.db.commit_person(person, transaction)
[ "def", "add_tag", "(", "self", ",", "transaction", ",", "person_handle", ",", "tag_handle", ")", ":", "person", "=", "self", ".", "dbstate", ".", "db", ".", "get_person_from_handle", "(", "person_handle", ")", "person", ".", "add_tag", "(", "tag_handle", ")"...
https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/plugins/lib/libpersonview.py#L579-L585
Nuitka/Nuitka
39262276993757fa4e299f497654065600453fc9
nuitka/build/inline_copy/jinja2_35/jinja2/bccache.py
python
BytecodeCache.get_source_checksum
(self, source)
return sha1(source.encode('utf-8')).hexdigest()
Returns a checksum for the source.
Returns a checksum for the source.
[ "Returns", "a", "checksum", "for", "the", "source", "." ]
def get_source_checksum(self, source): """Returns a checksum for the source.""" return sha1(source.encode('utf-8')).hexdigest()
[ "def", "get_source_checksum", "(", "self", ",", "source", ")", ":", "return", "sha1", "(", "source", ".", "encode", "(", "'utf-8'", ")", ")", ".", "hexdigest", "(", ")" ]
https://github.com/Nuitka/Nuitka/blob/39262276993757fa4e299f497654065600453fc9/nuitka/build/inline_copy/jinja2_35/jinja2/bccache.py#L176-L178
naftaliharris/tauthon
5587ceec329b75f7caf6d65a036db61ac1bae214
Lib/plistlib.py
python
Plist.fromFile
(cls, pathOrFile)
return plist
Deprecated. Use the readPlist() function instead.
Deprecated. Use the readPlist() function instead.
[ "Deprecated", ".", "Use", "the", "readPlist", "()", "function", "instead", "." ]
def fromFile(cls, pathOrFile): """Deprecated. Use the readPlist() function instead.""" rootObject = readPlist(pathOrFile) plist = cls() plist.update(rootObject) return plist
[ "def", "fromFile", "(", "cls", ",", "pathOrFile", ")", ":", "rootObject", "=", "readPlist", "(", "pathOrFile", ")", "plist", "=", "cls", "(", ")", "plist", ".", "update", "(", "rootObject", ")", "return", "plist" ]
https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/plistlib.py#L343-L348
kubernetes-client/python
47b9da9de2d02b2b7a34fbe05afb44afd130d73a
kubernetes/client/models/v1_nfs_volume_source.py
python
V1NFSVolumeSource.read_only
(self, read_only)
Sets the read_only of this V1NFSVolumeSource. ReadOnly here will force the NFS export to be mounted with read-only permissions. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs # noqa: E501 :param read_only: The read_only of this V1NFSVolumeSource. # noqa: E501 ...
Sets the read_only of this V1NFSVolumeSource.
[ "Sets", "the", "read_only", "of", "this", "V1NFSVolumeSource", "." ]
def read_only(self, read_only): """Sets the read_only of this V1NFSVolumeSource. ReadOnly here will force the NFS export to be mounted with read-only permissions. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs # noqa: E501 :param read_only: The read_only...
[ "def", "read_only", "(", "self", ",", "read_only", ")", ":", "self", ".", "_read_only", "=", "read_only" ]
https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_nfs_volume_source.py#L100-L109
openstack/octavia
27e5b27d31c695ba72fb6750de2bdafd76e0d7d9
octavia/common/data_models.py
python
BaseDataModel._find_in_graph
(self, key, _visited_nodes=None)
return None
Locates an object with the given unique key in the current object graph and returns a reference to it.
Locates an object with the given unique key in the current
[ "Locates", "an", "object", "with", "the", "given", "unique", "key", "in", "the", "current" ]
def _find_in_graph(self, key, _visited_nodes=None): """Locates an object with the given unique key in the current object graph and returns a reference to it. """ _visited_nodes = _visited_nodes or [] mykey = self._get_unique_key() if mykey in _visited_nodes: ...
[ "def", "_find_in_graph", "(", "self", ",", "key", ",", "_visited_nodes", "=", "None", ")", ":", "_visited_nodes", "=", "_visited_nodes", "or", "[", "]", "mykey", "=", "self", ".", "_get_unique_key", "(", ")", "if", "mykey", "in", "_visited_nodes", ":", "# ...
https://github.com/openstack/octavia/blob/27e5b27d31c695ba72fb6750de2bdafd76e0d7d9/octavia/common/data_models.py#L129-L159
ethereum/cbc-casper
733f24403a72816faf24f0052dc833c1feeaa6d4
casper/safety_oracles/adversary_oracle.py
python
AdversaryOracle.check_estimate_safety
(self)
return min(self.validator_set.validator_weights()), 1
Check the safety of the estimate.
Check the safety of the estimate.
[ "Check", "the", "safety", "of", "the", "estimate", "." ]
def check_estimate_safety(self): """Check the safety of the estimate.""" recent_messages, viewables = self.get_messages_and_viewables() adversary = Adversary(self.CAN_ESTIMATE, recent_messages, viewables, self.validator_set) attack_success, _, _ = adversary.ideal_network_attack() ...
[ "def", "check_estimate_safety", "(", "self", ")", ":", "recent_messages", ",", "viewables", "=", "self", ".", "get_messages_and_viewables", "(", ")", "adversary", "=", "Adversary", "(", "self", ".", "CAN_ESTIMATE", ",", "recent_messages", ",", "viewables", ",", ...
https://github.com/ethereum/cbc-casper/blob/733f24403a72816faf24f0052dc833c1feeaa6d4/casper/safety_oracles/adversary_oracle.py#L72-L85
docker/docker-py
a48a5a9647761406d66e8271f19fab7fa0c5f582
docker/models/services.py
python
ServiceCollection.create
(self, image, command=None, **kwargs)
return self.get(service_id)
Create a service. Similar to the ``docker service create`` command. Args: image (str): The image name to use for the containers. command (list of str or str): Command to run. args (list of str): Arguments to the command. constraints (list of str): :py:class:`~doc...
Create a service. Similar to the ``docker service create`` command.
[ "Create", "a", "service", ".", "Similar", "to", "the", "docker", "service", "create", "command", "." ]
def create(self, image, command=None, **kwargs): """ Create a service. Similar to the ``docker service create`` command. Args: image (str): The image name to use for the containers. command (list of str or str): Command to run. args (list of str): Arguments t...
[ "def", "create", "(", "self", ",", "image", ",", "command", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'image'", "]", "=", "image", "kwargs", "[", "'command'", "]", "=", "command", "create_kwargs", "=", "_get_create_service_kwargs", ...
https://github.com/docker/docker-py/blob/a48a5a9647761406d66e8271f19fab7fa0c5f582/docker/models/services.py#L148-L232
jaegertracing/jaeger-client-python
c9a7a3d38c443946d422f0bd03ab6adbd42d77c0
jaeger_client/metrics/metrics.py
python
Metrics.__init__
(self, count=None, gauge=None, timing=None)
:param count: function (key, value) to emit counters :param gauge: function (key, value) to emit gauges :param timing: function (key, value in milliseconds) to emit timings
:param count: function (key, value) to emit counters :param gauge: function (key, value) to emit gauges :param timing: function (key, value in milliseconds) to emit timings
[ ":", "param", "count", ":", "function", "(", "key", "value", ")", "to", "emit", "counters", ":", "param", "gauge", ":", "function", "(", "key", "value", ")", "to", "emit", "gauges", ":", "param", "timing", ":", "function", "(", "key", "value", "in", ...
def __init__(self, count=None, gauge=None, timing=None): """ :param count: function (key, value) to emit counters :param gauge: function (key, value) to emit gauges :param timing: function (key, value in milliseconds) to emit timings """ self._count = count ...
[ "def", "__init__", "(", "self", ",", "count", "=", "None", ",", "gauge", "=", "None", ",", "timing", "=", "None", ")", ":", "self", ".", "_count", "=", "count", "self", ".", "_gauge", "=", "gauge", "self", ".", "_timing", "=", "timing", "if", "not"...
https://github.com/jaegertracing/jaeger-client-python/blob/c9a7a3d38c443946d422f0bd03ab6adbd42d77c0/jaeger_client/metrics/metrics.py#L114-L129
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/transforms.py
python
Affine2D.skew
(self, xShear, yShear)
return self
Adds a skew in place. *xShear* and *yShear* are the shear angles along the *x*- and *y*-axes, respectively, in radians. Returns *self*, so this method can easily be chained with more calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate` and :meth:`scale`.
Adds a skew in place.
[ "Adds", "a", "skew", "in", "place", "." ]
def skew(self, xShear, yShear): """ Adds a skew in place. *xShear* and *yShear* are the shear angles along the *x*- and *y*-axes, respectively, in radians. Returns *self*, so this method can easily be chained with more calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:...
[ "def", "skew", "(", "self", ",", "xShear", ",", "yShear", ")", ":", "rotX", "=", "np", ".", "tan", "(", "xShear", ")", "rotY", "=", "np", ".", "tan", "(", "yShear", ")", "skew_mtx", "=", "np", ".", "array", "(", "[", "[", "1.0", ",", "rotX", ...
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/transforms.py#L2046-L2063
leapcode/bitmask_client
d2fe20df24fc6eaf146fa5ce1e847de6ab515688
src/leap/bitmask/gui/mainwindow.py
python
MainWindow._new_updates_available
(self, event, content)
Callback for the new updates event :param event: The event that triggered the callback. :type event: str :param content: The content of the event. :type content: list
Callback for the new updates event
[ "Callback", "for", "the", "new", "updates", "event" ]
def _new_updates_available(self, event, content): """ Callback for the new updates event :param event: The event that triggered the callback. :type event: str :param content: The content of the event. :type content: list """ self.new_updates.emit(content)
[ "def", "_new_updates_available", "(", "self", ",", "event", ",", "content", ")", ":", "self", ".", "new_updates", ".", "emit", "(", "content", ")" ]
https://github.com/leapcode/bitmask_client/blob/d2fe20df24fc6eaf146fa5ce1e847de6ab515688/src/leap/bitmask/gui/mainwindow.py#L695-L704
erikrose/blessings
f042b937db712a5c5ac75f6236181cd2575fa39c
blessings/__init__.py
python
Terminal.hidden_cursor
(self)
Return a context manager that hides the cursor while inside it and makes it visible on leaving.
Return a context manager that hides the cursor while inside it and makes it visible on leaving.
[ "Return", "a", "context", "manager", "that", "hides", "the", "cursor", "while", "inside", "it", "and", "makes", "it", "visible", "on", "leaving", "." ]
def hidden_cursor(self): """Return a context manager that hides the cursor while inside it and makes it visible on leaving.""" self.stream.write(self.hide_cursor) try: yield finally: self.stream.write(self.normal_cursor)
[ "def", "hidden_cursor", "(", "self", ")", ":", "self", ".", "stream", ".", "write", "(", "self", ".", "hide_cursor", ")", "try", ":", "yield", "finally", ":", "self", ".", "stream", ".", "write", "(", "self", ".", "normal_cursor", ")" ]
https://github.com/erikrose/blessings/blob/f042b937db712a5c5ac75f6236181cd2575fa39c/blessings/__init__.py#L286-L293
chengzhengxin/groupsoftmax-simpledet
3f63a00998c57fee25241cf43a2e8600893ea462
models/tridentnet/resnet_v2.py
python
TridentResNetV2Builder.deform_conv_shared
(data, name, conv_offset, kernel, num_filter, branch_ids=None, no_bias=True, share_weight=True, num_deformable_group=4, pad=(0, 0), stride=(1, 1), dilate=(1, 1))
return conv_layers
[]
def deform_conv_shared(data, name, conv_offset, kernel, num_filter, branch_ids=None, no_bias=True, share_weight=True, num_deformable_group=4, pad=(0, 0), stride=(1, 1), dilate=(1, 1)): if branch_ids is None: branch_ids = range(len(data)) weight = X.var(name + '_we...
[ "def", "deform_conv_shared", "(", "data", ",", "name", ",", "conv_offset", ",", "kernel", ",", "num_filter", ",", "branch_ids", "=", "None", ",", "no_bias", "=", "True", ",", "share_weight", "=", "True", ",", "num_deformable_group", "=", "4", ",", "pad", "...
https://github.com/chengzhengxin/groupsoftmax-simpledet/blob/3f63a00998c57fee25241cf43a2e8600893ea462/models/tridentnet/resnet_v2.py#L65-L94
giantbranch/python-hacker-code
addbc8c73e7e6fb9e4fcadcec022fa1d3da4b96d
我手敲的代码(中文注释)/chapter11/volatility-2.3/contrib/plugins/example.py
python
DateTime.render_text
(self, outfd, data)
Renders the calculated data as text to outfd
Renders the calculated data as text to outfd
[ "Renders", "the", "calculated", "data", "as", "text", "to", "outfd" ]
def render_text(self, outfd, data): """Renders the calculated data as text to outfd""" # Convert the result into a datetime object for display in local and non local format dt = data['ImageDatetime'].as_datetime() # Display the datetime in UTC as taken from the image outfd.write...
[ "def", "render_text", "(", "self", ",", "outfd", ",", "data", ")", ":", "# Convert the result into a datetime object for display in local and non local format", "dt", "=", "data", "[", "'ImageDatetime'", "]", ".", "as_datetime", "(", ")", "# Display the datetime in UTC as t...
https://github.com/giantbranch/python-hacker-code/blob/addbc8c73e7e6fb9e4fcadcec022fa1d3da4b96d/我手敲的代码(中文注释)/chapter11/volatility-2.3/contrib/plugins/example.py#L60-L68
1012598167/flask_mongodb_game
60c7e0351586656ec38f851592886338e50b4110
python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/requests/cookies.py
python
RequestsCookieJar.__setstate__
(self, state)
Unlike a normal CookieJar, this class is pickleable.
Unlike a normal CookieJar, this class is pickleable.
[ "Unlike", "a", "normal", "CookieJar", "this", "class", "is", "pickleable", "." ]
def __setstate__(self, state): """Unlike a normal CookieJar, this class is pickleable.""" self.__dict__.update(state) if '_cookies_lock' not in self.__dict__: self._cookies_lock = threading.RLock()
[ "def", "__setstate__", "(", "self", ",", "state", ")", ":", "self", ".", "__dict__", ".", "update", "(", "state", ")", "if", "'_cookies_lock'", "not", "in", "self", ".", "__dict__", ":", "self", ".", "_cookies_lock", "=", "threading", ".", "RLock", "(", ...
https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/requests/cookies.py#L408-L412
spl0k/supysonic
62bad3b9878a1d22cf040f25dab0fa28a252ba38
supysonic/scanner.py
python
Scanner.__try_load_tag
(self, path)
[]
def __try_load_tag(self, path): try: return mediafile.MediaFile(path) except mediafile.UnreadableFileError: return None
[ "def", "__try_load_tag", "(", "self", ",", "path", ")", ":", "try", ":", "return", "mediafile", ".", "MediaFile", "(", "path", ")", "except", "mediafile", ".", "UnreadableFileError", ":", "return", "None" ]
https://github.com/spl0k/supysonic/blob/62bad3b9878a1d22cf040f25dab0fa28a252ba38/supysonic/scanner.py#L418-L422
imatge-upc/detection-2016-nipsws
dbcc3ac46b4e2a8841eadd1cbc46ee58c6d9a2a8
scripts/visualization.py
python
draw_sequences_test
(step, action, qval, draw, region_image, background, path_testing_folder, region_mask, image_name, save_boolean)
return background
[]
def draw_sequences_test(step, action, qval, draw, region_image, background, path_testing_folder, region_mask, image_name, save_boolean): aux = np.asarray(region_image, np.uint8) img_offset = (1000 * step, 70) footnote_offset = (1000 * step, 550) q_predictions_offset = (1000 * ste...
[ "def", "draw_sequences_test", "(", "step", ",", "action", ",", "qval", ",", "draw", ",", "region_image", ",", "background", ",", "path_testing_folder", ",", "region_mask", ",", "image_name", ",", "save_boolean", ")", ":", "aux", "=", "np", ".", "asarray", "(...
https://github.com/imatge-upc/detection-2016-nipsws/blob/dbcc3ac46b4e2a8841eadd1cbc46ee58c6d9a2a8/scripts/visualization.py#L46-L64
diegma/graph-2-text
56e19d3066116c26464acde46c1b52ec46f319e6
onmt/modules/Transformer.py
python
TransformerDecoderState._all
(self)
return (self.previous_input, self.previous_layer_inputs, self.src)
Contains attributes that need to be updated in self.beam_update().
Contains attributes that need to be updated in self.beam_update().
[ "Contains", "attributes", "that", "need", "to", "be", "updated", "in", "self", ".", "beam_update", "()", "." ]
def _all(self): """ Contains attributes that need to be updated in self.beam_update(). """ return (self.previous_input, self.previous_layer_inputs, self.src)
[ "def", "_all", "(", "self", ")", ":", "return", "(", "self", ".", "previous_input", ",", "self", ".", "previous_layer_inputs", ",", "self", ".", "src", ")" ]
https://github.com/diegma/graph-2-text/blob/56e19d3066116c26464acde46c1b52ec46f319e6/onmt/modules/Transformer.py#L360-L364
python-discord/bot
26c5587ac13e5414361bb6e7ada42983b81014d2
bot/exts/filters/filter_lists.py
python
FilterLists._delete_data
(self, ctx: Context, allowed: bool, list_type: ValidFilterListType, content: str)
Remove an item from a filterlist.
Remove an item from a filterlist.
[ "Remove", "an", "item", "from", "a", "filterlist", "." ]
async def _delete_data(self, ctx: Context, allowed: bool, list_type: ValidFilterListType, content: str) -> None: """Remove an item from a filterlist.""" allow_type = "whitelist" if allowed else "blacklist" # If this is a server invite, we need to convert it. if list_type == "GUILD_INVIT...
[ "async", "def", "_delete_data", "(", "self", ",", "ctx", ":", "Context", ",", "allowed", ":", "bool", ",", "list_type", ":", "ValidFilterListType", ",", "content", ":", "str", ")", "->", "None", ":", "allow_type", "=", "\"whitelist\"", "if", "allowed", "el...
https://github.com/python-discord/bot/blob/26c5587ac13e5414361bb6e7ada42983b81014d2/bot/exts/filters/filter_lists.py#L114-L145
hzlzh/AlfredWorkflow.com
7055f14f6922c80ea5943839eb0caff11ae57255
Sources/Workflows/SearchKippt/alp/request/requests_cache/backends/base.py
python
BaseCache.reduce_response
(self, response)
return result
Reduce response object to make it compatible with ``pickle``
Reduce response object to make it compatible with ``pickle``
[ "Reduce", "response", "object", "to", "make", "it", "compatible", "with", "pickle" ]
def reduce_response(self, response): """ Reduce response object to make it compatible with ``pickle`` """ result = _Store() # prefetch response.content for field in self._response_attrs: setattr(result, field, self._picklable_field(response, field)) re...
[ "def", "reduce_response", "(", "self", ",", "response", ")", ":", "result", "=", "_Store", "(", ")", "# prefetch", "response", ".", "content", "for", "field", "in", "self", ".", "_response_attrs", ":", "setattr", "(", "result", ",", "field", ",", "self", ...
https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/SearchKippt/alp/request/requests_cache/backends/base.py#L116-L125
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/setuptools/wheel.py
python
Wheel.is_compatible
(self)
return next((True for t in self.tags() if t in supported_tags), False)
Is the wheel is compatible with the current platform?
Is the wheel is compatible with the current platform?
[ "Is", "the", "wheel", "is", "compatible", "with", "the", "current", "platform?" ]
def is_compatible(self): '''Is the wheel is compatible with the current platform?''' supported_tags = pep425tags.get_supported() return next((True for t in self.tags() if t in supported_tags), False)
[ "def", "is_compatible", "(", "self", ")", ":", "supported_tags", "=", "pep425tags", ".", "get_supported", "(", ")", "return", "next", "(", "(", "True", "for", "t", "in", "self", ".", "tags", "(", ")", "if", "t", "in", "supported_tags", ")", ",", "False...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/setuptools/wheel.py#L69-L72
meraki/dashboard-api-python
aef5e6fe5d23a40d435d5c64ff30580a28af07f1
meraki/api/organizations.py
python
Organizations.deleteOrganizationAdaptivePolicyAcl
(self, organizationId: str, id: str)
return self._session.delete(metadata, resource)
**Deletes the specified adaptive policy ACL** https://developer.cisco.com/meraki/api-v1/#!delete-organization-adaptive-policy-acl - organizationId (string): (required) - id (string): (required)
**Deletes the specified adaptive policy ACL** https://developer.cisco.com/meraki/api-v1/#!delete-organization-adaptive-policy-acl
[ "**", "Deletes", "the", "specified", "adaptive", "policy", "ACL", "**", "https", ":", "//", "developer", ".", "cisco", ".", "com", "/", "meraki", "/", "api", "-", "v1", "/", "#!delete", "-", "organization", "-", "adaptive", "-", "policy", "-", "acl" ]
def deleteOrganizationAdaptivePolicyAcl(self, organizationId: str, id: str): """ **Deletes the specified adaptive policy ACL** https://developer.cisco.com/meraki/api-v1/#!delete-organization-adaptive-policy-acl - organizationId (string): (required) - id (string): (required) ...
[ "def", "deleteOrganizationAdaptivePolicyAcl", "(", "self", ",", "organizationId", ":", "str", ",", "id", ":", "str", ")", ":", "metadata", "=", "{", "'tags'", ":", "[", "'organizations'", ",", "'configure'", ",", "'adaptivePolicy'", ",", "'acls'", "]", ",", ...
https://github.com/meraki/dashboard-api-python/blob/aef5e6fe5d23a40d435d5c64ff30580a28af07f1/meraki/api/organizations.py#L327-L342
numenta/nupic
b9ebedaf54f49a33de22d8d44dff7c765cdb5548
examples/sp/sp_tutorial.py
python
percentOverlap
(x1, x2, size)
return percentOverlap
Computes the percentage of overlap between vectors x1 and x2. @param x1 (array) binary vector @param x2 (array) binary vector @param size (int) length of binary vectors @return percentOverlap (float) percentage overlap between x1 and x2
Computes the percentage of overlap between vectors x1 and x2.
[ "Computes", "the", "percentage", "of", "overlap", "between", "vectors", "x1", "and", "x2", "." ]
def percentOverlap(x1, x2, size): """ Computes the percentage of overlap between vectors x1 and x2. @param x1 (array) binary vector @param x2 (array) binary vector @param size (int) length of binary vectors @return percentOverlap (float) percentage overlap between x1 and x2 """ nonZeroX1 = np.co...
[ "def", "percentOverlap", "(", "x1", ",", "x2", ",", "size", ")", ":", "nonZeroX1", "=", "np", ".", "count_nonzero", "(", "x1", ")", "nonZeroX2", "=", "np", ".", "count_nonzero", "(", "x2", ")", "minX1X2", "=", "min", "(", "nonZeroX1", ",", "nonZeroX2",...
https://github.com/numenta/nupic/blob/b9ebedaf54f49a33de22d8d44dff7c765cdb5548/examples/sp/sp_tutorial.py#L46-L62
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/PassiveTotal/Integrations/PassiveTotal_v2/PassiveTotal_v2.py
python
get_reputation_command
(client_obj: Client, args: Dict[str, Any])
return CommandResults( outputs_prefix='PassiveTotal.Reputation', outputs_key_field='query', outputs=context_data, readable_output=hr_response, raw_response=response )
Gets reputation for a given domain, host or IP. :param client_obj: client object which is used to get response from API :param args: it contain arguments of pt-reputation-get :return: command output
Gets reputation for a given domain, host or IP.
[ "Gets", "reputation", "for", "a", "given", "domain", "host", "or", "IP", "." ]
def get_reputation_command(client_obj: Client, args: Dict[str, Any]) -> CommandResults: """ Gets reputation for a given domain, host or IP. :param client_obj: client object which is used to get response from API :param args: it contain arguments of pt-reputation-get :return: command output """ ...
[ "def", "get_reputation_command", "(", "client_obj", ":", "Client", ",", "args", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "CommandResults", ":", "# Retrieve arguments", "query", "=", "args", ".", "get", "(", "'query'", ",", "''", ")", ".", "st...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/PassiveTotal/Integrations/PassiveTotal_v2/PassiveTotal_v2.py#L1937-L1967
MrH0wl/Cloudmare
65e5bc9888f9d362ab2abfb103ea6c1e869d67aa
thirdparty/urllib3/util/timeout.py
python
Timeout.start_connect
(self)
return self._start_connect
Start the timeout clock, used during a connect() attempt :raises urllib3.exceptions.TimeoutStateError: if you attempt to start a timer that has been started already.
Start the timeout clock, used during a connect() attempt
[ "Start", "the", "timeout", "clock", "used", "during", "a", "connect", "()", "attempt" ]
def start_connect(self): """Start the timeout clock, used during a connect() attempt :raises urllib3.exceptions.TimeoutStateError: if you attempt to start a timer that has been started already. """ if self._start_connect is not None: raise TimeoutStateError("Time...
[ "def", "start_connect", "(", "self", ")", ":", "if", "self", ".", "_start_connect", "is", "not", "None", ":", "raise", "TimeoutStateError", "(", "\"Timeout timer has already been started.\"", ")", "self", ".", "_start_connect", "=", "current_time", "(", ")", "retu...
https://github.com/MrH0wl/Cloudmare/blob/65e5bc9888f9d362ab2abfb103ea6c1e869d67aa/thirdparty/urllib3/util/timeout.py#L188-L197
bspaans/python-mingus
6558cacffeaab4f084a3eedda12b0e86fd24c430
mingus/core/chords.py
python
determine_triad
(triad, shorthand=False, no_inversions=False, placeholder=None)
return inversion_exhauster(triad, shorthand, 1, [])
Name the triad; return answers in a list. The third argument should not be given. If shorthand is True the answers will be in abbreviated form. This function can determine major, minor, diminished and suspended triads. Also knows about invertions. Examples: >>> determine_triad(['A', 'C', 'E']...
Name the triad; return answers in a list.
[ "Name", "the", "triad", ";", "return", "answers", "in", "a", "list", "." ]
def determine_triad(triad, shorthand=False, no_inversions=False, placeholder=None): """Name the triad; return answers in a list. The third argument should not be given. If shorthand is True the answers will be in abbreviated form. This function can determine major, minor, diminished and suspended ...
[ "def", "determine_triad", "(", "triad", ",", "shorthand", "=", "False", ",", "no_inversions", "=", "False", ",", "placeholder", "=", "None", ")", ":", "if", "len", "(", "triad", ")", "!=", "3", ":", "# warning: raise exception: not a triad", "return", "False",...
https://github.com/bspaans/python-mingus/blob/6558cacffeaab4f084a3eedda12b0e86fd24c430/mingus/core/chords.py#L944-L1015
iopsgroup/imoocc
de810eb6d4c1697b7139305925a5b0ba21225f3f
extra_apps/xadmin/util.py
python
NestedObjects.nested
(self, format_callback=None)
return roots
Return the graph as a nested list.
Return the graph as a nested list.
[ "Return", "the", "graph", "as", "a", "nested", "list", "." ]
def nested(self, format_callback=None): """ Return the graph as a nested list. """ seen = set() roots = [] for root in self.edges.get(None, ()): roots.extend(self._nested(root, seen, format_callback)) return roots
[ "def", "nested", "(", "self", ",", "format_callback", "=", "None", ")", ":", "seen", "=", "set", "(", ")", "roots", "=", "[", "]", "for", "root", "in", "self", ".", "edges", ".", "get", "(", "None", ",", "(", ")", ")", ":", "roots", ".", "exten...
https://github.com/iopsgroup/imoocc/blob/de810eb6d4c1697b7139305925a5b0ba21225f3f/extra_apps/xadmin/util.py#L223-L232
osmr/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
keras_/kerascv/models/vgg.py
python
bn_vgg19
(**kwargs)
return get_vgg(blocks=19, use_bias=False, use_bn=True, model_name="bn_vgg19", **kwargs)
VGG-19 model with batch normalization from 'Very Deep Convolutional Networks for Large-Scale Image Recognition,' https://arxiv.org/abs/1409.1556. Parameters: ---------- pretrained : bool, default False Whether to load the pretrained weights for model. root : str, default '~/.keras/models' ...
VGG-19 model with batch normalization from 'Very Deep Convolutional Networks for Large-Scale Image Recognition,' https://arxiv.org/abs/1409.1556.
[ "VGG", "-", "19", "model", "with", "batch", "normalization", "from", "Very", "Deep", "Convolutional", "Networks", "for", "Large", "-", "Scale", "Image", "Recognition", "https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1409", ".", "1556", "." ]
def bn_vgg19(**kwargs): """ VGG-19 model with batch normalization from 'Very Deep Convolutional Networks for Large-Scale Image Recognition,' https://arxiv.org/abs/1409.1556. Parameters: ---------- pretrained : bool, default False Whether to load the pretrained weights for model. roo...
[ "def", "bn_vgg19", "(", "*", "*", "kwargs", ")", ":", "return", "get_vgg", "(", "blocks", "=", "19", ",", "use_bias", "=", "False", ",", "use_bn", "=", "True", ",", "model_name", "=", "\"bn_vgg19\"", ",", "*", "*", "kwargs", ")" ]
https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/keras_/kerascv/models/vgg.py#L313-L325
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
lib/future/types/newbytes.py
python
newbytes.__gt__
(self, other)
[]
def __gt__(self, other): if isinstance(other, _builtin_bytes): return super(newbytes, self).__gt__(other) raise TypeError(self.unorderable_err.format(type(other)))
[ "def", "__gt__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "_builtin_bytes", ")", ":", "return", "super", "(", "newbytes", ",", "self", ")", ".", "__gt__", "(", "other", ")", "raise", "TypeError", "(", "self", ".", "...
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/future/types/newbytes.py#L389-L392
the4thdoctor/pg_chameleon
9d80212541559c8d0a42b3e7c1b2c67bb7606411
pg_chameleon/lib/sql_util.py
python
sql_token.quote_cols
(self, cols)
return quoted_cols
The method adds the " quotes to the column names. The string is converted to a list using the split method with the comma separator. The columns are then stripped and quoted with the "". Finally the list elements are rejoined in a string which is returned. The method is u...
The method adds the " quotes to the column names. The string is converted to a list using the split method with the comma separator. The columns are then stripped and quoted with the "". Finally the list elements are rejoined in a string which is returned. The method is u...
[ "The", "method", "adds", "the", "quotes", "to", "the", "column", "names", ".", "The", "string", "is", "converted", "to", "a", "list", "using", "the", "split", "method", "with", "the", "comma", "separator", ".", "The", "columns", "are", "then", "stripped", ...
def quote_cols(self, cols): """ The method adds the " quotes to the column names. The string is converted to a list using the split method with the comma separator. The columns are then stripped and quoted with the "". Finally the list elements are rejoined in a s...
[ "def", "quote_cols", "(", "self", ",", "cols", ")", ":", "idx_cols", "=", "cols", ".", "split", "(", "','", ")", "idx_cols", "=", "[", "'\"%s\"'", "%", "col", ".", "strip", "(", ")", "for", "col", "in", "idx_cols", "]", "quoted_cols", "=", "\",\"", ...
https://github.com/the4thdoctor/pg_chameleon/blob/9d80212541559c8d0a42b3e7c1b2c67bb7606411/pg_chameleon/lib/sql_util.py#L134-L149
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/tod/binary_sensor.py
python
TodSensor.should_poll
(self)
return False
Sensor does not need to be polled.
Sensor does not need to be polled.
[ "Sensor", "does", "not", "need", "to", "be", "polled", "." ]
def should_poll(self): """Sensor does not need to be polled.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/tod/binary_sensor.py#L85-L87
learningequality/ka-lite
571918ea668013dcf022286ea85eff1c5333fb8b
kalite/distributed/views.py
python
device_redirect
(request)
return HttpResponseRedirect(reverse("device_management", kwargs={"zone_id": (zone and zone.pk) or None, "device_id": device.pk}))
Dummy view to generate a helpful dynamic redirect to interface with 'control_panel' app
Dummy view to generate a helpful dynamic redirect to interface with 'control_panel' app
[ "Dummy", "view", "to", "generate", "a", "helpful", "dynamic", "redirect", "to", "interface", "with", "control_panel", "app" ]
def device_redirect(request): """ Dummy view to generate a helpful dynamic redirect to interface with 'control_panel' app """ device = Device.get_own_device() zone = device.get_zone() return HttpResponseRedirect(reverse("device_management", kwargs={"zone_id": (zone and zone.pk) or None, "device...
[ "def", "device_redirect", "(", "request", ")", ":", "device", "=", "Device", ".", "get_own_device", "(", ")", "zone", "=", "device", ".", "get_zone", "(", ")", "return", "HttpResponseRedirect", "(", "reverse", "(", "\"device_management\"", ",", "kwargs", "=", ...
https://github.com/learningequality/ka-lite/blob/571918ea668013dcf022286ea85eff1c5333fb8b/kalite/distributed/views.py#L171-L178
photonixapp/photonix
f18ccdd4867ccc9732080db4e255f2a9558e7ab4
photonix/classifiers/style/train.py
python
run_bottleneck_on_image
(sess, image_data, image_data_tensor, decoded_image_tensor, resized_input_tensor, bottleneck_tensor)
return bottleneck_values
Runs inference on an image to extract the 'bottleneck' summary layer. Args: sess: Current active TensorFlow Session. image_data: String of raw JPEG data. image_data_tensor: Input data layer in the graph. decoded_image_tensor: Output of initial image resizing and preprocessing. resized_input_tens...
Runs inference on an image to extract the 'bottleneck' summary layer.
[ "Runs", "inference", "on", "an", "image", "to", "extract", "the", "bottleneck", "summary", "layer", "." ]
def run_bottleneck_on_image(sess, image_data, image_data_tensor, decoded_image_tensor, resized_input_tensor, bottleneck_tensor): """Runs inference on an image to extract the 'bottleneck' summary layer. Args: sess: Current active TensorFlow Session. im...
[ "def", "run_bottleneck_on_image", "(", "sess", ",", "image_data", ",", "image_data_tensor", ",", "decoded_image_tensor", ",", "resized_input_tensor", ",", "bottleneck_tensor", ")", ":", "# First decode the JPEG image, resize it, and rescale the pixel values.", "resized_input_values...
https://github.com/photonixapp/photonix/blob/f18ccdd4867ccc9732080db4e255f2a9558e7ab4/photonix/classifiers/style/train.py#L289-L312
Terrance/SkPy
055a24f2087a79552f5ffebc8b2da28951313015
skpy/chat.py
python
SkypeChats.chat
(self, id)
return self.merge(SkypeChat.fromRaw(self.skype, json))
Get a single conversation by identifier. Args: id (str): single or group chat identifier Returns: :class:`SkypeChat`: retrieved conversation
Get a single conversation by identifier.
[ "Get", "a", "single", "conversation", "by", "identifier", "." ]
def chat(self, id): """ Get a single conversation by identifier. Args: id (str): single or group chat identifier Returns: :class:`SkypeChat`: retrieved conversation """ json = self.skype.conn("GET", "{0}/users/ME/conversations/{1}".format(self.sk...
[ "def", "chat", "(", "self", ",", "id", ")", ":", "json", "=", "self", ".", "skype", ".", "conn", "(", "\"GET\"", ",", "\"{0}/users/ME/conversations/{1}\"", ".", "format", "(", "self", ".", "skype", ".", "conn", ".", "msgsHost", ",", "id", ")", ",", "...
https://github.com/Terrance/SkPy/blob/055a24f2087a79552f5ffebc8b2da28951313015/skpy/chat.py#L497-L509
saturday06/VRM_Addon_for_Blender
0fc59703bb203dca760501221d34ecc4a566e64f
io_scene_vrm/importer/vrm_parser.py
python
PyMaterialGltf.__init__
(self)
[]
def __init__(self) -> None: super().__init__() self.base_color: List[float] = [1, 1, 1, 1] self.metallic_factor: float = 1 self.roughness_factor: float = 1 self.emissive_factor: List[float] = [0, 0, 0] self.color_texture_index: Optional[int] = None self.color_te...
[ "def", "__init__", "(", "self", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "base_color", ":", "List", "[", "float", "]", "=", "[", "1", ",", "1", ",", "1", ",", "1", "]", "self", ".", "metallic_factor", "...
https://github.com/saturday06/VRM_Addon_for_Blender/blob/0fc59703bb203dca760501221d34ecc4a566e64f/io_scene_vrm/importer/vrm_parser.py#L64-L88
seasonSH/WarpGAN
794e24d9c3abce08c0e95f975ce5914ccaa2e1bb
align/mtcnntf/detect_face.py
python
Network.setup
(self)
Construct the network.
Construct the network.
[ "Construct", "the", "network", "." ]
def setup(self): """Construct the network. """ raise NotImplementedError('Must be implemented by the subclass.')
[ "def", "setup", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "'Must be implemented by the subclass.'", ")" ]
https://github.com/seasonSH/WarpGAN/blob/794e24d9c3abce08c0e95f975ce5914ccaa2e1bb/align/mtcnntf/detect_face.py#L75-L77
gciruelos/musthe
ee76774eed366d577d9dc4eeb315f87d8480b606
musthe/musthe.py
python
Scale.all
(include_greek_modes=False)
[]
def all(include_greek_modes=False): for root in Note.all(): for name in Scale.scales: if not include_greek_modes and name in Scale.greek_modes_set: continue yield Scale(root, name)
[ "def", "all", "(", "include_greek_modes", "=", "False", ")", ":", "for", "root", "in", "Note", ".", "all", "(", ")", ":", "for", "name", "in", "Scale", ".", "scales", ":", "if", "not", "include_greek_modes", "and", "name", "in", "Scale", ".", "greek_mo...
https://github.com/gciruelos/musthe/blob/ee76774eed366d577d9dc4eeb315f87d8480b606/musthe/musthe.py#L431-L436
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/ip_messaging/v1/service/__init__.py
python
ServiceList.stream
(self, limit=None, page_size=None)
return self._version.stream(page, limits['limit'])
Streams ServiceInstance records from the API as a generator stream. This operation lazily loads records as efficiently as possible until the limit is reached. The results are returned as a generator, so this operation is memory efficient. :param int limit: Upper limit for the number of ...
Streams ServiceInstance records from the API as a generator stream. This operation lazily loads records as efficiently as possible until the limit is reached. The results are returned as a generator, so this operation is memory efficient.
[ "Streams", "ServiceInstance", "records", "from", "the", "API", "as", "a", "generator", "stream", ".", "This", "operation", "lazily", "loads", "records", "as", "efficiently", "as", "possible", "until", "the", "limit", "is", "reached", ".", "The", "results", "ar...
def stream(self, limit=None, page_size=None): """ Streams ServiceInstance records from the API as a generator stream. This operation lazily loads records as efficiently as possible until the limit is reached. The results are returned as a generator, so this operation is memory ef...
[ "def", "stream", "(", "self", ",", "limit", "=", "None", ",", "page_size", "=", "None", ")", ":", "limits", "=", "self", ".", "_version", ".", "read_limits", "(", "limit", ",", "page_size", ")", "page", "=", "self", ".", "page", "(", "page_size", "="...
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/ip_messaging/v1/service/__init__.py#L53-L74
ucsb-seclab/karonte
427ac313e596f723e40768b95d13bd7a9fc92fd8
eval/multi_bin/all_bins/taint_analysis/coretaint.py
python
CoreTaint._next_inst
(self, bl)
return bl.instruction_addrs[-1] + 4
[]
def _next_inst(self, bl): return bl.instruction_addrs[-1] + 4
[ "def", "_next_inst", "(", "self", ",", "bl", ")", ":", "return", "bl", ".", "instruction_addrs", "[", "-", "1", "]", "+", "4" ]
https://github.com/ucsb-seclab/karonte/blob/427ac313e596f723e40768b95d13bd7a9fc92fd8/eval/multi_bin/all_bins/taint_analysis/coretaint.py#L1022-L1023
Matheus-Garbelini/sweyntooth_bluetooth_low_energy_attacks
40c985b9a9ff1189ddf278462440b120cf96b196
libs/scapy/layers/ipsec.py
python
CryptAlgo.__init__
(self, name, cipher, mode, block_size=None, iv_size=None, key_size=None, icv_size=None, salt_size=None, format_mode_iv=None)
:param name: the name of this encryption algorithm :param cipher: a Cipher module :param mode: the mode used with the cipher module :param block_size: the length a block for this algo. Defaults to the `block_size` of the cipher. :param iv_size: the length of th...
:param name: the name of this encryption algorithm :param cipher: a Cipher module :param mode: the mode used with the cipher module :param block_size: the length a block for this algo. Defaults to the `block_size` of the cipher. :param iv_size: the length of th...
[ ":", "param", "name", ":", "the", "name", "of", "this", "encryption", "algorithm", ":", "param", "cipher", ":", "a", "Cipher", "module", ":", "param", "mode", ":", "the", "mode", "used", "with", "the", "cipher", "module", ":", "param", "block_size", ":",...
def __init__(self, name, cipher, mode, block_size=None, iv_size=None, key_size=None, icv_size=None, salt_size=None, format_mode_iv=None): # noqa: E501 """ :param name: the name of this encryption algorithm :param cipher: a Cipher module :param mode: the mode used with t...
[ "def", "__init__", "(", "self", ",", "name", ",", "cipher", ",", "mode", ",", "block_size", "=", "None", ",", "iv_size", "=", "None", ",", "key_size", "=", "None", ",", "icv_size", "=", "None", ",", "salt_size", "=", "None", ",", "format_mode_iv", "=",...
https://github.com/Matheus-Garbelini/sweyntooth_bluetooth_low_energy_attacks/blob/40c985b9a9ff1189ddf278462440b120cf96b196/libs/scapy/layers/ipsec.py#L202-L261
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/djangorestframework-3.9.4/rest_framework/schemas/generators.py
python
is_api_view
(callback)
return (cls is not None) and issubclass(cls, APIView)
Return `True` if the given view callback is a REST framework view/viewset.
Return `True` if the given view callback is a REST framework view/viewset.
[ "Return", "True", "if", "the", "given", "view", "callback", "is", "a", "REST", "framework", "view", "/", "viewset", "." ]
def is_api_view(callback): """ Return `True` if the given view callback is a REST framework view/viewset. """ # Avoid import cycle on APIView from rest_framework.views import APIView cls = getattr(callback, 'cls', None) return (cls is not None) and issubclass(cls, APIView)
[ "def", "is_api_view", "(", "callback", ")", ":", "# Avoid import cycle on APIView", "from", "rest_framework", ".", "views", "import", "APIView", "cls", "=", "getattr", "(", "callback", ",", "'cls'", ",", "None", ")", "return", "(", "cls", "is", "not", "None", ...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/djangorestframework-3.9.4/rest_framework/schemas/generators.py#L44-L51
exodrifter/unity-python
bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d
Lib/bdb.py
python
Bdb.user_call
(self, frame, argument_list)
This method is called when there is the remote possibility that we ever need to stop in this function.
This method is called when there is the remote possibility that we ever need to stop in this function.
[ "This", "method", "is", "called", "when", "there", "is", "the", "remote", "possibility", "that", "we", "ever", "need", "to", "stop", "in", "this", "function", "." ]
def user_call(self, frame, argument_list): """This method is called when there is the remote possibility that we ever need to stop in this function.""" pass
[ "def", "user_call", "(", "self", ",", "frame", ",", "argument_list", ")", ":", "pass" ]
https://github.com/exodrifter/unity-python/blob/bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d/Lib/bdb.py#L157-L160
aws/aws-cli
d697e0ed79fca0f853ce53efe1f83ee41a478134
awscli/customizations/cloudtrail/validation.py
python
S3ClientProvider.get_client
(self, bucket_name)
return self._create_client(region_name)
Creates an S3 client that can work with the given bucket name
Creates an S3 client that can work with the given bucket name
[ "Creates", "an", "S3", "client", "that", "can", "work", "with", "the", "given", "bucket", "name" ]
def get_client(self, bucket_name): """Creates an S3 client that can work with the given bucket name""" region_name = self._get_bucket_region(bucket_name) return self._create_client(region_name)
[ "def", "get_client", "(", "self", ",", "bucket_name", ")", ":", "region_name", "=", "self", ".", "_get_bucket_region", "(", "bucket_name", ")", "return", "self", ".", "_create_client", "(", "region_name", ")" ]
https://github.com/aws/aws-cli/blob/d697e0ed79fca0f853ce53efe1f83ee41a478134/awscli/customizations/cloudtrail/validation.py#L171-L174
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/scipy/linalg/_interpolative_backend.py
python
iddr_aidi
(m, n, k)
return _id.iddr_aidi(m, n, k)
Initialize array for :func:`iddr_aid`. :param m: Matrix row dimension. :type m: int :param n: Matrix column dimension. :type n: int :param k: Rank of ID. :type k: int :return: Initialization array to be used by :func:`iddr_aid`. :rtype: :class:`numpy.nda...
Initialize array for :func:`iddr_aid`.
[ "Initialize", "array", "for", ":", "func", ":", "iddr_aid", "." ]
def iddr_aidi(m, n, k): """ Initialize array for :func:`iddr_aid`. :param m: Matrix row dimension. :type m: int :param n: Matrix column dimension. :type n: int :param k: Rank of ID. :type k: int :return: Initialization array to be used by :func:`iddr...
[ "def", "iddr_aidi", "(", "m", ",", "n", ",", "k", ")", ":", "return", "_id", ".", "iddr_aidi", "(", "m", ",", "n", ",", "k", ")" ]
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/scipy/linalg/_interpolative_backend.py#L736-L754