feilian 1.2.0__tar.gz → 1.2.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.

Potentially problematic release.


This version of feilian might be problematic. Click here for more details.

@@ -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
@@ -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
  ]
@@ -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'
@@ -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
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