Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Develop#10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
daveoncode merged 44 commits intomasterfromdevelop
Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
44 commits
Select commitHold shift + click to select a range
014f515
global library refactor + fixes + improvements + new additions
daveoncodeFeb 29, 2020
88468f5
travis integration
daveoncodeFeb 29, 2020
a239092
specified branches in travis settings
daveoncodeFeb 29, 2020
16f2ec9
docs update
daveoncodeFeb 29, 2020
d0af466
added coverage script to travis config
daveoncodeFeb 29, 2020
d07853b
RomanNumbers.range + asciify
daveoncodeMar 1, 2020
fc50c10
uuid() has now an `as_hex` param to return the UUID as hex
daveoncodeMar 1, 2020
c29b258
fixed asciify test for python < 3.7
daveoncodeMar 1, 2020
4726ae8
added "allow_hex" to is_uuid()
daveoncodeMar 1, 2020
26016e1
updated setup.py (using setuptools) + added build in travis config
daveoncodeMar 1, 2020
70dbcfc
updated travis config (build docs as last step)
daveoncodeMar 1, 2020
d14b662
RomanNumbers, StringCompressor and StringFormatter are now private cl…
daveoncodeMar 2, 2020
a6329f3
back to 100% code coverage
daveoncodeMar 2, 2020
67e0307
updated README, CHANGELOG, LICENSE and docs
daveoncodeMar 2, 2020
fec8fd2
improved README.md
daveoncodeMar 2, 2020
59868ef
added readthedocs config
daveoncodeMar 2, 2020
33ddf09
updates readthedocs config, removed docs build dir
daveoncodeMar 2, 2020
4a6a4f1
fixed link to changelog in README.md
daveoncodeMar 2, 2020
136ff93
improved is_palindrome and docs
daveoncodeMar 3, 2020
c465ec2
roman_range moved to generation.py + doc improvements
daveoncodeMar 3, 2020
00167e4
sound sphinx doc structure
daveoncodeMar 3, 2020
3103a3e
doc badge link fix
daveoncodeMar 3, 2020
947ceb1
added overview to shpinx doc index.rst
daveoncodeMar 3, 2020
e860da8
fixed roman_range (descending generation) + better docs
daveoncodeMar 4, 2020
7901698
added new example for roman_range in README.md
daveoncodeMar 4, 2020
6d3e319
added check version instructions + extended CHANGELOG.md
daveoncodeMar 4, 2020
ad3c497
added check version instructions to README.md
daveoncodeMar 4, 2020
ab06a8b
fixed: is_email is now complaint with email specifications
daveoncodeMar 4, 2020
915676a
updated CHANGELOG.md with is_email fix
daveoncodeMar 4, 2020
0623299
defined markdown as description content type in setup.py + added buil…
daveoncodeMar 4, 2020
facbf4b
added twine to dev.dependencies.txt
daveoncodeMar 4, 2020
fb12401
updated dev.dependencies.txt
daveoncodeMar 4, 2020
d8161ac
twine downgrade for python < 3.6
daveoncodeMar 4, 2020
bb8cef6
reordering in README.md
daveoncodeMar 4, 2020
ebae878
is_slug now allows multiple consecutive separator signs between words
daveoncodeMar 4, 2020
a98451a
fixed typo
daveoncodeMar 4, 2020
35a3f91
fixed same typo again
daveoncodeMar 4, 2020
caad228
improved is_email + more tests
daveoncodeMar 4, 2020
2aa0009
removed erroneously pasted text from validation.py
daveoncodeMar 4, 2020
391edf4
updated CHANGELOG.md intro
daveoncodeMar 4, 2020
6df42b4
code formatting and typo fixes
daveoncodeMar 4, 2020
d535741
relative import for internal dependencies in generation.py
daveoncodeMar 4, 2020
0c36f5d
avoided unnecessary type casting
daveoncodeMar 4, 2020
d903db3
faster shuffle()
daveoncodeMar 4, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion.gitignore
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -119,4 +119,5 @@ com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties

.ENV
.ENV

24 changes: 24 additions & 0 deletions.readthedocs.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
builder: html
fail_on_warning: true

# Build documentation with MkDocs
#mkdocs:
# configuration: mkdocs.yml

# Optionally build your docs in additional formats such as PDF and ePub
formats: all

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.5
install:
- requirements: dev.requirements.txt
17 changes: 17 additions & 0 deletions.travis.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
language: python
python:
- "3.5"
- "3.6"
- "3.7"
- "3.8"
install:
- pip install -r dev.requirements.txt
script:
- coverage run -m unittest && coverage report # runs tests with coverage
- bash <(curl -s https://codecov.io/bash) # generate coverage report
- python setup.py sdist bdist_wheel # build python package
- cd docs && make html # generate html docs
branches:
only:
- master
- develop
92 changes: 92 additions & 0 deletionsCHANGELOG.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,97 @@
# Python String Utils Changelog

## v1.0.0 (March 2020)

### Project reboot:

I've started this project back in 2015, then abandoned it one year later, thinking no one care about it.\
Recently I've instead discovered that it's actually being used by several projects on GitHub
(despite it has only few stars).\
So I'm rebooting it with new found enthusiasm and a brand new version with tons of new api and improvements.

Besides the code, the project configuration is now mature and professional:
- Automatic builds and testing against multiple python versions with Travis CI
- Automatic code coverage reporting on codecov.io
- Automatic documentation generated on readthedocs.io
- Better descriptions and provided examples


### Deprecations:

We are in 2020 and finally old versions of Python have been
[officially deprecated](https://www.python.org/doc/sunset-python-2/).
So the following versions are **no longer supported**:

- 2.7.x
- 3.3.x
- 3.4.x

(suite tests are now being executed against all currently supported versions: 3.5, 3.6, 3.7 and 3.8)

### Added:

- `compress()`: compress strings into shorter ones that can be restored later on
- `decompress()`: restore a previously compressed string
- `roman_encode()`: encode integers/strings into roman number strings
- `roman_decode()`: decode roman number into an integer
- `roman_range()`: generator which returns roman numbers on each iteration
- `asciify()`: Force string content to be ascii-only by translating all non-ascii chars into the closest possible
representation
- `is_ip_v4()`: checks only for v4 ips
- `is_ip_v6()`: checks only for v6 ips
- `is_isbn_13()`: checks if the given string is a valid ISBN 13
- `is_isbn_10()`: checks if the given string is a valid ISBN 10
- `is_isbn()`: checks if the given string is a valid ISBN (any version)
- `is_number()`: checks if the given string is a valid number (either an integer or a decimal)
- `is_integer()`: checks if the given string is a valid integer
- `is_decimal()`: checks if the given string is a valid decimal
- `booleanize()`: turns string into boolean based on its content
- `strip_margin()`: remove left margin from multi line strings so you don't have to bother about indentation
in your code (inspired by Scala)
- `random_string()`: generates string of given size with random alpha-numeric chars
- `secure_random_hex()`: generates hexadecimal string of the given bytes count using secure random generator

### Fixes:

- `is_email()` is now fully compliant with email specifications (https://tools.ietf.org/html/rfc3696#section-3)
- `is_ip()` now checks both ip v4 (and validates 0-255 range) and ip v6
(the previous implementation was really shallow, my apologies :P)
- `is_json()` now considers as valid json array objects (eg. `is_json('[1, 2, 3]')` returns true now)
- `prettify()` does not screw up urls or emails anymore (from now on it won't consider those as text to be formatted)
- Solved deprecation warnings over invalid escape sequences in Python >= 3.7

### Changes:

- Old module `string_utils.py` has been replaced by a package with submodules (`validation.py`, `manipulation.py`,
`generation.py` and `errors.py`), anyway all the functions are still
importable as before (`from string_utils import xxx`). Similarly `tests.py` has been refactored into a package
with a module for each test case
- `is_snake_case()` now considers as "snake case" strings with mixed upper and lower case characters, strings with
leading or trailing underscores and string containing multiple underscores in sequence
- `is_slug()` now allows multiple consecutive separator signs between words

### Improvements:

- Added Python type hints to all functions arguments and return types
(this is now feasible since the minimum supported Python version is the 3.5)
- Each method that expect a valid string as input now will raise a more detailed `InvalidInputError` exception
(eg: ***Expected "str", received "list"***)
- `reverse()`, `shuffle()`, `prettify()` now raise the detailed `InvalidInputError` if input is not a valid string
- String checks should now be a bit faster (switched from `.search()` to `.match()` in internal regex when the goal
is to match the full string)
- `is_palindrome()` algorithm has been redesigned to offer a faster check and better memory usage
(only 2 chars are now being access at the same time instead of the whole string)...
signature has changed (now it has two optional boolean arguments: `ignore_spaces` and `ignore_case`)
- `slugify()` is now able to translate more non-ascii chars during the string conversion
(it now makes use of the new extracted method `asciify()`)
- `is_uuid()` has now a second parameter `allow_hex` that if true, considers as valid UUID hex value
- `uuid()` has now an optional boolean parameter `as_hex` which allows to return UUID string as hex representation
- `shuffle()` is now faster

---



## v0.6.0

### Added:
Expand Down
2 changes: 1 addition & 1 deletionLICENSE
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Davide Zanotti
Copyright (c) 2016-2020 Davide Zanotti

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
1 change: 0 additions & 1 deletionMANIFEST
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
# file GENERATED by distutils, do NOT edit
README.md
setup.py
string_utils.py
Loading

[8]ページ先頭

©2009-2025 Movatter.jp