Skip to content

Commit

Permalink
Only use typing_extensions for Self
Browse files Browse the repository at this point in the history
  • Loading branch information
golmschenk committed Feb 12, 2024
1 parent 20e67d2 commit 5ed3e08
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 59 deletions.
3 changes: 1 addition & 2 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"""Configuration for the pytest tests."""

import pytest
import matplotlib

import pytest

matplotlib.use('Agg') # Use non-interactive backend to prevent loss of focus during test.

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "qusi"
dynamic = ["version"]
description = ""
authors = [
{ name = "golmschenk", email = "[email protected]" },
{ name = "Greg Olmschenk", email = "[email protected]" },
]
readme = "README.md"
requires-python = ">=3.9"
Expand Down
6 changes: 2 additions & 4 deletions src/qusi/finite_standard_light_curve_dataset.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from dataclasses import dataclass
from functools import partial
try:
from typing import List, Callable, Any, Self
except ImportError:
from typing_extensions import List, Callable, Any, Self
from typing import List, Callable, Any
from typing_extensions import Self

import numpy as np
from torch.utils.data import Dataset
Expand Down
6 changes: 2 additions & 4 deletions src/qusi/finite_standard_light_curve_observation_dataset.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from dataclasses import dataclass
from functools import partial
try:
from typing import List, Callable, Any, Self
except ImportError:
from typing_extensions import List, Callable, Any, Self
from typing import List, Callable, Any
from typing_extensions import Self

import numpy as np
from torch.utils.data import Dataset
Expand Down
5 changes: 1 addition & 4 deletions src/qusi/finite_test_session.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
try:
from typing import List
except ImportError:
from typing_extensions import List
from typing import List

import torch
from torch.nn import Module
Expand Down
6 changes: 2 additions & 4 deletions src/qusi/hadryss_model.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from __future__ import annotations

import math
try:
from typing import Self, List
except ImportError:
from typing_extensions import Self, List
from typing import List
from typing_extensions import Self

import torch
from torch import Tensor
Expand Down
5 changes: 1 addition & 4 deletions src/qusi/infer_session.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
try:
from typing import List
except ImportError:
from typing_extensions import List
from typing import List

import numpy as np
import torch
Expand Down
5 changes: 1 addition & 4 deletions src/qusi/light_curve.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from copy import deepcopy
from dataclasses import dataclass
try:
from typing import Self
except ImportError:
from typing_extensions import Self
from typing_extensions import Self

import numpy as np
import numpy.typing as npt
Expand Down
6 changes: 2 additions & 4 deletions src/qusi/light_curve_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
from random import Random
from abc import ABC, abstractmethod
from pathlib import Path
try:
from typing import Iterable, Callable, Self, Iterator, List, Tuple
except ImportError:
from typing_extensions import Iterable, Callable, Self, Iterator, List, Tuple
from typing import Iterable, Callable, Iterator, List, Tuple
from typing_extensions import Self

import numpy as np
import numpy.typing as npt
Expand Down
6 changes: 2 additions & 4 deletions src/qusi/light_curve_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
from enum import Enum
from functools import partial
from pathlib import Path
try:
from typing import List, Iterable, Self, Tuple, TypeVar, Iterator, Callable, Any
except ImportError:
from typing_extensions import List, Iterable, Self, Tuple, TypeVar, Iterator, Callable, Any
from typing import List, Iterable, Tuple, TypeVar, Iterator, Callable, Any
from typing_extensions import Self


import numpy as np
Expand Down
5 changes: 1 addition & 4 deletions src/qusi/light_curve_observation.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from copy import deepcopy
from dataclasses import dataclass
try:
from typing import Self
except ImportError:
from typing_extensions import Self
from typing_extensions import Self

from qusi.light_curve import LightCurve, remove_nan_flux_data_points_from_light_curve, randomly_roll_light_curve

Expand Down
5 changes: 1 addition & 4 deletions src/qusi/light_curve_transforms.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
try:
from typing import Tuple
except ImportError:
from typing_extensions import Tuple
from typing import Tuple

import torch
import numpy.typing as npt
Expand Down
5 changes: 1 addition & 4 deletions src/qusi/toy_light_curve_collection.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from pathlib import Path

try:
from typing import List
except ImportError:
from typing_extensions import List
from typing import List

import numpy as np

Expand Down
5 changes: 1 addition & 4 deletions src/qusi/train_logging_configuration.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
from dataclasses import dataclass
try:
from typing import Any, Dict
except ImportError:
from typing_extensions import Any, Dict
from typing import Any, Dict


@dataclass
Expand Down
5 changes: 1 addition & 4 deletions src/qusi/train_session.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
from pathlib import Path
try:
from typing import List, Optional
except ImportError:
from typing_extensions import List, Optional
from typing import List, Optional

import numpy as np
import stringcase
Expand Down
5 changes: 1 addition & 4 deletions src/qusi/wandb_liaison.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
try:
from typing import Any, Dict
except ImportError:
from typing_extensions import Any, Dict
from typing import Any, Dict

import wandb as wandb

Expand Down

0 comments on commit 5ed3e08

Please sign in to comment.