Skip to content

Commit

Permalink
Tweaks imports of Callable and Iterable based on Python version
Browse files Browse the repository at this point in the history
  • Loading branch information
ilumsden committed Nov 14, 2024
1 parent fdaf23c commit 3cbb300
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 11 deletions.
7 changes: 6 additions & 1 deletion hatchet/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
#
# SPDX-License-Identifier: MIT

import sys
from collections import defaultdict
from collections.abc import Iterable
from typing import Any, Dict, List, Optional, Set, Tuple, Union

if sys.version_info >= (3, 9):
from collections.abc import Iterable
else:
from typing import Iterable

from .node import Node, traversal_order, node_traversal_order


Expand Down
6 changes: 5 additions & 1 deletion hatchet/graphframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@
import sys
import traceback
from collections import defaultdict
from collections.abc import Callable, Iterable
from typing import Any, Dict, List, Optional, Set, Tuple, Union, cast
from io import TextIOWrapper

if sys.version_info >= (3, 9):
from collections.abc import Callable, Iterable
else:
from typing import Callable, Iterable

import multiprocess as mp
import numpy as np
import pandas as pd
Expand Down
7 changes: 6 additions & 1 deletion hatchet/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
#
# SPDX-License-Identifier: MIT

import sys
from functools import total_ordering
from typing import Any, Dict, List, Optional, Set, Tuple, Union
from collections.abc import Iterable

if sys.version_info >= (3, 9):
from collections.abc import Iterable
else:
from typing import Iterable

from .frame import Frame

Expand Down
7 changes: 6 additions & 1 deletion hatchet/query/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@

import sys
import warnings
from collections.abc import Callable
from typing import List, Optional, Union, cast, TYPE_CHECKING

if sys.version_info >= (3, 9):
from collections.abc import Callable
else:
from typing import Callable


from ..node import Node
from .query import Query
from .compound import (
Expand Down
6 changes: 5 additions & 1 deletion hatchet/query/object_dialect.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
import re
import sys
from typing import Dict, List, Tuple, Union
from collections.abc import Callable, Iterable

if sys.version_info >= (3, 9):
from collections.abc import Callable, Iterable
else:
from typing import Callable, Iterable

from .errors import InvalidQueryPath, InvalidQueryFilter, MultiIndexModeMismatch
from ..node import Node
Expand Down
7 changes: 6 additions & 1 deletion hatchet/query/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
#
# SPDX-License-Identifier: MIT

import sys
from typing import List, Tuple, Union
from collections.abc import Callable, Iterator

if sys.version_info >= (3, 9):
from collections.abc import Callable, Iterator
else:
from typing import Callable, Iterator

from .errors import InvalidQueryPath

Expand Down
6 changes: 5 additions & 1 deletion hatchet/query/string_dialect.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from numbers import Real
import sys
from collections.abc import Callable
from typing import Any, Dict, Optional, List, Union
import pandas as pd # noqa: F401
from pandas.api.types import is_numeric_dtype, is_string_dtype # noqa: F401
Expand All @@ -14,6 +13,11 @@
from textx.exceptions import TextXError
import warnings

if sys.version_info >= (3, 9):
from collections.abc import Callable
else:
from typing import Callable

from .errors import InvalidQueryPath, InvalidQueryFilter, RedundantQueryFilterWarning
from .query import Query

Expand Down
7 changes: 6 additions & 1 deletion hatchet/readers/caliper_native_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
import pandas as pd
import numpy as np
import os
import sys
from typing import Any, Dict, List, Optional, Tuple, Union, cast
from collections.abc import Callable

if sys.version_info > (3, 9):
from collections.abc import Callable
else:
from typing import Callable

import caliperreader as cr

Expand Down
6 changes: 5 additions & 1 deletion hatchet/readers/caliper_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
import os
import math
from typing import Any, Dict, List, Union, cast
from collections.abc import Callable
from io import TextIOWrapper

if sys.version_info >= (3, 9):
from collections.abc import Callable
else:
from typing import Callable

import pandas as pd
import numpy as np

Expand Down
7 changes: 6 additions & 1 deletion hatchet/readers/literal_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
#
# SPDX-License-Identifier: MIT

import sys
from typing import Any, Dict, List, cast
from collections.abc import Iterable

if sys.version_info >= (3, 9):
from collections.abc import Iterable
else:
from typing import Iterable

import pandas as pd

Expand Down
8 changes: 7 additions & 1 deletion hatchet/readers/tau_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
import re
import os
import glob
import sys
from typing import Any, Dict, List, Tuple, Union, cast
from collections.abc import Iterable
import pandas as pd

if sys.version_info >= (3, 9):
from collections.abc import Iterable
else:
from typing import Iterable

import hatchet.graphframe
from hatchet.node import Node
from hatchet.graph import Graph
Expand Down

0 comments on commit 3cbb300

Please sign in to comment.