Skip to content

Commit

Permalink
Merge pull request #362 from neutrinoceros/fix_typos
Browse files Browse the repository at this point in the history
MNT: auto fix typos
  • Loading branch information
neutrinoceros authored Nov 2, 2024
2 parents c22316c + 0161f4d commit 42d1fca
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ repos:
- id: end-of-file-fixer
- id: check-toml

- repo: https://github.com/crate-ci/typos
rev: v1.26.0
hooks:
- id: typos

- repo: https://github.com/neutrinoceros/inifix.git
rev: v4.5.0
hooks:
Expand Down
2 changes: 2 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[default.extend-words]
PERIODICY = "PERIODICY" # reads "periodic Y"
6 changes: 3 additions & 3 deletions nonos/_readers/binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,11 +557,11 @@ def read(
if geometry_str == "cylindrical":
V["geometry"] = Geometry.POLAR
V["x2"] = domain_x # Y-Edge
V["x3"] = domain_z # Z-Edge #latitute
V["x3"] = domain_z # Z-Edge #latitude
pairs = [("RHO", "dens"), ("VX1", "vy"), ("VX2", "vx"), ("VX3", "vz")]
elif geometry_str == "spherical":
V["geometry"] = Geometry.SPHERICAL
V["x2"] = domain_z # Z-Edge #latitute
V["x2"] = domain_z # Z-Edge #latitude
V["x3"] = domain_x # Y-Edge
pairs = [("RHO", "dens"), ("VX1", "vy"), ("VX2", "vz"), ("VX3", "vx")]
else:
Expand Down Expand Up @@ -622,7 +622,7 @@ def read(

V["x1"] = domain_y # X-Edge
V["x2"] = domain_x # Y-Edge
V["x3"] = domain_z # Z-Edge #latitute
V["x3"] = domain_z # Z-Edge #latitude

n1 = len(V["x1"]) - 1
n2 = len(V["x2"]) - 1
Expand Down
6 changes: 3 additions & 3 deletions nonos/api/from_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ def fargoAdsgReadDat(self, on, *, directory="") -> DataStructure:

V.x1 = domain_y # X-Edge
V.x2 = domain_x # Y-Edge
V.x3 = domain_z # Z-Edge #latitute
V.x3 = domain_z # Z-Edge #latitude

V.n1 = len(V.x1) - 1 # if len(V.x1)>2 else 2
V.n2 = len(V.x2) - 1 # if len(V.x2)>2 else 2
Expand Down Expand Up @@ -907,7 +907,7 @@ def __init__(self, *, COORDINATES, **_kwargs) -> None:
V.geometry = "polar"
V.x1 = domain_y # X-Edge
V.x2 = domain_x # Y-Edge
V.x3 = domain_z # Z-Edge #latitute
V.x3 = domain_z # Z-Edge #latitude

V.n1 = len(V.x1) - 1 # if len(V.x1)>2 else 2
V.n2 = len(V.x2) - 1 # if len(V.x2)>2 else 2
Expand Down Expand Up @@ -940,7 +940,7 @@ def __init__(self, *, COORDINATES, **_kwargs) -> None:
V.data[key] = np.roll(V.data[key], V.n2 // 2, axis=1)
elif V.geometry == "spherical":
V.x1 = domain_y # X-Edge
V.x2 = domain_z # Z-Edge #latitute
V.x2 = domain_z # Z-Edge #latitude
V.x3 = domain_x # Y-Edge

V.n1 = len(V.x1) - 1 # if len(V.x1)>2 else 2
Expand Down
6 changes: 3 additions & 3 deletions nonos/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def userval_or_default(userval: T1, /, *, default: T2) -> Union[T1, T2]:
# it'd be nice to avoid a Union as a return type, however it's not clear
# how to express what this function does in typing language.
# In practice this is used in places where it's very hard to constrain T1, so
# the infered return type always degrades down to Any anyway.
# the inferred return type always degrades down to Any anyway.
if is_set(userval):
return userval
else:
Expand Down Expand Up @@ -97,7 +97,7 @@ def range_converter(extent, abscissa, ordinate):
_ if (_ := extent[1]) is not None else abscissa.max(),
)
else:
raise TypeError(f"Expected extent to be of lenght 2 or 4, got {len(extent)=}")
raise TypeError(f"Expected extent to be of length 2 or 4, got {len(extent)=}")


def parse_image_format(s: Optional[str]) -> str:
Expand All @@ -113,6 +113,6 @@ def parse_image_format(s: Optional[str]) -> str:
):
raise ValueError(
f"Received unknown file format '{s}'. "
f"Available formated are {available}."
f"Available formatted are {available}."
)
return ext
2 changes: 1 addition & 1 deletion nonos/styling.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def scale_mpl(scaling: float) -> None:
context_dict = {k: v * scaling for k, v in base_context.items()}

# the reason why the scaling are separated comes
# from seaborn where the font sizes are controled
# from seaborn where the font sizes are controlled
# by an independent factor, so I'm keeping the structure
# in case we want to do that as well later
font_dict = {k: context_dict[k] * scaling for k in texts_base_context}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_interfaces/test_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def test_use_reader_mixin(reader_class):
assert issubclass(reader_class, ReaderMixin)


def test_cannot_instanciate(reader_class):
def test_cannot_instantiate(reader_class):
cls = reader_class
with pytest.raises(TypeError, match=rf"^{cls} is not instantiable$"):
cls()
Expand Down
6 changes: 3 additions & 3 deletions tests/test_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_from_maxval():
assert parse_output_number_range(None, maxval=maxval) == [maxval]


def test_unparseable_data():
def test_unparsable_data():
with pytest.raises(
ValueError, match="Can't parse a range from unset values without a max."
):
Expand Down Expand Up @@ -143,7 +143,7 @@ def test_parse_range(abscissa, ordinate, dim, expected):
def test_range_converter_error():
with pytest.raises(
TypeError,
match="Expected extent to be of lenght 2 or 4,",
match="Expected extent to be of length 2 or 4,",
):
range_converter(extent=[], abscissa=None, ordinate=None)

Expand Down Expand Up @@ -172,7 +172,7 @@ def test_invalid_image_format():
fake_ext = ".pnd"
with pytest.raises(
ValueError,
match=f"^(Received unknown file format '{fake_ext}'. Available formated are)",
match=f"^(Received unknown file format '{fake_ext}'. Available formatted are)",
):
parse_image_format(fake_ext)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
)
@pytest.mark.skipif(
sys.platform.startswith("win"),
reason="Windows runner may choke on some special chararcters",
reason="Windows runner may choke on some special characters",
)
@pytest.mark.skipif(
sys.version_info < (3, 10),
Expand Down

0 comments on commit 42d1fca

Please sign in to comment.