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.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", ...
[ 608, 4 ]
[ 625, 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",...
[ 627, 4 ]
[ 665, 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...
[ 696, 4 ]
[ 713, 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", "...
[ 715, 4 ]
[ 749, 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...
[ 751, 4 ]
[ 791, 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", "]", ")", ")" ]
[ 794, 4 ]
[ 808, 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", "...
[ 811, 4 ]
[ 825, 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", ...
[ 828, 4 ]
[ 843, 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", ...
[ 845, 4 ]
[ 873, 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", ...
[ 875, 4 ]
[ 893, 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", ".", ...
[ 896, 4 ]
[ 914, 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'", ")", ")" ]
[ 917, 4 ]
[ 926, 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", ")", ...
[ 929, 4 ]
[ 969, 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",...
[ 972, 4 ]
[ 1004, 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'",...
[ 1007, 4 ]
[ 1017, 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", ...
[ 1020, 4 ]
[ 1037, 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'", ")", ")" ]
[ 1040, 4 ]
[ 1049, 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"...
[ 1052, 4 ]
[ 1065, 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...
[ 1068, 4 ]
[ 1083, 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", "("...
[ 1086, 4 ]
[ 1099, 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", "...
[ 1102, 4 ]
[ 1115, 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", ")" ]
[ 1118, 4 ]
[ 1127, 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", ")" ]
[ 1130, 4 ]
[ 1139, 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", "=", ...
[ 1141, 4 ]
[ 1168, 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", "...
[ 1171, 4 ]
[ 1193, 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" ]
[ 1230, 4 ]
[ 1239, 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" ]
[ 1242, 4 ]
[ 1251, 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", ",", "...
[ 1254, 4 ]
[ 1271, 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'", ")", "]" ]
[ 1274, 4 ]
[ 1284, 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"...
[ 1287, 4 ]
[ 1305, 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'", ")", "]" ]
[ 1308, 4 ]
[ 1319, 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...
[ 1322, 4 ]
[ 1356, 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", "....
[ 1359, 4 ]
[ 1376, 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'...
[ 1379, 4 ]
[ 1400, 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...
[ 1403, 4 ]
[ 1436, 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", "(", ")", ")" ]
[ 1439, 4 ]
[ 1448, 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", ",", ...
[ 1450, 4 ]
[ 1483, 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", "''" ]
[ 1486, 4 ]
[ 1496, 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'", ")", "]" ]
[ 1499, 4 ]
[ 1511, 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", "...
[ 1514, 4 ]
[ 1540, 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...
[ 1543, 4 ]
[ 1556, 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...
[ 1559, 4 ]
[ 1571, 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'", ")", "]" ]
[ 1574, 4 ]
[ 1583, 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", ".",...
[ 1586, 4 ]
[ 1611, 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'", ")", "]" ]
[ 1614, 4 ]
[ 1626, 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", ...
[ 1629, 4 ]
[ 1644, 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", ...
[ 1647, 4 ]
[ 1660, 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", "''" ]
[ 1663, 4 ]
[ 1673, 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", "]" ]
[ 1676, 4 ]
[ 1688, 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...
[ 1691, 4 ]
[ 1723, 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...
[ 1725, 4 ]
[ 1773, 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...
[ 1775, 4 ]
[ 1806, 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", "filterfalse", "(", "seen", ".", "__contains__", ...
[ 1810, 4 ]
[ 1830, 33 ]
python
en
['en', 'error', 'th']
False
current_umask
()
Get the current umask which involves having to set it temporarily.
Get the current umask which involves having to set it temporarily.
def current_umask(): """Get the current umask which involves having to set it temporarily.""" mask = os.umask(0) os.umask(mask) return mask
[ "def", "current_umask", "(", ")", ":", "mask", "=", "os", ".", "umask", "(", "0", ")", "os", ".", "umask", "(", "mask", ")", "return", "mask" ]
[ 49, 0 ]
[ 53, 15 ]
python
en
['en', 'en', 'en']
True
has_leading_dir
(paths)
Returns true if all the paths have the same leading path name (i.e., everything is in one subdirectory in an archive)
Returns true if all the paths have the same leading path name (i.e., everything is in one subdirectory in an archive)
def has_leading_dir(paths): # type: (Iterable[Union[str, Text]]) -> bool """Returns true if all the paths have the same leading path name (i.e., everything is in one subdirectory in an archive)""" common_prefix = None for path in paths: prefix, rest = split_leading_dir(path) if not p...
[ "def", "has_leading_dir", "(", "paths", ")", ":", "# type: (Iterable[Union[str, Text]]) -> bool", "common_prefix", "=", "None", "for", "path", "in", "paths", ":", "prefix", ",", "rest", "=", "split_leading_dir", "(", "path", ")", "if", "not", "prefix", ":", "ret...
[ 72, 0 ]
[ 85, 15 ]
python
en
['en', 'en', 'en']
True
is_within_directory
(directory, target)
Return true if the absolute path of target is within the directory
Return true if the absolute path of target is within the directory
def is_within_directory(directory, target): # type: ((Union[str, Text]), (Union[str, Text])) -> bool """ Return true if the absolute path of target is within the directory """ abs_directory = os.path.abspath(directory) abs_target = os.path.abspath(target) prefix = os.path.commonprefix([abs_...
[ "def", "is_within_directory", "(", "directory", ",", "target", ")", ":", "# type: ((Union[str, Text]), (Union[str, Text])) -> bool", "abs_directory", "=", "os", ".", "path", ".", "abspath", "(", "directory", ")", "abs_target", "=", "os", ".", "path", ".", "abspath",...
[ 88, 0 ]
[ 97, 34 ]
python
en
['en', 'error', 'th']
False
unzip_file
(filename, location, flatten=True)
Unzip the file (with path `filename`) to the destination `location`. All files are written based on system defaults and umask (i.e. permissions are not preserved), except that regular file members with any execute permissions (user, group, or world) have "chmod +x" applied after being written. Not...
Unzip the file (with path `filename`) to the destination `location`. All files are written based on system defaults and umask (i.e. permissions are not preserved), except that regular file members with any execute permissions (user, group, or world) have "chmod +x" applied after being written. Not...
def unzip_file(filename, location, flatten=True): # type: (str, str, bool) -> None """ Unzip the file (with path `filename`) to the destination `location`. All files are written based on system defaults and umask (i.e. permissions are not preserved), except that regular file members with any execut...
[ "def", "unzip_file", "(", "filename", ",", "location", ",", "flatten", "=", "True", ")", ":", "# type: (str, str, bool) -> None", "ensure_dir", "(", "location", ")", "zipfp", "=", "open", "(", "filename", ",", "'rb'", ")", "try", ":", "zip", "=", "zipfile", ...
[ 100, 0 ]
[ 149, 21 ]
python
en
['en', 'error', 'th']
False
untar_file
(filename, location)
Untar the file (with path `filename`) to the destination `location`. All files are written based on system defaults and umask (i.e. permissions are not preserved), except that regular file members with any execute permissions (user, group, or world) have "chmod +x" applied after being written. Not...
Untar the file (with path `filename`) to the destination `location`. All files are written based on system defaults and umask (i.e. permissions are not preserved), except that regular file members with any execute permissions (user, group, or world) have "chmod +x" applied after being written. Not...
def untar_file(filename, location): # type: (str, str) -> None """ Untar the file (with path `filename`) to the destination `location`. All files are written based on system defaults and umask (i.e. permissions are not preserved), except that regular file members with any execute permissions (us...
[ "def", "untar_file", "(", "filename", ",", "location", ")", ":", "# type: (str, str) -> None", "ensure_dir", "(", "location", ")", "if", "filename", ".", "lower", "(", ")", ".", "endswith", "(", "'.gz'", ")", "or", "filename", ".", "lower", "(", ")", ".", ...
[ 152, 0 ]
[ 233, 19 ]
python
en
['en', 'error', 'th']
False
memorized_timedelta
(seconds)
Create only one instance of each distinct timedelta
Create only one instance of each distinct timedelta
def memorized_timedelta(seconds): '''Create only one instance of each distinct timedelta''' try: return _timedelta_cache[seconds] except KeyError: delta = timedelta(seconds=seconds) _timedelta_cache[seconds] = delta return delta
[ "def", "memorized_timedelta", "(", "seconds", ")", ":", "try", ":", "return", "_timedelta_cache", "[", "seconds", "]", "except", "KeyError", ":", "delta", "=", "timedelta", "(", "seconds", "=", "seconds", ")", "_timedelta_cache", "[", "seconds", "]", "=", "d...
[ 17, 0 ]
[ 24, 20 ]
python
en
['en', 'en', 'en']
True
memorized_datetime
(seconds)
Create only one instance of each distinct datetime
Create only one instance of each distinct datetime
def memorized_datetime(seconds): '''Create only one instance of each distinct datetime''' try: return _datetime_cache[seconds] except KeyError: # NB. We can't just do datetime.utcfromtimestamp(seconds) as this # fails with negative values under Windows (Bug #90096) dt = _epoc...
[ "def", "memorized_datetime", "(", "seconds", ")", ":", "try", ":", "return", "_datetime_cache", "[", "seconds", "]", "except", "KeyError", ":", "# NB. We can't just do datetime.utcfromtimestamp(seconds) as this", "# fails with negative values under Windows (Bug #90096)", "dt", ...
[ 30, 0 ]
[ 39, 17 ]
python
en
['en', 'en', 'en']
True
memorized_ttinfo
(*args)
Create only one instance of each distinct tuple
Create only one instance of each distinct tuple
def memorized_ttinfo(*args): '''Create only one instance of each distinct tuple''' try: return _ttinfo_cache[args] except KeyError: ttinfo = ( memorized_timedelta(args[0]), memorized_timedelta(args[1]), args[2] ) _ttinfo_cache[args] = ttinf...
[ "def", "memorized_ttinfo", "(", "*", "args", ")", ":", "try", ":", "return", "_ttinfo_cache", "[", "args", "]", "except", "KeyError", ":", "ttinfo", "=", "(", "memorized_timedelta", "(", "args", "[", "0", "]", ")", ",", "memorized_timedelta", "(", "args", ...
[ 44, 0 ]
[ 55, 21 ]
python
en
['en', 'en', 'en']
True
_to_seconds
(td)
Convert a timedelta to seconds
Convert a timedelta to seconds
def _to_seconds(td): '''Convert a timedelta to seconds''' return td.seconds + td.days * 24 * 60 * 60
[ "def", "_to_seconds", "(", "td", ")", ":", "return", "td", ".", "seconds", "+", "td", ".", "days", "*", "24", "*", "60", "*", "60" ]
[ 60, 0 ]
[ 62, 46 ]
python
en
['en', 'en', 'en']
True
unpickler
(zone, utcoffset=None, dstoffset=None, tzname=None)
Factory function for unpickling pytz tzinfo instances. This is shared for both StaticTzInfo and DstTzInfo instances, because database changes could cause a zones implementation to switch between these two base classes and we can't break pickles on a pytz version upgrade.
Factory function for unpickling pytz tzinfo instances.
def unpickler(zone, utcoffset=None, dstoffset=None, tzname=None): """Factory function for unpickling pytz tzinfo instances. This is shared for both StaticTzInfo and DstTzInfo instances, because database changes could cause a zones implementation to switch between these two base classes and we can't bre...
[ "def", "unpickler", "(", "zone", ",", "utcoffset", "=", "None", ",", "dstoffset", "=", "None", ",", "tzname", "=", "None", ")", ":", "# Raises a KeyError if zone no longer exists, which should never happen", "# and would be a bug.", "tz", "=", "pytz", ".", "timezone",...
[ 528, 0 ]
[ 576, 27 ]
python
en
['en', 'fr', 'en']
True
StaticTzInfo.fromutc
(self, dt)
See datetime.tzinfo.fromutc
See datetime.tzinfo.fromutc
def fromutc(self, dt): '''See datetime.tzinfo.fromutc''' if dt.tzinfo is not None and dt.tzinfo is not self: raise ValueError('fromutc: dt.tzinfo is not self') return (dt + self._utcoffset).replace(tzinfo=self)
[ "def", "fromutc", "(", "self", ",", "dt", ")", ":", "if", "dt", ".", "tzinfo", "is", "not", "None", "and", "dt", ".", "tzinfo", "is", "not", "self", ":", "raise", "ValueError", "(", "'fromutc: dt.tzinfo is not self'", ")", "return", "(", "dt", "+", "se...
[ 81, 4 ]
[ 85, 58 ]
python
en
['en', 'en', 'de']
False
StaticTzInfo.utcoffset
(self, dt, is_dst=None)
See datetime.tzinfo.utcoffset is_dst is ignored for StaticTzInfo, and exists only to retain compatibility with DstTzInfo.
See datetime.tzinfo.utcoffset
def utcoffset(self, dt, is_dst=None): '''See datetime.tzinfo.utcoffset is_dst is ignored for StaticTzInfo, and exists only to retain compatibility with DstTzInfo. ''' return self._utcoffset
[ "def", "utcoffset", "(", "self", ",", "dt", ",", "is_dst", "=", "None", ")", ":", "return", "self", ".", "_utcoffset" ]
[ 87, 4 ]
[ 93, 30 ]
python
de
['en', 'ny', 'de']
False
StaticTzInfo.dst
(self, dt, is_dst=None)
See datetime.tzinfo.dst is_dst is ignored for StaticTzInfo, and exists only to retain compatibility with DstTzInfo.
See datetime.tzinfo.dst
def dst(self, dt, is_dst=None): '''See datetime.tzinfo.dst is_dst is ignored for StaticTzInfo, and exists only to retain compatibility with DstTzInfo. ''' return _notime
[ "def", "dst", "(", "self", ",", "dt", ",", "is_dst", "=", "None", ")", ":", "return", "_notime" ]
[ 95, 4 ]
[ 101, 22 ]
python
en
['en', 'en', 'de']
False
StaticTzInfo.tzname
(self, dt, is_dst=None)
See datetime.tzinfo.tzname is_dst is ignored for StaticTzInfo, and exists only to retain compatibility with DstTzInfo.
See datetime.tzinfo.tzname
def tzname(self, dt, is_dst=None): '''See datetime.tzinfo.tzname is_dst is ignored for StaticTzInfo, and exists only to retain compatibility with DstTzInfo. ''' return self._tzname
[ "def", "tzname", "(", "self", ",", "dt", ",", "is_dst", "=", "None", ")", ":", "return", "self", ".", "_tzname" ]
[ 103, 4 ]
[ 109, 27 ]
python
de
['de', 'en', 'de']
False
StaticTzInfo.localize
(self, dt, is_dst=False)
Convert naive time to local time
Convert naive time to local time
def localize(self, dt, is_dst=False): '''Convert naive time to local time''' if dt.tzinfo is not None: raise ValueError('Not naive datetime (tzinfo is already set)') return dt.replace(tzinfo=self)
[ "def", "localize", "(", "self", ",", "dt", ",", "is_dst", "=", "False", ")", ":", "if", "dt", ".", "tzinfo", "is", "not", "None", ":", "raise", "ValueError", "(", "'Not naive datetime (tzinfo is already set)'", ")", "return", "dt", ".", "replace", "(", "tz...
[ 111, 4 ]
[ 115, 38 ]
python
en
['en', 'en', 'en']
True
StaticTzInfo.normalize
(self, dt, is_dst=False)
Correct the timezone information on the given datetime. This is normally a no-op, as StaticTzInfo timezones never have ambiguous cases to correct: >>> from pytz import timezone >>> gmt = timezone('GMT') >>> isinstance(gmt, StaticTzInfo) True >>> dt = datetime(20...
Correct the timezone information on the given datetime.
def normalize(self, dt, is_dst=False): '''Correct the timezone information on the given datetime. This is normally a no-op, as StaticTzInfo timezones never have ambiguous cases to correct: >>> from pytz import timezone >>> gmt = timezone('GMT') >>> isinstance(gmt, Stati...
[ "def", "normalize", "(", "self", ",", "dt", ",", "is_dst", "=", "False", ")", ":", "if", "dt", ".", "tzinfo", "is", "self", ":", "return", "dt", "if", "dt", ".", "tzinfo", "is", "None", ":", "raise", "ValueError", "(", "'Naive time - no tzinfo set'", "...
[ 117, 4 ]
[ 144, 34 ]
python
en
['en', 'en', 'en']
True
DstTzInfo.fromutc
(self, dt)
See datetime.tzinfo.fromutc
See datetime.tzinfo.fromutc
def fromutc(self, dt): '''See datetime.tzinfo.fromutc''' if (dt.tzinfo is not None and getattr(dt.tzinfo, '_tzinfos', None) is not self._tzinfos): raise ValueError('fromutc: dt.tzinfo is not self') dt = dt.replace(tzinfo=None) idx = max(0, bisect_right(self._u...
[ "def", "fromutc", "(", "self", ",", "dt", ")", ":", "if", "(", "dt", ".", "tzinfo", "is", "not", "None", "and", "getattr", "(", "dt", ".", "tzinfo", ",", "'_tzinfos'", ",", "None", ")", "is", "not", "self", ".", "_tzinfos", ")", ":", "raise", "Va...
[ 192, 4 ]
[ 200, 63 ]
python
en
['en', 'en', 'de']
False
DstTzInfo.normalize
(self, dt)
Correct the timezone information on the given datetime If date arithmetic crosses DST boundaries, the tzinfo is not magically adjusted. This method normalizes the tzinfo to the correct one. To test, first we need to do some setup >>> from pytz import timezone >>> utc =...
Correct the timezone information on the given datetime
def normalize(self, dt): '''Correct the timezone information on the given datetime If date arithmetic crosses DST boundaries, the tzinfo is not magically adjusted. This method normalizes the tzinfo to the correct one. To test, first we need to do some setup >>> from py...
[ "def", "normalize", "(", "self", ",", "dt", ")", ":", "if", "dt", ".", "tzinfo", "is", "None", ":", "raise", "ValueError", "(", "'Naive time - no tzinfo set'", ")", "# Convert dt in localtime to UTC", "offset", "=", "dt", ".", "tzinfo", ".", "_utcoffset", "dt"...
[ 202, 4 ]
[ 255, 31 ]
python
en
['en', 'en', 'en']
True
DstTzInfo.localize
(self, dt, is_dst=False)
Convert naive time to local time. This method should be used to construct localtimes, rather than passing a tzinfo argument to a datetime constructor. is_dst is used to determine the correct timezone in the ambigous period at the end of daylight saving time. >>> from pytz impo...
Convert naive time to local time.
def localize(self, dt, is_dst=False): '''Convert naive time to local time. This method should be used to construct localtimes, rather than passing a tzinfo argument to a datetime constructor. is_dst is used to determine the correct timezone in the ambigous period at the end of ...
[ "def", "localize", "(", "self", ",", "dt", ",", "is_dst", "=", "False", ")", ":", "if", "dt", ".", "tzinfo", "is", "not", "None", ":", "raise", "ValueError", "(", "'Not naive datetime (tzinfo is already set)'", ")", "# Find the two best possibilities.", "possible_...
[ 257, 4 ]
[ 393, 51 ]
python
en
['en', 'en', 'en']
True
DstTzInfo.utcoffset
(self, dt, is_dst=None)
See datetime.tzinfo.utcoffset The is_dst parameter may be used to remove ambiguity during DST transitions. >>> from pytz import timezone >>> tz = timezone('America/St_Johns') >>> ambiguous = datetime(2009, 10, 31, 23, 30) >>> str(tz.utcoffset(ambiguous, is_dst=False)) ...
See datetime.tzinfo.utcoffset
def utcoffset(self, dt, is_dst=None): '''See datetime.tzinfo.utcoffset The is_dst parameter may be used to remove ambiguity during DST transitions. >>> from pytz import timezone >>> tz = timezone('America/St_Johns') >>> ambiguous = datetime(2009, 10, 31, 23, 30) ...
[ "def", "utcoffset", "(", "self", ",", "dt", ",", "is_dst", "=", "None", ")", ":", "if", "dt", "is", "None", ":", "return", "None", "elif", "dt", ".", "tzinfo", "is", "not", "self", ":", "dt", "=", "self", ".", "localize", "(", "dt", ",", "is_dst"...
[ 395, 4 ]
[ 424, 34 ]
python
de
['en', 'ny', 'de']
False
DstTzInfo.dst
(self, dt, is_dst=None)
See datetime.tzinfo.dst The is_dst parameter may be used to remove ambiguity during DST transitions. >>> from pytz import timezone >>> tz = timezone('America/St_Johns') >>> normal = datetime(2009, 9, 1) >>> str(tz.dst(normal)) '1:00:00' >>> str(tz.dst(...
See datetime.tzinfo.dst
def dst(self, dt, is_dst=None): '''See datetime.tzinfo.dst The is_dst parameter may be used to remove ambiguity during DST transitions. >>> from pytz import timezone >>> tz = timezone('America/St_Johns') >>> normal = datetime(2009, 9, 1) >>> str(tz.dst(normal)...
[ "def", "dst", "(", "self", ",", "dt", ",", "is_dst", "=", "None", ")", ":", "if", "dt", "is", "None", ":", "return", "None", "elif", "dt", ".", "tzinfo", "is", "not", "self", ":", "dt", "=", "self", ".", "localize", "(", "dt", ",", "is_dst", ")...
[ 426, 4 ]
[ 463, 28 ]
python
en
['en', 'en', 'de']
False
DstTzInfo.tzname
(self, dt, is_dst=None)
See datetime.tzinfo.tzname The is_dst parameter may be used to remove ambiguity during DST transitions. >>> from pytz import timezone >>> tz = timezone('America/St_Johns') >>> normal = datetime(2009, 9, 1) >>> tz.tzname(normal) 'NDT' >>> tz.tzname(norm...
See datetime.tzinfo.tzname
def tzname(self, dt, is_dst=None): '''See datetime.tzinfo.tzname The is_dst parameter may be used to remove ambiguity during DST transitions. >>> from pytz import timezone >>> tz = timezone('America/St_Johns') >>> normal = datetime(2009, 9, 1) >>> tz.tzname(no...
[ "def", "tzname", "(", "self", ",", "dt", ",", "is_dst", "=", "None", ")", ":", "if", "dt", "is", "None", ":", "return", "self", ".", "zone", "elif", "dt", ".", "tzinfo", "is", "not", "self", ":", "dt", "=", "self", ".", "localize", "(", "dt", "...
[ 465, 4 ]
[ 501, 31 ]
python
de
['de', 'en', 'de']
False
display_list
(values: List[str], display_limit: int)
Given a list of values, return a string nicely formatting those values, summarizing when you have more than `display_limit`. Eg, for a `display_limit` of 3 we get the following possible cases: Jessica Jessica and Waseem Jessica, Waseem, and Tim Jessica, Waseem, Tim, and 1 other Jessica...
Given a list of values, return a string nicely formatting those values, summarizing when you have more than `display_limit`. Eg, for a `display_limit` of 3 we get the following possible cases:
def display_list(values: List[str], display_limit: int) -> str: """ Given a list of values, return a string nicely formatting those values, summarizing when you have more than `display_limit`. Eg, for a `display_limit` of 3 we get the following possible cases: Jessica Jessica and Waseem Jes...
[ "def", "display_list", "(", "values", ":", "List", "[", "str", "]", ",", "display_limit", ":", "int", ")", "->", "str", ":", "if", "len", "(", "values", ")", "==", "1", ":", "# One value, show it.", "display_string", "=", "f\"{values[0]}\"", "elif", "len",...
[ 40, 0 ]
[ 64, 25 ]
python
en
['en', 'error', 'th']
False
render_markdown_path
( markdown_file_path: str, context: Mapping[str, Any] = {}, pure_markdown: bool = False )
Given a path to a Markdown file, return the rendered HTML. Note that this assumes that any HTML in the Markdown file is trusted; it is intended to be used for documentation, not user data.
Given a path to a Markdown file, return the rendered HTML.
def render_markdown_path( markdown_file_path: str, context: Mapping[str, Any] = {}, pure_markdown: bool = False ) -> str: """Given a path to a Markdown file, return the rendered HTML. Note that this assumes that any HTML in the Markdown file is trusted; it is intended to be used for documentation, not ...
[ "def", "render_markdown_path", "(", "markdown_file_path", ":", "str", ",", "context", ":", "Mapping", "[", "str", ",", "Any", "]", "=", "{", "}", ",", "pure_markdown", ":", "bool", "=", "False", ")", "->", "str", ":", "# We set this global hackishly", "from"...
[ 83, 0 ]
[ 172, 35 ]
python
en
['en', 'en', 'en']
True
install._called_from_setup
(run_frame)
Attempt to detect whether run() was called from setup() or by another command. If called by setup(), the parent caller will be the 'run_command' method in 'distutils.dist', and *its* caller will be the 'run_commands' method. If called any other way, the immediate caller *might...
Attempt to detect whether run() was called from setup() or by another command. If called by setup(), the parent caller will be the 'run_command' method in 'distutils.dist', and *its* caller will be the 'run_commands' method. If called any other way, the immediate caller *might...
def _called_from_setup(run_frame): """ Attempt to detect whether run() was called from setup() or by another command. If called by setup(), the parent caller will be the 'run_command' method in 'distutils.dist', and *its* caller will be the 'run_commands' method. If called any ...
[ "def", "_called_from_setup", "(", "run_frame", ")", ":", "if", "run_frame", "is", "None", ":", "msg", "=", "\"Call stack not available. bdist_* commands may fail.\"", "warnings", ".", "warn", "(", "msg", ")", "if", "platform", ".", "python_implementation", "(", ")",...
[ 69, 4 ]
[ 93, 9 ]
python
en
['en', 'error', 'th']
False
LineString.__init__
(self, *args, **kwargs)
Initializes on the given sequence -- may take lists, tuples, NumPy arrays of X,Y pairs, or Point objects. If Point objects are used, ownership is _not_ transferred to the LineString object. Examples: ls = LineString((1, 1), (2, 2)) ls = LineString([(1, 1), (2, 2)]) ...
Initializes on the given sequence -- may take lists, tuples, NumPy arrays of X,Y pairs, or Point objects. If Point objects are used, ownership is _not_ transferred to the LineString object.
def __init__(self, *args, **kwargs): """ Initializes on the given sequence -- may take lists, tuples, NumPy arrays of X,Y pairs, or Point objects. If Point objects are used, ownership is _not_ transferred to the LineString object. Examples: ls = LineString((1, 1), (2, ...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# If only one argument provided, set the coords array appropriately", "if", "len", "(", "args", ")", "==", "1", ":", "coords", "=", "args", "[", "0", "]", "else", ":", "c...
[ 14, 4 ]
[ 76, 76 ]
python
en
['en', 'error', 'th']
False
LineString.__iter__
(self)
Allows iteration over this LineString.
Allows iteration over this LineString.
def __iter__(self): "Allows iteration over this LineString." for i in xrange(len(self)): yield self[i]
[ "def", "__iter__", "(", "self", ")", ":", "for", "i", "in", "xrange", "(", "len", "(", "self", ")", ")", ":", "yield", "self", "[", "i", "]" ]
[ 78, 4 ]
[ 81, 25 ]
python
en
['en', 'en', 'en']
True
LineString.__len__
(self)
Returns the number of points in this LineString.
Returns the number of points in this LineString.
def __len__(self): "Returns the number of points in this LineString." return len(self._cs)
[ "def", "__len__", "(", "self", ")", ":", "return", "len", "(", "self", ".", "_cs", ")" ]
[ 83, 4 ]
[ 85, 28 ]
python
en
['en', 'en', 'en']
True
LineString.tuple
(self)
Returns a tuple version of the geometry from the coordinate sequence.
Returns a tuple version of the geometry from the coordinate sequence.
def tuple(self): "Returns a tuple version of the geometry from the coordinate sequence." return self._cs.tuple
[ "def", "tuple", "(", "self", ")", ":", "return", "self", ".", "_cs", ".", "tuple" ]
[ 120, 4 ]
[ 122, 29 ]
python
en
['en', 'en', 'en']
True
LineString._listarr
(self, func)
Internal routine that returns a sequence (list) corresponding with the given function. Will return a numpy array if possible.
Internal routine that returns a sequence (list) corresponding with the given function. Will return a numpy array if possible.
def _listarr(self, func): """ Internal routine that returns a sequence (list) corresponding with the given function. Will return a numpy array if possible. """ lst = [func(i) for i in xrange(len(self))] if numpy: return numpy.array(lst) # ARRRR! else...
[ "def", "_listarr", "(", "self", ",", "func", ")", ":", "lst", "=", "[", "func", "(", "i", ")", "for", "i", "in", "xrange", "(", "len", "(", "self", ")", ")", "]", "if", "numpy", ":", "return", "numpy", ".", "array", "(", "lst", ")", "# ARRRR!",...
[ 125, 4 ]
[ 134, 22 ]
python
en
['en', 'error', 'th']
False
LineString.array
(self)
Returns a numpy array for the LineString.
Returns a numpy array for the LineString.
def array(self): "Returns a numpy array for the LineString." return self._listarr(self._cs.__getitem__)
[ "def", "array", "(", "self", ")", ":", "return", "self", ".", "_listarr", "(", "self", ".", "_cs", ".", "__getitem__", ")" ]
[ 137, 4 ]
[ 139, 50 ]
python
en
['en', 'en', 'en']
True
LineString.merged
(self)
Returns the line merge of this LineString.
Returns the line merge of this LineString.
def merged(self): "Returns the line merge of this LineString." return self._topology(capi.geos_linemerge(self.ptr))
[ "def", "merged", "(", "self", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "geos_linemerge", "(", "self", ".", "ptr", ")", ")" ]
[ 142, 4 ]
[ 144, 60 ]
python
en
['en', 'en', 'en']
True
LineString.x
(self)
Returns a list or numpy array of the X variable.
Returns a list or numpy array of the X variable.
def x(self): "Returns a list or numpy array of the X variable." return self._listarr(self._cs.getX)
[ "def", "x", "(", "self", ")", ":", "return", "self", ".", "_listarr", "(", "self", ".", "_cs", ".", "getX", ")" ]
[ 147, 4 ]
[ 149, 43 ]
python
en
['en', 'ga', 'en']
True
LineString.y
(self)
Returns a list or numpy array of the Y variable.
Returns a list or numpy array of the Y variable.
def y(self): "Returns a list or numpy array of the Y variable." return self._listarr(self._cs.getY)
[ "def", "y", "(", "self", ")", ":", "return", "self", ".", "_listarr", "(", "self", ".", "_cs", ".", "getY", ")" ]
[ 152, 4 ]
[ 154, 43 ]
python
en
['en', 'en', 'en']
True
LineString.z
(self)
Returns a list or numpy array of the Z variable.
Returns a list or numpy array of the Z variable.
def z(self): "Returns a list or numpy array of the Z variable." if not self.hasz: return None else: return self._listarr(self._cs.getZ)
[ "def", "z", "(", "self", ")", ":", "if", "not", "self", ".", "hasz", ":", "return", "None", "else", ":", "return", "self", ".", "_listarr", "(", "self", ".", "_cs", ".", "getZ", ")" ]
[ 157, 4 ]
[ 162, 47 ]
python
en
['en', 'en', 'en']
True
Marker.evaluate
(self, environment=None)
Evaluate a marker. Return the boolean from evaluating the given marker against the environment. environment is an optional argument to override all or part of the determined environment. The environment is determined from the current Python process.
Evaluate a marker.
def evaluate(self, environment=None): """Evaluate a marker. Return the boolean from evaluating the given marker against the environment. environment is an optional argument to override all or part of the determined environment. The environment is determined from the current Pyt...
[ "def", "evaluate", "(", "self", ",", "environment", "=", "None", ")", ":", "current_environment", "=", "default_environment", "(", ")", "if", "environment", "is", "not", "None", ":", "current_environment", ".", "update", "(", "environment", ")", "return", "_ev...
[ 282, 4 ]
[ 295, 68 ]
python
en
['en', 'en', 'en']
True
update_last_login
(sender, user, **kwargs)
A signal receiver which updates the last_login date for the user logging in.
A signal receiver which updates the last_login date for the user logging in.
def update_last_login(sender, user, **kwargs): """ A signal receiver which updates the last_login date for the user logging in. """ user.last_login = timezone.now() user.save(update_fields=['last_login'])
[ "def", "update_last_login", "(", "sender", ",", "user", ",", "*", "*", "kwargs", ")", ":", "user", ".", "last_login", "=", "timezone", ".", "now", "(", ")", "user", ".", "save", "(", "update_fields", "=", "[", "'last_login'", "]", ")" ]
[ 20, 0 ]
[ 26, 43 ]
python
en
['en', 'error', 'th']
False
_user_has_perm
(user, perm, obj)
A backend can raise `PermissionDenied` to short-circuit permission checking.
A backend can raise `PermissionDenied` to short-circuit permission checking.
def _user_has_perm(user, perm, obj): """ A backend can raise `PermissionDenied` to short-circuit permission checking. """ for backend in auth.get_backends(): if not hasattr(backend, 'has_perm'): continue try: if backend.has_perm(user, perm, obj): r...
[ "def", "_user_has_perm", "(", "user", ",", "perm", ",", "obj", ")", ":", "for", "backend", "in", "auth", ".", "get_backends", "(", ")", ":", "if", "not", "hasattr", "(", "backend", ",", "'has_perm'", ")", ":", "continue", "try", ":", "if", "backend", ...
[ 268, 0 ]
[ 280, 16 ]
python
en
['en', 'error', 'th']
False
_user_has_module_perms
(user, app_label)
A backend can raise `PermissionDenied` to short-circuit permission checking.
A backend can raise `PermissionDenied` to short-circuit permission checking.
def _user_has_module_perms(user, app_label): """ A backend can raise `PermissionDenied` to short-circuit permission checking. """ for backend in auth.get_backends(): if not hasattr(backend, 'has_module_perms'): continue try: if backend.has_module_perms(user, app_l...
[ "def", "_user_has_module_perms", "(", "user", ",", "app_label", ")", ":", "for", "backend", "in", "auth", ".", "get_backends", "(", ")", ":", "if", "not", "hasattr", "(", "backend", ",", "'has_module_perms'", ")", ":", "continue", "try", ":", "if", "backen...
[ 283, 0 ]
[ 295, 16 ]
python
en
['en', 'error', 'th']
False
BaseUserManager.normalize_email
(cls, email)
Normalize the address by lowercasing the domain part of the email address.
Normalize the address by lowercasing the domain part of the email address.
def normalize_email(cls, email): """ Normalize the address by lowercasing the domain part of the email address. """ email = email or '' try: email_name, domain_part = email.strip().rsplit('@', 1) except ValueError: pass else: ...
[ "def", "normalize_email", "(", "cls", ",", "email", ")", ":", "email", "=", "email", "or", "''", "try", ":", "email_name", ",", "domain_part", "=", "email", ".", "strip", "(", ")", ".", "rsplit", "(", "'@'", ",", "1", ")", "except", "ValueError", ":"...
[ 131, 4 ]
[ 143, 20 ]
python
en
['en', 'error', 'th']
False
BaseUserManager.make_random_password
(self, length=10, allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789')
Generates a random password with the given length and given allowed_chars. Note that the default value of allowed_chars does not have "I" or "O" or letters and digits that look similar -- just to avoid confusion.
Generates a random password with the given length and given allowed_chars. Note that the default value of allowed_chars does not have "I" or "O" or letters and digits that look similar -- just to avoid confusion.
def make_random_password(self, length=10, allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789'): """ Generates a random password with the given length and given ...
[ "def", "make_random_password", "(", "self", ",", "length", "=", "10", ",", "allowed_chars", "=", "'abcdefghjkmnpqrstuvwxyz'", "'ABCDEFGHJKLMNPQRSTUVWXYZ'", "'23456789'", ")", ":", "return", "get_random_string", "(", "length", ",", "allowed_chars", ")" ]
[ 145, 4 ]
[ 155, 55 ]
python
en
['en', 'error', 'th']
False
UserManager._create_user
(self, username, email, password, is_staff, is_superuser, **extra_fields)
Creates and saves a User with the given username, email and password.
Creates and saves a User with the given username, email and password.
def _create_user(self, username, email, password, is_staff, is_superuser, **extra_fields): """ Creates and saves a User with the given username, email and password. """ now = timezone.now() if not username: raise ValueError('The given username mus...
[ "def", "_create_user", "(", "self", ",", "username", ",", "email", ",", "password", ",", "is_staff", ",", "is_superuser", ",", "*", "*", "extra_fields", ")", ":", "now", "=", "timezone", ".", "now", "(", ")", "if", "not", "username", ":", "raise", "Val...
[ 163, 4 ]
[ 178, 19 ]
python
en
['en', 'error', 'th']
False
PermissionsMixin.get_group_permissions
(self, obj=None)
Returns a list of permission strings that this user has through their groups. This method queries all available auth backends. If an object is passed in, only permissions matching this object are returned.
Returns a list of permission strings that this user has through their groups. This method queries all available auth backends. If an object is passed in, only permissions matching this object are returned.
def get_group_permissions(self, obj=None): """ Returns a list of permission strings that this user has through their groups. This method queries all available auth backends. If an object is passed in, only permissions matching this object are returned. """ permissions = s...
[ "def", "get_group_permissions", "(", "self", ",", "obj", "=", "None", ")", ":", "permissions", "=", "set", "(", ")", "for", "backend", "in", "auth", ".", "get_backends", "(", ")", ":", "if", "hasattr", "(", "backend", ",", "\"get_group_permissions\"", ")",...
[ 319, 4 ]
[ 329, 26 ]
python
en
['en', 'error', 'th']
False
PermissionsMixin.has_perm
(self, perm, obj=None)
Returns True if the user has the specified permission. This method queries all available auth backends, but returns immediately if any backend returns True. Thus, a user who has permission from a single auth backend is assumed to have permission in general. If an object is provi...
Returns True if the user has the specified permission. This method queries all available auth backends, but returns immediately if any backend returns True. Thus, a user who has permission from a single auth backend is assumed to have permission in general. If an object is provi...
def has_perm(self, perm, obj=None): """ Returns True if the user has the specified permission. This method queries all available auth backends, but returns immediately if any backend returns True. Thus, a user who has permission from a single auth backend is assumed to have permi...
[ "def", "has_perm", "(", "self", ",", "perm", ",", "obj", "=", "None", ")", ":", "# Active superusers have all permissions.", "if", "self", ".", "is_active", "and", "self", ".", "is_superuser", ":", "return", "True", "# Otherwise we need to check the backends.", "ret...
[ 334, 4 ]
[ 348, 46 ]
python
en
['en', 'error', 'th']
False
PermissionsMixin.has_perms
(self, perm_list, obj=None)
Returns True if the user has each of the specified permissions. If object is passed, it checks if the user has all required perms for this object.
Returns True if the user has each of the specified permissions. If object is passed, it checks if the user has all required perms for this object.
def has_perms(self, perm_list, obj=None): """ Returns True if the user has each of the specified permissions. If object is passed, it checks if the user has all required perms for this object. """ for perm in perm_list: if not self.has_perm(perm, obj): ...
[ "def", "has_perms", "(", "self", ",", "perm_list", ",", "obj", "=", "None", ")", ":", "for", "perm", "in", "perm_list", ":", "if", "not", "self", ".", "has_perm", "(", "perm", ",", "obj", ")", ":", "return", "False", "return", "True" ]
[ 350, 4 ]
[ 359, 19 ]
python
en
['en', 'error', 'th']
False
PermissionsMixin.has_module_perms
(self, app_label)
Returns True if the user has any permissions in the given app label. Uses pretty much the same logic as has_perm, above.
Returns True if the user has any permissions in the given app label. Uses pretty much the same logic as has_perm, above.
def has_module_perms(self, app_label): """ Returns True if the user has any permissions in the given app label. Uses pretty much the same logic as has_perm, above. """ # Active superusers have all permissions. if self.is_active and self.is_superuser: return Tr...
[ "def", "has_module_perms", "(", "self", ",", "app_label", ")", ":", "# Active superusers have all permissions.", "if", "self", ".", "is_active", "and", "self", ".", "is_superuser", ":", "return", "True", "return", "_user_has_module_perms", "(", "self", ",", "app_lab...
[ 361, 4 ]
[ 370, 54 ]
python
en
['en', 'error', 'th']
False
AbstractUser.get_full_name
(self)
Returns the first_name plus the last_name, with a space in between.
Returns the first_name plus the last_name, with a space in between.
def get_full_name(self): """ Returns the first_name plus the last_name, with a space in between. """ full_name = '%s %s' % (self.first_name, self.last_name) return full_name.strip()
[ "def", "get_full_name", "(", "self", ")", ":", "full_name", "=", "'%s %s'", "%", "(", "self", ".", "first_name", ",", "self", ".", "last_name", ")", "return", "full_name", ".", "strip", "(", ")" ]
[ 413, 4 ]
[ 418, 32 ]
python
en
['en', 'error', 'th']
False