Fixed take & skip
This commit is contained in:
parent
ae2a98b3bc
commit
89ac9e90d6
@ -15,7 +15,7 @@ __title__ = 'cpl_query'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2021 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10.0'
|
||||
__version__ = '2022.10.0.post2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='0')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='0.post2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_query.base'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2021 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10.0'
|
||||
__version__ = '2022.10.0.post2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='0')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='0.post2')
|
||||
|
@ -4,7 +4,7 @@
|
||||
"Version": {
|
||||
"Major": "2022",
|
||||
"Minor": "10",
|
||||
"Micro": "0"
|
||||
"Micro": "0.post2"
|
||||
},
|
||||
"Author": "Sven Heidemann",
|
||||
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_query.enumerable'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2021 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10.0'
|
||||
__version__ = '2022.10.0.post2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -27,4 +27,4 @@ from .ordered_enumerable import OrderedEnumerable
|
||||
from .ordered_enumerable_abc import OrderedEnumerableABC
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='0')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='0.post2')
|
||||
|
@ -249,9 +249,6 @@ class Enumerable(EnumerableABC):
|
||||
|
||||
_list = self.to_list()
|
||||
|
||||
if _index >= len(_list):
|
||||
raise IndexOutOfRangeException()
|
||||
|
||||
return Enumerable(self.type, _list[_index:])
|
||||
|
||||
def skip_last(self, _index: int) -> EnumerableABC:
|
||||
@ -263,9 +260,6 @@ class Enumerable(EnumerableABC):
|
||||
|
||||
index = len(self) - _index
|
||||
|
||||
if index >= len(self) or index < 0:
|
||||
raise IndexOutOfRangeException()
|
||||
|
||||
return self.take(len(self) - _index)
|
||||
|
||||
def take(self, _index: int) -> EnumerableABC:
|
||||
@ -277,9 +271,6 @@ class Enumerable(EnumerableABC):
|
||||
|
||||
_list = self.to_list()
|
||||
|
||||
if _index >= len(_list):
|
||||
raise IndexOutOfRangeException()
|
||||
|
||||
return Enumerable(self.type, _list[:_index])
|
||||
|
||||
def take_last(self, _index: int) -> EnumerableABC:
|
||||
@ -292,9 +283,6 @@ class Enumerable(EnumerableABC):
|
||||
_list = self.to_list()
|
||||
index = len(_list) - _index
|
||||
|
||||
if index >= len(_list) or index < 0:
|
||||
raise IndexOutOfRangeException()
|
||||
|
||||
return self.skip(index)
|
||||
|
||||
def sum(self, _func: Callable = None) -> Union[int, float, complex]:
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_query.extension'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2021 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10.0'
|
||||
__version__ = '2022.10.0.post2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -24,4 +24,4 @@ from collections import namedtuple
|
||||
from .list import List
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='0')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='0.post2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_query.iterable'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2021 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.10.0'
|
||||
__version__ = '2022.10.0.post2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -27,4 +27,4 @@ from .ordered_iterable_abc import OrderedIterableABC
|
||||
from .ordered_iterable import OrderedIterable
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='0')
|
||||
version_info = VersionInfo(major='2022', minor='10', micro='0.post2')
|
||||
|
@ -262,9 +262,6 @@ class Iterable(IterableABC):
|
||||
if _index is None:
|
||||
raise ArgumentNoneException(ExceptionArgument.index)
|
||||
|
||||
if _index >= len(self):
|
||||
raise IndexOutOfRangeException()
|
||||
|
||||
return Iterable(self.type, values=self[_index:])
|
||||
|
||||
def skip_last(self, _index: int) -> IterableABC:
|
||||
@ -276,9 +273,6 @@ class Iterable(IterableABC):
|
||||
|
||||
index = len(self) - _index
|
||||
|
||||
if index >= len(self) or index < 0:
|
||||
raise IndexOutOfRangeException()
|
||||
|
||||
result = Iterable()
|
||||
result.extend(self[:index])
|
||||
return result
|
||||
@ -290,9 +284,6 @@ class Iterable(IterableABC):
|
||||
if _index is None:
|
||||
raise ArgumentNoneException(ExceptionArgument.index)
|
||||
|
||||
if _index >= len(self):
|
||||
raise IndexOutOfRangeException()
|
||||
|
||||
result = Iterable()
|
||||
result.extend(self[:_index])
|
||||
return result
|
||||
@ -301,9 +292,6 @@ class Iterable(IterableABC):
|
||||
if self is None:
|
||||
raise ArgumentNoneException(ExceptionArgument.list)
|
||||
|
||||
if _index is None:
|
||||
raise ArgumentNoneException(ExceptionArgument.index)
|
||||
|
||||
index = len(self) - _index
|
||||
|
||||
if index >= len(self) or index < 0:
|
||||
|
Loading…
Reference in New Issue
Block a user