8000 DEV: adds ruff, removes black, isort and flake8 by Gui-FernandesBR · Pull Request #763 · RocketPy-Team/RocketPy · GitHub
[go: up one dir, main page]

Skip to content

DEV: adds ruff, removes black, isort and flake8 #763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
DEV: adds ruff format
  • Loading branch information
Gui-FernandesBR committed Feb 8, 2025
commit dc3bcade01315d6e8bf459ccaa155829eea3398c
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@
"prettytable",
"Projeto",
"prometheus",
"pycodestyle",
"pydata",
"pydocstyle",
"pylint",
Expand Down
17 changes: 5 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,13 @@ install:
pip install -r requirements-optional.txt
pip install -e .

format: isort black
format:
ruff check --select I --fix rocketpy/ tests/ docs/
ruff format rocketpy/ tests/ docs/

isort:
isort --profile black rocketpy/ tests/ docs/
lint: ruff-lint pylint

black:
black rocketpy/ tests/ docs/

lint: flake8 pylint

flake8:
flake8 rocketpy/ tests/

ruff:
ruff-lint:
ruff check rocketpy/ tests/ --output-file=.ruff-report.txt

pylint:
Expand Down
10 changes: 5 additions & 5 deletions docs/examples/SEB_liquid_motor.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@
"outputs": [],
"source": [
"from rocketpy import (\n",
" CylindricalTank,\n",
" Environment,\n",
" Flight,\n",
" Fluid,\n",
" Function,\n",
" LiquidMotor,\n",
" UllageBasedTank,\n",
" MassBasedTank,\n",
" Fluid,\n",
" Rocket,\n",
" Flight,\n",
" Environment,\n",
" CylindricalTank,\n",
" UllageBasedTank,\n",
")"
]
},
Expand Down
7 changes: 3 additions & 4 deletions docs/examples/andromeda_flight_sim.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
"metadata": {},
"outputs": [],
"source": [
"from rocketpy import Function, Environment, Flight, Rocket, SolidMotor\n",
"import matplotlib.pyplot as plt\n",
"\n",
"from rocketpy import Environment, Flight, Function, Rocket, SolidMotor\n",
"from rocketpy.motors import CylindricalTank, SolidMotor\n",
"from rocketpy.motors.tank import MassFlowRateBasedTank\n",
"\n",
"import matplotlib.pyplot as plt\n",
"\n",
"plt.style.use(\"seaborn-v0_8-colorblind\")"
]
},
Expand Down Expand Up @@ -452,7 +452,6 @@
"source": [
"from rocketpy.simulation.flight_data_importer import FlightDataImporter\n",
"\n",
"\n",
"columns_map = {\n",
" \"t(s)\": \"time\",\n",
" \"alt(m)\": \"altitude\",\n",
Expand Down
19 changes: 13 additions & 6 deletions docs/examples/camoes_flight_sim.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,20 @@
"metadata": {},
"outputs": [],
"source": [
"from rocketpy import Function, Environment, Flight, Rocket, SolidMotor\n",
"from rocketpy import AirBrakes, _Controller\n",
"import matplotlib.pyplot as plt\n",
"\n",
"from rocketpy import (\n",
" AirBrakes,\n",
" Environment,\n",
" Flight,\n",
" Function,\n",
" Rocket,\n",
" SolidMotor,\n",
" _Controller,\n",
")\n",
"from rocketpy.motors import CylindricalTank, SolidMotor\n",
"from rocketpy.motors.tank import MassFlowRateBasedTank\n",
"\n",
"import matplotlib.pyplot as plt\n",
"\n",
"plt.style.use(\"seaborn-v0_8-colorblind\")"
]
},
Expand Down Expand Up @@ -813,7 +820,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "RocketPy",
"display_name": ".venv",
"language": "python",
"name": "python3"
},
Expand All @@ -827,7 +834,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.7"
"version": "3.13.1"
}
},
"nbformat": 4,
Expand Down
7 changes: 3 additions & 4 deletions docs/examples/cavour_flight_sim.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
"metadata": {},
"outputs": [],
"source": [
"from rocketpy import Function, Environment, Flight, Rocket, SolidMotor\n",
"from rocketpy.motors import SolidMotor\n",
"\n",
"import matplotlib.pyplot as plt\n",
"\n",
"from rocketpy import Environment, Flight, Function, Rocket, SolidMotor\n",
"from rocketpy.motors import SolidMotor\n",
"\n",
"plt.style.use(\"seaborn-v0_8-colorblind\")"
]
},
Expand Down Expand Up @@ -377,7 +377,6 @@
"source": [
"from rocketpy.simulation.flight_data_importer import FlightDataImporter\n",
"\n",
"\n",
"columns_map = {\n",
" \"ts\": \"time\",\n",
" \"altitude[m]\": \"altitude\",\n",
Expand Down
31 changes: 16 additions & 15 deletions docs/examples/defiance_flight_sim.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
"metadata": {},
"outputs": [],
"source": [
"from rocketpy import Function, Environment, Rocket, Flight\n",
"import datetime\n",
"\n",
"from rocketpy import Environment, Flight, Function, Rocket\n",
"from rocketpy.motors import CylindricalTank, Fluid, HybridMotor\n",
"from rocketpy.motors.tank import MassFlowRateBasedTank\n",
"import datetime"
"from rocketpy.motors.tank import MassFlowRateBasedTank"
]
},
{
Expand Down Expand Up @@ -127,13 +128,13 @@
"metadata": {},
"outputs": [],
"source": [
"oxidizer_liq = Fluid(name='N2O_l', density=960)\n",
"oxidizer_gas = Fluid(name='N2O_g', density=1.9277)\n",
"oxidizer_liq = Fluid(name=\"N2O_l\", density=960)\n",
"oxidizer_gas = Fluid(name=\"N2O_g\", density=1.9277)\n",
"\n",
"tank_shape = CylindricalTank(0.0665, 1.79)\n",
"\n",
"oxidizer_tank = MassFlowRateBasedTank(\n",
" name='oxidizer_tank',\n",
" name=\"oxidizer_tank\",\n",
" geometry=tank_shape,\n",
" flux_time=(6.5),\n",
" liquid=oxidizer_liq,\n",
Expand All @@ -146,15 +147,15 @@
" gas_mass_flow_rate_out=0,\n",
")\n",
"\n",
"''' Defining the thrust curve'''\n",
"\"\"\" Defining the thrust curve\"\"\"\n",
"\n",
"\n",
"def thrust_fuction(t):\n",
" return 5750 * 2 ** (-t / 200)\n",
"\n",
"\n",
"hybrid_motor = HybridMotor(\n",
" thrust_source='../../data/rockets/defiance/Thrust_curve.csv',\n",
" thrust_source=\"../../data/rockets/defiance/Thrust_curve.csv\",\n",
" dry_mass=13.832,\n",
" dry_inertia=(1.801, 1.801, 0.0305),\n",
" center_of_dry_mass_position=780 / 1000,\n",
Expand All @@ -167,9 +168,9 @@
" grain_density=920,\n",
" nozzle_radius=0.0447,\n",
" throat_radius=0.0234,\n",
" interpolation_method='linear',\n",
" interpolation_method=\"linear\",\n",
" grains_center_of_mass_position=0.377,\n",
" coordinate_system_orientation='nozzle_to_combustion_chamber',\n",
" coordinate_system_orientation=\"nozzle_to_combustion_chamber\",\n",
")\n",
"\n",
"hybrid_motor.add_tank(tank=oxidizer_tank, position=2.2)"
Expand Down Expand Up @@ -205,9 +206,9 @@
" # inertia = (180.142, 180.142, 0.262),\n",
" inertia=(94.14, 94.14, 0.09),\n",
" center_of_mass_without_motor=3.29,\n",
" power_off_drag='../../data/rockets/defiance/DragCurve.csv',\n",
" power_on_drag='../../data/rockets/defiance/DragCurve.csv',\n",
" coordinate_system_orientation='tail_to_nose',\n",
" power_off_drag=\"../../data/rockets/defiance/DragCurve.csv\",\n",
" power_on_drag=\"../../data/rockets/defiance/DragCurve.csv\",\n",
" coordinate_system_orientation=\"tail_to_nose\",\n",
")\n",
"\n",
"defiance.add_motor(hybrid_motor, position=0.2)\n",
Expand All @@ -220,10 +221,10 @@
"\n",
"defiance.add_tail(top_radius=0.07, bottom_radius=0.064, length=0.0597, position=0.1)\n",
"\n",
"defiance.add_parachute(name='main', cd_s=2.2, trigger=305, sampling_rate=100, lag=0)\n",
"defiance.add_parachute(name=\"main\", cd_s=2.2, trigger=305, sampling_rate=100, lag=0)\n",
"\n",
"defiance.add_parachute(\n",
" name='drogue', cd_s=1.55, trigger='apogee', sampling_rate=100, lag=0\n",
" name=\"drogue\", cd_s=1.55, trigger=\"apogee\", sampling_rate=100, lag=0\n",
")"
]
},
Expand Down
7 changes: 3 additions & 4 deletions docs/examples/erebus_flight_sim.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
"metadata": {},
"outputs": [],
"source": [
"from rocketpy import Function, Environment, Flight, Rocket, SolidMotor\n",
"import matplotlib.pyplot as plt\n",
"\n",
"from rocketpy import Environment, Flight, Function, Rocket, SolidMotor\n",
"from rocketpy.motors import CylindricalTank, SolidMotor\n",
"from rocketpy.motors.tank import MassFlowRateBasedTank\n",
"\n",
"import matplotlib.pyplot as plt\n",
"\n",
"plt.style.use(\"seaborn-v0_8-colorblind\")"
]
},
Expand Down Expand Up @@ -384,7 +384,6 @@
"source": [
"from rocketpy.simulation.flight_data_importer import FlightDataImporter\n",
"\n",
"\n",
"columns_map = {\n",
" \"t\": \"time\",\n",
" \"alt\": \"altitude\",\n",
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/genesis_flight_sim.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
"metadata": {},
"outputs": [],
"source": [
"from rocketpy import Function, Environment, Flight, Rocket, SolidMotor\n",
"import matplotlib.pyplot as plt\n",
"\n",
"from rocketpy import Environment, Flight, Function, Rocket, SolidMotor\n",
"from rocketpy.motors import CylindricalTank, SolidMotor\n",
"from rocketpy.motors.tank import MassFlowRateBasedTank\n",
"\n",
"import matplotlib.pyplot as plt\n",
"\n",
"plt.style.use(\"seaborn-v0_8-colorblind\")"
]
},
Expand Down
9 changes: 5 additions & 4 deletions docs/examples/halcyon_flight_sim.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@
"metadata": {},
"outputs": [],
"source": [
"from rocketpy import Function, Environment, Flight, Rocket\n",
"from rocketpy.motors import CylindricalTank, Fluid, HybridMotor\n",
"from rocketpy.motors.tank import MassFlowRateBasedTank\n",
"import datetime\n",
"\n",
"import matplotlib.pyplot as plt\n",
"\n",
"from rocketpy import Environment, Flight, Function, Rocket\n",
"from rocketpy.motors import CylindricalTank, Fluid, HybridMotor\n",
"from rocketpy.motors.tank import MassFlowRateBasedTank\n",
"\n",
"plt.style.use(\"seaborn-v0_8-colorblind\")"
]
},
Expand Down Expand Up @@ -505,7 +507,6 @@
"source": [
"from rocketpy.simulation.flight_data_importer import FlightDataImporter\n",
"\n",
"\n",
"columns_map = {\n",
" \"ts\": \"time\",\n",
" \"filtered_altitude_AGL\": \"altitude\",\n",
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/juno3_flight_sim.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
"metadata": {},
"outputs": [],
"source": [
"from rocketpy import Function, Rocket, SolidMotor, Flight, Environment\n",
"from rocketpy.simulation.flight_data_importer import FlightDataImporter\n",
"\n",
"import matplotlib.pyplot as plt\n",
"\n",
"from rocketpy import Environment, Flight, Function, Rocket, SolidMotor\n",
"from rocketpy.simulation.flight_data_importer import FlightDataImporter\n",
"\n",
"plt.style.use(\"seaborn-v0_8-colorblind\")"
]
},
Expand Down
7 changes: 3 additions & 4 deletions docs/examples/lince_flight_sim.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
"metadata": {},
"outputs": [],
"source": [
"from rocketpy import Function, Environment, Flight, Rocket, SolidMotor\n",
"from rocketpy.motors import SolidMotor\n",
"\n",
"import matplotlib.pyplot as plt\n",
"\n",
"from rocketpy import Environment, Flight, Function, Rocket, SolidMotor\n",
"from rocketpy.motors import SolidMotor\n",
"\n",
"plt.style.use(\"seaborn-v0_8-colorblind\")"
]
},
Expand Down Expand Up @@ -607,7 +607,6 @@
"source": [
"from rocketpy.simulation.flight_data_importer import FlightDataImporter\n",
"\n",
"\n",
"columns_map = {\n",
" \"ts\": \"time\",\n",
" \"filtered_altitude_AGL\": \"altitude\",\n",
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/prometheus_2022_flight_sim.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
"metadata": {},
"outputs": [],
"source": [
"from rocketpy import Function, Rocket, GenericMotor, Flight, Environment\n",
"from rocketpy.simulation.flight_data_importer import FlightDataImporter\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"from rocketpy import Environment, Flight, Function, GenericMotor, Rocket\n",
"from rocketpy.simulation.flight_data_importer import FlightDataImporter\n",
"\n",
"plt.style.use(\"seaborn-v0_8-colorblind\")"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@
},
"outputs": [],
"source": [
"from rocketpy import EnvironmentAnalysis\n",
"from datetime import datetime\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"from scipy import stats"
"from scipy import stats\n",
"\n",
"from rocketpy import EnvironmentAnalysis"
]
},
{
Expand Down
Loading
0