Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
dbookstaber committed Apr 3, 2024
2 parents 8f9a171 + 81b4533 commit dce5d7a
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 36 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/python-publish-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
python-version: [ "3.9", "3.10", "3.11", "3.12" ]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -69,9 +69,9 @@ jobs:
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -95,7 +95,7 @@ jobs:
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}

- name: Upload Artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: python-package-artifacts
path: dist/
12 changes: 6 additions & 6 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ name: Upload Python Package

on:
release:
types: [published, edited]
types: [published]

workflow_dispatch:

Expand All @@ -28,9 +28,9 @@ jobs:
python-version: [ "3.9", "3.10", "3.11", "3.12" ]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -78,9 +78,9 @@ jobs:
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -104,7 +104,7 @@ jobs:
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}

- name: Upload Artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: python-package-artifacts
path: dist/
18 changes: 9 additions & 9 deletions py_ballisticcalc/conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
@dataclass
class Atmo(TypedUnits): # pylint: disable=too-many-instance-attributes
"""Atmospheric conditions and density calculations"""
altitude: [float, Distance] = field(default_factory=Set.Units.distance)
pressure: [float, Pressure] = field(default_factory=Set.Units.pressure)
temperature: [float, Temperature] = field(default_factory=Set.Units.temperature)
altitude: [float, Distance] = field(default_factory=lambda: Set.Units.distance)
pressure: [float, Pressure] = field(default_factory=lambda: Set.Units.pressure)
temperature: [float, Temperature] = field(default_factory=lambda: Set.Units.temperature)
humidity: float = 0.0 # Relative humidity [0% to 100%]
density_ratio: float = field(init=False) # Density / cStandardDensity
mach: Velocity = field(init=False) # Mach 1 in reference atmosphere
Expand Down Expand Up @@ -194,9 +194,9 @@ class Wind(TypedUnits):
direction_from = 0 is blowing from behind shooter.
direction_from = 90 degrees is blowing from shooter's left towards right.
"""
velocity: [float, Velocity] = field(default_factory=Set.Units.velocity)
direction_from: [float, Angular] = field(default_factory=Set.Units.angular)
until_distance: [float, Distance] = field(default_factory=Set.Units.distance)
velocity: [float, Velocity] = field(default_factory=lambda: Set.Units.velocity)
direction_from: [float, Angular] = field(default_factory=lambda: Set.Units.angular)
until_distance: [float, Distance] = field(default_factory=lambda: Set.Units.distance)
MAX_DISTANCE_FEET = 1e8

def __post_init__(self):
Expand All @@ -221,9 +221,9 @@ class Shot(TypedUnits):
:param cant_angle: Tilt of gun from vertical, which shifts any barrel elevation
from the vertical plane into the horizontal plane by sine(cant_angle)
"""
look_angle: [float, Angular] = field(default_factory=Set.Units.angular)
relative_angle: [float, Angular] = field(default_factory=Set.Units.angular)
cant_angle: [float, Angular] = field(default_factory=Set.Units.angular)
look_angle: [float, Angular] = field(default_factory=lambda: Set.Units.angular)
relative_angle: [float, Angular] = field(default_factory=lambda: Set.Units.angular)
cant_angle: [float, Angular] = field(default_factory=lambda: Set.Units.angular)

weapon: Weapon = field(default=None)
ammo: Ammo = field(default=None)
Expand Down
10 changes: 5 additions & 5 deletions py_ballisticcalc/munition.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class Weapon(TypedUnits):
:param zero_elevation: Angle of barrel relative to sight line when sight is set to "zero."
(Typically computed by ballistic Calculator.)
"""
sight_height: [float, Distance] = field(default_factory=Set.Units.sight_height)
twist: [float, Distance] = field(default_factory=Set.Units.twist)
zero_elevation: [float, Angular] = field(default_factory=Set.Units.angular)
sight_height: [float, Distance] = field(default_factory=lambda: Set.Units.sight_height)
twist: [float, Distance] = field(default_factory=lambda: Set.Units.twist)
zero_elevation: [float, Angular] = field(default_factory=lambda: Set.Units.angular)

def __post_init__(self):
if not self.sight_height:
Expand All @@ -42,8 +42,8 @@ class Ammo(TypedUnits):
Settings.USE_POWDER_SENSITIVITY = True
"""
dm: DragModel = field(default=None)
mv: [float, Velocity] = field(default_factory=Set.Units.velocity)
powder_temp: [float, Temperature] = field(default_factory=Set.Units.temperature)
mv: [float, Velocity] = field(default_factory=lambda: Set.Units.velocity)
powder_temp: [float, Temperature] = field(default_factory=lambda: Set.Units.temperature)
temp_modifier: float = field(default=0)

def __post_init__(self):
Expand Down
5 changes: 1 addition & 4 deletions py_ballisticcalc/unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,12 @@ def symbol(self) -> str:
def __repr__(self) -> str:
return UnitPropsDict[self].name

def __call__(self: 'Unit', value: [int, float, 'AbstractUnit'] = None) -> ['AbstractUnit', 'Unit']:
def __call__(self: 'Unit', value: [int, float, 'AbstractUnit']) -> 'AbstractUnit':
"""Creates new unit instance by dot syntax
:param self: unit as Unit enum
:param value: numeric value of the unit
:return: AbstractUnit instance
"""
if value is None:
return self

if isinstance(value, AbstractUnit):
return value << self
if 0 <= self < 10:
Expand Down
2 changes: 1 addition & 1 deletion py_ballisticcalc_exts/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "py_ballisticcalc.exts"
version = "2.0.0b2"
version = "2.0.0b1"

authors = [
{ name="o-murphy", email="[email protected]" },
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "py_ballisticcalc"
version = "2.0.0b2"
version = "2.0.0b1"

authors = [
{ name="o-murphy", email="[email protected]" },
Expand Down Expand Up @@ -58,6 +58,6 @@ exclude = ["py_ballisticcalc_exts*"]


[project.optional-dependencies]
exts = ['py_ballisticcalc.exts==2.0.0b2']
exts = ['py_ballisticcalc.exts==2.0.0b1']
lint = ['pylint', 'flake8']
charts = ['matplotlib', 'pandas']

0 comments on commit dce5d7a

Please sign in to comment.