Skip to content

Commit 11110c0

Browse files
committed
chore: formatting and linting
1 parent fab9582 commit 11110c0

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

src/utils.py

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import io
33
import logging
44
import json
5-
import copy
65
import numpy as np
76
from scipy.interpolate import interp1d
87
from datetime import datetime
@@ -26,7 +25,9 @@ class DiscretizeConfig:
2625
Configuration class for RocketPy function discretization.
2726
"""
2827

29-
def __init__(self, bounds: Tuple[float, float] = (0, 10), samples: int = 200):
28+
def __init__(
29+
self, bounds: Tuple[float, float] = (0, 10), samples: int = 200
30+
):
3031
self.bounds = bounds
3132
self.samples = samples
3233

@@ -162,12 +163,14 @@ def collect_attributes(obj, attribute_classes=None):
162163
]
163164
try:
164165
for key in motor_attributes_list:
165-
if key not in attributes.get("rocket", {}).get("motor", {}):
166+
if key not in attributes.get("rocket", {}).get(
167+
"motor", {}
168+
):
166169
try:
167170
value = getattr(obj.rocket.motor, key)
168-
attributes.setdefault("rocket", {}).setdefault("motor", {})[
169-
key
170-
] = value
171+
attributes.setdefault("rocket", {}).setdefault(
172+
"motor", {}
173+
)[key] = value
171174
except Exception:
172175
pass
173176
except Exception:
@@ -228,25 +231,33 @@ def _fix_datetime_fields(data):
228231

229232

230233
class RocketPyGZipMiddleware:
231-
def __init__(self, app: ASGIApp, minimum_size: int = 500, compresslevel: int = 9) -> None:
234+
def __init__(
235+
self, app: ASGIApp, minimum_size: int = 500, compresslevel: int = 9
236+
) -> None:
232237
self.app = app
233238
self.minimum_size = minimum_size
234239
self.compresslevel = compresslevel
235240

236-
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
241+
async def __call__(
242+
self, scope: Scope, receive: Receive, send: Send
243+
) -> None:
237244
if scope["type"] == "http":
238245
headers = Headers(scope=scope)
239246
if "gzip" in headers.get("Accept-Encoding", ""):
240247
responder = GZipResponder(
241-
self.app, self.minimum_size, compresslevel=self.compresslevel
248+
self.app,
249+
self.minimum_size,
250+
compresslevel=self.compresslevel,
242251
)
243252
await responder(scope, receive, send)
244253
return
245254
await self.app(scope, receive, send)
246255

247256

248257
class GZipResponder:
249-
def __init__(self, app: ASGIApp, minimum_size: int, compresslevel: int = 9) -> None:
258+
def __init__(
259+
self, app: ASGIApp, minimum_size: int, compresslevel: int = 9
260+
) -> None:
250261
self.app = app
251262
self.minimum_size = minimum_size
252263
self.send: Send = unattached_send
@@ -258,7 +269,9 @@ def __init__(self, app: ASGIApp, minimum_size: int, compresslevel: int = 9) -> N
258269
mode="wb", fileobj=self.gzip_buffer, compresslevel=compresslevel
259270
)
260271

261-
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
272+
async def __call__(
273+
self, scope: Scope, receive: Receive, send: Send
274+
) -> None:
262275
self.send = send
263276
with self.gzip_buffer, self.gzip_file:
264277
await self.app(scope, receive, self.send_with_gzip)
@@ -269,7 +282,9 @@ async def send_with_gzip(self, message: Message) -> None:
269282
self.initial_message = message
270283
headers = Headers(raw=self.initial_message["headers"])
271284
self.content_encoding_set = "content-encoding" in headers
272-
elif message_type == "http.response.body" and self.content_encoding_set:
285+
elif (
286+
message_type == "http.response.body" and self.content_encoding_set
287+
):
273288
if not self.started:
274289
self.started = True
275290
await self.send(self.initial_message)

src/views/flight.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from typing import Optional, Any
22
from pydantic import ConfigDict
3-
from typing import Optional, Any
4-
from pydantic import ConfigDict
53
from src.models.flight import FlightModel
64
from src.views.interface import ApiBaseView
75
from src.views.rocket import RocketView, RocketSimulation

0 commit comments

Comments
 (0)