Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Refresh and types #76

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
[mypy]
files =
src/**/*.py,
tests/**/*.py
warn_redundant_casts = True
warn_unused_configs = True
pretty = True
show_error_codes = True

disallow_any_generics = True
disallow_subclassing_any = True
# disallow_untyped_calls = True
disallow_incomplete_defs = True
# check_untyped_defs = True
disallow_untyped_decorators = True
no_implicit_optional = True
warn_unused_ignores = True
warn_return_any = True
no_implicit_reexport = True

# More strict checks for library code
[mypy-czml3]
disallow_untyped_defs = True

[mypy-versioneer]
ignore_errors = True
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import versioneer
from setuptools import setup

import versioneer

setup(version=versioneer.get_version(), cmdclass=versioneer.get_cmdclass())
2 changes: 1 addition & 1 deletion src/czml3/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def default(self, o):
return super().default(o)


@attr.s(repr=False, frozen=True)
@attr.s(auto_attribs=True, repr=False, frozen=True)
class BaseCZMLObject:
def __repr__(self):
return self.dumps(indent=4)
Expand Down
19 changes: 10 additions & 9 deletions src/czml3/common.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
# noinspection PyPep8Naming
import datetime as dt
from typing import Optional

import attr

from .enums import HorizontalOrigins, InterpolationAlgorithms, VerticalOrigins


@attr.s(repr=False, frozen=True, kw_only=True)
@attr.s(auto_attribs=True, repr=False, frozen=True, kw_only=True)
class Deletable:
"""A property whose value may be deleted."""

delete: bool = attr.ib(default=None)
delete: Optional[bool] = None


# noinspection PyPep8Naming
@attr.s(repr=False, frozen=True, kw_only=True)
@attr.s(auto_attribs=True, repr=False, frozen=True, kw_only=True)
class Interpolatable:
"""A property whose value may be determined by interpolating.

The interpolation happens over provided time-tagged samples.
"""

epoch: dt.datetime = attr.ib(default=None)
interpolationAlgorithm: InterpolationAlgorithms = attr.ib(default=None)
interpolationDegree: int = attr.ib(default=None)
epoch: Optional[dt.datetime] = None
interpolationAlgorithm: Optional[InterpolationAlgorithms] = None
interpolationDegree: Optional[int] = None


# noinspection PyPep8Naming
@attr.s(repr=False, frozen=True, kw_only=True)
@attr.s(auto_attribs=True, repr=False, frozen=True, kw_only=True)
class HasAlignment:
"""A property that can be horizontally or vertically aligned."""

horizontalOrigin: HorizontalOrigins = attr.ib(default=None)
verticalOrigin: VerticalOrigins = attr.ib(default=None)
horizontalOrigin: Optional[HorizontalOrigins] = None
verticalOrigin: Optional[VerticalOrigins] = None
Loading