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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/factorization/python/ops/factorization_ops.py | python | WALSModel.col_weights | (self) | return self._col_weights | Returns a list of tensors corresponding to col weight shards. | Returns a list of tensors corresponding to col weight shards. | [
"Returns",
"a",
"list",
"of",
"tensors",
"corresponding",
"to",
"col",
"weight",
"shards",
"."
] | def col_weights(self):
"""Returns a list of tensors corresponding to col weight shards."""
return self._col_weights | [
"def",
"col_weights",
"(",
"self",
")",
":",
"return",
"self",
".",
"_col_weights"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/factorization/python/ops/factorization_ops.py#L314-L316 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/utils/tensorboard/writer.py | python | SummaryWriter.add_scalars | (self, main_tag, tag_scalar_dict, global_step=None, walltime=None) | Adds many scalar data to summary.
Args:
main_tag (string): The parent name for the tags
tag_scalar_dict (dict): Key-value pair storing the tag and corresponding values
global_step (int): Global step value to record
walltime (float): Optional override default wall... | Adds many scalar data to summary. | [
"Adds",
"many",
"scalar",
"data",
"to",
"summary",
"."
] | def add_scalars(self, main_tag, tag_scalar_dict, global_step=None, walltime=None):
"""Adds many scalar data to summary.
Args:
main_tag (string): The parent name for the tags
tag_scalar_dict (dict): Key-value pair storing the tag and corresponding values
global_step (... | [
"def",
"add_scalars",
"(",
"self",
",",
"main_tag",
",",
"tag_scalar_dict",
",",
"global_step",
"=",
"None",
",",
"walltime",
"=",
"None",
")",
":",
"torch",
".",
"_C",
".",
"_log_api_usage_once",
"(",
"\"tensorboard.logging.add_scalars\"",
")",
"walltime",
"=",... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/utils/tensorboard/writer.py#L359-L404 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/attr/_make.py | python | _ClassBuilder._add_method_dunders | (self, method) | return method | Add __module__ and __qualname__ to a *method* if possible. | Add __module__ and __qualname__ to a *method* if possible. | [
"Add",
"__module__",
"and",
"__qualname__",
"to",
"a",
"*",
"method",
"*",
"if",
"possible",
"."
] | def _add_method_dunders(self, method):
"""
Add __module__ and __qualname__ to a *method* if possible.
"""
try:
method.__module__ = self._cls.__module__
except AttributeError:
pass
try:
method.__qualname__ = ".".join(
(s... | [
"def",
"_add_method_dunders",
"(",
"self",
",",
"method",
")",
":",
"try",
":",
"method",
".",
"__module__",
"=",
"self",
".",
"_cls",
".",
"__module__",
"except",
"AttributeError",
":",
"pass",
"try",
":",
"method",
".",
"__qualname__",
"=",
"\".\"",
".",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/attr/_make.py#L715-L731 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | remoting/host/installer/build-installer-archive.py | python | copyZipIntoArchive | (out_dir, files_root, zip_file) | Expands the zip_file into the out_dir, preserving the directory structure.
Args:
out_dir: Target directory where unzipped files are copied.
files_root: Path prefix which is stripped of zip_file before appending
it to the out_dir.
zip_file: Relative path (and filename) to the zip file. | Expands the zip_file into the out_dir, preserving the directory structure. | [
"Expands",
"the",
"zip_file",
"into",
"the",
"out_dir",
"preserving",
"the",
"directory",
"structure",
"."
] | def copyZipIntoArchive(out_dir, files_root, zip_file):
"""Expands the zip_file into the out_dir, preserving the directory structure.
Args:
out_dir: Target directory where unzipped files are copied.
files_root: Path prefix which is stripped of zip_file before appending
it to the out_dir.
... | [
"def",
"copyZipIntoArchive",
"(",
"out_dir",
",",
"files_root",
",",
"zip_file",
")",
":",
"base_zip_name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"zip_file",
")",
"# We don't use the 'zipfile' module here because it doesn't restore all the",
"# file permissions corr... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/remoting/host/installer/build-installer-archive.py#L144-L168 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/ops/variables.py | python | initialize_all_variables | () | return initialize_variables(all_variables()) | Returns an Op that initializes all variables.
This is just a shortcut for `initialize_variables(all_variables())`
Returns:
An Op that initializes all variables in the graph. | Returns an Op that initializes all variables. | [
"Returns",
"an",
"Op",
"that",
"initializes",
"all",
"variables",
"."
] | def initialize_all_variables():
"""Returns an Op that initializes all variables.
This is just a shortcut for `initialize_variables(all_variables())`
Returns:
An Op that initializes all variables in the graph.
"""
return initialize_variables(all_variables()) | [
"def",
"initialize_all_variables",
"(",
")",
":",
"return",
"initialize_variables",
"(",
"all_variables",
"(",
")",
")"
] | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/variables.py#L933-L941 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/debug/lib/dumping_callback.py | python | _DumpingCallback._instrument_symbolic_tensors | (self,
tensors,
op_type,
op_name,
tfdbg_context_id,
tensor_ids) | return instrumented_tensors | Add debugging instrumentation for symbolic (i.e., non-eager) tensors.
The detailed fashion in which the tensors are instrumented is determined
by the tensor_debug_mode configured for the currently enabled dumping
callback.
Args:
tensors: A tuple of Tensors to instrument. It is assumed that their... | Add debugging instrumentation for symbolic (i.e., non-eager) tensors. | [
"Add",
"debugging",
"instrumentation",
"for",
"symbolic",
"(",
"i",
".",
"e",
".",
"non",
"-",
"eager",
")",
"tensors",
"."
] | def _instrument_symbolic_tensors(self,
tensors,
op_type,
op_name,
tfdbg_context_id,
tensor_ids):
"""Add debugging instrumentation for symboli... | [
"def",
"_instrument_symbolic_tensors",
"(",
"self",
",",
"tensors",
",",
"op_type",
",",
"op_name",
",",
"tfdbg_context_id",
",",
"tensor_ids",
")",
":",
"tensor_debug_mode",
"=",
"self",
".",
"_tensor_debug_mode",
"debug_urls",
"=",
"[",
"\"file://%s\"",
"%",
"se... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/debug/lib/dumping_callback.py#L328-L443 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py | python | MsvsSettings._HasExplicitIdlActions | (self, spec) | return any([action.get('explicit_idl_action', 0)
for action in spec.get('actions', [])]) | Determine if an action should not run midl for .idl files. | Determine if an action should not run midl for .idl files. | [
"Determine",
"if",
"an",
"action",
"should",
"not",
"run",
"midl",
"for",
".",
"idl",
"files",
"."
] | def _HasExplicitIdlActions(self, spec):
"""Determine if an action should not run midl for .idl files."""
return any([action.get('explicit_idl_action', 0)
for action in spec.get('actions', [])]) | [
"def",
"_HasExplicitIdlActions",
"(",
"self",
",",
"spec",
")",
":",
"return",
"any",
"(",
"[",
"action",
".",
"get",
"(",
"'explicit_idl_action'",
",",
"0",
")",
"for",
"action",
"in",
"spec",
".",
"get",
"(",
"'actions'",
",",
"[",
"]",
")",
"]",
"... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py#L824-L827 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/idlelib/tooltip.py | python | OnHoverTooltipBase._hide_event | (self, event=None) | event handler to hide the tooltip | event handler to hide the tooltip | [
"event",
"handler",
"to",
"hide",
"the",
"tooltip"
] | def _hide_event(self, event=None):
"""event handler to hide the tooltip"""
self.hidetip() | [
"def",
"_hide_event",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"self",
".",
"hidetip",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/idlelib/tooltip.py#L119-L121 | ||
pyne/pyne | 0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3 | pyne/dbgen/scattering_lengths.py | python | make_scattering_lengths | (args) | Controller function for adding scattering lengths. | Controller function for adding scattering lengths. | [
"Controller",
"function",
"for",
"adding",
"scattering",
"lengths",
"."
] | def make_scattering_lengths(args):
"""Controller function for adding scattering lengths."""
nuc_data, build_dir = args.nuc_data, args.build_dir
# Check that the table exists
with tb.open_file(nuc_data, 'a', filters=BASIC_FILTERS) as f:
if hasattr(f.root, 'neutron') and hasattr(f.root.neutron, '... | [
"def",
"make_scattering_lengths",
"(",
"args",
")",
":",
"nuc_data",
",",
"build_dir",
"=",
"args",
".",
"nuc_data",
",",
"args",
".",
"build_dir",
"# Check that the table exists",
"with",
"tb",
".",
"open_file",
"(",
"nuc_data",
",",
"'a'",
",",
"filters",
"=... | https://github.com/pyne/pyne/blob/0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3/pyne/dbgen/scattering_lengths.py#L144-L160 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/Inelastic/CrystalField/fitting.py | python | CrystalFieldFit.fit | (self) | Run Fit algorithm. Update function parameters. | Run Fit algorithm. Update function parameters. | [
"Run",
"Fit",
"algorithm",
".",
"Update",
"function",
"parameters",
"."
] | def fit(self):
"""
Run Fit algorithm. Update function parameters.
"""
self.check_consistency()
if isinstance(self._input_workspace, list):
return self._fit_multi()
else:
return self._fit_single() | [
"def",
"fit",
"(",
"self",
")",
":",
"self",
".",
"check_consistency",
"(",
")",
"if",
"isinstance",
"(",
"self",
".",
"_input_workspace",
",",
"list",
")",
":",
"return",
"self",
".",
"_fit_multi",
"(",
")",
"else",
":",
"return",
"self",
".",
"_fit_s... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/Inelastic/CrystalField/fitting.py#L1241-L1249 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/dataset/text/utils.py | python | Vocab.from_list | (cls, word_list, special_tokens=None, special_first=True) | return vocab | Build a vocab object from a list of word.
Args:
word_list(list): A list of string where each element is a word of type string.
special_tokens(list, optional): A list of strings, each one is a special token. For example
special_tokens=["<pad>","<unk>"] (default=None, no ... | Build a vocab object from a list of word. | [
"Build",
"a",
"vocab",
"object",
"from",
"a",
"list",
"of",
"word",
"."
] | def from_list(cls, word_list, special_tokens=None, special_first=True):
"""
Build a vocab object from a list of word.
Args:
word_list(list): A list of string where each element is a word of type string.
special_tokens(list, optional): A list of strings, each one is a sp... | [
"def",
"from_list",
"(",
"cls",
",",
"word_list",
",",
"special_tokens",
"=",
"None",
",",
"special_first",
"=",
"True",
")",
":",
"if",
"special_tokens",
"is",
"None",
":",
"special_tokens",
"=",
"[",
"]",
"vocab",
"=",
"Vocab",
"(",
")",
"vocab",
".",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/dataset/text/utils.py#L144-L165 | |
OGRECave/ogre-next | 287307980e6de8910f04f3cc0994451b075071fd | Tools/BlenderExport/ogrepkg/gui.py | python | Widget.__init__ | (self, parent, size = Size()) | return | Constructor.
Overwrite the constructor to get event numbers for all used
actions via a call to <code>parent._addButtonAction()</code>.
@param name The widget name must be unique.
@param size Size hints. | Constructor.
Overwrite the constructor to get event numbers for all used
actions via a call to <code>parent._addButtonAction()</code>. | [
"Constructor",
".",
"Overwrite",
"the",
"constructor",
"to",
"get",
"event",
"numbers",
"for",
"all",
"used",
"actions",
"via",
"a",
"call",
"to",
"<code",
">",
"parent",
".",
"_addButtonAction",
"()",
"<",
"/",
"code",
">",
"."
] | def __init__(self, parent, size = Size()):
"""Constructor.
Overwrite the constructor to get event numbers for all used
actions via a call to <code>parent._addButtonAction()</code>.
@param name The widget name must be unique.
@param size Size hints.
"""
self.parent = parent
self.size = ... | [
"def",
"__init__",
"(",
"self",
",",
"parent",
",",
"size",
"=",
"Size",
"(",
")",
")",
":",
"self",
".",
"parent",
"=",
"parent",
"self",
".",
"size",
"=",
"size",
"self",
".",
"parent",
".",
"_addWidget",
"(",
"self",
")",
"return"
] | https://github.com/OGRECave/ogre-next/blob/287307980e6de8910f04f3cc0994451b075071fd/Tools/BlenderExport/ogrepkg/gui.py#L93-L105 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/math/symbolic_io.py | python | _prettyPrintExpr | (expr,astr,parseCompatible) | return res | Returns a string representing this expression, where astr is a list of strings
representing each argument | Returns a string representing this expression, where astr is a list of strings
representing each argument | [
"Returns",
"a",
"string",
"representing",
"this",
"expression",
"where",
"astr",
"is",
"a",
"list",
"of",
"strings",
"representing",
"each",
"argument"
] | def _prettyPrintExpr(expr,astr,parseCompatible):
"""Returns a string representing this expression, where astr is a list of strings
representing each argument"""
if not isinstance(expr,OperatorExpression):
return exprToStr(expr,parseCompatible)
if len(expr.functionInfo.printers) > 0:
if p... | [
"def",
"_prettyPrintExpr",
"(",
"expr",
",",
"astr",
",",
"parseCompatible",
")",
":",
"if",
"not",
"isinstance",
"(",
"expr",
",",
"OperatorExpression",
")",
":",
"return",
"exprToStr",
"(",
"expr",
",",
"parseCompatible",
")",
"if",
"len",
"(",
"expr",
"... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/math/symbolic_io.py#L56-L105 | |
freeorion/freeorion | c266a40eccd3a99a17de8fe57c36ef6ba3771665 | default/python/common/timers.py | python | Timer.__init__ | (self, timer_name) | Creates timer. Timer name is name that will be in logs. | Creates timer. Timer name is name that will be in logs. | [
"Creates",
"timer",
".",
"Timer",
"name",
"is",
"name",
"that",
"will",
"be",
"in",
"logs",
"."
] | def __init__(self, timer_name):
"""
Creates timer. Timer name is name that will be in logs.
"""
self.timer_name = timer_name
self.start_time = None
self.end_time = None
self.section_name = None
self.timers = [] | [
"def",
"__init__",
"(",
"self",
",",
"timer_name",
")",
":",
"self",
".",
"timer_name",
"=",
"timer_name",
"self",
".",
"start_time",
"=",
"None",
"self",
".",
"end_time",
"=",
"None",
"self",
".",
"section_name",
"=",
"None",
"self",
".",
"timers",
"=",... | https://github.com/freeorion/freeorion/blob/c266a40eccd3a99a17de8fe57c36ef6ba3771665/default/python/common/timers.py#L5-L13 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | src/third_party/wiredtiger/dist/stat.py | python | print_func | (name, handle, statlist) | Print the structures/functions for the stat.c file. | Print the structures/functions for the stat.c file. | [
"Print",
"the",
"structures",
"/",
"functions",
"for",
"the",
"stat",
".",
"c",
"file",
"."
] | def print_func(name, handle, statlist):
'''Print the structures/functions for the stat.c file.'''
f.write('\n')
f.write('static const char * const __stats_' + name + '_desc[] = {\n')
for l in statlist:
f.write('\t"' + l.desc + '",\n')
f.write('};\n')
f.write('''
int
__wt_stat_''' + name... | [
"def",
"print_func",
"(",
"name",
",",
"handle",
",",
"statlist",
")",
":",
"f",
".",
"write",
"(",
"'\\n'",
")",
"f",
".",
"write",
"(",
"'static const char * const __stats_'",
"+",
"name",
"+",
"'_desc[] = {\\n'",
")",
"for",
"l",
"in",
"statlist",
":",
... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/wiredtiger/dist/stat.py#L133-L256 | ||
GJDuck/LowFat | ecf6a0f0fa1b73a27a626cf493cc39e477b6faea | llvm-4.0.0.src/tools/clang/bindings/python/clang/cindex.py | python | Cursor.type | (self) | return self._type | Retrieve the Type (if any) of the entity pointed at by the cursor. | Retrieve the Type (if any) of the entity pointed at by the cursor. | [
"Retrieve",
"the",
"Type",
"(",
"if",
"any",
")",
"of",
"the",
"entity",
"pointed",
"at",
"by",
"the",
"cursor",
"."
] | def type(self):
"""
Retrieve the Type (if any) of the entity pointed at by the cursor.
"""
if not hasattr(self, '_type'):
self._type = conf.lib.clang_getCursorType(self)
return self._type | [
"def",
"type",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_type'",
")",
":",
"self",
".",
"_type",
"=",
"conf",
".",
"lib",
".",
"clang_getCursorType",
"(",
"self",
")",
"return",
"self",
".",
"_type"
] | https://github.com/GJDuck/LowFat/blob/ecf6a0f0fa1b73a27a626cf493cc39e477b6faea/llvm-4.0.0.src/tools/clang/bindings/python/clang/cindex.py#L1503-L1510 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/media.py | python | MediaCtrl.Tell | (*args, **kwargs) | return _media.MediaCtrl_Tell(*args, **kwargs) | Tell(self) -> wxFileOffset | Tell(self) -> wxFileOffset | [
"Tell",
"(",
"self",
")",
"-",
">",
"wxFileOffset"
] | def Tell(*args, **kwargs):
"""Tell(self) -> wxFileOffset"""
return _media.MediaCtrl_Tell(*args, **kwargs) | [
"def",
"Tell",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_media",
".",
"MediaCtrl_Tell",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/media.py#L137-L139 | |
trailofbits/llvm-sanitizer-tutorial | d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99 | llvm/utils/lit/lit/util.py | python | detectCPUs | () | return 1 | Detects the number of CPUs on a system.
Cribbed from pp. | Detects the number of CPUs on a system. | [
"Detects",
"the",
"number",
"of",
"CPUs",
"on",
"a",
"system",
"."
] | def detectCPUs():
"""Detects the number of CPUs on a system.
Cribbed from pp.
"""
# Linux, Unix and MacOS:
if hasattr(os, 'sysconf'):
if 'SC_NPROCESSORS_ONLN' in os.sysconf_names:
# Linux & Unix:
ncpus = os.sysconf('SC_NPROCESSORS_ONLN')
if isinstance(nc... | [
"def",
"detectCPUs",
"(",
")",
":",
"# Linux, Unix and MacOS:",
"if",
"hasattr",
"(",
"os",
",",
"'sysconf'",
")",
":",
"if",
"'SC_NPROCESSORS_ONLN'",
"in",
"os",
".",
"sysconf_names",
":",
"# Linux & Unix:",
"ncpus",
"=",
"os",
".",
"sysconf",
"(",
"'SC_NPROC... | https://github.com/trailofbits/llvm-sanitizer-tutorial/blob/d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99/llvm/utils/lit/lit/util.py#L105-L128 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/src/motionplanning.py | python | CSpaceInterface.addFeasibilityTest | (self, name: "char const *", pyFeas: "PyObject *") | return _motionplanning.CSpaceInterface_addFeasibilityTest(self, name, pyFeas) | r"""
addFeasibilityTest(CSpaceInterface self, char const * name, PyObject * pyFeas) | r"""
addFeasibilityTest(CSpaceInterface self, char const * name, PyObject * pyFeas) | [
"r",
"addFeasibilityTest",
"(",
"CSpaceInterface",
"self",
"char",
"const",
"*",
"name",
"PyObject",
"*",
"pyFeas",
")"
] | def addFeasibilityTest(self, name: "char const *", pyFeas: "PyObject *") -> "void":
r"""
addFeasibilityTest(CSpaceInterface self, char const * name, PyObject * pyFeas)
"""
return _motionplanning.CSpaceInterface_addFeasibilityTest(self, name, pyFeas) | [
"def",
"addFeasibilityTest",
"(",
"self",
",",
"name",
":",
"\"char const *\"",
",",
"pyFeas",
":",
"\"PyObject *\"",
")",
"->",
"\"void\"",
":",
"return",
"_motionplanning",
".",
"CSpaceInterface_addFeasibilityTest",
"(",
"self",
",",
"name",
",",
"pyFeas",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/src/motionplanning.py#L510-L516 | |
rootm0s/Protectors | 5b3f4d11687a5955caf9c3af30666c4bfc2c19ab | OWASP-ZSC/module/readline_windows/pyreadline/modes/notemacs.py | python | NotEmacsMode.backward_delete_char | (self, e) | Delete the character behind the cursor. A numeric argument means
to kill the characters instead of deleting them. | Delete the character behind the cursor. A numeric argument means
to kill the characters instead of deleting them. | [
"Delete",
"the",
"character",
"behind",
"the",
"cursor",
".",
"A",
"numeric",
"argument",
"means",
"to",
"kill",
"the",
"characters",
"instead",
"of",
"deleting",
"them",
"."
] | def backward_delete_char(self, e): # (Rubout)
'''Delete the character behind the cursor. A numeric argument means
to kill the characters instead of deleting them.'''
self.l_buffer.backward_delete_char() | [
"def",
"backward_delete_char",
"(",
"self",
",",
"e",
")",
":",
"# (Rubout)",
"self",
".",
"l_buffer",
".",
"backward_delete_char",
"(",
")"
] | https://github.com/rootm0s/Protectors/blob/5b3f4d11687a5955caf9c3af30666c4bfc2c19ab/OWASP-ZSC/module/readline_windows/pyreadline/modes/notemacs.py#L261-L264 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/docview.py | python | DocMDIChildFrame.OnActivate | (self, event) | Sets the currently active view to be the frame's view. You may need to
override (but still call) this function in order to set the keyboard
focus for your subwindow. | Sets the currently active view to be the frame's view. You may need to
override (but still call) this function in order to set the keyboard
focus for your subwindow. | [
"Sets",
"the",
"currently",
"active",
"view",
"to",
"be",
"the",
"frame",
"s",
"view",
".",
"You",
"may",
"need",
"to",
"override",
"(",
"but",
"still",
"call",
")",
"this",
"function",
"in",
"order",
"to",
"set",
"the",
"keyboard",
"focus",
"for",
"yo... | def OnActivate(self, event):
"""
Sets the currently active view to be the frame's view. You may need to
override (but still call) this function in order to set the keyboard
focus for your subwindow.
"""
event.Skip()
if self._activated != 0:
return True... | [
"def",
"OnActivate",
"(",
"self",
",",
"event",
")",
":",
"event",
".",
"Skip",
"(",
")",
"if",
"self",
".",
"_activated",
"!=",
"0",
":",
"return",
"True",
"self",
".",
"_activated",
"+=",
"1",
"wx",
".",
"MDIChildFrame",
".",
"Activate",
"(",
"self... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/docview.py#L2800-L2813 | ||
cyberbotics/webots | af7fa7d68dcf7b4550f1f2e132092b41e83698fc | resources/osm_importer/projection.py | python | Projection.project | (long, lat) | return (-z, x) | Return a projected coordinate. | Return a projected coordinate. | [
"Return",
"a",
"projected",
"coordinate",
"."
] | def project(long, lat):
"""Return a projected coordinate."""
if Projection.projection is None:
sys.stderr.write("Warning: Projection.project() called before Projection.initProjection()\n")
x, z = Projection.projection(long, lat)
return (-z, x) | [
"def",
"project",
"(",
"long",
",",
"lat",
")",
":",
"if",
"Projection",
".",
"projection",
"is",
"None",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"\"Warning: Projection.project() called before Projection.initProjection()\\n\"",
")",
"x",
",",
"z",
"=",
"Pr... | https://github.com/cyberbotics/webots/blob/af7fa7d68dcf7b4550f1f2e132092b41e83698fc/resources/osm_importer/projection.py#L48-L53 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/decimal.py | python | Context.add | (self, a, b) | Return the sum of the two operands.
>>> ExtendedContext.add(Decimal('12'), Decimal('7.00'))
Decimal('19.00')
>>> ExtendedContext.add(Decimal('1E+2'), Decimal('1.01E+4'))
Decimal('1.02E+4')
>>> ExtendedContext.add(1, Decimal(2))
Decimal('3')
>>> ExtendedContext.ad... | Return the sum of the two operands. | [
"Return",
"the",
"sum",
"of",
"the",
"two",
"operands",
"."
] | def add(self, a, b):
"""Return the sum of the two operands.
>>> ExtendedContext.add(Decimal('12'), Decimal('7.00'))
Decimal('19.00')
>>> ExtendedContext.add(Decimal('1E+2'), Decimal('1.01E+4'))
Decimal('1.02E+4')
>>> ExtendedContext.add(1, Decimal(2))
Decimal('3'... | [
"def",
"add",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"r",
"=",
"a",
".",
"__add__",
"(",
"b",
",",
"context",
"=",
"self",
")",
"if",
"r",
"is",
"NotImplemented",
":",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/decimal.py#L3978-L3997 | ||
stellar-deprecated/stellard | 67eabb2217bdfa9a6ea317f62338fb6bca458c90 | src/beast/python/beast/util/String.py | python | remove_comment | (line) | Remove trailing comments from one line. | Remove trailing comments from one line. | [
"Remove",
"trailing",
"comments",
"from",
"one",
"line",
"."
] | def remove_comment(line):
"""Remove trailing comments from one line."""
start = 0
while True:
loc = line.find('#', start)
if loc == -1:
return line.replace('\\#', '#')
elif not (loc and line[loc - 1] == '\\'):
return line[:loc].replace('\\#', '#')
star... | [
"def",
"remove_comment",
"(",
"line",
")",
":",
"start",
"=",
"0",
"while",
"True",
":",
"loc",
"=",
"line",
".",
"find",
"(",
"'#'",
",",
"start",
")",
"if",
"loc",
"==",
"-",
"1",
":",
"return",
"line",
".",
"replace",
"(",
"'\\\\#'",
",",
"'#'... | https://github.com/stellar-deprecated/stellard/blob/67eabb2217bdfa9a6ea317f62338fb6bca458c90/src/beast/python/beast/util/String.py#L33-L42 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | third_party/Python/module/pexpect-4.6/pexpect/ANSI.py | python | ANSI.do_modecrap | (self, fsm) | Handler for \x1b[?<number>h and \x1b[?<number>l. If anyone
wanted to actually use these, they'd need to add more states to the
FSM rather than just improve or override this method. | Handler for \x1b[?<number>h and \x1b[?<number>l. If anyone
wanted to actually use these, they'd need to add more states to the
FSM rather than just improve or override this method. | [
"Handler",
"for",
"\\",
"x1b",
"[",
"?<number",
">",
"h",
"and",
"\\",
"x1b",
"[",
"?<number",
">",
"l",
".",
"If",
"anyone",
"wanted",
"to",
"actually",
"use",
"these",
"they",
"d",
"need",
"to",
"add",
"more",
"states",
"to",
"the",
"FSM",
"rather"... | def do_modecrap (self, fsm):
'''Handler for \x1b[?<number>h and \x1b[?<number>l. If anyone
wanted to actually use these, they'd need to add more states to the
FSM rather than just improve or override this method. '''
screen = fsm.memory[0]
fsm.memory = [screen] | [
"def",
"do_modecrap",
"(",
"self",
",",
"fsm",
")",
":",
"screen",
"=",
"fsm",
".",
"memory",
"[",
"0",
"]",
"fsm",
".",
"memory",
"=",
"[",
"screen",
"]"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/third_party/Python/module/pexpect-4.6/pexpect/ANSI.py#L346-L351 | ||
giuspen/cherrytree | 84712f206478fcf9acf30174009ad28c648c6344 | pygtk2/modules/imports.py | python | KnowitHandler.parse_string_lines | (self, file_descriptor) | Parse the string line by line | Parse the string line by line | [
"Parse",
"the",
"string",
"line",
"by",
"line"
] | def parse_string_lines(self, file_descriptor):
"""Parse the string line by line"""
self.curr_xml_state = 0
self.curr_node_name = ""
self.curr_node_content = ""
self.curr_node_level = 0
self.former_node_level = -1
self.links_list = []
# 0: waiting for \NewE... | [
"def",
"parse_string_lines",
"(",
"self",
",",
"file_descriptor",
")",
":",
"self",
".",
"curr_xml_state",
"=",
"0",
"self",
".",
"curr_node_name",
"=",
"\"\"",
"self",
".",
"curr_node_content",
"=",
"\"\"",
"self",
".",
"curr_node_level",
"=",
"0",
"self",
... | https://github.com/giuspen/cherrytree/blob/84712f206478fcf9acf30174009ad28c648c6344/pygtk2/modules/imports.py#L1623-L1690 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/optim/optimizer.py | python | Optimizer.get_lr_parameter | (self, param) | return lr if isinstance(param, list) else lr[0] | When parameters is grouped and learning rate is different for each group. Get the learning rate of the specified
`param`.
Args:
param (Union[Parameter, list[Parameter]]): The `Parameter` or list of `Parameter`.
Returns:
Parameter, single `Parameter` or `list[Parameter]`... | When parameters is grouped and learning rate is different for each group. Get the learning rate of the specified
`param`. | [
"When",
"parameters",
"is",
"grouped",
"and",
"learning",
"rate",
"is",
"different",
"for",
"each",
"group",
".",
"Get",
"the",
"learning",
"rate",
"of",
"the",
"specified",
"param",
"."
] | def get_lr_parameter(self, param):
"""
When parameters is grouped and learning rate is different for each group. Get the learning rate of the specified
`param`.
Args:
param (Union[Parameter, list[Parameter]]): The `Parameter` or list of `Parameter`.
Returns:
... | [
"def",
"get_lr_parameter",
"(",
"self",
",",
"param",
")",
":",
"def",
"get_lr_value",
"(",
"learning_rate",
")",
":",
"if",
"isinstance",
"(",
"learning_rate",
",",
"(",
"_ConvertToCell",
",",
"_IteratorLearningRate",
")",
")",
":",
"return",
"learning_rate",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/optim/optimizer.py#L598-L650 | |
apache/impala | 8ddac48f3428c86f2cbd037ced89cfb903298b12 | bin/diagnostics/experimental/plan-graph.py | python | DotParser.find_preceding_scans | (self, rf_id) | return ret | Given a runtime filter id, find all scan nodes that contribute towards that runtime
filter creation. | Given a runtime filter id, find all scan nodes that contribute towards that runtime
filter creation. | [
"Given",
"a",
"runtime",
"filter",
"id",
"find",
"all",
"scan",
"nodes",
"that",
"contribute",
"towards",
"that",
"runtime",
"filter",
"creation",
"."
] | def find_preceding_scans(self, rf_id):
"""Given a runtime filter id, find all scan nodes that contribute towards that runtime
filter creation."""
ret = []
parent = self.rf_parent[rf_id]
consumer_scans = set(self.edges[rf_id])
for child in self.edges[parent]:
if child == rf_id:
cont... | [
"def",
"find_preceding_scans",
"(",
"self",
",",
"rf_id",
")",
":",
"ret",
"=",
"[",
"]",
"parent",
"=",
"self",
".",
"rf_parent",
"[",
"rf_id",
"]",
"consumer_scans",
"=",
"set",
"(",
"self",
".",
"edges",
"[",
"rf_id",
"]",
")",
"for",
"child",
"in... | https://github.com/apache/impala/blob/8ddac48f3428c86f2cbd037ced89cfb903298b12/bin/diagnostics/experimental/plan-graph.py#L247-L258 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/idl_parser/idl_parser.py | python | IDLParser.p_ExtendedAttributeIdentList | (self, p) | ExtendedAttributeIdentList : identifier '=' '(' IdentifierList ') | ExtendedAttributeIdentList : identifier '=' '(' IdentifierList ') | [
"ExtendedAttributeIdentList",
":",
"identifier",
"=",
"(",
"IdentifierList",
")"
] | def p_ExtendedAttributeIdentList(self, p):
"""ExtendedAttributeIdentList : identifier '=' '(' IdentifierList ')'"""
value = self.BuildAttribute('VALUE', p[4])
p[0] = self.BuildNamed('ExtAttribute', p, 1, value) | [
"def",
"p_ExtendedAttributeIdentList",
"(",
"self",
",",
"p",
")",
":",
"value",
"=",
"self",
".",
"BuildAttribute",
"(",
"'VALUE'",
",",
"p",
"[",
"4",
"]",
")",
"p",
"[",
"0",
"]",
"=",
"self",
".",
"BuildNamed",
"(",
"'ExtAttribute'",
",",
"p",
",... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/idl_parser/idl_parser.py#L1078-L1081 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/tracking/base.py | python | Trackable._preload_simple_restoration | (self, name, shape) | return CheckpointInitialValue(
checkpoint_position=checkpoint_position, shape=shape) | Return a dependency's value for restore-on-create.
Note the restoration is not deleted; if for some reason preload is called
and then not assigned to the variable (for example because a custom getter
overrides the initializer), the assignment will still happen once the
variable is tracked (determined b... | Return a dependency's value for restore-on-create. | [
"Return",
"a",
"dependency",
"s",
"value",
"for",
"restore",
"-",
"on",
"-",
"create",
"."
] | def _preload_simple_restoration(self, name, shape):
"""Return a dependency's value for restore-on-create.
Note the restoration is not deleted; if for some reason preload is called
and then not assigned to the variable (for example because a custom getter
overrides the initializer), the assignment will ... | [
"def",
"_preload_simple_restoration",
"(",
"self",
",",
"name",
",",
"shape",
")",
":",
"deferred_dependencies_list",
"=",
"self",
".",
"_deferred_dependencies",
".",
"get",
"(",
"name",
",",
"(",
")",
")",
"if",
"not",
"deferred_dependencies_list",
":",
"# Noth... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/tracking/base.py#L725-L760 | |
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | cmake/std/trilinosprhelpers/sysinfo/SysInfo.py | python | SysInfo.compute_num_usable_cores | (self, req_mem_gb_per_core=3.0, max_cores_allowed=32) | return output | Compute the number of usable cores given memory and size
constraints for the problem.
Steps:
1) compute max number of CPUs by cpu constraints: min(sys cores, max_cores_allowed)
2) compute max cores by mem constraints: sys_mem_GB / req_mem_gb_per_core
3) return min of... | Compute the number of usable cores given memory and size
constraints for the problem. | [
"Compute",
"the",
"number",
"of",
"usable",
"cores",
"given",
"memory",
"and",
"size",
"constraints",
"for",
"the",
"problem",
"."
] | def compute_num_usable_cores(self, req_mem_gb_per_core=3.0, max_cores_allowed=32):
"""
Compute the number of usable cores given memory and size
constraints for the problem.
Steps:
1) compute max number of CPUs by cpu constraints: min(sys cores, max_cores_allowed)
... | [
"def",
"compute_num_usable_cores",
"(",
"self",
",",
"req_mem_gb_per_core",
"=",
"3.0",
",",
"max_cores_allowed",
"=",
"32",
")",
":",
"if",
"max_cores_allowed",
"<",
"1",
":",
"max_cores_allowed",
"=",
"1",
"output",
"=",
"1",
"n_cpu",
"=",
"multiprocessing",
... | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/cmake/std/trilinosprhelpers/sysinfo/SysInfo.py#L119-L149 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/emscripten/1.37.19/site/source/get_wiki.py | python | CloneWiki | () | Clone the wiki into a temporary location (first cleaning) | Clone the wiki into a temporary location (first cleaning) | [
"Clone",
"the",
"wiki",
"into",
"a",
"temporary",
"location",
"(",
"first",
"cleaning",
")"
] | def CloneWiki():
"""
Clone the wiki into a temporary location (first cleaning)
"""
# Clean up existing repo
CleanWiki()
# Create directory for output and temporary files
try:
os.makedirs(wiki_directory)
os.makedirs(wiki_temp_directory)
print 'Created directory'
... | [
"def",
"CloneWiki",
"(",
")",
":",
"# Clean up existing repo",
"CleanWiki",
"(",
")",
"# Create directory for output and temporary files",
"try",
":",
"os",
".",
"makedirs",
"(",
"wiki_directory",
")",
"os",
".",
"makedirs",
"(",
"wiki_temp_directory",
")",
"print",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/emscripten/1.37.19/site/source/get_wiki.py#L77-L96 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | caffe2/python/modeling/parameter_sharing.py | python | ParameterSharing | (shared_scopes) | Helper function for sharing scopes.
All the parameters within the shared_scopes, will be remapped with the
respect of CurrentNamescope()
I.e. if one calls ParameterSharing with {'scope_b': 'scope_'a'}, from the
scope 'some_global_scope', it'll effectively mean, that all parameters from
'some_global... | Helper function for sharing scopes.
All the parameters within the shared_scopes, will be remapped with the
respect of CurrentNamescope() | [
"Helper",
"function",
"for",
"sharing",
"scopes",
".",
"All",
"the",
"parameters",
"within",
"the",
"shared_scopes",
"will",
"be",
"remapped",
"with",
"the",
"respect",
"of",
"CurrentNamescope",
"()"
] | def ParameterSharing(shared_scopes):
"""
Helper function for sharing scopes.
All the parameters within the shared_scopes, will be remapped with the
respect of CurrentNamescope()
I.e. if one calls ParameterSharing with {'scope_b': 'scope_'a'}, from the
scope 'some_global_scope', it'll effectivel... | [
"def",
"ParameterSharing",
"(",
"shared_scopes",
")",
":",
"assert",
"isinstance",
"(",
"shared_scopes",
",",
"dict",
")",
"shared_scope_overrides",
"=",
"{",
"}",
"current_scope",
"=",
"scope",
".",
"CurrentNameScope",
"(",
")",
"for",
"k",
",",
"v",
"in",
... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/caffe2/python/modeling/parameter_sharing.py#L88-L118 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/psutil/_pswindows.py | python | net_if_stats | () | return ret | Get NIC stats (isup, duplex, speed, mtu). | Get NIC stats (isup, duplex, speed, mtu). | [
"Get",
"NIC",
"stats",
"(",
"isup",
"duplex",
"speed",
"mtu",
")",
"."
] | def net_if_stats():
"""Get NIC stats (isup, duplex, speed, mtu)."""
ret = {}
rawdict = cext.net_if_stats()
for name, items in rawdict.items():
if not PY3:
assert isinstance(name, unicode), type(name)
name = py2_strencode(name)
isup, duplex, speed, mtu = items
... | [
"def",
"net_if_stats",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"rawdict",
"=",
"cext",
".",
"net_if_stats",
"(",
")",
"for",
"name",
",",
"items",
"in",
"rawdict",
".",
"items",
"(",
")",
":",
"if",
"not",
"PY3",
":",
"assert",
"isinstance",
"(",
"nam... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/psutil/_pswindows.py#L369-L381 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/_extends/graph_kernel/model/model.py | python | Utils.get_attr_type | (attr) | Get attr type | Get attr type | [
"Get",
"attr",
"type"
] | def get_attr_type(attr):
"""Get attr type"""
if isinstance(attr, bool):
return 'bool'
if isinstance(attr, str):
return 'str'
if isinstance(attr, int):
return 'int'
if isinstance(attr, float):
return 'bool'
if isinstance(attr... | [
"def",
"get_attr_type",
"(",
"attr",
")",
":",
"if",
"isinstance",
"(",
"attr",
",",
"bool",
")",
":",
"return",
"'bool'",
"if",
"isinstance",
"(",
"attr",
",",
"str",
")",
":",
"return",
"'str'",
"if",
"isinstance",
"(",
"attr",
",",
"int",
")",
":"... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/_extends/graph_kernel/model/model.py#L25-L42 | ||
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/nyan/nyan_structs.py | python | NyanMember.dump | (self, indent_depth, import_tree=None, namespace=None) | return output_str | Returns the nyan string representation of the member. | Returns the nyan string representation of the member. | [
"Returns",
"the",
"nyan",
"string",
"representation",
"of",
"the",
"member",
"."
] | def dump(self, indent_depth, import_tree=None, namespace=None):
"""
Returns the nyan string representation of the member.
"""
output_str = f"{self.name} : {self._member_type.dump()}"
if self.is_initialized():
output_str += " %s%s %s" % ("@" * self._override_depth,
... | [
"def",
"dump",
"(",
"self",
",",
"indent_depth",
",",
"import_tree",
"=",
"None",
",",
"namespace",
"=",
"None",
")",
":",
"output_str",
"=",
"f\"{self.name} : {self._member_type.dump()}\"",
"if",
"self",
".",
"is_initialized",
"(",
")",
":",
"output_str",
"+=",... | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/nyan/nyan_structs.py#L966-L981 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/pyfakefs/pyfakefs/example.py | python | delete_file | (path) | Delete the specified file.
For example:
>>> os.mkdir('/test')
>>> os.path.exists('/test/file.txt')
False
>>> create_file('/test/file.txt')
>>> os.path.exists('/test/file.txt')
True
>>> delete_file('/test/file.txt')
>>> os.path.exists('/test/file.txt')
False | Delete the specified file.
For example:
>>> os.mkdir('/test')
>>> os.path.exists('/test/file.txt')
False
>>> create_file('/test/file.txt')
>>> os.path.exists('/test/file.txt')
True
>>> delete_file('/test/file.txt')
>>> os.path.exists('/test/file.txt')
False | [
"Delete",
"the",
"specified",
"file",
".",
"For",
"example",
":",
">>>",
"os",
".",
"mkdir",
"(",
"/",
"test",
")",
">>>",
"os",
".",
"path",
".",
"exists",
"(",
"/",
"test",
"/",
"file",
".",
"txt",
")",
"False",
">>>",
"create_file",
"(",
"/",
... | def delete_file(path):
'''Delete the specified file.
For example:
>>> os.mkdir('/test')
>>> os.path.exists('/test/file.txt')
False
>>> create_file('/test/file.txt')
>>> os.path.exists('/test/file.txt')
True
>>> delete_file('/test/file.txt')
>>> os.path.exists('/test... | [
"def",
"delete_file",
"(",
"path",
")",
":",
"os",
".",
"remove",
"(",
"path",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/pyfakefs/pyfakefs/example.py#L70-L85 | ||
NeoGeographyToolkit/StereoPipeline | eedf54a919fb5cce1ab0e280bb0df4050763aa11 | src/asp/IceBridge/fetcher_script.py | python | workDirs | () | return (pfePath, lfePath) | When fetching data, return the paths where it is stored temporarily on pfe,
and for archival, on lou. | When fetching data, return the paths where it is stored temporarily on pfe,
and for archival, on lou. | [
"When",
"fetching",
"data",
"return",
"the",
"paths",
"where",
"it",
"is",
"stored",
"temporarily",
"on",
"pfe",
"and",
"for",
"archival",
"on",
"lou",
"."
] | def workDirs():
'''When fetching data, return the paths where it is stored temporarily on pfe,
and for archival, on lou.'''
currDir = os.getcwd()
m = re.match("^.*?/" + louUser + "/(.*?)$", currDir)
if not m:
raise Exception("Could not match %s in %s " % (louUser, currDir))
pfePath = '/n... | [
"def",
"workDirs",
"(",
")",
":",
"currDir",
"=",
"os",
".",
"getcwd",
"(",
")",
"m",
"=",
"re",
".",
"match",
"(",
"\"^.*?/\"",
"+",
"louUser",
"+",
"\"/(.*?)$\"",
",",
"currDir",
")",
"if",
"not",
"m",
":",
"raise",
"Exception",
"(",
"\"Could not m... | https://github.com/NeoGeographyToolkit/StereoPipeline/blob/eedf54a919fb5cce1ab0e280bb0df4050763aa11/src/asp/IceBridge/fetcher_script.py#L68-L78 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBTypeSynthetic_CreateWithScriptCode | (data, options=0) | return _lldb.SBTypeSynthetic_CreateWithScriptCode(data, options) | CreateWithScriptCode(char const * data, uint32_t options=0) -> SBTypeSynthetic
SBTypeSynthetic_CreateWithScriptCode(char const * data) -> SBTypeSynthetic | CreateWithScriptCode(char const * data, uint32_t options=0) -> SBTypeSynthetic
SBTypeSynthetic_CreateWithScriptCode(char const * data) -> SBTypeSynthetic | [
"CreateWithScriptCode",
"(",
"char",
"const",
"*",
"data",
"uint32_t",
"options",
"=",
"0",
")",
"-",
">",
"SBTypeSynthetic",
"SBTypeSynthetic_CreateWithScriptCode",
"(",
"char",
"const",
"*",
"data",
")",
"-",
">",
"SBTypeSynthetic"
] | def SBTypeSynthetic_CreateWithScriptCode(data, options=0):
"""
CreateWithScriptCode(char const * data, uint32_t options=0) -> SBTypeSynthetic
SBTypeSynthetic_CreateWithScriptCode(char const * data) -> SBTypeSynthetic
"""
return _lldb.SBTypeSynthetic_CreateWithScriptCode(data, options) | [
"def",
"SBTypeSynthetic_CreateWithScriptCode",
"(",
"data",
",",
"options",
"=",
"0",
")",
":",
"return",
"_lldb",
".",
"SBTypeSynthetic_CreateWithScriptCode",
"(",
"data",
",",
"options",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L14091-L14096 | |
Illumina/hap.py | 84011695b2ff2406c16a335106db6831fb67fdfe | src/python/Tools/parallel.py | python | runParallel | (pool, fun, par, *args, **kwargs) | return result | run a function in parallel on all elements in par
:param pool: multiprocessing.Pool or None
:param fun: a function
:param par: a list of things to map to (each item is passed as the first argument to fun)
:param args: more function arguments for fun
:param kwargs: more function arguments for fun | run a function in parallel on all elements in par | [
"run",
"a",
"function",
"in",
"parallel",
"on",
"all",
"elements",
"in",
"par"
] | def runParallel(pool, fun, par, *args, **kwargs):
""" run a function in parallel on all elements in par
:param pool: multiprocessing.Pool or None
:param fun: a function
:param par: a list of things to map to (each item is passed as the first argument to fun)
:param args: more function arguments for... | [
"def",
"runParallel",
"(",
"pool",
",",
"fun",
",",
"par",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"pool",
":",
"result",
"=",
"pool",
".",
"map",
"(",
"parMapper",
",",
"izip",
"(",
"par",
",",
"repeat",
"(",
"{",
"\"fun\"",
... | https://github.com/Illumina/hap.py/blob/84011695b2ff2406c16a335106db6831fb67fdfe/src/python/Tools/parallel.py#L85-L101 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TMOut.GetCrLfLn | (self) | return _snap.TMOut_GetCrLfLn(self) | GetCrLfLn(TMOut self) -> TStr
Parameters:
self: TMOut * | GetCrLfLn(TMOut self) -> TStr | [
"GetCrLfLn",
"(",
"TMOut",
"self",
")",
"-",
">",
"TStr"
] | def GetCrLfLn(self):
"""
GetCrLfLn(TMOut self) -> TStr
Parameters:
self: TMOut *
"""
return _snap.TMOut_GetCrLfLn(self) | [
"def",
"GetCrLfLn",
"(",
"self",
")",
":",
"return",
"_snap",
".",
"TMOut_GetCrLfLn",
"(",
"self",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L3109-L3117 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/fsspec/utils.py | python | infer_storage_options | (urlpath, inherit_storage_options=None) | return options | Infer storage options from URL path and merge it with existing storage
options.
Parameters
----------
urlpath: str or unicode
Either local absolute file path or URL (hdfs://namenode:8020/file.csv)
inherit_storage_options: dict (optional)
Its contents will get merged with the inferre... | Infer storage options from URL path and merge it with existing storage
options. | [
"Infer",
"storage",
"options",
"from",
"URL",
"path",
"and",
"merge",
"it",
"with",
"existing",
"storage",
"options",
"."
] | def infer_storage_options(urlpath, inherit_storage_options=None):
""" Infer storage options from URL path and merge it with existing storage
options.
Parameters
----------
urlpath: str or unicode
Either local absolute file path or URL (hdfs://namenode:8020/file.csv)
inherit_storage_opti... | [
"def",
"infer_storage_options",
"(",
"urlpath",
",",
"inherit_storage_options",
"=",
"None",
")",
":",
"# Handle Windows paths including disk name in this special case",
"if",
"(",
"re",
".",
"match",
"(",
"r\"^[a-zA-Z]:[\\\\/]\"",
",",
"urlpath",
")",
"or",
"re",
".",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/fsspec/utils.py#L12-L90 | |
microsoft/ELL | a1d6bacc37a14879cc025d9be2ba40b1a0632315 | docs/tutorials/Boosting-classifier-accuracy-by-grouping-categories/pets_callback.py | python | get_image_from_camera | (camera) | return None | Function to return an image from our camera using OpenCV | Function to return an image from our camera using OpenCV | [
"Function",
"to",
"return",
"an",
"image",
"from",
"our",
"camera",
"using",
"OpenCV"
] | def get_image_from_camera(camera):
"""Function to return an image from our camera using OpenCV"""
if camera:
# if predictor is too slow frames get buffered, this is designed to
# flush that buffer
ret, frame = camera.read()
if not ret:
raise Exception("your capture de... | [
"def",
"get_image_from_camera",
"(",
"camera",
")",
":",
"if",
"camera",
":",
"# if predictor is too slow frames get buffered, this is designed to",
"# flush that buffer",
"ret",
",",
"frame",
"=",
"camera",
".",
"read",
"(",
")",
"if",
"not",
"ret",
":",
"raise",
"... | https://github.com/microsoft/ELL/blob/a1d6bacc37a14879cc025d9be2ba40b1a0632315/docs/tutorials/Boosting-classifier-accuracy-by-grouping-categories/pets_callback.py#L20-L29 | |
xenia-project/xenia | 9b1fdac98665ac091b9660a5d0fbb259ed79e578 | third_party/google-styleguide/cpplint/cpplint.py | python | _CppLintState.SetVerboseLevel | (self, level) | return last_verbose_level | Sets the module's verbosity, and returns the previous setting. | Sets the module's verbosity, and returns the previous setting. | [
"Sets",
"the",
"module",
"s",
"verbosity",
"and",
"returns",
"the",
"previous",
"setting",
"."
] | def SetVerboseLevel(self, level):
"""Sets the module's verbosity, and returns the previous setting."""
last_verbose_level = self.verbose_level
self.verbose_level = level
return last_verbose_level | [
"def",
"SetVerboseLevel",
"(",
"self",
",",
"level",
")",
":",
"last_verbose_level",
"=",
"self",
".",
"verbose_level",
"self",
".",
"verbose_level",
"=",
"level",
"return",
"last_verbose_level"
] | https://github.com/xenia-project/xenia/blob/9b1fdac98665ac091b9660a5d0fbb259ed79e578/third_party/google-styleguide/cpplint/cpplint.py#L697-L701 | |
liulei01/DRBox | b5c76e033c555c9009590ab384e1f7bd3c66c237 | scripts/cpp_lint.py | python | CheckForIncludeWhatYouUse | (filename, clean_lines, include_state, error,
io=codecs) | Reports for missing stl includes.
This function will output warnings to make sure you are including the headers
necessary for the stl containers and functions that you use. We only give one
reason to include a header. For example, if you use both equal_to<> and
less<> in a .h file, only one (the latter in the ... | Reports for missing stl includes. | [
"Reports",
"for",
"missing",
"stl",
"includes",
"."
] | def CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error,
io=codecs):
"""Reports for missing stl includes.
This function will output warnings to make sure you are including the headers
necessary for the stl containers and functions that you use. We only give one
r... | [
"def",
"CheckForIncludeWhatYouUse",
"(",
"filename",
",",
"clean_lines",
",",
"include_state",
",",
"error",
",",
"io",
"=",
"codecs",
")",
":",
"required",
"=",
"{",
"}",
"# A map of header name to linenumber and the template entity.",
"# Example of required: { '<functiona... | https://github.com/liulei01/DRBox/blob/b5c76e033c555c9009590ab384e1f7bd3c66c237/scripts/cpp_lint.py#L4487-L4577 | ||
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/ndarray/ndarray.py | python | NDArray.__idiv__ | (self, other) | x.__rdiv__(y) <=> x/=y | x.__rdiv__(y) <=> x/=y | [
"x",
".",
"__rdiv__",
"(",
"y",
")",
"<",
"=",
">",
"x",
"/",
"=",
"y"
] | def __idiv__(self, other):
"""x.__rdiv__(y) <=> x/=y """
if not self.writable:
raise ValueError('trying to divide from a readonly NDArray')
if isinstance(other, NDArray):
return op.broadcast_div(self, other, out=self)
elif isinstance(other, numeric_types):
... | [
"def",
"__idiv__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"self",
".",
"writable",
":",
"raise",
"ValueError",
"(",
"'trying to divide from a readonly NDArray'",
")",
"if",
"isinstance",
"(",
"other",
",",
"NDArray",
")",
":",
"return",
"op",
".",... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/ndarray/ndarray.py#L275-L284 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/propgrid.py | python | PropertyGridInterface.GetPropertyBackgroundColour | (*args, **kwargs) | return _propgrid.PropertyGridInterface_GetPropertyBackgroundColour(*args, **kwargs) | GetPropertyBackgroundColour(self, PGPropArg id) -> Colour | GetPropertyBackgroundColour(self, PGPropArg id) -> Colour | [
"GetPropertyBackgroundColour",
"(",
"self",
"PGPropArg",
"id",
")",
"-",
">",
"Colour"
] | def GetPropertyBackgroundColour(*args, **kwargs):
"""GetPropertyBackgroundColour(self, PGPropArg id) -> Colour"""
return _propgrid.PropertyGridInterface_GetPropertyBackgroundColour(*args, **kwargs) | [
"def",
"GetPropertyBackgroundColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGridInterface_GetPropertyBackgroundColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/propgrid.py#L1397-L1399 | |
bulletphysics/bullet3 | f0f2a952e146f016096db6f85cf0c44ed75b0b9a | examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_trotting_env.py | python | MinitaurTrottingEnv._get_observation_upper_bound | (self) | return np.array(upper_bound) | Get the upper bound of the observation.
Returns:
A numpy array contains the upper bound of an observation. See
GetObservation() for the details of each element of an observation. | Get the upper bound of the observation. | [
"Get",
"the",
"upper",
"bound",
"of",
"the",
"observation",
"."
] | def _get_observation_upper_bound(self):
"""Get the upper bound of the observation.
Returns:
A numpy array contains the upper bound of an observation. See
GetObservation() for the details of each element of an observation.
"""
upper_bound = []
upper_bound.extend([2 * math.pi] * 2) # Rol... | [
"def",
"_get_observation_upper_bound",
"(",
"self",
")",
":",
"upper_bound",
"=",
"[",
"]",
"upper_bound",
".",
"extend",
"(",
"[",
"2",
"*",
"math",
".",
"pi",
"]",
"*",
"2",
")",
"# Roll, pitch, yaw of the base.",
"upper_bound",
".",
"extend",
"(",
"[",
... | https://github.com/bulletphysics/bullet3/blob/f0f2a952e146f016096db6f85cf0c44ed75b0b9a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_trotting_env.py#L275-L289 | |
peterljq/OpenMMD | 795d4dd660cf7e537ceb599fdb038c5388b33390 | VMD 3D Pose Baseline Multi-Objects/packages/lifting/utils/process.py | python | crop_image | (image, obj_pose) | return cropped_image, np.array([offset_left, offset_up]) | Crop the image in order to have the person at the center and the final
image size
is the same as the expected CNN input size.
Returns the cropped image and the offset that is used to update the joint
positions. | Crop the image in order to have the person at the center and the final
image size
is the same as the expected CNN input size.
Returns the cropped image and the offset that is used to update the joint
positions. | [
"Crop",
"the",
"image",
"in",
"order",
"to",
"have",
"the",
"person",
"at",
"the",
"center",
"and",
"the",
"final",
"image",
"size",
"is",
"the",
"same",
"as",
"the",
"expected",
"CNN",
"input",
"size",
".",
"Returns",
"the",
"cropped",
"image",
"and",
... | def crop_image(image, obj_pose):
"""
Crop the image in order to have the person at the center and the final
image size
is the same as the expected CNN input size.
Returns the cropped image and the offset that is used to update the joint
positions.
"""
offset_left = int(obj_pose[0] - conf... | [
"def",
"crop_image",
"(",
"image",
",",
"obj_pose",
")",
":",
"offset_left",
"=",
"int",
"(",
"obj_pose",
"[",
"0",
"]",
"-",
"config",
".",
"INPUT_SIZE",
"//",
"2",
")",
"offset_up",
"=",
"int",
"(",
"obj_pose",
"[",
"1",
"]",
"-",
"config",
".",
... | https://github.com/peterljq/OpenMMD/blob/795d4dd660cf7e537ceb599fdb038c5388b33390/VMD 3D Pose Baseline Multi-Objects/packages/lifting/utils/process.py#L249-L280 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/more-itertools/py3/more_itertools/more.py | python | chunked | (iterable, n, strict=False) | Break *iterable* into lists of length *n*:
>>> list(chunked([1, 2, 3, 4, 5, 6], 3))
[[1, 2, 3], [4, 5, 6]]
By the default, the last yielded list will have fewer than *n* elements
if the length of *iterable* is not divisible by *n*:
>>> list(chunked([1, 2, 3, 4, 5, 6, 7, 8], 3))
... | Break *iterable* into lists of length *n*: | [
"Break",
"*",
"iterable",
"*",
"into",
"lists",
"of",
"length",
"*",
"n",
"*",
":"
] | def chunked(iterable, n, strict=False):
"""Break *iterable* into lists of length *n*:
>>> list(chunked([1, 2, 3, 4, 5, 6], 3))
[[1, 2, 3], [4, 5, 6]]
By the default, the last yielded list will have fewer than *n* elements
if the length of *iterable* is not divisible by *n*:
>>> li... | [
"def",
"chunked",
"(",
"iterable",
",",
"n",
",",
"strict",
"=",
"False",
")",
":",
"iterator",
"=",
"iter",
"(",
"partial",
"(",
"take",
",",
"n",
",",
"iter",
"(",
"iterable",
")",
")",
",",
"[",
"]",
")",
"if",
"strict",
":",
"if",
"n",
"is"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/more-itertools/py3/more_itertools/more.py#L139-L171 | ||
bumptop/BumpTop | 466d23597a07ae738f4265262fa01087fc6e257c | trunk/mac/Build/cpplint.py | python | FileInfo.BaseName | (self) | return self.Split()[1] | File base name - text after the final slash, before the final period. | File base name - text after the final slash, before the final period. | [
"File",
"base",
"name",
"-",
"text",
"after",
"the",
"final",
"slash",
"before",
"the",
"final",
"period",
"."
] | def BaseName(self):
"""File base name - text after the final slash, before the final period."""
return self.Split()[1] | [
"def",
"BaseName",
"(",
"self",
")",
":",
"return",
"self",
".",
"Split",
"(",
")",
"[",
"1",
"]"
] | https://github.com/bumptop/BumpTop/blob/466d23597a07ae738f4265262fa01087fc6e257c/trunk/mac/Build/cpplint.py#L582-L584 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/_collections.py | python | HTTPHeaderDict.pop | (self, key, default=__marker) | D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised. | D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised. | [
"D",
".",
"pop",
"(",
"k",
"[",
"d",
"]",
")",
"-",
">",
"v",
"remove",
"specified",
"key",
"and",
"return",
"the",
"corresponding",
"value",
".",
"If",
"key",
"is",
"not",
"found",
"d",
"is",
"returned",
"if",
"given",
"otherwise",
"KeyError",
"is",... | def pop(self, key, default=__marker):
"""D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised.
"""
# Using the MutableMapping function directly fails due to the private marker.
# Us... | [
"def",
"pop",
"(",
"self",
",",
"key",
",",
"default",
"=",
"__marker",
")",
":",
"# Using the MutableMapping function directly fails due to the private marker.",
"# Using ordinary dict.pop would expose the internal structures.",
"# So let's reinvent the wheel.",
"try",
":",
"value... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/_collections.py#L191-L206 | ||
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/fusion/portableglobe/servers/local_server.py | python | LocalServer.LocalKmlSearchHandler | (self, handler) | Handle GET request for kml search results. | Handle GET request for kml search results. | [
"Handle",
"GET",
"request",
"for",
"kml",
"search",
"results",
"."
] | def LocalKmlSearchHandler(self, handler):
"""Handle GET request for kml search results."""
if not handler.IsValidRequest():
raise tornado.web.HTTPError(404)
try:
version = handler.request.arguments["cv"][0]
if float(version[:3]) >= 7.1:
self.LocalOneBoxKmlSearchHandler(handler)
... | [
"def",
"LocalKmlSearchHandler",
"(",
"self",
",",
"handler",
")",
":",
"if",
"not",
"handler",
".",
"IsValidRequest",
"(",
")",
":",
"raise",
"tornado",
".",
"web",
".",
"HTTPError",
"(",
"404",
")",
"try",
":",
"version",
"=",
"handler",
".",
"request",... | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/fusion/portableglobe/servers/local_server.py#L323-L351 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_format.py | python | Tokenizer.TryConsume | (self, token) | return False | Tries to consume a given piece of text.
Args:
token: Text to consume.
Returns:
True iff the text was consumed. | Tries to consume a given piece of text. | [
"Tries",
"to",
"consume",
"a",
"given",
"piece",
"of",
"text",
"."
] | def TryConsume(self, token):
"""Tries to consume a given piece of text.
Args:
token: Text to consume.
Returns:
True iff the text was consumed.
"""
if self.token == token:
self.NextToken()
return True
return False | [
"def",
"TryConsume",
"(",
"self",
",",
"token",
")",
":",
"if",
"self",
".",
"token",
"==",
"token",
":",
"self",
".",
"NextToken",
"(",
")",
"return",
"True",
"return",
"False"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_format.py#L1002-L1014 | |
microsoft/ivy | 9f3c7ecc0b2383129fdd0953e10890d98d09a82d | ivy/ivy_logic_utils.py | python | close_epr | (fmla) | Convert fmla to E X. A Y. fmla, where X are the skolems in fmla and Y are the variables. | Convert fmla to E X. A Y. fmla, where X are the skolems in fmla and Y are the variables. | [
"Convert",
"fmla",
"to",
"E",
"X",
".",
"A",
"Y",
".",
"fmla",
"where",
"X",
"are",
"the",
"skolems",
"in",
"fmla",
"and",
"Y",
"are",
"the",
"variables",
"."
] | def close_epr(fmla):
""" Convert fmla to E X. A Y. fmla, where X are the skolems in fmla and Y are the variables. """
if isinstance(fmla,And):
return And(*[close_epr(f) for f in fmla.args])
skolems = [s for s in used_symbols_ast(fmla) if not s.is_skolem()]
variables = list(used_variables_ast(fml... | [
"def",
"close_epr",
"(",
"fmla",
")",
":",
"if",
"isinstance",
"(",
"fmla",
",",
"And",
")",
":",
"return",
"And",
"(",
"*",
"[",
"close_epr",
"(",
"f",
")",
"for",
"f",
"in",
"fmla",
".",
"args",
"]",
")",
"skolems",
"=",
"[",
"s",
"for",
"s",... | https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_logic_utils.py#L107-L120 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/s3transfer/futures.py | python | TransferFuture.set_exception | (self, exception) | Sets the exception on the future. | Sets the exception on the future. | [
"Sets",
"the",
"exception",
"on",
"the",
"future",
"."
] | def set_exception(self, exception):
"""Sets the exception on the future."""
if not self.done():
raise TransferNotDoneError(
'set_exception can only be called once the transfer is '
'complete.')
self._coordinator.set_exception(exception, override=True) | [
"def",
"set_exception",
"(",
"self",
",",
"exception",
")",
":",
"if",
"not",
"self",
".",
"done",
"(",
")",
":",
"raise",
"TransferNotDoneError",
"(",
"'set_exception can only be called once the transfer is '",
"'complete.'",
")",
"self",
".",
"_coordinator",
".",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/s3transfer/futures.py#L82-L88 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | ItemContainer.Set | (*args, **kwargs) | return _core_.ItemContainer_Set(*args, **kwargs) | Set(self, List strings)
Replace all the items in the control | Set(self, List strings) | [
"Set",
"(",
"self",
"List",
"strings",
")"
] | def Set(*args, **kwargs):
"""
Set(self, List strings)
Replace all the items in the control
"""
return _core_.ItemContainer_Set(*args, **kwargs) | [
"def",
"Set",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"ItemContainer_Set",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L12890-L12896 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/richtext.py | python | RichTextCtrl.ApplyAlignmentToSelection | (*args, **kwargs) | return _richtext.RichTextCtrl_ApplyAlignmentToSelection(*args, **kwargs) | ApplyAlignmentToSelection(self, int alignment) -> bool
Apply alignment to the selection | ApplyAlignmentToSelection(self, int alignment) -> bool | [
"ApplyAlignmentToSelection",
"(",
"self",
"int",
"alignment",
")",
"-",
">",
"bool"
] | def ApplyAlignmentToSelection(*args, **kwargs):
"""
ApplyAlignmentToSelection(self, int alignment) -> bool
Apply alignment to the selection
"""
return _richtext.RichTextCtrl_ApplyAlignmentToSelection(*args, **kwargs) | [
"def",
"ApplyAlignmentToSelection",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextCtrl_ApplyAlignmentToSelection",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/richtext.py#L3979-L3985 | |
greenheartgames/greenworks | 3ea4ab490b56676de3f0a237c74bcfdb17323e60 | deps/cpplint/cpplint.py | python | CheckBraces | (filename, clean_lines, linenum, error) | Looks for misplaced braces (e.g. at the end of line).
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. | Looks for misplaced braces (e.g. at the end of line). | [
"Looks",
"for",
"misplaced",
"braces",
"(",
"e",
".",
"g",
".",
"at",
"the",
"end",
"of",
"line",
")",
"."
] | def CheckBraces(filename, clean_lines, linenum, error):
"""Looks for misplaced braces (e.g. at the end of line).
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 er... | [
"def",
"CheckBraces",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# get rid of comments and strings",
"if",
"Match",
"(",
"r'\\s*{\\s*$'",
",",
"line",
")",
":",
... | https://github.com/greenheartgames/greenworks/blob/3ea4ab490b56676de3f0a237c74bcfdb17323e60/deps/cpplint/cpplint.py#L3670-L3786 | ||
bulletphysics/bullet3 | f0f2a952e146f016096db6f85cf0c44ed75b0b9a | examples/pybullet/gym/pybullet_envs/minitaur/agents/baseline_controller/locomotion_controller_in_scenario_set_example.py | python | _generate_linear_angular_speed | (t, time_points, speed_points) | return speed[0:3], speed[3] | Creates an example speed profile based on time for demo purpose. | Creates an example speed profile based on time for demo purpose. | [
"Creates",
"an",
"example",
"speed",
"profile",
"based",
"on",
"time",
"for",
"demo",
"purpose",
"."
] | def _generate_linear_angular_speed(t, time_points, speed_points):
"""Creates an example speed profile based on time for demo purpose."""
speed = scipy.interpolate.interp1d(
time_points,
speed_points,
kind="previous",
fill_value="extrapolate",
axis=0)(
t)
return speed[0:3]... | [
"def",
"_generate_linear_angular_speed",
"(",
"t",
",",
"time_points",
",",
"speed_points",
")",
":",
"speed",
"=",
"scipy",
".",
"interpolate",
".",
"interp1d",
"(",
"time_points",
",",
"speed_points",
",",
"kind",
"=",
"\"previous\"",
",",
"fill_value",
"=",
... | https://github.com/bulletphysics/bullet3/blob/f0f2a952e146f016096db6f85cf0c44ed75b0b9a/examples/pybullet/gym/pybullet_envs/minitaur/agents/baseline_controller/locomotion_controller_in_scenario_set_example.py#L69-L80 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/tix.py | python | TixWidget.subwidget | (self, name) | return self._nametowidget(n) | Return the named subwidget (which must have been created by
the sub-class). | Return the named subwidget (which must have been created by
the sub-class). | [
"Return",
"the",
"named",
"subwidget",
"(",
"which",
"must",
"have",
"been",
"created",
"by",
"the",
"sub",
"-",
"class",
")",
"."
] | def subwidget(self, name):
"""Return the named subwidget (which must have been created by
the sub-class)."""
n = self._subwidget_name(name)
if not n:
raise TclError("Subwidget " + name + " not child of " + self._name)
# Remove header of name and leading dot
n ... | [
"def",
"subwidget",
"(",
"self",
",",
"name",
")",
":",
"n",
"=",
"self",
".",
"_subwidget_name",
"(",
"name",
")",
"if",
"not",
"n",
":",
"raise",
"TclError",
"(",
"\"Subwidget \"",
"+",
"name",
"+",
"\" not child of \"",
"+",
"self",
".",
"_name",
")... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/tix.py#L336-L344 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/nntplib.py | python | _NNTPBase.group | (self, name) | return resp, int(count), int(first), int(last), name | Process a GROUP command. Argument:
- group: the group name
Returns:
- resp: server response if successful
- count: number of articles
- first: first article number
- last: last article number
- name: the group name | Process a GROUP command. Argument:
- group: the group name
Returns:
- resp: server response if successful
- count: number of articles
- first: first article number
- last: last article number
- name: the group name | [
"Process",
"a",
"GROUP",
"command",
".",
"Argument",
":",
"-",
"group",
":",
"the",
"group",
"name",
"Returns",
":",
"-",
"resp",
":",
"server",
"response",
"if",
"successful",
"-",
"count",
":",
"number",
"of",
"articles",
"-",
"first",
":",
"first",
... | def group(self, name):
"""Process a GROUP command. Argument:
- group: the group name
Returns:
- resp: server response if successful
- count: number of articles
- first: first article number
- last: last article number
- name: the group name
"""
... | [
"def",
"group",
"(",
"self",
",",
"name",
")",
":",
"resp",
"=",
"self",
".",
"_shortcmd",
"(",
"'GROUP '",
"+",
"name",
")",
"if",
"not",
"resp",
".",
"startswith",
"(",
"'211'",
")",
":",
"raise",
"NNTPReplyError",
"(",
"resp",
")",
"words",
"=",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/nntplib.py#L651-L675 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | tools/stats/scribe.py | python | schema_from_sample | (data: Dict[str, Any]) | return schema | Extract a schema compatible with 'register_rds_schema' from data. | Extract a schema compatible with 'register_rds_schema' from data. | [
"Extract",
"a",
"schema",
"compatible",
"with",
"register_rds_schema",
"from",
"data",
"."
] | def schema_from_sample(data: Dict[str, Any]) -> Dict[str, str]:
"""
Extract a schema compatible with 'register_rds_schema' from data.
"""
schema = {}
for key, value in data.items():
if isinstance(value, str):
schema[key] = "string"
elif isinstance(value, int):
... | [
"def",
"schema_from_sample",
"(",
"data",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"Dict",
"[",
"str",
",",
"str",
"]",
":",
"schema",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"data",
".",
"items",
"(",
")",
":",
"if",
"isin... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/tools/stats/scribe.py#L97-L111 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/boost/boost_1_68_0/tools/build/src/build/virtual_target.py | python | Action.actualize_sources | (self, sources, prop_set) | Creates actual jam targets for sources. Initializes two member
variables:
'self.actual_sources_' -- sources which are passed to updating action
'self.dependency_only_sources_' -- sources which are made dependencies, but
are not used otherwise.
New values will... | Creates actual jam targets for sources. Initializes two member
variables:
'self.actual_sources_' -- sources which are passed to updating action
'self.dependency_only_sources_' -- sources which are made dependencies, but
are not used otherwise. | [
"Creates",
"actual",
"jam",
"targets",
"for",
"sources",
".",
"Initializes",
"two",
"member",
"variables",
":",
"self",
".",
"actual_sources_",
"--",
"sources",
"which",
"are",
"passed",
"to",
"updating",
"action",
"self",
".",
"dependency_only_sources_",
"--",
... | def actualize_sources (self, sources, prop_set):
""" Creates actual jam targets for sources. Initializes two member
variables:
'self.actual_sources_' -- sources which are passed to updating action
'self.dependency_only_sources_' -- sources which are made dependencies, but
... | [
"def",
"actualize_sources",
"(",
"self",
",",
"sources",
",",
"prop_set",
")",
":",
"assert",
"is_iterable_typed",
"(",
"sources",
",",
"VirtualTarget",
")",
"assert",
"isinstance",
"(",
"prop_set",
",",
"property_set",
".",
"PropertySet",
")",
"dependencies",
"... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/boost/boost_1_68_0/tools/build/src/build/virtual_target.py#L886-L917 | ||
google/llvm-propeller | 45c226984fe8377ebfb2ad7713c680d652ba678d | mlir/utils/spirv/gen_spirv_dialect.py | python | get_string_between_nested | (base, start, end) | return '', split[0] | Extracts a substring with a nested start and end from a string.
Arguments:
- base: string to extract from.
- start: string to use as the start of the substring.
- end: string to use as the end of the substring.
Returns:
- The substring if found
- The part of the base after end of the substring... | Extracts a substring with a nested start and end from a string. | [
"Extracts",
"a",
"substring",
"with",
"a",
"nested",
"start",
"and",
"end",
"from",
"a",
"string",
"."
] | def get_string_between_nested(base, start, end):
"""Extracts a substring with a nested start and end from a string.
Arguments:
- base: string to extract from.
- start: string to use as the start of the substring.
- end: string to use as the end of the substring.
Returns:
- The substring if found... | [
"def",
"get_string_between_nested",
"(",
"base",
",",
"start",
",",
"end",
")",
":",
"split",
"=",
"base",
".",
"split",
"(",
"start",
",",
"1",
")",
"if",
"len",
"(",
"split",
")",
"==",
"2",
":",
"# Handle nesting delimiters",
"rest",
"=",
"split",
"... | https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/mlir/utils/spirv/gen_spirv_dialect.py#L801-L836 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/lib/_iotools.py | python | easy_dtype | (ndtype, names=None, defaultfmt="f%i", **validationargs) | return ndtype | Convenience function to create a `np.dtype` object.
The function processes the input `dtype` and matches it with the given
names.
Parameters
----------
ndtype : var
Definition of the dtype. Can be any string or dictionary
recognized by the `np.dtype` function, or a sequence of type... | Convenience function to create a `np.dtype` object. | [
"Convenience",
"function",
"to",
"create",
"a",
"np",
".",
"dtype",
"object",
"."
] | def easy_dtype(ndtype, names=None, defaultfmt="f%i", **validationargs):
"""
Convenience function to create a `np.dtype` object.
The function processes the input `dtype` and matches it with the given
names.
Parameters
----------
ndtype : var
Definition of the dtype. Can be any strin... | [
"def",
"easy_dtype",
"(",
"ndtype",
",",
"names",
"=",
"None",
",",
"defaultfmt",
"=",
"\"f%i\"",
",",
"*",
"*",
"validationargs",
")",
":",
"try",
":",
"ndtype",
"=",
"np",
".",
"dtype",
"(",
"ndtype",
")",
"except",
"TypeError",
":",
"validate",
"=",... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/lib/_iotools.py#L800-L874 | |
milvus-io/milvus | 3b1030de2b6c39e3512833e97f6044d63eb24237 | internal/core/build-support/cpplint.py | python | _RestoreFilters | () | Restores filters previously backed up. | Restores filters previously backed up. | [
"Restores",
"filters",
"previously",
"backed",
"up",
"."
] | def _RestoreFilters():
""" Restores filters previously backed up."""
_cpplint_state.RestoreFilters() | [
"def",
"_RestoreFilters",
"(",
")",
":",
"_cpplint_state",
".",
"RestoreFilters",
"(",
")"
] | https://github.com/milvus-io/milvus/blob/3b1030de2b6c39e3512833e97f6044d63eb24237/internal/core/build-support/cpplint.py#L1482-L1484 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/ma/core.py | python | maximum_fill_value | (obj) | return _extremum_fill_value(obj, max_filler, "maximum") | Return the minimum value that can be represented by the dtype of an object.
This function is useful for calculating a fill value suitable for
taking the maximum of an array with a given dtype.
Parameters
----------
obj : ndarray, dtype or scalar
An object that can be queried for it's numer... | Return the minimum value that can be represented by the dtype of an object. | [
"Return",
"the",
"minimum",
"value",
"that",
"can",
"be",
"represented",
"by",
"the",
"dtype",
"of",
"an",
"object",
"."
] | def maximum_fill_value(obj):
"""
Return the minimum value that can be represented by the dtype of an object.
This function is useful for calculating a fill value suitable for
taking the maximum of an array with a given dtype.
Parameters
----------
obj : ndarray, dtype or scalar
An ... | [
"def",
"maximum_fill_value",
"(",
"obj",
")",
":",
"return",
"_extremum_fill_value",
"(",
"obj",
",",
"max_filler",
",",
"\"maximum\"",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/ma/core.py#L356-L404 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/io/packers.py | python | dtype_for | (t) | return np.typeDict.get(t, t) | return my dtype mapping, whether number or name | return my dtype mapping, whether number or name | [
"return",
"my",
"dtype",
"mapping",
"whether",
"number",
"or",
"name"
] | def dtype_for(t):
""" return my dtype mapping, whether number or name """
if t in dtype_dict:
return dtype_dict[t]
return np.typeDict.get(t, t) | [
"def",
"dtype_for",
"(",
"t",
")",
":",
"if",
"t",
"in",
"dtype_dict",
":",
"return",
"dtype_dict",
"[",
"t",
"]",
"return",
"np",
".",
"typeDict",
".",
"get",
"(",
"t",
",",
"t",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/io/packers.py#L243-L247 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/framework/ops.py | python | _get_graph_from_inputs | (op_input_list, graph=None) | return graph or get_default_graph() | Returns the appropriate graph to use for the given inputs.
This library method provides a consistent algorithm for choosing the graph
in which an Operation should be constructed:
1. If the "graph" is specified explicitly, we validate that all of the inputs
in "op_input_list" are compatible with that graph.... | Returns the appropriate graph to use for the given inputs. | [
"Returns",
"the",
"appropriate",
"graph",
"to",
"use",
"for",
"the",
"given",
"inputs",
"."
] | def _get_graph_from_inputs(op_input_list, graph=None):
"""Returns the appropriate graph to use for the given inputs.
This library method provides a consistent algorithm for choosing the graph
in which an Operation should be constructed:
1. If the "graph" is specified explicitly, we validate that all of the in... | [
"def",
"_get_graph_from_inputs",
"(",
"op_input_list",
",",
"graph",
"=",
"None",
")",
":",
"op_input_list",
"=",
"tuple",
"(",
"op_input_list",
")",
"# Handle generators correctly",
"if",
"graph",
"and",
"not",
"isinstance",
"(",
"graph",
",",
"Graph",
")",
":"... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/framework/ops.py#L3769-L3827 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/mailbox.py | python | Mailbox.get_string | (self, key) | return email.message_from_bytes(self.get_bytes(key)).as_string() | Return a string representation or raise a KeyError.
Uses email.message.Message to create a 7bit clean string
representation of the message. | Return a string representation or raise a KeyError. | [
"Return",
"a",
"string",
"representation",
"or",
"raise",
"a",
"KeyError",
"."
] | def get_string(self, key):
"""Return a string representation or raise a KeyError.
Uses email.message.Message to create a 7bit clean string
representation of the message."""
return email.message_from_bytes(self.get_bytes(key)).as_string() | [
"def",
"get_string",
"(",
"self",
",",
"key",
")",
":",
"return",
"email",
".",
"message_from_bytes",
"(",
"self",
".",
"get_bytes",
"(",
"key",
")",
")",
".",
"as_string",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/mailbox.py#L82-L87 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/autograph/converters/lists.py | python | ListTransformer._postprocess_statement | (self, node) | return node, None | Inserts any separate pop() calls that node may use. | Inserts any separate pop() calls that node may use. | [
"Inserts",
"any",
"separate",
"pop",
"()",
"calls",
"that",
"node",
"may",
"use",
"."
] | def _postprocess_statement(self, node):
"""Inserts any separate pop() calls that node may use."""
pop_uses = self.get_local(POP_USES, None)
if pop_uses:
replacements = []
for original_call_node, pop_var_name in pop_uses:
replacements.extend(
self._generate_pop_operation(origi... | [
"def",
"_postprocess_statement",
"(",
"self",
",",
"node",
")",
":",
"pop_uses",
"=",
"self",
".",
"get_local",
"(",
"POP_USES",
",",
"None",
")",
"if",
"pop_uses",
":",
"replacements",
"=",
"[",
"]",
"for",
"original_call_node",
",",
"pop_var_name",
"in",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/autograph/converters/lists.py#L185-L196 | |
livecode/livecode | 4606a10ea10b16d5071d0f9f263ccdd7ede8b31d | gyp/pylib/gyp/common.py | python | EncodePOSIXShellList | (list) | return ' '.join(encoded_arguments) | Encodes |list| suitably for consumption by POSIX shells.
Returns EncodePOSIXShellArgument for each item in list, and joins them
together using the space character as an argument separator. | Encodes |list| suitably for consumption by POSIX shells. | [
"Encodes",
"|list|",
"suitably",
"for",
"consumption",
"by",
"POSIX",
"shells",
"."
] | def EncodePOSIXShellList(list):
"""Encodes |list| suitably for consumption by POSIX shells.
Returns EncodePOSIXShellArgument for each item in list, and joins them
together using the space character as an argument separator.
"""
encoded_arguments = []
for argument in list:
encoded_arguments.append(Enco... | [
"def",
"EncodePOSIXShellList",
"(",
"list",
")",
":",
"encoded_arguments",
"=",
"[",
"]",
"for",
"argument",
"in",
"list",
":",
"encoded_arguments",
".",
"append",
"(",
"EncodePOSIXShellArgument",
"(",
"argument",
")",
")",
"return",
"' '",
".",
"join",
"(",
... | https://github.com/livecode/livecode/blob/4606a10ea10b16d5071d0f9f263ccdd7ede8b31d/gyp/pylib/gyp/common.py#L276-L286 | |
facebookincubator/BOLT | 88c70afe9d388ad430cc150cc158641701397f70 | libcxx/utils/gdb/libcxx/printers.py | python | RBTreeUtils.parent | (self, node) | return parent | Return the parent of node, if it exists. | Return the parent of node, if it exists. | [
"Return",
"the",
"parent",
"of",
"node",
"if",
"it",
"exists",
"."
] | def parent(self, node):
"""Return the parent of node, if it exists."""
# If this is the root, then from the algorithm's point of view, it has no
# parent.
if node == self.root:
return None
# We don't have enough information to tell if this is the end_node (which
... | [
"def",
"parent",
"(",
"self",
",",
"node",
")",
":",
"# If this is the root, then from the algorithm's point of view, it has no",
"# parent.",
"if",
"node",
"==",
"self",
".",
"root",
":",
"return",
"None",
"# We don't have enough information to tell if this is the end_node (wh... | https://github.com/facebookincubator/BOLT/blob/88c70afe9d388ad430cc150cc158641701397f70/libcxx/utils/gdb/libcxx/printers.py#L584-L613 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | gpu/command_buffer/build_gles2_cmd_buffer.py | python | BucketFunction.WriteHandlerImplementation | (self, file) | Overridden from Function | Overridden from Function | [
"Overridden",
"from",
"Function"
] | def WriteHandlerImplementation(self, file):
"""Overridden from Function"""
self.type_handler.WriteBucketHandlerImplementation(self, file) | [
"def",
"WriteHandlerImplementation",
"(",
"self",
",",
"file",
")",
":",
"self",
".",
"type_handler",
".",
"WriteBucketHandlerImplementation",
"(",
"self",
",",
"file",
")"
] | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/gpu/command_buffer/build_gles2_cmd_buffer.py#L5518-L5520 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/computation/scope.py | python | Scope.full_scope | (self) | return DeepChainMap(*maps) | Return the full scope for use with passing to engines transparently
as a mapping.
Returns
-------
vars : DeepChainMap
All variables in this scope. | Return the full scope for use with passing to engines transparently
as a mapping. | [
"Return",
"the",
"full",
"scope",
"for",
"use",
"with",
"passing",
"to",
"engines",
"transparently",
"as",
"a",
"mapping",
"."
] | def full_scope(self):
"""
Return the full scope for use with passing to engines transparently
as a mapping.
Returns
-------
vars : DeepChainMap
All variables in this scope.
"""
maps = [self.temps] + self.resolvers.maps + self.scope.maps
... | [
"def",
"full_scope",
"(",
"self",
")",
":",
"maps",
"=",
"[",
"self",
".",
"temps",
"]",
"+",
"self",
".",
"resolvers",
".",
"maps",
"+",
"self",
".",
"scope",
".",
"maps",
"return",
"DeepChainMap",
"(",
"*",
"maps",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/computation/scope.py#L303-L314 | |
microsoft/AirSim | 8057725712c0cd46979135396381784075ffc0f3 | PythonClient/airsim/client.py | python | VehicleClient.simGetObjectPose | (self, object_name) | return Pose.from_msgpack(pose) | The position inside the returned Pose is in the world frame
Args:
object_name (str): Object to get the Pose of
Returns:
Pose: | The position inside the returned Pose is in the world frame | [
"The",
"position",
"inside",
"the",
"returned",
"Pose",
"is",
"in",
"the",
"world",
"frame"
] | def simGetObjectPose(self, object_name):
"""
The position inside the returned Pose is in the world frame
Args:
object_name (str): Object to get the Pose of
Returns:
Pose:
"""
pose = self.client.call('simGetObjectPose', object_name)
return... | [
"def",
"simGetObjectPose",
"(",
"self",
",",
"object_name",
")",
":",
"pose",
"=",
"self",
".",
"client",
".",
"call",
"(",
"'simGetObjectPose'",
",",
"object_name",
")",
"return",
"Pose",
".",
"from_msgpack",
"(",
"pose",
")"
] | https://github.com/microsoft/AirSim/blob/8057725712c0cd46979135396381784075ffc0f3/PythonClient/airsim/client.py#L486-L497 | |
logcabin/logcabin | ee6c55ae9744b82b451becd9707d26c7c1b6bbfb | scripts/cpplint.py | python | FileInfo.RepositoryName | (self) | return fullname | FullName after removing the local path to the repository.
If we have a real absolute path name here we can try to do something smart:
detecting the root of the checkout and truncating /path/to/checkout from
the name so that we get header guards that don't include things like
"C:\Documents and Settings\... | FullName after removing the local path to the repository. | [
"FullName",
"after",
"removing",
"the",
"local",
"path",
"to",
"the",
"repository",
"."
] | def RepositoryName(self):
"""FullName after removing the local path to the repository.
If we have a real absolute path name here we can try to do something smart:
detecting the root of the checkout and truncating /path/to/checkout from
the name so that we get header guards that don't include things lik... | [
"def",
"RepositoryName",
"(",
"self",
")",
":",
"fullname",
"=",
"self",
".",
"FullName",
"(",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"fullname",
")",
":",
"project_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"fullname",
")",
"if",
... | https://github.com/logcabin/logcabin/blob/ee6c55ae9744b82b451becd9707d26c7c1b6bbfb/scripts/cpplint.py#L648-L686 | |
Z3Prover/z3 | d745d03afdfdf638d66093e2bfbacaf87187f35b | src/api/python/z3/z3.py | python | fpNeg | (a, ctx=None) | return FPRef(Z3_mk_fpa_neg(ctx.ref(), a.as_ast()), ctx) | Create a Z3 floating-point addition expression.
>>> s = FPSort(8, 24)
>>> rm = RNE()
>>> x = FP('x', s)
>>> fpNeg(x)
-x
>>> fpNeg(x).sort()
FPSort(8, 24) | Create a Z3 floating-point addition expression. | [
"Create",
"a",
"Z3",
"floating",
"-",
"point",
"addition",
"expression",
"."
] | def fpNeg(a, ctx=None):
"""Create a Z3 floating-point addition expression.
>>> s = FPSort(8, 24)
>>> rm = RNE()
>>> x = FP('x', s)
>>> fpNeg(x)
-x
>>> fpNeg(x).sort()
FPSort(8, 24)
"""
ctx = _get_ctx(ctx)
[a] = _coerce_fp_expr_list([a], ctx)
return FPRef(Z3_mk_fpa_neg(ct... | [
"def",
"fpNeg",
"(",
"a",
",",
"ctx",
"=",
"None",
")",
":",
"ctx",
"=",
"_get_ctx",
"(",
"ctx",
")",
"[",
"a",
"]",
"=",
"_coerce_fp_expr_list",
"(",
"[",
"a",
"]",
",",
"ctx",
")",
"return",
"FPRef",
"(",
"Z3_mk_fpa_neg",
"(",
"ctx",
".",
"ref"... | https://github.com/Z3Prover/z3/blob/d745d03afdfdf638d66093e2bfbacaf87187f35b/src/api/python/z3/z3.py#L10008-L10021 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/operations/array_ops.py | python | UniqueWithPad.__init__ | (self) | init UniqueWithPad | init UniqueWithPad | [
"init",
"UniqueWithPad"
] | def __init__(self):
"""init UniqueWithPad""" | [
"def",
"__init__",
"(",
"self",
")",
":"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/operations/array_ops.py#L1048-L1049 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Arch/ArchMaterial.py | python | _ArchMaterialTaskPanel.getFields | (self) | sets self.material from the contents of the task box | sets self.material from the contents of the task box | [
"sets",
"self",
".",
"material",
"from",
"the",
"contents",
"of",
"the",
"task",
"box"
] | def getFields(self):
"sets self.material from the contents of the task box"
self.material['Name'] = self.form.FieldName.text()
self.material['Description'] = self.form.FieldDescription.text()
self.material['DiffuseColor'] = self.getColorFromIcon(self.form.ButtonColor.icon())
self... | [
"def",
"getFields",
"(",
"self",
")",
":",
"self",
".",
"material",
"[",
"'Name'",
"]",
"=",
"self",
".",
"form",
".",
"FieldName",
".",
"text",
"(",
")",
"self",
".",
"material",
"[",
"'Description'",
"]",
"=",
"self",
".",
"form",
".",
"FieldDescri... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Arch/ArchMaterial.py#L598-L608 | ||
root-project/root | fcd3583bb14852bf2e8cd2415717cbaac0e75896 | interpreter/llvm/src/tools/clang/bindings/python/clang/cindex.py | python | Cursor.linkage | (self) | return LinkageKind.from_id(self._linkage) | Return the linkage of this cursor. | Return the linkage of this cursor. | [
"Return",
"the",
"linkage",
"of",
"this",
"cursor",
"."
] | def linkage(self):
"""Return the linkage of this cursor."""
if not hasattr(self, '_linkage'):
self._linkage = conf.lib.clang_getCursorLinkage(self)
return LinkageKind.from_id(self._linkage) | [
"def",
"linkage",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_linkage'",
")",
":",
"self",
".",
"_linkage",
"=",
"conf",
".",
"lib",
".",
"clang_getCursorLinkage",
"(",
"self",
")",
"return",
"LinkageKind",
".",
"from_id",
"(",
... | https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/interpreter/llvm/src/tools/clang/bindings/python/clang/cindex.py#L1585-L1590 | |
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | sdhash-ui/serverui/sdhashsrv/sdhashsrv.py | python | Iface.displayResultStatus | (self, resultID) | Parameters:
- resultID | Parameters:
- resultID | [
"Parameters",
":",
"-",
"resultID"
] | def displayResultStatus(self, resultID):
"""
Parameters:
- resultID
"""
pass | [
"def",
"displayResultStatus",
"(",
"self",
",",
"resultID",
")",
":",
"pass"
] | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/sdhash-ui/serverui/sdhashsrv/sdhashsrv.py#L130-L135 | ||
google/or-tools | 2cb85b4eead4c38e1c54b48044f92087cf165bce | ortools/sat/python/cp_model.py | python | CpModel.AddAbsEquality | (self, target, expr) | return ct | Adds `target == Abs(var)`. | Adds `target == Abs(var)`. | [
"Adds",
"target",
"==",
"Abs",
"(",
"var",
")",
"."
] | def AddAbsEquality(self, target, expr):
"""Adds `target == Abs(var)`."""
ct = Constraint(self.__model.constraints)
model_ct = self.__model.constraints[ct.Index()]
model_ct.lin_max.exprs.append(self.ParseLinearExpression(expr))
model_ct.lin_max.exprs.append(self.ParseLinearExpress... | [
"def",
"AddAbsEquality",
"(",
"self",
",",
"target",
",",
"expr",
")",
":",
"ct",
"=",
"Constraint",
"(",
"self",
".",
"__model",
".",
"constraints",
")",
"model_ct",
"=",
"self",
".",
"__model",
".",
"constraints",
"[",
"ct",
".",
"Index",
"(",
")",
... | https://github.com/google/or-tools/blob/2cb85b4eead4c38e1c54b48044f92087cf165bce/ortools/sat/python/cp_model.py#L1523-L1530 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/http/cookies.py | python | _quote | (str) | r"""Quote a string for use in a cookie header.
If the string does not need to be double-quoted, then just return the
string. Otherwise, surround the string in doublequotes and quote
(with a \) special characters. | r"""Quote a string for use in a cookie header. | [
"r",
"Quote",
"a",
"string",
"for",
"use",
"in",
"a",
"cookie",
"header",
"."
] | def _quote(str):
r"""Quote a string for use in a cookie header.
If the string does not need to be double-quoted, then just return the
string. Otherwise, surround the string in doublequotes and quote
(with a \) special characters.
"""
if str is None or _is_legal_key(str):
return str
... | [
"def",
"_quote",
"(",
"str",
")",
":",
"if",
"str",
"is",
"None",
"or",
"_is_legal_key",
"(",
"str",
")",
":",
"return",
"str",
"else",
":",
"return",
"'\"'",
"+",
"str",
".",
"translate",
"(",
"_Translator",
")",
"+",
"'\"'"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/http/cookies.py#L173-L183 | ||
aimerykong/Low-Rank-Bilinear-Pooling | 487eb2c857fd9c95357a5166b0c15ad0fe135b28 | caffe-20160312/scripts/cpp_lint.py | python | CheckForHeaderGuard | (filename, lines, error) | Checks that the file contains a header guard.
Logs an error if no #ifndef header guard is present. For other
headers, checks that the full pathname is used.
Args:
filename: The name of the C++ header file.
lines: An array of strings, each representing a line of the file.
error: The function to call... | Checks that the file contains a header guard. | [
"Checks",
"that",
"the",
"file",
"contains",
"a",
"header",
"guard",
"."
] | def CheckForHeaderGuard(filename, lines, error):
"""Checks that the file contains a header guard.
Logs an error if no #ifndef header guard is present. For other
headers, checks that the full pathname is used.
Args:
filename: The name of the C++ header file.
lines: An array of strings, each representi... | [
"def",
"CheckForHeaderGuard",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"cppvar",
"=",
"GetHeaderGuardCPPVariable",
"(",
"filename",
")",
"ifndef",
"=",
"None",
"ifndef_linenum",
"=",
"0",
"define",
"=",
"None",
"endif",
"=",
"None",
"endif_linenu... | https://github.com/aimerykong/Low-Rank-Bilinear-Pooling/blob/487eb2c857fd9c95357a5166b0c15ad0fe135b28/caffe-20160312/scripts/cpp_lint.py#L1408-L1480 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/email/quoprimime.py | python | unquote | (s) | return chr(int(s[1:3], 16)) | Turn a string in the form =AB to the ASCII character with value 0xab | Turn a string in the form =AB to the ASCII character with value 0xab | [
"Turn",
"a",
"string",
"in",
"the",
"form",
"=",
"AB",
"to",
"the",
"ASCII",
"character",
"with",
"value",
"0xab"
] | def unquote(s):
"""Turn a string in the form =AB to the ASCII character with value 0xab"""
return chr(int(s[1:3], 16)) | [
"def",
"unquote",
"(",
"s",
")",
":",
"return",
"chr",
"(",
"int",
"(",
"s",
"[",
"1",
":",
"3",
"]",
",",
"16",
")",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/email/quoprimime.py#L118-L120 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/arrays/datetimelike.py | python | DatetimeLikeArrayMixin._add_delta_tdi | (self, other) | return new_values.view("i8") | Add a delta of a TimedeltaIndex
return the i8 result view | Add a delta of a TimedeltaIndex
return the i8 result view | [
"Add",
"a",
"delta",
"of",
"a",
"TimedeltaIndex",
"return",
"the",
"i8",
"result",
"view"
] | def _add_delta_tdi(self, other):
"""
Add a delta of a TimedeltaIndex
return the i8 result view
"""
if len(self) != len(other):
raise ValueError("cannot add indices of unequal length")
if isinstance(other, np.ndarray):
# ndarray[timedelta64]; wrap ... | [
"def",
"_add_delta_tdi",
"(",
"self",
",",
"other",
")",
":",
"if",
"len",
"(",
"self",
")",
"!=",
"len",
"(",
"other",
")",
":",
"raise",
"ValueError",
"(",
"\"cannot add indices of unequal length\"",
")",
"if",
"isinstance",
"(",
"other",
",",
"np",
".",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/arrays/datetimelike.py#L1159-L1181 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | MenuBar.GetMenu | (*args, **kwargs) | return _core_.MenuBar_GetMenu(*args, **kwargs) | GetMenu(self, size_t pos) -> Menu | GetMenu(self, size_t pos) -> Menu | [
"GetMenu",
"(",
"self",
"size_t",
"pos",
")",
"-",
">",
"Menu"
] | def GetMenu(*args, **kwargs):
"""GetMenu(self, size_t pos) -> Menu"""
return _core_.MenuBar_GetMenu(*args, **kwargs) | [
"def",
"GetMenu",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"MenuBar_GetMenu",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L12280-L12282 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | ppapi/generators/idl_parser.py | python | IDLParser.p_ext_attr_list | (self, p) | ext_attr_list : SYMBOL '=' SYMBOL ext_attr_cont
| SYMBOL '=' value ext_attr_cont
| SYMBOL '=' SYMBOL param_list ext_attr_cont
| SYMBOL ext_attr_cont | ext_attr_list : SYMBOL '=' SYMBOL ext_attr_cont
| SYMBOL '=' value ext_attr_cont
| SYMBOL '=' SYMBOL param_list ext_attr_cont
| SYMBOL ext_attr_cont | [
"ext_attr_list",
":",
"SYMBOL",
"=",
"SYMBOL",
"ext_attr_cont",
"|",
"SYMBOL",
"=",
"value",
"ext_attr_cont",
"|",
"SYMBOL",
"=",
"SYMBOL",
"param_list",
"ext_attr_cont",
"|",
"SYMBOL",
"ext_attr_cont"
] | def p_ext_attr_list(self, p):
"""ext_attr_list : SYMBOL '=' SYMBOL ext_attr_cont
| SYMBOL '=' value ext_attr_cont
| SYMBOL '=' SYMBOL param_list ext_attr_cont
| SYMBOL ext_attr_cont"""
# If there are 4 tokens plus a return slot, this must be in the ... | [
"def",
"p_ext_attr_list",
"(",
"self",
",",
"p",
")",
":",
"# If there are 4 tokens plus a return slot, this must be in the form",
"# SYMBOL = SYMBOL|value ext_attr_cont",
"if",
"len",
"(",
"p",
")",
"==",
"5",
":",
"p",
"[",
"0",
"]",
"=",
"ListFromConcat",
"(",
"s... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/ppapi/generators/idl_parser.py#L377-L394 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/boost_1_66_0/tools/build/src/build/property.py | python | PropertyMap.insert | (self, properties, value) | Associate value with properties. | Associate value with properties. | [
"Associate",
"value",
"with",
"properties",
"."
] | def insert (self, properties, value):
""" Associate value with properties.
"""
assert is_iterable_typed(properties, basestring)
assert isinstance(value, basestring)
self.__properties.append(properties)
self.__values.append(value) | [
"def",
"insert",
"(",
"self",
",",
"properties",
",",
"value",
")",
":",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"value",
",",
"basestring",
")",
"self",
".",
"__properties",
".",
"append",
"(",
... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/boost_1_66_0/tools/build/src/build/property.py#L590-L596 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/arrays/sparse.py | python | SparseArray.npoints | (self) | return self.sp_index.npoints | The number of non- ``fill_value`` points.
Examples
--------
>>> s = SparseArray([0, 0, 1, 1, 1], fill_value=0)
>>> s.npoints
3 | The number of non- ``fill_value`` points. | [
"The",
"number",
"of",
"non",
"-",
"fill_value",
"points",
"."
] | def npoints(self):
"""
The number of non- ``fill_value`` points.
Examples
--------
>>> s = SparseArray([0, 0, 1, 1, 1], fill_value=0)
>>> s.npoints
3
"""
return self.sp_index.npoints | [
"def",
"npoints",
"(",
"self",
")",
":",
"return",
"self",
".",
"sp_index",
".",
"npoints"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/arrays/sparse.py#L810-L820 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/distutils/command/install_egg_info.py | python | to_filename | (name) | return name.replace('-','_') | Convert a project or version name to its filename-escaped form
Any '-' characters are currently replaced with '_'. | Convert a project or version name to its filename-escaped form | [
"Convert",
"a",
"project",
"or",
"version",
"name",
"to",
"its",
"filename",
"-",
"escaped",
"form"
] | def to_filename(name):
"""Convert a project or version name to its filename-escaped form
Any '-' characters are currently replaced with '_'.
"""
return name.replace('-','_') | [
"def",
"to_filename",
"(",
"name",
")",
":",
"return",
"name",
".",
"replace",
"(",
"'-'",
",",
"'_'",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/distutils/command/install_egg_info.py#L73-L78 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/dispatcher.py | python | _DispatcherBase.typeof_pyval | (self, val) | return tp | Resolve the Numba type of Python value *val*.
This is called from numba._dispatcher as a fallback if the native code
cannot decide the type. | Resolve the Numba type of Python value *val*.
This is called from numba._dispatcher as a fallback if the native code
cannot decide the type. | [
"Resolve",
"the",
"Numba",
"type",
"of",
"Python",
"value",
"*",
"val",
"*",
".",
"This",
"is",
"called",
"from",
"numba",
".",
"_dispatcher",
"as",
"a",
"fallback",
"if",
"the",
"native",
"code",
"cannot",
"decide",
"the",
"type",
"."
] | def typeof_pyval(self, val):
"""
Resolve the Numba type of Python value *val*.
This is called from numba._dispatcher as a fallback if the native code
cannot decide the type.
"""
# Not going through the resolve_argument_type() indirection
# can save a couple µs.
... | [
"def",
"typeof_pyval",
"(",
"self",
",",
"val",
")",
":",
"# Not going through the resolve_argument_type() indirection",
"# can save a couple µs.",
"try",
":",
"tp",
"=",
"typeof",
"(",
"val",
",",
"Purpose",
".",
"argument",
")",
"except",
"ValueError",
":",
"tp",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/dispatcher.py#L595-L610 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_futures.py | python | _format_callbacks | (cb) | return f'cb=[{cb}]' | helper function for Future.__repr__ | helper function for Future.__repr__ | [
"helper",
"function",
"for",
"Future",
".",
"__repr__"
] | def _format_callbacks(cb):
"""helper function for Future.__repr__"""
size = len(cb)
if not size:
cb = ''
def format_cb(callback):
return format_helpers._format_callback_source(callback, ())
if size == 1:
cb = format_cb(cb[0][0])
elif size == 2:
cb = '{}, {}'.for... | [
"def",
"_format_callbacks",
"(",
"cb",
")",
":",
"size",
"=",
"len",
"(",
"cb",
")",
"if",
"not",
"size",
":",
"cb",
"=",
"''",
"def",
"format_cb",
"(",
"callback",
")",
":",
"return",
"format_helpers",
".",
"_format_callback_source",
"(",
"callback",
",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_futures.py#L34-L51 | |
esphome/esphome | 40e06c9819f17409615d4f4eec5cfe4dc9a3776d | esphome/cpp_generator.py | python | add_global | (expression: Union[SafeExpType, Statement]) | Add an expression to the codegen global storage (above setup()). | Add an expression to the codegen global storage (above setup()). | [
"Add",
"an",
"expression",
"to",
"the",
"codegen",
"global",
"storage",
"(",
"above",
"setup",
"()",
")",
"."
] | def add_global(expression: Union[SafeExpType, Statement]):
"""Add an expression to the codegen global storage (above setup())."""
CORE.add_global(expression) | [
"def",
"add_global",
"(",
"expression",
":",
"Union",
"[",
"SafeExpType",
",",
"Statement",
"]",
")",
":",
"CORE",
".",
"add_global",
"(",
"expression",
")"
] | https://github.com/esphome/esphome/blob/40e06c9819f17409615d4f4eec5cfe4dc9a3776d/esphome/cpp_generator.py#L563-L565 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/common_shapes.py | python | is_broadcast_compatible | (shape_x, shape_y) | return _broadcast_shape_helper(shape_x, shape_y) is not None | Returns True if `shape_x` and `shape_y` are broadcast compatible.
Args:
shape_x: A `TensorShape`
shape_y: A `TensorShape`
Returns:
True if a shape exists that both `shape_x` and `shape_y` can be broadcasted
to. False otherwise. | Returns True if `shape_x` and `shape_y` are broadcast compatible. | [
"Returns",
"True",
"if",
"shape_x",
"and",
"shape_y",
"are",
"broadcast",
"compatible",
"."
] | def is_broadcast_compatible(shape_x, shape_y):
"""Returns True if `shape_x` and `shape_y` are broadcast compatible.
Args:
shape_x: A `TensorShape`
shape_y: A `TensorShape`
Returns:
True if a shape exists that both `shape_x` and `shape_y` can be broadcasted
to. False otherwise.
"""
if shape_... | [
"def",
"is_broadcast_compatible",
"(",
"shape_x",
",",
"shape_y",
")",
":",
"if",
"shape_x",
".",
"ndims",
"is",
"None",
"or",
"shape_y",
".",
"ndims",
"is",
"None",
":",
"return",
"False",
"return",
"_broadcast_shape_helper",
"(",
"shape_x",
",",
"shape_y",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/common_shapes.py#L562-L575 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/ftplib.py | python | FTP.retrbinary | (self, cmd, callback, blocksize=8192, rest=None) | return self.voidresp() | Retrieve data in binary mode. A new port is created for you.
Args:
cmd: A RETR command.
callback: A single parameter callable to be called on each
block of data read.
blocksize: The maximum number of bytes to read from the
socket at one ti... | Retrieve data in binary mode. A new port is created for you. | [
"Retrieve",
"data",
"in",
"binary",
"mode",
".",
"A",
"new",
"port",
"is",
"created",
"for",
"you",
"."
] | def retrbinary(self, cmd, callback, blocksize=8192, rest=None):
"""Retrieve data in binary mode. A new port is created for you.
Args:
cmd: A RETR command.
callback: A single parameter callable to be called on each
block of data read.
blocksize: The max... | [
"def",
"retrbinary",
"(",
"self",
",",
"cmd",
",",
"callback",
",",
"blocksize",
"=",
"8192",
",",
"rest",
"=",
"None",
")",
":",
"self",
".",
"voidcmd",
"(",
"'TYPE I'",
")",
"conn",
"=",
"self",
".",
"transfercmd",
"(",
"cmd",
",",
"rest",
")",
"... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/ftplib.py#L379-L401 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py | python | Filterer.removeFilter | (self, filter) | Remove the specified filter from this handler. | Remove the specified filter from this handler. | [
"Remove",
"the",
"specified",
"filter",
"from",
"this",
"handler",
"."
] | def removeFilter(self, filter):
"""
Remove the specified filter from this handler.
"""
if filter in self.filters:
self.filters.remove(filter) | [
"def",
"removeFilter",
"(",
"self",
",",
"filter",
")",
":",
"if",
"filter",
"in",
"self",
".",
"filters",
":",
"self",
".",
"filters",
".",
"remove",
"(",
"filter",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py#L729-L734 | ||
Constellation/iv | 64c3a9c7c517063f29d90d449180ea8f6f4d946f | tools/cpplint.py | python | CheckForCopyright | (filename, lines, error) | Logs an error if no Copyright message appears at the top of the file. | Logs an error if no Copyright message appears at the top of the file. | [
"Logs",
"an",
"error",
"if",
"no",
"Copyright",
"message",
"appears",
"at",
"the",
"top",
"of",
"the",
"file",
"."
] | def CheckForCopyright(filename, lines, error):
"""Logs an error if no Copyright message appears at the top of the file."""
# We'll say it should occur by line 10. Don't forget there's a
# dummy line at the front.
for line in xrange(1, min(len(lines), 11)):
if re.search(r'Copyright', lines[line], re.I): bre... | [
"def",
"CheckForCopyright",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"# We'll say it should occur by line 10. Don't forget there's a",
"# dummy line at the front.",
"for",
"line",
"in",
"xrange",
"(",
"1",
",",
"min",
"(",
"len",
"(",
"lines",
")",
","... | https://github.com/Constellation/iv/blob/64c3a9c7c517063f29d90d449180ea8f6f4d946f/tools/cpplint.py#L1360-L1370 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.