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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
eerolanguage/clang | 91360bee004a1cbdb95fe5eb605ef243152da41b | bindings/python/clang/cindex.py | python | TokenKind.__init__ | (self, value, name) | Create a new TokenKind instance from a numeric value and a name. | Create a new TokenKind instance from a numeric value and a name. | [
"Create",
"a",
"new",
"TokenKind",
"instance",
"from",
"a",
"numeric",
"value",
"and",
"a",
"name",
"."
] | def __init__(self, value, name):
"""Create a new TokenKind instance from a numeric value and a name."""
self.value = value
self.name = name | [
"def",
"__init__",
"(",
"self",
",",
"value",
",",
"name",
")",
":",
"self",
".",
"value",
"=",
"value",
"self",
".",
"name",
"=",
"name"
] | https://github.com/eerolanguage/clang/blob/91360bee004a1cbdb95fe5eb605ef243152da41b/bindings/python/clang/cindex.py#L466-L469 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/stc.py | python | StyledTextCtrl.GetMaxLineState | (*args, **kwargs) | return _stc.StyledTextCtrl_GetMaxLineState(*args, **kwargs) | GetMaxLineState(self) -> int
Retrieve the last line number that has line state. | GetMaxLineState(self) -> int | [
"GetMaxLineState",
"(",
"self",
")",
"-",
">",
"int"
] | def GetMaxLineState(*args, **kwargs):
"""
GetMaxLineState(self) -> int
Retrieve the last line number that has line state.
"""
return _stc.StyledTextCtrl_GetMaxLineState(*args, **kwargs) | [
"def",
"GetMaxLineState",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_GetMaxLineState",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/stc.py#L2979-L2985 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/robotsim.py | python | TransformPoser.set | (self, R, t) | return _robotsim.TransformPoser_set(self, R, t) | set(TransformPoser self, double const [9] R, double const [3] t) | set(TransformPoser self, double const [9] R, double const [3] t) | [
"set",
"(",
"TransformPoser",
"self",
"double",
"const",
"[",
"9",
"]",
"R",
"double",
"const",
"[",
"3",
"]",
"t",
")"
] | def set(self, R, t):
"""
set(TransformPoser self, double const [9] R, double const [3] t)
"""
return _robotsim.TransformPoser_set(self, R, t) | [
"def",
"set",
"(",
"self",
",",
"R",
",",
"t",
")",
":",
"return",
"_robotsim",
".",
"TransformPoser_set",
"(",
"self",
",",
"R",
",",
"t",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/robotsim.py#L3252-L3259 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/OpenSCAD/OpenSCAD2Dgeom.py | python | subtractfaces2 | (faces) | return fusefaces([subtractfaces(facegroup) for facegroup in findoverlappingfaces(faces)]) | Sort faces, check if they overlap. Subtract overlapping face and fuse
nonoverlapping groups. | Sort faces, check if they overlap. Subtract overlapping face and fuse
nonoverlapping groups. | [
"Sort",
"faces",
"check",
"if",
"they",
"overlap",
".",
"Subtract",
"overlapping",
"face",
"and",
"fuse",
"nonoverlapping",
"groups",
"."
] | def subtractfaces2(faces):
'''Sort faces, check if they overlap. Subtract overlapping face and fuse
nonoverlapping groups.'''
return fusefaces([subtractfaces(facegroup) for facegroup in findoverlappingfaces(faces)]) | [
"def",
"subtractfaces2",
"(",
"faces",
")",
":",
"return",
"fusefaces",
"(",
"[",
"subtractfaces",
"(",
"facegroup",
")",
"for",
"facegroup",
"in",
"findoverlappingfaces",
"(",
"faces",
")",
"]",
")"
] | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/OpenSCAD/OpenSCAD2Dgeom.py#L367-L370 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/wsgiref/handlers.py | python | BaseHandler._flush | (self) | Override in subclass to force sending of recent '_write()' calls
It's okay if this method is a no-op (i.e., if '_write()' actually
sends the data. | Override in subclass to force sending of recent '_write()' calls | [
"Override",
"in",
"subclass",
"to",
"force",
"sending",
"of",
"recent",
"_write",
"()",
"calls"
] | def _flush(self):
"""Override in subclass to force sending of recent '_write()' calls
It's okay if this method is a no-op (i.e., if '_write()' actually
sends the data.
"""
raise NotImplementedError | [
"def",
"_flush",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/wsgiref/handlers.py#L337-L343 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/lib/pretty.py | python | pprint | (obj, verbose=False, max_width=79, newline='\n', max_seq_length=MAX_SEQ_LENGTH) | Like `pretty` but print to stdout. | Like `pretty` but print to stdout. | [
"Like",
"pretty",
"but",
"print",
"to",
"stdout",
"."
] | def pprint(obj, verbose=False, max_width=79, newline='\n', max_seq_length=MAX_SEQ_LENGTH):
"""
Like `pretty` but print to stdout.
"""
printer = RepresentationPrinter(sys.stdout, verbose, max_width, newline, max_seq_length=max_seq_length)
printer.pretty(obj)
printer.flush()
sys.stdout.write(n... | [
"def",
"pprint",
"(",
"obj",
",",
"verbose",
"=",
"False",
",",
"max_width",
"=",
"79",
",",
"newline",
"=",
"'\\n'",
",",
"max_seq_length",
"=",
"MAX_SEQ_LENGTH",
")",
":",
"printer",
"=",
"RepresentationPrinter",
"(",
"sys",
".",
"stdout",
",",
"verbose"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/lib/pretty.py#L147-L155 | ||
chromiumembedded/cef | 80caf947f3fe2210e5344713c5281d8af9bdc295 | tools/yapf/yapf/yapflib/comment_splicer.py | python | SpliceComments | (tree) | Given a pytree, splice comments into nodes of their own right.
Extract comments from the prefixes where they are housed after parsing.
The prefixes that previously housed the comments become empty.
Args:
tree: a pytree.Node - the tree to work on. The tree is modified by this
function. | Given a pytree, splice comments into nodes of their own right. | [
"Given",
"a",
"pytree",
"splice",
"comments",
"into",
"nodes",
"of",
"their",
"own",
"right",
"."
] | def SpliceComments(tree):
"""Given a pytree, splice comments into nodes of their own right.
Extract comments from the prefixes where they are housed after parsing.
The prefixes that previously housed the comments become empty.
Args:
tree: a pytree.Node - the tree to work on. The tree is modified by this
... | [
"def",
"SpliceComments",
"(",
"tree",
")",
":",
"# The previous leaf node encountered in the traversal.",
"# This is a list because Python 2.x doesn't have 'nonlocal' :)",
"prev_leaf",
"=",
"[",
"None",
"]",
"_AnnotateIndents",
"(",
"tree",
")",
"def",
"_VisitNodeRec",
"(",
"... | https://github.com/chromiumembedded/cef/blob/80caf947f3fe2210e5344713c5281d8af9bdc295/tools/yapf/yapf/yapflib/comment_splicer.py#L31-L202 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/logging/handlers.py | python | SocketHandler.close | (self) | Closes the socket. | Closes the socket. | [
"Closes",
"the",
"socket",
"."
] | def close(self):
"""
Closes the socket.
"""
self.acquire()
try:
sock = self.sock
if sock:
self.sock = None
sock.close()
logging.Handler.close(self)
finally:
self.release() | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"acquire",
"(",
")",
"try",
":",
"sock",
"=",
"self",
".",
"sock",
"if",
"sock",
":",
"self",
".",
"sock",
"=",
"None",
"sock",
".",
"close",
"(",
")",
"logging",
".",
"Handler",
".",
"close",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/logging/handlers.py#L636-L648 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/summary/impl/io_wrapper.py | python | IsDirectory | (path) | Returns true if path exists and is a directory. | Returns true if path exists and is a directory. | [
"Returns",
"true",
"if",
"path",
"exists",
"and",
"is",
"a",
"directory",
"."
] | def IsDirectory(path):
"""Returns true if path exists and is a directory."""
if gcs.IsGCSPath(path):
return gcs.IsDirectory(path)
else:
return gfile.IsDirectory(path) | [
"def",
"IsDirectory",
"(",
"path",
")",
":",
"if",
"gcs",
".",
"IsGCSPath",
"(",
"path",
")",
":",
"return",
"gcs",
".",
"IsDirectory",
"(",
"path",
")",
"else",
":",
"return",
"gfile",
".",
"IsDirectory",
"(",
"path",
")"
] | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/summary/impl/io_wrapper.py#L81-L86 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/requests_toolbelt/threaded/thread.py | python | SessionThread.join | (self) | Join this thread to the master thread. | Join this thread to the master thread. | [
"Join",
"this",
"thread",
"to",
"the",
"master",
"thread",
"."
] | def join(self):
"""Join this thread to the master thread."""
self._worker.join() | [
"def",
"join",
"(",
"self",
")",
":",
"self",
".",
"_worker",
".",
"join",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/requests_toolbelt/threaded/thread.py#L51-L53 | ||
stereolabs/zed-examples | ed3f068301fbdf3898f7c42de864dc578467e061 | object detection/birds eye viewer/python/batch_system_handler.py | python | BatchSystemHandler.pop_objects | (self, objects) | pop_objects
pop data (objects data only) from the FIFO system
Parameters:
objects (sl.Objects): objects in the past | pop_objects
pop data (objects data only) from the FIFO system
Parameters:
objects (sl.Objects): objects in the past | [
"pop_objects",
"pop",
"data",
"(",
"objects",
"data",
"only",
")",
"from",
"the",
"FIFO",
"system",
"Parameters",
":",
"objects",
"(",
"sl",
".",
"Objects",
")",
":",
"objects",
"in",
"the",
"past"
] | def pop_objects(self, objects):
'''
pop_objects
pop data (objects data only) from the FIFO system
Parameters:
objects (sl.Objects): objects in the past
'''
if self.objects_tracked_queue:
tracked_merged_obj = self.objects_tracked_queue[... | [
"def",
"pop_objects",
"(",
"self",
",",
"objects",
")",
":",
"if",
"self",
".",
"objects_tracked_queue",
":",
"tracked_merged_obj",
"=",
"self",
".",
"objects_tracked_queue",
"[",
"0",
"]",
"objects",
"=",
"tracked_merged_obj",
"self",
".",
"objects_tracked_queue"... | https://github.com/stereolabs/zed-examples/blob/ed3f068301fbdf3898f7c42de864dc578467e061/object detection/birds eye viewer/python/batch_system_handler.py#L134-L145 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | examples/python/gdbremote.py | python | TerminalColors.red | (self, fg=True) | return '' | Set the foreground or background color to red.
The foreground color will be set if "fg" tests True. The background color will be set if "fg" tests False. | Set the foreground or background color to red.
The foreground color will be set if "fg" tests True. The background color will be set if "fg" tests False. | [
"Set",
"the",
"foreground",
"or",
"background",
"color",
"to",
"red",
".",
"The",
"foreground",
"color",
"will",
"be",
"set",
"if",
"fg",
"tests",
"True",
".",
"The",
"background",
"color",
"will",
"be",
"set",
"if",
"fg",
"tests",
"False",
"."
] | def red(self, fg=True):
'''Set the foreground or background color to red.
The foreground color will be set if "fg" tests True. The background color will be set if "fg" tests False.'''
if self.enabled:
if fg:
return "\x1b[31m"
else:
return "... | [
"def",
"red",
"(",
"self",
",",
"fg",
"=",
"True",
")",
":",
"if",
"self",
".",
"enabled",
":",
"if",
"fg",
":",
"return",
"\"\\x1b[31m\"",
"else",
":",
"return",
"\"\\x1b[41m\"",
"return",
"''"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/examples/python/gdbremote.py#L110-L118 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/client/timeline.py | python | Timeline._show_memory_counters | (self) | Produce a counter series for each memory allocator. | Produce a counter series for each memory allocator. | [
"Produce",
"a",
"counter",
"series",
"for",
"each",
"memory",
"allocator",
"."
] | def _show_memory_counters(self):
"""Produce a counter series for each memory allocator."""
# Iterate over all tensor trackers to build a list of allocations and
# frees for each allocator. Then sort the lists and emit a cumulative
# counter series for each allocator.
allocations = {}
for name in... | [
"def",
"_show_memory_counters",
"(",
"self",
")",
":",
"# Iterate over all tensor trackers to build a list of allocations and",
"# frees for each allocator. Then sort the lists and emit a cumulative",
"# counter series for each allocator.",
"allocations",
"=",
"{",
"}",
"for",
"name",
... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/client/timeline.py#L557-L600 | ||
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Autocoders/Python/src/fprime_ac/utils/pyparsing.py | python | ParserElement.setDebug | (self, flag=True) | return self | Enable display of debugging messages while doing pattern matching. | Enable display of debugging messages while doing pattern matching. | [
"Enable",
"display",
"of",
"debugging",
"messages",
"while",
"doing",
"pattern",
"matching",
"."
] | def setDebug(self, flag=True):
"""Enable display of debugging messages while doing pattern matching."""
if flag:
self.setDebugActions(
_defaultStartDebugAction,
_defaultSuccessDebugAction,
_defaultExceptionDebugAction,
)
els... | [
"def",
"setDebug",
"(",
"self",
",",
"flag",
"=",
"True",
")",
":",
"if",
"flag",
":",
"self",
".",
"setDebugActions",
"(",
"_defaultStartDebugAction",
",",
"_defaultSuccessDebugAction",
",",
"_defaultExceptionDebugAction",
",",
")",
"else",
":",
"self",
".",
... | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/utils/pyparsing.py#L1131-L1141 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/telemetry/telemetry/core/platform/power_monitor/powermetrics_power_monitor.py | python | PowerMetricsPowerMonitor.ParsePowerMetricsOutput | (powermetrics_output) | return out_dict | Parse output of powermetrics command line utility.
Returns:
Dictionary in the format returned by StopMonitoringPowerAsync(). | Parse output of powermetrics command line utility. | [
"Parse",
"output",
"of",
"powermetrics",
"command",
"line",
"utility",
"."
] | def ParsePowerMetricsOutput(powermetrics_output):
"""Parse output of powermetrics command line utility.
Returns:
Dictionary in the format returned by StopMonitoringPowerAsync().
"""
# Container to collect samples for running averages.
# out_path - list containing the key path in the output... | [
"def",
"ParsePowerMetricsOutput",
"(",
"powermetrics_output",
")",
":",
"# Container to collect samples for running averages.",
"# out_path - list containing the key path in the output dictionary.",
"# src_path - list containing the key path to get the data from in",
"# powermetrics' output.",
... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/telemetry/telemetry/core/platform/power_monitor/powermetrics_power_monitor.py#L83-L233 | |
cmu-db/noisepage | 79276e68fe83322f1249e8a8be96bd63c583ae56 | build-support/cpplint.py | python | _IncludeState.CanonicalizeAlphabeticalOrder | (self, header_path) | return header_path.replace('-inl.h', '.h').replace('-', '_').lower() | Returns a path canonicalized for alphabetical comparison.
- replaces "-" with "_" so they both cmp the same.
- removes '-inl' since we don't require them to be after the main header.
- lowercase everything, just in case.
Args:
header_path: Path to be canonicalized.
Returns:
Canonicali... | Returns a path canonicalized for alphabetical comparison. | [
"Returns",
"a",
"path",
"canonicalized",
"for",
"alphabetical",
"comparison",
"."
] | def CanonicalizeAlphabeticalOrder(self, header_path):
"""Returns a path canonicalized for alphabetical comparison.
- replaces "-" with "_" so they both cmp the same.
- removes '-inl' since we don't require them to be after the main header.
- lowercase everything, just in case.
Args:
head... | [
"def",
"CanonicalizeAlphabeticalOrder",
"(",
"self",
",",
"header_path",
")",
":",
"return",
"header_path",
".",
"replace",
"(",
"'-inl.h'",
",",
"'.h'",
")",
".",
"replace",
"(",
"'-'",
",",
"'_'",
")",
".",
"lower",
"(",
")"
] | https://github.com/cmu-db/noisepage/blob/79276e68fe83322f1249e8a8be96bd63c583ae56/build-support/cpplint.py#L914-L927 | |
nnrg/opennero | 43e12a1bcba6e228639db3886fec1dc47ddc24cb | mods/common/module.py | python | startScript | (script) | start the named script unless it is already running | start the named script unless it is already running | [
"start",
"the",
"named",
"script",
"unless",
"it",
"is",
"already",
"running"
] | def startScript(script):
"""
start the named script unless it is already running
"""
global opennero_sub_procs
if script not in opennero_sub_procs:
subproc = subprocess.Popen(['python', script])
opennero_sub_procs[script] = subproc
elif opennero_sub_procs[script].poll():
... | [
"def",
"startScript",
"(",
"script",
")",
":",
"global",
"opennero_sub_procs",
"if",
"script",
"not",
"in",
"opennero_sub_procs",
":",
"subproc",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"'python'",
",",
"script",
"]",
")",
"opennero_sub_procs",
"[",
"script... | https://github.com/nnrg/opennero/blob/43e12a1bcba6e228639db3886fec1dc47ddc24cb/mods/common/module.py#L64-L75 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/_vendor/pyparsing.py | python | ParserElement.setDefaultWhitespaceChars | ( chars ) | r"""
Overrides the default whitespace chars
Example::
# default whitespace chars are space, <TAB> and newline
OneOrMore(Word(alphas)).parseString("abc def\nghi jkl") # -> ['abc', 'def', 'ghi', 'jkl']
# change to just treat newline as significant
... | r"""
Overrides the default whitespace chars | [
"r",
"Overrides",
"the",
"default",
"whitespace",
"chars"
] | def setDefaultWhitespaceChars( chars ):
r"""
Overrides the default whitespace chars
Example::
# default whitespace chars are space, <TAB> and newline
OneOrMore(Word(alphas)).parseString("abc def\nghi jkl") # -> ['abc', 'def', 'ghi', 'jkl']
# cha... | [
"def",
"setDefaultWhitespaceChars",
"(",
"chars",
")",
":",
"ParserElement",
".",
"DEFAULT_WHITE_CHARS",
"=",
"chars"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/_vendor/pyparsing.py#L1086-L1098 | ||
ArduPilot/ardupilot | 6e684b3496122b8158ac412b609d00004b7ac306 | libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py | python | generic_pin.is_RTS | (self) | return False | return true if this is a RTS pin | return true if this is a RTS pin | [
"return",
"true",
"if",
"this",
"is",
"a",
"RTS",
"pin"
] | def is_RTS(self):
'''return true if this is a RTS pin'''
if self.label and self.label.endswith("_RTS") and (
self.type.startswith('USART') or self.type.startswith('UART')):
return True
return False | [
"def",
"is_RTS",
"(",
"self",
")",
":",
"if",
"self",
".",
"label",
"and",
"self",
".",
"label",
".",
"endswith",
"(",
"\"_RTS\"",
")",
"and",
"(",
"self",
".",
"type",
".",
"startswith",
"(",
"'USART'",
")",
"or",
"self",
".",
"type",
".",
"starts... | https://github.com/ArduPilot/ardupilot/blob/6e684b3496122b8158ac412b609d00004b7ac306/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py#L291-L296 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/symbol/contrib.py | python | rand_zipfian | (true_classes, num_sampled, range_max) | return sampled_classes, expected_count_true, expected_count_sampled | Draw random samples from an approximately log-uniform or Zipfian distribution.
This operation randomly samples *num_sampled* candidates the range of integers [0, range_max).
The elements of sampled_candidates are drawn with replacement from the base distribution.
The base distribution for this operator is... | Draw random samples from an approximately log-uniform or Zipfian distribution. | [
"Draw",
"random",
"samples",
"from",
"an",
"approximately",
"log",
"-",
"uniform",
"or",
"Zipfian",
"distribution",
"."
] | def rand_zipfian(true_classes, num_sampled, range_max):
"""Draw random samples from an approximately log-uniform or Zipfian distribution.
This operation randomly samples *num_sampled* candidates the range of integers [0, range_max).
The elements of sampled_candidates are drawn with replacement from the bas... | [
"def",
"rand_zipfian",
"(",
"true_classes",
",",
"num_sampled",
",",
"range_max",
")",
":",
"assert",
"(",
"isinstance",
"(",
"true_classes",
",",
"Symbol",
")",
")",
",",
"\"unexpected type %s\"",
"%",
"type",
"(",
"true_classes",
")",
"log_range",
"=",
"math... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/symbol/contrib.py#L39-L98 | |
livecode/livecode | 4606a10ea10b16d5071d0f9f263ccdd7ede8b31d | gyp/pylib/gyp/msvs_emulation.py | python | ExpandMacros | (string, expansions) | return string | Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv
for the canonical way to retrieve a suitable dict. | Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv
for the canonical way to retrieve a suitable dict. | [
"Expand",
"$",
"(",
"Variable",
")",
"per",
"expansions",
"dict",
".",
"See",
"MsvsSettings",
".",
"GetVSMacroEnv",
"for",
"the",
"canonical",
"way",
"to",
"retrieve",
"a",
"suitable",
"dict",
"."
] | def ExpandMacros(string, expansions):
"""Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv
for the canonical way to retrieve a suitable dict."""
if '$' in string:
for old, new in expansions.iteritems():
assert '$(' not in new, new
string = string.replace(old, new)
return str... | [
"def",
"ExpandMacros",
"(",
"string",
",",
"expansions",
")",
":",
"if",
"'$'",
"in",
"string",
":",
"for",
"old",
",",
"new",
"in",
"expansions",
".",
"iteritems",
"(",
")",
":",
"assert",
"'$('",
"not",
"in",
"new",
",",
"new",
"string",
"=",
"stri... | https://github.com/livecode/livecode/blob/4606a10ea10b16d5071d0f9f263ccdd7ede8b31d/gyp/pylib/gyp/msvs_emulation.py#L930-L937 | |
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | applications/CoSimulationApplication/python_scripts/base_classes/co_simulation_io.py | python | CoSimulationIO.ImportData | (self, data_config) | Imports data from an external solver
External solver sends, CoSimulation receives
@param data_config <python dictionary> : configuration of the data to be imported | Imports data from an external solver
External solver sends, CoSimulation receives | [
"Imports",
"data",
"from",
"an",
"external",
"solver",
"External",
"solver",
"sends",
"CoSimulation",
"receives"
] | def ImportData(self, data_config):
"""Imports data from an external solver
External solver sends, CoSimulation receives
@param data_config <python dictionary> : configuration of the data to be imported
"""
raise NotImplementedError("This function has to be implemented in the der... | [
"def",
"ImportData",
"(",
"self",
",",
"data_config",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"This function has to be implemented in the derived class!\"",
")"
] | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/CoSimulationApplication/python_scripts/base_classes/co_simulation_io.py#L42-L48 | ||
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/image/detection.py | python | DetRandomCropAug.__call__ | (self, src, label) | return (src, label) | Augmenter implementation body | Augmenter implementation body | [
"Augmenter",
"implementation",
"body"
] | def __call__(self, src, label):
"""Augmenter implementation body"""
crop = self._random_crop_proposal(label, src.shape[0], src.shape[1])
if crop:
x, y, w, h, label = crop
src = fixed_crop(src, x, y, w, h, None)
return (src, label) | [
"def",
"__call__",
"(",
"self",
",",
"src",
",",
"label",
")",
":",
"crop",
"=",
"self",
".",
"_random_crop_proposal",
"(",
"label",
",",
"src",
".",
"shape",
"[",
"0",
"]",
",",
"src",
".",
"shape",
"[",
"1",
"]",
")",
"if",
"crop",
":",
"x",
... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/image/detection.py#L205-L211 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/generic.py | python | NDFrame._constructor | (self) | Used when a manipulation result has the same dimensions as the
original. | Used when a manipulation result has the same dimensions as the
original. | [
"Used",
"when",
"a",
"manipulation",
"result",
"has",
"the",
"same",
"dimensions",
"as",
"the",
"original",
"."
] | def _constructor(self):
"""Used when a manipulation result has the same dimensions as the
original.
"""
raise AbstractMethodError(self) | [
"def",
"_constructor",
"(",
"self",
")",
":",
"raise",
"AbstractMethodError",
"(",
"self",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/generic.py#L196-L200 | ||
Smorodov/Multitarget-tracker | bee300e8bfd660c86cbeb6892c65a5b7195c9381 | thirdparty/pybind11/tools/clang/cindex.py | python | Cursor.get_template_argument_type | (self, num) | return conf.lib.clang_Cursor_getTemplateArgumentType(self, num) | Returns the CXType for the indicated template argument. | Returns the CXType for the indicated template argument. | [
"Returns",
"the",
"CXType",
"for",
"the",
"indicated",
"template",
"argument",
"."
] | def get_template_argument_type(self, num):
"""Returns the CXType for the indicated template argument."""
return conf.lib.clang_Cursor_getTemplateArgumentType(self, num) | [
"def",
"get_template_argument_type",
"(",
"self",
",",
"num",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_Cursor_getTemplateArgumentType",
"(",
"self",
",",
"num",
")"
] | https://github.com/Smorodov/Multitarget-tracker/blob/bee300e8bfd660c86cbeb6892c65a5b7195c9381/thirdparty/pybind11/tools/clang/cindex.py#L1631-L1633 | |
BogdanDIA/gr-dvbt | 79e1c54ef3bd66906c2d94dbc383c35c17b3f088 | docs/doxygen/swig_doc.py | python | make_class_entry | (klass, description=None) | return "\n\n".join(output) | Create a class docstring for a swig interface file. | Create a class docstring for a swig interface file. | [
"Create",
"a",
"class",
"docstring",
"for",
"a",
"swig",
"interface",
"file",
"."
] | def make_class_entry(klass, description=None):
"""
Create a class docstring for a swig interface file.
"""
output = []
output.append(make_entry(klass, description=description))
for func in klass.in_category(DoxyFunction):
name = klass.name() + '::' + func.name()
output.append(mak... | [
"def",
"make_class_entry",
"(",
"klass",
",",
"description",
"=",
"None",
")",
":",
"output",
"=",
"[",
"]",
"output",
".",
"append",
"(",
"make_entry",
"(",
"klass",
",",
"description",
"=",
"description",
")",
")",
"for",
"func",
"in",
"klass",
".",
... | https://github.com/BogdanDIA/gr-dvbt/blob/79e1c54ef3bd66906c2d94dbc383c35c17b3f088/docs/doxygen/swig_doc.py#L136-L145 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/setuptools/__init__.py | python | PackageFinder._find_packages_iter | (cls, where, exclude, include) | All the packages found in 'where' that pass the 'include' filter, but
not the 'exclude' filter. | All the packages found in 'where' that pass the 'include' filter, but
not the 'exclude' filter. | [
"All",
"the",
"packages",
"found",
"in",
"where",
"that",
"pass",
"the",
"include",
"filter",
"but",
"not",
"the",
"exclude",
"filter",
"."
] | def _find_packages_iter(cls, where, exclude, include):
"""
All the packages found in 'where' that pass the 'include' filter, but
not the 'exclude' filter.
"""
for root, dirs, files in os.walk(where, followlinks=True):
# Copy dirs to iterate over it, then empty dirs.
... | [
"def",
"_find_packages_iter",
"(",
"cls",
",",
"where",
",",
"exclude",
",",
"include",
")",
":",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"where",
",",
"followlinks",
"=",
"True",
")",
":",
"# Copy dirs to iterate over it, t... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/setuptools/__init__.py#L71-L96 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/index/collector.py | python | with_cached_html_pages | (
fn, # type: Callable[[HTMLPage], Iterable[Link]]
) | return wrapper_wrapper | Given a function that parses an Iterable[Link] from an HTMLPage, cache the
function's result (keyed by CacheablePageContent), unless the HTMLPage
`page` has `page.cache_link_parsing == False`. | [] | def with_cached_html_pages(
fn, # type: Callable[[HTMLPage], Iterable[Link]]
):
# type: (...) -> Callable[[HTMLPage], List[Link]]
"""
Given a function that parses an Iterable[Link] from an HTMLPage, cache the
function's result (keyed by CacheablePageContent), unless the HTMLPage
`page`... | [
"def",
"with_cached_html_pages",
"(",
"fn",
",",
"# type: Callable[[HTMLPage], Iterable[Link]]",
")",
":",
"# type: (...) -> Callable[[HTMLPage], List[Link]]",
"@",
"functools",
".",
"lru_cache",
"(",
"maxsize",
"=",
"None",
")",
"def",
"wrapper",
"(",
"cacheable_page",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/index/collector.py#L605-L649 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/copy_reg.py | python | add_extension | (module, name, code) | Register an extension code. | Register an extension code. | [
"Register",
"an",
"extension",
"code",
"."
] | def add_extension(module, name, code):
"""Register an extension code."""
code = int(code)
if not 1 <= code <= 0x7fffffff:
raise ValueError, "code out of range"
key = (module, name)
if (_extension_registry.get(key) == code and
_inverted_registry.get(code) == key):
return # Red... | [
"def",
"add_extension",
"(",
"module",
",",
"name",
",",
"code",
")",
":",
"code",
"=",
"int",
"(",
"code",
")",
"if",
"not",
"1",
"<=",
"code",
"<=",
"0x7fffffff",
":",
"raise",
"ValueError",
",",
"\"code out of range\"",
"key",
"=",
"(",
"module",
",... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/copy_reg.py#L157-L173 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBThread.GetStopDescription | (self, dst) | return _lldb.SBThread_GetStopDescription(self, dst) | Pass only an (int)length and expect to get a Python string describing the
stop reason. | [] | def GetStopDescription(self, dst):
"""
Pass only an (int)length and expect to get a Python string describing the
stop reason.
"""
return _lldb.SBThread_GetStopDescription(self, dst) | [
"def",
"GetStopDescription",
"(",
"self",
",",
"dst",
")",
":",
"return",
"_lldb",
".",
"SBThread_GetStopDescription",
"(",
"self",
",",
"dst",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L11577-L11583 | ||
LLNL/lbann | 26083e6c86050302ce33148aea70f62e61cacb92 | applications/nlp/utils/gutenberg.py | python | GutenbergCorpus.__len__ | (self) | return self.token_data.__len__() | Get total number of tokens in corpus. | Get total number of tokens in corpus. | [
"Get",
"total",
"number",
"of",
"tokens",
"in",
"corpus",
"."
] | def __len__(self):
"""Get total number of tokens in corpus."""
return self.token_data.__len__() | [
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"self",
".",
"token_data",
".",
"__len__",
"(",
")"
] | https://github.com/LLNL/lbann/blob/26083e6c86050302ce33148aea70f62e61cacb92/applications/nlp/utils/gutenberg.py#L144-L146 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_misc.py | python | MetafileDataObject.SetMetafile | (*args, **kwargs) | return _misc_.MetafileDataObject_SetMetafile(*args, **kwargs) | SetMetafile(self, MetaFile metafile) | SetMetafile(self, MetaFile metafile) | [
"SetMetafile",
"(",
"self",
"MetaFile",
"metafile",
")"
] | def SetMetafile(*args, **kwargs):
"""SetMetafile(self, MetaFile metafile)"""
return _misc_.MetafileDataObject_SetMetafile(*args, **kwargs) | [
"def",
"SetMetafile",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"MetafileDataObject_SetMetafile",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_misc.py#L5469-L5471 | |
vslavik/poedit | f7a9daa0a10037e090aa0a86f5ce0f24ececdf6a | deps/boost/tools/build/src/build/feature.py | python | is_implicit_value | (value_string) | return True | Returns true iff 'value_string' is a value_string
of an implicit feature. | Returns true iff 'value_string' is a value_string
of an implicit feature. | [
"Returns",
"true",
"iff",
"value_string",
"is",
"a",
"value_string",
"of",
"an",
"implicit",
"feature",
"."
] | def is_implicit_value (value_string):
""" Returns true iff 'value_string' is a value_string
of an implicit feature.
"""
assert isinstance(value_string, basestring)
if value_string in __implicit_features:
return __implicit_features[value_string]
v = value_string.split('-')
if v[0] n... | [
"def",
"is_implicit_value",
"(",
"value_string",
")",
":",
"assert",
"isinstance",
"(",
"value_string",
",",
"basestring",
")",
"if",
"value_string",
"in",
"__implicit_features",
":",
"return",
"__implicit_features",
"[",
"value_string",
"]",
"v",
"=",
"value_string... | https://github.com/vslavik/poedit/blob/f7a9daa0a10037e090aa0a86f5ce0f24ececdf6a/deps/boost/tools/build/src/build/feature.py#L222-L241 | |
mapnik/mapnik | f3da900c355e1d15059c4a91b00203dcc9d9f0ef | scons/scons-local-4.1.0/SCons/Tool/yacc.py | python | generate | (env) | Add Builders and construction variables for yacc to an Environment. | Add Builders and construction variables for yacc to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"yacc",
"to",
"an",
"Environment",
"."
] | def generate(env):
"""Add Builders and construction variables for yacc to an Environment."""
c_file, cxx_file = SCons.Tool.createCFileBuilders(env)
# C
c_file.add_action('.y', YaccAction)
c_file.add_emitter('.y', yEmitter)
c_file.add_action('.yacc', YaccAction)
c_file.add_emitter('.yacc', ... | [
"def",
"generate",
"(",
"env",
")",
":",
"c_file",
",",
"cxx_file",
"=",
"SCons",
".",
"Tool",
".",
"createCFileBuilders",
"(",
"env",
")",
"# C",
"c_file",
".",
"add_action",
"(",
"'.y'",
",",
"YaccAction",
")",
"c_file",
".",
"add_emitter",
"(",
"'.y'"... | https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/Tool/yacc.py#L131-L161 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/json_schema_compiler/h_generator.py | python | _Generator._GenerateParams | (self, params) | return ', '.join(str(p) for p in params) | Builds the parameter list for a function, given an array of parameters. | Builds the parameter list for a function, given an array of parameters. | [
"Builds",
"the",
"parameter",
"list",
"for",
"a",
"function",
"given",
"an",
"array",
"of",
"parameters",
"."
] | def _GenerateParams(self, params):
"""Builds the parameter list for a function, given an array of parameters.
"""
if self._generate_error_messages:
params += ('base::string16* error = NULL',)
return ', '.join(str(p) for p in params) | [
"def",
"_GenerateParams",
"(",
"self",
",",
"params",
")",
":",
"if",
"self",
".",
"_generate_error_messages",
":",
"params",
"+=",
"(",
"'base::string16* error = NULL'",
",",
")",
"return",
"', '",
".",
"join",
"(",
"str",
"(",
"p",
")",
"for",
"p",
"in",... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/json_schema_compiler/h_generator.py#L392-L397 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/inspect.py | python | _signature_from_callable | (obj, *,
follow_wrapper_chains=True,
skip_bound_arg=True,
sigcls) | Private helper function to get signature for arbitrary
callable objects. | Private helper function to get signature for arbitrary
callable objects. | [
"Private",
"helper",
"function",
"to",
"get",
"signature",
"for",
"arbitrary",
"callable",
"objects",
"."
] | def _signature_from_callable(obj, *,
follow_wrapper_chains=True,
skip_bound_arg=True,
sigcls):
"""Private helper function to get signature for arbitrary
callable objects.
"""
_get_signature_of = functools.partial(_s... | [
"def",
"_signature_from_callable",
"(",
"obj",
",",
"*",
",",
"follow_wrapper_chains",
"=",
"True",
",",
"skip_bound_arg",
"=",
"True",
",",
"sigcls",
")",
":",
"_get_signature_of",
"=",
"functools",
".",
"partial",
"(",
"_signature_from_callable",
",",
"follow_wr... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/inspect.py#L2246-L2426 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/v8/third_party/jinja2/optimizer.py | python | optimize | (node, environment) | return optimizer.visit(node) | The context hint can be used to perform an static optimization
based on the context given. | The context hint can be used to perform an static optimization
based on the context given. | [
"The",
"context",
"hint",
"can",
"be",
"used",
"to",
"perform",
"an",
"static",
"optimization",
"based",
"on",
"the",
"context",
"given",
"."
] | def optimize(node, environment):
"""The context hint can be used to perform an static optimization
based on the context given."""
optimizer = Optimizer(environment)
return optimizer.visit(node) | [
"def",
"optimize",
"(",
"node",
",",
"environment",
")",
":",
"optimizer",
"=",
"Optimizer",
"(",
"environment",
")",
"return",
"optimizer",
".",
"visit",
"(",
"node",
")"
] | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/v8/third_party/jinja2/optimizer.py#L23-L27 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/config.py | python | IdleConf.CurrentKeys | (self) | return self.current_colors_and_keys('Keys') | Return the name of the currently active key set. | Return the name of the currently active key set. | [
"Return",
"the",
"name",
"of",
"the",
"currently",
"active",
"key",
"set",
"."
] | def CurrentKeys(self):
"""Return the name of the currently active key set."""
return self.current_colors_and_keys('Keys') | [
"def",
"CurrentKeys",
"(",
"self",
")",
":",
"return",
"self",
".",
"current_colors_and_keys",
"(",
"'Keys'",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/config.py#L361-L363 | |
arx/ArxLibertatis | 0313c51625f3f55016cdad43d2c7f7296d27949c | scripts/cpplint.py | python | GetLineWidth | (line) | Determines the width of the line in column positions.
Args:
line: A string, which may be a Unicode string.
Returns:
The width of the line in column positions, accounting for Unicode
combining characters and wide characters. | Determines the width of the line in column positions. | [
"Determines",
"the",
"width",
"of",
"the",
"line",
"in",
"column",
"positions",
"."
] | def GetLineWidth(line):
"""Determines the width of the line in column positions.
Args:
line: A string, which may be a Unicode string.
Returns:
The width of the line in column positions, accounting for Unicode
combining characters and wide characters.
"""
if isinstance(line, TEXT_TYPE):
width... | [
"def",
"GetLineWidth",
"(",
"line",
")",
":",
"if",
"isinstance",
"(",
"line",
",",
"TEXT_TYPE",
")",
":",
"width",
"=",
"0",
"for",
"uc",
"in",
"unicodedata",
".",
"normalize",
"(",
"'NFC'",
",",
"line",
")",
":",
"if",
"unicodedata",
".",
"east_asian... | https://github.com/arx/ArxLibertatis/blob/0313c51625f3f55016cdad43d2c7f7296d27949c/scripts/cpplint.py#L2329-L2348 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/asyncio/sslproto.py | python | _SSLPipe.feed_appdata | (self, data, offset=0) | return (ssldata, offset) | Feed plaintext data into the pipe.
Return an (ssldata, offset) tuple. The ssldata element is a list of
buffers containing record level data that needs to be sent to the
remote SSL instance. The offset is the number of plaintext bytes that
were processed, which may be less than the lengt... | Feed plaintext data into the pipe. | [
"Feed",
"plaintext",
"data",
"into",
"the",
"pipe",
"."
] | def feed_appdata(self, data, offset=0):
"""Feed plaintext data into the pipe.
Return an (ssldata, offset) tuple. The ssldata element is a list of
buffers containing record level data that needs to be sent to the
remote SSL instance. The offset is the number of plaintext bytes that
... | [
"def",
"feed_appdata",
"(",
"self",
",",
"data",
",",
"offset",
"=",
"0",
")",
":",
"assert",
"0",
"<=",
"offset",
"<=",
"len",
"(",
"data",
")",
"if",
"self",
".",
"_state",
"==",
"_UNWRAPPED",
":",
"# pass through data in unwrapped mode",
"if",
"offset",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/asyncio/sslproto.py#L231-L280 | |
google/perfetto | fe68c7a7f7657aa71ced68efb126dcac4107c745 | python/perfetto/trace_processor/api.py | python | TraceProcessor.enable_metatrace | (self) | return self.http.enable_metatrace() | Enable metatrace for the currently running trace_processor. | Enable metatrace for the currently running trace_processor. | [
"Enable",
"metatrace",
"for",
"the",
"currently",
"running",
"trace_processor",
"."
] | def enable_metatrace(self):
"""Enable metatrace for the currently running trace_processor.
"""
return self.http.enable_metatrace() | [
"def",
"enable_metatrace",
"(",
"self",
")",
":",
"return",
"self",
".",
"http",
".",
"enable_metatrace",
"(",
")"
] | https://github.com/google/perfetto/blob/fe68c7a7f7657aa71ced68efb126dcac4107c745/python/perfetto/trace_processor/api.py#L297-L300 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/catapult_base/catapult_base/refactor/offset_token.py | python | _Pairwise | (iterable) | return itertools.izip(a, b) | s -> (None, s0), (s0, s1), (s1, s2), (s2, s3), ... | s -> (None, s0), (s0, s1), (s1, s2), (s2, s3), ... | [
"s",
"-",
">",
"(",
"None",
"s0",
")",
"(",
"s0",
"s1",
")",
"(",
"s1",
"s2",
")",
"(",
"s2",
"s3",
")",
"..."
] | def _Pairwise(iterable):
"""s -> (None, s0), (s0, s1), (s1, s2), (s2, s3), ..."""
a, b = itertools.tee(iterable)
a = itertools.chain((None,), a)
return itertools.izip(a, b) | [
"def",
"_Pairwise",
"(",
"iterable",
")",
":",
"a",
",",
"b",
"=",
"itertools",
".",
"tee",
"(",
"iterable",
")",
"a",
"=",
"itertools",
".",
"chain",
"(",
"(",
"None",
",",
")",
",",
"a",
")",
"return",
"itertools",
".",
"izip",
"(",
"a",
",",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/catapult_base/catapult_base/refactor/offset_token.py#L11-L15 | |
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | tools/pot/openvino/tools/pot/engines/ie_engine.py | python | IEEngine._process_dataset | (self, stats_layout, sampler, print_progress=False,
need_metrics_per_sample=False) | Performs model inference on specified dataset subset synchronously
:param stats_layout: dict of stats collection functions {node_name: {stat_name: fn}} (optional)
:param sampler: sampling dataset to make inference
:param print_progress: whether to print inference progress
:param need_met... | Performs model inference on specified dataset subset synchronously
:param stats_layout: dict of stats collection functions {node_name: {stat_name: fn}} (optional)
:param sampler: sampling dataset to make inference
:param print_progress: whether to print inference progress
:param need_met... | [
"Performs",
"model",
"inference",
"on",
"specified",
"dataset",
"subset",
"synchronously",
":",
"param",
"stats_layout",
":",
"dict",
"of",
"stats",
"collection",
"functions",
"{",
"node_name",
":",
"{",
"stat_name",
":",
"fn",
"}}",
"(",
"optional",
")",
":",... | def _process_dataset(self, stats_layout, sampler, print_progress=False,
need_metrics_per_sample=False):
"""
Performs model inference on specified dataset subset synchronously
:param stats_layout: dict of stats collection functions {node_name: {stat_name: fn}} (optional)
... | [
"def",
"_process_dataset",
"(",
"self",
",",
"stats_layout",
",",
"sampler",
",",
"print_progress",
"=",
"False",
",",
"need_metrics_per_sample",
"=",
"False",
")",
":",
"progress_log_fn",
"=",
"logger",
".",
"info",
"if",
"print_progress",
"else",
"logger",
"."... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/pot/openvino/tools/pot/engines/ie_engine.py#L344-L381 | ||
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/v7.9.317/third_party/jinja2/nativetypes.py | python | native_concat | (nodes) | Return a native Python type from the list of compiled nodes. If the
result is a single node, its value is returned. Otherwise, the nodes are
concatenated as strings. If the result can be parsed with
:func:`ast.literal_eval`, the parsed value is returned. Otherwise, the
string is returned. | Return a native Python type from the list of compiled nodes. If the
result is a single node, its value is returned. Otherwise, the nodes are
concatenated as strings. If the result can be parsed with
:func:`ast.literal_eval`, the parsed value is returned. Otherwise, the
string is returned. | [
"Return",
"a",
"native",
"Python",
"type",
"from",
"the",
"list",
"of",
"compiled",
"nodes",
".",
"If",
"the",
"result",
"is",
"a",
"single",
"node",
"its",
"value",
"is",
"returned",
".",
"Otherwise",
"the",
"nodes",
"are",
"concatenated",
"as",
"strings"... | def native_concat(nodes):
"""Return a native Python type from the list of compiled nodes. If the
result is a single node, its value is returned. Otherwise, the nodes are
concatenated as strings. If the result can be parsed with
:func:`ast.literal_eval`, the parsed value is returned. Otherwise, the
s... | [
"def",
"native_concat",
"(",
"nodes",
")",
":",
"head",
"=",
"list",
"(",
"islice",
"(",
"nodes",
",",
"2",
")",
")",
"if",
"not",
"head",
":",
"return",
"None",
"if",
"len",
"(",
"head",
")",
"==",
"1",
":",
"out",
"=",
"head",
"[",
"0",
"]",
... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/v7.9.317/third_party/jinja2/nativetypes.py#L11-L31 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/gyp/pylib/gyp/xcode_emulation.py | python | GetSpecPostbuildCommands | (spec, quiet=False) | return postbuilds | Returns the list of postbuilds explicitly defined on |spec|, in a form
executable by a shell. | Returns the list of postbuilds explicitly defined on |spec|, in a form
executable by a shell. | [
"Returns",
"the",
"list",
"of",
"postbuilds",
"explicitly",
"defined",
"on",
"|spec|",
"in",
"a",
"form",
"executable",
"by",
"a",
"shell",
"."
] | def GetSpecPostbuildCommands(spec, quiet=False):
"""Returns the list of postbuilds explicitly defined on |spec|, in a form
executable by a shell."""
postbuilds = []
for postbuild in spec.get('postbuilds', []):
if not quiet:
postbuilds.append('echo POSTBUILD\\(%s\\) %s' % (
spec['target_nam... | [
"def",
"GetSpecPostbuildCommands",
"(",
"spec",
",",
"quiet",
"=",
"False",
")",
":",
"postbuilds",
"=",
"[",
"]",
"for",
"postbuild",
"in",
"spec",
".",
"get",
"(",
"'postbuilds'",
",",
"[",
"]",
")",
":",
"if",
"not",
"quiet",
":",
"postbuilds",
".",... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/gyp/pylib/gyp/xcode_emulation.py#L1775-L1784 | |
yifita/3PU | 9ca4c3dfe4e3ead08c72e98a62e4cf181d5c70e0 | code/utils/pc_util.py | python | normalize_point_cloud | (input) | return input, centroid, furthest_distance | input: pc [N, P, 3]
output: pc, centroid, furthest_distance | input: pc [N, P, 3]
output: pc, centroid, furthest_distance | [
"input",
":",
"pc",
"[",
"N",
"P",
"3",
"]",
"output",
":",
"pc",
"centroid",
"furthest_distance"
] | def normalize_point_cloud(input):
"""
input: pc [N, P, 3]
output: pc, centroid, furthest_distance
"""
if len(input.shape) == 2:
axis = 0
elif len(input.shape) == 3:
axis = 1
centroid = np.mean(input, axis=axis, keepdims=True)
input = input - centroid
furthest_distance... | [
"def",
"normalize_point_cloud",
"(",
"input",
")",
":",
"if",
"len",
"(",
"input",
".",
"shape",
")",
"==",
"2",
":",
"axis",
"=",
"0",
"elif",
"len",
"(",
"input",
".",
"shape",
")",
"==",
"3",
":",
"axis",
"=",
"1",
"centroid",
"=",
"np",
".",
... | https://github.com/yifita/3PU/blob/9ca4c3dfe4e3ead08c72e98a62e4cf181d5c70e0/code/utils/pc_util.py#L93-L107 | |
larroy/clearskies_core | 3574ddf0edc8555454c7044126e786a6c29444dc | tools/gyp/pylib/gyp/__init__.py | python | NameValueListToDict | (name_value_list) | return result | Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary
of the pairs. If a string is simply NAME, then the value in the dictionary
is set to True. If VALUE can be converted to an integer, it is. | Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary
of the pairs. If a string is simply NAME, then the value in the dictionary
is set to True. If VALUE can be converted to an integer, it is. | [
"Takes",
"an",
"array",
"of",
"strings",
"of",
"the",
"form",
"NAME",
"=",
"VALUE",
"and",
"creates",
"a",
"dictionary",
"of",
"the",
"pairs",
".",
"If",
"a",
"string",
"is",
"simply",
"NAME",
"then",
"the",
"value",
"in",
"the",
"dictionary",
"is",
"s... | def NameValueListToDict(name_value_list):
"""
Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary
of the pairs. If a string is simply NAME, then the value in the dictionary
is set to True. If VALUE can be converted to an integer, it is.
"""
result = { }
for item in name_value_lis... | [
"def",
"NameValueListToDict",
"(",
"name_value_list",
")",
":",
"result",
"=",
"{",
"}",
"for",
"item",
"in",
"name_value_list",
":",
"tokens",
"=",
"item",
".",
"split",
"(",
"'='",
",",
"1",
")",
"if",
"len",
"(",
"tokens",
")",
"==",
"2",
":",
"# ... | https://github.com/larroy/clearskies_core/blob/3574ddf0edc8555454c7044126e786a6c29444dc/tools/gyp/pylib/gyp/__init__.py#L132-L152 | |
dartsim/dart | 495c82120c836005f2d136d4a50c8cc997fb879b | tools/cpplint.py | python | CleanseRawStrings | (raw_lines) | return lines_without_raw_strings | Removes C++11 raw strings from lines.
Before:
static const char kData[] = R"(
multi-line string
)";
After:
static const char kData[] = ""
(replaced by blank line)
"";
Args:
raw_lines: list of raw lines.
Returns:
list of lines with C++11 raw str... | Removes C++11 raw strings from lines. | [
"Removes",
"C",
"++",
"11",
"raw",
"strings",
"from",
"lines",
"."
] | def CleanseRawStrings(raw_lines):
"""Removes C++11 raw strings from lines.
Before:
static const char kData[] = R"(
multi-line string
)";
After:
static const char kData[] = ""
(replaced by blank line)
"";
Args:
raw_lines: list of raw lines.
Return... | [
"def",
"CleanseRawStrings",
"(",
"raw_lines",
")",
":",
"delimiter",
"=",
"None",
"lines_without_raw_strings",
"=",
"[",
"]",
"for",
"line",
"in",
"raw_lines",
":",
"if",
"delimiter",
":",
"# Inside a raw string, look for the end",
"end",
"=",
"line",
".",
"find",... | https://github.com/dartsim/dart/blob/495c82120c836005f2d136d4a50c8cc997fb879b/tools/cpplint.py#L1039-L1097 | |
trailofbits/llvm-sanitizer-tutorial | d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99 | llvm/examples/Kaleidoscope/MCJIT/complete/genk-timing.py | python | generateKScript | (filename, numFuncs, elementsPerFunc, funcsBetweenExec, callWeighting, timingScript) | Generate a random Kaleidoscope script based on the given parameters | Generate a random Kaleidoscope script based on the given parameters | [
"Generate",
"a",
"random",
"Kaleidoscope",
"script",
"based",
"on",
"the",
"given",
"parameters"
] | def generateKScript(filename, numFuncs, elementsPerFunc, funcsBetweenExec, callWeighting, timingScript):
""" Generate a random Kaleidoscope script based on the given parameters """
print("Generating " + filename)
print(" %d functions, %d elements per function, %d functions between execution" %
(n... | [
"def",
"generateKScript",
"(",
"filename",
",",
"numFuncs",
",",
"elementsPerFunc",
",",
"funcsBetweenExec",
",",
"callWeighting",
",",
"timingScript",
")",
":",
"print",
"(",
"\"Generating \"",
"+",
"filename",
")",
"print",
"(",
"\" %d functions, %d elements per fu... | https://github.com/trailofbits/llvm-sanitizer-tutorial/blob/d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99/llvm/examples/Kaleidoscope/MCJIT/complete/genk-timing.py#L181-L211 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/stc.py | python | StyledTextCtrl.CallTipPosAtStart | (*args, **kwargs) | return _stc.StyledTextCtrl_CallTipPosAtStart(*args, **kwargs) | CallTipPosAtStart(self) -> int
Retrieve the position where the caret was before displaying the call tip. | CallTipPosAtStart(self) -> int | [
"CallTipPosAtStart",
"(",
"self",
")",
"-",
">",
"int"
] | def CallTipPosAtStart(*args, **kwargs):
"""
CallTipPosAtStart(self) -> int
Retrieve the position where the caret was before displaying the call tip.
"""
return _stc.StyledTextCtrl_CallTipPosAtStart(*args, **kwargs) | [
"def",
"CallTipPosAtStart",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_CallTipPosAtStart",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/stc.py#L3820-L3826 | |
Yelp/MOE | 5b5a6a2c6c3cf47320126f7f5894e2a83e347f5c | moe/optimal_learning/python/cpp_wrappers/expected_improvement.py | python | ExpectedImprovement.__init__ | (
self,
gaussian_process,
points_to_sample=None,
points_being_sampled=None,
num_mc_iterations=DEFAULT_EXPECTED_IMPROVEMENT_MC_ITERATIONS,
randomness=None
) | Construct an ExpectedImprovement object that knows how to call C++ for evaluation of member functions.
:param gaussian_process: GaussianProcess describing
:type gaussian_process: :class:`moe.optimal_learning.python.cpp_wrappers.gaussian_process.GaussianProcess` object
:param points_to_sample: p... | Construct an ExpectedImprovement object that knows how to call C++ for evaluation of member functions. | [
"Construct",
"an",
"ExpectedImprovement",
"object",
"that",
"knows",
"how",
"to",
"call",
"C",
"++",
"for",
"evaluation",
"of",
"member",
"functions",
"."
] | def __init__(
self,
gaussian_process,
points_to_sample=None,
points_being_sampled=None,
num_mc_iterations=DEFAULT_EXPECTED_IMPROVEMENT_MC_ITERATIONS,
randomness=None
):
"""Construct an ExpectedImprovement object that knows how to call C... | [
"def",
"__init__",
"(",
"self",
",",
"gaussian_process",
",",
"points_to_sample",
"=",
"None",
",",
"points_being_sampled",
"=",
"None",
",",
"num_mc_iterations",
"=",
"DEFAULT_EXPECTED_IMPROVEMENT_MC_ITERATIONS",
",",
"randomness",
"=",
"None",
")",
":",
"self",
".... | https://github.com/Yelp/MOE/blob/5b5a6a2c6c3cf47320126f7f5894e2a83e347f5c/moe/optimal_learning/python/cpp_wrappers/expected_improvement.py#L361-L409 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/array_ops.py | python | concat | (values, axis, name="concat") | return gen_array_ops.concat_v2(values=values, axis=axis, name=name) | Concatenates tensors along one dimension.
See also `tf.tile`, `tf.stack`, `tf.repeat`.
Concatenates the list of tensors `values` along dimension `axis`. If
`values[i].shape = [D0, D1, ... Daxis(i), ...Dn]`, the concatenated
result has shape
[D0, D1, ... Raxis, ...Dn]
where
Raxis = sum(Daxis(... | Concatenates tensors along one dimension. | [
"Concatenates",
"tensors",
"along",
"one",
"dimension",
"."
] | def concat(values, axis, name="concat"):
"""Concatenates tensors along one dimension.
See also `tf.tile`, `tf.stack`, `tf.repeat`.
Concatenates the list of tensors `values` along dimension `axis`. If
`values[i].shape = [D0, D1, ... Daxis(i), ...Dn]`, the concatenated
result has shape
[D0, D1, ... Ra... | [
"def",
"concat",
"(",
"values",
",",
"axis",
",",
"name",
"=",
"\"concat\"",
")",
":",
"if",
"not",
"isinstance",
"(",
"values",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"values",
"=",
"[",
"values",
"]",
"# TODO(mrry): Change to return values?",
"... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/array_ops.py#L1734-L1824 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_misc.py | python | Process.IsInputOpened | (*args, **kwargs) | return _misc_.Process_IsInputOpened(*args, **kwargs) | IsInputOpened(self) -> bool | IsInputOpened(self) -> bool | [
"IsInputOpened",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsInputOpened(*args, **kwargs):
"""IsInputOpened(self) -> bool"""
return _misc_.Process_IsInputOpened(*args, **kwargs) | [
"def",
"IsInputOpened",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"Process_IsInputOpened",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_misc.py#L2035-L2037 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/v8/third_party/jinja2/filters.py | python | do_round | (value, precision=0, method='common') | return func(value * (10 ** precision)) / (10 ** precision) | Round the number to a given precision. The first
parameter specifies the precision (default is ``0``), the
second the rounding method:
- ``'common'`` rounds either up or down
- ``'ceil'`` always rounds up
- ``'floor'`` always rounds down
If you don't specify a method ``'common'`` is used.
... | Round the number to a given precision. The first
parameter specifies the precision (default is ``0``), the
second the rounding method: | [
"Round",
"the",
"number",
"to",
"a",
"given",
"precision",
".",
"The",
"first",
"parameter",
"specifies",
"the",
"precision",
"(",
"default",
"is",
"0",
")",
"the",
"second",
"the",
"rounding",
"method",
":"
] | def do_round(value, precision=0, method='common'):
"""Round the number to a given precision. The first
parameter specifies the precision (default is ``0``), the
second the rounding method:
- ``'common'`` rounds either up or down
- ``'ceil'`` always rounds up
- ``'floor'`` always rounds down
... | [
"def",
"do_round",
"(",
"value",
",",
"precision",
"=",
"0",
",",
"method",
"=",
"'common'",
")",
":",
"if",
"not",
"method",
"in",
"(",
"'common'",
",",
"'ceil'",
",",
"'floor'",
")",
":",
"raise",
"FilterArgumentError",
"(",
"'method must be common, ceil o... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/v8/third_party/jinja2/filters.py#L768-L799 | |
giuspen/cherrytree | 84712f206478fcf9acf30174009ad28c648c6344 | pygtk2/modules/tablez.py | python | TablesHandler.table_row_action | (self, action) | All Rows Actions | All Rows Actions | [
"All",
"Rows",
"Actions"
] | def table_row_action(self, action):
"""All Rows Actions"""
treeviewselection = self.curr_table_anchor.treeview.get_selection()
model, iter = treeviewselection.get_selected()
if not iter:
curr_iter = model.get_iter_first()
if not curr_iter: return
while... | [
"def",
"table_row_action",
"(",
"self",
",",
"action",
")",
":",
"treeviewselection",
"=",
"self",
".",
"curr_table_anchor",
".",
"treeview",
".",
"get_selection",
"(",
")",
"model",
",",
"iter",
"=",
"treeviewselection",
".",
"get_selected",
"(",
")",
"if",
... | https://github.com/giuspen/cherrytree/blob/84712f206478fcf9acf30174009ad28c648c6344/pygtk2/modules/tablez.py#L524-L572 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/paginate.py | python | TokenEncoder._encode_list | (self, data, path) | return new_data, encoded | Encode any bytes in a list, noting the index of what is encoded. | Encode any bytes in a list, noting the index of what is encoded. | [
"Encode",
"any",
"bytes",
"in",
"a",
"list",
"noting",
"the",
"index",
"of",
"what",
"is",
"encoded",
"."
] | def _encode_list(self, data, path):
"""Encode any bytes in a list, noting the index of what is encoded."""
new_data = []
encoded = []
for i, value in enumerate(data):
new_path = path + [i]
new_value, new_encoded = self._encode(value, new_path)
new_data... | [
"def",
"_encode_list",
"(",
"self",
",",
"data",
",",
"path",
")",
":",
"new_data",
"=",
"[",
"]",
"encoded",
"=",
"[",
"]",
"for",
"i",
",",
"value",
"in",
"enumerate",
"(",
"data",
")",
":",
"new_path",
"=",
"path",
"+",
"[",
"i",
"]",
"new_val... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/paginate.py#L81-L90 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/saved_model/signature_def_utils_impl.py | python | classification_signature_def | (examples, classes, scores) | return signature_def | Creates classification signature from given examples and predictions.
Args:
examples: `Tensor`.
classes: `Tensor`.
scores: `Tensor`.
Returns:
A classification-flavored signature_def.
Raises:
ValueError: If examples is `None`. | Creates classification signature from given examples and predictions. | [
"Creates",
"classification",
"signature",
"from",
"given",
"examples",
"and",
"predictions",
"."
] | def classification_signature_def(examples, classes, scores):
"""Creates classification signature from given examples and predictions.
Args:
examples: `Tensor`.
classes: `Tensor`.
scores: `Tensor`.
Returns:
A classification-flavored signature_def.
Raises:
ValueError: If examples is `None`.... | [
"def",
"classification_signature_def",
"(",
"examples",
",",
"classes",
",",
"scores",
")",
":",
"if",
"examples",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'examples cannot be None for classification.'",
")",
"if",
"classes",
"is",
"None",
"and",
"scores",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/saved_model/signature_def_utils_impl.py#L81-L118 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/ragged/row_partition.py | python | RowPartition.has_precomputed_nrows | (self) | return self._nrows is not None | Returns true if `nrows` has already been computed.
If true, then `self.nrows()` will return its value without calling
any TensorFlow ops. | Returns true if `nrows` has already been computed. | [
"Returns",
"true",
"if",
"nrows",
"has",
"already",
"been",
"computed",
"."
] | def has_precomputed_nrows(self):
"""Returns true if `nrows` has already been computed.
If true, then `self.nrows()` will return its value without calling
any TensorFlow ops.
"""
return self._nrows is not None | [
"def",
"has_precomputed_nrows",
"(",
"self",
")",
":",
"return",
"self",
".",
"_nrows",
"is",
"not",
"None"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/ragged/row_partition.py#L1054-L1060 | |
timi-liuliang/echo | 40a5a24d430eee4118314459ab7e03afcb3b8719 | thirdparty/protobuf/python/google/protobuf/internal/encoder.py | python | StringSizer | (field_number, is_repeated, is_packed) | Returns a sizer for a string field. | Returns a sizer for a string field. | [
"Returns",
"a",
"sizer",
"for",
"a",
"string",
"field",
"."
] | def StringSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a string field."""
tag_size = _TagSize(field_number)
local_VarintSize = _VarintSize
local_len = len
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in ... | [
"def",
"StringSizer",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag_size",
"=",
"_TagSize",
"(",
"field_number",
")",
"local_VarintSize",
"=",
"_VarintSize",
"local_len",
"=",
"len",
"assert",
"not",
"is_packed",
"if",
"is_repeated",
... | https://github.com/timi-liuliang/echo/blob/40a5a24d430eee4118314459ab7e03afcb3b8719/thirdparty/protobuf/python/google/protobuf/internal/encoder.py#L233-L252 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/optimize/_dual_annealing.py | python | EnergyState.reset | (self, func_wrapper, rand_state, x0=None) | Initialize current location is the search domain. If `x0` is not
provided, a random location within the bounds is generated. | Initialize current location is the search domain. If `x0` is not
provided, a random location within the bounds is generated. | [
"Initialize",
"current",
"location",
"is",
"the",
"search",
"domain",
".",
"If",
"x0",
"is",
"not",
"provided",
"a",
"random",
"location",
"within",
"the",
"bounds",
"is",
"generated",
"."
] | def reset(self, func_wrapper, rand_state, x0=None):
"""
Initialize current location is the search domain. If `x0` is not
provided, a random location within the bounds is generated.
"""
if x0 is None:
self.current_location = self.lower + rand_state.random_sample(
... | [
"def",
"reset",
"(",
"self",
",",
"func_wrapper",
",",
"rand_state",
",",
"x0",
"=",
"None",
")",
":",
"if",
"x0",
"is",
"None",
":",
"self",
".",
"current_location",
"=",
"self",
".",
"lower",
"+",
"rand_state",
".",
"random_sample",
"(",
"len",
"(",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/optimize/_dual_annealing.py#L150-L184 | ||
lawy623/SVS | b7c7ae367c82a4797ff4a896a2ff304f02e7f724 | caffe/scripts/cpp_lint.py | python | GetLineWidth | (line) | Determines the width of the line in column positions.
Args:
line: A string, which may be a Unicode string.
Returns:
The width of the line in column positions, accounting for Unicode
combining characters and wide characters. | Determines the width of the line in column positions. | [
"Determines",
"the",
"width",
"of",
"the",
"line",
"in",
"column",
"positions",
"."
] | def GetLineWidth(line):
"""Determines the width of the line in column positions.
Args:
line: A string, which may be a Unicode string.
Returns:
The width of the line in column positions, accounting for Unicode
combining characters and wide characters.
"""
if isinstance(line, unicode):
width =... | [
"def",
"GetLineWidth",
"(",
"line",
")",
":",
"if",
"isinstance",
"(",
"line",
",",
"unicode",
")",
":",
"width",
"=",
"0",
"for",
"uc",
"in",
"unicodedata",
".",
"normalize",
"(",
"'NFC'",
",",
"line",
")",
":",
"if",
"unicodedata",
".",
"east_asian_w... | https://github.com/lawy623/SVS/blob/b7c7ae367c82a4797ff4a896a2ff304f02e7f724/caffe/scripts/cpp_lint.py#L3437-L3456 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/resample.py | python | Resampler._apply_loffset | (self, result) | return result | If loffset is set, offset the result index.
This is NOT an idempotent routine, it will be applied
exactly once to the result.
Parameters
----------
result : Series or DataFrame
the result of resample | If loffset is set, offset the result index. | [
"If",
"loffset",
"is",
"set",
"offset",
"the",
"result",
"index",
"."
] | def _apply_loffset(self, result):
"""
If loffset is set, offset the result index.
This is NOT an idempotent routine, it will be applied
exactly once to the result.
Parameters
----------
result : Series or DataFrame
the result of resample
"""
... | [
"def",
"_apply_loffset",
"(",
"self",
",",
"result",
")",
":",
"needs_offset",
"=",
"(",
"isinstance",
"(",
"self",
".",
"loffset",
",",
"(",
"DateOffset",
",",
"timedelta",
",",
"np",
".",
"timedelta64",
")",
")",
"and",
"isinstance",
"(",
"result",
"."... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/resample.py#L387-L410 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Math/Primality.py | python | generate_probable_prime | (**kwargs) | return candidate | Generate a random probable prime.
The prime will not have any specific properties
(e.g. it will not be a *strong* prime).
Random numbers are evaluated for primality until one
passes all tests, consisting of a certain number of
Miller-Rabin tests with random bases followed by
a single Lucas tes... | Generate a random probable prime. | [
"Generate",
"a",
"random",
"probable",
"prime",
"."
] | def generate_probable_prime(**kwargs):
"""Generate a random probable prime.
The prime will not have any specific properties
(e.g. it will not be a *strong* prime).
Random numbers are evaluated for primality until one
passes all tests, consisting of a certain number of
Miller-Rabin tests with r... | [
"def",
"generate_probable_prime",
"(",
"*",
"*",
"kwargs",
")",
":",
"exact_bits",
"=",
"kwargs",
".",
"pop",
"(",
"\"exact_bits\"",
",",
"None",
")",
"randfunc",
"=",
"kwargs",
".",
"pop",
"(",
"\"randfunc\"",
",",
"None",
")",
"prime_filter",
"=",
"kwarg... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Math/Primality.py#L279-L334 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | samples/pySketch/pySketch.py | python | main | () | Start up the pySketch application. | Start up the pySketch application. | [
"Start",
"up",
"the",
"pySketch",
"application",
"."
] | def main():
""" Start up the pySketch application.
"""
global _app
# Redirect python exceptions to a log file.
sys.stderr = ExceptionHandler()
# Create and start the pySketch application.
_app = SketchApp(0)
_app.MainLoop() | [
"def",
"main",
"(",
")",
":",
"global",
"_app",
"# Redirect python exceptions to a log file.",
"sys",
".",
"stderr",
"=",
"ExceptionHandler",
"(",
")",
"# Create and start the pySketch application.",
"_app",
"=",
"SketchApp",
"(",
"0",
")",
"_app",
".",
"MainLoop",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/samples/pySketch/pySketch.py#L3536-L3548 | ||
albertz/openlierox | d316c14a8eb57848ef56e9bfa7b23a56f694a51b | tools/DedicatedServerVideo/gdata/data.py | python | ExtendedProperty.set_xml_blob | (self, blob) | Sets the contents of the extendedProperty to XML as a child node.
Since the extendedProperty is only allowed one child element as an XML
blob, setting the XML blob will erase any preexisting member elements
in this object.
Args:
blob: str or atom.core.XmlElement representing the XML blob stored... | Sets the contents of the extendedProperty to XML as a child node. | [
"Sets",
"the",
"contents",
"of",
"the",
"extendedProperty",
"to",
"XML",
"as",
"a",
"child",
"node",
"."
] | def set_xml_blob(self, blob):
"""Sets the contents of the extendedProperty to XML as a child node.
Since the extendedProperty is only allowed one child element as an XML
blob, setting the XML blob will erase any preexisting member elements
in this object.
Args:
blob: str or atom.core.XmlEle... | [
"def",
"set_xml_blob",
"(",
"self",
",",
"blob",
")",
":",
"# Erase any existing extension_elements, clears the child nodes from the",
"# extendedProperty.",
"if",
"isinstance",
"(",
"blob",
",",
"atom",
".",
"core",
".",
"XmlElement",
")",
":",
"self",
".",
"_other_e... | https://github.com/albertz/openlierox/blob/d316c14a8eb57848ef56e9bfa7b23a56f694a51b/tools/DedicatedServerVideo/gdata/data.py#L270-L286 | ||
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | Validation/Tools/python/GenObject.py | python | GenObject._createCppClass | (objName) | return goClass + diffClass + contClass | Returns a string containing the '.C' file necessary to
generate a shared object library with dictionary. | Returns a string containing the '.C' file necessary to
generate a shared object library with dictionary. | [
"Returns",
"a",
"string",
"containing",
"the",
".",
"C",
"file",
"necessary",
"to",
"generate",
"a",
"shared",
"object",
"library",
"with",
"dictionary",
"."
] | def _createCppClass (objName):
"""Returns a string containing the '.C' file necessary to
generate a shared object library with dictionary."""
if objName not in GenObject._objsDict:
# not good
print("Error: GenObject does not know about object '%s'." % objName)
... | [
"def",
"_createCppClass",
"(",
"objName",
")",
":",
"if",
"objName",
"not",
"in",
"GenObject",
".",
"_objsDict",
":",
"# not good",
"print",
"(",
"\"Error: GenObject does not know about object '%s'.\"",
"%",
"objName",
")",
"raise",
"RuntimeError",
"(",
"\"Failed to c... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Validation/Tools/python/GenObject.py#L244-L311 | |
genn-team/genn | 75e1eb218cafa228bf36ae4613d1ce26e877b12c | pygenn/genn_model.py | python | GeNNModel.add_slave_synapse_population | (self, pop_name, master_pop, delay_steps,
source, target, postsyn_model,
ps_param_space, ps_var_space) | return s_group | Add a 'slave' population to the GeNN model which shares
weights and connectivity with a 'master' population
Args:
pop_name -- name of the new population
master_pop -- master synapse group to share weights with
... | Add a 'slave' population to the GeNN model which shares
weights and connectivity with a 'master' population | [
"Add",
"a",
"slave",
"population",
"to",
"the",
"GeNN",
"model",
"which",
"shares",
"weights",
"and",
"connectivity",
"with",
"a",
"master",
"population"
] | def add_slave_synapse_population(self, pop_name, master_pop, delay_steps,
source, target, postsyn_model,
ps_param_space, ps_var_space):
"""Add a 'slave' population to the GeNN model which shares
weights and connectivity with a 'm... | [
"def",
"add_slave_synapse_population",
"(",
"self",
",",
"pop_name",
",",
"master_pop",
",",
"delay_steps",
",",
"source",
",",
"target",
",",
"postsyn_model",
",",
"ps_param_space",
",",
"ps_var_space",
")",
":",
"if",
"self",
".",
"_built",
":",
"raise",
"Ex... | https://github.com/genn-team/genn/blob/75e1eb218cafa228bf36ae4613d1ce26e877b12c/pygenn/genn_model.py#L429-L472 | |
anestisb/oatdump_plus | ba858c1596598f0d9ae79c14d08c708cecc50af3 | tools/cpplint.py | python | CheckStyle | (filename, clean_lines, linenum, file_extension, nesting_state,
error) | Checks rules from the 'C++ style rules' section of cppguide.html.
Most of these rules are hard to test (naming, comment style), but we
do what we can. In particular we check for 2-space indents, line lengths,
tab usage, spaces inside code, etc.
Args:
filename: The name of the current file.
clean_line... | Checks rules from the 'C++ style rules' section of cppguide.html. | [
"Checks",
"rules",
"from",
"the",
"C",
"++",
"style",
"rules",
"section",
"of",
"cppguide",
".",
"html",
"."
] | def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state,
error):
"""Checks rules from the 'C++ style rules' section of cppguide.html.
Most of these rules are hard to test (naming, comment style), but we
do what we can. In particular we check for 2-space indents, line lengths,... | [
"def",
"CheckStyle",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"file_extension",
",",
"nesting_state",
",",
"error",
")",
":",
"raw_lines",
"=",
"clean_lines",
".",
"raw_lines",
"line",
"=",
"raw_lines",
"[",
"linenum",
"]",
"if",
"line",
"."... | https://github.com/anestisb/oatdump_plus/blob/ba858c1596598f0d9ae79c14d08c708cecc50af3/tools/cpplint.py#L2828-L2936 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/groupby/generic.py | python | SeriesGroupBy.nunique | (self, dropna=True) | return Series(res,
index=ri,
name=self._selection_name) | Returns number of unique elements in the group | Returns number of unique elements in the group | [
"Returns",
"number",
"of",
"unique",
"elements",
"in",
"the",
"group"
] | def nunique(self, dropna=True):
""" Returns number of unique elements in the group """
ids, _, _ = self.grouper.group_info
val = self.obj.get_values()
try:
sorter = np.lexsort((val, ids))
except TypeError: # catches object dtypes
msg = 'val.dtype must b... | [
"def",
"nunique",
"(",
"self",
",",
"dropna",
"=",
"True",
")",
":",
"ids",
",",
"_",
",",
"_",
"=",
"self",
".",
"grouper",
".",
"group_info",
"val",
"=",
"self",
".",
"obj",
".",
"get_values",
"(",
")",
"try",
":",
"sorter",
"=",
"np",
".",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/groupby/generic.py#L1023-L1076 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/metrics/confusion_matrix.py | python | ConfusionMatrixMetric.update | (self, *inputs) | Update state with predictions and targets.
Args:
inputs: Input `y_pred` and `y`. `y_pred` and `y` are a `Tensor`, list or numpy.ndarray.
`y_pred`: The batch data shape is :math:`(N, C, ...)` or :math:`(N, ...)`, representing onehot format
or category index format res... | Update state with predictions and targets. | [
"Update",
"state",
"with",
"predictions",
"and",
"targets",
"."
] | def update(self, *inputs):
"""
Update state with predictions and targets.
Args:
inputs: Input `y_pred` and `y`. `y_pred` and `y` are a `Tensor`, list or numpy.ndarray.
`y_pred`: The batch data shape is :math:`(N, C, ...)` or :math:`(N, ...)`, representing onehot form... | [
"def",
"update",
"(",
"self",
",",
"*",
"inputs",
")",
":",
"if",
"len",
"(",
"inputs",
")",
"!=",
"2",
":",
"raise",
"ValueError",
"(",
"\"For 'ConfusionMatrixMetric.update', it needs 2 inputs (predicted value, true value), \"",
"\"but got {}.\"",
".",
"format",
"(",... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/metrics/confusion_matrix.py#L221-L253 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/optimize/_lsq/common.py | python | left_multiplied_operator | (J, d) | return LinearOperator(J.shape, matvec=matvec, matmat=matmat,
rmatvec=rmatvec) | Return diag(d) J as LinearOperator. | Return diag(d) J as LinearOperator. | [
"Return",
"diag",
"(",
"d",
")",
"J",
"as",
"LinearOperator",
"."
] | def left_multiplied_operator(J, d):
"""Return diag(d) J as LinearOperator."""
J = aslinearoperator(J)
def matvec(x):
return d * J.matvec(x)
def matmat(X):
return d[:, np.newaxis] * J.matmat(X)
def rmatvec(x):
return J.rmatvec(x.ravel() * d)
return LinearOperator(J.sha... | [
"def",
"left_multiplied_operator",
"(",
"J",
",",
"d",
")",
":",
"J",
"=",
"aslinearoperator",
"(",
"J",
")",
"def",
"matvec",
"(",
"x",
")",
":",
"return",
"d",
"*",
"J",
".",
"matvec",
"(",
"x",
")",
"def",
"matmat",
"(",
"X",
")",
":",
"return... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/optimize/_lsq/common.py#L617-L631 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/layers/python/layers/feature_column.py | python | _CrossedColumn.weight_tensor | (self, input_tensor) | return None | Returns the weight tensor from the given transformed input_tensor. | Returns the weight tensor from the given transformed input_tensor. | [
"Returns",
"the",
"weight",
"tensor",
"from",
"the",
"given",
"transformed",
"input_tensor",
"."
] | def weight_tensor(self, input_tensor):
"""Returns the weight tensor from the given transformed input_tensor."""
del input_tensor
return None | [
"def",
"weight_tensor",
"(",
"self",
",",
"input_tensor",
")",
":",
"del",
"input_tensor",
"return",
"None"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/layers/python/layers/feature_column.py#L2249-L2252 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/optimizer/optimizer.py | python | Optimizer._append_optimize_multi_tensor_op | (self, target_block,
parameters_and_grads) | For Multi Tensor, append optimize merged_operator to block. | For Multi Tensor, append optimize merged_operator to block. | [
"For",
"Multi",
"Tensor",
"append",
"optimize",
"merged_operator",
"to",
"block",
"."
] | def _append_optimize_multi_tensor_op(self, target_block,
parameters_and_grads):
"""
For Multi Tensor, append optimize merged_operator to block.
"""
pass | [
"def",
"_append_optimize_multi_tensor_op",
"(",
"self",
",",
"target_block",
",",
"parameters_and_grads",
")",
":",
"pass"
] | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/optimizer/optimizer.py#L1297-L1302 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/estimators/tensor_signature.py | python | create_example_parser_from_signatures | (signatures,
examples_batch,
single_feature_name="feature") | return features | Creates example parser from given signatures.
Args:
signatures: Dict of `TensorSignature` objects or single `TensorSignature`.
examples_batch: string `Tensor` of serialized `Example` proto.
single_feature_name: string, single feature name.
Returns:
features: `Tensor` or `dict` of `Tensor` objects. | Creates example parser from given signatures. | [
"Creates",
"example",
"parser",
"from",
"given",
"signatures",
"."
] | def create_example_parser_from_signatures(signatures,
examples_batch,
single_feature_name="feature"):
"""Creates example parser from given signatures.
Args:
signatures: Dict of `TensorSignature` objects or single `TensorSignatu... | [
"def",
"create_example_parser_from_signatures",
"(",
"signatures",
",",
"examples_batch",
",",
"single_feature_name",
"=",
"\"feature\"",
")",
":",
"feature_spec",
"=",
"{",
"}",
"if",
"not",
"isinstance",
"(",
"signatures",
",",
"dict",
")",
":",
"feature_spec",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/estimators/tensor_signature.py#L176-L207 | |
xenia-project/xenia | 9b1fdac98665ac091b9660a5d0fbb259ed79e578 | third_party/google-styleguide/cpplint/cpplint.py | python | IsDerivedFunction | (clean_lines, linenum) | return closing_paren >= 0 and Search(r'\boverride\b', line[closing_paren:]) | Check if current line contains an inherited function.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
Returns:
True if current line contains a function with "override"
virt-specifier. | Check if current line contains an inherited function. | [
"Check",
"if",
"current",
"line",
"contains",
"an",
"inherited",
"function",
"."
] | def IsDerivedFunction(clean_lines, linenum):
"""Check if current line contains an inherited function.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
Returns:
True if current line contains a function with "override"
virt-specifier.
"""
... | [
"def",
"IsDerivedFunction",
"(",
"clean_lines",
",",
"linenum",
")",
":",
"# Look for leftmost opening parenthesis on current line",
"opening_paren",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
".",
"find",
"(",
"'('",
")",
"if",
"opening_paren",
"<",
"0... | https://github.com/xenia-project/xenia/blob/9b1fdac98665ac091b9660a5d0fbb259ed79e578/third_party/google-styleguide/cpplint/cpplint.py#L4602-L4618 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/incubate/fleet/base/role_maker.py | python | GeneralRoleMaker.__get_default_iface_from_interfaces | (self) | return "lo" | get default physical interface | get default physical interface | [
"get",
"default",
"physical",
"interface"
] | def __get_default_iface_from_interfaces(self):
"""
get default physical interface
"""
res = os.popen("ip -f inet addr | awk NR%3==1").read().strip().split(
"\n")
for item in res:
if "BROADCAST" in item:
return item.split(":")[1].strip()
... | [
"def",
"__get_default_iface_from_interfaces",
"(",
"self",
")",
":",
"res",
"=",
"os",
".",
"popen",
"(",
"\"ip -f inet addr | awk NR%3==1\"",
")",
".",
"read",
"(",
")",
".",
"strip",
"(",
")",
".",
"split",
"(",
"\"\\n\"",
")",
"for",
"item",
"in",
"res"... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/incubate/fleet/base/role_maker.py#L986-L995 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/io/parsers/readers.py | python | validate_integer | (name, val, min_val=0) | return val | Checks whether the 'name' parameter for parsing is either
an integer OR float that can SAFELY be cast to an integer
without losing accuracy. Raises a ValueError if that is
not the case.
Parameters
----------
name : str
Parameter name (used for error reporting)
val : int or float
... | Checks whether the 'name' parameter for parsing is either
an integer OR float that can SAFELY be cast to an integer
without losing accuracy. Raises a ValueError if that is
not the case. | [
"Checks",
"whether",
"the",
"name",
"parameter",
"for",
"parsing",
"is",
"either",
"an",
"integer",
"OR",
"float",
"that",
"can",
"SAFELY",
"be",
"cast",
"to",
"an",
"integer",
"without",
"losing",
"accuracy",
".",
"Raises",
"a",
"ValueError",
"if",
"that",
... | def validate_integer(name, val, min_val=0):
"""
Checks whether the 'name' parameter for parsing is either
an integer OR float that can SAFELY be cast to an integer
without losing accuracy. Raises a ValueError if that is
not the case.
Parameters
----------
name : str
Parameter na... | [
"def",
"validate_integer",
"(",
"name",
",",
"val",
",",
"min_val",
"=",
"0",
")",
":",
"msg",
"=",
"f\"'{name:s}' must be an integer >={min_val:d}\"",
"if",
"val",
"is",
"not",
"None",
":",
"if",
"is_float",
"(",
"val",
")",
":",
"if",
"int",
"(",
"val",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/io/parsers/readers.py#L414-L440 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pyparsing/py3/pyparsing/unicode.py | python | unicode_set.nums | (cls) | return "".join(filter(str.isdigit, cls._chars_for_ranges)) | all numeric digit characters in this range | all numeric digit characters in this range | [
"all",
"numeric",
"digit",
"characters",
"in",
"this",
"range"
] | def nums(cls):
"all numeric digit characters in this range"
return "".join(filter(str.isdigit, cls._chars_for_ranges)) | [
"def",
"nums",
"(",
"cls",
")",
":",
"return",
"\"\"",
".",
"join",
"(",
"filter",
"(",
"str",
".",
"isdigit",
",",
"cls",
".",
"_chars_for_ranges",
")",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pyparsing/py3/pyparsing/unicode.py#L76-L78 | |
alexgkendall/caffe-posenet | 62aafbd7c45df91acdba14f5d1406d8295c2bc6f | scripts/cpp_lint.py | python | CleansedLines._CollapseStrings | (elided) | return elided | Collapses strings and chars on a line to simple "" or '' blocks.
We nix strings first so we're not fooled by text like '"http://"'
Args:
elided: The line being processed.
Returns:
The line with collapsed strings. | Collapses strings and chars on a line to simple "" or '' blocks. | [
"Collapses",
"strings",
"and",
"chars",
"on",
"a",
"line",
"to",
"simple",
"or",
"blocks",
"."
] | def _CollapseStrings(elided):
"""Collapses strings and chars on a line to simple "" or '' blocks.
We nix strings first so we're not fooled by text like '"http://"'
Args:
elided: The line being processed.
Returns:
The line with collapsed strings.
"""
if not _RE_PATTERN_INCLUDE.matc... | [
"def",
"_CollapseStrings",
"(",
"elided",
")",
":",
"if",
"not",
"_RE_PATTERN_INCLUDE",
".",
"match",
"(",
"elided",
")",
":",
"# Remove escaped characters first to make quote/single quote collapsing",
"# basic. Things that look like escaped characters shouldn't occur",
"# outside... | https://github.com/alexgkendall/caffe-posenet/blob/62aafbd7c45df91acdba14f5d1406d8295c2bc6f/scripts/cpp_lint.py#L1209-L1227 | |
microsoft/ELL | a1d6bacc37a14879cc025d9be2ba40b1a0632315 | tools/importers/CNTK/lib/cntk_converters.py | python | get_tensor_from_cntk_dense_weight_parameter | (tensorParameter) | return ell.math.DoubleTensor(orderedWeights) | Returns an ell.math.DoubleTensor from a trainable parameter
Note that ELL's ordering is row, column, channel.
CNTK has them in channel, row, column, filter order.
4D parameters are converted to ELL Tensor by stacking vertically in the row dimension. | Returns an ell.math.DoubleTensor from a trainable parameter
Note that ELL's ordering is row, column, channel.
CNTK has them in channel, row, column, filter order.
4D parameters are converted to ELL Tensor by stacking vertically in the row dimension. | [
"Returns",
"an",
"ell",
".",
"math",
".",
"DoubleTensor",
"from",
"a",
"trainable",
"parameter",
"Note",
"that",
"ELL",
"s",
"ordering",
"is",
"row",
"column",
"channel",
".",
"CNTK",
"has",
"them",
"in",
"channel",
"row",
"column",
"filter",
"order",
".",... | def get_tensor_from_cntk_dense_weight_parameter(tensorParameter):
"""Returns an ell.math.DoubleTensor from a trainable parameter
Note that ELL's ordering is row, column, channel.
CNTK has them in channel, row, column, filter order.
4D parameters are converted to ELL Tensor by stacking verticall... | [
"def",
"get_tensor_from_cntk_dense_weight_parameter",
"(",
"tensorParameter",
")",
":",
"tensorShape",
"=",
"tensorParameter",
".",
"shape",
"tensorValue",
"=",
"tensorParameter",
".",
"value",
"# orderedWeights = tensorValue",
"if",
"(",
"len",
"(",
"tensorShape",
")",
... | https://github.com/microsoft/ELL/blob/a1d6bacc37a14879cc025d9be2ba40b1a0632315/tools/importers/CNTK/lib/cntk_converters.py#L103-L130 | |
arkenthera/electron-vibrancy | 383153ef9ccb23a6c7517150d6bb0794dff3115e | scripts/cpplint.py | python | _BlockInfo.CheckEnd | (self, filename, clean_lines, linenum, error) | Run checks that applies to text after the closing brace.
This is mostly used for checking end of namespace comments.
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... | Run checks that applies to text after the closing brace. | [
"Run",
"checks",
"that",
"applies",
"to",
"text",
"after",
"the",
"closing",
"brace",
"."
] | def CheckEnd(self, filename, clean_lines, linenum, error):
"""Run checks that applies to text after the closing brace.
This is mostly used for checking end of namespace comments.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
line... | [
"def",
"CheckEnd",
"(",
"self",
",",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"pass"
] | https://github.com/arkenthera/electron-vibrancy/blob/383153ef9ccb23a6c7517150d6bb0794dff3115e/scripts/cpplint.py#L1793-L1804 | ||
shader-slang/slang | b8982fcf43b86c1e39dcc3dd19bff2821633eda6 | external/vulkan/registry/conventions.py | python | ConventionsBase.requires_error_validation | (self, return_type) | return False | Return True if the return_type element is an API result code
requiring error validation.
Defaults to always False.
May override. | Return True if the return_type element is an API result code
requiring error validation. | [
"Return",
"True",
"if",
"the",
"return_type",
"element",
"is",
"an",
"API",
"result",
"code",
"requiring",
"error",
"validation",
"."
] | def requires_error_validation(self, return_type):
"""Return True if the return_type element is an API result code
requiring error validation.
Defaults to always False.
May override."""
return False | [
"def",
"requires_error_validation",
"(",
"self",
",",
"return_type",
")",
":",
"return",
"False"
] | https://github.com/shader-slang/slang/blob/b8982fcf43b86c1e39dcc3dd19bff2821633eda6/external/vulkan/registry/conventions.py#L253-L260 | |
dmlc/xgboost | 2775c2a1abd4b5b759ff517617434c8b9aeb4cc0 | demo/aft_survival/aft_survival_viz_demo.py | python | plot_intermediate_model_callback | (env) | Custom callback to plot intermediate models | Custom callback to plot intermediate models | [
"Custom",
"callback",
"to",
"plot",
"intermediate",
"models"
] | def plot_intermediate_model_callback(env):
"""Custom callback to plot intermediate models"""
# Compute y_pred = prediction using the intermediate model, at current boosting iteration
y_pred = env.model.predict(dmat)
# "Accuracy" = the number of data points whose ranged label (y_lower, y_upper) includes
... | [
"def",
"plot_intermediate_model_callback",
"(",
"env",
")",
":",
"# Compute y_pred = prediction using the intermediate model, at current boosting iteration",
"y_pred",
"=",
"env",
".",
"model",
".",
"predict",
"(",
"dmat",
")",
"# \"Accuracy\" = the number of data points whose rang... | https://github.com/dmlc/xgboost/blob/2775c2a1abd4b5b759ff517617434c8b9aeb4cc0/demo/aft_survival/aft_survival_viz_demo.py#L52-L69 | ||
KhronosGroup/Vulkan-Headers | b32da5329b50e3cb96229aaecba9ded032fe29cc | registry/conventions.py | python | ConventionsBase.formatExtension | (self, name) | return '`apiext:{}`'.format(name) | Mark up an extension name as a link the spec. | Mark up an extension name as a link the spec. | [
"Mark",
"up",
"an",
"extension",
"name",
"as",
"a",
"link",
"the",
"spec",
"."
] | def formatExtension(self, name):
"""Mark up an extension name as a link the spec."""
return '`apiext:{}`'.format(name) | [
"def",
"formatExtension",
"(",
"self",
",",
"name",
")",
":",
"return",
"'`apiext:{}`'",
".",
"format",
"(",
"name",
")"
] | https://github.com/KhronosGroup/Vulkan-Headers/blob/b32da5329b50e3cb96229aaecba9ded032fe29cc/registry/conventions.py#L73-L75 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/foldpanelbar.py | python | FoldPanelBar.RepositionCollapsedToBottom | (self) | return value | Repositions all the collapsed panels to the bottom.
When it is not possible to align them to the bottom, stick them behind
the visible panels. | Repositions all the collapsed panels to the bottom. | [
"Repositions",
"all",
"the",
"collapsed",
"panels",
"to",
"the",
"bottom",
"."
] | def RepositionCollapsedToBottom(self):
"""
Repositions all the collapsed panels to the bottom.
When it is not possible to align them to the bottom, stick them behind
the visible panels.
"""
value = wx.Rect(0,0,0,0)
vertical = self.IsVertical()
# determi... | [
"def",
"RepositionCollapsedToBottom",
"(",
"self",
")",
":",
"value",
"=",
"wx",
".",
"Rect",
"(",
"0",
",",
"0",
",",
"0",
",",
"0",
")",
"vertical",
"=",
"self",
".",
"IsVertical",
"(",
")",
"# determine wether the number of panels left",
"# times the size o... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/foldpanelbar.py#L1500-L1551 | |
htcondor/htcondor | 4829724575176d1d6c936e4693dfd78a728569b0 | src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/user.py | python | IUser.SaveAvatarToFile | (self, Filename, AvatarId=1) | Saves user avatar to a file.
@param Filename: Destination path.
@type Filename: unicode
@param AvatarId: Avatar Id.
@type AvatarId: int | Saves user avatar to a file. | [
"Saves",
"user",
"avatar",
"to",
"a",
"file",
"."
] | def SaveAvatarToFile(self, Filename, AvatarId=1):
'''Saves user avatar to a file.
@param Filename: Destination path.
@type Filename: unicode
@param AvatarId: Avatar Id.
@type AvatarId: int
'''
s = 'USER %s AVATAR %s %s' % (self.Handle, AvatarId, Filename)
... | [
"def",
"SaveAvatarToFile",
"(",
"self",
",",
"Filename",
",",
"AvatarId",
"=",
"1",
")",
":",
"s",
"=",
"'USER %s AVATAR %s %s'",
"%",
"(",
"self",
".",
"Handle",
",",
"AvatarId",
",",
"Filename",
")",
"self",
".",
"_Skype",
".",
"_DoCommand",
"(",
"'GET... | https://github.com/htcondor/htcondor/blob/4829724575176d1d6c936e4693dfd78a728569b0/src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/user.py#L22-L31 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/Editra.py | python | Editra.IsOnlyInstance | (self) | return self._isfirst | Check if this app is the the first instance that is running
@return: bool | Check if this app is the the first instance that is running
@return: bool | [
"Check",
"if",
"this",
"app",
"is",
"the",
"the",
"first",
"instance",
"that",
"is",
"running",
"@return",
":",
"bool"
] | def IsOnlyInstance(self):
"""Check if this app is the the first instance that is running
@return: bool
"""
return self._isfirst | [
"def",
"IsOnlyInstance",
"(",
"self",
")",
":",
"return",
"self",
".",
"_isfirst"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/Editra.py#L431-L436 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/cookielib.py | python | CookieJar.make_cookies | (self, response, request) | return cookies | Return sequence of Cookie objects extracted from response object. | Return sequence of Cookie objects extracted from response object. | [
"Return",
"sequence",
"of",
"Cookie",
"objects",
"extracted",
"from",
"response",
"object",
"."
] | def make_cookies(self, response, request):
"""Return sequence of Cookie objects extracted from response object."""
# get cookie-attributes for RFC 2965 and Netscape protocols
headers = response.info()
rfc2965_hdrs = headers.getheaders("Set-Cookie2")
ns_hdrs = headers.getheaders("... | [
"def",
"make_cookies",
"(",
"self",
",",
"response",
",",
"request",
")",
":",
"# get cookie-attributes for RFC 2965 and Netscape protocols",
"headers",
"=",
"response",
".",
"info",
"(",
")",
"rfc2965_hdrs",
"=",
"headers",
".",
"getheaders",
"(",
"\"Set-Cookie2\"",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/cookielib.py#L1555-L1607 | |
GJDuck/LowFat | ecf6a0f0fa1b73a27a626cf493cc39e477b6faea | llvm-4.0.0.src/projects/compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | _BlockInfo.CheckEnd | (self, filename, clean_lines, linenum, error) | Run checks that applies to text after the closing brace.
This is mostly used for checking end of namespace comments.
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... | Run checks that applies to text after the closing brace. | [
"Run",
"checks",
"that",
"applies",
"to",
"text",
"after",
"the",
"closing",
"brace",
"."
] | def CheckEnd(self, filename, clean_lines, linenum, error):
"""Run checks that applies to text after the closing brace.
This is mostly used for checking end of namespace comments.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
line... | [
"def",
"CheckEnd",
"(",
"self",
",",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"pass"
] | https://github.com/GJDuck/LowFat/blob/ecf6a0f0fa1b73a27a626cf493cc39e477b6faea/llvm-4.0.0.src/projects/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L1380-L1391 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | FontData.SetAllowSymbols | (*args, **kwargs) | return _windows_.FontData_SetAllowSymbols(*args, **kwargs) | SetAllowSymbols(self, bool allowSymbols)
Under MS Windows, determines whether symbol fonts can be selected. Has
no effect on other platforms. The default value is true. | SetAllowSymbols(self, bool allowSymbols) | [
"SetAllowSymbols",
"(",
"self",
"bool",
"allowSymbols",
")"
] | def SetAllowSymbols(*args, **kwargs):
"""
SetAllowSymbols(self, bool allowSymbols)
Under MS Windows, determines whether symbol fonts can be selected. Has
no effect on other platforms. The default value is true.
"""
return _windows_.FontData_SetAllowSymbols(*args, **kwar... | [
"def",
"SetAllowSymbols",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"FontData_SetAllowSymbols",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L3519-L3526 | |
smilehao/xlua-framework | a03801538be2b0e92d39332d445b22caca1ef61f | ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/build/lib/google/protobuf/internal/containers.py | python | RepeatedCompositeFieldContainer.remove | (self, elem) | Removes an item from the list. Similar to list.remove(). | Removes an item from the list. Similar to list.remove(). | [
"Removes",
"an",
"item",
"from",
"the",
"list",
".",
"Similar",
"to",
"list",
".",
"remove",
"()",
"."
] | def remove(self, elem):
"""Removes an item from the list. Similar to list.remove()."""
self._values.remove(elem)
self._message_listener.Modified() | [
"def",
"remove",
"(",
"self",
",",
"elem",
")",
":",
"self",
".",
"_values",
".",
"remove",
"(",
"elem",
")",
"self",
".",
"_message_listener",
".",
"Modified",
"(",
")"
] | https://github.com/smilehao/xlua-framework/blob/a03801538be2b0e92d39332d445b22caca1ef61f/ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/build/lib/google/protobuf/internal/containers.py#L243-L246 | ||
Tencent/TNN | 7acca99f54c55747b415a4c57677403eebc7b706 | third_party/flatbuffers/python/flatbuffers/builder.py | python | Builder.CreateNumpyVector | (self, x) | return self.EndVector() | CreateNumpyVector writes a numpy array into the buffer. | CreateNumpyVector writes a numpy array into the buffer. | [
"CreateNumpyVector",
"writes",
"a",
"numpy",
"array",
"into",
"the",
"buffer",
"."
] | def CreateNumpyVector(self, x):
"""CreateNumpyVector writes a numpy array into the buffer."""
if np is None:
# Numpy is required for this feature
raise NumpyRequiredForThisFeature("Numpy was not found.")
if not isinstance(x, np.ndarray):
raise TypeError("non... | [
"def",
"CreateNumpyVector",
"(",
"self",
",",
"x",
")",
":",
"if",
"np",
"is",
"None",
":",
"# Numpy is required for this feature",
"raise",
"NumpyRequiredForThisFeature",
"(",
"\"Numpy was not found.\"",
")",
"if",
"not",
"isinstance",
"(",
"x",
",",
"np",
".",
... | https://github.com/Tencent/TNN/blob/7acca99f54c55747b415a4c57677403eebc7b706/third_party/flatbuffers/python/flatbuffers/builder.py#L441-L475 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/crywaflib/default_settings.py | python | register_verify_attribute_callback | (f) | Decorator function to register a callback verifying an options attribute.
*note* The callback function must have the same name as the attribute *note* | Decorator function to register a callback verifying an options attribute.
*note* The callback function must have the same name as the attribute *note* | [
"Decorator",
"function",
"to",
"register",
"a",
"callback",
"verifying",
"an",
"options",
"attribute",
".",
"*",
"note",
"*",
"The",
"callback",
"function",
"must",
"have",
"the",
"same",
"name",
"as",
"the",
"attribute",
"*",
"note",
"*"
] | def register_verify_attribute_callback(f):
"""
Decorator function to register a callback verifying an options attribute.
*note* The callback function must have the same name as the attribute *note*
"""
ATTRIBUTE_VERIFICATION_CALLBACKS[f.__name__] = f | [
"def",
"register_verify_attribute_callback",
"(",
"f",
")",
":",
"ATTRIBUTE_VERIFICATION_CALLBACKS",
"[",
"f",
".",
"__name__",
"]",
"=",
"f"
] | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/crywaflib/default_settings.py#L42-L47 | ||
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TChA.ToTrunc | (self) | return _snap.TChA_ToTrunc(self) | ToTrunc(TChA self) -> TChA
Parameters:
self: TChA * | ToTrunc(TChA self) -> TChA | [
"ToTrunc",
"(",
"TChA",
"self",
")",
"-",
">",
"TChA"
] | def ToTrunc(self):
"""
ToTrunc(TChA self) -> TChA
Parameters:
self: TChA *
"""
return _snap.TChA_ToTrunc(self) | [
"def",
"ToTrunc",
"(",
"self",
")",
":",
"return",
"_snap",
".",
"TChA_ToTrunc",
"(",
"self",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L9004-L9012 | |
microsoft/clang | 86d4513d3e0daa4d5a29b0b1de7c854ca15f9fe5 | bindings/python/clang/cindex.py | python | Type.get_class_type | (self) | return conf.lib.clang_Type_getClassType(self) | Retrieve the class type of the member pointer type. | Retrieve the class type of the member pointer type. | [
"Retrieve",
"the",
"class",
"type",
"of",
"the",
"member",
"pointer",
"type",
"."
] | def get_class_type(self):
"""
Retrieve the class type of the member pointer type.
"""
return conf.lib.clang_Type_getClassType(self) | [
"def",
"get_class_type",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_Type_getClassType",
"(",
"self",
")"
] | https://github.com/microsoft/clang/blob/86d4513d3e0daa4d5a29b0b1de7c854ca15f9fe5/bindings/python/clang/cindex.py#L2345-L2349 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TSInOut.GetPos | (self) | return _snap.TSInOut_GetPos(self) | GetPos(TSInOut self) -> int
Parameters:
self: TSInOut const * | GetPos(TSInOut self) -> int | [
"GetPos",
"(",
"TSInOut",
"self",
")",
"-",
">",
"int"
] | def GetPos(self):
"""
GetPos(TSInOut self) -> int
Parameters:
self: TSInOut const *
"""
return _snap.TSInOut_GetPos(self) | [
"def",
"GetPos",
"(",
"self",
")",
":",
"return",
"_snap",
".",
"TSInOut_GetPos",
"(",
"self",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L2634-L2642 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/io/pytables.py | python | _get_data_and_dtype_name | (data: ArrayLike) | return data, dtype_name | Convert the passed data into a storable form and a dtype string. | Convert the passed data into a storable form and a dtype string. | [
"Convert",
"the",
"passed",
"data",
"into",
"a",
"storable",
"form",
"and",
"a",
"dtype",
"string",
"."
] | def _get_data_and_dtype_name(data: ArrayLike):
"""
Convert the passed data into a storable form and a dtype string.
"""
if isinstance(data, Categorical):
data = data.codes
# For datetime64tz we need to drop the TZ in tests TODO: why?
dtype_name = data.dtype.name.split("[")[0]
if da... | [
"def",
"_get_data_and_dtype_name",
"(",
"data",
":",
"ArrayLike",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"Categorical",
")",
":",
"data",
"=",
"data",
".",
"codes",
"# For datetime64tz we need to drop the TZ in tests TODO: why?",
"dtype_name",
"=",
"data",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/io/pytables.py#L5163-L5182 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/config/configobj.py | python | ConfigObj._handle_bom | (self, infile) | Handle any BOM, and decode if necessary.
If an encoding is specified, that *must* be used - but the BOM should
still be removed (and the BOM attribute set).
(If the encoding is wrongly specified, then a BOM for an alternative
encoding won't be discovered or removed.)
... | Handle any BOM, and decode if necessary.
If an encoding is specified, that *must* be used - but the BOM should
still be removed (and the BOM attribute set).
(If the encoding is wrongly specified, then a BOM for an alternative
encoding won't be discovered or removed.)
... | [
"Handle",
"any",
"BOM",
"and",
"decode",
"if",
"necessary",
".",
"If",
"an",
"encoding",
"is",
"specified",
"that",
"*",
"must",
"*",
"be",
"used",
"-",
"but",
"the",
"BOM",
"should",
"still",
"be",
"removed",
"(",
"and",
"the",
"BOM",
"attribute",
"se... | def _handle_bom(self, infile):
"""
Handle any BOM, and decode if necessary.
If an encoding is specified, that *must* be used - but the BOM should
still be removed (and the BOM attribute set).
(If the encoding is wrongly specified, then a BOM for an alternative
... | [
"def",
"_handle_bom",
"(",
"self",
",",
"infile",
")",
":",
"if",
"(",
"(",
"self",
".",
"encoding",
"is",
"not",
"None",
")",
"and",
"(",
"self",
".",
"encoding",
".",
"lower",
"(",
")",
"not",
"in",
"BOM_LIST",
")",
")",
":",
"# No need to check fo... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/config/configobj.py#L1266-L1365 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site.py | python | execusercustomize | () | Run custom user specific code, if available. | Run custom user specific code, if available. | [
"Run",
"custom",
"user",
"specific",
"code",
"if",
"available",
"."
] | def execusercustomize():
"""Run custom user specific code, if available."""
try:
try:
import usercustomize
except ImportError as exc:
if exc.name == 'usercustomize':
pass
else:
raise
except Exception as err:
if sys.f... | [
"def",
"execusercustomize",
"(",
")",
":",
"try",
":",
"try",
":",
"import",
"usercustomize",
"except",
"ImportError",
"as",
"exc",
":",
"if",
"exc",
".",
"name",
"==",
"'usercustomize'",
":",
"pass",
"else",
":",
"raise",
"except",
"Exception",
"as",
"err... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site.py#L527-L544 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | buildconfig/class_maker.py | python | get_year | () | return datetime.datetime.now().year | returns the current year | returns the current year | [
"returns",
"the",
"current",
"year"
] | def get_year():
"""returns the current year"""
return datetime.datetime.now().year | [
"def",
"get_year",
"(",
")",
":",
"return",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
".",
"year"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/buildconfig/class_maker.py#L16-L18 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.