Skip to content

Commit 6df42b4

Browse files
committed
code formatting and typo fixes
1 parent 391edf4 commit 6df42b4

File tree

5 files changed

+35
-30
lines changed

5 files changed

+35
-30
lines changed

string_utils/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
__version__ = '1.0.0'
44

5-
# makes all the functions available at string_utils level
6-
# as the where in older versions (before 1.0.0) when it was a single python module
5+
# makes all the functions available at `string_utils` level
6+
# as they were in older versions (before 1.0.0) when it was a single python module
77
from .validation import *
88
from .manipulation import *
99
from .generation import *

string_utils/errors.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- coding: utf-8 -*-
2+
23
from typing import Any
34

45

string_utils/generation.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
import binascii
2-
import os
3-
import random
4-
from typing import Generator
5-
from uuid import uuid4
6-
import string
7-
8-
from string_utils import is_integer, roman_encode
1+
# -*- coding: utf-8 -*-
92

3+
# public api to export
104
__all__ = [
115
'uuid',
126
'random_string',
137
'secure_random_hex',
148
'roman_range',
159
]
1610

11+
import binascii
12+
import os
13+
import random
14+
import string
15+
from typing import Generator
16+
from uuid import uuid4
17+
18+
from string_utils import is_integer, roman_encode
19+
1720

1821
def uuid(as_hex: bool = False) -> str:
1922
"""

string_utils/manipulation.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
import base64
4-
import random
5-
import unicodedata
6-
from typing import Union
7-
from uuid import uuid4
8-
3+
# public api to export
94
__all__ = [
105
'camel_case_to_snake',
116
'snake_case_to_camel',
@@ -23,7 +18,12 @@
2318
'roman_decode',
2419
]
2520

21+
import base64
22+
import random
23+
import unicodedata
2624
import zlib
25+
from typing import Union
26+
from uuid import uuid4
2727

2828
from ._regex import *
2929
from .errors import InvalidInputError
@@ -156,7 +156,7 @@ def decode(cls, input_string: str) -> int:
156156
return output
157157

158158

159-
class _StringCompressor:
159+
class __StringCompressor:
160160

161161
@staticmethod
162162
def __require_valid_input_and_encoding(input_string: str, encoding: str):
@@ -209,7 +209,7 @@ def decompress(cls, input_string: str, encoding: str = 'utf-8') -> str:
209209
return original_string
210210

211211

212-
class _StringFormatter:
212+
class __StringFormatter:
213213
def __init__(self, input_string):
214214
if not is_string(input_string):
215215
raise InvalidInputError(input_string)
@@ -426,7 +426,7 @@ def prettify(input_string: str) -> str:
426426
:param input_string: String to manipulate
427427
:return: Prettified string.
428428
"""
429-
formatted = _StringFormatter(input_string).format()
429+
formatted = __StringFormatter(input_string).format()
430430
return formatted
431431

432432

@@ -592,7 +592,7 @@ def compress(input_string: str, encoding: str = 'utf-8', compression_level: int
592592
:type compression_level: int
593593
:return: Compressed string.
594594
"""
595-
return _StringCompressor.compress(input_string, encoding, compression_level)
595+
return __StringCompressor.compress(input_string, encoding, compression_level)
596596

597597

598598
def decompress(input_string: str, encoding: str = 'utf-8') -> str:
@@ -605,7 +605,7 @@ def decompress(input_string: str, encoding: str = 'utf-8') -> str:
605605
:type encoding: str
606606
:return: Decompressed string.
607607
"""
608-
return _StringCompressor.decompress(input_string, encoding)
608+
return __StringCompressor.decompress(input_string, encoding)
609609

610610

611611
def roman_encode(input_number: Union[str, int]) -> str:

string_utils/validation.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
import json
4-
import string
5-
from typing import Any, Optional, List
6-
3+
# public api to export
74
__all__ = [
85
'is_string',
96
'is_full_string',
@@ -31,14 +28,18 @@
3128
'words_count',
3229
]
3330

31+
import json
32+
import string
33+
from typing import Any, Optional, List
34+
3435
from ._regex import *
35-
from string_utils.errors import InvalidInputError
36+
from .errors import InvalidInputError
3637

3738

3839
# PRIVATE API
3940

4041

41-
class _ISBNChecker:
42+
class __ISBNChecker:
4243
def __init__(self, input_string: str, normalize: bool = True):
4344
if not is_string(input_string):
4445
raise InvalidInputError(input_string)
@@ -613,7 +614,7 @@ def is_isbn_10(input_string: str, normalize: bool = True) -> bool:
613614
:param normalize: True to ignore hyphens ("-") in the string (default), false otherwise.
614615
:return: True if valid ISBN 10, false otherwise.
615616
"""
616-
checker = _ISBNChecker(input_string, normalize)
617+
checker = __ISBNChecker(input_string, normalize)
617618
return checker.is_isbn_10()
618619

619620

@@ -633,7 +634,7 @@ def is_isbn_13(input_string: str, normalize: bool = True) -> bool:
633634
:param normalize: True to ignore hyphens ("-") in the string (default), false otherwise.
634635
:return: True if valid ISBN 13, false otherwise.
635636
"""
636-
checker = _ISBNChecker(input_string, normalize)
637+
checker = __ISBNChecker(input_string, normalize)
637638
return checker.is_isbn_13()
638639

639640

@@ -652,5 +653,5 @@ def is_isbn(input_string: str, normalize: bool = True) -> bool:
652653
:param normalize: True to ignore hyphens ("-") in the string (default), false otherwise.
653654
:return: True if valid ISBN (10 or 13), false otherwise.
654655
"""
655-
checker = _ISBNChecker(input_string, normalize)
656+
checker = __ISBNChecker(input_string, normalize)
656657
return checker.is_isbn_13() or checker.is_isbn_10()

0 commit comments

Comments
 (0)