Path.py

Latest version: v12.5.0

Safety actively analyzes 630217 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 10 of 11

5.1

---

- 53: Added ``path.in_place`` for editing files in place.

5.0

---

- ``path.fnmatch`` now takes an optional parameter ``normcase`` and this
parameter defaults to self.module.normcase (using case normalization most
pertinent to the path object itself). Note that this change means that
any paths using a custom ntpath module on non-Windows systems will have
different fnmatch behavior. Before::

on Unix
>>> p = path('Foo')
>>> p.module = ntpath
>>> p.fnmatch('foo')
False

After::

on any OS
>>> p = path('Foo')
>>> p.module = ntpath
>>> p.fnmatch('foo')
True

To maintain the original behavior, either don't define the 'module' for the
path or supply explicit normcase function::

>>> p.fnmatch('foo', normcase=os.path.normcase)
result always varies based on OS, same as fnmatch.fnmatch

For most use-cases, the default behavior should remain the same.

- Issue 50: Methods that accept patterns (``listdir``, ``files``, ``dirs``,
``walk``, ``walkdirs``, ``walkfiles``, and ``fnmatch``) will now use a
``normcase`` attribute if it is present on the ``pattern`` parameter. The
path module now provides a ``CaseInsensitivePattern`` wrapper for strings
suitable for creating case-insensitive patterns for those methods.

4.4

---

- Issue 44: _hash method would open files in text mode, producing
invalid results on Windows. Now files are opened in binary mode, producing
consistent results.
- Issue 47: Documentation is dramatically improved with Intersphinx links
to the Python os.path functions and documentation for all methods and
properties.

4.3

---

- Issue 32: Add ``chdir`` and ``cd`` methods.

4.2

---

- ``open()`` now passes all positional and keyword arguments through to the
underlying ``builtins.open`` call.

4.1

---

- Native Python 2 and Python 3 support without using 2to3 during the build
process.

Page 10 of 11

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.