imio.pyutils


Nameimio.pyutils JSON
Version 1.1.2 PyPI version JSON
download
home_pagehttps://github.com/imio/imio.pyutils/
SummarySome python useful methods
upload_time2024-12-19 13:48:38
maintainerNone
docs_urlNone
authorIMIO
requires_pythonNone
licenseGPL
keywords python imio
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://github.com/IMIO/imio.pyutils/actions/workflows/main.yml/badge.svg?branch=master
    :target: https://github.com/IMIO/imio.pyutils/actions/workflows/main.yml

.. image:: https://coveralls.io/repos/github/IMIO/imio.pyutils/badge.svg
    :target: https://coveralls.io/github/IMIO/imio.pyutils

.. image:: http://img.shields.io/pypi/v/imio.pyutils.svg
   :alt: PyPI badge
   :target: https://pypi.org/project/imio.pyutils

.. contents::

Introduction
============

This package provides python useful methods.

It relates to following kinds of operations:

1) System level operations (system.py)

It provides helper methods to:

* read and write files,
* read directories,
* execute commands,
* store and load list and dict,
* trace printing,
* creating temporary files,
* etc.

2) Various python helpers (utils.py)

About:

* ordereddict and dict manipulations
* list manipulations
* duration recording

3) BeautifulSoup methods (bs.py)

* remove elements
* remove attributes
* remove comments
* replace entire strings
* unwrap tags

4) Postgres level operations (postgres.py). It requires psycopg2 egg !

It provides helper methods to:

* single or multiple select,
* insert, update, delete rows,
* etc.

Tests
=====

Can be run with: `bin/python -m unittest discover`

Changelog
=========

1.1.2 (2024-12-19)
------------------

- Improved `batching.batch_delete_files`.
  [sgeulette]

1.1.1 (2024-09-18)
------------------

- Generated universal wheel version.
  [sgeulette]

1.1.0 (2024-09-17)
------------------

- Added `utils.add_key_if_value` to add a key in a dic only if value or is not None.
  [sgeulette]
- Moved `batching.batch_delete_files` from imio.helpers to be used commonly.
  [sgeulette]

1.0.4 (2024-06-11)
------------------

- Blacked files.
  [sgeulette]
- Added `system.post_request` to send a POST request.
  [sgeulette]

1.0.3 (2024-05-24)
------------------

- Fix bad release for python2.
  [aduchene]

1.0.2 (2024-05-15)
------------------

- Added a new helper `utils.get_ordinal_clusters` to cluster ordinal numbers based on an offset.
  [aduchene]

1.0.1 (2024-04-08)
------------------

- Added patterns parameter in `system.read_dir_filter`.
  [sgeulette]
- Returned original filename in `system.hashed_filename` if string to hash is empty.
  [sgeulette]

1.0.0 (2024-03-05)
------------------

- Require `six>=1.16.0`.
  [sgeulette]
- Added `system.hashed_filename` to get a new filename differentiated by a hashed string.
  [sgeulette]

1.0.0a1 (2024-02-08)
--------------------

- Handled set in `load_var`.
  [sgeulette]
- Added `load_pickle` and `dump_pickle`
  [sgeulette]
- Improved `bs.is_empty`
  [sgeulette]

1.0.0a (2023-11-28)
-------------------

- Made py2 and py3 compliant
  [sgeulette]
- Improved `utils_safe_encode`
  [sgeulette]
- Added `bs.is_empty` function.
  [sgeulette]
- Added `bs.remove_some_childrens` function.
  [sgeulette]
- Added `bs.replace_strings_by_pattern` function
  [sgeulette]
- Added `exclude_patterns` parameter in `system.read_recursive_dir`
  [sgeulette]

0.31 (2023-09-26)
-----------------

- Added `utils.listify` that will make sure a given value
  is always returned as list-like iterable.
  [gbastien]
- Improved `system.get_git_tag` with new parameter to get last tag from all branches
  [sgeulette]
- Added `utils.radix_like_starting_1` to get list of positional numbers following a given base but starting with 1
  [sgeulette]
- Added `utils.letters_sequence` to get a letters string corresponding to nth position
  [sgeulette]

0.30 (2023-07-24)
-----------------

- Added `system.read_recursive_dir` to get files recursively (with relative or full name).
  [sgeulette]

0.29 (2023-05-12)
-----------------

- Improved `utils.all_of_dict_values` to include optionally a label.
  [sgeulette]
- Added `setup_logger` to modify a given logger independently
  [sgeulette]
- Added `full_path` to prefix filename with path if necessary
  [sgeulette]

0.28 (2023-03-29)
-----------------

- Added `utils.one_of_dict_values` that gives the first non empty value of a list of keys.
  [sgeulette]
- Added `utils.all_of_dict_values` that returns a not empty values list from a dict following a keys list
  [sgeulette]

0.27 (2023-02-27)
-----------------

- Added `utils.sort_by_indexes` that will sort a list of values
  depending on a list of indexes.
  [gbastien]

0.26 (2022-12-12)
-----------------

- Added `stop` to print error and exit.
  [sgeulette]

0.25 (2022-09-16)
-----------------

- Added `get_git_tag`.
  [sgeulette]

0.24 (2022-08-19)
-----------------

- Added `utils.time_start` and `utils.time_elapsed` to print elapsed time from start.
  Intended to be easily used when debugging...
  [sgeulette]

0.23 (2022-07-01)
-----------------

- Added `utils.append` to append a value and return it.
  [sgeulette]

0.22 (2022-04-28)
-----------------

- Added `utils.get_clusters` to display a list of number grouped by clusters.
  [gbastien]

0.21 (2022-04-26)
-----------------

- Added `utils.merge_dicts` to be able to merge several dicts for which values
  are list, list are extended in final result.
  [gbastien]

0.20 (2022-02-10)
-----------------

- Modified `memory` to return more useful information.
  [sgeulette]

0.19 (2022-01-21)
-----------------

- Added `process_memory` to return current process memory.
  [sgeulette]
- Added `memory` to return RAM information.
  [sgeulette]

0.18 (2022-01-12)
-----------------

- Made `insert_in_ordereddict` python3 compatible.
  [sgeulette]
- Added `odict_pos_key` to get key at position in ordereddict.
  [sgeulette]

0.17 (2022-01-04)
-----------------

- Added `timed` and `ftimed` functions.
  [sgeulette]
- Added OrderedDict for load_var function
  [sgeulette]

0.16 (2021-10-27)
-----------------

- Added `iterable_as_list_of_list` function.
  [sgeulette]
- Added date in runCommand output
  [sgeulette]

0.15 (2021-04-27)
-----------------

- Added `ln_key` parameter in `read_dictcsv` method.
  [sgeulette]

0.14 (2021-04-21)
-----------------

- Added `read_dictcsv` function.
  [sgeulette]
- Added `utils.replace_in_list` function to ease replacement of values in a list.
  [gbastien]
- Added `safe_encode` function.
  [sgeulette]

0.13 (2020-10-07)
-----------------

- Added `insert_in_ordereddict` function to easier insert a new key at needed position.
  [sgeulette]

0.12 (2020-05-19)
-----------------

- Update syntax for py 3.
  [odelaere]

0.11 (2018-10-12)
-----------------

- Added warning log level function
  [odelaere]

0.10 (2018-07-23)
-----------------

- Added to_skip parameter in read_dir functions.
  [sgeulette]

0.9 (2017-07-28)
----------------

- Added read_csv function.
  [sgeulette]

0.8 (2017-07-19)
----------------

- runCommand can append to file.
  [sgeulette]

0.7 (2017-06-26)
----------------

- Just release on pypi for collective.documentgenerator.
  [sgeulette]

0.6 (2017-02-08)
----------------

- runCommand: return as third value the return code of the command.
  [sgeulette]

0.5 (2017-02-08)
----------------

- Added outfile parameter to runCommand.
  [sgeulette]

0.4 (2016-12-07)
----------------

- Added param to get only files in dir.
  [sgeulette]
- Added methods for bs4 (beautifulsoup)
  [sgeulette]

0.3 (2016-09-21)
----------------

- Return empty list when file doesn't exist.
  [sgeulette]

0.2 (2016-04-15)
----------------

- Added options on read_file.
  [sgeulette]

0.1 (2015-06-03)
----------------

- Initial release.
  [sgeulette]

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/imio/imio.pyutils/",
    "name": "imio.pyutils",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "Python IMIO",
    "author": "IMIO",
    "author_email": "support@imio.be",
    "download_url": "https://files.pythonhosted.org/packages/93/19/eb685198dec80fd067a0c2e4421c388519d2195fe4a4b48d0ba7fa9d51f2/imio_pyutils-1.1.2.tar.gz",
    "platform": null,
    "description": ".. image:: https://github.com/IMIO/imio.pyutils/actions/workflows/main.yml/badge.svg?branch=master\n    :target: https://github.com/IMIO/imio.pyutils/actions/workflows/main.yml\n\n.. image:: https://coveralls.io/repos/github/IMIO/imio.pyutils/badge.svg\n    :target: https://coveralls.io/github/IMIO/imio.pyutils\n\n.. image:: http://img.shields.io/pypi/v/imio.pyutils.svg\n   :alt: PyPI badge\n   :target: https://pypi.org/project/imio.pyutils\n\n.. contents::\n\nIntroduction\n============\n\nThis package provides python useful methods.\n\nIt relates to following kinds of operations:\n\n1) System level operations (system.py)\n\nIt provides helper methods to:\n\n* read and write files,\n* read directories,\n* execute commands,\n* store and load list and dict,\n* trace printing,\n* creating temporary files,\n* etc.\n\n2) Various python helpers (utils.py)\n\nAbout:\n\n* ordereddict and dict manipulations\n* list manipulations\n* duration recording\n\n3) BeautifulSoup methods (bs.py)\n\n* remove elements\n* remove attributes\n* remove comments\n* replace entire strings\n* unwrap tags\n\n4) Postgres level operations (postgres.py). It requires psycopg2 egg !\n\nIt provides helper methods to:\n\n* single or multiple select,\n* insert, update, delete rows,\n* etc.\n\nTests\n=====\n\nCan be run with: `bin/python -m unittest discover`\n\nChangelog\n=========\n\n1.1.2 (2024-12-19)\n------------------\n\n- Improved `batching.batch_delete_files`.\n  [sgeulette]\n\n1.1.1 (2024-09-18)\n------------------\n\n- Generated universal wheel version.\n  [sgeulette]\n\n1.1.0 (2024-09-17)\n------------------\n\n- Added `utils.add_key_if_value` to add a key in a dic only if value or is not None.\n  [sgeulette]\n- Moved `batching.batch_delete_files` from imio.helpers to be used commonly.\n  [sgeulette]\n\n1.0.4 (2024-06-11)\n------------------\n\n- Blacked files.\n  [sgeulette]\n- Added `system.post_request` to send a POST request.\n  [sgeulette]\n\n1.0.3 (2024-05-24)\n------------------\n\n- Fix bad release for python2.\n  [aduchene]\n\n1.0.2 (2024-05-15)\n------------------\n\n- Added a new helper `utils.get_ordinal_clusters` to cluster ordinal numbers based on an offset.\n  [aduchene]\n\n1.0.1 (2024-04-08)\n------------------\n\n- Added patterns parameter in `system.read_dir_filter`.\n  [sgeulette]\n- Returned original filename in `system.hashed_filename` if string to hash is empty.\n  [sgeulette]\n\n1.0.0 (2024-03-05)\n------------------\n\n- Require `six>=1.16.0`.\n  [sgeulette]\n- Added `system.hashed_filename` to get a new filename differentiated by a hashed string.\n  [sgeulette]\n\n1.0.0a1 (2024-02-08)\n--------------------\n\n- Handled set in `load_var`.\n  [sgeulette]\n- Added `load_pickle` and `dump_pickle`\n  [sgeulette]\n- Improved `bs.is_empty`\n  [sgeulette]\n\n1.0.0a (2023-11-28)\n-------------------\n\n- Made py2 and py3 compliant\n  [sgeulette]\n- Improved `utils_safe_encode`\n  [sgeulette]\n- Added `bs.is_empty` function.\n  [sgeulette]\n- Added `bs.remove_some_childrens` function.\n  [sgeulette]\n- Added `bs.replace_strings_by_pattern` function\n  [sgeulette]\n- Added `exclude_patterns` parameter in `system.read_recursive_dir`\n  [sgeulette]\n\n0.31 (2023-09-26)\n-----------------\n\n- Added `utils.listify` that will make sure a given value\n  is always returned as list-like iterable.\n  [gbastien]\n- Improved `system.get_git_tag` with new parameter to get last tag from all branches\n  [sgeulette]\n- Added `utils.radix_like_starting_1` to get list of positional numbers following a given base but starting with 1\n  [sgeulette]\n- Added `utils.letters_sequence` to get a letters string corresponding to nth position\n  [sgeulette]\n\n0.30 (2023-07-24)\n-----------------\n\n- Added `system.read_recursive_dir` to get files recursively (with relative or full name).\n  [sgeulette]\n\n0.29 (2023-05-12)\n-----------------\n\n- Improved `utils.all_of_dict_values` to include optionally a label.\n  [sgeulette]\n- Added `setup_logger` to modify a given logger independently\n  [sgeulette]\n- Added `full_path` to prefix filename with path if necessary\n  [sgeulette]\n\n0.28 (2023-03-29)\n-----------------\n\n- Added `utils.one_of_dict_values` that gives the first non empty value of a list of keys.\n  [sgeulette]\n- Added `utils.all_of_dict_values` that returns a not empty values list from a dict following a keys list\n  [sgeulette]\n\n0.27 (2023-02-27)\n-----------------\n\n- Added `utils.sort_by_indexes` that will sort a list of values\n  depending on a list of indexes.\n  [gbastien]\n\n0.26 (2022-12-12)\n-----------------\n\n- Added `stop` to print error and exit.\n  [sgeulette]\n\n0.25 (2022-09-16)\n-----------------\n\n- Added `get_git_tag`.\n  [sgeulette]\n\n0.24 (2022-08-19)\n-----------------\n\n- Added `utils.time_start` and `utils.time_elapsed` to print elapsed time from start.\n  Intended to be easily used when debugging...\n  [sgeulette]\n\n0.23 (2022-07-01)\n-----------------\n\n- Added `utils.append` to append a value and return it.\n  [sgeulette]\n\n0.22 (2022-04-28)\n-----------------\n\n- Added `utils.get_clusters` to display a list of number grouped by clusters.\n  [gbastien]\n\n0.21 (2022-04-26)\n-----------------\n\n- Added `utils.merge_dicts` to be able to merge several dicts for which values\n  are list, list are extended in final result.\n  [gbastien]\n\n0.20 (2022-02-10)\n-----------------\n\n- Modified `memory` to return more useful information.\n  [sgeulette]\n\n0.19 (2022-01-21)\n-----------------\n\n- Added `process_memory` to return current process memory.\n  [sgeulette]\n- Added `memory` to return RAM information.\n  [sgeulette]\n\n0.18 (2022-01-12)\n-----------------\n\n- Made `insert_in_ordereddict` python3 compatible.\n  [sgeulette]\n- Added `odict_pos_key` to get key at position in ordereddict.\n  [sgeulette]\n\n0.17 (2022-01-04)\n-----------------\n\n- Added `timed` and `ftimed` functions.\n  [sgeulette]\n- Added OrderedDict for load_var function\n  [sgeulette]\n\n0.16 (2021-10-27)\n-----------------\n\n- Added `iterable_as_list_of_list` function.\n  [sgeulette]\n- Added date in runCommand output\n  [sgeulette]\n\n0.15 (2021-04-27)\n-----------------\n\n- Added `ln_key` parameter in `read_dictcsv` method.\n  [sgeulette]\n\n0.14 (2021-04-21)\n-----------------\n\n- Added `read_dictcsv` function.\n  [sgeulette]\n- Added `utils.replace_in_list` function to ease replacement of values in a list.\n  [gbastien]\n- Added `safe_encode` function.\n  [sgeulette]\n\n0.13 (2020-10-07)\n-----------------\n\n- Added `insert_in_ordereddict` function to easier insert a new key at needed position.\n  [sgeulette]\n\n0.12 (2020-05-19)\n-----------------\n\n- Update syntax for py 3.\n  [odelaere]\n\n0.11 (2018-10-12)\n-----------------\n\n- Added warning log level function\n  [odelaere]\n\n0.10 (2018-07-23)\n-----------------\n\n- Added to_skip parameter in read_dir functions.\n  [sgeulette]\n\n0.9 (2017-07-28)\n----------------\n\n- Added read_csv function.\n  [sgeulette]\n\n0.8 (2017-07-19)\n----------------\n\n- runCommand can append to file.\n  [sgeulette]\n\n0.7 (2017-06-26)\n----------------\n\n- Just release on pypi for collective.documentgenerator.\n  [sgeulette]\n\n0.6 (2017-02-08)\n----------------\n\n- runCommand: return as third value the return code of the command.\n  [sgeulette]\n\n0.5 (2017-02-08)\n----------------\n\n- Added outfile parameter to runCommand.\n  [sgeulette]\n\n0.4 (2016-12-07)\n----------------\n\n- Added param to get only files in dir.\n  [sgeulette]\n- Added methods for bs4 (beautifulsoup)\n  [sgeulette]\n\n0.3 (2016-09-21)\n----------------\n\n- Return empty list when file doesn't exist.\n  [sgeulette]\n\n0.2 (2016-04-15)\n----------------\n\n- Added options on read_file.\n  [sgeulette]\n\n0.1 (2015-06-03)\n----------------\n\n- Initial release.\n  [sgeulette]\n",
    "bugtrack_url": null,
    "license": "GPL",
    "summary": "Some python useful methods",
    "version": "1.1.2",
    "project_urls": {
        "Homepage": "https://github.com/imio/imio.pyutils/",
        "PyPI": "https://pypi.python.org/pypi/imio.pyutils",
        "Source": "https://github.com/imio/imio.pyutils"
    },
    "split_keywords": [
        "python",
        "imio"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dd5c2c33b853fa5aea2d4e0797b406405e1f60ad18d1914a0af233fd2a0ce231",
                "md5": "0085dec4366576ef2b6346734aad9d73",
                "sha256": "7564cc889be92694ac63f5bab5669ab9d388d989aa955aec5966acdcd63b14e6"
            },
            "downloads": -1,
            "filename": "imio.pyutils-1.1.2-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0085dec4366576ef2b6346734aad9d73",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 18731,
            "upload_time": "2024-12-19T13:48:36",
            "upload_time_iso_8601": "2024-12-19T13:48:36.192867Z",
            "url": "https://files.pythonhosted.org/packages/dd/5c/2c33b853fa5aea2d4e0797b406405e1f60ad18d1914a0af233fd2a0ce231/imio.pyutils-1.1.2-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9319eb685198dec80fd067a0c2e4421c388519d2195fe4a4b48d0ba7fa9d51f2",
                "md5": "2dda3afbf0089f0004fd80de73899733",
                "sha256": "c8a7df496991b3d24f37ab6bd2053db363c9456f0904942545c9d395ff354eb0"
            },
            "downloads": -1,
            "filename": "imio_pyutils-1.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "2dda3afbf0089f0004fd80de73899733",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 20220,
            "upload_time": "2024-12-19T13:48:38",
            "upload_time_iso_8601": "2024-12-19T13:48:38.422810Z",
            "url": "https://files.pythonhosted.org/packages/93/19/eb685198dec80fd067a0c2e4421c388519d2195fe4a4b48d0ba7fa9d51f2/imio_pyutils-1.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-19 13:48:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "imio",
    "github_project": "imio.pyutils",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "imio.pyutils"
}
        
Elapsed time: 0.40094s