pipe21 1.7.3__tar.gz → 1.8.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pipe21
3
- Version: 1.7.3
3
+ Version: 1.8.0
4
4
  Summary: simple functional pipes
5
5
  Author-email: Alexander Rodionov <tandav@tandav.me>
6
6
  Project-URL: source, https://github.com/tandav/pipe21
@@ -12,6 +12,7 @@ Description-Content-Type: text/markdown
12
12
  Provides-Extra: dev
13
13
 
14
14
  [![PyPI version](https://img.shields.io/pypi/v/pipe21.svg?logo=pypi&logoColor=FFE873)](https://pypi.org/project/pipe21/)
15
+ [![Coverage Status](https://coveralls.io/repos/github/tandav/pipe21/badge.svg?branch=coveralls-bage)](https://coveralls.io/github/tandav/pipe21?branch=coveralls-bage)
15
16
 
16
17
  # pipe21 - simple functional pipes [[docs]](https://tandav.github.io/pipe21)
17
18
 
@@ -1,4 +1,5 @@
1
1
  [![PyPI version](https://img.shields.io/pypi/v/pipe21.svg?logo=pypi&logoColor=FFE873)](https://pypi.org/project/pipe21/)
2
+ [![Coverage Status](https://coveralls.io/repos/github/tandav/pipe21/badge.svg?branch=coveralls-bage)](https://coveralls.io/github/tandav/pipe21?branch=coveralls-bage)
2
3
 
3
4
  # pipe21 - simple functional pipes [[docs]](https://tandav.github.io/pipe21)
4
5
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pipe21
3
- Version: 1.7.3
3
+ Version: 1.8.0
4
4
  Summary: simple functional pipes
5
5
  Author-email: Alexander Rodionov <tandav@tandav.me>
6
6
  Project-URL: source, https://github.com/tandav/pipe21
@@ -12,6 +12,7 @@ Description-Content-Type: text/markdown
12
12
  Provides-Extra: dev
13
13
 
14
14
  [![PyPI version](https://img.shields.io/pypi/v/pipe21.svg?logo=pypi&logoColor=FFE873)](https://pypi.org/project/pipe21/)
15
+ [![Coverage Status](https://coveralls.io/repos/github/tandav/pipe21/badge.svg?branch=coveralls-bage)](https://coveralls.io/github/tandav/pipe21?branch=coveralls-bage)
15
16
 
16
17
  # pipe21 - simple functional pipes [[docs]](https://tandav.github.io/pipe21)
17
18
 
@@ -1,10 +1,12 @@
1
1
 
2
2
  [dev]
3
3
  bumpver
4
+ black
5
+ autopep8
4
6
  pre-commit
5
7
  hypothesis
6
- mypy
7
8
  pytest
8
9
  pytest-cov
10
+ coveralls
9
11
  mkdocs
10
12
  mkdocs-material
@@ -2,17 +2,18 @@ import functools
2
2
  import itertools
3
3
  import re
4
4
 
5
- __version__ = '1.7.3'
5
+ __version__ = '1.8.0'
6
6
 
7
7
 
8
8
  class B:
9
- def __init__(self, f=None, **kw): self.f = f; self.kw = kw
9
+ def __init__(self, f=None, *args, **kw):
10
+ self.f = f; self.args = args; self.kw = kw
10
11
  class Pipe (B): __ror__ = lambda self, x: self.f(x)
11
12
  class Map (B): __ror__ = lambda self, x: map (self.f, x)
12
13
  class Filter(B): __ror__ = lambda self, x: filter(self.f, x)
13
14
 
14
15
 
15
- class Reduce (B): __ror__ = lambda self, x: functools.reduce(self.f, x)
16
+ class Reduce (B): __ror__ = lambda self, x: functools.reduce(self.f, x, *self.args)
16
17
  class MapValues (B): __ror__ = lambda self, it: it | Map(lambda kv: (kv[0], self.f(kv[1])))
17
18
  class MapKeys (B): __ror__ = lambda self, it: it | Map(lambda kv: (self.f(kv[0]), kv[1]))
18
19
  class FilterFalse (B): __ror__ = lambda self, it: it | Filter(lambda x: not self.f(x))
@@ -28,7 +29,8 @@ class Values (B): __ror__ = lambda self, it: it | Map(lambda x: x[1])
28
29
  class Grep (B): __ror__ = lambda self, it: it | Filter(lambda x: re.search(self.f, x))
29
30
  class GrepV (B): __ror__ = lambda self, it: it | Filter(lambda x: not re.search(self.f, x))
30
31
  class Count (B): __ror__ = lambda self, it: sum(1 for _ in it)
31
- class Take (B): __ror__ = lambda self, it: itertools.islice(it, self.f) | Pipe(tuple)
32
+ class Slice (B): __ror__ = lambda self, it: itertools.islice(it, self.f, *self.args)
33
+ class Take (B): __ror__ = lambda self, it: it | Slice(self.f) | Pipe(tuple)
32
34
  class Chunked (B): __ror__ = lambda self, it: iter(functools.partial(lambda n, i: i | Take(n), self.f, iter(it)), ())
33
35
  class GroupBy (B): __ror__ = lambda self, it: itertools.groupby(it, key=self.f)
34
36
  class PipeArgs (B): __ror__ = lambda self, x: self.f(*x)
@@ -36,6 +38,7 @@ class StarMap (B): __ror__ = lambda self, x: x | Map(lambda y: y | PipeArgs
36
38
  class IsUnique (B): __ror__ = lambda self, seq: len(seq) == len(set(seq if self.f is None else map(self.f, seq)))
37
39
  class Sorted (B): __ror__ = lambda self, it: sorted(it, **self.kw)
38
40
  class MapApply (B): __ror__ = lambda self, it: it | Map(lambda x: x | Apply(self.f))
41
+ class ReduceByKey (B): __ror__ = lambda self, it: it | Sorted(lambda kv: kv[0]) | GroupBy(lambda kv: kv[0]) | MapValues(lambda kv: kv | Values() | Reduce(self.f)) | Pipe(list)
39
42
 
40
43
 
41
44
  class Unique(B):
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pipe21"
3
- version = "1.7.3"
3
+ version = "1.8.0"
4
4
  authors = [
5
5
  {name = "Alexander Rodionov", email = "tandav@tandav.me"},
6
6
  ]
@@ -12,11 +12,13 @@ dependencies = []
12
12
  [project.optional-dependencies]
13
13
  dev = [
14
14
  "bumpver",
15
+ "black",
16
+ "autopep8",
15
17
  "pre-commit",
16
18
  "hypothesis",
17
- "mypy",
18
19
  "pytest",
19
20
  "pytest-cov",
21
+ "coveralls",
20
22
  "mkdocs",
21
23
  "mkdocs-material",
22
24
  ]
@@ -41,7 +43,7 @@ build-backend = "setuptools.build_meta"
41
43
  # ==============================================================================
42
44
 
43
45
  [tool.bumpver]
44
- current_version = "v1.7.3"
46
+ current_version = "v1.8.0"
45
47
  version_pattern = "vMAJOR.MINOR.PATCH"
46
48
  commit_message = "bump version {old_version} -> {new_version}"
47
49
  commit = true
@@ -133,6 +135,7 @@ disable = [
133
135
  "W1514",
134
136
  "W0401", # wildcard import
135
137
  "W0614",
138
+ "W1113",
136
139
  "R0903",
137
140
  "E0401",
138
141
  ]
File without changes