basedpyright 1.13.2 → 1.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pyright-langserver.js +1 -1
- package/dist/pyright-langserver.js.map +1 -1
- package/dist/pyright.js +1 -1
- package/dist/pyright.js.map +1 -1
- package/dist/typeshed-fallback/commit.txt +1 -1
- package/dist/typeshed-fallback/stdlib/VERSIONS +2 -0
- package/dist/typeshed-fallback/stdlib/_ast.pyi +42 -279
- package/dist/typeshed-fallback/stdlib/_bisect.pyi +221 -221
- package/dist/typeshed-fallback/stdlib/_bootlocale.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/_collections_abc.pyi +15 -5
- package/dist/typeshed-fallback/stdlib/_csv.pyi +213 -213
- package/dist/typeshed-fallback/stdlib/_decimal.pyi +0 -18
- package/dist/typeshed-fallback/stdlib/_dummy_thread.pyi +33 -33
- package/dist/typeshed-fallback/stdlib/_dummy_threading.pyi +180 -164
- package/dist/typeshed-fallback/stdlib/_heapq.pyi +67 -67
- package/dist/typeshed-fallback/stdlib/_interpqueues.pyi +16 -0
- package/dist/typeshed-fallback/stdlib/_interpreters.pyi +50 -0
- package/dist/typeshed-fallback/stdlib/_json.pyi +92 -92
- package/dist/typeshed-fallback/stdlib/_lsprof.pyi +92 -92
- package/dist/typeshed-fallback/stdlib/_msi.pyi +94 -92
- package/dist/typeshed-fallback/stdlib/_operator.pyi +0 -24
- package/dist/typeshed-fallback/stdlib/_random.pyi +30 -30
- package/dist/typeshed-fallback/stdlib/_tkinter.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/_weakrefset.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/abc.pyi +12 -4
- package/dist/typeshed-fallback/stdlib/argparse.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/array.pyi +281 -281
- package/dist/typeshed-fallback/stdlib/asynchat.pyi +21 -21
- package/dist/typeshed-fallback/stdlib/asyncio/events.pyi +35 -4
- package/dist/typeshed-fallback/stdlib/asyncio/futures.pyi +107 -15
- package/dist/typeshed-fallback/stdlib/asyncio/locks.pyi +9 -3
- package/dist/typeshed-fallback/stdlib/asyncio/queues.pyi +10 -2
- package/dist/typeshed-fallback/stdlib/asyncio/sslproto.pyi +23 -4
- package/dist/typeshed-fallback/stdlib/asyncio/tasks.pyi +107 -12
- package/dist/typeshed-fallback/stdlib/asyncio/windows_events.pyi +86 -86
- package/dist/typeshed-fallback/stdlib/asyncio/windows_utils.pyi +49 -49
- package/dist/typeshed-fallback/stdlib/asyncore.pyi +90 -90
- package/dist/typeshed-fallback/stdlib/audioop.pyi +95 -95
- package/dist/typeshed-fallback/stdlib/binascii.pyi +123 -123
- package/dist/typeshed-fallback/stdlib/binhex.pyi +45 -45
- package/dist/typeshed-fallback/stdlib/builtins.pyi +0 -1
- package/dist/typeshed-fallback/stdlib/bz2.pyi +59 -6
- package/dist/typeshed-fallback/stdlib/cmath.pyi +112 -112
- package/dist/typeshed-fallback/stdlib/codecs.pyi +18 -6
- package/dist/typeshed-fallback/stdlib/collections/__init__.pyi +200 -56
- package/dist/typeshed-fallback/stdlib/concurrent/futures/__init__.pyi +33 -14
- package/dist/typeshed-fallback/stdlib/concurrent/futures/_base.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/concurrent/futures/thread.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/contextvars.pyi +99 -16
- package/dist/typeshed-fallback/stdlib/csv.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/ctypes/__init__.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/ctypes/_endian.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/curses/panel.pyi +16 -4
- package/dist/typeshed-fallback/stdlib/dataclasses.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/datetime.pyi +346 -104
- package/dist/typeshed-fallback/stdlib/dbm/gnu.pyi +52 -2
- package/dist/typeshed-fallback/stdlib/dbm/ndbm.pyi +26 -2
- package/dist/typeshed-fallback/stdlib/difflib.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/distutils/__init__.pyi +5 -5
- package/dist/typeshed-fallback/stdlib/distutils/archive_util.pyi +35 -35
- package/dist/typeshed-fallback/stdlib/distutils/bcppcompiler.pyi +3 -3
- package/dist/typeshed-fallback/stdlib/distutils/ccompiler.pyi +173 -173
- package/dist/typeshed-fallback/stdlib/distutils/cmd.pyi +99 -99
- package/dist/typeshed-fallback/stdlib/distutils/command/bdist.pyi +25 -25
- package/dist/typeshed-fallback/stdlib/distutils/command/bdist_dumb.pyi +21 -21
- package/dist/typeshed-fallback/stdlib/distutils/command/bdist_msi.pyi +45 -45
- package/dist/typeshed-fallback/stdlib/distutils/command/bdist_rpm.pyi +52 -52
- package/dist/typeshed-fallback/stdlib/distutils/command/bdist_wininst.pyi +16 -16
- package/dist/typeshed-fallback/stdlib/distutils/command/build.pyi +33 -33
- package/dist/typeshed-fallback/stdlib/distutils/command/build_clib.pyi +27 -27
- package/dist/typeshed-fallback/stdlib/distutils/command/build_ext.pyi +50 -50
- package/dist/typeshed-fallback/stdlib/distutils/command/build_py.pyi +44 -44
- package/dist/typeshed-fallback/stdlib/distutils/command/build_scripts.pyi +24 -24
- package/dist/typeshed-fallback/stdlib/distutils/command/check.pyi +39 -39
- package/dist/typeshed-fallback/stdlib/distutils/command/clean.pyi +17 -17
- package/dist/typeshed-fallback/stdlib/distutils/command/config.pyi +84 -84
- package/dist/typeshed-fallback/stdlib/distutils/command/install.pyi +65 -65
- package/dist/typeshed-fallback/stdlib/distutils/command/install_data.pyi +19 -19
- package/dist/typeshed-fallback/stdlib/distutils/command/install_egg_info.pyi +18 -18
- package/dist/typeshed-fallback/stdlib/distutils/command/install_headers.pyi +16 -16
- package/dist/typeshed-fallback/stdlib/distutils/command/install_lib.pyi +25 -25
- package/dist/typeshed-fallback/stdlib/distutils/command/install_scripts.pyi +18 -18
- package/dist/typeshed-fallback/stdlib/distutils/command/register.pyi +20 -20
- package/dist/typeshed-fallback/stdlib/distutils/command/sdist.pyi +44 -44
- package/dist/typeshed-fallback/stdlib/distutils/command/upload.pyi +17 -17
- package/dist/typeshed-fallback/stdlib/distutils/config.pyi +17 -17
- package/dist/typeshed-fallback/stdlib/distutils/core.pyi +57 -57
- package/dist/typeshed-fallback/stdlib/distutils/cygwinccompiler.pyi +20 -20
- package/dist/typeshed-fallback/stdlib/distutils/debug.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/distutils/dep_util.pyi +14 -14
- package/dist/typeshed-fallback/stdlib/distutils/dir_util.pyi +23 -23
- package/dist/typeshed-fallback/stdlib/distutils/dist.pyi +149 -149
- package/dist/typeshed-fallback/stdlib/distutils/errors.pyi +19 -19
- package/dist/typeshed-fallback/stdlib/distutils/extension.pyi +36 -36
- package/dist/typeshed-fallback/stdlib/distutils/fancy_getopt.pyi +34 -34
- package/dist/typeshed-fallback/stdlib/distutils/file_util.pyi +38 -38
- package/dist/typeshed-fallback/stdlib/distutils/filelist.pyi +58 -58
- package/dist/typeshed-fallback/stdlib/distutils/log.pyi +25 -25
- package/dist/typeshed-fallback/stdlib/distutils/msvccompiler.pyi +3 -3
- package/dist/typeshed-fallback/stdlib/distutils/spawn.pyi +6 -6
- package/dist/typeshed-fallback/stdlib/distutils/sysconfig.pyi +33 -33
- package/dist/typeshed-fallback/stdlib/distutils/text_file.pyi +21 -21
- package/dist/typeshed-fallback/stdlib/distutils/unixccompiler.pyi +3 -3
- package/dist/typeshed-fallback/stdlib/distutils/util.pyi +50 -50
- package/dist/typeshed-fallback/stdlib/distutils/version.pyi +38 -36
- package/dist/typeshed-fallback/stdlib/dummy_threading.pyi +2 -2
- package/dist/typeshed-fallback/stdlib/email/_header_value_parser.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/email/charset.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/email/header.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/email/headerregistry.pyi +6 -1
- package/dist/typeshed-fallback/stdlib/enum.pyi +8 -1
- package/dist/typeshed-fallback/stdlib/filecmp.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/fileinput.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/formatter.pyi +88 -88
- package/dist/typeshed-fallback/stdlib/fractions.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/functools.pyi +65 -13
- package/dist/typeshed-fallback/stdlib/graphlib.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/gzip.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/hashlib.pyi +42 -14
- package/dist/typeshed-fallback/stdlib/heapq.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/hmac.pyi +30 -2
- package/dist/typeshed-fallback/stdlib/http/cookies.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/imp.pyi +62 -62
- package/dist/typeshed-fallback/stdlib/importlib/abc.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/importlib/machinery.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/importlib/metadata/__init__.pyi +79 -15
- package/dist/typeshed-fallback/stdlib/importlib/metadata/_meta.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/importlib/resources/simple.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/io.pyi +428 -44
- package/dist/typeshed-fallback/stdlib/ipaddress.pyi +153 -28
- package/dist/typeshed-fallback/stdlib/itertools.pyi +5 -1
- package/dist/typeshed-fallback/stdlib/json/encoder.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/keyword.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/lib2to3/pytree.pyi +12 -2
- package/dist/typeshed-fallback/stdlib/logging/__init__.pyi +17 -3
- package/dist/typeshed-fallback/stdlib/lzma.pyi +107 -9
- package/dist/typeshed-fallback/stdlib/mailbox.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/math.pyi +424 -424
- package/dist/typeshed-fallback/stdlib/mmap.pyi +160 -160
- package/dist/typeshed-fallback/stdlib/msilib/__init__.pyi +177 -177
- package/dist/typeshed-fallback/stdlib/msilib/schema.pyi +94 -94
- package/dist/typeshed-fallback/stdlib/msilib/sequence.pyi +13 -13
- package/dist/typeshed-fallback/stdlib/msilib/text.pyi +7 -7
- package/dist/typeshed-fallback/stdlib/multiprocessing/connection.pyi +9 -3
- package/dist/typeshed-fallback/stdlib/multiprocessing/context.pyi +12 -2
- package/dist/typeshed-fallback/stdlib/multiprocessing/dummy/__init__.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/multiprocessing/managers.pyi +10 -2
- package/dist/typeshed-fallback/stdlib/multiprocessing/pool.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/multiprocessing/popen_spawn_win32.pyi +30 -30
- package/dist/typeshed-fallback/stdlib/multiprocessing/process.pyi +15 -4
- package/dist/typeshed-fallback/stdlib/multiprocessing/queues.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/multiprocessing/shared_memory.pyi +19 -5
- package/dist/typeshed-fallback/stdlib/nis.pyi +31 -4
- package/dist/typeshed-fallback/stdlib/numbers.pyi +26 -6
- package/dist/typeshed-fallback/stdlib/opcode.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/optparse.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/os/__init__.pyi +1447 -217
- package/dist/typeshed-fallback/stdlib/pathlib.pyi +42 -11
- package/dist/typeshed-fallback/stdlib/pickle.pyi +200 -12
- package/dist/typeshed-fallback/stdlib/posixpath.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/pyexpat/errors.pyi +2 -0
- package/dist/typeshed-fallback/stdlib/pyexpat/model.pyi +2 -0
- package/dist/typeshed-fallback/stdlib/queue.pyi +57 -9
- package/dist/typeshed-fallback/stdlib/re.pyi +219 -57
- package/dist/typeshed-fallback/stdlib/sched.pyi +8 -1
- package/dist/typeshed-fallback/stdlib/signal.pyi +95 -19
- package/dist/typeshed-fallback/stdlib/smtpd.pyi +91 -91
- package/dist/typeshed-fallback/stdlib/socket.pyi +12 -2
- package/dist/typeshed-fallback/stdlib/sqlite3/dbapi2.pyi +417 -83
- package/dist/typeshed-fallback/stdlib/ssl.pyi +133 -22
- package/dist/typeshed-fallback/stdlib/statistics.pyi +20 -5
- package/dist/typeshed-fallback/stdlib/struct.pyi +114 -13
- package/dist/typeshed-fallback/stdlib/subprocess.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/symbol.pyi +93 -93
- package/dist/typeshed-fallback/stdlib/symtable.pyi +30 -1
- package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +7 -3
- package/dist/typeshed-fallback/stdlib/tarfile.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/tempfile.pyi +17 -3
- package/dist/typeshed-fallback/stdlib/threading.pyi +68 -7
- package/dist/typeshed-fallback/stdlib/tkinter/__init__.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/turtle.pyi +11 -3
- package/dist/typeshed-fallback/stdlib/types.pyi +306 -79
- package/dist/typeshed-fallback/stdlib/typing.pyi +310 -31
- package/dist/typeshed-fallback/stdlib/typing_extensions.pyi +42 -11
- package/dist/typeshed-fallback/stdlib/unittest/__init__.pyi +6 -1
- package/dist/typeshed-fallback/stdlib/unittest/case.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/unittest/mock.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/urllib/parse.pyi +51 -3
- package/dist/typeshed-fallback/stdlib/weakref.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/winsound.pyi +44 -28
- package/dist/typeshed-fallback/stdlib/xml/dom/minicompat.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/xml/dom/minidom.pyi +33 -11
- package/dist/typeshed-fallback/stdlib/xml/etree/ElementTree.pyi +30 -10
- package/dist/typeshed-fallback/stdlib/xml/parsers/expat/errors.pyi +2 -0
- package/dist/typeshed-fallback/stdlib/xml/parsers/expat/model.pyi +2 -0
- package/dist/typeshed-fallback/stdlib/xxlimited.pyi +19 -4
- package/dist/typeshed-fallback/stdlib/zipimport.pyi +31 -0
- package/dist/typeshed-fallback/stdlib/zlib.pyi +157 -157
- package/dist/typeshed-fallback/stdlib/zoneinfo/__init__.pyi +18 -6
- package/dist/typeshed-fallback/stubs/assertpy/assertpy/extracting.pyi +2 -2
- package/dist/typeshed-fallback/stubs/docker/docker/_types.pyi +18 -1
- package/dist/typeshed-fallback/stubs/docker/docker/api/container.pyi +5 -19
- package/dist/typeshed-fallback/stubs/docker/docker/api/daemon.pyi +2 -1
- package/dist/typeshed-fallback/stubs/docker/docker/models/containers.pyi +268 -6
- package/dist/typeshed-fallback/stubs/docker/docker/types/containers.pyi +3 -7
- package/dist/typeshed-fallback/stubs/docker/docker/types/daemon.pyi +10 -4
- package/dist/typeshed-fallback/stubs/docutils/docutils/parsers/rst/states.pyi +47 -0
- package/dist/typeshed-fallback/stubs/gdb/gdb/__init__.pyi +1 -1
- package/dist/typeshed-fallback/stubs/networkx/networkx/algorithms/shortest_paths/generic.pyi +1 -1
- package/dist/typeshed-fallback/stubs/openpyxl/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/packaging/extended.pyi +0 -2
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/styles/named_styles.pyi +2 -1
- package/dist/typeshed-fallback/stubs/pygit2/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/pytest-lazy-fixture/pytest_lazyfixture.pyi +2 -2
- package/dist/typeshed-fallback/stubs/python-crontab/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/reportlab/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/reportlab/reportlab/lib/rl_safe_eval.pyi +23 -11
- package/dist/typeshed-fallback/stubs/reportlab/reportlab/pdfbase/pdfdoc.pyi +6 -0
- package/dist/typeshed-fallback/stubs/setuptools/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/archive_util.pyi +8 -8
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/ccompiler.pyi +11 -17
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/cmd.pyi +11 -11
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/build_py.pyi +1 -2
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/filelist.pyi +4 -12
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/sysconfig.pyi +2 -4
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/util.pyi +5 -8
- package/dist/typeshed-fallback/stubs/str2bool/METADATA.toml +2 -0
- package/dist/typeshed-fallback/stubs/str2bool/str2bool/__init__.pyi +7 -0
- package/package.json +1 -1
|
@@ -344,23 +344,41 @@ class stat_result(structseq[float], tuple[int, int, int, int, int, int, int, flo
|
|
|
344
344
|
__match_args__: Final = ("st_mode", "st_ino", "st_dev", "st_nlink", "st_uid", "st_gid", "st_size")
|
|
345
345
|
|
|
346
346
|
@property
|
|
347
|
-
def st_mode(self) -> int:
|
|
347
|
+
def st_mode(self) -> int:
|
|
348
|
+
"""protection bits"""
|
|
349
|
+
...
|
|
348
350
|
@property
|
|
349
|
-
def st_ino(self) -> int:
|
|
351
|
+
def st_ino(self) -> int:
|
|
352
|
+
"""inode"""
|
|
353
|
+
...
|
|
350
354
|
@property
|
|
351
|
-
def st_dev(self) -> int:
|
|
355
|
+
def st_dev(self) -> int:
|
|
356
|
+
"""device"""
|
|
357
|
+
...
|
|
352
358
|
@property
|
|
353
|
-
def st_nlink(self) -> int:
|
|
359
|
+
def st_nlink(self) -> int:
|
|
360
|
+
"""number of hard links"""
|
|
361
|
+
...
|
|
354
362
|
@property
|
|
355
|
-
def st_uid(self) -> int:
|
|
363
|
+
def st_uid(self) -> int:
|
|
364
|
+
"""user ID of owner"""
|
|
365
|
+
...
|
|
356
366
|
@property
|
|
357
|
-
def st_gid(self) -> int:
|
|
367
|
+
def st_gid(self) -> int:
|
|
368
|
+
"""group ID of owner"""
|
|
369
|
+
...
|
|
358
370
|
@property
|
|
359
|
-
def st_size(self) -> int:
|
|
371
|
+
def st_size(self) -> int:
|
|
372
|
+
"""total size, in bytes"""
|
|
373
|
+
...
|
|
360
374
|
@property
|
|
361
|
-
def st_atime(self) -> float:
|
|
375
|
+
def st_atime(self) -> float:
|
|
376
|
+
"""time of last access"""
|
|
377
|
+
...
|
|
362
378
|
@property
|
|
363
|
-
def st_mtime(self) -> float:
|
|
379
|
+
def st_mtime(self) -> float:
|
|
380
|
+
"""time of last modification"""
|
|
381
|
+
...
|
|
364
382
|
# platform dependent (time of most recent metadata change on Unix, or the time of creation on Windows)
|
|
365
383
|
if sys.version_info >= (3, 12) and sys.platform == "win32":
|
|
366
384
|
@property
|
|
@@ -370,15 +388,23 @@ class stat_result(structseq[float], tuple[int, int, int, int, int, int, int, flo
|
|
|
370
388
|
def st_ctime(self) -> float: ...
|
|
371
389
|
else:
|
|
372
390
|
@property
|
|
373
|
-
def st_ctime(self) -> float:
|
|
391
|
+
def st_ctime(self) -> float:
|
|
392
|
+
"""time of last change"""
|
|
393
|
+
...
|
|
374
394
|
|
|
375
395
|
@property
|
|
376
|
-
def st_atime_ns(self) -> int:
|
|
396
|
+
def st_atime_ns(self) -> int:
|
|
397
|
+
"""time of last access in nanoseconds"""
|
|
398
|
+
...
|
|
377
399
|
@property
|
|
378
|
-
def st_mtime_ns(self) -> int:
|
|
400
|
+
def st_mtime_ns(self) -> int:
|
|
401
|
+
"""time of last modification in nanoseconds"""
|
|
402
|
+
...
|
|
379
403
|
# platform dependent (time of most recent metadata change on Unix, or the time of creation on Windows) in nanoseconds
|
|
380
404
|
@property
|
|
381
|
-
def st_ctime_ns(self) -> int:
|
|
405
|
+
def st_ctime_ns(self) -> int:
|
|
406
|
+
"""time of last change in nanoseconds"""
|
|
407
|
+
...
|
|
382
408
|
if sys.platform == "win32":
|
|
383
409
|
@property
|
|
384
410
|
def st_file_attributes(self) -> int: ...
|
|
@@ -391,19 +417,29 @@ class stat_result(structseq[float], tuple[int, int, int, int, int, int, int, flo
|
|
|
391
417
|
def st_birthtime_ns(self) -> int: ... # time of file creation in nanoseconds
|
|
392
418
|
else:
|
|
393
419
|
@property
|
|
394
|
-
def st_blocks(self) -> int:
|
|
420
|
+
def st_blocks(self) -> int:
|
|
421
|
+
"""number of blocks allocated"""
|
|
422
|
+
...
|
|
395
423
|
@property
|
|
396
|
-
def st_blksize(self) -> int:
|
|
424
|
+
def st_blksize(self) -> int:
|
|
425
|
+
"""blocksize for filesystem I/O"""
|
|
426
|
+
...
|
|
397
427
|
@property
|
|
398
|
-
def st_rdev(self) -> int:
|
|
428
|
+
def st_rdev(self) -> int:
|
|
429
|
+
"""device type (if inode device)"""
|
|
430
|
+
...
|
|
399
431
|
if sys.platform != "linux":
|
|
400
432
|
# These properties are available on MacOS, but not Ubuntu.
|
|
401
433
|
# On other Unix systems (such as FreeBSD), the following attributes may be
|
|
402
434
|
# available (but may be only filled out if root tries to use them):
|
|
403
435
|
@property
|
|
404
|
-
def st_gen(self) -> int:
|
|
436
|
+
def st_gen(self) -> int:
|
|
437
|
+
"""generation number"""
|
|
438
|
+
...
|
|
405
439
|
@property
|
|
406
|
-
def st_birthtime(self) -> float:
|
|
440
|
+
def st_birthtime(self) -> float:
|
|
441
|
+
"""time of creation"""
|
|
442
|
+
...
|
|
407
443
|
if sys.platform == "darwin":
|
|
408
444
|
@property
|
|
409
445
|
def st_flags(self) -> int: ... # user defined flags for file
|
|
@@ -416,30 +452,95 @@ class PathLike(Protocol[AnyStr_co]):
|
|
|
416
452
|
def __fspath__(self) -> AnyStr_co: ...
|
|
417
453
|
|
|
418
454
|
@overload
|
|
419
|
-
def listdir(path: StrPath | None = None) -> list[str]:
|
|
455
|
+
def listdir(path: StrPath | None = None) -> list[str]:
|
|
456
|
+
r"""
|
|
457
|
+
Return a list containing the names of the files in the directory.
|
|
458
|
+
|
|
459
|
+
path can be specified as either str, bytes, or a path-like object. If path is bytes,
|
|
460
|
+
the filenames returned will also be bytes; in all other circumstances
|
|
461
|
+
the filenames returned will be str.
|
|
462
|
+
If path is None, uses the path='.'.
|
|
463
|
+
On some platforms, path may also be specified as an open file descriptor;\
|
|
464
|
+
the file descriptor must refer to a directory.
|
|
465
|
+
If this functionality is unavailable, using it raises NotImplementedError.
|
|
466
|
+
|
|
467
|
+
The list is in arbitrary order. It does not include the special
|
|
468
|
+
entries '.' and '..' even if they are present in the directory.
|
|
469
|
+
"""
|
|
470
|
+
...
|
|
420
471
|
@overload
|
|
421
|
-
def listdir(path: BytesPath) -> list[bytes]:
|
|
472
|
+
def listdir(path: BytesPath) -> list[bytes]:
|
|
473
|
+
r"""
|
|
474
|
+
Return a list containing the names of the files in the directory.
|
|
475
|
+
|
|
476
|
+
path can be specified as either str, bytes, or a path-like object. If path is bytes,
|
|
477
|
+
the filenames returned will also be bytes; in all other circumstances
|
|
478
|
+
the filenames returned will be str.
|
|
479
|
+
If path is None, uses the path='.'.
|
|
480
|
+
On some platforms, path may also be specified as an open file descriptor;\
|
|
481
|
+
the file descriptor must refer to a directory.
|
|
482
|
+
If this functionality is unavailable, using it raises NotImplementedError.
|
|
483
|
+
|
|
484
|
+
The list is in arbitrary order. It does not include the special
|
|
485
|
+
entries '.' and '..' even if they are present in the directory.
|
|
486
|
+
"""
|
|
487
|
+
...
|
|
422
488
|
@overload
|
|
423
|
-
def listdir(path: int) -> list[str]:
|
|
489
|
+
def listdir(path: int) -> list[str]:
|
|
490
|
+
r"""
|
|
491
|
+
Return a list containing the names of the files in the directory.
|
|
492
|
+
|
|
493
|
+
path can be specified as either str, bytes, or a path-like object. If path is bytes,
|
|
494
|
+
the filenames returned will also be bytes; in all other circumstances
|
|
495
|
+
the filenames returned will be str.
|
|
496
|
+
If path is None, uses the path='.'.
|
|
497
|
+
On some platforms, path may also be specified as an open file descriptor;\
|
|
498
|
+
the file descriptor must refer to a directory.
|
|
499
|
+
If this functionality is unavailable, using it raises NotImplementedError.
|
|
500
|
+
|
|
501
|
+
The list is in arbitrary order. It does not include the special
|
|
502
|
+
entries '.' and '..' even if they are present in the directory.
|
|
503
|
+
"""
|
|
504
|
+
...
|
|
424
505
|
@final
|
|
425
506
|
class DirEntry(Generic[AnyStr]):
|
|
426
507
|
# This is what the scandir iterator yields
|
|
427
508
|
# The constructor is hidden
|
|
428
509
|
|
|
429
510
|
@property
|
|
430
|
-
def name(self) -> AnyStr:
|
|
511
|
+
def name(self) -> AnyStr:
|
|
512
|
+
"""the entry's base filename, relative to scandir() "path" argument"""
|
|
513
|
+
...
|
|
431
514
|
@property
|
|
432
|
-
def path(self) -> AnyStr:
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
def
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
def
|
|
515
|
+
def path(self) -> AnyStr:
|
|
516
|
+
"""the entry's full path name; equivalent to os.path.join(scandir_path, entry.name)"""
|
|
517
|
+
...
|
|
518
|
+
def inode(self) -> int:
|
|
519
|
+
"""Return inode of the entry; cached per entry."""
|
|
520
|
+
...
|
|
521
|
+
def is_dir(self, *, follow_symlinks: bool = True) -> bool:
|
|
522
|
+
"""Return True if the entry is a directory; cached per entry."""
|
|
523
|
+
...
|
|
524
|
+
def is_file(self, *, follow_symlinks: bool = True) -> bool:
|
|
525
|
+
"""Return True if the entry is a file; cached per entry."""
|
|
526
|
+
...
|
|
527
|
+
def is_symlink(self) -> bool:
|
|
528
|
+
"""Return True if the entry is a symbolic link; cached per entry."""
|
|
529
|
+
...
|
|
530
|
+
def stat(self, *, follow_symlinks: bool = True) -> stat_result:
|
|
531
|
+
"""Return stat_result object for the entry; cached per entry."""
|
|
532
|
+
...
|
|
533
|
+
def __fspath__(self) -> AnyStr:
|
|
534
|
+
"""Returns the path for the entry."""
|
|
535
|
+
...
|
|
439
536
|
if sys.version_info >= (3, 9):
|
|
440
|
-
def __class_getitem__(cls, item: Any, /) -> GenericAlias:
|
|
537
|
+
def __class_getitem__(cls, item: Any, /) -> GenericAlias:
|
|
538
|
+
"""See PEP 585"""
|
|
539
|
+
...
|
|
441
540
|
if sys.version_info >= (3, 12):
|
|
442
|
-
def is_junction(self) -> bool:
|
|
541
|
+
def is_junction(self) -> bool:
|
|
542
|
+
"""Return True if the entry is a junction; cached per entry."""
|
|
543
|
+
...
|
|
443
544
|
|
|
444
545
|
@final
|
|
445
546
|
class statvfs_result(structseq[int], tuple[int, int, int, int, int, int, int, int, int, int, int]):
|
|
@@ -484,66 +585,198 @@ class statvfs_result(structseq[int], tuple[int, int, int, int, int, int, int, in
|
|
|
484
585
|
def fsencode(filename: StrOrBytesPath) -> bytes: ...
|
|
485
586
|
def fsdecode(filename: StrOrBytesPath) -> str: ...
|
|
486
587
|
@overload
|
|
487
|
-
def fspath(path: str) -> str:
|
|
588
|
+
def fspath(path: str) -> str:
|
|
589
|
+
"""
|
|
590
|
+
Return the file system path representation of the object.
|
|
591
|
+
|
|
592
|
+
If the object is str or bytes, then allow it to pass through as-is. If the
|
|
593
|
+
object defines __fspath__(), then return the result of that method. All other
|
|
594
|
+
types raise a TypeError.
|
|
595
|
+
"""
|
|
596
|
+
...
|
|
488
597
|
@overload
|
|
489
|
-
def fspath(path: bytes) -> bytes:
|
|
598
|
+
def fspath(path: bytes) -> bytes:
|
|
599
|
+
"""
|
|
600
|
+
Return the file system path representation of the object.
|
|
601
|
+
|
|
602
|
+
If the object is str or bytes, then allow it to pass through as-is. If the
|
|
603
|
+
object defines __fspath__(), then return the result of that method. All other
|
|
604
|
+
types raise a TypeError.
|
|
605
|
+
"""
|
|
606
|
+
...
|
|
490
607
|
@overload
|
|
491
|
-
def fspath(path: PathLike[AnyStr]) -> AnyStr:
|
|
608
|
+
def fspath(path: PathLike[AnyStr]) -> AnyStr:
|
|
609
|
+
"""
|
|
610
|
+
Return the file system path representation of the object.
|
|
611
|
+
|
|
612
|
+
If the object is str or bytes, then allow it to pass through as-is. If the
|
|
613
|
+
object defines __fspath__(), then return the result of that method. All other
|
|
614
|
+
types raise a TypeError.
|
|
615
|
+
"""
|
|
616
|
+
...
|
|
492
617
|
def get_exec_path(env: Mapping[str, str] | None = None) -> list[str]: ...
|
|
493
|
-
def getlogin() -> str:
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
def
|
|
497
|
-
|
|
618
|
+
def getlogin() -> str:
|
|
619
|
+
"""Return the actual login name."""
|
|
620
|
+
...
|
|
621
|
+
def getpid() -> int:
|
|
622
|
+
"""Return the current process id."""
|
|
623
|
+
...
|
|
624
|
+
def getppid() -> int:
|
|
625
|
+
"""
|
|
626
|
+
Return the parent's process id.
|
|
627
|
+
|
|
628
|
+
If the parent process has already exited, Windows machines will still
|
|
629
|
+
return its id; others systems will return the id of the 'init' process (1).
|
|
630
|
+
"""
|
|
631
|
+
...
|
|
632
|
+
def strerror(code: int, /) -> str:
|
|
633
|
+
"""Translate an error code to a message string."""
|
|
634
|
+
...
|
|
635
|
+
def umask(mask: int, /) -> int:
|
|
636
|
+
"""Set the current numeric umask and return the previous umask."""
|
|
637
|
+
...
|
|
498
638
|
@final
|
|
499
639
|
class uname_result(structseq[str], tuple[str, str, str, str, str]):
|
|
640
|
+
"""
|
|
641
|
+
uname_result: Result from os.uname().
|
|
642
|
+
|
|
643
|
+
This object may be accessed either as a tuple of
|
|
644
|
+
(sysname, nodename, release, version, machine),
|
|
645
|
+
or via the attributes sysname, nodename, release, version, and machine.
|
|
646
|
+
|
|
647
|
+
See os.uname for more information.
|
|
648
|
+
"""
|
|
500
649
|
if sys.version_info >= (3, 10):
|
|
501
650
|
__match_args__: Final = ("sysname", "nodename", "release", "version", "machine")
|
|
502
651
|
|
|
503
652
|
@property
|
|
504
|
-
def sysname(self) -> str:
|
|
653
|
+
def sysname(self) -> str:
|
|
654
|
+
"""operating system name"""
|
|
655
|
+
...
|
|
505
656
|
@property
|
|
506
|
-
def nodename(self) -> str:
|
|
657
|
+
def nodename(self) -> str:
|
|
658
|
+
"""name of machine on network (implementation-defined)"""
|
|
659
|
+
...
|
|
507
660
|
@property
|
|
508
|
-
def release(self) -> str:
|
|
661
|
+
def release(self) -> str:
|
|
662
|
+
"""operating system release"""
|
|
663
|
+
...
|
|
509
664
|
@property
|
|
510
|
-
def version(self) -> str:
|
|
665
|
+
def version(self) -> str:
|
|
666
|
+
"""operating system version"""
|
|
667
|
+
...
|
|
511
668
|
@property
|
|
512
|
-
def machine(self) -> str:
|
|
669
|
+
def machine(self) -> str:
|
|
670
|
+
"""hardware identifier"""
|
|
671
|
+
...
|
|
513
672
|
|
|
514
673
|
if sys.platform != "win32":
|
|
515
|
-
def ctermid() -> str:
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
def
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
def
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
def
|
|
525
|
-
|
|
674
|
+
def ctermid() -> str:
|
|
675
|
+
"""Return the name of the controlling terminal for this process."""
|
|
676
|
+
...
|
|
677
|
+
def getegid() -> int:
|
|
678
|
+
"""Return the current process's effective group id."""
|
|
679
|
+
...
|
|
680
|
+
def geteuid() -> int:
|
|
681
|
+
"""Return the current process's effective user id."""
|
|
682
|
+
...
|
|
683
|
+
def getgid() -> int:
|
|
684
|
+
"""Return the current process's group id."""
|
|
685
|
+
...
|
|
686
|
+
def getgrouplist(user: str, group: int, /) -> list[int]:
|
|
687
|
+
"""
|
|
688
|
+
getgrouplist(user, group) -> list of groups to which a user belongs
|
|
689
|
+
|
|
690
|
+
Returns a list of groups to which a user belongs.
|
|
691
|
+
|
|
692
|
+
user: username to lookup
|
|
693
|
+
group: base group id of the user
|
|
694
|
+
"""
|
|
695
|
+
...
|
|
696
|
+
def getgroups() -> list[int]:
|
|
697
|
+
"""Return list of supplemental group IDs for the process."""
|
|
698
|
+
...
|
|
699
|
+
def initgroups(username: str, gid: int, /) -> None:
|
|
700
|
+
"""
|
|
701
|
+
initgroups(username, gid) -> None
|
|
702
|
+
|
|
703
|
+
Call the system initgroups() to initialize the group access list with all of
|
|
704
|
+
the groups of which the specified username is a member, plus the specified
|
|
705
|
+
group id.
|
|
706
|
+
"""
|
|
707
|
+
...
|
|
708
|
+
def getpgid(pid: int) -> int:
|
|
709
|
+
"""Call the system call getpgid(), and return the result."""
|
|
710
|
+
...
|
|
711
|
+
def getpgrp() -> int:
|
|
712
|
+
"""Return the current process group id."""
|
|
713
|
+
...
|
|
714
|
+
def getpriority(which: int, who: int) -> int:
|
|
715
|
+
"""Return program scheduling priority."""
|
|
716
|
+
...
|
|
717
|
+
def setpriority(which: int, who: int, priority: int) -> None:
|
|
718
|
+
"""Set program scheduling priority."""
|
|
719
|
+
...
|
|
526
720
|
if sys.platform != "darwin":
|
|
527
|
-
def getresuid() -> tuple[int, int, int]:
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
def
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
def
|
|
721
|
+
def getresuid() -> tuple[int, int, int]:
|
|
722
|
+
"""Return a tuple of the current process's real, effective, and saved user ids."""
|
|
723
|
+
...
|
|
724
|
+
def getresgid() -> tuple[int, int, int]:
|
|
725
|
+
"""Return a tuple of the current process's real, effective, and saved group ids."""
|
|
726
|
+
...
|
|
727
|
+
|
|
728
|
+
def getuid() -> int:
|
|
729
|
+
"""Return the current process's user id."""
|
|
730
|
+
...
|
|
731
|
+
def setegid(egid: int, /) -> None:
|
|
732
|
+
"""Set the current process's effective group id."""
|
|
733
|
+
...
|
|
734
|
+
def seteuid(euid: int, /) -> None:
|
|
735
|
+
"""Set the current process's effective user id."""
|
|
736
|
+
...
|
|
737
|
+
def setgid(gid: int, /) -> None:
|
|
738
|
+
"""Set the current process's group id."""
|
|
739
|
+
...
|
|
740
|
+
def setgroups(groups: Sequence[int], /) -> None:
|
|
741
|
+
"""Set the groups of the current process to list."""
|
|
742
|
+
...
|
|
743
|
+
def setpgrp() -> None:
|
|
744
|
+
"""Make the current process the leader of its process group."""
|
|
745
|
+
...
|
|
746
|
+
def setpgid(pid: int, pgrp: int, /) -> None:
|
|
747
|
+
"""Call the system call setpgid(pid, pgrp)."""
|
|
748
|
+
...
|
|
749
|
+
def setregid(rgid: int, egid: int, /) -> None:
|
|
750
|
+
"""Set the current process's real and effective group ids."""
|
|
751
|
+
...
|
|
538
752
|
if sys.platform != "darwin":
|
|
539
|
-
def setresgid(rgid: int, egid: int, sgid: int, /) -> None:
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
def
|
|
753
|
+
def setresgid(rgid: int, egid: int, sgid: int, /) -> None:
|
|
754
|
+
"""Set the current process's real, effective, and saved group ids."""
|
|
755
|
+
...
|
|
756
|
+
def setresuid(ruid: int, euid: int, suid: int, /) -> None:
|
|
757
|
+
"""Set the current process's real, effective, and saved user ids."""
|
|
758
|
+
...
|
|
759
|
+
|
|
760
|
+
def setreuid(ruid: int, euid: int, /) -> None:
|
|
761
|
+
"""Set the current process's real and effective user ids."""
|
|
762
|
+
...
|
|
763
|
+
def getsid(pid: int, /) -> int:
|
|
764
|
+
"""Call the system call getsid(pid) and return the result."""
|
|
765
|
+
...
|
|
766
|
+
def setsid() -> None:
|
|
767
|
+
"""Call the system call setsid()."""
|
|
768
|
+
...
|
|
769
|
+
def setuid(uid: int, /) -> None:
|
|
770
|
+
"""Set the current process's user id."""
|
|
771
|
+
...
|
|
772
|
+
def uname() -> uname_result:
|
|
773
|
+
"""
|
|
774
|
+
Return an object identifying the current operating system.
|
|
775
|
+
|
|
776
|
+
The object behaves like a named tuple with the following fields:
|
|
777
|
+
(sysname, nodename, release, version, machine)
|
|
778
|
+
"""
|
|
779
|
+
...
|
|
547
780
|
|
|
548
781
|
@overload
|
|
549
782
|
def getenv(key: str) -> str | None: ...
|
|
@@ -555,8 +788,12 @@ if sys.platform != "win32":
|
|
|
555
788
|
def getenvb(key: bytes) -> bytes | None: ...
|
|
556
789
|
@overload
|
|
557
790
|
def getenvb(key: bytes, default: _T) -> bytes | _T: ...
|
|
558
|
-
def putenv(name: StrOrBytesPath, value: StrOrBytesPath, /) -> None:
|
|
559
|
-
|
|
791
|
+
def putenv(name: StrOrBytesPath, value: StrOrBytesPath, /) -> None:
|
|
792
|
+
"""Change or add an environment variable."""
|
|
793
|
+
...
|
|
794
|
+
def unsetenv(name: StrOrBytesPath, /) -> None:
|
|
795
|
+
"""Delete an environment variable."""
|
|
796
|
+
...
|
|
560
797
|
|
|
561
798
|
else:
|
|
562
799
|
def putenv(name: str, value: str, /) -> None: ...
|
|
@@ -643,51 +880,270 @@ def fdopen(
|
|
|
643
880
|
closefd: bool = ...,
|
|
644
881
|
opener: _Opener | None = ...,
|
|
645
882
|
) -> IO[Any]: ...
|
|
646
|
-
def close(fd: int) -> None:
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
def
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
def
|
|
653
|
-
|
|
654
|
-
|
|
883
|
+
def close(fd: int) -> None:
|
|
884
|
+
"""Close a file descriptor."""
|
|
885
|
+
...
|
|
886
|
+
def closerange(fd_low: int, fd_high: int, /) -> None:
|
|
887
|
+
"""Closes all file descriptors in [fd_low, fd_high), ignoring errors."""
|
|
888
|
+
...
|
|
889
|
+
def device_encoding(fd: int) -> str | None:
|
|
890
|
+
"""
|
|
891
|
+
Return a string describing the encoding of a terminal's file descriptor.
|
|
892
|
+
|
|
893
|
+
The file descriptor must be attached to a terminal.
|
|
894
|
+
If the device is not a terminal, return None.
|
|
895
|
+
"""
|
|
896
|
+
...
|
|
897
|
+
def dup(fd: int, /) -> int:
|
|
898
|
+
"""Return a duplicate of a file descriptor."""
|
|
899
|
+
...
|
|
900
|
+
def dup2(fd: int, fd2: int, inheritable: bool = True) -> int:
|
|
901
|
+
"""Duplicate file descriptor."""
|
|
902
|
+
...
|
|
903
|
+
def fstat(fd: int) -> stat_result:
|
|
904
|
+
"""
|
|
905
|
+
Perform a stat system call on the given file descriptor.
|
|
906
|
+
|
|
907
|
+
Like stat(), but for an open file descriptor.
|
|
908
|
+
Equivalent to os.stat(fd).
|
|
909
|
+
"""
|
|
910
|
+
...
|
|
911
|
+
def ftruncate(fd: int, length: int, /) -> None:
|
|
912
|
+
"""Truncate a file, specified by file descriptor, to a specific length."""
|
|
913
|
+
...
|
|
914
|
+
def fsync(fd: FileDescriptorLike) -> None:
|
|
915
|
+
"""Force write of fd to disk."""
|
|
916
|
+
...
|
|
917
|
+
def isatty(fd: int, /) -> bool:
|
|
918
|
+
"""
|
|
919
|
+
Return True if the fd is connected to a terminal.
|
|
920
|
+
|
|
921
|
+
Return True if the file descriptor is an open file descriptor
|
|
922
|
+
connected to the slave end of a terminal.
|
|
923
|
+
"""
|
|
924
|
+
...
|
|
655
925
|
|
|
656
926
|
if sys.platform != "win32" and sys.version_info >= (3, 11):
|
|
657
|
-
def login_tty(fd: int, /) -> None:
|
|
927
|
+
def login_tty(fd: int, /) -> None:
|
|
928
|
+
"""
|
|
929
|
+
Prepare the tty of which fd is a file descriptor for a new login session.
|
|
930
|
+
|
|
931
|
+
Make the calling process a session leader; make the tty the
|
|
932
|
+
controlling tty, the stdin, the stdout, and the stderr of the
|
|
933
|
+
calling process; close fd.
|
|
934
|
+
"""
|
|
935
|
+
...
|
|
658
936
|
|
|
659
937
|
if sys.version_info >= (3, 11):
|
|
660
|
-
def lseek(fd: int, position: int, whence: int, /) -> int:
|
|
938
|
+
def lseek(fd: int, position: int, whence: int, /) -> int:
|
|
939
|
+
"""
|
|
940
|
+
Set the position of a file descriptor. Return the new position.
|
|
941
|
+
|
|
942
|
+
fd
|
|
943
|
+
An open file descriptor, as returned by os.open().
|
|
944
|
+
position
|
|
945
|
+
Position, interpreted relative to 'whence'.
|
|
946
|
+
whence
|
|
947
|
+
The relative position to seek from. Valid values are:
|
|
948
|
+
- SEEK_SET: seek from the start of the file.
|
|
949
|
+
- SEEK_CUR: seek from the current file position.
|
|
950
|
+
- SEEK_END: seek from the end of the file.
|
|
951
|
+
|
|
952
|
+
The return value is the number of bytes relative to the beginning of the file.
|
|
953
|
+
"""
|
|
954
|
+
...
|
|
661
955
|
|
|
662
956
|
else:
|
|
663
|
-
def lseek(fd: int, position: int, how: int, /) -> int:
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
957
|
+
def lseek(fd: int, position: int, how: int, /) -> int:
|
|
958
|
+
"""
|
|
959
|
+
Set the position of a file descriptor. Return the new position.
|
|
960
|
+
|
|
961
|
+
Return the new cursor position in number of bytes
|
|
962
|
+
relative to the beginning of the file.
|
|
963
|
+
"""
|
|
964
|
+
...
|
|
965
|
+
|
|
966
|
+
def open(path: StrOrBytesPath, flags: int, mode: int = 0o777, *, dir_fd: int | None = None) -> int:
|
|
967
|
+
"""
|
|
968
|
+
Open a file for low level IO. Returns a file descriptor (integer).
|
|
969
|
+
|
|
970
|
+
If dir_fd is not None, it should be a file descriptor open to a directory,
|
|
971
|
+
and path should be relative; path will then be relative to that directory.
|
|
972
|
+
dir_fd may not be implemented on your platform.
|
|
973
|
+
If it is unavailable, using it will raise a NotImplementedError.
|
|
974
|
+
"""
|
|
975
|
+
...
|
|
976
|
+
def pipe() -> tuple[int, int]:
|
|
977
|
+
"""
|
|
978
|
+
Create a pipe.
|
|
979
|
+
|
|
980
|
+
Returns a tuple of two file descriptors:
|
|
981
|
+
(read_fd, write_fd)
|
|
982
|
+
"""
|
|
983
|
+
...
|
|
984
|
+
def read(fd: int, length: int, /) -> bytes:
|
|
985
|
+
"""Read from a file descriptor. Returns a bytes object."""
|
|
986
|
+
...
|
|
668
987
|
|
|
669
988
|
if sys.version_info >= (3, 12) or sys.platform != "win32":
|
|
670
|
-
def get_blocking(fd: int, /) -> bool:
|
|
671
|
-
|
|
989
|
+
def get_blocking(fd: int, /) -> bool:
|
|
990
|
+
"""
|
|
991
|
+
Get the blocking mode of the file descriptor.
|
|
992
|
+
|
|
993
|
+
Return False if the O_NONBLOCK flag is set, True if the flag is cleared.
|
|
994
|
+
"""
|
|
995
|
+
...
|
|
996
|
+
def set_blocking(fd: int, blocking: bool, /) -> None:
|
|
997
|
+
"""
|
|
998
|
+
Set the blocking mode of the specified file descriptor.
|
|
999
|
+
|
|
1000
|
+
Set the O_NONBLOCK flag if blocking is False,
|
|
1001
|
+
clear the O_NONBLOCK flag otherwise.
|
|
1002
|
+
"""
|
|
1003
|
+
...
|
|
672
1004
|
|
|
673
1005
|
if sys.platform != "win32":
|
|
674
|
-
def fchmod(fd: int, mode: int) -> None:
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
1006
|
+
def fchmod(fd: int, mode: int) -> None:
|
|
1007
|
+
"""
|
|
1008
|
+
Change the access permissions of the file given by file descriptor fd.
|
|
1009
|
+
|
|
1010
|
+
Equivalent to os.chmod(fd, mode).
|
|
1011
|
+
"""
|
|
1012
|
+
...
|
|
1013
|
+
def fchown(fd: int, uid: int, gid: int) -> None:
|
|
1014
|
+
"""
|
|
1015
|
+
Change the owner and group id of the file specified by file descriptor.
|
|
1016
|
+
|
|
1017
|
+
Equivalent to os.chown(fd, uid, gid).
|
|
1018
|
+
"""
|
|
1019
|
+
...
|
|
1020
|
+
def fpathconf(fd: int, name: str | int, /) -> int:
|
|
1021
|
+
"""
|
|
1022
|
+
Return the configuration limit name for the file descriptor fd.
|
|
1023
|
+
|
|
1024
|
+
If there is no limit, return -1.
|
|
1025
|
+
"""
|
|
1026
|
+
...
|
|
1027
|
+
def fstatvfs(fd: int, /) -> statvfs_result:
|
|
1028
|
+
"""
|
|
1029
|
+
Perform an fstatvfs system call on the given fd.
|
|
1030
|
+
|
|
1031
|
+
Equivalent to statvfs(fd).
|
|
1032
|
+
"""
|
|
1033
|
+
...
|
|
1034
|
+
def lockf(fd: int, command: int, length: int, /) -> None:
|
|
1035
|
+
"""
|
|
1036
|
+
Apply, test or remove a POSIX lock on an open file descriptor.
|
|
1037
|
+
|
|
1038
|
+
fd
|
|
1039
|
+
An open file descriptor.
|
|
1040
|
+
command
|
|
1041
|
+
One of F_LOCK, F_TLOCK, F_ULOCK or F_TEST.
|
|
1042
|
+
length
|
|
1043
|
+
The number of bytes to lock, starting at the current position.
|
|
1044
|
+
"""
|
|
1045
|
+
...
|
|
1046
|
+
def openpty() -> tuple[int, int]:
|
|
1047
|
+
"""
|
|
1048
|
+
Open a pseudo-terminal.
|
|
1049
|
+
|
|
1050
|
+
Return a tuple of (master_fd, slave_fd) containing open file descriptors
|
|
1051
|
+
for both the master and slave ends.
|
|
1052
|
+
"""
|
|
1053
|
+
...
|
|
680
1054
|
if sys.platform != "darwin":
|
|
681
|
-
def fdatasync(fd: FileDescriptorLike) -> None:
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
def
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
1055
|
+
def fdatasync(fd: FileDescriptorLike) -> None:
|
|
1056
|
+
"""Force write of fd to disk without forcing update of metadata."""
|
|
1057
|
+
...
|
|
1058
|
+
def pipe2(flags: int, /) -> tuple[int, int]:
|
|
1059
|
+
"""
|
|
1060
|
+
Create a pipe with flags set atomically.
|
|
1061
|
+
|
|
1062
|
+
Returns a tuple of two file descriptors:
|
|
1063
|
+
(read_fd, write_fd)
|
|
1064
|
+
|
|
1065
|
+
flags can be constructed by ORing together one or more of these values:
|
|
1066
|
+
O_NONBLOCK, O_CLOEXEC.
|
|
1067
|
+
"""
|
|
1068
|
+
...
|
|
1069
|
+
def posix_fallocate(fd: int, offset: int, length: int, /) -> None:
|
|
1070
|
+
"""
|
|
1071
|
+
Ensure a file has allocated at least a particular number of bytes on disk.
|
|
1072
|
+
|
|
1073
|
+
Ensure that the file specified by fd encompasses a range of bytes
|
|
1074
|
+
starting at offset bytes from the beginning and continuing for length bytes.
|
|
1075
|
+
"""
|
|
1076
|
+
...
|
|
1077
|
+
def posix_fadvise(fd: int, offset: int, length: int, advice: int, /) -> None:
|
|
1078
|
+
"""
|
|
1079
|
+
Announce an intention to access data in a specific pattern.
|
|
1080
|
+
|
|
1081
|
+
Announce an intention to access data in a specific pattern, thus allowing
|
|
1082
|
+
the kernel to make optimizations.
|
|
1083
|
+
The advice applies to the region of the file specified by fd starting at
|
|
1084
|
+
offset and continuing for length bytes.
|
|
1085
|
+
advice is one of POSIX_FADV_NORMAL, POSIX_FADV_SEQUENTIAL,
|
|
1086
|
+
POSIX_FADV_RANDOM, POSIX_FADV_NOREUSE, POSIX_FADV_WILLNEED, or
|
|
1087
|
+
POSIX_FADV_DONTNEED.
|
|
1088
|
+
"""
|
|
1089
|
+
...
|
|
1090
|
+
|
|
1091
|
+
def pread(fd: int, length: int, offset: int, /) -> bytes:
|
|
1092
|
+
"""
|
|
1093
|
+
Read a number of bytes from a file descriptor starting at a particular offset.
|
|
1094
|
+
|
|
1095
|
+
Read length bytes from file descriptor fd, starting at offset bytes from
|
|
1096
|
+
the beginning of the file. The file offset remains unchanged.
|
|
1097
|
+
"""
|
|
1098
|
+
...
|
|
1099
|
+
def pwrite(fd: int, buffer: ReadableBuffer, offset: int, /) -> int:
|
|
1100
|
+
"""
|
|
1101
|
+
Write bytes to a file descriptor starting at a particular offset.
|
|
1102
|
+
|
|
1103
|
+
Write buffer to fd, starting at offset bytes from the beginning of
|
|
1104
|
+
the file. Returns the number of bytes writte. Does not change the
|
|
1105
|
+
current file offset.
|
|
1106
|
+
"""
|
|
1107
|
+
...
|
|
688
1108
|
# In CI, stubtest sometimes reports that these are available on MacOS, sometimes not
|
|
689
|
-
def preadv(fd: int, buffers: SupportsLenAndGetItem[WriteableBuffer], offset: int, flags: int = 0, /) -> int:
|
|
690
|
-
|
|
1109
|
+
def preadv(fd: int, buffers: SupportsLenAndGetItem[WriteableBuffer], offset: int, flags: int = 0, /) -> int:
|
|
1110
|
+
"""
|
|
1111
|
+
Reads from a file descriptor into a number of mutable bytes-like objects.
|
|
1112
|
+
|
|
1113
|
+
Combines the functionality of readv() and pread(). As readv(), it will
|
|
1114
|
+
transfer data into each buffer until it is full and then move on to the next
|
|
1115
|
+
buffer in the sequence to hold the rest of the data. Its fourth argument,
|
|
1116
|
+
specifies the file offset at which the input operation is to be performed. It
|
|
1117
|
+
will return the total number of bytes read (which can be less than the total
|
|
1118
|
+
capacity of all the objects).
|
|
1119
|
+
|
|
1120
|
+
The flags argument contains a bitwise OR of zero or more of the following flags:
|
|
1121
|
+
|
|
1122
|
+
- RWF_HIPRI
|
|
1123
|
+
- RWF_NOWAIT
|
|
1124
|
+
|
|
1125
|
+
Using non-zero flags requires Linux 4.6 or newer.
|
|
1126
|
+
"""
|
|
1127
|
+
...
|
|
1128
|
+
def pwritev(fd: int, buffers: SupportsLenAndGetItem[ReadableBuffer], offset: int, flags: int = 0, /) -> int:
|
|
1129
|
+
"""
|
|
1130
|
+
Writes the contents of bytes-like objects to a file descriptor at a given offset.
|
|
1131
|
+
|
|
1132
|
+
Combines the functionality of writev() and pwrite(). All buffers must be a sequence
|
|
1133
|
+
of bytes-like objects. Buffers are processed in array order. Entire contents of first
|
|
1134
|
+
buffer is written before proceeding to second, and so on. The operating system may
|
|
1135
|
+
set a limit (sysconf() value SC_IOV_MAX) on the number of buffers that can be used.
|
|
1136
|
+
This function writes the contents of each object to the file descriptor and returns
|
|
1137
|
+
the total number of bytes written.
|
|
1138
|
+
|
|
1139
|
+
The flags argument contains a bitwise OR of zero or more of the following flags:
|
|
1140
|
+
|
|
1141
|
+
- RWF_DSYNC
|
|
1142
|
+
- RWF_SYNC
|
|
1143
|
+
|
|
1144
|
+
Using non-zero flags requires Linux 4.7 or newer.
|
|
1145
|
+
"""
|
|
1146
|
+
...
|
|
691
1147
|
if sys.platform != "darwin":
|
|
692
1148
|
if sys.version_info >= (3, 10):
|
|
693
1149
|
RWF_APPEND: int # docs say available on 3.7+, stubtest says otherwise
|
|
@@ -707,10 +1163,36 @@ if sys.platform != "win32":
|
|
|
707
1163
|
headers: Sequence[ReadableBuffer] = ...,
|
|
708
1164
|
trailers: Sequence[ReadableBuffer] = ...,
|
|
709
1165
|
flags: int = 0,
|
|
710
|
-
) -> int:
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
1166
|
+
) -> int:
|
|
1167
|
+
"""
|
|
1168
|
+
sendfile(out, in, offset, count) -> byteswritten
|
|
1169
|
+
sendfile(out, in, offset, count[, headers][, trailers], flags=0)
|
|
1170
|
+
-> byteswritten
|
|
1171
|
+
Copy count bytes from file descriptor in to file descriptor out.
|
|
1172
|
+
"""
|
|
1173
|
+
...
|
|
1174
|
+
|
|
1175
|
+
def readv(fd: int, buffers: SupportsLenAndGetItem[WriteableBuffer], /) -> int:
|
|
1176
|
+
"""
|
|
1177
|
+
Read from a file descriptor fd into an iterable of buffers.
|
|
1178
|
+
|
|
1179
|
+
The buffers should be mutable buffers accepting bytes.
|
|
1180
|
+
readv will transfer data into each buffer until it is full
|
|
1181
|
+
and then move on to the next buffer in the sequence to hold
|
|
1182
|
+
the rest of the data.
|
|
1183
|
+
|
|
1184
|
+
readv returns the total number of bytes read,
|
|
1185
|
+
which may be less than the total capacity of all the buffers.
|
|
1186
|
+
"""
|
|
1187
|
+
...
|
|
1188
|
+
def writev(fd: int, buffers: SupportsLenAndGetItem[ReadableBuffer], /) -> int:
|
|
1189
|
+
"""
|
|
1190
|
+
Iterate over buffers, and write the contents of each to a file descriptor.
|
|
1191
|
+
|
|
1192
|
+
Returns the total number of bytes written.
|
|
1193
|
+
buffers must be a sequence of bytes-like objects.
|
|
1194
|
+
"""
|
|
1195
|
+
...
|
|
714
1196
|
|
|
715
1197
|
@final
|
|
716
1198
|
class terminal_size(structseq[int], tuple[int, int]):
|
|
@@ -718,13 +1200,37 @@ class terminal_size(structseq[int], tuple[int, int]):
|
|
|
718
1200
|
__match_args__: Final = ("columns", "lines")
|
|
719
1201
|
|
|
720
1202
|
@property
|
|
721
|
-
def columns(self) -> int:
|
|
1203
|
+
def columns(self) -> int:
|
|
1204
|
+
"""width of the terminal window in characters"""
|
|
1205
|
+
...
|
|
722
1206
|
@property
|
|
723
|
-
def lines(self) -> int:
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
def
|
|
1207
|
+
def lines(self) -> int:
|
|
1208
|
+
"""height of the terminal window in characters"""
|
|
1209
|
+
...
|
|
1210
|
+
|
|
1211
|
+
def get_terminal_size(fd: int = ..., /) -> terminal_size:
|
|
1212
|
+
"""
|
|
1213
|
+
Return the size of the terminal window as (columns, lines).
|
|
1214
|
+
|
|
1215
|
+
The optional argument fd (default standard output) specifies
|
|
1216
|
+
which file descriptor should be queried.
|
|
1217
|
+
|
|
1218
|
+
If the file descriptor is not connected to a terminal, an OSError
|
|
1219
|
+
is thrown.
|
|
1220
|
+
|
|
1221
|
+
This function will only be defined if an implementation is
|
|
1222
|
+
available for this system.
|
|
1223
|
+
|
|
1224
|
+
shutil.get_terminal_size is the high-level function which should
|
|
1225
|
+
normally be used, os.get_terminal_size is the low-level implementation.
|
|
1226
|
+
"""
|
|
1227
|
+
...
|
|
1228
|
+
def get_inheritable(fd: int, /) -> bool:
|
|
1229
|
+
"""Get the close-on-exe flag of the specified file descriptor."""
|
|
1230
|
+
...
|
|
1231
|
+
def set_inheritable(fd: int, inheritable: bool, /) -> None:
|
|
1232
|
+
"""Set the inheritable flag of the specified file descriptor."""
|
|
1233
|
+
...
|
|
728
1234
|
|
|
729
1235
|
if sys.platform == "win32":
|
|
730
1236
|
def get_handle_inheritable(handle: int, /) -> bool: ...
|
|
@@ -732,34 +1238,180 @@ if sys.platform == "win32":
|
|
|
732
1238
|
|
|
733
1239
|
if sys.platform != "win32":
|
|
734
1240
|
# Unix only
|
|
735
|
-
def tcgetpgrp(fd: int, /) -> int:
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
1241
|
+
def tcgetpgrp(fd: int, /) -> int:
|
|
1242
|
+
"""Return the process group associated with the terminal specified by fd."""
|
|
1243
|
+
...
|
|
1244
|
+
def tcsetpgrp(fd: int, pgid: int, /) -> None:
|
|
1245
|
+
"""Set the process group associated with the terminal specified by fd."""
|
|
1246
|
+
...
|
|
1247
|
+
def ttyname(fd: int, /) -> str:
|
|
1248
|
+
"""
|
|
1249
|
+
Return the name of the terminal device connected to 'fd'.
|
|
1250
|
+
|
|
1251
|
+
fd
|
|
1252
|
+
Integer file descriptor handle.
|
|
1253
|
+
"""
|
|
1254
|
+
...
|
|
1255
|
+
|
|
1256
|
+
def write(fd: int, data: ReadableBuffer, /) -> int:
|
|
1257
|
+
"""Write a bytes object to a file descriptor."""
|
|
1258
|
+
...
|
|
740
1259
|
def access(
|
|
741
1260
|
path: FileDescriptorOrPath, mode: int, *, dir_fd: int | None = None, effective_ids: bool = False, follow_symlinks: bool = True
|
|
742
|
-
) -> bool:
|
|
743
|
-
|
|
1261
|
+
) -> bool:
|
|
1262
|
+
"""
|
|
1263
|
+
Use the real uid/gid to test for access to a path.
|
|
1264
|
+
|
|
1265
|
+
path
|
|
1266
|
+
Path to be tested; can be string, bytes, or a path-like object.
|
|
1267
|
+
mode
|
|
1268
|
+
Operating-system mode bitfield. Can be F_OK to test existence,
|
|
1269
|
+
or the inclusive-OR of R_OK, W_OK, and X_OK.
|
|
1270
|
+
dir_fd
|
|
1271
|
+
If not None, it should be a file descriptor open to a directory,
|
|
1272
|
+
and path should be relative; path will then be relative to that
|
|
1273
|
+
directory.
|
|
1274
|
+
effective_ids
|
|
1275
|
+
If True, access will use the effective uid/gid instead of
|
|
1276
|
+
the real uid/gid.
|
|
1277
|
+
follow_symlinks
|
|
1278
|
+
If False, and the last element of the path is a symbolic link,
|
|
1279
|
+
access will examine the symbolic link itself instead of the file
|
|
1280
|
+
the link points to.
|
|
1281
|
+
|
|
1282
|
+
dir_fd, effective_ids, and follow_symlinks may not be implemented
|
|
1283
|
+
on your platform. If they are unavailable, using them will raise a
|
|
1284
|
+
NotImplementedError.
|
|
1285
|
+
|
|
1286
|
+
Note that most operations will use the effective uid/gid, therefore this
|
|
1287
|
+
routine can be used in a suid/sgid environment to test if the invoking user
|
|
1288
|
+
has the specified access to the path.
|
|
1289
|
+
"""
|
|
1290
|
+
...
|
|
1291
|
+
def chdir(path: FileDescriptorOrPath) -> None:
|
|
1292
|
+
"""
|
|
1293
|
+
Change the current working directory to the specified path.
|
|
1294
|
+
|
|
1295
|
+
path may always be specified as a string.
|
|
1296
|
+
On some platforms, path may also be specified as an open file descriptor.
|
|
1297
|
+
If this functionality is unavailable, using it raises an exception.
|
|
1298
|
+
"""
|
|
1299
|
+
...
|
|
744
1300
|
|
|
745
1301
|
if sys.platform != "win32":
|
|
746
|
-
def fchdir(fd: FileDescriptorLike) -> None:
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
1302
|
+
def fchdir(fd: FileDescriptorLike) -> None:
|
|
1303
|
+
"""
|
|
1304
|
+
Change to the directory of the given file descriptor.
|
|
1305
|
+
|
|
1306
|
+
fd must be opened on a directory, not a file.
|
|
1307
|
+
Equivalent to os.chdir(fd).
|
|
1308
|
+
"""
|
|
1309
|
+
...
|
|
1310
|
+
|
|
1311
|
+
def getcwd() -> str:
|
|
1312
|
+
"""Return a unicode string representing the current working directory."""
|
|
1313
|
+
...
|
|
1314
|
+
def getcwdb() -> bytes:
|
|
1315
|
+
"""Return a bytes string representing the current working directory."""
|
|
1316
|
+
...
|
|
1317
|
+
def chmod(path: FileDescriptorOrPath, mode: int, *, dir_fd: int | None = None, follow_symlinks: bool = ...) -> None:
|
|
1318
|
+
"""
|
|
1319
|
+
Change the access permissions of a file.
|
|
1320
|
+
|
|
1321
|
+
path
|
|
1322
|
+
Path to be modified. May always be specified as a str, bytes, or a path-like object.
|
|
1323
|
+
On some platforms, path may also be specified as an open file descriptor.
|
|
1324
|
+
If this functionality is unavailable, using it raises an exception.
|
|
1325
|
+
mode
|
|
1326
|
+
Operating-system mode bitfield.
|
|
1327
|
+
dir_fd
|
|
1328
|
+
If not None, it should be a file descriptor open to a directory,
|
|
1329
|
+
and path should be relative; path will then be relative to that
|
|
1330
|
+
directory.
|
|
1331
|
+
follow_symlinks
|
|
1332
|
+
If False, and the last element of the path is a symbolic link,
|
|
1333
|
+
chmod will modify the symbolic link itself instead of the file
|
|
1334
|
+
the link points to.
|
|
1335
|
+
|
|
1336
|
+
It is an error to use dir_fd or follow_symlinks when specifying path as
|
|
1337
|
+
an open file descriptor.
|
|
1338
|
+
dir_fd and follow_symlinks may not be implemented on your platform.
|
|
1339
|
+
If they are unavailable, using them will raise a NotImplementedError.
|
|
1340
|
+
"""
|
|
1341
|
+
...
|
|
751
1342
|
|
|
752
1343
|
if sys.platform != "win32" and sys.platform != "linux":
|
|
753
|
-
def chflags(path: StrOrBytesPath, flags: int, follow_symlinks: bool = True) -> None:
|
|
754
|
-
|
|
755
|
-
|
|
1344
|
+
def chflags(path: StrOrBytesPath, flags: int, follow_symlinks: bool = True) -> None:
|
|
1345
|
+
"""
|
|
1346
|
+
Set file flags.
|
|
1347
|
+
|
|
1348
|
+
If follow_symlinks is False, and the last element of the path is a symbolic
|
|
1349
|
+
link, chflags will change flags on the symbolic link itself instead of the
|
|
1350
|
+
file the link points to.
|
|
1351
|
+
follow_symlinks may not be implemented on your platform. If it is
|
|
1352
|
+
unavailable, using it will raise a NotImplementedError.
|
|
1353
|
+
"""
|
|
1354
|
+
...
|
|
1355
|
+
def lchflags(path: StrOrBytesPath, flags: int) -> None:
|
|
1356
|
+
"""
|
|
1357
|
+
Set file flags.
|
|
1358
|
+
|
|
1359
|
+
This function will not follow symbolic links.
|
|
1360
|
+
Equivalent to chflags(path, flags, follow_symlinks=False).
|
|
1361
|
+
"""
|
|
1362
|
+
...
|
|
1363
|
+
def lchmod(path: StrOrBytesPath, mode: int) -> None:
|
|
1364
|
+
"""
|
|
1365
|
+
Change the access permissions of a file, without following symbolic links.
|
|
1366
|
+
|
|
1367
|
+
If path is a symlink, this affects the link itself rather than the target.
|
|
1368
|
+
Equivalent to chmod(path, mode, follow_symlinks=False)."
|
|
1369
|
+
"""
|
|
1370
|
+
...
|
|
756
1371
|
|
|
757
1372
|
if sys.platform != "win32":
|
|
758
|
-
def chroot(path: StrOrBytesPath) -> None:
|
|
1373
|
+
def chroot(path: StrOrBytesPath) -> None:
|
|
1374
|
+
"""Change root directory to path."""
|
|
1375
|
+
...
|
|
759
1376
|
def chown(
|
|
760
1377
|
path: FileDescriptorOrPath, uid: int, gid: int, *, dir_fd: int | None = None, follow_symlinks: bool = True
|
|
761
|
-
) -> None:
|
|
762
|
-
|
|
1378
|
+
) -> None:
|
|
1379
|
+
r"""
|
|
1380
|
+
Change the owner and group id of path to the numeric uid and gid.\
|
|
1381
|
+
|
|
1382
|
+
path
|
|
1383
|
+
Path to be examined; can be string, bytes, a path-like object, or open-file-descriptor int.
|
|
1384
|
+
dir_fd
|
|
1385
|
+
If not None, it should be a file descriptor open to a directory,
|
|
1386
|
+
and path should be relative; path will then be relative to that
|
|
1387
|
+
directory.
|
|
1388
|
+
follow_symlinks
|
|
1389
|
+
If False, and the last element of the path is a symbolic link,
|
|
1390
|
+
stat will examine the symbolic link itself instead of the file
|
|
1391
|
+
the link points to.
|
|
1392
|
+
|
|
1393
|
+
path may always be specified as a string.
|
|
1394
|
+
On some platforms, path may also be specified as an open file descriptor.
|
|
1395
|
+
If this functionality is unavailable, using it raises an exception.
|
|
1396
|
+
If dir_fd is not None, it should be a file descriptor open to a directory,
|
|
1397
|
+
and path should be relative; path will then be relative to that directory.
|
|
1398
|
+
If follow_symlinks is False, and the last element of the path is a symbolic
|
|
1399
|
+
link, chown will modify the symbolic link itself instead of the file the
|
|
1400
|
+
link points to.
|
|
1401
|
+
It is an error to use dir_fd or follow_symlinks when specifying path as
|
|
1402
|
+
an open file descriptor.
|
|
1403
|
+
dir_fd and follow_symlinks may not be implemented on your platform.
|
|
1404
|
+
If they are unavailable, using them will raise a NotImplementedError.
|
|
1405
|
+
"""
|
|
1406
|
+
...
|
|
1407
|
+
def lchown(path: StrOrBytesPath, uid: int, gid: int) -> None:
|
|
1408
|
+
"""
|
|
1409
|
+
Change the owner and group id of path to the numeric uid and gid.
|
|
1410
|
+
|
|
1411
|
+
This function will not follow symbolic links.
|
|
1412
|
+
Equivalent to os.chown(path, uid, gid, follow_symlinks=False).
|
|
1413
|
+
"""
|
|
1414
|
+
...
|
|
763
1415
|
|
|
764
1416
|
def link(
|
|
765
1417
|
src: StrOrBytesPath,
|
|
@@ -768,31 +1420,150 @@ def link(
|
|
|
768
1420
|
src_dir_fd: int | None = None,
|
|
769
1421
|
dst_dir_fd: int | None = None,
|
|
770
1422
|
follow_symlinks: bool = True,
|
|
771
|
-
) -> None:
|
|
772
|
-
|
|
773
|
-
|
|
1423
|
+
) -> None:
|
|
1424
|
+
"""
|
|
1425
|
+
Create a hard link to a file.
|
|
1426
|
+
|
|
1427
|
+
If either src_dir_fd or dst_dir_fd is not None, it should be a file
|
|
1428
|
+
descriptor open to a directory, and the respective path string (src or dst)
|
|
1429
|
+
should be relative; the path will then be relative to that directory.
|
|
1430
|
+
If follow_symlinks is False, and the last element of src is a symbolic
|
|
1431
|
+
link, link will create a link to the symbolic link itself instead of the
|
|
1432
|
+
file the link points to.
|
|
1433
|
+
src_dir_fd, dst_dir_fd, and follow_symlinks may not be implemented on your
|
|
1434
|
+
platform. If they are unavailable, using them will raise a
|
|
1435
|
+
NotImplementedError.
|
|
1436
|
+
"""
|
|
1437
|
+
...
|
|
1438
|
+
def lstat(path: StrOrBytesPath, *, dir_fd: int | None = None) -> stat_result:
|
|
1439
|
+
"""
|
|
1440
|
+
Perform a stat system call on the given path, without following symbolic links.
|
|
1441
|
+
|
|
1442
|
+
Like stat(), but do not follow symbolic links.
|
|
1443
|
+
Equivalent to stat(path, follow_symlinks=False).
|
|
1444
|
+
"""
|
|
1445
|
+
...
|
|
1446
|
+
def mkdir(path: StrOrBytesPath, mode: int = 0o777, *, dir_fd: int | None = None) -> None:
|
|
1447
|
+
"""
|
|
1448
|
+
Create a directory.
|
|
1449
|
+
|
|
1450
|
+
If dir_fd is not None, it should be a file descriptor open to a directory,
|
|
1451
|
+
and path should be relative; path will then be relative to that directory.
|
|
1452
|
+
dir_fd may not be implemented on your platform.
|
|
1453
|
+
If it is unavailable, using it will raise a NotImplementedError.
|
|
1454
|
+
|
|
1455
|
+
The mode argument is ignored on Windows.
|
|
1456
|
+
"""
|
|
1457
|
+
...
|
|
774
1458
|
|
|
775
1459
|
if sys.platform != "win32":
|
|
776
|
-
def mkfifo(path: StrOrBytesPath, mode: int = 0o666, *, dir_fd: int | None = None) -> None:
|
|
1460
|
+
def mkfifo(path: StrOrBytesPath, mode: int = 0o666, *, dir_fd: int | None = None) -> None:
|
|
1461
|
+
"""
|
|
1462
|
+
Create a "fifo" (a POSIX named pipe).
|
|
1463
|
+
|
|
1464
|
+
If dir_fd is not None, it should be a file descriptor open to a directory,
|
|
1465
|
+
and path should be relative; path will then be relative to that directory.
|
|
1466
|
+
dir_fd may not be implemented on your platform.
|
|
1467
|
+
If it is unavailable, using it will raise a NotImplementedError.
|
|
1468
|
+
"""
|
|
1469
|
+
...
|
|
777
1470
|
|
|
778
1471
|
def makedirs(name: StrOrBytesPath, mode: int = 0o777, exist_ok: bool = False) -> None: ...
|
|
779
1472
|
|
|
780
1473
|
if sys.platform != "win32":
|
|
781
|
-
def mknod(path: StrOrBytesPath, mode: int = 0o600, device: int = 0, *, dir_fd: int | None = None) -> None:
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
1474
|
+
def mknod(path: StrOrBytesPath, mode: int = 0o600, device: int = 0, *, dir_fd: int | None = None) -> None:
|
|
1475
|
+
"""
|
|
1476
|
+
Create a node in the file system.
|
|
1477
|
+
|
|
1478
|
+
Create a node in the file system (file, device special file or named pipe)
|
|
1479
|
+
at path. mode specifies both the permissions to use and the
|
|
1480
|
+
type of node to be created, being combined (bitwise OR) with one of
|
|
1481
|
+
S_IFREG, S_IFCHR, S_IFBLK, and S_IFIFO. If S_IFCHR or S_IFBLK is set on mode,
|
|
1482
|
+
device defines the newly created device special file (probably using
|
|
1483
|
+
os.makedev()). Otherwise device is ignored.
|
|
1484
|
+
|
|
1485
|
+
If dir_fd is not None, it should be a file descriptor open to a directory,
|
|
1486
|
+
and path should be relative; path will then be relative to that directory.
|
|
1487
|
+
dir_fd may not be implemented on your platform.
|
|
1488
|
+
If it is unavailable, using it will raise a NotImplementedError.
|
|
1489
|
+
"""
|
|
1490
|
+
...
|
|
1491
|
+
def major(device: int, /) -> int:
|
|
1492
|
+
"""Extracts a device major number from a raw device number."""
|
|
1493
|
+
...
|
|
1494
|
+
def minor(device: int, /) -> int:
|
|
1495
|
+
"""Extracts a device minor number from a raw device number."""
|
|
1496
|
+
...
|
|
1497
|
+
def makedev(major: int, minor: int, /) -> int:
|
|
1498
|
+
"""Composes a raw device number from the major and minor device numbers."""
|
|
1499
|
+
...
|
|
1500
|
+
def pathconf(path: FileDescriptorOrPath, name: str | int) -> int:
|
|
1501
|
+
"""
|
|
1502
|
+
Return the configuration limit name for the file or directory path.
|
|
1503
|
+
|
|
1504
|
+
If there is no limit, return -1.
|
|
1505
|
+
On some platforms, path may also be specified as an open file descriptor.
|
|
1506
|
+
If this functionality is unavailable, using it raises an exception.
|
|
1507
|
+
"""
|
|
1508
|
+
...
|
|
1509
|
+
|
|
1510
|
+
def readlink(path: GenericPath[AnyStr], *, dir_fd: int | None = None) -> AnyStr:
|
|
1511
|
+
"""
|
|
1512
|
+
Return a string representing the path to which the symbolic link points.
|
|
1513
|
+
|
|
1514
|
+
If dir_fd is not None, it should be a file descriptor open to a directory,
|
|
1515
|
+
and path should be relative; path will then be relative to that directory.
|
|
1516
|
+
|
|
1517
|
+
dir_fd may not be implemented on your platform. If it is unavailable,
|
|
1518
|
+
using it will raise a NotImplementedError.
|
|
1519
|
+
"""
|
|
1520
|
+
...
|
|
1521
|
+
def remove(path: StrOrBytesPath, *, dir_fd: int | None = None) -> None:
|
|
1522
|
+
"""
|
|
1523
|
+
Remove a file (same as unlink()).
|
|
1524
|
+
|
|
1525
|
+
If dir_fd is not None, it should be a file descriptor open to a directory,
|
|
1526
|
+
and path should be relative; path will then be relative to that directory.
|
|
1527
|
+
dir_fd may not be implemented on your platform.
|
|
1528
|
+
If it is unavailable, using it will raise a NotImplementedError.
|
|
1529
|
+
"""
|
|
1530
|
+
...
|
|
789
1531
|
def removedirs(name: StrOrBytesPath) -> None: ...
|
|
790
|
-
def rename(src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = None, dst_dir_fd: int | None = None) -> None:
|
|
1532
|
+
def rename(src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = None, dst_dir_fd: int | None = None) -> None:
|
|
1533
|
+
"""
|
|
1534
|
+
Rename a file or directory.
|
|
1535
|
+
|
|
1536
|
+
If either src_dir_fd or dst_dir_fd is not None, it should be a file
|
|
1537
|
+
descriptor open to a directory, and the respective path string (src or dst)
|
|
1538
|
+
should be relative; the path will then be relative to that directory.
|
|
1539
|
+
src_dir_fd and dst_dir_fd, may not be implemented on your platform.
|
|
1540
|
+
If they are unavailable, using them will raise a NotImplementedError.
|
|
1541
|
+
"""
|
|
1542
|
+
...
|
|
791
1543
|
def renames(old: StrOrBytesPath, new: StrOrBytesPath) -> None: ...
|
|
792
1544
|
def replace(
|
|
793
1545
|
src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = None, dst_dir_fd: int | None = None
|
|
794
|
-
) -> None:
|
|
795
|
-
|
|
1546
|
+
) -> None:
|
|
1547
|
+
"""
|
|
1548
|
+
Rename a file or directory, overwriting the destination.
|
|
1549
|
+
|
|
1550
|
+
If either src_dir_fd or dst_dir_fd is not None, it should be a file
|
|
1551
|
+
descriptor open to a directory, and the respective path string (src or dst)
|
|
1552
|
+
should be relative; the path will then be relative to that directory.
|
|
1553
|
+
src_dir_fd and dst_dir_fd, may not be implemented on your platform.
|
|
1554
|
+
If they are unavailable, using them will raise a NotImplementedError.
|
|
1555
|
+
"""
|
|
1556
|
+
...
|
|
1557
|
+
def rmdir(path: StrOrBytesPath, *, dir_fd: int | None = None) -> None:
|
|
1558
|
+
"""
|
|
1559
|
+
Remove a directory.
|
|
1560
|
+
|
|
1561
|
+
If dir_fd is not None, it should be a file descriptor open to a directory,
|
|
1562
|
+
and path should be relative; path will then be relative to that directory.
|
|
1563
|
+
dir_fd may not be implemented on your platform.
|
|
1564
|
+
If it is unavailable, using it will raise a NotImplementedError.
|
|
1565
|
+
"""
|
|
1566
|
+
...
|
|
796
1567
|
|
|
797
1568
|
class _ScandirIterator(Iterator[DirEntry[AnyStr]], AbstractContextManager[_ScandirIterator[AnyStr], None]):
|
|
798
1569
|
def __next__(self) -> DirEntry[AnyStr]: ...
|
|
@@ -800,25 +1571,118 @@ class _ScandirIterator(Iterator[DirEntry[AnyStr]], AbstractContextManager[_Scand
|
|
|
800
1571
|
def close(self) -> None: ...
|
|
801
1572
|
|
|
802
1573
|
@overload
|
|
803
|
-
def scandir(path: None = None) -> _ScandirIterator[str]:
|
|
1574
|
+
def scandir(path: None = None) -> _ScandirIterator[str]:
|
|
1575
|
+
"""
|
|
1576
|
+
Return an iterator of DirEntry objects for given path.
|
|
1577
|
+
|
|
1578
|
+
path can be specified as either str, bytes, or a path-like object. If path
|
|
1579
|
+
is bytes, the names of yielded DirEntry objects will also be bytes; in
|
|
1580
|
+
all other circumstances they will be str.
|
|
1581
|
+
|
|
1582
|
+
If path is None, uses the path='.'.
|
|
1583
|
+
"""
|
|
1584
|
+
...
|
|
804
1585
|
@overload
|
|
805
|
-
def scandir(path: int) -> _ScandirIterator[str]:
|
|
1586
|
+
def scandir(path: int) -> _ScandirIterator[str]:
|
|
1587
|
+
"""
|
|
1588
|
+
Return an iterator of DirEntry objects for given path.
|
|
1589
|
+
|
|
1590
|
+
path can be specified as either str, bytes, or a path-like object. If path
|
|
1591
|
+
is bytes, the names of yielded DirEntry objects will also be bytes; in
|
|
1592
|
+
all other circumstances they will be str.
|
|
1593
|
+
|
|
1594
|
+
If path is None, uses the path='.'.
|
|
1595
|
+
"""
|
|
1596
|
+
...
|
|
806
1597
|
@overload
|
|
807
|
-
def scandir(path: GenericPath[AnyStr]) -> _ScandirIterator[AnyStr]:
|
|
808
|
-
|
|
1598
|
+
def scandir(path: GenericPath[AnyStr]) -> _ScandirIterator[AnyStr]:
|
|
1599
|
+
"""
|
|
1600
|
+
Return an iterator of DirEntry objects for given path.
|
|
1601
|
+
|
|
1602
|
+
path can be specified as either str, bytes, or a path-like object. If path
|
|
1603
|
+
is bytes, the names of yielded DirEntry objects will also be bytes; in
|
|
1604
|
+
all other circumstances they will be str.
|
|
1605
|
+
|
|
1606
|
+
If path is None, uses the path='.'.
|
|
1607
|
+
"""
|
|
1608
|
+
...
|
|
1609
|
+
def stat(path: FileDescriptorOrPath, *, dir_fd: int | None = None, follow_symlinks: bool = True) -> stat_result:
|
|
1610
|
+
"""
|
|
1611
|
+
Perform a stat system call on the given path.
|
|
1612
|
+
|
|
1613
|
+
path
|
|
1614
|
+
Path to be examined; can be string, bytes, a path-like object or
|
|
1615
|
+
open-file-descriptor int.
|
|
1616
|
+
dir_fd
|
|
1617
|
+
If not None, it should be a file descriptor open to a directory,
|
|
1618
|
+
and path should be a relative string; path will then be relative to
|
|
1619
|
+
that directory.
|
|
1620
|
+
follow_symlinks
|
|
1621
|
+
If False, and the last element of the path is a symbolic link,
|
|
1622
|
+
stat will examine the symbolic link itself instead of the file
|
|
1623
|
+
the link points to.
|
|
1624
|
+
|
|
1625
|
+
dir_fd and follow_symlinks may not be implemented
|
|
1626
|
+
on your platform. If they are unavailable, using them will raise a
|
|
1627
|
+
NotImplementedError.
|
|
1628
|
+
|
|
1629
|
+
It's an error to use dir_fd or follow_symlinks when specifying path as
|
|
1630
|
+
an open file descriptor.
|
|
1631
|
+
"""
|
|
1632
|
+
...
|
|
809
1633
|
|
|
810
1634
|
if sys.platform != "win32":
|
|
811
|
-
def statvfs(path: FileDescriptorOrPath) -> statvfs_result:
|
|
1635
|
+
def statvfs(path: FileDescriptorOrPath) -> statvfs_result:
|
|
1636
|
+
"""
|
|
1637
|
+
Perform a statvfs system call on the given path.
|
|
1638
|
+
|
|
1639
|
+
path may always be specified as a string.
|
|
1640
|
+
On some platforms, path may also be specified as an open file descriptor.
|
|
1641
|
+
If this functionality is unavailable, using it raises an exception.
|
|
1642
|
+
"""
|
|
1643
|
+
...
|
|
812
1644
|
|
|
813
1645
|
def symlink(
|
|
814
1646
|
src: StrOrBytesPath, dst: StrOrBytesPath, target_is_directory: bool = False, *, dir_fd: int | None = None
|
|
815
|
-
) -> None:
|
|
1647
|
+
) -> None:
|
|
1648
|
+
"""
|
|
1649
|
+
Create a symbolic link pointing to src named dst.
|
|
1650
|
+
|
|
1651
|
+
target_is_directory is required on Windows if the target is to be
|
|
1652
|
+
interpreted as a directory. (On Windows, symlink requires
|
|
1653
|
+
Windows 6.0 or greater, and raises a NotImplementedError otherwise.)
|
|
1654
|
+
target_is_directory is ignored on non-Windows platforms.
|
|
1655
|
+
|
|
1656
|
+
If dir_fd is not None, it should be a file descriptor open to a directory,
|
|
1657
|
+
and path should be relative; path will then be relative to that directory.
|
|
1658
|
+
dir_fd may not be implemented on your platform.
|
|
1659
|
+
If it is unavailable, using it will raise a NotImplementedError.
|
|
1660
|
+
"""
|
|
1661
|
+
...
|
|
816
1662
|
|
|
817
1663
|
if sys.platform != "win32":
|
|
818
|
-
def sync() -> None:
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
1664
|
+
def sync() -> None:
|
|
1665
|
+
"""Force write of everything to disk."""
|
|
1666
|
+
...
|
|
1667
|
+
|
|
1668
|
+
def truncate(path: FileDescriptorOrPath, length: int) -> None:
|
|
1669
|
+
"""
|
|
1670
|
+
Truncate a file, specified by path, to a specific length.
|
|
1671
|
+
|
|
1672
|
+
On some platforms, path may also be specified as an open file descriptor.
|
|
1673
|
+
If this functionality is unavailable, using it raises an exception.
|
|
1674
|
+
"""
|
|
1675
|
+
...
|
|
1676
|
+
def unlink(path: StrOrBytesPath, *, dir_fd: int | None = None) -> None:
|
|
1677
|
+
"""
|
|
1678
|
+
Remove a file (same as remove()).
|
|
1679
|
+
|
|
1680
|
+
If dir_fd is not None, it should be a file descriptor open to a directory,
|
|
1681
|
+
and path should be relative; path will then be relative to that directory.
|
|
1682
|
+
dir_fd may not be implemented on your platform.
|
|
1683
|
+
If it is unavailable, using it will raise a NotImplementedError.
|
|
1684
|
+
"""
|
|
1685
|
+
...
|
|
822
1686
|
def utime(
|
|
823
1687
|
path: FileDescriptorOrPath,
|
|
824
1688
|
times: tuple[int, int] | tuple[float, float] | None = None,
|
|
@@ -826,7 +1690,33 @@ def utime(
|
|
|
826
1690
|
ns: tuple[int, int] = ...,
|
|
827
1691
|
dir_fd: int | None = None,
|
|
828
1692
|
follow_symlinks: bool = True,
|
|
829
|
-
) -> None:
|
|
1693
|
+
) -> None:
|
|
1694
|
+
"""
|
|
1695
|
+
Set the access and modified time of path.
|
|
1696
|
+
|
|
1697
|
+
path may always be specified as a string.
|
|
1698
|
+
On some platforms, path may also be specified as an open file descriptor.
|
|
1699
|
+
If this functionality is unavailable, using it raises an exception.
|
|
1700
|
+
|
|
1701
|
+
If times is not None, it must be a tuple (atime, mtime);
|
|
1702
|
+
atime and mtime should be expressed as float seconds since the epoch.
|
|
1703
|
+
If ns is specified, it must be a tuple (atime_ns, mtime_ns);
|
|
1704
|
+
atime_ns and mtime_ns should be expressed as integer nanoseconds
|
|
1705
|
+
since the epoch.
|
|
1706
|
+
If times is None and ns is unspecified, utime uses the current time.
|
|
1707
|
+
Specifying tuples for both times and ns is an error.
|
|
1708
|
+
|
|
1709
|
+
If dir_fd is not None, it should be a file descriptor open to a directory,
|
|
1710
|
+
and path should be relative; path will then be relative to that directory.
|
|
1711
|
+
If follow_symlinks is False, and the last element of the path is a symbolic
|
|
1712
|
+
link, utime will modify the symbolic link itself instead of the file the
|
|
1713
|
+
link points to.
|
|
1714
|
+
It is an error to use dir_fd or follow_symlinks when specifying path
|
|
1715
|
+
as an open file descriptor.
|
|
1716
|
+
dir_fd and follow_symlinks may not be available on your platform.
|
|
1717
|
+
If they are unavailable, using them will raise a NotImplementedError.
|
|
1718
|
+
"""
|
|
1719
|
+
...
|
|
830
1720
|
|
|
831
1721
|
_OnError: TypeAlias = Callable[[OSError], object]
|
|
832
1722
|
|
|
@@ -866,7 +1756,14 @@ if sys.platform != "win32":
|
|
|
866
1756
|
follow_symlinks: bool = True,
|
|
867
1757
|
) -> None: ...
|
|
868
1758
|
|
|
869
|
-
def abort() -> NoReturn:
|
|
1759
|
+
def abort() -> NoReturn:
|
|
1760
|
+
"""
|
|
1761
|
+
Abort the interpreter immediately.
|
|
1762
|
+
|
|
1763
|
+
This function 'dumps core' or otherwise fails in the hardest way possible
|
|
1764
|
+
on the hosting operating system. This function never returns.
|
|
1765
|
+
"""
|
|
1766
|
+
...
|
|
870
1767
|
|
|
871
1768
|
# These are defined as execl(file, *args) but the first *arg is mandatory.
|
|
872
1769
|
def execl(file: StrOrBytesPath, *args: Unpack[tuple[StrOrBytesPath, Unpack[tuple[StrOrBytesPath, ...]]]]) -> NoReturn: ...
|
|
@@ -901,19 +1798,62 @@ _ExecVArgs: TypeAlias = (
|
|
|
901
1798
|
# we limit to str | bytes.
|
|
902
1799
|
_ExecEnv: TypeAlias = Mapping[bytes, bytes | str] | Mapping[str, bytes | str]
|
|
903
1800
|
|
|
904
|
-
def execv(path: StrOrBytesPath, argv: _ExecVArgs, /) -> NoReturn:
|
|
905
|
-
|
|
1801
|
+
def execv(path: StrOrBytesPath, argv: _ExecVArgs, /) -> NoReturn:
|
|
1802
|
+
"""
|
|
1803
|
+
Execute an executable path with arguments, replacing current process.
|
|
1804
|
+
|
|
1805
|
+
path
|
|
1806
|
+
Path of executable file.
|
|
1807
|
+
argv
|
|
1808
|
+
Tuple or list of strings.
|
|
1809
|
+
"""
|
|
1810
|
+
...
|
|
1811
|
+
def execve(path: FileDescriptorOrPath, argv: _ExecVArgs, env: _ExecEnv) -> NoReturn:
|
|
1812
|
+
"""
|
|
1813
|
+
Execute an executable path with arguments, replacing current process.
|
|
1814
|
+
|
|
1815
|
+
path
|
|
1816
|
+
Path of executable file.
|
|
1817
|
+
argv
|
|
1818
|
+
Tuple or list of strings.
|
|
1819
|
+
env
|
|
1820
|
+
Dictionary of strings mapping to strings.
|
|
1821
|
+
"""
|
|
1822
|
+
...
|
|
906
1823
|
def execvp(file: StrOrBytesPath, args: _ExecVArgs) -> NoReturn: ...
|
|
907
1824
|
def execvpe(file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> NoReturn: ...
|
|
908
|
-
def _exit(status: int) -> NoReturn:
|
|
909
|
-
|
|
1825
|
+
def _exit(status: int) -> NoReturn:
|
|
1826
|
+
"""Exit to the system with specified status, without normal exit processing."""
|
|
1827
|
+
...
|
|
1828
|
+
def kill(pid: int, signal: int, /) -> None:
|
|
1829
|
+
"""Kill a process with a signal."""
|
|
1830
|
+
...
|
|
910
1831
|
|
|
911
1832
|
if sys.platform != "win32":
|
|
912
1833
|
# Unix only
|
|
913
|
-
def fork() -> int:
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
1834
|
+
def fork() -> int:
|
|
1835
|
+
"""
|
|
1836
|
+
Fork a child process.
|
|
1837
|
+
|
|
1838
|
+
Return 0 to child process and PID of child to parent process.
|
|
1839
|
+
"""
|
|
1840
|
+
...
|
|
1841
|
+
def forkpty() -> tuple[int, int]:
|
|
1842
|
+
"""
|
|
1843
|
+
Fork a new process with a new pseudo-terminal as controlling tty.
|
|
1844
|
+
|
|
1845
|
+
Returns a tuple of (pid, master_fd).
|
|
1846
|
+
Like fork(), return pid of 0 to the child process,
|
|
1847
|
+
and pid of child to the parent process.
|
|
1848
|
+
To both, return fd of newly opened pseudo-terminal.
|
|
1849
|
+
"""
|
|
1850
|
+
...
|
|
1851
|
+
def killpg(pgid: int, signal: int, /) -> None:
|
|
1852
|
+
"""Kill a process group with a signal."""
|
|
1853
|
+
...
|
|
1854
|
+
def nice(increment: int, /) -> int:
|
|
1855
|
+
"""Add increment to the priority of process and return the new priority."""
|
|
1856
|
+
...
|
|
917
1857
|
if sys.platform != "darwin" and sys.platform != "linux":
|
|
918
1858
|
def plock(op: int, /) -> None: ...
|
|
919
1859
|
|
|
@@ -926,32 +1866,95 @@ def spawnl(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBy
|
|
|
926
1866
|
def spawnle(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise sig
|
|
927
1867
|
|
|
928
1868
|
if sys.platform != "win32":
|
|
929
|
-
def spawnv(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int:
|
|
930
|
-
|
|
1869
|
+
def spawnv(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int:
|
|
1870
|
+
"""
|
|
1871
|
+
Execute the program specified by path in a new process.
|
|
1872
|
+
|
|
1873
|
+
mode
|
|
1874
|
+
Mode of process creation.
|
|
1875
|
+
path
|
|
1876
|
+
Path of executable file.
|
|
1877
|
+
argv
|
|
1878
|
+
Tuple or list of strings.
|
|
1879
|
+
"""
|
|
1880
|
+
...
|
|
1881
|
+
def spawnve(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int:
|
|
1882
|
+
"""
|
|
1883
|
+
Execute the program specified by path in a new process.
|
|
1884
|
+
|
|
1885
|
+
mode
|
|
1886
|
+
Mode of process creation.
|
|
1887
|
+
path
|
|
1888
|
+
Path of executable file.
|
|
1889
|
+
argv
|
|
1890
|
+
Tuple or list of strings.
|
|
1891
|
+
env
|
|
1892
|
+
Dictionary of strings mapping to strings.
|
|
1893
|
+
"""
|
|
1894
|
+
...
|
|
931
1895
|
|
|
932
1896
|
else:
|
|
933
1897
|
def spawnv(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, /) -> int: ...
|
|
934
1898
|
def spawnve(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, env: _ExecEnv, /) -> int: ...
|
|
935
1899
|
|
|
936
|
-
def system(command: StrOrBytesPath) -> int:
|
|
1900
|
+
def system(command: StrOrBytesPath) -> int:
|
|
1901
|
+
"""Execute the command in a subshell."""
|
|
1902
|
+
...
|
|
937
1903
|
@final
|
|
938
1904
|
class times_result(structseq[float], tuple[float, float, float, float, float]):
|
|
1905
|
+
"""
|
|
1906
|
+
times_result: Result from os.times().
|
|
1907
|
+
|
|
1908
|
+
This object may be accessed either as a tuple of
|
|
1909
|
+
(user, system, children_user, children_system, elapsed),
|
|
1910
|
+
or via the attributes user, system, children_user, children_system,
|
|
1911
|
+
and elapsed.
|
|
1912
|
+
|
|
1913
|
+
See os.times for more information.
|
|
1914
|
+
"""
|
|
939
1915
|
if sys.version_info >= (3, 10):
|
|
940
1916
|
__match_args__: Final = ("user", "system", "children_user", "children_system", "elapsed")
|
|
941
1917
|
|
|
942
1918
|
@property
|
|
943
|
-
def user(self) -> float:
|
|
1919
|
+
def user(self) -> float:
|
|
1920
|
+
"""user time"""
|
|
1921
|
+
...
|
|
944
1922
|
@property
|
|
945
|
-
def system(self) -> float:
|
|
1923
|
+
def system(self) -> float:
|
|
1924
|
+
"""system time"""
|
|
1925
|
+
...
|
|
946
1926
|
@property
|
|
947
|
-
def children_user(self) -> float:
|
|
1927
|
+
def children_user(self) -> float:
|
|
1928
|
+
"""user time of children"""
|
|
1929
|
+
...
|
|
948
1930
|
@property
|
|
949
|
-
def children_system(self) -> float:
|
|
1931
|
+
def children_system(self) -> float:
|
|
1932
|
+
"""system time of children"""
|
|
1933
|
+
...
|
|
950
1934
|
@property
|
|
951
|
-
def elapsed(self) -> float:
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
1935
|
+
def elapsed(self) -> float:
|
|
1936
|
+
"""elapsed time since an arbitrary point in the past"""
|
|
1937
|
+
...
|
|
1938
|
+
|
|
1939
|
+
def times() -> times_result:
|
|
1940
|
+
"""
|
|
1941
|
+
Return a collection containing process timing information.
|
|
1942
|
+
|
|
1943
|
+
The object returned behaves like a named tuple with these fields:
|
|
1944
|
+
(utime, stime, cutime, cstime, elapsed_time)
|
|
1945
|
+
All fields are floating point numbers.
|
|
1946
|
+
"""
|
|
1947
|
+
...
|
|
1948
|
+
def waitpid(pid: int, options: int, /) -> tuple[int, int]:
|
|
1949
|
+
"""
|
|
1950
|
+
Wait for completion of a given child process.
|
|
1951
|
+
|
|
1952
|
+
Returns a tuple of information regarding the child process:
|
|
1953
|
+
(pid, status)
|
|
1954
|
+
|
|
1955
|
+
The options argument is ignored on Windows.
|
|
1956
|
+
"""
|
|
1957
|
+
...
|
|
955
1958
|
|
|
956
1959
|
if sys.platform == "win32":
|
|
957
1960
|
if sys.version_info >= (3, 10):
|
|
@@ -970,10 +1973,26 @@ else:
|
|
|
970
1973
|
def spawnlpe(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise signature
|
|
971
1974
|
def spawnvp(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ...
|
|
972
1975
|
def spawnvpe(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ...
|
|
973
|
-
def wait() -> tuple[int, int]:
|
|
1976
|
+
def wait() -> tuple[int, int]:
|
|
1977
|
+
"""
|
|
1978
|
+
Wait for completion of a child process.
|
|
1979
|
+
|
|
1980
|
+
Returns a tuple of information about the child process:
|
|
1981
|
+
(pid, status)
|
|
1982
|
+
"""
|
|
1983
|
+
...
|
|
974
1984
|
if sys.platform != "darwin":
|
|
975
1985
|
@final
|
|
976
1986
|
class waitid_result(structseq[int], tuple[int, int, int, int, int]):
|
|
1987
|
+
"""
|
|
1988
|
+
waitid_result: Result from waitid.
|
|
1989
|
+
|
|
1990
|
+
This object may be accessed either as a tuple of
|
|
1991
|
+
(si_pid, si_uid, si_signo, si_status, si_code),
|
|
1992
|
+
or via the attributes si_pid, si_uid, and so on.
|
|
1993
|
+
|
|
1994
|
+
See os.waitid for more information.
|
|
1995
|
+
"""
|
|
977
1996
|
if sys.version_info >= (3, 10):
|
|
978
1997
|
__match_args__: Final = ("si_pid", "si_uid", "si_signo", "si_status", "si_code")
|
|
979
1998
|
|
|
@@ -988,20 +2007,70 @@ else:
|
|
|
988
2007
|
@property
|
|
989
2008
|
def si_code(self) -> int: ...
|
|
990
2009
|
|
|
991
|
-
def waitid(idtype: int, ident: int, options: int, /) -> waitid_result | None:
|
|
2010
|
+
def waitid(idtype: int, ident: int, options: int, /) -> waitid_result | None:
|
|
2011
|
+
"""
|
|
2012
|
+
Returns the result of waiting for a process or processes.
|
|
2013
|
+
|
|
2014
|
+
idtype
|
|
2015
|
+
Must be one of be P_PID, P_PGID or P_ALL.
|
|
2016
|
+
id
|
|
2017
|
+
The id to wait on.
|
|
2018
|
+
options
|
|
2019
|
+
Constructed from the ORing of one or more of WEXITED, WSTOPPED
|
|
2020
|
+
or WCONTINUED and additionally may be ORed with WNOHANG or WNOWAIT.
|
|
2021
|
+
|
|
2022
|
+
Returns either waitid_result or None if WNOHANG is specified and there are
|
|
2023
|
+
no children in a waitable state.
|
|
2024
|
+
"""
|
|
2025
|
+
...
|
|
992
2026
|
|
|
993
2027
|
from resource import struct_rusage
|
|
994
2028
|
|
|
995
|
-
def wait3(options: int) -> tuple[int, int, struct_rusage]:
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
def
|
|
1004
|
-
|
|
2029
|
+
def wait3(options: int) -> tuple[int, int, struct_rusage]:
|
|
2030
|
+
"""
|
|
2031
|
+
Wait for completion of a child process.
|
|
2032
|
+
|
|
2033
|
+
Returns a tuple of information about the child process:
|
|
2034
|
+
(pid, status, rusage)
|
|
2035
|
+
"""
|
|
2036
|
+
...
|
|
2037
|
+
def wait4(pid: int, options: int) -> tuple[int, int, struct_rusage]:
|
|
2038
|
+
"""
|
|
2039
|
+
Wait for completion of a specific child process.
|
|
2040
|
+
|
|
2041
|
+
Returns a tuple of information about the child process:
|
|
2042
|
+
(pid, status, rusage)
|
|
2043
|
+
"""
|
|
2044
|
+
...
|
|
2045
|
+
def WCOREDUMP(status: int, /) -> bool:
|
|
2046
|
+
"""Return True if the process returning status was dumped to a core file."""
|
|
2047
|
+
...
|
|
2048
|
+
def WIFCONTINUED(status: int) -> bool:
|
|
2049
|
+
"""
|
|
2050
|
+
Return True if a particular process was continued from a job control stop.
|
|
2051
|
+
|
|
2052
|
+
Return True if the process returning status was continued from a
|
|
2053
|
+
job control stop.
|
|
2054
|
+
"""
|
|
2055
|
+
...
|
|
2056
|
+
def WIFSTOPPED(status: int) -> bool:
|
|
2057
|
+
"""Return True if the process returning status was stopped."""
|
|
2058
|
+
...
|
|
2059
|
+
def WIFSIGNALED(status: int) -> bool:
|
|
2060
|
+
"""Return True if the process returning status was terminated by a signal."""
|
|
2061
|
+
...
|
|
2062
|
+
def WIFEXITED(status: int) -> bool:
|
|
2063
|
+
"""Return True if the process returning status exited via the exit() system call."""
|
|
2064
|
+
...
|
|
2065
|
+
def WEXITSTATUS(status: int) -> int:
|
|
2066
|
+
"""Return the process return code from status."""
|
|
2067
|
+
...
|
|
2068
|
+
def WSTOPSIG(status: int) -> int:
|
|
2069
|
+
"""Return the signal that stopped the process that provided the status value."""
|
|
2070
|
+
...
|
|
2071
|
+
def WTERMSIG(status: int) -> int:
|
|
2072
|
+
"""Return the signal that terminated the process that provided the status value."""
|
|
2073
|
+
...
|
|
1005
2074
|
def posix_spawn(
|
|
1006
2075
|
path: StrOrBytesPath,
|
|
1007
2076
|
argv: _ExecVArgs,
|
|
@@ -1015,7 +2084,32 @@ else:
|
|
|
1015
2084
|
setsigmask: Iterable[int] = ...,
|
|
1016
2085
|
setsigdef: Iterable[int] = ...,
|
|
1017
2086
|
scheduler: tuple[Any, sched_param] | None = ...,
|
|
1018
|
-
) -> int:
|
|
2087
|
+
) -> int:
|
|
2088
|
+
"""
|
|
2089
|
+
Execute the program specified by path in a new process.
|
|
2090
|
+
|
|
2091
|
+
path
|
|
2092
|
+
Path of executable file.
|
|
2093
|
+
argv
|
|
2094
|
+
Tuple or list of strings.
|
|
2095
|
+
env
|
|
2096
|
+
Dictionary of strings mapping to strings.
|
|
2097
|
+
file_actions
|
|
2098
|
+
A sequence of file action tuples.
|
|
2099
|
+
setpgroup
|
|
2100
|
+
The pgroup to use with the POSIX_SPAWN_SETPGROUP flag.
|
|
2101
|
+
resetids
|
|
2102
|
+
If the value is `true` the POSIX_SPAWN_RESETIDS will be activated.
|
|
2103
|
+
setsid
|
|
2104
|
+
If the value is `true` the POSIX_SPAWN_SETSID or POSIX_SPAWN_SETSID_NP will be activated.
|
|
2105
|
+
setsigmask
|
|
2106
|
+
The sigmask to use with the POSIX_SPAWN_SETSIGMASK flag.
|
|
2107
|
+
setsigdef
|
|
2108
|
+
The sigmask to use with the POSIX_SPAWN_SETSIGDEF flag.
|
|
2109
|
+
scheduler
|
|
2110
|
+
A tuple with the scheduler policy (optional) and parameters.
|
|
2111
|
+
"""
|
|
2112
|
+
...
|
|
1019
2113
|
def posix_spawnp(
|
|
1020
2114
|
path: StrOrBytesPath,
|
|
1021
2115
|
argv: _ExecVArgs,
|
|
@@ -1029,7 +2123,32 @@ else:
|
|
|
1029
2123
|
setsigmask: Iterable[int] = ...,
|
|
1030
2124
|
setsigdef: Iterable[int] = ...,
|
|
1031
2125
|
scheduler: tuple[Any, sched_param] | None = ...,
|
|
1032
|
-
) -> int:
|
|
2126
|
+
) -> int:
|
|
2127
|
+
"""
|
|
2128
|
+
Execute the program specified by path in a new process.
|
|
2129
|
+
|
|
2130
|
+
path
|
|
2131
|
+
Path of executable file.
|
|
2132
|
+
argv
|
|
2133
|
+
Tuple or list of strings.
|
|
2134
|
+
env
|
|
2135
|
+
Dictionary of strings mapping to strings.
|
|
2136
|
+
file_actions
|
|
2137
|
+
A sequence of file action tuples.
|
|
2138
|
+
setpgroup
|
|
2139
|
+
The pgroup to use with the POSIX_SPAWN_SETPGROUP flag.
|
|
2140
|
+
resetids
|
|
2141
|
+
If the value is `True` the POSIX_SPAWN_RESETIDS will be activated.
|
|
2142
|
+
setsid
|
|
2143
|
+
If the value is `True` the POSIX_SPAWN_SETSID or POSIX_SPAWN_SETSID_NP will be activated.
|
|
2144
|
+
setsigmask
|
|
2145
|
+
The sigmask to use with the POSIX_SPAWN_SETSIGMASK flag.
|
|
2146
|
+
setsigdef
|
|
2147
|
+
The sigmask to use with the POSIX_SPAWN_SETSIGDEF flag.
|
|
2148
|
+
scheduler
|
|
2149
|
+
A tuple with the scheduler policy (optional) and parameters.
|
|
2150
|
+
"""
|
|
2151
|
+
...
|
|
1033
2152
|
POSIX_SPAWN_OPEN: int
|
|
1034
2153
|
POSIX_SPAWN_CLOSE: int
|
|
1035
2154
|
POSIX_SPAWN_DUP2: int
|
|
@@ -1037,37 +2156,118 @@ else:
|
|
|
1037
2156
|
if sys.platform != "win32":
|
|
1038
2157
|
@final
|
|
1039
2158
|
class sched_param(structseq[int], tuple[int]):
|
|
2159
|
+
"""
|
|
2160
|
+
Current has only one field: sched_priority");
|
|
2161
|
+
|
|
2162
|
+
sched_priority
|
|
2163
|
+
A scheduling parameter.
|
|
2164
|
+
"""
|
|
1040
2165
|
if sys.version_info >= (3, 10):
|
|
1041
2166
|
__match_args__: Final = ("sched_priority",)
|
|
1042
2167
|
|
|
1043
2168
|
def __new__(cls, sched_priority: int) -> Self: ...
|
|
1044
2169
|
@property
|
|
1045
|
-
def sched_priority(self) -> int:
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
def
|
|
2170
|
+
def sched_priority(self) -> int:
|
|
2171
|
+
"""the scheduling priority"""
|
|
2172
|
+
...
|
|
2173
|
+
|
|
2174
|
+
def sched_get_priority_min(policy: int) -> int:
|
|
2175
|
+
"""Get the minimum scheduling priority for policy."""
|
|
2176
|
+
...
|
|
2177
|
+
def sched_get_priority_max(policy: int) -> int:
|
|
2178
|
+
"""Get the maximum scheduling priority for policy."""
|
|
2179
|
+
...
|
|
2180
|
+
def sched_yield() -> None:
|
|
2181
|
+
"""Voluntarily relinquish the CPU."""
|
|
2182
|
+
...
|
|
1050
2183
|
if sys.platform != "darwin":
|
|
1051
|
-
def sched_setscheduler(pid: int, policy: int, param: sched_param, /) -> None:
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
def
|
|
2184
|
+
def sched_setscheduler(pid: int, policy: int, param: sched_param, /) -> None:
|
|
2185
|
+
"""
|
|
2186
|
+
Set the scheduling policy for the process identified by pid.
|
|
2187
|
+
|
|
2188
|
+
If pid is 0, the calling process is changed.
|
|
2189
|
+
param is an instance of sched_param.
|
|
2190
|
+
"""
|
|
2191
|
+
...
|
|
2192
|
+
def sched_getscheduler(pid: int, /) -> int:
|
|
2193
|
+
"""
|
|
2194
|
+
Get the scheduling policy for the process identifiedy by pid.
|
|
2195
|
+
|
|
2196
|
+
Passing 0 for pid returns the scheduling policy for the calling process.
|
|
2197
|
+
"""
|
|
2198
|
+
...
|
|
2199
|
+
def sched_rr_get_interval(pid: int, /) -> float:
|
|
2200
|
+
"""
|
|
2201
|
+
Return the round-robin quantum for the process identified by pid, in seconds.
|
|
2202
|
+
|
|
2203
|
+
Value returned is a float.
|
|
2204
|
+
"""
|
|
2205
|
+
...
|
|
2206
|
+
def sched_setparam(pid: int, param: sched_param, /) -> None:
|
|
2207
|
+
"""
|
|
2208
|
+
Set scheduling parameters for the process identified by pid.
|
|
2209
|
+
|
|
2210
|
+
If pid is 0, sets parameters for the calling process.
|
|
2211
|
+
param should be an instance of sched_param.
|
|
2212
|
+
"""
|
|
2213
|
+
...
|
|
2214
|
+
def sched_getparam(pid: int, /) -> sched_param:
|
|
2215
|
+
"""
|
|
2216
|
+
Returns scheduling parameters for the process identified by pid.
|
|
2217
|
+
|
|
2218
|
+
If pid is 0, returns parameters for the calling process.
|
|
2219
|
+
Return value is an instance of sched_param.
|
|
2220
|
+
"""
|
|
2221
|
+
...
|
|
2222
|
+
def sched_setaffinity(pid: int, mask: Iterable[int], /) -> None:
|
|
2223
|
+
"""
|
|
2224
|
+
Set the CPU affinity of the process identified by pid to mask.
|
|
2225
|
+
|
|
2226
|
+
mask should be an iterable of integers identifying CPUs.
|
|
2227
|
+
"""
|
|
2228
|
+
...
|
|
2229
|
+
def sched_getaffinity(pid: int, /) -> set[int]:
|
|
2230
|
+
"""
|
|
2231
|
+
Return the affinity of the process identified by pid (or the current process if zero).
|
|
2232
|
+
|
|
2233
|
+
The affinity is returned as a set of CPU identifiers.
|
|
2234
|
+
"""
|
|
2235
|
+
...
|
|
2236
|
+
|
|
2237
|
+
def cpu_count() -> int | None:
|
|
2238
|
+
"""
|
|
2239
|
+
Return the number of CPUs in the system; return None if indeterminable.
|
|
2240
|
+
|
|
2241
|
+
This number is not equivalent to the number of CPUs the current process can
|
|
2242
|
+
use. The number of usable CPUs can be obtained with
|
|
2243
|
+
``len(os.sched_getaffinity(0))``
|
|
2244
|
+
"""
|
|
2245
|
+
...
|
|
1060
2246
|
|
|
1061
2247
|
if sys.platform != "win32":
|
|
1062
2248
|
# Unix only
|
|
1063
|
-
def confstr(name: str | int, /) -> str | None:
|
|
1064
|
-
|
|
1065
|
-
|
|
2249
|
+
def confstr(name: str | int, /) -> str | None:
|
|
2250
|
+
"""Return a string-valued system configuration variable."""
|
|
2251
|
+
...
|
|
2252
|
+
def getloadavg() -> tuple[float, float, float]:
|
|
2253
|
+
"""
|
|
2254
|
+
Return average recent system load information.
|
|
2255
|
+
|
|
2256
|
+
Return the number of processes in the system run queue averaged over
|
|
2257
|
+
the last 1, 5, and 15 minutes as a tuple of three floats.
|
|
2258
|
+
Raises OSError if the load average was unobtainable.
|
|
2259
|
+
"""
|
|
2260
|
+
...
|
|
2261
|
+
def sysconf(name: str | int, /) -> int:
|
|
2262
|
+
"""Return an integer-valued system configuration variable."""
|
|
2263
|
+
...
|
|
1066
2264
|
|
|
1067
2265
|
if sys.platform == "linux":
|
|
1068
2266
|
def getrandom(size: int, flags: int = 0) -> bytes: ...
|
|
1069
2267
|
|
|
1070
|
-
def urandom(size: int, /) -> bytes:
|
|
2268
|
+
def urandom(size: int, /) -> bytes:
|
|
2269
|
+
"""Return a bytes object containing random bytes suitable for cryptographic use."""
|
|
2270
|
+
...
|
|
1071
2271
|
|
|
1072
2272
|
if sys.platform != "win32":
|
|
1073
2273
|
def register_at_fork(
|
|
@@ -1075,7 +2275,21 @@ if sys.platform != "win32":
|
|
|
1075
2275
|
before: Callable[..., Any] | None = ...,
|
|
1076
2276
|
after_in_parent: Callable[..., Any] | None = ...,
|
|
1077
2277
|
after_in_child: Callable[..., Any] | None = ...,
|
|
1078
|
-
) -> None:
|
|
2278
|
+
) -> None:
|
|
2279
|
+
"""
|
|
2280
|
+
Register callables to be called when forking a new process.
|
|
2281
|
+
|
|
2282
|
+
before
|
|
2283
|
+
A callable to be called in the parent before the fork() syscall.
|
|
2284
|
+
after_in_child
|
|
2285
|
+
A callable to be called in the child after fork().
|
|
2286
|
+
after_in_parent
|
|
2287
|
+
A callable to be called in the parent after fork().
|
|
2288
|
+
|
|
2289
|
+
'before' callbacks are called in reverse order.
|
|
2290
|
+
'after_in_child' and 'after_in_parent' callbacks are called in order.
|
|
2291
|
+
"""
|
|
2292
|
+
...
|
|
1079
2293
|
|
|
1080
2294
|
if sys.platform == "win32":
|
|
1081
2295
|
class _AddedDllDirectory:
|
|
@@ -1109,7 +2323,23 @@ if sys.platform == "linux":
|
|
|
1109
2323
|
def copy_file_range(src: int, dst: int, count: int, offset_src: int | None = ..., offset_dst: int | None = ...) -> int: ...
|
|
1110
2324
|
|
|
1111
2325
|
if sys.version_info >= (3, 9):
|
|
1112
|
-
def waitstatus_to_exitcode(status: int) -> int:
|
|
2326
|
+
def waitstatus_to_exitcode(status: int) -> int:
|
|
2327
|
+
"""
|
|
2328
|
+
Convert a wait status to an exit code.
|
|
2329
|
+
|
|
2330
|
+
On Unix:
|
|
2331
|
+
|
|
2332
|
+
* If WIFEXITED(status) is true, return WEXITSTATUS(status).
|
|
2333
|
+
* If WIFSIGNALED(status) is true, return -WTERMSIG(status).
|
|
2334
|
+
* Otherwise, raise a ValueError.
|
|
2335
|
+
|
|
2336
|
+
On Windows, return status shifted right by 8 bits.
|
|
2337
|
+
|
|
2338
|
+
On Unix, if the process is being traced or if waitpid() was called with
|
|
2339
|
+
WUNTRACED option, the caller must first check if WIFSTOPPED(status) is true.
|
|
2340
|
+
This function must not be called if WIFSTOPPED(status) is true.
|
|
2341
|
+
"""
|
|
2342
|
+
...
|
|
1113
2343
|
|
|
1114
2344
|
if sys.platform == "linux":
|
|
1115
2345
|
def pidfd_open(pid: int, flags: int = ...) -> int: ...
|