Skip to content

Commit

Permalink
fix(CatalogVerifier): relax typing < Python 3.9
Browse files Browse the repository at this point in the history
When typing[1] exc_type as Optional[type[BaseException]], there seems to
be no way around "TypeError: 'type' object is not subscriptable" in our
current Python 3.8, even using __future__.annotations.

[1]: https://adamj.eu/tech/2021/07/04/python-type-hints-how-to-type-a-context-manager/
  • Loading branch information
cfm committed Sep 28, 2023
1 parent 38c6902 commit f5b02f7
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions devops/scripts/verify-mo.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
import os
import shlex
import subprocess
from collections.abc import Iterator
from pathlib import Path
from types import TracebackType
from typing import Optional, Set
from typing import Any, Iterator, Optional, Set

import polib
from translate.tools.pocompile import convertmo
Expand Down Expand Up @@ -61,9 +59,9 @@ def __enter__(self) -> "CatalogVerifier":

def __exit__(
self,
exc_type: Optional[type[BaseException]],
exc_value: Optional[BaseException],
traceback: Optional[TracebackType],
exc_type: Optional[Any],
exc_value: Optional[Any],
traceback: Optional[Any],
) -> None:
"""Clean up."""

Expand Down

0 comments on commit f5b02f7

Please sign in to comment.