Code Review
/
pti
/
o2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Fix a string issue of the selector
[pti/o2.git]
/
o2ims
/
domain
/
alarm_repo.py
diff --git
a/o2ims/domain/alarm_repo.py
b/o2ims/domain/alarm_repo.py
index
d3e7f52
..
41205db
100644
(file)
--- a/
o2ims/domain/alarm_repo.py
+++ b/
o2ims/domain/alarm_repo.py
@@
-13,7
+13,7
@@
# limitations under the License.
import abc
# limitations under the License.
import abc
-from typing import List, Set
+from typing import List, Set
, Tuple
from o2ims.domain import alarm_obj as obj
from o2ims.domain import alarm_obj as obj
@@
-31,8
+31,12
@@
class AlarmEventRecordRepository(abc.ABC):
self.seen.add(alarm_event_record)
return alarm_event_record
self.seen.add(alarm_event_record)
return alarm_event_record
- def list(self) -> List[obj.AlarmEventRecord]:
- return self._list()
+ def list(self, **kwargs) -> List[obj.AlarmEventRecord]:
+ return self._list(*[], **kwargs)[1]
+
+ def list_with_count(self, *args, **kwargs) -> \
+ Tuple[int, List[obj.AlarmEventRecord]]:
+ return self._list(*args, **kwargs)
def update(self, alarm_event_record: obj.AlarmEventRecord):
self._update(alarm_event_record)
def update(self, alarm_event_record: obj.AlarmEventRecord):
self._update(alarm_event_record)
@@
-49,7
+53,7
@@
class AlarmEventRecordRepository(abc.ABC):
raise NotImplementedError
@abc.abstractmethod
raise NotImplementedError
@abc.abstractmethod
- def _list(self
) -> List[obj.AlarmEventRecord
]:
+ def _list(self
, **kwargs) -> Tuple[int, List[obj.AlarmEventRecord]
]:
raise NotImplementedError
@abc.abstractmethod
raise NotImplementedError
@abc.abstractmethod
@@
-92,6
+96,10
@@
class AlarmDefinitionRepository(abc.ABC):
def _get(self, definition_id) -> obj.AlarmDefinition:
raise NotImplementedError
def _get(self, definition_id) -> obj.AlarmDefinition:
raise NotImplementedError
+ @abc.abstractmethod
+ def _list(self, **kwargs) -> List[obj.AlarmDefinition]:
+ raise NotImplementedError
+
@abc.abstractmethod
def _update(self, definition: obj.AlarmDefinition):
raise NotImplementedError
@abc.abstractmethod
def _update(self, definition: obj.AlarmDefinition):
raise NotImplementedError
@@
-133,7
+141,7
@@
class AlarmDictionaryRepository(abc.ABC):
raise NotImplementedError
@abc.abstractmethod
raise NotImplementedError
@abc.abstractmethod
- def _
update(self, dictionary: obj.AlarmDictionary)
:
+ def _
list(self, **kwargs) -> List[obj.AlarmDictionary]
:
raise NotImplementedError
@abc.abstractmethod
raise NotImplementedError
@abc.abstractmethod
@@
-155,8
+163,12
@@
class AlarmSubscriptionRepository(abc.ABC):
self.seen.add(subscription)
return subscription
self.seen.add(subscription)
return subscription
- def list(self) -> List[obj.AlarmSubscription]:
- return self._list()
+ def list(self, **kwargs) -> List[obj.AlarmSubscription]:
+ return self._list(*[], **kwargs)[1]
+
+ def list_with_count(self, *args, **kwargs) -> \
+ Tuple[int, List[obj.AlarmSubscription]]:
+ return self._list(*args, **kwargs)
def update(self, subscription: obj.AlarmSubscription):
self._update(subscription)
def update(self, subscription: obj.AlarmSubscription):
self._update(subscription)
@@
-172,6
+184,10
@@
class AlarmSubscriptionRepository(abc.ABC):
def _get(self, subscription_id) -> obj.AlarmSubscription:
raise NotImplementedError
def _get(self, subscription_id) -> obj.AlarmSubscription:
raise NotImplementedError
+ @abc.abstractmethod
+ def _list(self, **kwargs) -> Tuple[int, List[obj.AlarmSubscription]]:
+ raise NotImplementedError
+
@abc.abstractmethod
def _update(self, subscription: obj.AlarmSubscription):
raise NotImplementedError
@abc.abstractmethod
def _update(self, subscription: obj.AlarmSubscription):
raise NotImplementedError
@@
-212,6
+228,10
@@
class AlarmProbableCauseRepository(abc.ABC):
def _get(self, probable_cause_id) -> obj.ProbableCause:
raise NotImplementedError
def _get(self, probable_cause_id) -> obj.ProbableCause:
raise NotImplementedError
+ @abc.abstractmethod
+ def _list(self, **kwargs) -> List[obj.ProbableCause]:
+ raise NotImplementedError
+
@abc.abstractmethod
def _update(self, probable_cause: obj.ProbableCause):
raise NotImplementedError
@abc.abstractmethod
def _update(self, probable_cause: obj.ProbableCause):
raise NotImplementedError