Skip to content

Commit

Permalink
conditional typing ext
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Jul 2, 2024
1 parent 058668b commit bfa7004
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/python/pyflyby/_importclns.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from __future__ import annotations


import sys

from collections import defaultdict
from functools import total_ordering
Expand All @@ -21,7 +21,10 @@
from typing import (ClassVar, Dict, FrozenSet, List,
Sequence, Union)

from typing_extensions import Self
if sys.version_info < (3, 12):
from typing_extensions import Self
else:
from typing import Self


class NoSuchImportError(ValueError):
Expand Down
7 changes: 6 additions & 1 deletion lib/python/pyflyby/_importdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
from collections import defaultdict
import os
import re
import sys

from typing import Dict, Any, Tuple
from typing_extensions import Self


from pyflyby._file import Filename, expand_py_files_from_args, UnsafeFilenameError
from pyflyby._idents import dotted_prefixes
Expand All @@ -19,6 +20,10 @@
from pyflyby._parse import PythonBlock
from pyflyby._util import cached_attribute, memoize, stable_unique

if sys.version_info = (3,12):
from typing_extensions import Self
else:
from typing import self


@memoize
Expand Down

0 comments on commit bfa7004

Please sign in to comment.