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
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/parenmatch.py
python
ParenMatch.set_timeout_none
(self)
Highlight will remain until user input turns it off or the insert has moved
Highlight will remain until user input turns it off or the insert has moved
[ "Highlight", "will", "remain", "until", "user", "input", "turns", "it", "off", "or", "the", "insert", "has", "moved" ]
def set_timeout_none(self): """Highlight will remain until user input turns it off or the insert has moved""" # After CHECK_DELAY, call a function which disables the "paren" tag # if the event is for the most recent timer and the insert has changed, # or schedules another call for itself. self.counter += 1 def callme(callme, self=self, c=self.counter, index=self.text.index("insert")): if index != self.text.index("insert"): self.handle_restore_timer(c) else: self.editwin.text_frame.after(CHECK_DELAY, callme, callme) self.editwin.text_frame.after(CHECK_DELAY, callme, callme)
[ "def", "set_timeout_none", "(", "self", ")", ":", "# After CHECK_DELAY, call a function which disables the \"paren\" tag", "# if the event is for the most recent timer and the insert has changed,", "# or schedules another call for itself.", "self", ".", "counter", "+=", "1", "def", "callme", "(", "callme", ",", "self", "=", "self", ",", "c", "=", "self", ".", "counter", ",", "index", "=", "self", ".", "text", ".", "index", "(", "\"insert\"", ")", ")", ":", "if", "index", "!=", "self", ".", "text", ".", "index", "(", "\"insert\"", ")", ":", "self", ".", "handle_restore_timer", "(", "c", ")", "else", ":", "self", ".", "editwin", ".", "text_frame", ".", "after", "(", "CHECK_DELAY", ",", "callme", ",", "callme", ")", "self", ".", "editwin", ".", "text_frame", ".", "after", "(", "CHECK_DELAY", ",", "callme", ",", "callme", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/parenmatch.py#L153-L166
KratosMultiphysics/Kratos
0000833054ed0503424eb28205d6508d9ca6cbbc
applications/MeshingApplication/python_scripts/mmg_process.py
python
MmgProcess._debug_output_gid
(self, label, name, prefix)
Debug postprocess with GiD.
Debug postprocess with GiD.
[ "Debug", "postprocess", "with", "GiD", "." ]
def _debug_output_gid(self, label, name, prefix): '''Debug postprocess with GiD.''' gid_mode = KratosMultiphysics.GiDPostMode.GiD_PostBinary singlefile = KratosMultiphysics.MultiFileFlag.SingleFile deformed_mesh_flag = KratosMultiphysics.WriteDeformedMeshFlag.WriteUndeformed write_conditions = KratosMultiphysics.WriteConditionsFlag.WriteConditions gid_io = KratosMultiphysics.GidIO(prefix + "REMESHING_" + name + "_STEP_" + str(label), gid_mode, singlefile, deformed_mesh_flag, write_conditions) gid_io.InitializeMesh(label) gid_io.WriteMesh(self.main_model_part.GetMesh()) gid_io.FinalizeMesh() gid_io.InitializeResults(label, self.main_model_part.GetMesh()) if self.settings["framework"].GetString() == "Lagrangian": gid_io.WriteNodalResults(KratosMultiphysics.DISPLACEMENT, self.main_model_part.Nodes, label, 0) for var in self.internal_variable_interpolation_list: gid_io.PrintOnGaussPoints(var, self.main_model_part, label) else: gid_io.WriteNodalResults(KratosMultiphysics.VELOCITY, self.main_model_part.Nodes, label, 0) if self.strategy == "levelset": gid_io.WriteNodalResults(self.scalar_variable, self.main_model_part.Nodes, label, 0) gid_io.WriteNodalResults(self.gradation_value, self.main_model_part.Nodes, label, 0) elif self.strategy == "hessian": variables = self.settings["hessian_strategy_parameters"]["metric_variable"].GetStringArray() for i in range(len(variables)): aux_var = KratosMultiphysics.KratosGlobals.GetVariable( variables[i] ) if self.settings["hessian_strategy_parameters"]["non_historical_metric_variable"][i].GetBool(): gid_io.WriteNodalResultsNonHistorical(aux_var, self.main_model_part.Nodes, label) else: gid_io.WriteNodalResults(aux_var, self.main_model_part.Nodes, label, 0) gid_io.FinalizeResults()
[ "def", "_debug_output_gid", "(", "self", ",", "label", ",", "name", ",", "prefix", ")", ":", "gid_mode", "=", "KratosMultiphysics", ".", "GiDPostMode", ".", "GiD_PostBinary", "singlefile", "=", "KratosMultiphysics", ".", "MultiFileFlag", ".", "SingleFile", "deformed_mesh_flag", "=", "KratosMultiphysics", ".", "WriteDeformedMeshFlag", ".", "WriteUndeformed", "write_conditions", "=", "KratosMultiphysics", ".", "WriteConditionsFlag", ".", "WriteConditions", "gid_io", "=", "KratosMultiphysics", ".", "GidIO", "(", "prefix", "+", "\"REMESHING_\"", "+", "name", "+", "\"_STEP_\"", "+", "str", "(", "label", ")", ",", "gid_mode", ",", "singlefile", ",", "deformed_mesh_flag", ",", "write_conditions", ")", "gid_io", ".", "InitializeMesh", "(", "label", ")", "gid_io", ".", "WriteMesh", "(", "self", ".", "main_model_part", ".", "GetMesh", "(", ")", ")", "gid_io", ".", "FinalizeMesh", "(", ")", "gid_io", ".", "InitializeResults", "(", "label", ",", "self", ".", "main_model_part", ".", "GetMesh", "(", ")", ")", "if", "self", ".", "settings", "[", "\"framework\"", "]", ".", "GetString", "(", ")", "==", "\"Lagrangian\"", ":", "gid_io", ".", "WriteNodalResults", "(", "KratosMultiphysics", ".", "DISPLACEMENT", ",", "self", ".", "main_model_part", ".", "Nodes", ",", "label", ",", "0", ")", "for", "var", "in", "self", ".", "internal_variable_interpolation_list", ":", "gid_io", ".", "PrintOnGaussPoints", "(", "var", ",", "self", ".", "main_model_part", ",", "label", ")", "else", ":", "gid_io", ".", "WriteNodalResults", "(", "KratosMultiphysics", ".", "VELOCITY", ",", "self", ".", "main_model_part", ".", "Nodes", ",", "label", ",", "0", ")", "if", "self", ".", "strategy", "==", "\"levelset\"", ":", "gid_io", ".", "WriteNodalResults", "(", "self", ".", "scalar_variable", ",", "self", ".", "main_model_part", ".", "Nodes", ",", "label", ",", "0", ")", "gid_io", ".", "WriteNodalResults", "(", "self", ".", "gradation_value", ",", "self", ".", "main_model_part", ".", "Nodes", ",", "label", ",", "0", ")", "elif", "self", ".", "strategy", "==", "\"hessian\"", ":", "variables", "=", "self", ".", "settings", "[", "\"hessian_strategy_parameters\"", "]", "[", "\"metric_variable\"", "]", ".", "GetStringArray", "(", ")", "for", "i", "in", "range", "(", "len", "(", "variables", ")", ")", ":", "aux_var", "=", "KratosMultiphysics", ".", "KratosGlobals", ".", "GetVariable", "(", "variables", "[", "i", "]", ")", "if", "self", ".", "settings", "[", "\"hessian_strategy_parameters\"", "]", "[", "\"non_historical_metric_variable\"", "]", "[", "i", "]", ".", "GetBool", "(", ")", ":", "gid_io", ".", "WriteNodalResultsNonHistorical", "(", "aux_var", ",", "self", ".", "main_model_part", ".", "Nodes", ",", "label", ")", "else", ":", "gid_io", ".", "WriteNodalResults", "(", "aux_var", ",", "self", ".", "main_model_part", ".", "Nodes", ",", "label", ",", "0", ")", "gid_io", ".", "FinalizeResults", "(", ")" ]
https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/MeshingApplication/python_scripts/mmg_process.py#L815-L846
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/numpy/py2/numpy/lib/financial.py
python
pmt
(rate, nper, pv, fv=0, when='end')
return -(fv + pv*temp) / fact
Compute the payment against loan principal plus interest. Given: * a present value, `pv` (e.g., an amount borrowed) * a future value, `fv` (e.g., 0) * an interest `rate` compounded once per period, of which there are * `nper` total * and (optional) specification of whether payment is made at the beginning (`when` = {'begin', 1}) or the end (`when` = {'end', 0}) of each period Return: the (fixed) periodic payment. Parameters ---------- rate : array_like Rate of interest (per period) nper : array_like Number of compounding periods pv : array_like Present value fv : array_like, optional Future value (default = 0) when : {{'begin', 1}, {'end', 0}}, {string, int} When payments are due ('begin' (1) or 'end' (0)) Returns ------- out : ndarray Payment against loan plus interest. If all input is scalar, returns a scalar float. If any input is array_like, returns payment for each input element. If multiple inputs are array_like, they all must have the same shape. Notes ----- The payment is computed by solving the equation:: fv + pv*(1 + rate)**nper + pmt*(1 + rate*when)/rate*((1 + rate)**nper - 1) == 0 or, when ``rate == 0``:: fv + pv + pmt * nper == 0 for ``pmt``. Note that computing a monthly mortgage payment is only one use for this function. For example, pmt returns the periodic deposit one must make to achieve a specified future balance given an initial deposit, a fixed, periodically compounded interest rate, and the total number of periods. References ---------- .. [WRW] Wheeler, D. A., E. Rathke, and R. Weir (Eds.) (2009, May). Open Document Format for Office Applications (OpenDocument)v1.2, Part 2: Recalculated Formula (OpenFormula) Format - Annotated Version, Pre-Draft 12. Organization for the Advancement of Structured Information Standards (OASIS). Billerica, MA, USA. [ODT Document]. Available: http://www.oasis-open.org/committees/documents.php ?wg_abbrev=office-formulaOpenDocument-formula-20090508.odt Examples -------- What is the monthly payment needed to pay off a $200,000 loan in 15 years at an annual interest rate of 7.5%? >>> np.pmt(0.075/12, 12*15, 200000) -1854.0247200054619 In order to pay-off (i.e., have a future-value of 0) the $200,000 obtained today, a monthly payment of $1,854.02 would be required. Note that this example illustrates usage of `fv` having a default value of 0.
Compute the payment against loan principal plus interest.
[ "Compute", "the", "payment", "against", "loan", "principal", "plus", "interest", "." ]
def pmt(rate, nper, pv, fv=0, when='end'): """ Compute the payment against loan principal plus interest. Given: * a present value, `pv` (e.g., an amount borrowed) * a future value, `fv` (e.g., 0) * an interest `rate` compounded once per period, of which there are * `nper` total * and (optional) specification of whether payment is made at the beginning (`when` = {'begin', 1}) or the end (`when` = {'end', 0}) of each period Return: the (fixed) periodic payment. Parameters ---------- rate : array_like Rate of interest (per period) nper : array_like Number of compounding periods pv : array_like Present value fv : array_like, optional Future value (default = 0) when : {{'begin', 1}, {'end', 0}}, {string, int} When payments are due ('begin' (1) or 'end' (0)) Returns ------- out : ndarray Payment against loan plus interest. If all input is scalar, returns a scalar float. If any input is array_like, returns payment for each input element. If multiple inputs are array_like, they all must have the same shape. Notes ----- The payment is computed by solving the equation:: fv + pv*(1 + rate)**nper + pmt*(1 + rate*when)/rate*((1 + rate)**nper - 1) == 0 or, when ``rate == 0``:: fv + pv + pmt * nper == 0 for ``pmt``. Note that computing a monthly mortgage payment is only one use for this function. For example, pmt returns the periodic deposit one must make to achieve a specified future balance given an initial deposit, a fixed, periodically compounded interest rate, and the total number of periods. References ---------- .. [WRW] Wheeler, D. A., E. Rathke, and R. Weir (Eds.) (2009, May). Open Document Format for Office Applications (OpenDocument)v1.2, Part 2: Recalculated Formula (OpenFormula) Format - Annotated Version, Pre-Draft 12. Organization for the Advancement of Structured Information Standards (OASIS). Billerica, MA, USA. [ODT Document]. Available: http://www.oasis-open.org/committees/documents.php ?wg_abbrev=office-formulaOpenDocument-formula-20090508.odt Examples -------- What is the monthly payment needed to pay off a $200,000 loan in 15 years at an annual interest rate of 7.5%? >>> np.pmt(0.075/12, 12*15, 200000) -1854.0247200054619 In order to pay-off (i.e., have a future-value of 0) the $200,000 obtained today, a monthly payment of $1,854.02 would be required. Note that this example illustrates usage of `fv` having a default value of 0. """ when = _convert_when(when) (rate, nper, pv, fv, when) = map(np.array, [rate, nper, pv, fv, when]) temp = (1 + rate)**nper mask = (rate == 0) masked_rate = np.where(mask, 1, rate) fact = np.where(mask != 0, nper, (1 + masked_rate*when)*(temp - 1)/masked_rate) return -(fv + pv*temp) / fact
[ "def", "pmt", "(", "rate", ",", "nper", ",", "pv", ",", "fv", "=", "0", ",", "when", "=", "'end'", ")", ":", "when", "=", "_convert_when", "(", "when", ")", "(", "rate", ",", "nper", ",", "pv", ",", "fv", ",", "when", ")", "=", "map", "(", "np", ".", "array", ",", "[", "rate", ",", "nper", ",", "pv", ",", "fv", ",", "when", "]", ")", "temp", "=", "(", "1", "+", "rate", ")", "**", "nper", "mask", "=", "(", "rate", "==", "0", ")", "masked_rate", "=", "np", ".", "where", "(", "mask", ",", "1", ",", "rate", ")", "fact", "=", "np", ".", "where", "(", "mask", "!=", "0", ",", "nper", ",", "(", "1", "+", "masked_rate", "*", "when", ")", "*", "(", "temp", "-", "1", ")", "/", "masked_rate", ")", "return", "-", "(", "fv", "+", "pv", "*", "temp", ")", "/", "fact" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/lib/financial.py#L146-L236
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/py2/scipy/integrate/quadrature.py
python
_romberg_diff
(b, c, k)
return (tmp * c - b)/(tmp - 1.0)
Compute the differences for the Romberg quadrature corrections. See Forman Acton's "Real Computing Made Real," p 143.
Compute the differences for the Romberg quadrature corrections. See Forman Acton's "Real Computing Made Real," p 143.
[ "Compute", "the", "differences", "for", "the", "Romberg", "quadrature", "corrections", ".", "See", "Forman", "Acton", "s", "Real", "Computing", "Made", "Real", "p", "143", "." ]
def _romberg_diff(b, c, k): """ Compute the differences for the Romberg quadrature corrections. See Forman Acton's "Real Computing Made Real," p 143. """ tmp = 4.0**k return (tmp * c - b)/(tmp - 1.0)
[ "def", "_romberg_diff", "(", "b", ",", "c", ",", "k", ")", ":", "tmp", "=", "4.0", "**", "k", "return", "(", "tmp", "*", "c", "-", "b", ")", "/", "(", "tmp", "-", "1.0", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/integrate/quadrature.py#L645-L651
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/dtypes/cast.py
python
infer_dtype_from
(val, pandas_dtype: bool = False)
return infer_dtype_from_array(val, pandas_dtype=pandas_dtype)
Interpret the dtype from a scalar or array. Parameters ---------- val : object pandas_dtype : bool, default False whether to infer dtype including pandas extension types. If False, scalar/array belongs to pandas extension types is inferred as object
Interpret the dtype from a scalar or array.
[ "Interpret", "the", "dtype", "from", "a", "scalar", "or", "array", "." ]
def infer_dtype_from(val, pandas_dtype: bool = False): """ Interpret the dtype from a scalar or array. Parameters ---------- val : object pandas_dtype : bool, default False whether to infer dtype including pandas extension types. If False, scalar/array belongs to pandas extension types is inferred as object """ if is_scalar(val): return infer_dtype_from_scalar(val, pandas_dtype=pandas_dtype) return infer_dtype_from_array(val, pandas_dtype=pandas_dtype)
[ "def", "infer_dtype_from", "(", "val", ",", "pandas_dtype", ":", "bool", "=", "False", ")", ":", "if", "is_scalar", "(", "val", ")", ":", "return", "infer_dtype_from_scalar", "(", "val", ",", "pandas_dtype", "=", "pandas_dtype", ")", "return", "infer_dtype_from_array", "(", "val", ",", "pandas_dtype", "=", "pandas_dtype", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/dtypes/cast.py#L532-L546
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_controls.py
python
TextAttr.HasFontFamily
(*args, **kwargs)
return _controls_.TextAttr_HasFontFamily(*args, **kwargs)
HasFontFamily(self) -> bool
HasFontFamily(self) -> bool
[ "HasFontFamily", "(", "self", ")", "-", ">", "bool" ]
def HasFontFamily(*args, **kwargs): """HasFontFamily(self) -> bool""" return _controls_.TextAttr_HasFontFamily(*args, **kwargs)
[ "def", "HasFontFamily", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_controls_", ".", "TextAttr_HasFontFamily", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L1820-L1822
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/Pygments/py3/pygments/lexers/scripting.py
python
HybrisLexer.analyse_text
(text)
return result
public method and private method don't seem to be quite common elsewhere.
public method and private method don't seem to be quite common elsewhere.
[ "public", "method", "and", "private", "method", "don", "t", "seem", "to", "be", "quite", "common", "elsewhere", "." ]
def analyse_text(text): """public method and private method don't seem to be quite common elsewhere.""" result = 0 if re.search(r'\b(?:public|private)\s+method\b', text): result += 0.01 return result
[ "def", "analyse_text", "(", "text", ")", ":", "result", "=", "0", "if", "re", ".", "search", "(", "r'\\b(?:public|private)\\s+method\\b'", ",", "text", ")", ":", "result", "+=", "0.01", "return", "result" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Pygments/py3/pygments/lexers/scripting.py#L946-L952
PixarAnimationStudios/OpenSubdiv
ff76e0f2dc9c9202b7d2f965f264bfd6f41866d5
build_scripts/build_osd.py
python
CopyDirectory
(context, srcDir, destDir)
Copy directory like shutil.copytree.
Copy directory like shutil.copytree.
[ "Copy", "directory", "like", "shutil", ".", "copytree", "." ]
def CopyDirectory(context, srcDir, destDir): """Copy directory like shutil.copytree.""" instDestDir = os.path.join(context.instDir, destDir) if os.path.isdir(instDestDir): shutil.rmtree(instDestDir) PrintCommandOutput("Copying {srcDir} to {destDir}\n" .format(srcDir=srcDir, destDir=instDestDir)) shutil.copytree(srcDir, instDestDir)
[ "def", "CopyDirectory", "(", "context", ",", "srcDir", ",", "destDir", ")", ":", "instDestDir", "=", "os", ".", "path", ".", "join", "(", "context", ".", "instDir", ",", "destDir", ")", "if", "os", ".", "path", ".", "isdir", "(", "instDestDir", ")", ":", "shutil", ".", "rmtree", "(", "instDestDir", ")", "PrintCommandOutput", "(", "\"Copying {srcDir} to {destDir}\\n\"", ".", "format", "(", "srcDir", "=", "srcDir", ",", "destDir", "=", "instDestDir", ")", ")", "shutil", ".", "copytree", "(", "srcDir", ",", "instDestDir", ")" ]
https://github.com/PixarAnimationStudios/OpenSubdiv/blob/ff76e0f2dc9c9202b7d2f965f264bfd6f41866d5/build_scripts/build_osd.py#L208-L216
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/scipy/spatial/distance.py
python
matching
(u, v)
return hamming(u, v)
Computes the Hamming distance between two boolean 1-D arrays. This is a deprecated synonym for :func:`hamming`.
Computes the Hamming distance between two boolean 1-D arrays.
[ "Computes", "the", "Hamming", "distance", "between", "two", "boolean", "1", "-", "D", "arrays", "." ]
def matching(u, v): """ Computes the Hamming distance between two boolean 1-D arrays. This is a deprecated synonym for :func:`hamming`. """ return hamming(u, v)
[ "def", "matching", "(", "u", ",", "v", ")", ":", "return", "hamming", "(", "u", ",", "v", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/spatial/distance.py#L733-L739
GJDuck/LowFat
ecf6a0f0fa1b73a27a626cf493cc39e477b6faea
llvm-4.0.0.src/tools/clang/bindings/python/clang/cindex.py
python
Cursor.canonical
(self)
return self._canonical
Return the canonical Cursor corresponding to this Cursor. The canonical cursor is the cursor which is representative for the underlying entity. For example, if you have multiple forward declarations for the same class, the canonical cursor for the forward declarations will be identical.
Return the canonical Cursor corresponding to this Cursor.
[ "Return", "the", "canonical", "Cursor", "corresponding", "to", "this", "Cursor", "." ]
def canonical(self): """Return the canonical Cursor corresponding to this Cursor. The canonical cursor is the cursor which is representative for the underlying entity. For example, if you have multiple forward declarations for the same class, the canonical cursor for the forward declarations will be identical. """ if not hasattr(self, '_canonical'): self._canonical = conf.lib.clang_getCanonicalCursor(self) return self._canonical
[ "def", "canonical", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_canonical'", ")", ":", "self", ".", "_canonical", "=", "conf", ".", "lib", ".", "clang_getCanonicalCursor", "(", "self", ")", "return", "self", ".", "_canonical" ]
https://github.com/GJDuck/LowFat/blob/ecf6a0f0fa1b73a27a626cf493cc39e477b6faea/llvm-4.0.0.src/tools/clang/bindings/python/clang/cindex.py#L1513-L1524
tangzhenyu/Scene-Text-Understanding
0f7ffc7aea5971a50cdc03d33d0a41075285948b
ctpn_crnn_ocr/CTPN/caffe/scripts/cpp_lint.py
python
_CppLintState.SetVerboseLevel
(self, level)
return last_verbose_level
Sets the module's verbosity, and returns the previous setting.
Sets the module's verbosity, and returns the previous setting.
[ "Sets", "the", "module", "s", "verbosity", "and", "returns", "the", "previous", "setting", "." ]
def SetVerboseLevel(self, level): """Sets the module's verbosity, and returns the previous setting.""" last_verbose_level = self.verbose_level self.verbose_level = level return last_verbose_level
[ "def", "SetVerboseLevel", "(", "self", ",", "level", ")", ":", "last_verbose_level", "=", "self", ".", "verbose_level", "self", ".", "verbose_level", "=", "level", "return", "last_verbose_level" ]
https://github.com/tangzhenyu/Scene-Text-Understanding/blob/0f7ffc7aea5971a50cdc03d33d0a41075285948b/ctpn_crnn_ocr/CTPN/caffe/scripts/cpp_lint.py#L707-L711
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/xrc.py
python
XmlResource.AddHandler
(*args, **kwargs)
return _xrc.XmlResource_AddHandler(*args, **kwargs)
AddHandler(self, XmlResourceHandler handler)
AddHandler(self, XmlResourceHandler handler)
[ "AddHandler", "(", "self", "XmlResourceHandler", "handler", ")" ]
def AddHandler(*args, **kwargs): """AddHandler(self, XmlResourceHandler handler)""" return _xrc.XmlResource_AddHandler(*args, **kwargs)
[ "def", "AddHandler", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_xrc", ".", "XmlResource_AddHandler", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/xrc.py#L102-L104
intel/caffe
3f494b442ee3f9d17a07b09ecbd5fa2bbda00836
examples/rfcn/lib/nms/py_cpu_nms.py
python
py_cpu_nms
(dets, thresh)
return keep
Pure Python NMS baseline.
Pure Python NMS baseline.
[ "Pure", "Python", "NMS", "baseline", "." ]
def py_cpu_nms(dets, thresh): """Pure Python NMS baseline.""" x1 = dets[:, 0] y1 = dets[:, 1] x2 = dets[:, 2] y2 = dets[:, 3] scores = dets[:, 4] areas = (x2 - x1 + 1) * (y2 - y1 + 1) order = scores.argsort()[::-1] keep = [] while order.size > 0: i = order[0] keep.append(i) xx1 = np.maximum(x1[i], x1[order[1:]]) yy1 = np.maximum(y1[i], y1[order[1:]]) xx2 = np.minimum(x2[i], x2[order[1:]]) yy2 = np.minimum(y2[i], y2[order[1:]]) w = np.maximum(0.0, xx2 - xx1 + 1) h = np.maximum(0.0, yy2 - yy1 + 1) inter = w * h ovr = inter / (areas[i] + areas[order[1:]] - inter) inds = np.where(ovr <= thresh)[0] order = order[inds + 1] return keep
[ "def", "py_cpu_nms", "(", "dets", ",", "thresh", ")", ":", "x1", "=", "dets", "[", ":", ",", "0", "]", "y1", "=", "dets", "[", ":", ",", "1", "]", "x2", "=", "dets", "[", ":", ",", "2", "]", "y2", "=", "dets", "[", ":", ",", "3", "]", "scores", "=", "dets", "[", ":", ",", "4", "]", "areas", "=", "(", "x2", "-", "x1", "+", "1", ")", "*", "(", "y2", "-", "y1", "+", "1", ")", "order", "=", "scores", ".", "argsort", "(", ")", "[", ":", ":", "-", "1", "]", "keep", "=", "[", "]", "while", "order", ".", "size", ">", "0", ":", "i", "=", "order", "[", "0", "]", "keep", ".", "append", "(", "i", ")", "xx1", "=", "np", ".", "maximum", "(", "x1", "[", "i", "]", ",", "x1", "[", "order", "[", "1", ":", "]", "]", ")", "yy1", "=", "np", ".", "maximum", "(", "y1", "[", "i", "]", ",", "y1", "[", "order", "[", "1", ":", "]", "]", ")", "xx2", "=", "np", ".", "minimum", "(", "x2", "[", "i", "]", ",", "x2", "[", "order", "[", "1", ":", "]", "]", ")", "yy2", "=", "np", ".", "minimum", "(", "y2", "[", "i", "]", ",", "y2", "[", "order", "[", "1", ":", "]", "]", ")", "w", "=", "np", ".", "maximum", "(", "0.0", ",", "xx2", "-", "xx1", "+", "1", ")", "h", "=", "np", ".", "maximum", "(", "0.0", ",", "yy2", "-", "yy1", "+", "1", ")", "inter", "=", "w", "*", "h", "ovr", "=", "inter", "/", "(", "areas", "[", "i", "]", "+", "areas", "[", "order", "[", "1", ":", "]", "]", "-", "inter", ")", "inds", "=", "np", ".", "where", "(", "ovr", "<=", "thresh", ")", "[", "0", "]", "order", "=", "order", "[", "inds", "+", "1", "]", "return", "keep" ]
https://github.com/intel/caffe/blob/3f494b442ee3f9d17a07b09ecbd5fa2bbda00836/examples/rfcn/lib/nms/py_cpu_nms.py#L10-L38
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/webapp2/webapp2_extras/sessions.py
python
SessionStore.get_secure_cookie
(self, name, max_age=_default_value)
Returns a deserialized secure cookie value. :param name: Cookie name. :param max_age: Maximum age in seconds for a valid cookie. If the cookie is older than this, returns None. :returns: A secure cookie value or None if it is not set.
Returns a deserialized secure cookie value.
[ "Returns", "a", "deserialized", "secure", "cookie", "value", "." ]
def get_secure_cookie(self, name, max_age=_default_value): """Returns a deserialized secure cookie value. :param name: Cookie name. :param max_age: Maximum age in seconds for a valid cookie. If the cookie is older than this, returns None. :returns: A secure cookie value or None if it is not set. """ if max_age is _default_value: max_age = self.config['session_max_age'] value = self.request.cookies.get(name) if value: return self.serializer.deserialize(name, value, max_age=max_age)
[ "def", "get_secure_cookie", "(", "self", ",", "name", ",", "max_age", "=", "_default_value", ")", ":", "if", "max_age", "is", "_default_value", ":", "max_age", "=", "self", ".", "config", "[", "'session_max_age'", "]", "value", "=", "self", ".", "request", ".", "cookies", ".", "get", "(", "name", ")", "if", "value", ":", "return", "self", ".", "serializer", ".", "deserialize", "(", "name", ",", "value", ",", "max_age", "=", "max_age", ")" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/webapp2/webapp2_extras/sessions.py#L377-L393
Kitware/ParaView
f760af9124ff4634b23ebbeab95a4f56e0261955
Adaptors/Cam/Python/fv_coprocess.py
python
DoCoProcessing
(datadescription)
Callback to do co-processing for current timestep
Callback to do co-processing for current timestep
[ "Callback", "to", "do", "co", "-", "processing", "for", "current", "timestep" ]
def DoCoProcessing(datadescription): "Callback to do co-processing for current timestep" global coprocessor # Update the coprocessor by providing it the newly generated simulation data. # If the pipeline hasn't been setup yet, this will setup the pipeline. coprocessor.UpdateProducers(datadescription) # Write output data, if appropriate. coprocessor.WriteData(datadescription); # Write image capture (Last arg: rescale lookup table), if appropriate. coprocessor.WriteImages(datadescription, rescale_lookuptable=False) # Live Visualization, if enabled. coprocessor.DoLiveVisualization(datadescription, "localhost", 22222)
[ "def", "DoCoProcessing", "(", "datadescription", ")", ":", "global", "coprocessor", "# Update the coprocessor by providing it the newly generated simulation data.", "# If the pipeline hasn't been setup yet, this will setup the pipeline.", "coprocessor", ".", "UpdateProducers", "(", "datadescription", ")", "# Write output data, if appropriate.", "coprocessor", ".", "WriteData", "(", "datadescription", ")", "# Write image capture (Last arg: rescale lookup table), if appropriate.", "coprocessor", ".", "WriteImages", "(", "datadescription", ",", "rescale_lookuptable", "=", "False", ")", "# Live Visualization, if enabled.", "coprocessor", ".", "DoLiveVisualization", "(", "datadescription", ",", "\"localhost\"", ",", "22222", ")" ]
https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Adaptors/Cam/Python/fv_coprocess.py#L97-L112
zy445566/llvm-guide-zh
edaf7d5b6c29812f90ba0e1929a70c24f5005d6a
MCJIT/cached/genk-timing.py
python
KScriptGenerator.setCallWeighting
(self, weight)
Sets the probably of generating a function call
Sets the probably of generating a function call
[ "Sets", "the", "probably", "of", "generating", "a", "function", "call" ]
def setCallWeighting(self, weight): """ Sets the probably of generating a function call""" self.callWeighting = weight
[ "def", "setCallWeighting", "(", "self", ",", "weight", ")", ":", "self", ".", "callWeighting", "=", "weight" ]
https://github.com/zy445566/llvm-guide-zh/blob/edaf7d5b6c29812f90ba0e1929a70c24f5005d6a/MCJIT/cached/genk-timing.py#L80-L82
intel-iot-devkit/how-to-code-samples
b4ea616f36bbfa2e042beb1698f968cfd651d79f
fire-alarm/python/iot_fire_alarm/log.py
python
send
(payload)
Publish payload to MQTT server, data store and SMS.
Publish payload to MQTT server, data store and SMS.
[ "Publish", "payload", "to", "MQTT", "server", "data", "store", "and", "SMS", "." ]
def send(payload): """ Publish payload to MQTT server, data store and SMS. """ service_message(payload) store_message(payload, method="GET") send_sms(payload)
[ "def", "send", "(", "payload", ")", ":", "service_message", "(", "payload", ")", "store_message", "(", "payload", ",", "method", "=", "\"GET\"", ")", "send_sms", "(", "payload", ")" ]
https://github.com/intel-iot-devkit/how-to-code-samples/blob/b4ea616f36bbfa2e042beb1698f968cfd651d79f/fire-alarm/python/iot_fire_alarm/log.py#L28-L36
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/python/framework/ops.py
python
add_to_collection
(name, value)
Wrapper for `Graph.add_to_collection()` using the default graph. See @{tf.Graph.add_to_collection} for more details. Args: name: The key for the collection. For example, the `GraphKeys` class contains many standard names for collections. value: The value to add to the collection.
Wrapper for `Graph.add_to_collection()` using the default graph.
[ "Wrapper", "for", "Graph", ".", "add_to_collection", "()", "using", "the", "default", "graph", "." ]
def add_to_collection(name, value): """Wrapper for `Graph.add_to_collection()` using the default graph. See @{tf.Graph.add_to_collection} for more details. Args: name: The key for the collection. For example, the `GraphKeys` class contains many standard names for collections. value: The value to add to the collection. """ get_default_graph().add_to_collection(name, value)
[ "def", "add_to_collection", "(", "name", ",", "value", ")", ":", "get_default_graph", "(", ")", ".", "add_to_collection", "(", "name", ",", "value", ")" ]
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/framework/ops.py#L4400-L4411
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
src/external/coremltools_wrap/coremltools/coremltools/converters/onnx/_operators_nd.py
python
_convert_tanh
(builder, node, graph, err)
convert to CoreML Tanh Layer: https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L3881
convert to CoreML Tanh Layer: https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L3881
[ "convert", "to", "CoreML", "Tanh", "Layer", ":", "https", ":", "//", "github", ".", "com", "/", "apple", "/", "coremltools", "/", "blob", "/", "655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492", "/", "mlmodel", "/", "format", "/", "NeuralNetwork", ".", "proto#L3881" ]
def _convert_tanh(builder, node, graph, err): """ convert to CoreML Tanh Layer: https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L3881 """ load_input_constants(builder, node, graph, err) builder.add_tanh( name=node.name, input_name=node.inputs[0], output_name=node.outputs[0] )
[ "def", "_convert_tanh", "(", "builder", ",", "node", ",", "graph", ",", "err", ")", ":", "load_input_constants", "(", "builder", ",", "node", ",", "graph", ",", "err", ")", "builder", ".", "add_tanh", "(", "name", "=", "node", ".", "name", ",", "input_name", "=", "node", ".", "inputs", "[", "0", "]", ",", "output_name", "=", "node", ".", "outputs", "[", "0", "]", ")" ]
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/converters/onnx/_operators_nd.py#L2523-L2531
adobe/chromium
cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7
native_client_sdk/src/build_tools/nacl_sdk_scons/site_tools/nacl_tools.py
python
FilterOut
(env, **kw)
Removes values from existing construction variables in an Environment. The values to remove should be a list. For example: env.FilterOut(CPPDEFINES=['REMOVE_ME', 'ME_TOO']) Args: env: Environment to alter. kw: (Any other named arguments are values to remove).
Removes values from existing construction variables in an Environment.
[ "Removes", "values", "from", "existing", "construction", "variables", "in", "an", "Environment", "." ]
def FilterOut(env, **kw): """Removes values from existing construction variables in an Environment. The values to remove should be a list. For example: env.FilterOut(CPPDEFINES=['REMOVE_ME', 'ME_TOO']) Args: env: Environment to alter. kw: (Any other named arguments are values to remove). """ kw = SCons.Environment.copy_non_reserved_keywords(kw) for key, val in kw.items(): if key in env: # Filter out the specified values without modifying the original list. # This helps isolate us if a list is accidently shared # NOTE if env[key] is a UserList, this changes the type into a plain # list. This is OK because SCons also does this in semi_deepcopy env[key] = [item for item in env[key] if item not in val]
[ "def", "FilterOut", "(", "env", ",", "*", "*", "kw", ")", ":", "kw", "=", "SCons", ".", "Environment", ".", "copy_non_reserved_keywords", "(", "kw", ")", "for", "key", ",", "val", "in", "kw", ".", "items", "(", ")", ":", "if", "key", "in", "env", ":", "# Filter out the specified values without modifying the original list.", "# This helps isolate us if a list is accidently shared", "# NOTE if env[key] is a UserList, this changes the type into a plain", "# list. This is OK because SCons also does this in semi_deepcopy", "env", "[", "key", "]", "=", "[", "item", "for", "item", "in", "env", "[", "key", "]", "if", "item", "not", "in", "val", "]" ]
https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/native_client_sdk/src/build_tools/nacl_sdk_scons/site_tools/nacl_tools.py#L15-L35
BitMEX/api-connectors
37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812
auto-generated/python/swagger_client/api/user_api.py
python
UserApi.user_communication_token_with_http_info
(self, token, platform_agent, **kwargs)
return self.api_client.call_api( '/user/communicationToken', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[CommunicationToken]', # noqa: E501 auth_settings=auth_settings, async_req=params.get('async_req'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats)
Register your communication token for mobile clients # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.user_communication_token_with_http_info(token, platform_agent, async_req=True) >>> result = thread.get() :param async_req bool :param str token: (required) :param str platform_agent: (required) :return: list[CommunicationToken] If the method is called asynchronously, returns the request thread.
Register your communication token for mobile clients # noqa: E501
[ "Register", "your", "communication", "token", "for", "mobile", "clients", "#", "noqa", ":", "E501" ]
def user_communication_token_with_http_info(self, token, platform_agent, **kwargs): # noqa: E501 """Register your communication token for mobile clients # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.user_communication_token_with_http_info(token, platform_agent, async_req=True) >>> result = thread.get() :param async_req bool :param str token: (required) :param str platform_agent: (required) :return: list[CommunicationToken] If the method is called asynchronously, returns the request thread. """ all_params = ['token', 'platform_agent'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method user_communication_token" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'token' is set if ('token' not in params or params['token'] is None): raise ValueError("Missing the required parameter `token` when calling `user_communication_token`") # noqa: E501 # verify the required parameter 'platform_agent' is set if ('platform_agent' not in params or params['platform_agent'] is None): raise ValueError("Missing the required parameter `platform_agent` when calling `user_communication_token`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} if 'token' in params: form_params.append(('token', params['token'])) # noqa: E501 if 'platform_agent' in params: form_params.append(('platformAgent', params['platform_agent'])) # noqa: E501 body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json', 'application/x-www-form-urlencoded']) # noqa: E501 # Authentication setting auth_settings = ['apiExpires', 'apiKey', 'apiSignature'] # noqa: E501 return self.api_client.call_api( '/user/communicationToken', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[CommunicationToken]', # noqa: E501 auth_settings=auth_settings, async_req=params.get('async_req'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats)
[ "def", "user_communication_token_with_http_info", "(", "self", ",", "token", ",", "platform_agent", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "all_params", "=", "[", "'token'", ",", "'platform_agent'", "]", "# noqa: E501", "all_params", ".", "append", "(", "'async_req'", ")", "all_params", ".", "append", "(", "'_return_http_data_only'", ")", "all_params", ".", "append", "(", "'_preload_content'", ")", "all_params", ".", "append", "(", "'_request_timeout'", ")", "params", "=", "locals", "(", ")", "for", "key", ",", "val", "in", "six", ".", "iteritems", "(", "params", "[", "'kwargs'", "]", ")", ":", "if", "key", "not", "in", "all_params", ":", "raise", "TypeError", "(", "\"Got an unexpected keyword argument '%s'\"", "\" to method user_communication_token\"", "%", "key", ")", "params", "[", "key", "]", "=", "val", "del", "params", "[", "'kwargs'", "]", "# verify the required parameter 'token' is set", "if", "(", "'token'", "not", "in", "params", "or", "params", "[", "'token'", "]", "is", "None", ")", ":", "raise", "ValueError", "(", "\"Missing the required parameter `token` when calling `user_communication_token`\"", ")", "# noqa: E501", "# verify the required parameter 'platform_agent' is set", "if", "(", "'platform_agent'", "not", "in", "params", "or", "params", "[", "'platform_agent'", "]", "is", "None", ")", ":", "raise", "ValueError", "(", "\"Missing the required parameter `platform_agent` when calling `user_communication_token`\"", ")", "# noqa: E501", "collection_formats", "=", "{", "}", "path_params", "=", "{", "}", "query_params", "=", "[", "]", "header_params", "=", "{", "}", "form_params", "=", "[", "]", "local_var_files", "=", "{", "}", "if", "'token'", "in", "params", ":", "form_params", ".", "append", "(", "(", "'token'", ",", "params", "[", "'token'", "]", ")", ")", "# noqa: E501", "if", "'platform_agent'", "in", "params", ":", "form_params", ".", "append", "(", "(", "'platformAgent'", ",", "params", "[", "'platform_agent'", "]", ")", ")", "# noqa: E501", "body_params", "=", "None", "# HTTP header `Accept`", "header_params", "[", "'Accept'", "]", "=", "self", ".", "api_client", ".", "select_header_accept", "(", "[", "'application/json'", ",", "'application/xml'", ",", "'text/xml'", ",", "'application/javascript'", ",", "'text/javascript'", "]", ")", "# noqa: E501", "# HTTP header `Content-Type`", "header_params", "[", "'Content-Type'", "]", "=", "self", ".", "api_client", ".", "select_header_content_type", "(", "# noqa: E501", "[", "'application/json'", ",", "'application/x-www-form-urlencoded'", "]", ")", "# noqa: E501", "# Authentication setting", "auth_settings", "=", "[", "'apiExpires'", ",", "'apiKey'", ",", "'apiSignature'", "]", "# noqa: E501", "return", "self", ".", "api_client", ".", "call_api", "(", "'/user/communicationToken'", ",", "'POST'", ",", "path_params", ",", "query_params", ",", "header_params", ",", "body", "=", "body_params", ",", "post_params", "=", "form_params", ",", "files", "=", "local_var_files", ",", "response_type", "=", "'list[CommunicationToken]'", ",", "# noqa: E501", "auth_settings", "=", "auth_settings", ",", "async_req", "=", "params", ".", "get", "(", "'async_req'", ")", ",", "_return_http_data_only", "=", "params", ".", "get", "(", "'_return_http_data_only'", ")", ",", "_preload_content", "=", "params", ".", "get", "(", "'_preload_content'", ",", "True", ")", ",", "_request_timeout", "=", "params", ".", "get", "(", "'_request_timeout'", ")", ",", "collection_formats", "=", "collection_formats", ")" ]
https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/api/user_api.py#L250-L331
BitMEX/api-connectors
37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812
auto-generated/python/swagger_client/models/quote_fill_ratio.py
python
QuoteFillRatio.quote_fill_ratio_mavg7
(self, quote_fill_ratio_mavg7)
Sets the quote_fill_ratio_mavg7 of this QuoteFillRatio. :param quote_fill_ratio_mavg7: The quote_fill_ratio_mavg7 of this QuoteFillRatio. # noqa: E501 :type: float
Sets the quote_fill_ratio_mavg7 of this QuoteFillRatio.
[ "Sets", "the", "quote_fill_ratio_mavg7", "of", "this", "QuoteFillRatio", "." ]
def quote_fill_ratio_mavg7(self, quote_fill_ratio_mavg7): """Sets the quote_fill_ratio_mavg7 of this QuoteFillRatio. :param quote_fill_ratio_mavg7: The quote_fill_ratio_mavg7 of this QuoteFillRatio. # noqa: E501 :type: float """ self._quote_fill_ratio_mavg7 = quote_fill_ratio_mavg7
[ "def", "quote_fill_ratio_mavg7", "(", "self", ",", "quote_fill_ratio_mavg7", ")", ":", "self", ".", "_quote_fill_ratio_mavg7", "=", "quote_fill_ratio_mavg7" ]
https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/quote_fill_ratio.py#L218-L226
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/re.py
python
compile
(pattern, flags=0)
return _compile(pattern, flags)
Compile a regular expression pattern, returning a pattern object.
Compile a regular expression pattern, returning a pattern object.
[ "Compile", "a", "regular", "expression", "pattern", "returning", "a", "pattern", "object", "." ]
def compile(pattern, flags=0): "Compile a regular expression pattern, returning a pattern object." return _compile(pattern, flags)
[ "def", "compile", "(", "pattern", ",", "flags", "=", "0", ")", ":", "return", "_compile", "(", "pattern", ",", "flags", ")" ]
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/re.py#L188-L190
OSGeo/PROJ
ca1ec7b147087f18bec0b3cf0b0548f3f034c675
scripts/build_db_from_esri.py
python
get_parameter_value
(wkt_definition: List)
return ParameterValue(value=value, unit_type=unit_type, unit=get_wkt_unit(*wkt_definition[1][unit_type_str]))
Retrieves a WKT parameter value from its definition
Retrieves a WKT parameter value from its definition
[ "Retrieves", "a", "WKT", "parameter", "value", "from", "its", "definition" ]
def get_parameter_value(wkt_definition: List) -> ParameterValue: """ Retrieves a WKT parameter value from its definition """ value = wkt_definition[0] assert len(wkt_definition[1]) == 1 unit_type_str = list(wkt_definition[1].keys())[0] unit_type = STRING_TO_UNIT_TYPE[unit_type_str] return ParameterValue(value=value, unit_type=unit_type, unit=get_wkt_unit(*wkt_definition[1][unit_type_str]))
[ "def", "get_parameter_value", "(", "wkt_definition", ":", "List", ")", "->", "ParameterValue", ":", "value", "=", "wkt_definition", "[", "0", "]", "assert", "len", "(", "wkt_definition", "[", "1", "]", ")", "==", "1", "unit_type_str", "=", "list", "(", "wkt_definition", "[", "1", "]", ".", "keys", "(", ")", ")", "[", "0", "]", "unit_type", "=", "STRING_TO_UNIT_TYPE", "[", "unit_type_str", "]", "return", "ParameterValue", "(", "value", "=", "value", ",", "unit_type", "=", "unit_type", ",", "unit", "=", "get_wkt_unit", "(", "*", "wkt_definition", "[", "1", "]", "[", "unit_type_str", "]", ")", ")" ]
https://github.com/OSGeo/PROJ/blob/ca1ec7b147087f18bec0b3cf0b0548f3f034c675/scripts/build_db_from_esri.py#L924-L935
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/py2/scipy/stats/mstats_basic.py
python
stde_median
(data, axis=None)
Returns the McKean-Schrader estimate of the standard error of the sample median along the given axis. masked values are discarded. Parameters ---------- data : ndarray Data to trim. axis : {None,int}, optional Axis along which to perform the trimming. If None, the input array is first flattened.
Returns the McKean-Schrader estimate of the standard error of the sample median along the given axis. masked values are discarded.
[ "Returns", "the", "McKean", "-", "Schrader", "estimate", "of", "the", "standard", "error", "of", "the", "sample", "median", "along", "the", "given", "axis", ".", "masked", "values", "are", "discarded", "." ]
def stde_median(data, axis=None): """Returns the McKean-Schrader estimate of the standard error of the sample median along the given axis. masked values are discarded. Parameters ---------- data : ndarray Data to trim. axis : {None,int}, optional Axis along which to perform the trimming. If None, the input array is first flattened. """ def _stdemed_1D(data): data = np.sort(data.compressed()) n = len(data) z = 2.5758293035489004 k = int(np.round((n+1)/2. - z * np.sqrt(n/4.),0)) return ((data[n-k] - data[k-1])/(2.*z)) data = ma.array(data, copy=False, subok=True) if (axis is None): return _stdemed_1D(data) else: if data.ndim > 2: raise ValueError("Array 'data' must be at most two dimensional, " "but got data.ndim = %d" % data.ndim) return ma.apply_along_axis(_stdemed_1D, axis, data)
[ "def", "stde_median", "(", "data", ",", "axis", "=", "None", ")", ":", "def", "_stdemed_1D", "(", "data", ")", ":", "data", "=", "np", ".", "sort", "(", "data", ".", "compressed", "(", ")", ")", "n", "=", "len", "(", "data", ")", "z", "=", "2.5758293035489004", "k", "=", "int", "(", "np", ".", "round", "(", "(", "n", "+", "1", ")", "/", "2.", "-", "z", "*", "np", ".", "sqrt", "(", "n", "/", "4.", ")", ",", "0", ")", ")", "return", "(", "(", "data", "[", "n", "-", "k", "]", "-", "data", "[", "k", "-", "1", "]", ")", "/", "(", "2.", "*", "z", ")", ")", "data", "=", "ma", ".", "array", "(", "data", ",", "copy", "=", "False", ",", "subok", "=", "True", ")", "if", "(", "axis", "is", "None", ")", ":", "return", "_stdemed_1D", "(", "data", ")", "else", ":", "if", "data", ".", "ndim", ">", "2", ":", "raise", "ValueError", "(", "\"Array 'data' must be at most two dimensional, \"", "\"but got data.ndim = %d\"", "%", "data", ".", "ndim", ")", "return", "ma", ".", "apply_along_axis", "(", "_stdemed_1D", ",", "axis", ",", "data", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/stats/mstats_basic.py#L2309-L2336
openweave/openweave-core
11ceb6b7efd39fe05de7f79229247a5774d56766
src/device-manager/python/weave-device-mgr.py
python
DeviceMgrCmd.do_removenetwork
(self, line)
remove-network <network-id> Remove a provisioned network.
remove-network <network-id>
[ "remove", "-", "network", "<network", "-", "id", ">" ]
def do_removenetwork(self, line): """ remove-network <network-id> Remove a provisioned network. """ args = shlex.split(line) if (len(args) == 0): print("Usage:") self.do_help('remove-network') return if (len(args) < 1): print("Please specify a network id") return if (len(args) > 1): print("Unexpected argument: " + args[1]) return networkId = self.parseNetworkId(args[0]) if (networkId == None): return self.lastNetworkId = networkId try: self.devMgr.RemoveNetwork(networkId) except WeaveStack.WeaveStackException as ex: print(str(ex)) return print("Remove network complete")
[ "def", "do_removenetwork", "(", "self", ",", "line", ")", ":", "args", "=", "shlex", ".", "split", "(", "line", ")", "if", "(", "len", "(", "args", ")", "==", "0", ")", ":", "print", "(", "\"Usage:\"", ")", "self", ".", "do_help", "(", "'remove-network'", ")", "return", "if", "(", "len", "(", "args", ")", "<", "1", ")", ":", "print", "(", "\"Please specify a network id\"", ")", "return", "if", "(", "len", "(", "args", ")", ">", "1", ")", ":", "print", "(", "\"Unexpected argument: \"", "+", "args", "[", "1", "]", ")", "return", "networkId", "=", "self", ".", "parseNetworkId", "(", "args", "[", "0", "]", ")", "if", "(", "networkId", "==", "None", ")", ":", "return", "self", ".", "lastNetworkId", "=", "networkId", "try", ":", "self", ".", "devMgr", ".", "RemoveNetwork", "(", "networkId", ")", "except", "WeaveStack", ".", "WeaveStackException", "as", "ex", ":", "print", "(", "str", "(", "ex", ")", ")", "return", "print", "(", "\"Remove network complete\"", ")" ]
https://github.com/openweave/openweave-core/blob/11ceb6b7efd39fe05de7f79229247a5774d56766/src/device-manager/python/weave-device-mgr.py#L1459-L1493
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/joblib/joblib/_store_backends.py
python
StoreBackendBase._open_item
(self, f, mode)
Opens an item on the store and return a file-like object. This method is private and only used by the StoreBackendMixin object. Parameters ---------- f: a file-like object The file-like object where an item is stored and retrieved mode: string, optional the mode in which the file-like object is opened allowed valued are 'rb', 'wb' Returns ------- a file-like object
Opens an item on the store and return a file-like object.
[ "Opens", "an", "item", "on", "the", "store", "and", "return", "a", "file", "-", "like", "object", "." ]
def _open_item(self, f, mode): """Opens an item on the store and return a file-like object. This method is private and only used by the StoreBackendMixin object. Parameters ---------- f: a file-like object The file-like object where an item is stored and retrieved mode: string, optional the mode in which the file-like object is opened allowed valued are 'rb', 'wb' Returns ------- a file-like object """
[ "def", "_open_item", "(", "self", ",", "f", ",", "mode", ")", ":" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/joblib/joblib/_store_backends.py#L40-L56
eric612/Caffe-YOLOv3-Windows
6736ca6e16781789b828cc64218ff77cc3454e5d
python/caffe/coord_map.py
python
coord_map
(fn)
Define the coordinate mapping by its - axis - scale: output coord[i * scale] <- input_coord[i] - shift: output coord[i] <- output_coord[i + shift] s.t. the identity mapping, as for pointwise layers like ReLu, is defined by (None, 1, 0) since it is independent of axis and does not transform coords.
Define the coordinate mapping by its - axis - scale: output coord[i * scale] <- input_coord[i] - shift: output coord[i] <- output_coord[i + shift] s.t. the identity mapping, as for pointwise layers like ReLu, is defined by (None, 1, 0) since it is independent of axis and does not transform coords.
[ "Define", "the", "coordinate", "mapping", "by", "its", "-", "axis", "-", "scale", ":", "output", "coord", "[", "i", "*", "scale", "]", "<", "-", "input_coord", "[", "i", "]", "-", "shift", ":", "output", "coord", "[", "i", "]", "<", "-", "output_coord", "[", "i", "+", "shift", "]", "s", ".", "t", ".", "the", "identity", "mapping", "as", "for", "pointwise", "layers", "like", "ReLu", "is", "defined", "by", "(", "None", "1", "0", ")", "since", "it", "is", "independent", "of", "axis", "and", "does", "not", "transform", "coords", "." ]
def coord_map(fn): """ Define the coordinate mapping by its - axis - scale: output coord[i * scale] <- input_coord[i] - shift: output coord[i] <- output_coord[i + shift] s.t. the identity mapping, as for pointwise layers like ReLu, is defined by (None, 1, 0) since it is independent of axis and does not transform coords. """ if fn.type_name in ['Convolution', 'Pooling', 'Im2col']: axis, stride, ks, pad = conv_params(fn) return axis, 1 / stride, (pad - (ks - 1) / 2) / stride elif fn.type_name == 'Deconvolution': axis, stride, ks, pad = conv_params(fn) return axis, stride, (ks - 1) / 2 - pad elif fn.type_name in PASS_THROUGH_LAYERS: return None, 1, 0 elif fn.type_name == 'Crop': axis, offset = crop_params(fn) axis -= 1 # -1 for last non-coordinate dim. return axis, 1, - offset else: raise UndefinedMapException
[ "def", "coord_map", "(", "fn", ")", ":", "if", "fn", ".", "type_name", "in", "[", "'Convolution'", ",", "'Pooling'", ",", "'Im2col'", "]", ":", "axis", ",", "stride", ",", "ks", ",", "pad", "=", "conv_params", "(", "fn", ")", "return", "axis", ",", "1", "/", "stride", ",", "(", "pad", "-", "(", "ks", "-", "1", ")", "/", "2", ")", "/", "stride", "elif", "fn", ".", "type_name", "==", "'Deconvolution'", ":", "axis", ",", "stride", ",", "ks", ",", "pad", "=", "conv_params", "(", "fn", ")", "return", "axis", ",", "stride", ",", "(", "ks", "-", "1", ")", "/", "2", "-", "pad", "elif", "fn", ".", "type_name", "in", "PASS_THROUGH_LAYERS", ":", "return", "None", ",", "1", ",", "0", "elif", "fn", ".", "type_name", "==", "'Crop'", ":", "axis", ",", "offset", "=", "crop_params", "(", "fn", ")", "axis", "-=", "1", "# -1 for last non-coordinate dim.", "return", "axis", ",", "1", ",", "-", "offset", "else", ":", "raise", "UndefinedMapException" ]
https://github.com/eric612/Caffe-YOLOv3-Windows/blob/6736ca6e16781789b828cc64218ff77cc3454e5d/python/caffe/coord_map.py#L57-L79
root-project/root
fcd3583bb14852bf2e8cd2415717cbaac0e75896
bindings/pyroot/cppyy/cppyy-backend/cling/python/cppyy_backend/bindings_utils.py
python
initialise
(pkg, __init__py, cmake_shared_library_prefix, cmake_shared_library_suffix)
Initialise the bindings module. :param pkg: The bindings package. :param __init__py: Base __init__.py file of the bindings. :param cmake_shared_library_prefix: ${cmake_shared_library_prefix} :param cmake_shared_library_suffix: ${cmake_shared_library_suffix}
Initialise the bindings module.
[ "Initialise", "the", "bindings", "module", "." ]
def initialise(pkg, __init__py, cmake_shared_library_prefix, cmake_shared_library_suffix): """ Initialise the bindings module. :param pkg: The bindings package. :param __init__py: Base __init__.py file of the bindings. :param cmake_shared_library_prefix: ${cmake_shared_library_prefix} :param cmake_shared_library_suffix: ${cmake_shared_library_suffix} """ def add_to_pkg(file, keyword, simplenames, children): def map_operator_name(name): """ Map the given C++ operator name on the python equivalent. """ CPPYY__idiv__ = "__idiv__" CPPYY__div__ = "__div__" gC2POperatorMapping = { "[]": "__getitem__", "()": "__call__", "/": CPPYY__div__, "%": "__mod__", "**": "__pow__", "<<": "__lshift__", ">>": "__rshift__", "&": "__and__", "|": "__or__", "^": "__xor__", "~": "__inv__", "+=": "__iadd__", "-=": "__isub__", "*=": "__imul__", "/=": CPPYY__idiv__, "%=": "__imod__", "**=": "__ipow__", "<<=": "__ilshift__", ">>=": "__irshift__", "&=": "__iand__", "|=": "__ior__", "^=": "__ixor__", "==": "__eq__", "!=": "__ne__", ">": "__gt__", "<": "__lt__", ">=": "__ge__", "<=": "__le__", } op = name[8:] result = gC2POperatorMapping.get(op, None) if result: return result print(children) bTakesParams = 1 if op == "*": # dereference v.s. multiplication of two instances return "__mul__" if bTakesParams else "__deref__" elif op == "+": # unary positive v.s. addition of two instances return "__add__" if bTakesParams else "__pos__" elif op == "-": # unary negative v.s. subtraction of two instances return "__sub__" if bTakesParams else "__neg__" elif op == "++": # prefix v.s. postfix increment return "__postinc__" if bTakesParams else "__preinc__" elif op == "--": # prefix v.s. postfix decrement return "__postdec__" if bTakesParams else "__predec__" # might get here, as not all operator methods are handled (new, delete, etc.) return name # # Add level 1 objects to the pkg namespace. # if len(simplenames) > 1: return # # Ignore some names based on heuristics. # simplename = simplenames[0] if simplename in ('void', 'sizeof', 'const'): return if simplename[0] in '0123456789': # # Don't attempt to look up numbers (i.e. non-type template parameters). # return if PRIMITIVE_TYPES.search(simplename): return if simplename.startswith("operator"): simplename = map_operator_name(simplename) # # Classes, variables etc. # try: entity = getattr(cppyy.gbl, simplename) except AttributeError as e: print(_("Unable to lookup {}:{} cppyy.gbl.{} ({})").format(file, keyword, simplename, children)) #raise else: if getattr(entity, "__module__", None) == "cppyy.gbl": setattr(entity, "__module__", pkg) setattr(pkg_module, simplename, entity) pkg_dir = os.path.dirname(__init__py) if "." in pkg: pkg_namespace, pkg_simplename = pkg.rsplit(".", 1) else: pkg_namespace, pkg_simplename = "", pkg pkg_module = sys.modules[pkg] lib_name = pkg_namespace + pkg_simplename + "Cppyy" lib_file = cmake_shared_library_prefix + lib_name + cmake_shared_library_suffix map_file = os.path.join(pkg_dir, pkg_simplename + ".map") # # Load the library. # cppyy.load_reflection_info(os.path.join(pkg_dir, lib_file)) # # Parse the map file. # with open(map_file, 'rU') as map_file: files = json.load(map_file) # # Iterate over all the items at the top level of each file, and add them # to the pkg. # for file in files: for child in file["children"]: if not child["kind"] in ('class', 'var', 'namespace', 'typedef'): continue simplenames = child["name"].split('::') add_to_pkg(file["name"], child["kind"], simplenames, child) # # Load any customisations. # extra_pythons = glob.glob(os.path.join(pkg_dir, "extra_*.py")) for extra_python in extra_pythons: extra_module = os.path.basename(extra_python) extra_module = pkg + "." + os.path.splitext(extra_module)[0] # # Deleting the modules after use runs the risk of GC running on # stuff we are using, such as ctypes.c_int. # extra = load_source(extra_module, extra_python) # # Valid customisations are routines named "c13n_<something>". # fns = inspect.getmembers(extra, predicate=inspect.isroutine) fns = {fn[0]: fn[1] for fn in fns if fn[0].startswith("c13n_")} for fn in sorted(fns): fns[fn](pkg_module)
[ "def", "initialise", "(", "pkg", ",", "__init__py", ",", "cmake_shared_library_prefix", ",", "cmake_shared_library_suffix", ")", ":", "def", "add_to_pkg", "(", "file", ",", "keyword", ",", "simplenames", ",", "children", ")", ":", "def", "map_operator_name", "(", "name", ")", ":", "\"\"\"\n Map the given C++ operator name on the python equivalent.\n \"\"\"", "CPPYY__idiv__", "=", "\"__idiv__\"", "CPPYY__div__", "=", "\"__div__\"", "gC2POperatorMapping", "=", "{", "\"[]\"", ":", "\"__getitem__\"", ",", "\"()\"", ":", "\"__call__\"", ",", "\"/\"", ":", "CPPYY__div__", ",", "\"%\"", ":", "\"__mod__\"", ",", "\"**\"", ":", "\"__pow__\"", ",", "\"<<\"", ":", "\"__lshift__\"", ",", "\">>\"", ":", "\"__rshift__\"", ",", "\"&\"", ":", "\"__and__\"", ",", "\"|\"", ":", "\"__or__\"", ",", "\"^\"", ":", "\"__xor__\"", ",", "\"~\"", ":", "\"__inv__\"", ",", "\"+=\"", ":", "\"__iadd__\"", ",", "\"-=\"", ":", "\"__isub__\"", ",", "\"*=\"", ":", "\"__imul__\"", ",", "\"/=\"", ":", "CPPYY__idiv__", ",", "\"%=\"", ":", "\"__imod__\"", ",", "\"**=\"", ":", "\"__ipow__\"", ",", "\"<<=\"", ":", "\"__ilshift__\"", ",", "\">>=\"", ":", "\"__irshift__\"", ",", "\"&=\"", ":", "\"__iand__\"", ",", "\"|=\"", ":", "\"__ior__\"", ",", "\"^=\"", ":", "\"__ixor__\"", ",", "\"==\"", ":", "\"__eq__\"", ",", "\"!=\"", ":", "\"__ne__\"", ",", "\">\"", ":", "\"__gt__\"", ",", "\"<\"", ":", "\"__lt__\"", ",", "\">=\"", ":", "\"__ge__\"", ",", "\"<=\"", ":", "\"__le__\"", ",", "}", "op", "=", "name", "[", "8", ":", "]", "result", "=", "gC2POperatorMapping", ".", "get", "(", "op", ",", "None", ")", "if", "result", ":", "return", "result", "print", "(", "children", ")", "bTakesParams", "=", "1", "if", "op", "==", "\"*\"", ":", "# dereference v.s. multiplication of two instances", "return", "\"__mul__\"", "if", "bTakesParams", "else", "\"__deref__\"", "elif", "op", "==", "\"+\"", ":", "# unary positive v.s. addition of two instances", "return", "\"__add__\"", "if", "bTakesParams", "else", "\"__pos__\"", "elif", "op", "==", "\"-\"", ":", "# unary negative v.s. subtraction of two instances", "return", "\"__sub__\"", "if", "bTakesParams", "else", "\"__neg__\"", "elif", "op", "==", "\"++\"", ":", "# prefix v.s. postfix increment", "return", "\"__postinc__\"", "if", "bTakesParams", "else", "\"__preinc__\"", "elif", "op", "==", "\"--\"", ":", "# prefix v.s. postfix decrement", "return", "\"__postdec__\"", "if", "bTakesParams", "else", "\"__predec__\"", "# might get here, as not all operator methods are handled (new, delete, etc.)", "return", "name", "#", "# Add level 1 objects to the pkg namespace.", "#", "if", "len", "(", "simplenames", ")", ">", "1", ":", "return", "#", "# Ignore some names based on heuristics.", "#", "simplename", "=", "simplenames", "[", "0", "]", "if", "simplename", "in", "(", "'void'", ",", "'sizeof'", ",", "'const'", ")", ":", "return", "if", "simplename", "[", "0", "]", "in", "'0123456789'", ":", "#", "# Don't attempt to look up numbers (i.e. non-type template parameters).", "#", "return", "if", "PRIMITIVE_TYPES", ".", "search", "(", "simplename", ")", ":", "return", "if", "simplename", ".", "startswith", "(", "\"operator\"", ")", ":", "simplename", "=", "map_operator_name", "(", "simplename", ")", "#", "# Classes, variables etc.", "#", "try", ":", "entity", "=", "getattr", "(", "cppyy", ".", "gbl", ",", "simplename", ")", "except", "AttributeError", "as", "e", ":", "print", "(", "_", "(", "\"Unable to lookup {}:{} cppyy.gbl.{} ({})\"", ")", ".", "format", "(", "file", ",", "keyword", ",", "simplename", ",", "children", ")", ")", "#raise", "else", ":", "if", "getattr", "(", "entity", ",", "\"__module__\"", ",", "None", ")", "==", "\"cppyy.gbl\"", ":", "setattr", "(", "entity", ",", "\"__module__\"", ",", "pkg", ")", "setattr", "(", "pkg_module", ",", "simplename", ",", "entity", ")", "pkg_dir", "=", "os", ".", "path", ".", "dirname", "(", "__init__py", ")", "if", "\".\"", "in", "pkg", ":", "pkg_namespace", ",", "pkg_simplename", "=", "pkg", ".", "rsplit", "(", "\".\"", ",", "1", ")", "else", ":", "pkg_namespace", ",", "pkg_simplename", "=", "\"\"", ",", "pkg", "pkg_module", "=", "sys", ".", "modules", "[", "pkg", "]", "lib_name", "=", "pkg_namespace", "+", "pkg_simplename", "+", "\"Cppyy\"", "lib_file", "=", "cmake_shared_library_prefix", "+", "lib_name", "+", "cmake_shared_library_suffix", "map_file", "=", "os", ".", "path", ".", "join", "(", "pkg_dir", ",", "pkg_simplename", "+", "\".map\"", ")", "#", "# Load the library.", "#", "cppyy", ".", "load_reflection_info", "(", "os", ".", "path", ".", "join", "(", "pkg_dir", ",", "lib_file", ")", ")", "#", "# Parse the map file.", "#", "with", "open", "(", "map_file", ",", "'rU'", ")", "as", "map_file", ":", "files", "=", "json", ".", "load", "(", "map_file", ")", "#", "# Iterate over all the items at the top level of each file, and add them", "# to the pkg.", "#", "for", "file", "in", "files", ":", "for", "child", "in", "file", "[", "\"children\"", "]", ":", "if", "not", "child", "[", "\"kind\"", "]", "in", "(", "'class'", ",", "'var'", ",", "'namespace'", ",", "'typedef'", ")", ":", "continue", "simplenames", "=", "child", "[", "\"name\"", "]", ".", "split", "(", "'::'", ")", "add_to_pkg", "(", "file", "[", "\"name\"", "]", ",", "child", "[", "\"kind\"", "]", ",", "simplenames", ",", "child", ")", "#", "# Load any customisations.", "#", "extra_pythons", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "pkg_dir", ",", "\"extra_*.py\"", ")", ")", "for", "extra_python", "in", "extra_pythons", ":", "extra_module", "=", "os", ".", "path", ".", "basename", "(", "extra_python", ")", "extra_module", "=", "pkg", "+", "\".\"", "+", "os", ".", "path", ".", "splitext", "(", "extra_module", ")", "[", "0", "]", "#", "# Deleting the modules after use runs the risk of GC running on", "# stuff we are using, such as ctypes.c_int.", "#", "extra", "=", "load_source", "(", "extra_module", ",", "extra_python", ")", "#", "# Valid customisations are routines named \"c13n_<something>\".", "#", "fns", "=", "inspect", ".", "getmembers", "(", "extra", ",", "predicate", "=", "inspect", ".", "isroutine", ")", "fns", "=", "{", "fn", "[", "0", "]", ":", "fn", "[", "1", "]", "for", "fn", "in", "fns", "if", "fn", "[", "0", "]", ".", "startswith", "(", "\"c13n_\"", ")", "}", "for", "fn", "in", "sorted", "(", "fns", ")", ":", "fns", "[", "fn", "]", "(", "pkg_module", ")" ]
https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/bindings/pyroot/cppyy/cppyy-backend/cling/python/cppyy_backend/bindings_utils.py#L49-L202
Studio3T/robomongo
2411cd032e2e69b968dadda13ac91ca4ef3483b0
src/third-party/qscintilla-2.8.4/sources/Python/configure.py
python
_run_command
(cmd, verbose)
Run a command and display the output if requested. cmd is the command to run. verbose is set if the output is to be displayed.
Run a command and display the output if requested. cmd is the command to run. verbose is set if the output is to be displayed.
[ "Run", "a", "command", "and", "display", "the", "output", "if", "requested", ".", "cmd", "is", "the", "command", "to", "run", ".", "verbose", "is", "set", "if", "the", "output", "is", "to", "be", "displayed", "." ]
def _run_command(cmd, verbose): """ Run a command and display the output if requested. cmd is the command to run. verbose is set if the output is to be displayed. """ if verbose: sys.stdout.write(cmd + "\n") fout = _get_command_output(cmd) # Read stdout and stderr until there is no more output. lout = fout.readline() while lout: if verbose: if sys.hexversion >= 0x03000000: sys.stdout.write(str(lout, encoding=sys.stdout.encoding)) else: sys.stdout.write(lout) lout = fout.readline() fout.close() try: os.wait() except: pass
[ "def", "_run_command", "(", "cmd", ",", "verbose", ")", ":", "if", "verbose", ":", "sys", ".", "stdout", ".", "write", "(", "cmd", "+", "\"\\n\"", ")", "fout", "=", "_get_command_output", "(", "cmd", ")", "# Read stdout and stderr until there is no more output.", "lout", "=", "fout", ".", "readline", "(", ")", "while", "lout", ":", "if", "verbose", ":", "if", "sys", ".", "hexversion", ">=", "0x03000000", ":", "sys", ".", "stdout", ".", "write", "(", "str", "(", "lout", ",", "encoding", "=", "sys", ".", "stdout", ".", "encoding", ")", ")", "else", ":", "sys", ".", "stdout", ".", "write", "(", "lout", ")", "lout", "=", "fout", ".", "readline", "(", ")", "fout", ".", "close", "(", ")", "try", ":", "os", ".", "wait", "(", ")", "except", ":", "pass" ]
https://github.com/Studio3T/robomongo/blob/2411cd032e2e69b968dadda13ac91ca4ef3483b0/src/third-party/qscintilla-2.8.4/sources/Python/configure.py#L1512-L1538
tfwu/FaceDetection-ConvNet-3D
f9251c48eb40c5aec8fba7455115c355466555be
python/build/lib.linux-x86_64-2.7/mxnet/executor_manager.py
python
DataParallelExecutorGroup.forward
(self, is_train=False)
Perform a forward pass on each executor
Perform a forward pass on each executor
[ "Perform", "a", "forward", "pass", "on", "each", "executor" ]
def forward(self, is_train=False): """ Perform a forward pass on each executor """ for texec in self.train_execs: texec.forward(is_train=is_train)
[ "def", "forward", "(", "self", ",", "is_train", "=", "False", ")", ":", "for", "texec", "in", "self", ".", "train_execs", ":", "texec", ".", "forward", "(", "is_train", "=", "is_train", ")" ]
https://github.com/tfwu/FaceDetection-ConvNet-3D/blob/f9251c48eb40c5aec8fba7455115c355466555be/python/build/lib.linux-x86_64-2.7/mxnet/executor_manager.py#L235-L238
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pandas/py3/pandas/io/pytables.py
python
HDFStore.root
(self)
return self._handle.root
return the root node
return the root node
[ "return", "the", "root", "node" ]
def root(self): """return the root node""" self._check_if_open() assert self._handle is not None # for mypy return self._handle.root
[ "def", "root", "(", "self", ")", ":", "self", ".", "_check_if_open", "(", ")", "assert", "self", ".", "_handle", "is", "not", "None", "# for mypy", "return", "self", ".", "_handle", ".", "root" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/io/pytables.py#L597-L601
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/python/ops/variable_scope.py
python
VariableScope.local_variables
(self)
return self.get_collection(ops.GraphKeys.LOCAL_VARIABLES)
Get this scope's local variables.
Get this scope's local variables.
[ "Get", "this", "scope", "s", "local", "variables", "." ]
def local_variables(self): """Get this scope's local variables.""" return self.get_collection(ops.GraphKeys.LOCAL_VARIABLES)
[ "def", "local_variables", "(", "self", ")", ":", "return", "self", ".", "get_collection", "(", "ops", ".", "GraphKeys", ".", "LOCAL_VARIABLES", ")" ]
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/variable_scope.py#L1026-L1028
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/win32/lib/win32timezone.py
python
utcnow
()
return now
Return the UTC time now with timezone awareness as enabled by this module >>> now = utcnow()
Return the UTC time now with timezone awareness as enabled by this module >>> now = utcnow()
[ "Return", "the", "UTC", "time", "now", "with", "timezone", "awareness", "as", "enabled", "by", "this", "module", ">>>", "now", "=", "utcnow", "()" ]
def utcnow(): """ Return the UTC time now with timezone awareness as enabled by this module >>> now = utcnow() """ now = datetime.datetime.utcnow() now = now.replace(tzinfo=TimeZoneInfo.utc()) return now
[ "def", "utcnow", "(", ")", ":", "now", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", "now", "=", "now", ".", "replace", "(", "tzinfo", "=", "TimeZoneInfo", ".", "utc", "(", ")", ")", "return", "now" ]
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/win32/lib/win32timezone.py#L808-L816
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
Framework/PythonInterface/plugins/algorithms/EnggVanadiumCorrections.py
python
EnggVanadiumCorrections._apply_pix_by_pix_correction
(self, ws, van_curves_ws)
Applies the second step of the Vanadium correction on the given workspace: pixel by pixel divides by a curve fitted to the sum of the set of spectra of the corresponding bank. @param ws :: workspace to work on / correct @param van_curves_ws :: a workspace with the per-bank curves for Vanadium data, this will contain 3 histograms per instrument bank
Applies the second step of the Vanadium correction on the given workspace: pixel by pixel divides by a curve fitted to the sum of the set of spectra of the corresponding bank.
[ "Applies", "the", "second", "step", "of", "the", "Vanadium", "correction", "on", "the", "given", "workspace", ":", "pixel", "by", "pixel", "divides", "by", "a", "curve", "fitted", "to", "the", "sum", "of", "the", "set", "of", "spectra", "of", "the", "corresponding", "bank", "." ]
def _apply_pix_by_pix_correction(self, ws, van_curves_ws): """ Applies the second step of the Vanadium correction on the given workspace: pixel by pixel divides by a curve fitted to the sum of the set of spectra of the corresponding bank. @param ws :: workspace to work on / correct @param van_curves_ws :: a workspace with the per-bank curves for Vanadium data, this will contain 3 histograms per instrument bank """ curves_dict = self._fit_results_to_dict(van_curves_ws) self._divide_by_curves(ws, curves_dict)
[ "def", "_apply_pix_by_pix_correction", "(", "self", ",", "ws", ",", "van_curves_ws", ")", ":", "curves_dict", "=", "self", ".", "_fit_results_to_dict", "(", "van_curves_ws", ")", "self", ".", "_divide_by_curves", "(", "ws", ",", "curves_dict", ")" ]
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/EnggVanadiumCorrections.py#L156-L167
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scikit-learn/py3/sklearn/linear_model/_ridge.py
python
_RidgeGCV._solve_eigen_gram
(self, alpha, y, sqrt_sw, X_mean, eigvals, Q, QT_y)
return G_inverse_diag, c
Compute dual coefficients and diagonal of G^-1. Used when we have a decomposition of X.X^T (n_samples <= n_features).
Compute dual coefficients and diagonal of G^-1.
[ "Compute", "dual", "coefficients", "and", "diagonal", "of", "G^", "-", "1", "." ]
def _solve_eigen_gram(self, alpha, y, sqrt_sw, X_mean, eigvals, Q, QT_y): """Compute dual coefficients and diagonal of G^-1. Used when we have a decomposition of X.X^T (n_samples <= n_features). """ w = 1. / (eigvals + alpha) if self.fit_intercept: # the vector containing the square roots of the sample weights (1 # when no sample weights) is the eigenvector of XX^T which # corresponds to the intercept; we cancel the regularization on # this dimension. the corresponding eigenvalue is # sum(sample_weight). normalized_sw = sqrt_sw / np.linalg.norm(sqrt_sw) intercept_dim = _find_smallest_angle(normalized_sw, Q) w[intercept_dim] = 0 # cancel regularization for the intercept c = np.dot(Q, self._diag_dot(w, QT_y)) G_inverse_diag = self._decomp_diag(w, Q) # handle case where y is 2-d if len(y.shape) != 1: G_inverse_diag = G_inverse_diag[:, np.newaxis] return G_inverse_diag, c
[ "def", "_solve_eigen_gram", "(", "self", ",", "alpha", ",", "y", ",", "sqrt_sw", ",", "X_mean", ",", "eigvals", ",", "Q", ",", "QT_y", ")", ":", "w", "=", "1.", "/", "(", "eigvals", "+", "alpha", ")", "if", "self", ".", "fit_intercept", ":", "# the vector containing the square roots of the sample weights (1", "# when no sample weights) is the eigenvector of XX^T which", "# corresponds to the intercept; we cancel the regularization on", "# this dimension. the corresponding eigenvalue is", "# sum(sample_weight).", "normalized_sw", "=", "sqrt_sw", "/", "np", ".", "linalg", ".", "norm", "(", "sqrt_sw", ")", "intercept_dim", "=", "_find_smallest_angle", "(", "normalized_sw", ",", "Q", ")", "w", "[", "intercept_dim", "]", "=", "0", "# cancel regularization for the intercept", "c", "=", "np", ".", "dot", "(", "Q", ",", "self", ".", "_diag_dot", "(", "w", ",", "QT_y", ")", ")", "G_inverse_diag", "=", "self", ".", "_decomp_diag", "(", "w", ",", "Q", ")", "# handle case where y is 2-d", "if", "len", "(", "y", ".", "shape", ")", "!=", "1", ":", "G_inverse_diag", "=", "G_inverse_diag", "[", ":", ",", "np", ".", "newaxis", "]", "return", "G_inverse_diag", ",", "c" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/linear_model/_ridge.py#L1269-L1290
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/distutils/msvc9compiler.py
python
query_vcvarsall
(version, arch="x86")
return result
Launch vcvarsall.bat and read the settings from its environment
Launch vcvarsall.bat and read the settings from its environment
[ "Launch", "vcvarsall", ".", "bat", "and", "read", "the", "settings", "from", "its", "environment" ]
def query_vcvarsall(version, arch="x86"): """Launch vcvarsall.bat and read the settings from its environment """ vcvarsall = find_vcvarsall(version) interesting = {"include", "lib", "libpath", "path"} result = {} if vcvarsall is None: raise DistutilsPlatformError("Unable to find vcvarsall.bat") log.debug("Calling 'vcvarsall.bat %s' (version=%s)", arch, version) popen = subprocess.Popen('"%s" %s & set' % (vcvarsall, arch), stdout=subprocess.PIPE, stderr=subprocess.PIPE) try: stdout, stderr = popen.communicate() if popen.wait() != 0: raise DistutilsPlatformError(stderr.decode("mbcs")) stdout = stdout.decode("mbcs") for line in stdout.split("\n"): line = Reg.convert_mbcs(line) if '=' not in line: continue line = line.strip() key, value = line.split('=', 1) key = key.lower() if key in interesting: if value.endswith(os.pathsep): value = value[:-1] result[key] = removeDuplicates(value) finally: popen.stdout.close() popen.stderr.close() if len(result) != len(interesting): raise ValueError(str(list(result.keys()))) return result
[ "def", "query_vcvarsall", "(", "version", ",", "arch", "=", "\"x86\"", ")", ":", "vcvarsall", "=", "find_vcvarsall", "(", "version", ")", "interesting", "=", "{", "\"include\"", ",", "\"lib\"", ",", "\"libpath\"", ",", "\"path\"", "}", "result", "=", "{", "}", "if", "vcvarsall", "is", "None", ":", "raise", "DistutilsPlatformError", "(", "\"Unable to find vcvarsall.bat\"", ")", "log", ".", "debug", "(", "\"Calling 'vcvarsall.bat %s' (version=%s)\"", ",", "arch", ",", "version", ")", "popen", "=", "subprocess", ".", "Popen", "(", "'\"%s\" %s & set'", "%", "(", "vcvarsall", ",", "arch", ")", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "PIPE", ")", "try", ":", "stdout", ",", "stderr", "=", "popen", ".", "communicate", "(", ")", "if", "popen", ".", "wait", "(", ")", "!=", "0", ":", "raise", "DistutilsPlatformError", "(", "stderr", ".", "decode", "(", "\"mbcs\"", ")", ")", "stdout", "=", "stdout", ".", "decode", "(", "\"mbcs\"", ")", "for", "line", "in", "stdout", ".", "split", "(", "\"\\n\"", ")", ":", "line", "=", "Reg", ".", "convert_mbcs", "(", "line", ")", "if", "'='", "not", "in", "line", ":", "continue", "line", "=", "line", ".", "strip", "(", ")", "key", ",", "value", "=", "line", ".", "split", "(", "'='", ",", "1", ")", "key", "=", "key", ".", "lower", "(", ")", "if", "key", "in", "interesting", ":", "if", "value", ".", "endswith", "(", "os", ".", "pathsep", ")", ":", "value", "=", "value", "[", ":", "-", "1", "]", "result", "[", "key", "]", "=", "removeDuplicates", "(", "value", ")", "finally", ":", "popen", ".", "stdout", ".", "close", "(", ")", "popen", ".", "stderr", ".", "close", "(", ")", "if", "len", "(", "result", ")", "!=", "len", "(", "interesting", ")", ":", "raise", "ValueError", "(", "str", "(", "list", "(", "result", ".", "keys", "(", ")", ")", ")", ")", "return", "result" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/distutils/msvc9compiler.py#L253-L291
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python/src/Lib/_osx_support.py
python
_override_all_archs
(_config_vars)
return _config_vars
Allow override of all archs with ARCHFLAGS env var
Allow override of all archs with ARCHFLAGS env var
[ "Allow", "override", "of", "all", "archs", "with", "ARCHFLAGS", "env", "var" ]
def _override_all_archs(_config_vars): """Allow override of all archs with ARCHFLAGS env var""" # NOTE: This name was introduced by Apple in OSX 10.5 and # is used by several scripting languages distributed with # that OS release. if 'ARCHFLAGS' in os.environ: arch = os.environ['ARCHFLAGS'] for cv in _UNIVERSAL_CONFIG_VARS: if cv in _config_vars and '-arch' in _config_vars[cv]: flags = _config_vars[cv] flags = re.sub('-arch\s+\w+\s', ' ', flags) flags = flags + ' ' + arch _save_modified_value(_config_vars, cv, flags) return _config_vars
[ "def", "_override_all_archs", "(", "_config_vars", ")", ":", "# NOTE: This name was introduced by Apple in OSX 10.5 and", "# is used by several scripting languages distributed with", "# that OS release.", "if", "'ARCHFLAGS'", "in", "os", ".", "environ", ":", "arch", "=", "os", ".", "environ", "[", "'ARCHFLAGS'", "]", "for", "cv", "in", "_UNIVERSAL_CONFIG_VARS", ":", "if", "cv", "in", "_config_vars", "and", "'-arch'", "in", "_config_vars", "[", "cv", "]", ":", "flags", "=", "_config_vars", "[", "cv", "]", "flags", "=", "re", ".", "sub", "(", "'-arch\\s+\\w+\\s'", ",", "' '", ",", "flags", ")", "flags", "=", "flags", "+", "' '", "+", "arch", "_save_modified_value", "(", "_config_vars", ",", "cv", ",", "flags", ")", "return", "_config_vars" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/_osx_support.py#L260-L274
Polidea/SiriusObfuscator
b0e590d8130e97856afe578869b83a209e2b19be
SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py
python
SBFunction.__ne__
(self, *args)
return _lldb.SBFunction___ne__(self, *args)
__ne__(self, SBFunction rhs) -> bool
__ne__(self, SBFunction rhs) -> bool
[ "__ne__", "(", "self", "SBFunction", "rhs", ")", "-", ">", "bool" ]
def __ne__(self, *args): """__ne__(self, SBFunction rhs) -> bool""" return _lldb.SBFunction___ne__(self, *args)
[ "def", "__ne__", "(", "self", ",", "*", "args", ")", ":", "return", "_lldb", ".", "SBFunction___ne__", "(", "self", ",", "*", "args", ")" ]
https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L5004-L5006
natanielruiz/android-yolo
1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f
jni-build/jni/include/tensorflow/python/ops/array_grad.py
python
_CheckNumericsGrad
(_, grad)
return grad
Gradient for check_numerics op.
Gradient for check_numerics op.
[ "Gradient", "for", "check_numerics", "op", "." ]
def _CheckNumericsGrad(_, grad): """Gradient for check_numerics op.""" return grad
[ "def", "_CheckNumericsGrad", "(", "_", ",", "grad", ")", ":", "return", "grad" ]
https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/array_grad.py#L278-L280
zeakey/DeepSkeleton
dc70170f8fd2ec8ca1157484ce66129981104486
python/caffe/pycaffe.py
python
_Net_blobs
(self)
return OrderedDict(zip(self._blob_names, self._blobs))
An OrderedDict (bottom to top, i.e., input to output) of network blobs indexed by name
An OrderedDict (bottom to top, i.e., input to output) of network blobs indexed by name
[ "An", "OrderedDict", "(", "bottom", "to", "top", "i", ".", "e", ".", "input", "to", "output", ")", "of", "network", "blobs", "indexed", "by", "name" ]
def _Net_blobs(self): """ An OrderedDict (bottom to top, i.e., input to output) of network blobs indexed by name """ return OrderedDict(zip(self._blob_names, self._blobs))
[ "def", "_Net_blobs", "(", "self", ")", ":", "return", "OrderedDict", "(", "zip", "(", "self", ".", "_blob_names", ",", "self", ".", "_blobs", ")", ")" ]
https://github.com/zeakey/DeepSkeleton/blob/dc70170f8fd2ec8ca1157484ce66129981104486/python/caffe/pycaffe.py#L22-L27
ChromiumWebApps/chromium
c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7
tools/idl_parser/idl_parser.py
python
IDLParser.p_UnionMemberTypes
(self, p)
UnionMemberTypes : OR UnionMemberType UnionMemberTypes |
UnionMemberTypes : OR UnionMemberType UnionMemberTypes |
[ "UnionMemberTypes", ":", "OR", "UnionMemberType", "UnionMemberTypes", "|" ]
def p_UnionMemberTypes(self, p): """UnionMemberTypes : OR UnionMemberType UnionMemberTypes |"""
[ "def", "p_UnionMemberTypes", "(", "self", ",", "p", ")", ":" ]
https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/idl_parser/idl_parser.py#L678-L680
CRYTEK/CRYENGINE
232227c59a220cbbd311576f0fbeba7bb53b2a8c
Editor/Python/windows/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py
python
yield_lines
(strs)
Yield non-empty/non-comment lines of a string or sequence
Yield non-empty/non-comment lines of a string or sequence
[ "Yield", "non", "-", "empty", "/", "non", "-", "comment", "lines", "of", "a", "string", "or", "sequence" ]
def yield_lines(strs): """Yield non-empty/non-comment lines of a string or sequence""" if isinstance(strs, string_types): for s in strs.splitlines(): s = s.strip() # skip blank lines/comments if s and not s.startswith('#'): yield s else: for ss in strs: for s in yield_lines(ss): yield s
[ "def", "yield_lines", "(", "strs", ")", ":", "if", "isinstance", "(", "strs", ",", "string_types", ")", ":", "for", "s", "in", "strs", ".", "splitlines", "(", ")", ":", "s", "=", "s", ".", "strip", "(", ")", "# skip blank lines/comments", "if", "s", "and", "not", "s", ".", "startswith", "(", "'#'", ")", ":", "yield", "s", "else", ":", "for", "ss", "in", "strs", ":", "for", "s", "in", "yield_lines", "(", "ss", ")", ":", "yield", "s" ]
https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py#L2257-L2268
eclipse/sumo
7132a9b8b6eea734bdec38479026b4d8c4336d03
tools/traci/_vehicletype.py
python
VehicleTypeDomain.getDecel
(self, typeID)
return self._getUniversal(tc.VAR_DECEL, typeID)
getDecel(string) -> double Returns the maximal comfortable deceleration in m/s^2 of vehicles of this type.
getDecel(string) -> double
[ "getDecel", "(", "string", ")", "-", ">", "double" ]
def getDecel(self, typeID): """getDecel(string) -> double Returns the maximal comfortable deceleration in m/s^2 of vehicles of this type. """ return self._getUniversal(tc.VAR_DECEL, typeID)
[ "def", "getDecel", "(", "self", ",", "typeID", ")", ":", "return", "self", ".", "_getUniversal", "(", "tc", ".", "VAR_DECEL", ",", "typeID", ")" ]
https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/traci/_vehicletype.py#L67-L72
apache/trafodion
8455c839ad6b6d7b6e04edda5715053095b78046
install/python-installer/scripts/httplib2/__init__.py
python
Http.clear_credentials
(self)
Remove all the names and passwords that are used for authentication
Remove all the names and passwords that are used for authentication
[ "Remove", "all", "the", "names", "and", "passwords", "that", "are", "used", "for", "authentication" ]
def clear_credentials(self): """Remove all the names and passwords that are used for authentication""" self.credentials.clear() self.authorizations = []
[ "def", "clear_credentials", "(", "self", ")", ":", "self", ".", "credentials", ".", "clear", "(", ")", "self", ".", "authorizations", "=", "[", "]" ]
https://github.com/apache/trafodion/blob/8455c839ad6b6d7b6e04edda5715053095b78046/install/python-installer/scripts/httplib2/__init__.py#L1301-L1305
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py
python
Misc.after_cancel
(self, id)
Cancel scheduling of function identified with ID. Identifier returned by after or after_idle must be given as first parameter.
Cancel scheduling of function identified with ID.
[ "Cancel", "scheduling", "of", "function", "identified", "with", "ID", "." ]
def after_cancel(self, id): """Cancel scheduling of function identified with ID. Identifier returned by after or after_idle must be given as first parameter. """ if not id: raise ValueError('id must be a valid identifier returned from ' 'after or after_idle') try: data = self.tk.call('after', 'info', id) script = self.tk.splitlist(data)[0] self.deletecommand(script) except TclError: pass self.tk.call('after', 'cancel', id)
[ "def", "after_cancel", "(", "self", ",", "id", ")", ":", "if", "not", "id", ":", "raise", "ValueError", "(", "'id must be a valid identifier returned from '", "'after or after_idle'", ")", "try", ":", "data", "=", "self", ".", "tk", ".", "call", "(", "'after'", ",", "'info'", ",", "id", ")", "script", "=", "self", ".", "tk", ".", "splitlist", "(", "data", ")", "[", "0", "]", "self", ".", "deletecommand", "(", "script", ")", "except", "TclError", ":", "pass", "self", ".", "tk", ".", "call", "(", "'after'", ",", "'cancel'", ",", "id", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py#L765-L780
RobotLocomotion/drake
0e18a34604c45ed65bc9018a54f7610f91cdad5b
bindings/pydrake/systems/planar_scenegraph_visualizer.py
python
PlanarSceneGraphVisualizer._update_body_fill_verts
(self, body_fill, patch_V)
Takes a convex hull if necessary and uses in-place replacement of vertices to update the fill.
Takes a convex hull if necessary and uses in-place replacement of vertices to update the fill.
[ "Takes", "a", "convex", "hull", "if", "necessary", "and", "uses", "in", "-", "place", "replacement", "of", "vertices", "to", "update", "the", "fill", "." ]
def _update_body_fill_verts(self, body_fill, patch_V): """ Takes a convex hull if necessary and uses in-place replacement of vertices to update the fill. """ # Take a convex hull to get an accurate shape for drawing, with verts # coming out in ccw order. if patch_V.shape[1] > 3: hull = spatial.ConvexHull(patch_V.T) patch_V = np.vstack([patch_V[:, v] for v in hull.vertices]).T # Update the verts, padding out to the appropriate full # of verts by # replicating the final vertex. n_verts = body_fill.get_path().vertices.shape[0] patch_V = np.pad( patch_V, ((0, 0), (0, n_verts - patch_V.shape[1])), mode="edge") body_fill.get_path().vertices[:, :] = patch_V.T
[ "def", "_update_body_fill_verts", "(", "self", ",", "body_fill", ",", "patch_V", ")", ":", "# Take a convex hull to get an accurate shape for drawing, with verts", "# coming out in ccw order.", "if", "patch_V", ".", "shape", "[", "1", "]", ">", "3", ":", "hull", "=", "spatial", ".", "ConvexHull", "(", "patch_V", ".", "T", ")", "patch_V", "=", "np", ".", "vstack", "(", "[", "patch_V", "[", ":", ",", "v", "]", "for", "v", "in", "hull", ".", "vertices", "]", ")", ".", "T", "# Update the verts, padding out to the appropriate full # of verts by", "# replicating the final vertex.", "n_verts", "=", "body_fill", ".", "get_path", "(", ")", ".", "vertices", ".", "shape", "[", "0", "]", "patch_V", "=", "np", ".", "pad", "(", "patch_V", ",", "(", "(", "0", ",", "0", ")", ",", "(", "0", ",", "n_verts", "-", "patch_V", ".", "shape", "[", "1", "]", ")", ")", ",", "mode", "=", "\"edge\"", ")", "body_fill", ".", "get_path", "(", ")", ".", "vertices", "[", ":", ",", ":", "]", "=", "patch_V", ".", "T" ]
https://github.com/RobotLocomotion/drake/blob/0e18a34604c45ed65bc9018a54f7610f91cdad5b/bindings/pydrake/systems/planar_scenegraph_visualizer.py#L364-L381
google/nucleus
68d3947fafba1337f294c0668a6e1c7f3f1273e3
nucleus/util/variantcall_utils.py
python
ploidy
(variant_call)
return sum(gt >= -1 for gt in variant_call.genotype)
Returns the ploidy of the VariantCall. Args: variant_call: VariantCall proto. The VariantCall to evaluate. Returns: The ploidy of the call (a non-negative integer).
Returns the ploidy of the VariantCall.
[ "Returns", "the", "ploidy", "of", "the", "VariantCall", "." ]
def ploidy(variant_call): """Returns the ploidy of the VariantCall. Args: variant_call: VariantCall proto. The VariantCall to evaluate. Returns: The ploidy of the call (a non-negative integer). """ # Unknown genotypes are represented as -1 in VariantCall protos. When # a VCF is parsed that contains multiple ploidies in different samples, # a separate padding value of -2**30 - 1 is inserted into the calls. return sum(gt >= -1 for gt in variant_call.genotype)
[ "def", "ploidy", "(", "variant_call", ")", ":", "# Unknown genotypes are represented as -1 in VariantCall protos. When", "# a VCF is parsed that contains multiple ploidies in different samples,", "# a separate padding value of -2**30 - 1 is inserted into the calls.", "return", "sum", "(", "gt", ">=", "-", "1", "for", "gt", "in", "variant_call", ".", "genotype", ")" ]
https://github.com/google/nucleus/blob/68d3947fafba1337f294c0668a6e1c7f3f1273e3/nucleus/util/variantcall_utils.py#L223-L235
google/mysql-protobuf
467cda676afaa49e762c5c9164a43f6ad31a1fbf
protobuf/python/google/protobuf/internal/wire_format.py
python
UnpackTag
(tag)
return (tag >> TAG_TYPE_BITS), (tag & TAG_TYPE_MASK)
The inverse of PackTag(). Given an unsigned 32-bit number, returns a (field_number, wire_type) tuple.
The inverse of PackTag(). Given an unsigned 32-bit number, returns a (field_number, wire_type) tuple.
[ "The", "inverse", "of", "PackTag", "()", ".", "Given", "an", "unsigned", "32", "-", "bit", "number", "returns", "a", "(", "field_number", "wire_type", ")", "tuple", "." ]
def UnpackTag(tag): """The inverse of PackTag(). Given an unsigned 32-bit number, returns a (field_number, wire_type) tuple. """ return (tag >> TAG_TYPE_BITS), (tag & TAG_TYPE_MASK)
[ "def", "UnpackTag", "(", "tag", ")", ":", "return", "(", "tag", ">>", "TAG_TYPE_BITS", ")", ",", "(", "tag", "&", "TAG_TYPE_MASK", ")" ]
https://github.com/google/mysql-protobuf/blob/467cda676afaa49e762c5c9164a43f6ad31a1fbf/protobuf/python/google/protobuf/internal/wire_format.py#L93-L97
cms-sw/cmssw
fd9de012d503d3405420bcbeec0ec879baa57cf2
Alignment/CommonAlignment/scripts/tkal_create_file_lists.py
python
FileListCreator._define_parser
(self)
return parser
Definition of command line argument parser.
Definition of command line argument parser.
[ "Definition", "of", "command", "line", "argument", "parser", "." ]
def _define_parser(self): """Definition of command line argument parser.""" parser = argparse.ArgumentParser( description = "Create file lists for alignment", epilog = ("The tool will create a directory containing all file " "lists and a log file with all relevant event counts " "('{}').".format(FileListCreator._event_count_log))) parser.add_argument("-i", "--input", dest = "datasets", required = True, metavar = "DATASET", action = "append", help = ("CMS dataset name; supports wildcards; " "use multiple times for multiple datasets")) parser.add_argument("--dataset-filter", default = "", help = "regex to match within in the datasets matched," "in case the wildcard isn't flexible enough") parser.add_argument("-j", "--json", dest = "json", metavar = "PATH", help = "path to JSON file (optional)") parser.add_argument("-f", "--fraction", dest = "fraction", type = float, default = 1, help = "max. fraction of files used for alignment") parser.add_argument("--iov", dest = "iovs", metavar = "RUN", type = int, action = "append", default = [], help = ("define IOV by specifying first run; for " "multiple IOVs use this option multiple " "times; files from runs before the lowest " "IOV are discarded (default: 1)")) parser.add_argument("--miniiov", dest="miniiovs", metavar="RUN", type=int, action="append", default=[], help=("in addition to the standard IOVs, break up hippy jobs " "at these points, so that jobs from before and after " "these runs are not in the same job")) parser.add_argument("-r", "--random", action = "store_true", default = False, help = "select files randomly") parser.add_argument("-n", "--events-for-alignment", "--maxevents", dest = "events", type = int, metavar = "NUMBER", help = ("number of events needed for alignment; the" " remaining events in the dataset are used " "for validation; if n<=0, all events are " "used for validation")) parser.add_argument("--all-events", action = "store_true", help = "Use all events for alignment") parser.add_argument("--tracks-for-alignment", dest = "tracks", type = int, metavar = "NUMBER", help = "number of tracks needed for alignment") parser.add_argument("--track-rate", dest = "rate", type = float, metavar = "NUMBER", help = "number of tracks per event") parser.add_argument("--run-by-run", dest = "run_by_run", action = "store_true", default = False, help = "create validation file list for each run") parser.add_argument("--minimum-events-in-iov", dest = "minimum_events_in_iov", metavar = "NUMBER", type = int, default = 100000, help = ("minimum number of events for alignment per" " IOV; this option has a higher priority " "than '-f/--fraction' " "(default: %(default)s)")) parser.add_argument("--minimum-events-validation", dest = "minimum_events_validation", metavar = "NUMBER", type = int, default = 1, help = ("minimum number of events for validation; " "applies to IOVs; in case of --run-by-run " "it applies to runs runs " "(default: %(default)s)")) parser.add_argument("--use-cache", dest = "use_cache", action = "store_true", default = False, help = "use DAS-query results of previous run") parser.add_argument("-o", "--output-dir", dest = "output_dir", metavar = "PATH", default = os.getcwd(), help = "output base directory (default: %(default)s)") parser.add_argument("--create-ini", dest = "create_ini", action = "store_true", default = False, help = ("create dataset ini file based on the " "created file lists")) parser.add_argument("--force", action = "store_true", default = False, help = ("remove output directory from previous " "runs, if existing")) parser.add_argument("--hippy-events-per-job", type = int, default = 1, help = ("approximate number of events in each job for HipPy")) parser.add_argument("--test-mode", dest = "test_mode", action = "store_true", default = False, help = argparse.SUPPRESS) # hidden option return parser
[ "def", "_define_parser", "(", "self", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"Create file lists for alignment\"", ",", "epilog", "=", "(", "\"The tool will create a directory containing all file \"", "\"lists and a log file with all relevant event counts \"", "\"('{}').\"", ".", "format", "(", "FileListCreator", ".", "_event_count_log", ")", ")", ")", "parser", ".", "add_argument", "(", "\"-i\"", ",", "\"--input\"", ",", "dest", "=", "\"datasets\"", ",", "required", "=", "True", ",", "metavar", "=", "\"DATASET\"", ",", "action", "=", "\"append\"", ",", "help", "=", "(", "\"CMS dataset name; supports wildcards; \"", "\"use multiple times for multiple datasets\"", ")", ")", "parser", ".", "add_argument", "(", "\"--dataset-filter\"", ",", "default", "=", "\"\"", ",", "help", "=", "\"regex to match within in the datasets matched,\"", "\"in case the wildcard isn't flexible enough\"", ")", "parser", ".", "add_argument", "(", "\"-j\"", ",", "\"--json\"", ",", "dest", "=", "\"json\"", ",", "metavar", "=", "\"PATH\"", ",", "help", "=", "\"path to JSON file (optional)\"", ")", "parser", ".", "add_argument", "(", "\"-f\"", ",", "\"--fraction\"", ",", "dest", "=", "\"fraction\"", ",", "type", "=", "float", ",", "default", "=", "1", ",", "help", "=", "\"max. fraction of files used for alignment\"", ")", "parser", ".", "add_argument", "(", "\"--iov\"", ",", "dest", "=", "\"iovs\"", ",", "metavar", "=", "\"RUN\"", ",", "type", "=", "int", ",", "action", "=", "\"append\"", ",", "default", "=", "[", "]", ",", "help", "=", "(", "\"define IOV by specifying first run; for \"", "\"multiple IOVs use this option multiple \"", "\"times; files from runs before the lowest \"", "\"IOV are discarded (default: 1)\"", ")", ")", "parser", ".", "add_argument", "(", "\"--miniiov\"", ",", "dest", "=", "\"miniiovs\"", ",", "metavar", "=", "\"RUN\"", ",", "type", "=", "int", ",", "action", "=", "\"append\"", ",", "default", "=", "[", "]", ",", "help", "=", "(", "\"in addition to the standard IOVs, break up hippy jobs \"", "\"at these points, so that jobs from before and after \"", "\"these runs are not in the same job\"", ")", ")", "parser", ".", "add_argument", "(", "\"-r\"", ",", "\"--random\"", ",", "action", "=", "\"store_true\"", ",", "default", "=", "False", ",", "help", "=", "\"select files randomly\"", ")", "parser", ".", "add_argument", "(", "\"-n\"", ",", "\"--events-for-alignment\"", ",", "\"--maxevents\"", ",", "dest", "=", "\"events\"", ",", "type", "=", "int", ",", "metavar", "=", "\"NUMBER\"", ",", "help", "=", "(", "\"number of events needed for alignment; the\"", "\" remaining events in the dataset are used \"", "\"for validation; if n<=0, all events are \"", "\"used for validation\"", ")", ")", "parser", ".", "add_argument", "(", "\"--all-events\"", ",", "action", "=", "\"store_true\"", ",", "help", "=", "\"Use all events for alignment\"", ")", "parser", ".", "add_argument", "(", "\"--tracks-for-alignment\"", ",", "dest", "=", "\"tracks\"", ",", "type", "=", "int", ",", "metavar", "=", "\"NUMBER\"", ",", "help", "=", "\"number of tracks needed for alignment\"", ")", "parser", ".", "add_argument", "(", "\"--track-rate\"", ",", "dest", "=", "\"rate\"", ",", "type", "=", "float", ",", "metavar", "=", "\"NUMBER\"", ",", "help", "=", "\"number of tracks per event\"", ")", "parser", ".", "add_argument", "(", "\"--run-by-run\"", ",", "dest", "=", "\"run_by_run\"", ",", "action", "=", "\"store_true\"", ",", "default", "=", "False", ",", "help", "=", "\"create validation file list for each run\"", ")", "parser", ".", "add_argument", "(", "\"--minimum-events-in-iov\"", ",", "dest", "=", "\"minimum_events_in_iov\"", ",", "metavar", "=", "\"NUMBER\"", ",", "type", "=", "int", ",", "default", "=", "100000", ",", "help", "=", "(", "\"minimum number of events for alignment per\"", "\" IOV; this option has a higher priority \"", "\"than '-f/--fraction' \"", "\"(default: %(default)s)\"", ")", ")", "parser", ".", "add_argument", "(", "\"--minimum-events-validation\"", ",", "dest", "=", "\"minimum_events_validation\"", ",", "metavar", "=", "\"NUMBER\"", ",", "type", "=", "int", ",", "default", "=", "1", ",", "help", "=", "(", "\"minimum number of events for validation; \"", "\"applies to IOVs; in case of --run-by-run \"", "\"it applies to runs runs \"", "\"(default: %(default)s)\"", ")", ")", "parser", ".", "add_argument", "(", "\"--use-cache\"", ",", "dest", "=", "\"use_cache\"", ",", "action", "=", "\"store_true\"", ",", "default", "=", "False", ",", "help", "=", "\"use DAS-query results of previous run\"", ")", "parser", ".", "add_argument", "(", "\"-o\"", ",", "\"--output-dir\"", ",", "dest", "=", "\"output_dir\"", ",", "metavar", "=", "\"PATH\"", ",", "default", "=", "os", ".", "getcwd", "(", ")", ",", "help", "=", "\"output base directory (default: %(default)s)\"", ")", "parser", ".", "add_argument", "(", "\"--create-ini\"", ",", "dest", "=", "\"create_ini\"", ",", "action", "=", "\"store_true\"", ",", "default", "=", "False", ",", "help", "=", "(", "\"create dataset ini file based on the \"", "\"created file lists\"", ")", ")", "parser", ".", "add_argument", "(", "\"--force\"", ",", "action", "=", "\"store_true\"", ",", "default", "=", "False", ",", "help", "=", "(", "\"remove output directory from previous \"", "\"runs, if existing\"", ")", ")", "parser", ".", "add_argument", "(", "\"--hippy-events-per-job\"", ",", "type", "=", "int", ",", "default", "=", "1", ",", "help", "=", "(", "\"approximate number of events in each job for HipPy\"", ")", ")", "parser", ".", "add_argument", "(", "\"--test-mode\"", ",", "dest", "=", "\"test_mode\"", ",", "action", "=", "\"store_true\"", ",", "default", "=", "False", ",", "help", "=", "argparse", ".", "SUPPRESS", ")", "# hidden option", "return", "parser" ]
https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Alignment/CommonAlignment/scripts/tkal_create_file_lists.py#L129-L211
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/ma/core.py
python
put
(a, indices, values, mode='raise')
Set storage-indexed locations to corresponding values. This function is equivalent to `MaskedArray.put`, see that method for details. See Also -------- MaskedArray.put
Set storage-indexed locations to corresponding values.
[ "Set", "storage", "-", "indexed", "locations", "to", "corresponding", "values", "." ]
def put(a, indices, values, mode='raise'): """ Set storage-indexed locations to corresponding values. This function is equivalent to `MaskedArray.put`, see that method for details. See Also -------- MaskedArray.put """ # We can't use 'frommethod', the order of arguments is different try: return a.put(indices, values, mode=mode) except AttributeError: return narray(a, copy=False).put(indices, values, mode=mode)
[ "def", "put", "(", "a", ",", "indices", ",", "values", ",", "mode", "=", "'raise'", ")", ":", "# We can't use 'frommethod', the order of arguments is different", "try", ":", "return", "a", ".", "put", "(", "indices", ",", "values", ",", "mode", "=", "mode", ")", "except", "AttributeError", ":", "return", "narray", "(", "a", ",", "copy", "=", "False", ")", ".", "put", "(", "indices", ",", "values", ",", "mode", "=", "mode", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/ma/core.py#L6947-L6963
y123456yz/reading-and-annotate-mongodb-3.6
93280293672ca7586dc24af18132aa61e4ed7fcf
mongo/buildscripts/idl/idl/cpp_types.py
python
get_cpp_type
(field)
return cpp_type_info
Get the C++ Type information for the given field.
Get the C++ Type information for the given field.
[ "Get", "the", "C", "++", "Type", "information", "for", "the", "given", "field", "." ]
def get_cpp_type(field): # type: (ast.Field) -> CppTypeBase # pylint: disable=redefined-variable-type """Get the C++ Type information for the given field.""" cpp_type_info = None # type: Any if field.cpp_type == 'std::string': cpp_type_info = _CppTypeView(field, 'std::string', 'StringData') elif field.cpp_type == 'std::vector<std::uint8_t>': cpp_type_info = _CppTypeVector(field) else: cpp_type_info = _CppTypeBasic(field) # pylint: disable=redefined-variable-type if field.array: cpp_type_info = _CppTypeArray(cpp_type_info, field) if field.optional: cpp_type_info = _CppTypeOptional(cpp_type_info, field) return cpp_type_info
[ "def", "get_cpp_type", "(", "field", ")", ":", "# type: (ast.Field) -> CppTypeBase", "# pylint: disable=redefined-variable-type", "cpp_type_info", "=", "None", "# type: Any", "if", "field", ".", "cpp_type", "==", "'std::string'", ":", "cpp_type_info", "=", "_CppTypeView", "(", "field", ",", "'std::string'", ",", "'StringData'", ")", "elif", "field", ".", "cpp_type", "==", "'std::vector<std::uint8_t>'", ":", "cpp_type_info", "=", "_CppTypeVector", "(", "field", ")", "else", ":", "cpp_type_info", "=", "_CppTypeBasic", "(", "field", ")", "# pylint: disable=redefined-variable-type", "if", "field", ".", "array", ":", "cpp_type_info", "=", "_CppTypeArray", "(", "cpp_type_info", ",", "field", ")", "if", "field", ".", "optional", ":", "cpp_type_info", "=", "_CppTypeOptional", "(", "cpp_type_info", ",", "field", ")", "return", "cpp_type_info" ]
https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/idl/idl/cpp_types.py#L517-L537
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/richtext.py
python
RichTextBuffer.BatchingUndo
(*args, **kwargs)
return _richtext.RichTextBuffer_BatchingUndo(*args, **kwargs)
BatchingUndo(self) -> bool
BatchingUndo(self) -> bool
[ "BatchingUndo", "(", "self", ")", "-", ">", "bool" ]
def BatchingUndo(*args, **kwargs): """BatchingUndo(self) -> bool""" return _richtext.RichTextBuffer_BatchingUndo(*args, **kwargs)
[ "def", "BatchingUndo", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_richtext", ".", "RichTextBuffer_BatchingUndo", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L2277-L2279
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/propgrid.py
python
PropertyGridIteratorBase.Prev
(*args, **kwargs)
return _propgrid.PropertyGridIteratorBase_Prev(*args, **kwargs)
Prev(self)
Prev(self)
[ "Prev", "(", "self", ")" ]
def Prev(*args, **kwargs): """Prev(self)""" return _propgrid.PropertyGridIteratorBase_Prev(*args, **kwargs)
[ "def", "Prev", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_propgrid", ".", "PropertyGridIteratorBase_Prev", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/propgrid.py#L955-L957
facebookincubator/katran
192eb988c398afc673620254097defb7035d669e
build/fbcode_builder/getdeps/cargo.py
python
CargoBuilder._extract_crates
(cargo_toml_file, dep_to_git)
return deps_to_crates
This functions reads content of provided cargo toml file and extracts crate names per each dependency. The extraction is done by a heuristic so it might be incorrect.
This functions reads content of provided cargo toml file and extracts crate names per each dependency. The extraction is done by a heuristic so it might be incorrect.
[ "This", "functions", "reads", "content", "of", "provided", "cargo", "toml", "file", "and", "extracts", "crate", "names", "per", "each", "dependency", ".", "The", "extraction", "is", "done", "by", "a", "heuristic", "so", "it", "might", "be", "incorrect", "." ]
def _extract_crates(cargo_toml_file, dep_to_git): """ This functions reads content of provided cargo toml file and extracts crate names per each dependency. The extraction is done by a heuristic so it might be incorrect. """ deps_to_crates = {} with open(cargo_toml_file, "r") as f: for line in f.readlines(): if line.startswith("#") or "git = " not in line: continue # filter out commented lines and ones without git deps for name, conf in dep_to_git.items(): if 'git = "{}"'.format(conf["repo_url"]) in line: pkg_template = ' package = "' if pkg_template in line: crate_name, _, _ = line.partition(pkg_template)[ 2 ].partition('"') else: crate_name, _, _ = line.partition("=") deps_to_crates.setdefault(name, set()).add(crate_name.strip()) return deps_to_crates
[ "def", "_extract_crates", "(", "cargo_toml_file", ",", "dep_to_git", ")", ":", "deps_to_crates", "=", "{", "}", "with", "open", "(", "cargo_toml_file", ",", "\"r\"", ")", "as", "f", ":", "for", "line", "in", "f", ".", "readlines", "(", ")", ":", "if", "line", ".", "startswith", "(", "\"#\"", ")", "or", "\"git = \"", "not", "in", "line", ":", "continue", "# filter out commented lines and ones without git deps", "for", "name", ",", "conf", "in", "dep_to_git", ".", "items", "(", ")", ":", "if", "'git = \"{}\"'", ".", "format", "(", "conf", "[", "\"repo_url\"", "]", ")", "in", "line", ":", "pkg_template", "=", "' package = \"'", "if", "pkg_template", "in", "line", ":", "crate_name", ",", "_", ",", "_", "=", "line", ".", "partition", "(", "pkg_template", ")", "[", "2", "]", ".", "partition", "(", "'\"'", ")", "else", ":", "crate_name", ",", "_", ",", "_", "=", "line", ".", "partition", "(", "\"=\"", ")", "deps_to_crates", ".", "setdefault", "(", "name", ",", "set", "(", ")", ")", ".", "add", "(", "crate_name", ".", "strip", "(", ")", ")", "return", "deps_to_crates" ]
https://github.com/facebookincubator/katran/blob/192eb988c398afc673620254097defb7035d669e/build/fbcode_builder/getdeps/cargo.py#L276-L297
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/stc.py
python
StyledTextCtrl.ToggleCaretSticky
(*args, **kwargs)
return _stc.StyledTextCtrl_ToggleCaretSticky(*args, **kwargs)
ToggleCaretSticky(self) Switch between sticky and non-sticky: meant to be bound to a key.
ToggleCaretSticky(self)
[ "ToggleCaretSticky", "(", "self", ")" ]
def ToggleCaretSticky(*args, **kwargs): """ ToggleCaretSticky(self) Switch between sticky and non-sticky: meant to be bound to a key. """ return _stc.StyledTextCtrl_ToggleCaretSticky(*args, **kwargs)
[ "def", "ToggleCaretSticky", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_stc", ".", "StyledTextCtrl_ToggleCaretSticky", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/stc.py#L5583-L5589
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/propgrid.py
python
PropertyGridEvent.GetPropertyValue
(*args, **kwargs)
return _propgrid.PropertyGridEvent_GetPropertyValue(*args, **kwargs)
GetPropertyValue(self) -> wxVariant
GetPropertyValue(self) -> wxVariant
[ "GetPropertyValue", "(", "self", ")", "-", ">", "wxVariant" ]
def GetPropertyValue(*args, **kwargs): """GetPropertyValue(self) -> wxVariant""" return _propgrid.PropertyGridEvent_GetPropertyValue(*args, **kwargs)
[ "def", "GetPropertyValue", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_propgrid", ".", "PropertyGridEvent_GetPropertyValue", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/propgrid.py#L2536-L2538
oracle/graaljs
36a56e8e993d45fc40939a3a4d9c0c24990720f1
graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py
python
Writer.__init__
(self, project_path, version, name, guid=None, platforms=None)
Initializes the project. Args: project_path: Path to the project file. version: Format version to emit. name: Name of the project. guid: GUID to use for project, if not None. platforms: Array of string, the supported platforms. If null, ['Win32']
Initializes the project.
[ "Initializes", "the", "project", "." ]
def __init__(self, project_path, version, name, guid=None, platforms=None): """Initializes the project. Args: project_path: Path to the project file. version: Format version to emit. name: Name of the project. guid: GUID to use for project, if not None. platforms: Array of string, the supported platforms. If null, ['Win32'] """ self.project_path = project_path self.version = version self.name = name self.guid = guid # Default to Win32 for platforms. if not platforms: platforms = ["Win32"] # Initialize the specifications of the various sections. self.platform_section = ["Platforms"] for platform in platforms: self.platform_section.append(["Platform", {"Name": platform}]) self.tool_files_section = ["ToolFiles"] self.configurations_section = ["Configurations"] self.files_section = ["Files"] # Keep a dict keyed on filename to speed up access. self.files_dict = dict()
[ "def", "__init__", "(", "self", ",", "project_path", ",", "version", ",", "name", ",", "guid", "=", "None", ",", "platforms", "=", "None", ")", ":", "self", ".", "project_path", "=", "project_path", "self", ".", "version", "=", "version", "self", ".", "name", "=", "name", "self", ".", "guid", "=", "guid", "# Default to Win32 for platforms.", "if", "not", "platforms", ":", "platforms", "=", "[", "\"Win32\"", "]", "# Initialize the specifications of the various sections.", "self", ".", "platform_section", "=", "[", "\"Platforms\"", "]", "for", "platform", "in", "platforms", ":", "self", ".", "platform_section", ".", "append", "(", "[", "\"Platform\"", ",", "{", "\"Name\"", ":", "platform", "}", "]", ")", "self", ".", "tool_files_section", "=", "[", "\"ToolFiles\"", "]", "self", ".", "configurations_section", "=", "[", "\"Configurations\"", "]", "self", ".", "files_section", "=", "[", "\"Files\"", "]", "# Keep a dict keyed on filename to speed up access.", "self", ".", "files_dict", "=", "dict", "(", ")" ]
https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py#L54-L82
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
scripts/DiamondAttenuationCorrection/FitTransReadUB.py
python
showx3
(x)
%showx displays all parameters for refinement in reasonably intelligible %form Input : parameter vector and the sets of hkl indices for the diamonds
%showx displays all parameters for refinement in reasonably intelligible %form Input : parameter vector and the sets of hkl indices for the diamonds
[ "%showx", "displays", "all", "parameters", "for", "refinement", "in", "reasonably", "intelligible", "%form", "Input", ":", "parameter", "vector", "and", "the", "sets", "of", "hkl", "indices", "for", "the", "diamonds" ]
def showx3(x): ''' %showx displays all parameters for refinement in reasonably intelligible %form Input : parameter vector and the sets of hkl indices for the diamonds ''' global hkl1, hkl2 global UB1, pkcalcint1 global UB2, pkcalcint2 global pktype global lam, y, e, TOF global L1 global ttot global fxsamediam global neqv1, eqvlab1, neqv2, eqvlab2 global difa, function_verbose # nref1 = hkl1.shape[0] # % number of reflections to integrate over # unused variable # nref2 = hkl2.shape[0] # % number of reflections to integrate over # unused variable # % returns array with same dim as input labelling equivs eqvlab1, neqv1 = findeqvs(hkl1) eqvlab2, neqv2 = findeqvs(hkl2) setang1 = x[0:3] pkmult1 = x[3:4 + neqv1 - 1] setang2 = x[4 + neqv1 - 1:6 + neqv1] pkmult2 = x[6 + neqv1:7 + neqv1 + neqv2 - 1] sf = x[neqv1 + neqv2 + 7 - 1] pkwid1 = x[neqv1 + neqv2 + 8 - 1] # bgd = x[neqv1 + neqv2 + 8 - 1:neqv1 + neqv2 + 9 + 2 - 1] # unused variable pkwid2 = x[neqv1 + neqv2 + 10] # % if diamond intensities the same, allow single scale f relsf = x[neqv1 + neqv2 + 11] delam = x[neqv1 + neqv2 + 12] L2 = x[neqv1 + neqv2 + 13] print('_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/\n') print(('Setting angles diam {0} : \nalp {1} bet {2} gam {3} \n'.format( 1, setang1[0], setang1[1], setang1[2]))) print(('pkmult1: {0}\n'.format(pkmult1))) print(('Setting angles diam {0} : \nalp {1} bet {2} gam {3} \n'.format( 2, setang2[0], setang2[1], setang2[2]))) print(('pkmult2: {0}\n'.format(pkmult2))) print(('Scale factor: {0}\n'.format(sf))) print(('pkwid1: {0}\n'.format(pkwid1))) print(('pkwid2: {0}\n'.format(pkwid2))) print(('Rel. scale factor : {0}\n'.format(relsf))) print(('Lambda multiplier: {0}\n'.format(delam))) print(('L2 sample to detector: {0} m\n'.format(L2))) print('_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/\n')
[ "def", "showx3", "(", "x", ")", ":", "global", "hkl1", ",", "hkl2", "global", "UB1", ",", "pkcalcint1", "global", "UB2", ",", "pkcalcint2", "global", "pktype", "global", "lam", ",", "y", ",", "e", ",", "TOF", "global", "L1", "global", "ttot", "global", "fxsamediam", "global", "neqv1", ",", "eqvlab1", ",", "neqv2", ",", "eqvlab2", "global", "difa", ",", "function_verbose", "# nref1 = hkl1.shape[0] # % number of reflections to integrate over # unused variable", "# nref2 = hkl2.shape[0] # % number of reflections to integrate over # unused variable", "# % returns array with same dim as input labelling equivs", "eqvlab1", ",", "neqv1", "=", "findeqvs", "(", "hkl1", ")", "eqvlab2", ",", "neqv2", "=", "findeqvs", "(", "hkl2", ")", "setang1", "=", "x", "[", "0", ":", "3", "]", "pkmult1", "=", "x", "[", "3", ":", "4", "+", "neqv1", "-", "1", "]", "setang2", "=", "x", "[", "4", "+", "neqv1", "-", "1", ":", "6", "+", "neqv1", "]", "pkmult2", "=", "x", "[", "6", "+", "neqv1", ":", "7", "+", "neqv1", "+", "neqv2", "-", "1", "]", "sf", "=", "x", "[", "neqv1", "+", "neqv2", "+", "7", "-", "1", "]", "pkwid1", "=", "x", "[", "neqv1", "+", "neqv2", "+", "8", "-", "1", "]", "# bgd = x[neqv1 + neqv2 + 8 - 1:neqv1 + neqv2 + 9 + 2 - 1] # unused variable", "pkwid2", "=", "x", "[", "neqv1", "+", "neqv2", "+", "10", "]", "# % if diamond intensities the same, allow single scale f", "relsf", "=", "x", "[", "neqv1", "+", "neqv2", "+", "11", "]", "delam", "=", "x", "[", "neqv1", "+", "neqv2", "+", "12", "]", "L2", "=", "x", "[", "neqv1", "+", "neqv2", "+", "13", "]", "print", "(", "'_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/\\n'", ")", "print", "(", "(", "'Setting angles diam {0} : \\nalp {1} bet {2} gam {3} \\n'", ".", "format", "(", "1", ",", "setang1", "[", "0", "]", ",", "setang1", "[", "1", "]", ",", "setang1", "[", "2", "]", ")", ")", ")", "print", "(", "(", "'pkmult1: {0}\\n'", ".", "format", "(", "pkmult1", ")", ")", ")", "print", "(", "(", "'Setting angles diam {0} : \\nalp {1} bet {2} gam {3} \\n'", ".", "format", "(", "2", ",", "setang2", "[", "0", "]", ",", "setang2", "[", "1", "]", ",", "setang2", "[", "2", "]", ")", ")", ")", "print", "(", "(", "'pkmult2: {0}\\n'", ".", "format", "(", "pkmult2", ")", ")", ")", "print", "(", "(", "'Scale factor: {0}\\n'", ".", "format", "(", "sf", ")", ")", ")", "print", "(", "(", "'pkwid1: {0}\\n'", ".", "format", "(", "pkwid1", ")", ")", ")", "print", "(", "(", "'pkwid2: {0}\\n'", ".", "format", "(", "pkwid2", ")", ")", ")", "print", "(", "(", "'Rel. scale factor : {0}\\n'", ".", "format", "(", "relsf", ")", ")", ")", "print", "(", "(", "'Lambda multiplier: {0}\\n'", ".", "format", "(", "delam", ")", ")", ")", "print", "(", "(", "'L2 sample to detector: {0} m\\n'", ".", "format", "(", "L2", ")", ")", ")", "print", "(", "'_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/\\n'", ")" ]
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/DiamondAttenuationCorrection/FitTransReadUB.py#L552-L600
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/multiprocessing/connection.py
python
address_type
(address)
Return the types of the address This can be 'AF_INET', 'AF_UNIX', or 'AF_PIPE'
Return the types of the address
[ "Return", "the", "types", "of", "the", "address" ]
def address_type(address): ''' Return the types of the address This can be 'AF_INET', 'AF_UNIX', or 'AF_PIPE' ''' if type(address) == tuple: return 'AF_INET' elif type(address) is str and address.startswith('\\\\'): return 'AF_PIPE' elif type(address) is str: return 'AF_UNIX' else: raise ValueError('address type of %r unrecognized' % address)
[ "def", "address_type", "(", "address", ")", ":", "if", "type", "(", "address", ")", "==", "tuple", ":", "return", "'AF_INET'", "elif", "type", "(", "address", ")", "is", "str", "and", "address", ".", "startswith", "(", "'\\\\\\\\'", ")", ":", "return", "'AF_PIPE'", "elif", "type", "(", "address", ")", "is", "str", ":", "return", "'AF_UNIX'", "else", ":", "raise", "ValueError", "(", "'address type of %r unrecognized'", "%", "address", ")" ]
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/multiprocessing/connection.py#L98-L111
rsummers11/CADLab
976ed959a0b5208bb4173127a7ef732ac73a9b6f
panreas_hnn/hed-globalweight/scripts/cpp_lint.py
python
_ClassifyInclude
(fileinfo, include, is_system)
return _OTHER_HEADER
Figures out what kind of header 'include' is. Args: fileinfo: The current file cpplint is running over. A FileInfo instance. include: The path to a #included file. is_system: True if the #include used <> rather than "". Returns: One of the _XXX_HEADER constants. For example: >>> _ClassifyInclude(FileInfo('foo/foo.cc'), 'stdio.h', True) _C_SYS_HEADER >>> _ClassifyInclude(FileInfo('foo/foo.cc'), 'string', True) _CPP_SYS_HEADER >>> _ClassifyInclude(FileInfo('foo/foo.cc'), 'foo/foo.h', False) _LIKELY_MY_HEADER >>> _ClassifyInclude(FileInfo('foo/foo_unknown_extension.cc'), ... 'bar/foo_other_ext.h', False) _POSSIBLE_MY_HEADER >>> _ClassifyInclude(FileInfo('foo/foo.cc'), 'foo/bar.h', False) _OTHER_HEADER
Figures out what kind of header 'include' is.
[ "Figures", "out", "what", "kind", "of", "header", "include", "is", "." ]
def _ClassifyInclude(fileinfo, include, is_system): """Figures out what kind of header 'include' is. Args: fileinfo: The current file cpplint is running over. A FileInfo instance. include: The path to a #included file. is_system: True if the #include used <> rather than "". Returns: One of the _XXX_HEADER constants. For example: >>> _ClassifyInclude(FileInfo('foo/foo.cc'), 'stdio.h', True) _C_SYS_HEADER >>> _ClassifyInclude(FileInfo('foo/foo.cc'), 'string', True) _CPP_SYS_HEADER >>> _ClassifyInclude(FileInfo('foo/foo.cc'), 'foo/foo.h', False) _LIKELY_MY_HEADER >>> _ClassifyInclude(FileInfo('foo/foo_unknown_extension.cc'), ... 'bar/foo_other_ext.h', False) _POSSIBLE_MY_HEADER >>> _ClassifyInclude(FileInfo('foo/foo.cc'), 'foo/bar.h', False) _OTHER_HEADER """ # This is a list of all standard c++ header files, except # those already checked for above. is_cpp_h = include in _CPP_HEADERS if is_system: if is_cpp_h: return _CPP_SYS_HEADER else: return _C_SYS_HEADER # If the target file and the include we're checking share a # basename when we drop common extensions, and the include # lives in . , then it's likely to be owned by the target file. target_dir, target_base = ( os.path.split(_DropCommonSuffixes(fileinfo.RepositoryName()))) include_dir, include_base = os.path.split(_DropCommonSuffixes(include)) if target_base == include_base and ( include_dir == target_dir or include_dir == os.path.normpath(target_dir + '/../public')): return _LIKELY_MY_HEADER # If the target and include share some initial basename # component, it's possible the target is implementing the # include, so it's allowed to be first, but we'll never # complain if it's not there. target_first_component = _RE_FIRST_COMPONENT.match(target_base) include_first_component = _RE_FIRST_COMPONENT.match(include_base) if (target_first_component and include_first_component and target_first_component.group(0) == include_first_component.group(0)): return _POSSIBLE_MY_HEADER return _OTHER_HEADER
[ "def", "_ClassifyInclude", "(", "fileinfo", ",", "include", ",", "is_system", ")", ":", "# This is a list of all standard c++ header files, except", "# those already checked for above.", "is_cpp_h", "=", "include", "in", "_CPP_HEADERS", "if", "is_system", ":", "if", "is_cpp_h", ":", "return", "_CPP_SYS_HEADER", "else", ":", "return", "_C_SYS_HEADER", "# If the target file and the include we're checking share a", "# basename when we drop common extensions, and the include", "# lives in . , then it's likely to be owned by the target file.", "target_dir", ",", "target_base", "=", "(", "os", ".", "path", ".", "split", "(", "_DropCommonSuffixes", "(", "fileinfo", ".", "RepositoryName", "(", ")", ")", ")", ")", "include_dir", ",", "include_base", "=", "os", ".", "path", ".", "split", "(", "_DropCommonSuffixes", "(", "include", ")", ")", "if", "target_base", "==", "include_base", "and", "(", "include_dir", "==", "target_dir", "or", "include_dir", "==", "os", ".", "path", ".", "normpath", "(", "target_dir", "+", "'/../public'", ")", ")", ":", "return", "_LIKELY_MY_HEADER", "# If the target and include share some initial basename", "# component, it's possible the target is implementing the", "# include, so it's allowed to be first, but we'll never", "# complain if it's not there.", "target_first_component", "=", "_RE_FIRST_COMPONENT", ".", "match", "(", "target_base", ")", "include_first_component", "=", "_RE_FIRST_COMPONENT", ".", "match", "(", "include_base", ")", "if", "(", "target_first_component", "and", "include_first_component", "and", "target_first_component", ".", "group", "(", "0", ")", "==", "include_first_component", ".", "group", "(", "0", ")", ")", ":", "return", "_POSSIBLE_MY_HEADER", "return", "_OTHER_HEADER" ]
https://github.com/rsummers11/CADLab/blob/976ed959a0b5208bb4173127a7ef732ac73a9b6f/panreas_hnn/hed-globalweight/scripts/cpp_lint.py#L3620-L3676
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/build/waf-1.7.13/lmbrwaflib/msvs.py
python
vsnode_target.collect_properties
(self)
Visual studio projects are associated with platforms and configurations (for building especially)
Visual studio projects are associated with platforms and configurations (for building especially)
[ "Visual", "studio", "projects", "are", "associated", "with", "platforms", "and", "configurations", "(", "for", "building", "especially", ")" ]
def collect_properties(self): """ Visual studio projects are associated with platforms and configurations (for building especially) """ project_generator_node = self.ctx.bldnode.make_node('project_generator') project_generator_prefix = project_generator_node.abspath() bintemp_prefix = self.ctx.bldnode.abspath() super(vsnode_target, self).collect_properties() for x in self.build_properties: x.outdir = self.path.parent.abspath() x.bindir = self.path.parent.abspath() x.preprocessor_definitions = '' x.includes_search_path = '' x.c_flags = '' x.cxx_flags = '' x.link_flags = '' x.target_spec = '' x.target_config = '' x.is_external_project_tool = str(False) x.ld_target_path = '' x.ld_target_command = '' x.ld_target_arguments = '' if not hasattr(self.tg, 'link_task') and 'create_static_library' not in self.tg.features: continue current_spec_name = x.configuration.waf_spec # If the toolset map list doesn't contain a platform which matches this node msvs_version, it is skipped platform = self.get_platform_for_toolset_name(x.platform) if not platform: continue waf_platform = platform.platform waf_configuration = x.configuration.waf_configuration spec_modules = self.ctx.spec_modules(current_spec_name) waf_platform_config_key = waf_platform + '_' + waf_configuration include_project = True # Determine the module's supported platform(s) and configuration(s) and see if it needs to be included # in the project module_platforms = self.ctx.get_module_platforms(self.tg.target) module_configurations = self.ctx.get_module_configurations(self.tg.target, waf_platform) if waf_platform not in module_platforms: include_project = False elif waf_configuration not in module_configurations: include_project = False elif waf_platform_config_key not in self.ctx.all_envs: include_project = False else: target_name = self.tg.target all_module_uses = self.ctx.get_all_module_uses(current_spec_name, waf_platform, waf_configuration) unit_test_target = getattr(self.tg, 'unit_test_target', '') if (target_name not in spec_modules) and \ (target_name not in all_module_uses) and \ (unit_test_target not in spec_modules) and \ (unit_test_target not in all_module_uses): include_project = False # Check if this project is supported for the current spec if not include_project: # Even if this project does is not supported by a particular configuration, it still needs a place-holder # for its value so MSVS will be able to load the project output_file_name = 'Unsupported_For_Configuration' x.output_file = output_file_name x.output_file_name = output_file_name x.includes_search_path = "" x.preprocessor_definitions = "" x.c_flags = '' x.cxx_flags = '' x.link_flags = '' x.target_spec = '' x.is_external_project_tool = str(False) x.ld_target_path = '' x.ld_target_command = '' x.ld_target_arguments = '' continue current_env = self.ctx.all_envs[waf_platform_config_key] msvc_helper.verify_options_common(current_env) x.c_flags = " ".join(current_env['CFLAGS']) # convert list to space separated string x.cxx_flags = " ".join(current_env['CXXFLAGS']) # convert list to space separated string x.link_flags = " ".join(current_env['LINKFLAGS']) # convert list to space separated string x.target_spec = current_spec_name x.target_config = waf_platform + '_' + waf_configuration # Get the details of the platform+configuration for the current vs build configuration config_details = platform.get_configuration(waf_configuration) # If there is a new style project settings attribute, use the mechanism to extract from that data instead # of querying for platform+configuration built keywords project_settings_list = getattr(self.tg, 'project_settings', None) base_project_path = getattr(self.tg, 'base_project_settings_path', None) if project_settings_list: project_settings = self.get_platform_settings_from_project_settings(base_project_path, config_details, ['defines', 'includes', 'output_file_name']) else: project_settings = None has_link_task = False # For VS projects with a single game project target if hasattr(self.tg, 'link_task'): # no link task implies special static modules which are static libraries link_task_pattern_name = self.tg.link_task.__class__.__name__ + '_PATTERN' has_link_task = True else: link_task_pattern_name = 'cxxstlib_PATTERN' pattern = current_env[link_task_pattern_name] output_folder_node = self.get_output_folder_node(waf_configuration, waf_platform) if project_settings: output_file_name = project_settings['output_file_name'] else: # Legacy if waf_configuration.startswith('debug') and hasattr(self.tg, 'debug_output_file_name'): output_file_name = self.tg.debug_output_file_name elif not waf_configuration.startswith('debug') and hasattr(self.tg, 'ndebug_output_file_name'): output_file_name = self.tg.ndebug_output_file_name else: output_file_name = self.tg.output_file_name # Save project info try: x.output_file = output_folder_node.abspath() + '\\' + pattern % output_file_name except TypeError: pass x.output_file_name = output_file_name x.output_path = os.path.dirname(x.output_file) x.outdir = x.output_path x.bindir = os.path.join(self.tg.bld.path.abspath(), self.tg.bld.get_output_target_folder(waf_platform, waf_configuration)) x.assembly_name = output_file_name x.output_type = os.path.splitext(x.output_file)[1][1:] # e.g. ".dll" to "dll" if not has_link_task: # Project with no outputs (static lib or pile of objects) # Even if this project does not have an executable, it still needs a place-holder # for its value so MSVS will be able to load the project output_file_name = '' x.output_file = output_file_name x.output_file_name = output_file_name # Collect all defines for this configuration define_list = list(current_env['DEFINES']) if project_settings: define_list += project_settings.get('defines', []) else: # Legacy define_list += self.GetPlatformSettings(waf_platform, waf_configuration, 'defines', self.tg) include_list = list(current_env['INCLUDES']) if project_settings: include_list += project_settings.get('includes', []) else: # Legacy include_list += self.GetPlatformSettings(waf_platform, waf_configuration, 'includes', self.tg) # make sure we only have absolute path for intellisense # If we don't have a absolute path, assume a relative one, hence prefix the path with the taskgen path and comvert it into an absolute one for i in range(len(include_list)): if (isinstance(include_list[i], Node.Node)): # convert nodes to abs paths include_list[i] = include_list[i].abspath() else: if not os.path.isabs(include_list[i]): include_list[i] = os.path.abspath(self.tg.path.abspath() + '/' + include_list[i]) # Do a depth-first recursion into the use dependencies to collect any additional include paths uselib_include_cache = {} self.recurse_use_includes_and_defines(waf_platform, waf_configuration, self.tg, include_list, define_list, uselib_include_cache) # For generate header files that need to be included, the include path during project generation will # be $ROOT\BinTemp\project_generator\... because the task is generated based on files that are to be # created. At this point, the include paths from this step will be included if they exist (ie UI4) # so we will filter and replace all paths that start with $ROOT\BinTemp\project_generator\... and # replace the header with what the files WILL BE during the build process, where those platform # specific header files will be generated platform_configuration = waf_platform + '_' + waf_configuration; replace_project_generator_prefix = self.ctx.bldnode.make_node(platform_configuration).abspath() include_list = [p.replace(project_generator_prefix, replace_project_generator_prefix) for p in include_list] replace_bintemp_to_target = self.ctx.bldnode.make_node(platform_configuration).abspath() include_list = [p.replace(bintemp_prefix, replace_bintemp_to_target) for p in include_list] if 'qt5' in self.tg.features: # Special case for projects that use QT. It needs to resolve the intermediate/generated QT related files based # on the configuration. qt_intermediate_include_path = os.path.join(self.tg.bld.bldnode.abspath(), x.target_config, 'qt5', '{}.{}'.format(self.name, self.tg.target_uid)) include_list.append(qt_intermediate_include_path) x.includes_search_path = ';'.join(include_list) x.preprocessor_definitions = ';'.join(define_list) x.ld_target_command = "$(TargetPath)" x.ld_target_arguments = '' x.ld_target_path = x.output_file if x.target_config.endswith('_test') and x.output_file.endswith('.dll'): x.ld_target_command = '$(OutDir)AzTestRunner' x.ld_target_arguments = "{} AzRunUnitTests --pause-on-completion --gtest_break_on_failure".format(x.output_file) elif self.engine_external and hasattr(self.tg, 'tool_launcher_target'): tool_launcher_target = getattr(self.tg, 'tool_launcher_target', None) if tool_launcher_target is not None: if isinstance(tool_launcher_target, list): tool_launcher_target = tool_launcher_target[0] target_executable = "{}.exe".format(tool_launcher_target) # Tool Launcher targets will exist in the corresponding engine's outdir folder target_executable_full_path = os.path.join(self.tg.bld.engine_path, os.path.basename(x.output_path), target_executable) x.ld_target_path = target_executable_full_path x.ld_target_arguments = '--app-root "{}"'.format(self.tg.bld.path.abspath()) x.is_external_project_tool = str(True)
[ "def", "collect_properties", "(", "self", ")", ":", "project_generator_node", "=", "self", ".", "ctx", ".", "bldnode", ".", "make_node", "(", "'project_generator'", ")", "project_generator_prefix", "=", "project_generator_node", ".", "abspath", "(", ")", "bintemp_prefix", "=", "self", ".", "ctx", ".", "bldnode", ".", "abspath", "(", ")", "super", "(", "vsnode_target", ",", "self", ")", ".", "collect_properties", "(", ")", "for", "x", "in", "self", ".", "build_properties", ":", "x", ".", "outdir", "=", "self", ".", "path", ".", "parent", ".", "abspath", "(", ")", "x", ".", "bindir", "=", "self", ".", "path", ".", "parent", ".", "abspath", "(", ")", "x", ".", "preprocessor_definitions", "=", "''", "x", ".", "includes_search_path", "=", "''", "x", ".", "c_flags", "=", "''", "x", ".", "cxx_flags", "=", "''", "x", ".", "link_flags", "=", "''", "x", ".", "target_spec", "=", "''", "x", ".", "target_config", "=", "''", "x", ".", "is_external_project_tool", "=", "str", "(", "False", ")", "x", ".", "ld_target_path", "=", "''", "x", ".", "ld_target_command", "=", "''", "x", ".", "ld_target_arguments", "=", "''", "if", "not", "hasattr", "(", "self", ".", "tg", ",", "'link_task'", ")", "and", "'create_static_library'", "not", "in", "self", ".", "tg", ".", "features", ":", "continue", "current_spec_name", "=", "x", ".", "configuration", ".", "waf_spec", "# If the toolset map list doesn't contain a platform which matches this node msvs_version, it is skipped", "platform", "=", "self", ".", "get_platform_for_toolset_name", "(", "x", ".", "platform", ")", "if", "not", "platform", ":", "continue", "waf_platform", "=", "platform", ".", "platform", "waf_configuration", "=", "x", ".", "configuration", ".", "waf_configuration", "spec_modules", "=", "self", ".", "ctx", ".", "spec_modules", "(", "current_spec_name", ")", "waf_platform_config_key", "=", "waf_platform", "+", "'_'", "+", "waf_configuration", "include_project", "=", "True", "# Determine the module's supported platform(s) and configuration(s) and see if it needs to be included", "# in the project", "module_platforms", "=", "self", ".", "ctx", ".", "get_module_platforms", "(", "self", ".", "tg", ".", "target", ")", "module_configurations", "=", "self", ".", "ctx", ".", "get_module_configurations", "(", "self", ".", "tg", ".", "target", ",", "waf_platform", ")", "if", "waf_platform", "not", "in", "module_platforms", ":", "include_project", "=", "False", "elif", "waf_configuration", "not", "in", "module_configurations", ":", "include_project", "=", "False", "elif", "waf_platform_config_key", "not", "in", "self", ".", "ctx", ".", "all_envs", ":", "include_project", "=", "False", "else", ":", "target_name", "=", "self", ".", "tg", ".", "target", "all_module_uses", "=", "self", ".", "ctx", ".", "get_all_module_uses", "(", "current_spec_name", ",", "waf_platform", ",", "waf_configuration", ")", "unit_test_target", "=", "getattr", "(", "self", ".", "tg", ",", "'unit_test_target'", ",", "''", ")", "if", "(", "target_name", "not", "in", "spec_modules", ")", "and", "(", "target_name", "not", "in", "all_module_uses", ")", "and", "(", "unit_test_target", "not", "in", "spec_modules", ")", "and", "(", "unit_test_target", "not", "in", "all_module_uses", ")", ":", "include_project", "=", "False", "# Check if this project is supported for the current spec", "if", "not", "include_project", ":", "# Even if this project does is not supported by a particular configuration, it still needs a place-holder", "# for its value so MSVS will be able to load the project", "output_file_name", "=", "'Unsupported_For_Configuration'", "x", ".", "output_file", "=", "output_file_name", "x", ".", "output_file_name", "=", "output_file_name", "x", ".", "includes_search_path", "=", "\"\"", "x", ".", "preprocessor_definitions", "=", "\"\"", "x", ".", "c_flags", "=", "''", "x", ".", "cxx_flags", "=", "''", "x", ".", "link_flags", "=", "''", "x", ".", "target_spec", "=", "''", "x", ".", "is_external_project_tool", "=", "str", "(", "False", ")", "x", ".", "ld_target_path", "=", "''", "x", ".", "ld_target_command", "=", "''", "x", ".", "ld_target_arguments", "=", "''", "continue", "current_env", "=", "self", ".", "ctx", ".", "all_envs", "[", "waf_platform_config_key", "]", "msvc_helper", ".", "verify_options_common", "(", "current_env", ")", "x", ".", "c_flags", "=", "\" \"", ".", "join", "(", "current_env", "[", "'CFLAGS'", "]", ")", "# convert list to space separated string", "x", ".", "cxx_flags", "=", "\" \"", ".", "join", "(", "current_env", "[", "'CXXFLAGS'", "]", ")", "# convert list to space separated string", "x", ".", "link_flags", "=", "\" \"", ".", "join", "(", "current_env", "[", "'LINKFLAGS'", "]", ")", "# convert list to space separated string", "x", ".", "target_spec", "=", "current_spec_name", "x", ".", "target_config", "=", "waf_platform", "+", "'_'", "+", "waf_configuration", "# Get the details of the platform+configuration for the current vs build configuration", "config_details", "=", "platform", ".", "get_configuration", "(", "waf_configuration", ")", "# If there is a new style project settings attribute, use the mechanism to extract from that data instead", "# of querying for platform+configuration built keywords", "project_settings_list", "=", "getattr", "(", "self", ".", "tg", ",", "'project_settings'", ",", "None", ")", "base_project_path", "=", "getattr", "(", "self", ".", "tg", ",", "'base_project_settings_path'", ",", "None", ")", "if", "project_settings_list", ":", "project_settings", "=", "self", ".", "get_platform_settings_from_project_settings", "(", "base_project_path", ",", "config_details", ",", "[", "'defines'", ",", "'includes'", ",", "'output_file_name'", "]", ")", "else", ":", "project_settings", "=", "None", "has_link_task", "=", "False", "# For VS projects with a single game project target", "if", "hasattr", "(", "self", ".", "tg", ",", "'link_task'", ")", ":", "# no link task implies special static modules which are static libraries", "link_task_pattern_name", "=", "self", ".", "tg", ".", "link_task", ".", "__class__", ".", "__name__", "+", "'_PATTERN'", "has_link_task", "=", "True", "else", ":", "link_task_pattern_name", "=", "'cxxstlib_PATTERN'", "pattern", "=", "current_env", "[", "link_task_pattern_name", "]", "output_folder_node", "=", "self", ".", "get_output_folder_node", "(", "waf_configuration", ",", "waf_platform", ")", "if", "project_settings", ":", "output_file_name", "=", "project_settings", "[", "'output_file_name'", "]", "else", ":", "# Legacy", "if", "waf_configuration", ".", "startswith", "(", "'debug'", ")", "and", "hasattr", "(", "self", ".", "tg", ",", "'debug_output_file_name'", ")", ":", "output_file_name", "=", "self", ".", "tg", ".", "debug_output_file_name", "elif", "not", "waf_configuration", ".", "startswith", "(", "'debug'", ")", "and", "hasattr", "(", "self", ".", "tg", ",", "'ndebug_output_file_name'", ")", ":", "output_file_name", "=", "self", ".", "tg", ".", "ndebug_output_file_name", "else", ":", "output_file_name", "=", "self", ".", "tg", ".", "output_file_name", "# Save project info", "try", ":", "x", ".", "output_file", "=", "output_folder_node", ".", "abspath", "(", ")", "+", "'\\\\'", "+", "pattern", "%", "output_file_name", "except", "TypeError", ":", "pass", "x", ".", "output_file_name", "=", "output_file_name", "x", ".", "output_path", "=", "os", ".", "path", ".", "dirname", "(", "x", ".", "output_file", ")", "x", ".", "outdir", "=", "x", ".", "output_path", "x", ".", "bindir", "=", "os", ".", "path", ".", "join", "(", "self", ".", "tg", ".", "bld", ".", "path", ".", "abspath", "(", ")", ",", "self", ".", "tg", ".", "bld", ".", "get_output_target_folder", "(", "waf_platform", ",", "waf_configuration", ")", ")", "x", ".", "assembly_name", "=", "output_file_name", "x", ".", "output_type", "=", "os", ".", "path", ".", "splitext", "(", "x", ".", "output_file", ")", "[", "1", "]", "[", "1", ":", "]", "# e.g. \".dll\" to \"dll\"", "if", "not", "has_link_task", ":", "# Project with no outputs (static lib or pile of objects)", "# Even if this project does not have an executable, it still needs a place-holder", "# for its value so MSVS will be able to load the project", "output_file_name", "=", "''", "x", ".", "output_file", "=", "output_file_name", "x", ".", "output_file_name", "=", "output_file_name", "# Collect all defines for this configuration", "define_list", "=", "list", "(", "current_env", "[", "'DEFINES'", "]", ")", "if", "project_settings", ":", "define_list", "+=", "project_settings", ".", "get", "(", "'defines'", ",", "[", "]", ")", "else", ":", "# Legacy", "define_list", "+=", "self", ".", "GetPlatformSettings", "(", "waf_platform", ",", "waf_configuration", ",", "'defines'", ",", "self", ".", "tg", ")", "include_list", "=", "list", "(", "current_env", "[", "'INCLUDES'", "]", ")", "if", "project_settings", ":", "include_list", "+=", "project_settings", ".", "get", "(", "'includes'", ",", "[", "]", ")", "else", ":", "# Legacy", "include_list", "+=", "self", ".", "GetPlatformSettings", "(", "waf_platform", ",", "waf_configuration", ",", "'includes'", ",", "self", ".", "tg", ")", "# make sure we only have absolute path for intellisense", "# If we don't have a absolute path, assume a relative one, hence prefix the path with the taskgen path and comvert it into an absolute one", "for", "i", "in", "range", "(", "len", "(", "include_list", ")", ")", ":", "if", "(", "isinstance", "(", "include_list", "[", "i", "]", ",", "Node", ".", "Node", ")", ")", ":", "# convert nodes to abs paths", "include_list", "[", "i", "]", "=", "include_list", "[", "i", "]", ".", "abspath", "(", ")", "else", ":", "if", "not", "os", ".", "path", ".", "isabs", "(", "include_list", "[", "i", "]", ")", ":", "include_list", "[", "i", "]", "=", "os", ".", "path", ".", "abspath", "(", "self", ".", "tg", ".", "path", ".", "abspath", "(", ")", "+", "'/'", "+", "include_list", "[", "i", "]", ")", "# Do a depth-first recursion into the use dependencies to collect any additional include paths", "uselib_include_cache", "=", "{", "}", "self", ".", "recurse_use_includes_and_defines", "(", "waf_platform", ",", "waf_configuration", ",", "self", ".", "tg", ",", "include_list", ",", "define_list", ",", "uselib_include_cache", ")", "# For generate header files that need to be included, the include path during project generation will", "# be $ROOT\\BinTemp\\project_generator\\... because the task is generated based on files that are to be", "# created. At this point, the include paths from this step will be included if they exist (ie UI4)", "# so we will filter and replace all paths that start with $ROOT\\BinTemp\\project_generator\\... and", "# replace the header with what the files WILL BE during the build process, where those platform", "# specific header files will be generated", "platform_configuration", "=", "waf_platform", "+", "'_'", "+", "waf_configuration", "replace_project_generator_prefix", "=", "self", ".", "ctx", ".", "bldnode", ".", "make_node", "(", "platform_configuration", ")", ".", "abspath", "(", ")", "include_list", "=", "[", "p", ".", "replace", "(", "project_generator_prefix", ",", "replace_project_generator_prefix", ")", "for", "p", "in", "include_list", "]", "replace_bintemp_to_target", "=", "self", ".", "ctx", ".", "bldnode", ".", "make_node", "(", "platform_configuration", ")", ".", "abspath", "(", ")", "include_list", "=", "[", "p", ".", "replace", "(", "bintemp_prefix", ",", "replace_bintemp_to_target", ")", "for", "p", "in", "include_list", "]", "if", "'qt5'", "in", "self", ".", "tg", ".", "features", ":", "# Special case for projects that use QT. It needs to resolve the intermediate/generated QT related files based", "# on the configuration.", "qt_intermediate_include_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "tg", ".", "bld", ".", "bldnode", ".", "abspath", "(", ")", ",", "x", ".", "target_config", ",", "'qt5'", ",", "'{}.{}'", ".", "format", "(", "self", ".", "name", ",", "self", ".", "tg", ".", "target_uid", ")", ")", "include_list", ".", "append", "(", "qt_intermediate_include_path", ")", "x", ".", "includes_search_path", "=", "';'", ".", "join", "(", "include_list", ")", "x", ".", "preprocessor_definitions", "=", "';'", ".", "join", "(", "define_list", ")", "x", ".", "ld_target_command", "=", "\"$(TargetPath)\"", "x", ".", "ld_target_arguments", "=", "''", "x", ".", "ld_target_path", "=", "x", ".", "output_file", "if", "x", ".", "target_config", ".", "endswith", "(", "'_test'", ")", "and", "x", ".", "output_file", ".", "endswith", "(", "'.dll'", ")", ":", "x", ".", "ld_target_command", "=", "'$(OutDir)AzTestRunner'", "x", ".", "ld_target_arguments", "=", "\"{} AzRunUnitTests --pause-on-completion --gtest_break_on_failure\"", ".", "format", "(", "x", ".", "output_file", ")", "elif", "self", ".", "engine_external", "and", "hasattr", "(", "self", ".", "tg", ",", "'tool_launcher_target'", ")", ":", "tool_launcher_target", "=", "getattr", "(", "self", ".", "tg", ",", "'tool_launcher_target'", ",", "None", ")", "if", "tool_launcher_target", "is", "not", "None", ":", "if", "isinstance", "(", "tool_launcher_target", ",", "list", ")", ":", "tool_launcher_target", "=", "tool_launcher_target", "[", "0", "]", "target_executable", "=", "\"{}.exe\"", ".", "format", "(", "tool_launcher_target", ")", "# Tool Launcher targets will exist in the corresponding engine's outdir folder", "target_executable_full_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "tg", ".", "bld", ".", "engine_path", ",", "os", ".", "path", ".", "basename", "(", "x", ".", "output_path", ")", ",", "target_executable", ")", "x", ".", "ld_target_path", "=", "target_executable_full_path", "x", ".", "ld_target_arguments", "=", "'--app-root \"{}\"'", ".", "format", "(", "self", ".", "tg", ".", "bld", ".", "path", ".", "abspath", "(", ")", ")", "x", ".", "is_external_project_tool", "=", "str", "(", "True", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/lmbrwaflib/msvs.py#L1357-L1580
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/wsgiref/headers.py
python
Headers.items
(self)
return self._headers[:]
Get all the header fields and values. These will be sorted in the order they were in the original header list, or were added to this instance, and may contain duplicates. Any fields deleted and re-inserted are always appended to the header list.
Get all the header fields and values.
[ "Get", "all", "the", "header", "fields", "and", "values", "." ]
def items(self): """Get all the header fields and values. These will be sorted in the order they were in the original header list, or were added to this instance, and may contain duplicates. Any fields deleted and re-inserted are always appended to the header list. """ return self._headers[:]
[ "def", "items", "(", "self", ")", ":", "return", "self", ".", "_headers", "[", ":", "]" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/wsgiref/headers.py#L123-L131
google/iree
1224bbdbe65b0d1fdf40e7324f60f68beeaf7c76
scripts/download_file.py
python
parse_arguments
()
return parser.parse_args()
Parses command line arguments.
Parses command line arguments.
[ "Parses", "command", "line", "arguments", "." ]
def parse_arguments(): """Parses command line arguments.""" parser = argparse.ArgumentParser() parser.add_argument("source_url", type=str, metavar="<source-url>", help="Source URL to download") parser.add_argument("-o", "--output", type=str, required=True, metavar="<output-file>", help="Output file path") return parser.parse_args()
[ "def", "parse_arguments", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "\"source_url\"", ",", "type", "=", "str", ",", "metavar", "=", "\"<source-url>\"", ",", "help", "=", "\"Source URL to download\"", ")", "parser", ".", "add_argument", "(", "\"-o\"", ",", "\"--output\"", ",", "type", "=", "str", ",", "required", "=", "True", ",", "metavar", "=", "\"<output-file>\"", ",", "help", "=", "\"Output file path\"", ")", "return", "parser", ".", "parse_args", "(", ")" ]
https://github.com/google/iree/blob/1224bbdbe65b0d1fdf40e7324f60f68beeaf7c76/scripts/download_file.py#L16-L29
mindspore-ai/mindspore
fb8fd3338605bb34fa5cea054e535a8b1d753fab
mindspore/python/mindspore/profiler/parser/integrator.py
python
Integrator._query_and_sort_by_op_type
(self, filter_condition, op_type_order: list)
return { 'col_name_detail': self._display_col_names_detail, 'object': result }
Query the AICORE operator detail information by `filter_condition`, and sort by `op_type_order` and execution time. Args: filter_condition (dict): The filter condition. op_type_order (list[str]): The name of the operator type in order. Returns: dict, The results are filtered and sorted.
Query the AICORE operator detail information by `filter_condition`, and sort by `op_type_order` and execution time.
[ "Query", "the", "AICORE", "operator", "detail", "information", "by", "filter_condition", "and", "sort", "by", "op_type_order", "and", "execution", "time", "." ]
def _query_and_sort_by_op_type(self, filter_condition, op_type_order: list): """ Query the AICORE operator detail information by `filter_condition`, and sort by `op_type_order` and execution time. Args: filter_condition (dict): The filter condition. op_type_order (list[str]): The name of the operator type in order. Returns: dict, The results are filtered and sorted. """ self._aicore_detail_data_load() if filter_condition is None: filter_condition = {} self._filter(filter_condition) type_detail_cache = {} for detail_info in self._result: op_type = detail_info[1] if op_type not in op_type_order: continue infos = type_detail_cache.get(op_type) if infos: infos.append(detail_info) else: type_detail_cache[op_type] = [detail_info] result = [] for op_type in op_type_order: detail_infos = type_detail_cache.get(op_type) if detail_infos is None: continue detail_infos.sort(key=lambda item: item[2], reverse=True) result.extend(detail_infos) return { 'col_name_detail': self._display_col_names_detail, 'object': result }
[ "def", "_query_and_sort_by_op_type", "(", "self", ",", "filter_condition", ",", "op_type_order", ":", "list", ")", ":", "self", ".", "_aicore_detail_data_load", "(", ")", "if", "filter_condition", "is", "None", ":", "filter_condition", "=", "{", "}", "self", ".", "_filter", "(", "filter_condition", ")", "type_detail_cache", "=", "{", "}", "for", "detail_info", "in", "self", ".", "_result", ":", "op_type", "=", "detail_info", "[", "1", "]", "if", "op_type", "not", "in", "op_type_order", ":", "continue", "infos", "=", "type_detail_cache", ".", "get", "(", "op_type", ")", "if", "infos", ":", "infos", ".", "append", "(", "detail_info", ")", "else", ":", "type_detail_cache", "[", "op_type", "]", "=", "[", "detail_info", "]", "result", "=", "[", "]", "for", "op_type", "in", "op_type_order", ":", "detail_infos", "=", "type_detail_cache", ".", "get", "(", "op_type", ")", "if", "detail_infos", "is", "None", ":", "continue", "detail_infos", ".", "sort", "(", "key", "=", "lambda", "item", ":", "item", "[", "2", "]", ",", "reverse", "=", "True", ")", "result", ".", "extend", "(", "detail_infos", ")", "return", "{", "'col_name_detail'", ":", "self", ".", "_display_col_names_detail", ",", "'object'", ":", "result", "}" ]
https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/profiler/parser/integrator.py#L361-L400
livecode/livecode
4606a10ea10b16d5071d0f9f263ccdd7ede8b31d
gyp/pylib/gyp/MSVSSettings.py
python
ValidateMSBuildSettings
(settings, stderr=sys.stderr)
Validates that the names of the settings are valid for MSBuild. Args: settings: A dictionary. The key is the tool name. The values are themselves dictionaries of settings and their values. stderr: The stream receiving the error messages.
Validates that the names of the settings are valid for MSBuild.
[ "Validates", "that", "the", "names", "of", "the", "settings", "are", "valid", "for", "MSBuild", "." ]
def ValidateMSBuildSettings(settings, stderr=sys.stderr): """Validates that the names of the settings are valid for MSBuild. Args: settings: A dictionary. The key is the tool name. The values are themselves dictionaries of settings and their values. stderr: The stream receiving the error messages. """ _ValidateSettings(_msbuild_validators, settings, stderr)
[ "def", "ValidateMSBuildSettings", "(", "settings", ",", "stderr", "=", "sys", ".", "stderr", ")", ":", "_ValidateSettings", "(", "_msbuild_validators", ",", "settings", ",", "stderr", ")" ]
https://github.com/livecode/livecode/blob/4606a10ea10b16d5071d0f9f263ccdd7ede8b31d/gyp/pylib/gyp/MSVSSettings.py#L491-L499
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/_core.py
python
Image.HSVtoRGB
(*args, **kwargs)
return _core_.Image_HSVtoRGB(*args, **kwargs)
HSVtoRGB(Image_HSVValue hsv) -> Image_RGBValue Converts a color in HSV color space to RGB color space.
HSVtoRGB(Image_HSVValue hsv) -> Image_RGBValue
[ "HSVtoRGB", "(", "Image_HSVValue", "hsv", ")", "-", ">", "Image_RGBValue" ]
def HSVtoRGB(*args, **kwargs): """ HSVtoRGB(Image_HSVValue hsv) -> Image_RGBValue Converts a color in HSV color space to RGB color space. """ return _core_.Image_HSVtoRGB(*args, **kwargs)
[ "def", "HSVtoRGB", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core_", ".", "Image_HSVtoRGB", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L3670-L3676
facebookresearch/minirts
859e747a5e2fab2355bea083daffa6a36820a7f2
scripts/behavior_clone/cmd_heads.py
python
DotMoveHead.forward
(self, ufeat, mapfeat, globfeat)
return logit
ufeat: [batch, pnum_unit, ufeat_dim] mapfeat: [batch, x*y, mapfeat_dim] globfeat: [batch, pnum_unit, globfeat_dim] return logit: [batch, pnum_unit, mapfeat_dim]
ufeat: [batch, pnum_unit, ufeat_dim] mapfeat: [batch, x*y, mapfeat_dim] globfeat: [batch, pnum_unit, globfeat_dim]
[ "ufeat", ":", "[", "batch", "pnum_unit", "ufeat_dim", "]", "mapfeat", ":", "[", "batch", "x", "*", "y", "mapfeat_dim", "]", "globfeat", ":", "[", "batch", "pnum_unit", "globfeat_dim", "]" ]
def forward(self, ufeat, mapfeat, globfeat): """ ufeat: [batch, pnum_unit, ufeat_dim] mapfeat: [batch, x*y, mapfeat_dim] globfeat: [batch, pnum_unit, globfeat_dim] return logit: [batch, pnum_unit, mapfeat_dim] """ pnum_unit = ufeat.size(1) map_dim = mapfeat.size(1) assert globfeat is None and self.globfeat_dim == 0 infeat = ufeat#, globfeat], 2) proj = self.net(infeat) proj = proj.unsqueeze(2).repeat(1, 1, map_dim, 1) mapfeat = mapfeat.unsqueeze(1).repeat(1, pnum_unit, 1, 1) logit = (proj * mapfeat).sum(3) / self.norm return logit
[ "def", "forward", "(", "self", ",", "ufeat", ",", "mapfeat", ",", "globfeat", ")", ":", "pnum_unit", "=", "ufeat", ".", "size", "(", "1", ")", "map_dim", "=", "mapfeat", ".", "size", "(", "1", ")", "assert", "globfeat", "is", "None", "and", "self", ".", "globfeat_dim", "==", "0", "infeat", "=", "ufeat", "#, globfeat], 2)", "proj", "=", "self", ".", "net", "(", "infeat", ")", "proj", "=", "proj", ".", "unsqueeze", "(", "2", ")", ".", "repeat", "(", "1", ",", "1", ",", "map_dim", ",", "1", ")", "mapfeat", "=", "mapfeat", ".", "unsqueeze", "(", "1", ")", ".", "repeat", "(", "1", ",", "pnum_unit", ",", "1", ",", "1", ")", "logit", "=", "(", "proj", "*", "mapfeat", ")", ".", "sum", "(", "3", ")", "/", "self", ".", "norm", "return", "logit" ]
https://github.com/facebookresearch/minirts/blob/859e747a5e2fab2355bea083daffa6a36820a7f2/scripts/behavior_clone/cmd_heads.py#L217-L234
CGRU/cgru
1881a4128530e3d31ac6c25314c18314fc50c2c7
lib/python/cgruutils.py
python
getIconFileName
(iconname)
return None
Missing DocString :param iconname: :return:
Missing DocString
[ "Missing", "DocString" ]
def getIconFileName(iconname): """Missing DocString :param iconname: :return: """ icon_path = os.path.join( os.path.join( cgruconfig.VARS['CGRU_LOCATION'], 'icons' ) ) icon_paths = cgruconfig.VARS['icons_path'] if icon_paths is None: icon_paths = icon_path if icon_paths.find(';') != -1: icon_paths = icon_paths.split(';') elif sys.platform.find('win') == -1: icon_paths = icon_paths.split(':') else: icon_paths = [icon_paths] if not icon_path in icon_paths: icon_paths.append(icon_path) for icon_path in icon_paths: icon_path = os.path.join(icon_path, iconname) if os.path.isfile(icon_path): return icon_path icon_path += '.png' if os.path.isfile(icon_path): return icon_path return None
[ "def", "getIconFileName", "(", "iconname", ")", ":", "icon_path", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "join", "(", "cgruconfig", ".", "VARS", "[", "'CGRU_LOCATION'", "]", ",", "'icons'", ")", ")", "icon_paths", "=", "cgruconfig", ".", "VARS", "[", "'icons_path'", "]", "if", "icon_paths", "is", "None", ":", "icon_paths", "=", "icon_path", "if", "icon_paths", ".", "find", "(", "';'", ")", "!=", "-", "1", ":", "icon_paths", "=", "icon_paths", ".", "split", "(", "';'", ")", "elif", "sys", ".", "platform", ".", "find", "(", "'win'", ")", "==", "-", "1", ":", "icon_paths", "=", "icon_paths", ".", "split", "(", "':'", ")", "else", ":", "icon_paths", "=", "[", "icon_paths", "]", "if", "not", "icon_path", "in", "icon_paths", ":", "icon_paths", ".", "append", "(", "icon_path", ")", "for", "icon_path", "in", "icon_paths", ":", "icon_path", "=", "os", ".", "path", ".", "join", "(", "icon_path", ",", "iconname", ")", "if", "os", ".", "path", ".", "isfile", "(", "icon_path", ")", ":", "return", "icon_path", "icon_path", "+=", "'.png'", "if", "os", ".", "path", ".", "isfile", "(", "icon_path", ")", ":", "return", "icon_path", "return", "None" ]
https://github.com/CGRU/cgru/blob/1881a4128530e3d31ac6c25314c18314fc50c2c7/lib/python/cgruutils.py#L307-L343
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/contrib/labeled_tensor/python/ops/core.py
python
Axis.labels
(self)
return self._labels
Returns the tuple containing coordinate labels, else None.
Returns the tuple containing coordinate labels, else None.
[ "Returns", "the", "tuple", "containing", "coordinate", "labels", "else", "None", "." ]
def labels(self): """Returns the tuple containing coordinate labels, else None.""" return self._labels
[ "def", "labels", "(", "self", ")", ":", "return", "self", ".", "_labels" ]
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/labeled_tensor/python/ops/core.py#L163-L165
microsoft/DirectXShaderCompiler
8348ff8d9e0287610ba05d3a828e10af981a1c05
tools/clang/utils/check_cfc/check_cfc.py
python
get_input_file
(args)
Return the input file string if it can be found (and there is only one).
Return the input file string if it can be found (and there is only one).
[ "Return", "the", "input", "file", "string", "if", "it", "can", "be", "found", "(", "and", "there", "is", "only", "one", ")", "." ]
def get_input_file(args): """Return the input file string if it can be found (and there is only one).""" inputFiles = list() for arg in args: testarg = arg quotes = ('"', "'") while testarg.endswith(quotes): testarg = testarg[:-1] testarg = os.path.normcase(testarg) # Test if it is a source file if testarg.endswith(gSrcFileSuffixes): inputFiles.append(arg) if len(inputFiles) == 1: return inputFiles[0] else: return None
[ "def", "get_input_file", "(", "args", ")", ":", "inputFiles", "=", "list", "(", ")", "for", "arg", "in", "args", ":", "testarg", "=", "arg", "quotes", "=", "(", "'\"'", ",", "\"'\"", ")", "while", "testarg", ".", "endswith", "(", "quotes", ")", ":", "testarg", "=", "testarg", "[", ":", "-", "1", "]", "testarg", "=", "os", ".", "path", ".", "normcase", "(", "testarg", ")", "# Test if it is a source file", "if", "testarg", ".", "endswith", "(", "gSrcFileSuffixes", ")", ":", "inputFiles", ".", "append", "(", "arg", ")", "if", "len", "(", "inputFiles", ")", "==", "1", ":", "return", "inputFiles", "[", "0", "]", "else", ":", "return", "None" ]
https://github.com/microsoft/DirectXShaderCompiler/blob/8348ff8d9e0287610ba05d3a828e10af981a1c05/tools/clang/utils/check_cfc/check_cfc.py#L184-L201
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/propgrid.py
python
PropertyGridManager.GetValuesFromPage
(self, page, dict_=None, as_strings=False, inc_attributes=False)
return page.GetPropertyValues(dict_, as_strings, inc_attributes)
Same as GetValues, but returns values from specific page only.
Same as GetValues, but returns values from specific page only.
[ "Same", "as", "GetValues", "but", "returns", "values", "from", "specific", "page", "only", "." ]
def GetValuesFromPage(self, page, dict_=None, as_strings=False, inc_attributes=False): "Same as GetValues, but returns values from specific page only." "For argument descriptions, see GetValues." return page.GetPropertyValues(dict_, as_strings, inc_attributes)
[ "def", "GetValuesFromPage", "(", "self", ",", "page", ",", "dict_", "=", "None", ",", "as_strings", "=", "False", ",", "inc_attributes", "=", "False", ")", ":", "\"For argument descriptions, see GetValues.\"", "return", "page", ".", "GetPropertyValues", "(", "dict_", ",", "as_strings", ",", "inc_attributes", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/propgrid.py#L3642-L3649
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/propgrid.py
python
PropertyGrid.IsMainButtonEvent
(*args, **kwargs)
return _propgrid.PropertyGrid_IsMainButtonEvent(*args, **kwargs)
IsMainButtonEvent(self, Event event) -> bool
IsMainButtonEvent(self, Event event) -> bool
[ "IsMainButtonEvent", "(", "self", "Event", "event", ")", "-", ">", "bool" ]
def IsMainButtonEvent(*args, **kwargs): """IsMainButtonEvent(self, Event event) -> bool""" return _propgrid.PropertyGrid_IsMainButtonEvent(*args, **kwargs)
[ "def", "IsMainButtonEvent", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_propgrid", ".", "PropertyGrid_IsMainButtonEvent", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/propgrid.py#L2431-L2433
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/contrib/keras/python/keras/utils/generic_utils.py
python
func_load
(code, defaults=None, closure=None, globs=None)
return python_types.FunctionType( code, globs, name=code.co_name, argdefs=defaults, closure=closure)
Deserializes a user defined function. Arguments: code: bytecode of the function. defaults: defaults of the function. closure: closure of the function. globs: dictionary of global objects. Returns: A function object.
Deserializes a user defined function.
[ "Deserializes", "a", "user", "defined", "function", "." ]
def func_load(code, defaults=None, closure=None, globs=None): """Deserializes a user defined function. Arguments: code: bytecode of the function. defaults: defaults of the function. closure: closure of the function. globs: dictionary of global objects. Returns: A function object. """ if isinstance(code, (tuple, list)): # unpack previous dump code, defaults, closure = code if isinstance(defaults, list): defaults = tuple(defaults) code = marshal.loads(code.encode('raw_unicode_escape')) if globs is None: globs = globals() return python_types.FunctionType( code, globs, name=code.co_name, argdefs=defaults, closure=closure)
[ "def", "func_load", "(", "code", ",", "defaults", "=", "None", ",", "closure", "=", "None", ",", "globs", "=", "None", ")", ":", "if", "isinstance", "(", "code", ",", "(", "tuple", ",", "list", ")", ")", ":", "# unpack previous dump", "code", ",", "defaults", ",", "closure", "=", "code", "if", "isinstance", "(", "defaults", ",", "list", ")", ":", "defaults", "=", "tuple", "(", "defaults", ")", "code", "=", "marshal", ".", "loads", "(", "code", ".", "encode", "(", "'raw_unicode_escape'", ")", ")", "if", "globs", "is", "None", ":", "globs", "=", "globals", "(", ")", "return", "python_types", ".", "FunctionType", "(", "code", ",", "globs", ",", "name", "=", "code", ".", "co_name", ",", "argdefs", "=", "defaults", ",", "closure", "=", "closure", ")" ]
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/keras/python/keras/utils/generic_utils.py#L207-L227
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/tkinter/__init__.py
python
Misc.tk_focusNext
(self)
return self._nametowidget(name)
Return the next widget in the focus order which follows widget which has currently the focus. The focus order first goes to the next child, then to the children of the child recursively and then to the next sibling which is higher in the stacking order. A widget is omitted if it has the takefocus resource set to 0.
Return the next widget in the focus order which follows widget which has currently the focus.
[ "Return", "the", "next", "widget", "in", "the", "focus", "order", "which", "follows", "widget", "which", "has", "currently", "the", "focus", "." ]
def tk_focusNext(self): """Return the next widget in the focus order which follows widget which has currently the focus. The focus order first goes to the next child, then to the children of the child recursively and then to the next sibling which is higher in the stacking order. A widget is omitted if it has the takefocus resource set to 0.""" name = self.tk.call('tk_focusNext', self._w) if not name: return None return self._nametowidget(name)
[ "def", "tk_focusNext", "(", "self", ")", ":", "name", "=", "self", ".", "tk", ".", "call", "(", "'tk_focusNext'", ",", "self", ".", "_w", ")", "if", "not", "name", ":", "return", "None", "return", "self", ".", "_nametowidget", "(", "name", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/tkinter/__init__.py#L718-L729
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/core/overrides.py
python
array_function_dispatch
(dispatcher, module=None, verify=True, docs_from_dispatcher=False)
return decorator
Decorator for adding dispatch with the __array_function__ protocol. See NEP-18 for example usage. Parameters ---------- dispatcher : callable Function that when called like ``dispatcher(*args, **kwargs)`` with arguments from the NumPy function call returns an iterable of array-like arguments to check for ``__array_function__``. module : str, optional __module__ attribute to set on new function, e.g., ``module='numpy'``. By default, module is copied from the decorated function. verify : bool, optional If True, verify the that the signature of the dispatcher and decorated function signatures match exactly: all required and optional arguments should appear in order with the same names, but the default values for all optional arguments should be ``None``. Only disable verification if the dispatcher's signature needs to deviate for some particular reason, e.g., because the function has a signature like ``func(*args, **kwargs)``. docs_from_dispatcher : bool, optional If True, copy docs from the dispatcher function onto the dispatched function, rather than from the implementation. This is useful for functions defined in C, which otherwise don't have docstrings. Returns ------- Function suitable for decorating the implementation of a NumPy function.
Decorator for adding dispatch with the __array_function__ protocol.
[ "Decorator", "for", "adding", "dispatch", "with", "the", "__array_function__", "protocol", "." ]
def array_function_dispatch(dispatcher, module=None, verify=True, docs_from_dispatcher=False): """Decorator for adding dispatch with the __array_function__ protocol. See NEP-18 for example usage. Parameters ---------- dispatcher : callable Function that when called like ``dispatcher(*args, **kwargs)`` with arguments from the NumPy function call returns an iterable of array-like arguments to check for ``__array_function__``. module : str, optional __module__ attribute to set on new function, e.g., ``module='numpy'``. By default, module is copied from the decorated function. verify : bool, optional If True, verify the that the signature of the dispatcher and decorated function signatures match exactly: all required and optional arguments should appear in order with the same names, but the default values for all optional arguments should be ``None``. Only disable verification if the dispatcher's signature needs to deviate for some particular reason, e.g., because the function has a signature like ``func(*args, **kwargs)``. docs_from_dispatcher : bool, optional If True, copy docs from the dispatcher function onto the dispatched function, rather than from the implementation. This is useful for functions defined in C, which otherwise don't have docstrings. Returns ------- Function suitable for decorating the implementation of a NumPy function. """ if not ARRAY_FUNCTION_ENABLED: def decorator(implementation): if docs_from_dispatcher: add_docstring(implementation, dispatcher.__doc__) if module is not None: implementation.__module__ = module return implementation return decorator def decorator(implementation): if verify: verify_matching_signatures(implementation, dispatcher) if docs_from_dispatcher: add_docstring(implementation, dispatcher.__doc__) # Equivalently, we could define this function directly instead of using # exec. This version has the advantage of giving the helper function a # more interpettable name. Otherwise, the original function does not # show up at all in many cases, e.g., if it's written in C or if the # dispatcher gets an invalid keyword argument. source = _wrapped_func_source.format(name=implementation.__name__) source_object = compile( source, filename='<__array_function__ internals>', mode='exec') scope = { 'implementation': implementation, 'dispatcher': dispatcher, 'functools': functools, 'implement_array_function': implement_array_function, } exec(source_object, scope) public_api = scope[implementation.__name__] if module is not None: public_api.__module__ = module public_api._implementation = implementation return public_api return decorator
[ "def", "array_function_dispatch", "(", "dispatcher", ",", "module", "=", "None", ",", "verify", "=", "True", ",", "docs_from_dispatcher", "=", "False", ")", ":", "if", "not", "ARRAY_FUNCTION_ENABLED", ":", "def", "decorator", "(", "implementation", ")", ":", "if", "docs_from_dispatcher", ":", "add_docstring", "(", "implementation", ",", "dispatcher", ".", "__doc__", ")", "if", "module", "is", "not", "None", ":", "implementation", ".", "__module__", "=", "module", "return", "implementation", "return", "decorator", "def", "decorator", "(", "implementation", ")", ":", "if", "verify", ":", "verify_matching_signatures", "(", "implementation", ",", "dispatcher", ")", "if", "docs_from_dispatcher", ":", "add_docstring", "(", "implementation", ",", "dispatcher", ".", "__doc__", ")", "# Equivalently, we could define this function directly instead of using", "# exec. This version has the advantage of giving the helper function a", "# more interpettable name. Otherwise, the original function does not", "# show up at all in many cases, e.g., if it's written in C or if the", "# dispatcher gets an invalid keyword argument.", "source", "=", "_wrapped_func_source", ".", "format", "(", "name", "=", "implementation", ".", "__name__", ")", "source_object", "=", "compile", "(", "source", ",", "filename", "=", "'<__array_function__ internals>'", ",", "mode", "=", "'exec'", ")", "scope", "=", "{", "'implementation'", ":", "implementation", ",", "'dispatcher'", ":", "dispatcher", ",", "'functools'", ":", "functools", ",", "'implement_array_function'", ":", "implement_array_function", ",", "}", "exec", "(", "source_object", ",", "scope", ")", "public_api", "=", "scope", "[", "implementation", ".", "__name__", "]", "if", "module", "is", "not", "None", ":", "public_api", ".", "__module__", "=", "module", "public_api", ".", "_implementation", "=", "implementation", "return", "public_api", "return", "decorator" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/core/overrides.py#L124-L199
lballabio/quantlib-old
136336947ed4fea9ecc1da6edad188700e821739
gensrc/gensrc/configuration/environment.py
python
Environment.addinConfigPath
(self)
return self.addinConfigPath_
Return the current working directory.
Return the current working directory.
[ "Return", "the", "current", "working", "directory", "." ]
def addinConfigPath(self): """Return the current working directory.""" return self.addinConfigPath_
[ "def", "addinConfigPath", "(", "self", ")", ":", "return", "self", ".", "addinConfigPath_" ]
https://github.com/lballabio/quantlib-old/blob/136336947ed4fea9ecc1da6edad188700e821739/gensrc/gensrc/configuration/environment.py#L50-L52
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/py2/scipy/stats/mstats_basic.py
python
count_tied_groups
(x, use_missing=False)
return nties
Counts the number of tied values. Parameters ---------- x : sequence Sequence of data on which to counts the ties use_missing : bool, optional Whether to consider missing values as tied. Returns ------- count_tied_groups : dict Returns a dictionary (nb of ties: nb of groups). Examples -------- >>> from scipy.stats import mstats >>> z = [0, 0, 0, 2, 2, 2, 3, 3, 4, 5, 6] >>> mstats.count_tied_groups(z) {2: 1, 3: 2} In the above example, the ties were 0 (3x), 2 (3x) and 3 (2x). >>> z = np.ma.array([0, 0, 1, 2, 2, 2, 3, 3, 4, 5, 6]) >>> mstats.count_tied_groups(z) {2: 2, 3: 1} >>> z[[1,-1]] = np.ma.masked >>> mstats.count_tied_groups(z, use_missing=True) {2: 2, 3: 1}
Counts the number of tied values.
[ "Counts", "the", "number", "of", "tied", "values", "." ]
def count_tied_groups(x, use_missing=False): """ Counts the number of tied values. Parameters ---------- x : sequence Sequence of data on which to counts the ties use_missing : bool, optional Whether to consider missing values as tied. Returns ------- count_tied_groups : dict Returns a dictionary (nb of ties: nb of groups). Examples -------- >>> from scipy.stats import mstats >>> z = [0, 0, 0, 2, 2, 2, 3, 3, 4, 5, 6] >>> mstats.count_tied_groups(z) {2: 1, 3: 2} In the above example, the ties were 0 (3x), 2 (3x) and 3 (2x). >>> z = np.ma.array([0, 0, 1, 2, 2, 2, 3, 3, 4, 5, 6]) >>> mstats.count_tied_groups(z) {2: 2, 3: 1} >>> z[[1,-1]] = np.ma.masked >>> mstats.count_tied_groups(z, use_missing=True) {2: 2, 3: 1} """ nmasked = ma.getmask(x).sum() # We need the copy as find_repeats will overwrite the initial data data = ma.compressed(x).copy() (ties, counts) = find_repeats(data) nties = {} if len(ties): nties = dict(zip(np.unique(counts), itertools.repeat(1))) nties.update(dict(zip(*find_repeats(counts)))) if nmasked and use_missing: try: nties[nmasked] += 1 except KeyError: nties[nmasked] = 1 return nties
[ "def", "count_tied_groups", "(", "x", ",", "use_missing", "=", "False", ")", ":", "nmasked", "=", "ma", ".", "getmask", "(", "x", ")", ".", "sum", "(", ")", "# We need the copy as find_repeats will overwrite the initial data", "data", "=", "ma", ".", "compressed", "(", "x", ")", ".", "copy", "(", ")", "(", "ties", ",", "counts", ")", "=", "find_repeats", "(", "data", ")", "nties", "=", "{", "}", "if", "len", "(", "ties", ")", ":", "nties", "=", "dict", "(", "zip", "(", "np", ".", "unique", "(", "counts", ")", ",", "itertools", ".", "repeat", "(", "1", ")", ")", ")", "nties", ".", "update", "(", "dict", "(", "zip", "(", "*", "find_repeats", "(", "counts", ")", ")", ")", ")", "if", "nmasked", "and", "use_missing", ":", "try", ":", "nties", "[", "nmasked", "]", "+=", "1", "except", "KeyError", ":", "nties", "[", "nmasked", "]", "=", "1", "return", "nties" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/stats/mstats_basic.py#L172-L220
hughperkins/tf-coriander
970d3df6c11400ad68405f22b0c42a52374e94ca
tensorflow/python/training/optimizer.py
python
Optimizer._apply_sparse
(self, grad, var)
Add ops to apply sparse gradients to `var`. Args: grad: `IndexedSlices`. var: A `Variable` object. Return: An `Operation`.
Add ops to apply sparse gradients to `var`.
[ "Add", "ops", "to", "apply", "sparse", "gradients", "to", "var", "." ]
def _apply_sparse(self, grad, var): """Add ops to apply sparse gradients to `var`. Args: grad: `IndexedSlices`. var: A `Variable` object. Return: An `Operation`. """ raise NotImplementedError()
[ "def", "_apply_sparse", "(", "self", ",", "grad", ",", "var", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/training/optimizer.py#L424-L434
rootm0s/Protectors
5b3f4d11687a5955caf9c3af30666c4bfc2c19ab
OWASP-ZSC/module/readline_windows/pyreadline/modes/notemacs.py
python
NotEmacsMode.digit_argument
(self, e)
Add this digit to the argument already accumulating, or start a new argument. M-- starts a negative argument.
Add this digit to the argument already accumulating, or start a new argument. M-- starts a negative argument.
[ "Add", "this", "digit", "to", "the", "argument", "already", "accumulating", "or", "start", "a", "new", "argument", ".", "M", "--", "starts", "a", "negative", "argument", "." ]
def digit_argument(self, e): # (M-0, M-1, ... M--) '''Add this digit to the argument already accumulating, or start a new argument. M-- starts a negative argument.''' pass
[ "def", "digit_argument", "(", "self", ",", "e", ")", ":", "# (M-0, M-1, ... M--)", "pass" ]
https://github.com/rootm0s/Protectors/blob/5b3f4d11687a5955caf9c3af30666c4bfc2c19ab/OWASP-ZSC/module/readline_windows/pyreadline/modes/notemacs.py#L443-L446
pmq20/node-packer
12c46c6e44fbc14d9ee645ebd17d5296b324f7e0
lts/tools/inspector_protocol/markupsafe/_native.py
python
soft_unicode
(s)
return s
Make a string unicode if it isn't already. That way a markup string is not converted back to unicode.
Make a string unicode if it isn't already. That way a markup string is not converted back to unicode.
[ "Make", "a", "string", "unicode", "if", "it", "isn", "t", "already", ".", "That", "way", "a", "markup", "string", "is", "not", "converted", "back", "to", "unicode", "." ]
def soft_unicode(s): """Make a string unicode if it isn't already. That way a markup string is not converted back to unicode. """ if not isinstance(s, text_type): s = text_type(s) return s
[ "def", "soft_unicode", "(", "s", ")", ":", "if", "not", "isinstance", "(", "s", ",", "text_type", ")", ":", "s", "=", "text_type", "(", "s", ")", "return", "s" ]
https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/tools/inspector_protocol/markupsafe/_native.py#L40-L46
miyosuda/TensorFlowAndroidDemo
35903e0221aa5f109ea2dbef27f20b52e317f42d
jni-build/jni/include/tensorflow/python/ops/linalg_ops.py
python
_BatchSvdShape
(op)
return _SvdShapeHelper(op.inputs[0].get_shape().with_rank_at_least(2), op)
Shape function for batch SVD op.
Shape function for batch SVD op.
[ "Shape", "function", "for", "batch", "SVD", "op", "." ]
def _BatchSvdShape(op): """Shape function for batch SVD op.""" return _SvdShapeHelper(op.inputs[0].get_shape().with_rank_at_least(2), op)
[ "def", "_BatchSvdShape", "(", "op", ")", ":", "return", "_SvdShapeHelper", "(", "op", ".", "inputs", "[", "0", "]", ".", "get_shape", "(", ")", ".", "with_rank_at_least", "(", "2", ")", ",", "op", ")" ]
https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/linalg_ops.py#L156-L158
miyosuda/TensorFlowAndroidMNIST
7b5a4603d2780a8a2834575706e9001977524007
jni-build/jni/include/tensorflow/python/tools/inspect_checkpoint.py
python
print_tensors_in_checkpoint_file
(file_name, tensor_name)
Prints tensors in a checkpoint file. If no `tensor_name` is provided, prints the tensor names and shapes in the checkpoint file. If `tensor_name` is provided, prints the content of the tensor. Args: file_name: Name of the checkpoint file. tensor_name: Name of the tensor in the checkpoint file to print.
Prints tensors in a checkpoint file.
[ "Prints", "tensors", "in", "a", "checkpoint", "file", "." ]
def print_tensors_in_checkpoint_file(file_name, tensor_name): """Prints tensors in a checkpoint file. If no `tensor_name` is provided, prints the tensor names and shapes in the checkpoint file. If `tensor_name` is provided, prints the content of the tensor. Args: file_name: Name of the checkpoint file. tensor_name: Name of the tensor in the checkpoint file to print. """ try: reader = tf.train.NewCheckpointReader(file_name) if not tensor_name: print(reader.debug_string().decode("utf-8")) else: print("tensor_name: ", tensor_name) print(reader.get_tensor(tensor_name)) except Exception as e: # pylint: disable=broad-except print(str(e)) if "corrupted compressed block contents" in str(e): print("It's likely that your checkpoint file has been compressed " "with SNAPPY.")
[ "def", "print_tensors_in_checkpoint_file", "(", "file_name", ",", "tensor_name", ")", ":", "try", ":", "reader", "=", "tf", ".", "train", ".", "NewCheckpointReader", "(", "file_name", ")", "if", "not", "tensor_name", ":", "print", "(", "reader", ".", "debug_string", "(", ")", ".", "decode", "(", "\"utf-8\"", ")", ")", "else", ":", "print", "(", "\"tensor_name: \"", ",", "tensor_name", ")", "print", "(", "reader", ".", "get_tensor", "(", "tensor_name", ")", ")", "except", "Exception", "as", "e", ":", "# pylint: disable=broad-except", "print", "(", "str", "(", "e", ")", ")", "if", "\"corrupted compressed block contents\"", "in", "str", "(", "e", ")", ":", "print", "(", "\"It's likely that your checkpoint file has been compressed \"", "\"with SNAPPY.\"", ")" ]
https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/tools/inspect_checkpoint.py#L30-L53
yyzybb537/libgo
4af17b7c67643c4d54aa354dcc77963ea07847d0
third_party/boost.context/tools/build/src/tools/common.py
python
find_tool
(name, additional_paths = [], path_last = False)
Attempts to find tool (binary) named 'name' in PATH and in 'additional-paths'. If found in path, returns 'name'. If found in additional paths, returns full name. If the tool is found in several directories, returns the first path found. Otherwise, returns the empty string. If 'path_last' is specified, path is checked after 'additional_paths'.
Attempts to find tool (binary) named 'name' in PATH and in 'additional-paths'. If found in path, returns 'name'. If found in additional paths, returns full name. If the tool is found in several directories, returns the first path found. Otherwise, returns the empty string. If 'path_last' is specified, path is checked after 'additional_paths'.
[ "Attempts", "to", "find", "tool", "(", "binary", ")", "named", "name", "in", "PATH", "and", "in", "additional", "-", "paths", ".", "If", "found", "in", "path", "returns", "name", ".", "If", "found", "in", "additional", "paths", "returns", "full", "name", ".", "If", "the", "tool", "is", "found", "in", "several", "directories", "returns", "the", "first", "path", "found", ".", "Otherwise", "returns", "the", "empty", "string", ".", "If", "path_last", "is", "specified", "path", "is", "checked", "after", "additional_paths", "." ]
def find_tool(name, additional_paths = [], path_last = False): """ Attempts to find tool (binary) named 'name' in PATH and in 'additional-paths'. If found in path, returns 'name'. If found in additional paths, returns full name. If the tool is found in several directories, returns the first path found. Otherwise, returns the empty string. If 'path_last' is specified, path is checked after 'additional_paths'. """ assert isinstance(name, basestring) assert is_iterable_typed(additional_paths, basestring) assert isinstance(path_last, (int, bool)) programs = path.programs_path() match = path.glob(programs, [name, name + '.exe']) additional_match = path.glob(additional_paths, [name, name + '.exe']) result = [] if path_last: result = additional_match if not result and match: result = match else: if match: result = match elif additional_match: result = additional_match if result: return path.native(result[0]) else: return ''
[ "def", "find_tool", "(", "name", ",", "additional_paths", "=", "[", "]", ",", "path_last", "=", "False", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "assert", "is_iterable_typed", "(", "additional_paths", ",", "basestring", ")", "assert", "isinstance", "(", "path_last", ",", "(", "int", ",", "bool", ")", ")", "programs", "=", "path", ".", "programs_path", "(", ")", "match", "=", "path", ".", "glob", "(", "programs", ",", "[", "name", ",", "name", "+", "'.exe'", "]", ")", "additional_match", "=", "path", ".", "glob", "(", "additional_paths", ",", "[", "name", ",", "name", "+", "'.exe'", "]", ")", "result", "=", "[", "]", "if", "path_last", ":", "result", "=", "additional_match", "if", "not", "result", "and", "match", ":", "result", "=", "match", "else", ":", "if", "match", ":", "result", "=", "match", "elif", "additional_match", ":", "result", "=", "additional_match", "if", "result", ":", "return", "path", ".", "native", "(", "result", "[", "0", "]", ")", "else", ":", "return", "''" ]
https://github.com/yyzybb537/libgo/blob/4af17b7c67643c4d54aa354dcc77963ea07847d0/third_party/boost.context/tools/build/src/tools/common.py#L370-L402
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/graphics.py
python
GraphicsContext.Rotate
(self, angle)
Modifies the current transformation matrix by rotating the user-space axes by angle radians.
Modifies the current transformation matrix by rotating the user-space axes by angle radians.
[ "Modifies", "the", "current", "transformation", "matrix", "by", "rotating", "the", "user", "-", "space", "axes", "by", "angle", "radians", "." ]
def Rotate(self, angle): """ Modifies the current transformation matrix by rotating the user-space axes by angle radians. """ self._context.rotate(angle)
[ "def", "Rotate", "(", "self", ",", "angle", ")", ":", "self", ".", "_context", ".", "rotate", "(", "angle", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/graphics.py#L1210-L1215
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/agw/advancedsplash.py
python
AdvancedSplash.OnCharEvents
(self, event)
Handles the ``wx.EVT_CHAR`` event for :class:`AdvancedSplash`. :param `event`: a :class:`KeyEvent` to be processed. :note: This reproduces the behavior of :class:`SplashScreen`.
Handles the ``wx.EVT_CHAR`` event for :class:`AdvancedSplash`.
[ "Handles", "the", "wx", ".", "EVT_CHAR", "event", "for", ":", "class", ":", "AdvancedSplash", "." ]
def OnCharEvents(self, event): """ Handles the ``wx.EVT_CHAR`` event for :class:`AdvancedSplash`. :param `event`: a :class:`KeyEvent` to be processed. :note: This reproduces the behavior of :class:`SplashScreen`. """ self.Close()
[ "def", "OnCharEvents", "(", "self", ",", "event", ")", ":", "self", ".", "Close", "(", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/advancedsplash.py#L368-L377
INK-USC/USC-DS-RelationExtraction
eebcfa7fd2eda5bba92f3ef8158797cdf91e6981
code/Model/baselines/hypenet/evaluation.py
python
evaluate_rm
(prediction, ground_truth)
return precision, recall, f1
Evaluation matrix. :param prediction: a dictionary of labels. e.g {0:[1,0],1:[2],2:[3,4],3:[5,6,7]} :param ground_truth: a dictionary of labels :return:
Evaluation matrix. :param prediction: a dictionary of labels. e.g {0:[1,0],1:[2],2:[3,4],3:[5,6,7]} :param ground_truth: a dictionary of labels :return:
[ "Evaluation", "matrix", ".", ":", "param", "prediction", ":", "a", "dictionary", "of", "labels", ".", "e", ".", "g", "{", "0", ":", "[", "1", "0", "]", "1", ":", "[", "2", "]", "2", ":", "[", "3", "4", "]", "3", ":", "[", "5", "6", "7", "]", "}", ":", "param", "ground_truth", ":", "a", "dictionary", "of", "labels", ":", "return", ":" ]
def evaluate_rm(prediction, ground_truth): """ Evaluation matrix. :param prediction: a dictionary of labels. e.g {0:[1,0],1:[2],2:[3,4],3:[5,6,7]} :param ground_truth: a dictionary of labels :return: """ pos_pred = 0.0 pos_gt = 0.0 + len(ground_truth) true_pos = 0.0 for i in prediction: # classified as pos example (Is-A-Relation) pos_pred += 1 if i in ground_truth and prediction[i] == ground_truth[i]: true_pos += 1.0 precision = true_pos / (pos_pred + 1e-8) recall = true_pos / (pos_gt + 1e-8) f1 = 2 * precision * recall / (precision + recall + 1e-8) # print "predicted # Pos RMs:%d, ground-truth #Pos RMs:%d"%(int(pos_pred), int(pos_gt)) return precision, recall, f1
[ "def", "evaluate_rm", "(", "prediction", ",", "ground_truth", ")", ":", "pos_pred", "=", "0.0", "pos_gt", "=", "0.0", "+", "len", "(", "ground_truth", ")", "true_pos", "=", "0.0", "for", "i", "in", "prediction", ":", "# classified as pos example (Is-A-Relation)", "pos_pred", "+=", "1", "if", "i", "in", "ground_truth", "and", "prediction", "[", "i", "]", "==", "ground_truth", "[", "i", "]", ":", "true_pos", "+=", "1.0", "precision", "=", "true_pos", "/", "(", "pos_pred", "+", "1e-8", ")", "recall", "=", "true_pos", "/", "(", "pos_gt", "+", "1e-8", ")", "f1", "=", "2", "*", "precision", "*", "recall", "/", "(", "precision", "+", "recall", "+", "1e-8", ")", "# print \"predicted # Pos RMs:%d, ground-truth #Pos RMs:%d\"%(int(pos_pred), int(pos_gt))", "return", "precision", ",", "recall", ",", "f1" ]
https://github.com/INK-USC/USC-DS-RelationExtraction/blob/eebcfa7fd2eda5bba92f3ef8158797cdf91e6981/code/Model/baselines/hypenet/evaluation.py#L100-L123
francinexue/xuefu
b6ff79747a42e020588c0c0a921048e08fe4680c
ctpx/ctp2/ctptd.py
python
CtpTd.onErrRtnRepealBankToFutureByFutureManual
(self, ReqRepealField, RspInfoField)
系统运行时期货端手工发起冲正银行转期货错误回报
系统运行时期货端手工发起冲正银行转期货错误回报
[ "系统运行时期货端手工发起冲正银行转期货错误回报" ]
def onErrRtnRepealBankToFutureByFutureManual(self, ReqRepealField, RspInfoField): """系统运行时期货端手工发起冲正银行转期货错误回报""" pass
[ "def", "onErrRtnRepealBankToFutureByFutureManual", "(", "self", ",", "ReqRepealField", ",", "RspInfoField", ")", ":", "pass" ]
https://github.com/francinexue/xuefu/blob/b6ff79747a42e020588c0c0a921048e08fe4680c/ctpx/ctp2/ctptd.py#L503-L505
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/python/ops/numerics.py
python
verify_tensor_all_finite
(t, msg, name=None)
return out
Assert that the tensor does not contain any NaN's or Inf's. Args: t: Tensor to check. msg: Message to log on failure. name: A name for this operation (optional). Returns: Same tensor as `t`.
Assert that the tensor does not contain any NaN's or Inf's.
[ "Assert", "that", "the", "tensor", "does", "not", "contain", "any", "NaN", "s", "or", "Inf", "s", "." ]
def verify_tensor_all_finite(t, msg, name=None): """Assert that the tensor does not contain any NaN's or Inf's. Args: t: Tensor to check. msg: Message to log on failure. name: A name for this operation (optional). Returns: Same tensor as `t`. """ with ops.name_scope(name, "VerifyFinite", [t]) as name: t = ops.convert_to_tensor(t, name="t") with ops.colocate_with(t): verify_input = array_ops.check_numerics(t, message=msg) out = control_flow_ops.with_dependencies([verify_input], t) return out
[ "def", "verify_tensor_all_finite", "(", "t", ",", "msg", ",", "name", "=", "None", ")", ":", "with", "ops", ".", "name_scope", "(", "name", ",", "\"VerifyFinite\"", ",", "[", "t", "]", ")", "as", "name", ":", "t", "=", "ops", ".", "convert_to_tensor", "(", "t", ",", "name", "=", "\"t\"", ")", "with", "ops", ".", "colocate_with", "(", "t", ")", ":", "verify_input", "=", "array_ops", ".", "check_numerics", "(", "t", ",", "message", "=", "msg", ")", "out", "=", "control_flow_ops", ".", "with_dependencies", "(", "[", "verify_input", "]", ",", "t", ")", "return", "out" ]
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/numerics.py#L28-L44
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/telemetry/third_party/mox3/mox3/mox.py
python
IgnoreArg.equals
(self, unused_rhs)
return True
Ignores arguments and returns True. Args: unused_rhs: any python object Returns: always returns True
Ignores arguments and returns True.
[ "Ignores", "arguments", "and", "returns", "True", "." ]
def equals(self, unused_rhs): """Ignores arguments and returns True. Args: unused_rhs: any python object Returns: always returns True """ return True
[ "def", "equals", "(", "self", ",", "unused_rhs", ")", ":", "return", "True" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/mox3/mox3/mox.py#L1861-L1871
mapsme/omim
1892903b63f2c85b16ed4966d21fe76aba06b9ba
tools/python/ResponseProvider.py
python
Payload.message
(self)
return self.__message
The message to send to the client.
The message to send to the client.
[ "The", "message", "to", "send", "to", "the", "client", "." ]
def message(self): """ The message to send to the client. """ return self.__message
[ "def", "message", "(", "self", ")", ":", "return", "self", ".", "__message" ]
https://github.com/mapsme/omim/blob/1892903b63f2c85b16ed4966d21fe76aba06b9ba/tools/python/ResponseProvider.py#L25-L29
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/_misc.py
python
MetafileDataObject.GetMetafile
(*args, **kwargs)
return _misc_.MetafileDataObject_GetMetafile(*args, **kwargs)
GetMetafile(self) -> MetaFile
GetMetafile(self) -> MetaFile
[ "GetMetafile", "(", "self", ")", "-", ">", "MetaFile" ]
def GetMetafile(*args, **kwargs): """GetMetafile(self) -> MetaFile""" return _misc_.MetafileDataObject_GetMetafile(*args, **kwargs)
[ "def", "GetMetafile", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_misc_", ".", "MetafileDataObject_GetMetafile", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L5473-L5475
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/contrib/learn/python/learn/monitors.py
python
BaseMonitor.begin
(self, max_steps=None)
Called at the beginning of training. When called, the default graph is the one we are executing. Args: max_steps: `int`, the maximum global step this training will run until. Raises: ValueError: if we've already begun a run.
Called at the beginning of training.
[ "Called", "at", "the", "beginning", "of", "training", "." ]
def begin(self, max_steps=None): """Called at the beginning of training. When called, the default graph is the one we are executing. Args: max_steps: `int`, the maximum global step this training will run until. Raises: ValueError: if we've already begun a run. """ if self._begun: raise ValueError("begin called twice without end.") self._max_steps = max_steps self._begun = True
[ "def", "begin", "(", "self", ",", "max_steps", "=", "None", ")", ":", "if", "self", ".", "_begun", ":", "raise", "ValueError", "(", "\"begin called twice without end.\"", ")", "self", ".", "_max_steps", "=", "max_steps", "self", ".", "_begun", "=", "True" ]
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/learn/python/learn/monitors.py#L98-L112
PaddlePaddle/Paddle
1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c
python/paddle/distributed/fleet/dataset/dataset.py
python
InMemoryDataset.update_settings
(self, **kwargs)
:api_attr: Static Graph should be called in user's python scripts to update setings of dataset instance. Args: kwargs: Keyword arguments. Currently, we support following keys in **kwargs, including single node settings and advanced distributed related settings: batch_size(int): batch size. It will be effective during training. default is 1. thread_num(int): thread num, it is the num of readers. default is 1. use_var(list): list of variables. Variables which you will use. default is []. input_type(int): the input type of generated input. 0 is for one sample, 1 is for one batch. defalut is 0. fs_name(str): fs name. default is "". fs_ugi(str): fs ugi. default is "". pipe_command(str): pipe command of current dataset. A pipe command is a UNIX pipeline command that can be used only. default is "cat" download_cmd(str): customized download command. default is "cat" data_feed_type(str): data feed type used in c++ code. default is "MultiSlotInMemoryDataFeed". queue_num(int): Dataset output queue num, training threads get data from queues. default is-1, which is set same as thread number in c++. merge_size(int): ins size to merge, if merge_size > 0, set merge by line id, instances of same line id will be merged after shuffle, you should parse line id in data generator. default is -1. parse_ins_id(bool): Set if Dataset need to parse ins_id. default is False. parse_content(bool): Set if Dataset need to parse content. default is False. fleet_send_batch_size(int): Set fleet send batch size in one rpc, default is 1024 fleet_send_sleep_seconds(int): Set fleet send sleep time, default is 0 fea_eval(bool): Set if Dataset need to do feature importance evaluation using slots shuffle. default is False. candidate_size(int): if fea_eval is set True, set the candidate size used in slots shuffle. Examples: .. code-block:: python import paddle paddle.enable_static() dataset = paddle.distributed.InMemoryDataset() dataset.init( batch_size=1, thread_num=2, input_type=1, pipe_command="cat", use_var=[]) dataset._init_distributed_settings( parse_ins_id=True, parse_content=True, fea_eval=True, candidate_size=10000) dataset.update_settings(batch_size=2)
:api_attr: Static Graph
[ ":", "api_attr", ":", "Static", "Graph" ]
def update_settings(self, **kwargs): """ :api_attr: Static Graph should be called in user's python scripts to update setings of dataset instance. Args: kwargs: Keyword arguments. Currently, we support following keys in **kwargs, including single node settings and advanced distributed related settings: batch_size(int): batch size. It will be effective during training. default is 1. thread_num(int): thread num, it is the num of readers. default is 1. use_var(list): list of variables. Variables which you will use. default is []. input_type(int): the input type of generated input. 0 is for one sample, 1 is for one batch. defalut is 0. fs_name(str): fs name. default is "". fs_ugi(str): fs ugi. default is "". pipe_command(str): pipe command of current dataset. A pipe command is a UNIX pipeline command that can be used only. default is "cat" download_cmd(str): customized download command. default is "cat" data_feed_type(str): data feed type used in c++ code. default is "MultiSlotInMemoryDataFeed". queue_num(int): Dataset output queue num, training threads get data from queues. default is-1, which is set same as thread number in c++. merge_size(int): ins size to merge, if merge_size > 0, set merge by line id, instances of same line id will be merged after shuffle, you should parse line id in data generator. default is -1. parse_ins_id(bool): Set if Dataset need to parse ins_id. default is False. parse_content(bool): Set if Dataset need to parse content. default is False. fleet_send_batch_size(int): Set fleet send batch size in one rpc, default is 1024 fleet_send_sleep_seconds(int): Set fleet send sleep time, default is 0 fea_eval(bool): Set if Dataset need to do feature importance evaluation using slots shuffle. default is False. candidate_size(int): if fea_eval is set True, set the candidate size used in slots shuffle. Examples: .. code-block:: python import paddle paddle.enable_static() dataset = paddle.distributed.InMemoryDataset() dataset.init( batch_size=1, thread_num=2, input_type=1, pipe_command="cat", use_var=[]) dataset._init_distributed_settings( parse_ins_id=True, parse_content=True, fea_eval=True, candidate_size=10000) dataset.update_settings(batch_size=2) """ for key in kwargs: if key == "pipe_command": self._set_pipe_command(kwargs[key]) elif key == "batch_size": self._set_batch_size(kwargs[key]) elif key == "thread_num": self._set_thread(kwargs[key]) elif key == "use_var": self._set_use_var(kwargs[key]) elif key == "input_type": self._set_input_type(kwargs[key]) elif key == "fs_name" and "fs_ugi" in kwargs: self._set_hdfs_config(kwargs[key], kwargs["fs_ugi"]) elif key == "download_cmd": self._set_download_cmd(kwargs[key]) elif key == "merge_size" and kwargs.get("merge_size", -1) > 0: self._set_merge_by_lineid(kwargs[key]) elif key == "parse_ins_id": self._set_parse_ins_id(kwargs[key]) elif key == "parse_content": self._set_parse_content(kwargs[key]) elif key == "fleet_send_batch_size": self._set_fleet_send_batch_size(kwargs[key]) elif key == "fleet_send_sleep_seconds": self._set_fleet_send_sleep_seconds(kwargs[key]) elif key == "fea_eval" and kwargs[key] == True: candidate_size = kwargs.get("candidate_size", 10000) self._set_fea_eval(candidate_size, True)
[ "def", "update_settings", "(", "self", ",", "*", "*", "kwargs", ")", ":", "for", "key", "in", "kwargs", ":", "if", "key", "==", "\"pipe_command\"", ":", "self", ".", "_set_pipe_command", "(", "kwargs", "[", "key", "]", ")", "elif", "key", "==", "\"batch_size\"", ":", "self", ".", "_set_batch_size", "(", "kwargs", "[", "key", "]", ")", "elif", "key", "==", "\"thread_num\"", ":", "self", ".", "_set_thread", "(", "kwargs", "[", "key", "]", ")", "elif", "key", "==", "\"use_var\"", ":", "self", ".", "_set_use_var", "(", "kwargs", "[", "key", "]", ")", "elif", "key", "==", "\"input_type\"", ":", "self", ".", "_set_input_type", "(", "kwargs", "[", "key", "]", ")", "elif", "key", "==", "\"fs_name\"", "and", "\"fs_ugi\"", "in", "kwargs", ":", "self", ".", "_set_hdfs_config", "(", "kwargs", "[", "key", "]", ",", "kwargs", "[", "\"fs_ugi\"", "]", ")", "elif", "key", "==", "\"download_cmd\"", ":", "self", ".", "_set_download_cmd", "(", "kwargs", "[", "key", "]", ")", "elif", "key", "==", "\"merge_size\"", "and", "kwargs", ".", "get", "(", "\"merge_size\"", ",", "-", "1", ")", ">", "0", ":", "self", ".", "_set_merge_by_lineid", "(", "kwargs", "[", "key", "]", ")", "elif", "key", "==", "\"parse_ins_id\"", ":", "self", ".", "_set_parse_ins_id", "(", "kwargs", "[", "key", "]", ")", "elif", "key", "==", "\"parse_content\"", ":", "self", ".", "_set_parse_content", "(", "kwargs", "[", "key", "]", ")", "elif", "key", "==", "\"fleet_send_batch_size\"", ":", "self", ".", "_set_fleet_send_batch_size", "(", "kwargs", "[", "key", "]", ")", "elif", "key", "==", "\"fleet_send_sleep_seconds\"", ":", "self", ".", "_set_fleet_send_sleep_seconds", "(", "kwargs", "[", "key", "]", ")", "elif", "key", "==", "\"fea_eval\"", "and", "kwargs", "[", "key", "]", "==", "True", ":", "candidate_size", "=", "kwargs", ".", "get", "(", "\"candidate_size\"", ",", "10000", ")", "self", ".", "_set_fea_eval", "(", "candidate_size", ",", "True", ")" ]
https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/distributed/fleet/dataset/dataset.py#L432-L511
apache/arrow
af33dd1157eb8d7d9bfac25ebf61445b793b7943
cpp/build-support/cpplint.py
python
IsDecltype
(clean_lines, linenum, column)
return False
Check if the token ending on (linenum, column) is decltype(). Args: clean_lines: A CleansedLines instance containing the file. linenum: the number of the line to check. column: end column of the token to check. Returns: True if this token is decltype() expression, False otherwise.
Check if the token ending on (linenum, column) is decltype().
[ "Check", "if", "the", "token", "ending", "on", "(", "linenum", "column", ")", "is", "decltype", "()", "." ]
def IsDecltype(clean_lines, linenum, column): """Check if the token ending on (linenum, column) is decltype(). Args: clean_lines: A CleansedLines instance containing the file. linenum: the number of the line to check. column: end column of the token to check. Returns: True if this token is decltype() expression, False otherwise. """ (text, _, start_col) = ReverseCloseExpression(clean_lines, linenum, column) if start_col < 0: return False if Search(r'\bdecltype\s*$', text[0:start_col]): return True return False
[ "def", "IsDecltype", "(", "clean_lines", ",", "linenum", ",", "column", ")", ":", "(", "text", ",", "_", ",", "start_col", ")", "=", "ReverseCloseExpression", "(", "clean_lines", ",", "linenum", ",", "column", ")", "if", "start_col", "<", "0", ":", "return", "False", "if", "Search", "(", "r'\\bdecltype\\s*$'", ",", "text", "[", "0", ":", "start_col", "]", ")", ":", "return", "True", "return", "False" ]
https://github.com/apache/arrow/blob/af33dd1157eb8d7d9bfac25ebf61445b793b7943/cpp/build-support/cpplint.py#L3783-L3798
natanielruiz/android-yolo
1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f
jni-build/jni/include/tensorflow/python/ops/io_ops.py
python
_MatchingFilesShape
(op)
return [tensor_shape.unknown_shape(ndims=1)]
Shape function for the MatchingFiles op.
Shape function for the MatchingFiles op.
[ "Shape", "function", "for", "the", "MatchingFiles", "op", "." ]
def _MatchingFilesShape(op): """Shape function for the MatchingFiles op.""" unused_patern_shape = op.inputs[0].get_shape().merge_with( tensor_shape.scalar()) return [tensor_shape.unknown_shape(ndims=1)]
[ "def", "_MatchingFilesShape", "(", "op", ")", ":", "unused_patern_shape", "=", "op", ".", "inputs", "[", "0", "]", ".", "get_shape", "(", ")", ".", "merge_with", "(", "tensor_shape", ".", "scalar", "(", ")", ")", "return", "[", "tensor_shape", ".", "unknown_shape", "(", "ndims", "=", "1", ")", "]" ]
https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/io_ops.py#L628-L632
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/idlelib/configHandler.py
python
IdleUserConfParser.RemoveOption
(self,section,option)
If section/option exists, remove it. Returns 1 if option was removed, 0 otherwise.
If section/option exists, remove it. Returns 1 if option was removed, 0 otherwise.
[ "If", "section", "/", "option", "exists", "remove", "it", ".", "Returns", "1", "if", "option", "was", "removed", "0", "otherwise", "." ]
def RemoveOption(self,section,option): """ If section/option exists, remove it. Returns 1 if option was removed, 0 otherwise. """ if self.has_section(section): return self.remove_option(section,option)
[ "def", "RemoveOption", "(", "self", ",", "section", ",", "option", ")", ":", "if", "self", ".", "has_section", "(", "section", ")", ":", "return", "self", ".", "remove_option", "(", "section", ",", "option", ")" ]
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/idlelib/configHandler.py#L102-L108
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/utils/misc.py
python
redact_auth_from_url
(url)
return _transform_url(url, _redact_netloc)[0]
Replace the password in a given url with ****.
Replace the password in a given url with ****.
[ "Replace", "the", "password", "in", "a", "given", "url", "with", "****", "." ]
def redact_auth_from_url(url): # type: (str) -> str """Replace the password in a given url with ****.""" return _transform_url(url, _redact_netloc)[0]
[ "def", "redact_auth_from_url", "(", "url", ")", ":", "# type: (str) -> str", "return", "_transform_url", "(", "url", ",", "_redact_netloc", ")", "[", "0", "]" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/utils/misc.py#L794-L797
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/unicode/gencodec.py
python
codegen
(name, map, encodingname, comments=1)
return '\n'.join(l).expandtabs()
Returns Python source for the given map. Comments are included in the source, if comments is true (default).
Returns Python source for the given map.
[ "Returns", "Python", "source", "for", "the", "given", "map", "." ]
def codegen(name, map, encodingname, comments=1): """ Returns Python source for the given map. Comments are included in the source, if comments is true (default). """ # Generate code decoding_map_code = python_mapdef_code( 'decoding_map', map, comments=comments) decoding_table_code = python_tabledef_code( 'decoding_table', map, comments=comments) encoding_map_code = python_mapdef_code( 'encoding_map', codecs.make_encoding_map(map), comments=comments, precisions=(4, 2)) if decoding_table_code: suffix = 'table' else: suffix = 'map' l = [ '''\ """ Python Character Mapping Codec %s generated from '%s' with gencodec.py. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self, input, errors='strict'): return codecs.charmap_encode(input, errors, encoding_%s) def decode(self, input, errors='strict'): return codecs.charmap_decode(input, errors, decoding_%s) ''' % (encodingname, name, suffix, suffix)] l.append('''\ class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input, final=False): return codecs.charmap_encode(input, self.errors, encoding_%s)[0] class IncrementalDecoder(codecs.IncrementalDecoder): def decode(self, input, final=False): return codecs.charmap_decode(input, self.errors, decoding_%s)[0]''' % (suffix, suffix)) l.append(''' class StreamWriter(Codec, codecs.StreamWriter): pass class StreamReader(Codec, codecs.StreamReader): pass ### encodings module API def getregentry(): return codecs.CodecInfo( name=%r, encode=Codec().encode, decode=Codec().decode, incrementalencoder=IncrementalEncoder, incrementaldecoder=IncrementalDecoder, streamreader=StreamReader, streamwriter=StreamWriter, ) ''' % encodingname.replace('_', '-')) # Add decoding table or map (with preference to the table) if not decoding_table_code: l.append(''' ### Decoding Map ''') l.extend(decoding_map_code) else: l.append(''' ### Decoding Table ''') l.extend(decoding_table_code) # Add encoding map if decoding_table_code: l.append(''' ### Encoding table encoding_table = codecs.charmap_build(decoding_table) ''') else: l.append(''' ### Encoding Map ''') l.extend(encoding_map_code) # Final new-line l.append('') return '\n'.join(l).expandtabs()
[ "def", "codegen", "(", "name", ",", "map", ",", "encodingname", ",", "comments", "=", "1", ")", ":", "# Generate code", "decoding_map_code", "=", "python_mapdef_code", "(", "'decoding_map'", ",", "map", ",", "comments", "=", "comments", ")", "decoding_table_code", "=", "python_tabledef_code", "(", "'decoding_table'", ",", "map", ",", "comments", "=", "comments", ")", "encoding_map_code", "=", "python_mapdef_code", "(", "'encoding_map'", ",", "codecs", ".", "make_encoding_map", "(", "map", ")", ",", "comments", "=", "comments", ",", "precisions", "=", "(", "4", ",", "2", ")", ")", "if", "decoding_table_code", ":", "suffix", "=", "'table'", "else", ":", "suffix", "=", "'map'", "l", "=", "[", "'''\\\n\"\"\" Python Character Mapping Codec %s generated from '%s' with gencodec.py.\n\n\"\"\"#\"\n\nimport codecs\n\n### Codec APIs\n\nclass Codec(codecs.Codec):\n\n def encode(self, input, errors='strict'):\n return codecs.charmap_encode(input, errors, encoding_%s)\n\n def decode(self, input, errors='strict'):\n return codecs.charmap_decode(input, errors, decoding_%s)\n'''", "%", "(", "encodingname", ",", "name", ",", "suffix", ",", "suffix", ")", "]", "l", ".", "append", "(", "'''\\\nclass IncrementalEncoder(codecs.IncrementalEncoder):\n def encode(self, input, final=False):\n return codecs.charmap_encode(input, self.errors, encoding_%s)[0]\n\nclass IncrementalDecoder(codecs.IncrementalDecoder):\n def decode(self, input, final=False):\n return codecs.charmap_decode(input, self.errors, decoding_%s)[0]'''", "%", "(", "suffix", ",", "suffix", ")", ")", "l", ".", "append", "(", "'''\nclass StreamWriter(Codec, codecs.StreamWriter):\n pass\n\nclass StreamReader(Codec, codecs.StreamReader):\n pass\n\n### encodings module API\n\ndef getregentry():\n return codecs.CodecInfo(\n name=%r,\n encode=Codec().encode,\n decode=Codec().decode,\n incrementalencoder=IncrementalEncoder,\n incrementaldecoder=IncrementalDecoder,\n streamreader=StreamReader,\n streamwriter=StreamWriter,\n )\n'''", "%", "encodingname", ".", "replace", "(", "'_'", ",", "'-'", ")", ")", "# Add decoding table or map (with preference to the table)", "if", "not", "decoding_table_code", ":", "l", ".", "append", "(", "'''\n### Decoding Map\n'''", ")", "l", ".", "extend", "(", "decoding_map_code", ")", "else", ":", "l", ".", "append", "(", "'''\n### Decoding Table\n'''", ")", "l", ".", "extend", "(", "decoding_table_code", ")", "# Add encoding map", "if", "decoding_table_code", ":", "l", ".", "append", "(", "'''\n### Encoding table\nencoding_table = codecs.charmap_build(decoding_table)\n'''", ")", "else", ":", "l", ".", "append", "(", "'''\n### Encoding Map\n'''", ")", "l", ".", "extend", "(", "encoding_map_code", ")", "# Final new-line", "l", ".", "append", "(", "''", ")", "return", "'\\n'", ".", "join", "(", "l", ")", ".", "expandtabs", "(", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/unicode/gencodec.py#L254-L357
InsightSoftwareConsortium/ITK
87acfce9a93d928311c38bc371b666b515b9f19d
Modules/ThirdParty/pygccxml/src/pygccxml/declarations/decl_factory.py
python
decl_factory_t.create_destructor
(self, *arguments, **keywords)
return destructor_t(*arguments, **keywords)
creates instance of class that describes destructor declaration
creates instance of class that describes destructor declaration
[ "creates", "instance", "of", "class", "that", "describes", "destructor", "declaration" ]
def create_destructor(self, *arguments, **keywords): """creates instance of class that describes destructor declaration""" return destructor_t(*arguments, **keywords)
[ "def", "create_destructor", "(", "self", ",", "*", "arguments", ",", "*", "*", "keywords", ")", ":", "return", "destructor_t", "(", "*", "arguments", ",", "*", "*", "keywords", ")" ]
https://github.com/InsightSoftwareConsortium/ITK/blob/87acfce9a93d928311c38bc371b666b515b9f19d/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/decl_factory.py#L44-L46