chunk_id stringlengths 36 36 | source stringclasses 35
values | source_url stringlengths 0 290 | upstream_license stringclasses 1
value | document_id stringlengths 36 36 | chunk_index int64 0 324k | retrieved_at stringclasses 2
values | chunker_version stringclasses 4
values | content_hash stringlengths 15 64 | content stringlengths 50 44.7k | namespace stringclasses 9
values | source_name stringclasses 35
values | raw_text stringlengths 50 44.7k | cleaned_text stringlengths 50 44.7k | tags stringclasses 49
values | collection_name stringclasses 11
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
85b29a26-f6c3-4ad7-a079-a577218c2c05 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,656 | supabase-export-v2 | 5a0c89eb5b9d78e7 | .. method:: is_file(*, follow_symlinks=True)
Return ``True`` if the path is a file, or a symbolic link pointing to
a file; return ``False`` if the path is (or points to) a directory or
other non-file, or if it doesn't exist. | trusted_official_docs | CPython Docs | .. method:: is_file(*, follow_symlinks=True)
Return ``True`` if the path is a file, or a symbolic link pointing to
a file; return ``False`` if the path is (or points to) a directory or
other non-file, or if it doesn't exist. | .. method:: is_file(*, follow_symlinks=True)
Return ``True`` if the path is a file, or a symbolic link pointing to
a file; return ``False`` if the path is (or points to) a directory or
other non-file, or if it doesn't exist. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
873a8dbc-3a78-4293-b599-a5d6a05a71f6 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,414 | supabase-export-v2 | b105a5d90f0808c0 | .. versionchanged:: 3.8
:meth:`~Path.exists`, :meth:`~Path.is_dir`, :meth:`~Path.is_file`,
:meth:`~Path.is_mount`, :meth:`~Path.is_symlink`,
:meth:`~Path.is_block_device`, :meth:`~Path.is_char_device`,
:meth:`~Path.is_fifo`, :meth:`~Path.is_socket` now return ``False``
instead of raising an exception for paths that... | trusted_official_docs | CPython Docs | .. versionchanged:: 3.8
:meth:`~Path.exists`, :meth:`~Path.is_dir`, :meth:`~Path.is_file`,
:meth:`~Path.is_mount`, :meth:`~Path.is_symlink`,
:meth:`~Path.is_block_device`, :meth:`~Path.is_char_device`,
:meth:`~Path.is_fifo`, :meth:`~Path.is_socket` now return ``False``
instead of raising an exception for paths that... | .. versionchanged:: 3.8
:meth:`~Path.exists`, :meth:`~Path.is_dir`, :meth:`~Path.is_file`,
:meth:`~Path.is_mount`, :meth:`~Path.is_symlink`,
:meth:`~Path.is_block_device`, :meth:`~Path.is_char_device`,
:meth:`~Path.is_fifo`, :meth:`~Path.is_socket` now return ``False``
instead of raising an exception for paths that... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
88e2034e-3d96-464e-a470-fbd4b6bdd5ec | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,638 | supabase-export-v2 | d0eb092cdd9ae31c | child process. Specifically, the absence of a separator in the path may force it to be looked up in :envvar:`PATH` rather than the current directory.
As a consequence of these differences, pathlib is not a drop-in replacement
for :mod:`os.path`. | trusted_official_docs | CPython Docs | child process. Specifically, the absence of a separator in the path may force it to be looked up in :envvar:`PATH` rather than the current directory.
As a consequence of these differences, pathlib is not a drop-in replacement
for :mod:`os.path`. | child process. Specifically, the absence of a separator in the path may force it to be looked up in :envvar:`PATH` rather than the current directory.
As a consequence of these differences, pathlib is not a drop-in replacement
for :mod:`os.path`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
89a009ce-db41-4460-977c-0ef4cd2d59bf | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,533 | supabase-export-v2 | 348cee546db3f122 | Unlike :func:`os.walk`, :meth:`Path.walk` lists symlinks to directories in *filenames* if *follow_symlinks* is false.
This example displays the number of bytes used by all files in each directory,
while ignoring ``__pycache__`` directories:: | trusted_official_docs | CPython Docs | Unlike :func:`os.walk`, :meth:`Path.walk` lists symlinks to directories in *filenames* if *follow_symlinks* is false.
This example displays the number of bytes used by all files in each directory,
while ignoring ``__pycache__`` directories:: | Unlike :func:`os.walk`, :meth:`Path.walk` lists symlinks to directories in *filenames* if *follow_symlinks* is false.
This example displays the number of bytes used by all files in each directory,
while ignoring ``__pycache__`` directories:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8c012204-6fe3-4873-b1fd-2eded408a85e | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,331 | supabase-export-v2 | 1e5d79c528eb579d | Return a new path with the :attr:`stem` changed. If the original path doesn't have a name, ValueError is raised::
>>> p = PureWindowsPath('c:/Downloads/draft.txt')
>>> p.with_stem('final')
PureWindowsPath('c:/Downloads/final.txt')
>>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')
>>> p.with_stem('lib')
PureWi... | trusted_official_docs | CPython Docs | Return a new path with the :attr:`stem` changed. If the original path doesn't have a name, ValueError is raised::
>>> p = PureWindowsPath('c:/Downloads/draft.txt')
>>> p.with_stem('final')
PureWindowsPath('c:/Downloads/final.txt')
>>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')
>>> p.with_stem('lib')
PureWi... | Return a new path with the :attr:`stem` changed. If the original path doesn't have a name, ValueError is raised::
>>> p = PureWindowsPath('c:/Downloads/draft.txt')
>>> p.with_stem('final')
PureWindowsPath('c:/Downloads/final.txt')
>>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')
>>> p.with_stem('lib')
PureWi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8e40667d-edd7-4bd7-939d-e8c29017fa8a | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,159 | supabase-export-v2 | 28e075961bca82bb | Pure paths are useful in some special cases; for example:
#. If you want to manipulate Windows paths on a Unix machine (or vice versa). You cannot instantiate a :class:`WindowsPath` when running on Unix, but you
can instantiate :class:`PureWindowsPath`. #. You want to make sure that your code only manipulates paths wi... | trusted_official_docs | CPython Docs | Pure paths are useful in some special cases; for example:
#. If you want to manipulate Windows paths on a Unix machine (or vice versa). You cannot instantiate a :class:`WindowsPath` when running on Unix, but you
can instantiate :class:`PureWindowsPath`. #. You want to make sure that your code only manipulates paths wi... | Pure paths are useful in some special cases; for example:
#. If you want to manipulate Windows paths on a Unix machine (or vice versa). You cannot instantiate a :class:`WindowsPath` when running on Unix, but you
can instantiate :class:`PureWindowsPath`. #. You want to make sure that your code only manipulates paths wi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8fa8bb39-3935-4495-bc21-707e2e9499ab | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,157 | supabase-export-v2 | d38a11394e62e412 | Path. Further to these four classes, there are two classes that use multiple inheritance: PosixPath subclasses PurePosixPath and Path, and WindowsPath subclasses PureWindowsPath and Path.
If you've never used this module before or just aren't sure which class is
right for your task, :class:`Path` is most likely what yo... | trusted_official_docs | CPython Docs | Path. Further to these four classes, there are two classes that use multiple inheritance: PosixPath subclasses PurePosixPath and Path, and WindowsPath subclasses PureWindowsPath and Path.
If you've never used this module before or just aren't sure which class is
right for your task, :class:`Path` is most likely what yo... | Path. Further to these four classes, there are two classes that use multiple inheritance: PosixPath subclasses PurePosixPath and Path, and WindowsPath subclasses PureWindowsPath and Path.
If you've never used this module before or just aren't sure which class is
right for your task, :class:`Path` is most likely what yo... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
939ac8d9-ba45-4ff6-863f-21777c03165b | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,328 | supabase-export-v2 | 036f88f3d5eeb2b0 | Return a new path with the :attr:`name` changed. If the original path doesn't have a name, ValueError is raised::
>>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')
>>> p.with_name('setup.py')
PureWindowsPath('c:/Downloads/setup.py')
>>> p = PureWindowsPath('c:/')
>>> p.with_name('setup.py')
Traceback (most re... | trusted_official_docs | CPython Docs | Return a new path with the :attr:`name` changed. If the original path doesn't have a name, ValueError is raised::
>>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')
>>> p.with_name('setup.py')
PureWindowsPath('c:/Downloads/setup.py')
>>> p = PureWindowsPath('c:/')
>>> p.with_name('setup.py')
Traceback (most re... | Return a new path with the :attr:`name` changed. If the original path doesn't have a name, ValueError is raised::
>>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')
>>> p.with_name('setup.py')
PureWindowsPath('c:/Downloads/setup.py')
>>> p = PureWindowsPath('c:/')
>>> p.with_name('setup.py')
Traceback (most re... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
99cdcd7b-765b-4309-be59-134da176cea5 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,623 | supabase-export-v2 | 647aa27c5824b865 | Any path with a final segment ending "``.py``". "``assets/**``" Any path starting with "``assets/``". "``assets/**/*``" Any path starting with "``assets/``", excluding "``assets/``" itself. ========================= ===========================================
.. note::
Globbing with the "``**``" wildcard visits every ... | trusted_official_docs | CPython Docs | Any path with a final segment ending "``.py``". "``assets/**``" Any path starting with "``assets/``". "``assets/**/*``" Any path starting with "``assets/``", excluding "``assets/``" itself. ========================= ===========================================
.. note::
Globbing with the "``**``" wildcard visits every ... | Any path with a final segment ending "``.py``". "``assets/**``" Any path starting with "``assets/``". "``assets/**/*``" Any path starting with "``assets/``", excluding "``assets/``" itself. ========================= ===========================================
.. note::
Globbing with the "``**``" wildcard visits every ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9aad2a88-a21f-4a46-a6d7-795e21eaabe9 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,209 | supabase-export-v2 | f65d3a173d6f00e6 | Paths of a different flavour compare unequal and cannot be ordered::
>>> PureWindowsPath('foo') == PurePosixPath('foo')
False
>>> PureWindowsPath('foo') < PurePosixPath('foo')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: '<' not supported between instances of 'PureWindowsPath' ... | trusted_official_docs | CPython Docs | Paths of a different flavour compare unequal and cannot be ordered::
>>> PureWindowsPath('foo') == PurePosixPath('foo')
False
>>> PureWindowsPath('foo') < PurePosixPath('foo')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: '<' not supported between instances of 'PureWindowsPath' ... | Paths of a different flavour compare unequal and cannot be ordered::
>>> PureWindowsPath('foo') == PurePosixPath('foo')
False
>>> PureWindowsPath('foo') < PurePosixPath('foo')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: '<' not supported between instances of 'PureWindowsPath' ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9ce72074-af65-4a79-9768-471eb8b03b4b | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,500 | supabase-export-v2 | 61e454da41fbef1a | Glob the given relative *pattern* in the directory represented by this path, yielding all matching files (of any kind)::
>>> sorted(Path('.').glob('*.py'))
[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib.py')]
>>> sorted(Path('.').glob('*/*.py'))
[PosixPath('docs/conf.py')]
>>> sorted(Path(... | trusted_official_docs | CPython Docs | Glob the given relative *pattern* in the directory represented by this path, yielding all matching files (of any kind)::
>>> sorted(Path('.').glob('*.py'))
[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib.py')]
>>> sorted(Path('.').glob('*/*.py'))
[PosixPath('docs/conf.py')]
>>> sorted(Path(... | Glob the given relative *pattern* in the directory represented by this path, yielding all matching files (of any kind)::
>>> sorted(Path('.').glob('*.py'))
[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib.py')]
>>> sorted(Path('.').glob('*/*.py'))
[PosixPath('docs/conf.py')]
>>> sorted(Path(... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a1875c02-549c-48d5-b1c1-caf8bb6009cb | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,622 | supabase-export-v2 | b0f8de3848d08fae | The "``**``" wildcard enables recursive globbing. A few examples:
========================= ===========================================
Pattern Meaning
========================= ===========================================
"``**/*``" Any path with at least one segment. "``**/*.py``" Any path with a final segment ending ... | trusted_official_docs | CPython Docs | The "``**``" wildcard enables recursive globbing. A few examples:
========================= ===========================================
Pattern Meaning
========================= ===========================================
"``**/*``" Any path with at least one segment. "``**/*.py``" Any path with a final segment ending ... | The "``**``" wildcard enables recursive globbing. A few examples:
========================= ===========================================
Pattern Meaning
========================= ===========================================
"``**/*``" Any path with at least one segment. "``**/*.py``" Any path with a final segment ending ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a2f766b8-7ab8-4205-9293-1f4452975710 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,630 | supabase-export-v2 | b359072e8d506e2d | don't include trailing slashes. 5. The values returned from pathlib's ``path.glob()`` and ``path.rglob()`` include the *path* as a prefix, unlike the results of ``glob.glob(root_dir=path)``. 6.
The values returned from pathlib's ``path.glob()`` and ``path.rglob()``
may include *path* itself, for example when globbing ... | trusted_official_docs | CPython Docs | don't include trailing slashes. 5. The values returned from pathlib's ``path.glob()`` and ``path.rglob()`` include the *path* as a prefix, unlike the results of ``glob.glob(root_dir=path)``. 6.
The values returned from pathlib's ``path.glob()`` and ``path.rglob()``
may include *path* itself, for example when globbing ... | don't include trailing slashes. 5. The values returned from pathlib's ``path.glob()`` and ``path.rglob()`` include the *path* as a prefix, unlike the results of ``glob.glob(root_dir=path)``. 6.
The values returned from pathlib's ``path.glob()`` and ``path.rglob()``
may include *path* itself, for example when globbing ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a3670b83-e407-48ee-b7d4-143e58fd09a7 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,495 | supabase-export-v2 | e3144511fb67392e | When the path points to a directory, yield path objects of the directory contents::
>>> p = Path('docs')
>>> for child in p.iterdir(): child
... PosixPath('docs/conf.py')
PosixPath('docs/_templates')
PosixPath('docs/make.bat')
PosixPath('docs/index.rst')
PosixPath('docs/_build')
PosixPath('docs/_static')
PosixP... | trusted_official_docs | CPython Docs | When the path points to a directory, yield path objects of the directory contents::
>>> p = Path('docs')
>>> for child in p.iterdir(): child
... PosixPath('docs/conf.py')
PosixPath('docs/_templates')
PosixPath('docs/make.bat')
PosixPath('docs/index.rst')
PosixPath('docs/_build')
PosixPath('docs/_static')
PosixP... | When the path points to a directory, yield path objects of the directory contents::
>>> p = Path('docs')
>>> for child in p.iterdir(): child
... PosixPath('docs/conf.py')
PosixPath('docs/_templates')
PosixPath('docs/make.bat')
PosixPath('docs/index.rst')
PosixPath('docs/_build')
PosixPath('docs/_static')
PosixP... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a368224f-25e2-41fc-ae5a-f6c028424722 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,217 | supabase-export-v2 | bf6dbc2c0bf1c70c | >>> p = PurePath('/etc') >>> str(p) '/etc' >>> p = PureWindowsPath('c:/Program Files') >>> str(p) 'c:\\Program Files'
Similarly, calling :class:`bytes` on a path gives the raw filesystem path as a
bytes object, as encoded by :func:`os.fsencode`:: | trusted_official_docs | CPython Docs | >>> p = PurePath('/etc') >>> str(p) '/etc' >>> p = PureWindowsPath('c:/Program Files') >>> str(p) 'c:\\Program Files'
Similarly, calling :class:`bytes` on a path gives the raw filesystem path as a
bytes object, as encoded by :func:`os.fsencode`:: | >>> p = PurePath('/etc') >>> str(p) '/etc' >>> p = PureWindowsPath('c:/Program Files') >>> str(p) 'c:\\Program Files'
Similarly, calling :class:`bytes` on a path gives the raw filesystem path as a
bytes object, as encoded by :func:`os.fsencode`:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a3e3d64b-f454-4d09-b6f1-e25f9e4d9b78 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,522 | supabase-export-v2 | 6c6fccbdae2edbeb | Generate the file names in a directory tree by walking the tree either top-down or bottom-up.
For each directory in the directory tree rooted at *self* (including
*self* but excluding '.' and '..'), the method yields a 3-tuple of
``(dirpath, dirnames, filenames)``. | trusted_official_docs | CPython Docs | Generate the file names in a directory tree by walking the tree either top-down or bottom-up.
For each directory in the directory tree rooted at *self* (including
*self* but excluding '.' and '..'), the method yields a 3-tuple of
``(dirpath, dirnames, filenames)``. | Generate the file names in a directory tree by walking the tree either top-down or bottom-up.
For each directory in the directory tree rooted at *self* (including
*self* but excluding '.' and '..'), the method yields a 3-tuple of
``(dirpath, dirnames, filenames)``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a527a2b0-7333-4c65-9c0f-852d550afdc8 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,565 | supabase-export-v2 | 9e97c6c02b8955bb | If the source is a symlink and *follow_symlinks* is true (the default), the symlink's target is copied. Otherwise, the symlink is recreated at the destination.
If *preserve_metadata* is false (the default), only directory structures
and file data are guaranteed to be copied. Set *preserve_metadata* to true
to ensure ... | trusted_official_docs | CPython Docs | If the source is a symlink and *follow_symlinks* is true (the default), the symlink's target is copied. Otherwise, the symlink is recreated at the destination.
If *preserve_metadata* is false (the default), only directory structures
and file data are guaranteed to be copied. Set *preserve_metadata* to true
to ensure ... | If the source is a symlink and *follow_symlinks* is true (the default), the symlink's target is copied. Otherwise, the symlink is recreated at the destination.
If *preserve_metadata* is false (the default), only directory structures
and file data are guaranteed to be copied. Set *preserve_metadata* to true
to ensure ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a630cc8e-4f59-4a0a-91bc-a10793c1580a | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,641 | supabase-export-v2 | 2708f1991611a0ac | Below is a table mapping various :mod:`os` functions to their corresponding :class:`PurePath`/:class:`Path` equivalent.
===================================== ==============================================
:mod:`os` and :mod:`os.path` :mod:`!pathlib`
===================================== ================================... | trusted_official_docs | CPython Docs | Below is a table mapping various :mod:`os` functions to their corresponding :class:`PurePath`/:class:`Path` equivalent.
===================================== ==============================================
:mod:`os` and :mod:`os.path` :mod:`!pathlib`
===================================== ================================... | Below is a table mapping various :mod:`os` functions to their corresponding :class:`PurePath`/:class:`Path` equivalent.
===================================== ==============================================
:mod:`os` and :mod:`os.path` :mod:`!pathlib`
===================================== ================================... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a779154d-ff4b-483d-96e6-b5ca33cbf13e | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,634 | supabase-export-v2 | 19cb8cea6f111c5c | Many functions in :mod:`os` and :mod:`os.path` support ``bytes`` paths and :ref:`paths relative to directory descriptors <dir_fd>`. These features aren't available in pathlib.
Python's ``str`` and ``bytes`` types, and portions of the :mod:`os` and
:mod:`os.path` modules, are written in C and are very speedy. pathlib is... | trusted_official_docs | CPython Docs | Many functions in :mod:`os` and :mod:`os.path` support ``bytes`` paths and :ref:`paths relative to directory descriptors <dir_fd>`. These features aren't available in pathlib.
Python's ``str`` and ``bytes`` types, and portions of the :mod:`os` and
:mod:`os.path` modules, are written in C and are very speedy. pathlib is... | Many functions in :mod:`os` and :mod:`os.path` support ``bytes`` paths and :ref:`paths relative to directory descriptors <dir_fd>`. These features aren't available in pathlib.
Python's ``str`` and ``bytes`` types, and portions of the :mod:`os` and
:mod:`os.path` modules, are written in C and are very speedy. pathlib is... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
af22d514-cbdb-4c95-9365-c13db6842c12 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,510 | supabase-export-v2 | 013f9e5446741a95 | .. versionchanged:: 3.13 The *pattern* parameter accepts a :term:`path-like object`.
.. versionchanged:: 3.13
Any :exc:`OSError` exceptions raised from scanning the filesystem are
suppressed. In previous versions, such exceptions are suppressed in many
cases, but not all. | trusted_official_docs | CPython Docs | .. versionchanged:: 3.13 The *pattern* parameter accepts a :term:`path-like object`.
.. versionchanged:: 3.13
Any :exc:`OSError` exceptions raised from scanning the filesystem are
suppressed. In previous versions, such exceptions are suppressed in many
cases, but not all. | .. versionchanged:: 3.13 The *pattern* parameter accepts a :term:`path-like object`.
.. versionchanged:: 3.13
Any :exc:`OSError` exceptions raised from scanning the filesystem are
suppressed. In previous versions, such exceptions are suppressed in many
cases, but not all. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
af9b38f9-47c6-40bb-b9c1-68e8bfd150a4 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,564 | supabase-export-v2 | e7827542699461e0 | Copy this file or directory tree to the given *target*, and return a new :class:`!Path` instance pointing to *target*.
If the source is a file, the target will be replaced if it is an existing
file. If the source is a symlink and *follow_symlinks* is true (the
default), the symlink's target is copied. Otherwise, the ... | trusted_official_docs | CPython Docs | Copy this file or directory tree to the given *target*, and return a new :class:`!Path` instance pointing to *target*.
If the source is a file, the target will be replaced if it is an existing
file. If the source is a symlink and *follow_symlinks* is true (the
default), the symlink's target is copied. Otherwise, the ... | Copy this file or directory tree to the given *target*, and return a new :class:`!Path` instance pointing to *target*.
If the source is a file, the target will be replaced if it is an existing
file. If the source is a symlink and *follow_symlinks* is true (the
default), the symlink's target is copied. Otherwise, the ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b1dc755c-ba3c-465c-9e9c-85e16ac3ce5b | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,457 | supabase-export-v2 | 8696a7d2c97eecac | .. method:: Path.samefile(other_path)
Return whether this path points to the same file as *other_path*, which
can be either a Path object, or a string. The semantics are similar
to :func:`os.path.samefile` and :func:`os.path.samestat`. | trusted_official_docs | CPython Docs | .. method:: Path.samefile(other_path)
Return whether this path points to the same file as *other_path*, which
can be either a Path object, or a string. The semantics are similar
to :func:`os.path.samefile` and :func:`os.path.samestat`. | .. method:: Path.samefile(other_path)
Return whether this path points to the same file as *other_path*, which
can be either a Path object, or a string. The semantics are similar
to :func:`os.path.samefile` and :func:`os.path.samestat`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b2a9ec06-cbc4-47e3-9e68-536f15b85a1f | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,514 | supabase-export-v2 | af3f213bffbcb748 | .. note:: The paths are returned in no particular order. If you need a specific order, sort the results.
.. note::
Any :exc:`OSError` exceptions raised from scanning the filesystem are
suppressed. This includes :exc:`PermissionError` when accessing
directories without read permission. | trusted_official_docs | CPython Docs | .. note:: The paths are returned in no particular order. If you need a specific order, sort the results.
.. note::
Any :exc:`OSError` exceptions raised from scanning the filesystem are
suppressed. This includes :exc:`PermissionError` when accessing
directories without read permission. | .. note:: The paths are returned in no particular order. If you need a specific order, sort the results.
.. note::
Any :exc:`OSError` exceptions raised from scanning the filesystem are
suppressed. This includes :exc:`PermissionError` when accessing
directories without read permission. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b48c6652-24eb-4eeb-baff-731aacade9e7 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,618 | supabase-export-v2 | 26a04020cfcff30a | The following wildcards are supported in patterns for :meth:`~PurePath.full_match`, :meth:`~Path.glob` and :meth:`~Path.rglob`:
``**`` (entire segment)
Matches any number of file or directory segments, including zero. ``*`` (entire segment)
Matches one file or directory segment. ``*`` (part of a segment)
Matches any... | trusted_official_docs | CPython Docs | The following wildcards are supported in patterns for :meth:`~PurePath.full_match`, :meth:`~Path.glob` and :meth:`~Path.rglob`:
``**`` (entire segment)
Matches any number of file or directory segments, including zero. ``*`` (entire segment)
Matches one file or directory segment. ``*`` (part of a segment)
Matches any... | The following wildcards are supported in patterns for :meth:`~PurePath.full_match`, :meth:`~Path.glob` and :meth:`~Path.rglob`:
``**`` (entire segment)
Matches any number of file or directory segments, including zero. ``*`` (entire segment)
Matches one file or directory segment. ``*`` (part of a segment)
Matches any... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b6460cb7-c414-4952-b8e6-7ae0531af4e9 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,362 | supabase-export-v2 | c6731e943815cd58 | (most recent call last): File "<stdin>", line 1, in <module> File "pathlib.py", line 798, in __new__ % (cls.__name__,)) UnsupportedOperation: cannot instantiate 'WindowsPath' on your system
Some concrete path methods can raise an :exc:`OSError` if a system call fails
(for example because the path doesn't exist). | trusted_official_docs | CPython Docs | (most recent call last): File "<stdin>", line 1, in <module> File "pathlib.py", line 798, in __new__ % (cls.__name__,)) UnsupportedOperation: cannot instantiate 'WindowsPath' on your system
Some concrete path methods can raise an :exc:`OSError` if a system call fails
(for example because the path doesn't exist). | (most recent call last): File "<stdin>", line 1, in <module> File "pathlib.py", line 798, in __new__ % (cls.__name__,)) UnsupportedOperation: cannot instantiate 'WindowsPath' on your system
Some concrete path methods can raise an :exc:`OSError` if a system call fails
(for example because the path doesn't exist). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b6fd685b-abef-4264-bdde-0ae99a1807bd | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,534 | supabase-export-v2 | d6972cc2a0ecbc08 | This example displays the number of bytes used by all files in each directory, while ignoring ``__pycache__`` directories::
from pathlib import Path
for root, dirs, files in Path("cpython/Lib/concurrent").walk(on_error=print):
print(
root,
"consumes",
sum((root / file).stat().st_size for file in files),
"bytes in... | trusted_official_docs | CPython Docs | This example displays the number of bytes used by all files in each directory, while ignoring ``__pycache__`` directories::
from pathlib import Path
for root, dirs, files in Path("cpython/Lib/concurrent").walk(on_error=print):
print(
root,
"consumes",
sum((root / file).stat().st_size for file in files),
"bytes in... | This example displays the number of bytes used by all files in each directory, while ignoring ``__pycache__`` directories::
from pathlib import Path
for root, dirs, files in Path("cpython/Lib/concurrent").walk(on_error=print):
print(
root,
"consumes",
sum((root / file).stat().st_size for file in files),
"bytes in... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b79de313-3bc6-4224-9218-5923e8b7f1dc | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,609 | supabase-export-v2 | 77947c21993dcbcf | Change the file mode and permissions, like :func:`os.chmod`.
This method normally follows symlinks. Some Unix flavours support changing
permissions on the symlink itself; on these platforms you may add the
argument ``follow_symlinks=False``, or use :meth:`~Path.lchmod`. | trusted_official_docs | CPython Docs | Change the file mode and permissions, like :func:`os.chmod`.
This method normally follows symlinks. Some Unix flavours support changing
permissions on the symlink itself; on these platforms you may add the
argument ``follow_symlinks=False``, or use :meth:`~Path.lchmod`. | Change the file mode and permissions, like :func:`os.chmod`.
This method normally follows symlinks. Some Unix flavours support changing
permissions on the symlink itself; on these platforms you may add the
argument ``follow_symlinks=False``, or use :meth:`~Path.lchmod`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b89e2aa4-38b3-46ef-99b1-3c8c2c27017f | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,654 | supabase-export-v2 | 615ca7539608d0d6 | symbolic link pointing to a directory; return ``False`` if the path is (or points to) any other kind of file, or if it doesn't exist.
If *follow_symlinks* is ``False``, return ``True`` only if the path
is a directory (without following symlinks); return ``False`` if the
path is any other kind of file, or if it doesn'... | trusted_official_docs | CPython Docs | symbolic link pointing to a directory; return ``False`` if the path is (or points to) any other kind of file, or if it doesn't exist.
If *follow_symlinks* is ``False``, return ``True`` only if the path
is a directory (without following symlinks); return ``False`` if the
path is any other kind of file, or if it doesn'... | symbolic link pointing to a directory; return ``False`` if the path is (or points to) any other kind of file, or if it doesn't exist.
If *follow_symlinks* is ``False``, return ``True`` only if the path
is a directory (without following symlinks); return ``False`` if the
path is any other kind of file, or if it doesn'... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ba1c5559-b94d-4978-9e60-03417ee1d982 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,445 | supabase-export-v2 | d8e198511c7b8129 | .. method:: Path.is_mount()
Return ``True`` if the path is a :dfn:`mount point`: a point in a
file system where a different file system has been mounted. On POSIX, the
function checks whether *path*'s parent, :file:`path/..`, is on a different
device than *path*, or whether :file:`path/..` and *path* point to the sa... | trusted_official_docs | CPython Docs | .. method:: Path.is_mount()
Return ``True`` if the path is a :dfn:`mount point`: a point in a
file system where a different file system has been mounted. On POSIX, the
function checks whether *path*'s parent, :file:`path/..`, is on a different
device than *path*, or whether :file:`path/..` and *path* point to the sa... | .. method:: Path.is_mount()
Return ``True`` if the path is a :dfn:`mount point`: a point in a
file system where a different file system has been mounted. On POSIX, the
function checks whether *path*'s parent, :file:`path/..`, is on a different
device than *path*, or whether :file:`path/..` and *path* point to the sa... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
baa0f589-a30e-4555-8569-d41720932c7f | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,440 | supabase-export-v2 | 545eb5b85c04cc5d | .. method:: Path.is_symlink()
Return ``True`` if the path points to a symbolic link, even if that symlink
is broken. ``False`` will be returned if the path is invalid, inaccessible
or missing, or if it points to something other than a symbolic link. Use
:meth:`Path.stat` to distinguish between these cases. | trusted_official_docs | CPython Docs | .. method:: Path.is_symlink()
Return ``True`` if the path points to a symbolic link, even if that symlink
is broken. ``False`` will be returned if the path is invalid, inaccessible
or missing, or if it points to something other than a symbolic link. Use
:meth:`Path.stat` to distinguish between these cases. | .. method:: Path.is_symlink()
Return ``True`` if the path points to a symbolic link, even if that symlink
is broken. ``False`` will be returned if the path is invalid, inaccessible
or missing, or if it points to something other than a symbolic link. Use
:meth:`Path.stat` to distinguish between these cases. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bb6856e6-c653-4fe0-9d76-64d0c08f44fa | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,572 | supabase-export-v2 | c6a7d01ff4bae683 | .. method:: Path.rename(target)
Rename this file or directory to the given *target*, and return a new
:class:`!Path` instance pointing to *target*. On Unix, if *target* exists
and is a file, it will be replaced silently if the user has permission. On Windows, if *target* exists, :exc:`FileExistsError` will be raised.... | trusted_official_docs | CPython Docs | .. method:: Path.rename(target)
Rename this file or directory to the given *target*, and return a new
:class:`!Path` instance pointing to *target*. On Unix, if *target* exists
and is a file, it will be replaced silently if the user has permission. On Windows, if *target* exists, :exc:`FileExistsError` will be raised.... | .. method:: Path.rename(target)
Rename this file or directory to the given *target*, and return a new
:class:`!Path` instance pointing to *target*. On Unix, if *target* exists
and is a file, it will be replaced silently if the user has permission. On Windows, if *target* exists, :exc:`FileExistsError` will be raised.... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bd4637c3-2cb1-4f03-8ca8-3cb1ee267043 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,651 | supabase-export-v2 | 44ccf4ca389d3b50 | Return ``True`` if the path is an existing file or directory, or any other kind of file; return ``False`` if the path doesn't exist.
If *follow_symlinks* is ``False``, return ``True`` for symlinks without
checking if their targets exist. | trusted_official_docs | CPython Docs | Return ``True`` if the path is an existing file or directory, or any other kind of file; return ``False`` if the path doesn't exist.
If *follow_symlinks* is ``False``, return ``True`` for symlinks without
checking if their targets exist. | Return ``True`` if the path is an existing file or directory, or any other kind of file; return ``False`` if the path doesn't exist.
If *follow_symlinks* is ``False``, return ``True`` for symlinks without
checking if their targets exist. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
befcd715-d25a-4439-9ed0-edaa08949843 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,208 | supabase-export-v2 | 5eb7fb0cbba5eb58 | >>> PurePosixPath('foo') == PurePosixPath('FOO') False >>> PureWindowsPath('foo') == PureWindowsPath('FOO') True >>> PureWindowsPath('FOO') in { PureWindowsPath('foo') } True >>> PureWindowsPath('C:') < PureWindowsPath('d:') True
Paths of a different flavour compare unequal and cannot be ordered:: | trusted_official_docs | CPython Docs | >>> PurePosixPath('foo') == PurePosixPath('FOO') False >>> PureWindowsPath('foo') == PureWindowsPath('FOO') True >>> PureWindowsPath('FOO') in { PureWindowsPath('foo') } True >>> PureWindowsPath('C:') < PureWindowsPath('d:') True
Paths of a different flavour compare unequal and cannot be ordered:: | >>> PurePosixPath('foo') == PurePosixPath('FOO') False >>> PureWindowsPath('foo') == PureWindowsPath('FOO') True >>> PureWindowsPath('FOO') in { PureWindowsPath('foo') } True >>> PureWindowsPath('C:') < PureWindowsPath('d:') True
Paths of a different flavour compare unequal and cannot be ordered:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bf502078-a90e-499f-b2dd-6d6e72ff1b76 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,505 | supabase-export-v2 | 5105e60b8884e5ee | the *recurse_symlinks* keyword-only argument is set to ``False``, this method follows symlinks except when expanding "``**``" wildcards. Set *recurse_symlinks* to ``True`` to always follow symlinks.
.. note::
Any :exc:`OSError` exceptions raised from scanning the filesystem are
suppressed. This includes :exc:`Permiss... | trusted_official_docs | CPython Docs | the *recurse_symlinks* keyword-only argument is set to ``False``, this method follows symlinks except when expanding "``**``" wildcards. Set *recurse_symlinks* to ``True`` to always follow symlinks.
.. note::
Any :exc:`OSError` exceptions raised from scanning the filesystem are
suppressed. This includes :exc:`Permiss... | the *recurse_symlinks* keyword-only argument is set to ``False``, this method follows symlinks except when expanding "``**``" wildcards. Set *recurse_symlinks* to ``True`` to always follow symlinks.
.. note::
Any :exc:`OSError` exceptions raised from scanning the filesystem are
suppressed. This includes :exc:`Permiss... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bf8b761c-4ebb-49e5-9db3-200e5fc4b005 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,190 | supabase-export-v2 | ba1c5baedcfc7ad8 | >>> PureWindowsPath('c:/Windows', '/Program Files') PureWindowsPath('c:/Program Files')
Spurious slashes and single dots are collapsed, but double dots (``'..'``)
and leading double slashes (``'//'``) are not, since this would change the
meaning of a path for various reasons (e.g. symbolic links, UNC paths):: | trusted_official_docs | CPython Docs | >>> PureWindowsPath('c:/Windows', '/Program Files') PureWindowsPath('c:/Program Files')
Spurious slashes and single dots are collapsed, but double dots (``'..'``)
and leading double slashes (``'//'``) are not, since this would change the
meaning of a path for various reasons (e.g. symbolic links, UNC paths):: | >>> PureWindowsPath('c:/Windows', '/Program Files') PureWindowsPath('c:/Program Files')
Spurious slashes and single dots are collapsed, but double dots (``'..'``)
and leading double slashes (``'//'``) are not, since this would change the
meaning of a path for various reasons (e.g. symbolic links, UNC paths):: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c2f3f233-1f1a-46f8-a4d1-a897ada5e8e8 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,583 | supabase-export-v2 | d5e8a9ad59dd95d4 | Move this file or directory tree to the given *target*, and return a new :class:`!Path` instance pointing to *target*.
If the *target* doesn't exist it will be created. If both this path and the
*target* are existing files, then the target is overwritten. If both paths
point to the same file or directory, or the *tar... | trusted_official_docs | CPython Docs | Move this file or directory tree to the given *target*, and return a new :class:`!Path` instance pointing to *target*.
If the *target* doesn't exist it will be created. If both this path and the
*target* are existing files, then the target is overwritten. If both paths
point to the same file or directory, or the *tar... | Move this file or directory tree to the given *target*, and return a new :class:`!Path` instance pointing to *target*.
If the *target* doesn't exist it will be created. If both this path and the
*target* are existing files, then the target is overwritten. If both paths
point to the same file or directory, or the *tar... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c33f7358-d771-4b89-b687-af50069626e3 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,526 | supabase-export-v2 | f15431f6f99fca15 | no effect on the behavior of :meth:`Path.walk` since the directories in *dirnames* have already been generated by the time *dirnames* is yielded to the caller.
By default, errors from :func:`os.scandir` are ignored. If the optional
argument *on_error* is specified, it should be a callable; it will be
called with one ... | trusted_official_docs | CPython Docs | no effect on the behavior of :meth:`Path.walk` since the directories in *dirnames* have already been generated by the time *dirnames* is yielded to the caller.
By default, errors from :func:`os.scandir` are ignored. If the optional
argument *on_error* is specified, it should be a callable; it will be
called with one ... | no effect on the behavior of :meth:`Path.walk` since the directories in *dirnames* have already been generated by the time *dirnames* is yielded to the caller.
By default, errors from :func:`os.scandir` are ignored. If the optional
argument *on_error* is specified, it should be a callable; it will be
called with one ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c6a8fc76-4c64-4f96-b00c-9fa3a8aca5f7 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,427 | supabase-export-v2 | 48359e2726b62603 | to an existing file or directory. ``False`` will be returned if the path is invalid, inaccessible or missing. Use :meth:`Path.stat` to distinguish between these cases.
This method normally follows symlinks; to check if a symlink exists, add
the argument ``follow_symlinks=False``. | trusted_official_docs | CPython Docs | to an existing file or directory. ``False`` will be returned if the path is invalid, inaccessible or missing. Use :meth:`Path.stat` to distinguish between these cases.
This method normally follows symlinks; to check if a symlink exists, add
the argument ``follow_symlinks=False``. | to an existing file or directory. ``False`` will be returned if the path is invalid, inaccessible or missing. Use :meth:`Path.stat` to distinguish between these cases.
This method normally follows symlinks; to check if a symlink exists, add
the argument ``follow_symlinks=False``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c937e9f2-5e5d-4bb9-86fd-1863d24316b4 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,657 | supabase-export-v2 | df4abe83ccb1734d | symbolic link pointing to a file; return ``False`` if the path is (or points to) a directory or other non-file, or if it doesn't exist.
If *follow_symlinks* is ``False``, return ``True`` only if the path
is a file (without following symlinks); return ``False`` if the path
is a directory or other non-file, or if it do... | trusted_official_docs | CPython Docs | symbolic link pointing to a file; return ``False`` if the path is (or points to) a directory or other non-file, or if it doesn't exist.
If *follow_symlinks* is ``False``, return ``True`` only if the path
is a file (without following symlinks); return ``False`` if the path
is a directory or other non-file, or if it do... | symbolic link pointing to a file; return ``False`` if the path is (or points to) a directory or other non-file, or if it doesn't exist.
If *follow_symlinks* is ``False``, return ``True`` only if the path
is a file (without following symlinks); return ``False`` if the path
is a directory or other non-file, or if it do... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dd9b10a0-0a9a-482b-b7be-a5029cfd4a8a | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,463 | supabase-export-v2 | 467046a65e09f40f | The object exposes methods that cache their results, which can help reduce the number of system calls needed when switching on file type. For example::
>>> p = Path('src')
>>> if p.info.is_symlink():
... print('symlink')
... elif p.info.is_dir():
... print('directory')
... elif p.info.exists():
... print('somethi... | trusted_official_docs | CPython Docs | The object exposes methods that cache their results, which can help reduce the number of system calls needed when switching on file type. For example::
>>> p = Path('src')
>>> if p.info.is_symlink():
... print('symlink')
... elif p.info.is_dir():
... print('directory')
... elif p.info.exists():
... print('somethi... | The object exposes methods that cache their results, which can help reduce the number of system calls needed when switching on file type. For example::
>>> p = Path('src')
>>> if p.info.is_symlink():
... print('symlink')
... elif p.info.is_dir():
... print('directory')
... elif p.info.exists():
... print('somethi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dda69251-78c8-4a22-96ad-89e9f58c225c | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,524 | supabase-export-v2 | f5d84c543e825ca2 | (which begins with *self*) to a file or directory in *dirpath*, do ``dirpath / name``. Whether or not the lists are sorted is file system-dependent.
If the optional argument *top_down* is true (which is the default), the triple for a
directory is generated before the triples for any of its subdirectories
(directories... | trusted_official_docs | CPython Docs | (which begins with *self*) to a file or directory in *dirpath*, do ``dirpath / name``. Whether or not the lists are sorted is file system-dependent.
If the optional argument *top_down* is true (which is the default), the triple for a
directory is generated before the triples for any of its subdirectories
(directories... | (which begins with *self*) to a file or directory in *dirpath*, do ``dirpath / name``. Whether or not the lists are sorted is file system-dependent.
If the optional argument *top_down* is true (which is the default), the triple for a
directory is generated before the triples for any of its subdirectories
(directories... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ddbe3b96-804c-41e0-8c78-f178e0505749 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,483 | supabase-export-v2 | e364d3b67e01b2e6 | Open the file pointed to in text mode, write *data* to it, and close the file::
>>> p = Path('my_text_file')
>>> p.write_text('Text file contents')
18
>>> p.read_text()
'Text file contents' | trusted_official_docs | CPython Docs | Open the file pointed to in text mode, write *data* to it, and close the file::
>>> p = Path('my_text_file')
>>> p.write_text('Text file contents')
18
>>> p.read_text()
'Text file contents' | Open the file pointed to in text mode, write *data* to it, and close the file::
>>> p = Path('my_text_file')
>>> p.write_text('Text file contents')
18
>>> p.read_text()
'Text file contents' | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
debb8589-ec1c-4365-b208-d54175116059 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,527 | supabase-export-v2 | a2b92aefec1a9962 | to continue the walk or re-raise it to stop the walk. Note that the filename is available as the ``filename`` attribute of the exception object.
By default, :meth:`Path.walk` does not follow symbolic links, and instead adds them
to the *filenames* list. Set *follow_symlinks* to true to resolve symlinks
and place them... | trusted_official_docs | CPython Docs | to continue the walk or re-raise it to stop the walk. Note that the filename is available as the ``filename`` attribute of the exception object.
By default, :meth:`Path.walk` does not follow symbolic links, and instead adds them
to the *filenames* list. Set *follow_symlinks* to true to resolve symlinks
and place them... | to continue the walk or re-raise it to stop the walk. Note that the filename is available as the ``filename`` attribute of the exception object.
By default, :meth:`Path.walk` does not follow symbolic links, and instead adds them
to the *filenames* list. Set *follow_symlinks* to true to resolve symlinks
and place them... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e08b0331-1db4-4669-aeba-f9c5cf96593c | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,191 | supabase-export-v2 | 983530b11bea69dd | (``'..'``) and leading double slashes (``'//'``) are not, since this would change the meaning of a path for various reasons (e.g. symbolic links, UNC paths)::
>>> PurePath('foo//bar')
PurePosixPath('foo/bar')
>>> PurePath('//foo/bar')
PurePosixPath('//foo/bar')
>>> PurePath('foo/./bar')
PurePosixPath('foo/bar')
>... | trusted_official_docs | CPython Docs | (``'..'``) and leading double slashes (``'//'``) are not, since this would change the meaning of a path for various reasons (e.g. symbolic links, UNC paths)::
>>> PurePath('foo//bar')
PurePosixPath('foo/bar')
>>> PurePath('//foo/bar')
PurePosixPath('//foo/bar')
>>> PurePath('foo/./bar')
PurePosixPath('foo/bar')
>... | (``'..'``) and leading double slashes (``'//'``) are not, since this would change the meaning of a path for various reasons (e.g. symbolic links, UNC paths)::
>>> PurePath('foo//bar')
PurePosixPath('foo/bar')
>>> PurePath('//foo/bar')
PurePosixPath('//foo/bar')
>>> PurePath('foo/./bar')
PurePosixPath('foo/bar')
>... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e39c61a4-7ad1-4e80-a68a-795408c6fc4b | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,569 | supabase-export-v2 | b35cf5e42dc80fdf | .. method:: Path.copy_into(target_dir, *, follow_symlinks=True, \ preserve_metadata=False)
Copy this file or directory tree into the given *target_dir*, which should
be an existing directory. Other arguments are handled identically to
:meth:`Path.copy`. Returns a new :class:`!Path` instance pointing to the
copy. | trusted_official_docs | CPython Docs | .. method:: Path.copy_into(target_dir, *, follow_symlinks=True, \ preserve_metadata=False)
Copy this file or directory tree into the given *target_dir*, which should
be an existing directory. Other arguments are handled identically to
:meth:`Path.copy`. Returns a new :class:`!Path` instance pointing to the
copy. | .. method:: Path.copy_into(target_dir, *, follow_symlinks=True, \ preserve_metadata=False)
Copy this file or directory tree into the given *target_dir*, which should
be an existing directory. Other arguments are handled identically to
:meth:`Path.copy`. Returns a new :class:`!Path` instance pointing to the
copy. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e43dcf75-2bf4-4a59-9d55-fae99110b4a7 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,426 | supabase-export-v2 | 9e023d8af64c7318 | .. method:: Path.exists(*, follow_symlinks=True)
Return ``True`` if the path points to an existing file or directory. ``False`` will be returned if the path is invalid, inaccessible or missing. Use :meth:`Path.stat` to distinguish between these cases. | trusted_official_docs | CPython Docs | .. method:: Path.exists(*, follow_symlinks=True)
Return ``True`` if the path points to an existing file or directory. ``False`` will be returned if the path is invalid, inaccessible or missing. Use :meth:`Path.stat` to distinguish between these cases. | .. method:: Path.exists(*, follow_symlinks=True)
Return ``True`` if the path points to an existing file or directory. ``False`` will be returned if the path is invalid, inaccessible or missing. Use :meth:`Path.stat` to distinguish between these cases. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e53abaae-42b6-48fb-a303-d662911c9e52 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,453 | supabase-export-v2 | 72fc8293f6def38f | .. method:: Path.is_block_device()
Return ``True`` if the path points to a block device. ``False`` will be
returned if the path is invalid, inaccessible or missing, or if it points
to something other than a block device. Use :meth:`Path.stat` to
distinguish between these cases. | trusted_official_docs | CPython Docs | .. method:: Path.is_block_device()
Return ``True`` if the path points to a block device. ``False`` will be
returned if the path is invalid, inaccessible or missing, or if it points
to something other than a block device. Use :meth:`Path.stat` to
distinguish between these cases. | .. method:: Path.is_block_device()
Return ``True`` if the path points to a block device. ``False`` will be
returned if the path is invalid, inaccessible or missing, or if it points
to something other than a block device. Use :meth:`Path.stat` to
distinguish between these cases. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e5f2c9bc-2177-494d-93dc-ca2086821395 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,604 | supabase-export-v2 | bc956d0681f5112e | Return the name of the group owning the file. :exc:`KeyError` is raised if the file's group identifier (GID) isn't found in the system database.
This method normally follows symlinks; to get the group of the symlink, add
the argument ``follow_symlinks=False``. | trusted_official_docs | CPython Docs | Return the name of the group owning the file. :exc:`KeyError` is raised if the file's group identifier (GID) isn't found in the system database.
This method normally follows symlinks; to get the group of the symlink, add
the argument ``follow_symlinks=False``. | Return the name of the group owning the file. :exc:`KeyError` is raised if the file's group identifier (GID) isn't found in the system database.
This method normally follows symlinks; to get the group of the symlink, add
the argument ``follow_symlinks=False``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e8cae03e-5a2e-4396-b679-dba5cca8ef7b | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,635 | supabase-export-v2 | cd9a9838b412984d | modules, are written in C and are very speedy. pathlib is written in pure Python and is often slower, but rarely slow enough to matter.
pathlib's path normalization is slightly more opinionated and consistent than
:mod:`os.path`. For example, whereas :func:`os.path.abspath` eliminates
"``..``" segments from a path, whi... | trusted_official_docs | CPython Docs | modules, are written in C and are very speedy. pathlib is written in pure Python and is often slower, but rarely slow enough to matter.
pathlib's path normalization is slightly more opinionated and consistent than
:mod:`os.path`. For example, whereas :func:`os.path.abspath` eliminates
"``..``" segments from a path, whi... | modules, are written in C and are very speedy. pathlib is written in pure Python and is often slower, but rarely slow enough to matter.
pathlib's path normalization is slightly more opinionated and consistent than
:mod:`os.path`. For example, whereas :func:`os.path.abspath` eliminates
"``..``" segments from a path, whi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e95ea6bb-1cd9-415c-b3dc-4c456db2cb9f | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,313 | supabase-export-v2 | 1213b81a1a8efd75 | Match this path against the provided non-recursive glob-style pattern. Return ``True`` if matching is successful, ``False`` otherwise.
This method is similar to :meth:`~PurePath.full_match`, but empty patterns
aren't allowed (:exc:`ValueError` is raised), the recursive wildcard
"``**``" isn't supported (it acts like ... | trusted_official_docs | CPython Docs | Match this path against the provided non-recursive glob-style pattern. Return ``True`` if matching is successful, ``False`` otherwise.
This method is similar to :meth:`~PurePath.full_match`, but empty patterns
aren't allowed (:exc:`ValueError` is raised), the recursive wildcard
"``**``" isn't supported (it acts like ... | Match this path against the provided non-recursive glob-style pattern. Return ``True`` if matching is successful, ``False`` otherwise.
This method is similar to :meth:`~PurePath.full_match`, but empty patterns
aren't allowed (:exc:`ValueError` is raised), the recursive wildcard
"``**``" isn't supported (it acts like ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eb8e2f8e-518c-45b0-acb1-340550c2edbe | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,183 | supabase-export-v2 | 82f9b9b818e0aa32 | a string representing a path segment, or an object implementing the :class:`os.PathLike` interface where the :meth:`~os.PathLike.__fspath__` method returns a string, such as another path object::
>>> PurePath('foo', 'some/path', 'bar')
PurePosixPath('foo/some/path/bar')
>>> PurePath(Path('foo'), Path('bar'))
PurePos... | trusted_official_docs | CPython Docs | a string representing a path segment, or an object implementing the :class:`os.PathLike` interface where the :meth:`~os.PathLike.__fspath__` method returns a string, such as another path object::
>>> PurePath('foo', 'some/path', 'bar')
PurePosixPath('foo/some/path/bar')
>>> PurePath(Path('foo'), Path('bar'))
PurePos... | a string representing a path segment, or an object implementing the :class:`os.PathLike` interface where the :meth:`~os.PathLike.__fspath__` method returns a string, such as another path object::
>>> PurePath('foo', 'some/path', 'bar')
PurePosixPath('foo/some/path/bar')
>>> PurePath(Path('foo'), Path('bar'))
PurePos... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ef5c4e74-d908-467a-9543-32d35693e49a | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,474 | supabase-export-v2 | 8ffe3a27bd21a977 | >>> p = Path('my_text_file') >>> p.write_text('Text file contents') 18 >>> p.read_text() 'Text file contents'
The file is opened and then closed. The optional parameters have the same
meaning as in :func:`open`. | trusted_official_docs | CPython Docs | >>> p = Path('my_text_file') >>> p.write_text('Text file contents') 18 >>> p.read_text() 'Text file contents'
The file is opened and then closed. The optional parameters have the same
meaning as in :func:`open`. | >>> p = Path('my_text_file') >>> p.write_text('Text file contents') 18 >>> p.read_text() 'Text file contents'
The file is opened and then closed. The optional parameters have the same
meaning as in :func:`open`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
efaf0402-36aa-4572-bde1-410a70eb4f98 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,625 | supabase-export-v2 | ed0f51ef7e503e41 | .. versionchanged:: 3.13 Globbing with a pattern that ends with "``**``" returns both files and directories. In previous versions, only directories were returned.
In :meth:`Path.glob` and :meth:`~Path.rglob`, a trailing slash may be added to
the pattern to match only directories. | trusted_official_docs | CPython Docs | .. versionchanged:: 3.13 Globbing with a pattern that ends with "``**``" returns both files and directories. In previous versions, only directories were returned.
In :meth:`Path.glob` and :meth:`~Path.rglob`, a trailing slash may be added to
the pattern to match only directories. | .. versionchanged:: 3.13 Globbing with a pattern that ends with "``**``" returns both files and directories. In previous versions, only directories were returned.
In :meth:`Path.glob` and :meth:`~Path.rglob`, a trailing slash may be added to
the pattern to match only directories. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
efdf0cef-f82e-4d53-8f6f-582ade9a5fc9 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,551 | supabase-export-v2 | deafd682a4162e46 | Make this path a symbolic link pointing to *target*.
On Windows, a symlink represents either a file or a directory, and does not
morph to the target dynamically. If the target is present, the type of the
symlink will be created to match. Otherwise, the symlink will be created
as a directory if *target_is_directory* ... | trusted_official_docs | CPython Docs | Make this path a symbolic link pointing to *target*.
On Windows, a symlink represents either a file or a directory, and does not
morph to the target dynamically. If the target is present, the type of the
symlink will be created to match. Otherwise, the symlink will be created
as a directory if *target_is_directory* ... | Make this path a symbolic link pointing to *target*.
On Windows, a symlink represents either a file or a directory, and does not
morph to the target dynamically. If the target is present, the type of the
symlink will be created to match. Otherwise, the symlink will be created
as a directory if *target_is_directory* ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f0caf40b-2b44-4df2-b14a-51b44bf3982a | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,449 | supabase-export-v2 | d1692bd648575f32 | .. method:: Path.is_socket()
Return ``True`` if the path points to a Unix socket. ``False`` will be
returned if the path is invalid, inaccessible or missing, or if it points
to something other than a Unix socket. Use :meth:`Path.stat` to
distinguish between these cases. | trusted_official_docs | CPython Docs | .. method:: Path.is_socket()
Return ``True`` if the path points to a Unix socket. ``False`` will be
returned if the path is invalid, inaccessible or missing, or if it points
to something other than a Unix socket. Use :meth:`Path.stat` to
distinguish between these cases. | .. method:: Path.is_socket()
Return ``True`` if the path points to a Unix socket. ``False`` will be
returned if the path is invalid, inaccessible or missing, or if it points
to something other than a Unix socket. Use :meth:`Path.stat` to
distinguish between these cases. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f0cf0bc5-d562-45cd-85a1-52454dbe5eb8 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,339 | supabase-export-v2 | 3dfc53ca463e74de | .. method:: PurePath.with_segments(*pathsegments)
Create a new path object of the same type by combining the given
*pathsegments*. This method is called whenever a derivative path is created,
such as from :attr:`parent` and :meth:`relative_to`. Subclasses may
override this method to pass information to derivative pa... | trusted_official_docs | CPython Docs | .. method:: PurePath.with_segments(*pathsegments)
Create a new path object of the same type by combining the given
*pathsegments*. This method is called whenever a derivative path is created,
such as from :attr:`parent` and :meth:`relative_to`. Subclasses may
override this method to pass information to derivative pa... | .. method:: PurePath.with_segments(*pathsegments)
Create a new path object of the same type by combining the given
*pathsegments*. This method is called whenever a derivative path is created,
such as from :attr:`parent` and :meth:`relative_to`. Subclasses may
override this method to pass information to derivative pa... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f145f46f-7d76-468d-ab10-459d153c80cd | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,580 | supabase-export-v2 | 7f52ea25871bf000 | The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, *not* the directory of the :class:`!Path` object.
.. versionchanged:: 3.8
Added return value, return the new :class:`!Path` instance. | trusted_official_docs | CPython Docs | The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, *not* the directory of the :class:`!Path` object.
.. versionchanged:: 3.8
Added return value, return the new :class:`!Path` instance. | The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, *not* the directory of the :class:`!Path` object.
.. versionchanged:: 3.8
Added return value, return the new :class:`!Path` instance. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f1b74708-3763-4d0a-aaac-fb723b38b17c | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,643 | supabase-export-v2 | f4d876bc315f4376 | .. rubric:: Footnotes
.. [1] :func:`os.path.relpath` calls :func:`~os.path.abspath` to make paths
absolute and remove "``..``" parts, whereas :meth:`PurePath.relative_to`
is a lexical operation that raises :exc:`ValueError` when its inputs'
anchors differ (e.g. if one path is absolute and the other relative.)
.. [2]... | trusted_official_docs | CPython Docs | .. rubric:: Footnotes
.. [1] :func:`os.path.relpath` calls :func:`~os.path.abspath` to make paths
absolute and remove "``..``" parts, whereas :meth:`PurePath.relative_to`
is a lexical operation that raises :exc:`ValueError` when its inputs'
anchors differ (e.g. if one path is absolute and the other relative.)
.. [2]... | .. rubric:: Footnotes
.. [1] :func:`os.path.relpath` calls :func:`~os.path.abspath` to make paths
absolute and remove "``..``" parts, whereas :meth:`PurePath.relative_to`
is a lexical operation that raises :exc:`ValueError` when its inputs'
anchors differ (e.g. if one path is absolute and the other relative.)
.. [2]... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f1c2a3c8-5e2d-48d4-82e6-08c0074bac79 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,633 | supabase-export-v2 | ab5e1d03c76477ec | functions that work with low-level ``str`` and ``bytes`` objects, which is a more *procedural* approach. Some users consider the object-oriented style to be more readable.
Many functions in :mod:`os` and :mod:`os.path` support ``bytes`` paths and
:ref:`paths relative to directory descriptors <dir_fd>`. These features a... | trusted_official_docs | CPython Docs | functions that work with low-level ``str`` and ``bytes`` objects, which is a more *procedural* approach. Some users consider the object-oriented style to be more readable.
Many functions in :mod:`os` and :mod:`os.path` support ``bytes`` paths and
:ref:`paths relative to directory descriptors <dir_fd>`. These features a... | functions that work with low-level ``str`` and ``bytes`` objects, which is a more *procedural* approach. Some users consider the object-oriented style to be more readable.
Many functions in :mod:`os` and :mod:`os.path` support ``bytes`` paths and
:ref:`paths relative to directory descriptors <dir_fd>`. These features a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f1ea4c40-77b2-45cf-89c9-bfd52d85f02b | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,314 | supabase-export-v2 | f670353a3cff552f | the recursive wildcard "``**``" isn't supported (it acts like non-recursive "``*``"), and if a relative pattern is provided, then matching is done from the right::
>>> PurePath('a/b.py').match('*.py')
True
>>> PurePath('/a/b/c.py').match('b/*.py')
True
>>> PurePath('/a/b/c.py').match('a/*.py')
False | trusted_official_docs | CPython Docs | the recursive wildcard "``**``" isn't supported (it acts like non-recursive "``*``"), and if a relative pattern is provided, then matching is done from the right::
>>> PurePath('a/b.py').match('*.py')
True
>>> PurePath('/a/b/c.py').match('b/*.py')
True
>>> PurePath('/a/b/c.py').match('a/*.py')
False | the recursive wildcard "``**``" isn't supported (it acts like non-recursive "``*``"), and if a relative pattern is provided, then matching is done from the right::
>>> PurePath('a/b.py').match('*.py')
True
>>> PurePath('/a/b/c.py').match('b/*.py')
True
>>> PurePath('/a/b/c.py').match('a/*.py')
False | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f251c33c-bb47-4ee7-a314-0aa296722880 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,319 | supabase-export-v2 | 81e74586d2a06598 | Compute a version of this path relative to the path represented by *other*. If it's impossible, :exc:`ValueError` is raised::
>>> p = PurePosixPath('/etc/passwd')
>>> p.relative_to('/')
PurePosixPath('etc/passwd')
>>> p.relative_to('/etc')
PurePosixPath('passwd')
>>> p.relative_to('/usr')
Traceback (most recent c... | trusted_official_docs | CPython Docs | Compute a version of this path relative to the path represented by *other*. If it's impossible, :exc:`ValueError` is raised::
>>> p = PurePosixPath('/etc/passwd')
>>> p.relative_to('/')
PurePosixPath('etc/passwd')
>>> p.relative_to('/etc')
PurePosixPath('passwd')
>>> p.relative_to('/usr')
Traceback (most recent c... | Compute a version of this path relative to the path represented by *other*. If it's impossible, :exc:`ValueError` is raised::
>>> p = PurePosixPath('/etc/passwd')
>>> p.relative_to('/')
PurePosixPath('etc/passwd')
>>> p.relative_to('/etc')
PurePosixPath('passwd')
>>> p.relative_to('/usr')
Traceback (most recent c... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f41bda1e-b19e-47cd-987e-4c6f96839c15 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,216 | supabase-export-v2 | 552474ca64cc3a05 | filesystem path itself (in native form, e.g. with backslashes under Windows), which you can pass to any function taking a file path as a string::
>>> p = PurePath('/etc')
>>> str(p)
'/etc'
>>> p = PureWindowsPath('c:/Program Files')
>>> str(p)
'c:\\Program Files' | trusted_official_docs | CPython Docs | filesystem path itself (in native form, e.g. with backslashes under Windows), which you can pass to any function taking a file path as a string::
>>> p = PurePath('/etc')
>>> str(p)
'/etc'
>>> p = PureWindowsPath('c:/Program Files')
>>> str(p)
'c:\\Program Files' | filesystem path itself (in native form, e.g. with backslashes under Windows), which you can pass to any function taking a file path as a string::
>>> p = PurePath('/etc')
>>> str(p)
'/etc'
>>> p = PureWindowsPath('c:/Program Files')
>>> str(p)
'c:\\Program Files' | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f4e00715-9fdf-47be-b4aa-374f1a7622f6 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,543 | supabase-export-v2 | 5e88fa54cfe2de08 | .. method:: Path.mkdir(mode=0o777, parents=False, exist_ok=False)
Create a new directory at this given path. If *mode* is given, it is
combined with the process's ``umask`` value to determine the file mode
and access flags. If the path already exists, :exc:`FileExistsError`
is raised. | trusted_official_docs | CPython Docs | .. method:: Path.mkdir(mode=0o777, parents=False, exist_ok=False)
Create a new directory at this given path. If *mode* is given, it is
combined with the process's ``umask`` value to determine the file mode
and access flags. If the path already exists, :exc:`FileExistsError`
is raised. | .. method:: Path.mkdir(mode=0o777, parents=False, exist_ok=False)
Create a new directory at this given path. If *mode* is given, it is
combined with the process's ``umask`` value to determine the file mode
and access flags. If the path already exists, :exc:`FileExistsError`
is raised. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f65f3836-61a8-4686-9ed3-a8ca6fc42b7a | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,624 | supabase-export-v2 | aab851b26a9089de | .. note:: Globbing with the "``**``" wildcard visits every directory in the tree. Large directory trees may take a long time to search.
.. versionchanged:: 3.13
Globbing with a pattern that ends with "``**``" returns both files and
directories. In previous versions, only directories were returned. | trusted_official_docs | CPython Docs | .. note:: Globbing with the "``**``" wildcard visits every directory in the tree. Large directory trees may take a long time to search.
.. versionchanged:: 3.13
Globbing with a pattern that ends with "``**``" returns both files and
directories. In previous versions, only directories were returned. | .. note:: Globbing with the "``**``" wildcard visits every directory in the tree. Large directory trees may take a long time to search.
.. versionchanged:: 3.13
Globbing with a pattern that ends with "``**``" returns both files and
directories. In previous versions, only directories were returned. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f8de6d6c-4784-47fc-bea2-14d356a1a022 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,376 | supabase-export-v2 | 4e1377404902b197 | .. versionadded:: 3.13
.. versionchanged:: 3.14
The URL authority is discarded if it matches the local hostname. Otherwise, if the authority isn't empty or ``localhost``, then on
Windows a UNC path is returned (as before), and on other platforms a
:exc:`ValueError` is raised. | trusted_official_docs | CPython Docs | .. versionadded:: 3.13
.. versionchanged:: 3.14
The URL authority is discarded if it matches the local hostname. Otherwise, if the authority isn't empty or ``localhost``, then on
Windows a UNC path is returned (as before), and on other platforms a
:exc:`ValueError` is raised. | .. versionadded:: 3.13
.. versionchanged:: 3.14
The URL authority is discarded if it matches the local hostname. Otherwise, if the authority isn't empty or ``localhost``, then on
Windows a UNC path is returned (as before), and on other platforms a
:exc:`ValueError` is raised. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f9f0f20d-22ce-425d-b7b8-1972d1c0ef45 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,592 | supabase-export-v2 | 51568fc7cfef0d59 | If *missing_ok* is false (the default), :exc:`FileNotFoundError` is raised if the path does not exist.
If *missing_ok* is true, :exc:`FileNotFoundError` exceptions will be
ignored (same behavior as the POSIX ``rm -f`` command). | trusted_official_docs | CPython Docs | If *missing_ok* is false (the default), :exc:`FileNotFoundError` is raised if the path does not exist.
If *missing_ok* is true, :exc:`FileNotFoundError` exceptions will be
ignored (same behavior as the POSIX ``rm -f`` command). | If *missing_ok* is false (the default), :exc:`FileNotFoundError` is raised if the path does not exist.
If *missing_ok* is true, :exc:`FileNotFoundError` exceptions will be
ignored (same behavior as the POSIX ``rm -f`` command). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fc81be05-980d-4cde-bbfb-f07a0e6d7599 | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,497 | supabase-export-v2 | b4ad8dc2d087951b | file is removed from or added to the directory after creating the iterator, it is unspecified whether a path object for that file is included.
If the path is not a directory or otherwise inaccessible, :exc:`OSError` is
raised. | trusted_official_docs | CPython Docs | file is removed from or added to the directory after creating the iterator, it is unspecified whether a path object for that file is included.
If the path is not a directory or otherwise inaccessible, :exc:`OSError` is
raised. | file is removed from or added to the directory after creating the iterator, it is unspecified whether a path object for that file is included.
If the path is not a directory or otherwise inaccessible, :exc:`OSError` is
raised. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fce33f45-e2d5-428e-a4ed-1d32a55ac77b | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,296 | supabase-export-v2 | cdce7621b74b0ab9 | This method is string-based; it neither accesses the filesystem nor treats "``..``" segments specially. The following code is equivalent:
>>> u = PurePath('/usr')
>>> u == p or u in p.parents
False | trusted_official_docs | CPython Docs | This method is string-based; it neither accesses the filesystem nor treats "``..``" segments specially. The following code is equivalent:
>>> u = PurePath('/usr')
>>> u == p or u in p.parents
False | This method is string-based; it neither accesses the filesystem nor treats "``..``" segments specially. The following code is equivalent:
>>> u = PurePath('/usr')
>>> u == p or u in p.parents
False | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fe782656-5dc3-46c3-a22c-c4e361f4218c | CPython Docs | file://datasets/cpython/Doc/library/pathlib.rst | unknown | 71847990-46b5-498d-9f52-51dcb5914631 | 27,322 | supabase-export-v2 | cdc9ecaabc50f78d | in relative_to raise ValueError(error_message.format(str(self), str(formatted))) ValueError: '/etc/passwd' is not on the same drive as 'foo' OR one path is relative and the other is absolute.
.. warning::
This function is part of :class:`PurePath` and works with strings. It does not check or access the underlying file... | trusted_official_docs | CPython Docs | in relative_to raise ValueError(error_message.format(str(self), str(formatted))) ValueError: '/etc/passwd' is not on the same drive as 'foo' OR one path is relative and the other is absolute.
.. warning::
This function is part of :class:`PurePath` and works with strings. It does not check or access the underlying file... | in relative_to raise ValueError(error_message.format(str(self), str(formatted))) ValueError: '/etc/passwd' is not on the same drive as 'foo' OR one path is relative and the other is absolute.
.. warning::
This function is part of :class:`PurePath` and works with strings. It does not check or access the underlying file... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
003abcd7-39ec-4c9c-ac55-e0fa4cf8e4f8 | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 28,206 | supabase-export-v2 | 471345d018a14ae9 | .. function:: check_warnings(*filters, quiet=True)
A convenience wrapper for :func:`warnings.catch_warnings` that makes it
easier to test that a warning was correctly raised. It is approximately
equivalent to calling ``warnings.catch_warnings(record=True)`` with
:meth:`warnings.simplefilter` set to ``always`` and wi... | trusted_official_docs | CPython Docs | .. function:: check_warnings(*filters, quiet=True)
A convenience wrapper for :func:`warnings.catch_warnings` that makes it
easier to test that a warning was correctly raised. It is approximately
equivalent to calling ``warnings.catch_warnings(record=True)`` with
:meth:`warnings.simplefilter` set to ``always`` and wi... | .. function:: check_warnings(*filters, quiet=True)
A convenience wrapper for :func:`warnings.catch_warnings` that makes it
easier to test that a warning was correctly raised. It is approximately
equivalent to calling ``warnings.catch_warnings(record=True)`` with
:meth:`warnings.simplefilter` set to ``always`` and wi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
02324d73-9dc6-4bb3-9c9e-25dce06a8ec6 | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 28,164 | supabase-export-v2 | 0959749300781377 | .. function:: import_fresh_module(name, fresh=(), blocked=(), deprecated=False)
This function imports and returns a fresh copy of the named Python module
by removing the named module from ``sys.modules`` before doing the import. Note that unlike :func:`reload`, the original module is not affected by
this operation. | trusted_official_docs | CPython Docs | .. function:: import_fresh_module(name, fresh=(), blocked=(), deprecated=False)
This function imports and returns a fresh copy of the named Python module
by removing the named module from ``sys.modules`` before doing the import. Note that unlike :func:`reload`, the original module is not affected by
this operation. | .. function:: import_fresh_module(name, fresh=(), blocked=(), deprecated=False)
This function imports and returns a fresh copy of the named Python module
by removing the named module from ``sys.modules`` before doing the import. Note that unlike :func:`reload`, the original module is not affected by
this operation. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
03155376-cde3-4204-9444-da1e10cc1daf | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 27,825 | supabase-export-v2 | 90cc566771788eeb | .. function:: findfile(filename, subdir=None)
Return the path to the file named *filename*. If no match is found
*filename* is returned. This does not equal a failure since it could be the
path to the file. | trusted_official_docs | CPython Docs | .. function:: findfile(filename, subdir=None)
Return the path to the file named *filename*. If no match is found
*filename* is returned. This does not equal a failure since it could be the
path to the file. | .. function:: findfile(filename, subdir=None)
Return the path to the file named *filename*. If no match is found
*filename* is returned. This does not equal a failure since it could be the
path to the file. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
06cf2318-6a9e-441a-81fc-ff5b9fdadbad | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 27,972 | supabase-export-v2 | 833f72c631b61774 | The module's public names (its API) are detected automatically based on whether they match the public name convention and were defined in *module*.
The *name_of_module* argument can specify (as a string or tuple thereof) what
module(s) an API could be defined in order to be detected as a public
API. One case for this... | trusted_official_docs | CPython Docs | The module's public names (its API) are detected automatically based on whether they match the public name convention and were defined in *module*.
The *name_of_module* argument can specify (as a string or tuple thereof) what
module(s) an API could be defined in order to be detected as a public
API. One case for this... | The module's public names (its API) are detected automatically based on whether they match the public name convention and were defined in *module*.
The *name_of_module* argument can specify (as a string or tuple thereof) what
module(s) an API could be defined in order to be detected as a public
API. One case for this... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
06ed84ab-b02b-4f21-93e7-5b15b53a0b8a | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 28,157 | supabase-export-v2 | fa45136bbe8f7a82 | Call :func:`os.unlink` on *filename*. As with :func:`rmdir`, on Windows platforms, this is wrapped with a wait loop that checks for the existence of the file.
:mod:`!test.support.import_helper` --- Utilities for import tests
================================================================= | trusted_official_docs | CPython Docs | Call :func:`os.unlink` on *filename*. As with :func:`rmdir`, on Windows platforms, this is wrapped with a wait loop that checks for the existence of the file.
:mod:`!test.support.import_helper` --- Utilities for import tests
================================================================= | Call :func:`os.unlink` on *filename*. As with :func:`rmdir`, on Windows platforms, this is wrapped with a wait loop that checks for the existence of the file.
:mod:`!test.support.import_helper` --- Utilities for import tests
================================================================= | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0b7ca22e-749e-49c5-b31b-e65854230729 | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 28,168 | supabase-export-v2 | ac101fe9125cca36 | modules named in the *fresh* and *blocked* parameters are saved before starting the import and then reinserted into ``sys.modules`` when the fresh import is complete.
Module and package deprecation messages are suppressed during this import
if *deprecated* is ``True``. | trusted_official_docs | CPython Docs | modules named in the *fresh* and *blocked* parameters are saved before starting the import and then reinserted into ``sys.modules`` when the fresh import is complete.
Module and package deprecation messages are suppressed during this import
if *deprecated* is ``True``. | modules named in the *fresh* and *blocked* parameters are saved before starting the import and then reinserted into ``sys.modules`` when the fresh import is complete.
Module and package deprecation messages are suppressed during this import
if *deprecated* is ``True``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0b9b7877-0f70-4d7c-8ed4-b98accdb95f8 | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 27,709 | supabase-export-v2 | 56496f51822af168 | :mod:`!test` with all resources except the ``audio`` and ``largefile`` resources. For a list of all resources and more command-line options, run :program:`python -m test -h`.
Some other ways to execute the regression tests depend on what platform the
tests are being executed on. On Unix, you can run :program:`make test... | trusted_official_docs | CPython Docs | :mod:`!test` with all resources except the ``audio`` and ``largefile`` resources. For a list of all resources and more command-line options, run :program:`python -m test -h`.
Some other ways to execute the regression tests depend on what platform the
tests are being executed on. On Unix, you can run :program:`make test... | :mod:`!test` with all resources except the ``audio`` and ``largefile`` resources. For a list of all resources and more command-line options, run :program:`python -m test -h`.
Some other ways to execute the regression tests depend on what platform the
tests are being executed on. On Unix, you can run :program:`make test... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0dfd1831-bb22-47ab-aee3-2d13e994ac3a | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 28,056 | supabase-export-v2 | 0b497be5c372efcf | will be compiled and added to the zip package. Return a tuple of the full zip path and the archive name for the zip file.
:mod:`!test.support.bytecode_helper` --- Support tools for testing correct bytecode generation
============================================================================================== | trusted_official_docs | CPython Docs | will be compiled and added to the zip package. Return a tuple of the full zip path and the archive name for the zip file.
:mod:`!test.support.bytecode_helper` --- Support tools for testing correct bytecode generation
============================================================================================== | will be compiled and added to the zip package. Return a tuple of the full zip path and the archive name for the zip file.
:mod:`!test.support.bytecode_helper` --- Support tools for testing correct bytecode generation
============================================================================================== | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0ec09d8d-9fb3-4e89-808f-56b9d9214844 | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 27,878 | supabase-export-v2 | 131d180608fee88b | Raise an :exc:`AssertionError` if the process exit code is not equal to *exitcode*.
If the process runs longer than *timeout* seconds (:data:`SHORT_TIMEOUT` by
default), kill the process and raise an :exc:`AssertionError`. The timeout
feature is not available on Windows. | trusted_official_docs | CPython Docs | Raise an :exc:`AssertionError` if the process exit code is not equal to *exitcode*.
If the process runs longer than *timeout* seconds (:data:`SHORT_TIMEOUT` by
default), kill the process and raise an :exc:`AssertionError`. The timeout
feature is not available on Windows. | Raise an :exc:`AssertionError` if the process exit code is not equal to *exitcode*.
If the process runs longer than *timeout* seconds (:data:`SHORT_TIMEOUT` by
default), kill the process and raise an :exc:`AssertionError`. The timeout
feature is not available on Windows. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
108a655e-f187-49cd-b211-9821849064a3 | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 28,028 | supabase-export-v2 | 8471c9303cd4a2d9 | Return ``True`` if ``sys.executable interpreter`` requires environment variables in order to be able to run at all.
This is designed to be used with ``@unittest.skipIf()`` to annotate tests
that need to use an ``assert_python*()`` function to launch an isolated
mode (``-I``) or no environment mode (``-E``) sub-interp... | trusted_official_docs | CPython Docs | Return ``True`` if ``sys.executable interpreter`` requires environment variables in order to be able to run at all.
This is designed to be used with ``@unittest.skipIf()`` to annotate tests
that need to use an ``assert_python*()`` function to launch an isolated
mode (``-I``) or no environment mode (``-E``) sub-interp... | Return ``True`` if ``sys.executable interpreter`` requires environment variables in order to be able to run at all.
This is designed to be used with ``@unittest.skipIf()`` to annotate tests
that need to use an ``assert_python*()`` function to launch an isolated
mode (``-I``) or no environment mode (``-E``) sub-interp... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
12f6a914-a0fb-41a8-b229-d6ecb243c02d | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 27,955 | supabase-export-v2 | 334f3a40095f3468 | directory of the package; *loader*, *standard_tests*, and *pattern* are the arguments expected by ``load_tests``. In simple cases, the test package's ``__init__.py`` can be the following::
import os
from test.support import load_package_tests | trusted_official_docs | CPython Docs | directory of the package; *loader*, *standard_tests*, and *pattern* are the arguments expected by ``load_tests``. In simple cases, the test package's ``__init__.py`` can be the following::
import os
from test.support import load_package_tests | directory of the package; *loader*, *standard_tests*, and *pattern* are the arguments expected by ``load_tests``. In simple cases, the test package's ``__init__.py`` can be the following::
import os
from test.support import load_package_tests | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
164c1e6b-621a-4751-9cb4-6a521332fd40 | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 27,741 | supabase-export-v2 | b06e7863d466ff9f | long enough to prevent test failure: it takes into account that the client and the server can run in different threads or even different processes.
The timeout should be long enough for :meth:`~socket.socket.connect`,
:meth:`~socket.socket.recv` and :meth:`~socket.socket.send` methods of
:class:`socket.socket`. | trusted_official_docs | CPython Docs | long enough to prevent test failure: it takes into account that the client and the server can run in different threads or even different processes.
The timeout should be long enough for :meth:`~socket.socket.connect`,
:meth:`~socket.socket.recv` and :meth:`~socket.socket.send` methods of
:class:`socket.socket`. | long enough to prevent test failure: it takes into account that the client and the server can run in different threads or even different processes.
The timeout should be long enough for :meth:`~socket.socket.connect`,
:meth:`~socket.socket.recv` and :meth:`~socket.socket.send` methods of
:class:`socket.socket`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
16b740f9-0f47-45a7-b63f-07ff00c9d621 | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 27,854 | supabase-export-v2 | c8090fb9e3c72442 | .. function:: gc_collect()
Force as many objects as possible to be collected. This is needed because
timely deallocation is not guaranteed by the garbage collector. This means
that ``__del__`` methods may be called later than expected and weakrefs
may remain alive for longer than expected. | trusted_official_docs | CPython Docs | .. function:: gc_collect()
Force as many objects as possible to be collected. This is needed because
timely deallocation is not guaranteed by the garbage collector. This means
that ``__del__`` methods may be called later than expected and weakrefs
may remain alive for longer than expected. | .. function:: gc_collect()
Force as many objects as possible to be collected. This is needed because
timely deallocation is not guaranteed by the garbage collector. This means
that ``__del__`` methods may be called later than expected and weakrefs
may remain alive for longer than expected. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
173740fa-1f76-4b3f-963f-0b283e40331c | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 27,690 | supabase-export-v2 | 5a896ddace12dc9c | many code paths as possible. Test where branching occurs and thus tailor input to make sure as many different paths through the code are taken.
* Add an explicit test for any bugs discovered for the tested code. This will
make sure that the error does not crop up again if the code is changed in the
future. | trusted_official_docs | CPython Docs | many code paths as possible. Test where branching occurs and thus tailor input to make sure as many different paths through the code are taken.
* Add an explicit test for any bugs discovered for the tested code. This will
make sure that the error does not crop up again if the code is changed in the
future. | many code paths as possible. Test where branching occurs and thus tailor input to make sure as many different paths through the code are taken.
* Add an explicit test for any bugs discovered for the tested code. This will
make sure that the error does not crop up again if the code is changed in the
future. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
17f69b59-0022-49c8-85ef-52215399676a | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 28,033 | supabase-export-v2 | 35b2745f4939342d | Set up the environment based on *env_vars* for running the interpreter in a subprocess. The values can include ``__isolated``, ``__cleanenv``, ``__cwd``, and ``TERM``.
.. versionchanged:: 3.9
The function no longer strips whitespaces from *stderr*. | trusted_official_docs | CPython Docs | Set up the environment based on *env_vars* for running the interpreter in a subprocess. The values can include ``__isolated``, ``__cleanenv``, ``__cwd``, and ``TERM``.
.. versionchanged:: 3.9
The function no longer strips whitespaces from *stderr*. | Set up the environment based on *env_vars* for running the interpreter in a subprocess. The values can include ``__isolated``, ``__cleanenv``, ``__cwd``, and ``TERM``.
.. versionchanged:: 3.9
The function no longer strips whitespaces from *stderr*. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
192e1697-cd04-4b3e-b68c-8b54d15b05ad | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 28,030 | supabase-export-v2 | 1f78c421f5d95c46 | happen when trying to run the standard library test suite from an interpreter that doesn't have an obvious home with Python's current home finding logic.
Setting :envvar:`PYTHONHOME` is one way to get most of the testsuite to run
in that situation. :envvar:`PYTHONPATH` or :envvar:`PYTHONUSERSITE` are
other common env... | trusted_official_docs | CPython Docs | happen when trying to run the standard library test suite from an interpreter that doesn't have an obvious home with Python's current home finding logic.
Setting :envvar:`PYTHONHOME` is one way to get most of the testsuite to run
in that situation. :envvar:`PYTHONPATH` or :envvar:`PYTHONUSERSITE` are
other common env... | happen when trying to run the standard library test suite from an interpreter that doesn't have an obvious home with Python's current home finding logic.
Setting :envvar:`PYTHONHOME` is one way to get most of the testsuite to run
in that situation. :envvar:`PYTHONPATH` or :envvar:`PYTHONUSERSITE` are
other common env... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1b7847b8-f9e3-41d9-9b5e-144c70be4bad | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 27,935 | supabase-export-v2 | f068eb15ea88be44 | .. function:: linked_to_musl()
Return ``False`` if there is no evidence the interpreter was compiled with
``musl``, otherwise return a version triple, either ``(0, 0, 0)`` if the
version is unknown, or the actual version if it is known. Intended for use
in ``skip`` decorators. ``emscripten`` and ``wasi`` are assumed... | trusted_official_docs | CPython Docs | .. function:: linked_to_musl()
Return ``False`` if there is no evidence the interpreter was compiled with
``musl``, otherwise return a version triple, either ``(0, 0, 0)`` if the
version is unknown, or the actual version if it is known. Intended for use
in ``skip`` decorators. ``emscripten`` and ``wasi`` are assumed... | .. function:: linked_to_musl()
Return ``False`` if there is no evidence the interpreter was compiled with
``musl``, otherwise return a version triple, either ``(0, 0, 0)`` if the
version is unknown, or the actual version if it is known. Intended for use
in ``skip`` decorators. ``emscripten`` and ``wasi`` are assumed... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1bc14d65-bfbb-414d-92f5-bc9fbe79588d | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 27,947 | supabase-export-v2 | b315d106d439ebfd | Storing the exception value (``cm.unraisable.exc_value``) creates a reference cycle. The reference cycle is broken explicitly when the context manager exits.
Storing the object (``cm.unraisable.object``) can resurrect it if it is set
to an object which is being finalized. Exiting the context manager clears
the stored... | trusted_official_docs | CPython Docs | Storing the exception value (``cm.unraisable.exc_value``) creates a reference cycle. The reference cycle is broken explicitly when the context manager exits.
Storing the object (``cm.unraisable.object``) can resurrect it if it is set
to an object which is being finalized. Exiting the context manager clears
the stored... | Storing the exception value (``cm.unraisable.exc_value``) creates a reference cycle. The reference cycle is broken explicitly when the context manager exits.
Storing the object (``cm.unraisable.object``) can resurrect it if it is set
to an object which is being finalized. Exiting the context manager clears
the stored... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1e313273-f27c-47b7-aaa0-ee9d5becc690 | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 27,927 | supabase-export-v2 | 4e7e7a7cfe995117 | .. decorator:: refcount_test
Decorator for tests which involve reference counting. The decorator does
not run the test if it is not run by CPython. Any trace function is unset
for the duration of the test to prevent unexpected refcounts caused by
the trace function. | trusted_official_docs | CPython Docs | .. decorator:: refcount_test
Decorator for tests which involve reference counting. The decorator does
not run the test if it is not run by CPython. Any trace function is unset
for the duration of the test to prevent unexpected refcounts caused by
the trace function. | .. decorator:: refcount_test
Decorator for tests which involve reference counting. The decorator does
not run the test if it is not run by CPython. Any trace function is unset
for the duration of the test to prevent unexpected refcounts caused by
the trace function. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1ed5f0b3-5373-45d9-b8d1-bb5b83ec34c4 | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 27,978 | supabase-export-v2 | a1852897a2b86ffb | class MiscTestCase(unittest.TestCase): def test__all__(self): support.check__all__(self, foo)
class OtherTestCase(unittest.TestCase):
def test__all__(self):
extra = {'BAR_CONST', 'FOO_CONST'}
not_exported = {'baz'} # Undocumented name. # bar imports part of its API from _bar. support.check__all__(self, bar, ('bar', ... | trusted_official_docs | CPython Docs | class MiscTestCase(unittest.TestCase): def test__all__(self): support.check__all__(self, foo)
class OtherTestCase(unittest.TestCase):
def test__all__(self):
extra = {'BAR_CONST', 'FOO_CONST'}
not_exported = {'baz'} # Undocumented name. # bar imports part of its API from _bar. support.check__all__(self, bar, ('bar', ... | class MiscTestCase(unittest.TestCase): def test__all__(self): support.check__all__(self, foo)
class OtherTestCase(unittest.TestCase):
def test__all__(self):
extra = {'BAR_CONST', 'FOO_CONST'}
not_exported = {'baz'} # Undocumented name. # bar imports part of its API from _bar. support.check__all__(self, bar, ('bar', ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2346abba-02b1-446e-b824-5e0b66233285 | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 28,015 | supabase-export-v2 | 89f62473ebf68080 | .. function:: bind_port(sock, host=HOST)
Bind the socket to a free port and return the port number. Relies on
ephemeral ports in order to ensure we are using an unbound port. This is
important as many tests may be running simultaneously, especially in a
buildbot environment. This method raises an exception if the
`... | trusted_official_docs | CPython Docs | .. function:: bind_port(sock, host=HOST)
Bind the socket to a free port and return the port number. Relies on
ephemeral ports in order to ensure we are using an unbound port. This is
important as many tests may be running simultaneously, especially in a
buildbot environment. This method raises an exception if the
`... | .. function:: bind_port(sock, host=HOST)
Bind the socket to a free port and return the port number. Relies on
ephemeral ports in order to ensure we are using an unbound port. This is
important as many tests may be running simultaneously, especially in a
buildbot environment. This method raises an exception if the
`... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
25a4c7a1-edb4-40b9-a309-99af6153db82 | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 28,218 | supabase-export-v2 | 230e87376bc18b98 | as w: warnings.warn("foo") assert str(w.args[0]) == "foo" warnings.warn("bar") assert str(w.args[0]) == "bar" assert str(w.warnings[0].args[0]) == "foo" assert str(w.warnings[1].args[0]) == "bar" w.reset() assert len(w.warnings) == 0
Here all warnings will be caught, and the test code tests the captured
warnings direc... | trusted_official_docs | CPython Docs | as w: warnings.warn("foo") assert str(w.args[0]) == "foo" warnings.warn("bar") assert str(w.args[0]) == "bar" assert str(w.warnings[0].args[0]) == "foo" assert str(w.warnings[1].args[0]) == "bar" w.reset() assert len(w.warnings) == 0
Here all warnings will be caught, and the test code tests the captured
warnings direc... | as w: warnings.warn("foo") assert str(w.args[0]) == "foo" warnings.warn("bar") assert str(w.args[0]) == "bar" assert str(w.warnings[0].args[0]) == "foo" assert str(w.warnings[1].args[0]) == "bar" w.reset() assert len(w.warnings) == 0
Here all warnings will be caught, and the test code tests the captured
warnings direc... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
279be0e4-6a52-4cec-a1b4-4afbedfb5c9b | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 27,758 | supabase-export-v2 | 73ee6ab1b387d8d1 | be used to mark a test as failed if the test takes "too long". The timeout value depends on the regrtest ``--timeout`` command line option.
Its default value is 5 minutes. | trusted_official_docs | CPython Docs | be used to mark a test as failed if the test takes "too long". The timeout value depends on the regrtest ``--timeout`` command line option.
Its default value is 5 minutes. | be used to mark a test as failed if the test takes "too long". The timeout value depends on the regrtest ``--timeout`` command line option.
Its default value is 5 minutes. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
342392e4-7339-4f00-b662-576637d95e34 | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 27,806 | supabase-export-v2 | 3e90fb7f5b661e36 | Wait strategy that applies exponential backoff.
Run the loop body until ``break`` stops the loop. Sleep at each loop
iteration, but not at the first iteration. The sleep delay is doubled at
each iteration (up to *max_delay* seconds). | trusted_official_docs | CPython Docs | Wait strategy that applies exponential backoff.
Run the loop body until ``break`` stops the loop. Sleep at each loop
iteration, but not at the first iteration. The sleep delay is doubled at
each iteration (up to *max_delay* seconds). | Wait strategy that applies exponential backoff.
Run the loop body until ``break`` stops the loop. Sleep at each loop
iteration, but not at the first iteration. The sleep delay is doubled at
each iteration (up to *max_delay* seconds). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
342902e7-93d0-4f01-b287-887fd5ff7c34 | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 27,861 | supabase-export-v2 | 288bf426a58c5831 | with swap_attr(obj, "attr", 5): ...
This will set ``obj.attr`` to 5 for the duration of the ``with`` block,
restoring the old value at the end of the block. If ``attr`` doesn't
exist on ``obj``, it will be created and then deleted at the end of the
block. | trusted_official_docs | CPython Docs | with swap_attr(obj, "attr", 5): ...
This will set ``obj.attr`` to 5 for the duration of the ``with`` block,
restoring the old value at the end of the block. If ``attr`` doesn't
exist on ``obj``, it will be created and then deleted at the end of the
block. | with swap_attr(obj, "attr", 5): ...
This will set ``obj.attr`` to 5 for the duration of the ``with`` block,
restoring the old value at the end of the block. If ``attr`` doesn't
exist on ``obj``, it will be created and then deleted at the end of the
block. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
34364df0-5985-4ab7-9e86-a42254d3b512 | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 28,198 | supabase-export-v2 | ba59c7da9f7bff47 | Suppress warnings that are instances of *category*, which must be :exc:`Warning` or a subclass. Roughly equivalent to :func:`warnings.catch_warnings` with :meth:`warnings.simplefilter('ignore', category=category) <warnings.simplefilter>`. For example::
@warning_helper.ignore_warnings(category=DeprecationWarning)
def t... | trusted_official_docs | CPython Docs | Suppress warnings that are instances of *category*, which must be :exc:`Warning` or a subclass. Roughly equivalent to :func:`warnings.catch_warnings` with :meth:`warnings.simplefilter('ignore', category=category) <warnings.simplefilter>`. For example::
@warning_helper.ignore_warnings(category=DeprecationWarning)
def t... | Suppress warnings that are instances of *category*, which must be :exc:`Warning` or a subclass. Roughly equivalent to :func:`warnings.catch_warnings` with :meth:`warnings.simplefilter('ignore', category=category) <warnings.simplefilter>`. For example::
@warning_helper.ignore_warnings(category=DeprecationWarning)
def t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
358402f9-22a2-4415-95fd-7333e31f4f2b | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 28,013 | supabase-export-v2 | afb2b4b4de655cf0 | set to 0, eliciting an unused ephemeral port from the OS. The temporary socket is then closed and deleted, and the ephemeral port is returned.
Either this method or :func:`bind_port` should be used for any tests
where a server socket needs to be bound to a particular port for the
duration of the test. Which one to us... | trusted_official_docs | CPython Docs | set to 0, eliciting an unused ephemeral port from the OS. The temporary socket is then closed and deleted, and the ephemeral port is returned.
Either this method or :func:`bind_port` should be used for any tests
where a server socket needs to be bound to a particular port for the
duration of the test. Which one to us... | set to 0, eliciting an unused ephemeral port from the OS. The temporary socket is then closed and deleted, and the ephemeral port is returned.
Either this method or :func:`bind_port` should be used for any tests
where a server socket needs to be bound to a particular port for the
duration of the test. Which one to us... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
35cb8963-19cf-48a3-bfe3-381bd3765527 | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 27,974 | supabase-export-v2 | 2ef3df2da99f770f | wouldn't otherwise be automatically detected as "public", like objects without a proper :attr:`~definition.__module__` attribute. If provided, it will be added to the automatically detected ones.
The *not_exported* argument can be a set of names that must not be treated
as part of the public API even though their name... | trusted_official_docs | CPython Docs | wouldn't otherwise be automatically detected as "public", like objects without a proper :attr:`~definition.__module__` attribute. If provided, it will be added to the automatically detected ones.
The *not_exported* argument can be a set of names that must not be treated
as part of the public API even though their name... | wouldn't otherwise be automatically detected as "public", like objects without a proper :attr:`~definition.__module__` attribute. If provided, it will be added to the automatically detected ones.
The *not_exported* argument can be a set of names that must not be treated
as part of the public API even though their name... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3639670c-9a18-4e6c-bde4-e106de200193 | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 27,693 | supabase-export-v2 | 2b2346ed6fa50c98 | * If a test is dependent on a specific condition of the operating system then verify the condition already exists before attempting the test.
* Import as few modules as possible and do it as soon as possible. This
minimizes external dependencies of tests and also minimizes possible anomalous
behavior from side-effect... | trusted_official_docs | CPython Docs | * If a test is dependent on a specific condition of the operating system then verify the condition already exists before attempting the test.
* Import as few modules as possible and do it as soon as possible. This
minimizes external dependencies of tests and also minimizes possible anomalous
behavior from side-effect... | * If a test is dependent on a specific condition of the operating system then verify the condition already exists before attempting the test.
* Import as few modules as possible and do it as soon as possible. This
minimizes external dependencies of tests and also minimizes possible anomalous
behavior from side-effect... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
382b63a2-d6d2-4dd5-8b15-ef35c6f0fb7b | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 28,106 | supabase-export-v2 | 586229af632ed37e | .. data:: TESTFN_NONASCII
Set to a filename containing the :data:`FS_NONASCII` character, if it exists. This guarantees that if the filename exists, it can be encoded and decoded
with the default filesystem encoding. This allows tests that require a
non-ASCII filename to be easily skipped on platforms where they can'... | trusted_official_docs | CPython Docs | .. data:: TESTFN_NONASCII
Set to a filename containing the :data:`FS_NONASCII` character, if it exists. This guarantees that if the filename exists, it can be encoded and decoded
with the default filesystem encoding. This allows tests that require a
non-ASCII filename to be easily skipped on platforms where they can'... | .. data:: TESTFN_NONASCII
Set to a filename containing the :data:`FS_NONASCII` character, if it exists. This guarantees that if the filename exists, it can be encoded and decoded
with the default filesystem encoding. This allows tests that require a
non-ASCII filename to be easily skipped on platforms where they can'... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
388e7d17-09c7-4ae3-97ad-e432298d6629 | CPython Docs | file://datasets/cpython/Doc/library/test.rst | unknown | f2df259e-f066-4432-b4ea-d3a1246b3883 | 27,968 | supabase-export-v2 | 0b0e1dab699aefff | .. function:: missing_compiler_executable(cmd_names=[])
Check for the existence of the compiler executables whose names are listed
in *cmd_names* or all the compiler executables when *cmd_names* is empty
and return the first missing executable or ``None`` when none is found
missing. | trusted_official_docs | CPython Docs | .. function:: missing_compiler_executable(cmd_names=[])
Check for the existence of the compiler executables whose names are listed
in *cmd_names* or all the compiler executables when *cmd_names* is empty
and return the first missing executable or ``None`` when none is found
missing. | .. function:: missing_compiler_executable(cmd_names=[])
Check for the existence of the compiler executables whose names are listed
in *cmd_names* or all the compiler executables when *cmd_names* is empty
and return the first missing executable or ``None`` when none is found
missing. | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.