Run autoformat, Add readme

This commit is contained in:
Kai Vogelgesang 2023-05-18 03:10:34 +02:00
parent d1b8839dba
commit f973938f53
Signed by: kai
GPG Key ID: 3FC8578CC818A9EB
5 changed files with 15 additions and 8 deletions

1
README.md Normal file
View File

@ -0,0 +1 @@
# 🛰️ Sat-Kalender

View File

@ -34,7 +34,9 @@ class Pass:
summary += " [!]" summary += " [!]"
description = [] description = []
description.append(f"Azimuth: {self.start_az} ({self.start_compass}) to {self.end_az} ({self.end_compass})") description.append(
f"Azimuth: {self.start_az} ({self.start_compass}) to {self.end_az} ({self.end_compass})"
)
description.append("") description.append("")
description.append("Downlinks:") description.append("Downlinks:")
for downlink in self.downlinks: for downlink in self.downlinks:

View File

@ -86,6 +86,7 @@ class N2YO:
return RadioPasses.parse_obj(response) return RadioPasses.parse_obj(response)
@asynccontextmanager @asynccontextmanager
async def n2yo_api(key: str): async def n2yo_api(key: str):
api = N2YO(key) api = N2YO(key)

View File

@ -4,10 +4,12 @@ from pydantic import BaseModel
from .settings import settings from .settings import settings
class Downlink(BaseModel): class Downlink(BaseModel):
proto: str proto: str
freq: float freq: float
class Satellite(BaseModel): class Satellite(BaseModel):
name: str name: str
downlink: list[Downlink] downlink: list[Downlink]
@ -17,7 +19,4 @@ def read_satellites() -> dict[int, Satellite]:
with open(settings.satellites_file, "rb") as f: with open(settings.satellites_file, "rb") as f:
data = tomllib.load(f) data = tomllib.load(f)
return { return {int(k): Satellite.parse_obj(v) for k, v in data.items()}
int(k): Satellite.parse_obj(v)
for k, v in data.items()
}

View File

@ -1,5 +1,6 @@
from pydantic import BaseSettings, BaseModel from pydantic import BaseSettings, BaseModel
class Observer(BaseModel): class Observer(BaseModel):
latitude: float latitude: float
longitude: float longitude: float
@ -7,11 +8,13 @@ class Observer(BaseModel):
min_elevation: int = 15 min_elevation: int = 15
good_elevation: int = 50 good_elevation: int = 50
class CalDav(BaseModel): class CalDav(BaseModel):
uri: str uri: str
username: str username: str
password: str password: str
class Settings(BaseSettings): class Settings(BaseSettings):
n2yo_api_key: str n2yo_api_key: str
satellites_file: str = "satellites.toml" satellites_file: str = "satellites.toml"
@ -20,6 +23,7 @@ class Settings(BaseSettings):
class Config: class Config:
env_file = ".env" env_file = ".env"
env_nested_delimiter = '_' env_nested_delimiter = "_"
settings = Settings() settings = Settings()