Skip to main content

ImprovedReplace

Python library to add some replace method improvements focused on common replacements to optimize code.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Make sure you have Python and that the expected version is available from your command line. You can check this by running:

python --version

You should get some output like Python 3.6.3. If you do not have Python, please install the latest 3.x version from python.org

Additionally, you’ll need to make sure you have pip available. You can check this by running:

pip --version

If you installed Python from source, with an installer from python.org you should already have pip. If you’re on Linux and installed using your OS package manager, you may have to install pip separately, see Installing pip/setuptools/wheel with Linux Package Managers.

If pip isn’t already installed, then first try to bootstrap it from the standard library:

python -m ensurepip --default-pip

While pip alone is sufficient to install from pre-built binary archives, up to date copies of the setuptools and wheel projects are useful to ensure you can also install from source archives:

python -m pip install --upgrade pip setuptools wheel

Installing

To install the latest version of ImprovedReplace:

pip install -U improved-replace

And then you can import this library in Python:

from improved_replace import to_array

string = "Hello World"
string = to_array(string)

print(string)
# Output: ['Hello', 'World']

Or you can check the project in PyPI.

Running the tests

To run automated module tests you first need to install py.test:

pip install -U py.test

Then you must to download the source code of the module in his github repository, go to the tests folder with PowerShell and run pytest:

pytest

Pytest will detect all automatic tests to run and check them.

Some test examples

These are some examples of the automated test

def test_to_array():
    """Test to_array function."""

    # Normal string
    assert to_array("Hello World") == ["Hello", "World"]

    # Many spaces
    assert to_array(" H e l l o ") == ["H", "e", "l", "l", "o"]

    # Only spaces
    assert to_array("           ") == []

    # Any spaces
    assert to_array("HelloWorld!") == ["HelloWorld!"]

    # Not a string
    assert to_array(None) == None

This test is testing all the general cases of the function to_array and since the function is based on separating by space, the tests are based on that.

Built With

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Lucas Mosquera - Creator and Maintainer - LuckJMG

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

This is my first package of python and my first real open source project. The idea occurred to me when I had to replace a few commas many times with points or vice versa when i was practicing in the URI Online Judge.

Thank you all for getting here, remember this is my first project and i'll learn more thank to this

Metadata

Release files for improved-replace 1.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for improved-replace 1.3.2
File Size Uploaded
improved_replace-1.3.2.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for improved-replace 1.3.2
File Interpreter ABI Platform
improved_replace-1.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.9 kB

Release files / improved_replace-1.3.2.tar.gz

Download URL improved_replace-1.3.2.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8d88dd916b14f774b859adcdcd5dd451a757ca7329ad1aba1782472184315fae
BLAKE2b-256 checksum
How to use checksums
71aace473cd21d6d27bae01c99904c5e22a217fe7996cd3f864bfbdac6e8dfdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

Release files / improved_replace-1.3.2-py3-none-any.whl

Download URL improved_replace-1.3.2-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3825675be982dc2278e1c659b08faac1fee866ff57f438b4ea5522f6193e2dc
BLAKE2b-256 checksum
How to use checksums
bc6d106aaf1b6b405f6fbdb26efc6712fff36e8e158487a1034414419dcd230d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

Release history Release notifications | RSS feed

This release

1.3.2 This release

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page