Skip to content

Commit

Permalink
Merge pull request #2277 from pytroll/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
  • Loading branch information
djhoese committed Nov 18, 2022
2 parents 60be391 + f39eba7 commit 402804f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:
- id: bandit
args: [--ini, .bandit]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.982' # Use the sha / tag you want to point at
rev: 'v0.990' # Use the sha / tag you want to point at
hooks:
- id: mypy
additional_dependencies:
Expand Down
3 changes: 2 additions & 1 deletion satpy/enhancements/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from collections import namedtuple
from functools import wraps
from numbers import Number
from typing import Optional

import dask
import dask.array as da
Expand Down Expand Up @@ -135,7 +136,7 @@ def piecewise_linear_stretch(
img: XRImage,
xp: ArrayLike,
fp: ArrayLike,
reference_scale_factor: Number = None,
reference_scale_factor: Optional[Number] = None,
**kwargs) -> xr.DataArray:
"""Apply 1D linear interpolation.
Expand Down
6 changes: 3 additions & 3 deletions satpy/modifiers/angles.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def __init__(self,
func: Callable,
cache_config_key: str,
uncacheable_arg_types=DEFAULT_UNCACHE_TYPES,
sanitize_args_func: Callable = None,
sanitize_args_func: Optional[Callable] = None,
cache_version: int = 1,
):
"""Hold on to provided arguments for future use."""
Expand All @@ -131,7 +131,7 @@ def cache_clear(self, cache_dir: Optional[str] = None):
for zarr_dir in glob(os.path.join(cache_dir, zarr_pattern)):
shutil.rmtree(zarr_dir, ignore_errors=True)

def _zarr_pattern(self, arg_hash, cache_version: Union[int, str] = None) -> str:
def _zarr_pattern(self, arg_hash, cache_version: Union[None, int, str] = None) -> str:
if cache_version is None:
cache_version = self._cache_version
return f"{self._func.__name__}_v{cache_version}" + "_{}_" + f"{arg_hash}.zarr"
Expand Down Expand Up @@ -222,7 +222,7 @@ def _get_output_chunks_from_func_arguments(args):
def cache_to_zarr_if(
cache_config_key: str,
uncacheable_arg_types=DEFAULT_UNCACHE_TYPES,
sanitize_args_func: Callable = None,
sanitize_args_func: Optional[Callable] = None,
) -> Callable:
"""Decorate a function and cache the results as a zarr array on disk.
Expand Down
2 changes: 1 addition & 1 deletion satpy/tests/modifier_tests/test_angles.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _angle_cache_stacked_area_def():
def _get_angle_test_data(area_def: Optional[Union[AreaDefinition, StackedAreaDefinition]] = None,
chunks: Optional[Union[int, tuple]] = 2,
shape: tuple = (5, 5),
dims: tuple = None,
dims: Optional[tuple] = None,
) -> xr.DataArray:
if area_def is None:
area_def = _angle_cache_area_def()
Expand Down

0 comments on commit 402804f

Please sign in to comment.