Skip to content

Commit

Permalink
fix sum
Browse files Browse the repository at this point in the history
  • Loading branch information
artemisart committed Feb 5, 2024
1 parent c6ef3e5 commit 986cad2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions functional/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ def sum(self, projection: Callable[[T], Tnumber] = identity) -> Tnumber: # type
:param projection: function to project on the sequence before taking the sum
:return: sum of elements in sequence
"""
return sum(self.map(projection))
return sum(self.map(projection)) # type: ignore # sum wants int but our Tnumber is a bit better

def average(self, projection: Callable[[T], Tnumber] = identity) -> Tnumber: # type: ignore
"""
Expand All @@ -1071,7 +1071,7 @@ def average(self, projection: Callable[[T], Tnumber] = identity) -> Tnumber: #
:return: average of elements in the sequence
"""
length = self.len() # call .len() before because it calls .cache()
return sum(self.map(projection)) / length
return sum(self.map(projection)) / length # type: ignore

@overload
def aggregate(
Expand Down

0 comments on commit 986cad2

Please sign in to comment.