Skip to content

Commit cca0802

Browse files
authored
Merge pull request #10 from daveoncode/develop
Develop
2 parents 5dfe43c + d903db3 commit cca0802

File tree

113 files changed

+5666
-18268
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+5666
-18268
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,5 @@ com_crashlytics_export_strings.xml
119119
crashlytics.properties
120120
crashlytics-build.properties
121121

122-
.ENV
122+
.ENV
123+

.readthedocs.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Read the Docs configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
# Required
5+
version: 2
6+
7+
# Build documentation in the docs/ directory with Sphinx
8+
sphinx:
9+
configuration: docs/conf.py
10+
builder: html
11+
fail_on_warning: true
12+
13+
# Build documentation with MkDocs
14+
#mkdocs:
15+
# configuration: mkdocs.yml
16+
17+
# Optionally build your docs in additional formats such as PDF and ePub
18+
formats: all
19+
20+
# Optionally set the version of Python and requirements required to build your docs
21+
python:
22+
version: 3.5
23+
install:
24+
- requirements: dev.requirements.txt

.travis.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
language: python
2+
python:
3+
- "3.5"
4+
- "3.6"
5+
- "3.7"
6+
- "3.8"
7+
install:
8+
- pip install -r dev.requirements.txt
9+
script:
10+
- coverage run -m unittest && coverage report # runs tests with coverage
11+
- bash <(curl -s https://codecov.io/bash) # generate coverage report
12+
- python setup.py sdist bdist_wheel # build python package
13+
- cd docs && make html # generate html docs
14+
branches:
15+
only:
16+
- master
17+
- develop

CHANGELOG.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,97 @@
11
# Python String Utils Changelog
22

3+
## v1.0.0 (March 2020)
4+
5+
### Project reboot:
6+
7+
I've started this project back in 2015, then abandoned it one year later, thinking no one care about it.\
8+
Recently I've instead discovered that it's actually being used by several projects on GitHub
9+
(despite it has only few stars).\
10+
So I'm rebooting it with new found enthusiasm and a brand new version with tons of new api and improvements.
11+
12+
Besides the code, the project configuration is now mature and professional:
13+
- Automatic builds and testing against multiple python versions with Travis CI
14+
- Automatic code coverage reporting on codecov.io
15+
- Automatic documentation generated on readthedocs.io
16+
- Better descriptions and provided examples
17+
18+
19+
### Deprecations:
20+
21+
We are in 2020 and finally old versions of Python have been
22+
[officially deprecated](https://www.python.org/doc/sunset-python-2/).
23+
So the following versions are **no longer supported**:
24+
25+
- 2.7.x
26+
- 3.3.x
27+
- 3.4.x
28+
29+
(suite tests are now being executed against all currently supported versions: 3.5, 3.6, 3.7 and 3.8)
30+
31+
### Added:
32+
33+
- `compress()`: compress strings into shorter ones that can be restored later on
34+
- `decompress()`: restore a previously compressed string
35+
- `roman_encode()`: encode integers/strings into roman number strings
36+
- `roman_decode()`: decode roman number into an integer
37+
- `roman_range()`: generator which returns roman numbers on each iteration
38+
- `asciify()`: Force string content to be ascii-only by translating all non-ascii chars into the closest possible
39+
representation
40+
- `is_ip_v4()`: checks only for v4 ips
41+
- `is_ip_v6()`: checks only for v6 ips
42+
- `is_isbn_13()`: checks if the given string is a valid ISBN 13
43+
- `is_isbn_10()`: checks if the given string is a valid ISBN 10
44+
- `is_isbn()`: checks if the given string is a valid ISBN (any version)
45+
- `is_number()`: checks if the given string is a valid number (either an integer or a decimal)
46+
- `is_integer()`: checks if the given string is a valid integer
47+
- `is_decimal()`: checks if the given string is a valid decimal
48+
- `booleanize()`: turns string into boolean based on its content
49+
- `strip_margin()`: remove left margin from multi line strings so you don't have to bother about indentation
50+
in your code (inspired by Scala)
51+
- `random_string()`: generates string of given size with random alpha-numeric chars
52+
- `secure_random_hex()`: generates hexadecimal string of the given bytes count using secure random generator
53+
54+
### Fixes:
55+
56+
- `is_email()` is now fully compliant with email specifications (https://tools.ietf.org/html/rfc3696#section-3)
57+
- `is_ip()` now checks both ip v4 (and validates 0-255 range) and ip v6
58+
(the previous implementation was really shallow, my apologies :P)
59+
- `is_json()` now considers as valid json array objects (eg. `is_json('[1, 2, 3]')` returns true now)
60+
- `prettify()` does not screw up urls or emails anymore (from now on it won't consider those as text to be formatted)
61+
- Solved deprecation warnings over invalid escape sequences in Python >= 3.7
62+
63+
### Changes:
64+
65+
- Old module `string_utils.py` has been replaced by a package with submodules (`validation.py`, `manipulation.py`,
66+
`generation.py` and `errors.py`), anyway all the functions are still
67+
importable as before (`from string_utils import xxx`). Similarly `tests.py` has been refactored into a package
68+
with a module for each test case
69+
- `is_snake_case()` now considers as "snake case" strings with mixed upper and lower case characters, strings with
70+
leading or trailing underscores and string containing multiple underscores in sequence
71+
- `is_slug()` now allows multiple consecutive separator signs between words
72+
73+
### Improvements:
74+
75+
- Added Python type hints to all functions arguments and return types
76+
(this is now feasible since the minimum supported Python version is the 3.5)
77+
- Each method that expect a valid string as input now will raise a more detailed `InvalidInputError` exception
78+
(eg: ***Expected "str", received "list"***)
79+
- `reverse()`, `shuffle()`, `prettify()` now raise the detailed `InvalidInputError` if input is not a valid string
80+
- String checks should now be a bit faster (switched from `.search()` to `.match()` in internal regex when the goal
81+
is to match the full string)
82+
- `is_palindrome()` algorithm has been redesigned to offer a faster check and better memory usage
83+
(only 2 chars are now being access at the same time instead of the whole string)...
84+
signature has changed (now it has two optional boolean arguments: `ignore_spaces` and `ignore_case`)
85+
- `slugify()` is now able to translate more non-ascii chars during the string conversion
86+
(it now makes use of the new extracted method `asciify()`)
87+
- `is_uuid()` has now a second parameter `allow_hex` that if true, considers as valid UUID hex value
88+
- `uuid()` has now an optional boolean parameter `as_hex` which allows to return UUID string as hex representation
89+
- `shuffle()` is now faster
90+
91+
---
92+
93+
94+
395
## v0.6.0
496

597
### Added:

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2016 Davide Zanotti
3+
Copyright (c) 2016-2020 Davide Zanotti
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

MANIFEST

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# file GENERATED by distutils, do NOT edit
22
README.md
33
setup.py
4-
string_utils.py

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy