Skip to content

Commit

Permalink
minor: Use native TypeAlias
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiitk committed Oct 8, 2024
1 parent 93e4bec commit dfcaeba
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 20 deletions.
3 changes: 1 addition & 2 deletions framework/helpers/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
import collections
import dataclasses
import functools
from typing import Optional
from typing import Optional, TypeAlias

import grpc
from typing_extensions import TypeAlias
import yaml

from framework.rpc import grpc_testing
Expand Down
4 changes: 2 additions & 2 deletions framework/infrastructure/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import logging
import pathlib
import threading
from typing import Any, Callable, Final, List, Optional, Tuple, Union
from typing import Any, Callable, Final, List, Optional, Tuple, TypeAlias, Union
import warnings

from kubernetes import client
Expand All @@ -30,7 +30,7 @@
import kubernetes.config
from kubernetes.dynamic import exceptions as dynamic_exc
from kubernetes.dynamic import resource as dynamic_res
from typing_extensions import Self, TypeAlias, override
from typing_extensions import Self, override
import urllib3.exceptions
import yaml

Expand Down
3 changes: 1 addition & 2 deletions framework/infrastructure/traffic_director.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
import functools
import logging
import random
from typing import Any, Dict, Final, List, Optional
from typing import Any, Dict, Final, List, Optional, TypeAlias

import googleapiclient.errors
from typing_extensions import TypeAlias

from framework import xds_flags
from framework.infrastructure import gcp
Expand Down
3 changes: 1 addition & 2 deletions framework/rpc/grpc_csds.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
import json
import logging
import re
from typing import Any, Final, Optional, Type, cast
from typing import Any, Final, Optional, Type, TypeAlias, cast

from google.protobuf import json_format
from typing_extensions import TypeAlias

# Needed to load the descriptors so that Any is parsed
# TODO(sergiitk): replace with import xds_protos when it works
Expand Down
3 changes: 1 addition & 2 deletions framework/rpc/grpc_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@
from collections.abc import Sequence
import datetime as dt
import logging
from typing import Any, Final, Optional, cast
from typing import Any, Final, Optional, TypeAlias, cast

from google.protobuf import json_format
import grpc
from grpc_health.v1 import health_pb2
from grpc_health.v1 import health_pb2_grpc
from typing_extensions import TypeAlias

import framework.rpc
from protos.grpc.testing import empty_pb2
Expand Down
4 changes: 1 addition & 3 deletions framework/test_cases/session_affinity_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
"""
import datetime as dt
import logging
from typing import Final, Sequence, Union

from typing_extensions import TypeAlias
from typing import Final, Sequence, TypeAlias, Union

from framework import xds_k8s_testcase
from framework.helpers import retryers
Expand Down
3 changes: 1 addition & 2 deletions tests/app_net_ssa_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import logging
from typing import Final, List, Optional
from typing import Final, List, Optional, TypeAlias

from absl import flags
from absl.testing import absltest
from typing_extensions import TypeAlias

from framework import xds_k8s_testcase
from framework.helpers import skips
Expand Down
2 changes: 1 addition & 1 deletion tests/dualstack_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from absl import flags
from absl.testing import absltest
from typing_extensions import TypeAlias, override
from typing_extensions import override

from framework import xds_k8s_flags
from framework import xds_k8s_testcase
Expand Down
4 changes: 2 additions & 2 deletions tests/gamma/affinity_session_drain_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
# limitations under the License.
import datetime as dt
import logging
from typing import Final, Optional
from typing import Final, Optional, TypeAlias

from absl import flags
from absl.testing import absltest
from typing_extensions import TypeAlias, override
from typing_extensions import override

from framework import xds_gamma_testcase
from framework import xds_k8s_testcase
Expand Down
4 changes: 2 additions & 2 deletions tests/gamma/affinity_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import logging
from typing import List, Optional
from typing import List, Optional, TypeAlias

from absl import flags
from absl.testing import absltest
from typing_extensions import TypeAlias, override
from typing_extensions import override

from framework import xds_gamma_testcase
from framework import xds_k8s_testcase
Expand Down

0 comments on commit dfcaeba

Please sign in to comment.