Skip to content
forked from pydata/xarray

Commit

Permalink
Fix typing.
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian committed Oct 29, 2021
1 parent fe870e5 commit 8106a4a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
8 changes: 7 additions & 1 deletion xarray/core/_reductions.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
"""Mixin classes with reduction operations."""
# This file was generated using xarray.util.generate_reductions. Do not edit manually.

from typing import Any, Callable, Hashable, Optional, Protocol, Sequence, Union
import sys
from typing import Any, Callable, Hashable, Optional, Sequence, Union

from . import duck_array_ops
from .types import T_DataArray, T_Dataset

if sys.version_info >= (3, 8):
from typing import Protocol
else:
from typing_extensions import Protocol


class DatasetReduce(Protocol):
def reduce(
Expand Down
14 changes: 9 additions & 5 deletions xarray/util/generate_reductions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@
"""Mixin classes with reduction operations."""
# This file was generated using xarray.util.generate_reductions. Do not edit manually.
from typing import Any, Callable, Hashable, Optional, Protocol, Sequence, Union
import sys
from typing import Any, Callable, Hashable, Optional, Sequence, Union
from . import duck_array_ops
from .types import T_DataArray, T_Dataset'''
from .types import T_DataArray, T_Dataset
if sys.version_info >= (3, 8):
from typing import Protocol
else:
from typing_extensions import Protocol'''

OBJ_PREAMBLE = """
Expand Down Expand Up @@ -187,11 +193,9 @@ def generate_groupby_example(obj: str, cls: str, method: str):
else:
maybe_mincount = ""

return (
f"""{create_da}{maybe_dataset}
return f"""{create_da}{maybe_dataset}
>>> {calculation}(){maybe_skipna}{maybe_mincount}"""
)


def generate_method(
Expand Down

0 comments on commit 8106a4a

Please sign in to comment.