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 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
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # file generated by setuptools_scm
3
3
  # don't change, don't track in version control
4
- VERSION = (1, 2, 0)
5
- __version__ = '1.2.0'
4
+ VERSION = (1, 2, 1)
5
+ __version__ = '1.2.1'
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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: feilian
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary: General data processing tool.
5
5
  Author-email: darkpeath <darkpeath@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/darkpeath/feilian
@@ -1,5 +1,5 @@
1
- feilian/__init__.py,sha256=G5SKKbmcX8Um6BJ1-nZvMrXhiJnWJbDPMyBjhKkWWAc,881
2
- feilian/_dist_ver.py,sha256=U8gcehSDq7YjTNBnP2g7zZAOcoHw9_WLrgCWQX4QAUY,148
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=DqBKjpRBbSNipRDau9sYnoCfSDR_Of-xTOCoNxGWUJk,2180
10
+ feilian/utils.py,sha256=pzzGEgngidVkYvuNJWY7KWjkdgGRuH5_ENaLS6kxBtk,2648
11
11
  feilian/version.py,sha256=oH_DvE7jRCWlCCX9SSadwxwRJXFas_rIisYLBGPYZn4,350
12
- feilian-1.2.0.dist-info/METADATA,sha256=P-6B1-dzIzMm-4tQU_Ew7azWeMOo9X8pKTUrAF9rWwI,3723
13
- feilian-1.2.0.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
14
- feilian-1.2.0.dist-info/top_level.txt,sha256=1Q2-B6KJrcTr7drW_kik35PTVEUJLPP4wVrn0kYKwGw,8
15
- feilian-1.2.0.dist-info/RECORD,,
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,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.2.0)
2
+ Generator: setuptools (71.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5