tinystream 0.1.11__tar.gz → 0.1.12__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: tinystream
3
- Version: 0.1.11
3
+ Version: 0.1.12
4
4
  Summary: Yet another python streams library
5
5
  Home-page: https://github.com/mreiche/python-streams
6
6
  Author: Mike Reiche
@@ -61,7 +61,7 @@ assert Opt(None).absent
61
61
 
62
62
  Map *optional*:
63
63
  ```python
64
- assert Opt("String").map(len).get() == 6
64
+ assert Opt("String").len == 6
65
65
  ```
66
66
 
67
67
  Get default value:
@@ -52,7 +52,7 @@ assert Opt(None).absent
52
52
 
53
53
  Map *optional*:
54
54
  ```python
55
- assert Opt("String").map(len).get() == 6
55
+ assert Opt("String").len == 6
56
56
  ```
57
57
 
58
58
  Get default value:
@@ -10,7 +10,7 @@ setup(
10
10
  description="Yet another python streams library",
11
11
  long_description=long_description,
12
12
  long_description_content_type="text/markdown",
13
- version="0.1.11",
13
+ version="0.1.12",
14
14
  url="https://github.com/mreiche/python-streams",
15
15
  author="Mike Reiche",
16
16
  py_modules=['tinystream'],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tinystream
3
- Version: 0.1.11
3
+ Version: 0.1.12
4
4
  Summary: Yet another python streams library
5
5
  Home-page: https://github.com/mreiche/python-streams
6
6
  Author: Mike Reiche
@@ -61,7 +61,7 @@ assert Opt(None).absent
61
61
 
62
62
  Map *optional*:
63
63
  ```python
64
- assert Opt("String").map(len).get() == 6
64
+ assert Opt("String").len == 6
65
65
  ```
66
66
 
67
67
  Get default value:
@@ -127,6 +127,13 @@ class Opt(Generic[T]):
127
127
  def stream(self):
128
128
  return Stream(self.__val)
129
129
 
130
+ @property
131
+ def len(self):
132
+ if self.absent:
133
+ return 0
134
+ else:
135
+ return len(self.__val)
136
+
130
137
 
131
138
  class EmptyOpt(Opt[None]):
132
139
  def __init__(self):
@@ -151,6 +158,10 @@ class EmptyOpt(Opt[None]):
151
158
  def stream(self):
152
159
  return Stream([])
153
160
 
161
+ @property
162
+ def len(self):
163
+ return 0
164
+
154
165
 
155
166
  class Stream(Iterator[T]):
156
167
 
File without changes
File without changes