deep-sort-list-parser 1.0.0__tar.gz → 1.0.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.
- deep_sort_list_parser-1.0.1/PKG-INFO +63 -0
- deep_sort_list_parser-1.0.1/README.md +53 -0
- {deep_sort_list_parser-1.0.0 → deep_sort_list_parser-1.0.1}/pyproject.toml +1 -1
- deep_sort_list_parser-1.0.0/PKG-INFO +0 -8
- deep_sort_list_parser-1.0.0/README.md +0 -0
- {deep_sort_list_parser-1.0.0 → deep_sort_list_parser-1.0.1}/deep_sort_list.py +0 -0
- {deep_sort_list_parser-1.0.0 → deep_sort_list_parser-1.0.1}/deep_sort_list_test.py +0 -0
- {deep_sort_list_parser-1.0.0 → deep_sort_list_parser-1.0.1}/test_suite.py +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: deep_sort_list_parser
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: A recursive data parser to flatten and sort complex nested structures safely.
|
|
5
|
+
Author: Developer
|
|
6
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Requires-Python: >=3.8
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
|
|
11
|
+
# deep_sort_list
|
|
12
|
+
|
|
13
|
+
A bulletproof data parsing library designed to safely unwrap, flatten, and sort messy, multi-nested collections (Lists and Dictionaries) without crashing.
|
|
14
|
+
|
|
15
|
+
## What This Solves
|
|
16
|
+
Python's native `.sort()` method immediately crashes with a `TypeError` if a list contains mixed data types (like strings and integers together), or if it contains nested structures.
|
|
17
|
+
|
|
18
|
+
This library completely bypasses that limitation by automatically separating elements into distinct, sorted data streams.
|
|
19
|
+
|
|
20
|
+
## 🚀 How to Use
|
|
21
|
+
|
|
22
|
+
Save `deep_sort_list.py` in your project folder, import it, and pass your data payload into the `clean_and_flatten` function.
|
|
23
|
+
|
|
24
|
+
### 🔹 Scenario 1: Sorting a Complex, Mixed Input
|
|
25
|
+
You can pass completely mixed lists, nested sublists, or even single items directly without a crash.
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
import deep_sort_list
|
|
29
|
+
|
|
30
|
+
# A chaotic list containing numbers, strings, symbols, and nested boxes
|
|
31
|
+
data = [44, [3, "@#%&"], "banana"]
|
|
32
|
+
|
|
33
|
+
result = deep_sort_list.clean_and_flatten(data)
|
|
34
|
+
|
|
35
|
+
print(result["numbers"]) # Output: [3, 44]
|
|
36
|
+
print(result["words"]) # Output: ['banana']
|
|
37
|
+
print(result["symbols"]) # Output: ['@#%&']
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 🔹 Scenario 2: Handling Nested Dictionaries (Locker Sorting)
|
|
41
|
+
If your list contains multi-layered dictionaries, the engine digs through every sub-layer, alphabetizes all keys, keeps the values safely locked to their pairs, and puts them into a dedicated track.
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
nested_data = [{"sex": "Female", "name": {"last": "Singh", "first": "Shreya"}}]
|
|
45
|
+
|
|
46
|
+
result = deep_sort_list.clean_and_flatten(nested_data)
|
|
47
|
+
print(result["dictionaries"])
|
|
48
|
+
# Output: [{'name': {'first': 'Shreya', 'last': 'Singh'}, 'sex': 'Female'}]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 🔹 Scenario 3: Smart Number Conversion
|
|
52
|
+
By default, text digits like `'100'` are kept in the words track. Set `convert_numeric_strings=True` to dynamically convert and sort them as math integers.
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
result = deep_sort_list.clean_and_flatten(data, convert_numeric_strings=True)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## 📊 Return Format
|
|
59
|
+
The function returns a clean Python dictionary with four tracks:
|
|
60
|
+
- `result["numbers"]`: Sorted integers and floats.
|
|
61
|
+
- `result["words"]`: Sorted text strings.
|
|
62
|
+
- `result["symbols"]`: Sorted special punctuation marks (like `@`, `#`, `^`).
|
|
63
|
+
- `result["dictionaries"]`: Deeply key-sorted internal dictionary blocks.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# deep_sort_list
|
|
2
|
+
|
|
3
|
+
A bulletproof data parsing library designed to safely unwrap, flatten, and sort messy, multi-nested collections (Lists and Dictionaries) without crashing.
|
|
4
|
+
|
|
5
|
+
## What This Solves
|
|
6
|
+
Python's native `.sort()` method immediately crashes with a `TypeError` if a list contains mixed data types (like strings and integers together), or if it contains nested structures.
|
|
7
|
+
|
|
8
|
+
This library completely bypasses that limitation by automatically separating elements into distinct, sorted data streams.
|
|
9
|
+
|
|
10
|
+
## 🚀 How to Use
|
|
11
|
+
|
|
12
|
+
Save `deep_sort_list.py` in your project folder, import it, and pass your data payload into the `clean_and_flatten` function.
|
|
13
|
+
|
|
14
|
+
### 🔹 Scenario 1: Sorting a Complex, Mixed Input
|
|
15
|
+
You can pass completely mixed lists, nested sublists, or even single items directly without a crash.
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
import deep_sort_list
|
|
19
|
+
|
|
20
|
+
# A chaotic list containing numbers, strings, symbols, and nested boxes
|
|
21
|
+
data = [44, [3, "@#%&"], "banana"]
|
|
22
|
+
|
|
23
|
+
result = deep_sort_list.clean_and_flatten(data)
|
|
24
|
+
|
|
25
|
+
print(result["numbers"]) # Output: [3, 44]
|
|
26
|
+
print(result["words"]) # Output: ['banana']
|
|
27
|
+
print(result["symbols"]) # Output: ['@#%&']
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 🔹 Scenario 2: Handling Nested Dictionaries (Locker Sorting)
|
|
31
|
+
If your list contains multi-layered dictionaries, the engine digs through every sub-layer, alphabetizes all keys, keeps the values safely locked to their pairs, and puts them into a dedicated track.
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
nested_data = [{"sex": "Female", "name": {"last": "Singh", "first": "Shreya"}}]
|
|
35
|
+
|
|
36
|
+
result = deep_sort_list.clean_and_flatten(nested_data)
|
|
37
|
+
print(result["dictionaries"])
|
|
38
|
+
# Output: [{'name': {'first': 'Shreya', 'last': 'Singh'}, 'sex': 'Female'}]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 🔹 Scenario 3: Smart Number Conversion
|
|
42
|
+
By default, text digits like `'100'` are kept in the words track. Set `convert_numeric_strings=True` to dynamically convert and sort them as math integers.
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
result = deep_sort_list.clean_and_flatten(data, convert_numeric_strings=True)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 📊 Return Format
|
|
49
|
+
The function returns a clean Python dictionary with four tracks:
|
|
50
|
+
- `result["numbers"]`: Sorted integers and floats.
|
|
51
|
+
- `result["words"]`: Sorted text strings.
|
|
52
|
+
- `result["symbols"]`: Sorted special punctuation marks (like `@`, `#`, `^`).
|
|
53
|
+
- `result["dictionaries"]`: Deeply key-sorted internal dictionary blocks.
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "deep_sort_list_parser"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.1"
|
|
8
8
|
description = "A recursive data parser to flatten and sort complex nested structures safely."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: deep_sort_list_parser
|
|
3
|
-
Version: 1.0.0
|
|
4
|
-
Summary: A recursive data parser to flatten and sort complex nested structures safely.
|
|
5
|
-
Author: Developer
|
|
6
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
|
8
|
-
Requires-Python: >=3.8
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|