Skip to content

Commit

Permalink
refactor: use Self return type
Browse files Browse the repository at this point in the history
Python 3.11 my beloved
  • Loading branch information
ShyAssassin committed Oct 16, 2023
1 parent c76c8d3 commit 0393bb6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
9 changes: 4 additions & 5 deletions TrackingBackend/app/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import annotations
import re
import sys
import uuid
Expand All @@ -7,12 +6,12 @@
import random
import os.path
from .logger import get_logger
from typing import Callable, Self
from watchdog.observers import Observer
from fastapi import Request, HTTPException
from watchdog.observers.api import BaseObserver
from app.types import Algorithms, TrackerPosition
from pydantic import BaseModel, ValidationError, field_validator
from typing import Callable
from watchdog.observers import Observer
from watchdog.observers.api import BaseObserver
from watchdog.events import FileSystemEventHandler, FileModifiedEvent

logger = get_logger()
Expand Down Expand Up @@ -178,7 +177,7 @@ def save(self, file: str = CONFIG_FILE) -> None:
self.save(file=file)

# TODO: refactor how we load config files, this is a mess
def load(self, file: str = CONFIG_FILE) -> EyeTrackConfig:
def load(self, file: str = CONFIG_FILE) -> Self:
# FIXME: this hopefully prevents multiple processes opening the config file at the same time
time.sleep(random.random())

Expand Down
1 change: 0 additions & 1 deletion TrackingBackend/app/processes/camera.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import annotations
from app.utils import WorkerProcess
from app.types import CameraState
from multiprocessing import Value
Expand Down
1 change: 0 additions & 1 deletion TrackingBackend/app/processes/osc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import annotations
from app.utils import WorkerProcess, OneEuroFilter
from app.config import EyeTrackConfig, OSCConfig
from app.types import EyeData, TrackerPosition
Expand Down

0 comments on commit 0393bb6

Please sign in to comment.