Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielBarberini committed Sep 16, 2023
1 parent 83b9176 commit c95424f
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
7 changes: 4 additions & 3 deletions lib/controllers/rocket.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from fastapi import Response, status
from typing import Dict, Any, Union
import jsonpickle
import ast

from fastapi import Response, status
#from inspect import getsourcelines

import ast
import jsonpickle
import rocketpy.Parachute
import rocketpy.Rocket
from rocketpy.AeroSurface import NoseCone as rocketpy_NoseCone
Expand Down
2 changes: 1 addition & 1 deletion lib/models/motor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pydantic import BaseModel
from typing import Optional, Tuple
from pydantic import BaseModel

class Motor(BaseModel, frozen=True):
burn_time: float
Expand Down
2 changes: 1 addition & 1 deletion lib/models/rocket.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pydantic import BaseModel
from typing import Optional, Tuple
from pydantic import BaseModel
from lib.models.motor import Motor
from lib.models.aerosurfaces import Fins, NoseCone, Tail, RailButtons
from lib.models.parachute import Parachute
Expand Down
6 changes: 3 additions & 3 deletions lib/repositories/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ def update_env(self) -> "Union[int, None]":
environment_to_dict = self.environment.dict()
environment_to_dict["env_id"] = self.environment.__hash__()

updated_env = self.collection.update_one(
self.collection.update_one(
{ "env_id": self.env_id },
{ "$set": environment_to_dict }
)

self.env_id = environment_to_dict["env_id"]
return self.env_id
except:
Expand All @@ -77,8 +78,7 @@ def get_env(self) -> "Union[Env, None]":
if environment is not None:
del environment["_id"]
return Env.parse_obj(environment)
else:
return None
return None
except:
raise Exception("Error getting environment")

Expand Down
3 changes: 1 addition & 2 deletions lib/repositories/motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ def get_motor(self) -> "Union[motor, None]":
if motor is not None:
del motor["_id"]
return Motor.parse_obj(motor)
else:
return None
return None
except:
raise Exception("Error getting motor")

Expand Down
3 changes: 1 addition & 2 deletions lib/repositories/rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ def get_rocket(self) -> "Union[Rocket, None]":
if rocket is not None:
del rocket["_id"]
return Rocket.parse_obj(rocket)
else:
return None
return None
except:
raise Exception("Error getting rocket")

Expand Down
1 change: 1 addition & 0 deletions lib/secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def get_os_secret(key):
def get_secret(self, key):
dotenv_secret = self.secrets.get(key)
if not dotenv_secret:
print("cheguei")
return self.get_os_secret(key)
return dotenv_secret

Expand Down

0 comments on commit c95424f

Please sign in to comment.