String generator by regex
Project description
String gen
String generator by regex
Installation
Install using pip with
pip install string-gen
Example
from string_gen import StringGen
generator = StringGen(r'(A|B)\d{4}(\.|-)\d{1}')
print(generator.render()) # B9954.4
print(generator.render()) # A5292-1
generator = StringGen(r'[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}')
print(generator.render()) # 52aabe4b-01fa-4b33-8976-b53b09f49e72
# Generate list strings
generator = StringGen(r'(A|B)\d{4}(\.|-)\d{1}')
print(generator.render_list(5)) # ['A9046.5', 'A8334.7', 'B5496-6', 'A4207-2', 'A1171-7']
# Return a set of generated unique strings
generator = StringGen(r'\d')
print(generator.render_set(10)) # {'4', '6', '3', '9', '2', '7', '5', '1', '8', '0'}
Changelog
Contributing
Contributions are very welcome.
You might want to:
- Fix spelling errors
- Improve documentation
- Add tests for untested code
- Add new features
- Fix bugs
Getting started
- python 3.12
- pipenv 2023.11.15+
- Clone the repository
git clone https://github.com/tolstislon/string-gen.git cd string-gen
- Install dev dependencies
pipenv install --dev pipenv shell
- Run ruff format
pipenv run format
- Run ruff check
pipenv run check
- Run tests
pipenv run tests
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
string_gen-0.1.1.tar.gz
(11.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file string_gen-0.1.1.tar.gz.
File metadata
- Download URL: string_gen-0.1.1.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b60311ab0887c8f36f264135a0d863d1d71646e4b4d5aa9dfe7449123c5b4b2
|
|
| MD5 |
c2f06f9455dd6ab004487448dde4f455
|
|
| BLAKE2b-256 |
f9f042836da7736102ef9fab76134d81c53f38d35ba9f52e921cb135fcbcf451
|
File details
Details for the file string_gen-0.1.1-py3-none-any.whl.
File metadata
- Download URL: string_gen-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad83012165af83e7bddf5c9c0f77de68594b567c84f11126e0d509db13a8990c
|
|
| MD5 |
5ae683b9062ff7a4c1892d6db0a6369c
|
|
| BLAKE2b-256 |
1a9b6145b9558f1379395e32cd06161e909666d77bfa411d9283912048658ea2
|