Skip to content

Commit

Permalink
docs: remove unnecessary type-ignores
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
  • Loading branch information
jkowalleck committed Oct 2, 2023
1 parent 76c566c commit 11b5896
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

[mypy]

files = serializable/
files = serializable/, tests/model.py

show_error_codes = True
pretty = True
Expand Down
4 changes: 2 additions & 2 deletions docs/customising-structure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ For example:

.. code-block:: python
@property # type: ignore[misc]
@property[misc]
@serializable.view(SchemaVersion1)
def address(self) -> Optional[str]:
return self._address
Expand All @@ -222,7 +222,7 @@ Further to the above, you can vary the ``None`` value per View as follows:

.. code-block:: python
@property # type: ignore[misc]
@property[misc]
@serializable.include_none(SchemaVersion2)
@serializable.include_none(SchemaVersion3, "RUBBISH")
def email(self) -> Optional[str]:
Expand Down
34 changes: 17 additions & 17 deletions tests/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ def __init__(self, *, name: str, address: Optional[str] = None, email: Optional[
def name(self) -> str:
return self._name

@property # type: ignore[misc]
@property
@serializable.view(SchemaVersion2)
@serializable.view(SchemaVersion4)
def address(self) -> Optional[str]:
return self._address

@property # type: ignore[misc]
@property
@serializable.include_none(SchemaVersion2)
@serializable.include_none(SchemaVersion3, "RUBBISH")
def email(self) -> Optional[str]:
Expand Down Expand Up @@ -158,12 +158,12 @@ def __init__(self, *, number: int, name: str) -> None:
self._number = number
self._name = name

@property # type: ignore[misc]
@property
@serializable.xml_attribute()
def number(self) -> int:
return self._number

@property # type: ignore[misc]
@property
@serializable.xml_name('.')
def name(self) -> str:
return self._name
Expand All @@ -184,7 +184,7 @@ def __init__(self, *, ref: str, references: Optional[Iterable["BookReference"]]
self.ref = ref
self.references = set(references or {})

@property # type: ignore[misc]
@property
@serializable.json_name('reference')
@serializable.xml_attribute()
def ref(self) -> str:
Expand All @@ -194,7 +194,7 @@ def ref(self) -> str:
def ref(self, ref: str) -> None:
self._ref = ref

@property # type: ignore[misc]
@property
@serializable.json_name('refersTo')
@serializable.type_mapping(ReferenceReferences)
@serializable.xml_array(serializable.XmlArraySerializationType.FLAT, 'reference')
Expand Down Expand Up @@ -236,47 +236,47 @@ def __init__(self, title: str, isbn: str, publish_date: date, authors: Iterable[
self._type = type
self.references = set(references or [])

@property # type: ignore[misc]
@property
@serializable.xml_sequence(1)
def id(self) -> UUID:
return self._id

@property # type: ignore[misc]
@property
@serializable.xml_sequence(2)
@serializable.type_mapping(TitleMapper)
def title(self) -> str:
return self._title

@property # type: ignore[misc]
@property
@serializable.json_name('isbn_number')
@serializable.xml_attribute()
@serializable.xml_name('isbn_number')
def isbn(self) -> str:
return self._isbn

@property # type: ignore[misc]
@property
@serializable.xml_sequence(3)
def edition(self) -> Optional[BookEdition]:
return self._edition

@property # type: ignore[misc]
@property
@serializable.xml_sequence(4)
@serializable.type_mapping(Iso8601Date)
def publish_date(self) -> date:
return self._publish_date

@property # type: ignore[misc]
@property
@serializable.xml_array(XmlArraySerializationType.FLAT, 'author')
@serializable.xml_sequence(5)
def authors(self) -> Set[str]:
return self._authors

@property # type: ignore[misc]
@property
@serializable.xml_sequence(7)
def publisher(self) -> Optional[Publisher]:
return self._publisher

@property # type: ignore[misc]
@property
@serializable.xml_array(XmlArraySerializationType.NESTED, 'chapter')
@serializable.xml_sequence(8)
def chapters(self) -> List[Chapter]:
Expand All @@ -286,12 +286,12 @@ def chapters(self) -> List[Chapter]:
def chapters(self, chapters: Iterable[Chapter]) -> None:
self._chapters = list(chapters)

@property # type: ignore[misc]
@property
@serializable.xml_sequence(6)
def type(self) -> BookType:
return self._type

@property # type: ignore[misc]
@property
@serializable.view(SchemaVersion4)
@serializable.xml_array(serializable.XmlArraySerializationType.NESTED, 'reference')
@serializable.xml_sequence(7)
Expand Down Expand Up @@ -337,6 +337,6 @@ def references(self, references: Iterable[BookReference]) -> None:
Ref2 = BookReference(ref='my-ref-2', references=[SubRef1, SubRef3])
Ref3 = BookReference(ref='my-ref-3', references=[SubRef2])

ThePhoenixProject_v2.references = [Ref3, Ref2, Ref1]
ThePhoenixProject_v2.references = {Ref3, Ref2, Ref1}

ThePhoenixProject = ThePhoenixProject_v2

0 comments on commit 11b5896

Please sign in to comment.