Skip to content

Commit

Permalink
style: Upgrade deprecated type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
nvictus committed Dec 19, 2024
1 parent c3f22b5 commit 03f781f
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/cooler/_reduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import warnings
from bisect import bisect_right
from collections import OrderedDict, defaultdict
from typing import Any, Iterator, Literal
from collections.abc import Iterator
from typing import Any, Literal

import h5py
import multiprocess as mp
Expand Down
9 changes: 5 additions & 4 deletions src/cooler/_typing.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
from __future__ import annotations

from typing import Callable, Dict, Iterable, Optional, Tuple, TypeVar, Union
from collections.abc import Iterable
from typing import Callable, Optional, TypeVar, Union

import numpy as np
import pandas as pd

T = TypeVar('T')
U = TypeVar('U')
MapFunctor = Callable[[Callable[[T], U], Iterable[T]], Iterable[U]]
GenomicRangeSpecifier = Union[str , Tuple[str, Optional[int], Optional[int]]]
GenomicRangeTuple = Tuple[str, int, int]
Tabular = Union[pd.DataFrame, Dict[str, np.ndarray]]
GenomicRangeSpecifier = Union[str , tuple[str, Optional[int], Optional[int]]]
GenomicRangeTuple = tuple[str, int, int]
Tabular = Union[pd.DataFrame, dict[str, np.ndarray]]

__all__ = ["MapFunctor", "GenomicRangeSpecifier", "GenomicRangeTuple", "Tabular"]
3 changes: 2 additions & 1 deletion src/cooler/core/_rangequery.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

from typing import Any, Callable, Iterator
from collections.abc import Iterator
from typing import Any, Callable

import h5py
import numpy as np
Expand Down
6 changes: 3 additions & 3 deletions src/cooler/core/_selectors.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from __future__ import annotations

from typing import Any, Callable, List, Optional, Tuple, Union, overload
from typing import Any, Callable, Optional, Union, overload

import pandas as pd

ColumnsArg = Optional[Union[str, List[str]]]
GenomicRangeArg = Optional[Union[str, Tuple[str, Optional[int], Optional[int]]]]
ColumnsArg = Optional[Union[str, list[str]]]
GenomicRangeArg = Optional[Union[str, tuple[str, Optional[int], Optional[int]]]]
FieldArg = Optional[str]


Expand Down
3 changes: 2 additions & 1 deletion src/cooler/create/_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
import posixpath
import tempfile
import warnings
from collections.abc import Iterable
from datetime import datetime
from typing import Any, Iterable
from typing import Any

import h5py
import numpy as np
Expand Down
3 changes: 2 additions & 1 deletion src/cooler/create/_ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
import warnings
from bisect import bisect_left
from collections import Counter, OrderedDict
from collections.abc import Iterator
from functools import partial
from typing import Any, Callable, Iterator
from typing import Any, Callable

import h5py
import numpy as np
Expand Down
3 changes: 2 additions & 1 deletion src/cooler/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
"""
from __future__ import annotations

from collections.abc import Iterable, Iterator, Sequence
from functools import partial, reduce
from typing import Any, Callable, Iterable, Iterator, Sequence
from typing import Any, Callable

from multiprocess import Lock

Expand Down
3 changes: 2 additions & 1 deletion src/cooler/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
import os
import re
from collections import OrderedDict, defaultdict
from collections.abc import Generator, Iterable, Iterator
from contextlib import contextmanager
from typing import IO, Any, Generator, Iterable, Iterator
from typing import IO, Any

import h5py
import numpy as np
Expand Down

0 comments on commit 03f781f

Please sign in to comment.