1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
%global _empty_manifest_terminate_build 0
Name: python-FINQ
Version: 1.1.4
Release: 1
Summary: Lightweight conveyor data processing python framework
License: Apache Software License
URL: https://github.com/FacelessLord/FINQ
Source0: https://mirrors.aliyun.com/pypi/web/packages/8a/2b/4a12fd9db5dea836c9d7c3318e647992d1f6e5e641306fe78171a163b6d7/FINQ-1.1.4.tar.gz
BuildArch: noarch
%description
# FINQ
Lightweight conveyor data processing python framework, which allows to quickly write long queries without a fear that it'll become unreadable,
because FINQ as opposed to standard library allows you to write each logical part of query at next line without tearing it and expanding logical block over whole function
## Start
To start conveyor processing of your iterable you need to wrap it with `FINQ()` object which then allows you to call Basic methods
## Basic methods
| Method | IsTerminal | Description |
|--------------------------------------------------|------------|---------------------------------------------------------------------------------------------------------------------------|
| `concat(b:Iterable[T])` | - | Concatenates two sequences, creating sequence that contains items of the first iterable then of second iterable. |
| `map(*f:T -> T2)` | - | Applies given function to every element of sequence. |
| `zip(b:Iterable[T])` | - | Pairs corresponding elements of two sequences in pairs. |
| `flat_map(f:T -> Collection[T2] = Identity)` | - | Applies given function to every element to get collection, then glues these collections. |
| `flatten(f:T -> Collection[T] = Identity)` | - | Applies given function to every element to get collection, then glues these collections. Repeats until all elements are non iterable. |
| `filter(f:T -> bool)` | - | Removes elements that doesn't satisfy predicate from sequence. |
| `distinct(f:T -> T2)` | - | Skips elements which `f(element)` repeated. |
| `sort(f:T -> int)` | - | Sorts sequence elements by key given by `f`. |
| `skip(count:int)` | - | Skips `count` elements from sequence. |
| `take(count:int)` | - | Limits sequence by `count` elements, dropping others. |
| `cartesian_product(b:Iterable[T1], mapping:TxT1 -> T2)` | - | Returns Cartesian product of two sequences after application of mapping if specified. |
| `cartesian_power(pow:int, mapping:T^pow -> T2)` | - | Returns Cartesian power of sequence after application of mapping if specified. |
| `pairs()` | - | Returns Cartesian square of sequence. Equivalent to Cartesian square with Identity mapping. |
| `enumerate(start=0)` | - | Maps sequence elements to pair which first value is index in sequence starting by `start`. |
| `peek(f:T -> ())` | - | Applies function to each element in sequence leaving sequence unchanged. |
| `group_by(mapping:T -> T2 = Identity)` | - | Splits sequence into sequence of lists of elements which `f(x)` is the same. |
| `random(precentage:float)` | - | Takes roughly `percentage*100%` of random elements of sequence. |
| `sort_randomly()` | - | Shuffles sequence. |
| `join_str(delimiter:str)` | + | Joins sequence by `delimiter`. |
| `join(seq:Iterable[T2], cond: :TxT2 -> bool, aggr:TxT2 -> T3)`| + | Joins two sequences. Two values are aggregated if `condition` is true. |
| `for_each(f:T -> () = Consumer)` | + | Calls `f` for every element of a sequence. Equivalent to:<br> <code>for e in collection:</code><br><code> f(e)</code>. |
| `all(f:T -> bool = IdentityTrue)` | + | Checks if all elements in sequence satisfy predicate. |
| `any(f:T -> bool = IdentityTrue)` | + | Checks if there exist element in sequence that satisfies predicate. |
| `none(f:T -> bool = IdentityTrue)` | + | Checks if there no element in sequence that satisfies predicate. |
| `first()` | + | Takes first element of sequence. |
| `to_list()` | + | Creates default python-list containing all sequence elements. |
| `to_set()` | + | Creates default python-set containing all distinct sequence elements. |
| `to_counter()` | + | Creates Counter containing all sequence elements. |
| `to_dict(key:T -> TKey = First, value:T -> TValue = Second)` | + | Creates default python-dict containing mapping `(key(x), value(x))` for every `x` in sequence. |
| `count()` | + | Returns count of elements in sequence. |
| `min()` | + | Finds minimal element in sequence. |
| `max()` | + | Finds maximal element in sequence. |
| `sum()` | + | Sums all elements of sequence. Works only for summable types. |
| `max_diff()` | + | Counts maximal difference between elements. Equal to difference between max and min for sequence. |
| `reduce(f:TxT -> T, /, first:T)` | + | Applies function to first two elements, then to result and next element until elements end. Allows to specify first element. |
| `fold(m:T -> T2, g:T2xT2 -> T2)` | + | Applies mapper to each element, then aggregates pairs of T2 into single T2 until elements end. Equivalent to `finq.map(mapper).reduce(aggregator)` |
## Constant functions
These functions aren't intended to be called manually. Instead you have to pass them as an arguments to FINQ methods as mappings, reducers, predicates.
Ordered Collection here is any collection which provides `__get_item__` based on index (Tuple, List)
| Method | | Returns |
|-----------------|---------------|-------------|
| `Identity` | `T -> T` | Given argument |
| `Consumer` | `T -> None` | None |
| `IdentityTrue` | `T -> bool` | True for any argument |
| `IdentityFalse` | `T -> bool` | False for any value |
| `Sum` | `TxT -> T` | Sum of two given values |
| `PairSum` | `T^2 -> T` | Sum of first two values of Ordered Collection |
| `First` | `T^n -> T` | First value of Ordered Collection |
| `Second` | `T^n -> T` | Second value of Ordered Collection |
| `Multiply` | `TxT -> T` | Product of two given value |
| `Square` | `T -> T` | Square of given value |
| `OneArgRandom` | `T -> float` | Random value independent of given value |
| `TupleSum` | `T^n -> T` | Sum of given Ordered Collection |
| `PairWith` | `F^n -> (T -> T^2)` | Function that, when applied to value `e` returns `e, f1(f2(...fn(e)...))` |
| `RPairWith` | `F^n -> (T -> T^2)` | Function that, when applied to value `e` returns `f1(f2(...fn(e)...)), e` |
| `Compose` | `F^n -> F` | Function that, when applied to value `e` returns `f1(f2(...fn(e)...))` |
%package -n python3-FINQ
Summary: Lightweight conveyor data processing python framework
Provides: python-FINQ
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-FINQ
# FINQ
Lightweight conveyor data processing python framework, which allows to quickly write long queries without a fear that it'll become unreadable,
because FINQ as opposed to standard library allows you to write each logical part of query at next line without tearing it and expanding logical block over whole function
## Start
To start conveyor processing of your iterable you need to wrap it with `FINQ()` object which then allows you to call Basic methods
## Basic methods
| Method | IsTerminal | Description |
|--------------------------------------------------|------------|---------------------------------------------------------------------------------------------------------------------------|
| `concat(b:Iterable[T])` | - | Concatenates two sequences, creating sequence that contains items of the first iterable then of second iterable. |
| `map(*f:T -> T2)` | - | Applies given function to every element of sequence. |
| `zip(b:Iterable[T])` | - | Pairs corresponding elements of two sequences in pairs. |
| `flat_map(f:T -> Collection[T2] = Identity)` | - | Applies given function to every element to get collection, then glues these collections. |
| `flatten(f:T -> Collection[T] = Identity)` | - | Applies given function to every element to get collection, then glues these collections. Repeats until all elements are non iterable. |
| `filter(f:T -> bool)` | - | Removes elements that doesn't satisfy predicate from sequence. |
| `distinct(f:T -> T2)` | - | Skips elements which `f(element)` repeated. |
| `sort(f:T -> int)` | - | Sorts sequence elements by key given by `f`. |
| `skip(count:int)` | - | Skips `count` elements from sequence. |
| `take(count:int)` | - | Limits sequence by `count` elements, dropping others. |
| `cartesian_product(b:Iterable[T1], mapping:TxT1 -> T2)` | - | Returns Cartesian product of two sequences after application of mapping if specified. |
| `cartesian_power(pow:int, mapping:T^pow -> T2)` | - | Returns Cartesian power of sequence after application of mapping if specified. |
| `pairs()` | - | Returns Cartesian square of sequence. Equivalent to Cartesian square with Identity mapping. |
| `enumerate(start=0)` | - | Maps sequence elements to pair which first value is index in sequence starting by `start`. |
| `peek(f:T -> ())` | - | Applies function to each element in sequence leaving sequence unchanged. |
| `group_by(mapping:T -> T2 = Identity)` | - | Splits sequence into sequence of lists of elements which `f(x)` is the same. |
| `random(precentage:float)` | - | Takes roughly `percentage*100%` of random elements of sequence. |
| `sort_randomly()` | - | Shuffles sequence. |
| `join_str(delimiter:str)` | + | Joins sequence by `delimiter`. |
| `join(seq:Iterable[T2], cond: :TxT2 -> bool, aggr:TxT2 -> T3)`| + | Joins two sequences. Two values are aggregated if `condition` is true. |
| `for_each(f:T -> () = Consumer)` | + | Calls `f` for every element of a sequence. Equivalent to:<br> <code>for e in collection:</code><br><code> f(e)</code>. |
| `all(f:T -> bool = IdentityTrue)` | + | Checks if all elements in sequence satisfy predicate. |
| `any(f:T -> bool = IdentityTrue)` | + | Checks if there exist element in sequence that satisfies predicate. |
| `none(f:T -> bool = IdentityTrue)` | + | Checks if there no element in sequence that satisfies predicate. |
| `first()` | + | Takes first element of sequence. |
| `to_list()` | + | Creates default python-list containing all sequence elements. |
| `to_set()` | + | Creates default python-set containing all distinct sequence elements. |
| `to_counter()` | + | Creates Counter containing all sequence elements. |
| `to_dict(key:T -> TKey = First, value:T -> TValue = Second)` | + | Creates default python-dict containing mapping `(key(x), value(x))` for every `x` in sequence. |
| `count()` | + | Returns count of elements in sequence. |
| `min()` | + | Finds minimal element in sequence. |
| `max()` | + | Finds maximal element in sequence. |
| `sum()` | + | Sums all elements of sequence. Works only for summable types. |
| `max_diff()` | + | Counts maximal difference between elements. Equal to difference between max and min for sequence. |
| `reduce(f:TxT -> T, /, first:T)` | + | Applies function to first two elements, then to result and next element until elements end. Allows to specify first element. |
| `fold(m:T -> T2, g:T2xT2 -> T2)` | + | Applies mapper to each element, then aggregates pairs of T2 into single T2 until elements end. Equivalent to `finq.map(mapper).reduce(aggregator)` |
## Constant functions
These functions aren't intended to be called manually. Instead you have to pass them as an arguments to FINQ methods as mappings, reducers, predicates.
Ordered Collection here is any collection which provides `__get_item__` based on index (Tuple, List)
| Method | | Returns |
|-----------------|---------------|-------------|
| `Identity` | `T -> T` | Given argument |
| `Consumer` | `T -> None` | None |
| `IdentityTrue` | `T -> bool` | True for any argument |
| `IdentityFalse` | `T -> bool` | False for any value |
| `Sum` | `TxT -> T` | Sum of two given values |
| `PairSum` | `T^2 -> T` | Sum of first two values of Ordered Collection |
| `First` | `T^n -> T` | First value of Ordered Collection |
| `Second` | `T^n -> T` | Second value of Ordered Collection |
| `Multiply` | `TxT -> T` | Product of two given value |
| `Square` | `T -> T` | Square of given value |
| `OneArgRandom` | `T -> float` | Random value independent of given value |
| `TupleSum` | `T^n -> T` | Sum of given Ordered Collection |
| `PairWith` | `F^n -> (T -> T^2)` | Function that, when applied to value `e` returns `e, f1(f2(...fn(e)...))` |
| `RPairWith` | `F^n -> (T -> T^2)` | Function that, when applied to value `e` returns `f1(f2(...fn(e)...)), e` |
| `Compose` | `F^n -> F` | Function that, when applied to value `e` returns `f1(f2(...fn(e)...))` |
%package help
Summary: Development documents and examples for FINQ
Provides: python3-FINQ-doc
%description help
# FINQ
Lightweight conveyor data processing python framework, which allows to quickly write long queries without a fear that it'll become unreadable,
because FINQ as opposed to standard library allows you to write each logical part of query at next line without tearing it and expanding logical block over whole function
## Start
To start conveyor processing of your iterable you need to wrap it with `FINQ()` object which then allows you to call Basic methods
## Basic methods
| Method | IsTerminal | Description |
|--------------------------------------------------|------------|---------------------------------------------------------------------------------------------------------------------------|
| `concat(b:Iterable[T])` | - | Concatenates two sequences, creating sequence that contains items of the first iterable then of second iterable. |
| `map(*f:T -> T2)` | - | Applies given function to every element of sequence. |
| `zip(b:Iterable[T])` | - | Pairs corresponding elements of two sequences in pairs. |
| `flat_map(f:T -> Collection[T2] = Identity)` | - | Applies given function to every element to get collection, then glues these collections. |
| `flatten(f:T -> Collection[T] = Identity)` | - | Applies given function to every element to get collection, then glues these collections. Repeats until all elements are non iterable. |
| `filter(f:T -> bool)` | - | Removes elements that doesn't satisfy predicate from sequence. |
| `distinct(f:T -> T2)` | - | Skips elements which `f(element)` repeated. |
| `sort(f:T -> int)` | - | Sorts sequence elements by key given by `f`. |
| `skip(count:int)` | - | Skips `count` elements from sequence. |
| `take(count:int)` | - | Limits sequence by `count` elements, dropping others. |
| `cartesian_product(b:Iterable[T1], mapping:TxT1 -> T2)` | - | Returns Cartesian product of two sequences after application of mapping if specified. |
| `cartesian_power(pow:int, mapping:T^pow -> T2)` | - | Returns Cartesian power of sequence after application of mapping if specified. |
| `pairs()` | - | Returns Cartesian square of sequence. Equivalent to Cartesian square with Identity mapping. |
| `enumerate(start=0)` | - | Maps sequence elements to pair which first value is index in sequence starting by `start`. |
| `peek(f:T -> ())` | - | Applies function to each element in sequence leaving sequence unchanged. |
| `group_by(mapping:T -> T2 = Identity)` | - | Splits sequence into sequence of lists of elements which `f(x)` is the same. |
| `random(precentage:float)` | - | Takes roughly `percentage*100%` of random elements of sequence. |
| `sort_randomly()` | - | Shuffles sequence. |
| `join_str(delimiter:str)` | + | Joins sequence by `delimiter`. |
| `join(seq:Iterable[T2], cond: :TxT2 -> bool, aggr:TxT2 -> T3)`| + | Joins two sequences. Two values are aggregated if `condition` is true. |
| `for_each(f:T -> () = Consumer)` | + | Calls `f` for every element of a sequence. Equivalent to:<br> <code>for e in collection:</code><br><code> f(e)</code>. |
| `all(f:T -> bool = IdentityTrue)` | + | Checks if all elements in sequence satisfy predicate. |
| `any(f:T -> bool = IdentityTrue)` | + | Checks if there exist element in sequence that satisfies predicate. |
| `none(f:T -> bool = IdentityTrue)` | + | Checks if there no element in sequence that satisfies predicate. |
| `first()` | + | Takes first element of sequence. |
| `to_list()` | + | Creates default python-list containing all sequence elements. |
| `to_set()` | + | Creates default python-set containing all distinct sequence elements. |
| `to_counter()` | + | Creates Counter containing all sequence elements. |
| `to_dict(key:T -> TKey = First, value:T -> TValue = Second)` | + | Creates default python-dict containing mapping `(key(x), value(x))` for every `x` in sequence. |
| `count()` | + | Returns count of elements in sequence. |
| `min()` | + | Finds minimal element in sequence. |
| `max()` | + | Finds maximal element in sequence. |
| `sum()` | + | Sums all elements of sequence. Works only for summable types. |
| `max_diff()` | + | Counts maximal difference between elements. Equal to difference between max and min for sequence. |
| `reduce(f:TxT -> T, /, first:T)` | + | Applies function to first two elements, then to result and next element until elements end. Allows to specify first element. |
| `fold(m:T -> T2, g:T2xT2 -> T2)` | + | Applies mapper to each element, then aggregates pairs of T2 into single T2 until elements end. Equivalent to `finq.map(mapper).reduce(aggregator)` |
## Constant functions
These functions aren't intended to be called manually. Instead you have to pass them as an arguments to FINQ methods as mappings, reducers, predicates.
Ordered Collection here is any collection which provides `__get_item__` based on index (Tuple, List)
| Method | | Returns |
|-----------------|---------------|-------------|
| `Identity` | `T -> T` | Given argument |
| `Consumer` | `T -> None` | None |
| `IdentityTrue` | `T -> bool` | True for any argument |
| `IdentityFalse` | `T -> bool` | False for any value |
| `Sum` | `TxT -> T` | Sum of two given values |
| `PairSum` | `T^2 -> T` | Sum of first two values of Ordered Collection |
| `First` | `T^n -> T` | First value of Ordered Collection |
| `Second` | `T^n -> T` | Second value of Ordered Collection |
| `Multiply` | `TxT -> T` | Product of two given value |
| `Square` | `T -> T` | Square of given value |
| `OneArgRandom` | `T -> float` | Random value independent of given value |
| `TupleSum` | `T^n -> T` | Sum of given Ordered Collection |
| `PairWith` | `F^n -> (T -> T^2)` | Function that, when applied to value `e` returns `e, f1(f2(...fn(e)...))` |
| `RPairWith` | `F^n -> (T -> T^2)` | Function that, when applied to value `e` returns `f1(f2(...fn(e)...)), e` |
| `Compose` | `F^n -> F` | Function that, when applied to value `e` returns `f1(f2(...fn(e)...))` |
%prep
%autosetup -n FINQ-1.1.4
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-FINQ -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Tue Jun 20 2023 Python_Bot <Python_Bot@openeuler.org> - 1.1.4-1
- Package Spec generated
|