feilian 1.2.0__py3-none-any.whl → 1.2.1__py3-none-any.whl
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.
Potentially problematic release.
This version of feilian might be problematic. Click here for more details.
- feilian/__init__.py +2 -2
- feilian/_dist_ver.py +2 -2
- feilian/utils.py +19 -1
- {feilian-1.2.0.dist-info → feilian-1.2.1.dist-info}/METADATA +1 -1
- {feilian-1.2.0.dist-info → feilian-1.2.1.dist-info}/RECORD +7 -7
- {feilian-1.2.0.dist-info → feilian-1.2.1.dist-info}/WHEEL +1 -1
- {feilian-1.2.0.dist-info → feilian-1.2.1.dist-info}/top_level.txt +0 -0
feilian/__init__.py
CHANGED
|
@@ -7,7 +7,7 @@ from .datetime import format_time, format_date
|
|
|
7
7
|
from .arg import ArgValueParser
|
|
8
8
|
from .json import read_json, save_json
|
|
9
9
|
from .process import DataframeProcessor
|
|
10
|
-
from .utils import flatten_dict
|
|
10
|
+
from .utils import flatten_dict, flatten_list
|
|
11
11
|
from .version import __version__
|
|
12
12
|
|
|
13
13
|
__all__ = [
|
|
@@ -18,6 +18,6 @@ __all__ = [
|
|
|
18
18
|
'ArgValueParser',
|
|
19
19
|
'read_json', 'save_json',
|
|
20
20
|
'DataframeProcessor',
|
|
21
|
-
'flatten_dict',
|
|
21
|
+
'flatten_dict', 'flatten_list',
|
|
22
22
|
'__version__',
|
|
23
23
|
]
|
feilian/_dist_ver.py
CHANGED
feilian/utils.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# coding: utf-8
|
|
3
3
|
|
|
4
|
-
from typing import Dict, Any, Union, Collection
|
|
4
|
+
from typing import Dict, Any, Union, Collection, List
|
|
5
5
|
|
|
6
6
|
def flatten_dict(data: Dict[str, Any], prefix="", joiner=".",
|
|
7
7
|
exclude: Union[None, str, Collection[str]] = None,
|
|
@@ -62,3 +62,21 @@ def flatten_dict(data: Dict[str, Any], prefix="", joiner=".",
|
|
|
62
62
|
|
|
63
63
|
return res
|
|
64
64
|
|
|
65
|
+
|
|
66
|
+
def flatten_list(data: List[Any], res: List[Any] = None) -> List[Any]:
|
|
67
|
+
"""
|
|
68
|
+
Flatten nested list as a flat on layer list.
|
|
69
|
+
:param data: a nested list
|
|
70
|
+
:param res: the result flat layer list, create a new one if not given.
|
|
71
|
+
"""
|
|
72
|
+
if res is None:
|
|
73
|
+
res = []
|
|
74
|
+
|
|
75
|
+
for x in data:
|
|
76
|
+
if isinstance(x, list):
|
|
77
|
+
# flatten recursively
|
|
78
|
+
flatten_list(x, res)
|
|
79
|
+
else:
|
|
80
|
+
res.append(x)
|
|
81
|
+
|
|
82
|
+
return res
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
feilian/__init__.py,sha256=
|
|
2
|
-
feilian/_dist_ver.py,sha256=
|
|
1
|
+
feilian/__init__.py,sha256=97Rvz2O6LknvCWInAjINH4GeqG4-QPPcep9n-V7KD8k,911
|
|
2
|
+
feilian/_dist_ver.py,sha256=quKRw8l2uSmWwO0SXPBC-2dE29rT4esN_0UQ9PP_-bk,148
|
|
3
3
|
feilian/arg.py,sha256=n2nIcmC_3rb9A6BOzm9C5z3-T4lnubaGzH2sFhtqwZQ,8402
|
|
4
4
|
feilian/dataframe.py,sha256=DsUiNRuVAe2H6WwqtZ6TGu6WHiLxFEN_Xjl208xvvnw,10698
|
|
5
5
|
feilian/datetime.py,sha256=IONvWhLeGEy9IVe6GWKEW3FhrfRrShyhGP8-RTf9r3c,763
|
|
@@ -7,9 +7,9 @@ feilian/io.py,sha256=aYN3QwWcLoRKzhGMNutqdkmxArVcXfeWXzxCB07LcFc,155
|
|
|
7
7
|
feilian/json.py,sha256=1FkQ6e4JmbccpxhMobXpsGg-f7uVrTtUmu6jDCXCFTQ,1406
|
|
8
8
|
feilian/process.py,sha256=GLkmogYnhkxi6qf-JX-FwIlJAHmTynmgB7zSAggEe1E,2080
|
|
9
9
|
feilian/string.py,sha256=G_X3dnR0Oxmi4hXF-6E5jm5M7GPjGoMYrSMyI1dj6Z4,370
|
|
10
|
-
feilian/utils.py,sha256=
|
|
10
|
+
feilian/utils.py,sha256=pzzGEgngidVkYvuNJWY7KWjkdgGRuH5_ENaLS6kxBtk,2648
|
|
11
11
|
feilian/version.py,sha256=oH_DvE7jRCWlCCX9SSadwxwRJXFas_rIisYLBGPYZn4,350
|
|
12
|
-
feilian-1.2.
|
|
13
|
-
feilian-1.2.
|
|
14
|
-
feilian-1.2.
|
|
15
|
-
feilian-1.2.
|
|
12
|
+
feilian-1.2.1.dist-info/METADATA,sha256=v0pXur6UQVS3a6U8irka8ucSq9M-wyQ4bgshSv6IBJo,3723
|
|
13
|
+
feilian-1.2.1.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
|
|
14
|
+
feilian-1.2.1.dist-info/top_level.txt,sha256=1Q2-B6KJrcTr7drW_kik35PTVEUJLPP4wVrn0kYKwGw,8
|
|
15
|
+
feilian-1.2.1.dist-info/RECORD,,
|
|
File without changes
|