Fixed where query typing
This commit is contained in:
parent
1f445a99b2
commit
62ac976b99
@ -15,11 +15,11 @@ __title__ = 'cpl_query'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.11.0.post2'
|
__version__ = '2021.11.0.post3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='11', micro='0.post2')
|
version_info = VersionInfo(major='2021', minor='11', micro='0.post3')
|
||||||
|
@ -15,11 +15,11 @@ __title__ = 'cpl_query._query'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.11.0.post2'
|
__version__ = '2021.11.0.post3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='11', micro='0.post2')
|
version_info = VersionInfo(major='2021', minor='11', micro='0.post3')
|
||||||
|
@ -11,7 +11,7 @@ def where_query(_list: IterableABC, _func: Callable) -> IterableABC:
|
|||||||
if _func is None:
|
if _func is None:
|
||||||
raise ArgumentNoneException(ExceptionArgument.func)
|
raise ArgumentNoneException(ExceptionArgument.func)
|
||||||
|
|
||||||
result = IterableABC()
|
result = IterableABC(_list.type)
|
||||||
for element in _list:
|
for element in _list:
|
||||||
if _func(element):
|
if _func(element):
|
||||||
result.append(element)
|
result.append(element)
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"Version": {
|
"Version": {
|
||||||
"Major": "2021",
|
"Major": "2021",
|
||||||
"Minor": "11",
|
"Minor": "11",
|
||||||
"Micro": "0.post2"
|
"Micro": "0.post3"
|
||||||
},
|
},
|
||||||
"Author": "Sven Heidemann",
|
"Author": "Sven Heidemann",
|
||||||
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
||||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_query.extension'
|
|||||||
__author__ = 'Sven Heidemann'
|
__author__ = 'Sven Heidemann'
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'
|
||||||
__version__ = '2021.11.0.post2'
|
__version__ = '2021.11.0.post3'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@ -27,4 +27,4 @@ from .ordered_iterable_abc import OrderedIterableABC
|
|||||||
from .ordered_iterable import OrderedIterable
|
from .ordered_iterable import OrderedIterable
|
||||||
|
|
||||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||||
version_info = VersionInfo(major='2021', minor='11', micro='0.post2')
|
version_info = VersionInfo(major='2021', minor='11', micro='0.post3')
|
||||||
|
@ -43,7 +43,7 @@ class Iterable(IterableABC):
|
|||||||
def count(self, func: Callable = None) -> int:
|
def count(self, func: Callable = None) -> int:
|
||||||
return count_query(self, func)
|
return count_query(self, func)
|
||||||
|
|
||||||
def distinct(self, func: Callable) -> IterableABC:
|
def distinct(self, func: Callable = None) -> IterableABC:
|
||||||
return self.__to_self(distinct_query(self, func))
|
return self.__to_self(distinct_query(self, func))
|
||||||
|
|
||||||
def element_at(self, index: int) -> any:
|
def element_at(self, index: int) -> any:
|
||||||
|
@ -60,9 +60,8 @@ class IterableABC(ABC, list):
|
|||||||
__object: :class:`object`
|
__object: :class:`object`
|
||||||
value
|
value
|
||||||
"""
|
"""
|
||||||
if self._type is not None and type(__object) != self._type and not isinstance(type(__object), self._type) \
|
if self._type is not None and type(__object) != self._type and not isinstance(type(__object), self._type) and not issubclass(type(__object), self._type):
|
||||||
and not issubclass(type(__object), self._type):
|
raise Exception(f'Unexpected type: {type(__object)}\nExpected type: {self._type}')
|
||||||
raise Exception(f'Unexpected type: {type(__object)}')
|
|
||||||
|
|
||||||
if len(self) == 0 and self._type is None:
|
if len(self) == 0 and self._type is None:
|
||||||
self._type = type(__object)
|
self._type = type(__object)
|
||||||
|
Loading…
Reference in New Issue
Block a user