Skip to content

Commit

Permalink
Merge pull request yt-project#4807 from yt-project/pre-commit-ci-upda…
Browse files Browse the repository at this point in the history
…te-config

[pre-commit.ci] pre-commit autoupdate
  • Loading branch information
neutrinoceros authored Feb 5, 2024
2 parents 6119d78 + 60467a3 commit b1bb94a
Show file tree
Hide file tree
Showing 54 changed files with 100 additions and 97 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repos:
- id: check-yaml

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black-jupyter

Expand All @@ -39,7 +39,7 @@ repos:
additional_dependencies: [black==23.9.1]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
rev: v0.2.0
hooks:
- id: ruff
args: [--fix]
Expand Down
1 change: 1 addition & 0 deletions doc/source/cookbook/tests/test_cookbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
$ sed -e '/where/d' -i nose.cfg setup.cfg
$ nosetests doc/source/cookbook/tests/test_cookbook.py -P -v
"""

import subprocess
import sys

Expand Down
8 changes: 5 additions & 3 deletions tests/nose_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ def generate_tasks_input():
exclude_answers = [f"--exclude-test={ex}" for ex in exclude_answers]

args = [
(item + [f"--xunit-file={item[0]}.xml"], exclusive)
if item[0] != "unittests"
else (item + ["--xunit-file=unittests.xml"] + exclude_answers, exclusive)
(
(item + [f"--xunit-file={item[0]}.xml"], exclusive)
if item[0] != "unittests"
else (item + ["--xunit-file=unittests.xml"] + exclude_answers, exclusive)
)
for item, exclusive in args
]
return args
Expand Down
1 change: 0 additions & 1 deletion tests/pytest_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
for executing answer tests and optionally generating new answers.
"""


import glob
import os

Expand Down
1 change: 0 additions & 1 deletion tests/report_failed_answers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"""


import argparse
import base64
import collections
Expand Down
1 change: 1 addition & 0 deletions yt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Contribute: https://github.com/yt-project/yt
"""

from ._version import __version__, version_info # isort: skip
import yt.units as units
import yt.utilities.physical_constants as physical_constants
Expand Down
1 change: 1 addition & 0 deletions yt/data_objects/construction_data_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1653,6 +1653,7 @@ class YTSurface(YTSelectionContainer3D):
... ]
>>> surf.export_ply("my_galaxy.ply", bounds=bounds)
"""

_type_name = "surface"
_con_args = ("data_source", "surface_field", "field_value")
_container_fields = (
Expand Down
6 changes: 3 additions & 3 deletions yt/data_objects/static_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@
# to here, and then have it instantiate EnzoDatasets as appropriate.


_cached_datasets: MutableMapping[
Union[int, str], "Dataset"
] = weakref.WeakValueDictionary()
_cached_datasets: MutableMapping[Union[int, str], "Dataset"] = (
weakref.WeakValueDictionary()
)

# we set this global to None as a place holder
# its actual instantiation is delayed until after yt.__init__
Expand Down
1 change: 1 addition & 0 deletions yt/data_objects/time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ class DatasetSeries:
... SlicePlot(ds, "x", ("gas", "density")).save()
"""

# this annotation should really be Optional[Type[Dataset]]
# but we cannot import the yt.data_objects.static_output.Dataset
# class here without creating a circular import for now
Expand Down
3 changes: 1 addition & 2 deletions yt/data_objects/unions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
class Union(ABC):
@property
@abstractmethod
def _union_type(self) -> str:
...
def _union_type(self) -> str: ...

def __init__(self, name, sub_types):
self.name = name
Expand Down
1 change: 1 addition & 0 deletions yt/exthook.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""

# This source code was originally in flask/exthook.py
import os
import sys
Expand Down
4 changes: 1 addition & 3 deletions yt/fields/magnetic_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,7 @@ def _mach_alfven(field, data):
rm_scale = pc.qp.to("C", "SI") ** 3 / (4.0 * np.pi * pc.eps_0)
else:
rm_scale = pc.qp**3 / pc.clight
rm_scale *= registry.ds.quan(1.0, "rad") / (
2.0 * np.pi * pc.me**2 * pc.clight**3
)
rm_scale *= registry.ds.quan(1.0, "rad") / (2.0 * np.pi * pc.me**2 * pc.clight**3)
rm_units = registry.ds.quan(1.0, "rad/m**2").units / unit_system["length"]

def _rotation_measure(field, data):
Expand Down
1 change: 0 additions & 1 deletion yt/frontends/adaptahop/data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"""


import os
import re
from itertools import product
Expand Down
1 change: 1 addition & 0 deletions yt/frontends/adaptahop/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

from typing import Union

from yt.funcs import mylog
Expand Down
1 change: 1 addition & 0 deletions yt/frontends/adaptahop/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""

from yt._typing import KnownFieldsT
from yt.fields.field_info_container import FieldInfoContainer

Expand Down
1 change: 0 additions & 1 deletion yt/frontends/adaptahop/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"""


from functools import partial
from operator import attrgetter
from typing import Union
Expand Down
1 change: 1 addition & 0 deletions yt/frontends/amrvac/data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

import os
import struct
import warnings
Expand Down
1 change: 0 additions & 1 deletion yt/frontends/amrvac/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""


import functools

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions yt/frontends/amrvac/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

import os

import numpy as np
Expand Down
4 changes: 1 addition & 3 deletions yt/frontends/artio/data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,7 @@ def _parse_parameter_file(self):
]

self.parameters["unit_m"] = self.artio_parameters["mass_unit"][0]
self.parameters["unit_t"] = (
self.artio_parameters["time_unit"][0] * abox**2
)
self.parameters["unit_t"] = self.artio_parameters["time_unit"][0] * abox**2
self.parameters["unit_l"] = self.artio_parameters["length_unit"][0] * abox

if self.artio_parameters["DeltaDC"][0] != 0:
Expand Down
8 changes: 4 additions & 4 deletions yt/frontends/athena/data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,10 +615,10 @@ def _parse_parameter_file(self):
self.omega_matter = 0.0
self.hubble_constant = 0.0
self.cosmological_simulation = 0
self.parameters["Time"] = self.current_time # Hardcode time conversion for now.
self.parameters[
"HydroMethod"
] = 0 # Hardcode for now until field staggering is supported.
# Hardcode time conversion for now.
self.parameters["Time"] = self.current_time
# Hardcode for now until field staggering is supported.
self.parameters["HydroMethod"] = 0
if "gamma" in self.specified_parameters:
self.parameters["Gamma"] = self.specified_parameters["gamma"]
else:
Expand Down
8 changes: 4 additions & 4 deletions yt/frontends/athena_pp/data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,10 @@ def _parse_parameter_file(self):
self.omega_matter = 0.0
self.hubble_constant = 0.0
self.cosmological_simulation = 0
self.parameters["Time"] = self.current_time # Hardcode time conversion for now.
self.parameters[
"HydroMethod"
] = 0 # Hardcode for now until field staggering is supported.
# Hardcode time conversion for now.
self.parameters["Time"] = self.current_time
# Hardcode for now until field staggering is supported.
self.parameters["HydroMethod"] = 0
if "gamma" in self.specified_parameters:
self.parameters["Gamma"] = self.specified_parameters["gamma"]
else:
Expand Down
1 change: 1 addition & 0 deletions yt/frontends/cf_radial/data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

import contextlib
import os
import weakref
Expand Down
1 change: 1 addition & 0 deletions yt/frontends/cf_radial/tests/test_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

import os
import shutil
import tempfile
Expand Down
1 change: 1 addition & 0 deletions yt/frontends/chimera/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

from yt._typing import KnownFieldsT
from yt.fields.field_info_container import FieldInfoContainer

Expand Down
3 changes: 2 additions & 1 deletion yt/frontends/gdf/data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ def _parse_parameter_file(self):
self.omega_matter = 0.0
self.hubble_constant = 0.0
self.cosmological_simulation = 0
self.parameters["Time"] = 1.0 # Hardcode time conversion for now.
# Hardcode time conversion for now.
self.parameters["Time"] = 1.0
# Hardcode for now until field staggering is supported.
self.parameters["HydroMethod"] = 0
self._handle.close()
Expand Down
1 change: 0 additions & 1 deletion yt/frontends/gdf/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
Purpose: Contains fixtures for loading data.
"""


# Test data
sedov = "sedov/sedov_tst_0004.h5"

Expand Down
4 changes: 1 addition & 3 deletions yt/frontends/open_pmd/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ def velocity(field, data):
momentum = data[ptype, f"particle_momentum_{axis}"]
mass = data[ptype, "particle_mass"]
weighting = data[ptype, "particle_weighting"]
return momentum / np.sqrt(
(mass * weighting) ** 2 + (momentum**2) / (c**2)
)
return momentum / np.sqrt((mass * weighting) ** 2 + (momentum**2) / (c**2))

return velocity

Expand Down
2 changes: 0 additions & 2 deletions yt/frontends/owls/owls_ion_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def h5rd(fname, path, dtype=None):


class IonTableSpectrum:

"""A class to handle the HM01 spectra in the OWLS ionization tables."""

def __init__(self, ion_file):
Expand Down Expand Up @@ -60,7 +59,6 @@ def return_table_GH1_at_z(self, z):


class IonTableOWLS:

"""A class to handle OWLS ionization tables."""

DELTA_nH = 0.25
Expand Down
5 changes: 2 additions & 3 deletions yt/frontends/ramses/field_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,8 @@ class FieldFileHandler(abc.ABC, HandlerMixin):
# These properties are static properties
ftype: Optional[str] = None # The name to give to the field type
fname: Optional[str] = None # The name of the file(s)
attrs: Optional[
tuple[tuple[str, int, str], ...]
] = None # The attributes of the header
# The attributes of the header
attrs: Optional[tuple[tuple[str, int, str], ...]] = None
known_fields = None # A list of tuple containing the field name and its type
config_field: Optional[str] = None # Name of the config section (if any)

Expand Down
1 change: 1 addition & 0 deletions yt/frontends/sph/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""

from yt.utilities.io_handler import BaseParticleIOHandler


Expand Down
6 changes: 2 additions & 4 deletions yt/geometry/coordinates/coordinate_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ def pixelize(
periodic=True,
*,
return_mask: Literal[False],
) -> "np.ndarray[Any, np.dtype[np.float64]]":
...
) -> "np.ndarray[Any, np.dtype[np.float64]]": ...

@overload
def pixelize(
Expand All @@ -175,8 +174,7 @@ def pixelize(
return_mask: Literal[True],
) -> tuple[
"np.ndarray[Any, np.dtype[np.float64]]", "np.ndarray[Any, np.dtype[np.bool_]]"
]:
...
]: ...

@abc.abstractmethod
def pixelize(
Expand Down
1 change: 1 addition & 0 deletions yt/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This module gathers all user-facing functions with a `load_` prefix.
"""

import atexit
import os
import sys
Expand Down
1 change: 1 addition & 0 deletions yt/sample_data/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This is a collection of helper functions to yt.load_sample
"""

import json
import re
import sys
Expand Down
Loading

0 comments on commit b1bb94a

Please # to comment.