smith-utils 0.2.1__tar.gz → 0.3.0__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 (27) hide show
  1. {smith_utils-0.2.1/src/smith_utils.egg-info → smith_utils-0.3.0}/PKG-INFO +10 -1
  2. {smith_utils-0.2.1 → smith_utils-0.3.0}/README.md +9 -0
  3. {smith_utils-0.2.1 → smith_utils-0.3.0}/pyproject.toml +1 -1
  4. {smith_utils-0.2.1 → smith_utils-0.3.0}/src/smith_utils/__init__.py +10 -0
  5. {smith_utils-0.2.1 → smith_utils-0.3.0}/src/smith_utils/text/__init__.py +4 -0
  6. {smith_utils-0.2.1 → smith_utils-0.3.0/src/smith_utils.egg-info}/PKG-INFO +10 -1
  7. {smith_utils-0.2.1 → smith_utils-0.3.0}/src/smith_utils.egg-info/SOURCES.txt +1 -0
  8. smith_utils-0.3.0/tests/test_package_exports.py +20 -0
  9. {smith_utils-0.2.1 → smith_utils-0.3.0}/LICENSE +0 -0
  10. {smith_utils-0.2.1 → smith_utils-0.3.0}/setup.cfg +0 -0
  11. {smith_utils-0.2.1 → smith_utils-0.3.0}/src/smith_utils/datetime/__init__.py +0 -0
  12. {smith_utils-0.2.1 → smith_utils-0.3.0}/src/smith_utils/datetime/date_utils.py +0 -0
  13. {smith_utils-0.2.1 → smith_utils-0.3.0}/src/smith_utils/numeric/__init__.py +0 -0
  14. {smith_utils-0.2.1 → smith_utils-0.3.0}/src/smith_utils/numeric/refinement.py +0 -0
  15. {smith_utils-0.2.1 → smith_utils-0.3.0}/src/smith_utils/text/metrics.py +0 -0
  16. {smith_utils-0.2.1 → smith_utils-0.3.0}/src/smith_utils/text/newlines.py +0 -0
  17. {smith_utils-0.2.1 → smith_utils-0.3.0}/src/smith_utils/text/normalization.py +0 -0
  18. {smith_utils-0.2.1 → smith_utils-0.3.0}/src/smith_utils/text/unicode_char_names.py +0 -0
  19. {smith_utils-0.2.1 → smith_utils-0.3.0}/src/smith_utils.egg-info/dependency_links.txt +0 -0
  20. {smith_utils-0.2.1 → smith_utils-0.3.0}/src/smith_utils.egg-info/requires.txt +0 -0
  21. {smith_utils-0.2.1 → smith_utils-0.3.0}/src/smith_utils.egg-info/top_level.txt +0 -0
  22. {smith_utils-0.2.1 → smith_utils-0.3.0}/tests/test_date_utils.py +0 -0
  23. {smith_utils-0.2.1 → smith_utils-0.3.0}/tests/test_metrics.py +0 -0
  24. {smith_utils-0.2.1 → smith_utils-0.3.0}/tests/test_newlines.py +0 -0
  25. {smith_utils-0.2.1 → smith_utils-0.3.0}/tests/test_normalization.py +0 -0
  26. {smith_utils-0.2.1 → smith_utils-0.3.0}/tests/test_refinement.py +0 -0
  27. {smith_utils-0.2.1 → smith_utils-0.3.0}/tests/test_unicode_char_names.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: smith-utils
3
- Version: 0.2.1
3
+ Version: 0.3.0
4
4
  Summary: A utility library for data cleaning and parsing.
5
5
  Author-email: Eiichi YAMAMOTO <info@yeiichi.com>
6
6
  License: MIT License
@@ -75,7 +75,11 @@ Clean and parse messy numeric data.
75
75
  Standardize text and compare string similarity.
76
76
  - `normalize_text`: Unicode NFKC normalization, case folding, and whitespace handling.
77
77
  - `StringDistance`: Implementation of Damerau-Levenshtein and Jaro-Winkler algorithms for fuzzy matching.
78
+ - `analyze_pair`: Convenience function for string comparison returning a `Result`.
79
+ - `Relation` / `Result`: Relation enum and typed result for text comparisons.
78
80
  - `make_unicode_char_name_records`: Extract Unicode codepoint/name metadata from text.
81
+ - `normalize_newlines_stream`: Stream-based newline normalization to LF with newline type detection.
82
+ - `normalize_file_to_lf`: File-based newline normalization helper.
79
83
 
80
84
  ## Installation
81
85
 
@@ -90,6 +94,7 @@ pip install smith-utils
90
94
  ```python
91
95
  from smith_utils import ensure_date, parse_numeric_value, normalize_text
92
96
  from smith_utils import make_unicode_char_name_records
97
+ from smith_utils import normalize_file_to_lf
93
98
 
94
99
  # Datetime
95
100
  date = ensure_date("20231225") # datetime.date(2023, 12, 25)
@@ -103,6 +108,10 @@ clean_text = normalize_text(" Smith Utils ") # "smith uti
103
108
  # Unicode metadata
104
109
  records = make_unicode_char_name_records("Aあ")
105
110
  # [UnicodeCharNameRecord(index=0, codepoint='U+0041', ...), ...]
111
+
112
+ # Normalize a file's newlines to LF
113
+ summary = normalize_file_to_lf("input.txt", "output.txt")
114
+ # {'newline_type': 'CRLF', 'bytes_in': ..., 'bytes_out': ...}
106
115
  ```
107
116
 
108
117
  ## Directory Structure
@@ -27,7 +27,11 @@ Clean and parse messy numeric data.
27
27
  Standardize text and compare string similarity.
28
28
  - `normalize_text`: Unicode NFKC normalization, case folding, and whitespace handling.
29
29
  - `StringDistance`: Implementation of Damerau-Levenshtein and Jaro-Winkler algorithms for fuzzy matching.
30
+ - `analyze_pair`: Convenience function for string comparison returning a `Result`.
31
+ - `Relation` / `Result`: Relation enum and typed result for text comparisons.
30
32
  - `make_unicode_char_name_records`: Extract Unicode codepoint/name metadata from text.
33
+ - `normalize_newlines_stream`: Stream-based newline normalization to LF with newline type detection.
34
+ - `normalize_file_to_lf`: File-based newline normalization helper.
31
35
 
32
36
  ## Installation
33
37
 
@@ -42,6 +46,7 @@ pip install smith-utils
42
46
  ```python
43
47
  from smith_utils import ensure_date, parse_numeric_value, normalize_text
44
48
  from smith_utils import make_unicode_char_name_records
49
+ from smith_utils import normalize_file_to_lf
45
50
 
46
51
  # Datetime
47
52
  date = ensure_date("20231225") # datetime.date(2023, 12, 25)
@@ -55,6 +60,10 @@ clean_text = normalize_text(" Smith Utils ") # "smith uti
55
60
  # Unicode metadata
56
61
  records = make_unicode_char_name_records("Aあ")
57
62
  # [UnicodeCharNameRecord(index=0, codepoint='U+0041', ...), ...]
63
+
64
+ # Normalize a file's newlines to LF
65
+ summary = normalize_file_to_lf("input.txt", "output.txt")
66
+ # {'newline_type': 'CRLF', 'bytes_in': ..., 'bytes_out': ...}
58
67
  ```
59
68
 
60
69
  ## Directory Structure
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "smith-utils"
7
- version = "0.2.1"
7
+ version = "0.3.0"
8
8
  description = "A utility library for data cleaning and parsing."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -1,20 +1,30 @@
1
1
  from .datetime import ensure_date, format_ordinal, parse_strict_date
2
2
  from .numeric import parse_currency_value, parse_numeric_value
3
3
  from .text import (
4
+ NewlineType,
5
+ Relation,
6
+ Result,
4
7
  StringDistance,
5
8
  UnicodeCharNameRecord,
6
9
  analyze_pair,
7
10
  make_unicode_char_name_records,
11
+ normalize_file_to_lf,
12
+ normalize_newlines_stream,
8
13
  normalize_text,
9
14
  )
10
15
 
11
16
  __all__ = [
17
+ "NewlineType",
18
+ "Relation",
19
+ "Result",
12
20
  "StringDistance",
13
21
  "UnicodeCharNameRecord",
14
22
  "analyze_pair",
15
23
  "ensure_date",
16
24
  "format_ordinal",
17
25
  "make_unicode_char_name_records",
26
+ "normalize_file_to_lf",
27
+ "normalize_newlines_stream",
18
28
  "normalize_text",
19
29
  "parse_currency_value",
20
30
  "parse_numeric_value",
@@ -1,8 +1,12 @@
1
1
  from .metrics import StringDistance, analyze_pair, Result, Relation
2
+ from .newlines import NewlineType, normalize_file_to_lf, normalize_newlines_stream
2
3
  from .normalization import normalize_text
3
4
  from .unicode_char_names import UnicodeCharNameRecord, make_unicode_char_name_records
4
5
 
5
6
  __all__ = [
7
+ "NewlineType",
8
+ "normalize_file_to_lf",
9
+ "normalize_newlines_stream",
6
10
  "StringDistance",
7
11
  "analyze_pair",
8
12
  "Result",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: smith-utils
3
- Version: 0.2.1
3
+ Version: 0.3.0
4
4
  Summary: A utility library for data cleaning and parsing.
5
5
  Author-email: Eiichi YAMAMOTO <info@yeiichi.com>
6
6
  License: MIT License
@@ -75,7 +75,11 @@ Clean and parse messy numeric data.
75
75
  Standardize text and compare string similarity.
76
76
  - `normalize_text`: Unicode NFKC normalization, case folding, and whitespace handling.
77
77
  - `StringDistance`: Implementation of Damerau-Levenshtein and Jaro-Winkler algorithms for fuzzy matching.
78
+ - `analyze_pair`: Convenience function for string comparison returning a `Result`.
79
+ - `Relation` / `Result`: Relation enum and typed result for text comparisons.
78
80
  - `make_unicode_char_name_records`: Extract Unicode codepoint/name metadata from text.
81
+ - `normalize_newlines_stream`: Stream-based newline normalization to LF with newline type detection.
82
+ - `normalize_file_to_lf`: File-based newline normalization helper.
79
83
 
80
84
  ## Installation
81
85
 
@@ -90,6 +94,7 @@ pip install smith-utils
90
94
  ```python
91
95
  from smith_utils import ensure_date, parse_numeric_value, normalize_text
92
96
  from smith_utils import make_unicode_char_name_records
97
+ from smith_utils import normalize_file_to_lf
93
98
 
94
99
  # Datetime
95
100
  date = ensure_date("20231225") # datetime.date(2023, 12, 25)
@@ -103,6 +108,10 @@ clean_text = normalize_text(" Smith Utils ") # "smith uti
103
108
  # Unicode metadata
104
109
  records = make_unicode_char_name_records("Aあ")
105
110
  # [UnicodeCharNameRecord(index=0, codepoint='U+0041', ...), ...]
111
+
112
+ # Normalize a file's newlines to LF
113
+ summary = normalize_file_to_lf("input.txt", "output.txt")
114
+ # {'newline_type': 'CRLF', 'bytes_in': ..., 'bytes_out': ...}
106
115
  ```
107
116
 
108
117
  ## Directory Structure
@@ -20,5 +20,6 @@ tests/test_date_utils.py
20
20
  tests/test_metrics.py
21
21
  tests/test_newlines.py
22
22
  tests/test_normalization.py
23
+ tests/test_package_exports.py
23
24
  tests/test_refinement.py
24
25
  tests/test_unicode_char_names.py
@@ -0,0 +1,20 @@
1
+ from src import smith_utils
2
+
3
+
4
+ def test_text_exports_are_available_globally():
5
+ expected = {
6
+ "NewlineType",
7
+ "normalize_file_to_lf",
8
+ "normalize_newlines_stream",
9
+ "StringDistance",
10
+ "analyze_pair",
11
+ "Result",
12
+ "Relation",
13
+ "normalize_text",
14
+ "UnicodeCharNameRecord",
15
+ "make_unicode_char_name_records",
16
+ }
17
+
18
+ for name in expected:
19
+ assert hasattr(smith_utils, name), f"missing export: {name}"
20
+ assert name in smith_utils.__all__
File without changes
File without changes