<commit_before>.. image:: images/header.svg
   :align: center
   :width: 400px

.. toctree::
    :hidden:
    :titlesonly:

    changelog
    tutorial
    api

.. currentmodule:: senf


What?
-----

**senf** makes filename handling easier by providing a set of filename
handling functions which work the same across all Python versions and
supported platforms. It also provides a print() function which can print all
filenames.

You can think of it as `six <https://pypi.org/project/six/>`__ for filename
handling.

It supports Python 2.6, 2.7, 3.3+, works with PyPy, works on Linux, Windows,
macOS and only depends on the stdlib.

::

    import os
    from senf import argv, print_

    for entry in os.listdir(argv[1]):
        print_(u"File: ", entry)

The above example prints wrongly encoded filenames on Unix and unicode
filenames on Windows.

**senf** does not monkey patch stdlib functions, it just provides alternatives
and wrappers.

See the :doc:`tutorial` or :doc:`api` for more details.


Who?
----

You might want to use senf if you

* use Python 2 and want to improve your Windows support
* use Python 2 and want to move (gradually) to Python 3
* have a library which needs to support both Python 2 and Python 3
* want to print filenames


How?
----

It introduces a virtual type called `fsnative` which actually represents

- :obj:`python:unicode`  under Py2 + Windows
- :obj:`python:str` under Py2 on other platforms
- :obj:`python3:str` under Py3 + Windows
- :obj:`python3:str` + ``surrogates`` under Py3 on other platforms [#]_<commit_msg>docs: add some links and the pypi name<commit_after>.. image:: images/header.svg
   :align: center
   :width: 400px

.. toctree::
    :hidden:
    :titlesonly:

    changelog
    tutorial
    api

.. currentmodule:: senf


What?
-----

**senf** makes filename handling easier by providing a set of filename
handling functions which work the same across all Python versions and
supported platforms. It also provides a print() function which can print all
filenames.

::

    pip install senf


You can think of it as `six <https://pypi.org/project/six/>`__ for filename
handling.

It supports Python 2.6, 2.7, 3.3+, works with PyPy, works on Linux, Windows,
macOS and only depends on the stdlib.

::

    import os
    from senf import argv, print_

    for entry in os.listdir(argv[1]):
        print_(u"File: ", entry)

The above example prints wrongly encoded filenames on Unix and unicode
filenames on Windows.

**senf** does not monkey patch stdlib functions, it just provides alternatives
and wrappers.

See the :doc:`tutorial` or :doc:`api` or `GitHub repo
<https://github.com/lazka/senf>`__ for more details.


Who?
----

You might want to use senf if you

* use Python 2 and want to improve your Windows support
* use Python 2 and want to move (gradually) to Python 3
* have a library which needs to support both Python 2 and Python 3
* want to print filenames


How?
----

It introduces a virtual type called `fsnative` which actually represents

- :obj:`python:unicode`  under Py2 + Windows
- :obj:`python:str` under Py2 on other platforms
- :obj:`python3:str` under Py3 + Windows
- :obj:`python3:str` + ``surrogates`` under Py3 on other platforms [#]_
{'fraction_non_alphanumeric': 0.09407016454517231, 'fraction_numerical': 0.013039428748835765, 'mean_word_length': 3.5767045454545454, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4175225', 'n_tokens_mistral': 1019, 'n_tokens_neox': 953, 'n_words': 432}