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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/dashboard/dashboard/issue_tracker_service.py | python | IssueTrackerService.AddBugComment | (self, bug_id, comment, status=None, cc_list=None,
merge_issue=None, labels=None, owner=None, send_email=True) | return self._MakeCommentRequest(bug_id, body, send_email=send_email) | Adds a comment with the bisect results to the given bug.
Args:
bug_id: Bug ID of the issue to update.
comment: Bisect results information.
status: A string status for bug, e.g. Assigned, Duplicate, WontFix, etc.
cc_list: List of email addresses of users to add to the CC list.
merge_is... | Adds a comment with the bisect results to the given bug. | [
"Adds",
"a",
"comment",
"with",
"the",
"bisect",
"results",
"to",
"the",
"given",
"bug",
"."
] | def AddBugComment(self, bug_id, comment, status=None, cc_list=None,
merge_issue=None, labels=None, owner=None, send_email=True):
"""Adds a comment with the bisect results to the given bug.
Args:
bug_id: Bug ID of the issue to update.
comment: Bisect results information.
st... | [
"def",
"AddBugComment",
"(",
"self",
",",
"bug_id",
",",
"comment",
",",
"status",
"=",
"None",
",",
"cc_list",
"=",
"None",
",",
"merge_issue",
"=",
"None",
",",
"labels",
"=",
"None",
",",
"owner",
"=",
"None",
",",
"send_email",
"=",
"True",
")",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/dashboard/dashboard/issue_tracker_service.py#L44-L83 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | build/config/win/get_msvc_config_real.py | python | VisualStudioVersion.Path | (self) | return self.path | Returns the path to Visual Studio installation. | Returns the path to Visual Studio installation. | [
"Returns",
"the",
"path",
"to",
"Visual",
"Studio",
"installation",
"."
] | def Path(self):
"""Returns the path to Visual Studio installation."""
return self.path | [
"def",
"Path",
"(",
"self",
")",
":",
"return",
"self",
".",
"path"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/build/config/win/get_msvc_config_real.py#L59-L61 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/applications/workbench/workbench/config/user.py | python | UserConfig._check_section_option_is_valid | (self, option, second) | Sanity check the section and option are strings and return the flattened option key | Sanity check the section and option are strings and return the flattened option key | [
"Sanity",
"check",
"the",
"section",
"and",
"option",
"are",
"strings",
"and",
"return",
"the",
"flattened",
"option",
"key"
] | def _check_section_option_is_valid(self, option, second):
"""
Sanity check the section and option are strings and return the flattened option key
"""
if second is None:
if not isinstance(option, str):
raise TypeError('Found invalid type ({}) for option ({}) mu... | [
"def",
"_check_section_option_is_valid",
"(",
"self",
",",
"option",
",",
"second",
")",
":",
"if",
"second",
"is",
"None",
":",
"if",
"not",
"isinstance",
"(",
"option",
",",
"str",
")",
":",
"raise",
"TypeError",
"(",
"'Found invalid type ({}) for option ({}) ... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/applications/workbench/workbench/config/user.py#L152-L166 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/nn/utils/rnn.py | python | PackedSequence.is_pinned | (self) | return self.data.is_pinned() | r"""Returns true if `self.data` stored on in pinned memory | r"""Returns true if `self.data` stored on in pinned memory | [
"r",
"Returns",
"true",
"if",
"self",
".",
"data",
"stored",
"on",
"in",
"pinned",
"memory"
] | def is_pinned(self):
r"""Returns true if `self.data` stored on in pinned memory"""
return self.data.is_pinned() | [
"def",
"is_pinned",
"(",
"self",
")",
":",
"return",
"self",
".",
"data",
".",
"is_pinned",
"(",
")"
] | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/nn/utils/rnn.py#L149-L151 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py | python | Scale.get | (self) | Get the current value as integer or float. | Get the current value as integer or float. | [
"Get",
"the",
"current",
"value",
"as",
"integer",
"or",
"float",
"."
] | def get(self):
"""Get the current value as integer or float."""
value = self.tk.call(self._w, 'get')
try:
return self.tk.getint(value)
except (ValueError, TypeError, TclError):
return self.tk.getdouble(value) | [
"def",
"get",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'get'",
")",
"try",
":",
"return",
"self",
".",
"tk",
".",
"getint",
"(",
"value",
")",
"except",
"(",
"ValueError",
",",
"TypeError"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py#L3011-L3017 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/propgrid.py | python | PGProperty.GetAttributeAsLong | (*args, **kwargs) | return _propgrid.PGProperty_GetAttributeAsLong(*args, **kwargs) | GetAttributeAsLong(self, String name, long defVal) -> long | GetAttributeAsLong(self, String name, long defVal) -> long | [
"GetAttributeAsLong",
"(",
"self",
"String",
"name",
"long",
"defVal",
")",
"-",
">",
"long"
] | def GetAttributeAsLong(*args, **kwargs):
"""GetAttributeAsLong(self, String name, long defVal) -> long"""
return _propgrid.PGProperty_GetAttributeAsLong(*args, **kwargs) | [
"def",
"GetAttributeAsLong",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PGProperty_GetAttributeAsLong",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/propgrid.py#L630-L632 | |
gv22ga/dlib-face-recognition-android | 42d6305cbd85833f2b85bb79b70ab9ab004153c9 | tools/lint/cpplint.py | python | _FunctionState.Begin | (self, function_name) | Start analyzing function body.
Args:
function_name: The name of the function being tracked. | Start analyzing function body.
Args:
function_name: The name of the function being tracked. | [
"Start",
"analyzing",
"function",
"body",
".",
"Args",
":",
"function_name",
":",
"The",
"name",
"of",
"the",
"function",
"being",
"tracked",
"."
] | def Begin(self, function_name):
"""Start analyzing function body.
Args:
function_name: The name of the function being tracked.
"""
self.in_a_function = True
self.lines_in_function = 0
self.current_function = function_name | [
"def",
"Begin",
"(",
"self",
",",
"function_name",
")",
":",
"self",
".",
"in_a_function",
"=",
"True",
"self",
".",
"lines_in_function",
"=",
"0",
"self",
".",
"current_function",
"=",
"function_name"
] | https://github.com/gv22ga/dlib-face-recognition-android/blob/42d6305cbd85833f2b85bb79b70ab9ab004153c9/tools/lint/cpplint.py#L955-L962 | ||
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/algorithms/adidas_utils/solvers/nonsymmetric/qre.py | python | cheap_gradients | (random, dist, y, payoff_matrices, num_players,
temperature=0., proj_grad=True) | return (grad_dist, grad_y), np.mean(unreg_exp), np.mean(reg_exp) | Computes exploitablity gradient and aux variable gradients with samples.
This implementation takes payoff_matrices as input so technically uses O(d^2)
compute but only a single column of payoff_matrices is used to perform the
update so can be re-implemented in O(d) if needed.
Args:
random: random number g... | Computes exploitablity gradient and aux variable gradients with samples. | [
"Computes",
"exploitablity",
"gradient",
"and",
"aux",
"variable",
"gradients",
"with",
"samples",
"."
] | def cheap_gradients(random, dist, y, payoff_matrices, num_players,
temperature=0., proj_grad=True):
"""Computes exploitablity gradient and aux variable gradients with samples.
This implementation takes payoff_matrices as input so technically uses O(d^2)
compute but only a single column of pay... | [
"def",
"cheap_gradients",
"(",
"random",
",",
"dist",
",",
"y",
",",
"payoff_matrices",
",",
"num_players",
",",
"temperature",
"=",
"0.",
",",
"proj_grad",
"=",
"True",
")",
":",
"# first compute policy gradients and player effects (fx)",
"policy_gradient",
"=",
"[... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/adidas_utils/solvers/nonsymmetric/qre.py#L251-L344 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/aui/framemanager.py | python | AuiManager.SnapToScreen | (self, snap=True, monitor=0, hAlign=wx.RIGHT, vAlign=wx.TOP) | Snaps the main frame to specified position on the screen.
:param bool `snap`: whether to snap the main frame or not;
:param integer `monitor`: the monitor display in which snapping the window;
:param integer `hAlign`: the horizontal alignment of the snapping position;
:param integer `vA... | Snaps the main frame to specified position on the screen. | [
"Snaps",
"the",
"main",
"frame",
"to",
"specified",
"position",
"on",
"the",
"screen",
"."
] | def SnapToScreen(self, snap=True, monitor=0, hAlign=wx.RIGHT, vAlign=wx.TOP):
"""
Snaps the main frame to specified position on the screen.
:param bool `snap`: whether to snap the main frame or not;
:param integer `monitor`: the monitor display in which snapping the window;
:par... | [
"def",
"SnapToScreen",
"(",
"self",
",",
"snap",
"=",
"True",
",",
"monitor",
"=",
"0",
",",
"hAlign",
"=",
"wx",
".",
"RIGHT",
",",
"vAlign",
"=",
"wx",
".",
"TOP",
")",
":",
"if",
"not",
"snap",
":",
"self",
".",
"_is_docked",
"=",
"(",
"False"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/framemanager.py#L10428-L10447 | ||
lammps/lammps | b75c3065430a75b1b5543a10e10f46d9b4c91913 | tools/i-pi/ipi/engine/forces.py | python | ForceBeads.bind | (self, beads, cell) | Binds beads, cell and force to the forcefield.
Takes the beads, cell objects and makes them members of the forcefield.
Also takes the force object and copies it once for each replica of the
system, then binds each replica to one of the copies so that the force
calculation can be parallelized. C... | Binds beads, cell and force to the forcefield. | [
"Binds",
"beads",
"cell",
"and",
"force",
"to",
"the",
"forcefield",
"."
] | def bind(self, beads, cell):
"""Binds beads, cell and force to the forcefield.
Takes the beads, cell objects and makes them members of the forcefield.
Also takes the force object and copies it once for each replica of the
system, then binds each replica to one of the copies so that the force
... | [
"def",
"bind",
"(",
"self",
",",
"beads",
",",
"cell",
")",
":",
"# stores a copy of the number of atoms and of beads",
"#!TODO! make them read-only properties",
"self",
".",
"natoms",
"=",
"beads",
".",
"natoms",
"if",
"(",
"self",
".",
"nbeads",
"!=",
"beads",
"... | https://github.com/lammps/lammps/blob/b75c3065430a75b1b5543a10e10f46d9b4c91913/tools/i-pi/ipi/engine/forces.py#L392-L446 | ||
p4lang/PI | 38d87e81253feff9fff0660d662c885be78fb719 | tools/cpplint.py | python | _IsType | (clean_lines, nesting_state, expr) | return False | Check if expression looks like a type name, returns true if so.
Args:
clean_lines: A CleansedLines instance containing the file.
nesting_state: A NestingState instance which maintains information about
the current stack of nested blocks being parsed.
expr: The expression to check.
Re... | Check if expression looks like a type name, returns true if so. | [
"Check",
"if",
"expression",
"looks",
"like",
"a",
"type",
"name",
"returns",
"true",
"if",
"so",
"."
] | def _IsType(clean_lines, nesting_state, expr):
"""Check if expression looks like a type name, returns true if so.
Args:
clean_lines: A CleansedLines instance containing the file.
nesting_state: A NestingState instance which maintains information about
the current stack of nested blocks b... | [
"def",
"_IsType",
"(",
"clean_lines",
",",
"nesting_state",
",",
"expr",
")",
":",
"# Keep only the last token in the expression",
"last_word",
"=",
"Match",
"(",
"r'^.*(\\b\\S+)$'",
",",
"expr",
")",
"if",
"last_word",
":",
"token",
"=",
"last_word",
".",
"group"... | https://github.com/p4lang/PI/blob/38d87e81253feff9fff0660d662c885be78fb719/tools/cpplint.py#L3985-L4045 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/trace.py | python | CoverageResults.write_results_file | (self, path, lines, lnotab, lines_hit) | return n_hits, n_lines | Return a coverage results file in path. | Return a coverage results file in path. | [
"Return",
"a",
"coverage",
"results",
"file",
"in",
"path",
"."
] | def write_results_file(self, path, lines, lnotab, lines_hit):
"""Return a coverage results file in path."""
try:
outfile = open(path, "w")
except IOError, err:
print >> sys.stderr, ("trace: Could not open %r for writing: %s"
"- skipping"... | [
"def",
"write_results_file",
"(",
"self",
",",
"path",
",",
"lines",
",",
"lnotab",
",",
"lines_hit",
")",
":",
"try",
":",
"outfile",
"=",
"open",
"(",
"path",
",",
"\"w\"",
")",
"except",
"IOError",
",",
"err",
":",
"print",
">>",
"sys",
".",
"stde... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/trace.py#L357-L391 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/benchmark/tools/gbench/util.py | python | remove_benchmark_flags | (prefix, benchmark_flags) | return [f for f in benchmark_flags if not f.startswith(prefix)] | Return a new list containing the specified benchmark_flags except those
with the specified prefix. | Return a new list containing the specified benchmark_flags except those
with the specified prefix. | [
"Return",
"a",
"new",
"list",
"containing",
"the",
"specified",
"benchmark_flags",
"except",
"those",
"with",
"the",
"specified",
"prefix",
"."
] | def remove_benchmark_flags(prefix, benchmark_flags):
"""
Return a new list containing the specified benchmark_flags except those
with the specified prefix.
"""
assert prefix.startswith('--') and prefix.endswith('=')
return [f for f in benchmark_flags if not f.startswith(prefix)] | [
"def",
"remove_benchmark_flags",
"(",
"prefix",
",",
"benchmark_flags",
")",
":",
"assert",
"prefix",
".",
"startswith",
"(",
"'--'",
")",
"and",
"prefix",
".",
"endswith",
"(",
"'='",
")",
"return",
"[",
"f",
"for",
"f",
"in",
"benchmark_flags",
"if",
"no... | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/benchmark/tools/gbench/util.py#L104-L110 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/interpolate/fitpack2.py | python | UnivariateSpline.__call__ | (self, x, nu=0, ext=None) | return fitpack.splev(x, self._eval_args, der=nu, ext=ext) | Evaluate spline (or its nu-th derivative) at positions x.
Parameters
----------
x : array_like
A 1-D array of points at which to return the value of the smoothed
spline or its derivatives. Note: x can be unordered but the
evaluation is more efficient if x is ... | Evaluate spline (or its nu-th derivative) at positions x. | [
"Evaluate",
"spline",
"(",
"or",
"its",
"nu",
"-",
"th",
"derivative",
")",
"at",
"positions",
"x",
"."
] | def __call__(self, x, nu=0, ext=None):
"""
Evaluate spline (or its nu-th derivative) at positions x.
Parameters
----------
x : array_like
A 1-D array of points at which to return the value of the smoothed
spline or its derivatives. Note: x can be unordere... | [
"def",
"__call__",
"(",
"self",
",",
"x",
",",
"nu",
"=",
"0",
",",
"ext",
"=",
"None",
")",
":",
"x",
"=",
"np",
".",
"asarray",
"(",
"x",
")",
"# empty input yields empty output",
"if",
"x",
".",
"size",
"==",
"0",
":",
"return",
"array",
"(",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/interpolate/fitpack2.py#L273-L312 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBDebugger.EnableLog | (self, channel, types) | return _lldb.SBDebugger_EnableLog(self, channel, types) | EnableLog(SBDebugger self, char const * channel, char const ** types) -> bool | EnableLog(SBDebugger self, char const * channel, char const ** types) -> bool | [
"EnableLog",
"(",
"SBDebugger",
"self",
"char",
"const",
"*",
"channel",
"char",
"const",
"**",
"types",
")",
"-",
">",
"bool"
] | def EnableLog(self, channel, types):
"""EnableLog(SBDebugger self, char const * channel, char const ** types) -> bool"""
return _lldb.SBDebugger_EnableLog(self, channel, types) | [
"def",
"EnableLog",
"(",
"self",
",",
"channel",
",",
"types",
")",
":",
"return",
"_lldb",
".",
"SBDebugger_EnableLog",
"(",
"self",
",",
"channel",
",",
"types",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L4131-L4133 | |
NVIDIA/MDL-SDK | aa9642b2546ad7b6236b5627385d882c2ed83c5d | src/mdl/compiler/compilercore/gen_intrinsic_eval.py | python | SignatureParser.gen_type_check | (self, f, idx, type_code) | Create a check for the idx parameter to be of given type. | Create a check for the idx parameter to be of given type. | [
"Create",
"a",
"check",
"for",
"the",
"idx",
"parameter",
"to",
"be",
"of",
"given",
"type",
"."
] | def gen_type_check(self, f, idx, type_code):
"""Create a check for the idx parameter to be of given type."""
atomic_chk = self.get_atomic_value_kind(type_code)
if atomic_chk:
self.write(f, "if (arguments[%s]->get_kind() != %s)\n" % (idx, atomic_chk))
self.indent += 1
self.write(f, "return false;\n")
... | [
"def",
"gen_type_check",
"(",
"self",
",",
"f",
",",
"idx",
",",
"type_code",
")",
":",
"atomic_chk",
"=",
"self",
".",
"get_atomic_value_kind",
"(",
"type_code",
")",
"if",
"atomic_chk",
":",
"self",
".",
"write",
"(",
"f",
",",
"\"if (arguments[%s]->get_ki... | https://github.com/NVIDIA/MDL-SDK/blob/aa9642b2546ad7b6236b5627385d882c2ed83c5d/src/mdl/compiler/compilercore/gen_intrinsic_eval.py#L994-L1064 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/series.py | python | Series.dtypes | (self) | return self._data.dtype | Return the dtype object of the underlying data. | Return the dtype object of the underlying data. | [
"Return",
"the",
"dtype",
"object",
"of",
"the",
"underlying",
"data",
"."
] | def dtypes(self):
"""
Return the dtype object of the underlying data.
"""
return self._data.dtype | [
"def",
"dtypes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_data",
".",
"dtype"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/series.py#L422-L426 | |
okex/V3-Open-API-SDK | c5abb0db7e2287718e0055e17e57672ce0ec7fd9 | okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_internal/req/req_file.py | python | build_parser | (line) | return parser | Return a parser for parsing requirement lines | Return a parser for parsing requirement lines | [
"Return",
"a",
"parser",
"for",
"parsing",
"requirement",
"lines"
] | def build_parser(line):
# type: (Text) -> optparse.OptionParser
"""
Return a parser for parsing requirement lines
"""
parser = optparse.OptionParser(add_help_option=False)
option_factories = SUPPORTED_OPTIONS + SUPPORTED_OPTIONS_REQ
for option_factory in option_factories:
option = o... | [
"def",
"build_parser",
"(",
"line",
")",
":",
"# type: (Text) -> optparse.OptionParser",
"parser",
"=",
"optparse",
".",
"OptionParser",
"(",
"add_help_option",
"=",
"False",
")",
"option_factories",
"=",
"SUPPORTED_OPTIONS",
"+",
"SUPPORTED_OPTIONS_REQ",
"for",
"option... | https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_internal/req/req_file.py#L276-L298 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/math/autodiff/pytorch.py | python | torch_to_ad | (module,args) | return wrapper(*args) | Converts a PyTorch function applied to args (list of scalars or numpy
arrays) to a Klamp't autodiff function call on those arguments. | Converts a PyTorch function applied to args (list of scalars or numpy
arrays) to a Klamp't autodiff function call on those arguments. | [
"Converts",
"a",
"PyTorch",
"function",
"applied",
"to",
"args",
"(",
"list",
"of",
"scalars",
"or",
"numpy",
"arrays",
")",
"to",
"a",
"Klamp",
"t",
"autodiff",
"function",
"call",
"on",
"those",
"arguments",
"."
] | def torch_to_ad(module,args):
"""Converts a PyTorch function applied to args (list of scalars or numpy
arrays) to a Klamp't autodiff function call on those arguments."""
wrapper=TorchModuleFunction(module)
return wrapper(*args) | [
"def",
"torch_to_ad",
"(",
"module",
",",
"args",
")",
":",
"wrapper",
"=",
"TorchModuleFunction",
"(",
"module",
")",
"return",
"wrapper",
"(",
"*",
"args",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/math/autodiff/pytorch.py#L136-L140 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/plat-mac/findertools.py | python | _setwindowview | (folder_alias, view=0) | set the windowview | set the windowview | [
"set",
"the",
"windowview"
] | def _setwindowview(folder_alias, view=0):
"""set the windowview"""
attrs = {}
args = {}
if view == 1:
_v = aetypes.Type('pnam')
elif view == 2:
_v = aetypes.Type('lgbu')
else:
_v = aetypes.Type('iimg')
finder = _getfinder()
aeobj_0 = aetypes.ObjectSpecifier(want =... | [
"def",
"_setwindowview",
"(",
"folder_alias",
",",
"view",
"=",
"0",
")",
":",
"attrs",
"=",
"{",
"}",
"args",
"=",
"{",
"}",
"if",
"view",
"==",
"1",
":",
"_v",
"=",
"aetypes",
".",
"Type",
"(",
"'pnam'",
")",
"elif",
"view",
"==",
"2",
":",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/plat-mac/findertools.py#L386-L413 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/client/session_benchmark.py | python | SessionBenchmark._benchmarkFetchPrebuilt | (self, name, target, size, iters) | Runs a microbenchmark to measure the cost of fetching a tensor.
Reports the median cost of fetching a tensor of `size` * `sizeof(float)`
bytes.
Args:
name: A human-readable name for logging the output.
target: The session target to use for the benchmark.
size: The number of floating-poin... | Runs a microbenchmark to measure the cost of fetching a tensor. | [
"Runs",
"a",
"microbenchmark",
"to",
"measure",
"the",
"cost",
"of",
"fetching",
"a",
"tensor",
"."
] | def _benchmarkFetchPrebuilt(self, name, target, size, iters):
"""Runs a microbenchmark to measure the cost of fetching a tensor.
Reports the median cost of fetching a tensor of `size` * `sizeof(float)`
bytes.
Args:
name: A human-readable name for logging the output.
target: The session tar... | [
"def",
"_benchmarkFetchPrebuilt",
"(",
"self",
",",
"name",
",",
"target",
",",
"size",
",",
"iters",
")",
":",
"times",
"=",
"[",
"]",
"with",
"ops",
".",
"Graph",
"(",
")",
".",
"as_default",
"(",
")",
":",
"# Define the tensor to be fetched as a variable,... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/client/session_benchmark.py#L95-L122 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/training/python/training/sequence_queueing_state_saver.py | python | _check_shape | (value, expected_shape) | Check the shape of Tensor `value`, via shape inference and assertions.
Args:
value: A Tensor, possibly with shape associated shape information.
expected_shape: a `TensorShape`, list of `int32`, or a vector `Tensor`.
Returns:
new_value: A Tensor matching `value`. Accessing this tensor tests
asse... | Check the shape of Tensor `value`, via shape inference and assertions. | [
"Check",
"the",
"shape",
"of",
"Tensor",
"value",
"via",
"shape",
"inference",
"and",
"assertions",
"."
] | def _check_shape(value, expected_shape):
"""Check the shape of Tensor `value`, via shape inference and assertions.
Args:
value: A Tensor, possibly with shape associated shape information.
expected_shape: a `TensorShape`, list of `int32`, or a vector `Tensor`.
Returns:
new_value: A Tensor matching `v... | [
"def",
"_check_shape",
"(",
"value",
",",
"expected_shape",
")",
":",
"assert",
"isinstance",
"(",
"value",
",",
"ops",
".",
"Tensor",
")",
"if",
"isinstance",
"(",
"expected_shape",
",",
"tensor_shape",
".",
"TensorShape",
")",
":",
"expected_shape",
"=",
"... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/training/python/training/sequence_queueing_state_saver.py#L171-L214 | ||
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | PhysicsTools/NanoAOD/python/custom_jme_cff.py | python | AddQGLTaggerVars | (proc, jetName="", jetSrc="", jetTableName="", jetSequenceName="", calculateQGLVars=False) | return proc | Schedule the QGTagger module to calculate input variables to the QG likelihood | Schedule the QGTagger module to calculate input variables to the QG likelihood | [
"Schedule",
"the",
"QGTagger",
"module",
"to",
"calculate",
"input",
"variables",
"to",
"the",
"QG",
"likelihood"
] | def AddQGLTaggerVars(proc, jetName="", jetSrc="", jetTableName="", jetSequenceName="", calculateQGLVars=False):
"""
Schedule the QGTagger module to calculate input variables to the QG likelihood
"""
QGLTagger="qgtagger{}".format(jetName)
patJetWithUserData="{}WithUserData".format(jetSrc)
if calculateQGLVa... | [
"def",
"AddQGLTaggerVars",
"(",
"proc",
",",
"jetName",
"=",
"\"\"",
",",
"jetSrc",
"=",
"\"\"",
",",
"jetTableName",
"=",
"\"\"",
",",
"jetSequenceName",
"=",
"\"\"",
",",
"calculateQGLVars",
"=",
"False",
")",
":",
"QGLTagger",
"=",
"\"qgtagger{}\"",
".",
... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/PhysicsTools/NanoAOD/python/custom_jme_cff.py#L353-L384 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ReflectometryILLSumForeground.py | python | ReflectometryILLSumForeground._applyWavelengthRange | (self, ws) | return croppedWS | Cut wavelengths outside the wavelength range from a TOF workspace. | Cut wavelengths outside the wavelength range from a TOF workspace. | [
"Cut",
"wavelengths",
"outside",
"the",
"wavelength",
"range",
"from",
"a",
"TOF",
"workspace",
"."
] | def _applyWavelengthRange(self, ws):
"""Cut wavelengths outside the wavelength range from a TOF workspace."""
wRange = self.getProperty(Prop.WAVELENGTH_RANGE).value
rangeProp = {'XMin': wRange[0]}
if len(wRange) == 2:
rangeProp['XMax'] = wRange[1]
croppedWSName = self... | [
"def",
"_applyWavelengthRange",
"(",
"self",
",",
"ws",
")",
":",
"wRange",
"=",
"self",
".",
"getProperty",
"(",
"Prop",
".",
"WAVELENGTH_RANGE",
")",
".",
"value",
"rangeProp",
"=",
"{",
"'XMin'",
":",
"wRange",
"[",
"0",
"]",
"}",
"if",
"len",
"(",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ReflectometryILLSumForeground.py#L199-L212 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/framework/dtypes.py | python | DType.is_floating | (self) | return issubclass(self.as_numpy_dtype, np.floating) | Returns whether this is a (real) floating point type. | Returns whether this is a (real) floating point type. | [
"Returns",
"whether",
"this",
"is",
"a",
"(",
"real",
")",
"floating",
"point",
"type",
"."
] | def is_floating(self):
"""Returns whether this is a (real) floating point type."""
return issubclass(self.as_numpy_dtype, np.floating) | [
"def",
"is_floating",
"(",
"self",
")",
":",
"return",
"issubclass",
"(",
"self",
".",
"as_numpy_dtype",
",",
"np",
".",
"floating",
")"
] | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/framework/dtypes.py#L145-L147 | |
fastio/1store | 64f928df0ddb665c17a9ab3aa79ddd703de374ce | dist/common/scripts/scylla_util.py | python | aws_instance.instance | (self) | return self._type | Returns which instance we are running in. i.e.: i3.16xlarge | Returns which instance we are running in. i.e.: i3.16xlarge | [
"Returns",
"which",
"instance",
"we",
"are",
"running",
"in",
".",
"i",
".",
"e",
".",
":",
"i3",
".",
"16xlarge"
] | def instance(self):
"""Returns which instance we are running in. i.e.: i3.16xlarge"""
return self._type | [
"def",
"instance",
"(",
"self",
")",
":",
"return",
"self",
".",
"_type"
] | https://github.com/fastio/1store/blob/64f928df0ddb665c17a9ab3aa79ddd703de374ce/dist/common/scripts/scylla_util.py#L98-L100 | |
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/tools/gyp/pylib/gyp/msvs_emulation.py | python | PrecompiledHeader.GetObjDependencies | (self, sources, objs, arch) | return [] | Given a list of sources files and the corresponding object files,
returns a list of the pch files that should be depended upon. The
additional wrapping in the return value is for interface compatibility
with make.py on Mac, and xcode_emulation.py. | Given a list of sources files and the corresponding object files,
returns a list of the pch files that should be depended upon. The
additional wrapping in the return value is for interface compatibility
with make.py on Mac, and xcode_emulation.py. | [
"Given",
"a",
"list",
"of",
"sources",
"files",
"and",
"the",
"corresponding",
"object",
"files",
"returns",
"a",
"list",
"of",
"the",
"pch",
"files",
"that",
"should",
"be",
"depended",
"upon",
".",
"The",
"additional",
"wrapping",
"in",
"the",
"return",
... | def GetObjDependencies(self, sources, objs, arch):
"""Given a list of sources files and the corresponding object files,
returns a list of the pch files that should be depended upon. The
additional wrapping in the return value is for interface compatibility
with make.py on Mac, and xcode_emulation.py."""... | [
"def",
"GetObjDependencies",
"(",
"self",
",",
"sources",
",",
"objs",
",",
"arch",
")",
":",
"assert",
"arch",
"is",
"None",
"if",
"not",
"self",
".",
"_PchHeader",
"(",
")",
":",
"return",
"[",
"]",
"pch_ext",
"=",
"os",
".",
"path",
".",
"splitext... | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/tools/gyp/pylib/gyp/msvs_emulation.py#L905-L917 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | models/AI-Model-Zoo/caffe-xilinx/scripts/cpp_lint.py | python | FindNextMultiLineCommentStart | (lines, lineix) | return len(lines) | Find the beginning marker for a multiline comment. | Find the beginning marker for a multiline comment. | [
"Find",
"the",
"beginning",
"marker",
"for",
"a",
"multiline",
"comment",
"."
] | def FindNextMultiLineCommentStart(lines, lineix):
"""Find the beginning marker for a multiline comment."""
while lineix < len(lines):
if lines[lineix].strip().startswith('/*'):
# Only return this marker if the comment goes beyond this line
if lines[lineix].strip().find('*/', 2) < 0:
return l... | [
"def",
"FindNextMultiLineCommentStart",
"(",
"lines",
",",
"lineix",
")",
":",
"while",
"lineix",
"<",
"len",
"(",
"lines",
")",
":",
"if",
"lines",
"[",
"lineix",
"]",
".",
"strip",
"(",
")",
".",
"startswith",
"(",
"'/*'",
")",
":",
"# Only return this... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/models/AI-Model-Zoo/caffe-xilinx/scripts/cpp_lint.py#L1123-L1131 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | example/gluon/style_transfer/utils.py | python | add_imagenet_mean_batch | (batch) | return batch | batch = denormalizer(batch) | batch = denormalizer(batch) | [
"batch",
"=",
"denormalizer",
"(",
"batch",
")"
] | def add_imagenet_mean_batch(batch):
batch = F.swapaxes(batch,0, 1)
(b, g, r) = F.split(batch, num_outputs=3, axis=0)
r = r + 123.680
g = g + 116.779
b = b + 103.939
batch = F.concat(b, g, r, dim=0)
batch = F.swapaxes(batch,0, 1)
"""
batch = denormalizer(batch)
"""
return batc... | [
"def",
"add_imagenet_mean_batch",
"(",
"batch",
")",
":",
"batch",
"=",
"F",
".",
"swapaxes",
"(",
"batch",
",",
"0",
",",
"1",
")",
"(",
"b",
",",
"g",
",",
"r",
")",
"=",
"F",
".",
"split",
"(",
"batch",
",",
"num_outputs",
"=",
"3",
",",
"ax... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/example/gluon/style_transfer/utils.py#L81-L92 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/contributed/sumopy/agilepy/lib_base/arrayman.py | python | ArrayConfMixin._del_rows | (self, ids_del, inds_remain) | Multiple row delete method used by attrsman | Multiple row delete method used by attrsman | [
"Multiple",
"row",
"delete",
"method",
"used",
"by",
"attrsman"
] | def _del_rows(self, ids_del, inds_remain):
"""
Multiple row delete method used by attrsman
"""
self.set_value(self.get_value()[inds_remain]) | [
"def",
"_del_rows",
"(",
"self",
",",
"ids_del",
",",
"inds_remain",
")",
":",
"self",
".",
"set_value",
"(",
"self",
".",
"get_value",
"(",
")",
"[",
"inds_remain",
"]",
")"
] | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/contributed/sumopy/agilepy/lib_base/arrayman.py#L94-L98 | ||
jubatus/jubatus | 1251ce551bac980488a6313728e72b3fe0b79a9f | tools/codestyle/cpplint/cpplint.py | python | _OutputFormat | () | return _cpplint_state.output_format | Gets the module's output format. | Gets the module's output format. | [
"Gets",
"the",
"module",
"s",
"output",
"format",
"."
] | def _OutputFormat():
"""Gets the module's output format."""
return _cpplint_state.output_format | [
"def",
"_OutputFormat",
"(",
")",
":",
"return",
"_cpplint_state",
".",
"output_format"
] | https://github.com/jubatus/jubatus/blob/1251ce551bac980488a6313728e72b3fe0b79a9f/tools/codestyle/cpplint/cpplint.py#L586-L588 | |
NVIDIAGameWorks/kaolin | e5148d05e9c1e2ce92a07881ce3593b1c5c3f166 | kaolin/ops/gcn.py | python | GraphConv.forward | (self, node_feat, adj, normalize_adj=True) | return result | r"""
Args:
node_feat (torch.FloatTensor):
The input features of each node, of shape
:math:`(\text{batch_size}, \text{num_nodes}, \text{input_dim})`.
adj (torch.sparse.FloatTensor or torch.FloatTensor):
The adjacency matrix. ``adj[i, j]`` is... | r"""
Args:
node_feat (torch.FloatTensor):
The input features of each node, of shape
:math:`(\text{batch_size}, \text{num_nodes}, \text{input_dim})`.
adj (torch.sparse.FloatTensor or torch.FloatTensor):
The adjacency matrix. ``adj[i, j]`` is... | [
"r",
"Args",
":",
"node_feat",
"(",
"torch",
".",
"FloatTensor",
")",
":",
"The",
"input",
"features",
"of",
"each",
"node",
"of",
"shape",
":",
"math",
":",
"(",
"\\",
"text",
"{",
"batch_size",
"}",
"\\",
"text",
"{",
"num_nodes",
"}",
"\\",
"text"... | def forward(self, node_feat, adj, normalize_adj=True):
r"""
Args:
node_feat (torch.FloatTensor):
The input features of each node, of shape
:math:`(\text{batch_size}, \text{num_nodes}, \text{input_dim})`.
adj (torch.sparse.FloatTensor or torch.Float... | [
"def",
"forward",
"(",
"self",
",",
"node_feat",
",",
"adj",
",",
"normalize_adj",
"=",
"True",
")",
":",
"if",
"adj",
".",
"type",
"(",
")",
".",
"endswith",
"(",
"'sparse.FloatTensor'",
")",
":",
"if",
"normalize_adj",
":",
"norm",
"=",
"torch",
".",... | https://github.com/NVIDIAGameWorks/kaolin/blob/e5148d05e9c1e2ce92a07881ce3593b1c5c3f166/kaolin/ops/gcn.py#L153-L199 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/requests/sessions.py | python | SessionRedirectMixin.rebuild_proxies | (self, prepared_request, proxies) | return new_proxies | This method re-evaluates the proxy configuration by considering the
environment variables. If we are redirected to a URL covered by
NO_PROXY, we strip the proxy configuration. Otherwise, we set missing
proxy keys for this URL (in case they were stripped by a previous
redirect).
... | This method re-evaluates the proxy configuration by considering the
environment variables. If we are redirected to a URL covered by
NO_PROXY, we strip the proxy configuration. Otherwise, we set missing
proxy keys for this URL (in case they were stripped by a previous
redirect). | [
"This",
"method",
"re",
"-",
"evaluates",
"the",
"proxy",
"configuration",
"by",
"considering",
"the",
"environment",
"variables",
".",
"If",
"we",
"are",
"redirected",
"to",
"a",
"URL",
"covered",
"by",
"NO_PROXY",
"we",
"strip",
"the",
"proxy",
"configuratio... | def rebuild_proxies(self, prepared_request, proxies):
"""This method re-evaluates the proxy configuration by considering the
environment variables. If we are redirected to a URL covered by
NO_PROXY, we strip the proxy configuration. Otherwise, we set missing
proxy keys for this URL (in c... | [
"def",
"rebuild_proxies",
"(",
"self",
",",
"prepared_request",
",",
"proxies",
")",
":",
"proxies",
"=",
"proxies",
"if",
"proxies",
"is",
"not",
"None",
"else",
"{",
"}",
"headers",
"=",
"prepared_request",
".",
"headers",
"url",
"=",
"prepared_request",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/requests/sessions.py#L251-L290 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/symbol/numpy/_symbol.py | python | full_like | (a, fill_value, dtype=None, order='C', ctx=None, out=None) | return _npi.full_like(a, fill_value=fill_value, ctx=ctx, dtype=dtype, out=out) | Return a full array with the same shape and type as a given array.
Parameters
----------
a : _Symbol
The shape and data-type of `a` define these same attributes of
the returned array.
fill_value : scalar
Fill value.
dtype : data-type, optional
Overrides the data type... | Return a full array with the same shape and type as a given array. | [
"Return",
"a",
"full",
"array",
"with",
"the",
"same",
"shape",
"and",
"type",
"as",
"a",
"given",
"array",
"."
] | def full_like(a, fill_value, dtype=None, order='C', ctx=None, out=None): # pylint: disable=too-many-arguments
"""
Return a full array with the same shape and type as a given array.
Parameters
----------
a : _Symbol
The shape and data-type of `a` define these same attributes of
the ... | [
"def",
"full_like",
"(",
"a",
",",
"fill_value",
",",
"dtype",
"=",
"None",
",",
"order",
"=",
"'C'",
",",
"ctx",
"=",
"None",
",",
"out",
"=",
"None",
")",
":",
"# pylint: disable=too-many-arguments",
"if",
"order",
"!=",
"'C'",
":",
"raise",
"NotImplem... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/symbol/numpy/_symbol.py#L1342-L1383 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/mimetypes.py | python | MimeTypes.guess_extension | (self, type, strict=True) | return extensions[0] | Guess the extension for a file based on its MIME type.
Return value is a string giving a filename extension,
including the leading dot ('.'). The extension is not
guaranteed to have been associated with any particular data
stream, but would be mapped to the MIME type `type' by
... | Guess the extension for a file based on its MIME type. | [
"Guess",
"the",
"extension",
"for",
"a",
"file",
"based",
"on",
"its",
"MIME",
"type",
"."
] | def guess_extension(self, type, strict=True):
"""Guess the extension for a file based on its MIME type.
Return value is a string giving a filename extension,
including the leading dot ('.'). The extension is not
guaranteed to have been associated with any particular data
stream... | [
"def",
"guess_extension",
"(",
"self",
",",
"type",
",",
"strict",
"=",
"True",
")",
":",
"extensions",
"=",
"self",
".",
"guess_all_extensions",
"(",
"type",
",",
"strict",
")",
"if",
"not",
"extensions",
":",
"return",
"None",
"return",
"extensions",
"["... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/mimetypes.py#L176-L192 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/lib-tk/ttk.py | python | tclobjs_to_py | (adict) | return adict | Returns adict with its values converted from Tcl objects to Python
objects. | Returns adict with its values converted from Tcl objects to Python
objects. | [
"Returns",
"adict",
"with",
"its",
"values",
"converted",
"from",
"Tcl",
"objects",
"to",
"Python",
"objects",
"."
] | def tclobjs_to_py(adict):
"""Returns adict with its values converted from Tcl objects to Python
objects."""
for opt, val in adict.items():
adict[opt] = _tclobj_to_py(val)
return adict | [
"def",
"tclobjs_to_py",
"(",
"adict",
")",
":",
"for",
"opt",
",",
"val",
"in",
"adict",
".",
"items",
"(",
")",
":",
"adict",
"[",
"opt",
"]",
"=",
"_tclobj_to_py",
"(",
"val",
")",
"return",
"adict"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib-tk/ttk.py#L337-L343 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/math_ops.py | python | div_no_nan | (x, y, name=None) | Computes an unsafe divide which returns 0 if the y is zero.
Args:
x: A `Tensor`. Must be one of the following types: `float32`, `float64`.
y: A `Tensor` whose dtype is compatible with `x`.
name: A name for the operation (optional).
Returns:
The element-wise value of the x divided by y. | Computes an unsafe divide which returns 0 if the y is zero. | [
"Computes",
"an",
"unsafe",
"divide",
"which",
"returns",
"0",
"if",
"the",
"y",
"is",
"zero",
"."
] | def div_no_nan(x, y, name=None):
"""Computes an unsafe divide which returns 0 if the y is zero.
Args:
x: A `Tensor`. Must be one of the following types: `float32`, `float64`.
y: A `Tensor` whose dtype is compatible with `x`.
name: A name for the operation (optional).
Returns:
The element-wise va... | [
"def",
"div_no_nan",
"(",
"x",
",",
"y",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"\"div_no_nan\"",
",",
"[",
"x",
",",
"y",
"]",
")",
"as",
"name",
":",
"x",
"=",
"ops",
".",
"convert_to_tensor",
"(... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/math_ops.py#L1098-L1118 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/glob.py | python | iglob | (pathname, recursive=False) | return it | Return an iterator which yields the paths matching a pathname pattern.
The pattern may contain simple shell-style wildcards a la
fnmatch. However, unlike fnmatch, filenames starting with a
dot are special cases that are not matched by '*' and '?'
patterns.
If recursive is true, the pattern '**' wi... | Return an iterator which yields the paths matching a pathname pattern. | [
"Return",
"an",
"iterator",
"which",
"yields",
"the",
"paths",
"matching",
"a",
"pathname",
"pattern",
"."
] | def iglob(pathname, recursive=False):
"""Return an iterator which yields the paths matching a pathname pattern.
The pattern may contain simple shell-style wildcards a la
fnmatch. However, unlike fnmatch, filenames starting with a
dot are special cases that are not matched by '*' and '?'
patterns.
... | [
"def",
"iglob",
"(",
"pathname",
",",
"recursive",
"=",
"False",
")",
":",
"it",
"=",
"_iglob",
"(",
"pathname",
",",
"recursive",
")",
"if",
"recursive",
"and",
"_isrecursive",
"(",
"pathname",
")",
":",
"s",
"=",
"next",
"(",
"it",
")",
"# skip empty... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/glob.py#L30-L45 | |
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | lldb/examples/python/file_extract.py | python | FileExtract.get_c_string | (self) | return cstr | Extract a single NULL terminated C string from the binary file at the current file position, returns a single C string | Extract a single NULL terminated C string from the binary file at the current file position, returns a single C string | [
"Extract",
"a",
"single",
"NULL",
"terminated",
"C",
"string",
"from",
"the",
"binary",
"file",
"at",
"the",
"current",
"file",
"position",
"returns",
"a",
"single",
"C",
"string"
] | def get_c_string(self):
'''Extract a single NULL terminated C string from the binary file at the current file position, returns a single C string'''
cstr = ''
byte = self.get_uint8()
while byte != 0:
cstr += "%c" % byte
byte = self.get_uint8()
return cstr | [
"def",
"get_c_string",
"(",
"self",
")",
":",
"cstr",
"=",
"''",
"byte",
"=",
"self",
".",
"get_uint8",
"(",
")",
"while",
"byte",
"!=",
"0",
":",
"cstr",
"+=",
"\"%c\"",
"%",
"byte",
"byte",
"=",
"self",
".",
"get_uint8",
"(",
")",
"return",
"cstr... | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/lldb/examples/python/file_extract.py#L155-L162 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | PyApp.SetAppDisplayName | (*args, **kwargs) | return _core_.PyApp_SetAppDisplayName(*args, **kwargs) | SetAppDisplayName(self, String name)
Set the application display name. The display name is the name shown
to the user in titles, reports, etc while the app name is used for
paths, config, and other places the user doesn't see, for example the
app name could be myapp while display name ... | SetAppDisplayName(self, String name) | [
"SetAppDisplayName",
"(",
"self",
"String",
"name",
")"
] | def SetAppDisplayName(*args, **kwargs):
"""
SetAppDisplayName(self, String name)
Set the application display name. The display name is the name shown
to the user in titles, reports, etc while the app name is used for
paths, config, and other places the user doesn't see, for exa... | [
"def",
"SetAppDisplayName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"PyApp_SetAppDisplayName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L7740-L7750 | |
dmlc/xgboost | 2775c2a1abd4b5b759ff517617434c8b9aeb4cc0 | python-package/xgboost/core.py | python | DataIter._next_wrapper | (self, this: None) | return self._handle_exception(lambda: self.next(data_handle), 0) | A wrapper for user defined `next` function.
`this` is not used in Python. ctypes can handle `self` of a Python
member function automatically when converting it to c function
pointer. | A wrapper for user defined `next` function. | [
"A",
"wrapper",
"for",
"user",
"defined",
"next",
"function",
"."
] | def _next_wrapper(self, this: None) -> int: # pylint: disable=unused-argument
"""A wrapper for user defined `next` function.
`this` is not used in Python. ctypes can handle `self` of a Python
member function automatically when converting it to c function
pointer.
"""
... | [
"def",
"_next_wrapper",
"(",
"self",
",",
"this",
":",
"None",
")",
"->",
"int",
":",
"# pylint: disable=unused-argument",
"@",
"_deprecate_positional_args",
"def",
"data_handle",
"(",
"data",
":",
"Any",
",",
"*",
",",
"feature_names",
":",
"FeatNamesT",
"=",
... | https://github.com/dmlc/xgboost/blob/2775c2a1abd4b5b759ff517617434c8b9aeb4cc0/python-package/xgboost/core.py#L391-L425 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/dataview.py | python | DataViewTreeStore.GetNthChild | (*args, **kwargs) | return _dataview.DataViewTreeStore_GetNthChild(*args, **kwargs) | GetNthChild(self, DataViewItem parent, unsigned int pos) -> DataViewItem | GetNthChild(self, DataViewItem parent, unsigned int pos) -> DataViewItem | [
"GetNthChild",
"(",
"self",
"DataViewItem",
"parent",
"unsigned",
"int",
"pos",
")",
"-",
">",
"DataViewItem"
] | def GetNthChild(*args, **kwargs):
"""GetNthChild(self, DataViewItem parent, unsigned int pos) -> DataViewItem"""
return _dataview.DataViewTreeStore_GetNthChild(*args, **kwargs) | [
"def",
"GetNthChild",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewTreeStore_GetNthChild",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/dataview.py#L2403-L2405 | |
doxygen/doxygen | c5d4b67565a5fadea5d84d28cfe86db605b4593f | addon/doxmlparser/doxmlparser/index.py | python | parseString | (inString, silence=False, print_warnings=True) | return rootObj | Parse a string, create the object tree, and export it.
Arguments:
- inString -- A string. This XML fragment should not start
with an XML declaration containing an encoding.
- silence -- A boolean. If False, export the object.
Returns -- The root object in the tree. | Parse a string, create the object tree, and export it. | [
"Parse",
"a",
"string",
"create",
"the",
"object",
"tree",
"and",
"export",
"it",
"."
] | def parseString(inString, silence=False, print_warnings=True):
'''Parse a string, create the object tree, and export it.
Arguments:
- inString -- A string. This XML fragment should not start
with an XML declaration containing an encoding.
- silence -- A boolean. If False, export the object.
... | [
"def",
"parseString",
"(",
"inString",
",",
"silence",
"=",
"False",
",",
"print_warnings",
"=",
"True",
")",
":",
"parser",
"=",
"None",
"rootNode",
"=",
"parsexmlstring_",
"(",
"inString",
",",
"parser",
")",
"gds_collector",
"=",
"GdsCollector_",
"(",
")"... | https://github.com/doxygen/doxygen/blob/c5d4b67565a5fadea5d84d28cfe86db605b4593f/addon/doxmlparser/doxmlparser/index.py#L1531-L1563 | |
tkn-tub/ns3-gym | 19bfe0a583e641142609939a090a09dfc63a095f | waf-tools/misc.py | python | apply_cmd | (self) | call a command every time | call a command every time | [
"call",
"a",
"command",
"every",
"time"
] | def apply_cmd(self):
"call a command every time"
if not self.fun: raise Errors.WafError('cmdobj needs a function!')
tsk = Task.TaskBase()
tsk.fun = self.fun
tsk.env = self.env
self.tasks.append(tsk)
tsk.install_path = self.install_path | [
"def",
"apply_cmd",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"fun",
":",
"raise",
"Errors",
".",
"WafError",
"(",
"'cmdobj needs a function!'",
")",
"tsk",
"=",
"Task",
".",
"TaskBase",
"(",
")",
"tsk",
".",
"fun",
"=",
"self",
".",
"fun",
"t... | https://github.com/tkn-tub/ns3-gym/blob/19bfe0a583e641142609939a090a09dfc63a095f/waf-tools/misc.py#L47-L54 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | build/plugins/lib/nots/package_manager/pnpm/lockfile.py | python | PnpmLockfile.merge | (self, lf) | Merges two lockfiles:
1. Converts the lockfile to monorepo-like lockfile with "importers" section instead of "dependencies" and "specifiers".
2. Merges `lf`'s dependencies and specifiers to importers.
3. Merges `lf`'s packages to the lockfile.
:param lf: lockfile to merge
:type l... | Merges two lockfiles:
1. Converts the lockfile to monorepo-like lockfile with "importers" section instead of "dependencies" and "specifiers".
2. Merges `lf`'s dependencies and specifiers to importers.
3. Merges `lf`'s packages to the lockfile.
:param lf: lockfile to merge
:type l... | [
"Merges",
"two",
"lockfiles",
":",
"1",
".",
"Converts",
"the",
"lockfile",
"to",
"monorepo",
"-",
"like",
"lockfile",
"with",
"importers",
"section",
"instead",
"of",
"dependencies",
"and",
"specifiers",
".",
"2",
".",
"Merges",
"lf",
"s",
"dependencies",
"... | def merge(self, lf):
"""
Merges two lockfiles:
1. Converts the lockfile to monorepo-like lockfile with "importers" section instead of "dependencies" and "specifiers".
2. Merges `lf`'s dependencies and specifiers to importers.
3. Merges `lf`'s packages to the lockfile.
:pa... | [
"def",
"merge",
"(",
"self",
",",
"lf",
")",
":",
"importers",
"=",
"self",
".",
"get_importers",
"(",
")",
"build_path",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"self",
".",
"path",
")",
"for",
"[",
"importer",
",",
"imports",
"]",
"in",
"ite... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/build/plugins/lib/nots/package_manager/pnpm/lockfile.py#L63-L89 | ||
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | Match | (pattern, s) | return _regexp_compile_cache[pattern].match(s) | Matches the string with the pattern, caching the compiled regexp. | Matches the string with the pattern, caching the compiled regexp. | [
"Matches",
"the",
"string",
"with",
"the",
"pattern",
"caching",
"the",
"compiled",
"regexp",
"."
] | def Match(pattern, s):
"""Matches the string with the pattern, caching the compiled regexp."""
# The regexp compilation caching is inlined in both Match and Search for
# performance reasons; factoring it out into a separate function turns out
# to be noticeably expensive.
if not pattern in _regexp_compile_cac... | [
"def",
"Match",
"(",
"pattern",
",",
"s",
")",
":",
"# The regexp compilation caching is inlined in both Match and Search for",
"# performance reasons; factoring it out into a separate function turns out",
"# to be noticeably expensive.",
"if",
"not",
"pattern",
"in",
"_regexp_compile_... | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L409-L416 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/idlelib/configdialog.py | python | KeysPage.get_new_keys | (self) | Handle event to change key binding for selected line.
A selection of a key/binding in the list of current
bindings pops up a dialog to enter a new binding. If
the current key set is builtin and a binding has
changed, then a name for a custom key set needs to be
entered for the ... | Handle event to change key binding for selected line. | [
"Handle",
"event",
"to",
"change",
"key",
"binding",
"for",
"selected",
"line",
"."
] | def get_new_keys(self):
"""Handle event to change key binding for selected line.
A selection of a key/binding in the list of current
bindings pops up a dialog to enter a new binding. If
the current key set is builtin and a binding has
changed, then a name for a custom key set n... | [
"def",
"get_new_keys",
"(",
"self",
")",
":",
"list_index",
"=",
"self",
".",
"bindingslist",
".",
"index",
"(",
"ANCHOR",
")",
"binding",
"=",
"self",
".",
"bindingslist",
".",
"get",
"(",
"list_index",
")",
"bind_name",
"=",
"binding",
".",
"split",
"(... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/idlelib/configdialog.py#L1604-L1646 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/core/fromnumeric.py | python | any | (a, axis=None, out=None, keepdims=np._NoValue) | return _wrapreduction(a, np.logical_or, 'any', axis, None, out, keepdims=keepdims) | Test whether any array element along a given axis evaluates to True.
Returns single boolean unless `axis` is not ``None``
Parameters
----------
a : array_like
Input array or object that can be converted to an array.
axis : None or int or tuple of ints, optional
Axis or axes along w... | Test whether any array element along a given axis evaluates to True. | [
"Test",
"whether",
"any",
"array",
"element",
"along",
"a",
"given",
"axis",
"evaluates",
"to",
"True",
"."
] | def any(a, axis=None, out=None, keepdims=np._NoValue):
"""
Test whether any array element along a given axis evaluates to True.
Returns single boolean unless `axis` is not ``None``
Parameters
----------
a : array_like
Input array or object that can be converted to an array.
axis : ... | [
"def",
"any",
"(",
"a",
",",
"axis",
"=",
"None",
",",
"out",
"=",
"None",
",",
"keepdims",
"=",
"np",
".",
"_NoValue",
")",
":",
"return",
"_wrapreduction",
"(",
"a",
",",
"np",
".",
"logical_or",
",",
"'any'",
",",
"axis",
",",
"None",
",",
"ou... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/core/fromnumeric.py#L2084-L2164 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/v7.9.317/third_party/jinja2/meta.py | python | find_undeclared_variables | (ast) | return codegen.undeclared_identifiers | Returns a set of all variables in the AST that will be looked up from
the context at runtime. Because at compile time it's not known which
variables will be used depending on the path the execution takes at
runtime, all variables are returned.
>>> from jinja2 import Environment, meta
>>> env = Env... | Returns a set of all variables in the AST that will be looked up from
the context at runtime. Because at compile time it's not known which
variables will be used depending on the path the execution takes at
runtime, all variables are returned. | [
"Returns",
"a",
"set",
"of",
"all",
"variables",
"in",
"the",
"AST",
"that",
"will",
"be",
"looked",
"up",
"from",
"the",
"context",
"at",
"runtime",
".",
"Because",
"at",
"compile",
"time",
"it",
"s",
"not",
"known",
"which",
"variables",
"will",
"be",
... | def find_undeclared_variables(ast):
"""Returns a set of all variables in the AST that will be looked up from
the context at runtime. Because at compile time it's not known which
variables will be used depending on the path the execution takes at
runtime, all variables are returned.
>>> from jinja2... | [
"def",
"find_undeclared_variables",
"(",
"ast",
")",
":",
"codegen",
"=",
"TrackingCodeGenerator",
"(",
"ast",
".",
"environment",
")",
"codegen",
".",
"visit",
"(",
"ast",
")",
"return",
"codegen",
".",
"undeclared_identifiers"
] | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/v7.9.317/third_party/jinja2/meta.py#L36-L57 | |
hfinkel/llvm-project-cxxjit | 91084ef018240bbb8e24235ff5cd8c355a9c1a1e | lldb/utils/lui/lldbutil.py | python | run_break_set_by_regexp | (
test,
regexp,
extra_options=None,
num_expected_locations=-1) | return get_bpno_from_match(break_results) | Set a breakpoint by regular expression match on symbol name. Common options are the same as run_break_set_by_file_and_line. | Set a breakpoint by regular expression match on symbol name. Common options are the same as run_break_set_by_file_and_line. | [
"Set",
"a",
"breakpoint",
"by",
"regular",
"expression",
"match",
"on",
"symbol",
"name",
".",
"Common",
"options",
"are",
"the",
"same",
"as",
"run_break_set_by_file_and_line",
"."
] | def run_break_set_by_regexp(
test,
regexp,
extra_options=None,
num_expected_locations=-1):
"""Set a breakpoint by regular expression match on symbol name. Common options are the same as run_break_set_by_file_and_line."""
command = 'breakpoint set -r "%s"' % (regexp)
if extr... | [
"def",
"run_break_set_by_regexp",
"(",
"test",
",",
"regexp",
",",
"extra_options",
"=",
"None",
",",
"num_expected_locations",
"=",
"-",
"1",
")",
":",
"command",
"=",
"'breakpoint set -r \"%s\"'",
"%",
"(",
"regexp",
")",
"if",
"extra_options",
":",
"command",... | https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/lldb/utils/lui/lldbutil.py#L436-L454 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/distutils/misc_util.py | python | get_mathlibs | (path=None) | return mathlibs | Return the MATHLIB line from numpyconfig.h | Return the MATHLIB line from numpyconfig.h | [
"Return",
"the",
"MATHLIB",
"line",
"from",
"numpyconfig",
".",
"h"
] | def get_mathlibs(path=None):
"""Return the MATHLIB line from numpyconfig.h
"""
if path is not None:
config_file = os.path.join(path, '_numpyconfig.h')
else:
# Look for the file in each of the numpy include directories.
dirs = get_numpy_include_dirs()
for path in dirs:
... | [
"def",
"get_mathlibs",
"(",
"path",
"=",
"None",
")",
":",
"if",
"path",
"is",
"not",
"None",
":",
"config_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"'_numpyconfig.h'",
")",
"else",
":",
"# Look for the file in each of the numpy include dir... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/distutils/misc_util.py#L204-L230 | |
baidu/Familia | 958febfd5fe7a61e46a35bfb084e71f806dde6a6 | python/familia_wrapper.py | python | TopicalWordEmbeddingsWrapper.nearest_words_around_topic | (self, topic_id, k = 10) | return familia.nearest_words_around_topic(self._twe, topic_id, k) | 寻求与目标主题最相关的词
对模型中的所有词语进行检索,通过计算cosine相似度,返回最相关的k个词语
Args:
topic_id: 目标主题ID
k: 设置返回最邻近词的个数,默认为10个
Returns:
返回一个list对象,长度为k,list中每个元素为tuple,包含了返回词以及该词与目标主题的cosine相关性,
并按照相关性从高到低排序。例如输入主题ID"356",返回前10个结果:
[(绿色,0.908283),
(低碳, ... | 寻求与目标主题最相关的词
对模型中的所有词语进行检索,通过计算cosine相似度,返回最相关的k个词语
Args:
topic_id: 目标主题ID
k: 设置返回最邻近词的个数,默认为10个
Returns:
返回一个list对象,长度为k,list中每个元素为tuple,包含了返回词以及该词与目标主题的cosine相关性,
并按照相关性从高到低排序。例如输入主题ID"356",返回前10个结果:
[(绿色,0.908283),
(低碳, ... | [
"寻求与目标主题最相关的词",
"对模型中的所有词语进行检索,通过计算cosine相似度,返回最相关的k个词语",
"Args",
":",
"topic_id",
":",
"目标主题ID",
"k",
":",
"设置返回最邻近词的个数,默认为10个",
"Returns",
":",
"返回一个list对象,长度为k,list中每个元素为tuple,包含了返回词以及该词与目标主题的cosine相关性,",
"并按照相关性从高到低排序。例如输入主题ID",
"356",
"返回前10个结果:",
"[",
"(",
"绿色,0",
".",
... | def nearest_words_around_topic(self, topic_id, k = 10):
"""寻求与目标主题最相关的词
对模型中的所有词语进行检索,通过计算cosine相似度,返回最相关的k个词语
Args:
topic_id: 目标主题ID
k: 设置返回最邻近词的个数,默认为10个
Returns:
返回一个list对象,长度为k,list中每个元素为tuple,包含了返回词以及该词与目标主题的cosine相关性,
并按照相关性从高到低排序。例如输... | [
"def",
"nearest_words_around_topic",
"(",
"self",
",",
"topic_id",
",",
"k",
"=",
"10",
")",
":",
"return",
"familia",
".",
"nearest_words_around_topic",
"(",
"self",
".",
"_twe",
",",
"topic_id",
",",
"k",
")"
] | https://github.com/baidu/Familia/blob/958febfd5fe7a61e46a35bfb084e71f806dde6a6/python/familia_wrapper.py#L220-L235 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/stc.py | python | StyledTextCtrl.SetAdditionalSelectionTyping | (*args, **kwargs) | return _stc.StyledTextCtrl_SetAdditionalSelectionTyping(*args, **kwargs) | SetAdditionalSelectionTyping(self, bool additionalSelectionTyping)
Set whether typing can be performed into multiple selections | SetAdditionalSelectionTyping(self, bool additionalSelectionTyping) | [
"SetAdditionalSelectionTyping",
"(",
"self",
"bool",
"additionalSelectionTyping",
")"
] | def SetAdditionalSelectionTyping(*args, **kwargs):
"""
SetAdditionalSelectionTyping(self, bool additionalSelectionTyping)
Set whether typing can be performed into multiple selections
"""
return _stc.StyledTextCtrl_SetAdditionalSelectionTyping(*args, **kwargs) | [
"def",
"SetAdditionalSelectionTyping",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_SetAdditionalSelectionTyping",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/stc.py#L6056-L6062 | |
freeorion/freeorion | c266a40eccd3a99a17de8fe57c36ef6ba3771665 | default/python/common/option_tools.py | python | get_sectioned_option_dict | () | return sectioned_options | Return options for AI
:return: ordered dict of ordered dicts of options | Return options for AI
:return: ordered dict of ordered dicts of options | [
"Return",
"options",
"for",
"AI",
":",
"return",
":",
"ordered",
"dict",
"of",
"ordered",
"dicts",
"of",
"options"
] | def get_sectioned_option_dict():
"""
Return options for AI
:return: ordered dict of ordered dicts of options
"""
return sectioned_options | [
"def",
"get_sectioned_option_dict",
"(",
")",
":",
"return",
"sectioned_options"
] | https://github.com/freeorion/freeorion/blob/c266a40eccd3a99a17de8fe57c36ef6ba3771665/default/python/common/option_tools.py#L91-L96 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/mapreduce/mapreduce/output_writers.py | python | OutputWriter.write | (self, data) | Write data.
Args:
data: actual data yielded from handler. Type is writer-specific. | Write data. | [
"Write",
"data",
"."
] | def write(self, data):
"""Write data.
Args:
data: actual data yielded from handler. Type is writer-specific.
"""
raise NotImplementedError("write() not implemented in %s" %
self.__class__) | [
"def",
"write",
"(",
"self",
",",
"data",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"write() not implemented in %s\"",
"%",
"self",
".",
"__class__",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/mapreduce/mapreduce/output_writers.py#L190-L197 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/op_def_library.py | python | _MaybeColocateWith | (inputs) | A context manager for (maybe) colocating with a list of input tensors.
Args:
inputs: A list of `Tensor` or `Operation` objects.
Returns:
A context manager. | A context manager for (maybe) colocating with a list of input tensors. | [
"A",
"context",
"manager",
"for",
"(",
"maybe",
")",
"colocating",
"with",
"a",
"list",
"of",
"input",
"tensors",
"."
] | def _MaybeColocateWith(inputs):
"""A context manager for (maybe) colocating with a list of input tensors.
Args:
inputs: A list of `Tensor` or `Operation` objects.
Returns:
A context manager.
"""
if not inputs:
yield
else:
# NOTE(mrry): The `ops.colocate_with()` function accepts only a sing... | [
"def",
"_MaybeColocateWith",
"(",
"inputs",
")",
":",
"if",
"not",
"inputs",
":",
"yield",
"else",
":",
"# NOTE(mrry): The `ops.colocate_with()` function accepts only a single",
"# op or tensor, so we create one context manager per element in the list.",
"with",
"ops",
".",
"colo... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/op_def_library.py#L266-L281 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/fsspec/spec.py | python | AbstractFileSystem.tail | (self, path, size=1024) | Get the last ``size`` bytes from file | Get the last ``size`` bytes from file | [
"Get",
"the",
"last",
"size",
"bytes",
"from",
"file"
] | def tail(self, path, size=1024):
""" Get the last ``size`` bytes from file """
with self.open(path, "rb") as f:
f.seek(max(-size, -f.size), 2)
return f.read() | [
"def",
"tail",
"(",
"self",
",",
"path",
",",
"size",
"=",
"1024",
")",
":",
"with",
"self",
".",
"open",
"(",
"path",
",",
"\"rb\"",
")",
"as",
"f",
":",
"f",
".",
"seek",
"(",
"max",
"(",
"-",
"size",
",",
"-",
"f",
".",
"size",
")",
",",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/fsspec/spec.py#L657-L661 | ||
tkn-tub/ns3-gym | 19bfe0a583e641142609939a090a09dfc63a095f | src/visualizer/visualizer/ipython_view.py | python | ConsoleView._changeLine | (self, text) | !
Replace currently entered command line with given text.
@param text: Text to use as replacement.
@return none | !
Replace currently entered command line with given text. | [
"!",
"Replace",
"currently",
"entered",
"command",
"line",
"with",
"given",
"text",
"."
] | def _changeLine(self, text):
"""!
Replace currently entered command line with given text.
@param text: Text to use as replacement.
@return none
"""
iter = self.text_buffer.get_iter_at_mark(self.line_start)
iter.forward_to_line_end()
self.text_buffer.delete(self.text_buffer.get_iter_... | [
"def",
"_changeLine",
"(",
"self",
",",
"text",
")",
":",
"iter",
"=",
"self",
".",
"text_buffer",
".",
"get_iter_at_mark",
"(",
"self",
".",
"line_start",
")",
"iter",
".",
"forward_to_line_end",
"(",
")",
"self",
".",
"text_buffer",
".",
"delete",
"(",
... | https://github.com/tkn-tub/ns3-gym/blob/19bfe0a583e641142609939a090a09dfc63a095f/src/visualizer/visualizer/ipython_view.py#L457-L467 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/lib/nanfunctions.py | python | nancumsum | (a, axis=None, dtype=None, out=None) | return np.cumsum(a, axis=axis, dtype=dtype, out=out) | Return the cumulative sum of array elements over a given axis treating Not a
Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are
encountered and leading NaNs are replaced by zeros.
Zeros are returned for slices that are all-NaN or empty.
.. versionadded:: 1.12.0
Parameters
... | Return the cumulative sum of array elements over a given axis treating Not a
Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are
encountered and leading NaNs are replaced by zeros. | [
"Return",
"the",
"cumulative",
"sum",
"of",
"array",
"elements",
"over",
"a",
"given",
"axis",
"treating",
"Not",
"a",
"Numbers",
"(",
"NaNs",
")",
"as",
"zero",
".",
"The",
"cumulative",
"sum",
"does",
"not",
"change",
"when",
"NaNs",
"are",
"encountered"... | def nancumsum(a, axis=None, dtype=None, out=None):
"""
Return the cumulative sum of array elements over a given axis treating Not a
Numbers (NaNs) as zero. The cumulative sum does not change when NaNs are
encountered and leading NaNs are replaced by zeros.
Zeros are returned for slices that are al... | [
"def",
"nancumsum",
"(",
"a",
",",
"axis",
"=",
"None",
",",
"dtype",
"=",
"None",
",",
"out",
"=",
"None",
")",
":",
"a",
",",
"mask",
"=",
"_replace_nan",
"(",
"a",
",",
"0",
")",
"return",
"np",
".",
"cumsum",
"(",
"a",
",",
"axis",
"=",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/lib/nanfunctions.py#L692-L754 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | Window.SetDimensions | (*args, **kwargs) | return _core_.Window_SetDimensions(*args, **kwargs) | SetDimensions(self, int x, int y, int width, int height, int sizeFlags=SIZE_AUTO)
Sets the position and size of the window in pixels. The sizeFlags
parameter indicates the interpretation of the other params if they are
equal to -1.
======================== =======================... | SetDimensions(self, int x, int y, int width, int height, int sizeFlags=SIZE_AUTO) | [
"SetDimensions",
"(",
"self",
"int",
"x",
"int",
"y",
"int",
"width",
"int",
"height",
"int",
"sizeFlags",
"=",
"SIZE_AUTO",
")"
] | def SetDimensions(*args, **kwargs):
"""
SetDimensions(self, int x, int y, int width, int height, int sizeFlags=SIZE_AUTO)
Sets the position and size of the window in pixels. The sizeFlags
parameter indicates the interpretation of the other params if they are
equal to -1.
... | [
"def",
"SetDimensions",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Window_SetDimensions",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L9336-L9355 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/ma/core.py | python | get_fill_value | (a) | return result | Return the filling value of a, if any. Otherwise, returns the
default filling value for that type. | Return the filling value of a, if any. Otherwise, returns the
default filling value for that type. | [
"Return",
"the",
"filling",
"value",
"of",
"a",
"if",
"any",
".",
"Otherwise",
"returns",
"the",
"default",
"filling",
"value",
"for",
"that",
"type",
"."
] | def get_fill_value(a):
"""
Return the filling value of a, if any. Otherwise, returns the
default filling value for that type.
"""
if isinstance(a, MaskedArray):
result = a.fill_value
else:
result = default_fill_value(a)
return result | [
"def",
"get_fill_value",
"(",
"a",
")",
":",
"if",
"isinstance",
"(",
"a",
",",
"MaskedArray",
")",
":",
"result",
"=",
"a",
".",
"fill_value",
"else",
":",
"result",
"=",
"default_fill_value",
"(",
"a",
")",
"return",
"result"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/ma/core.py#L549-L559 | |
vslavik/poedit | f7a9daa0a10037e090aa0a86f5ce0f24ececdf6a | deps/boost/libs/metaparse/tools/benchmark/generate.py | python | main | () | The main function of the script | The main function of the script | [
"The",
"main",
"function",
"of",
"the",
"script"
] | def main():
"""The main function of the script"""
desc = 'Generate files to benchmark'
parser = argparse.ArgumentParser(description=desc)
parser.add_argument(
'--src',
dest='src_dir',
default='src',
help='The directory containing the templates'
)
parser.add_argume... | [
"def",
"main",
"(",
")",
":",
"desc",
"=",
"'Generate files to benchmark'",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"desc",
")",
"parser",
".",
"add_argument",
"(",
"'--src'",
",",
"dest",
"=",
"'src_dir'",
",",
"default",
... | https://github.com/vslavik/poedit/blob/f7a9daa0a10037e090aa0a86f5ce0f24ececdf6a/deps/boost/libs/metaparse/tools/benchmark/generate.py#L238-L295 | ||
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py | python | _GenerateActionsForMSBuild | (spec, actions_to_add) | return actions_spec, sources_handled_by_action | Add actions accumulated into an actions_to_add, merging as needed.
Arguments:
spec: the target project dict
actions_to_add: dictionary keyed on input name, which maps to a list of
dicts describing the actions attached to that input file.
Returns:
A pair of (action specification, the sources ha... | Add actions accumulated into an actions_to_add, merging as needed. | [
"Add",
"actions",
"accumulated",
"into",
"an",
"actions_to_add",
"merging",
"as",
"needed",
"."
] | def _GenerateActionsForMSBuild(spec, actions_to_add):
"""Add actions accumulated into an actions_to_add, merging as needed.
Arguments:
spec: the target project dict
actions_to_add: dictionary keyed on input name, which maps to a list of
dicts describing the actions attached to that input file.
... | [
"def",
"_GenerateActionsForMSBuild",
"(",
"spec",
",",
"actions_to_add",
")",
":",
"sources_handled_by_action",
"=",
"OrderedSet",
"(",
")",
"actions_spec",
"=",
"[",
"]",
"for",
"primary_input",
",",
"actions",
"in",
"actions_to_add",
".",
"items",
"(",
")",
":... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py#L3884-L3946 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/gdb/mongo_lock.py | python | MongoDBShowLocks.invoke | (self, *_) | Invoke mongodb_show_locks. | Invoke mongodb_show_locks. | [
"Invoke",
"mongodb_show_locks",
"."
] | def invoke(self, *_):
"""Invoke mongodb_show_locks."""
self.mongodb_show_locks() | [
"def",
"invoke",
"(",
"self",
",",
"*",
"_",
")",
":",
"self",
".",
"mongodb_show_locks",
"(",
")"
] | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/gdb/mongo_lock.py#L392-L394 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/site_compare/drivers/win32/mouse.py | python | DoubleClickInWindow | (
hwnd, offset=None, button='left', click_time=0, time_between_clicks=0.1) | Simulate a user mouse double click in the center of a window.
Args:
hwnd: handle of the window to click in
offset: where to click, defaults to dead center
button: which button to click
click_time: duration of the clicks
time_between_clicks: length of time to pause between clicks
Returns:
N... | Simulate a user mouse double click in the center of a window. | [
"Simulate",
"a",
"user",
"mouse",
"double",
"click",
"in",
"the",
"center",
"of",
"a",
"window",
"."
] | def DoubleClickInWindow(
hwnd, offset=None, button='left', click_time=0, time_between_clicks=0.1):
"""Simulate a user mouse double click in the center of a window.
Args:
hwnd: handle of the window to click in
offset: where to click, defaults to dead center
button: which button to click
click_time... | [
"def",
"DoubleClickInWindow",
"(",
"hwnd",
",",
"offset",
"=",
"None",
",",
"button",
"=",
"'left'",
",",
"click_time",
"=",
"0",
",",
"time_between_clicks",
"=",
"0.1",
")",
":",
"ClickInWindow",
"(",
"hwnd",
",",
"offset",
",",
"button",
",",
"click_time... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/site_compare/drivers/win32/mouse.py#L174-L190 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/math/autodiff/pytorch.py | python | ad_to_torch | (func,terminals=None) | return ADModule(func,terminals) | Converts a Klamp't autodiff function call or function instance to a
PyTorch Function. If terminals is provided, this is the list of arguments
that PyTorch will expect. Otherwise, the variables in the expression
will be automatically determined by the forward traversal order. | Converts a Klamp't autodiff function call or function instance to a
PyTorch Function. If terminals is provided, this is the list of arguments
that PyTorch will expect. Otherwise, the variables in the expression
will be automatically determined by the forward traversal order. | [
"Converts",
"a",
"Klamp",
"t",
"autodiff",
"function",
"call",
"or",
"function",
"instance",
"to",
"a",
"PyTorch",
"Function",
".",
"If",
"terminals",
"is",
"provided",
"this",
"is",
"the",
"list",
"of",
"arguments",
"that",
"PyTorch",
"will",
"expect",
".",... | def ad_to_torch(func,terminals=None):
"""Converts a Klamp't autodiff function call or function instance to a
PyTorch Function. If terminals is provided, this is the list of arguments
that PyTorch will expect. Otherwise, the variables in the expression
will be automatically determined by the forward tr... | [
"def",
"ad_to_torch",
"(",
"func",
",",
"terminals",
"=",
"None",
")",
":",
"if",
"terminals",
"is",
"None",
":",
"if",
"isinstance",
"(",
"func",
",",
"ad",
".",
"ADFunctionCall",
")",
":",
"terminals",
"=",
"func",
".",
"terminals",
"(",
")",
"else",... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/math/autodiff/pytorch.py#L143-L172 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | RichTextBuffer.EndFont | (*args, **kwargs) | return _richtext.RichTextBuffer_EndFont(*args, **kwargs) | EndFont(self) -> bool | EndFont(self) -> bool | [
"EndFont",
"(",
"self",
")",
"-",
">",
"bool"
] | def EndFont(*args, **kwargs):
"""EndFont(self) -> bool"""
return _richtext.RichTextBuffer_EndFont(*args, **kwargs) | [
"def",
"EndFont",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextBuffer_EndFont",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L2369-L2371 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/common/battor/battor/battor_wrapper.py | python | BattorWrapper._GetBattorPath | (self, target_platform, android_device=None,
battor_path=None, battor_map_file=None, battor_map=None) | Determines most likely path to the correct BattOr. | Determines most likely path to the correct BattOr. | [
"Determines",
"most",
"likely",
"path",
"to",
"the",
"correct",
"BattOr",
"."
] | def _GetBattorPath(self, target_platform, android_device=None,
battor_path=None, battor_map_file=None, battor_map=None):
"""Determines most likely path to the correct BattOr."""
if target_platform not in self._SUPPORTED_PLATFORMS:
raise battor_error.BattorError(
'%s is an un... | [
"def",
"_GetBattorPath",
"(",
"self",
",",
"target_platform",
",",
"android_device",
"=",
"None",
",",
"battor_path",
"=",
"None",
",",
"battor_map_file",
"=",
"None",
",",
"battor_map",
"=",
"None",
")",
":",
"if",
"target_platform",
"not",
"in",
"self",
".... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/common/battor/battor/battor_wrapper.py#L174-L224 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/core/display.py | python | ProgressBar.__init__ | (self, total) | Creates a new progressbar
Parameters
----------
total : int
maximum size of the progressbar | Creates a new progressbar
Parameters
----------
total : int
maximum size of the progressbar | [
"Creates",
"a",
"new",
"progressbar",
"Parameters",
"----------",
"total",
":",
"int",
"maximum",
"size",
"of",
"the",
"progressbar"
] | def __init__(self, total):
"""Creates a new progressbar
Parameters
----------
total : int
maximum size of the progressbar
"""
self.total = total
self._progress = 0
self.html_width = '60ex'
self.text_width = 60
self._dis... | [
"def",
"__init__",
"(",
"self",
",",
"total",
")",
":",
"self",
".",
"total",
"=",
"total",
"self",
".",
"_progress",
"=",
"0",
"self",
".",
"html_width",
"=",
"'60ex'",
"self",
".",
"text_width",
"=",
"60",
"self",
".",
"_display_id",
"=",
"hexlify",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/core/display.py#L802-L814 | ||
derekmolloy/exploringBB | 6fb12690226cf76a2e262869782e026bd7c2c593 | chp05/pythonLED/pythonLED.py | python | writeLED | ( filename, value, path=LED3_PATH ) | return | This function writes the value passed to the file in the path | This function writes the value passed to the file in the path | [
"This",
"function",
"writes",
"the",
"value",
"passed",
"to",
"the",
"file",
"in",
"the",
"path"
] | def writeLED ( filename, value, path=LED3_PATH ):
"This function writes the value passed to the file in the path"
fo = open( path + filename,"w")
fo.write(value)
fo.close()
return | [
"def",
"writeLED",
"(",
"filename",
",",
"value",
",",
"path",
"=",
"LED3_PATH",
")",
":",
"fo",
"=",
"open",
"(",
"path",
"+",
"filename",
",",
"\"w\"",
")",
"fo",
".",
"write",
"(",
"value",
")",
"fo",
".",
"close",
"(",
")",
"return"
] | https://github.com/derekmolloy/exploringBB/blob/6fb12690226cf76a2e262869782e026bd7c2c593/chp05/pythonLED/pythonLED.py#L12-L17 | |
bigartm/bigartm | 47e37f982de87aa67bfd475ff1f39da696b181b3 | utils/cpplint.py | python | CheckBracesSpacing | (filename, clean_lines, linenum, error) | Checks for horizontal spacing near commas.
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. | Checks for horizontal spacing near commas. | [
"Checks",
"for",
"horizontal",
"spacing",
"near",
"commas",
"."
] | def CheckBracesSpacing(filename, clean_lines, linenum, error):
"""Checks for horizontal spacing near commas.
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... | [
"def",
"CheckBracesSpacing",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Except after an opening paren, or after another opening brace (in case of",
"# an initializer list, f... | https://github.com/bigartm/bigartm/blob/47e37f982de87aa67bfd475ff1f39da696b181b3/utils/cpplint.py#L3320-L3396 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/functions/Guinier.py | python | Guinier.functionDeriv1D | (self, xvals, jacobian) | Evaluate the first derivatives
@param xvals: numpy array of q-values
@param jacobian: Jacobian object | Evaluate the first derivatives | [
"Evaluate",
"the",
"first",
"derivatives"
] | def functionDeriv1D(self, xvals, jacobian):
"""
Evaluate the first derivatives
@param xvals: numpy array of q-values
@param jacobian: Jacobian object
"""
i = 0
rg = self.getParameterValue('Rg')
for x in xvals:
jacobian.set(i, 0, mat... | [
"def",
"functionDeriv1D",
"(",
"self",
",",
"xvals",
",",
"jacobian",
")",
":",
"i",
"=",
"0",
"rg",
"=",
"self",
".",
"getParameterValue",
"(",
"'Rg'",
")",
"for",
"x",
"in",
"xvals",
":",
"jacobian",
".",
"set",
"(",
"i",
",",
"0",
",",
"math",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/functions/Guinier.py#L39-L51 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/distributions/transformed_distribution.py | python | _logical_equal | (x, y) | return constant_op.constant(np.array_equal(x_, y_)) | Convenience function which attempts to statically compute `x == y`. | Convenience function which attempts to statically compute `x == y`. | [
"Convenience",
"function",
"which",
"attempts",
"to",
"statically",
"compute",
"x",
"==",
"y",
"."
] | def _logical_equal(x, y):
"""Convenience function which attempts to statically compute `x == y`."""
x_ = _static_value(x)
y_ = _static_value(y)
if x_ is None or y_ is None:
return math_ops.equal(x, y)
return constant_op.constant(np.array_equal(x_, y_)) | [
"def",
"_logical_equal",
"(",
"x",
",",
"y",
")",
":",
"x_",
"=",
"_static_value",
"(",
"x",
")",
"y_",
"=",
"_static_value",
"(",
"y",
")",
"if",
"x_",
"is",
"None",
"or",
"y_",
"is",
"None",
":",
"return",
"math_ops",
".",
"equal",
"(",
"x",
",... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/distributions/transformed_distribution.py#L58-L64 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py | python | Menu.add_cascade | (self, cnf={}, **kw) | Add hierarchical menu item. | Add hierarchical menu item. | [
"Add",
"hierarchical",
"menu",
"item",
"."
] | def add_cascade(self, cnf={}, **kw):
"""Add hierarchical menu item."""
self.add('cascade', cnf or kw) | [
"def",
"add_cascade",
"(",
"self",
",",
"cnf",
"=",
"{",
"}",
",",
"*",
"*",
"kw",
")",
":",
"self",
".",
"add",
"(",
"'cascade'",
",",
"cnf",
"or",
"kw",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py#L2675-L2677 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/nntplib.py | python | _NNTPBase._putcmd | (self, line) | Internal: send one command to the server (through _putline()).
The `line` must be a unicode string. | Internal: send one command to the server (through _putline()).
The `line` must be a unicode string. | [
"Internal",
":",
"send",
"one",
"command",
"to",
"the",
"server",
"(",
"through",
"_putline",
"()",
")",
".",
"The",
"line",
"must",
"be",
"a",
"unicode",
"string",
"."
] | def _putcmd(self, line):
"""Internal: send one command to the server (through _putline()).
The `line` must be a unicode string."""
if self.debugging: print('*cmd*', repr(line))
line = line.encode(self.encoding, self.errors)
self._putline(line) | [
"def",
"_putcmd",
"(",
"self",
",",
"line",
")",
":",
"if",
"self",
".",
"debugging",
":",
"print",
"(",
"'*cmd*'",
",",
"repr",
"(",
"line",
")",
")",
"line",
"=",
"line",
".",
"encode",
"(",
"self",
".",
"encoding",
",",
"self",
".",
"errors",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/nntplib.py#L421-L426 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Path/PathScripts/PathFeatureExtensions.py | python | Extension._makeCircularExtFace | (self, edge, extWire) | return extensionFace | _makeCircularExtensionFace(edge, extWire)...
Create proper circular extension face shape. Incoming edge is expected to be a circle. | _makeCircularExtensionFace(edge, extWire)...
Create proper circular extension face shape. Incoming edge is expected to be a circle. | [
"_makeCircularExtensionFace",
"(",
"edge",
"extWire",
")",
"...",
"Create",
"proper",
"circular",
"extension",
"face",
"shape",
".",
"Incoming",
"edge",
"is",
"expected",
"to",
"be",
"a",
"circle",
"."
] | def _makeCircularExtFace(self, edge, extWire):
"""_makeCircularExtensionFace(edge, extWire)...
Create proper circular extension face shape. Incoming edge is expected to be a circle.
"""
# Add original outer wire to cut faces if necessary
edgeFace = Part.Face(Part.Wire([edge]))
... | [
"def",
"_makeCircularExtFace",
"(",
"self",
",",
"edge",
",",
"extWire",
")",
":",
"# Add original outer wire to cut faces if necessary",
"edgeFace",
"=",
"Part",
".",
"Face",
"(",
"Part",
".",
"Wire",
"(",
"[",
"edge",
"]",
")",
")",
"edgeFace",
".",
"transla... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Path/PathScripts/PathFeatureExtensions.py#L488-L504 | |
glotzerlab/hoomd-blue | f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a | hoomd/logging.py | python | _LoggerQuantity.yield_names | (self, user_name=None) | Infinitely yield potential namespaces.
Used to ensure that all namespaces are unique for a
`hoomd.logging.Logger` object. We simple increment a number at the end
until the caller stops asking for another namespace.
Yields:
tuple[str]: A potential namespace for the object. | Infinitely yield potential namespaces. | [
"Infinitely",
"yield",
"potential",
"namespaces",
"."
] | def yield_names(self, user_name=None):
"""Infinitely yield potential namespaces.
Used to ensure that all namespaces are unique for a
`hoomd.logging.Logger` object. We simple increment a number at the end
until the caller stops asking for another namespace.
Yields:
t... | [
"def",
"yield_names",
"(",
"self",
",",
"user_name",
"=",
"None",
")",
":",
"if",
"user_name",
"is",
"None",
":",
"namespace",
"=",
"self",
".",
"namespace",
"else",
":",
"namespace",
"=",
"self",
".",
"namespace",
"[",
":",
"-",
"1",
"]",
"+",
"(",
... | https://github.com/glotzerlab/hoomd-blue/blob/f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a/hoomd/logging.py#L210-L226 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/locale.py | python | atoi | (string) | return int(delocalize(string)) | Converts a string to an integer according to the locale settings. | Converts a string to an integer according to the locale settings. | [
"Converts",
"a",
"string",
"to",
"an",
"integer",
"according",
"to",
"the",
"locale",
"settings",
"."
] | def atoi(string):
"Converts a string to an integer according to the locale settings."
return int(delocalize(string)) | [
"def",
"atoi",
"(",
"string",
")",
":",
"return",
"int",
"(",
"delocalize",
"(",
"string",
")",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/locale.py#L328-L330 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/losses/python/metric_learning/metric_loss_ops.py | python | compute_augmented_facility_locations | (pairwise_distances, labels, all_ids,
margin_multiplier, margin_type) | return chosen_ids | Computes the centroid locations.
Args:
pairwise_distances: 2-D Tensor of pairwise distances.
labels: 1-D Tensor of ground truth cluster assignment.
all_ids: 1-D Tensor of all data indices.
margin_multiplier: multiplication constant.
margin_type: Type of structured margin to use. Default is nmi.
... | Computes the centroid locations. | [
"Computes",
"the",
"centroid",
"locations",
"."
] | def compute_augmented_facility_locations(pairwise_distances, labels, all_ids,
margin_multiplier, margin_type):
"""Computes the centroid locations.
Args:
pairwise_distances: 2-D Tensor of pairwise distances.
labels: 1-D Tensor of ground truth cluster assignment.
... | [
"def",
"compute_augmented_facility_locations",
"(",
"pairwise_distances",
",",
"labels",
",",
"all_ids",
",",
"margin_multiplier",
",",
"margin_type",
")",
":",
"def",
"func_cond_augmented",
"(",
"iteration",
",",
"chosen_ids",
")",
":",
"del",
"chosen_ids",
"# Unused... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/losses/python/metric_learning/metric_loss_ops.py#L729-L771 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/distribute/input_lib.py | python | _get_batched_dataset | (d) | Get the batched dataset from `d`. | Get the batched dataset from `d`. | [
"Get",
"the",
"batched",
"dataset",
"from",
"d",
"."
] | def _get_batched_dataset(d):
"""Get the batched dataset from `d`."""
# pylint: disable=protected-access
if isinstance(d, dataset_ops.DatasetV1Adapter):
d = d._dataset
if isinstance(d, (dataset_ops.BatchDataset, batching._MapAndBatchDataset)):
return d
elif isinstance(d, (dataset_ops.PrefetchDataset,
... | [
"def",
"_get_batched_dataset",
"(",
"d",
")",
":",
"# pylint: disable=protected-access",
"if",
"isinstance",
"(",
"d",
",",
"dataset_ops",
".",
"DatasetV1Adapter",
")",
":",
"d",
"=",
"d",
".",
"_dataset",
"if",
"isinstance",
"(",
"d",
",",
"(",
"dataset_ops",... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/distribute/input_lib.py#L1843-L1858 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/PartDesign/WizardShaft/WizardShaftTable.py | python | WizardShaftTable.addColumn | (self) | Add a new column, fill it with widgets, and connect the signals | Add a new column, fill it with widgets, and connect the signals | [
"Add",
"a",
"new",
"column",
"fill",
"it",
"with",
"widgets",
"and",
"connect",
"the",
"signals"
] | def addColumn(self):
"Add a new column, fill it with widgets, and connect the signals"
index = self.widget.columnCount()
# Make an intelligent guess at the length/dia of the next segment
if index > 0:
length = self.shaft.segments[index-1].length
diameter = self.sh... | [
"def",
"addColumn",
"(",
"self",
")",
":",
"index",
"=",
"self",
".",
"widget",
".",
"columnCount",
"(",
")",
"# Make an intelligent guess at the length/dia of the next segment",
"if",
"index",
">",
"0",
":",
"length",
"=",
"self",
".",
"shaft",
".",
"segments",... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/PartDesign/WizardShaft/WizardShaftTable.py#L100-L195 | ||
intel/caffe | 3f494b442ee3f9d17a07b09ecbd5fa2bbda00836 | examples/rfcn/lib/pycocotools/cocoeval.py | python | COCOeval.accumulate | (self, p = None) | Accumulate per image evaluation results and store the result in self.eval
:param p: input params for evaluation
:return: None | Accumulate per image evaluation results and store the result in self.eval
:param p: input params for evaluation
:return: None | [
"Accumulate",
"per",
"image",
"evaluation",
"results",
"and",
"store",
"the",
"result",
"in",
"self",
".",
"eval",
":",
"param",
"p",
":",
"input",
"params",
"for",
"evaluation",
":",
"return",
":",
"None"
] | def accumulate(self, p = None):
'''
Accumulate per image evaluation results and store the result in self.eval
:param p: input params for evaluation
:return: None
'''
print 'Accumulating evaluation results... '
tic = time.time()
if not self.evalImgs:
... | [
"def",
"accumulate",
"(",
"self",
",",
"p",
"=",
"None",
")",
":",
"print",
"'Accumulating evaluation results... '",
"tic",
"=",
"time",
".",
"time",
"(",
")",
"if",
"not",
"self",
".",
"evalImgs",
":",
"print",
"'Please run evaluate() first'",
"# allows input... | https://github.com/intel/caffe/blob/3f494b442ee3f9d17a07b09ecbd5fa2bbda00836/examples/rfcn/lib/pycocotools/cocoeval.py#L274-L374 | ||
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/server/wsgi/serve/publish/publish_manager.py | python | PublishManager.__VerifyTargetPath | (self, t_path) | Verifies target path for validity.
Check if the reserved word is used in the path.
Args:
t_path: the path to verify.
Raises:
PublishServeException: in case the path is not valid. | Verifies target path for validity. | [
"Verifies",
"target",
"path",
"for",
"validity",
"."
] | def __VerifyTargetPath(self, t_path):
"""Verifies target path for validity.
Check if the reserved word is used in the path.
Args:
t_path: the path to verify.
Raises:
PublishServeException: in case the path is not valid.
"""
if not t_path:
return
assert t_path and (t_path[... | [
"def",
"__VerifyTargetPath",
"(",
"self",
",",
"t_path",
")",
":",
"if",
"not",
"t_path",
":",
"return",
"assert",
"t_path",
"and",
"(",
"t_path",
"[",
"0",
"]",
"==",
"\"/\"",
")",
"and",
"(",
"t_path",
"[",
"-",
"1",
"]",
"!=",
"\"/\"",
")",
"end... | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/server/wsgi/serve/publish/publish_manager.py#L799-L824 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | media/webrtc/trunk/build/mac/tweak_info_plist.py | python | _AddBreakpadKeys | (plist, branding) | Adds the Breakpad keys. This must be called AFTER _AddVersionKeys() and
also requires the |branding| argument. | Adds the Breakpad keys. This must be called AFTER _AddVersionKeys() and
also requires the |branding| argument. | [
"Adds",
"the",
"Breakpad",
"keys",
".",
"This",
"must",
"be",
"called",
"AFTER",
"_AddVersionKeys",
"()",
"and",
"also",
"requires",
"the",
"|branding|",
"argument",
"."
] | def _AddBreakpadKeys(plist, branding):
"""Adds the Breakpad keys. This must be called AFTER _AddVersionKeys() and
also requires the |branding| argument."""
plist['BreakpadReportInterval'] = '3600' # Deliberately a string.
plist['BreakpadProduct'] = '%s_Mac' % branding
plist['BreakpadProductDisplay'] = brandi... | [
"def",
"_AddBreakpadKeys",
"(",
"plist",
",",
"branding",
")",
":",
"plist",
"[",
"'BreakpadReportInterval'",
"]",
"=",
"'3600'",
"# Deliberately a string.",
"plist",
"[",
"'BreakpadProduct'",
"]",
"=",
"'%s_Mac'",
"%",
"branding",
"plist",
"[",
"'BreakpadProductDis... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/media/webrtc/trunk/build/mac/tweak_info_plist.py#L174-L183 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/contrib/mixed_precision/fp16_utils.py | python | cast_model_to_fp16 | (program, amp_lists=None, use_fp16_guard=True) | return to_fp16_var_names | Traverse all ops in the whole model and set their inputs and outputs
to the fp16 data type. This function will do some special process for
the batch normalization, which keeps the computational process of
batchnorms in FP32.
Args:
program (Program): The used program.
amp_lists (AutoMixed... | Traverse all ops in the whole model and set their inputs and outputs
to the fp16 data type. This function will do some special process for
the batch normalization, which keeps the computational process of
batchnorms in FP32.
Args:
program (Program): The used program.
amp_lists (AutoMixed... | [
"Traverse",
"all",
"ops",
"in",
"the",
"whole",
"model",
"and",
"set",
"their",
"inputs",
"and",
"outputs",
"to",
"the",
"fp16",
"data",
"type",
".",
"This",
"function",
"will",
"do",
"some",
"special",
"process",
"for",
"the",
"batch",
"normalization",
"w... | def cast_model_to_fp16(program, amp_lists=None, use_fp16_guard=True):
"""
Traverse all ops in the whole model and set their inputs and outputs
to the fp16 data type. This function will do some special process for
the batch normalization, which keeps the computational process of
batchnorms in FP32.
... | [
"def",
"cast_model_to_fp16",
"(",
"program",
",",
"amp_lists",
"=",
"None",
",",
"use_fp16_guard",
"=",
"True",
")",
":",
"if",
"amp_lists",
"is",
"None",
":",
"amp_lists",
"=",
"AutoMixedPrecisionLists",
"(",
")",
"global_block",
"=",
"program",
".",
"global_... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/contrib/mixed_precision/fp16_utils.py#L387-L515 | |
NVIDIA/MDL-SDK | aa9642b2546ad7b6236b5627385d882c2ed83c5d | src/mdl/jit/llvm/dist/utils/lit/lit/Util.py | python | to_bytes | (s) | return s.encode('utf-8') | Return the parameter as type 'bytes', possibly encoding it.
In Python2, the 'bytes' type is the same as 'str'. In Python3, they
are distinct. | Return the parameter as type 'bytes', possibly encoding it. | [
"Return",
"the",
"parameter",
"as",
"type",
"bytes",
"possibly",
"encoding",
"it",
"."
] | def to_bytes(s):
"""Return the parameter as type 'bytes', possibly encoding it.
In Python2, the 'bytes' type is the same as 'str'. In Python3, they
are distinct.
"""
if isinstance(s, bytes):
# In Python2, this branch is taken for both 'str' and 'bytes'.
# In Python3, this branch is... | [
"def",
"to_bytes",
"(",
"s",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"bytes",
")",
":",
"# In Python2, this branch is taken for both 'str' and 'bytes'.",
"# In Python3, this branch is taken only for 'bytes'.",
"return",
"s",
"# In Python2, 's' is a 'unicode' object.",
"# I... | https://github.com/NVIDIA/MDL-SDK/blob/aa9642b2546ad7b6236b5627385d882c2ed83c5d/src/mdl/jit/llvm/dist/utils/lit/lit/Util.py#L47-L61 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/bayesflow/python/ops/stochastic_graph.py | python | DistributionTensor.__init__ | (self,
dist_cls,
name=None,
dist_value_type=None,
loss_fn=score_function,
**dist_args) | Construct a `DistributionTensor`.
`DistributionTensor` will instantiate a distribution from `dist_cls` and
`dist_args` and its `value` method will return the same value each time
it is called. What `value` is returned is controlled by the
`dist_value_type` (defaults to `SampleAndReshapeValue`).
So... | Construct a `DistributionTensor`. | [
"Construct",
"a",
"DistributionTensor",
"."
] | def __init__(self,
dist_cls,
name=None,
dist_value_type=None,
loss_fn=score_function,
**dist_args):
"""Construct a `DistributionTensor`.
`DistributionTensor` will instantiate a distribution from `dist_cls` and
`dist_args` and its `v... | [
"def",
"__init__",
"(",
"self",
",",
"dist_cls",
",",
"name",
"=",
"None",
",",
"dist_value_type",
"=",
"None",
",",
"loss_fn",
"=",
"score_function",
",",
"*",
"*",
"dist_args",
")",
":",
"self",
".",
"_dist_cls",
"=",
"dist_cls",
"self",
".",
"_dist_ar... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/bayesflow/python/ops/stochastic_graph.py#L328-L389 | ||
google/mysql-protobuf | 467cda676afaa49e762c5c9164a43f6ad31a1fbf | protobuf/python/google/protobuf/descriptor.py | python | FileDescriptor.CopyToProto | (self, proto) | Copies this to a descriptor_pb2.FileDescriptorProto.
Args:
proto: An empty descriptor_pb2.FileDescriptorProto. | Copies this to a descriptor_pb2.FileDescriptorProto. | [
"Copies",
"this",
"to",
"a",
"descriptor_pb2",
".",
"FileDescriptorProto",
"."
] | def CopyToProto(self, proto):
"""Copies this to a descriptor_pb2.FileDescriptorProto.
Args:
proto: An empty descriptor_pb2.FileDescriptorProto.
"""
proto.ParseFromString(self.serialized_pb) | [
"def",
"CopyToProto",
"(",
"self",
",",
"proto",
")",
":",
"proto",
".",
"ParseFromString",
"(",
"self",
".",
"serialized_pb",
")"
] | https://github.com/google/mysql-protobuf/blob/467cda676afaa49e762c5c9164a43f6ad31a1fbf/protobuf/python/google/protobuf/descriptor.py#L807-L813 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/ipc_messages_log.py | python | _ReadLines | (f) | Read from file f and generate right-stripped lines. | Read from file f and generate right-stripped lines. | [
"Read",
"from",
"file",
"f",
"and",
"generate",
"right",
"-",
"stripped",
"lines",
"."
] | def _ReadLines(f):
"""Read from file f and generate right-stripped lines."""
for line in f:
yield line.rstrip() | [
"def",
"_ReadLines",
"(",
"f",
")",
":",
"for",
"line",
"in",
"f",
":",
"yield",
"line",
".",
"rstrip",
"(",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/ipc_messages_log.py#L34-L37 | ||
wesnoth/wesnoth | 6ccac5a5e8ff75303c9190c0da60580925cb32c0 | data/tools/wesnoth/campaignserver_client.py | python | CampaignClient.send_packet | (self, packet) | Send binary data to the server. | Send binary data to the server. | [
"Send",
"binary",
"data",
"to",
"the",
"server",
"."
] | def send_packet(self, packet):
"""
Send binary data to the server.
"""
# Compress the packet before we send it
fio = io.BytesIO()
z = gzip.GzipFile(mode = "wb", fileobj = fio)
z.write(packet)
z.close()
zdata = fio.getvalue()
zpacket = stru... | [
"def",
"send_packet",
"(",
"self",
",",
"packet",
")",
":",
"# Compress the packet before we send it",
"fio",
"=",
"io",
".",
"BytesIO",
"(",
")",
"z",
"=",
"gzip",
".",
"GzipFile",
"(",
"mode",
"=",
"\"wb\"",
",",
"fileobj",
"=",
"fio",
")",
"z",
".",
... | https://github.com/wesnoth/wesnoth/blob/6ccac5a5e8ff75303c9190c0da60580925cb32c0/data/tools/wesnoth/campaignserver_client.py#L129-L141 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBBreakpoint.AddLocation | (self, address) | return _lldb.SBBreakpoint_AddLocation(self, address) | AddLocation(SBBreakpoint self, SBAddress address) -> SBError | AddLocation(SBBreakpoint self, SBAddress address) -> SBError | [
"AddLocation",
"(",
"SBBreakpoint",
"self",
"SBAddress",
"address",
")",
"-",
">",
"SBError"
] | def AddLocation(self, address):
"""AddLocation(SBBreakpoint self, SBAddress address) -> SBError"""
return _lldb.SBBreakpoint_AddLocation(self, address) | [
"def",
"AddLocation",
"(",
"self",
",",
"address",
")",
":",
"return",
"_lldb",
".",
"SBBreakpoint_AddLocation",
"(",
"self",
",",
"address",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L1751-L1753 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/android/loading/request_track.py | python | _ParseStringToInt | (string) | return 0 | Parses a string to an integer like base::StringToInt64().
Returns:
Parsed integer. | Parses a string to an integer like base::StringToInt64(). | [
"Parses",
"a",
"string",
"to",
"an",
"integer",
"like",
"base",
"::",
"StringToInt64",
"()",
"."
] | def _ParseStringToInt(string):
"""Parses a string to an integer like base::StringToInt64().
Returns:
Parsed integer.
"""
string = string.strip()
while string:
try:
parsed_integer = int(string)
if parsed_integer > sys.maxint:
return sys.maxint
if parsed_integer < -sys.maxint ... | [
"def",
"_ParseStringToInt",
"(",
"string",
")",
":",
"string",
"=",
"string",
".",
"strip",
"(",
")",
"while",
"string",
":",
"try",
":",
"parsed_integer",
"=",
"int",
"(",
"string",
")",
"if",
"parsed_integer",
">",
"sys",
".",
"maxint",
":",
"return",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/android/loading/request_track.py#L406-L423 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/botocore/utils.py | python | S3RegionRedirector.redirect_from_error | (self, request_dict, response, operation, **kwargs) | return 0 | An S3 request sent to the wrong region will return an error that
contains the endpoint the request should be sent to. This handler
will add the redirect information to the signing context and then
redirect the request. | An S3 request sent to the wrong region will return an error that
contains the endpoint the request should be sent to. This handler
will add the redirect information to the signing context and then
redirect the request. | [
"An",
"S3",
"request",
"sent",
"to",
"the",
"wrong",
"region",
"will",
"return",
"an",
"error",
"that",
"contains",
"the",
"endpoint",
"the",
"request",
"should",
"be",
"sent",
"to",
".",
"This",
"handler",
"will",
"add",
"the",
"redirect",
"information",
... | def redirect_from_error(self, request_dict, response, operation, **kwargs):
"""
An S3 request sent to the wrong region will return an error that
contains the endpoint the request should be sent to. This handler
will add the redirect information to the signing context and then
red... | [
"def",
"redirect_from_error",
"(",
"self",
",",
"request_dict",
",",
"response",
",",
"operation",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"response",
"is",
"None",
":",
"# This could be none if there was a ConnectionError or other",
"# transport error.",
"return",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/botocore/utils.py#L1157-L1241 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/math/autodiff/kinematics_ad.py | python | KinematicsBuilder.world_position | (self,link,localPos=None) | return se3_ad.apply(self.link_transforms[link],localPos) | Returns an autodiff expression for the world position of the point
localPos on the given link. If localPos isn't given, the link origin's
position is returned. | Returns an autodiff expression for the world position of the point
localPos on the given link. If localPos isn't given, the link origin's
position is returned. | [
"Returns",
"an",
"autodiff",
"expression",
"for",
"the",
"world",
"position",
"of",
"the",
"point",
"localPos",
"on",
"the",
"given",
"link",
".",
"If",
"localPos",
"isn",
"t",
"given",
"the",
"link",
"origin",
"s",
"position",
"is",
"returned",
"."
] | def world_position(self,link,localPos=None):
"""Returns an autodiff expression for the world position of the point
localPos on the given link. If localPos isn't given, the link origin's
position is returned.
"""
link = self._link_index(link)
if localPos is None:
... | [
"def",
"world_position",
"(",
"self",
",",
"link",
",",
"localPos",
"=",
"None",
")",
":",
"link",
"=",
"self",
".",
"_link_index",
"(",
"link",
")",
"if",
"localPos",
"is",
"None",
":",
"return",
"self",
".",
"link_positions",
"[",
"link",
"]",
"retur... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/math/autodiff/kinematics_ad.py#L515-L523 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/kvstore/kvstore_server.py | python | KVStoreServer.__init__ | (self, kvstore) | Initialize a new KVStoreServer.
Parameters
----------
kvstore : KVStore | Initialize a new KVStoreServer. | [
"Initialize",
"a",
"new",
"KVStoreServer",
"."
] | def __init__(self, kvstore):
"""Initialize a new KVStoreServer.
Parameters
----------
kvstore : KVStore
"""
self.kvstore = kvstore
self.handle = kvstore.handle
self.init_logginig = False | [
"def",
"__init__",
"(",
"self",
",",
"kvstore",
")",
":",
"self",
".",
"kvstore",
"=",
"kvstore",
"self",
".",
"handle",
"=",
"kvstore",
".",
"handle",
"self",
".",
"init_logginig",
"=",
"False"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/kvstore/kvstore_server.py#L31-L40 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | samples/pySketch/pySketch.py | python | ScribbleDrawingObject.getData | (self) | return data | Return a copy of the object's internal data.
This is used to save this DrawingObject to disk. | Return a copy of the object's internal data. | [
"Return",
"a",
"copy",
"of",
"the",
"object",
"s",
"internal",
"data",
"."
] | def getData(self):
""" Return a copy of the object's internal data.
This is used to save this DrawingObject to disk.
"""
# get the basics
data = DrawingObject.getData(self)
# add our specifics
data += [list(self.points)]
return data | [
"def",
"getData",
"(",
"self",
")",
":",
"# get the basics",
"data",
"=",
"DrawingObject",
".",
"getData",
"(",
"self",
")",
"# add our specifics",
"data",
"+=",
"[",
"list",
"(",
"self",
".",
"points",
")",
"]",
"return",
"data"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/samples/pySketch/pySketch.py#L2844-L2854 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/idl_parser/idl_parser.py | python | IDLParser.p_null | (self, p) | null : NULL | null : NULL | [
"null",
":",
"NULL"
] | def p_null(self, p):
"""null : NULL"""
p[0] = ListFromConcat(self.BuildAttribute('TYPE', 'NULL'),
self.BuildAttribute('NAME', 'NULL')) | [
"def",
"p_null",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"ListFromConcat",
"(",
"self",
".",
"BuildAttribute",
"(",
"'TYPE'",
",",
"'NULL'",
")",
",",
"self",
".",
"BuildAttribute",
"(",
"'NAME'",
",",
"'NULL'",
")",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/idl_parser/idl_parser.py#L457-L460 | ||
kushview/Element | 1cc16380caa2ab79461246ba758b9de1f46db2a5 | waflib/Utils.py | python | listdir_win32 | (s) | return os.listdir(s) | Lists the contents of a folder in a portable manner.
On Win32, returns the list of drive letters: ['C:', 'X:', 'Z:'] when an empty string is given.
:type s: string
:param s: a string, which can be empty on Windows | Lists the contents of a folder in a portable manner.
On Win32, returns the list of drive letters: ['C:', 'X:', 'Z:'] when an empty string is given. | [
"Lists",
"the",
"contents",
"of",
"a",
"folder",
"in",
"a",
"portable",
"manner",
".",
"On",
"Win32",
"returns",
"the",
"list",
"of",
"drive",
"letters",
":",
"[",
"C",
":",
"X",
":",
"Z",
":",
"]",
"when",
"an",
"empty",
"string",
"is",
"given",
"... | def listdir_win32(s):
"""
Lists the contents of a folder in a portable manner.
On Win32, returns the list of drive letters: ['C:', 'X:', 'Z:'] when an empty string is given.
:type s: string
:param s: a string, which can be empty on Windows
"""
if not s:
try:
import ctypes
except ImportError:
# there i... | [
"def",
"listdir_win32",
"(",
"s",
")",
":",
"if",
"not",
"s",
":",
"try",
":",
"import",
"ctypes",
"except",
"ImportError",
":",
"# there is nothing much we can do",
"return",
"[",
"x",
"+",
"':\\\\'",
"for",
"x",
"in",
"'ABCDEFGHIJKLMNOPQRSTUVWXYZ'",
"]",
"el... | https://github.com/kushview/Element/blob/1cc16380caa2ab79461246ba758b9de1f46db2a5/waflib/Utils.py#L372-L400 | |
mongodb/mongo-cxx-driver | eb86512b05be20d2f51d53ba9b860c709e0799b3 | etc/clang_format.py | python | ClangFormat.lint | (self, file_name) | return self._lint(file_name, print_diff=True) | Check the specified file has the correct format | Check the specified file has the correct format | [
"Check",
"the",
"specified",
"file",
"has",
"the",
"correct",
"format"
] | def lint(self, file_name):
"""Check the specified file has the correct format
"""
return self._lint(file_name, print_diff=True) | [
"def",
"lint",
"(",
"self",
",",
"file_name",
")",
":",
"return",
"self",
".",
"_lint",
"(",
"file_name",
",",
"print_diff",
"=",
"True",
")"
] | https://github.com/mongodb/mongo-cxx-driver/blob/eb86512b05be20d2f51d53ba9b860c709e0799b3/etc/clang_format.py#L310-L313 | |
google/usd_from_gltf | 6d288cce8b68744494a226574ae1d7ba6a9c46eb | tools/ufgbatch/ufgcommon/util.py | python | norm_abspath | (path) | return norm_slashes(os.path.normpath(os.path.abspath(path))) | Get a normalized absolute path, using forward-slashes. | Get a normalized absolute path, using forward-slashes. | [
"Get",
"a",
"normalized",
"absolute",
"path",
"using",
"forward",
"-",
"slashes",
"."
] | def norm_abspath(path):
"""Get a normalized absolute path, using forward-slashes."""
return norm_slashes(os.path.normpath(os.path.abspath(path))) | [
"def",
"norm_abspath",
"(",
"path",
")",
":",
"return",
"norm_slashes",
"(",
"os",
".",
"path",
".",
"normpath",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"path",
")",
")",
")"
] | https://github.com/google/usd_from_gltf/blob/6d288cce8b68744494a226574ae1d7ba6a9c46eb/tools/ufgbatch/ufgcommon/util.py#L100-L102 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.