pnu-libpnu


Namepnu-libpnu JSON
Version 1.3.0 PyPI version JSON
download
home_pagehttps://github.com/HubTou/libpnu/
SummaryCommon utility functions for the PNU project
upload_time2024-03-14 00:40:25
maintainer
docs_urlNone
authorHubert Tournier
requires_python>=3.3
licenseBSD 3-Clause License
keywords pnu-project
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Installation
This library will be installed as a dependency by other PNU utilities.

# LibPNU(3)

## NAME
libpnu — Common utility functions for the PNU project

## SYNOPSIS
import **libpnu**

*libpnu*.**initialize_debugging**(String *program_name*)

*libpnu*.**handle_interrupt_signals**(Function *handler_function*)

*libpnu*.**interrupt_handler_function**(Int *signal_number*, FrameObject *current_stack_frame*)

String *libpnu*.**get_home_directory**()

String *libpnu*.**get_caching_directory**(String *name*)

List *libpnu*.**locate_directory**(String *directory*)

List *libpnu*.**load_strings_from_file**(String *filename*)

## DESCRIPTION
The **initialize_debugging()** function sets up the Python logging module with a syslog style kind of console log using *program_name* as the program name.
By default, the logging level is set at WARNING or more, but can be lowered by calling **logging.disable()**,
for example with the *logging.NOTSET* parameter to get DEBUG or more logging level.

The **handle_interrupt_signals()** function calls the specified *handler_function* to process the SIGINT and SIGPIPE signals,
usually to avoid an ugly trace dump to the console in case of interrupt (Control-C pressed or broken pipe).
If all you want is printing an "Interrupted" English message and exit your program,
then you can use the **interrupt_handler_function()** as the *handler_function*.

The **get_home_directory()** function returns the location of the user's home directory in a string
depending on the operating system used (Unix, Windows).

The **get_caching_directory()** function returns the location of a user writable directory for caching files in a string
depending on the operating system used (Unix, Windows).
The provided *name* will be the last directory part of this location.

The **locate_directory()** function searches the specified *directory* in a variety of possible other directories,
depending on the operating system used (Unix, Windows) and the fact that a package can be user or system installed.
It is intended to be used when the directory can't be directly found, and returns a list of paths where the directory searched has been found.

For example, if the argument is "/usr/local/etc/man.d", we'll search for "usr/local/etc/man.d", "local/etc/man.d", "etc/man.d" (more likely) and "man.d"
in a list of user's local Python package directories
("$HOME/.local" on Unix, "$APPDATA/python", "$HOMEPATH/appdata/roaming/python", "$USERPROFILE/appdata/roaming/python" on Windows)
and system wide Python package base directories (given by *sys.base_prefix*: "/usr/local" on Unix, "C:/Program Files/Python3x" on Windows).

The **load_strings_from_file()** function returns a list of strings from the given *filename*,
filtering out comments and empty lines (with '#' being the comment character),
and joining continued lines (those ending with a '\\' character).

## ENVIRONMENT
The following environment variables can be used to identify the user identity and home directory,
or find a caching directory.

On Unix: *HOME*, *LNAME*, *LOGNAME*, *TMP*, *TMPDIR*, *USER* and *USERNAME*.

On Windows: *APPDATA*, *HOME*, *HOMEPATH*, *LOCALAPPDATA*, *TMP* and *USERPROFILE*.

## STANDARDS
The **libpnu** library is not a standard UNIX one.

It tries to follow the [PEP 8](https://www.python.org/dev/peps/pep-0008/) style guide for [Python](https://www.python.org/) code.

## PORTABILITY
Tested OK under Windows.

Packaged for FreeBSD as *pyXX-pnu-libpnu*.

## HISTORY
This library was made for the [PNU project](https://github.com/HubTou/PNU).

## LICENSE
It is available under the [3-clause BSD license](https://opensource.org/licenses/BSD-3-Clause).

## AUTHORS
[Hubert Tournier](https://github.com/HubTou)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/HubTou/libpnu/",
    "name": "pnu-libpnu",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.3",
    "maintainer_email": "",
    "keywords": "pnu-project",
    "author": "Hubert Tournier",
    "author_email": "hubert.tournier@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/85/f0/839f6df3b3f6297181a5469198667723a8ea23285b7e8307138d19422f8a/pnu-libpnu-1.3.0.tar.gz",
    "platform": null,
    "description": "# Installation\nThis library will be installed as a dependency by other PNU utilities.\n\n# LibPNU(3)\n\n## NAME\nlibpnu \u2014 Common utility functions for the PNU project\n\n## SYNOPSIS\nimport **libpnu**\n\n*libpnu*.**initialize_debugging**(String *program_name*)\n\n*libpnu*.**handle_interrupt_signals**(Function *handler_function*)\n\n*libpnu*.**interrupt_handler_function**(Int *signal_number*, FrameObject *current_stack_frame*)\n\nString *libpnu*.**get_home_directory**()\n\nString *libpnu*.**get_caching_directory**(String *name*)\n\nList *libpnu*.**locate_directory**(String *directory*)\n\nList *libpnu*.**load_strings_from_file**(String *filename*)\n\n## DESCRIPTION\nThe **initialize_debugging()** function sets up the Python logging module with a syslog style kind of console log using *program_name* as the program name.\nBy default, the logging level is set at WARNING or more, but can be lowered by calling **logging.disable()**,\nfor example with the *logging.NOTSET* parameter to get DEBUG or more logging level.\n\nThe **handle_interrupt_signals()** function calls the specified *handler_function* to process the SIGINT and SIGPIPE signals,\nusually to avoid an ugly trace dump to the console in case of interrupt (Control-C pressed or broken pipe).\nIf all you want is printing an \"Interrupted\" English message and exit your program,\nthen you can use the **interrupt_handler_function()** as the *handler_function*.\n\nThe **get_home_directory()** function returns the location of the user's home directory in a string\ndepending on the operating system used (Unix, Windows).\n\nThe **get_caching_directory()** function returns the location of a user writable directory for caching files in a string\ndepending on the operating system used (Unix, Windows).\nThe provided *name* will be the last directory part of this location.\n\nThe **locate_directory()** function searches the specified *directory* in a variety of possible other directories,\ndepending on the operating system used (Unix, Windows) and the fact that a package can be user or system installed.\nIt is intended to be used when the directory can't be directly found, and returns a list of paths where the directory searched has been found.\n\nFor example, if the argument is \"/usr/local/etc/man.d\", we'll search for \"usr/local/etc/man.d\", \"local/etc/man.d\", \"etc/man.d\" (more likely) and \"man.d\"\nin a list of user's local Python package directories\n(\"$HOME/.local\" on Unix, \"$APPDATA/python\", \"$HOMEPATH/appdata/roaming/python\", \"$USERPROFILE/appdata/roaming/python\" on Windows)\nand system wide Python package base directories (given by *sys.base_prefix*: \"/usr/local\" on Unix, \"C:/Program Files/Python3x\" on Windows).\n\nThe **load_strings_from_file()** function returns a list of strings from the given *filename*,\nfiltering out comments and empty lines (with '#' being the comment character),\nand joining continued lines (those ending with a '\\\\' character).\n\n## ENVIRONMENT\nThe following environment variables can be used to identify the user identity and home directory,\nor find a caching directory.\n\nOn Unix: *HOME*, *LNAME*, *LOGNAME*, *TMP*, *TMPDIR*, *USER* and *USERNAME*.\n\nOn Windows: *APPDATA*, *HOME*, *HOMEPATH*, *LOCALAPPDATA*, *TMP* and *USERPROFILE*.\n\n## STANDARDS\nThe **libpnu** library is not a standard UNIX one.\n\nIt tries to follow the [PEP 8](https://www.python.org/dev/peps/pep-0008/) style guide for [Python](https://www.python.org/) code.\n\n## PORTABILITY\nTested OK under Windows.\n\nPackaged for FreeBSD as *pyXX-pnu-libpnu*.\n\n## HISTORY\nThis library was made for the [PNU project](https://github.com/HubTou/PNU).\n\n## LICENSE\nIt is available under the [3-clause BSD license](https://opensource.org/licenses/BSD-3-Clause).\n\n## AUTHORS\n[Hubert Tournier](https://github.com/HubTou)\n\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License",
    "summary": "Common utility functions for the PNU project",
    "version": "1.3.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/HubTou/libpnu/issues",
        "Homepage": "https://github.com/HubTou/libpnu/"
    },
    "split_keywords": [
        "pnu-project"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "edd80c54cb152baa4cc75757f329d547ae7a36549b425f2be016975612983065",
                "md5": "4451e225838abdcdd0321da5f8180f3f",
                "sha256": "a7e2669f41d5c2c1ae3cff39d33de6e8fab9dd0bc3f777efefc7f719201d70bd"
            },
            "downloads": -1,
            "filename": "pnu_libpnu-1.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4451e225838abdcdd0321da5f8180f3f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.3",
            "size": 8022,
            "upload_time": "2024-03-14T00:40:24",
            "upload_time_iso_8601": "2024-03-14T00:40:24.128720Z",
            "url": "https://files.pythonhosted.org/packages/ed/d8/0c54cb152baa4cc75757f329d547ae7a36549b425f2be016975612983065/pnu_libpnu-1.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "85f0839f6df3b3f6297181a5469198667723a8ea23285b7e8307138d19422f8a",
                "md5": "d23150abac5450696ff385a81189f697",
                "sha256": "07b2fcb04621fd15322520eed5e3adb09f10255788891ac5fb9ae207e0774509"
            },
            "downloads": -1,
            "filename": "pnu-libpnu-1.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d23150abac5450696ff385a81189f697",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.3",
            "size": 9192,
            "upload_time": "2024-03-14T00:40:25",
            "upload_time_iso_8601": "2024-03-14T00:40:25.867117Z",
            "url": "https://files.pythonhosted.org/packages/85/f0/839f6df3b3f6297181a5469198667723a8ea23285b7e8307138d19422f8a/pnu-libpnu-1.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-14 00:40:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "HubTou",
    "github_project": "libpnu",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pnu-libpnu"
}
        
Elapsed time: 9.35903s