From e85e9b9b330a38e2db0243e9fa4c3e65871dccef Mon Sep 17 00:00:00 2001 From: Robert Lucey Date: Sat, 5 Aug 2023 16:39:17 +0100 Subject: [PATCH] Remove dead code --- src/via/api/main.py | 2 +- src/via/bounding_graph_gdfs_cache.py | 37 +---------- src/via/constants.py | 2 - src/via/geojson/utils.py | 33 ---------- src/via/models/frame.py | 94 ---------------------------- src/via/models/journey.py | 45 ------------- src/via/models/journeys.py | 9 --- src/via/models/point.py | 49 --------------- src/via/place_cache.py | 1 + src/via/settings.py | 14 ----- src/via/utils.py | 50 +-------------- test/geojson/test_utils.py | 22 ------- test/models/test_frame.py | 22 +------ test/models/test_journey.py | 21 ------- test/models/test_point.py | 41 ------------ test/test_network_cache.py | 1 - test/test_utils.py | 30 --------- 17 files changed, 5 insertions(+), 468 deletions(-) diff --git a/src/via/api/main.py b/src/via/api/main.py index 8f9fd28..6980f1d 100644 --- a/src/via/api/main.py +++ b/src/via/api/main.py @@ -1,5 +1,5 @@ from typing import List, Optional, Union -from fastapi import FastAPI, Query +from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from pydantic import BaseModel diff --git a/src/via/bounding_graph_gdfs_cache.py b/src/via/bounding_graph_gdfs_cache.py index 8227cd0..df6fbbf 100644 --- a/src/via/bounding_graph_gdfs_cache.py +++ b/src/via/bounding_graph_gdfs_cache.py @@ -6,38 +6,7 @@ from gridfs import GridFS from via.utils import get_mongo_interface -from via.settings import ( - GRIDFS_BOUNDING_GRAPH_GDFS_GRAPH_FILENAME_PREFIX, - GRIDFS_UTILS_BOUNDING_GRAPH_GDFS_GRAPH_FILENAME_PREFIX, -) - - -class UtilsBoundingGraphGDFSGraphs: - def __init__(self): - self.mongo_interface = get_mongo_interface() - self.grid = GridFS(self.mongo_interface) - - @staticmethod - def get_filename(key): - return f"{GRIDFS_UTILS_BOUNDING_GRAPH_GDFS_GRAPH_FILENAME_PREFIX}_{key}" - - @ttl_cache(maxsize=50, ttl=360) - def get_from_gridfs(self, key): - return pickle.loads( - self.grid.find_one({"filename": self.get_filename(key)}).read() - ) - - def get(self, key: Any): - if self.grid.find_one({"filename": get_filename(key)}): - return self.get_from_gridfs(key) - - return None - - def set(self, key: Any, value: Any): - if self.get(key): - return - - self.grid.put(pickle.dumps(value), filename=self.get_filename(key)) +from via.settings import GRIDFS_BOUNDING_GRAPH_GDFS_GRAPH_FILENAME_PREFIX class BoundingGraphGDFSGraphs: @@ -56,8 +25,6 @@ def get_from_gridfs(self, key): ) def get(self, key: Any): - filename = f"bounding_graph_gdfs_graph_{key}" - if self.grid.find_one({"filename": self.get_filename(key)}): return self.get_from_gridfs(key) @@ -71,5 +38,3 @@ def set(self, key: Any, value: Any): bounding_graph_gdfs_cache = BoundingGraphGDFSGraphs() - -utils_bounding_graph_gdfs_cache = UtilsBoundingGraphGDFSGraphs() diff --git a/src/via/constants.py b/src/via/constants.py index 8721a5b..56b2d0d 100644 --- a/src/via/constants.py +++ b/src/via/constants.py @@ -8,8 +8,6 @@ else "/tmp/log/via/via.log" ) -POLY_POINT_BUFFER = 0.002 - USELESS_GEOJSON_PROPERTIES = { "oneway", "length", diff --git a/src/via/geojson/utils.py b/src/via/geojson/utils.py index bdce590..52597c3 100644 --- a/src/via/geojson/utils.py +++ b/src/via/geojson/utils.py @@ -1,42 +1,9 @@ -import datetime -import urllib -from packaging.version import Version -import dateutil.parser - import shapely from networkx.readwrite import json_graph from via.constants import USELESS_GEOJSON_PROPERTIES -def parse_start_date(earliest_date: str) -> str: - if earliest_date is None: - raise ValueError("earliest_date cannot be None") - - if isinstance(earliest_date, str): - earliest_date = dateutil.parser.parse(earliest_date) - elif isinstance(earliest_date, datetime.date): - earliest_date = datetime.datetime.combine( - earliest_date, datetime.datetime.min.time() - ) - - return str(earliest_date.date()) - - -def parse_end_date(latest_date: str) -> str: - if latest_date is None: - raise ValueError("latest_date cannot be None") - - if isinstance(latest_date, str): - latest_date = dateutil.parser.parse(latest_date) - elif isinstance(latest_date, datetime.date): - latest_date = datetime.datetime.combine( - latest_date, datetime.datetime.min.time() - ) - - return str(latest_date.date()) - - def geojson_from_graph(graph, must_include_props: list = None) -> dict: json_links = json_graph.node_link_data(graph)["links"] diff --git a/src/via/models/frame.py b/src/via/models/frame.py index 721cbbb..c0c78fc 100644 --- a/src/via/models/frame.py +++ b/src/via/models/frame.py @@ -39,102 +39,8 @@ def distance_from(self, point: GPSPoint) -> float: point = point.gps return self.gps.distance_from(point) - @property - def is_complete(self) -> bool: - """ - Does the frame contain all expected data - """ - return ( - isinstance(self.time, float) - and self.gps.is_populated - and self.acceleration != [] - ) - def serialize(self, **kwargs) -> dict: data = {"gps": self.gps.serialize(), "acc": self.acceleration} if kwargs.get("include_time", True): data["time"] = round(self.time, 2) return data - - -class Frames(GenericObjects): - def __init__(self, *args, **kwargs): - kwargs.setdefault("child_class", Frame) - super().__init__(*args, **kwargs) - - @property - def most_northern(self) -> float: - return max([frame.gps.lat for frame in self]) - - @property - def most_southern(self) -> float: - return min([frame.gps.lat for frame in self]) - - @property - def most_eastern(self) -> float: - return max([frame.gps.lng for frame in self]) - - @property - def most_western(self) -> float: - return min([frame.gps.lng for frame in self]) - - @property - def data_quality(self) -> float: - """ - Get the percentage of frames that are good. Should - automatically disregard journeys with low data quality - - :rtype: float - :return: The percent between 0 and 1 - """ - # Mixed with the deviation between times? - return len([f for f in self if f.is_complete]) / float(len(self)) - - @property - def origin(self) -> Frame: - """ - The first frame of the journey - - :rtype: via.models.Frame - :return: The first frame of the journey - """ - return self[0] - - @property - def destination(self) -> Frame: - """ - The last frame of the journey - - :rtype: via.models.Frame - :return: The last frame of the journey - """ - return self[-1] - - @property - def duration(self) -> float: - """ - Get the time in seconds - - Note that much of the start and end may have been removed. - - :rtype: float - :return: The number of seconds the journey took - """ - if self.destination.time is None or self.origin.time is None: - return None - return self.destination.time - self.origin.time - - @property - def direct_distance(self) -> float: - """ - Get the distance in metres as the crow flies - - Note that much of the start and end may have been removed. - - :rtype: float - :return: distance from origin to destination in metres - """ - return self[0].distance_from(self[-1]) - - def serialize(self, include_time: bool = True) -> list: - return [frame.serialize(include_time=include_time) for frame in self] diff --git a/src/via/models/journey.py b/src/via/models/journey.py index 7929da9..e1b7889 100644 --- a/src/via/models/journey.py +++ b/src/via/models/journey.py @@ -9,20 +9,14 @@ from dateutil.parser import parse from cached_property import cached_property -import geopandas as gpd - -from shapely.ops import cascaded_union import networkx as nx import osmnx as ox from mappymatch.maps.nx.readers.osm_readers import ( NetworkType, - nx_graph_from_osmnx, parse_osmnx_graph, ) -from mappymatch import package_root -from mappymatch.constructs.geofence import Geofence from mappymatch.constructs.trace import Trace from mappymatch.maps.nx.nx_map import NxMap from mappymatch.matchers.lcss.lcss import LCSSMatcher @@ -34,7 +28,6 @@ from via import logger from via.utils import window, get_combined_id from via.constants import ( - POLY_POINT_BUFFER, VALID_JOURNEY_MIN_DISTANCE, VALID_JOURNEY_MIN_POINTS, VALID_JOURNEY_MIN_DURATION, @@ -476,37 +469,6 @@ def bbox(self) -> dict: "west": self.most_western, } - @property - def poly_graph(self): - """ - Get a graph of the journey but excluding nodes far away from the route - - :rtype: networkx.classes.multidigraph.MultiDiGraph - """ - - if network_cache.get("poly", self) is None: - logger.debug("poly > %s not found in cache, generating...", self.gps_hash) - - # TODO: might want to not use polygon for this since we could - # get the benefits of using a parent bbox from the cache - - # Maybe use city if possible and then truncate_graph_polygon - points = self.get_multi_points() - - buf = points.buffer(POLY_POINT_BUFFER, cap_style=3) - boundary = gpd.GeoSeries(cascaded_union(buf)) - - network = ox.graph_from_polygon( - boundary.geometry[0], network_type=self.network_type, simplify=True - ) - - # TODO: might want to merge our edge_quality_data with - # edge data here - - network_cache.set("poly", self, network) - - return network_cache.get("poly", self) - @property def graph(self): """ @@ -540,13 +502,6 @@ def version(self): return self._version return version.parse(self._version) - @property - def region(self): - """ - Get the region name in which this journey started - """ - return self.origin.gps.reverse_geo["place_2"] - @property def has_enough_data(self): """ diff --git a/src/via/models/journeys.py b/src/via/models/journeys.py index 24042cd..f7297f2 100644 --- a/src/via/models/journeys.py +++ b/src/via/models/journeys.py @@ -1,7 +1,5 @@ import statistics import hashlib -import multiprocessing -from contextlib import closing from collections import defaultdict from typing import List @@ -9,7 +7,6 @@ from via.models.generic import GenericObjects from via.models.journey import Journey -from via.utils import flatten from via.models.journey_mixins import ( SnappedRouteGraphMixin, GeoJsonMixin, @@ -44,12 +41,6 @@ def edge_quality_map(self): :rtype: dict """ - # with multiprocessing.Pool(min([multiprocessing.cpu_count() - 1, 4])) as pool: - # journey_edge_quality_maps = pool.map( - # get_journey_edge_quality_map, - # self - # ) - journey_edge_quality_maps = [get_journey_edge_quality_map(i) for i in self] edge_quality_map = defaultdict(list) diff --git a/src/via/models/point.py b/src/via/models/point.py index aa79f2d..6dbfee7 100644 --- a/src/via/models/point.py +++ b/src/via/models/point.py @@ -1,17 +1,14 @@ import hashlib from numbers import Number -from operator import itemgetter import numpy from cached_property import cached_property -from shapely.geometry import MultiPoint, Point from via import settings from via import logger from via.place_cache import place_cache from via.models.generic import GenericObject, GenericObjects from via.models.gps import GPSPoint -from via.utils import angle_between_slopes class Context: @@ -175,17 +172,6 @@ def distance_from(self, point: GPSPoint) -> float: point = point.gps return self.gps.distance_from(point) - @property - def is_complete(self) -> bool: - """ - Does the point contain all expected data - """ - return ( - isinstance(self.time, (float, int)) - and self.gps.is_populated - and self.acceleration != [] - ) - @property def road_quality(self) -> int: """ @@ -253,15 +239,6 @@ def __init__(self, *args, **kwargs): kwargs.setdefault("child_class", FramePoint) super().__init__(*args, **kwargs) - def __del__(self): - attrs_to_del = ["country"] - - for attr in attrs_to_del: - try: - delattr(self, attr) - except AttributeError: - pass - @property def most_northern(self) -> float: """ @@ -358,22 +335,6 @@ def serialize( for frame in self ] - def get_multi_points(self) -> MultiPoint: - """ - Get a shapely.geometry.MultiPoint of all the points - """ - unique_points = [] - prev = None - for frame in self: - if frame.gps.is_populated: - if prev is not None: - if prev.gps.lat != frame.gps.lat: - unique_points.append(Point(frame.gps.lng, frame.gps.lat)) - - prev = frame - - return MultiPoint(unique_points) - @property def gps_hash(self) -> str: """ @@ -392,16 +353,6 @@ def content_hash(self) -> str: str([point.content_hash for point in self]).encode() ).hexdigest() - @cached_property - def country(self) -> str: - """ - Get what country this journey started in - - :return: a two letter country code - :rtype: str - """ - return self.origin.gps.reverse_geo["cc"] - def is_in_place(self, place_name: str) -> bool: """ Get if a journey is entirely within the bounds of some place. diff --git a/src/via/place_cache.py b/src/via/place_cache.py index 87a40cf..a6a241f 100644 --- a/src/via/place_cache.py +++ b/src/via/place_cache.py @@ -15,6 +15,7 @@ class PlaceCache: """ def __init__(self): + # TODO: store in mongo so we don't need to graph_from_place every run self.data = { "dublin ireland": { "north": 53.626487, diff --git a/src/via/settings.py b/src/via/settings.py index c4e1473..ec155c0 100644 --- a/src/via/settings.py +++ b/src/via/settings.py @@ -1,5 +1,4 @@ import os -import pkg_resources from packaging import version # TODO: data from DOWNLOAD_JOURNEYS_URL should give back the s3 region @@ -21,9 +20,6 @@ # Intervals are generally 2 seconds GPS_INCLUDE_RATIO = int(os.getenv("GPS_INCLUDE_RATIO", "2")) -NEAREST_EDGE_METHOD = os.getenv("NEAREST_EDGE_METHOD", "angle_nearest") -CLOSE_ANGLE_TO_ROAD = float(os.getenv("CLOSE_ANGLE_TO_ROAD", 20)) - DEFAULT_OVERPASS_API = os.getenv("DEFAULT_OVERPASS_API", "https://overpass-api.de/api") CUSTOM_OVERPASS_API = os.getenv("CUSTOM_OVERPASS_API", "http://54.73.95.15/api") @@ -33,25 +29,15 @@ 60 * 60 ) # How long to cache served geojson files before generating again (using new data) -VERSION = pkg_resources.require("via-api")[0].version - if os.getenv("TEST_ENV", "False") == "True": MONGO_RAW_JOURNEYS_COLLECTION = "test_raw_journeys" MONGO_NETWORKS_COLLECTION = "test_networks" MONGO_PARSED_JOURNEYS_COLLECTION = "test_parsed_journeys" GRIDFS_NETWORK_FILENAME_PREFIX = "test_network" GRIDFS_BOUNDING_GRAPH_GDFS_GRAPH_FILENAME_PREFIX = "test_bounding_graph_gdfs_graph" - GRIDFS_UTILS_BOUNDING_GRAPH_GDFS_GRAPH_FILENAME_PREFIX = ( - "test_utils_bounding_graph_gdfs_graph" - ) - - else: # pragma: nocover MONGO_RAW_JOURNEYS_COLLECTION = "raw_journeys" MONGO_NETWORKS_COLLECTION = "networks" MONGO_PARSED_JOURNEYS_COLLECTION = "parsed_journeys" GRIDFS_NETWORK_FILENAME_PREFIX = "network" GRIDFS_BOUNDING_GRAPH_GDFS_GRAPH_FILENAME_PREFIX = "bounding_graph_gdfs_graph" - GRIDFS_UTILS_BOUNDING_GRAPH_GDFS_GRAPH_FILENAME_PREFIX = ( - "utils_bounding_graph_gdfs_graph" - ) diff --git a/src/via/utils.py b/src/via/utils.py index 174a2da..8393ff7 100644 --- a/src/via/utils.py +++ b/src/via/utils.py @@ -1,8 +1,7 @@ -import math import hashlib import os from functools import lru_cache, cache -from itertools import islice, chain +from itertools import islice from typing import Any, List, Tuple import pymongo @@ -174,20 +173,6 @@ def get_combined_id(obj: Any, other_obj: Any) -> int: return hash(obj) + hash(other_obj) -def flatten(lst: List) -> List[Any]: - """ - Given a nested list, flatten it. - - Usage: - >>> flatten([[1, 2, 3], [1, 2]]) - [1, 2, 3, 1, 2] - - :param lst: list to be flattened - :return: Flattened list - """ - return list(chain.from_iterable(lst)) - - def filter_nodes_from_geodataframe( nodes_dataframe: GeoDataFrame, nodes_to_keep: List[int] ) -> GeoDataFrame: @@ -226,39 +211,6 @@ def update_edge_data(graph: MultiDiGraph, edge_data_map: dict) -> MultiDiGraph: return graph -def get_slope(origin: GPSPoint, dst: GPSPoint) -> float: - """ - - :param origin: A GPSPoint - :param dst: A GPSPoint - :rtype: float - """ - return (origin.lng - dst.lng) / (origin.lat - dst.lat) - - -def angle_between_slopes( - slope_1: float, - slope_2: float, - ensure_positive: bool = False, - absolute: bool = False, -) -> float: - """ - - :param slope_1: - :param slope_2: - :kwargs ensure_positive: Ensure the result is always positive - Useful in comparisons where you don't care about direction - and want -45 to also equal 135 for example - """ - degrees = math.degrees(math.atan((slope_2 - slope_1) / (1 + (slope_2 * slope_1)))) - if absolute: - degrees = abs(degrees) - elif ensure_positive: - if degrees < 0: - degrees = 180 + degrees - return degrees - - def is_within(bbox: dict, potentially_larger_bbox: dict) -> bool: """ diff --git a/test/geojson/test_utils.py b/test/geojson/test_utils.py index 3524fbf..87061e9 100644 --- a/test/geojson/test_utils.py +++ b/test/geojson/test_utils.py @@ -3,33 +3,11 @@ from unittest import TestCase, skip from via.geojson.utils import ( - parse_start_date, - parse_end_date, geojson_from_graph, ) class GeoJsonUtilTest(TestCase): - def test_parse_start_date(self): - with self.assertRaises(ValueError): - parse_start_date(None) - self.assertEqual(parse_start_date("2021-02-03"), "2021-02-03") - self.assertEqual(parse_start_date("2021-02-03 01:02:03"), "2021-02-03") - self.assertEqual(parse_start_date(datetime.date(2021, 2, 3)), "2021-02-03") - self.assertEqual( - parse_start_date(datetime.datetime(2021, 2, 3, 12)), "2021-02-03" - ) - - def test_parse_end_date(self): - with self.assertRaises(ValueError): - parse_end_date(None) - self.assertEqual(parse_end_date("2021-02-03"), "2021-02-03") - self.assertEqual(parse_end_date("2021-02-03 01:02:03"), "2021-02-03") - self.assertEqual(parse_end_date(datetime.date(2021, 2, 3)), "2021-02-03") - self.assertEqual( - parse_end_date(datetime.datetime(2021, 2, 3, 12)), "2021-02-03" - ) - @skip("todo") def test_geojson_from_graph(self): pass diff --git a/test/models/test_frame.py b/test/models/test_frame.py index 176f685..b0cda85 100644 --- a/test/models/test_frame.py +++ b/test/models/test_frame.py @@ -1,13 +1,9 @@ from unittest import TestCase, skip -from via.models.frame import Frame, Frames +from via.models.frame import Frame class FrameTest(TestCase): - def test_completeness(self): - self.assertTrue(Frame(0.0, {"lat": 0.1, "lng": 1.0}, 1.0).is_complete) - self.assertFalse(Frame(0.0, {"lat": 0.0, "lng": None}, 1.0).is_complete) - def test_lat(self): self.assertEqual(Frame(0.0, {"lat": 0.0, "lng": 1.0}, 1.0).gps.lat, 0) @@ -41,19 +37,3 @@ def test_parse(self): ) with self.assertRaises(NotImplementedError): Frame.parse(None) - - -class FramesTest(TestCase): - def setUp(self): - self.frames = Frames() - self.frames.append(Frame(0.0, {"lat": 1.0, "lng": 1.0}, (1.0, 2.0, 3.0))) - self.frames.append(Frame(1.0, {"lat": 2.0, "lng": 3.0}, (1.0, 2.0, 3.0))) - - def test_most_directional(self): - self.assertEqual(self.frames.most_northern, 2) - self.assertEqual(self.frames.most_southern, 1) - self.assertEqual(self.frames.most_eastern, 3) - self.assertEqual(self.frames.most_western, 1) - - def test_data_quality(self): - self.assertEqual(self.frames.data_quality, 1) diff --git a/test/models/test_journey.py b/test/models/test_journey.py index d6b896b..2039077 100644 --- a/test/models/test_journey.py +++ b/test/models/test_journey.py @@ -732,9 +732,6 @@ def test_toggle_gps_acc(self): }, ) - def test_country(self): - self.assertEqual(self.test_journey.country, "IE") - def test_version(self): journey = Journey() self.assertEqual(journey.version, version.Version("0.0.0")) @@ -743,24 +740,6 @@ def test_version(self): journey._version = "1.0.0" self.assertEqual(journey.version, version.Version("1.0.0")) - def test_region(self): - data = [ - {"time": 0, "acc": 1, "gps": {"lat": None, "lng": None}}, - {"time": 1, "acc": 1, "gps": {"lat": None, "lng": None}}, - {"time": 2, "acc": None, "gps": {"lat": 53.3498, "lng": -6.2603}}, - {"time": 3, "acc": 1, "gps": {"lat": None, "lng": None}}, - {"time": 4, "acc": 1, "gps": {"lat": None, "lng": None}}, - {"time": 5, "acc": 1, "gps": {"lat": None, "lng": None}}, - {"time": 6, "acc": 1, "gps": {"lat": None, "lng": None}}, - {"time": 7, "acc": None, "gps": {"lat": 53.3498, "lng": -6.2603}}, - ] - - journey = Journey() - for dp in data: - journey.append(dp) - - self.assertEqual(journey.region, "Leinster") - def test_append(self): test_journey = Journey() for d in self.test_data: diff --git a/test/models/test_point.py b/test/models/test_point.py index 4764198..388b0f0 100644 --- a/test/models/test_point.py +++ b/test/models/test_point.py @@ -93,12 +93,6 @@ def test_speed_between(self): def test_distance_from(self): pass - def test_is_complete(self): - frame_point = FramePoint.parse( - {"time": 10, "gps": {"lat": 1, "lng": 1}, "acc": [1, 2, 3, 4]} - ) - self.assertTrue(frame_point.is_complete) - def test_road_quality(self): frame_point = FramePoint.parse( {"time": 10, "gps": {"lat": 1, "lng": 1}, "acc": [1, 2, 3, 4]} @@ -132,28 +126,6 @@ def test_content_hash(self): class FramePointsTest(TestCase): - def test_get_multi_point(self): - points = FramePoints() - points.append( - FramePoint.parse( - {"time": 10, "gps": {"lat": 1, "lng": 2}, "acc": [1, 2, 3, 4]} - ) - ) - points.append( - FramePoint.parse( - {"time": 20, "gps": {"lat": 3, "lng": 4}, "acc": [1, 2, 3, 4]} - ) - ) - points.append( - FramePoint.parse( - {"time": 30, "gps": {"lat": 5, "lng": 6}, "acc": [1, 2, 3, 4]} - ) - ) - - multi_points = points.get_multi_points() - self.assertEqual(multi_points.centroid.x, 5) - self.assertEqual(multi_points.centroid.y, 4) - def test_is_in_place(self): points = FramePoints() points.append( @@ -170,19 +142,6 @@ def test_is_in_place(self): self.assertFalse(points.is_in_place("Paris, France")) self.assertFalse(points.is_in_place("Blah blah blah")) - def test_country(self): - points = FramePoints() - points.append( - FramePoint.parse( - { - "time": 10, - "gps": {"lat": 53.3497913, "lng": -6.2603686}, - "acc": [1, 2, 3, 4], - } - ) - ) - self.assertEqual(points.country, "IE") - def test_content_hash(self): points = FramePoints() points.append( diff --git a/test/test_network_cache.py b/test/test_network_cache.py index a246334..e3e1510 100644 --- a/test/test_network_cache.py +++ b/test/test_network_cache.py @@ -17,7 +17,6 @@ class NetworkCacheTest(TestCase): - @skipUnless(not IS_ACTION, "action_mongo") def setUp(self): mongo_interface = get_mongo_interface() diff --git a/test/test_utils.py b/test/test_utils.py index 1f25176..a44212f 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -22,14 +22,10 @@ ) from via.utils import ( - get_slope, should_include_journey, window, iter_journeys, - flatten, get_journeys, - angle_between_slopes, - get_slope, filter_edges_from_geodataframe, filter_nodes_from_geodataframe, get_mongo_interface, @@ -88,32 +84,6 @@ def test_window(self): [(1, 2, 3), (2, 3, 4), (3, 4, 5)], ) - def test_flatten(self): - self.assertEqual(flatten([[1, 2, 3], [1, 2]]), [1, 2, 3, 1, 2]) - - def test_angle_between_slopes(self): - self.assertEqual(angle_between_slopes(0, 1), 45) - self.assertEqual(angle_between_slopes(1, 0), -45) - self.assertEqual(angle_between_slopes(0, 1, ensure_positive=True), 45) - self.assertEqual(angle_between_slopes(1, 0, ensure_positive=True), 135) - - def test_get_slope(self): - self.assertEqual( - get_slope( - GPSPoint(0, 0), - GPSPoint(1, 1), - ), - 1, - ) - - self.assertEqual( - get_slope( - GPSPoint(1, 1), - GPSPoint(0, 0), - ), - 1, - ) - def test_filter_edges_from_geodataframe(self): json_dataframe = { "osmid": {