Skip to content
Snippets Groups Projects

Resolve "Fix mypy errors in models.py and complete type hints"

All threads resolved!
1 file
+ 12
11
Compare changes
  • Side-by-side
  • Inline
+ 12
11
@@ -2368,13 +2368,13 @@ class _Properties(list):
def __init__(self):
list.__init__(self)
self._importance: Dict[Property, IMPORTANCE] = dict()
self._inheritance: Dict[Property, INHERITANCE] = dict()
self._element_by_name: Dict[str, Property] = dict()
self._element_by_id: Dict[str, Property] = dict()
self._importance: Dict[Entity, IMPORTANCE] = dict()
self._inheritance: Dict[Entity, INHERITANCE] = dict()
self._element_by_name: Dict[str, Entity] = dict()
self._element_by_id: Dict[str, Entity] = dict()
def get_importance(
self, property: Union[Property, str, None]
self, property: Union[Property, Entity, str, None]
): # @ReservedAssignment
if property is not None:
if isinstance(property, str):
@@ -2386,7 +2386,7 @@ class _Properties(list):
if property is not None:
self._importance[property] = importance
def get_by_name(self, name: str) -> Property:
def get_by_name(self, name: str) -> Entity:
"""Get a property of this list via it's name. Raises a LinkAheadException
if not exactly one property has this name.
@@ -2420,7 +2420,7 @@ class _Properties(list):
if inheritance is not None:
self._inheritance[property] = inheritance
else:
self._inheritance[property] = FIX
self._inheritance[property] = "ALL"
if property.id is not None:
self._element_by_id[str(property.id)] = property
@@ -3492,7 +3492,7 @@ class Container(list):
sync_remote_entities.append(remote_entity)
if len(sync_remote_entities) > 0:
sync_dict[self] = sync_remote_entities
sync_dict[self] = sync_remote_entities # FIXME: How is this supposed to work?
if unique and len(sync_remote_entities) != 0:
msg = "Request was not unique. There are " + \
@@ -4686,7 +4686,8 @@ class Query():
self.etag = None
if isinstance(q, etree._Element):
self.q = q.get("string")
string = q.get("string")
self.q = string if string is not None else ""
results = q.get("results")
if results is None:
raise LinkAheadException(
@@ -5119,7 +5120,7 @@ def _parse_single_xml_element(elem: etree._Element):
)
def _evaluate_and_add_error(parent_error: TransactionError, ent: Union[Entity, Container]):
def _evaluate_and_add_error(parent_error: TransactionError, ent: Union[Entity, QueryTemplate, Container]):
"""Evaluate the error message(s) attached to entity and add a
corresponding exception to parent_error.
@@ -5128,7 +5129,7 @@ def _evaluate_and_add_error(parent_error: TransactionError, ent: Union[Entity, C
parent_error : TransactionError
Parent error to which the new exception will be attached. This
exception will be a direct child.
ent : Entity or Container
ent : Entity or Container or QueryTemplate
Entity that caused the TransactionError. An exception is
created depending on its error message(s).
Loading