Commit 0821384a authored by Joseph Siddons's avatar Joseph Siddons
Browse files

standards: fixes for ruff linting

parent dc5641c4
"""Tools for fast neighbour look-up on the Earth's surface"""
from .neighbours import find_nearest from .neighbours import find_nearest
from .distance_metrics import haversine from .distance_metrics import haversine
from .great_circle import GreatCircle from .great_circle import GreatCircle
......
...@@ -75,7 +75,10 @@ class SpaceTimeRecord: ...@@ -75,7 +75,10 @@ class SpaceTimeRecord:
return None return None
def __str__(self) -> str: 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: def __eq__(self, other: object) -> bool:
if not isinstance(other, SpaceTimeRecord): if not isinstance(other, SpaceTimeRecord):
...@@ -196,10 +199,12 @@ class SpaceTimeRectangle: ...@@ -196,10 +199,12 @@ class SpaceTimeRectangle:
@property @property
def time_range(self) -> datetime.timedelta: def time_range(self) -> datetime.timedelta:
"""The time extent of the Rectangle"""
return self.end - self.start return self.end - self.start
@property @property
def centre_datetime(self) -> datetime.datetime: def centre_datetime(self) -> datetime.datetime:
"""The midpoint time of the Rectangle"""
return self.start + (self.end - self.start) / 2 return self.start + (self.end - self.start) / 2
def _test_east_west(self, lon: float) -> bool: def _test_east_west(self, lon: float) -> bool:
...@@ -564,7 +569,7 @@ class OctTree: ...@@ -564,7 +569,7 @@ class OctTree:
) )
self.divided = True self.divided = True
def insert(self, point: SpaceTimeRecord) -> bool: def insert(self, point: SpaceTimeRecord) -> bool: # noqa: C901
""" """
Insert a SpaceTimeRecord into the QuadTree. Insert a SpaceTimeRecord into the QuadTree.
...@@ -600,7 +605,7 @@ class OctTree: ...@@ -600,7 +605,7 @@ class OctTree:
return True return True
return False 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. Remove a SpaceTimeRecord from the OctTree if it is in the OctTree.
......
...@@ -67,7 +67,10 @@ class Record: ...@@ -67,7 +67,10 @@ class Record:
return None return None
def __str__(self) -> str: 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: def __eq__(self, other: object) -> bool:
if not isinstance(other, Record): if not isinstance(other, Record):
......
"""Utility functions. Including Error classes and Warnings."""
class LatitudeError(ValueError): class LatitudeError(ValueError):
"""Error for invalid Latitude Value""" """Error for invalid Latitude Value"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment