aletk 0.1.7__tar.gz → 0.1.8__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aletk
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: Collection of general purpose tools to work with Python
5
5
  Author-email: Luis Alejandro Bordo García <bgluiszz@gmail.com>
6
6
  License: MIT
@@ -20,6 +20,7 @@ Provides-Extra: dev
20
20
  Requires-Dist: mypy; extra == "dev"
21
21
  Requires-Dist: black; extra == "dev"
22
22
  Requires-Dist: pytest; extra == "dev"
23
+ Requires-Dist: autoflake; extra == "dev"
23
24
  Requires-Dist: jupyter; extra == "dev"
24
25
  Dynamic: license-file
25
26
 
aletk-0.1.8/format ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+
3
+ PYTHONPATH="." .venv/bin/python scripts/format.py
@@ -29,8 +29,6 @@ class Nothing:
29
29
  A code that can be used to handle different error cases.
30
30
  """
31
31
 
32
- pass
33
-
34
32
 
35
33
  type Maybe[T] = Some[T] | Nothing
36
34
 
@@ -38,6 +38,7 @@ dev = [
38
38
  "mypy", # for static type checking
39
39
  "black", # for code formatting
40
40
  "pytest", # for testing
41
+ "autoflake", # for removing unused imports and variables
41
42
  "jupyter" # for prototyping in notebooks
42
43
  ]
43
44
 
@@ -76,6 +77,15 @@ module = [
76
77
  ]
77
78
  ignore_missing_imports = true
78
79
 
80
+ [tool.pytest.ini_options]
81
+ minversion = "6.0"
82
+ addopts = "-ras -m 'not external'"
83
+ markers = [
84
+ "external: mark tests that require external API calls",
85
+ ]
86
+ testpaths = ["tests"]
87
+ pythonpath = ["."]
88
+
79
89
  [tool.black]
80
90
  line-length = 120
81
91
  target-version = ['py313']
@@ -0,0 +1,29 @@
1
+ import subprocess
2
+ import sys
3
+
4
+ from src.aletk.utils import get_logger
5
+
6
+ lgr = get_logger(__name__)
7
+
8
+
9
+ def main() -> None:
10
+ try:
11
+ # Run autoflake to remove unused imports
12
+ lgr.info("Running autoflake to remove unused imports...")
13
+ subprocess.run(
14
+ ["autoflake", "--in-place", "--remove-all-unused-imports", "--recursive", "--verbose", "."], check=True
15
+ )
16
+ lgr.info("Successfully removed unused imports.")
17
+
18
+ lgr.info("Running black to format the code...")
19
+ # Run black to format the code
20
+ subprocess.run(["black", "."], check=True)
21
+ lgr.info("Successfully formatted the code with black.")
22
+
23
+ except subprocess.CalledProcessError as e:
24
+ print(f"Error: {e}", file=sys.stderr)
25
+ sys.exit(e.returncode)
26
+
27
+
28
+ if __name__ == "__main__":
29
+ main()
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.1.7'
32
- __version_tuple__ = version_tuple = (0, 1, 7)
31
+ __version__ = version = '0.1.8'
32
+ __version_tuple__ = version_tuple = (0, 1, 8)
33
33
 
34
- __commit_id__ = commit_id = 'g5369285da'
34
+ __commit_id__ = commit_id = 'gf2bd05a80'
@@ -39,11 +39,7 @@ def get_logger(name: str) -> logging.Logger:
39
39
  def remove_extra_whitespace(string: str) -> str:
40
40
  """
41
41
  Remove extra whitespace from a string. This version removes all newlines, tabs, carriage returns, trailing and leading whitespace, and multiple spaces in a row.
42
-
43
- If the input is None or not a string, a ValueError is raised.
44
42
  """
45
- if not string:
46
- raise ValueError("Utils::RemoveExtraWhiteSpace::Argument string has to be a non-empty string.")
47
43
 
48
44
  cleaned_string = " ".join(string.split()).strip()
49
45
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aletk
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: Collection of general purpose tools to work with Python
5
5
  Author-email: Luis Alejandro Bordo García <bgluiszz@gmail.com>
6
6
  License: MIT
@@ -20,6 +20,7 @@ Provides-Extra: dev
20
20
  Requires-Dist: mypy; extra == "dev"
21
21
  Requires-Dist: black; extra == "dev"
22
22
  Requires-Dist: pytest; extra == "dev"
23
+ Requires-Dist: autoflake; extra == "dev"
23
24
  Requires-Dist: jupyter; extra == "dev"
24
25
  Dynamic: license-file
25
26
 
@@ -3,11 +3,13 @@
3
3
  .python-version
4
4
  LICENSE
5
5
  README.md
6
+ format
6
7
  pyproject.toml
7
8
  docs/generic_style_guide.md
8
9
  prototypes/MaybeMonad.py
9
10
  prototypes/pipe.ipynb
10
11
  prototypes/pipe.py
12
+ scripts/format.py
11
13
  src/aletk/ResultMonad.py
12
14
  src/aletk/__init__.py
13
15
  src/aletk/_version.py
@@ -19,4 +21,4 @@ src/aletk.egg-info/SOURCES.txt
19
21
  src/aletk.egg-info/dependency_links.txt
20
22
  src/aletk.egg-info/requires.txt
21
23
  src/aletk.egg-info/top_level.txt
22
- tests/.gitkeep
24
+ tests/test_utils.py
@@ -5,4 +5,5 @@ python-Levenshtein
5
5
  mypy
6
6
  black
7
7
  pytest
8
+ autoflake
8
9
  jupyter
@@ -0,0 +1,19 @@
1
+ from src.aletk.utils import remove_extra_whitespace
2
+
3
+
4
+ def test_remove_extra_whitespace() -> None:
5
+
6
+ # Test normal case
7
+ input_str = " This is a test string. \n With extra \t whitespace. "
8
+ expected_output = "This is a test string. With extra whitespace."
9
+ assert remove_extra_whitespace(input_str) == expected_output
10
+
11
+ # Test empty string
12
+ input_str = ""
13
+ expected_output = ""
14
+ assert remove_extra_whitespace(input_str) == expected_output
15
+
16
+ # Test string with only whitespace
17
+ input_str = " \n\t "
18
+ expected_output = ""
19
+ assert remove_extra_whitespace(input_str) == expected_output
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes