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
14,301
_genops
def _genops(data, yield_end_pos=False): if isinstance(data, bytes_types): data = io.BytesIO(data) if hasattr(data, "tell"): getpos = data.tell else: getpos = lambda: None while True: pos = getpos() code = data.read(1) opcode = code2op.get(code.decode("la...
python
Lib/pickletools.py
2,268
2,298
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,302
genops
def genops(pickle): """Generate all the opcodes in a pickle. 'pickle' is a file-like object, or string, containing the pickle. Each opcode in the pickle is generated, from the current pickle position, stopping after a STOP opcode is delivered. A triple is generated for each opcode: opcod...
python
Lib/pickletools.py
2,300
2,323
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,303
optimize
def optimize(p): 'Optimize a pickle string by removing unused PUT opcodes' put = 'PUT' get = 'GET' oldids = set() # set of all PUT ids newids = {} # set of ids used by a GET opcode opcodes = [] # (op, idx) or (pos, end_pos) proto = 0 protoheader = b'' ...
python
Lib/pickletools.py
2,328
2,390
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,304
dis
def dis(pickle, out=None, memo=None, indentlevel=4, annotate=0): """Produce a symbolic disassembly of a pickle. 'pickle' is a file-like object, or string, containing a (at least one) pickle. The pickle is disassembled from the current position, through the first STOP opcode encountered. Optional ...
python
Lib/pickletools.py
2,395
2,547
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,305
__init__
def __init__(self, value): self.value = value
python
Lib/pickletools.py
2,551
2,552
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,306
_test
def _test(): import doctest return doctest.testmod()
python
Lib/pickletools.py
2,842
2,844
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,307
_trace
def _trace(message): if sys.flags.verbose: print(message, file=sys.stderr)
python
Lib/site.py
92
94
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,308
makepath
def makepath(*paths): dir = os.path.join(*paths) try: dir = os.path.abspath(dir) except OSError: pass return dir, os.path.normcase(dir)
python
Lib/site.py
97
103
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,309
abs_paths
def abs_paths(): """Set all module __file__ and __cached__ attributes to an absolute path""" for m in set(sys.modules.values()): loader_module = None try: loader_module = m.__loader__.__module__ except AttributeError: try: loader_module = m.__spec_...
python
Lib/site.py
106
126
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,310
removeduppaths
def removeduppaths(): """ Remove duplicate entries from sys.path along with making them absolute""" # This ensures that the initial path provided by the interpreter contains # only absolute pathnames, even if we're running from the build directory. L = [] known_paths = set() for dir in sys.p...
python
Lib/site.py
129
145
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,311
_init_pathinfo
def _init_pathinfo(): """Return a set containing all existing file system items from sys.path.""" d = set() for item in sys.path: try: if os.path.exists(item): _, itemcase = makepath(item) d.add(itemcase) except TypeError: continue ...
python
Lib/site.py
148
158
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,312
addpackage
def addpackage(sitedir, name, known_paths): """Process a .pth file within the site-packages directory: For each line in the file, either combine it with sitedir to a path and add that to known_paths, or execute it if it starts with 'import '. """ if known_paths is None: known_paths = _...
python
Lib/site.py
161
222
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,313
addsitedir
def addsitedir(sitedir, known_paths=None): """Add 'sitedir' argument to sys.path if missing and handle .pth files in 'sitedir'""" _trace(f"Adding directory: {sitedir!r}") if known_paths is None: known_paths = _init_pathinfo() reset = True else: reset = False sitedir, site...
python
Lib/site.py
225
248
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,314
check_enableusersite
def check_enableusersite(): """Check if user site directory is safe for inclusion The function tests for the command line flag (including environment var), process uid/gid equal to effective uid/gid. None: Disabled for security reasons False: Disabled by user (command line option) True: Safe a...
python
Lib/site.py
251
273
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,315
_get_implementation
def _get_implementation(): return 'Python'
python
Lib/site.py
283
284
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,316
_getuserbase
def _getuserbase(): env_base = os.environ.get("PYTHONUSERBASE", None) if env_base: return env_base # Emscripten, iOS, tvOS, VxWorks, WASI, and watchOS have no home directories if sys.platform in {"emscripten", "ios", "tvos", "vxworks", "wasi", "watchos"}: return None def joinuser(*...
python
Lib/site.py
287
307
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,317
joinuser
def joinuser(*args): return os.path.expanduser(os.path.join(*args))
python
Lib/site.py
296
297
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,318
_get_path
def _get_path(userbase): version = sys.version_info implementation = _get_implementation() implementation_lower = implementation.lower() if os.name == 'nt': ver_nodot = sys.winver.replace('.', '') return f'{userbase}\\{implementation}{ver_nodot}\\site-packages' if sys.platform == '...
python
Lib/site.py
311
323
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,319
getuserbase
def getuserbase(): """Returns the `user base` directory path. The `user base` directory can be used to store data. If the global variable ``USER_BASE`` is not initialized yet, this function will also set it. """ global USER_BASE if USER_BASE is None: USER_BASE = _getuserbase() r...
python
Lib/site.py
326
336
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,320
getusersitepackages
def getusersitepackages(): """Returns the user-specific site-packages directory path. If the global variable ``USER_SITE`` is not initialized yet, this function will also set it. """ global USER_SITE, ENABLE_USER_SITE userbase = getuserbase() # this will also set USER_BASE if USER_SITE is ...
python
Lib/site.py
339
354
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,321
addusersitepackages
def addusersitepackages(known_paths): """Add a per user site-package to sys.path Each user has its own python directory with site-packages in the home directory. """ # get the per user site-package path # this call will also make sure USER_BASE and USER_SITE are set _trace("Processing user ...
python
Lib/site.py
356
369
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,322
getsitepackages
def getsitepackages(prefixes=None): """Returns a list containing all global site-packages directories. For each directory present in ``prefixes`` (or the global ``PREFIXES``), this function will find its `site-packages` subdirectory depending on the system environment, and will return a list of full pa...
python
Lib/site.py
371
404
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,323
addsitepackages
def addsitepackages(known_paths, prefixes=None): """Add site-packages to sys.path""" _trace("Processing global site-packages") for sitedir in getsitepackages(prefixes): if os.path.isdir(sitedir): addsitedir(sitedir, known_paths) return known_paths
python
Lib/site.py
406
413
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,324
setquit
def setquit(): """Define new builtins 'quit' and 'exit'. These are objects which make the interpreter exit when called. The repr of each object contains a hint at how it works. """ if os.sep == '\\': eof = 'Ctrl-Z plus Return' else: eof = 'Ctrl-D (i.e. EOF)' builtins.quit ...
python
Lib/site.py
415
428
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,325
setcopyright
def setcopyright(): """Set 'copyright' and 'credits' in builtins""" builtins.copyright = _sitebuiltins._Printer("copyright", sys.copyright) builtins.credits = _sitebuiltins._Printer("credits", """\ Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands for supporting Python develo...
python
Lib/site.py
431
449
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,326
sethelper
def sethelper(): builtins.help = _sitebuiltins._Helper()
python
Lib/site.py
452
453
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,327
gethistoryfile
def gethistoryfile(): """Check if the PYTHON_HISTORY environment variable is set and define it as the .python_history file. If PYTHON_HISTORY is not set, use the default .python_history file. """ if not sys.flags.ignore_environment: history = os.environ.get("PYTHON_HISTORY") if hist...
python
Lib/site.py
456
466
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,328
enablerlcompleter
def enablerlcompleter(): """Enable default readline configuration on interactive prompts, by registering a sys.__interactivehook__. """ sys.__interactivehook__ = register_readline
python
Lib/site.py
469
473
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,329
register_readline
def register_readline(): """Configure readline completion on interactive prompts. If the readline module can be imported, the hook will set the Tab key as completion key and register ~/.python_history as history file. This can be overridden in the sitecustomize or usercustomize module, or in a PYTH...
python
Lib/site.py
476
536
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,330
write_history
def write_history(): try: if os.getenv("PYTHON_BASIC_REPL"): readline.write_history_file(history) else: _pyrepl.readline.write_history_file(history) except (FileNotFoundError, PermissionError): # home directo...
python
Lib/site.py
525
534
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,331
venv
def venv(known_paths): global PREFIXES, ENABLE_USER_SITE env = os.environ if sys.platform == 'darwin' and '__PYVENV_LAUNCHER__' in env: executable = sys._base_executable = os.environ['__PYVENV_LAUNCHER__'] else: executable = sys.executable exe_dir = os.path.dirname(os.path.abspath(e...
python
Lib/site.py
539
591
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,332
execsitecustomize
def execsitecustomize(): """Run custom site specific code, if available.""" try: try: import sitecustomize except ImportError as exc: if exc.name == 'sitecustomize': pass else: raise except Exception as err: if sys.f...
python
Lib/site.py
594
611
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,333
execusercustomize
def execusercustomize(): """Run custom user specific code, if available.""" try: try: import usercustomize except ImportError as exc: if exc.name == 'usercustomize': pass else: raise except Exception as err: if sys.f...
python
Lib/site.py
614
631
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,334
main
def main(): """Add standard site-specific directories to the module search path. This function is called automatically when this module is imported, unless the python interpreter was started with the -S flag. """ global ENABLE_USER_SITE orig_path = sys.path[:] known_paths = removeduppaths(...
python
Lib/site.py
634
661
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,335
_script
def _script(): help = """\ %s [--user-base] [--user-site] Without arguments print some useful information With arguments print the value of USER_BASE and/or USER_SITE separated by '%s'. Exit codes with --user-base or --user-site: 0 - user site directory is enabled 1 - user site dir...
python
Lib/site.py
668
720
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,336
exists
def exists(path): if path is not None and os.path.isdir(path): return "exists" else: return "doesn't exist"
python
Lib/site.py
691
695
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,337
__init__
def __init__(self, msg=''): self.message = msg Exception.__init__(self, msg)
python
Lib/configparser.py
180
182
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,338
__repr__
def __repr__(self): return self.message
python
Lib/configparser.py
184
185
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,339
__init__
def __init__(self, section): Error.__init__(self, 'No section: %r' % (section,)) self.section = section self.args = (section, )
python
Lib/configparser.py
193
196
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,340
__init__
def __init__(self, section, source=None, lineno=None): msg = [repr(section), " already exists"] if source is not None: message = ["While reading from ", repr(source)] if lineno is not None: message.append(" [line {0:2d}]".format(lineno)) message.append...
python
Lib/configparser.py
207
222
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,341
__init__
def __init__(self, section, option, source=None, lineno=None): msg = [repr(option), " in section ", repr(section), " already exists"] if source is not None: message = ["While reading from ", repr(source)] if lineno is not None: message.append(" [lin...
python
Lib/configparser.py
232
249
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,342
__init__
def __init__(self, option, section): Error.__init__(self, "No option %r in section: %r" % (option, section)) self.option = option self.section = section self.args = (option, section)
python
Lib/configparser.py
255
260
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,343
__init__
def __init__(self, option, section, msg): Error.__init__(self, msg) self.option = option self.section = section self.args = (option, section, msg)
python
Lib/configparser.py
266
270
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,344
__init__
def __init__(self, option, section, rawval, reference): msg = ("Bad value substitution: option {!r} in section {!r} contains " "an interpolation key {!r} which is not a valid option name. " "Raw value: {!r}".format(option, section, reference, rawval)) InterpolationError.__i...
python
Lib/configparser.py
276
282
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,345
__init__
def __init__(self, option, section, rawval): msg = ("Recursion limit exceeded in value substitution: option {!r} " "in section {!r} contains an interpolation key which " "cannot be substituted in {} steps. Raw value: {!r}" "".format(option, section, MAX_INTERPOLATION...
python
Lib/configparser.py
296
303
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,346
__init__
def __init__(self, source, *args): super().__init__(f'Source contains parsing errors: {source!r}') self.source = source self.errors = [] self.args = (source, ) if args: self.append(*args)
python
Lib/configparser.py
309
315
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,347
append
def append(self, lineno, line): self.errors.append((lineno, line)) self.message += '\n\t[line %2d]: %s' % (lineno, repr(line))
python
Lib/configparser.py
317
319
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,348
combine
def combine(self, others): for other in others: for error in other.errors: self.append(*error) return self
python
Lib/configparser.py
321
325
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,349
_raise_all
def _raise_all(exceptions: Iterable['ParsingError']): """ Combine any number of ParsingErrors into one and raise it. """ exceptions = iter(exceptions) with contextlib.suppress(StopIteration): raise next(exceptions).combine(exceptions)
python
Lib/configparser.py
328
334
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,350
__init__
def __init__(self, filename, lineno, line): Error.__init__( self, 'File contains no section headers.\nfile: %r, line: %d\n%r' % (filename, lineno, line)) self.source = filename self.lineno = lineno self.line = line self.args = (filename, lineno...
python
Lib/configparser.py
341
349
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,351
__init__
def __init__(self, filename, lineno, line): Error.__init__( self, "Key without value continued with an indented line.\n" "file: %r, line: %d\n%r" %(filename, lineno, line)) self.source = filename self.lineno = lineno self.line = line ...
python
Lib/configparser.py
354
363
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,352
__repr__
def __repr__(self): return "<UNNAMED_SECTION>"
python
Lib/configparser.py
367
368
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,353
before_get
def before_get(self, parser, section, option, value, defaults): return value
python
Lib/configparser.py
383
384
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,354
before_set
def before_set(self, parser, section, option, value): return value
python
Lib/configparser.py
386
387
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,355
before_read
def before_read(self, parser, section, option, value): return value
python
Lib/configparser.py
389
390
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,356
before_write
def before_write(self, parser, section, option, value): return value
python
Lib/configparser.py
392
393
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,357
before_get
def before_get(self, parser, section, option, value, defaults): L = [] self._interpolate_some(parser, option, L, value, section, defaults, 1) return ''.join(L)
python
Lib/configparser.py
413
416
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,358
before_set
def before_set(self, parser, section, option, value): tmp_value = value.replace('%%', '') # escaped percent signs tmp_value = self._KEYCRE.sub('', tmp_value) # valid syntax if '%' in tmp_value: raise ValueError("invalid interpolation syntax in %r at " "po...
python
Lib/configparser.py
418
424
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,359
_interpolate_some
def _interpolate_some(self, parser, option, accum, rest, section, map, depth): rawval = parser.get(section, option, raw=True, fallback=rest) if depth > MAX_INTERPOLATION_DEPTH: raise InterpolationDepthError(option, section, rawval) while rest: p ...
python
Lib/configparser.py
426
465
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,360
before_get
def before_get(self, parser, section, option, value, defaults): L = [] self._interpolate_some(parser, option, L, value, section, defaults, 1) return ''.join(L)
python
Lib/configparser.py
474
477
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,361
before_set
def before_set(self, parser, section, option, value): tmp_value = value.replace('$$', '') # escaped dollar signs tmp_value = self._KEYCRE.sub('', tmp_value) # valid syntax if '$' in tmp_value: raise ValueError("invalid interpolation syntax in %r at " "pos...
python
Lib/configparser.py
479
485
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,362
_interpolate_some
def _interpolate_some(self, parser, option, accum, rest, section, map, depth): rawval = parser.get(section, option, raw=True, fallback=rest) if depth > MAX_INTERPOLATION_DEPTH: raise InterpolationDepthError(option, section, rawval) while rest: p ...
python
Lib/configparser.py
487
539
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,363
__init__
def __init__(self): self.elements_added = set() self.errors = list()
python
Lib/configparser.py
551
553
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,364
__new__
def __new__(cls, val, *args, **kwargs): return super().__new__(cls, val)
python
Lib/configparser.py
558
559
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,365
__init__
def __init__(self, val, prefixes): self.prefixes = prefixes
python
Lib/configparser.py
561
562
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,366
clean
def clean(self): return self._strip_full() and self._strip_inline()
python
Lib/configparser.py
565
566
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,367
has_comments
def has_comments(self): return self.strip() != self.clean
python
Lib/configparser.py
569
570
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,368
_strip_inline
def _strip_inline(self): """ Search for the earliest prefix at the beginning of the line or following a space. """ matcher = re.compile( '|'.join(fr'(^|\s)({re.escape(prefix)})' for prefix in self.prefixes.inline) # match nothing if no prefixes or '(?!...
python
Lib/configparser.py
572
582
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,369
_strip_full
def _strip_full(self): return '' if any(map(self.strip().startswith, self.prefixes.full)) else True
python
Lib/configparser.py
584
585
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,370
__init__
def __init__(self, defaults=None, dict_type=_default_dict, allow_no_value=False, *, delimiters=('=', ':'), comment_prefixes=('#', ';'), inline_comment_prefixes=None, strict=True, empty_lines_in_values=True, default_section=DEFAULTSECT, ...
python
Lib/configparser.py
629
676
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,371
defaults
def defaults(self): return self._defaults
python
Lib/configparser.py
678
679
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,372
sections
def sections(self): """Return a list of section names, excluding [DEFAULT]""" # self._sections will never have [DEFAULT] in it return list(self._sections.keys())
python
Lib/configparser.py
681
684
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,373
add_section
def add_section(self, section): """Create a new section in the configuration. Raise DuplicateSectionError if a section by the specified name already exists. Raise ValueError if name is DEFAULT. """ if section == self.default_section: raise ValueError('Invalid section...
python
Lib/configparser.py
686
698
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,374
has_section
def has_section(self, section): """Indicate whether the named section is present in the configuration. The DEFAULT section is not acknowledged. """ return section in self._sections
python
Lib/configparser.py
700
705
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,375
options
def options(self, section): """Return a list of option names for the given section name.""" try: opts = self._sections[section].copy() except KeyError: raise NoSectionError(section) from None opts.update(self._defaults) return list(opts.keys())
python
Lib/configparser.py
707
714
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,376
read
def read(self, filenames, encoding=None): """Read and parse a filename or an iterable of filenames. Files that cannot be opened are silently ignored; this is designed so that you can specify an iterable of potential configuration file locations (e.g. current directory, user's ho...
python
Lib/configparser.py
716
741
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,377
read_file
def read_file(self, f, source=None): """Like read() but the argument must be a file-like object. The `f` argument must be iterable, returning one line at a time. Optional second argument is the `source` specifying the name of the file being read. If not given, it is taken from f.name. I...
python
Lib/configparser.py
743
756
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,378
read_string
def read_string(self, string, source='<string>'): """Read configuration from a given string.""" sfile = io.StringIO(string) self.read_file(sfile, source)
python
Lib/configparser.py
758
761
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,379
read_dict
def read_dict(self, dictionary, source='<dict>'): """Read configuration from a dictionary. Keys are section names, values are dictionaries with keys and values that should be present in the section. If the used dictionary type preserves order, sections and their keys will be added in or...
python
Lib/configparser.py
763
792
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,380
get
def get(self, section, option, *, raw=False, vars=None, fallback=_UNSET): """Get an option value for a given section. If `vars` is provided, it must be a dictionary. The option is looked up in `vars` (if provided), `section`, and in `DEFAULTSECT` in that order. If the key is not found a...
python
Lib/configparser.py
794
829
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,381
_get
def _get(self, section, conv, option, **kwargs): return conv(self.get(section, option, **kwargs))
python
Lib/configparser.py
831
832
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,382
_get_conv
def _get_conv(self, section, option, conv, *, raw=False, vars=None, fallback=_UNSET, **kwargs): try: return self._get(section, conv, option, raw=raw, vars=vars, **kwargs) except (NoSectionError, NoOptionError): if fallback is _UNSET:...
python
Lib/configparser.py
834
842
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,383
getint
def getint(self, section, option, *, raw=False, vars=None, fallback=_UNSET, **kwargs): return self._get_conv(section, option, int, raw=raw, vars=vars, fallback=fallback, **kwargs)
python
Lib/configparser.py
845
848
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,384
getfloat
def getfloat(self, section, option, *, raw=False, vars=None, fallback=_UNSET, **kwargs): return self._get_conv(section, option, float, raw=raw, vars=vars, fallback=fallback, **kwargs)
python
Lib/configparser.py
850
853
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,385
getboolean
def getboolean(self, section, option, *, raw=False, vars=None, fallback=_UNSET, **kwargs): return self._get_conv(section, option, self._convert_to_boolean, raw=raw, vars=vars, fallback=fallback, **kwargs)
python
Lib/configparser.py
855
858
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,386
items
def items(self, section=_UNSET, raw=False, vars=None): """Return a list of (name, value) tuples for each option in a section. All % interpolations are expanded in the return values, based on the defaults passed into the constructor, unless the optional argument `raw` is true. Additiona...
python
Lib/configparser.py
860
888
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,387
popitem
def popitem(self): """Remove a section from the parser and return it as a (section_name, section_proxy) tuple. If no section is present, raise KeyError. The section DEFAULT is never returned because it cannot be removed. """ for key in self.sections(): value ...
python
Lib/configparser.py
890
901
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,388
optionxform
def optionxform(self, optionstr): return optionstr.lower()
python
Lib/configparser.py
903
904
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,389
has_option
def has_option(self, section, option): """Check for the existence of a given option in a given section. If the specified `section` is None or an empty string, DEFAULT is assumed. If the specified `section` does not exist, returns False.""" if not section or section == self.default_sectio...
python
Lib/configparser.py
906
918
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,390
set
def set(self, section, option, value=None): """Set an option.""" if value: value = self._interpolation.before_set(self, section, option, value) if not section or section == self.default_section: sectdict = self._defaults ...
python
Lib/configparser.py
920
932
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,391
write
def write(self, fp, space_around_delimiters=True): """Write an .ini-format representation of the configuration state. If `space_around_delimiters` is True (the default), delimiters between keys and values are surrounded by spaces. Please note that comments in the original configuration...
python
Lib/configparser.py
934
957
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,392
_write_section
def _write_section(self, fp, section_name, section_items, delimiter, unnamed=False): """Write a single section to the specified `fp'.""" if not unnamed: fp.write("[{}]\n".format(section_name)) for key, value in section_items: value = self._interpolation.before_write(self,...
python
Lib/configparser.py
959
971
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,393
remove_option
def remove_option(self, section, option): """Remove an option.""" if not section or section == self.default_section: sectdict = self._defaults else: try: sectdict = self._sections[section] except KeyError: raise NoSectionError(s...
python
Lib/configparser.py
973
986
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,394
remove_section
def remove_section(self, section): """Remove a file section.""" existed = section in self._sections if existed: del self._sections[section] del self._proxies[section] return existed
python
Lib/configparser.py
988
994
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,395
__getitem__
def __getitem__(self, key): if key != self.default_section and not self.has_section(key): raise KeyError(key) return self._proxies[key]
python
Lib/configparser.py
996
999
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,396
__setitem__
def __setitem__(self, key, value): # To conform with the mapping protocol, overwrites existing values in # the section. if key in self and self[key] is value: return # XXX this is not atomic if read_dict fails at any point. Then again, # no update method in configpars...
python
Lib/configparser.py
1,001
1,012
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,397
__delitem__
def __delitem__(self, key): if key == self.default_section: raise ValueError("Cannot remove the default section.") if not self.has_section(key): raise KeyError(key) self.remove_section(key)
python
Lib/configparser.py
1,014
1,019
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,398
__contains__
def __contains__(self, key): return key == self.default_section or self.has_section(key)
python
Lib/configparser.py
1,021
1,022
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,399
__len__
def __len__(self): return len(self._sections) + 1 # the default section
python
Lib/configparser.py
1,024
1,025
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
14,400
__iter__
def __iter__(self): # XXX does it break when underlying container state changed? return itertools.chain((self.default_section,), self._sections.keys())
python
Lib/configparser.py
1,027
1,029
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }