Run autoformat, Add readme
This commit is contained in:
parent
d1b8839dba
commit
f973938f53
@ -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:
|
||||||
|
@ -86,10 +86,11 @@ 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)
|
||||||
try:
|
try:
|
||||||
yield api
|
yield api
|
||||||
finally:
|
finally:
|
||||||
await api.client.close()
|
await api.client.close()
|
||||||
|
@ -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()
|
|
||||||
}
|
|
||||||
|
@ -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,19 +8,22 @@ 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"
|
||||||
observer: Observer
|
observer: Observer
|
||||||
caldav: CalDav
|
caldav: CalDav
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
env_file = ".env"
|
env_file = ".env"
|
||||||
env_nested_delimiter = '_'
|
env_nested_delimiter = "_"
|
||||||
|
|
||||||
|
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
|
Loading…
Reference in New Issue
Block a user