diff --git a/GeoSpatialTools/__init__.py b/GeoSpatialTools/__init__.py index e3a054eb5a7cc0269477bf2e346f51f4071b7370..e10e2d5dd6ea4efed2e53c735f397e09f2b08f74 100644 --- a/GeoSpatialTools/__init__.py +++ b/GeoSpatialTools/__init__.py @@ -1,3 +1,5 @@ +"""Tools for fast neighbour look-up on the Earth's surface""" + from .neighbours import find_nearest from .distance_metrics import haversine from .great_circle import GreatCircle diff --git a/GeoSpatialTools/octtree.py b/GeoSpatialTools/octtree.py index 79542ff0721e331df7398b42d7b67fbff6228016..33e32c561a2d5951a308704457e6d658d34a7e6c 100644 --- a/GeoSpatialTools/octtree.py +++ b/GeoSpatialTools/octtree.py @@ -75,7 +75,10 @@ class SpaceTimeRecord: return None def __str__(self) -> str: - return f"SpaceTimeRecord(x = {self.lon}, y = {self.lat}, datetime = {self.datetime}, uid = {self.uid})" + return ( + f"SpaceTimeRecord(x = {self.lon}, y = {self.lat}, " + + f"datetime = {self.datetime}, uid = {self.uid})" + ) def __eq__(self, other: object) -> bool: if not isinstance(other, SpaceTimeRecord): @@ -196,10 +199,12 @@ class SpaceTimeRectangle: @property def time_range(self) -> datetime.timedelta: + """The time extent of the Rectangle""" return self.end - self.start @property def centre_datetime(self) -> datetime.datetime: + """The midpoint time of the Rectangle""" return self.start + (self.end - self.start) / 2 def _test_east_west(self, lon: float) -> bool: @@ -564,7 +569,7 @@ class OctTree: ) self.divided = True - def insert(self, point: SpaceTimeRecord) -> bool: + def insert(self, point: SpaceTimeRecord) -> bool: # noqa: C901 """ Insert a SpaceTimeRecord into the QuadTree. @@ -600,7 +605,7 @@ class OctTree: return True return False - def remove(self, point: SpaceTimeRecord) -> bool: + def remove(self, point: SpaceTimeRecord) -> bool: # noqa: C901 """ Remove a SpaceTimeRecord from the OctTree if it is in the OctTree. diff --git a/GeoSpatialTools/quadtree.py b/GeoSpatialTools/quadtree.py index 90a22c78d08e711e0edad577a9b2a02fe66a1503..b7a3ad7ef470e11ea6bcda1ae0efcfa89025867b 100644 --- a/GeoSpatialTools/quadtree.py +++ b/GeoSpatialTools/quadtree.py @@ -67,7 +67,10 @@ class Record: return None def __str__(self) -> str: - return f"Record(lon = {self.lon}, lat = {self.lat}, datetime = {self.datetime}, uid = {self.uid})" + return ( + f"Record(lon = {self.lon}, lat = {self.lat}, " + + f"datetime = {self.datetime}, uid = {self.uid})" + ) def __eq__(self, other: object) -> bool: if not isinstance(other, Record): diff --git a/GeoSpatialTools/utils.py b/GeoSpatialTools/utils.py index 2af13f6d9cbd64133f287765d8d65a9343ce452c..4f83cfec9ed670559d33949c699f58d2516c107c 100644 --- a/GeoSpatialTools/utils.py +++ b/GeoSpatialTools/utils.py @@ -1,3 +1,6 @@ +"""Utility functions. Including Error classes and Warnings.""" + + class LatitudeError(ValueError): """Error for invalid Latitude Value""" diff --git a/pyproject.toml b/pyproject.toml index 2477ea621411ebe3ffed00e12a537ab68e37db41..594fc8a9f79a4edd4f5bbeca63fcd423e8025415 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -78,7 +78,8 @@ extend-select = [ ignore = [ "D205", # blank-line-after-summary "D400", # ends-in-period - "D401" # non-imperative-mood + "D401", # non-imperative-mood + "D105" # missing docstring in magic method ] preview = true select = [