From dc5641c456b45b9cb0ab4448389d3b6529f864ba Mon Sep 17 00:00:00 2001 From: josidd <joseph.siddons@noc.ac.uk> Date: Wed, 26 Feb 2025 08:05:37 +0000 Subject: [PATCH 1/2] chore: ignore missing docstring in magic method --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2477ea6..594fc8a 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 = [ -- GitLab From 0821384a5c82f8c90a367d651e9b82501aef87a4 Mon Sep 17 00:00:00 2001 From: josidd <joseph.siddons@noc.ac.uk> Date: Wed, 26 Feb 2025 08:06:09 +0000 Subject: [PATCH 2/2] standards: fixes for ruff linting --- GeoSpatialTools/__init__.py | 2 ++ GeoSpatialTools/octtree.py | 11 ++++++++--- GeoSpatialTools/quadtree.py | 5 ++++- GeoSpatialTools/utils.py | 3 +++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/GeoSpatialTools/__init__.py b/GeoSpatialTools/__init__.py index e3a054e..e10e2d5 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 79542ff..33e32c5 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 90a22c7..b7a3ad7 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 2af13f6..4f83cfe 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""" -- GitLab