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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | Button.SetDefault | (*args, **kwargs) | return _controls_.Button_SetDefault(*args, **kwargs) | SetDefault(self) -> Window
This sets the button to be the default item for the panel or dialog box. | SetDefault(self) -> Window | [
"SetDefault",
"(",
"self",
")",
"-",
">",
"Window"
] | def SetDefault(*args, **kwargs):
"""
SetDefault(self) -> Window
This sets the button to be the default item for the panel or dialog box.
"""
return _controls_.Button_SetDefault(*args, **kwargs) | [
"def",
"SetDefault",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"Button_SetDefault",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L215-L221 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/stc.py | python | StyledTextCtrl.AutoCompSetIgnoreCase | (*args, **kwargs) | return _stc.StyledTextCtrl_AutoCompSetIgnoreCase(*args, **kwargs) | AutoCompSetIgnoreCase(self, bool ignoreCase)
Set whether case is significant when performing auto-completion searches. | AutoCompSetIgnoreCase(self, bool ignoreCase) | [
"AutoCompSetIgnoreCase",
"(",
"self",
"bool",
"ignoreCase",
")"
] | def AutoCompSetIgnoreCase(*args, **kwargs):
"""
AutoCompSetIgnoreCase(self, bool ignoreCase)
Set whether case is significant when performing auto-completion searches.
"""
return _stc.StyledTextCtrl_AutoCompSetIgnoreCase(*args, **kwargs) | [
"def",
"AutoCompSetIgnoreCase",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_AutoCompSetIgnoreCase",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/stc.py#L3145-L3151 | |
dmlc/dmlc-core | 20ec5bee3a655e8d66e50e3abf7ab5c35ea028fe | tracker/dmlc_tracker/yarn.py | python | yarn_submit | (args, nworker, nserver, pass_env) | return thread | Submission function for YARN. | Submission function for YARN. | [
"Submission",
"function",
"for",
"YARN",
"."
] | def yarn_submit(args, nworker, nserver, pass_env):
"""Submission function for YARN."""
is_windows = os.name == 'nt'
hadoop_home = os.getenv('HADOOP_HOME')
assert hadoop_home is not None, 'Need to set HADOOP_HOME for YARN submission.'
hadoop_binary = os.path.join(hadoop_home, 'bin', 'hadoop')
ass... | [
"def",
"yarn_submit",
"(",
"args",
",",
"nworker",
",",
"nserver",
",",
"pass_env",
")",
":",
"is_windows",
"=",
"os",
".",
"name",
"==",
"'nt'",
"hadoop_home",
"=",
"os",
".",
"getenv",
"(",
"'HADOOP_HOME'",
")",
"assert",
"hadoop_home",
"is",
"not",
"N... | https://github.com/dmlc/dmlc-core/blob/20ec5bee3a655e8d66e50e3abf7ab5c35ea028fe/tracker/dmlc_tracker/yarn.py#L18-L120 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | PyEvent.__init__ | (self, *args, **kwargs) | __init__(self, int winid=0, EventType eventType=wxEVT_NULL) -> PyEvent | __init__(self, int winid=0, EventType eventType=wxEVT_NULL) -> PyEvent | [
"__init__",
"(",
"self",
"int",
"winid",
"=",
"0",
"EventType",
"eventType",
"=",
"wxEVT_NULL",
")",
"-",
">",
"PyEvent"
] | def __init__(self, *args, **kwargs):
"""__init__(self, int winid=0, EventType eventType=wxEVT_NULL) -> PyEvent"""
_core_.PyEvent_swiginit(self,_core_.new_PyEvent(*args, **kwargs))
self._SetSelf(self) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_core_",
".",
"PyEvent_swiginit",
"(",
"self",
",",
"_core_",
".",
"new_PyEvent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"self",
".",
"_SetSelf",
"(... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L7583-L7586 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/propgrid.py | python | PGProperty.DoGetValidator | (*args, **kwargs) | return _propgrid.PGProperty_DoGetValidator(*args, **kwargs) | DoGetValidator(self) -> Validator | DoGetValidator(self) -> Validator | [
"DoGetValidator",
"(",
"self",
")",
"-",
">",
"Validator"
] | def DoGetValidator(*args, **kwargs):
"""DoGetValidator(self) -> Validator"""
return _propgrid.PGProperty_DoGetValidator(*args, **kwargs) | [
"def",
"DoGetValidator",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PGProperty_DoGetValidator",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/propgrid.py#L397-L399 | |
apache/arrow | af33dd1157eb8d7d9bfac25ebf61445b793b7943 | cpp/build-support/asan_symbolize.py | python | Addr2LineSymbolizer.symbolize | (self, addr, binary, offset) | return ['%s in %s %s' % (addr, function_name, file_name)] | Overrides Symbolizer.symbolize. | Overrides Symbolizer.symbolize. | [
"Overrides",
"Symbolizer",
".",
"symbolize",
"."
] | def symbolize(self, addr, binary, offset):
"""Overrides Symbolizer.symbolize."""
if self.binary != binary:
return None
try:
self.pipe.stdin.write(offset)
self.pipe.stdin.write('\n')
function_name = self.pipe.stdout.readline().rstrip()
file_name = self.pipe.stdout.readline().rst... | [
"def",
"symbolize",
"(",
"self",
",",
"addr",
",",
"binary",
",",
"offset",
")",
":",
"if",
"self",
".",
"binary",
"!=",
"binary",
":",
"return",
"None",
"try",
":",
"self",
".",
"pipe",
".",
"stdin",
".",
"write",
"(",
"offset",
")",
"self",
".",
... | https://github.com/apache/arrow/blob/af33dd1157eb8d7d9bfac25ebf61445b793b7943/cpp/build-support/asan_symbolize.py#L121-L134 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/waflib/Tools/cs.py | python | use_cs | (self) | C# applications honor the **use** keyword::
def build(bld):
bld(features='cs', source='My.cs', bintype='library', gen='my.dll', name='mylib')
bld(features='cs', source='Hi.cs', includes='.', bintype='exe', gen='hi.exe', use='mylib', name='hi') | C# applications honor the **use** keyword:: | [
"C#",
"applications",
"honor",
"the",
"**",
"use",
"**",
"keyword",
"::"
] | def use_cs(self):
"""
C# applications honor the **use** keyword::
def build(bld):
bld(features='cs', source='My.cs', bintype='library', gen='my.dll', name='mylib')
bld(features='cs', source='Hi.cs', includes='.', bintype='exe', gen='hi.exe', use='mylib', name='hi')
"""
names = self.to_list(getattr(self, 'u... | [
"def",
"use_cs",
"(",
"self",
")",
":",
"names",
"=",
"self",
".",
"to_list",
"(",
"getattr",
"(",
"self",
",",
"'use'",
",",
"[",
"]",
")",
")",
"get",
"=",
"self",
".",
"bld",
".",
"get_tgen_by_name",
"for",
"x",
"in",
"names",
":",
"try",
":",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/waflib/Tools/cs.py#L62-L85 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/colourchooser/canvas.py | python | Canvas.DrawBuffer | (self) | Actual drawing function for drawing into the off-screen
buffer. To be overrideen in the implementing class. Do nothing
by default. | Actual drawing function for drawing into the off-screen
buffer. To be overrideen in the implementing class. Do nothing
by default. | [
"Actual",
"drawing",
"function",
"for",
"drawing",
"into",
"the",
"off",
"-",
"screen",
"buffer",
".",
"To",
"be",
"overrideen",
"in",
"the",
"implementing",
"class",
".",
"Do",
"nothing",
"by",
"default",
"."
] | def DrawBuffer(self):
"""Actual drawing function for drawing into the off-screen
buffer. To be overrideen in the implementing class. Do nothing
by default."""
pass | [
"def",
"DrawBuffer",
"(",
"self",
")",
":",
"pass"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/colourchooser/canvas.py#L139-L143 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/next-greater-element-iii.py | python | Solution.nextGreaterElement | (self, n) | return -1 if result >= 0x7FFFFFFF else result | :type n: int
:rtype: int | :type n: int
:rtype: int | [
":",
"type",
"n",
":",
"int",
":",
"rtype",
":",
"int"
] | def nextGreaterElement(self, n):
"""
:type n: int
:rtype: int
"""
digits = map(int, list(str(n)))
k, l = -1, 0
for i in xrange(len(digits) - 1):
if digits[i] < digits[i + 1]:
k = i
if k == -1:
digits.reverse()
... | [
"def",
"nextGreaterElement",
"(",
"self",
",",
"n",
")",
":",
"digits",
"=",
"map",
"(",
"int",
",",
"list",
"(",
"str",
"(",
"n",
")",
")",
")",
"k",
",",
"l",
"=",
"-",
"1",
",",
"0",
"for",
"i",
"in",
"xrange",
"(",
"len",
"(",
"digits",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/next-greater-element-iii.py#L6-L28 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/vis/ipython/widgets.py | python | KlamptWidget.hide | (self,name,value=False) | Changes the visibility status of a certain named target | Changes the visibility status of a certain named target | [
"Changes",
"the",
"visibility",
"status",
"of",
"a",
"certain",
"named",
"target"
] | def hide(self,name,value=False):
"""Changes the visibility status of a certain named target"""
target_name = name
if name in self._extras:
type,data = self._extras[target]
if type == 'Config':
target_name = data
elif type == 'Configs' or type =... | [
"def",
"hide",
"(",
"self",
",",
"name",
",",
"value",
"=",
"False",
")",
":",
"target_name",
"=",
"name",
"if",
"name",
"in",
"self",
".",
"_extras",
":",
"type",
",",
"data",
"=",
"self",
".",
"_extras",
"[",
"target",
"]",
"if",
"type",
"==",
... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/vis/ipython/widgets.py#L250-L263 | ||
fifengine/fifengine | 4b62c42e85bec19893cef8e63e6855927cff2c47 | engine/python/fife/extensions/serializers/__init__.py | python | root_subfile | (masterfile, subfile) | return pathstr | Returns new path for given subfile (path), which is rooted against masterfile
E.g. if masterfile is ./../foo/bar.xml and subfile is ./../foo2/subfoo.xml,
returned path is ../foo2/subfoo.xml
NOTE: masterfile is expected to be *file*, not directory. subfile can be either | Returns new path for given subfile (path), which is rooted against masterfile
E.g. if masterfile is ./../foo/bar.xml and subfile is ./../foo2/subfoo.xml,
returned path is ../foo2/subfoo.xml
NOTE: masterfile is expected to be *file*, not directory. subfile can be either | [
"Returns",
"new",
"path",
"for",
"given",
"subfile",
"(",
"path",
")",
"which",
"is",
"rooted",
"against",
"masterfile",
"E",
".",
"g",
".",
"if",
"masterfile",
"is",
".",
"/",
"..",
"/",
"foo",
"/",
"bar",
".",
"xml",
"and",
"subfile",
"is",
".",
... | def root_subfile(masterfile, subfile):
"""
Returns new path for given subfile (path), which is rooted against masterfile
E.g. if masterfile is ./../foo/bar.xml and subfile is ./../foo2/subfoo.xml,
returned path is ../foo2/subfoo.xml
NOTE: masterfile is expected to be *file*, not directory. subfile can be either
"... | [
"def",
"root_subfile",
"(",
"masterfile",
",",
"subfile",
")",
":",
"s",
"=",
"'/'",
"masterfile",
"=",
"norm_path",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"masterfile",
")",
")",
"subfile",
"=",
"norm_path",
"(",
"os",
".",
"path",
".",
"abspath... | https://github.com/fifengine/fifengine/blob/4b62c42e85bec19893cef8e63e6855927cff2c47/engine/python/fife/extensions/serializers/__init__.py#L53-L83 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | PNEANet.AddIntAttrN | (self, *args) | return _snap.PNEANet_AddIntAttrN(self, *args) | AddIntAttrN(PNEANet self, TStr attr, TInt defaultValue=Mn) -> int
Parameters:
attr: TStr const &
defaultValue: TInt
AddIntAttrN(PNEANet self, TStr attr) -> int
Parameters:
attr: TStr const & | AddIntAttrN(PNEANet self, TStr attr, TInt defaultValue=Mn) -> int | [
"AddIntAttrN",
"(",
"PNEANet",
"self",
"TStr",
"attr",
"TInt",
"defaultValue",
"=",
"Mn",
")",
"-",
">",
"int"
] | def AddIntAttrN(self, *args):
"""
AddIntAttrN(PNEANet self, TStr attr, TInt defaultValue=Mn) -> int
Parameters:
attr: TStr const &
defaultValue: TInt
AddIntAttrN(PNEANet self, TStr attr) -> int
Parameters:
attr: TStr const &
"""
... | [
"def",
"AddIntAttrN",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"PNEANet_AddIntAttrN",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L24271-L24285 | |
CMU-Perceptual-Computing-Lab/caffe_rtpose | a4778bb1c3eb74d7250402016047216f77b4dba6 | python/caffe/classifier.py | python | Classifier.predict | (self, inputs, oversample=True) | return predictions | Predict classification probabilities of inputs.
Parameters
----------
inputs : iterable of (H x W x K) input ndarrays.
oversample : boolean
average predictions across center, corners, and mirrors
when True (default). Center-only prediction when False.
Re... | Predict classification probabilities of inputs. | [
"Predict",
"classification",
"probabilities",
"of",
"inputs",
"."
] | def predict(self, inputs, oversample=True):
"""
Predict classification probabilities of inputs.
Parameters
----------
inputs : iterable of (H x W x K) input ndarrays.
oversample : boolean
average predictions across center, corners, and mirrors
whe... | [
"def",
"predict",
"(",
"self",
",",
"inputs",
",",
"oversample",
"=",
"True",
")",
":",
"# Scale to standardize input dimensions.",
"input_",
"=",
"np",
".",
"zeros",
"(",
"(",
"len",
"(",
"inputs",
")",
",",
"self",
".",
"image_dims",
"[",
"0",
"]",
","... | https://github.com/CMU-Perceptual-Computing-Lab/caffe_rtpose/blob/a4778bb1c3eb74d7250402016047216f77b4dba6/python/caffe/classifier.py#L47-L98 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/rospkg/distro.py | python | _get_rules | (distro_doc, stack_name) | return update_r | Retrieve rules from distro_doc for specified stack. This operates on
the raw distro dictionary document.
:param distro_doc: rosdistro document, ``dict``
:param stack_name: name of stack to get rules for, ``str`` | Retrieve rules from distro_doc for specified stack. This operates on
the raw distro dictionary document. | [
"Retrieve",
"rules",
"from",
"distro_doc",
"for",
"specified",
"stack",
".",
"This",
"operates",
"on",
"the",
"raw",
"distro",
"dictionary",
"document",
"."
] | def _get_rules(distro_doc, stack_name):
"""
Retrieve rules from distro_doc for specified stack. This operates on
the raw distro dictionary document.
:param distro_doc: rosdistro document, ``dict``
:param stack_name: name of stack to get rules for, ``str``
"""
# top-level named section
... | [
"def",
"_get_rules",
"(",
"distro_doc",
",",
"stack_name",
")",
":",
"# top-level named section",
"named_rules_d",
"=",
"distro_doc",
".",
"get",
"(",
"'_rules'",
",",
"{",
"}",
")",
"# other rules to search",
"rules_d",
"=",
"[",
"distro_doc",
".",
"get",
"(",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/rospkg/distro.py#L310-L339 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/nn_ops.py | python | log_softmax_v2 | (logits, axis=None, name=None) | return _wrap_2d_function(logits, gen_nn_ops.log_softmax, axis, name) | Computes log softmax activations.
For each batch `i` and class `j` we have
logsoftmax = logits - log(reduce_sum(exp(logits), axis))
Args:
logits: A non-empty `Tensor`. Must be one of the following types: `half`,
`float32`, `float64`.
axis: The dimension softmax would be performed on. The defa... | Computes log softmax activations. | [
"Computes",
"log",
"softmax",
"activations",
"."
] | def log_softmax_v2(logits, axis=None, name=None):
"""Computes log softmax activations.
For each batch `i` and class `j` we have
logsoftmax = logits - log(reduce_sum(exp(logits), axis))
Args:
logits: A non-empty `Tensor`. Must be one of the following types: `half`,
`float32`, `float64`.
axis... | [
"def",
"log_softmax_v2",
"(",
"logits",
",",
"axis",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"if",
"axis",
"is",
"None",
":",
"axis",
"=",
"-",
"1",
"return",
"_wrap_2d_function",
"(",
"logits",
",",
"gen_nn_ops",
".",
"log_softmax",
",",
"axi... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/nn_ops.py#L3913-L3936 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | example/speech_recognition/stt_utils.py | python | spectrogram | (samples, fft_length=256, sample_rate=2, hop_length=128) | return x, freqs | Compute the spectrogram for a real signal.
The parameters follow the naming convention of
matplotlib.mlab.specgram
Args:
samples (1D array): input audio signal
fft_length (int): number of elements in fft window
sample_rate (scalar): sample rate
hop_length (int): hop length (r... | Compute the spectrogram for a real signal.
The parameters follow the naming convention of
matplotlib.mlab.specgram
Args:
samples (1D array): input audio signal
fft_length (int): number of elements in fft window
sample_rate (scalar): sample rate
hop_length (int): hop length (r... | [
"Compute",
"the",
"spectrogram",
"for",
"a",
"real",
"signal",
".",
"The",
"parameters",
"follow",
"the",
"naming",
"convention",
"of",
"matplotlib",
".",
"mlab",
".",
"specgram",
"Args",
":",
"samples",
"(",
"1D",
"array",
")",
":",
"input",
"audio",
"sig... | def spectrogram(samples, fft_length=256, sample_rate=2, hop_length=128):
"""
Compute the spectrogram for a real signal.
The parameters follow the naming convention of
matplotlib.mlab.specgram
Args:
samples (1D array): input audio signal
fft_length (int): number of elements in fft win... | [
"def",
"spectrogram",
"(",
"samples",
",",
"fft_length",
"=",
"256",
",",
"sample_rate",
"=",
"2",
",",
"hop_length",
"=",
"128",
")",
":",
"assert",
"not",
"np",
".",
"iscomplexobj",
"(",
"samples",
")",
",",
"\"Must not pass in complex numbers\"",
"window",
... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/example/speech_recognition/stt_utils.py#L53-L104 | |
Smorodov/Multitarget-tracker | bee300e8bfd660c86cbeb6892c65a5b7195c9381 | thirdparty/pybind11/tools/clang/cindex.py | python | Type.get_ref_qualifier | (self) | return RefQualifierKind.from_id(
conf.lib.clang_Type_getCXXRefQualifier(self)) | Retrieve the ref-qualifier of the type. | Retrieve the ref-qualifier of the type. | [
"Retrieve",
"the",
"ref",
"-",
"qualifier",
"of",
"the",
"type",
"."
] | def get_ref_qualifier(self):
"""
Retrieve the ref-qualifier of the type.
"""
return RefQualifierKind.from_id(
conf.lib.clang_Type_getCXXRefQualifier(self)) | [
"def",
"get_ref_qualifier",
"(",
"self",
")",
":",
"return",
"RefQualifierKind",
".",
"from_id",
"(",
"conf",
".",
"lib",
".",
"clang_Type_getCXXRefQualifier",
"(",
"self",
")",
")"
] | https://github.com/Smorodov/Multitarget-tracker/blob/bee300e8bfd660c86cbeb6892c65a5b7195c9381/thirdparty/pybind11/tools/clang/cindex.py#L2101-L2106 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/pydoc.py | python | gui | () | Graphical interface (starts web server and pops up a control window). | Graphical interface (starts web server and pops up a control window). | [
"Graphical",
"interface",
"(",
"starts",
"web",
"server",
"and",
"pops",
"up",
"a",
"control",
"window",
")",
"."
] | def gui():
"""Graphical interface (starts web server and pops up a control window)."""
class GUI:
def __init__(self, window, port=7464):
self.window = window
self.server = None
self.scanner = None
import Tkinter
self.server_frm = Tkinter.Frame... | [
"def",
"gui",
"(",
")",
":",
"class",
"GUI",
":",
"def",
"__init__",
"(",
"self",
",",
"window",
",",
"port",
"=",
"7464",
")",
":",
"self",
".",
"window",
"=",
"window",
"self",
".",
"server",
"=",
"None",
"self",
".",
"scanner",
"=",
"None",
"i... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/pydoc.py#L2090-L2269 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/layers/python/layers/embedding_ops.py | python | hashed_embedding_lookup_sparse | (params,
sparse_values,
dimension,
combiner="mean",
default_value=None,
name=None) | Looks up embeddings of a sparse feature using parameter hashing.
See `tf.contrib.layers.hashed_embedding_lookup` for embedding with hashing.
Args:
params: A `Tensor` or `list` of `Tensors`.
Each tensor must be of rank 1 with fully-defined shape.
sparse_values: A 2-D `SparseTensor` containing the val... | Looks up embeddings of a sparse feature using parameter hashing. | [
"Looks",
"up",
"embeddings",
"of",
"a",
"sparse",
"feature",
"using",
"parameter",
"hashing",
"."
] | def hashed_embedding_lookup_sparse(params,
sparse_values,
dimension,
combiner="mean",
default_value=None,
name=None):
"""Looks up embeddings of... | [
"def",
"hashed_embedding_lookup_sparse",
"(",
"params",
",",
"sparse_values",
",",
"dimension",
",",
"combiner",
"=",
"\"mean\"",
",",
"default_value",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"params",
",",
"list",
")... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/layers/python/layers/embedding_ops.py#L244-L313 | ||
devsisters/libquic | 8954789a056d8e7d5fcb6452fd1572ca57eb5c4e | src/third_party/protobuf/python/google/protobuf/message.py | python | Message.HasField | (self, field_name) | Checks if a certain field is set for the message, or if any field inside
a oneof group is set. Note that if the field_name is not defined in the
message descriptor, ValueError will be raised. | Checks if a certain field is set for the message, or if any field inside
a oneof group is set. Note that if the field_name is not defined in the
message descriptor, ValueError will be raised. | [
"Checks",
"if",
"a",
"certain",
"field",
"is",
"set",
"for",
"the",
"message",
"or",
"if",
"any",
"field",
"inside",
"a",
"oneof",
"group",
"is",
"set",
".",
"Note",
"that",
"if",
"the",
"field_name",
"is",
"not",
"defined",
"in",
"the",
"message",
"de... | def HasField(self, field_name):
"""Checks if a certain field is set for the message, or if any field inside
a oneof group is set. Note that if the field_name is not defined in the
message descriptor, ValueError will be raised."""
raise NotImplementedError | [
"def",
"HasField",
"(",
"self",
",",
"field_name",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/devsisters/libquic/blob/8954789a056d8e7d5fcb6452fd1572ca57eb5c4e/src/third_party/protobuf/python/google/protobuf/message.py#L234-L238 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/ttk.py | python | Treeview.bbox | (self, item, column=None) | return self.tk.call(self._w, "bbox", item, column) | Returns the bounding box (relative to the treeview widget's
window) of the specified item in the form x y width height.
If column is specified, returns the bounding box of that cell.
If the item is not visible (i.e., if it is a descendant of a
closed item or is scrolled offscreen), retu... | Returns the bounding box (relative to the treeview widget's
window) of the specified item in the form x y width height. | [
"Returns",
"the",
"bounding",
"box",
"(",
"relative",
"to",
"the",
"treeview",
"widget",
"s",
"window",
")",
"of",
"the",
"specified",
"item",
"in",
"the",
"form",
"x",
"y",
"width",
"height",
"."
] | def bbox(self, item, column=None):
"""Returns the bounding box (relative to the treeview widget's
window) of the specified item in the form x y width height.
If column is specified, returns the bounding box of that cell.
If the item is not visible (i.e., if it is a descendant of a
... | [
"def",
"bbox",
"(",
"self",
",",
"item",
",",
"column",
"=",
"None",
")",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"\"bbox\"",
",",
"item",
",",
"column",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/ttk.py#L1177-L1184 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/plat-mac/findertools.py | python | _setwindowposition | (folder_alias, (x, y)) | Set the size of a Finder window for folder to (w, h). | Set the size of a Finder window for folder to (w, h). | [
"Set",
"the",
"size",
"of",
"a",
"Finder",
"window",
"for",
"folder",
"to",
"(",
"w",
"h",
")",
"."
] | def _setwindowposition(folder_alias, (x, y)):
"""Set the size of a Finder window for folder to (w, h)."""
finder = _getfinder()
args = {}
attrs = {}
aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'),
form="alis", seld=folder_alias, fr=None)
aeobj_1 = aetypes.ObjectSpecifier... | [
"def",
"_setwindowposition",
"(",
"folder_alias",
",",
"(",
"x",
",",
"y",
")",
")",
":",
"finder",
"=",
"_getfinder",
"(",
")",
"args",
"=",
"{",
"}",
"attrs",
"=",
"{",
"}",
"aeobj_0",
"=",
"aetypes",
".",
"ObjectSpecifier",
"(",
"want",
"=",
"aety... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/plat-mac/findertools.py#L496-L513 | ||
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/p4util/util.py | python | cubeprop | (wfn, **kwargs) | Evaluate properties on a grid and generate cube files.
.. versionadded:: 0.5
*wfn* parameter passed explicitly
:returns: None
:type wfn: :py:class:`~psi4.core.Wavefunction`
:param wfn: set of molecule, basis, orbitals from which to generate cube files
:examples:
>>> # [1] Cube files ... | Evaluate properties on a grid and generate cube files. | [
"Evaluate",
"properties",
"on",
"a",
"grid",
"and",
"generate",
"cube",
"files",
"."
] | def cubeprop(wfn, **kwargs):
"""Evaluate properties on a grid and generate cube files.
.. versionadded:: 0.5
*wfn* parameter passed explicitly
:returns: None
:type wfn: :py:class:`~psi4.core.Wavefunction`
:param wfn: set of molecule, basis, orbitals from which to generate cube files
:... | [
"def",
"cubeprop",
"(",
"wfn",
",",
"*",
"*",
"kwargs",
")",
":",
"# By default compute the orbitals",
"if",
"not",
"core",
".",
"has_global_option_changed",
"(",
"'CUBEPROP_TASKS'",
")",
":",
"core",
".",
"set_global_option",
"(",
"'CUBEPROP_TASKS'",
",",
"[",
... | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/p4util/util.py#L77-L110 | ||
pyne/pyne | 0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3 | pyne/dbgen/materials_library.py | python | make_matslib | (fname) | return matslib | Make a pyne.material.MaterialLibrary. First makes elements, then
materials from compendium.
Parameters
----------
fname : str
Path to materials compendium.
Returns
-------
matslib : pyne.material.MaterialLibrary
All the materials you could want, in a handy MaterialLibrary i... | Make a pyne.material.MaterialLibrary. First makes elements, then
materials from compendium. | [
"Make",
"a",
"pyne",
".",
"material",
".",
"MaterialLibrary",
".",
"First",
"makes",
"elements",
"then",
"materials",
"from",
"compendium",
"."
] | def make_matslib(fname):
"""Make a pyne.material.MaterialLibrary. First makes elements, then
materials from compendium.
Parameters
----------
fname : str
Path to materials compendium.
Returns
-------
matslib : pyne.material.MaterialLibrary
All the materials you could wa... | [
"def",
"make_matslib",
"(",
"fname",
")",
":",
"matslib",
"=",
"MaterialLibrary",
"(",
"make_elements",
"(",
")",
")",
"matsdict",
"=",
"grab_materials_compendium",
"(",
"fname",
")",
"matslib",
".",
"update",
"(",
"matsdict",
")",
"return",
"matslib"
] | https://github.com/pyne/pyne/blob/0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3/pyne/dbgen/materials_library.py#L134-L151 | |
yrnkrn/zapcc | c6a8aa30006d997eff0d60fd37b0e62b8aa0ea50 | tools/clang/bindings/python/clang/cindex.py | python | Cursor.enum_value | (self) | return self._enum_value | Return the value of an enum constant. | Return the value of an enum constant. | [
"Return",
"the",
"value",
"of",
"an",
"enum",
"constant",
"."
] | def enum_value(self):
"""Return the value of an enum constant."""
if not hasattr(self, '_enum_value'):
assert self.kind == CursorKind.ENUM_CONSTANT_DECL
# Figure out the underlying type of the enum to know if it
# is a signed or unsigned quantity.
underlyi... | [
"def",
"enum_value",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_enum_value'",
")",
":",
"assert",
"self",
".",
"kind",
"==",
"CursorKind",
".",
"ENUM_CONSTANT_DECL",
"# Figure out the underlying type of the enum to know if it",
"# is a signed ... | https://github.com/yrnkrn/zapcc/blob/c6a8aa30006d997eff0d60fd37b0e62b8aa0ea50/tools/clang/bindings/python/clang/cindex.py#L1691-L1713 | |
HackWebRTC/webrtc | 7abfc990c00ab35090fff285fcf635d1d7892433 | tools_webrtc/android/build_aar.py | python | _EncodeForGN | (value) | Encodes value as a GN literal. | Encodes value as a GN literal. | [
"Encodes",
"value",
"as",
"a",
"GN",
"literal",
"."
] | def _EncodeForGN(value):
"""Encodes value as a GN literal."""
if isinstance(value, str):
return '"' + value + '"'
elif isinstance(value, bool):
return repr(value).lower()
else:
return repr(value) | [
"def",
"_EncodeForGN",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"str",
")",
":",
"return",
"'\"'",
"+",
"value",
"+",
"'\"'",
"elif",
"isinstance",
"(",
"value",
",",
"bool",
")",
":",
"return",
"repr",
"(",
"value",
")",
".",
... | https://github.com/HackWebRTC/webrtc/blob/7abfc990c00ab35090fff285fcf635d1d7892433/tools_webrtc/android/build_aar.py#L104-L111 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/propgrid.py | python | PropertyGridManager.IsFrozen | (*args, **kwargs) | return _propgrid.PropertyGridManager_IsFrozen(*args, **kwargs) | IsFrozen(self) -> bool
Returns ``True`` if the window has been frozen and not thawed yet.
:see: `Freeze` and `Thaw` | IsFrozen(self) -> bool | [
"IsFrozen",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsFrozen(*args, **kwargs):
"""
IsFrozen(self) -> bool
Returns ``True`` if the window has been frozen and not thawed yet.
:see: `Freeze` and `Thaw`
"""
return _propgrid.PropertyGridManager_IsFrozen(*args, **kwargs) | [
"def",
"IsFrozen",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGridManager_IsFrozen",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/propgrid.py#L3532-L3540 | |
microsoft/ELL | a1d6bacc37a14879cc025d9be2ba40b1a0632315 | tools/importers/common/converters.py | python | ConvertBase.get_output_parameters | (self, last_in_block=True, output_index=0) | return (ell_shape, ell_padding_parameter) | Return the output shape and padding parameters as a tuple.
last_in_block - indicates whether this will be the last ell
node in a block. If it is, it will have its output padding set
differently. | Return the output shape and padding parameters as a tuple.
last_in_block - indicates whether this will be the last ell
node in a block. If it is, it will have its output padding set
differently. | [
"Return",
"the",
"output",
"shape",
"and",
"padding",
"parameters",
"as",
"a",
"tuple",
".",
"last_in_block",
"-",
"indicates",
"whether",
"this",
"will",
"be",
"the",
"last",
"ell",
"node",
"in",
"a",
"block",
".",
"If",
"it",
"is",
"it",
"will",
"have"... | def get_output_parameters(self, last_in_block=True, output_index=0):
"""
Return the output shape and padding parameters as a tuple.
last_in_block - indicates whether this will be the last ell
node in a block. If it is, it will have its output padding set
differently.
"""
... | [
"def",
"get_output_parameters",
"(",
"self",
",",
"last_in_block",
"=",
"True",
",",
"output_index",
"=",
"0",
")",
":",
"shape_entry",
"=",
"self",
".",
"importer_node",
".",
"output_shapes",
"[",
"output_index",
"]",
"padding",
"=",
"0",
"if",
"last_in_block... | https://github.com/microsoft/ELL/blob/a1d6bacc37a14879cc025d9be2ba40b1a0632315/tools/importers/common/converters.py#L369-L382 | |
leosac/leosac | 932a2a90bd2e75483d46b24fdbc8f02e0809d731 | python/leosacpy/cli/cli_config.py | python | find_config_file | () | return None | Find the configuration file to use and return a Path to it.
This function will look in various place to find the configuration file.
In order, those location are tested:
+ ./.leosacclirc
+ $HOME/.leosacclirc
:return: Optionally a path to the config file we found. | Find the configuration file to use and return a Path to it. | [
"Find",
"the",
"configuration",
"file",
"to",
"use",
"and",
"return",
"a",
"Path",
"to",
"it",
"."
] | def find_config_file() -> Optional[Path]:
"""
Find the configuration file to use and return a Path to it.
This function will look in various place to find the configuration file.
In order, those location are tested:
+ ./.leosacclirc
+ $HOME/.leosacclirc
:return: Optionally a path to... | [
"def",
"find_config_file",
"(",
")",
"->",
"Optional",
"[",
"Path",
"]",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"'find_config_file'",
")",
"for",
"location",
"in",
"os",
".",
"curdir",
",",
"os",
".",
"path",
".",
"expanduser",
"(",
"'~'",... | https://github.com/leosac/leosac/blob/932a2a90bd2e75483d46b24fdbc8f02e0809d731/python/leosacpy/cli/cli_config.py#L37-L55 | |
wesnoth/wesnoth | 6ccac5a5e8ff75303c9190c0da60580925cb32c0 | data/tools/unit_tree/html_output.py | python | build_timestamp | () | return '<div id="lastmod">Last updated on %s.</div>' % time.ctime() | Returns an element containing the current date and time. | Returns an element containing the current date and time. | [
"Returns",
"an",
"element",
"containing",
"the",
"current",
"date",
"and",
"time",
"."
] | def build_timestamp():
"""Returns an element containing the current date and time."""
return '<div id="lastmod">Last updated on %s.</div>' % time.ctime() | [
"def",
"build_timestamp",
"(",
")",
":",
"return",
"'<div id=\"lastmod\">Last updated on %s.</div>'",
"%",
"time",
".",
"ctime",
"(",
")"
] | https://github.com/wesnoth/wesnoth/blob/6ccac5a5e8ff75303c9190c0da60580925cb32c0/data/tools/unit_tree/html_output.py#L151-L153 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/special/basic.py | python | h1vp | (v, z, n=1) | Compute nth derivative of Hankel function H1v(z) with respect to `z`.
Parameters
----------
v : float
Order of Hankel function
z : complex
Argument at which to evaluate the derivative
n : int, default 1
Order of derivative
Notes
-----
The derivative is computed ... | Compute nth derivative of Hankel function H1v(z) with respect to `z`. | [
"Compute",
"nth",
"derivative",
"of",
"Hankel",
"function",
"H1v",
"(",
"z",
")",
"with",
"respect",
"to",
"z",
"."
] | def h1vp(v, z, n=1):
"""Compute nth derivative of Hankel function H1v(z) with respect to `z`.
Parameters
----------
v : float
Order of Hankel function
z : complex
Argument at which to evaluate the derivative
n : int, default 1
Order of derivative
Notes
-----
... | [
"def",
"h1vp",
"(",
"v",
",",
"z",
",",
"n",
"=",
"1",
")",
":",
"n",
"=",
"_nonneg_int_or_fail",
"(",
"n",
",",
"'n'",
")",
"if",
"n",
"==",
"0",
":",
"return",
"hankel1",
"(",
"v",
",",
"z",
")",
"else",
":",
"return",
"_bessel_diff_formula",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/special/basic.py#L588-L617 | ||
sfzhang15/RefineDet | 52b6fe23dc1a160fe710b7734576dca509bf4fae | scripts/cpp_lint.py | python | Match | (pattern, s) | return _regexp_compile_cache[pattern].match(s) | Matches the string with the pattern, caching the compiled regexp. | Matches the string with the pattern, caching the compiled regexp. | [
"Matches",
"the",
"string",
"with",
"the",
"pattern",
"caching",
"the",
"compiled",
"regexp",
"."
] | def Match(pattern, s):
"""Matches the string with the pattern, caching the compiled regexp."""
# The regexp compilation caching is inlined in both Match and Search for
# performance reasons; factoring it out into a separate function turns out
# to be noticeably expensive.
if pattern not in _regexp_compile_cac... | [
"def",
"Match",
"(",
"pattern",
",",
"s",
")",
":",
"# The regexp compilation caching is inlined in both Match and Search for",
"# performance reasons; factoring it out into a separate function turns out",
"# to be noticeably expensive.",
"if",
"pattern",
"not",
"in",
"_regexp_compile_... | https://github.com/sfzhang15/RefineDet/blob/52b6fe23dc1a160fe710b7734576dca509bf4fae/scripts/cpp_lint.py#L515-L522 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/tracing/tracing_build/merge_traces.py | python | MergeTraceEvents | (events_by_filename) | return merged_events | Merge trace events from multiple traces into a single list of events. | Merge trace events from multiple traces into a single list of events. | [
"Merge",
"trace",
"events",
"from",
"multiple",
"traces",
"into",
"a",
"single",
"list",
"of",
"events",
"."
] | def MergeTraceEvents(events_by_filename):
"""Merge trace events from multiple traces into a single list of events."""
timestamp_range_by_filename = _AdjustTimestampRanges(events_by_filename)
process_map = _CreateProcessMapFromTraceEvents(events_by_filename)
merged_events = _CombineTraceEvents(events_by_filename... | [
"def",
"MergeTraceEvents",
"(",
"events_by_filename",
")",
":",
"timestamp_range_by_filename",
"=",
"_AdjustTimestampRanges",
"(",
"events_by_filename",
")",
"process_map",
"=",
"_CreateProcessMapFromTraceEvents",
"(",
"events_by_filename",
")",
"merged_events",
"=",
"_Combin... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/tracing/tracing_build/merge_traces.py#L373-L380 | |
Illumina/hap.py | 84011695b2ff2406c16a335106db6831fb67fdfe | src/python/Haplo/xcmp.py | python | xcmpWrapper | (location_str, args) | return tf.name | Haplotype block comparison wrapper function | Haplotype block comparison wrapper function | [
"Haplotype",
"block",
"comparison",
"wrapper",
"function"
] | def xcmpWrapper(location_str, args):
""" Haplotype block comparison wrapper function
"""
starttime = time.time()
tf = tempfile.NamedTemporaryFile(delete=False,
dir=args.scratch_prefix,
prefix="result.%s" % location_str,
... | [
"def",
"xcmpWrapper",
"(",
"location_str",
",",
"args",
")",
":",
"starttime",
"=",
"time",
".",
"time",
"(",
")",
"tf",
"=",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"delete",
"=",
"False",
",",
"dir",
"=",
"args",
".",
"scratch_prefix",
",",
"prefix... | https://github.com/Illumina/hap.py/blob/84011695b2ff2406c16a335106db6831fb67fdfe/src/python/Haplo/xcmp.py#L28-L85 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py | python | ModuleSpec.parent | (self) | The name of the module's parent. | The name of the module's parent. | [
"The",
"name",
"of",
"the",
"module",
"s",
"parent",
"."
] | def parent(self):
"""The name of the module's parent."""
if self.submodule_search_locations is None:
return self.name.rpartition('.')[0]
else:
return self.name | [
"def",
"parent",
"(",
"self",
")",
":",
"if",
"self",
".",
"submodule_search_locations",
"is",
"None",
":",
"return",
"self",
".",
"name",
".",
"rpartition",
"(",
"'.'",
")",
"[",
"0",
"]",
"else",
":",
"return",
"self",
".",
"name"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py#L417-L422 | ||
NVIDIA/MDL-SDK | aa9642b2546ad7b6236b5627385d882c2ed83c5d | src/mdl/jit/generator_jit/gen_intrinsic_func.py | python | SignatureParser.__init__ | (self, script_name, indir, out_name, strict) | constructor | constructor | [
"constructor"
] | def __init__(self, script_name, indir, out_name, strict):
"""constructor"""
self.debug = False
self.indir = indir
self.out_name = out_name
self.r_intrinsic = re.compile(r"\[\[\s+intrinsic\(\)[^]]*\]\];")
self.curr_module = ""
self.m_intrinsics = {}
self.m_intrinsic_mods = {}
self.m_signatures = {}
... | [
"def",
"__init__",
"(",
"self",
",",
"script_name",
",",
"indir",
",",
"out_name",
",",
"strict",
")",
":",
"self",
".",
"debug",
"=",
"False",
"self",
".",
"indir",
"=",
"indir",
"self",
".",
"out_name",
"=",
"out_name",
"self",
".",
"r_intrinsic",
"=... | https://github.com/NVIDIA/MDL-SDK/blob/aa9642b2546ad7b6236b5627385d882c2ed83c5d/src/mdl/jit/generator_jit/gen_intrinsic_func.py#L55-L194 | ||
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/qcdb/libmintsmolecule.py | python | LibmintsMolecule.get_anchor_atom | (self, vstr, line) | Attempts to interpret a string *vstr* as an atom specifier in
a zmatrix. Takes the current *line* for error message printing.
Returns the atom number (adjusted to zero-based counting). | Attempts to interpret a string *vstr* as an atom specifier in
a zmatrix. Takes the current *line* for error message printing.
Returns the atom number (adjusted to zero-based counting). | [
"Attempts",
"to",
"interpret",
"a",
"string",
"*",
"vstr",
"*",
"as",
"an",
"atom",
"specifier",
"in",
"a",
"zmatrix",
".",
"Takes",
"the",
"current",
"*",
"line",
"*",
"for",
"error",
"message",
"printing",
".",
"Returns",
"the",
"atom",
"number",
"(",
... | def get_anchor_atom(self, vstr, line):
"""Attempts to interpret a string *vstr* as an atom specifier in
a zmatrix. Takes the current *line* for error message printing.
Returns the atom number (adjusted to zero-based counting).
"""
integerNumber = re.compile(r"(-?\d+)", re.IGNORE... | [
"def",
"get_anchor_atom",
"(",
"self",
",",
"vstr",
",",
"line",
")",
":",
"integerNumber",
"=",
"re",
".",
"compile",
"(",
"r\"(-?\\d+)\"",
",",
"re",
".",
"IGNORECASE",
")",
"if",
"integerNumber",
".",
"match",
"(",
"vstr",
")",
":",
"# This is just a nu... | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/qcdb/libmintsmolecule.py#L1218-L1233 | ||
Constellation/iv | 64c3a9c7c517063f29d90d449180ea8f6f4d946f | tools/cpplint.py | python | _IsTestFilename | (filename) | Determines if the given filename has a suffix that identifies it as a test.
Args:
filename: The input filename.
Returns:
True if 'filename' looks like a test, False otherwise. | Determines if the given filename has a suffix that identifies it as a test. | [
"Determines",
"if",
"the",
"given",
"filename",
"has",
"a",
"suffix",
"that",
"identifies",
"it",
"as",
"a",
"test",
"."
] | def _IsTestFilename(filename):
"""Determines if the given filename has a suffix that identifies it as a test.
Args:
filename: The input filename.
Returns:
True if 'filename' looks like a test, False otherwise.
"""
if (filename.endswith('_test.cc') or
filename.endswith('_unittest.cc') or
... | [
"def",
"_IsTestFilename",
"(",
"filename",
")",
":",
"if",
"(",
"filename",
".",
"endswith",
"(",
"'_test.cc'",
")",
"or",
"filename",
".",
"endswith",
"(",
"'_unittest.cc'",
")",
"or",
"filename",
".",
"endswith",
"(",
"'_regtest.cc'",
")",
")",
":",
"ret... | https://github.com/Constellation/iv/blob/64c3a9c7c517063f29d90d449180ea8f6f4d946f/tools/cpplint.py#L3491-L3505 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/binding/passmanagers.py | python | PassManager.add_sccp_pass | (self) | See http://llvm.org/docs/Passes.html#sccp-sparse-conditional-constant-propagation. | See http://llvm.org/docs/Passes.html#sccp-sparse-conditional-constant-propagation. | [
"See",
"http",
":",
"//",
"llvm",
".",
"org",
"/",
"docs",
"/",
"Passes",
".",
"html#sccp",
"-",
"sparse",
"-",
"conditional",
"-",
"constant",
"-",
"propagation",
"."
] | def add_sccp_pass(self):
"""See http://llvm.org/docs/Passes.html#sccp-sparse-conditional-constant-propagation."""
ffi.lib.LLVMPY_AddSCCPPass(self) | [
"def",
"add_sccp_pass",
"(",
"self",
")",
":",
"ffi",
".",
"lib",
".",
"LLVMPY_AddSCCPPass",
"(",
"self",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/binding/passmanagers.py#L69-L71 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | addon-sdk/source/python-lib/mozrunner/__init__.py | python | run_command | (cmd, env=None, **kwargs) | Run the given command in killable process. | Run the given command in killable process. | [
"Run",
"the",
"given",
"command",
"in",
"killable",
"process",
"."
] | def run_command(cmd, env=None, **kwargs):
"""Run the given command in killable process."""
killable_kwargs = {'stdout':stdout ,'stderr':stderr, 'stdin':stdin}
killable_kwargs.update(kwargs)
if sys.platform != "win32":
return killableprocess.Popen(cmd, preexec_fn=lambda : os.setpgid(0, 0),
... | [
"def",
"run_command",
"(",
"cmd",
",",
"env",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"killable_kwargs",
"=",
"{",
"'stdout'",
":",
"stdout",
",",
"'stderr'",
":",
"stderr",
",",
"'stdin'",
":",
"stdin",
"}",
"killable_kwargs",
".",
"update",
"... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/addon-sdk/source/python-lib/mozrunner/__init__.py#L50-L59 | ||
GarageGames/Torque2D | 72c8891f192b44d58a8bd5ec2b293a3b48a818f4 | engine/lib/freetype/android/freetype-2.4.12/src/tools/docmaker/tohtml.py | python | HtmlFormatter.make_html_words | ( self, words ) | return line | convert a series of simple words into some HTML text | convert a series of simple words into some HTML text | [
"convert",
"a",
"series",
"of",
"simple",
"words",
"into",
"some",
"HTML",
"text"
] | def make_html_words( self, words ):
""" convert a series of simple words into some HTML text """
line = ""
if words:
line = html_quote( words[0] )
for w in words[1:]:
line = line + " " + html_quote( w )
return line | [
"def",
"make_html_words",
"(",
"self",
",",
"words",
")",
":",
"line",
"=",
"\"\"",
"if",
"words",
":",
"line",
"=",
"html_quote",
"(",
"words",
"[",
"0",
"]",
")",
"for",
"w",
"in",
"words",
"[",
"1",
":",
"]",
":",
"line",
"=",
"line",
"+",
"... | https://github.com/GarageGames/Torque2D/blob/72c8891f192b44d58a8bd5ec2b293a3b48a818f4/engine/lib/freetype/android/freetype-2.4.12/src/tools/docmaker/tohtml.py#L245-L253 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TStr_PutFBaseIfEmpty | (*args) | return _snap.TStr_PutFBaseIfEmpty(*args) | TStr_PutFBaseIfEmpty(TStr FNm, TStr FBase) -> TStr
Parameters:
FNm: TStr const &
FBase: TStr const & | TStr_PutFBaseIfEmpty(TStr FNm, TStr FBase) -> TStr | [
"TStr_PutFBaseIfEmpty",
"(",
"TStr",
"FNm",
"TStr",
"FBase",
")",
"-",
">",
"TStr"
] | def TStr_PutFBaseIfEmpty(*args):
"""
TStr_PutFBaseIfEmpty(TStr FNm, TStr FBase) -> TStr
Parameters:
FNm: TStr const &
FBase: TStr const &
"""
return _snap.TStr_PutFBaseIfEmpty(*args) | [
"def",
"TStr_PutFBaseIfEmpty",
"(",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TStr_PutFBaseIfEmpty",
"(",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L11246-L11255 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/SaveGEMMAUDParamFile.py | python | SaveGEMMAUDParamFile._expand_to_texture_bank | (self, bank_param_list, spectrum_numbers, grouping_scheme) | return (bank_param_list[grouping_scheme[spec_num] - 1] for spec_num in spectrum_numbers) | :param bank_param_list: a list of n values for some parameter, such as DIFC
:param spectrum_numbers: a list of m bank IDs, one for each focused spectrum
:param grouping_scheme: a list of m indexes, to index bank_param_list, where
the element at item i is the bank number in bank_param_list to ass... | :param bank_param_list: a list of n values for some parameter, such as DIFC
:param spectrum_numbers: a list of m bank IDs, one for each focused spectrum
:param grouping_scheme: a list of m indexes, to index bank_param_list, where
the element at item i is the bank number in bank_param_list to ass... | [
":",
"param",
"bank_param_list",
":",
"a",
"list",
"of",
"n",
"values",
"for",
"some",
"parameter",
"such",
"as",
"DIFC",
":",
"param",
"spectrum_numbers",
":",
"a",
"list",
"of",
"m",
"bank",
"IDs",
"one",
"for",
"each",
"focused",
"spectrum",
":",
"par... | def _expand_to_texture_bank(self, bank_param_list, spectrum_numbers, grouping_scheme):
"""
:param bank_param_list: a list of n values for some parameter, such as DIFC
:param spectrum_numbers: a list of m bank IDs, one for each focused spectrum
:param grouping_scheme: a list of m indexes,... | [
"def",
"_expand_to_texture_bank",
"(",
"self",
",",
"bank_param_list",
",",
"spectrum_numbers",
",",
"grouping_scheme",
")",
":",
"return",
"(",
"bank_param_list",
"[",
"grouping_scheme",
"[",
"spec_num",
"]",
"-",
"1",
"]",
"for",
"spec_num",
"in",
"spectrum_numb... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/SaveGEMMAUDParamFile.py#L135-L145 | |
NVIDIA/MDL-SDK | aa9642b2546ad7b6236b5627385d882c2ed83c5d | src/mdl/compiler/compilercore/generate_stdmodule.py | python | scan_src_file | (prefix, filename) | return block | Read a .mdl file and build a Block(name,comment,text).
The name is the filename without extension, with module_
prepended | Read a .mdl file and build a Block(name,comment,text).
The name is the filename without extension, with module_
prepended | [
"Read",
"a",
".",
"mdl",
"file",
"and",
"build",
"a",
"Block",
"(",
"name",
"comment",
"text",
")",
".",
"The",
"name",
"is",
"the",
"filename",
"without",
"extension",
"with",
"module_",
"prepended"
] | def scan_src_file(prefix, filename):
"""
Read a .mdl file and build a Block(name,comment,text).
The name is the filename without extension, with module_
prepended
"""
block = Block()
# remove extension and add prefix
block.name, ext = os.path.splitext(os.path.basename(filename))
blo... | [
"def",
"scan_src_file",
"(",
"prefix",
",",
"filename",
")",
":",
"block",
"=",
"Block",
"(",
")",
"# remove extension and add prefix",
"block",
".",
"name",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"path",
".",
"basename",
"(... | https://github.com/NVIDIA/MDL-SDK/blob/aa9642b2546ad7b6236b5627385d882c2ed83c5d/src/mdl/compiler/compilercore/generate_stdmodule.py#L52-L82 | |
stitchEm/stitchEm | 0f399501d41ab77933677f2907f41f80ceb704d7 | lib/bindings/samples/server/utils/performance.py | python | getMemoryInfo | () | return {
'virtual': vmem,
'swap': swap,
} | Returns information of the memory modules in the system | Returns information of the memory modules in the system | [
"Returns",
"information",
"of",
"the",
"memory",
"modules",
"in",
"the",
"system"
] | def getMemoryInfo():
"""Returns information of the memory modules in the system
"""
vmem = psutil.virtual_memory()
swap = psutil.swap_memory()
vmem = vars(vmem)
swap = vars(swap)
return {
'virtual': vmem,
'swap': swap,
} | [
"def",
"getMemoryInfo",
"(",
")",
":",
"vmem",
"=",
"psutil",
".",
"virtual_memory",
"(",
")",
"swap",
"=",
"psutil",
".",
"swap_memory",
"(",
")",
"vmem",
"=",
"vars",
"(",
"vmem",
")",
"swap",
"=",
"vars",
"(",
"swap",
")",
"return",
"{",
"'virtual... | https://github.com/stitchEm/stitchEm/blob/0f399501d41ab77933677f2907f41f80ceb704d7/lib/bindings/samples/server/utils/performance.py#L61-L72 | |
zhuli19901106/leetcode-zhuli | 0f8fc29ccb8c33ea91149ecb2d4e961024c11db7 | explore/linkedin/2000_two-sum-iii-data-structure-design_1_AC.py | python | TwoSum.find | (self, value: int) | return False | Find if there exists any pair of numbers which sum is equal to the value. | Find if there exists any pair of numbers which sum is equal to the value. | [
"Find",
"if",
"there",
"exists",
"any",
"pair",
"of",
"numbers",
"which",
"sum",
"is",
"equal",
"to",
"the",
"value",
"."
] | def find(self, value: int) -> bool:
"""
Find if there exists any pair of numbers which sum is equal to the value.
"""
mm = self.mm
for k, v in mm.items():
if value - k == k and v > 1:
return True
elif value - k != k and value - k in mm:
... | [
"def",
"find",
"(",
"self",
",",
"value",
":",
"int",
")",
"->",
"bool",
":",
"mm",
"=",
"self",
".",
"mm",
"for",
"k",
",",
"v",
"in",
"mm",
".",
"items",
"(",
")",
":",
"if",
"value",
"-",
"k",
"==",
"k",
"and",
"v",
">",
"1",
":",
"ret... | https://github.com/zhuli19901106/leetcode-zhuli/blob/0f8fc29ccb8c33ea91149ecb2d4e961024c11db7/explore/linkedin/2000_two-sum-iii-data-structure-design_1_AC.py#L21-L31 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/_pyio.py | python | IOBase.readline | (self, limit=-1) | return bytes(res) | r"""Read and return a line from the stream.
If limit is specified, at most limit bytes will be read.
The line terminator is always b'\n' for binary files; for text
files, the newlines argument to open can be used to select the line
terminator(s) recognized. | r"""Read and return a line from the stream. | [
"r",
"Read",
"and",
"return",
"a",
"line",
"from",
"the",
"stream",
"."
] | def readline(self, limit=-1):
r"""Read and return a line from the stream.
If limit is specified, at most limit bytes will be read.
The line terminator is always b'\n' for binary files; for text
files, the newlines argument to open can be used to select the line
terminator(s) re... | [
"def",
"readline",
"(",
"self",
",",
"limit",
"=",
"-",
"1",
")",
":",
"# For backwards compatibility, a (slowish) readline().",
"if",
"hasattr",
"(",
"self",
",",
"\"peek\"",
")",
":",
"def",
"nreadahead",
"(",
")",
":",
"readahead",
"=",
"self",
".",
"peek... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/_pyio.py#L462-L496 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/deep_memory_profiler/lib/policy.py | python | PolicySet.load | (labels=None) | Loads a set of policies via the "default policy directory".
The "default policy directory" contains pairs of policies and their labels.
For example, a policy "policy.l0.json" is labeled "l0" in the default
policy directory "policies.json".
All policies in the directory are loaded by default. Policies... | Loads a set of policies via the "default policy directory". | [
"Loads",
"a",
"set",
"of",
"policies",
"via",
"the",
"default",
"policy",
"directory",
"."
] | def load(labels=None):
"""Loads a set of policies via the "default policy directory".
The "default policy directory" contains pairs of policies and their labels.
For example, a policy "policy.l0.json" is labeled "l0" in the default
policy directory "policies.json".
All policies in the directory ar... | [
"def",
"load",
"(",
"labels",
"=",
"None",
")",
":",
"default_policy_directory",
"=",
"PolicySet",
".",
"_load_default_policy_directory",
"(",
")",
"if",
"labels",
":",
"specified_policy_directory",
"=",
"{",
"}",
"for",
"label",
"in",
"labels",
":",
"if",
"la... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/deep_memory_profiler/lib/policy.py#L352-L377 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/operations/build/wheel_legacy.py | python | get_legacy_build_wheel_path | (
names, # type: List[str]
temp_dir, # type: str
name, # type: str
command_args, # type: List[str]
command_output, # type: str
) | return os.path.join(temp_dir, names[0]) | Return the path to the wheel in the temporary build directory. | Return the path to the wheel in the temporary build directory. | [
"Return",
"the",
"path",
"to",
"the",
"wheel",
"in",
"the",
"temporary",
"build",
"directory",
"."
] | def get_legacy_build_wheel_path(
names, # type: List[str]
temp_dir, # type: str
name, # type: str
command_args, # type: List[str]
command_output, # type: str
):
# type: (...) -> Optional[str]
"""Return the path to the wheel in the temporary build directory."""
# Sort for de... | [
"def",
"get_legacy_build_wheel_path",
"(",
"names",
",",
"# type: List[str]",
"temp_dir",
",",
"# type: str",
"name",
",",
"# type: str",
"command_args",
",",
"# type: List[str]",
"command_output",
",",
"# type: str",
")",
":",
"# type: (...) -> Optional[str]",
"# Sort for ... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/operations/build/wheel_legacy.py#L79-L133 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/core/completer.py | python | CompletionSplitter.delims | (self, delims) | Set the delimiters for line splitting. | Set the delimiters for line splitting. | [
"Set",
"the",
"delimiters",
"for",
"line",
"splitting",
"."
] | def delims(self, delims):
"""Set the delimiters for line splitting."""
expr = '[' + ''.join('\\'+ c for c in delims) + ']'
self._delim_re = re.compile(expr)
self._delims = delims
self._delim_expr = expr | [
"def",
"delims",
"(",
"self",
",",
"delims",
")",
":",
"expr",
"=",
"'['",
"+",
"''",
".",
"join",
"(",
"'\\\\'",
"+",
"c",
"for",
"c",
"in",
"delims",
")",
"+",
"']'",
"self",
".",
"_delim_re",
"=",
"re",
".",
"compile",
"(",
"expr",
")",
"sel... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/core/completer.py#L566-L571 | ||
intel/llvm | e6d0547e9d99b5a56430c4749f6c7e328bf221ab | libcxx/utils/libcxx/sym_check/extract.py | python | NMExtractor.__init__ | (self, static_lib) | Initialize the nm executable and flags that will be used to extract
symbols from shared libraries. | Initialize the nm executable and flags that will be used to extract
symbols from shared libraries. | [
"Initialize",
"the",
"nm",
"executable",
"and",
"flags",
"that",
"will",
"be",
"used",
"to",
"extract",
"symbols",
"from",
"shared",
"libraries",
"."
] | def __init__(self, static_lib):
"""
Initialize the nm executable and flags that will be used to extract
symbols from shared libraries.
"""
self.nm_exe = self.find_tool()
if self.nm_exe is None:
# ERROR no NM found
print("ERROR: Could not find nm")
... | [
"def",
"__init__",
"(",
"self",
",",
"static_lib",
")",
":",
"self",
".",
"nm_exe",
"=",
"self",
".",
"find_tool",
"(",
")",
"if",
"self",
".",
"nm_exe",
"is",
"None",
":",
"# ERROR no NM found",
"print",
"(",
"\"ERROR: Could not find nm\"",
")",
"sys",
".... | https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/libcxx/utils/libcxx/sym_check/extract.py#L34-L45 | ||
dicecco1/fpga_caffe | 7a191704efd7873071cfef35772d7e7bf3e3cfd6 | examples/pycaffe/layers/pascal_multilabel_datalayers.py | python | PascalMultilabelDataLayerSync.forward | (self, bottom, top) | Load data. | Load data. | [
"Load",
"data",
"."
] | def forward(self, bottom, top):
"""
Load data.
"""
for itt in range(self.batch_size):
# Use the batch loader to load the next image.
im, multilabel = self.batch_loader.load_next_image()
# Add directly to the caffe data layer
top[0].data[it... | [
"def",
"forward",
"(",
"self",
",",
"bottom",
",",
"top",
")",
":",
"for",
"itt",
"in",
"range",
"(",
"self",
".",
"batch_size",
")",
":",
"# Use the batch loader to load the next image.",
"im",
",",
"multilabel",
"=",
"self",
".",
"batch_loader",
".",
"load... | https://github.com/dicecco1/fpga_caffe/blob/7a191704efd7873071cfef35772d7e7bf3e3cfd6/examples/pycaffe/layers/pascal_multilabel_datalayers.py#L55-L65 | ||
ucla-vision/xivo | 1b97bf5a3124e62bf4920429af5bb91c7a6de876 | scripts/tum_rgbd_benchmark_tools/associate.py | python | associate | (first_list, second_list,offset,max_difference) | return matches | Associate two dictionaries of (stamp,data). As the time stamps never match exactly, we aim
to find the closest match for every input tuple.
Input:
first_list -- first dictionary of (stamp,data) tuples
second_list -- second dictionary of (stamp,data) tuples
offset -- time offset between both di... | Associate two dictionaries of (stamp,data). As the time stamps never match exactly, we aim
to find the closest match for every input tuple.
Input:
first_list -- first dictionary of (stamp,data) tuples
second_list -- second dictionary of (stamp,data) tuples
offset -- time offset between both di... | [
"Associate",
"two",
"dictionaries",
"of",
"(",
"stamp",
"data",
")",
".",
"As",
"the",
"time",
"stamps",
"never",
"match",
"exactly",
"we",
"aim",
"to",
"find",
"the",
"closest",
"match",
"for",
"every",
"input",
"tuple",
".",
"Input",
":",
"first_list",
... | def associate(first_list, second_list,offset,max_difference):
"""
Associate two dictionaries of (stamp,data). As the time stamps never match exactly, we aim
to find the closest match for every input tuple.
Input:
first_list -- first dictionary of (stamp,data) tuples
second_list -- second d... | [
"def",
"associate",
"(",
"first_list",
",",
"second_list",
",",
"offset",
",",
"max_difference",
")",
":",
"first_keys",
"=",
"list",
"(",
"first_list",
")",
"second_keys",
"=",
"list",
"(",
"second_list",
")",
"potential_matches",
"=",
"[",
"(",
"abs",
"(",... | https://github.com/ucla-vision/xivo/blob/1b97bf5a3124e62bf4920429af5bb91c7a6de876/scripts/tum_rgbd_benchmark_tools/associate.py#L75-L105 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/plat-mac/gensuitemodule.py | python | identify | (str) | return rv | Turn any string into an identifier:
- replace space by _
- replace other illegal chars by _xx_ (hex code)
- append _ if the result is a python keyword | Turn any string into an identifier:
- replace space by _
- replace other illegal chars by _xx_ (hex code)
- append _ if the result is a python keyword | [
"Turn",
"any",
"string",
"into",
"an",
"identifier",
":",
"-",
"replace",
"space",
"by",
"_",
"-",
"replace",
"other",
"illegal",
"chars",
"by",
"_xx_",
"(",
"hex",
"code",
")",
"-",
"append",
"_",
"if",
"the",
"result",
"is",
"a",
"python",
"keyword"
... | def identify(str):
"""Turn any string into an identifier:
- replace space by _
- replace other illegal chars by _xx_ (hex code)
- append _ if the result is a python keyword
"""
if not str:
return "empty_ae_name_"
rv = ''
ok = string.ascii_letters + '_'
ok2 = ok + string.digit... | [
"def",
"identify",
"(",
"str",
")",
":",
"if",
"not",
"str",
":",
"return",
"\"empty_ae_name_\"",
"rv",
"=",
"''",
"ok",
"=",
"string",
".",
"ascii_letters",
"+",
"'_'",
"ok2",
"=",
"ok",
"+",
"string",
".",
"digits",
"for",
"c",
"in",
"str",
":",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/plat-mac/gensuitemodule.py#L1189-L1210 | |
rampageX/firmware-mod-kit | c94cd6aeee50d92ec5280a6dba6d74828fd3606b | src/binwalk-2.1.1/src/binwalk/modules/general.py | python | General._set_verbosity | (self) | Sets the appropriate verbosity.
Must be called after self._test_target_files so that self.target_files is properly set. | Sets the appropriate verbosity.
Must be called after self._test_target_files so that self.target_files is properly set. | [
"Sets",
"the",
"appropriate",
"verbosity",
".",
"Must",
"be",
"called",
"after",
"self",
".",
"_test_target_files",
"so",
"that",
"self",
".",
"target_files",
"is",
"properly",
"set",
"."
] | def _set_verbosity(self):
'''
Sets the appropriate verbosity.
Must be called after self._test_target_files so that self.target_files is properly set.
'''
# If more than one target file was specified, enable verbose mode; else, there is
# nothing in some outputs to indicat... | [
"def",
"_set_verbosity",
"(",
"self",
")",
":",
"# If more than one target file was specified, enable verbose mode; else, there is",
"# nothing in some outputs to indicate which scan corresponds to which file.",
"if",
"len",
"(",
"self",
".",
"target_files",
")",
">",
"1",
"and",
... | https://github.com/rampageX/firmware-mod-kit/blob/c94cd6aeee50d92ec5280a6dba6d74828fd3606b/src/binwalk-2.1.1/src/binwalk/modules/general.py#L157-L165 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/ops/parsing_ops.py | python | parse_single_example | (serialized, features, name=None, example_names=None) | return _parse_single_example_raw(
serialized, example_names, sparse_keys, sparse_types, dense_keys,
dense_types, dense_defaults, dense_shapes, name) | Parses a single `Example` proto.
Similar to `parse_example`, except:
For dense tensors, the returned `Tensor` is identical to the output of
`parse_example`, except there is no batch dimension, the output shape is the
same as the shape given in `dense_shape`.
For `SparseTensor`s, the first (batch) column of... | Parses a single `Example` proto. | [
"Parses",
"a",
"single",
"Example",
"proto",
"."
] | def parse_single_example(serialized, features, name=None, example_names=None):
"""Parses a single `Example` proto.
Similar to `parse_example`, except:
For dense tensors, the returned `Tensor` is identical to the output of
`parse_example`, except there is no batch dimension, the output shape is the
same as t... | [
"def",
"parse_single_example",
"(",
"serialized",
",",
"features",
",",
"name",
"=",
"None",
",",
"example_names",
"=",
"None",
")",
":",
"if",
"not",
"features",
":",
"raise",
"ValueError",
"(",
"\"Missing features.\"",
")",
"(",
"sparse_keys",
",",
"sparse_t... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/parsing_ops.py#L417-L453 | |
quarnster/SublimeClang | 6823e7f0904e60680ac9f898108e301582ec5505 | internals/clang/cindex.py | python | TokenImpl.location | (self, translation_unit) | return self._location | Return the location of the token. | Return the location of the token. | [
"Return",
"the",
"location",
"of",
"the",
"token",
"."
] | def location(self, translation_unit):
"""Return the location of the token."""
if not hasattr(self, '_location'):
self._location = Token_location(translation_unit, self)
return self._location | [
"def",
"location",
"(",
"self",
",",
"translation_unit",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_location'",
")",
":",
"self",
".",
"_location",
"=",
"Token_location",
"(",
"translation_unit",
",",
"self",
")",
"return",
"self",
".",
"_locat... | https://github.com/quarnster/SublimeClang/blob/6823e7f0904e60680ac9f898108e301582ec5505/internals/clang/cindex.py#L2452-L2456 | |
cornell-zhang/heterocl | 6d9e4b4acc2ee2707b2d25b27298c0335bccedfd | python/heterocl/tvm/_ffi/ndarray.py | python | NDArrayBase.copyto | (self, target) | return target | Copy array to target
Parameters
----------
target : NDArray
The target array to be copied, must have same shape as this array. | Copy array to target | [
"Copy",
"array",
"to",
"target"
] | def copyto(self, target):
"""Copy array to target
Parameters
----------
target : NDArray
The target array to be copied, must have same shape as this array.
"""
if isinstance(target, TVMContext):
target = empty(self.shape, self.dtype, target)
... | [
"def",
"copyto",
"(",
"self",
",",
"target",
")",
":",
"if",
"isinstance",
"(",
"target",
",",
"TVMContext",
")",
":",
"target",
"=",
"empty",
"(",
"self",
".",
"shape",
",",
"self",
".",
"dtype",
",",
"target",
")",
"if",
"isinstance",
"(",
"target"... | https://github.com/cornell-zhang/heterocl/blob/6d9e4b4acc2ee2707b2d25b27298c0335bccedfd/python/heterocl/tvm/_ffi/ndarray.py#L270-L285 | |
mapsme/omim | 1892903b63f2c85b16ed4966d21fe76aba06b9ba | tools/python/descriptions/descriptions_downloader.py | python | read_popularity | (path) | return ids | :param path: a path of popularity file. A file contains '<id>,<rank>' rows.
:return: a set of popularity object ids | :param path: a path of popularity file. A file contains '<id>,<rank>' rows.
:return: a set of popularity object ids | [
":",
"param",
"path",
":",
"a",
"path",
"of",
"popularity",
"file",
".",
"A",
"file",
"contains",
"<id",
">",
"<rank",
">",
"rows",
".",
":",
"return",
":",
"a",
"set",
"of",
"popularity",
"object",
"ids"
] | def read_popularity(path):
"""
:param path: a path of popularity file. A file contains '<id>,<rank>' rows.
:return: a set of popularity object ids
"""
ids = set()
for line in open(path):
try:
ident = int(line.split(",", maxsplit=1)[0])
except (AttributeError, IndexErr... | [
"def",
"read_popularity",
"(",
"path",
")",
":",
"ids",
"=",
"set",
"(",
")",
"for",
"line",
"in",
"open",
"(",
"path",
")",
":",
"try",
":",
"ident",
"=",
"int",
"(",
"line",
".",
"split",
"(",
"\",\"",
",",
"maxsplit",
"=",
"1",
")",
"[",
"0"... | https://github.com/mapsme/omim/blob/1892903b63f2c85b16ed4966d21fe76aba06b9ba/tools/python/descriptions/descriptions_downloader.py#L92-L104 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/email/utils.py | python | decode_rfc2231 | (s) | return parts | Decode string according to RFC 2231 | Decode string according to RFC 2231 | [
"Decode",
"string",
"according",
"to",
"RFC",
"2231"
] | def decode_rfc2231(s):
"""Decode string according to RFC 2231"""
parts = s.split(TICK, 2)
if len(parts) <= 2:
return None, None, s
return parts | [
"def",
"decode_rfc2231",
"(",
"s",
")",
":",
"parts",
"=",
"s",
".",
"split",
"(",
"TICK",
",",
"2",
")",
"if",
"len",
"(",
"parts",
")",
"<=",
"2",
":",
"return",
"None",
",",
"None",
",",
"s",
"return",
"parts"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/email/utils.py#L234-L239 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | ConfigPathChanger.__init__ | (self, *args, **kwargs) | __init__(self, ConfigBase config, String entry) -> ConfigPathChanger | __init__(self, ConfigBase config, String entry) -> ConfigPathChanger | [
"__init__",
"(",
"self",
"ConfigBase",
"config",
"String",
"entry",
")",
"-",
">",
"ConfigPathChanger"
] | def __init__(self, *args, **kwargs):
"""__init__(self, ConfigBase config, String entry) -> ConfigPathChanger"""
_misc_.ConfigPathChanger_swiginit(self,_misc_.new_ConfigPathChanger(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_misc_",
".",
"ConfigPathChanger_swiginit",
"(",
"self",
",",
"_misc_",
".",
"new_ConfigPathChanger",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L3546-L3548 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/tix.py | python | tixCommand.tix_addbitmapdir | (self, directory) | return self.tk.call('tix', 'addbitmapdir', directory) | Tix maintains a list of directories under which
the tix_getimage and tix_getbitmap commands will
search for image files. The standard bitmap directory
is $TIX_LIBRARY/bitmaps. The addbitmapdir command
adds directory into this list. By using this
command, the image files o... | Tix maintains a list of directories under which
the tix_getimage and tix_getbitmap commands will
search for image files. The standard bitmap directory
is $TIX_LIBRARY/bitmaps. The addbitmapdir command
adds directory into this list. By using this
command, the image files o... | [
"Tix",
"maintains",
"a",
"list",
"of",
"directories",
"under",
"which",
"the",
"tix_getimage",
"and",
"tix_getbitmap",
"commands",
"will",
"search",
"for",
"image",
"files",
".",
"The",
"standard",
"bitmap",
"directory",
"is",
"$TIX_LIBRARY",
"/",
"bitmaps",
"."... | def tix_addbitmapdir(self, directory):
"""Tix maintains a list of directories under which
the tix_getimage and tix_getbitmap commands will
search for image files. The standard bitmap directory
is $TIX_LIBRARY/bitmaps. The addbitmapdir command
adds directory into this list. By ... | [
"def",
"tix_addbitmapdir",
"(",
"self",
",",
"directory",
")",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"'tix'",
",",
"'addbitmapdir'",
",",
"directory",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/tix.py#L82-L92 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TIntV.DelLast | (self) | return _snap.TIntV_DelLast(self) | DelLast(TIntV self)
Parameters:
self: TVec< TInt,int > * | DelLast(TIntV self) | [
"DelLast",
"(",
"TIntV",
"self",
")"
] | def DelLast(self):
"""
DelLast(TIntV self)
Parameters:
self: TVec< TInt,int > *
"""
return _snap.TIntV_DelLast(self) | [
"def",
"DelLast",
"(",
"self",
")",
":",
"return",
"_snap",
".",
"TIntV_DelLast",
"(",
"self",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L15801-L15809 | |
letscontrolit/ESPEasy | acb2c9e695d6f61d8d67adf0fe4037c08d4baedd | lib/IRremoteESP8266/tools/scrape_supported_devices.py | python | getmdfile | () | return foutpath.resolve() | Resolves SupportedProtocols.md path | Resolves SupportedProtocols.md path | [
"Resolves",
"SupportedProtocols",
".",
"md",
"path"
] | def getmdfile():
"""Resolves SupportedProtocols.md path"""
foutpath = ARGS.directory / "../SupportedProtocols.md"
return foutpath.resolve() | [
"def",
"getmdfile",
"(",
")",
":",
"foutpath",
"=",
"ARGS",
".",
"directory",
"/",
"\"../SupportedProtocols.md\"",
"return",
"foutpath",
".",
"resolve",
"(",
")"
] | https://github.com/letscontrolit/ESPEasy/blob/acb2c9e695d6f61d8d67adf0fe4037c08d4baedd/lib/IRremoteESP8266/tools/scrape_supported_devices.py#L274-L277 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py | python | convert_broadcast_npi_greater_equal | (node, **kwargs) | return create_basic_op_node('GreaterOrEqual', node, kwargs) | npi_greater_equal | npi_greater_equal | [
"npi_greater_equal"
] | def convert_broadcast_npi_greater_equal(node, **kwargs):
""" npi_greater_equal
"""
return create_basic_op_node('GreaterOrEqual', node, kwargs) | [
"def",
"convert_broadcast_npi_greater_equal",
"(",
"node",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"create_basic_op_node",
"(",
"'GreaterOrEqual'",
",",
"node",
",",
"kwargs",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py#L5142-L5145 | |
echronos/echronos | c996f1d2c8af6c6536205eb319c1bf1d4d84569c | external_tools/pystache/context.py | python | ContextStack.__init__ | (self, *items) | Construct an instance, and initialize the private stack.
The *items arguments are the items with which to populate the
initial stack. Items in the argument list are added to the
stack in order so that, in particular, items at the end of
the argument list are queried first when querying... | Construct an instance, and initialize the private stack. | [
"Construct",
"an",
"instance",
"and",
"initialize",
"the",
"private",
"stack",
"."
] | def __init__(self, *items):
"""
Construct an instance, and initialize the private stack.
The *items arguments are the items with which to populate the
initial stack. Items in the argument list are added to the
stack in order so that, in particular, items at the end of
t... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"items",
")",
":",
"self",
".",
"_stack",
"=",
"list",
"(",
"items",
")"
] | https://github.com/echronos/echronos/blob/c996f1d2c8af6c6536205eb319c1bf1d4d84569c/external_tools/pystache/context.py#L118-L131 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/joblib/joblib/_parallel_backends.py | python | AutoBatchingMixin.reset_batch_stats | (self) | Reset batch statistics to default values.
This avoids interferences with future jobs. | Reset batch statistics to default values. | [
"Reset",
"batch",
"statistics",
"to",
"default",
"values",
"."
] | def reset_batch_stats(self):
"""Reset batch statistics to default values.
This avoids interferences with future jobs.
"""
self._effective_batch_size = self._DEFAULT_EFFECTIVE_BATCH_SIZE
self._smoothed_batch_duration = self._DEFAULT_SMOOTHED_BATCH_DURATION | [
"def",
"reset_batch_stats",
"(",
"self",
")",
":",
"self",
".",
"_effective_batch_size",
"=",
"self",
".",
"_DEFAULT_EFFECTIVE_BATCH_SIZE",
"self",
".",
"_smoothed_batch_duration",
"=",
"self",
".",
"_DEFAULT_SMOOTHED_BATCH_DURATION"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/joblib/joblib/_parallel_backends.py#L361-L367 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/s3transfer/tasks.py | python | CreateMultipartUploadTask._main | (self, client, bucket, key, extra_args) | return upload_id | :param client: The client to use when calling CreateMultipartUpload
:param bucket: The name of the bucket to upload to
:param key: The name of the key to upload to
:param extra_args: A dictionary of any extra arguments that may be
used in the intialization.
:returns: The upl... | :param client: The client to use when calling CreateMultipartUpload
:param bucket: The name of the bucket to upload to
:param key: The name of the key to upload to
:param extra_args: A dictionary of any extra arguments that may be
used in the intialization. | [
":",
"param",
"client",
":",
"The",
"client",
"to",
"use",
"when",
"calling",
"CreateMultipartUpload",
":",
"param",
"bucket",
":",
"The",
"name",
"of",
"the",
"bucket",
"to",
"upload",
"to",
":",
"param",
"key",
":",
"The",
"name",
"of",
"the",
"key",
... | def _main(self, client, bucket, key, extra_args):
"""
:param client: The client to use when calling CreateMultipartUpload
:param bucket: The name of the bucket to upload to
:param key: The name of the key to upload to
:param extra_args: A dictionary of any extra arguments that ma... | [
"def",
"_main",
"(",
"self",
",",
"client",
",",
"bucket",
",",
"key",
",",
"extra_args",
")",
":",
"# Create the multipart upload.",
"response",
"=",
"client",
".",
"create_multipart_upload",
"(",
"Bucket",
"=",
"bucket",
",",
"Key",
"=",
"key",
",",
"*",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/s3transfer/tasks.py#L321-L341 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py2/google/protobuf/internal/well_known_types.py | python | _FieldMaskTree.AddLeafNodes | (self, prefix, node) | Adds leaf nodes begin with prefix to this tree. | Adds leaf nodes begin with prefix to this tree. | [
"Adds",
"leaf",
"nodes",
"begin",
"with",
"prefix",
"to",
"this",
"tree",
"."
] | def AddLeafNodes(self, prefix, node):
"""Adds leaf nodes begin with prefix to this tree."""
if not node:
self.AddPath(prefix)
for name in node:
child_path = prefix + '.' + name
self.AddLeafNodes(child_path, node[name]) | [
"def",
"AddLeafNodes",
"(",
"self",
",",
"prefix",
",",
"node",
")",
":",
"if",
"not",
"node",
":",
"self",
".",
"AddPath",
"(",
"prefix",
")",
"for",
"name",
"in",
"node",
":",
"child_path",
"=",
"prefix",
"+",
"'.'",
"+",
"name",
"self",
".",
"Ad... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py2/google/protobuf/internal/well_known_types.py#L638-L644 | ||
hfinkel/llvm-project-cxxjit | 91084ef018240bbb8e24235ff5cd8c355a9c1a1e | lldb/third_party/Python/module/pexpect-2.4/examples/bd_serv.py | python | daemonize | (stdin='/dev/null', stdout='/dev/null', stderr='/dev/null') | return 0 | This forks the current process into a daemon. Almost none of this is
necessary (or advisable) if your daemon is being started by inetd. In that
case, stdin, stdout and stderr are all set up for you to refer to the
network connection, and the fork()s and session manipulation should not be
done (to avoid ... | This forks the current process into a daemon. Almost none of this is
necessary (or advisable) if your daemon is being started by inetd. In that
case, stdin, stdout and stderr are all set up for you to refer to the
network connection, and the fork()s and session manipulation should not be
done (to avoid ... | [
"This",
"forks",
"the",
"current",
"process",
"into",
"a",
"daemon",
".",
"Almost",
"none",
"of",
"this",
"is",
"necessary",
"(",
"or",
"advisable",
")",
"if",
"your",
"daemon",
"is",
"being",
"started",
"by",
"inetd",
".",
"In",
"that",
"case",
"stdin",... | def daemonize(stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'):
'''This forks the current process into a daemon. Almost none of this is
necessary (or advisable) if your daemon is being started by inetd. In that
case, stdin, stdout and stderr are all set up for you to refer to the
network conne... | [
"def",
"daemonize",
"(",
"stdin",
"=",
"'/dev/null'",
",",
"stdout",
"=",
"'/dev/null'",
",",
"stderr",
"=",
"'/dev/null'",
")",
":",
"# Do first fork.",
"try",
":",
"pid",
"=",
"os",
".",
"fork",
"(",
")",
"if",
"pid",
">",
"0",
":",
"sys",
".",
"ex... | https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/lldb/third_party/Python/module/pexpect-2.4/examples/bd_serv.py#L82-L139 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/algorithms/best_response.py | python | BestResponsePolicy.__init__ | (self,
game,
player_id,
policy,
root_state=None,
cut_threshold=0.0) | Initializes the best-response calculation.
Args:
game: The game to analyze.
player_id: The player id of the best-responder.
policy: A `policy.Policy` object.
root_state: The state of the game at which to start analysis. If `None`,
the game root state is used.
cut_threshold: Th... | Initializes the best-response calculation. | [
"Initializes",
"the",
"best",
"-",
"response",
"calculation",
"."
] | def __init__(self,
game,
player_id,
policy,
root_state=None,
cut_threshold=0.0):
"""Initializes the best-response calculation.
Args:
game: The game to analyze.
player_id: The player id of the best-responder.
policy: A ... | [
"def",
"__init__",
"(",
"self",
",",
"game",
",",
"player_id",
",",
"policy",
",",
"root_state",
"=",
"None",
",",
"cut_threshold",
"=",
"0.0",
")",
":",
"self",
".",
"_num_players",
"=",
"game",
".",
"num_players",
"(",
")",
"self",
".",
"_player_id",
... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/best_response.py#L90-L115 | ||
SoarGroup/Soar | a1c5e249499137a27da60533c72969eef3b8ab6b | scons/scons-local-4.1.0/SCons/SConsign.py | python | Reset | () | Reset global state. Used by unit tests that end up using
SConsign multiple times to get a clean slate for each test. | Reset global state. Used by unit tests that end up using
SConsign multiple times to get a clean slate for each test. | [
"Reset",
"global",
"state",
".",
"Used",
"by",
"unit",
"tests",
"that",
"end",
"up",
"using",
"SConsign",
"multiple",
"times",
"to",
"get",
"a",
"clean",
"slate",
"for",
"each",
"test",
"."
] | def Reset():
"""Reset global state. Used by unit tests that end up using
SConsign multiple times to get a clean slate for each test."""
global sig_files, DB_sync_list
sig_files = []
DB_sync_list = [] | [
"def",
"Reset",
"(",
")",
":",
"global",
"sig_files",
",",
"DB_sync_list",
"sig_files",
"=",
"[",
"]",
"DB_sync_list",
"=",
"[",
"]"
] | https://github.com/SoarGroup/Soar/blob/a1c5e249499137a27da60533c72969eef3b8ab6b/scons/scons-local-4.1.0/SCons/SConsign.py#L91-L96 | ||
cinder/Cinder | e83f5bb9c01a63eec20168d02953a0879e5100f7 | docs/libs/markdown/extensions/codehilite.py | python | HiliteTreeprocessor.run | (self, root) | Find code blocks and store in htmlStash. | Find code blocks and store in htmlStash. | [
"Find",
"code",
"blocks",
"and",
"store",
"in",
"htmlStash",
"."
] | def run(self, root):
""" Find code blocks and store in htmlStash. """
blocks = root.iter('pre')
for block in blocks:
if len(block) == 1 and block[0].tag == 'code':
code = CodeHilite(
block[0].text,
linenums=self.config['linenums... | [
"def",
"run",
"(",
"self",
",",
"root",
")",
":",
"blocks",
"=",
"root",
".",
"iter",
"(",
"'pre'",
")",
"for",
"block",
"in",
"blocks",
":",
"if",
"len",
"(",
"block",
")",
"==",
"1",
"and",
"block",
"[",
"0",
"]",
".",
"tag",
"==",
"'code'",
... | https://github.com/cinder/Cinder/blob/e83f5bb9c01a63eec20168d02953a0879e5100f7/docs/libs/markdown/extensions/codehilite.py#L203-L225 | ||
fatih/subvim | 241b6d170597857105da219c9b7d36059e9f11fb | vim/base/YouCompleteMe/third_party/jedi/jedi/api.py | python | Script.completions | (self) | return sorted(comps, key=lambda x: (x.name.startswith('__'),
x.name.startswith('_'),
x.name.lower())) | Return :class:`api_classes.Completion` objects. Those objects contain
information about the completions, more than just names.
:return: Completion objects, sorted by name and __ comes last.
:rtype: list of :class:`api_classes.Completion` | Return :class:`api_classes.Completion` objects. Those objects contain
information about the completions, more than just names. | [
"Return",
":",
"class",
":",
"api_classes",
".",
"Completion",
"objects",
".",
"Those",
"objects",
"contain",
"information",
"about",
"the",
"completions",
"more",
"than",
"just",
"names",
"."
] | def completions(self):
"""
Return :class:`api_classes.Completion` objects. Those objects contain
information about the completions, more than just names.
:return: Completion objects, sorted by name and __ comes last.
:rtype: list of :class:`api_classes.Completion`
"""
... | [
"def",
"completions",
"(",
"self",
")",
":",
"def",
"get_completions",
"(",
"user_stmt",
",",
"bs",
")",
":",
"if",
"isinstance",
"(",
"user_stmt",
",",
"pr",
".",
"Import",
")",
":",
"context",
"=",
"self",
".",
"_module",
".",
"get_context",
"(",
")"... | https://github.com/fatih/subvim/blob/241b6d170597857105da219c9b7d36059e9f11fb/vim/base/YouCompleteMe/third_party/jedi/jedi/api.py#L112-L174 | |
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | src/python/m5/ext/pyfdt/pyfdt.py | python | FdtNop.dts_represent | (self, depth=0) | return INDENT*depth+'// [NOP]' | Get dts string representation | Get dts string representation | [
"Get",
"dts",
"string",
"representation"
] | def dts_represent(self, depth=0): # pylint: disable-msg=R0201
"""Get dts string representation"""
return INDENT*depth+'// [NOP]' | [
"def",
"dts_represent",
"(",
"self",
",",
"depth",
"=",
"0",
")",
":",
"# pylint: disable-msg=R0201",
"return",
"INDENT",
"*",
"depth",
"+",
"'// [NOP]'"
] | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/python/m5/ext/pyfdt/pyfdt.py#L416-L418 | |
bundy-dns/bundy | 3d41934996b82b0cd2fe22dd74d2abc1daba835d | src/lib/python/bundy/statistics/counters.py | python | Counters.disable | (self) | disables incrementing/decrementing counters | disables incrementing/decrementing counters | [
"disables",
"incrementing",
"/",
"decrementing",
"counters"
] | def disable(self):
"""disables incrementing/decrementing counters"""
with self._rlock:
self._disabled = True | [
"def",
"disable",
"(",
"self",
")",
":",
"with",
"self",
".",
"_rlock",
":",
"self",
".",
"_disabled",
"=",
"True"
] | https://github.com/bundy-dns/bundy/blob/3d41934996b82b0cd2fe22dd74d2abc1daba835d/src/lib/python/bundy/statistics/counters.py#L188-L191 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/telnetlib.py | python | Telnet.open | (self, host, port=0, timeout=socket._GLOBAL_DEFAULT_TIMEOUT) | Connect to a host.
The optional second argument is the port number, which
defaults to the standard telnet port (23).
Don't try to reopen an already connected instance. | Connect to a host. | [
"Connect",
"to",
"a",
"host",
"."
] | def open(self, host, port=0, timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
"""Connect to a host.
The optional second argument is the port number, which
defaults to the standard telnet port (23).
Don't try to reopen an already connected instance.
"""
self.eof = 0
if n... | [
"def",
"open",
"(",
"self",
",",
"host",
",",
"port",
"=",
"0",
",",
"timeout",
"=",
"socket",
".",
"_GLOBAL_DEFAULT_TIMEOUT",
")",
":",
"self",
".",
"eof",
"=",
"0",
"if",
"not",
"port",
":",
"port",
"=",
"TELNET_PORT",
"self",
".",
"host",
"=",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/telnetlib.py#L220-L235 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py | python | Misc.winfo_atomname | (self, id, displayof=0) | return self.tk.call(args) | Return name of atom with identifier ID. | Return name of atom with identifier ID. | [
"Return",
"name",
"of",
"atom",
"with",
"identifier",
"ID",
"."
] | def winfo_atomname(self, id, displayof=0):
"""Return name of atom with identifier ID."""
args = ('winfo', 'atomname') \
+ self._displayof(displayof) + (id,)
return self.tk.call(args) | [
"def",
"winfo_atomname",
"(",
"self",
",",
"id",
",",
"displayof",
"=",
"0",
")",
":",
"args",
"=",
"(",
"'winfo'",
",",
"'atomname'",
")",
"+",
"self",
".",
"_displayof",
"(",
"displayof",
")",
"+",
"(",
"id",
",",
")",
"return",
"self",
".",
"tk"... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py#L728-L732 | |
apache/qpid-proton | 6bcdfebb55ea3554bc29b1901422532db331a591 | python/proton/_message.py | python | Message.annotations | (self) | return self.annotation_dict | Message annotations as a dictionary of key/values. The AMQP 1.0
specification restricts this dictionary to have keys that are either
:class:`symbol` or :class:`ulong` types. It is possible to use
the special ``dict`` subclass :class:`AnnotationDict` which
will by default enforce these re... | Message annotations as a dictionary of key/values. The AMQP 1.0
specification restricts this dictionary to have keys that are either
:class:`symbol` or :class:`ulong` types. It is possible to use
the special ``dict`` subclass :class:`AnnotationDict` which
will by default enforce these re... | [
"Message",
"annotations",
"as",
"a",
"dictionary",
"of",
"key",
"/",
"values",
".",
"The",
"AMQP",
"1",
".",
"0",
"specification",
"restricts",
"this",
"dictionary",
"to",
"have",
"keys",
"that",
"are",
"either",
":",
"class",
":",
"symbol",
"or",
":",
"... | def annotations(self) -> Optional[AnnotationDict]:
"""Message annotations as a dictionary of key/values. The AMQP 1.0
specification restricts this dictionary to have keys that are either
:class:`symbol` or :class:`ulong` types. It is possible to use
the special ``dict`` subclass :class:`... | [
"def",
"annotations",
"(",
"self",
")",
"->",
"Optional",
"[",
"AnnotationDict",
"]",
":",
"return",
"self",
".",
"annotation_dict"
] | https://github.com/apache/qpid-proton/blob/6bcdfebb55ea3554bc29b1901422532db331a591/python/proton/_message.py#L467-L478 | |
google/shaka-player-embedded | dabbeb5b47cc257b37b9a254661546352aaf0afe | shaka/tools/webidl/webidl/parser.py | python | IdlParser.p_error | (self, t) | Called when an error occurs. | Called when an error occurs. | [
"Called",
"when",
"an",
"error",
"occurs",
"."
] | def p_error(self, t):
"""Called when an error occurs."""
if t:
line = t.lineno
pos = t.lexpos
prev = self.yacc.symstack[-1]
if t.type == 'DOCSTRING':
msg = ('This treats doc-strings (/** */) special and are only allowed '
'before definitions or members')
elif... | [
"def",
"p_error",
"(",
"self",
",",
"t",
")",
":",
"if",
"t",
":",
"line",
"=",
"t",
".",
"lineno",
"pos",
"=",
"t",
".",
"lexpos",
"prev",
"=",
"self",
".",
"yacc",
".",
"symstack",
"[",
"-",
"1",
"]",
"if",
"t",
".",
"type",
"==",
"'DOCSTRI... | https://github.com/google/shaka-player-embedded/blob/dabbeb5b47cc257b37b9a254661546352aaf0afe/shaka/tools/webidl/webidl/parser.py#L241-L260 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/dygraph/dygraph_to_static/error.py | python | ErrorData.create_message | (self) | return '\n'.join(message_lines) | Creates a custom error message which includes trace stack with source code information of dygraph from user. | Creates a custom error message which includes trace stack with source code information of dygraph from user. | [
"Creates",
"a",
"custom",
"error",
"message",
"which",
"includes",
"trace",
"stack",
"with",
"source",
"code",
"information",
"of",
"dygraph",
"from",
"user",
"."
] | def create_message(self):
"""
Creates a custom error message which includes trace stack with source code information of dygraph from user.
"""
message_lines = []
# Step1: Adds header message to prompt users that the following is the original information.
header_message =... | [
"def",
"create_message",
"(",
"self",
")",
":",
"message_lines",
"=",
"[",
"]",
"# Step1: Adds header message to prompt users that the following is the original information.",
"header_message",
"=",
"\"In transformed code:\"",
"message_lines",
".",
"append",
"(",
"header_message"... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/dygraph/dygraph_to_static/error.py#L165-L231 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/fmt/support/docopt.py | python | parse_argv | (tokens, options, options_first=False) | return parsed | Parse command-line argument vector.
If options_first:
argv ::= [ long | shorts ]* [ argument ]* [ '--' [ argument ]* ] ;
else:
argv ::= [ long | shorts | argument ]* [ '--' [ argument ]* ] ; | Parse command-line argument vector. | [
"Parse",
"command",
"-",
"line",
"argument",
"vector",
"."
] | def parse_argv(tokens, options, options_first=False):
"""Parse command-line argument vector.
If options_first:
argv ::= [ long | shorts ]* [ argument ]* [ '--' [ argument ]* ] ;
else:
argv ::= [ long | shorts | argument ]* [ '--' [ argument ]* ] ;
"""
parsed = []
while tokens.c... | [
"def",
"parse_argv",
"(",
"tokens",
",",
"options",
",",
"options_first",
"=",
"False",
")",
":",
"parsed",
"=",
"[",
"]",
"while",
"tokens",
".",
"current",
"(",
")",
"is",
"not",
"None",
":",
"if",
"tokens",
".",
"current",
"(",
")",
"==",
"'--'",
... | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/fmt/support/docopt.py#L428-L449 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | TimeSpan_Days | (*args, **kwargs) | return _misc_.TimeSpan_Days(*args, **kwargs) | TimeSpan_Days(long days) -> TimeSpan | TimeSpan_Days(long days) -> TimeSpan | [
"TimeSpan_Days",
"(",
"long",
"days",
")",
"-",
">",
"TimeSpan"
] | def TimeSpan_Days(*args, **kwargs):
"""TimeSpan_Days(long days) -> TimeSpan"""
return _misc_.TimeSpan_Days(*args, **kwargs) | [
"def",
"TimeSpan_Days",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"TimeSpan_Days",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L4588-L4590 | |
eclipse/omr | 056e7c9ce9d503649190bc5bd9931fac30b4e4bc | jitbuilder/apigen/genutils.py | python | APIClass.fields | (self) | return [APIField(f, self.api) for f in self.description["fields"]] | Returns a list of descriptions of all class fields. | Returns a list of descriptions of all class fields. | [
"Returns",
"a",
"list",
"of",
"descriptions",
"of",
"all",
"class",
"fields",
"."
] | def fields(self):
"""Returns a list of descriptions of all class fields."""
return [APIField(f, self.api) for f in self.description["fields"]] | [
"def",
"fields",
"(",
"self",
")",
":",
"return",
"[",
"APIField",
"(",
"f",
",",
"self",
".",
"api",
")",
"for",
"f",
"in",
"self",
".",
"description",
"[",
"\"fields\"",
"]",
"]"
] | https://github.com/eclipse/omr/blob/056e7c9ce9d503649190bc5bd9931fac30b4e4bc/jitbuilder/apigen/genutils.py#L331-L333 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/s3/bucket.py | python | Bucket.get_website_endpoint | (self) | return '.'.join(l) | Returns the fully qualified hostname to use is you want to access this
bucket as a website. This doesn't validate whether the bucket has
been correctly configured as a website or not. | Returns the fully qualified hostname to use is you want to access this
bucket as a website. This doesn't validate whether the bucket has
been correctly configured as a website or not. | [
"Returns",
"the",
"fully",
"qualified",
"hostname",
"to",
"use",
"is",
"you",
"want",
"to",
"access",
"this",
"bucket",
"as",
"a",
"website",
".",
"This",
"doesn",
"t",
"validate",
"whether",
"the",
"bucket",
"has",
"been",
"correctly",
"configured",
"as",
... | def get_website_endpoint(self):
"""
Returns the fully qualified hostname to use is you want to access this
bucket as a website. This doesn't validate whether the bucket has
been correctly configured as a website or not.
"""
l = [self.name]
l.append(S3WebsiteEndpo... | [
"def",
"get_website_endpoint",
"(",
"self",
")",
":",
"l",
"=",
"[",
"self",
".",
"name",
"]",
"l",
".",
"append",
"(",
"S3WebsiteEndpointTranslate",
".",
"translate_region",
"(",
"self",
".",
"get_location",
"(",
")",
")",
")",
"l",
".",
"append",
"(",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/s3/bucket.py#L1551-L1560 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | PhysicsTools/NanoAOD/python/custom_jme_cff.py | python | ReclusterAK4CHSJets | (proc, recoJA, runOnMC) | return proc | Recluster AK4 CHS jets and replace slimmedJets
that is used as default to save AK4 CHS jets
in NanoAODs. | Recluster AK4 CHS jets and replace slimmedJets
that is used as default to save AK4 CHS jets
in NanoAODs. | [
"Recluster",
"AK4",
"CHS",
"jets",
"and",
"replace",
"slimmedJets",
"that",
"is",
"used",
"as",
"default",
"to",
"save",
"AK4",
"CHS",
"jets",
"in",
"NanoAODs",
"."
] | def ReclusterAK4CHSJets(proc, recoJA, runOnMC):
"""
Recluster AK4 CHS jets and replace slimmedJets
that is used as default to save AK4 CHS jets
in NanoAODs.
"""
print("custom_jme_cff::ReclusterAK4CHSJets: Recluster AK4 PF CHS jets")
#
# Recluster AK4 CHS jets
#
cfg = {
"jet" : "ak4pfchs",
"... | [
"def",
"ReclusterAK4CHSJets",
"(",
"proc",
",",
"recoJA",
",",
"runOnMC",
")",
":",
"print",
"(",
"\"custom_jme_cff::ReclusterAK4CHSJets: Recluster AK4 PF CHS jets\"",
")",
"#",
"# Recluster AK4 CHS jets",
"#",
"cfg",
"=",
"{",
"\"jet\"",
":",
"\"ak4pfchs\"",
",",
"\"... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/PhysicsTools/NanoAOD/python/custom_jme_cff.py#L596-L765 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/share/gdb/python/gdb/prompt.py | python | _prompt_param | (attr) | return gdb.parameter(attr) | A parameter's value; the argument names the parameter. | A parameter's value; the argument names the parameter. | [
"A",
"parameter",
"s",
"value",
";",
"the",
"argument",
"names",
"the",
"parameter",
"."
] | def _prompt_param(attr):
"A parameter's value; the argument names the parameter."
return gdb.parameter(attr) | [
"def",
"_prompt_param",
"(",
"attr",
")",
":",
"return",
"gdb",
".",
"parameter",
"(",
"attr",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/share/gdb/python/gdb/prompt.py#L70-L72 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/distribute/distributed_training_utils_v1.py | python | _update_sample_weight_modes | (model, mode, sample_weights) | Update sample_weight_mode of the distributed model. | Update sample_weight_mode of the distributed model. | [
"Update",
"sample_weight_mode",
"of",
"the",
"distributed",
"model",
"."
] | def _update_sample_weight_modes(model, mode, sample_weights):
"""Update sample_weight_mode of the distributed model."""
if is_distributing_by_cloning(model):
distributed_model = get_distributed_model(model, mode)
if not distributed_model:
_make_replicated_models_with_cloning(model, mode)
distrib... | [
"def",
"_update_sample_weight_modes",
"(",
"model",
",",
"mode",
",",
"sample_weights",
")",
":",
"if",
"is_distributing_by_cloning",
"(",
"model",
")",
":",
"distributed_model",
"=",
"get_distributed_model",
"(",
"model",
",",
"mode",
")",
"if",
"not",
"distribut... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/distribute/distributed_training_utils_v1.py#L1121-L1139 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/input.py | python | ValidateTargetType | (target, target_dict) | Ensures the 'type' field on the target is one of the known types.
Arguments:
target: string, name of target.
target_dict: dict, target spec.
Raises an exception on error. | Ensures the 'type' field on the target is one of the known types. | [
"Ensures",
"the",
"type",
"field",
"on",
"the",
"target",
"is",
"one",
"of",
"the",
"known",
"types",
"."
] | def ValidateTargetType(target, target_dict):
"""Ensures the 'type' field on the target is one of the known types.
Arguments:
target: string, name of target.
target_dict: dict, target spec.
Raises an exception on error.
"""
VALID_TARGET_TYPES = ('executable', 'loadable_module',
... | [
"def",
"ValidateTargetType",
"(",
"target",
",",
"target_dict",
")",
":",
"VALID_TARGET_TYPES",
"=",
"(",
"'executable'",
",",
"'loadable_module'",
",",
"'static_library'",
",",
"'shared_library'",
",",
"'none'",
")",
"target_type",
"=",
"target_dict",
".",
"get",
... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/input.py#L2297-L2318 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py | python | MacroFunction.completemacro | (self, macro) | Complete the macro with the parameters read. | Complete the macro with the parameters read. | [
"Complete",
"the",
"macro",
"with",
"the",
"parameters",
"read",
"."
] | def completemacro(self, macro):
"Complete the macro with the parameters read."
self.contents = [macro.instantiate()]
replaced = [False] * len(self.values)
for parameter in self.searchall(MacroParameter):
index = parameter.number - 1
if index >= len(self.values):
Trace.error('Macro pa... | [
"def",
"completemacro",
"(",
"self",
",",
"macro",
")",
":",
"self",
".",
"contents",
"=",
"[",
"macro",
".",
"instantiate",
"(",
")",
"]",
"replaced",
"=",
"[",
"False",
"]",
"*",
"len",
"(",
"self",
".",
"values",
")",
"for",
"parameter",
"in",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py#L5309-L5322 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/construction.py | python | sanitize_array | (
data, index, dtype=None, copy: bool = False, raise_cast_failure: bool = False
) | return subarr | Sanitize input data to an ndarray, copy if specified, coerce to the
dtype if specified. | Sanitize input data to an ndarray, copy if specified, coerce to the
dtype if specified. | [
"Sanitize",
"input",
"data",
"to",
"an",
"ndarray",
"copy",
"if",
"specified",
"coerce",
"to",
"the",
"dtype",
"if",
"specified",
"."
] | def sanitize_array(
data, index, dtype=None, copy: bool = False, raise_cast_failure: bool = False
):
"""
Sanitize input data to an ndarray, copy if specified, coerce to the
dtype if specified.
"""
if dtype is not None:
dtype = pandas_dtype(dtype)
if isinstance(data, ma.MaskedArray):... | [
"def",
"sanitize_array",
"(",
"data",
",",
"index",
",",
"dtype",
"=",
"None",
",",
"copy",
":",
"bool",
"=",
"False",
",",
"raise_cast_failure",
":",
"bool",
"=",
"False",
")",
":",
"if",
"dtype",
"is",
"not",
"None",
":",
"dtype",
"=",
"pandas_dtype"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/construction.py#L388-L503 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/io/formats/style_render.py | python | StylerRenderer._translate_body | (
self,
data_class: str,
row_heading_class: str,
sparsify_index: bool,
max_rows: int,
max_cols: int,
trimmed_row_class: str,
trimmed_col_class: str,
) | return body | Build each <tr> within table <body> as a list
Use the following structure:
+--------------------------------------------+---------------------------+
| index_header_0 ... index_header_n | data_by_column |
+--------------------------------------------+----------... | Build each <tr> within table <body> as a list | [
"Build",
"each",
"<tr",
">",
"within",
"table",
"<body",
">",
"as",
"a",
"list"
] | def _translate_body(
self,
data_class: str,
row_heading_class: str,
sparsify_index: bool,
max_rows: int,
max_cols: int,
trimmed_row_class: str,
trimmed_col_class: str,
):
"""
Build each <tr> within table <body> as a list
Use th... | [
"def",
"_translate_body",
"(",
"self",
",",
"data_class",
":",
"str",
",",
"row_heading_class",
":",
"str",
",",
"sparsify_index",
":",
"bool",
",",
"max_rows",
":",
"int",
",",
"max_cols",
":",
"int",
",",
"trimmed_row_class",
":",
"str",
",",
"trimmed_col_... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/io/formats/style_render.py#L389-L528 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/lite/tools/evaluation/tasks/coco_object_detection/preprocess_coco_minival.py | python | _parse_args | () | return parser.parse_known_args(args=sys.argv[1:])[0] | Creates a parser that parse the command line arguments.
Returns:
A namespace parsed from command line arguments. | Creates a parser that parse the command line arguments. | [
"Creates",
"a",
"parser",
"that",
"parse",
"the",
"command",
"line",
"arguments",
"."
] | def _parse_args():
"""Creates a parser that parse the command line arguments.
Returns:
A namespace parsed from command line arguments.
"""
parser = argparse.ArgumentParser(
description='preprocess_coco_minival: Preprocess COCO minival dataset')
parser.add_argument(
'--images_folder',
ty... | [
"def",
"_parse_args",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'preprocess_coco_minival: Preprocess COCO minival dataset'",
")",
"parser",
".",
"add_argument",
"(",
"'--images_folder'",
",",
"type",
"=",
"str",
",",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/lite/tools/evaluation/tasks/coco_object_detection/preprocess_coco_minival.py#L167-L200 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/gyp/pylib/gyp/MSVSToolFile.py | python | Writer.AddCustomBuildRule | (self, name, cmd, description,
additional_dependencies,
outputs, extensions) | Adds a rule to the tool file.
Args:
name: Name of the rule.
description: Description of the rule.
cmd: Command line of the rule.
additional_dependencies: other files which may trigger the rule.
outputs: outputs of the rule.
extensions: extensions handled by the rule. | Adds a rule to the tool file. | [
"Adds",
"a",
"rule",
"to",
"the",
"tool",
"file",
"."
] | def AddCustomBuildRule(self, name, cmd, description,
additional_dependencies,
outputs, extensions):
"""Adds a rule to the tool file.
Args:
name: Name of the rule.
description: Description of the rule.
cmd: Command line of the rule.
addit... | [
"def",
"AddCustomBuildRule",
"(",
"self",
",",
"name",
",",
"cmd",
",",
"description",
",",
"additional_dependencies",
",",
"outputs",
",",
"extensions",
")",
":",
"rule",
"=",
"[",
"'CustomBuildRule'",
",",
"{",
"'Name'",
":",
"name",
",",
"'ExecutionDescript... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/gyp/pylib/gyp/MSVSToolFile.py#L25-L47 | ||
xbmc/xbmc | 091211a754589fc40a2a1f239b0ce9f4ee138268 | addons/metadata.tvshows.themoviedb.org.python/libs/cache.py | python | load_show_info_from_cache | (show_id) | Load show info from a local cache
:param show_id: show ID on TVmaze
:return: show_info dict or None | Load show info from a local cache | [
"Load",
"show",
"info",
"from",
"a",
"local",
"cache"
] | def load_show_info_from_cache(show_id):
# type: (Text) -> Optional[Dict[Text, Any]]
"""
Load show info from a local cache
:param show_id: show ID on TVmaze
:return: show_info dict or None
"""
file_name = str(show_id) + '.pickle'
try:
with open(os.path.join(CACHE_DIR, file_name),... | [
"def",
"load_show_info_from_cache",
"(",
"show_id",
")",
":",
"# type: (Text) -> Optional[Dict[Text, Any]]",
"file_name",
"=",
"str",
"(",
"show_id",
")",
"+",
"'.pickle'",
"try",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"CACHE_DIR",
",",
... | https://github.com/xbmc/xbmc/blob/091211a754589fc40a2a1f239b0ce9f4ee138268/addons/metadata.tvshows.themoviedb.org.python/libs/cache.py#L63-L80 | ||
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py | python | _ConvertSourcesToFilterHierarchy | (sources, prefix=None, excluded=None,
list_excluded=True, msvs_version=None) | return result | Converts a list split source file paths into a vcproj folder hierarchy.
Arguments:
sources: A list of source file paths split.
prefix: A list of source file path layers meant to apply to each of sources.
excluded: A set of excluded files.
msvs_version: A MSVSVersion object.
Returns:
A hierarch... | Converts a list split source file paths into a vcproj folder hierarchy. | [
"Converts",
"a",
"list",
"split",
"source",
"file",
"paths",
"into",
"a",
"vcproj",
"folder",
"hierarchy",
"."
] | def _ConvertSourcesToFilterHierarchy(sources, prefix=None, excluded=None,
list_excluded=True, msvs_version=None):
"""Converts a list split source file paths into a vcproj folder hierarchy.
Arguments:
sources: A list of source file paths split.
prefix: A list of source f... | [
"def",
"_ConvertSourcesToFilterHierarchy",
"(",
"sources",
",",
"prefix",
"=",
"None",
",",
"excluded",
"=",
"None",
",",
"list_excluded",
"=",
"True",
",",
"msvs_version",
"=",
"None",
")",
":",
"if",
"not",
"prefix",
":",
"prefix",
"=",
"[",
"]",
"result... | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py#L179-L241 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AzCodeGenerator/bin/windows/az_code_gen/clang_cpp.py | python | is_list | (test_dictionary) | return False | Detect if a dictionary can be converted into
a list of strings
@param test_dictionary - The dictionary to test
@return False if the incoming dictionary is empty, has only a single
key/value pair, or has any values at all that aren't
the None type. True if the dictionary has multiple
... | Detect if a dictionary can be converted into
a list of strings | [
"Detect",
"if",
"a",
"dictionary",
"can",
"be",
"converted",
"into",
"a",
"list",
"of",
"strings"
] | def is_list(test_dictionary):
"""Detect if a dictionary can be converted into
a list of strings
@param test_dictionary - The dictionary to test
@return False if the incoming dictionary is empty, has only a single
key/value pair, or has any values at all that aren't
the None type.... | [
"def",
"is_list",
"(",
"test_dictionary",
")",
":",
"assert",
"not",
"test_dictionary",
"or",
"isinstance",
"(",
"test_dictionary",
",",
"OrderedDict",
")",
"if",
"test_dictionary",
"and",
"len",
"(",
"test_dictionary",
")",
">",
"1",
":",
"for",
"value",
"in"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AzCodeGenerator/bin/windows/az_code_gen/clang_cpp.py#L661-L676 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/ao/quantization/qconfig_dict_utils.py | python | get_flattened_qconfig_dict | (qconfig_dict) | return flattened | flatten the global, object_type and module_name qconfig
to the same qconfig_dict so that it can be used by
propagate_qconfig_ function.
"module_name_regex" is ignored for now since it's not supported
in propagate_qconfig_, but it can be fixed later.
For example:
Input: {
"": qconfig,
... | flatten the global, object_type and module_name qconfig
to the same qconfig_dict so that it can be used by
propagate_qconfig_ function.
"module_name_regex" is ignored for now since it's not supported
in propagate_qconfig_, but it can be fixed later. | [
"flatten",
"the",
"global",
"object_type",
"and",
"module_name",
"qconfig",
"to",
"the",
"same",
"qconfig_dict",
"so",
"that",
"it",
"can",
"be",
"used",
"by",
"propagate_qconfig_",
"function",
".",
"module_name_regex",
"is",
"ignored",
"for",
"now",
"since",
"i... | def get_flattened_qconfig_dict(qconfig_dict):
""" flatten the global, object_type and module_name qconfig
to the same qconfig_dict so that it can be used by
propagate_qconfig_ function.
"module_name_regex" is ignored for now since it's not supported
in propagate_qconfig_, but it can be fixed later.
... | [
"def",
"get_flattened_qconfig_dict",
"(",
"qconfig_dict",
")",
":",
"flattened",
"=",
"dict",
"(",
")",
"if",
"''",
"in",
"qconfig_dict",
":",
"flattened",
"[",
"''",
"]",
"=",
"qconfig_dict",
"[",
"''",
"]",
"def",
"flatten_key",
"(",
"key",
")",
":",
"... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/ao/quantization/qconfig_dict_utils.py#L60-L95 | |
Tokutek/mongo | 0653eabe2c5b9d12b4814617cb7fb2d799937a0f | buildscripts/packager.py | python | sysassert | (argv) | Run argv and assert that it exited with status 0. | Run argv and assert that it exited with status 0. | [
"Run",
"argv",
"and",
"assert",
"that",
"it",
"exited",
"with",
"status",
"0",
"."
] | def sysassert(argv):
"""Run argv and assert that it exited with status 0."""
print "In %s, running %s" % (os.getcwd(), " ".join(argv))
sys.stdout.flush()
sys.stderr.flush()
assert(subprocess.Popen(argv).wait()==0) | [
"def",
"sysassert",
"(",
"argv",
")",
":",
"print",
"\"In %s, running %s\"",
"%",
"(",
"os",
".",
"getcwd",
"(",
")",
",",
"\" \"",
".",
"join",
"(",
"argv",
")",
")",
"sys",
".",
"stdout",
".",
"flush",
"(",
")",
"sys",
".",
"stderr",
".",
"flush"... | https://github.com/Tokutek/mongo/blob/0653eabe2c5b9d12b4814617cb7fb2d799937a0f/buildscripts/packager.py#L235-L240 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/httplib2/python2/httplib2/__init__.py | python | Http.__init__ | (self, cache=None, timeout=None,
proxy_info=proxy_info_from_environment,
ca_certs=None, disable_ssl_certificate_validation=False) | If 'cache' is a string then it is used as a directory name for
a disk cache. Otherwise it must be an object that supports the
same interface as FileCache.
All timeouts are in seconds. If None is passed for timeout
then Python's default timeout for sockets will be used. See
for e... | If 'cache' is a string then it is used as a directory name for
a disk cache. Otherwise it must be an object that supports the
same interface as FileCache. | [
"If",
"cache",
"is",
"a",
"string",
"then",
"it",
"is",
"used",
"as",
"a",
"directory",
"name",
"for",
"a",
"disk",
"cache",
".",
"Otherwise",
"it",
"must",
"be",
"an",
"object",
"that",
"supports",
"the",
"same",
"interface",
"as",
"FileCache",
"."
] | def __init__(self, cache=None, timeout=None,
proxy_info=proxy_info_from_environment,
ca_certs=None, disable_ssl_certificate_validation=False):
"""If 'cache' is a string then it is used as a directory name for
a disk cache. Otherwise it must be an object that supports th... | [
"def",
"__init__",
"(",
"self",
",",
"cache",
"=",
"None",
",",
"timeout",
"=",
"None",
",",
"proxy_info",
"=",
"proxy_info_from_environment",
",",
"ca_certs",
"=",
"None",
",",
"disable_ssl_certificate_validation",
"=",
"False",
")",
":",
"self",
".",
"proxy_... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/httplib2/python2/httplib2/__init__.py#L1139-L1206 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.