remove_hairs
Function form removing characters from both sides of string.
Documentation
There is just one function remove_hairs() and one decorator remove_hairs_decorator().
remove_hairs()
This function is useful, when you have string and you need to remove some characters from both sides of the string.
>>> from remove_hairs import remove_hairs
>>> remove_hairs(",a-sd,-/")
'a-sd'
By default, the function uses set of characters defined in .HAIRS, which is defined as /:;,- []<>(). You can change that using hairs parameter:
>>> remove_hairs(" - a sd: --", " -")
'a sd:'
remove_hairs_decorator()
As the name say, remove_hairs_decorator() is just decorator for remove_hairs():
@remove_hairs_decorator
def x():
return ",a-sd,-/"
assert x() == "a-sd"
Or with hairs parameter:
@remove_hairs_decorator(hairs=" -")
def y():
return " - a sd: --"
assert y() == "a sd:"
Installation
The code is hosted at PYPI, and you can easily install it using the following command:
sudo pip install remove_hairs
Testing
This project uses py.test for testing. Just run py.test from the root of the project:
$ py.test ============================= test session starts ============================== platform linux2 -- Python 2.7.6 -- py-1.4.26 -- pytest-2.6.4 collected 2 items tests/test_remove_hairs.py .. =========================== 2 passed in 0.02 seconds ===========================
Changelog
1.0.1
Fixed setup.py.
1.0.0
Project created.
Metadata
Release files for remove_hairs 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| remove_hairs-1.0.1.tar.gz | 4.1 kB | Without provenance | Details for remove_hairs-1.0.1.tar.gz |
Release files / remove_hairs-1.0.1.tar.gz
| Download URL | remove_hairs-1.0.1.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2921c1cbb28c37615e1105b0319c09514400bb53ee61b4b74901898d47747a10
|
|
BLAKE2b-256 checksum How to use checksums |
4e9dd0a8cd5181cb3f63005dc8ba792d2f1fc9c773cbebb3b1ff0b80a5a529c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for remove_hairs 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.