Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
RegistryInfo.windows_sdk | (self) |
Microsoft Windows/Platform SDK registry key.
Return
------
str
Registry key
|
Microsoft Windows/Platform SDK registry key. | def windows_sdk(self):
"""
Microsoft Windows/Platform SDK registry key.
Return
------
str
Registry key
"""
return join(self.microsoft_sdk, 'Windows') | [
"def",
"windows_sdk",
"(",
"self",
")",
":",
"return",
"join",
"(",
"self",
".",
"microsoft_sdk",
",",
"'Windows'",
")"
] | [
572,
4
] | [
581,
50
] | python | en | ['en', 'error', 'th'] | False |
RegistryInfo.netfx_sdk | (self) |
Microsoft .NET Framework SDK registry key.
Return
------
str
Registry key
|
Microsoft .NET Framework SDK registry key. | def netfx_sdk(self):
"""
Microsoft .NET Framework SDK registry key.
Return
------
str
Registry key
"""
return join(self.microsoft_sdk, 'NETFXSDK') | [
"def",
"netfx_sdk",
"(",
"self",
")",
":",
"return",
"join",
"(",
"self",
".",
"microsoft_sdk",
",",
"'NETFXSDK'",
")"
] | [
584,
4
] | [
593,
51
] | python | en | ['en', 'error', 'th'] | False |
RegistryInfo.windows_kits_roots | (self) |
Microsoft Windows Kits Roots registry key.
Return
------
str
Registry key
|
Microsoft Windows Kits Roots registry key. | def windows_kits_roots(self):
"""
Microsoft Windows Kits Roots registry key.
Return
------
str
Registry key
"""
return r'Windows Kits\Installed Roots' | [
"def",
"windows_kits_roots",
"(",
"self",
")",
":",
"return",
"r'Windows Kits\\Installed Roots'"
] | [
596,
4
] | [
605,
46
] | python | en | ['en', 'error', 'th'] | False |
RegistryInfo.microsoft | (self, key, x86=False) |
Return key in Microsoft software registry.
Parameters
----------
key: str
Registry key path where look.
x86: str
Force x86 software registry.
Return
------
str
Registry key
|
Return key in Microsoft software registry. | def microsoft(self, key, x86=False):
"""
Return key in Microsoft software registry.
Parameters
----------
key: str
Registry key path where look.
x86: str
Force x86 software registry.
Return
------
str
Registry ... | [
"def",
"microsoft",
"(",
"self",
",",
"key",
",",
"x86",
"=",
"False",
")",
":",
"node64",
"=",
"''",
"if",
"self",
".",
"pi",
".",
"current_is_x86",
"(",
")",
"or",
"x86",
"else",
"'Wow6432Node'",
"return",
"join",
"(",
"'Software'",
",",
"node64",
... | [
607,
4
] | [
624,
57
] | python | en | ['en', 'error', 'th'] | False |
RegistryInfo.lookup | (self, key, name) |
Look for values in registry in Microsoft software registry.
Parameters
----------
key: str
Registry key path where look.
name: str
Value name to find.
Return
------
str
value
|
Look for values in registry in Microsoft software registry. | def lookup(self, key, name):
"""
Look for values in registry in Microsoft software registry.
Parameters
----------
key: str
Registry key path where look.
name: str
Value name to find.
Return
------
str
value
... | [
"def",
"lookup",
"(",
"self",
",",
"key",
",",
"name",
")",
":",
"key_read",
"=",
"winreg",
".",
"KEY_READ",
"openkey",
"=",
"winreg",
".",
"OpenKey",
"closekey",
"=",
"winreg",
".",
"CloseKey",
"ms",
"=",
"self",
".",
"microsoft",
"for",
"hkey",
"in",... | [
626,
4
] | [
664,
34
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo._find_latest_available_vs_ver | (self) |
Find the latest VC version
Return
------
float
version
|
Find the latest VC version | def _find_latest_available_vs_ver(self):
"""
Find the latest VC version
Return
------
float
version
"""
reg_vc_vers = self.find_reg_vs_vers()
if not (reg_vc_vers or self.known_vs_paths):
raise distutils.errors.DistutilsPlatformErr... | [
"def",
"_find_latest_available_vs_ver",
"(",
"self",
")",
":",
"reg_vc_vers",
"=",
"self",
".",
"find_reg_vs_vers",
"(",
")",
"if",
"not",
"(",
"reg_vc_vers",
"or",
"self",
".",
"known_vs_paths",
")",
":",
"raise",
"distutils",
".",
"errors",
".",
"DistutilsPl... | [
695,
4
] | [
712,
34
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo.find_reg_vs_vers | (self) |
Find Microsoft Visual Studio versions available in registry.
Return
------
list of float
Versions
|
Find Microsoft Visual Studio versions available in registry. | def find_reg_vs_vers(self):
"""
Find Microsoft Visual Studio versions available in registry.
Return
------
list of float
Versions
"""
ms = self.ri.microsoft
vckeys = (self.ri.vc, self.ri.vc_for_python, self.ri.vs)
vs_vers = []
... | [
"def",
"find_reg_vs_vers",
"(",
"self",
")",
":",
"ms",
"=",
"self",
".",
"ri",
".",
"microsoft",
"vckeys",
"=",
"(",
"self",
".",
"ri",
".",
"vc",
",",
"self",
".",
"ri",
".",
"vc_for_python",
",",
"self",
".",
"ri",
".",
"vs",
")",
"vs_vers",
"... | [
714,
4
] | [
748,
30
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo.find_programdata_vs_vers | (self) | r"""
Find Visual studio 2017+ versions from information in
"C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances".
Return
------
dict
float version as key, path as value.
| r"""
Find Visual studio 2017+ versions from information in
"C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances". | def find_programdata_vs_vers(self):
r"""
Find Visual studio 2017+ versions from information in
"C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances".
Return
------
dict
float version as key, path as value.
"""
vs_versions = {}
in... | [
"def",
"find_programdata_vs_vers",
"(",
"self",
")",
":",
"vs_versions",
"=",
"{",
"}",
"instances_dir",
"=",
"r'C:\\ProgramData\\Microsoft\\VisualStudio\\Packages\\_Instances'",
"try",
":",
"hashed_names",
"=",
"listdir",
"(",
"instances_dir",
")",
"except",
"(",
"OSEr... | [
750,
4
] | [
790,
26
] | python | cy | ['en', 'cy', 'hi'] | False |
SystemInfo._as_float_version | (version) |
Return a string version as a simplified float version (major.minor)
Parameters
----------
version: str
Version.
Return
------
float
version
|
Return a string version as a simplified float version (major.minor) | def _as_float_version(version):
"""
Return a string version as a simplified float version (major.minor)
Parameters
----------
version: str
Version.
Return
------
float
version
"""
return float('.'.join(version.spli... | [
"def",
"_as_float_version",
"(",
"version",
")",
":",
"return",
"float",
"(",
"'.'",
".",
"join",
"(",
"version",
".",
"split",
"(",
"'.'",
")",
"[",
":",
"2",
"]",
")",
")"
] | [
793,
4
] | [
807,
54
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo.VSInstallDir | (self) |
Microsoft Visual Studio directory.
Return
------
str
path
|
Microsoft Visual Studio directory. | def VSInstallDir(self):
"""
Microsoft Visual Studio directory.
Return
------
str
path
"""
# Default path
default = join(self.ProgramFilesx86,
'Microsoft Visual Studio %0.1f' % self.vs_ver)
# Try to get path from... | [
"def",
"VSInstallDir",
"(",
"self",
")",
":",
"# Default path",
"default",
"=",
"join",
"(",
"self",
".",
"ProgramFilesx86",
",",
"'Microsoft Visual Studio %0.1f'",
"%",
"self",
".",
"vs_ver",
")",
"# Try to get path from registry, if fail use default path",
"return",
"... | [
810,
4
] | [
824,
75
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo.VCInstallDir | (self) |
Microsoft Visual C++ directory.
Return
------
str
path
|
Microsoft Visual C++ directory. | def VCInstallDir(self):
"""
Microsoft Visual C++ directory.
Return
------
str
path
"""
path = self._guess_vc() or self._guess_vc_legacy()
if not isdir(path):
msg = 'Microsoft Visual C++ directory not found'
raise distu... | [
"def",
"VCInstallDir",
"(",
"self",
")",
":",
"path",
"=",
"self",
".",
"_guess_vc",
"(",
")",
"or",
"self",
".",
"_guess_vc_legacy",
"(",
")",
"if",
"not",
"isdir",
"(",
"path",
")",
":",
"msg",
"=",
"'Microsoft Visual C++ directory not found'",
"raise",
... | [
827,
4
] | [
842,
19
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo._guess_vc | (self) |
Locate Visual C++ for VS2017+.
Return
------
str
path
|
Locate Visual C++ for VS2017+. | def _guess_vc(self):
"""
Locate Visual C++ for VS2017+.
Return
------
str
path
"""
if self.vs_ver <= 14.0:
return ''
try:
# First search in known VS paths
vs_dir = self.known_vs_paths[self.vs_ver]
e... | [
"def",
"_guess_vc",
"(",
"self",
")",
":",
"if",
"self",
".",
"vs_ver",
"<=",
"14.0",
":",
"return",
"''",
"try",
":",
"# First search in known VS paths",
"vs_dir",
"=",
"self",
".",
"known_vs_paths",
"[",
"self",
".",
"vs_ver",
"]",
"except",
"KeyError",
... | [
844,
4
] | [
872,
21
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo._guess_vc_legacy | (self) |
Locate Visual C++ for versions prior to 2017.
Return
------
str
path
|
Locate Visual C++ for versions prior to 2017. | def _guess_vc_legacy(self):
"""
Locate Visual C++ for versions prior to 2017.
Return
------
str
path
"""
default = join(self.ProgramFilesx86,
r'Microsoft Visual Studio %0.1f\VC' % self.vs_ver)
# Try to get "VC++ for Pyt... | [
"def",
"_guess_vc_legacy",
"(",
"self",
")",
":",
"default",
"=",
"join",
"(",
"self",
".",
"ProgramFilesx86",
",",
"r'Microsoft Visual Studio %0.1f\\VC'",
"%",
"self",
".",
"vs_ver",
")",
"# Try to get \"VC++ for Python\" path from registry as default path",
"reg_path",
... | [
874,
4
] | [
892,
78
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo.WindowsSdkVersion | (self) |
Microsoft Windows SDK versions for specified MSVC++ version.
Return
------
tuple of str
versions
|
Microsoft Windows SDK versions for specified MSVC++ version. | def WindowsSdkVersion(self):
"""
Microsoft Windows SDK versions for specified MSVC++ version.
Return
------
tuple of str
versions
"""
if self.vs_ver <= 9.0:
return '7.0', '6.1', '6.0a'
elif self.vs_ver == 10.0:
return '... | [
"def",
"WindowsSdkVersion",
"(",
"self",
")",
":",
"if",
"self",
".",
"vs_ver",
"<=",
"9.0",
":",
"return",
"'7.0'",
",",
"'6.1'",
",",
"'6.0a'",
"elif",
"self",
".",
"vs_ver",
"==",
"10.0",
":",
"return",
"'7.1'",
",",
"'7.0a'",
"elif",
"self",
".",
... | [
895,
4
] | [
913,
32
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo.WindowsSdkLastVersion | (self) |
Microsoft Windows SDK last version.
Return
------
str
version
|
Microsoft Windows SDK last version. | def WindowsSdkLastVersion(self):
"""
Microsoft Windows SDK last version.
Return
------
str
version
"""
return self._use_last_dir_name(join(self.WindowsSdkDir, 'lib')) | [
"def",
"WindowsSdkLastVersion",
"(",
"self",
")",
":",
"return",
"self",
".",
"_use_last_dir_name",
"(",
"join",
"(",
"self",
".",
"WindowsSdkDir",
",",
"'lib'",
")",
")"
] | [
916,
4
] | [
925,
71
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo.WindowsSdkDir | (self) |
Microsoft Windows SDK directory.
Return
------
str
path
|
Microsoft Windows SDK directory. | def WindowsSdkDir(self):
"""
Microsoft Windows SDK directory.
Return
------
str
path
"""
sdkdir = ''
for ver in self.WindowsSdkVersion:
# Try to get it from registry
loc = join(self.ri.windows_sdk, 'v%s' % ver)
... | [
"def",
"WindowsSdkDir",
"(",
"self",
")",
":",
"sdkdir",
"=",
"''",
"for",
"ver",
"in",
"self",
".",
"WindowsSdkVersion",
":",
"# Try to get it from registry",
"loc",
"=",
"join",
"(",
"self",
".",
"ri",
".",
"windows_sdk",
",",
"'v%s'",
"%",
"ver",
")",
... | [
928,
4
] | [
968,
21
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo.WindowsSDKExecutablePath | (self) |
Microsoft Windows SDK executable directory.
Return
------
str
path
|
Microsoft Windows SDK executable directory. | def WindowsSDKExecutablePath(self):
"""
Microsoft Windows SDK executable directory.
Return
------
str
path
"""
# Find WinSDK NetFx Tools registry dir name
if self.vs_ver <= 11.0:
netfxver = 35
arch = ''
else:
... | [
"def",
"WindowsSDKExecutablePath",
"(",
"self",
")",
":",
"# Find WinSDK NetFx Tools registry dir name",
"if",
"self",
".",
"vs_ver",
"<=",
"11.0",
":",
"netfxver",
"=",
"35",
"arch",
"=",
"''",
"else",
":",
"netfxver",
"=",
"40",
"hidex86",
"=",
"True",
"if",... | [
971,
4
] | [
1003,
31
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo.FSharpInstallDir | (self) |
Microsoft Visual F# directory.
Return
------
str
path
|
Microsoft Visual F# directory. | def FSharpInstallDir(self):
"""
Microsoft Visual F# directory.
Return
------
str
path
"""
path = join(self.ri.visualstudio, r'%0.1f\Setup\F#' % self.vs_ver)
return self.ri.lookup(path, 'productdir') or '' | [
"def",
"FSharpInstallDir",
"(",
"self",
")",
":",
"path",
"=",
"join",
"(",
"self",
".",
"ri",
".",
"visualstudio",
",",
"r'%0.1f\\Setup\\F#'",
"%",
"self",
".",
"vs_ver",
")",
"return",
"self",
".",
"ri",
".",
"lookup",
"(",
"path",
",",
"'productdir'",... | [
1006,
4
] | [
1016,
55
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo.UniversalCRTSdkDir | (self) |
Microsoft Universal CRT SDK directory.
Return
------
str
path
|
Microsoft Universal CRT SDK directory. | def UniversalCRTSdkDir(self):
"""
Microsoft Universal CRT SDK directory.
Return
------
str
path
"""
# Set Kit Roots versions for specified MSVC++ version
vers = ('10', '81') if self.vs_ver >= 14.0 else ()
# Find path of the more recen... | [
"def",
"UniversalCRTSdkDir",
"(",
"self",
")",
":",
"# Set Kit Roots versions for specified MSVC++ version",
"vers",
"=",
"(",
"'10'",
",",
"'81'",
")",
"if",
"self",
".",
"vs_ver",
">=",
"14.0",
"else",
"(",
")",
"# Find path of the more recent Kit",
"for",
"ver",
... | [
1019,
4
] | [
1036,
35
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo.UniversalCRTSdkLastVersion | (self) |
Microsoft Universal C Runtime SDK last version.
Return
------
str
version
|
Microsoft Universal C Runtime SDK last version. | def UniversalCRTSdkLastVersion(self):
"""
Microsoft Universal C Runtime SDK last version.
Return
------
str
version
"""
return self._use_last_dir_name(join(self.UniversalCRTSdkDir, 'lib')) | [
"def",
"UniversalCRTSdkLastVersion",
"(",
"self",
")",
":",
"return",
"self",
".",
"_use_last_dir_name",
"(",
"join",
"(",
"self",
".",
"UniversalCRTSdkDir",
",",
"'lib'",
")",
")"
] | [
1039,
4
] | [
1048,
76
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo.NetFxSdkVersion | (self) |
Microsoft .NET Framework SDK versions.
Return
------
tuple of str
versions
|
Microsoft .NET Framework SDK versions. | def NetFxSdkVersion(self):
"""
Microsoft .NET Framework SDK versions.
Return
------
tuple of str
versions
"""
# Set FxSdk versions for specified VS version
return (('4.7.2', '4.7.1', '4.7',
'4.6.2', '4.6.1', '4.6',
... | [
"def",
"NetFxSdkVersion",
"(",
"self",
")",
":",
"# Set FxSdk versions for specified VS version",
"return",
"(",
"(",
"'4.7.2'",
",",
"'4.7.1'",
",",
"'4.7'",
",",
"'4.6.2'",
",",
"'4.6.1'",
",",
"'4.6'",
",",
"'4.5.2'",
",",
"'4.5.1'",
",",
"'4.5'",
")",
"if"... | [
1051,
4
] | [
1064,
47
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo.NetFxSdkDir | (self) |
Microsoft .NET Framework SDK directory.
Return
------
str
path
|
Microsoft .NET Framework SDK directory. | def NetFxSdkDir(self):
"""
Microsoft .NET Framework SDK directory.
Return
------
str
path
"""
sdkdir = ''
for ver in self.NetFxSdkVersion:
loc = join(self.ri.netfx_sdk, ver)
sdkdir = self.ri.lookup(loc, 'kitsinstallatio... | [
"def",
"NetFxSdkDir",
"(",
"self",
")",
":",
"sdkdir",
"=",
"''",
"for",
"ver",
"in",
"self",
".",
"NetFxSdkVersion",
":",
"loc",
"=",
"join",
"(",
"self",
".",
"ri",
".",
"netfx_sdk",
",",
"ver",
")",
"sdkdir",
"=",
"self",
".",
"ri",
".",
"lookup... | [
1067,
4
] | [
1082,
21
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo.FrameworkDir32 | (self) |
Microsoft .NET Framework 32bit directory.
Return
------
str
path
|
Microsoft .NET Framework 32bit directory. | def FrameworkDir32(self):
"""
Microsoft .NET Framework 32bit directory.
Return
------
str
path
"""
# Default path
guess_fw = join(self.WinDir, r'Microsoft.NET\Framework')
# Try to get path from registry, if fail use default path
... | [
"def",
"FrameworkDir32",
"(",
"self",
")",
":",
"# Default path",
"guess_fw",
"=",
"join",
"(",
"self",
".",
"WinDir",
",",
"r'Microsoft.NET\\Framework'",
")",
"# Try to get path from registry, if fail use default path",
"return",
"self",
".",
"ri",
".",
"lookup",
"("... | [
1085,
4
] | [
1098,
71
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo.FrameworkDir64 | (self) |
Microsoft .NET Framework 64bit directory.
Return
------
str
path
|
Microsoft .NET Framework 64bit directory. | def FrameworkDir64(self):
"""
Microsoft .NET Framework 64bit directory.
Return
------
str
path
"""
# Default path
guess_fw = join(self.WinDir, r'Microsoft.NET\Framework64')
# Try to get path from registry, if fail use default path
... | [
"def",
"FrameworkDir64",
"(",
"self",
")",
":",
"# Default path",
"guess_fw",
"=",
"join",
"(",
"self",
".",
"WinDir",
",",
"r'Microsoft.NET\\Framework64'",
")",
"# Try to get path from registry, if fail use default path",
"return",
"self",
".",
"ri",
".",
"lookup",
"... | [
1101,
4
] | [
1114,
71
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo.FrameworkVersion32 | (self) |
Microsoft .NET Framework 32bit versions.
Return
------
tuple of str
versions
|
Microsoft .NET Framework 32bit versions. | def FrameworkVersion32(self):
"""
Microsoft .NET Framework 32bit versions.
Return
------
tuple of str
versions
"""
return self._find_dot_net_versions(32) | [
"def",
"FrameworkVersion32",
"(",
"self",
")",
":",
"return",
"self",
".",
"_find_dot_net_versions",
"(",
"32",
")"
] | [
1117,
4
] | [
1126,
46
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo.FrameworkVersion64 | (self) |
Microsoft .NET Framework 64bit versions.
Return
------
tuple of str
versions
|
Microsoft .NET Framework 64bit versions. | def FrameworkVersion64(self):
"""
Microsoft .NET Framework 64bit versions.
Return
------
tuple of str
versions
"""
return self._find_dot_net_versions(64) | [
"def",
"FrameworkVersion64",
"(",
"self",
")",
":",
"return",
"self",
".",
"_find_dot_net_versions",
"(",
"64",
")"
] | [
1129,
4
] | [
1138,
46
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo._find_dot_net_versions | (self, bits) |
Find Microsoft .NET Framework versions.
Parameters
----------
bits: int
Platform number of bits: 32 or 64.
Return
------
tuple of str
versions
|
Find Microsoft .NET Framework versions. | def _find_dot_net_versions(self, bits):
"""
Find Microsoft .NET Framework versions.
Parameters
----------
bits: int
Platform number of bits: 32 or 64.
Return
------
tuple of str
versions
"""
# Find actual .NET vers... | [
"def",
"_find_dot_net_versions",
"(",
"self",
",",
"bits",
")",
":",
"# Find actual .NET version in registry",
"reg_ver",
"=",
"self",
".",
"ri",
".",
"lookup",
"(",
"self",
".",
"ri",
".",
"vc",
",",
"'frameworkver%d'",
"%",
"bits",
")",
"dot_net_dir",
"=",
... | [
1140,
4
] | [
1167,
39
] | python | en | ['en', 'error', 'th'] | False |
SystemInfo._use_last_dir_name | (path, prefix='') |
Return name of the last dir in path or '' if no dir found.
Parameters
----------
path: str
Use dirs in this path
prefix: str
Use only dirs starting by this prefix
Return
------
str
name
|
Return name of the last dir in path or '' if no dir found. | def _use_last_dir_name(path, prefix=''):
"""
Return name of the last dir in path or '' if no dir found.
Parameters
----------
path: str
Use dirs in this path
prefix: str
Use only dirs starting by this prefix
Return
------
... | [
"def",
"_use_last_dir_name",
"(",
"path",
",",
"prefix",
"=",
"''",
")",
":",
"matching_dirs",
"=",
"(",
"dir_name",
"for",
"dir_name",
"in",
"reversed",
"(",
"listdir",
"(",
"path",
")",
")",
"if",
"isdir",
"(",
"join",
"(",
"path",
",",
"dir_name",
"... | [
1170,
4
] | [
1192,
46
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.vs_ver | (self) |
Microsoft Visual Studio.
Return
------
float
version
|
Microsoft Visual Studio. | def vs_ver(self):
"""
Microsoft Visual Studio.
Return
------
float
version
"""
return self.si.vs_ver | [
"def",
"vs_ver",
"(",
"self",
")",
":",
"return",
"self",
".",
"si",
".",
"vs_ver"
] | [
1229,
4
] | [
1238,
29
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.vc_ver | (self) |
Microsoft Visual C++ version.
Return
------
float
version
|
Microsoft Visual C++ version. | def vc_ver(self):
"""
Microsoft Visual C++ version.
Return
------
float
version
"""
return self.si.vc_ver | [
"def",
"vc_ver",
"(",
"self",
")",
":",
"return",
"self",
".",
"si",
".",
"vc_ver"
] | [
1241,
4
] | [
1250,
29
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.VSTools | (self) |
Microsoft Visual Studio Tools.
Return
------
list of str
paths
|
Microsoft Visual Studio Tools. | def VSTools(self):
"""
Microsoft Visual Studio Tools.
Return
------
list of str
paths
"""
paths = [r'Common7\IDE', r'Common7\Tools']
if self.vs_ver >= 14.0:
arch_subdir = self.pi.current_dir(hidex86=True, x64=True)
pat... | [
"def",
"VSTools",
"(",
"self",
")",
":",
"paths",
"=",
"[",
"r'Common7\\IDE'",
",",
"r'Common7\\Tools'",
"]",
"if",
"self",
".",
"vs_ver",
">=",
"14.0",
":",
"arch_subdir",
"=",
"self",
".",
"pi",
".",
"current_dir",
"(",
"hidex86",
"=",
"True",
",",
"... | [
1253,
4
] | [
1270,
67
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.VCIncludes | (self) |
Microsoft Visual C++ & Microsoft Foundation Class Includes.
Return
------
list of str
paths
|
Microsoft Visual C++ & Microsoft Foundation Class Includes. | def VCIncludes(self):
"""
Microsoft Visual C++ & Microsoft Foundation Class Includes.
Return
------
list of str
paths
"""
return [join(self.si.VCInstallDir, 'Include'),
join(self.si.VCInstallDir, r'ATLMFC\Include')] | [
"def",
"VCIncludes",
"(",
"self",
")",
":",
"return",
"[",
"join",
"(",
"self",
".",
"si",
".",
"VCInstallDir",
",",
"'Include'",
")",
",",
"join",
"(",
"self",
".",
"si",
".",
"VCInstallDir",
",",
"r'ATLMFC\\Include'",
")",
"]"
] | [
1273,
4
] | [
1283,
62
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.VCLibraries | (self) |
Microsoft Visual C++ & Microsoft Foundation Class Libraries.
Return
------
list of str
paths
|
Microsoft Visual C++ & Microsoft Foundation Class Libraries. | def VCLibraries(self):
"""
Microsoft Visual C++ & Microsoft Foundation Class Libraries.
Return
------
list of str
paths
"""
if self.vs_ver >= 15.0:
arch_subdir = self.pi.target_dir(x64=True)
else:
arch_subdir = self.pi.... | [
"def",
"VCLibraries",
"(",
"self",
")",
":",
"if",
"self",
".",
"vs_ver",
">=",
"15.0",
":",
"arch_subdir",
"=",
"self",
".",
"pi",
".",
"target_dir",
"(",
"x64",
"=",
"True",
")",
"else",
":",
"arch_subdir",
"=",
"self",
".",
"pi",
".",
"target_dir"... | [
1286,
4
] | [
1304,
67
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.VCStoreRefs | (self) |
Microsoft Visual C++ store references Libraries.
Return
------
list of str
paths
|
Microsoft Visual C++ store references Libraries. | def VCStoreRefs(self):
"""
Microsoft Visual C++ store references Libraries.
Return
------
list of str
paths
"""
if self.vs_ver < 14.0:
return []
return [join(self.si.VCInstallDir, r'Lib\store\references')] | [
"def",
"VCStoreRefs",
"(",
"self",
")",
":",
"if",
"self",
".",
"vs_ver",
"<",
"14.0",
":",
"return",
"[",
"]",
"return",
"[",
"join",
"(",
"self",
".",
"si",
".",
"VCInstallDir",
",",
"r'Lib\\store\\references'",
")",
"]"
] | [
1307,
4
] | [
1318,
68
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.VCTools | (self) |
Microsoft Visual C++ Tools.
Return
------
list of str
paths
|
Microsoft Visual C++ Tools. | def VCTools(self):
"""
Microsoft Visual C++ Tools.
Return
------
list of str
paths
"""
si = self.si
tools = [join(si.VCInstallDir, 'VCPackages')]
forcex86 = True if self.vs_ver <= 10.0 else False
arch_subdir = self.pi.cross_di... | [
"def",
"VCTools",
"(",
"self",
")",
":",
"si",
"=",
"self",
".",
"si",
"tools",
"=",
"[",
"join",
"(",
"si",
".",
"VCInstallDir",
",",
"'VCPackages'",
")",
"]",
"forcex86",
"=",
"True",
"if",
"self",
".",
"vs_ver",
"<=",
"10.0",
"else",
"False",
"a... | [
1321,
4
] | [
1355,
20
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.OSLibraries | (self) |
Microsoft Windows SDK Libraries.
Return
------
list of str
paths
|
Microsoft Windows SDK Libraries. | def OSLibraries(self):
"""
Microsoft Windows SDK Libraries.
Return
------
list of str
paths
"""
if self.vs_ver <= 10.0:
arch_subdir = self.pi.target_dir(hidex86=True, x64=True)
return [join(self.si.WindowsSdkDir, 'Lib%s' % arch... | [
"def",
"OSLibraries",
"(",
"self",
")",
":",
"if",
"self",
".",
"vs_ver",
"<=",
"10.0",
":",
"arch_subdir",
"=",
"self",
".",
"pi",
".",
"target_dir",
"(",
"hidex86",
"=",
"True",
",",
"x64",
"=",
"True",
")",
"return",
"[",
"join",
"(",
"self",
".... | [
1358,
4
] | [
1375,
64
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.OSIncludes | (self) |
Microsoft Windows SDK Include.
Return
------
list of str
paths
|
Microsoft Windows SDK Include. | def OSIncludes(self):
"""
Microsoft Windows SDK Include.
Return
------
list of str
paths
"""
include = join(self.si.WindowsSdkDir, 'include')
if self.vs_ver <= 10.0:
return [include, join(include, 'gl')]
else:
... | [
"def",
"OSIncludes",
"(",
"self",
")",
":",
"include",
"=",
"join",
"(",
"self",
".",
"si",
".",
"WindowsSdkDir",
",",
"'include'",
")",
"if",
"self",
".",
"vs_ver",
"<=",
"10.0",
":",
"return",
"[",
"include",
",",
"join",
"(",
"include",
",",
"'gl'... | [
1378,
4
] | [
1399,
54
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.OSLibpath | (self) |
Microsoft Windows SDK Libraries Paths.
Return
------
list of str
paths
|
Microsoft Windows SDK Libraries Paths. | def OSLibpath(self):
"""
Microsoft Windows SDK Libraries Paths.
Return
------
list of str
paths
"""
ref = join(self.si.WindowsSdkDir, 'References')
libpath = []
if self.vs_ver <= 9.0:
libpath += self.OSLibraries
i... | [
"def",
"OSLibpath",
"(",
"self",
")",
":",
"ref",
"=",
"join",
"(",
"self",
".",
"si",
".",
"WindowsSdkDir",
",",
"'References'",
")",
"libpath",
"=",
"[",
"]",
"if",
"self",
".",
"vs_ver",
"<=",
"9.0",
":",
"libpath",
"+=",
"self",
".",
"OSLibraries... | [
1402,
4
] | [
1435,
22
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.SdkTools | (self) |
Microsoft Windows SDK Tools.
Return
------
list of str
paths
|
Microsoft Windows SDK Tools. | def SdkTools(self):
"""
Microsoft Windows SDK Tools.
Return
------
list of str
paths
"""
return list(self._sdk_tools()) | [
"def",
"SdkTools",
"(",
"self",
")",
":",
"return",
"list",
"(",
"self",
".",
"_sdk_tools",
"(",
")",
")"
] | [
1438,
4
] | [
1447,
38
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo._sdk_tools | (self) |
Microsoft Windows SDK Tools paths generator.
Return
------
generator of str
paths
|
Microsoft Windows SDK Tools paths generator. | def _sdk_tools(self):
"""
Microsoft Windows SDK Tools paths generator.
Return
------
generator of str
paths
"""
if self.vs_ver < 15.0:
bin_dir = 'Bin' if self.vs_ver <= 11.0 else r'Bin\x86'
yield join(self.si.WindowsSdkDir, bin... | [
"def",
"_sdk_tools",
"(",
"self",
")",
":",
"if",
"self",
".",
"vs_ver",
"<",
"15.0",
":",
"bin_dir",
"=",
"'Bin'",
"if",
"self",
".",
"vs_ver",
"<=",
"11.0",
"else",
"r'Bin\\x86'",
"yield",
"join",
"(",
"self",
".",
"si",
".",
"WindowsSdkDir",
",",
... | [
1449,
4
] | [
1482,
50
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo._sdk_subdir | (self) |
Microsoft Windows SDK version subdir.
Return
------
str
subdir
|
Microsoft Windows SDK version subdir. | def _sdk_subdir(self):
"""
Microsoft Windows SDK version subdir.
Return
------
str
subdir
"""
ucrtver = self.si.WindowsSdkLastVersion
return ('%s\\' % ucrtver) if ucrtver else '' | [
"def",
"_sdk_subdir",
"(",
"self",
")",
":",
"ucrtver",
"=",
"self",
".",
"si",
".",
"WindowsSdkLastVersion",
"return",
"(",
"'%s\\\\'",
"%",
"ucrtver",
")",
"if",
"ucrtver",
"else",
"''"
] | [
1485,
4
] | [
1495,
52
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.SdkSetup | (self) |
Microsoft Windows SDK Setup.
Return
------
list of str
paths
|
Microsoft Windows SDK Setup. | def SdkSetup(self):
"""
Microsoft Windows SDK Setup.
Return
------
list of str
paths
"""
if self.vs_ver > 9.0:
return []
return [join(self.si.WindowsSdkDir, 'Setup')] | [
"def",
"SdkSetup",
"(",
"self",
")",
":",
"if",
"self",
".",
"vs_ver",
">",
"9.0",
":",
"return",
"[",
"]",
"return",
"[",
"join",
"(",
"self",
".",
"si",
".",
"WindowsSdkDir",
",",
"'Setup'",
")",
"]"
] | [
1498,
4
] | [
1510,
53
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.FxTools | (self) |
Microsoft .NET Framework Tools.
Return
------
list of str
paths
|
Microsoft .NET Framework Tools. | def FxTools(self):
"""
Microsoft .NET Framework Tools.
Return
------
list of str
paths
"""
pi = self.pi
si = self.si
if self.vs_ver <= 10.0:
include32 = True
include64 = not pi.target_is_x86() and not pi.curren... | [
"def",
"FxTools",
"(",
"self",
")",
":",
"pi",
"=",
"self",
".",
"pi",
"si",
"=",
"self",
".",
"si",
"if",
"self",
".",
"vs_ver",
"<=",
"10.0",
":",
"include32",
"=",
"True",
"include64",
"=",
"not",
"pi",
".",
"target_is_x86",
"(",
")",
"and",
"... | [
1513,
4
] | [
1539,
20
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.NetFxSDKLibraries | (self) |
Microsoft .Net Framework SDK Libraries.
Return
------
list of str
paths
|
Microsoft .Net Framework SDK Libraries. | def NetFxSDKLibraries(self):
"""
Microsoft .Net Framework SDK Libraries.
Return
------
list of str
paths
"""
if self.vs_ver < 14.0 or not self.si.NetFxSdkDir:
return []
arch_subdir = self.pi.target_dir(x64=True)
return [jo... | [
"def",
"NetFxSDKLibraries",
"(",
"self",
")",
":",
"if",
"self",
".",
"vs_ver",
"<",
"14.0",
"or",
"not",
"self",
".",
"si",
".",
"NetFxSdkDir",
":",
"return",
"[",
"]",
"arch_subdir",
"=",
"self",
".",
"pi",
".",
"target_dir",
"(",
"x64",
"=",
"True... | [
1542,
4
] | [
1555,
69
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.NetFxSDKIncludes | (self) |
Microsoft .Net Framework SDK Includes.
Return
------
list of str
paths
|
Microsoft .Net Framework SDK Includes. | def NetFxSDKIncludes(self):
"""
Microsoft .Net Framework SDK Includes.
Return
------
list of str
paths
"""
if self.vs_ver < 14.0 or not self.si.NetFxSdkDir:
return []
return [join(self.si.NetFxSdkDir, r'include\um')] | [
"def",
"NetFxSDKIncludes",
"(",
"self",
")",
":",
"if",
"self",
".",
"vs_ver",
"<",
"14.0",
"or",
"not",
"self",
".",
"si",
".",
"NetFxSdkDir",
":",
"return",
"[",
"]",
"return",
"[",
"join",
"(",
"self",
".",
"si",
".",
"NetFxSdkDir",
",",
"r'includ... | [
1558,
4
] | [
1570,
57
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.VsTDb | (self) |
Microsoft Visual Studio Team System Database.
Return
------
list of str
paths
|
Microsoft Visual Studio Team System Database. | def VsTDb(self):
"""
Microsoft Visual Studio Team System Database.
Return
------
list of str
paths
"""
return [join(self.si.VSInstallDir, r'VSTSDB\Deploy')] | [
"def",
"VsTDb",
"(",
"self",
")",
":",
"return",
"[",
"join",
"(",
"self",
".",
"si",
".",
"VSInstallDir",
",",
"r'VSTSDB\\Deploy'",
")",
"]"
] | [
1573,
4
] | [
1582,
61
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.MSBuild | (self) |
Microsoft Build Engine.
Return
------
list of str
paths
|
Microsoft Build Engine. | def MSBuild(self):
"""
Microsoft Build Engine.
Return
------
list of str
paths
"""
if self.vs_ver < 12.0:
return []
elif self.vs_ver < 15.0:
base_path = self.si.ProgramFilesx86
arch_subdir = self.pi.current_... | [
"def",
"MSBuild",
"(",
"self",
")",
":",
"if",
"self",
".",
"vs_ver",
"<",
"12.0",
":",
"return",
"[",
"]",
"elif",
"self",
".",
"vs_ver",
"<",
"15.0",
":",
"base_path",
"=",
"self",
".",
"si",
".",
"ProgramFilesx86",
"arch_subdir",
"=",
"self",
".",... | [
1585,
4
] | [
1610,
20
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.HTMLHelpWorkshop | (self) |
Microsoft HTML Help Workshop.
Return
------
list of str
paths
|
Microsoft HTML Help Workshop. | def HTMLHelpWorkshop(self):
"""
Microsoft HTML Help Workshop.
Return
------
list of str
paths
"""
if self.vs_ver < 11.0:
return []
return [join(self.si.ProgramFilesx86, 'HTML Help Workshop')] | [
"def",
"HTMLHelpWorkshop",
"(",
"self",
")",
":",
"if",
"self",
".",
"vs_ver",
"<",
"11.0",
":",
"return",
"[",
"]",
"return",
"[",
"join",
"(",
"self",
".",
"si",
".",
"ProgramFilesx86",
",",
"'HTML Help Workshop'",
")",
"]"
] | [
1613,
4
] | [
1625,
68
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.UCRTLibraries | (self) |
Microsoft Universal C Runtime SDK Libraries.
Return
------
list of str
paths
|
Microsoft Universal C Runtime SDK Libraries. | def UCRTLibraries(self):
"""
Microsoft Universal C Runtime SDK Libraries.
Return
------
list of str
paths
"""
if self.vs_ver < 14.0:
return []
arch_subdir = self.pi.target_dir(x64=True)
lib = join(self.si.UniversalCRTSdkDi... | [
"def",
"UCRTLibraries",
"(",
"self",
")",
":",
"if",
"self",
".",
"vs_ver",
"<",
"14.0",
":",
"return",
"[",
"]",
"arch_subdir",
"=",
"self",
".",
"pi",
".",
"target_dir",
"(",
"x64",
"=",
"True",
")",
"lib",
"=",
"join",
"(",
"self",
".",
"si",
... | [
1628,
4
] | [
1643,
63
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.UCRTIncludes | (self) |
Microsoft Universal C Runtime SDK Include.
Return
------
list of str
paths
|
Microsoft Universal C Runtime SDK Include. | def UCRTIncludes(self):
"""
Microsoft Universal C Runtime SDK Include.
Return
------
list of str
paths
"""
if self.vs_ver < 14.0:
return []
include = join(self.si.UniversalCRTSdkDir, 'include')
return [join(include, '%sucr... | [
"def",
"UCRTIncludes",
"(",
"self",
")",
":",
"if",
"self",
".",
"vs_ver",
"<",
"14.0",
":",
"return",
"[",
"]",
"include",
"=",
"join",
"(",
"self",
".",
"si",
".",
"UniversalCRTSdkDir",
",",
"'include'",
")",
"return",
"[",
"join",
"(",
"include",
... | [
1646,
4
] | [
1659,
60
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo._ucrt_subdir | (self) |
Microsoft Universal C Runtime SDK version subdir.
Return
------
str
subdir
|
Microsoft Universal C Runtime SDK version subdir. | def _ucrt_subdir(self):
"""
Microsoft Universal C Runtime SDK version subdir.
Return
------
str
subdir
"""
ucrtver = self.si.UniversalCRTSdkLastVersion
return ('%s\\' % ucrtver) if ucrtver else '' | [
"def",
"_ucrt_subdir",
"(",
"self",
")",
":",
"ucrtver",
"=",
"self",
".",
"si",
".",
"UniversalCRTSdkLastVersion",
"return",
"(",
"'%s\\\\'",
"%",
"ucrtver",
")",
"if",
"ucrtver",
"else",
"''"
] | [
1662,
4
] | [
1672,
52
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.FSharp | (self) |
Microsoft Visual F#.
Return
------
list of str
paths
|
Microsoft Visual F#. | def FSharp(self):
"""
Microsoft Visual F#.
Return
------
list of str
paths
"""
if 11.0 > self.vs_ver > 12.0:
return []
return [self.si.FSharpInstallDir] | [
"def",
"FSharp",
"(",
"self",
")",
":",
"if",
"11.0",
">",
"self",
".",
"vs_ver",
">",
"12.0",
":",
"return",
"[",
"]",
"return",
"[",
"self",
".",
"si",
".",
"FSharpInstallDir",
"]"
] | [
1675,
4
] | [
1687,
41
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.VCRuntimeRedist | (self) |
Microsoft Visual C++ runtime redistributable dll.
Return
------
str
path
|
Microsoft Visual C++ runtime redistributable dll. | def VCRuntimeRedist(self):
"""
Microsoft Visual C++ runtime redistributable dll.
Return
------
str
path
"""
vcruntime = 'vcruntime%d0.dll' % self.vc_ver
arch_subdir = self.pi.target_dir(x64=True).strip('\\')
# Installation prefixes ca... | [
"def",
"VCRuntimeRedist",
"(",
"self",
")",
":",
"vcruntime",
"=",
"'vcruntime%d0.dll'",
"%",
"self",
".",
"vc_ver",
"arch_subdir",
"=",
"self",
".",
"pi",
".",
"target_dir",
"(",
"x64",
"=",
"True",
")",
".",
"strip",
"(",
"'\\\\'",
")",
"# Installation p... | [
1690,
4
] | [
1722,
27
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo.return_env | (self, exists=True) |
Return environment dict.
Parameters
----------
exists: bool
It True, only return existing paths.
Return
------
dict
environment
|
Return environment dict. | def return_env(self, exists=True):
"""
Return environment dict.
Parameters
----------
exists: bool
It True, only return existing paths.
Return
------
dict
environment
"""
env = dict(
include=self._build... | [
"def",
"return_env",
"(",
"self",
",",
"exists",
"=",
"True",
")",
":",
"env",
"=",
"dict",
"(",
"include",
"=",
"self",
".",
"_build_paths",
"(",
"'include'",
",",
"[",
"self",
".",
"VCIncludes",
",",
"self",
".",
"OSIncludes",
",",
"self",
".",
"UC... | [
1724,
4
] | [
1772,
18
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo._build_paths | (self, name, spec_path_lists, exists) |
Given an environment variable name and specified paths,
return a pathsep-separated string of paths containing
unique, extant, directories from those paths and from
the environment variable. Raise an error if no paths
are resolved.
Parameters
----------
n... |
Given an environment variable name and specified paths,
return a pathsep-separated string of paths containing
unique, extant, directories from those paths and from
the environment variable. Raise an error if no paths
are resolved. | def _build_paths(self, name, spec_path_lists, exists):
"""
Given an environment variable name and specified paths,
return a pathsep-separated string of paths containing
unique, extant, directories from those paths and from
the environment variable. Raise an error if no paths
... | [
"def",
"_build_paths",
"(",
"self",
",",
"name",
",",
"spec_path_lists",
",",
"exists",
")",
":",
"# flatten spec_path_lists",
"spec_paths",
"=",
"itertools",
".",
"chain",
".",
"from_iterable",
"(",
"spec_path_lists",
")",
"env_paths",
"=",
"environ",
".",
"get... | [
1774,
4
] | [
1805,
41
] | python | en | ['en', 'error', 'th'] | False |
EnvironmentInfo._unique_everseen | (iterable, key=None) |
List unique elements, preserving order.
Remember all elements ever seen.
_unique_everseen('AAAABBBCCDAABBB') --> A B C D
_unique_everseen('ABBCcAD', str.lower) --> A B C D
|
List unique elements, preserving order.
Remember all elements ever seen. | def _unique_everseen(iterable, key=None):
"""
List unique elements, preserving order.
Remember all elements ever seen.
_unique_everseen('AAAABBBCCDAABBB') --> A B C D
_unique_everseen('ABBCcAD', str.lower) --> A B C D
"""
seen = set()
seen_add = seen.add... | [
"def",
"_unique_everseen",
"(",
"iterable",
",",
"key",
"=",
"None",
")",
":",
"seen",
"=",
"set",
"(",
")",
"seen_add",
"=",
"seen",
".",
"add",
"if",
"key",
"is",
"None",
":",
"for",
"element",
"in",
"itertools",
".",
"filterfalse",
"(",
"seen",
".... | [
1809,
4
] | [
1829,
33
] | python | en | ['en', 'error', 'th'] | False |
WebsocketTask.connect | (self, attempt) |
Can not put get_channel_layer() in the init code because it is in the init
path of channel layers i.e. RedisChannelLayer() calls our init code.
|
Can not put get_channel_layer() in the init code because it is in the init
path of channel layers i.e. RedisChannelLayer() calls our init code.
| async def connect(self, attempt):
from awx.main.consumers import WebsocketSecretAuthHelper # noqa
logger.debug(f"Connection from {self.name} to {self.remote_host} attempt number {attempt}.")
'''
Can not put get_channel_layer() in the init code because it is in the init
path of... | [
"async",
"def",
"connect",
"(",
"self",
",",
"attempt",
")",
":",
"from",
"awx",
".",
"main",
".",
"consumers",
"import",
"WebsocketSecretAuthHelper",
"# noqa",
"logger",
".",
"debug",
"(",
"f\"Connection from {self.name} to {self.remote_host} attempt number {attempt}.\""... | [
75,
4
] | [
122,
39
] | python | en | ['en', 'error', 'th'] | False |
BroadcastWebsocketManager.__init__ | (self) |
{
'hostname1': BroadcastWebsocketTask(),
'hostname2': BroadcastWebsocketTask(),
'hostname3': BroadcastWebsocketTask(),
}
|
{
'hostname1': BroadcastWebsocketTask(),
'hostname2': BroadcastWebsocketTask(),
'hostname3': BroadcastWebsocketTask(),
}
| def __init__(self):
self.event_loop = asyncio.get_event_loop()
'''
{
'hostname1': BroadcastWebsocketTask(),
'hostname2': BroadcastWebsocketTask(),
'hostname3': BroadcastWebsocketTask(),
}
'''
self.broadcast_tasks = dict()
self.l... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"event_loop",
"=",
"asyncio",
".",
"get_event_loop",
"(",
")",
"self",
".",
"broadcast_tasks",
"=",
"dict",
"(",
")",
"self",
".",
"local_hostname",
"=",
"get_local_host",
"(",
")",
"self",
".",
"sta... | [
155,
4
] | [
166,
93
] | python | en | ['en', 'error', 'th'] | False |
FormPageWithRedirect.render_landing_page | (self, request, form_submission=None, *args, **kwargs) |
Renders the landing page OR if a receipt_page_redirect is chosen redirects to this page.
|
Renders the landing page OR if a receipt_page_redirect is chosen redirects to this page.
| def render_landing_page(self, request, form_submission=None, *args, **kwargs):
"""
Renders the landing page OR if a receipt_page_redirect is chosen redirects to this page.
"""
if self.thank_you_redirect_page:
return redirect(self.thank_you_redirect_page.url, permanent=False)
... | [
"def",
"render_landing_page",
"(",
"self",
",",
"request",
",",
"form_submission",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"thank_you_redirect_page",
":",
"return",
"redirect",
"(",
"self",
".",
"thank_you_redirec... | [
532,
4
] | [
539,
111
] | python | en | ['en', 'error', 'th'] | False |
CustomImageFilePath.get_upload_to | (self, filename) | Create a path that's file-system friendly.
By hashing the file's contents we guarantee an equal distribution
of files within our root directories. This also gives us a
better chance of uploading images with the same filename, but
different contents - this isn't guaranteed as we're only ... | Create a path that's file-system friendly. | def get_upload_to(self, filename):
"""Create a path that's file-system friendly.
By hashing the file's contents we guarantee an equal distribution
of files within our root directories. This also gives us a
better chance of uploading images with the same filename, but
different c... | [
"def",
"get_upload_to",
"(",
"self",
",",
"filename",
")",
":",
"original_filepath",
"=",
"super",
"(",
")",
".",
"get_upload_to",
"(",
"filename",
")",
"folder_name",
",",
"filename",
"=",
"original_filepath",
".",
"split",
"(",
"os",
".",
"path",
".",
"s... | [
1187,
4
] | [
1214,
64
] | python | en | ['en', 'en', 'en'] | True |
WalletTransactionStore.add_transaction_record | (self, record: TransactionRecord, in_transaction: bool) |
Store TransactionRecord in DB and Cache.
|
Store TransactionRecord in DB and Cache.
| async def add_transaction_record(self, record: TransactionRecord, in_transaction: bool) -> None:
"""
Store TransactionRecord in DB and Cache.
"""
self.tx_record_cache[record.name] = record
if record.wallet_id not in self.unconfirmed_for_wallet:
self.unconfirmed_for_wa... | [
"async",
"def",
"add_transaction_record",
"(",
"self",
",",
"record",
":",
"TransactionRecord",
",",
"in_transaction",
":",
"bool",
")",
"->",
"None",
":",
"self",
".",
"tx_record_cache",
"[",
"record",
".",
"name",
"]",
"=",
"record",
"if",
"record",
".",
... | [
102,
4
] | [
144,
46
] | python | en | ['en', 'error', 'th'] | False |
WalletTransactionStore.set_confirmed | (self, tx_id: bytes32, height: uint32) |
Updates transaction to be confirmed.
|
Updates transaction to be confirmed.
| async def set_confirmed(self, tx_id: bytes32, height: uint32):
"""
Updates transaction to be confirmed.
"""
current: Optional[TransactionRecord] = await self.get_transaction_record(tx_id)
if current is None:
return None
tx: TransactionRecord = TransactionRecor... | [
"async",
"def",
"set_confirmed",
"(",
"self",
",",
"tx_id",
":",
"bytes32",
",",
"height",
":",
"uint32",
")",
":",
"current",
":",
"Optional",
"[",
"TransactionRecord",
"]",
"=",
"await",
"self",
".",
"get_transaction_record",
"(",
"tx_id",
")",
"if",
"cu... | [
146,
4
] | [
170,
51
] | python | en | ['en', 'error', 'th'] | False |
WalletTransactionStore.increment_sent | (
self,
tx_id: bytes32,
name: str,
send_status: MempoolInclusionStatus,
err: Optional[Err],
) |
Updates transaction sent count (Full Node has received spend_bundle and sent ack).
|
Updates transaction sent count (Full Node has received spend_bundle and sent ack).
| async def increment_sent(
self,
tx_id: bytes32,
name: str,
send_status: MempoolInclusionStatus,
err: Optional[Err],
) -> bool:
"""
Updates transaction sent count (Full Node has received spend_bundle and sent ack).
"""
current: Optional[Transac... | [
"async",
"def",
"increment_sent",
"(",
"self",
",",
"tx_id",
":",
"bytes32",
",",
"name",
":",
"str",
",",
"send_status",
":",
"MempoolInclusionStatus",
",",
"err",
":",
"Optional",
"[",
"Err",
"]",
",",
")",
"->",
"bool",
":",
"current",
":",
"Optional"... | [
172,
4
] | [
222,
19
] | python | en | ['en', 'error', 'th'] | False |
WalletTransactionStore.tx_reorged | (self, record: TransactionRecord) |
Updates transaction sent count to 0 and resets confirmation data
|
Updates transaction sent count to 0 and resets confirmation data
| async def tx_reorged(self, record: TransactionRecord):
"""
Updates transaction sent count to 0 and resets confirmation data
"""
tx: TransactionRecord = TransactionRecord(
confirmed_at_height=uint32(0),
created_at_time=record.created_at_time,
to_puzzle_... | [
"async",
"def",
"tx_reorged",
"(",
"self",
",",
"record",
":",
"TransactionRecord",
")",
":",
"tx",
":",
"TransactionRecord",
"=",
"TransactionRecord",
"(",
"confirmed_at_height",
"=",
"uint32",
"(",
"0",
")",
",",
"created_at_time",
"=",
"record",
".",
"creat... | [
224,
4
] | [
245,
51
] | python | en | ['en', 'error', 'th'] | False |
WalletTransactionStore.get_transaction_record | (self, tx_id: bytes32) |
Checks DB and cache for TransactionRecord with id: id and returns it.
|
Checks DB and cache for TransactionRecord with id: id and returns it.
| async def get_transaction_record(self, tx_id: bytes32) -> Optional[TransactionRecord]:
"""
Checks DB and cache for TransactionRecord with id: id and returns it.
"""
if tx_id in self.tx_record_cache:
return self.tx_record_cache[tx_id]
# NOTE: bundle_id is being stored... | [
"async",
"def",
"get_transaction_record",
"(",
"self",
",",
"tx_id",
":",
"bytes32",
")",
"->",
"Optional",
"[",
"TransactionRecord",
"]",
":",
"if",
"tx_id",
"in",
"self",
".",
"tx_record_cache",
":",
"return",
"self",
".",
"tx_record_cache",
"[",
"tx_id",
... | [
247,
4
] | [
261,
19
] | python | en | ['en', 'error', 'th'] | False |
WalletTransactionStore.get_not_sent | (self) |
Returns the list of transaction that have not been received by full node yet.
|
Returns the list of transaction that have not been received by full node yet.
| async def get_not_sent(self) -> List[TransactionRecord]:
"""
Returns the list of transaction that have not been received by full node yet.
"""
current_time = int(time.time())
cursor = await self.db_connection.execute(
"SELECT * from transaction_record WHERE confirmed=... | [
"async",
"def",
"get_not_sent",
"(",
"self",
")",
"->",
"List",
"[",
"TransactionRecord",
"]",
":",
"current_time",
"=",
"int",
"(",
"time",
".",
"time",
"(",
")",
")",
"cursor",
"=",
"await",
"self",
".",
"db_connection",
".",
"execute",
"(",
"\"SELECT ... | [
263,
4
] | [
290,
22
] | python | en | ['en', 'error', 'th'] | False |
WalletTransactionStore.get_farming_rewards | (self) |
Returns the list of all farming rewards.
|
Returns the list of all farming rewards.
| async def get_farming_rewards(self):
"""
Returns the list of all farming rewards.
"""
fee_int = TransactionType.FEE_REWARD.value
pool_int = TransactionType.COINBASE_REWARD.value
cursor = await self.db_connection.execute(
"SELECT * from transaction_record WHERE... | [
"async",
"def",
"get_farming_rewards",
"(",
"self",
")",
":",
"fee_int",
"=",
"TransactionType",
".",
"FEE_REWARD",
".",
"value",
"pool_int",
"=",
"TransactionType",
".",
"COINBASE_REWARD",
".",
"value",
"cursor",
"=",
"await",
"self",
".",
"db_connection",
".",... | [
292,
4
] | [
309,
22
] | python | en | ['en', 'error', 'th'] | False |
WalletTransactionStore.get_all_unconfirmed | (self) |
Returns the list of all transaction that have not yet been confirmed.
|
Returns the list of all transaction that have not yet been confirmed.
| async def get_all_unconfirmed(self) -> List[TransactionRecord]:
"""
Returns the list of all transaction that have not yet been confirmed.
"""
cursor = await self.db_connection.execute("SELECT * from transaction_record WHERE confirmed=?", (0,))
rows = await cursor.fetchall()
... | [
"async",
"def",
"get_all_unconfirmed",
"(",
"self",
")",
"->",
"List",
"[",
"TransactionRecord",
"]",
":",
"cursor",
"=",
"await",
"self",
".",
"db_connection",
".",
"execute",
"(",
"\"SELECT * from transaction_record WHERE confirmed=?\"",
",",
"(",
"0",
",",
")",... | [
311,
4
] | [
325,
22
] | python | en | ['en', 'error', 'th'] | False |
WalletTransactionStore.get_unconfirmed_for_wallet | (self, wallet_id: int) |
Returns the list of transaction that have not yet been confirmed.
|
Returns the list of transaction that have not yet been confirmed.
| async def get_unconfirmed_for_wallet(self, wallet_id: int) -> List[TransactionRecord]:
"""
Returns the list of transaction that have not yet been confirmed.
"""
if wallet_id in self.unconfirmed_for_wallet:
return list(self.unconfirmed_for_wallet[wallet_id].values())
e... | [
"async",
"def",
"get_unconfirmed_for_wallet",
"(",
"self",
",",
"wallet_id",
":",
"int",
")",
"->",
"List",
"[",
"TransactionRecord",
"]",
":",
"if",
"wallet_id",
"in",
"self",
".",
"unconfirmed_for_wallet",
":",
"return",
"list",
"(",
"self",
".",
"unconfirme... | [
327,
4
] | [
334,
21
] | python | en | ['en', 'error', 'th'] | False |
WalletTransactionStore.get_transactions_between | (self, wallet_id: int, start, end) | Return a list of transaction between start and end index. List is in reverse chronological order.
start = 0 is most recent transaction
| Return a list of transaction between start and end index. List is in reverse chronological order.
start = 0 is most recent transaction
| async def get_transactions_between(self, wallet_id: int, start, end) -> List[TransactionRecord]:
"""Return a list of transaction between start and end index. List is in reverse chronological order.
start = 0 is most recent transaction
"""
limit = end - start
cursor = await self.d... | [
"async",
"def",
"get_transactions_between",
"(",
"self",
",",
"wallet_id",
":",
"int",
",",
"start",
",",
"end",
")",
"->",
"List",
"[",
"TransactionRecord",
"]",
":",
"limit",
"=",
"end",
"-",
"start",
"cursor",
"=",
"await",
"self",
".",
"db_connection",... | [
336,
4
] | [
358,
22
] | python | en | ['en', 'en', 'en'] | True |
WalletTransactionStore.get_all_transactions_for_wallet | (self, wallet_id: int, type: int = None) |
Returns all stored transactions.
|
Returns all stored transactions.
| async def get_all_transactions_for_wallet(self, wallet_id: int, type: int = None) -> List[TransactionRecord]:
"""
Returns all stored transactions.
"""
if type is None:
cursor = await self.db_connection.execute(
"SELECT * from transaction_record where wallet_id... | [
"async",
"def",
"get_all_transactions_for_wallet",
"(",
"self",
",",
"wallet_id",
":",
"int",
",",
"type",
":",
"int",
"=",
"None",
")",
"->",
"List",
"[",
"TransactionRecord",
"]",
":",
"if",
"type",
"is",
"None",
":",
"cursor",
"=",
"await",
"self",
".... | [
372,
4
] | [
398,
22
] | python | en | ['en', 'error', 'th'] | False |
WalletTransactionStore.get_all_transactions | (self) |
Returns all stored transactions.
|
Returns all stored transactions.
| async def get_all_transactions(self) -> List[TransactionRecord]:
"""
Returns all stored transactions.
"""
cursor = await self.db_connection.execute("SELECT * from transaction_record")
rows = await cursor.fetchall()
await cursor.close()
records = []
for ro... | [
"async",
"def",
"get_all_transactions",
"(",
"self",
")",
"->",
"List",
"[",
"TransactionRecord",
"]",
":",
"cursor",
"=",
"await",
"self",
".",
"db_connection",
".",
"execute",
"(",
"\"SELECT * from transaction_record\"",
")",
"rows",
"=",
"await",
"cursor",
".... | [
400,
4
] | [
413,
22
] | python | en | ['en', 'error', 'th'] | False |
parse_cookie | (cookie) |
Return a dictionary parsed from a `Cookie:` header string.
|
Return a dictionary parsed from a `Cookie:` header string.
| def parse_cookie(cookie):
"""
Return a dictionary parsed from a `Cookie:` header string.
"""
cookiedict = {}
if six.PY2:
cookie = force_str(cookie)
for chunk in cookie.split(str(';')):
if str('=') in chunk:
key, val = chunk.split(str('='), 1)
else:
... | [
"def",
"parse_cookie",
"(",
"cookie",
")",
":",
"cookiedict",
"=",
"{",
"}",
"if",
"six",
".",
"PY2",
":",
"cookie",
"=",
"force_str",
"(",
"cookie",
")",
"for",
"chunk",
"in",
"cookie",
".",
"split",
"(",
"str",
"(",
"';'",
")",
")",
":",
"if",
... | [
58,
0
] | [
76,
21
] | python | en | ['en', 'error', 'th'] | False |
normalize_together | (option_together) |
option_together can be either a tuple of tuples, or a single
tuple of two strings. Normalize it to a tuple of tuples, so that
calling code can uniformly expect that.
|
option_together can be either a tuple of tuples, or a single
tuple of two strings. Normalize it to a tuple of tuples, so that
calling code can uniformly expect that.
| def normalize_together(option_together):
"""
option_together can be either a tuple of tuples, or a single
tuple of two strings. Normalize it to a tuple of tuples, so that
calling code can uniformly expect that.
"""
try:
if not option_together:
return ()
if not isinsta... | [
"def",
"normalize_together",
"(",
"option_together",
")",
":",
"try",
":",
"if",
"not",
"option_together",
":",
"return",
"(",
")",
"if",
"not",
"isinstance",
"(",
"option_together",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"raise",
"TypeError",
"fir... | [
49,
0
] | [
68,
30
] | python | en | ['en', 'error', 'th'] | False |
LoadEdges | (filename, targets) | Load the edges map from the dump file, and filter it to only
show targets in |targets| and their depedendents. | Load the edges map from the dump file, and filter it to only
show targets in |targets| and their depedendents. | def LoadEdges(filename, targets):
"""Load the edges map from the dump file, and filter it to only
show targets in |targets| and their depedendents."""
file = open("dump.json")
edges = json.load(file)
file.close()
# Copy out only the edges we're interested in from the full edge list.
target_e... | [
"def",
"LoadEdges",
"(",
"filename",
",",
"targets",
")",
":",
"file",
"=",
"open",
"(",
"\"dump.json\"",
")",
"edges",
"=",
"json",
".",
"load",
"(",
"file",
")",
"file",
".",
"close",
"(",
")",
"# Copy out only the edges we're interested in from the full edge ... | [
23,
0
] | [
41,
23
] | python | en | ['en', 'en', 'en'] | True |
WriteGraph | (edges) | Print a graphviz graph to stdout.
|edges| is a map of target to a list of other targets it depends on. | Print a graphviz graph to stdout.
|edges| is a map of target to a list of other targets it depends on. | def WriteGraph(edges):
"""Print a graphviz graph to stdout.
|edges| is a map of target to a list of other targets it depends on."""
# Bucket targets by file.
files = collections.defaultdict(list)
for src, dst in edges.items():
build_file, target_name, toolset = ParseTarget(src)
files[... | [
"def",
"WriteGraph",
"(",
"edges",
")",
":",
"# Bucket targets by file.",
"files",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"src",
",",
"dst",
"in",
"edges",
".",
"items",
"(",
")",
":",
"build_file",
",",
"target_name",
",",
"tools... | [
44,
0
] | [
85,
14
] | python | en | ['en', 'ht', 'it'] | False |
Draw.settransform | (self, offset) | Sets a transformation offset. | Sets a transformation offset. | def settransform(self, offset):
"""Sets a transformation offset."""
(xoffset, yoffset) = offset
self.transform = (1, 0, xoffset, 0, 1, yoffset) | [
"def",
"settransform",
"(",
"self",
",",
"offset",
")",
":",
"(",
"xoffset",
",",
"yoffset",
")",
"=",
"offset",
"self",
".",
"transform",
"=",
"(",
"1",
",",
"0",
",",
"xoffset",
",",
"0",
",",
"1",
",",
"yoffset",
")"
] | [
92,
4
] | [
95,
55
] | python | en | ['en', 'en', 'en'] | True |
Draw.arc | (self, xy, start, end, *options) |
Draws an arc (a portion of a circle outline) between the start and end
angles, inside the given bounding box.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.arc`
|
Draws an arc (a portion of a circle outline) between the start and end
angles, inside the given bounding box. | def arc(self, xy, start, end, *options):
"""
Draws an arc (a portion of a circle outline) between the start and end
angles, inside the given bounding box.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.arc`
"""
self.render("arc", xy, start, end, *options) | [
"def",
"arc",
"(",
"self",
",",
"xy",
",",
"start",
",",
"end",
",",
"*",
"options",
")",
":",
"self",
".",
"render",
"(",
"\"arc\"",
",",
"xy",
",",
"start",
",",
"end",
",",
"*",
"options",
")"
] | [
97,
4
] | [
104,
52
] | python | en | ['en', 'error', 'th'] | False |
Draw.chord | (self, xy, start, end, *options) |
Same as :py:meth:`~PIL.ImageDraw2.Draw.arc`, but connects the end points
with a straight line.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.chord`
|
Same as :py:meth:`~PIL.ImageDraw2.Draw.arc`, but connects the end points
with a straight line. | def chord(self, xy, start, end, *options):
"""
Same as :py:meth:`~PIL.ImageDraw2.Draw.arc`, but connects the end points
with a straight line.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.chord`
"""
self.render("chord", xy, start, end, *options) | [
"def",
"chord",
"(",
"self",
",",
"xy",
",",
"start",
",",
"end",
",",
"*",
"options",
")",
":",
"self",
".",
"render",
"(",
"\"chord\"",
",",
"xy",
",",
"start",
",",
"end",
",",
"*",
"options",
")"
] | [
106,
4
] | [
113,
54
] | python | en | ['en', 'error', 'th'] | False |
Draw.ellipse | (self, xy, *options) |
Draws an ellipse inside the given bounding box.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.ellipse`
|
Draws an ellipse inside the given bounding box. | def ellipse(self, xy, *options):
"""
Draws an ellipse inside the given bounding box.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.ellipse`
"""
self.render("ellipse", xy, *options) | [
"def",
"ellipse",
"(",
"self",
",",
"xy",
",",
"*",
"options",
")",
":",
"self",
".",
"render",
"(",
"\"ellipse\"",
",",
"xy",
",",
"*",
"options",
")"
] | [
115,
4
] | [
121,
44
] | python | en | ['en', 'error', 'th'] | False |
Draw.line | (self, xy, *options) |
Draws a line between the coordinates in the ``xy`` list.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.line`
|
Draws a line between the coordinates in the ``xy`` list. | def line(self, xy, *options):
"""
Draws a line between the coordinates in the ``xy`` list.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.line`
"""
self.render("line", xy, *options) | [
"def",
"line",
"(",
"self",
",",
"xy",
",",
"*",
"options",
")",
":",
"self",
".",
"render",
"(",
"\"line\"",
",",
"xy",
",",
"*",
"options",
")"
] | [
123,
4
] | [
129,
41
] | python | en | ['en', 'error', 'th'] | False |
Draw.pieslice | (self, xy, start, end, *options) |
Same as arc, but also draws straight lines between the end points and the
center of the bounding box.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.pieslice`
|
Same as arc, but also draws straight lines between the end points and the
center of the bounding box. | def pieslice(self, xy, start, end, *options):
"""
Same as arc, but also draws straight lines between the end points and the
center of the bounding box.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.pieslice`
"""
self.render("pieslice", xy, start, end, *options) | [
"def",
"pieslice",
"(",
"self",
",",
"xy",
",",
"start",
",",
"end",
",",
"*",
"options",
")",
":",
"self",
".",
"render",
"(",
"\"pieslice\"",
",",
"xy",
",",
"start",
",",
"end",
",",
"*",
"options",
")"
] | [
131,
4
] | [
138,
57
] | python | en | ['en', 'error', 'th'] | False |
Draw.polygon | (self, xy, *options) |
Draws a polygon.
The polygon outline consists of straight lines between the given
coordinates, plus a straight line between the last and the first
coordinate.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.polygon`
|
Draws a polygon. | def polygon(self, xy, *options):
"""
Draws a polygon.
The polygon outline consists of straight lines between the given
coordinates, plus a straight line between the last and the first
coordinate.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.polygon`
"""
... | [
"def",
"polygon",
"(",
"self",
",",
"xy",
",",
"*",
"options",
")",
":",
"self",
".",
"render",
"(",
"\"polygon\"",
",",
"xy",
",",
"*",
"options",
")"
] | [
140,
4
] | [
151,
44
] | python | en | ['en', 'error', 'th'] | False |
Draw.rectangle | (self, xy, *options) |
Draws a rectangle.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.rectangle`
|
Draws a rectangle. | def rectangle(self, xy, *options):
"""
Draws a rectangle.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.rectangle`
"""
self.render("rectangle", xy, *options) | [
"def",
"rectangle",
"(",
"self",
",",
"xy",
",",
"*",
"options",
")",
":",
"self",
".",
"render",
"(",
"\"rectangle\"",
",",
"xy",
",",
"*",
"options",
")"
] | [
153,
4
] | [
159,
46
] | python | en | ['en', 'error', 'th'] | False |
Draw.text | (self, xy, text, font) |
Draws the string at the given position.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.text`
|
Draws the string at the given position. | def text(self, xy, text, font):
"""
Draws the string at the given position.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.text`
"""
if self.transform:
xy = ImagePath.Path(xy)
xy.transform(self.transform)
self.draw.text(xy, text, font=font.font, f... | [
"def",
"text",
"(",
"self",
",",
"xy",
",",
"text",
",",
"font",
")",
":",
"if",
"self",
".",
"transform",
":",
"xy",
"=",
"ImagePath",
".",
"Path",
"(",
"xy",
")",
"xy",
".",
"transform",
"(",
"self",
".",
"transform",
")",
"self",
".",
"draw",
... | [
161,
4
] | [
170,
65
] | python | en | ['en', 'error', 'th'] | False |
Draw.textsize | (self, text, font) |
Return the size of the given string, in pixels.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.textsize`
|
Return the size of the given string, in pixels. | def textsize(self, text, font):
"""
Return the size of the given string, in pixels.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.textsize`
"""
return self.draw.textsize(text, font=font.font) | [
"def",
"textsize",
"(",
"self",
",",
"text",
",",
"font",
")",
":",
"return",
"self",
".",
"draw",
".",
"textsize",
"(",
"text",
",",
"font",
"=",
"font",
".",
"font",
")"
] | [
172,
4
] | [
178,
55
] | python | en | ['en', 'error', 'th'] | False |
is_executable_file | (filename) |
Return 'True' if 'filename' names a valid file which is likely
an executable. A file is considered an executable if it starts with the
magic bytes for a EXE, Mach O, or ELF file.
|
Return 'True' if 'filename' names a valid file which is likely
an executable. A file is considered an executable if it starts with the
magic bytes for a EXE, Mach O, or ELF file.
| def is_executable_file(filename):
"""
Return 'True' if 'filename' names a valid file which is likely
an executable. A file is considered an executable if it starts with the
magic bytes for a EXE, Mach O, or ELF file.
"""
if not os.path.isfile(filename):
return False
with open(filenam... | [
"def",
"is_executable_file",
"(",
"filename",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"filename",
")",
":",
"return",
"False",
"with",
"open",
"(",
"filename",
",",
"mode",
"=",
"'rb'",
")",
"as",
"f",
":",
"magic_bytes",
"=",
"... | [
16,
0
] | [
38,
40
] | python | en | ['en', 'error', 'th'] | False |
is_json_file | (filename) |
Returns 'True' if 'filename' names a valid JSON output file.
'False' otherwise.
|
Returns 'True' if 'filename' names a valid JSON output file.
'False' otherwise.
| def is_json_file(filename):
"""
Returns 'True' if 'filename' names a valid JSON output file.
'False' otherwise.
"""
try:
with open(filename, 'r') as f:
json.load(f)
return True
except BaseException:
pass
return False | [
"def",
"is_json_file",
"(",
"filename",
")",
":",
"try",
":",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"f",
":",
"json",
".",
"load",
"(",
"f",
")",
"return",
"True",
"except",
"BaseException",
":",
"pass",
"return",
"False"
] | [
41,
0
] | [
52,
16
] | python | en | ['en', 'error', 'th'] | False |
classify_input_file | (filename) |
Return a tuple (type, msg) where 'type' specifies the classified type
of 'filename'. If 'type' is 'IT_Invalid' then 'msg' is a human readable
string represeting the error.
|
Return a tuple (type, msg) where 'type' specifies the classified type
of 'filename'. If 'type' is 'IT_Invalid' then 'msg' is a human readable
string represeting the error.
| def classify_input_file(filename):
"""
Return a tuple (type, msg) where 'type' specifies the classified type
of 'filename'. If 'type' is 'IT_Invalid' then 'msg' is a human readable
string represeting the error.
"""
ftype = IT_Invalid
err_msg = None
if not os.path.exists(filename):
... | [
"def",
"classify_input_file",
"(",
"filename",
")",
":",
"ftype",
"=",
"IT_Invalid",
"err_msg",
"=",
"None",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":",
"err_msg",
"=",
"\"'%s' does not exist\"",
"%",
"filename",
"elif",
"not",
... | [
55,
0
] | [
73,
25
] | python | en | ['en', 'error', 'th'] | False |
check_input_file | (filename) |
Classify the file named by 'filename' and return the classification.
If the file is classified as 'IT_Invalid' print an error message and exit
the program.
|
Classify the file named by 'filename' and return the classification.
If the file is classified as 'IT_Invalid' print an error message and exit
the program.
| def check_input_file(filename):
"""
Classify the file named by 'filename' and return the classification.
If the file is classified as 'IT_Invalid' print an error message and exit
the program.
"""
ftype, msg = classify_input_file(filename)
if ftype == IT_Invalid:
print("Invalid input ... | [
"def",
"check_input_file",
"(",
"filename",
")",
":",
"ftype",
",",
"msg",
"=",
"classify_input_file",
"(",
"filename",
")",
"if",
"ftype",
"==",
"IT_Invalid",
":",
"print",
"(",
"\"Invalid input file: %s\"",
"%",
"msg",
")",
"sys",
".",
"exit",
"(",
"1",
... | [
76,
0
] | [
86,
16
] | python | en | ['en', 'error', 'th'] | False |
find_benchmark_flag | (prefix, benchmark_flags) |
Search the specified list of flags for a flag matching `<prefix><arg>` and
if it is found return the arg it specifies. If specified more than once the
last value is returned. If the flag is not found None is returned.
|
Search the specified list of flags for a flag matching `<prefix><arg>` and
if it is found return the arg it specifies. If specified more than once the
last value is returned. If the flag is not found None is returned.
| def find_benchmark_flag(prefix, benchmark_flags):
"""
Search the specified list of flags for a flag matching `<prefix><arg>` and
if it is found return the arg it specifies. If specified more than once the
last value is returned. If the flag is not found None is returned.
"""
assert prefix.starts... | [
"def",
"find_benchmark_flag",
"(",
"prefix",
",",
"benchmark_flags",
")",
":",
"assert",
"prefix",
".",
"startswith",
"(",
"'--'",
")",
"and",
"prefix",
".",
"endswith",
"(",
"'='",
")",
"result",
"=",
"None",
"for",
"f",
"in",
"benchmark_flags",
":",
"if"... | [
89,
0
] | [
100,
17
] | python | en | ['en', 'error', 'th'] | False |
remove_benchmark_flags | (prefix, benchmark_flags) |
Return a new list containing the specified benchmark_flags except those
with the specified prefix.
|
Return a new list containing the specified benchmark_flags except those
with the specified prefix.
| def remove_benchmark_flags(prefix, benchmark_flags):
"""
Return a new list containing the specified benchmark_flags except those
with the specified prefix.
"""
assert prefix.startswith('--') and prefix.endswith('=')
return [f for f in benchmark_flags if not f.startswith(prefix)] | [
"def",
"remove_benchmark_flags",
"(",
"prefix",
",",
"benchmark_flags",
")",
":",
"assert",
"prefix",
".",
"startswith",
"(",
"'--'",
")",
"and",
"prefix",
".",
"endswith",
"(",
"'='",
")",
"return",
"[",
"f",
"for",
"f",
"in",
"benchmark_flags",
"if",
"no... | [
103,
0
] | [
109,
67
] | python | en | ['en', 'error', 'th'] | False |
load_benchmark_results | (fname) |
Read benchmark output from a file and return the JSON object.
REQUIRES: 'fname' names a file containing JSON benchmark output.
|
Read benchmark output from a file and return the JSON object.
REQUIRES: 'fname' names a file containing JSON benchmark output.
| def load_benchmark_results(fname):
"""
Read benchmark output from a file and return the JSON object.
REQUIRES: 'fname' names a file containing JSON benchmark output.
"""
with open(fname, 'r') as f:
return json.load(f) | [
"def",
"load_benchmark_results",
"(",
"fname",
")",
":",
"with",
"open",
"(",
"fname",
",",
"'r'",
")",
"as",
"f",
":",
"return",
"json",
".",
"load",
"(",
"f",
")"
] | [
112,
0
] | [
118,
27
] | python | en | ['en', 'error', 'th'] | False |
run_benchmark | (exe_name, benchmark_flags) |
Run a benchmark specified by 'exe_name' with the specified
'benchmark_flags'. The benchmark is run directly as a subprocess to preserve
real time console output.
RETURNS: A JSON object representing the benchmark output
|
Run a benchmark specified by 'exe_name' with the specified
'benchmark_flags'. The benchmark is run directly as a subprocess to preserve
real time console output.
RETURNS: A JSON object representing the benchmark output
| def run_benchmark(exe_name, benchmark_flags):
"""
Run a benchmark specified by 'exe_name' with the specified
'benchmark_flags'. The benchmark is run directly as a subprocess to preserve
real time console output.
RETURNS: A JSON object representing the benchmark output
"""
output_name = find_... | [
"def",
"run_benchmark",
"(",
"exe_name",
",",
"benchmark_flags",
")",
":",
"output_name",
"=",
"find_benchmark_flag",
"(",
"'--benchmark_out='",
",",
"benchmark_flags",
")",
"is_temp_output",
"=",
"False",
"if",
"output_name",
"is",
"None",
":",
"is_temp_output",
"=... | [
121,
0
] | [
147,
19
] | python | en | ['en', 'error', 'th'] | False |
run_or_load_benchmark | (filename, benchmark_flags) |
Get the results for a specified benchmark. If 'filename' specifies
an executable benchmark then the results are generated by running the
benchmark. Otherwise 'filename' must name a valid JSON output file,
which is loaded and the result returned.
|
Get the results for a specified benchmark. If 'filename' specifies
an executable benchmark then the results are generated by running the
benchmark. Otherwise 'filename' must name a valid JSON output file,
which is loaded and the result returned.
| def run_or_load_benchmark(filename, benchmark_flags):
"""
Get the results for a specified benchmark. If 'filename' specifies
an executable benchmark then the results are generated by running the
benchmark. Otherwise 'filename' must name a valid JSON output file,
which is loaded and the result return... | [
"def",
"run_or_load_benchmark",
"(",
"filename",
",",
"benchmark_flags",
")",
":",
"ftype",
"=",
"check_input_file",
"(",
"filename",
")",
"if",
"ftype",
"==",
"IT_JSON",
":",
"return",
"load_benchmark_results",
"(",
"filename",
")",
"elif",
"ftype",
"==",
"IT_E... | [
150,
0
] | [
163,
20
] | python | en | ['en', 'error', 'th'] | False |
CriteriaProcessor.aggregated_second | (self, data) |
Inform criteria of the data
:type data: bzt.modules.aggregator.DataPoint
|
Inform criteria of the data | def aggregated_second(self, data):
"""
Inform criteria of the data
:type data: bzt.modules.aggregator.DataPoint
"""
self.last_datapoint = data
for crit in self.criteria:
if isinstance(crit, DataCriterion):
if crit.selector != DataPoint.CUMULAT... | [
"def",
"aggregated_second",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"last_datapoint",
"=",
"data",
"for",
"crit",
"in",
"self",
".",
"criteria",
":",
"if",
"isinstance",
"(",
"crit",
",",
"DataCriterion",
")",
":",
"if",
"crit",
".",
"selector",... | [
66,
4
] | [
76,
48
] | python | en | ['en', 'error', 'th'] | False |
PassFailStatus.check | (self) |
Check if we should stop
:return:
|
Check if we should stop | def check(self):
"""
Check if we should stop
:return:
"""
if self.widget:
self.widget.update()
res = super(PassFailStatus, self).check()
for processor in self.processors:
res = res or processor.check()
return res | [
"def",
"check",
"(",
"self",
")",
":",
"if",
"self",
".",
"widget",
":",
"self",
".",
"widget",
".",
"update",
"(",
")",
"res",
"=",
"super",
"(",
"PassFailStatus",
",",
"self",
")",
".",
"check",
"(",
")",
"for",
"processor",
"in",
"self",
".",
... | [
136,
4
] | [
147,
18
] | python | en | ['en', 'error', 'th'] | False |
PassFailStatus.get_widget | (self) |
Add widget to console screen
:return:
|
Add widget to console screen | def get_widget(self):
"""
Add widget to console screen
:return:
"""
if not self.widget:
self.widget = PassFailWidget(self)
return self.widget | [
"def",
"get_widget",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"widget",
":",
"self",
".",
"widget",
"=",
"PassFailWidget",
"(",
"self",
")",
"return",
"self",
".",
"widget"
] | [
149,
4
] | [
157,
26
] | python | en | ['en', 'error', 'th'] | False |
FailCriterion.check | (self) |
Interrupt the execution if desired condition occured
:raise AutomatedShutdown:
|
Interrupt the execution if desired condition occured
:raise AutomatedShutdown:
| def check(self):
"""
Interrupt the execution if desired condition occured
:raise AutomatedShutdown:
"""
if self.stop and self.is_triggered:
if self.fail:
self.owner.log.info("Pass/Fail criterion triggered shutdown: %s", self)
raise Auto... | [
"def",
"check",
"(",
"self",
")",
":",
"if",
"self",
".",
"stop",
"and",
"self",
".",
"is_triggered",
":",
"if",
"self",
".",
"fail",
":",
"self",
".",
"owner",
".",
"log",
".",
"info",
"(",
"\"Pass/Fail criterion triggered shutdown: %s\"",
",",
"self",
... | [
246,
4
] | [
257,
20
] | python | en | ['en', 'error', 'th'] | False |
DataCriterion.aggregated_second | (self, data) |
Main criteria logic contained here
:type data: bzt.modules.aggregator.DataPoint
|
Main criteria logic contained here | def aggregated_second(self, data):
"""
Main criteria logic contained here
:type data: bzt.modules.aggregator.DataPoint
"""
part = data[self.selector]
if self.label not in part:
self.owner.log.debug("No label %s in %s", self.label, part.keys())
ret... | [
"def",
"aggregated_second",
"(",
"self",
",",
"data",
")",
":",
"part",
"=",
"data",
"[",
"self",
".",
"selector",
"]",
"if",
"self",
".",
"label",
"not",
"in",
"part",
":",
"self",
".",
"owner",
".",
"log",
".",
"debug",
"(",
"\"No label %s in %s\"",
... | [
328,
4
] | [
340,
67
] | python | en | ['en', 'error', 'th'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.