Skip to content

Commit

Permalink
Applies automatic ruff fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdsharpe committed Aug 1, 2024
1 parent a8b74f5 commit c627f7a
Show file tree
Hide file tree
Showing 153 changed files with 94 additions and 251 deletions.
2 changes: 1 addition & 1 deletion aerosandbox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from aerosandbox.propulsion import *
from aerosandbox.structures import *

__version__ = "4.2.5"
__version__ = "4.2.6"


def docs():
Expand Down
4 changes: 2 additions & 2 deletions aerosandbox/aerodynamics/aero_2D/airfoil_inviscid.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
calculate_induced_velocity_line_singularities,
)
import aerosandbox.numpy as np
from typing import Union, List, Optional
from typing import Union, List


class AirfoilInviscid(ImplicitAnalysis):
Expand Down Expand Up @@ -246,7 +246,7 @@ def draw_streamlines(self, res=200, show=True):
plt.gca().set_aspect("equal", adjustable="box")
plt.xlabel(r"$x/c$")
plt.ylabel(r"$y/c$")
plt.title(rf"Inviscid Airfoil: Flow Field")
plt.title(r"Inviscid Airfoil: Flow Field")
plt.tight_layout()
if show:
plt.show()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from aerosandbox.geometry.airfoil.airfoil_families import get_kulfan_coordinates
from scipy import optimize
import matplotlib.pyplot as plt
import aerosandbox.tools.pretty_plots as p

if __name__ == "__main__":

Expand Down
2 changes: 0 additions & 2 deletions aerosandbox/aerodynamics/aero_2D/airfoil_polar_functions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from aerosandbox.geometry import Airfoil
from aerosandbox.performance import OperatingPoint
import aerosandbox.numpy as np
import aerosandbox.library.aerodynamics as aerolib


def airfoil_coefficients_post_stall(
Expand Down
7 changes: 2 additions & 5 deletions aerosandbox/aerodynamics/aero_2D/mses.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@
from pathlib import Path
from aerosandbox.geometry import Airfoil
from aerosandbox.aerodynamics.aero_3D.avl import AVL
from typing import Union, List, Dict
from typing import Union, List
import tempfile
import warnings
import os
from textwrap import dedent
import shutil


class MSES(ExplicitAnalysis):
Expand Down Expand Up @@ -329,7 +326,7 @@ def mset(mset_alpha):
continue

mplot_keystrokes = dedent(
f"""\
"""\
1
12
0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import aerosandbox as asb
import aerosandbox.numpy as np
import pytest


Expand Down
2 changes: 1 addition & 1 deletion aerosandbox/aerodynamics/aero_2D/xfoil.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ def open_interactive(self) -> None:
self.airfoil.write_dat(directory / airfoil_file)

### Open up AVL
import sys, os
import sys

if sys.platform == "win32":
# Run XFoil
Expand Down
4 changes: 1 addition & 3 deletions aerosandbox/aerodynamics/aero_3D/aero_buildup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
from aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.fuselage_aerodynamics_utilities import *
from aerosandbox.library.aerodynamics import transonic
import aerosandbox.library.aerodynamics as aerolib
import copy
from typing import Union, List, Dict, Any
from typing import Union, List, Dict
from aerosandbox.aerodynamics.aero_3D.aero_buildup_submodels.softmax_scalefree import (
softmax_scalefree,
)
from dataclasses import dataclass
from functools import cached_property


class AeroBuildup(ExplicitAnalysis):
Expand Down
15 changes: 7 additions & 8 deletions aerosandbox/aerodynamics/aero_3D/avl.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
from pathlib import Path
from aerosandbox.geometry import Airplane, Wing, WingXSec, Fuselage, ControlSurface
from aerosandbox.performance import OperatingPoint
from typing import Union, List, Dict, Any
import copy
from typing import Union, List, Dict
import tempfile
import warnings

Expand Down Expand Up @@ -179,7 +178,7 @@ def open_interactive(self) -> None:
self.write_avl(directory / airplane_file)

### Open up AVL
import sys, os
import sys

if sys.platform == "win32":
# Run AVL
Expand Down Expand Up @@ -388,7 +387,7 @@ def _default_keystroke_file_contents(self) -> List[str]:
]

# Set control surface deflections
run_file_contents += [f"d1 d1 1"]
run_file_contents += ["d1 d1 1"]

return run_file_contents

Expand Down Expand Up @@ -471,7 +470,7 @@ def clean(s):

if wing.symmetric:
avl_file += clean(
f"""\
"""\
YDUPLICATE
0
Expand All @@ -480,23 +479,23 @@ def clean(s):

if wing_options["no_wake"]:
avl_file += clean(
f"""\
"""\
NOWAKE
"""
)

if wing_options["no_alpha_beta"]:
avl_file += clean(
f"""\
"""\
NOALBE
"""
)

if wing_options["no_load"]:
avl_file += clean(
f"""\
"""\
NOLOAD
"""
Expand Down
4 changes: 1 addition & 3 deletions aerosandbox/aerodynamics/aero_3D/lifting_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from aerosandbox.aerodynamics.aero_3D.singularities.point_source import (
calculate_induced_velocity_point_source,
)
from typing import Dict, Any, List, Callable, Union
from typing import Dict, List, Callable, Union
from aerosandbox.aerodynamics.aero_3D.aero_buildup import AeroBuildup
from dataclasses import dataclass

Expand Down Expand Up @@ -1323,8 +1323,6 @@ def get_aero(resolution):
resolutions = 1 + np.arange(20)
aeros = get_aero(resolutions)

import matplotlib.pyplot as plt
import aerosandbox.tools.pretty_plots as p

fig, ax = plt.subplots(3, 1)
ax[0].semilogx(resolutions, [aero["CL"] for aero in aeros])
Expand Down
6 changes: 2 additions & 4 deletions aerosandbox/aerodynamics/aero_3D/linear_potential_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
from aerosandbox.aerodynamics.aero_3D.singularities.uniform_strength_horseshoe_singularities import (
calculate_induced_velocity_horseshoe,
)
from typing import Dict, Any, List, Callable, Optional, Union, Tuple
import copy
from functools import cached_property, lru_cache, partial
from collections import namedtuple
from typing import Dict, Any, List, Union, Tuple
from functools import cached_property, partial
from dataclasses import dataclass
from abc import abstractmethod, ABC

Expand Down
1 change: 0 additions & 1 deletion aerosandbox/aerodynamics/aero_3D/nonlinear_lifting_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
)
import aerosandbox.numpy as np
from typing import Dict, Any, Callable, List
import copy


### Define some helper functions that take a vector and make it a Nx1 or 1xN, respectively.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import aerosandbox as asb
import aerosandbox.numpy as np

airfoil = asb.Airfoil("naca0008")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import aerosandbox as asb
import aerosandbox.numpy as np

airfoil = asb.Airfoil("naca0008")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import aerosandbox as asb
import aerosandbox.numpy as np
import pytest

wing_airfoil = asb.Airfoil("naca0010") # asb.Airfoil("sd7037")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
),
).run()

from aerosandbox.tools.string_formatting import eng_string

p.contour(
Beta,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ def get_aero(xyz_ref):
x_cgs = np.linspace(0, 1, 11)
aeros = np.array([get_aero(xyz_ref=[x, 0, 0]) for x in x_cgs], dtype="O")

import matplotlib.pyplot as plt
import aerosandbox.tools.pretty_plots as p

fig, ax = plt.subplots(figsize=(4, 4))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import aerosandbox as asb
import pytest
from aerosandbox.aerodynamics.aero_3D.test_aero_3D.geometries.conventional import (
airplane,
)
Expand Down
1 change: 0 additions & 1 deletion aerosandbox/aerodynamics/aero_3D/test_aero_3D/test_avl.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import aerosandbox as asb
import pytest


def is_tool(name):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import aerosandbox as asb
import pytest
from aerosandbox.aerodynamics.aero_3D.test_aero_3D.geometries.conventional import (
airplane,
)

# def test_lifting_line():
# analysis = asb.LiftingLine(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
airplane,
)
import aerosandbox as asb
import aerosandbox.numpy as np


op_point = asb.OperatingPoint(velocity=25, alpha=3)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import aerosandbox as asb
import aerosandbox.numpy as np
import pytest


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import aerosandbox as asb
import aerosandbox.numpy as np
import pytest

airplane = asb.Airplane(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import aerosandbox as asb
import pytest


def test_conventional():
Expand Down
2 changes: 0 additions & 2 deletions aerosandbox/atmosphere/_diff_atmo_functions.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import aerosandbox.numpy as np
from pathlib import Path
from aerosandbox.modeling.interpolation import InterpolatedModel
from aerosandbox.atmosphere._isa_atmo_functions import (
pressure_isa,
temperature_isa,
isa_base_altitude,
)

# Define the altitudes of knot points
Expand Down
6 changes: 3 additions & 3 deletions aerosandbox/atmosphere/atmosphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def get_item_of_attribute(a):
else:
try:
return a[index]
except IndexError as e:
except IndexError:
raise IndexError(
f"A state variable could not be indexed; it has length {len(a)} while the"
f"parent has length {l}."
Expand Down Expand Up @@ -114,7 +114,7 @@ def __len__(self):
try:
v[0]
length = 1
except (TypeError, IndexError, KeyError) as e:
except (TypeError, IndexError, KeyError):
pass
elif length == 0 or length == 1:
length = np.length(v)
Expand Down Expand Up @@ -318,7 +318,7 @@ def knudsen(self, length):
a.set_ylim(altitude.min() / u.foot, altitude.max() / u.foot)
ax[0].set_ylabel("Altitude [ft]")
plt.legend(title="Method")
p.show_plot(f"Atmosphere", rotate_axis_labels=False, legend=False)
p.show_plot("Atmosphere", rotate_axis_labels=False, legend=False)

fig, ax = plt.subplots(1, 2, sharey=True)
ax[0].plot(
Expand Down
1 change: 0 additions & 1 deletion aerosandbox/atmosphere/thermodynamics/choked_flow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import aerosandbox.numpy as np
from aerosandbox.atmosphere.thermodynamics.gas import universal_gas_constant


Expand Down
1 change: 0 additions & 1 deletion aerosandbox/atmosphere/thermodynamics/gas.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import aerosandbox.numpy as np
from aerosandbox.tools.string_formatting import eng_string
import copy
from typing import Union

universal_gas_constant = 8.31432 # J/(mol*K); universal gas constant
Expand Down
4 changes: 2 additions & 2 deletions aerosandbox/dynamics/point_mass/common_point_mass.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import aerosandbox.numpy as np
from aerosandbox.common import AeroSandboxObject
from abc import ABC, abstractmethod, abstractproperty
from abc import ABC, abstractmethod
from typing import Union, Dict, Tuple, List
from aerosandbox import (
MassProperties,
Expand Down Expand Up @@ -211,7 +211,7 @@ def get_item_of_attribute(a):
else:
try:
return a[index]
except IndexError as e:
except IndexError:
raise IndexError(
f"A state variable could not be indexed; it has length {len(a)} while the"
f"parent has length {l}."
Expand Down
2 changes: 1 addition & 1 deletion aerosandbox/dynamics/point_mass/point_1D/horizontal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
)
from aerosandbox.weights.mass_properties import MassProperties
import aerosandbox.numpy as np
from typing import Union, Dict, Tuple
from typing import Union, Dict


class DynamicsPointMass1DHorizontal(DynamicsPointMass3DCartesian):
Expand Down
2 changes: 1 addition & 1 deletion aerosandbox/dynamics/point_mass/point_1D/vertical.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
)
from aerosandbox.weights.mass_properties import MassProperties
import aerosandbox.numpy as np
from typing import Union, Dict, Tuple
from typing import Union, Dict


class DynamicsPointMass1DVertical(DynamicsPointMass3DCartesian):
Expand Down
2 changes: 1 addition & 1 deletion aerosandbox/dynamics/point_mass/point_2D/cartesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
)
from aerosandbox.weights.mass_properties import MassProperties
import aerosandbox.numpy as np
from typing import Union, Dict, Tuple
from typing import Union, Dict


class DynamicsPointMass2DCartesian(DynamicsPointMass3DCartesian):
Expand Down
2 changes: 1 addition & 1 deletion aerosandbox/dynamics/point_mass/point_2D/speed_gamma.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
)
from aerosandbox.weights.mass_properties import MassProperties
import aerosandbox.numpy as np
from typing import Union, Dict, Tuple
from typing import Union, Dict


class DynamicsPointMass2DSpeedGamma(DynamicsPointMass3DSpeedGammaTrack):
Expand Down
4 changes: 2 additions & 2 deletions aerosandbox/dynamics/rigid_body/common_rigid_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from aerosandbox.dynamics.point_mass.common_point_mass import (
_DynamicsPointMassBaseClass,
)
from abc import ABC, abstractmethod, abstractproperty
from typing import Union, Tuple
from abc import ABC, abstractmethod
from typing import Union
from aerosandbox import OperatingPoint, Atmosphere


Expand Down
Loading

0 comments on commit c627f7a

Please sign in to comment.