Browse Source

Revert "ref: enable pyupgrade --py311-plus (#64363)"

This reverts commit 28f5037299c366879d6f1d0572e907919383d27f.

Co-authored-by: asottile-sentry <103459774+asottile-sentry@users.noreply.github.com>
getsentry-bot 1 year ago
parent
commit
6fc6ffc848

+ 1 - 1
.pre-commit-config.yaml

@@ -22,7 +22,7 @@ repos:
       - id: pyupgrade
         name: pyupgrade
         entry: pyupgrade
-        args: ['--py311-plus']
+        args: ['--py38-plus', '--keep-runtime-typing']
         language: system
         types: [python]
       # Configuration for black exists in pyproject.toml,

+ 1 - 1
bin/model-dependency-graphviz

@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 from __future__ import annotations
 
-from collections.abc import Iterable
+from typing import Iterable
 
 from sentry.backup.scopes import RelocationScope
 from sentry.runner import configure

+ 4 - 1
bin/split-silo-database

@@ -1,4 +1,7 @@
 #!/usr/bin/env python
+
+from typing import List
+
 import click
 import docker
 from django.apps import apps
@@ -22,7 +25,7 @@ def exec_run(container, command):
     return output
 
 
-def split_database(tables: list[str], source: str, destination: str, reset: bool, verbose: bool):
+def split_database(tables: List[str], source: str, destination: str, reset: bool, verbose: bool):
     click.echo(f">> Dumping tables from {source} database")
     command = ["pg_dump", "-U", "postgres", "-d", source, "--clean"]
     for table in tables:

+ 1 - 2
fixtures/sdk_crash_detection/crash_event_cocoa.py

@@ -1,5 +1,4 @@
-from collections.abc import Collection, Mapping, MutableMapping, Sequence
-from typing import Any
+from typing import Any, Collection, Mapping, MutableMapping, Sequence
 
 IN_APP_FRAME = {
     "function": "LoginViewController.viewDidAppear",

+ 1 - 1
fixtures/sdk_crash_detection/crash_event_react_native.py

@@ -1,4 +1,4 @@
-from collections.abc import Mapping, MutableMapping, Sequence
+from typing import Mapping, MutableMapping, Sequence
 
 
 def get_frames(filename: str) -> Sequence[MutableMapping[str, str]]:

+ 1 - 2
scripts/silo/rpcsetup.py

@@ -2,9 +2,8 @@
 
 import json  # noqa
 import re
-from collections.abc import Mapping
 from dataclasses import dataclass
-from typing import Any
+from typing import Any, Mapping
 
 import click
 

+ 1 - 1
scripts/start-colima.py

@@ -4,7 +4,7 @@ import os
 import platform
 import subprocess
 import sys
-from collections.abc import Sequence
+from typing import Sequence
 
 
 def main(argv: Sequence[str] | None = None) -> int:

+ 2 - 3
src/bitfield/models.py

@@ -1,5 +1,4 @@
-from collections.abc import Mapping, Sequence
-from typing import Any, TypeVar, cast
+from typing import Any, Mapping, Optional, Sequence, TypeVar, cast
 
 from django.db.models.fields import BigIntegerField
 
@@ -193,7 +192,7 @@ class TypedClassBitField(metaclass=TypedBitfieldMeta):
     attributes in a type-safe way.
     """
 
-    bitfield_default: Any | None
+    bitfield_default: Optional[Any]
     bitfield_null: bool
 
     _value: int

+ 2 - 2
src/sentry/analytics/event.py

@@ -2,8 +2,8 @@ from __future__ import annotations
 
 import datetime as dt
 from base64 import b64encode
-from collections.abc import Mapping, Sequence
-from typing import Any
+from collections.abc import Mapping
+from typing import Any, Sequence
 from uuid import uuid1
 
 from django.utils import timezone

+ 1 - 2
src/sentry/analytics/event_manager.py

@@ -1,7 +1,6 @@
 __all__ = ("default_manager", "EventManager")
 
-from collections.abc import MutableMapping
-from typing import Any
+from typing import Any, MutableMapping
 
 from sentry.analytics.event import Event
 

Some files were not shown because too many files changed in this diff