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
catalyst-team/catalyst
678dc06eda1848242df010b7f34adb572def2598
catalyst/metrics/_confusion_matrix.py
python
ConfusionMatrixMetric.compute
(self)
Returns: Confusion matrix of K rows and K columns, where rows corresponds to ground-truth targets and columns corresponds to predicted targets.
Returns: Confusion matrix of K rows and K columns, where rows corresponds to ground-truth targets and columns corresponds to predicted targets.
[ "Returns", ":", "Confusion", "matrix", "of", "K", "rows", "and", "K", "columns", "where", "rows", "corresponds", "to", "ground", "-", "truth", "targets", "and", "columns", "corresponds", "to", "predicted", "targets", "." ]
def compute(self) -> Any: """ Returns: Confusion matrix of K rows and K columns, where rows corresponds to ground-truth targets and columns corresponds to predicted targets. """ # ddp hotfix, could be done better # but metric must handle DDP on...
[ "def", "compute", "(", "self", ")", "->", "Any", ":", "# ddp hotfix, could be done better", "# but metric must handle DDP on it's own", "if", "self", ".", "_ddp_backend", "==", "\"xla\"", ":", "# if you have \"RuntimeError: Aborted: Session XXX is not found\" here", "# please, as...
https://github.com/catalyst-team/catalyst/blob/678dc06eda1848242df010b7f34adb572def2598/catalyst/metrics/_confusion_matrix.py#L150-L174
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/27/Lib/site-packages/win32com/decimal_23.py
python
Decimal.sqrt
(self, context=None)
return ans._fix(context)
Return the square root of self. Uses a converging algorithm (Xn+1 = 0.5*(Xn + self / Xn)) Should quadratically approach the right answer.
Return the square root of self.
[ "Return", "the", "square", "root", "of", "self", "." ]
def sqrt(self, context=None): """Return the square root of self. Uses a converging algorithm (Xn+1 = 0.5*(Xn + self / Xn)) Should quadratically approach the right answer. """ if self._is_special: ans = self._check_nans(context=context) if ans: ...
[ "def", "sqrt", "(", "self", ",", "context", "=", "None", ")", ":", "if", "self", ".", "_is_special", ":", "ans", "=", "self", ".", "_check_nans", "(", "context", "=", "context", ")", "if", "ans", ":", "return", "ans", "if", "self", ".", "_isinfinity"...
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/site-packages/win32com/decimal_23.py#L1879-L1999
poodarchu/Det3D
01258d8cb26656c5b950f8d41f9dcc1dd62a391e
det3d/models/builder.py
python
build_neck
(cfg)
return build(cfg, NECKS)
[]
def build_neck(cfg): return build(cfg, NECKS)
[ "def", "build_neck", "(", "cfg", ")", ":", "return", "build", "(", "cfg", ",", "NECKS", ")" ]
https://github.com/poodarchu/Det3D/blob/01258d8cb26656c5b950f8d41f9dcc1dd62a391e/det3d/models/builder.py#L32-L33
ysig/GraKeL
33ffff18d99c13f8afc0438a5691cb1206b119fb
grakel/kernels/neighborhood_hash.py
python
NeighborhoodHash.fit
(self, X, y=None)
return self
Fit a dataset, for a transformer. Parameters ---------- X : iterable Each element must be an iterable with at most three features and at least one. The first that is obligatory is a valid graph structure (adjacency matrix or edge_dictionary) while the second ...
Fit a dataset, for a transformer.
[ "Fit", "a", "dataset", "for", "a", "transformer", "." ]
def fit(self, X, y=None): """Fit a dataset, for a transformer. Parameters ---------- X : iterable Each element must be an iterable with at most three features and at least one. The first that is obligatory is a valid graph structure (adjacency matrix ...
[ "def", "fit", "(", "self", ",", "X", ",", "y", "=", "None", ")", ":", "self", ".", "_method_calling", "=", "1", "self", ".", "_is_transformed", "=", "False", "# Input validation and parsing", "self", ".", "initialize", "(", ")", "if", "X", "is", "None", ...
https://github.com/ysig/GraKeL/blob/33ffff18d99c13f8afc0438a5691cb1206b119fb/grakel/kernels/neighborhood_hash.py#L95-L210
PySimpleGUI/PySimpleGUI
6c0d1fb54f493d45e90180b322fbbe70f7a5af3c
DemoPrograms/Demo_OpenCV_Simple_GUI.py
python
main
()
[]
def main(): sg.theme('LightGreen') # define the window layout layout = [ [sg.Text('OpenCV Demo', size=(60, 1), justification='center')], [sg.Image(filename='', key='-IMAGE-')], [sg.Radio('None', 'Radio', True, size=(10, 1))], [sg.Radio('threshold', 'Radio', size=(10, 1), key='-THRES...
[ "def", "main", "(", ")", ":", "sg", ".", "theme", "(", "'LightGreen'", ")", "# define the window layout", "layout", "=", "[", "[", "sg", ".", "Text", "(", "'OpenCV Demo'", ",", "size", "=", "(", "60", ",", "1", ")", ",", "justification", "=", "'center'...
https://github.com/PySimpleGUI/PySimpleGUI/blob/6c0d1fb54f493d45e90180b322fbbe70f7a5af3c/DemoPrograms/Demo_OpenCV_Simple_GUI.py#L18-L73
collinsctk/PyQYT
7af3673955f94ff1b2df2f94220cd2dab2e252af
ExtentionPackages/pycparser/c_parser.py
python
CParser.p_abstract_declarator_3
(self, p)
abstract_declarator : direct_abstract_declarator
abstract_declarator : direct_abstract_declarator
[ "abstract_declarator", ":", "direct_abstract_declarator" ]
def p_abstract_declarator_3(self, p): """ abstract_declarator : direct_abstract_declarator """ p[0] = p[1]
[ "def", "p_abstract_declarator_3", "(", "self", ",", "p", ")", ":", "p", "[", "0", "]", "=", "p", "[", "1", "]" ]
https://github.com/collinsctk/PyQYT/blob/7af3673955f94ff1b2df2f94220cd2dab2e252af/ExtentionPackages/pycparser/c_parser.py#L1247-L1250
flaskbb/flaskbb
de13a37fcb713b9c627632210ab9a7bb980d591f
flaskbb/plugins/manager.py
python
FlaskBBPluginManager.list_name
(self)
return list(self._name2plugin.keys())
Returns only the enabled plugin names.
Returns only the enabled plugin names.
[ "Returns", "only", "the", "enabled", "plugin", "names", "." ]
def list_name(self): """Returns only the enabled plugin names.""" return list(self._name2plugin.keys())
[ "def", "list_name", "(", "self", ")", ":", "return", "list", "(", "self", ".", "_name2plugin", ".", "keys", "(", ")", ")" ]
https://github.com/flaskbb/flaskbb/blob/de13a37fcb713b9c627632210ab9a7bb980d591f/flaskbb/plugins/manager.py#L133-L135
pywinauto/pywinauto
7235e6f83edfd96a7aeb8bbf9fef7b8f3d912512
pywinauto/clipboard.py
python
GetData
(format_id = win32clipboard.CF_UNICODETEXT)
return data
Return the data from the clipboard in the requested format
Return the data from the clipboard in the requested format
[ "Return", "the", "data", "from", "the", "clipboard", "in", "the", "requested", "format" ]
def GetData(format_id = win32clipboard.CF_UNICODETEXT): """Return the data from the clipboard in the requested format""" if format_id not in GetClipboardFormats(): raise RuntimeError("That format is not available") win32clipboard.OpenClipboard() try: data = win32clipboard.GetClipboardDa...
[ "def", "GetData", "(", "format_id", "=", "win32clipboard", ".", "CF_UNICODETEXT", ")", ":", "if", "format_id", "not", "in", "GetClipboardFormats", "(", ")", ":", "raise", "RuntimeError", "(", "\"That format is not available\"", ")", "win32clipboard", ".", "OpenClipb...
https://github.com/pywinauto/pywinauto/blob/7235e6f83edfd96a7aeb8bbf9fef7b8f3d912512/pywinauto/clipboard.py#L88-L99
larryhastings/gilectomy
4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a
Lib/tkinter/__init__.py
python
Listbox.get
(self, first, last=None)
Get list of items from FIRST to LAST (included).
Get list of items from FIRST to LAST (included).
[ "Get", "list", "of", "items", "from", "FIRST", "to", "LAST", "(", "included", ")", "." ]
def get(self, first, last=None): """Get list of items from FIRST to LAST (included).""" if last is not None: return self.tk.splitlist(self.tk.call( self._w, 'get', first, last)) else: return self.tk.call(self._w, 'get', first)
[ "def", "get", "(", "self", ",", "first", ",", "last", "=", "None", ")", ":", "if", "last", "is", "not", "None", ":", "return", "self", ".", "tk", ".", "splitlist", "(", "self", ".", "tk", ".", "call", "(", "self", ".", "_w", ",", "'get'", ",", ...
https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/tkinter/__init__.py#L2622-L2628
wwqgtxx/wwqLyParse
33136508e52821babd9294fdecffbdf02d73a6fc
wwqLyParse/lib/flask_lib/flask/app.py
python
Flask.test_client
(self, use_cookies=True, **kwargs)
return cls(self, self.response_class, use_cookies=use_cookies, **kwargs)
Creates a test client for this application. For information about unit testing head over to :ref:`testing`. Note that if you are testing for assertions or exceptions in your application code, you must set ``app.testing = True`` in order for the exceptions to propagate to the test clien...
Creates a test client for this application. For information about unit testing head over to :ref:`testing`.
[ "Creates", "a", "test", "client", "for", "this", "application", ".", "For", "information", "about", "unit", "testing", "head", "over", "to", ":", "ref", ":", "testing", "." ]
def test_client(self, use_cookies=True, **kwargs): """Creates a test client for this application. For information about unit testing head over to :ref:`testing`. Note that if you are testing for assertions or exceptions in your application code, you must set ``app.testing = True`` in o...
[ "def", "test_client", "(", "self", ",", "use_cookies", "=", "True", ",", "*", "*", "kwargs", ")", ":", "cls", "=", "self", ".", "test_client_class", "if", "cls", "is", "None", ":", "from", "flask", ".", "testing", "import", "FlaskClient", "as", "cls", ...
https://github.com/wwqgtxx/wwqLyParse/blob/33136508e52821babd9294fdecffbdf02d73a6fc/wwqLyParse/lib/flask_lib/flask/app.py#L950-L1004
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/insights/v1/room/__init__.py
python
RoomList.__call__
(self, room_sid)
return RoomContext(self._version, room_sid=room_sid, )
Constructs a RoomContext :param room_sid: The SID of the Room resource. :returns: twilio.rest.insights.v1.room.RoomContext :rtype: twilio.rest.insights.v1.room.RoomContext
Constructs a RoomContext
[ "Constructs", "a", "RoomContext" ]
def __call__(self, room_sid): """ Constructs a RoomContext :param room_sid: The SID of the Room resource. :returns: twilio.rest.insights.v1.room.RoomContext :rtype: twilio.rest.insights.v1.room.RoomContext """ return RoomContext(self._version, room_sid=room_sid,...
[ "def", "__call__", "(", "self", ",", "room_sid", ")", ":", "return", "RoomContext", "(", "self", ".", "_version", ",", "room_sid", "=", "room_sid", ",", ")" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/insights/v1/room/__init__.py#L171-L180
pyansys/pymapdl
c07291fc062b359abf0e92b95a92d753a95ef3d7
ansys/mapdl/core/_commands/preproc/digitizing.py
python
Digitizing.dmove
(self, node1="", node2="", ninc="", **kwargs)
return self.run(command, **kwargs)
Digitizes nodes on surfaces and along intersections. APDL Command: DMOVE Parameters ---------- node1, node2, ninc Digitize nodes NODE1through NODE2 in steps of NINC. NODE2 defaults to NODE1 and NINC defaults to 1. Notes ----- Digitizes ...
Digitizes nodes on surfaces and along intersections.
[ "Digitizes", "nodes", "on", "surfaces", "and", "along", "intersections", "." ]
def dmove(self, node1="", node2="", ninc="", **kwargs): """Digitizes nodes on surfaces and along intersections. APDL Command: DMOVE Parameters ---------- node1, node2, ninc Digitize nodes NODE1through NODE2 in steps of NINC. NODE2 defaults to NODE1 and ...
[ "def", "dmove", "(", "self", ",", "node1", "=", "\"\"", ",", "node2", "=", "\"\"", ",", "ninc", "=", "\"\"", ",", "*", "*", "kwargs", ")", ":", "command", "=", "f\"DMOVE,{node1},{node2},{ninc}\"", "return", "self", ".", "run", "(", "command", ",", "*",...
https://github.com/pyansys/pymapdl/blob/c07291fc062b359abf0e92b95a92d753a95ef3d7/ansys/mapdl/core/_commands/preproc/digitizing.py#L24-L47
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/Ubuntu_13/pyasn1/type/univ.py
python
Real.__mod__
(self, value)
return self.clone(float(self) % value)
[]
def __mod__(self, value): return self.clone(float(self) % value)
[ "def", "__mod__", "(", "self", ",", "value", ")", ":", "return", "self", ".", "clone", "(", "float", "(", "self", ")", "%", "value", ")" ]
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Ubuntu_13/pyasn1/type/univ.py#L581-L581
Jenyay/outwiker
50530cf7b3f71480bb075b2829bc0669773b835b
plugins/webpage/webpage/libs/html5lib/treebuilders/base.py
python
Node.cloneNode
(self)
Return a shallow copy of the current node i.e. a node with the same name and attributes but with no parent or child nodes
Return a shallow copy of the current node i.e. a node with the same name and attributes but with no parent or child nodes
[ "Return", "a", "shallow", "copy", "of", "the", "current", "node", "i", ".", "e", ".", "a", "node", "with", "the", "same", "name", "and", "attributes", "but", "with", "no", "parent", "or", "child", "nodes" ]
def cloneNode(self): """Return a shallow copy of the current node i.e. a node with the same name and attributes but with no parent or child nodes """ raise NotImplementedError
[ "def", "cloneNode", "(", "self", ")", ":", "raise", "NotImplementedError" ]
https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/plugins/webpage/webpage/libs/html5lib/treebuilders/base.py#L110-L114
NVIDIA/DeepLearningExamples
589604d49e016cd9ef4525f7abcc9c7b826cfc5e
TensorFlow/Translation/GNMT/variable_mgr/variable_mgr_util.py
python
aggregate_single_gradient_using_copy
(grad_and_vars, use_mean, check_inf_nan)
Calculate the average gradient for a shared variable across all towers. Note that this function provides a synchronization point across all towers. Args: grad_and_vars: A list or tuple of (gradient, variable) tuples. Each (gradient, variable) pair within the outer list represents the gradient of t...
Calculate the average gradient for a shared variable across all towers.
[ "Calculate", "the", "average", "gradient", "for", "a", "shared", "variable", "across", "all", "towers", "." ]
def aggregate_single_gradient_using_copy(grad_and_vars, use_mean, check_inf_nan): """Calculate the average gradient for a shared variable across all towers. Note that this function provides a synchronization point across all towers. Args: grad_and_vars: A list or tup...
[ "def", "aggregate_single_gradient_using_copy", "(", "grad_and_vars", ",", "use_mean", ",", "check_inf_nan", ")", ":", "grads", "=", "[", "g", "for", "g", ",", "_", "in", "grad_and_vars", "]", "if", "any", "(", "isinstance", "(", "g", ",", "tf", ".", "Index...
https://github.com/NVIDIA/DeepLearningExamples/blob/589604d49e016cd9ef4525f7abcc9c7b826cfc5e/TensorFlow/Translation/GNMT/variable_mgr/variable_mgr_util.py#L499-L534
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/combinatorics/permutations.py
python
Permutation.commutator
(self, x)
return _af_new([a[b[inva[i]]] for i in invb])
Return the commutator of self and x: ``~x*~self*x*self`` If f and g are part of a group, G, then the commutator of f and g is the group identity iff f and g commute, i.e. fg == gf. Examples ======== >>> from sympy.combinatorics.permutations import Permutation >>> Permu...
Return the commutator of self and x: ``~x*~self*x*self``
[ "Return", "the", "commutator", "of", "self", "and", "x", ":", "~x", "*", "~self", "*", "x", "*", "self" ]
def commutator(self, x): """Return the commutator of self and x: ``~x*~self*x*self`` If f and g are part of a group, G, then the commutator of f and g is the group identity iff f and g commute, i.e. fg == gf. Examples ======== >>> from sympy.combinatorics.permutations ...
[ "def", "commutator", "(", "self", ",", "x", ")", ":", "a", "=", "self", ".", "array_form", "b", "=", "x", ".", "array_form", "n", "=", "len", "(", "a", ")", "if", "len", "(", "b", ")", "!=", "n", ":", "raise", "ValueError", "(", "\"The permutatio...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/combinatorics/permutations.py#L2026-L2072
4shadoww/hakkuframework
409a11fc3819d251f86faa3473439f8c19066a21
lib/urllib3/filepost.py
python
iter_fields
(fields)
return ((k, v) for k, v in fields)
.. deprecated:: 1.6 Iterate over fields. The addition of :class:`~urllib3.fields.RequestField` makes this function obsolete. Instead, use :func:`iter_field_objects`, which returns :class:`~urllib3.fields.RequestField` objects. Supports list of (k, v) tuples and dicts.
.. deprecated:: 1.6
[ "..", "deprecated", "::", "1", ".", "6" ]
def iter_fields(fields): """ .. deprecated:: 1.6 Iterate over fields. The addition of :class:`~urllib3.fields.RequestField` makes this function obsolete. Instead, use :func:`iter_field_objects`, which returns :class:`~urllib3.fields.RequestField` objects. Supports list of (k, v) tuples an...
[ "def", "iter_fields", "(", "fields", ")", ":", "if", "isinstance", "(", "fields", ",", "dict", ")", ":", "return", "(", "(", "k", ",", "v", ")", "for", "k", ",", "v", "in", "six", ".", "iteritems", "(", "fields", ")", ")", "return", "(", "(", "...
https://github.com/4shadoww/hakkuframework/blob/409a11fc3819d251f86faa3473439f8c19066a21/lib/urllib3/filepost.py#L45-L60
graphcore/examples
46d2b7687b829778369fc6328170a7b14761e5c6
applications/tensorflow/contrastive_divergence_vae/utils/data_utils.py
python
xy_array_combine
(arrays, shuffle=True)
return arrays, shuffle_idx
Cobines X and Y arrays into a single 2D numpy array, shuffles if required
Cobines X and Y arrays into a single 2D numpy array, shuffles if required
[ "Cobines", "X", "and", "Y", "arrays", "into", "a", "single", "2D", "numpy", "array", "shuffles", "if", "required" ]
def xy_array_combine(arrays, shuffle=True): """Cobines X and Y arrays into a single 2D numpy array, shuffles if required""" x_arr = np.reshape(arrays['x'], [arrays['x'].shape[0], -1]) if arrays['y'].ndim == 1: y_arr = np.expand_dims(arrays['y'], 1) else: y_arr = arrays['y'] arrays =...
[ "def", "xy_array_combine", "(", "arrays", ",", "shuffle", "=", "True", ")", ":", "x_arr", "=", "np", ".", "reshape", "(", "arrays", "[", "'x'", "]", ",", "[", "arrays", "[", "'x'", "]", ".", "shape", "[", "0", "]", ",", "-", "1", "]", ")", "if"...
https://github.com/graphcore/examples/blob/46d2b7687b829778369fc6328170a7b14761e5c6/applications/tensorflow/contrastive_divergence_vae/utils/data_utils.py#L46-L60
mckinziebrandon/DeepChatModels
4fef8a6ce00d92235a2fb0e427d2ec60833022d2
data/data_helper.py
python
DataHelper.load_random
(self, year=None)
return pd.read_json(files[rand_index], lines=True)
Load a random data file and return as a DataFrame. Args: year: (int) If given, get a random file from this year.
Load a random data file and return as a DataFrame. Args: year: (int) If given, get a random file from this year.
[ "Load", "a", "random", "data", "file", "and", "return", "as", "a", "DataFrame", ".", "Args", ":", "year", ":", "(", "int", ")", "If", "given", "get", "a", "random", "file", "from", "this", "year", "." ]
def load_random(self, year=None): """Load a random data file and return as a DataFrame. Args: year: (int) If given, get a random file from this year. """ files = self.file_paths if year is not None: files = list(filter(lambda f: str(year) in f, f...
[ "def", "load_random", "(", "self", ",", "year", "=", "None", ")", ":", "files", "=", "self", ".", "file_paths", "if", "year", "is", "not", "None", ":", "files", "=", "list", "(", "filter", "(", "lambda", "f", ":", "str", "(", "year", ")", "in", "...
https://github.com/mckinziebrandon/DeepChatModels/blob/4fef8a6ce00d92235a2fb0e427d2ec60833022d2/data/data_helper.py#L153-L166
cloudtools/troposphere
62a90a5e88c6e2df8c3f0a5d56284df212438dc1
troposphere/validators/s3.py
python
validate_bucket
(self)
Class: Bucket
Class: Bucket
[ "Class", ":", "Bucket" ]
def validate_bucket(self): """ Class: Bucket """ from .. import AWSHelperFn access_control_types = [ Private, PublicRead, PublicReadWrite, AuthenticatedRead, BucketOwnerRead, BucketOwnerFullControl, LogDeliveryWrite, ] access_control...
[ "def", "validate_bucket", "(", "self", ")", ":", "from", ".", ".", "import", "AWSHelperFn", "access_control_types", "=", "[", "Private", ",", "PublicRead", ",", "PublicReadWrite", ",", "AuthenticatedRead", ",", "BucketOwnerRead", ",", "BucketOwnerFullControl", ",", ...
https://github.com/cloudtools/troposphere/blob/62a90a5e88c6e2df8c3f0a5d56284df212438dc1/troposphere/validators/s3.py#L50-L71
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/plat-sunos5/IN.py
python
htons
(x)
return (x)
[]
def htons(x): return (x)
[ "def", "htons", "(", "x", ")", ":", "return", "(", "x", ")" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/plat-sunos5/IN.py#L1245-L1245
NVIDIA/NeMo
5b0c0b4dec12d87d3cd960846de4105309ce938e
nemo/collections/nlp/models/duplex_text_normalization/duplex_tagger.py
python
DuplexTaggerModel.validation_epoch_end
(self, outputs)
Called at the end of validation to aggregate outputs. :param outputs: list of individual outputs of each validation step.
Called at the end of validation to aggregate outputs. :param outputs: list of individual outputs of each validation step.
[ "Called", "at", "the", "end", "of", "validation", "to", "aggregate", "outputs", ".", ":", "param", "outputs", ":", "list", "of", "individual", "outputs", "of", "each", "validation", "step", "." ]
def validation_epoch_end(self, outputs): """ Called at the end of validation to aggregate outputs. :param outputs: list of individual outputs of each validation step. """ # calculate metrics and classification report precision, _, _, report = self.classification_report.co...
[ "def", "validation_epoch_end", "(", "self", ",", "outputs", ")", ":", "# calculate metrics and classification report", "precision", ",", "_", ",", "_", ",", "report", "=", "self", ".", "classification_report", ".", "compute", "(", ")", "logging", ".", "info", "(...
https://github.com/NVIDIA/NeMo/blob/5b0c0b4dec12d87d3cd960846de4105309ce938e/nemo/collections/nlp/models/duplex_text_normalization/duplex_tagger.py#L123-L135
yuxiaokui/Intranet-Penetration
f57678a204840c83cbf3308e3470ae56c5ff514b
proxy/XX-Net/code/default/launcher/web_control.py
python
confirm_xxnet_exit
()
return is_xxnet_exit
suppose xxnet is running, try to close it
suppose xxnet is running, try to close it
[ "suppose", "xxnet", "is", "running", "try", "to", "close", "it" ]
def confirm_xxnet_exit(): """suppose xxnet is running, try to close it """ is_xxnet_exit = False xlog.debug("start confirm_xxnet_exit") for i in range(30): # gae_proxy(default port:8087) if http_request("http://127.0.0.1:8087/quit") == False: xlog.debug("good, xxnet:808...
[ "def", "confirm_xxnet_exit", "(", ")", ":", "is_xxnet_exit", "=", "False", "xlog", ".", "debug", "(", "\"start confirm_xxnet_exit\"", ")", "for", "i", "in", "range", "(", "30", ")", ":", "# gae_proxy(default port:8087)", "if", "http_request", "(", "\"http://127.0....
https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/launcher/web_control.py#L464-L494
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/ipaddress.py
python
_BaseNetwork.prefixlen
(self)
return self._prefixlen
[]
def prefixlen(self): return self._prefixlen
[ "def", "prefixlen", "(", "self", ")", ":", "return", "self", ".", "_prefixlen" ]
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/ipaddress.py#L859-L860
twisted/twisted
dee676b040dd38b847ea6fb112a712cb5e119490
src/twisted/python/modules.py
python
PythonModule._subModuleName
(self, mn)
return self.name + "." + mn
submodules of this module are prefixed with our name.
submodules of this module are prefixed with our name.
[ "submodules", "of", "this", "module", "are", "prefixed", "with", "our", "name", "." ]
def _subModuleName(self, mn): """ submodules of this module are prefixed with our name. """ return self.name + "." + mn
[ "def", "_subModuleName", "(", "self", ",", "mn", ")", ":", "return", "self", ".", "name", "+", "\".\"", "+", "mn" ]
https://github.com/twisted/twisted/blob/dee676b040dd38b847ea6fb112a712cb5e119490/src/twisted/python/modules.py#L408-L412
cloudmatrix/esky
6fde3201f0335064931a6c7f7847fc5ad39001b4
esky/util.py
python
copy_ownership_info
(src,dst,cur="",default=None)
Copy file ownership from src onto dst, as much as possible.
Copy file ownership from src onto dst, as much as possible.
[ "Copy", "file", "ownership", "from", "src", "onto", "dst", "as", "much", "as", "possible", "." ]
def copy_ownership_info(src,dst,cur="",default=None): """Copy file ownership from src onto dst, as much as possible.""" # TODO: how on win32? source = os.path.join(src,cur) target = os.path.join(dst,cur) if default is None: default = os.stat(src) if os.path.exists(source): info =...
[ "def", "copy_ownership_info", "(", "src", ",", "dst", ",", "cur", "=", "\"\"", ",", "default", "=", "None", ")", ":", "# TODO: how on win32?", "source", "=", "os", ".", "path", ".", "join", "(", "src", ",", "cur", ")", "target", "=", "os", ".", "path...
https://github.com/cloudmatrix/esky/blob/6fde3201f0335064931a6c7f7847fc5ad39001b4/esky/util.py#L454-L472
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/models/perceiver/tokenization_perceiver.py
python
PerceiverTokenizer.get_special_tokens_mask
( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None, already_has_special_tokens: bool = False )
return [1] + ([0] * len(token_ids_0)) + [1] + ([0] * len(token_ids_1)) + [1]
Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding special tokens using the tokenizer `prepare_for_model` method. Args: token_ids_0 (`List[int]`): List of IDs. token_ids_1 (`List[int]`, *optional*): ...
Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding special tokens using the tokenizer `prepare_for_model` method.
[ "Retrieve", "sequence", "ids", "from", "a", "token", "list", "that", "has", "no", "special", "tokens", "added", ".", "This", "method", "is", "called", "when", "adding", "special", "tokens", "using", "the", "tokenizer", "prepare_for_model", "method", "." ]
def get_special_tokens_mask( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None, already_has_special_tokens: bool = False ) -> List[int]: """ Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding special tokens ...
[ "def", "get_special_tokens_mask", "(", "self", ",", "token_ids_0", ":", "List", "[", "int", "]", ",", "token_ids_1", ":", "Optional", "[", "List", "[", "int", "]", "]", "=", "None", ",", "already_has_special_tokens", ":", "bool", "=", "False", ")", "->", ...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/perceiver/tokenization_perceiver.py#L116-L142
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/urllib3/packages/ssl_match_hostname/_implementation.py
python
_ipaddress_match
(ipname, host_ip)
return ip == host_ip
Exact matching of IP addresses. RFC 6125 explicitly doesn't define an algorithm for this (section 1.7.2 - "Out of Scope").
Exact matching of IP addresses.
[ "Exact", "matching", "of", "IP", "addresses", "." ]
def _ipaddress_match(ipname, host_ip): """Exact matching of IP addresses. RFC 6125 explicitly doesn't define an algorithm for this (section 1.7.2 - "Out of Scope"). """ # OpenSSL may add a trailing newline to a subjectAltName's IP address # Divergence from upstream: ipaddress can't handle byte ...
[ "def", "_ipaddress_match", "(", "ipname", ",", "host_ip", ")", ":", "# OpenSSL may add a trailing newline to a subjectAltName's IP address", "# Divergence from upstream: ipaddress can't handle byte str", "ip", "=", "ipaddress", ".", "ip_address", "(", "_to_unicode", "(", "ipname"...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/urllib3/packages/ssl_match_hostname/_implementation.py#L83-L92
Qiskit/qiskit-terra
b66030e3b9192efdd3eb95cf25c6545fe0a13da4
qiskit/circuit/library/arithmetic/piecewise_linear_pauli_rotations.py
python
PiecewiseLinearPauliRotations._build
(self)
If not already built, build the circuit.
If not already built, build the circuit.
[ "If", "not", "already", "built", "build", "the", "circuit", "." ]
def _build(self): """If not already built, build the circuit.""" if self._is_built: return super()._build() circuit = QuantumCircuit(*self.qregs, name=self.name) qr_state = circuit.qubits[: self.num_state_qubits] qr_target = [circuit.qubits[self.num_state_q...
[ "def", "_build", "(", "self", ")", ":", "if", "self", ".", "_is_built", ":", "return", "super", "(", ")", ".", "_build", "(", ")", "circuit", "=", "QuantumCircuit", "(", "*", "self", ".", "qregs", ",", "name", "=", "self", ".", "name", ")", "qr_sta...
https://github.com/Qiskit/qiskit-terra/blob/b66030e3b9192efdd3eb95cf25c6545fe0a13da4/qiskit/circuit/library/arithmetic/piecewise_linear_pauli_rotations.py#L243-L290
KhronosGroup/OpenXR-SDK-Source
76756e2e7849b15466d29bee7d80cada92865550
external/python/jinja2/compiler.py
python
has_safe_repr
(value)
return False
Does the node have a safe representation?
Does the node have a safe representation?
[ "Does", "the", "node", "have", "a", "safe", "representation?" ]
def has_safe_repr(value): """Does the node have a safe representation?""" if value is None or value is NotImplemented or value is Ellipsis: return True if type(value) in (bool, int, float, complex, range_type, Markup) + string_types: return True if type(value) in (tuple, list, set, froze...
[ "def", "has_safe_repr", "(", "value", ")", ":", "if", "value", "is", "None", "or", "value", "is", "NotImplemented", "or", "value", "is", "Ellipsis", ":", "return", "True", "if", "type", "(", "value", ")", "in", "(", "bool", ",", "int", ",", "float", ...
https://github.com/KhronosGroup/OpenXR-SDK-Source/blob/76756e2e7849b15466d29bee7d80cada92865550/external/python/jinja2/compiler.py#L87-L105
sabnzbd/sabnzbd
52d21e94d3cc6e30764a833fe2a256783d1a8931
sabnzbd/misc.py
python
format_time_left
(totalseconds: int, short_format: bool = False)
return "0:00:00"
Calculate the time left in the format [DD:]HH:MM:SS or [DD:][HH:]MM:SS (short_format)
Calculate the time left in the format [DD:]HH:MM:SS or [DD:][HH:]MM:SS (short_format)
[ "Calculate", "the", "time", "left", "in", "the", "format", "[", "DD", ":", "]", "HH", ":", "MM", ":", "SS", "or", "[", "DD", ":", "]", "[", "HH", ":", "]", "MM", ":", "SS", "(", "short_format", ")" ]
def format_time_left(totalseconds: int, short_format: bool = False) -> str: """Calculate the time left in the format [DD:]HH:MM:SS or [DD:][HH:]MM:SS (short_format)""" if totalseconds > 0: try: minutes, seconds = divmod(totalseconds, 60) hours, minutes = divmod(minutes, 60) ...
[ "def", "format_time_left", "(", "totalseconds", ":", "int", ",", "short_format", ":", "bool", "=", "False", ")", "->", "str", ":", "if", "totalseconds", ">", "0", ":", "try", ":", "minutes", ",", "seconds", "=", "divmod", "(", "totalseconds", ",", "60", ...
https://github.com/sabnzbd/sabnzbd/blob/52d21e94d3cc6e30764a833fe2a256783d1a8931/sabnzbd/misc.py#L93-L117
DebPanigrahi/Machine-Learning
6456d752a4aeae2317eb4da0469f9266cf9e158b
ml_algo.py
python
NormalBayesian.__init__
(self, data, **kwargs)
return
[]
def __init__(self, data, **kwargs): self.data = data covariance = {} μ = {} N = {} for lc in data.label_categories: covariance[lc] = {} μ[lc] = {} N[lc] = {} for class_label in data.class_labels[lc]: Xs = data.Xs[dat...
[ "def", "__init__", "(", "self", ",", "data", ",", "*", "*", "kwargs", ")", ":", "self", ".", "data", "=", "data", "covariance", "=", "{", "}", "μ ", " ", "}", "", "N", "=", "{", "}", "for", "lc", "in", "data", ".", "label_categories", ":", "cov...
https://github.com/DebPanigrahi/Machine-Learning/blob/6456d752a4aeae2317eb4da0469f9266cf9e158b/ml_algo.py#L238-L256
daleroberts/itermplot
e8427ce87b0d74e18e14d8c092a01696c17b4c3e
itermplot/__init__.py
python
ItermplotFigureManager.__init__
(self, canvas, num)
[]
def __init__(self, canvas, num): FigureManagerBase.__init__(self, canvas, num)
[ "def", "__init__", "(", "self", ",", "canvas", ",", "num", ")", ":", "FigureManagerBase", ".", "__init__", "(", "self", ",", "canvas", ",", "num", ")" ]
https://github.com/daleroberts/itermplot/blob/e8427ce87b0d74e18e14d8c092a01696c17b4c3e/itermplot/__init__.py#L256-L257
twisted/twisted
dee676b040dd38b847ea6fb112a712cb5e119490
src/twisted/protocols/ftp.py
python
FTPClient.rename
(self, pathFrom, pathTo)
return result
Rename a file. This method issues the I{RNFR}/I{RNTO} command sequence to rename C{pathFrom} to C{pathTo}. @param pathFrom: the absolute path to the file to be renamed @type pathFrom: C{str} @param pathTo: the absolute path to rename the file to. @type pathTo: C{str} ...
Rename a file.
[ "Rename", "a", "file", "." ]
def rename(self, pathFrom, pathTo): """ Rename a file. This method issues the I{RNFR}/I{RNTO} command sequence to rename C{pathFrom} to C{pathTo}. @param pathFrom: the absolute path to the file to be renamed @type pathFrom: C{str} @param pathTo: the absolute pa...
[ "def", "rename", "(", "self", ",", "pathFrom", ",", "pathTo", ")", ":", "renameFrom", "=", "self", ".", "queueStringCommand", "(", "\"RNFR \"", "+", "self", ".", "escapePath", "(", "pathFrom", ")", ")", "renameTo", "=", "self", ".", "queueStringCommand", "...
https://github.com/twisted/twisted/blob/dee676b040dd38b847ea6fb112a712cb5e119490/src/twisted/protocols/ftp.py#L2922-L2968
pranz24/pytorch-soft-actor-critic
398595e0d9dca98b7db78c7f2f939c969431871a
replay_memory.py
python
ReplayMemory.push
(self, state, action, reward, next_state, done)
[]
def push(self, state, action, reward, next_state, done): if len(self.buffer) < self.capacity: self.buffer.append(None) self.buffer[self.position] = (state, action, reward, next_state, done) self.position = (self.position + 1) % self.capacity
[ "def", "push", "(", "self", ",", "state", ",", "action", ",", "reward", ",", "next_state", ",", "done", ")", ":", "if", "len", "(", "self", ".", "buffer", ")", "<", "self", ".", "capacity", ":", "self", ".", "buffer", ".", "append", "(", "None", ...
https://github.com/pranz24/pytorch-soft-actor-critic/blob/398595e0d9dca98b7db78c7f2f939c969431871a/replay_memory.py#L11-L15
pysathq/pysat
07bf3a5a4428d40eca804e7ebdf4f496aadf4213
pysat/formula.py
python
CNFPlus.__init__
(self, from_file=None, from_fp=None, from_string=None, comment_lead=['c'])
Constructor.
Constructor.
[ "Constructor", "." ]
def __init__(self, from_file=None, from_fp=None, from_string=None, comment_lead=['c']): """ Constructor. """ # atmost constraints are initially empty self.atmosts = [] # calling the base class constructor super(CNFPlus, self).__init__(from_file=f...
[ "def", "__init__", "(", "self", ",", "from_file", "=", "None", ",", "from_fp", "=", "None", ",", "from_string", "=", "None", ",", "comment_lead", "=", "[", "'c'", "]", ")", ":", "# atmost constraints are initially empty", "self", ".", "atmosts", "=", "[", ...
https://github.com/pysathq/pysat/blob/07bf3a5a4428d40eca804e7ebdf4f496aadf4213/pysat/formula.py#L1577-L1588
trailofbits/manticore
b050fdf0939f6c63f503cdf87ec0ab159dd41159
manticore/native/cpu/x86.py
python
X86Cpu.JNS
(cpu, target)
Jumps short if not sign. :param cpu: current CPU. :param target: destination operand.
Jumps short if not sign.
[ "Jumps", "short", "if", "not", "sign", "." ]
def JNS(cpu, target): """ Jumps short if not sign. :param cpu: current CPU. :param target: destination operand. """ cpu.PC = Operators.ITEBV(cpu.address_bit_size, False == cpu.SF, target.read(), cpu.PC)
[ "def", "JNS", "(", "cpu", ",", "target", ")", ":", "cpu", ".", "PC", "=", "Operators", ".", "ITEBV", "(", "cpu", ".", "address_bit_size", ",", "False", "==", "cpu", ".", "SF", ",", "target", ".", "read", "(", ")", ",", "cpu", ".", "PC", ")" ]
https://github.com/trailofbits/manticore/blob/b050fdf0939f6c63f503cdf87ec0ab159dd41159/manticore/native/cpu/x86.py#L3604-L3611
fedspendingtransparency/usaspending-api
b13bd5bcba0369ff8512f61a34745626c3969391
usaspending_api/common/helpers/dict_helpers.py
python
order_nested_object
(nested_object)
Simply recursively order the item. To be used for standardizing objects for JSON dumps
Simply recursively order the item. To be used for standardizing objects for JSON dumps
[ "Simply", "recursively", "order", "the", "item", ".", "To", "be", "used", "for", "standardizing", "objects", "for", "JSON", "dumps" ]
def order_nested_object(nested_object): """ Simply recursively order the item. To be used for standardizing objects for JSON dumps """ if isinstance(nested_object, list): if len(nested_object) > 0 and isinstance(nested_object[0], dict): # Lists of dicts aren't handled by python's sor...
[ "def", "order_nested_object", "(", "nested_object", ")", ":", "if", "isinstance", "(", "nested_object", ",", "list", ")", ":", "if", "len", "(", "nested_object", ")", ">", "0", "and", "isinstance", "(", "nested_object", "[", "0", "]", ",", "dict", ")", "...
https://github.com/fedspendingtransparency/usaspending-api/blob/b13bd5bcba0369ff8512f61a34745626c3969391/usaspending_api/common/helpers/dict_helpers.py#L44-L80
MediaBrowser/plugin.video.emby
71162fc7704656833d8b228dc9014f88742215b1
resources/lib/hooks/player.py
python
Player.stop_playback
(self)
Stop all playback. Check for external player for positionticks. Immediately force an internal update for the item to remove the visual delay waiting on the callback from server.
Stop all playback. Check for external player for positionticks. Immediately force an internal update for the item to remove the visual delay waiting on the callback from server.
[ "Stop", "all", "playback", ".", "Check", "for", "external", "player", "for", "positionticks", ".", "Immediately", "force", "an", "internal", "update", "for", "the", "item", "to", "remove", "the", "visual", "delay", "waiting", "on", "the", "callback", "from", ...
def stop_playback(self): ''' Stop all playback. Check for external player for positionticks. Immediately force an internal update for the item to remove the visual delay waiting on the callback from server. ''' LOG.debug("[ played info ] %s", self.played) for file in self.p...
[ "def", "stop_playback", "(", "self", ")", ":", "LOG", ".", "debug", "(", "\"[ played info ] %s\"", ",", "self", ".", "played", ")", "for", "file", "in", "self", ".", "played", ":", "try", ":", "item", "=", "self", ".", "get_file_info", "(", "file", ")"...
https://github.com/MediaBrowser/plugin.video.emby/blob/71162fc7704656833d8b228dc9014f88742215b1/resources/lib/hooks/player.py#L520-L601
caktus/django-timepiece
52515dec027664890efbc535429e1ba1ee152f40
timepiece/templatetags/timepiece_tags.py
python
_timesheet_url
(url_name, pk, date=None)
return url
Utility to create a time sheet URL with optional date parameters.
Utility to create a time sheet URL with optional date parameters.
[ "Utility", "to", "create", "a", "time", "sheet", "URL", "with", "optional", "date", "parameters", "." ]
def _timesheet_url(url_name, pk, date=None): """Utility to create a time sheet URL with optional date parameters.""" url = reverse(url_name, args=(pk,)) if date: params = {'month': date.month, 'year': date.year} return '?'.join((url, urlencode(params))) return url
[ "def", "_timesheet_url", "(", "url_name", ",", "pk", ",", "date", "=", "None", ")", ":", "url", "=", "reverse", "(", "url_name", ",", "args", "=", "(", "pk", ",", ")", ")", "if", "date", ":", "params", "=", "{", "'month'", ":", "date", ".", "mont...
https://github.com/caktus/django-timepiece/blob/52515dec027664890efbc535429e1ba1ee152f40/timepiece/templatetags/timepiece_tags.py#L222-L228
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/python-openid-2.2.5/openid/server/trustroot.py
python
TrustRoot.buildDiscoveryURL
(self)
Return a discovery URL for this realm. This function does not check to make sure that the realm is valid. Its behaviour on invalid inputs is undefined. @rtype: str @returns: The URL upon which relying party discovery should be run in order to verify the return_to URL ...
Return a discovery URL for this realm.
[ "Return", "a", "discovery", "URL", "for", "this", "realm", "." ]
def buildDiscoveryURL(self): """Return a discovery URL for this realm. This function does not check to make sure that the realm is valid. Its behaviour on invalid inputs is undefined. @rtype: str @returns: The URL upon which relying party discovery should be run in...
[ "def", "buildDiscoveryURL", "(", "self", ")", ":", "if", "self", ".", "wildcard", ":", "# Use \"www.\" in place of the star", "assert", "self", ".", "host", ".", "startswith", "(", "'.'", ")", ",", "self", ".", "host", "www_domain", "=", "'www'", "+", "self"...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/python-openid-2.2.5/openid/server/trustroot.py#L324-L343
openml/openml-python
aed5010c0ef636bd071ce42c09b03c69c080923f
openml/config.py
python
get_server_base_url
()
return server.split("/api")[0]
Return the base URL of the currently configured server. Turns ``"https://www.openml.org/api/v1/xml"`` in ``"https://www.openml.org/"`` Returns ======= str
Return the base URL of the currently configured server.
[ "Return", "the", "base", "URL", "of", "the", "currently", "configured", "server", "." ]
def get_server_base_url() -> str: """Return the base URL of the currently configured server. Turns ``"https://www.openml.org/api/v1/xml"`` in ``"https://www.openml.org/"`` Returns ======= str """ return server.split("/api")[0]
[ "def", "get_server_base_url", "(", ")", "->", "str", ":", "return", "server", ".", "split", "(", "\"/api\"", ")", "[", "0", "]" ]
https://github.com/openml/openml-python/blob/aed5010c0ef636bd071ce42c09b03c69c080923f/openml/config.py#L107-L116
google/grr
8ad8a4d2c5a93c92729206b7771af19d92d4f915
grr/server/grr_response_server/artifact.py
python
ParseResults.AddError
(self, error: parsers.ParseError)
[]
def AddError(self, error: parsers.ParseError) -> None: self._errors.append(error)
[ "def", "AddError", "(", "self", ",", "error", ":", "parsers", ".", "ParseError", ")", "->", "None", ":", "self", ".", "_errors", ".", "append", "(", "error", ")" ]
https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/artifact.py#L330-L331
has2k1/plotnine
6c82cdc20d6f81c96772da73fc07a672a0a0a6ef
plotnine/scales/scale.py
python
scale.reset
(self)
Set the range of the scale to None. i.e Forget all the training
Set the range of the scale to None.
[ "Set", "the", "range", "of", "the", "scale", "to", "None", "." ]
def reset(self): """ Set the range of the scale to None. i.e Forget all the training """ self.range.reset()
[ "def", "reset", "(", "self", ")", ":", "self", ".", "range", ".", "reset", "(", ")" ]
https://github.com/has2k1/plotnine/blob/6c82cdc20d6f81c96772da73fc07a672a0a0a6ef/plotnine/scales/scale.py#L244-L250
PrefectHQ/prefect
67bdc94e2211726d99561f6f52614bec8970e981
src/prefect/tasks/secrets/vault_secret.py
python
VaultSecret._get_vault_secret
(self, name: str)
return value
Connect to vault service and retrieve a secret value Arguments: - name (str): name of the secret to be retrieved using "<mount_point>/<path>" Returns: - secret (dict): a dict of the secret key/value items retrieved Raises: - ValueError: unable to configure t...
Connect to vault service and retrieve a secret value Arguments: - name (str): name of the secret to be retrieved using "<mount_point>/<path>"
[ "Connect", "to", "vault", "service", "and", "retrieve", "a", "secret", "value", "Arguments", ":", "-", "name", "(", "str", ")", ":", "name", "of", "the", "secret", "to", "be", "retrieved", "using", "<mount_point", ">", "/", "<path", ">" ]
def _get_vault_secret(self, name: str): """ Connect to vault service and retrieve a secret value Arguments: - name (str): name of the secret to be retrieved using "<mount_point>/<path>" Returns: - secret (dict): a dict of the secret key/value items retrieved ...
[ "def", "_get_vault_secret", "(", "self", ",", "name", ":", "str", ")", ":", "self", ".", "logger", ".", "debug", "(", "f\"Looking up vault path: {name}\"", ")", "client", "=", "hvac", ".", "Client", "(", ")", "# get vault address url", "vault_url", "=", "os", ...
https://github.com/PrefectHQ/prefect/blob/67bdc94e2211726d99561f6f52614bec8970e981/src/prefect/tasks/secrets/vault_secret.py#L46-L113
reviewboard/rbtools
b4838a640b458641ffd233093ae65971d0b4d529
rbtools/utils/filesystem.py
python
parse_config_file
(filename)
return dict((k, config[k]) for k in set(config.keys()) - set(builtin.keys()))
Parse a .reviewboardrc file. Returns a dictionary containing the configuration from the file. The ``filename`` argument should contain a full path to a .reviewboardrc file.
Parse a .reviewboardrc file.
[ "Parse", "a", ".", "reviewboardrc", "file", "." ]
def parse_config_file(filename): """Parse a .reviewboardrc file. Returns a dictionary containing the configuration from the file. The ``filename`` argument should contain a full path to a .reviewboardrc file. """ config = { 'TREES': {}, 'ALIASES': {}, } try: co...
[ "def", "parse_config_file", "(", "filename", ")", ":", "config", "=", "{", "'TREES'", ":", "{", "}", ",", "'ALIASES'", ":", "{", "}", ",", "}", "try", ":", "config", "=", "_load_python_file", "(", "filename", ",", "config", ")", "except", "SyntaxError", ...
https://github.com/reviewboard/rbtools/blob/b4838a640b458641ffd233093ae65971d0b4d529/rbtools/utils/filesystem.py#L239-L260
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/zmq/auth/certs.py
python
_write_key_file
(key_filename, banner, public_key, secret_key=None, metadata=None, encoding='utf-8')
Create a certificate file
Create a certificate file
[ "Create", "a", "certificate", "file" ]
def _write_key_file(key_filename, banner, public_key, secret_key=None, metadata=None, encoding='utf-8'): """Create a certificate file""" if isinstance(public_key, bytes): public_key = public_key.decode(encoding) if isinstance(secret_key, bytes): secret_key = secret_key.decode(encoding) w...
[ "def", "_write_key_file", "(", "key_filename", ",", "banner", ",", "public_key", ",", "secret_key", "=", "None", ",", "metadata", "=", "None", ",", "encoding", "=", "'utf-8'", ")", ":", "if", "isinstance", "(", "public_key", ",", "bytes", ")", ":", "public...
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/zmq/auth/certs.py#L29-L49
uwdata/termite-data-server
1085571407c627bdbbd21c352e793fed65d09599
web2py/gluon/tools.py
python
Service.__call__
(self)
register services with: service = Service() @service.run @service.rss @service.json @service.jsonrpc @service.xmlrpc @service.amfrpc @service.amfrpc3('domain') @service.soap('Method', returns={'Result':int}, args={'a':int,'b':int,}) expose...
register services with: service = Service() @service.run @service.rss @service.json @service.jsonrpc @service.xmlrpc @service.amfrpc @service.amfrpc3('domain') @service.soap('Method', returns={'Result':int}, args={'a':int,'b':int,})
[ "register", "services", "with", ":", "service", "=", "Service", "()", "@service", ".", "run", "@service", ".", "rss", "@service", ".", "json", "@service", ".", "jsonrpc", "@service", ".", "xmlrpc", "@service", ".", "amfrpc", "@service", ".", "amfrpc3", "(", ...
def __call__(self): """ register services with: service = Service() @service.run @service.rss @service.json @service.jsonrpc @service.xmlrpc @service.amfrpc @service.amfrpc3('domain') @service.soap('Method', returns={'Result':int}, ...
[ "def", "__call__", "(", "self", ")", ":", "request", "=", "current", ".", "request", "if", "len", "(", "request", ".", "args", ")", "<", "1", ":", "raise", "HTTP", "(", "404", ",", "\"Not Found\"", ")", "arg0", "=", "request", ".", "args", "(", "0"...
https://github.com/uwdata/termite-data-server/blob/1085571407c627bdbbd21c352e793fed65d09599/web2py/gluon/tools.py#L4927-L4982
pgq/skytools-legacy
8b7e6c118572a605d28b7a3403c96aeecfd0d272
python/skytools/quoting.py
python
_json_quote_char
(m)
Quote single char.
Quote single char.
[ "Quote", "single", "char", "." ]
def _json_quote_char(m): """Quote single char.""" c = m.group(0) try: return _jsmap[c] except KeyError: return r"\u%04x" % ord(c)
[ "def", "_json_quote_char", "(", "m", ")", ":", "c", "=", "m", ".", "group", "(", "0", ")", "try", ":", "return", "_jsmap", "[", "c", "]", "except", "KeyError", ":", "return", "r\"\\u%04x\"", "%", "ord", "(", "c", ")" ]
https://github.com/pgq/skytools-legacy/blob/8b7e6c118572a605d28b7a3403c96aeecfd0d272/python/skytools/quoting.py#L114-L120
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/patched/notpip/_vendor/requests/cookies.py
python
MockRequest.add_header
(self, key, val)
cookielib has no legitimate use for this method; add it back if you find one.
cookielib has no legitimate use for this method; add it back if you find one.
[ "cookielib", "has", "no", "legitimate", "use", "for", "this", "method", ";", "add", "it", "back", "if", "you", "find", "one", "." ]
def add_header(self, key, val): """cookielib has no legitimate use for this method; add it back if you find one.""" raise NotImplementedError("Cookie headers should be added with add_unredirected_header()")
[ "def", "add_header", "(", "self", ",", "key", ",", "val", ")", ":", "raise", "NotImplementedError", "(", "\"Cookie headers should be added with add_unredirected_header()\"", ")" ]
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_vendor/requests/cookies.py#L74-L76
snarfed/granary
ab085de2aef0cff8ac31a99b5e21443a249e8419
granary/source.py
python
Source.get_comment
(self, comment_id, activity_id=None, activity_author_id=None, activity=None)
Fetches and returns a comment. Subclasses should override this. Args: comment_id: string comment id activity_id: string activity id, optional activity_author_id: string activity author id, optional. Needed for some sources (e.g. Facebook) to construct the comment permalink. act...
Fetches and returns a comment.
[ "Fetches", "and", "returns", "a", "comment", "." ]
def get_comment(self, comment_id, activity_id=None, activity_author_id=None, activity=None): """Fetches and returns a comment. Subclasses should override this. Args: comment_id: string comment id activity_id: string activity id, optional activity_author_id: string activ...
[ "def", "get_comment", "(", "self", ",", "comment_id", ",", "activity_id", "=", "None", ",", "activity_author_id", "=", "None", ",", "activity", "=", "None", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/snarfed/granary/blob/ab085de2aef0cff8ac31a99b5e21443a249e8419/granary/source.py#L476-L494
ninthDevilHAUNSTER/ArknightsAutoHelper
a27a930502d6e432368d9f62595a1d69a992f4e6
vendor/penguin_client/penguin_client/models/typed_drop.py
python
TypedDrop.drop_type
(self)
return self._drop_type
Gets the drop_type of this TypedDrop. # noqa: E501 :return: The drop_type of this TypedDrop. # noqa: E501 :rtype: str
Gets the drop_type of this TypedDrop. # noqa: E501
[ "Gets", "the", "drop_type", "of", "this", "TypedDrop", ".", "#", "noqa", ":", "E501" ]
def drop_type(self): """Gets the drop_type of this TypedDrop. # noqa: E501 :return: The drop_type of this TypedDrop. # noqa: E501 :rtype: str """ return self._drop_type
[ "def", "drop_type", "(", "self", ")", ":", "return", "self", ".", "_drop_type" ]
https://github.com/ninthDevilHAUNSTER/ArknightsAutoHelper/blob/a27a930502d6e432368d9f62595a1d69a992f4e6/vendor/penguin_client/penguin_client/models/typed_drop.py#L61-L68
gleeda/memtriage
c24f4859995cccb9d88ccc0118d90693019cc1d5
volatility/volatility/plugins/overlays/basic.py
python
String.__len__
(self)
return len(unicode(self))
This returns the length of the string
This returns the length of the string
[ "This", "returns", "the", "length", "of", "the", "string" ]
def __len__(self): """This returns the length of the string""" return len(unicode(self))
[ "def", "__len__", "(", "self", ")", ":", "return", "len", "(", "unicode", "(", "self", ")", ")" ]
https://github.com/gleeda/memtriage/blob/c24f4859995cccb9d88ccc0118d90693019cc1d5/volatility/volatility/plugins/overlays/basic.py#L75-L77
e2nIEE/pandapower
12bd83d7c4e1bf3fa338dab2db649c3cd3db0cfb
pandapower/networks/kerber_networks.py
python
create_kerber_vorstadtnetz_kabel_2
(std_type="NAYY 4x185", p_load_mw=.002, q_load_mvar=0., trafotype="0.63 MVA 10/0.4 kV", v_os=10.)
return pd_net
.. note:: Please pay attention, that the linetypes of the branch out house \ connections are randomlydistributed according to the probability 50% between \ "NAYY 50" and "NYY 35"
.. note:: Please pay attention, that the linetypes of the branch out house \ connections are randomlydistributed according to the probability 50% between \ "NAYY 50" and "NYY 35"
[ "..", "note", "::", "Please", "pay", "attention", "that", "the", "linetypes", "of", "the", "branch", "out", "house", "\\", "connections", "are", "randomlydistributed", "according", "to", "the", "probability", "50%", "between", "\\", "NAYY", "50", "and", "NYY",...
def create_kerber_vorstadtnetz_kabel_2(std_type="NAYY 4x185", p_load_mw=.002, q_load_mvar=0., trafotype="0.63 MVA 10/0.4 kV", v_os=10.): """ .. note:: Please pay attention, that the linetypes of the branch out house \ connections are randomlydistributed according to th...
[ "def", "create_kerber_vorstadtnetz_kabel_2", "(", "std_type", "=", "\"NAYY 4x185\"", ",", "p_load_mw", "=", ".002", ",", "q_load_mvar", "=", "0.", ",", "trafotype", "=", "\"0.63 MVA 10/0.4 kV\"", ",", "v_os", "=", "10.", ")", ":", "num_lines", "=", "[", "15", ...
https://github.com/e2nIEE/pandapower/blob/12bd83d7c4e1bf3fa338dab2db649c3cd3db0cfb/pandapower/networks/kerber_networks.py#L293-L311
general03/flask-autoindex
424246242c9f40aeb9ac2c8c63f4d2234024256e
.eggs/Jinja2-3.0.0a1-py3.7.egg/jinja2/runtime.py
python
Undefined._fail_with_undefined_error
(self, *args, **kwargs)
Raise an :exc:`UndefinedError` when operations are performed on the undefined value.
Raise an :exc:`UndefinedError` when operations are performed on the undefined value.
[ "Raise", "an", ":", "exc", ":", "UndefinedError", "when", "operations", "are", "performed", "on", "the", "undefined", "value", "." ]
def _fail_with_undefined_error(self, *args, **kwargs): """Raise an :exc:`UndefinedError` when operations are performed on the undefined value. """ raise self._undefined_exception(self._undefined_message)
[ "def", "_fail_with_undefined_error", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "raise", "self", ".", "_undefined_exception", "(", "self", ".", "_undefined_message", ")" ]
https://github.com/general03/flask-autoindex/blob/424246242c9f40aeb9ac2c8c63f4d2234024256e/.eggs/Jinja2-3.0.0a1-py3.7.egg/jinja2/runtime.py#L722-L726
florath/rmtoo
6ffe08703451358dca24b232ee4380b1da23bcad
rmtoo/outputs/graph2.py
python
graph2.topic_post
(self, _)
Write header to file.
Write header to file.
[ "Write", "header", "to", "file", "." ]
def topic_post(self, _): '''Write header to file.''' self.__output_file.write('%s}\n' % self.__ident) self.__dec_indent_level()
[ "def", "topic_post", "(", "self", ",", "_", ")", ":", "self", ".", "__output_file", ".", "write", "(", "'%s}\\n'", "%", "self", ".", "__ident", ")", "self", ".", "__dec_indent_level", "(", ")" ]
https://github.com/florath/rmtoo/blob/6ffe08703451358dca24b232ee4380b1da23bcad/rmtoo/outputs/graph2.py#L83-L86
securityclippy/elasticintel
aa08d3e9f5ab1c000128e95161139ce97ff0e334
ingest_feed_lambda/pandas/core/internals.py
python
BlockManager.get
(self, item, fastpath=True)
Return values for selected item (ndarray or BlockManager).
Return values for selected item (ndarray or BlockManager).
[ "Return", "values", "for", "selected", "item", "(", "ndarray", "or", "BlockManager", ")", "." ]
def get(self, item, fastpath=True): """ Return values for selected item (ndarray or BlockManager). """ if self.items.is_unique: if not isna(item): loc = self.items.get_loc(item) else: indexer = np.arange(len(self.items))[isna(self....
[ "def", "get", "(", "self", ",", "item", ",", "fastpath", "=", "True", ")", ":", "if", "self", ".", "items", ".", "is_unique", ":", "if", "not", "isna", "(", "item", ")", ":", "loc", "=", "self", ".", "items", ".", "get_loc", "(", "item", ")", "...
https://github.com/securityclippy/elasticintel/blob/aa08d3e9f5ab1c000128e95161139ce97ff0e334/ingest_feed_lambda/pandas/core/internals.py#L3831-L3858
ShreyAmbesh/Traffic-Rule-Violation-Detection-System
ae0c327ce014ce6a427da920b5798a0d4bbf001e
core/box_predictor.py
python
ConvolutionalBoxPredictor._predict
(self, image_features, num_predictions_per_location_list)
return {BOX_ENCODINGS: tf.concat(box_encodings_list, axis=1), CLASS_PREDICTIONS_WITH_BACKGROUND: tf.concat(class_predictions_list, axis=1)}
Computes encoded object locations and corresponding confidences. Args: image_features: A list of float tensors of shape [batch_size, height_i, width_i, channels_i] containing features for a batch of images. num_predictions_per_location_list: A list of integers representing the number of...
Computes encoded object locations and corresponding confidences.
[ "Computes", "encoded", "object", "locations", "and", "corresponding", "confidences", "." ]
def _predict(self, image_features, num_predictions_per_location_list): """Computes encoded object locations and corresponding confidences. Args: image_features: A list of float tensors of shape [batch_size, height_i, width_i, channels_i] containing features for a batch of images. num_predic...
[ "def", "_predict", "(", "self", ",", "image_features", ",", "num_predictions_per_location_list", ")", ":", "box_encodings_list", "=", "[", "]", "class_predictions_list", "=", "[", "]", "# TODO: Come up with a better way to generate scope names", "# in box predictor once we have...
https://github.com/ShreyAmbesh/Traffic-Rule-Violation-Detection-System/blob/ae0c327ce014ce6a427da920b5798a0d4bbf001e/core/box_predictor.py#L636-L746
galaxyproject/galaxy
4c03520f05062e0f4a1b3655dc0b7452fda69943
lib/galaxy/util/commands.py
python
download_command
(url, to=STDOUT_INDICATOR)
return download_cmd
Build a command line to download a URL. By default the URL will be downloaded to standard output but a specific file can be specified with the `to` argument.
Build a command line to download a URL.
[ "Build", "a", "command", "line", "to", "download", "a", "URL", "." ]
def download_command(url, to=STDOUT_INDICATOR): """Build a command line to download a URL. By default the URL will be downloaded to standard output but a specific file can be specified with the `to` argument. """ if which("wget"): download_cmd = ["wget", "-q"] if to == STDOUT_INDICA...
[ "def", "download_command", "(", "url", ",", "to", "=", "STDOUT_INDICATOR", ")", ":", "if", "which", "(", "\"wget\"", ")", ":", "download_cmd", "=", "[", "\"wget\"", ",", "\"-q\"", "]", "if", "to", "==", "STDOUT_INDICATOR", ":", "download_cmd", ".", "extend...
https://github.com/galaxyproject/galaxy/blob/4c03520f05062e0f4a1b3655dc0b7452fda69943/lib/galaxy/util/commands.py#L120-L136
pantsbuild/pex
473c6ac732ed4bc338b4b20a9ec930d1d722c9b4
pex/vendor/_vendored/pip/pip/_vendor/pkg_resources/__init__.py
python
Distribution.__lt__
(self, other)
return self.hashcmp < other.hashcmp
[]
def __lt__(self, other): return self.hashcmp < other.hashcmp
[ "def", "__lt__", "(", "self", ",", "other", ")", ":", "return", "self", ".", "hashcmp", "<", "other", ".", "hashcmp" ]
https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/pip/pip/_vendor/pkg_resources/__init__.py#L2612-L2613
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/categories/category_with_axiom.py
python
CategoryWithAxiom._axiom
(cls)
return cls._base_category_class_and_axiom[1]
r""" The axiom for this category with axiom. .. SEEALSO:: :meth:`_base_category_class_and_axiom` EXAMPLES:: sage: FiniteSets._axiom 'Finite' sage: Sets.Finite._axiom 'Finite' sage: Algebras.Commutative._axiom 'Commutative...
r""" The axiom for this category with axiom.
[ "r", "The", "axiom", "for", "this", "category", "with", "axiom", "." ]
def _axiom(cls): r""" The axiom for this category with axiom. .. SEEALSO:: :meth:`_base_category_class_and_axiom` EXAMPLES:: sage: FiniteSets._axiom 'Finite' sage: Sets.Finite._axiom 'Finite' sage: Algebras.Commutative._axiom...
[ "def", "_axiom", "(", "cls", ")", ":", "return", "cls", ".", "_base_category_class_and_axiom", "[", "1", "]" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/categories/category_with_axiom.py#L1941-L1965
WenlongZhang0517/RankSRGAN
b313c24a25c9844d1d0c7ea8fd1e35da00ad8975
codes/train.py
python
init_dist
(backend='nccl', **kwargs)
initialization for distributed training
initialization for distributed training
[ "initialization", "for", "distributed", "training" ]
def init_dist(backend='nccl', **kwargs): """initialization for distributed training""" if mp.get_start_method(allow_none=True) != 'spawn': mp.set_start_method('spawn') rank = int(os.environ['RANK']) num_gpus = torch.cuda.device_count() torch.cuda.set_device(rank % num_gpus) dist.init_pro...
[ "def", "init_dist", "(", "backend", "=", "'nccl'", ",", "*", "*", "kwargs", ")", ":", "if", "mp", ".", "get_start_method", "(", "allow_none", "=", "True", ")", "!=", "'spawn'", ":", "mp", ".", "set_start_method", "(", "'spawn'", ")", "rank", "=", "int"...
https://github.com/WenlongZhang0517/RankSRGAN/blob/b313c24a25c9844d1d0c7ea8fd1e35da00ad8975/codes/train.py#L18-L25
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-linux/x64/PIL/ImageDraw.py
python
ImageDraw.shape
(self, shape, fill=None, outline=None)
(Experimental) Draw a shape.
(Experimental) Draw a shape.
[ "(", "Experimental", ")", "Draw", "a", "shape", "." ]
def shape(self, shape, fill=None, outline=None): """(Experimental) Draw a shape.""" shape.close() ink, fill = self._getink(outline, fill) if fill is not None: self.draw.draw_outline(shape, fill, 1) if ink is not None and ink != fill: self.draw.draw_outline...
[ "def", "shape", "(", "self", ",", "shape", ",", "fill", "=", "None", ",", "outline", "=", "None", ")", ":", "shape", ".", "close", "(", ")", "ink", ",", "fill", "=", "self", ".", "_getink", "(", "outline", ",", "fill", ")", "if", "fill", "is", ...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/PIL/ImageDraw.py#L213-L220
golismero/golismero
7d605b937e241f51c1ca4f47b20f755eeefb9d76
thirdparty_libs/nltk/parse/projectivedependencyparser.py
python
ProbabilisticProjectiveDependencyParser.parse
(self, tokens)
return [max_parse, max_score]
Parses the list of tokens subject to the projectivity constraint and the productions in the parser's grammar. This uses a method similar to the span-concatenation algorithm defined in Eisner (1996). It returns the most probable parse derived from the parser's probabilistic dependency gr...
Parses the list of tokens subject to the projectivity constraint and the productions in the parser's grammar. This uses a method similar to the span-concatenation algorithm defined in Eisner (1996). It returns the most probable parse derived from the parser's probabilistic dependency gr...
[ "Parses", "the", "list", "of", "tokens", "subject", "to", "the", "projectivity", "constraint", "and", "the", "productions", "in", "the", "parser", "s", "grammar", ".", "This", "uses", "a", "method", "similar", "to", "the", "span", "-", "concatenation", "algo...
def parse(self, tokens): """ Parses the list of tokens subject to the projectivity constraint and the productions in the parser's grammar. This uses a method similar to the span-concatenation algorithm defined in Eisner (1996). It returns the most probable parse derived from the...
[ "def", "parse", "(", "self", ",", "tokens", ")", ":", "self", ".", "_tokens", "=", "list", "(", "tokens", ")", "chart", "=", "[", "]", "for", "i", "in", "range", "(", "0", ",", "len", "(", "self", ".", "_tokens", ")", "+", "1", ")", ":", "cha...
https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/nltk/parse/projectivedependencyparser.py#L269-L312
mesalock-linux/mesapy
ed546d59a21b36feb93e2309d5c6b75aa0ad95c9
lib-python/2.7/lib-tk/Tkinter.py
python
Wm.wm_transient
(self, master=None)
return self.tk.call('wm', 'transient', self._w, master)
Instruct the window manager that this widget is transient with regard to widget MASTER.
Instruct the window manager that this widget is transient with regard to widget MASTER.
[ "Instruct", "the", "window", "manager", "that", "this", "widget", "is", "transient", "with", "regard", "to", "widget", "MASTER", "." ]
def wm_transient(self, master=None): """Instruct the window manager that this widget is transient with regard to widget MASTER.""" return self.tk.call('wm', 'transient', self._w, master)
[ "def", "wm_transient", "(", "self", ",", "master", "=", "None", ")", ":", "return", "self", ".", "tk", ".", "call", "(", "'wm'", ",", "'transient'", ",", "self", ".", "_w", ",", "master", ")" ]
https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/lib-tk/Tkinter.py#L1784-L1787
Yelp/clusterman
54beef89c01a2681aafd1fbb93b6ad5f6252d6cf
clusterman/aws/aws_resource_group.py
python
AWSResourceGroup.id
(self)
return self.group_id
A unique identifier for this AWSResourceGroup
A unique identifier for this AWSResourceGroup
[ "A", "unique", "identifier", "for", "this", "AWSResourceGroup" ]
def id(self) -> str: """ A unique identifier for this AWSResourceGroup """ return self.group_id
[ "def", "id", "(", "self", ")", "->", "str", ":", "return", "self", ".", "group_id" ]
https://github.com/Yelp/clusterman/blob/54beef89c01a2681aafd1fbb93b6ad5f6252d6cf/clusterman/aws/aws_resource_group.py#L159-L161
FederatedAI/FATE
32540492623568ecd1afcb367360133616e02fa3
python/federatedml/secureprotol/hash/hash_factory.py
python
compute_sha256_base64
(value)
return str(base64.b64encode(hashlib.sha256(bytes(value, encoding='utf-8')).digest()), "utf-8")
[]
def compute_sha256_base64(value): return str(base64.b64encode(hashlib.sha256(bytes(value, encoding='utf-8')).digest()), "utf-8")
[ "def", "compute_sha256_base64", "(", "value", ")", ":", "return", "str", "(", "base64", ".", "b64encode", "(", "hashlib", ".", "sha256", "(", "bytes", "(", "value", ",", "encoding", "=", "'utf-8'", ")", ")", ".", "digest", "(", ")", ")", ",", "\"utf-8\...
https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/secureprotol/hash/hash_factory.py#L23-L24
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/mixins/treemixin.py
python
VirtualTree.OnGetItemBackgroundColour
(self, index)
return wx.NullColour
This function may be overloaded in the derived class. It should return the wx.Colour to be used as background colour for the specified item.
This function may be overloaded in the derived class. It should return the wx.Colour to be used as background colour for the specified item.
[ "This", "function", "may", "be", "overloaded", "in", "the", "derived", "class", ".", "It", "should", "return", "the", "wx", ".", "Colour", "to", "be", "used", "as", "background", "colour", "for", "the", "specified", "item", "." ]
def OnGetItemBackgroundColour(self, index): """ This function may be overloaded in the derived class. It should return the wx.Colour to be used as background colour for the specified item. """ return wx.NullColour
[ "def", "OnGetItemBackgroundColour", "(", "self", ",", "index", ")", ":", "return", "wx", ".", "NullColour" ]
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/mixins/treemixin.py#L335-L339
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/vpc/v20170312/models.py
python
GatewayFlowMonitorDetail.__init__
(self)
r""" :param PrivateIpAddress: 来源`IP`。 :type PrivateIpAddress: str :param InPkg: 入包量。 :type InPkg: int :param OutPkg: 出包量。 :type OutPkg: int :param InTraffic: 入流量,单位:`Byte`。 :type InTraffic: int :param OutTraffic: 出流量,单位:`Byte`。 :type OutTra...
r""" :param PrivateIpAddress: 来源`IP`。 :type PrivateIpAddress: str :param InPkg: 入包量。 :type InPkg: int :param OutPkg: 出包量。 :type OutPkg: int :param InTraffic: 入流量,单位:`Byte`。 :type InTraffic: int :param OutTraffic: 出流量,单位:`Byte`。 :type OutTra...
[ "r", ":", "param", "PrivateIpAddress", ":", "来源", "IP", "。", ":", "type", "PrivateIpAddress", ":", "str", ":", "param", "InPkg", ":", "入包量。", ":", "type", "InPkg", ":", "int", ":", "param", "OutPkg", ":", "出包量。", ":", "type", "OutPkg", ":", "int", ":...
def __init__(self): r""" :param PrivateIpAddress: 来源`IP`。 :type PrivateIpAddress: str :param InPkg: 入包量。 :type InPkg: int :param OutPkg: 出包量。 :type OutPkg: int :param InTraffic: 入流量,单位:`Byte`。 :type InTraffic: int :param OutTraffic: 出流量,单位:...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "PrivateIpAddress", "=", "None", "self", ".", "InPkg", "=", "None", "self", ".", "OutPkg", "=", "None", "self", ".", "InTraffic", "=", "None", "self", ".", "OutTraffic", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/vpc/v20170312/models.py#L12564-L12581
privacyidea/privacyidea
9490c12ddbf77a34ac935b082d09eb583dfafa2c
privacyidea/api/system.py
python
delete_config
(key=None)
return send_result(res)
delete a configuration key :jsonparam key: configuration key name :returns: a json result with the deleted value
delete a configuration key
[ "delete", "a", "configuration", "key" ]
def delete_config(key=None): """ delete a configuration key :jsonparam key: configuration key name :returns: a json result with the deleted value """ if not key: raise ParameterError("You need to provide the config key to delete.") res = delete_privacyidea_config(key) g.audit_o...
[ "def", "delete_config", "(", "key", "=", "None", ")", ":", "if", "not", "key", ":", "raise", "ParameterError", "(", "\"You need to provide the config key to delete.\"", ")", "res", "=", "delete_privacyidea_config", "(", "key", ")", "g", ".", "audit_object", ".", ...
https://github.com/privacyidea/privacyidea/blob/9490c12ddbf77a34ac935b082d09eb583dfafa2c/privacyidea/api/system.py#L271-L284
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
cpython/Lib/logging/__init__.py
python
_acquireLock
()
Acquire the module-level lock for serializing access to shared data. This should be released with _releaseLock().
Acquire the module-level lock for serializing access to shared data.
[ "Acquire", "the", "module", "-", "level", "lock", "for", "serializing", "access", "to", "shared", "data", "." ]
def _acquireLock(): """ Acquire the module-level lock for serializing access to shared data. This should be released with _releaseLock(). """ if _lock: _lock.acquire()
[ "def", "_acquireLock", "(", ")", ":", "if", "_lock", ":", "_lock", ".", "acquire", "(", ")" ]
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/logging/__init__.py#L210-L217
qutebrowser/qutebrowser
3a2aaaacbf97f4bf0c72463f3da94ed2822a5442
qutebrowser/utils/version.py
python
_pdfjs_version
()
Get the pdf.js version. Return: A string with the version number.
Get the pdf.js version.
[ "Get", "the", "pdf", ".", "js", "version", "." ]
def _pdfjs_version() -> str: """Get the pdf.js version. Return: A string with the version number. """ try: pdfjs_file, file_path = pdfjs.get_pdfjs_res_and_path('build/pdf.js') except pdfjs.PDFJSNotFound: return 'no' else: pdfjs_file = pdfjs_file.decode('utf-8') ...
[ "def", "_pdfjs_version", "(", ")", "->", "str", ":", "try", ":", "pdfjs_file", ",", "file_path", "=", "pdfjs", ".", "get_pdfjs_res_and_path", "(", "'build/pdf.js'", ")", "except", "pdfjs", ".", "PDFJSNotFound", ":", "return", "'no'", "else", ":", "pdfjs_file",...
https://github.com/qutebrowser/qutebrowser/blob/3a2aaaacbf97f4bf0c72463f3da94ed2822a5442/qutebrowser/utils/version.py#L473-L494
myint/cppclean
aa73d06022533a3ff0a956910f2df9a54c233d88
cpp/ast.py
python
Node.is_exportable
(self)
return False
Returns bool if this node exportable from a header file.
Returns bool if this node exportable from a header file.
[ "Returns", "bool", "if", "this", "node", "exportable", "from", "a", "header", "file", "." ]
def is_exportable(self): """Returns bool if this node exportable from a header file.""" return False
[ "def", "is_exportable", "(", "self", ")", ":", "return", "False" ]
https://github.com/myint/cppclean/blob/aa73d06022533a3ff0a956910f2df9a54c233d88/cpp/ast.py#L83-L85
cangermueller/deepcpg
7f58da5423121168edabb27202c234df0f0e460d
deepcpg/utils.py
python
to_list
(value)
return value
Convert `value` to a list.
Convert `value` to a list.
[ "Convert", "value", "to", "a", "list", "." ]
def to_list(value): """Convert `value` to a list.""" if not isinstance(value, list) and value is not None: value = [value] return value
[ "def", "to_list", "(", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "list", ")", "and", "value", "is", "not", "None", ":", "value", "=", "[", "value", "]", "return", "value" ]
https://github.com/cangermueller/deepcpg/blob/7f58da5423121168edabb27202c234df0f0e460d/deepcpg/utils.py#L128-L132
GNS3/gns3-gui
da8adbaa18ab60e053af2a619efd468f4c8950f3
gns3/main_window.py
python
MainWindow._setupWizardActionSlot
(self)
Slot to open the setup wizard.
Slot to open the setup wizard.
[ "Slot", "to", "open", "the", "setup", "wizard", "." ]
def _setupWizardActionSlot(self): """ Slot to open the setup wizard. """ with Progress.instance().context(min_duration=0): setup_wizard = SetupWizard(self) setup_wizard.show() res = setup_wizard.exec_() # start and connect to the local ser...
[ "def", "_setupWizardActionSlot", "(", "self", ")", ":", "with", "Progress", ".", "instance", "(", ")", ".", "context", "(", "min_duration", "=", "0", ")", ":", "setup_wizard", "=", "SetupWizard", "(", "self", ")", "setup_wizard", ".", "show", "(", ")", "...
https://github.com/GNS3/gns3-gui/blob/da8adbaa18ab60e053af2a619efd468f4c8950f3/gns3/main_window.py#L944-L954
mozman/ezdxf
59d0fc2ea63f5cf82293428f5931da7e9f9718e9
src/ezdxf/math/eulerspiral.py
python
EulerSpiral.circle_center
(self, t: float)
return p + self.tangent(t).normalize(r).orthogonal()
Get circle center at distance `t`.
Get circle center at distance `t`.
[ "Get", "circle", "center", "at", "distance", "t", "." ]
def circle_center(self, t: float) -> Vec3: """Get circle center at distance `t`.""" p = self.point(t) r = self.radius(t) return p + self.tangent(t).normalize(r).orthogonal()
[ "def", "circle_center", "(", "self", ",", "t", ":", "float", ")", "->", "Vec3", ":", "p", "=", "self", ".", "point", "(", "t", ")", "r", "=", "self", ".", "radius", "(", "t", ")", "return", "p", "+", "self", ".", "tangent", "(", "t", ")", "."...
https://github.com/mozman/ezdxf/blob/59d0fc2ea63f5cf82293428f5931da7e9f9718e9/src/ezdxf/math/eulerspiral.py#L94-L98
scikit-hep/scikit-hep
506149b352eeb2291f24aef3f40691b5f6be2da7
skhep/math/vectors.py
python
Vector3D.rotatex
(self, angle)
return self.rotate(angle, 1, 0, 0)
Rotate vector by a given angle (in radians) around the x axis.
Rotate vector by a given angle (in radians) around the x axis.
[ "Rotate", "vector", "by", "a", "given", "angle", "(", "in", "radians", ")", "around", "the", "x", "axis", "." ]
def rotatex(self, angle): """Rotate vector by a given angle (in radians) around the x axis.""" return self.rotate(angle, 1, 0, 0)
[ "def", "rotatex", "(", "self", ",", "angle", ")", ":", "return", "self", ".", "rotate", "(", "angle", ",", "1", ",", "0", ",", "0", ")" ]
https://github.com/scikit-hep/scikit-hep/blob/506149b352eeb2291f24aef3f40691b5f6be2da7/skhep/math/vectors.py#L482-L484
ShuangLI59/person_search
ef7d77a58a581825611e575010d9a3653b1ddf98
lib/datasets/imdb.py
python
imdb.append_flipped_images
(self)
[]
def append_flipped_images(self): num_images = self.num_images widths = self._get_widths() for i in xrange(num_images): boxes = self.roidb[i]['boxes'].copy() oldx1 = boxes[:, 0].copy() oldx2 = boxes[:, 2].copy() boxes[:, 0] = widths[i] - oldx2 - 1 ...
[ "def", "append_flipped_images", "(", "self", ")", ":", "num_images", "=", "self", ".", "num_images", "widths", "=", "self", ".", "_get_widths", "(", ")", "for", "i", "in", "xrange", "(", "num_images", ")", ":", "boxes", "=", "self", ".", "roidb", "[", ...
https://github.com/ShuangLI59/person_search/blob/ef7d77a58a581825611e575010d9a3653b1ddf98/lib/datasets/imdb.py#L96-L113
HDE/python-lambda-local
d35ae7f1e58752dd05224df3a72ed90fe651497e
lambda_local/main.py
python
FunctionLoader.load
(self)
[]
def load(self): if self.library_path is not None: load_lib(self.library_path) self.func = load_source( self.request_id, self.source, self.function_name)
[ "def", "load", "(", "self", ")", ":", "if", "self", ".", "library_path", "is", "not", "None", ":", "load_lib", "(", "self", ".", "library_path", ")", "self", ".", "func", "=", "load_source", "(", "self", ".", "request_id", ",", "self", ".", "source", ...
https://github.com/HDE/python-lambda-local/blob/d35ae7f1e58752dd05224df3a72ed90fe651497e/lambda_local/main.py#L55-L60
Zengyi-Qin/MonoGRNet
bd8c36c780345449b44db1b7d8de22e5eaa5fc7e
include/tensorvision/train.py
python
continue_training
(logdir)
Continues training of a model. This will load model files and weights found in logdir and continues an aborted training. Parameters ---------- logdir : string Directory with logs.
Continues training of a model.
[ "Continues", "training", "of", "a", "model", "." ]
def continue_training(logdir): """ Continues training of a model. This will load model files and weights found in logdir and continues an aborted training. Parameters ---------- logdir : string Directory with logs. """ hypes = utils.load_hypes_from_logdir(logdir) module...
[ "def", "continue_training", "(", "logdir", ")", ":", "hypes", "=", "utils", ".", "load_hypes_from_logdir", "(", "logdir", ")", "modules", "=", "utils", ".", "load_modules_from_logdir", "(", "logdir", ")", "# Tell TensorFlow that the model will be built into the default Gr...
https://github.com/Zengyi-Qin/MonoGRNet/blob/bd8c36c780345449b44db1b7d8de22e5eaa5fc7e/include/tensorvision/train.py#L410-L470
rm-hull/luma.lcd
156d0613ceb973356cea768263f3847d68994bde
luma/lcd/device.py
python
st7735.contrast
(self, level)
NOT SUPPORTED :param level: Desired contrast level in the range of 0-255. :type level: int
NOT SUPPORTED
[ "NOT", "SUPPORTED" ]
def contrast(self, level): """ NOT SUPPORTED :param level: Desired contrast level in the range of 0-255. :type level: int """ assert(0 <= level <= 255)
[ "def", "contrast", "(", "self", ",", "level", ")", ":", "assert", "(", "0", "<=", "level", "<=", "255", ")" ]
https://github.com/rm-hull/luma.lcd/blob/156d0613ceb973356cea768263f3847d68994bde/luma/lcd/device.py#L568-L575
dhondta/python-sploitkit
501ee5c034189d39e2ed76e9ccf6a538ab638409
sploitkit/core/console.py
python
Console.rcfile
(self, rcfile, capture=False)
return self.play(*commands, capture)
Execute commands from a .rc file.
Execute commands from a .rc file.
[ "Execute", "commands", "from", "a", ".", "rc", "file", "." ]
def rcfile(self, rcfile, capture=False): """ Execute commands from a .rc file. """ with open(rcfile) as f: commands = [c.strip() for c in f] return self.play(*commands, capture)
[ "def", "rcfile", "(", "self", ",", "rcfile", ",", "capture", "=", "False", ")", ":", "with", "open", "(", "rcfile", ")", "as", "f", ":", "commands", "=", "[", "c", ".", "strip", "(", ")", "for", "c", "in", "f", "]", "return", "self", ".", "play...
https://github.com/dhondta/python-sploitkit/blob/501ee5c034189d39e2ed76e9ccf6a538ab638409/sploitkit/core/console.py#L313-L317
LuxCoreRender/BlendLuxCore
bf31ca58501d54c02acd97001b6db7de81da7cbf
export/camera.py
python
_depth_of_field
(scene, definitions, context=None)
[]
def _depth_of_field(scene, definitions, context=None): camera = scene.camera settings = camera.data.luxcore if not camera.data.dof.use_dof or utils.in_material_shading_mode(context): return definitions["lensradius"] = (camera.data.lens / 1000) / (2 * camera.data.dof.aperture_fstop) if set...
[ "def", "_depth_of_field", "(", "scene", ",", "definitions", ",", "context", "=", "None", ")", ":", "camera", "=", "scene", ".", "camera", "settings", "=", "camera", ".", "data", ".", "luxcore", "if", "not", "camera", ".", "data", ".", "dof", ".", "use_...
https://github.com/LuxCoreRender/BlendLuxCore/blob/bf31ca58501d54c02acd97001b6db7de81da7cbf/export/camera.py#L140-L196
pyansys/pymapdl
c07291fc062b359abf0e92b95a92d753a95ef3d7
ansys/mapdl/core/_commands/preproc/primitives.py
python
Primitives.blc4
( self, xcorner="", ycorner="", width="", height="", depth="", **kwargs )
return parse.parse_output_volume_area(self.run(command, **kwargs))
Creates a rectangular area or block volume by corner points. APDL Command: BLC4 Defines a rectangular area anywhere on the working plane or a hexahedral volume with one face anywhere on the working plane. A rectangle will be defined with four keypoints and four lines. A volume...
Creates a rectangular area or block volume by corner points.
[ "Creates", "a", "rectangular", "area", "or", "block", "volume", "by", "corner", "points", "." ]
def blc4( self, xcorner="", ycorner="", width="", height="", depth="", **kwargs ) -> int: """Creates a rectangular area or block volume by corner points. APDL Command: BLC4 Defines a rectangular area anywhere on the working plane or a hexahedral volume with one face anywher...
[ "def", "blc4", "(", "self", ",", "xcorner", "=", "\"\"", ",", "ycorner", "=", "\"\"", ",", "width", "=", "\"\"", ",", "height", "=", "\"\"", ",", "depth", "=", "\"\"", ",", "*", "*", "kwargs", ")", "->", "int", ":", "command", "=", "f\"BLC4,{xcorne...
https://github.com/pyansys/pymapdl/blob/c07291fc062b359abf0e92b95a92d753a95ef3d7/ansys/mapdl/core/_commands/preproc/primitives.py#L5-L59
pyvista/pyvista
012dbb95a9aae406c3cd4cd94fc8c477f871e426
pyvista/themes.py
python
_SliderStyleConfig.name
(self)
return self._name
Return the name of the slider style configuration.
Return the name of the slider style configuration.
[ "Return", "the", "name", "of", "the", "slider", "style", "configuration", "." ]
def name(self) -> str: """Return the name of the slider style configuration.""" return self._name
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_name" ]
https://github.com/pyvista/pyvista/blob/012dbb95a9aae406c3cd4cd94fc8c477f871e426/pyvista/themes.py#L846-L848
mediacloud/backend
d36b489e4fbe6e44950916a04d9543a1d6cd5df0
apps/topics-mine/src/python/topics_mine/fetch_topic_posts.py
python
get_post_fetcher
(topic_seed_query: dict)
return fetch
get the fetch_posts function for the given topic_seed_query, or None.`
get the fetch_posts function for the given topic_seed_query, or None.`
[ "get", "the", "fetch_posts", "function", "for", "the", "given", "topic_seed_query", "or", "None", "." ]
def get_post_fetcher(topic_seed_query: dict) -> Optional[AbstractPostFetcher]: """get the fetch_posts function for the given topic_seed_query, or None.`""" source = topic_seed_query['source'] platform = topic_seed_query['platform'] if source == 'brandwatch' and platform == 'twitter': fetch = Br...
[ "def", "get_post_fetcher", "(", "topic_seed_query", ":", "dict", ")", "->", "Optional", "[", "AbstractPostFetcher", "]", ":", "source", "=", "topic_seed_query", "[", "'source'", "]", "platform", "=", "topic_seed_query", "[", "'platform'", "]", "if", "source", "=...
https://github.com/mediacloud/backend/blob/d36b489e4fbe6e44950916a04d9543a1d6cd5df0/apps/topics-mine/src/python/topics_mine/fetch_topic_posts.py#L214-L230
dpwe/audfprint
cb03ba99feafd41b8874307f0f4e808a6ce34362
audfprint_analyze.py
python
Analyzer._decaying_threshold_bwd_prune_peaks
(self, sgram, peaks, a_dec)
return peaks
backwards pass of findpeaks
backwards pass of findpeaks
[ "backwards", "pass", "of", "findpeaks" ]
def _decaying_threshold_bwd_prune_peaks(self, sgram, peaks, a_dec): """ backwards pass of findpeaks """ scols = np.shape(sgram)[1] # Backwards filter to prune peaks sthresh = self.spreadpeaksinvector(sgram[:, -1], self.f_sd) for col in range(scols, 0, -1): pkposs = np...
[ "def", "_decaying_threshold_bwd_prune_peaks", "(", "self", ",", "sgram", ",", "peaks", ",", "a_dec", ")", ":", "scols", "=", "np", ".", "shape", "(", "sgram", ")", "[", "1", "]", "# Backwards filter to prune peaks", "sthresh", "=", "self", ".", "spreadpeaksinv...
https://github.com/dpwe/audfprint/blob/cb03ba99feafd41b8874307f0f4e808a6ce34362/audfprint_analyze.py#L233-L253
wistbean/learn_python3_spider
73c873f4845f4385f097e5057407d03dd37a117b
stackoverflow/venv/lib/python3.6/site-packages/scrapy/settings/__init__.py
python
BaseSettings.freeze
(self)
Disable further changes to the current settings. After calling this method, the present state of the settings will become immutable. Trying to change values through the :meth:`~set` method and its variants won't be possible and will be alerted.
Disable further changes to the current settings.
[ "Disable", "further", "changes", "to", "the", "current", "settings", "." ]
def freeze(self): """ Disable further changes to the current settings. After calling this method, the present state of the settings will become immutable. Trying to change values through the :meth:`~set` method and its variants won't be possible and will be alerted. """ ...
[ "def", "freeze", "(", "self", ")", ":", "self", ".", "frozen", "=", "True" ]
https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/scrapy/settings/__init__.py#L358-L366
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/gdata/src/gdata/apps/emailsettings/data.py
python
EmailSettingsFilter.SetArchive
(self, value)
Set the Archive value of this Filter object. Args: value: string The new Archive value to give this object.
Set the Archive value of this Filter object.
[ "Set", "the", "Archive", "value", "of", "this", "Filter", "object", "." ]
def SetArchive(self, value): """Set the Archive value of this Filter object. Args: value: string The new Archive value to give this object. """ self._SetProperty(FILTER_ARCHIVE, value)
[ "def", "SetArchive", "(", "self", ",", "value", ")", ":", "self", ".", "_SetProperty", "(", "FILTER_ARCHIVE", ",", "value", ")" ]
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/gdata/src/gdata/apps/emailsettings/data.py#L376-L383
YunoHost/yunohost
08efbbb9045eaed8e64d3dfc3f5e22e6ac0b5ecd
src/yunohost/permission.py
python
user_permission_reset
(operation_logger, permission, sync_perm=True)
return new_permission
Reset a given permission to just 'all_users' Keyword argument: permission -- Name of the permission (e.g. mail or nextcloud or wordpress.editors)
Reset a given permission to just 'all_users'
[ "Reset", "a", "given", "permission", "to", "just", "all_users" ]
def user_permission_reset(operation_logger, permission, sync_perm=True): """ Reset a given permission to just 'all_users' Keyword argument: permission -- Name of the permission (e.g. mail or nextcloud or wordpress.editors) """ # By default, manipulate main permission if "." not in perm...
[ "def", "user_permission_reset", "(", "operation_logger", ",", "permission", ",", "sync_perm", "=", "True", ")", ":", "# By default, manipulate main permission", "if", "\".\"", "not", "in", "permission", ":", "permission", "=", "permission", "+", "\".main\"", "# Fetch ...
https://github.com/YunoHost/yunohost/blob/08efbbb9045eaed8e64d3dfc3f5e22e6ac0b5ecd/src/yunohost/permission.py#L296-L327
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/redis/client.py
python
StrictRedis.rpop
(self, name)
return self.execute_command('RPOP', name)
Remove and return the last item of the list ``name``
Remove and return the last item of the list ``name``
[ "Remove", "and", "return", "the", "last", "item", "of", "the", "list", "name" ]
def rpop(self, name): "Remove and return the last item of the list ``name``" return self.execute_command('RPOP', name)
[ "def", "rpop", "(", "self", ",", "name", ")", ":", "return", "self", ".", "execute_command", "(", "'RPOP'", ",", "name", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/redis/client.py#L1375-L1377
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/CortexDataLake/Integrations/CortexDataLake/CortexDataLake.py
python
prepare_fetch_incidents_query
(fetch_timestamp: str, fetch_severity: list, fetch_table: str, fetch_subtype: list, fetch_fields: str, fetch_limit: str)
return query
Prepares the SQL query for fetch incidents command Args: fetch_limit: Indicates how many incidents should be queried fetch_timestamp: The date from which threat logs should be queried fetch_severity: Severity associated with the incident. fetch_subtype: Identifies the log subtype. ...
Prepares the SQL query for fetch incidents command Args: fetch_limit: Indicates how many incidents should be queried fetch_timestamp: The date from which threat logs should be queried fetch_severity: Severity associated with the incident. fetch_subtype: Identifies the log subtype. ...
[ "Prepares", "the", "SQL", "query", "for", "fetch", "incidents", "command", "Args", ":", "fetch_limit", ":", "Indicates", "how", "many", "incidents", "should", "be", "queried", "fetch_timestamp", ":", "The", "date", "from", "which", "threat", "logs", "should", ...
def prepare_fetch_incidents_query(fetch_timestamp: str, fetch_severity: list, fetch_table: str, fetch_subtype: list, fetch_fields: str, fetch_limit: s...
[ "def", "prepare_fetch_incidents_query", "(", "fetch_timestamp", ":", "str", ",", "fetch_severity", ":", "list", ",", "fetch_table", ":", "str", ",", "fetch_subtype", ":", "list", ",", "fetch_fields", ":", "str", ",", "fetch_limit", ":", "str", ")", "->", "str"...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/CortexDataLake/Integrations/CortexDataLake/CortexDataLake.py#L837-L866
NVIDIA/NeMo
5b0c0b4dec12d87d3cd960846de4105309ce938e
nemo_text_processing/inverse_text_normalization/en/clean_eval_data.py
python
Filter.process
(self, instance: Instance)
return self.process_func(instance)
process function Args: processes given instance with process function Returns: processed instance if instance belongs to expected class type or original instance
process function
[ "process", "function" ]
def process(self, instance: Instance) -> Instance: """ process function Args: processes given instance with process function Returns: processed instance if instance belongs to expected class type or original instance """ if instance.token_type !=...
[ "def", "process", "(", "self", ",", "instance", ":", "Instance", ")", "->", "Instance", ":", "if", "instance", ".", "token_type", "!=", "self", ".", "class_type", ":", "return", "instance", "return", "self", ".", "process_func", "(", "instance", ")" ]
https://github.com/NVIDIA/NeMo/blob/5b0c0b4dec12d87d3cd960846de4105309ce938e/nemo_text_processing/inverse_text_normalization/en/clean_eval_data.py#L64-L75
digidotcom/xbee-python
0757f4be0017530c205175fbee8f9f61be9614d1
digi/xbee/firmware.py
python
_RemoteGPMFirmwareUpdater._create_gpm_cmd_frame
(self, cmd, options=0, block_index=0, byte_index=0, gpm_data=None)
return self._create_explicit_frame(payload)
Creates and returns a GPM command frame with the given parameters. Args: cmd (:class:`.GPMCommand`): GPM command to create the frame for. options (Integer, optional, default=0): Command options byte. block_index (Integer, optional, default=0): Block number addressed in the G...
Creates and returns a GPM command frame with the given parameters.
[ "Creates", "and", "returns", "a", "GPM", "command", "frame", "with", "the", "given", "parameters", "." ]
def _create_gpm_cmd_frame(self, cmd, options=0, block_index=0, byte_index=0, gpm_data=None): """ Creates and returns a GPM command frame with the given parameters. Args: cmd (:class:`.GPMCommand`): GPM command to create the frame for. options (Integer, optional, default=...
[ "def", "_create_gpm_cmd_frame", "(", "self", ",", "cmd", ",", "options", "=", "0", ",", "block_index", "=", "0", ",", "byte_index", "=", "0", ",", "gpm_data", "=", "None", ")", ":", "payload", "=", "bytearray", "(", ")", "payload", ".", "append", "(", ...
https://github.com/digidotcom/xbee-python/blob/0757f4be0017530c205175fbee8f9f61be9614d1/digi/xbee/firmware.py#L5865-L5889
stopstalk/stopstalk-deployment
10c3ab44c4ece33ae515f6888c15033db2004bb1
aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_vendor/distlib/database.py
python
make_graph
(dists, scheme='default')
return graph
Makes a dependency graph from the given distributions. :parameter dists: a list of distributions :type dists: list of :class:`distutils2.database.InstalledDistribution` and :class:`distutils2.database.EggInfoDistribution` instances :rtype: a :class:`DependencyGraph` instance
Makes a dependency graph from the given distributions.
[ "Makes", "a", "dependency", "graph", "from", "the", "given", "distributions", "." ]
def make_graph(dists, scheme='default'): """Makes a dependency graph from the given distributions. :parameter dists: a list of distributions :type dists: list of :class:`distutils2.database.InstalledDistribution` and :class:`distutils2.database.EggInfoDistribution` instances :rtype: a ...
[ "def", "make_graph", "(", "dists", ",", "scheme", "=", "'default'", ")", ":", "scheme", "=", "get_scheme", "(", "scheme", ")", "graph", "=", "DependencyGraph", "(", ")", "provided", "=", "{", "}", "# maps names to lists of (version, dist) tuples", "# first, build ...
https://github.com/stopstalk/stopstalk-deployment/blob/10c3ab44c4ece33ae515f6888c15033db2004bb1/aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_vendor/distlib/database.py#L1222-L1273
robinhood/faust
01b4c0ad8390221db71751d80001b0fd879291e2
faust/web/drivers/aiohttp.py
python
Web.route
(self, pattern: str, handler: Callable, cors_options: Mapping[str, ResourceOptions] = None)
Add route for web view or handler.
Add route for web view or handler.
[ "Add", "route", "for", "web", "view", "or", "handler", "." ]
def route(self, pattern: str, handler: Callable, cors_options: Mapping[str, ResourceOptions] = None) -> None: """Add route for web view or handler.""" if cors_options or self.cors_options: async_handler = self._wrap_into_asyncdef(handler) ...
[ "def", "route", "(", "self", ",", "pattern", ":", "str", ",", "handler", ":", "Callable", ",", "cors_options", ":", "Mapping", "[", "str", ",", "ResourceOptions", "]", "=", "None", ")", "->", "None", ":", "if", "cors_options", "or", "self", ".", "cors_...
https://github.com/robinhood/faust/blob/01b4c0ad8390221db71751d80001b0fd879291e2/faust/web/drivers/aiohttp.py#L220-L233
xuanzebi/BERT-CH-NER
24bf95411e831281ffc6c13f3ea9382870a17d64
bert-master/run_classifier_with_tfhub.py
python
create_model
(is_training, input_ids, input_mask, segment_ids, labels, num_labels, bert_hub_module_handle)
Creates a classification model.
Creates a classification model.
[ "Creates", "a", "classification", "model", "." ]
def create_model(is_training, input_ids, input_mask, segment_ids, labels, num_labels, bert_hub_module_handle): """Creates a classification model.""" tags = set() if is_training: tags.add("train") bert_module = hub.Module(bert_hub_module_handle, tags=tags, trainable=True) bert_inputs = dic...
[ "def", "create_model", "(", "is_training", ",", "input_ids", ",", "input_mask", ",", "segment_ids", ",", "labels", ",", "num_labels", ",", "bert_hub_module_handle", ")", ":", "tags", "=", "set", "(", ")", "if", "is_training", ":", "tags", ".", "add", "(", ...
https://github.com/xuanzebi/BERT-CH-NER/blob/24bf95411e831281ffc6c13f3ea9382870a17d64/bert-master/run_classifier_with_tfhub.py#L37-L83
aliyun/aliyun-openapi-python-sdk
bda53176cc9cf07605b1cf769f0df444cca626a0
aliyun-python-sdk-core-v3/aliyunsdkcore/vendored/requests/packages/urllib3/util/timeout.py
python
Timeout.read_timeout
(self)
Get the value for the read timeout. This assumes some time has elapsed in the connection timeout and computes the read timeout appropriately. If self.total is set, the read timeout is dependent on the amount of time taken by the connect timeout. If the connection time has not been ...
Get the value for the read timeout.
[ "Get", "the", "value", "for", "the", "read", "timeout", "." ]
def read_timeout(self): """ Get the value for the read timeout. This assumes some time has elapsed in the connection timeout and computes the read timeout appropriately. If self.total is set, the read timeout is dependent on the amount of time taken by the connect timeout. If t...
[ "def", "read_timeout", "(", "self", ")", ":", "if", "(", "self", ".", "total", "is", "not", "None", "and", "self", ".", "total", "is", "not", "self", ".", "DEFAULT_TIMEOUT", "and", "self", ".", "_read", "is", "not", "None", "and", "self", ".", "_read...
https://github.com/aliyun/aliyun-openapi-python-sdk/blob/bda53176cc9cf07605b1cf769f0df444cca626a0/aliyun-python-sdk-core-v3/aliyunsdkcore/vendored/requests/packages/urllib3/util/timeout.py#L214-L242
lalor/python_for_linux_system_administration
2a002fcab3e74e82287400556dee7909e1996d10
chapter9/section5/fabfile.py
python
install_redis
()
[]
def install_redis(): sudo("apt-get install redis-server")
[ "def", "install_redis", "(", ")", ":", "sudo", "(", "\"apt-get install redis-server\"", ")" ]
https://github.com/lalor/python_for_linux_system_administration/blob/2a002fcab3e74e82287400556dee7909e1996d10/chapter9/section5/fabfile.py#L19-L20
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
opy/compiler2/symbols.py
python
Scope.add_use
(self, name)
[]
def add_use(self, name): self.uses.add(self.mangle(name))
[ "def", "add_use", "(", "self", ",", "name", ")", ":", "self", ".", "uses", ".", "add", "(", "self", ".", "mangle", "(", "name", ")", ")" ]
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/opy/compiler2/symbols.py#L66-L67