Skip to content

Commit 9e21499

Browse files
committed
Fix deepsource issues
1 parent 5d741d9 commit 9e21499

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

pystreamapi/_streams/__base_stream.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121

2222

2323
def _operation(func):
24+
"""
25+
Decorator to execute all the processes in the queue before executing the decorated function.
26+
To be applied to intermediate operations.
27+
"""
2428
@functools.wraps(func)
2529
def wrapper(*args, **kwargs):
2630
self: BaseStream = args[0]
@@ -65,9 +69,11 @@ def __init__(self, source: Iterable[K]):
6569
self._open = True
6670

6771
def _close(self):
72+
"""Close the stream."""
6873
self._open = False
6974

7075
def _verify_open(self):
76+
"""Verify if stream is open. If not, raise an exception."""
7177
if not self._open:
7278
raise RuntimeError("The stream has been closed")
7379

@@ -233,7 +239,6 @@ def peek(self, action: Callable) -> 'BaseStream[_V]':
233239
def _peek(self, action: Callable):
234240
"""Implementation of peek. Should be implemented by subclasses."""
235241

236-
237242
@_operation
238243
def reversed(self) -> 'BaseStream[_V]':
239244
"""

pystreamapi/_streams/numeric/__numeric_base_stream.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def interquartile_range(self) -> Union[float, int, None]:
2121
return self._interquartile_range()
2222

2323
def _interquartile_range(self):
24+
"""Implementation of the interquartile range calculation"""
2425
return self._third_quartile() - self._first_quartile() if len(self._source) > 0 else None
2526

2627
@terminal
@@ -32,6 +33,7 @@ def first_quartile(self) -> Union[float, int, None]:
3233
return self._first_quartile()
3334

3435
def _first_quartile(self):
36+
"""Implementation of the first quartile calculation"""
3537
self._source = sorted(self._source)
3638
return self.__median(self._source[:(len(self._source)) // 2])
3739

@@ -99,5 +101,6 @@ def third_quartile(self) -> Union[float, int, None]:
99101
return self._third_quartile()
100102

101103
def _third_quartile(self):
104+
"""Implementation of the third quartile calculation"""
102105
self._source = sorted(self._source)
103106
return self.__median(self._source[(len(self._source) + 1) // 2:])

0 commit comments

Comments
 (0)