Skip to main content

Add replace method improvements

Project description

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 improved-replace

And then you can import this library in Python:

from improved_replace import ImprovedReplace

replace = ImprovedReplace()
string = "Hello World"
string = replace.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 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(self):
        '''Test to_array function.'''
        assert test.to_array("Hello World") == ['Hello', 'World']           # Normal string
        assert test.to_array(" H e l l o ") == ['H', 'e', 'l', 'l', 'o']    # Many spaces
        assert test.to_array("           ") == []                           # Only spaces
        assert test.to_array("HelloWorld!") == ['HelloWorld!']              # Any spaces

This test is testing all the general cases of the function to_array of the ImprovedReplace class 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

improved_replace-1.2.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

improved_replace-1.2.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file improved_replace-1.2.2.tar.gz.

File metadata

  • Download URL: improved_replace-1.2.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using 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.2

File hashes

Hashes for improved_replace-1.2.2.tar.gz
Algorithm Hash digest
SHA256 af459961d85d7385b8c2b7b6896bf458b2241f15b112e7abca5e327053d9e1cc
MD5 41e533ebaa9a604069ec8c2b2a51b80b
BLAKE2b-256 9ca0d12ceab7510a673dd44891c0ce0b3d4f00d44776eb406f522fa5ec99c3cb

See more details on using hashes here.

File details

Details for the file improved_replace-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: improved_replace-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using 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.2

File hashes

Hashes for improved_replace-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0cfeaa5b1b847058366cf071deac0a3d1c2aae7a5b016a22095eca34eaee1838
MD5 265c02262f7185bf6e0c81b4491d4369
BLAKE2b-256 f9a51ca0d844dfa93d725f90e0da81743e1bac8a63c8786b12f222f339ce834d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page