Commit a7e594a1 authored by Joseph Siddons's avatar Joseph Siddons
Browse files

Merge branch 'ruff_check' into 'main'

Ruff check

See merge request !17
parents 8292da92 0821384a
"""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
......
......@@ -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.
......
......@@ -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):
......
"""Utility functions. Including Error classes and Warnings."""
class LatitudeError(ValueError):
"""Error for invalid Latitude Value"""
......
......@@ -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 = [
......
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