Skip to content

Commit 9da1542

Browse files
Merge pull request #553 from RocketPy-Team/mnt/final-refactor-before-v1.2
MNT: Final refactor before v1.2
2 parents e4e67f4 + 1d819d1 commit 9da1542

File tree

3 files changed

+14
-23
lines changed

3 files changed

+14
-23
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ You can install this version by running `pip install rocketpy==1.2.0`
5757

5858
### Changed
5959

60+
- MNT: Final refactor before v1.2 [#553](https://github.com/RocketPy-Team/RocketPy/pull/553)
6061
- ENH: Plotting both power on and off drag curves in a single plot [#547](https://github.com/RocketPy-Team/RocketPy/pull/547)
6162
- DOC: Replacing git clone command with curl in notebooks. [#544](https://github.com/RocketPy-Team/RocketPy/pull/544)
6263
- DOC: Installing imageio library on dispersion analysis notebook [#540](https://github.com/RocketPy-Team/RocketPy/pull/540)

docs/development/style_guide.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ So here are a couple of **guidelines** to help you when creating new branches to
6767
#. ``bug``: when your branch attempts to fix a bug
6868
#. ``doc``: when your branch adds documentation changes
6969
#. ``enh``: when you add new features and enhancements
70-
#. ``maint``: when your branch is all about refactoring, fixing typos, etc.
70+
#. ``mnt``: when your branch is all about refactoring, fixing typos, etc.
7171
#. ``rel``: when your branch makes changes related to creating new releases
7272
#. ``tst``: when your branch makes changes related to tests
7373

@@ -77,10 +77,10 @@ So here are a couple of **guidelines** to help you when creating new branches to
7777

7878
Here are a couple of example branch names:
7979

80-
- ``maint/refactor-parachute-implementation``
80+
- ``mnt/refactor-parachute-implementation``
8181
- ``bug/issue-98-upside-down-rockets``
8282
- ``enh/hybrid-motor-feature``
83-
- ``maint/typos-flight-class``
83+
- ``mnt/typos-flight-class``
8484
- ``tst/refactor-tests-flight-class``
8585

8686
Once you are ready to create a Pull Request for your branch, we advise you to merge with the ``develop`` branch instead of the default ``master`` branch.
@@ -104,7 +104,7 @@ Commit messages should be clear and follow a few basic rules. Example::
104104
Describing the motivation for a change, the nature of a bug for bug fixes or
105105
some details on what an enhancement does are also good to include in a commit
106106
message. Messages should be understandable without looking at the code
107-
changes. A commit message like ``MAINT: fixed another one`` is an example of
107+
changes. A commit message like ``MNT: fixed another one`` is an example of
108108
what not to do; the reader has to go look for context elsewhere.
109109

110110
Standard acronyms to start the commit message with are::
@@ -115,7 +115,7 @@ Standard acronyms to start the commit message with are::
115115
DEV: development tool or utility
116116
DOC: documentation
117117
ENH: enhancement
118-
MAINT: maintenance commit (refactoring, typos, etc.)
118+
MNT: maintenance commit (refactoring, typos, etc.)
119119
REV: revert an earlier commit
120120
STY: style fix (whitespace, PEP8)
121121
TST: addition or modification of tests

rocketpy/mathutils/function.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
except ImportError:
2020
from ..tools import cached_property
2121

22+
NUMERICAL_TYPES = (float, int, complex, np.ndarray, np.integer, np.floating)
23+
2224

2325
class Function:
2426
"""Class converts a python function or a data sequence into an object
@@ -1937,9 +1939,7 @@ def __add__(self, other):
19371939
return Function(lambda x: (self.get_value(x) + other(x)))
19381940
# If other is Float except...
19391941
except AttributeError:
1940-
if isinstance(
1941-
other, (float, int, complex, np.ndarray, np.integer, np.floating)
1942-
):
1942+
if isinstance(other, NUMERICAL_TYPES):
19431943
# Check if Function object source is array or callable
19441944
if isinstance(self.source, np.ndarray):
19451945
# Operate on grid values
@@ -2069,9 +2069,7 @@ def __mul__(self, other):
20692069
return Function(lambda x: (self.get_value(x) * other(x)))
20702070
# If other is Float except...
20712071
except AttributeError:
2072-
if isinstance(
2073-
other, (float, int, complex, np.ndarray, np.integer, np.floating)
2074-
):
2072+
if isinstance(other, NUMERICAL_TYPES):
20752073
# Check if Function object source is array or callable
20762074
if isinstance(self.source, np.ndarray):
20772075
# Operate on grid values
@@ -2160,9 +2158,7 @@ def __truediv__(self, other):
21602158
return Function(lambda x: (self.get_value_opt(x) / other(x)))
21612159
# If other is Float except...
21622160
except AttributeError:
2163-
if isinstance(
2164-
other, (float, int, complex, np.ndarray, np.integer, np.floating)
2165-
):
2161+
if isinstance(other, NUMERICAL_TYPES):
21662162
# Check if Function object source is array or callable
21672163
if isinstance(self.source, np.ndarray):
21682164
# Operate on grid values
@@ -2201,9 +2197,7 @@ def __rtruediv__(self, other):
22012197
A Function object which gives the result of other(x)/self(x).
22022198
"""
22032199
# Check if Function object source is array and other is float
2204-
if isinstance(
2205-
other, (float, int, complex, np.ndarray, np.integer, np.floating)
2206-
):
2200+
if isinstance(other, NUMERICAL_TYPES):
22072201
if isinstance(self.source, np.ndarray):
22082202
# Operate on grid values
22092203
ys = other / self.y_array
@@ -2271,9 +2265,7 @@ def __pow__(self, other):
22712265
return Function(lambda x: (self.get_value_opt(x) ** other(x)))
22722266
# If other is Float except...
22732267
except AttributeError:
2274-
if isinstance(
2275-
other, (float, int, complex, np.ndarray, np.integer, np.floating)
2276-
):
2268+
if isinstance(other, NUMERICAL_TYPES):
22772269
# Check if Function object source is array or callable
22782270
if isinstance(self.source, np.ndarray):
22792271
# Operate on grid values
@@ -2312,9 +2304,7 @@ def __rpow__(self, other):
23122304
A Function object which gives the result of other(x)**self(x).
23132305
"""
23142306
# Check if Function object source is array and other is float
2315-
if isinstance(
2316-
other, (float, int, complex, np.ndarray, np.integer, np.floating)
2317-
):
2307+
if isinstance(other, NUMERICAL_TYPES):
23182308
if isinstance(self.source, np.ndarray):
23192309
# Operate on grid values
23202310
ys = other**self.y_array

0 commit comments

Comments
 (0)