umt-python 0.1.0__tar.gz → 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {umt_python-0.1.0/src/umt_python.egg-info → umt_python-0.1.1}/PKG-INFO +1 -1
  2. {umt_python-0.1.0 → umt_python-0.1.1}/pyproject.toml +8 -4
  3. {umt_python-0.1.0 → umt_python-0.1.1}/src/delete_spaces.py +2 -1
  4. {umt_python-0.1.0 → umt_python-0.1.1}/src/format_string.py +4 -2
  5. {umt_python-0.1.0 → umt_python-0.1.1}/src/from_base64.py +4 -2
  6. {umt_python-0.1.0 → umt_python-0.1.1}/src/pad_start.py +1 -1
  7. {umt_python-0.1.0 → umt_python-0.1.1}/src/random_string.py +2 -1
  8. {umt_python-0.1.0 → umt_python-0.1.1}/src/to_base64.py +2 -1
  9. {umt_python-0.1.0 → umt_python-0.1.1}/src/to_half_width.py +3 -3
  10. {umt_python-0.1.0 → umt_python-0.1.1}/src/trim_characters.py +1 -0
  11. {umt_python-0.1.0 → umt_python-0.1.1/umt_python.egg-info}/PKG-INFO +1 -1
  12. {umt_python-0.1.0/src → umt_python-0.1.1}/umt_python.egg-info/SOURCES.txt +5 -5
  13. umt_python-0.1.1/umt_python.egg-info/top_level.txt +1 -0
  14. umt_python-0.1.0/src/umt_python.egg-info/top_level.txt +0 -15
  15. {umt_python-0.1.0 → umt_python-0.1.1}/LICENSE +0 -0
  16. {umt_python-0.1.0 → umt_python-0.1.1}/README.md +0 -0
  17. {umt_python-0.1.0 → umt_python-0.1.1}/setup.cfg +0 -0
  18. {umt_python-0.1.0 → umt_python-0.1.1}/src/__init__.py +0 -0
  19. {umt_python-0.1.0 → umt_python-0.1.1}/src/has_no_letters.py +0 -0
  20. {umt_python-0.1.0 → umt_python-0.1.1}/src/pad_end.py +0 -0
  21. {umt_python-0.1.0 → umt_python-0.1.1}/src/random_string_initialization.py +0 -0
  22. {umt_python-0.1.0 → umt_python-0.1.1}/src/reverse_string.py +0 -0
  23. {umt_python-0.1.0 → umt_python-0.1.1}/src/trim_end_characters.py +0 -0
  24. {umt_python-0.1.0 → umt_python-0.1.1}/src/trim_start_characters.py +0 -0
  25. {umt_python-0.1.0 → umt_python-0.1.1}/tests/test_string_utils.py +0 -0
  26. {umt_python-0.1.0/src → umt_python-0.1.1}/umt_python.egg-info/dependency_links.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: umt_python
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: A collection of useful utility functions for various tasks in Python, focusing on string manipulation and formatting.
5
5
  Author-email: riya-amemiya <riyaamemiya@gmail.com>
6
6
  License-Expression: MIT
@@ -2,6 +2,10 @@
2
2
  build-backend = "setuptools.build_meta"
3
3
  requires = ["setuptools>=61.0", "wheel"]
4
4
 
5
+ [tool.setuptools]
6
+ package-dir = {"umt_python" = "src"}
7
+ packages = ["umt_python"]
8
+
5
9
  [project]
6
10
  authors = [
7
11
  {name = "riya-amemiya", email = "riyaamemiya@gmail.com"},
@@ -21,7 +25,7 @@ license = "MIT"
21
25
  name = "umt_python"
22
26
  readme = "README.md"
23
27
  requires-python = ">=3.9"
24
- version = "0.1.0"
28
+ version = "0.1.1"
25
29
 
26
30
  [project.urls]
27
31
  "Bug Tracker" = "https://github.com/riya-amemiya/UMT/issues"
@@ -30,7 +34,7 @@ version = "0.1.0"
30
34
 
31
35
  [dependency-groups]
32
36
  dev = [
33
- "pyright>=1.1.402",
34
- "pytest>=8.4.1",
35
- "ruff>=0.12.1",
37
+ "pyright==1.1.402",
38
+ "pytest==8.4.1",
39
+ "ruff==0.12.2",
36
40
  ]
@@ -1,5 +1,6 @@
1
1
  import re
2
2
 
3
+
3
4
  def delete_spaces(string_: str) -> str:
4
5
  """
5
6
  Removes all whitespace characters from a string.
@@ -16,4 +17,4 @@ def delete_spaces(string_: str) -> str:
16
17
  >>> delete_spaces(" tab\\t space ")
17
18
  'tabspace'
18
19
  """
19
- return re.sub(r'\s', '', string_)
20
+ return re.sub(r"\s", "", string_)
@@ -1,5 +1,6 @@
1
1
  import re
2
2
 
3
+
3
4
  def format_string(template: str, *values: object) -> str:
4
5
  """
5
6
  Replaces placeholders in a template string with specified values.
@@ -21,10 +22,11 @@ def format_string(template: str, *values: object) -> str:
21
22
  >>> format_string("Not enough values: {0} {1}", "val1") # Mimics TS behavior
22
23
  'Not enough values: val1 {1}'
23
24
  """
25
+
24
26
  def replace(match):
25
27
  index = int(match.group(1))
26
28
  if index < len(values):
27
29
  return str(values[index])
28
- return match.group(0) # Return the original placeholder if value not found
30
+ return match.group(0) # Return the original placeholder if value not found
29
31
 
30
- return re.sub(r'{(\d+)}', replace, template)
32
+ return re.sub(r"{(\d+)}", replace, template)
@@ -1,4 +1,6 @@
1
1
  import base64
2
+ import binascii
3
+
2
4
 
3
5
  def from_base64(base64_string: str) -> str:
4
6
  """
@@ -20,6 +22,6 @@ def from_base64(base64_string: str) -> str:
20
22
  if not base64_string:
21
23
  return ""
22
24
  try:
23
- return base64.b64decode(base64_string.encode('utf-8')).decode('utf-8')
24
- except Exception as e:
25
+ return base64.b64decode(base64_string.encode("utf-8")).decode("utf-8")
26
+ except (binascii.Error, UnicodeDecodeError) as e:
25
27
  raise ValueError("Invalid Base64 string") from e
@@ -32,5 +32,5 @@ def pad_start(string_: str, target_length: int, pad_string: str) -> str:
32
32
 
33
33
  while len(padding) < padding_length:
34
34
  padding += pad_string
35
-
35
+
36
36
  return padding[:padding_length] + string_
@@ -3,6 +3,7 @@ import string
3
3
 
4
4
  DEFAULT_RANDOM_STRING_CHARS = string.ascii_letters + string.digits
5
5
 
6
+
6
7
  def random_string(size: int = 8, char_pool: str = DEFAULT_RANDOM_STRING_CHARS) -> str:
7
8
  """
8
9
  Generates a random string.
@@ -27,4 +28,4 @@ def random_string(size: int = 8, char_pool: str = DEFAULT_RANDOM_STRING_CHARS) -
27
28
  return ""
28
29
  # When char_pool is empty and size > 0, random.choice will raise IndexError.
29
30
  # This is the expected behavior for the tests.
30
- return ''.join(random.choice(char_pool) for _ in range(size))
31
+ return "".join(random.choice(char_pool) for _ in range(size))
@@ -1,5 +1,6 @@
1
1
  import base64
2
2
 
3
+
3
4
  def to_base64(char: str) -> str:
4
5
  """
5
6
  Convert string to Base64.
@@ -14,4 +15,4 @@ def to_base64(char: str) -> str:
14
15
  >>> to_base64("Hello World")
15
16
  'SGVsbG8gV29ybGQ='
16
17
  """
17
- return base64.b64encode(char.encode('utf-8')).decode('utf-8')
18
+ return base64.b64encode(char.encode("utf-8")).decode("utf-8")
@@ -25,8 +25,8 @@ def to_half_width(string_: str) -> str:
25
25
  # The difference is 0xFEE0 (65248)
26
26
  # Full-width space U+3000 -> Half-width space U+0020
27
27
  translation_table = {}
28
- for i in range(0xFF01, 0xFF5F): # Covers full-width '!' to '~'
28
+ for i in range(0xFF01, 0xFF5F): # Covers full-width '!' to '~'
29
29
  translation_table[i] = i - 0xFEE0
30
- translation_table[0x3000] = 0x0020 # Full-width space to half-width space
31
-
30
+ translation_table[0x3000] = 0x0020 # Full-width space to half-width space
31
+
32
32
  return string_.translate(translation_table)
@@ -1,6 +1,7 @@
1
1
  from .trim_start_characters import trim_start_characters
2
2
  from .trim_end_characters import trim_end_characters
3
3
 
4
+
4
5
  def trim_characters(string_: str, chars: str) -> str:
5
6
  """
6
7
  Removes specified characters from both ends of a string.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: umt_python
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: A collection of useful utility functions for various tasks in Python, focusing on string manipulation and formatting.
5
5
  Author-email: riya-amemiya <riyaamemiya@gmail.com>
6
6
  License-Expression: MIT
@@ -16,8 +16,8 @@ src/to_half_width.py
16
16
  src/trim_characters.py
17
17
  src/trim_end_characters.py
18
18
  src/trim_start_characters.py
19
- src/umt_python.egg-info/PKG-INFO
20
- src/umt_python.egg-info/SOURCES.txt
21
- src/umt_python.egg-info/dependency_links.txt
22
- src/umt_python.egg-info/top_level.txt
23
- tests/test_string_utils.py
19
+ tests/test_string_utils.py
20
+ umt_python.egg-info/PKG-INFO
21
+ umt_python.egg-info/SOURCES.txt
22
+ umt_python.egg-info/dependency_links.txt
23
+ umt_python.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ umt_python
@@ -1,15 +0,0 @@
1
- __init__
2
- delete_spaces
3
- format_string
4
- from_base64
5
- has_no_letters
6
- pad_end
7
- pad_start
8
- random_string
9
- random_string_initialization
10
- reverse_string
11
- to_base64
12
- to_half_width
13
- trim_characters
14
- trim_end_characters
15
- trim_start_characters
File without changes
File without changes
File without changes
File without changes
File without changes