id
int64
1
6.07M
name
stringlengths
1
295
code
stringlengths
12
426k
language
stringclasses
1 value
source_file
stringlengths
5
202
start_line
int64
1
158k
end_line
int64
1
158k
repo
dict
8,301
__init__
def __init__(self, verbose=0, dry_run=0, force=0): CCompiler.__init__ (self, verbose, dry_run, force) self.__version = VERSION self.__root = r"Software\Microsoft\VisualStudio" # self.__macros = MACROS self.__paths = [] # target platform (.plat_name is consistent with 'bdi...
python
Tools/c-analyzer/distutils/msvc9compiler.py
326
335
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,302
manifest_setup_ldargs
def manifest_setup_ldargs(self, output_filename, build_temp, ld_args): # If we need a manifest at all, an embedded manifest is recommended. # See MSDN article titled # "How to: Embed a Manifest Inside a C/C++ Application" # (currently at http://msdn2.microsoft.com/en-us/library/ms235591(...
python
Tools/c-analyzer/distutils/msvc9compiler.py
339
349
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,303
manifest_get_embed_info
def manifest_get_embed_info(self, target_desc, ld_args): # If a manifest should be embedded, return a tuple of # (manifest_filename, resource_id). Returns None if no manifest # should be embedded. See http://bugs.python.org/issue7833 for why # we want to avoid any manifest for extensio...
python
Tools/c-analyzer/distutils/msvc9compiler.py
351
373
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,304
_remove_visual_c_ref
def _remove_visual_c_ref(self, manifest_file): try: # Remove references to the Visual C runtime, so they will # fall through to the Visual C dependency of Python.exe. # This way, when installed for a restricted user (e.g. # runtimes are not in WinSxS folder, but i...
python
Tools/c-analyzer/distutils/msvc9compiler.py
375
412
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,305
find_exe
def find_exe(self, exe): """Return path to an MSVC executable program. Tries to find the program in several places: first, one of the MSVC program search paths from the registry; next, the directories in the PATH environment variable. If any of those work, return an absolute pa...
python
Tools/c-analyzer/distutils/msvc9compiler.py
418
438
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,306
__init__
def __init__(self, threshold=WARN): self.threshold = threshold
python
Tools/c-analyzer/distutils/log.py
16
17
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,307
_log
def _log(self, level, msg, args): if level not in (DEBUG, INFO, WARN, ERROR, FATAL): raise ValueError('%s wrong log level' % str(level)) if level >= self.threshold: if args: msg = msg % args if level in (WARN, ERROR, FATAL): stream = s...
python
Tools/c-analyzer/distutils/log.py
19
37
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,308
log
def log(self, level, msg, *args): self._log(level, msg, args)
python
Tools/c-analyzer/distutils/log.py
39
40
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,309
debug
def debug(self, msg, *args): self._log(DEBUG, msg, args)
python
Tools/c-analyzer/distutils/log.py
42
43
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,310
info
def info(self, msg, *args): self._log(INFO, msg, args)
python
Tools/c-analyzer/distutils/log.py
45
46
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,311
warn
def warn(self, msg, *args): self._log(WARN, msg, args)
python
Tools/c-analyzer/distutils/log.py
48
49
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,312
error
def error(self, msg, *args): self._log(ERROR, msg, args)
python
Tools/c-analyzer/distutils/log.py
51
52
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,313
fatal
def fatal(self, msg, *args): self._log(FATAL, msg, args)
python
Tools/c-analyzer/distutils/log.py
54
55
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,314
get_host_platform
def get_host_platform(): """Return a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and version and the architecture (as supplied by 'os.uname()'), although th...
python
Tools/c-analyzer/distutils/util.py
13
91
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,315
get_platform
def get_platform(): if os.name == 'nt': TARGET_TO_PLAT = { 'x86' : 'win32', 'x64' : 'win-amd64', 'arm' : 'win-arm32', } return TARGET_TO_PLAT.get(os.environ.get('VSCMD_ARG_TGT_ARCH')) or get_host_platform() else: return get_host_platform()
python
Tools/c-analyzer/distutils/util.py
93
102
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,316
_init_regex
def _init_regex(): global _wordchars_re, _squote_re, _dquote_re _wordchars_re = re.compile(r'[^\\\'\"%s ]*' % string.whitespace) _squote_re = re.compile(r"'(?:[^'\\]|\\.)*'") _dquote_re = re.compile(r'"(?:[^"\\]|\\.)*"')
python
Tools/c-analyzer/distutils/util.py
107
111
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,317
split_quoted
def split_quoted (s): """Split a string up according to Unix shell-like rules for quotes and backslashes. In short: words are delimited by spaces, as long as those spaces are not escaped by a backslash, or inside a quoted string. Single and double quotes are equivalent, and the quote characters can ...
python
Tools/c-analyzer/distutils/util.py
113
169
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,318
get_msvcr
def get_msvcr(): """Include the appropriate MSVC runtime library if Python was built with MSVC 7.0 or later. """ msc_pos = sys.version.find('MSC v.') if msc_pos != -1: msc_ver = sys.version[msc_pos+6:msc_pos+10] if msc_ver == '1300': # MSVC 7.0 return ['msvcr7...
python
Tools/c-analyzer/distutils/cygwinccompiler.py
57
80
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,319
__init__
def __init__(self, verbose=0, dry_run=0, force=0): UnixCCompiler.__init__(self, verbose, dry_run, force) status, details = check_config_h() self.debug_print("Python's GCC status: %s (details: %s)" % (status, details)) if status is not CONFIG_H_OK: s...
python
Tools/c-analyzer/distutils/cygwinccompiler.py
94
151
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,320
__init__
def __init__(self, verbose=0, dry_run=0, force=0): CygwinCCompiler.__init__ (self, verbose, dry_run, force) # ld_version >= "2.13" support -shared so use it instead of # -mdll -static if self.ld_version >= "2.13": shared_option = "-shared" else: shared_o...
python
Tools/c-analyzer/distutils/cygwinccompiler.py
160
198
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,321
check_config_h
def check_config_h(): """Check if the current Python installation appears amenable to building extensions with GCC. Returns a tuple (status, details), where 'status' is one of the following constants: - CONFIG_H_OK: all is well, go ahead and compile - CONFIG_H_NOTOK: doesn't look good - CO...
python
Tools/c-analyzer/distutils/cygwinccompiler.py
208
249
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,322
_find_exe_version
def _find_exe_version(cmd): """Find the version of an executable by running `cmd` in the shell. If the command is not found, or the output does not match `RE_VERSION`, returns None. """ executable = cmd.split()[0] if find_executable(executable) is None: return None out = Popen(cmd, ...
python
Tools/c-analyzer/distutils/cygwinccompiler.py
253
272
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,323
get_versions
def get_versions(): """ Try to find out the versions of gcc, ld and dllwrap. If not possible it returns None for it. """ commands = ['gcc -dumpversion', 'ld -v', 'dllwrap --version'] return tuple([_find_exe_version(cmd) for cmd in commands])
python
Tools/c-analyzer/distutils/cygwinccompiler.py
274
280
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,324
is_cygwingcc
def is_cygwingcc(): '''Try to determine if the gcc that would be used is from cygwin.''' out_string = check_output(['gcc', '-dumpmachine']) return out_string.strip().endswith(b'cygwin')
python
Tools/c-analyzer/distutils/cygwinccompiler.py
282
285
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,325
find_executable
def find_executable(executable, path=None): """Tries to find 'executable' in the directories listed in 'path'. A string listing directories separated by 'os.pathsep'; defaults to os.environ['PATH']. Returns the complete filename or None if not found. """ _, ext = os.path.splitext(executable) i...
python
Tools/c-analyzer/distutils/spawn.py
14
48
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,326
read_keys
def read_keys(base, key): """Return list of registry keys.""" try: handle = RegOpenKeyEx(base, key) except RegError: return None L = [] i = 0 while True: try: k = RegEnumKey(handle, i) except RegError: break L.append(k) i +=...
python
Tools/c-analyzer/distutils/msvccompiler.py
51
66
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,327
read_values
def read_values(base, key): """Return dict of registry keys and values. All names are converted to lowercase. """ try: handle = RegOpenKeyEx(base, key) except RegError: return None d = {} i = 0 while True: try: name, value, type = RegEnumValue(handle,...
python
Tools/c-analyzer/distutils/msvccompiler.py
68
87
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,328
convert_mbcs
def convert_mbcs(s): dec = getattr(s, "decode", None) if dec is not None: try: s = dec("mbcs") except UnicodeError: pass return s
python
Tools/c-analyzer/distutils/msvccompiler.py
89
96
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,329
__init__
def __init__(self, version): self.macros = {} self.load_macros(version)
python
Tools/c-analyzer/distutils/msvccompiler.py
99
101
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,330
set_macro
def set_macro(self, macro, path, key): for base in HKEYS: d = read_values(base, path) if d: self.macros["$(%s)" % macro] = d[key] break
python
Tools/c-analyzer/distutils/msvccompiler.py
103
108
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,331
load_macros
def load_macros(self, version): vsbase = r"Software\Microsoft\VisualStudio\%0.1f" % version self.set_macro("VCInstallDir", vsbase + r"\Setup\VC", "productdir") self.set_macro("VSInstallDir", vsbase + r"\Setup\VS", "productdir") net = r"Software\Microsoft\.NETFramework" self.set_m...
python
Tools/c-analyzer/distutils/msvccompiler.py
110
136
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,332
sub
def sub(self, s): for k, v in self.macros.items(): s = s.replace(k, v) return s
python
Tools/c-analyzer/distutils/msvccompiler.py
138
141
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,333
get_build_version
def get_build_version(): """Return the version of MSVC that was used to build Python. For Python 2.3 and up, the version number is included in sys.version. For earlier versions, assume the compiler is MSVC 6. """ prefix = "MSC v." i = sys.version.find(prefix) if i == -1: return 6 ...
python
Tools/c-analyzer/distutils/msvccompiler.py
143
166
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,334
get_build_architecture
def get_build_architecture(): """Return the processor architecture. Possible results are "Intel" or "AMD64". """ prefix = " bit (" i = sys.version.find(prefix) if i == -1: return "Intel" j = sys.version.find(")", i) return sys.version[i+len(prefix):j]
python
Tools/c-analyzer/distutils/msvccompiler.py
168
179
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,335
normalize_and_reduce_paths
def normalize_and_reduce_paths(paths): """Return a list of normalized paths with duplicates removed. The current order of paths is maintained. """ # Paths are normalized so things like: /a and /a/ aren't both preserved. reduced_paths = [] for p in paths: np = os.path.normpath(p) ...
python
Tools/c-analyzer/distutils/msvccompiler.py
181
193
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,336
__init__
def __init__(self, verbose=0, dry_run=0, force=0): CCompiler.__init__ (self, verbose, dry_run, force) self.__version = get_build_version() self.__arch = get_build_architecture() if self.__arch == "Intel": # x86 if self.__version >= 7: self.__root =...
python
Tools/c-analyzer/distutils/msvccompiler.py
226
242
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,337
find_exe
def find_exe(self, exe): """Return path to an MSVC executable program. Tries to find the program in several places: first, one of the MSVC program search paths from the registry; next, the directories in the PATH environment variable. If any of those work, return an absolute pa...
python
Tools/c-analyzer/distutils/msvccompiler.py
249
269
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,338
get_msvc_paths
def get_msvc_paths(self, path, platform='x86'): """Get a list of devstudio directories (include, lib or path). Return a list of strings. The list will be empty if unable to access the registry or appropriate registry keys not found. """ if not _can_read_reg: return ...
python
Tools/c-analyzer/distutils/msvccompiler.py
271
305
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,339
set_path_env_var
def set_path_env_var(self, name): """Set environment variable 'name' to an MSVC path type value. This is equivalent to a SET command prior to execution of spawned commands. """ if name == "lib": p = self.get_msvc_paths("library") else: p = self.g...
python
Tools/c-analyzer/distutils/msvccompiler.py
307
319
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,340
newer
def newer (source, target): """Return true if 'source' exists and is more recently modified than 'target', or if 'source' exists and 'target' doesn't. Return false if both exist and 'target' is the same age or younger than 'source'. Raise DistutilsFileError if 'source' does not exist. """ if no...
python
Tools/c-analyzer/distutils/dep_util.py
11
27
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,341
__init__
def __init__ (self, verbose=0, dry_run=0, force=0): CCompiler.__init__ (self, verbose, dry_run, force) # These executables are assumed to all be in the path. # Borland doesn't seem to use any special registry settings to # indicate ...
python
Tools/c-analyzer/distutils/bcppcompiler.py
49
72
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,342
preprocess
def preprocess (self, source, output_file=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None): (_, macros, include_dirs) = \ self._fix_compile_args(None...
python
Tools/c-analyzer/distutils/bcppcompiler.py
77
107
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,343
parse_file
def parse_file(filename, *, match_kind=None, get_file_preprocessor=None, file_maxsizes=None, ): if get_file_preprocessor is None: get_file_preprocessor = _get_preprocessor() yield from _parse_file( filename, match_kind, get_file_pre...
python
Tools/c-analyzer/c_parser/__init__.py
6
14
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,344
parse_files
def parse_files(filenames, *, match_kind=None, get_file_preprocessor=None, file_maxsizes=None, ): if get_file_preprocessor is None: get_file_preprocessor = _get_preprocessor() for filename in filenames: try: yield from _...
python
Tools/c-analyzer/c_parser/__init__.py
17
30
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,345
_parse_file
def _parse_file(filename, match_kind, get_file_preprocessor, maxsizes): srckwargs = {} maxsize = _resolve_max_size(filename, maxsizes) if maxsize: srckwargs['maxtext'], srckwargs['maxlines'] = maxsize # Preprocess the file. preprocess = get_file_preprocessor(filename) preprocessed = pre...
python
Tools/c-analyzer/c_parser/__init__.py
33
52
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,346
_resolve_max_size
def _resolve_max_size(filename, maxsizes): for pattern, maxsize in (maxsizes.items() if maxsizes else ()): if _match_glob(filename, pattern): break else: return None if not maxsize: return None, None maxtext, maxlines = maxsize if maxtext is not None: maxt...
python
Tools/c-analyzer/c_parser/__init__.py
55
68
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,347
parse_signature
def parse_signature(text): raise NotImplementedError
python
Tools/c-analyzer/c_parser/__init__.py
71
72
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,348
_from_raw
def _from_raw(cls, raw): if raw is None: return None elif isinstance(raw, cls): return raw elif type(raw) is str: # We could use cls[raw] for the upper-case form, # but there's no need to go to the trouble. return cls(raw.lower()) ...
python
Tools/c-analyzer/c_parser/info.py
34
44
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,349
by_priority
def by_priority(cls, group=None): if group is None: return cls._ALL_BY_PRIORITY.copy() elif group == 'type': return cls._TYPE_DECLS_BY_PRIORITY.copy() elif group == 'decl': return cls._ALL_DECLS_BY_PRIORITY.copy() elif isinstance(group, str): ...
python
Tools/c-analyzer/c_parser/info.py
47
58
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,350
is_type_decl
def is_type_decl(cls, kind): if kind in cls.TYPES: return True if not isinstance(kind, cls): raise TypeError(f'expected KIND, got {kind!r}') return False
python
Tools/c-analyzer/c_parser/info.py
61
66
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,351
is_decl
def is_decl(cls, kind): if kind in cls.DECLS: return True if not isinstance(kind, cls): raise TypeError(f'expected KIND, got {kind!r}') return False
python
Tools/c-analyzer/c_parser/info.py
69
74
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,352
get_group
def get_group(cls, kind, *, groups=None): if not isinstance(kind, cls): raise TypeError(f'expected KIND, got {kind!r}') if groups is None: groups = ['type'] elif not groups: groups = () elif isinstance(groups, str): group = groups ...
python
Tools/c-analyzer/c_parser/info.py
77
97
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,353
resolve_group
def resolve_group(cls, group): if isinstance(group, cls): return {group} elif isinstance(group, str): try: return cls._GROUPS[group].copy() except KeyError: raise ValueError(f'unsupported group {group!r}') else: reso...
python
Tools/c-analyzer/c_parser/info.py
100
113
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,354
get_kind_group
def get_kind_group(item): return KIND.get_group(item.kind)
python
Tools/c-analyzer/c_parser/info.py
144
145
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,355
_fix_filename
def _fix_filename(filename, relroot, *, formatted=True, **kwargs): if formatted: fix = fsutil.format_filename else: fix = fsutil.fix_filename return fix(filename, relroot=relroot, **kwargs)
python
Tools/c-analyzer/c_parser/info.py
151
158
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,356
from_raw
def from_raw(cls, raw): if isinstance(raw, cls): return raw elif isinstance(raw, tuple): return cls(*raw) elif not raw: return None elif isinstance(raw, str): return cls(raw, -1) else: raise TypeError(f'unsupported "raw"...
python
Tools/c-analyzer/c_parser/info.py
163
173
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,357
__str__
def __str__(self): return self.filename
python
Tools/c-analyzer/c_parser/info.py
175
176
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,358
fix_filename
def fix_filename(self, relroot=fsutil.USE_CWD, **kwargs): filename = _fix_filename(self.filename, relroot, **kwargs) if filename == self.filename: return self return self._replace(filename=filename)
python
Tools/c-analyzer/c_parser/info.py
178
182
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,359
filename
def filename(self): return self.file.filename
python
Tools/c-analyzer/c_parser/info.py
193
194
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,360
lno
def lno(self): return self.file.lno
python
Tools/c-analyzer/c_parser/info.py
197
198
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,361
from_row
def from_row(cls, row, **markers): row = _tables.fix_row(row, **markers) return cls(*row)
python
Tools/c-analyzer/c_parser/info.py
205
207
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,362
_make
def _make(cls, iterable): try: return cls(*iterable) except Exception: super()._make(iterable) raise # re-raise
python
Tools/c-analyzer/c_parser/info.py
212
217
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,363
__new__
def __new__(cls, filename, funcname, name): self = super().__new__( cls, filename=str(filename) if filename else None, funcname=str(funcname) if funcname else None, name=str(name) if name else None, ) self._compare = tuple(v or '' for v in self) ...
python
Tools/c-analyzer/c_parser/info.py
219
227
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,364
__hash__
def __hash__(self): return super().__hash__()
python
Tools/c-analyzer/c_parser/info.py
229
230
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,365
__eq__
def __eq__(self, other): try: other = tuple(v or '' for v in other) except TypeError: return NotImplemented return self._compare == other
python
Tools/c-analyzer/c_parser/info.py
232
237
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,366
__gt__
def __gt__(self, other): try: other = tuple(v or '' for v in other) except TypeError: return NotImplemented return self._compare > other
python
Tools/c-analyzer/c_parser/info.py
239
244
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,367
fix_filename
def fix_filename(self, relroot=fsutil.USE_CWD, **kwargs): filename = _fix_filename(self.filename, relroot, **kwargs) if filename == self.filename: return self return self._replace(filename=filename)
python
Tools/c-analyzer/c_parser/info.py
246
250
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,368
from_raw
def from_raw(cls, raw): if isinstance(raw, cls): return raw elif isinstance(raw, tuple): return cls(*raw) else: raise TypeError(f'unsupported "raw": {raw:!r}')
python
Tools/c-analyzer/c_parser/info.py
256
262
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,369
from_row
def from_row(cls, row, columns=None): if not columns: colnames = 'filename funcname name kind data'.split() else: colnames = list(columns) for i, column in enumerate(colnames): if column == 'file': colnames[i] = 'filename' ...
python
Tools/c-analyzer/c_parser/info.py
265
287
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,370
id
def id(self): try: return self._id except AttributeError: if self.kind is KIND.STATEMENT: self._id = None else: self._id = DeclID(str(self.file), self.funcname, self.name) return self._id
python
Tools/c-analyzer/c_parser/info.py
290
298
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,371
filename
def filename(self): if not self.file: return None return self.file.filename
python
Tools/c-analyzer/c_parser/info.py
301
304
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,372
lno
def lno(self): if not self.file: return -1 return self.file.lno
python
Tools/c-analyzer/c_parser/info.py
307
310
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,373
funcname
def funcname(self): if not self.parent: return None if type(self.parent) is str: return self.parent else: return self.parent.name
python
Tools/c-analyzer/c_parser/info.py
313
319
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,374
fix_filename
def fix_filename(self, relroot=fsutil.USE_CWD, **kwargs): fixed = self.file.fix_filename(relroot, **kwargs) if fixed == self.file: return self return self._replace(file=fixed)
python
Tools/c-analyzer/c_parser/info.py
321
325
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,375
as_row
def as_row(self, columns=None): if not columns: columns = self._fields row = [] for column in columns: if column == 'file': value = self.filename elif column == 'kind': value = self.kind.value elif column == 'data': ...
python
Tools/c-analyzer/c_parser/info.py
327
341
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,376
_render_data
def _render_data(self): if not self.data: return None elif isinstance(self.data, str): return self.data else: # XXX raise NotImplementedError
python
Tools/c-analyzer/c_parser/info.py
343
350
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,377
_get_vartype
def _get_vartype(data): try: vartype = dict(data['vartype']) except KeyError: vartype = dict(data) storage = data.get('storage') else: storage = data.get('storage') or vartype.get('storage') del vartype['storage'] return storage, vartype
python
Tools/c-analyzer/c_parser/info.py
353
362
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,378
get_parsed_vartype
def get_parsed_vartype(decl): kind = getattr(decl, 'kind', None) if isinstance(decl, ParsedItem): storage, vartype = _get_vartype(decl.data) typequal = vartype['typequal'] typespec = vartype['typespec'] abstract = vartype['abstract'] elif isinstance(decl, dict): kind ...
python
Tools/c-analyzer/c_parser/info.py
365
398
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,379
get_default_storage
def get_default_storage(decl): if decl.kind not in (KIND.VARIABLE, KIND.FUNCTION): return None return 'extern' if decl.parent is None else 'auto'
python
Tools/c-analyzer/c_parser/info.py
401
404
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,380
get_effective_storage
def get_effective_storage(decl, *, default=None): # Note that "static" limits access to just that C module # and "extern" (the default for module-level) allows access # outside the C module. if default is None: default = get_default_storage(decl) if default is None: return No...
python
Tools/c-analyzer/c_parser/info.py
407
419
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,381
from_parsed
def from_parsed(cls, parsed): if parsed.kind is not cls.kind: raise TypeError(f'kind mismatch ({parsed.kind.value} != {cls.kind.value})') data, extra = cls._resolve_data(parsed.data) self = cls( cls._resolve_file(parsed), parsed.name, data, ...
python
Tools/c-analyzer/c_parser/info.py
432
444
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,382
_resolve_file
def _resolve_file(cls, parsed): fileinfo = FileInfo.from_raw(parsed.file) if not fileinfo: raise NotImplementedError(parsed) return fileinfo
python
Tools/c-analyzer/c_parser/info.py
447
451
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,383
_resolve_data
def _resolve_data(cls, data): return data, None
python
Tools/c-analyzer/c_parser/info.py
454
455
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,384
_raw_data
def _raw_data(cls, data, extra): if isinstance(data, str): return data else: raise NotImplementedError(data)
python
Tools/c-analyzer/c_parser/info.py
458
462
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,385
_data_as_row
def _data_as_row(cls, data, extra, colnames): row = {} for colname in colnames: if colname in row: continue rendered = cls._render_data_row_item(colname, data, extra) if rendered is iter(rendered): rendered, = rendered row[c...
python
Tools/c-analyzer/c_parser/info.py
465
474
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,386
_render_data_row_item
def _render_data_row_item(cls, colname, data, extra): if colname == 'data': return str(data) else: return None
python
Tools/c-analyzer/c_parser/info.py
477
481
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,387
_render_data_row
def _render_data_row(cls, fmt, data, extra, colnames): if fmt != 'row': raise NotImplementedError datarow = cls._data_as_row(data, extra, colnames) unresolved = [c for c, v in datarow.items() if v is None] if unresolved: raise NotImplementedError(unresolved) ...
python
Tools/c-analyzer/c_parser/info.py
484
497
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,388
_render_data
def _render_data(cls, fmt, data, extra): row = cls._render_data_row(fmt, data, extra, ['data']) yield ' '.join(row.values())
python
Tools/c-analyzer/c_parser/info.py
500
502
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,389
_resolve_parent
def _resolve_parent(cls, parsed, *, _kind=None): fileinfo = FileInfo(parsed.file.filename, -1) if isinstance(parsed.parent, str): if parsed.parent.isidentifier(): name = parsed.parent else: # XXX It could be something like "<kind> <name>". ...
python
Tools/c-analyzer/c_parser/info.py
505
520
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,390
_parse_columns
def _parse_columns(cls, columns): colnames = {} # {requested -> actual} columns = list(columns or cls.FIELDS) datacolumns = [] for i, colname in enumerate(columns): if colname == 'file': columns[i] = 'filename' colnames['file'] = 'filename' ...
python
Tools/c-analyzer/c_parser/info.py
523
544
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,391
__init__
def __init__(self, file, name, data, parent=None, *, _extra=None, _shortkey=None, _key=None, ): self.file = file self.parent = parent or None self.name = name self.data = data self._extra = _extra or {} s...
python
Tools/c-analyzer/c_parser/info.py
546
557
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,392
__repr__
def __repr__(self): args = [f'{n}={getattr(self, n)!r}' for n in ['file', 'name', 'data', 'parent', *(self._extra or ())]] return f'{type(self).__name__}({", ".join(args)})'
python
Tools/c-analyzer/c_parser/info.py
559
562
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,393
__str__
def __str__(self): try: return self._str except AttributeError: self._str = next(self.render()) return self._str
python
Tools/c-analyzer/c_parser/info.py
564
569
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,394
__getattr__
def __getattr__(self, name): try: return self._extra[name] except KeyError: raise AttributeError(name)
python
Tools/c-analyzer/c_parser/info.py
571
575
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,395
__hash__
def __hash__(self): return hash(self._key)
python
Tools/c-analyzer/c_parser/info.py
577
578
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,396
__eq__
def __eq__(self, other): if isinstance(other, HighlevelParsedItem): return self._key == other._key elif type(other) is tuple: return self._key == other else: return NotImplemented
python
Tools/c-analyzer/c_parser/info.py
580
586
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,397
__gt__
def __gt__(self, other): if isinstance(other, HighlevelParsedItem): return self._key > other._key elif type(other) is tuple: return self._key > other else: return NotImplemented
python
Tools/c-analyzer/c_parser/info.py
588
594
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,398
id
def id(self): return self.parsed.id
python
Tools/c-analyzer/c_parser/info.py
597
598
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,399
shortkey
def shortkey(self): return self._shortkey
python
Tools/c-analyzer/c_parser/info.py
601
602
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
8,400
key
def key(self): return self._key
python
Tools/c-analyzer/c_parser/info.py
605
606
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }