<commit_before>
pathlib
=======

.. module:: pathlib
   :synopsis: Object-oriented filesystem paths

.. moduleauthor:: <NAME> <<EMAIL>>

.. toctree::
   :maxdepth: 2


Manipulating filesystem paths as string objects can quickly become cumbersome:
multiple calls to :func:`os.path.join` or :func:`os.path.dirname`, etc.
This module offers a set of classes featuring all the common operations on
paths in an easy, object-oriented way.

This module is best used with Python 3.2 or later, but it is also compatible
with Python 2.7.  If using it with Python 3.3, you also have access to
optional ``openat``-based filesystem operations.


Download
--------

Releases are available on PyPI: http://pypi.python.org/pypi/pathlib/

The development repository and issue tracker can be found at BitBucket:
https://bitbucket.org/pitrou/pathlib/


Basic use
---------

Importing the module classes::

   >>> from pathlib import *

Listing Python source files in the current directory::

   >>> p = Path('.')
   >>> [x for x in p if x.ext == '.py']
   [PosixPath('test_pathlib.py'), PosixPath('setup.py'),
    PosixPath('pathlib.py')]

Listing subdirectories::

   >>> [x for x in p if x.is_dir()]
   [PosixPath('.hg'), PosixPath('docs'), PosixPath('dist'),
    PosixPath('__pycache__'), PosixPath('build')]

Navigating inside a directory tree::

   >>> p = Path('/etc')
   >>> q = p['init.d/reboot']
   >>> q
   PosixPath('/etc/init.d/reboot')
   >>> q.resolve()<commit_msg>Update summary at the top of the docs<commit_after>
pathlib
=======

.. module:: pathlib
   :synopsis: Object-oriented filesystem paths

.. moduleauthor:: <NAME> <<EMAIL>>

.. toctree::
   :maxdepth: 2


Manipulating filesystem paths as string objects can quickly become cumbersome:
multiple calls to :func:`os.path.join` or :func:`os.path.dirname`, etc.
This module offers a set of classes featuring all the common operations on
paths in an easy, object-oriented way.

This module is best used with Python 3.2 or later, but it is also compatible
with Python 2.7.  If using it with Python 3.3, you also have access to
optional ``openat``-based filesystem operations.


Download
--------

Releases are available on PyPI: http://pypi.python.org/pypi/pathlib/

The development repository and issue tracker can be found at BitBucket:
https://bitbucket.org/pitrou/pathlib/


Basic use
---------

Importing the module classes::

   >>> from pathlib import *

Listing subdirectories::

   >>> p = Path('.')
   >>> [x for x in p if x.is_dir()]
   [PosixPath('.hg'), PosixPath('docs'), PosixPath('dist'),
    PosixPath('__pycache__'), PosixPath('build')]

Listing Python source files in this directory tree::

    >>> list(p.glob('**/*.py'))
    [PosixPath('test_pathlib.py'), PosixPath('setup.py'),
     PosixPath('pathlib.py'), PosixPath('docs/conf.py'),
     PosixPath('build/lib/pathlib.py')]

Navigating inside a directory tree::

   >>> p = Path('/etc')
   >>> q = p['init.d/reboot']
   >>> q
   PosixPath('/etc/init.d/reboot')
   >>> q.resolve()
{'fraction_non_alphanumeric': 0.1521811521811522, 'fraction_numerical': 0.004662004662004662, 'mean_word_length': 3.7232704402515724, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 57, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3571258', 'n_tokens_mistral': 973, 'n_tokens_neox': 931, 'n_words': 317}