diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0526da40..9b54aadb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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: diff --git a/_typos.toml b/_typos.toml new file mode 100644 index 00000000..8ffec212 --- /dev/null +++ b/_typos.toml @@ -0,0 +1,2 @@ +[default.extend-words] +PERIODICY = "PERIODICY" # reads "periodic Y" diff --git a/nonos/_readers/binary.py b/nonos/_readers/binary.py index e2949d2d..9ea3258c 100644 --- a/nonos/_readers/binary.py +++ b/nonos/_readers/binary.py @@ -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: @@ -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 diff --git a/nonos/api/from_simulation.py b/nonos/api/from_simulation.py index 0b930190..70f7e482 100644 --- a/nonos/api/from_simulation.py +++ b/nonos/api/from_simulation.py @@ -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 @@ -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 @@ -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 diff --git a/nonos/parsing.py b/nonos/parsing.py index 4c84ae28..aea44921 100644 --- a/nonos/parsing.py +++ b/nonos/parsing.py @@ -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: @@ -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: @@ -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 diff --git a/nonos/styling.py b/nonos/styling.py index 54058b15..82cd1af8 100644 --- a/nonos/styling.py +++ b/nonos/styling.py @@ -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} diff --git a/tests/test_interfaces/test_contracts.py b/tests/test_interfaces/test_contracts.py index 81e7c5b1..45dc0902 100644 --- a/tests/test_interfaces/test_contracts.py +++ b/tests/test_interfaces/test_contracts.py @@ -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() diff --git a/tests/test_parsing.py b/tests/test_parsing.py index e1a08b5e..591dac8f 100644 --- a/tests/test_parsing.py +++ b/tests/test_parsing.py @@ -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." ): @@ -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) @@ -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) diff --git a/tests/test_readme.py b/tests/test_readme.py index ead11353..078c5f03 100644 --- a/tests/test_readme.py +++ b/tests/test_readme.py @@ -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),