Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrikboeck committed Jun 14, 2024
1 parent 3ca40fa commit 22245cd
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 6 deletions.
Binary file added .github/parasite_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 38 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
# `parasite` - `zod` inspired library for Python 3.11+

> **DISCLAIMER:**
![Stars][stars-shield]
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]


<br />
<div align="center">
<a href="https://github.com/hendrikboeck/parasite">
<img src="https://raw.githubusercontent.com/hendrikboeck/parasite/main/.github/parasite_logo.png" alt="Logo" width="128" height="128">
</a>

<h1 align="center">parasite <code>v0.1</code></h1>

<p align="center">
<code>zod</code> inspired library for Python 3.11+
<br />
<a href="https://github.com/hendrikboeck/parasite/issues/new?labels=bug&template=bug-report---.md">Report Bug</a>
|
<a href="https://github.com/ohendrikboeck/parasite/issues/new?labels=enhancement&template=feature-request---.md">Request Feature</a>
</p>
</div>

> [!WARNING]
>
> This library is under active development, expect things to break or not to work as expected.
> Creating an issue for bugs you encounter would be appreciated. Documentation is currently work in
Expand Down Expand Up @@ -54,7 +76,8 @@ parasite = "^0.1.0"

## Documentation

Work in Progress...
> [!IMPORTANT]
> Work in Progress...
## License (_MIT License_)

Expand All @@ -76,4 +99,14 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.

[license-shield]: https://img.shields.io/github/license/hendrikboeck/parasite?style=for-the-badge
[license-url]: https://github.com/hendrikboeck/parasite/blob/main/LICENSE
[issues-shield]: https://img.shields.io/github/issues/hendrikboeck/parasite?style=for-the-badge
[issues-url]: https://github.com/hendrikboeck/parasite/issues
[forks-shield]: https://img.shields.io/github/forks/hendrikboeck/parasite?style=for-the-badge
[forks-url]: https://github.com/hendrikboeck/parasite/forks
[contributors-shield]: https://img.shields.io/github/contributors/hendrikboeck/parasite?style=for-the-badge
[contributors-url]: https://github.com/hendrikboeck/parasite/contributors
[stars-shield]: https://img.shields.io/github/stars/hendrikboeck/parasite?style=for-the-badge
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "parasite"
version = "0.1.1"
version = "0.1.2"
description = "Data validation for Python 3"
authors = ["Hendrik Boeck <hendrikboeck.dev@protonmail.com>"]
packages = [{ include = "*", from = "src" }]
Expand Down
26 changes: 26 additions & 0 deletions src/parasite/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,32 @@ def ipv6(self) -> String:
self._m_regex_t = self._RegexType.IPV6
return self

def regex(self, value: Pattern) -> String:
"""
Sets the regex pattern to use for validation.
Args:
value (Pattern): compiled regex pattern
Returns:
String: modified instance
"""
self._m_regex_t = self._RegexType.REGEX
self._m_regex = value
return self

def match(self, value: str) -> String:
"""
Sets the regex pattern to use for validation.
Args:
value (str): regex pattern
Returns:
String: modified instance
"""
return self.regex(re.compile(value))

def _apply_transformations(self, value: str) -> str:
"""
Applies the transformations on the value.
Expand Down

0 comments on commit 22245cd

Please sign in to comment.