summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-10-11 11:17:56 +0200
committerWojtek Kosior <koszko@koszko.org>2022-10-11 13:12:15 +0200
commit634cef218e9979053da3367c79de6d740633c61a (patch)
tree317ebb413ad98067c142004c0da79f2cbb160457
parent94e140e685baae38e8977fe90a3304bbc041ae66 (diff)
downloadhaketilo-hydrilla-634cef218e9979053da3367c79de6d740633c61a.tar.gz
haketilo-hydrilla-634cef218e9979053da3367c79de6d740633c61a.zip
[builder][server][proxy] remove "from __future__ import annotations"
-rw-r--r--src/hydrilla/builder/build.py3
-rw-r--r--src/hydrilla/builder/common_errors.py3
-rw-r--r--src/hydrilla/builder/local_apt.py3
-rw-r--r--src/hydrilla/builder/piggybacking.py3
-rw-r--r--src/hydrilla/exceptions.py3
-rw-r--r--src/hydrilla/item_infos.py9
-rw-r--r--src/hydrilla/json_instances.py3
-rw-r--r--src/hydrilla/pattern_tree.py3
-rw-r--r--src/hydrilla/proxy/addon.py3
-rw-r--r--src/hydrilla/proxy/csp.py3
-rw-r--r--src/hydrilla/proxy/http_messages.py3
-rw-r--r--src/hydrilla/proxy/policies/base.py3
-rw-r--r--src/hydrilla/proxy/policies/misc.py3
-rw-r--r--src/hydrilla/proxy/policies/payload.py3
-rw-r--r--src/hydrilla/proxy/policies/payload_resource.py3
-rw-r--r--src/hydrilla/proxy/policies/rule.py3
-rw-r--r--src/hydrilla/proxy/policies/web_ui.py3
-rw-r--r--src/hydrilla/proxy/simple_dependency_satisfying.py3
-rw-r--r--src/hydrilla/proxy/state.py7
-rw-r--r--src/hydrilla/proxy/state_impl/_operations/load_packages.py3
-rw-r--r--src/hydrilla/proxy/state_impl/_operations/prune_orphans.py3
-rw-r--r--src/hydrilla/proxy/state_impl/_operations/pull_missing_files.py3
-rw-r--r--src/hydrilla/proxy/state_impl/_operations/recompute_dependencies.py3
-rw-r--r--src/hydrilla/proxy/state_impl/base.py3
-rw-r--r--src/hydrilla/proxy/state_impl/concrete_state.py3
-rw-r--r--src/hydrilla/proxy/state_impl/items.py3
-rw-r--r--src/hydrilla/proxy/state_impl/payloads.py3
-rw-r--r--src/hydrilla/proxy/state_impl/repos.py3
-rw-r--r--src/hydrilla/proxy/state_impl/rules.py3
-rw-r--r--src/hydrilla/proxy/web_ui/items.py3
-rw-r--r--src/hydrilla/proxy/web_ui/items_import.py3
-rw-r--r--src/hydrilla/proxy/web_ui/prompts.py3
-rw-r--r--src/hydrilla/proxy/web_ui/repos.py3
-rw-r--r--src/hydrilla/proxy/web_ui/root.py3
-rw-r--r--src/hydrilla/proxy/web_ui/rules.py3
-rw-r--r--src/hydrilla/server/config.py3
-rw-r--r--src/hydrilla/server/malcontent.py3
-rw-r--r--src/hydrilla/server/serve.py3
-rw-r--r--src/hydrilla/translations.py3
-rw-r--r--src/hydrilla/url_patterns.py3
-rw-r--r--src/hydrilla/versions.py3
-rw-r--r--tests/test_build.py3
42 files changed, 5 insertions, 131 deletions
diff --git a/src/hydrilla/builder/build.py b/src/hydrilla/builder/build.py
index 8a97a20..3ae6ea9 100644
--- a/src/hydrilla/builder/build.py
+++ b/src/hydrilla/builder/build.py
@@ -25,9 +25,6 @@
# code in a proprietary program, I am not going to enforce this in
# court.
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import json
import re
import zipfile
diff --git a/src/hydrilla/builder/common_errors.py b/src/hydrilla/builder/common_errors.py
index 13d32a5..c5d131f 100644
--- a/src/hydrilla/builder/common_errors.py
+++ b/src/hydrilla/builder/common_errors.py
@@ -29,9 +29,6 @@
This module defines error types for use in other parts of Hydrilla builder.
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
from pathlib import Path
from typing import Optional
from subprocess import CompletedProcess as CP
diff --git a/src/hydrilla/builder/local_apt.py b/src/hydrilla/builder/local_apt.py
index 385a533..cc28bcc 100644
--- a/src/hydrilla/builder/local_apt.py
+++ b/src/hydrilla/builder/local_apt.py
@@ -25,9 +25,6 @@
# code in a proprietary program, I am not going to enforce this in
# court.
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import zipfile
import shutil
import re
diff --git a/src/hydrilla/builder/piggybacking.py b/src/hydrilla/builder/piggybacking.py
index c152135..3be674e 100644
--- a/src/hydrilla/builder/piggybacking.py
+++ b/src/hydrilla/builder/piggybacking.py
@@ -30,9 +30,6 @@ This module contains definitions that may be reused by multiple piggybacked
software system backends.
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import typing as t
from pathlib import Path, PurePosixPath
diff --git a/src/hydrilla/exceptions.py b/src/hydrilla/exceptions.py
index 3291bb7..9a0bebf 100644
--- a/src/hydrilla/exceptions.py
+++ b/src/hydrilla/exceptions.py
@@ -29,9 +29,6 @@
This module contains utilities for reading and validation of JSON instances.
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
class HaketiloException(Exception):
"""
Type used for exceptions generated by Haketilo code. Instances of this type
diff --git a/src/hydrilla/item_infos.py b/src/hydrilla/item_infos.py
index d4cafe5..430bcd0 100644
--- a/src/hydrilla/item_infos.py
+++ b/src/hydrilla/item_infos.py
@@ -29,9 +29,6 @@
.....
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import sys
if sys.version_info >= (3, 8):
@@ -248,6 +245,9 @@ class ItemInfoBase(ABC, ItemIdentity, Categorizable):
)
+AnyInfo = t.Union['ResourceInfo', 'MappingInfo']
+
+
class ItemType(enum.Enum):
RESOURCE = 'resource'
MAPPING = 'mapping'
@@ -425,9 +425,6 @@ class MappingInfo(ItemInfoBase, CorrespondsToMappingDCMixin):
)
-AnyInfo = t.Union[ResourceInfo, MappingInfo]
-
-
LoadedType = t.TypeVar('LoadedType', ResourceInfo, MappingInfo)
def _load_item_info(
diff --git a/src/hydrilla/json_instances.py b/src/hydrilla/json_instances.py
index e6cf50f..b56a7e1 100644
--- a/src/hydrilla/json_instances.py
+++ b/src/hydrilla/json_instances.py
@@ -29,9 +29,6 @@
This module contains utilities for reading and validation of JSON instances.
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import re
import json
import os
diff --git a/src/hydrilla/pattern_tree.py b/src/hydrilla/pattern_tree.py
index b678fe1..5671b2b 100644
--- a/src/hydrilla/pattern_tree.py
+++ b/src/hydrilla/pattern_tree.py
@@ -29,9 +29,6 @@
This module defines data structures for querying data using URL patterns.
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import typing as t
import dataclasses as dc
diff --git a/src/hydrilla/proxy/addon.py b/src/hydrilla/proxy/addon.py
index b8ad819..328d4a1 100644
--- a/src/hydrilla/proxy/addon.py
+++ b/src/hydrilla/proxy/addon.py
@@ -30,9 +30,6 @@ This module contains the definition of a mitmproxy addon that gets instantiated
from addon script.
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import sys
import re
import typing as t
diff --git a/src/hydrilla/proxy/csp.py b/src/hydrilla/proxy/csp.py
index d4f2e4e..8eb914f 100644
--- a/src/hydrilla/proxy/csp.py
+++ b/src/hydrilla/proxy/csp.py
@@ -29,9 +29,6 @@
.....
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import re
import typing as t
import dataclasses as dc
diff --git a/src/hydrilla/proxy/http_messages.py b/src/hydrilla/proxy/http_messages.py
index 53d10db..78baf81 100644
--- a/src/hydrilla/proxy/http_messages.py
+++ b/src/hydrilla/proxy/http_messages.py
@@ -29,9 +29,6 @@
.....
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import dataclasses as dc
import typing as t
import sys
diff --git a/src/hydrilla/proxy/policies/base.py b/src/hydrilla/proxy/policies/base.py
index c02ea0b..b3d3172 100644
--- a/src/hydrilla/proxy/policies/base.py
+++ b/src/hydrilla/proxy/policies/base.py
@@ -29,9 +29,6 @@
.....
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import dataclasses as dc
import typing as t
import enum
diff --git a/src/hydrilla/proxy/policies/misc.py b/src/hydrilla/proxy/policies/misc.py
index bc3b08f..6d1e032 100644
--- a/src/hydrilla/proxy/policies/misc.py
+++ b/src/hydrilla/proxy/policies/misc.py
@@ -29,9 +29,6 @@
.....
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import dataclasses as dc
import typing as t
import enum
diff --git a/src/hydrilla/proxy/policies/payload.py b/src/hydrilla/proxy/policies/payload.py
index 7eef184..d3e8e30 100644
--- a/src/hydrilla/proxy/policies/payload.py
+++ b/src/hydrilla/proxy/policies/payload.py
@@ -29,9 +29,6 @@
.....
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import dataclasses as dc
import typing as t
import re
diff --git a/src/hydrilla/proxy/policies/payload_resource.py b/src/hydrilla/proxy/policies/payload_resource.py
index 7fdc7ac..d53f1f7 100644
--- a/src/hydrilla/proxy/policies/payload_resource.py
+++ b/src/hydrilla/proxy/policies/payload_resource.py
@@ -54,9 +54,6 @@ consider accesses to non-enabled mappings' resources a security breach
and block them by responding with 403 Not Found.
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import dataclasses as dc
import typing as t
import json
diff --git a/src/hydrilla/proxy/policies/rule.py b/src/hydrilla/proxy/policies/rule.py
index 833d287..b742a64 100644
--- a/src/hydrilla/proxy/policies/rule.py
+++ b/src/hydrilla/proxy/policies/rule.py
@@ -29,9 +29,6 @@
.....
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import dataclasses as dc
import typing as t
diff --git a/src/hydrilla/proxy/policies/web_ui.py b/src/hydrilla/proxy/policies/web_ui.py
index 9f6c0f5..9d31696 100644
--- a/src/hydrilla/proxy/policies/web_ui.py
+++ b/src/hydrilla/proxy/policies/web_ui.py
@@ -29,9 +29,6 @@
.....
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import dataclasses as dc
import typing as t
diff --git a/src/hydrilla/proxy/simple_dependency_satisfying.py b/src/hydrilla/proxy/simple_dependency_satisfying.py
index d03c86e..ffe4d62 100644
--- a/src/hydrilla/proxy/simple_dependency_satisfying.py
+++ b/src/hydrilla/proxy/simple_dependency_satisfying.py
@@ -33,9 +33,6 @@ The approach taken here is a very simplified one. Hopefully, this will at some
point be replaced by a solution based on some SAT solver.
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import dataclasses as dc
import typing as t
import functools as ft
diff --git a/src/hydrilla/proxy/state.py b/src/hydrilla/proxy/state.py
index 4142f7f..5e09367 100644
--- a/src/hydrilla/proxy/state.py
+++ b/src/hydrilla/proxy/state.py
@@ -31,9 +31,6 @@ This module defines API for keeping track of all settings, rules, mappings and
resources.
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import dataclasses as dc
import typing as t
@@ -79,7 +76,7 @@ class FrozenStatus(Enum):
NOT_FROZEN = 'N'
@staticmethod
- def make(letter: t.Optional[str]) -> t.Optional[FrozenStatus]:
+ def make(letter: t.Optional[str]) -> t.Optional['FrozenStatus']:
if letter is None:
return None
@@ -419,7 +416,7 @@ class ResourceVersionRef(Ref, item_infos.CorrespondsToResourceDCMixin):
...
@abstractmethod
- def get_dependency(self, identifier: str) -> ResourceVersionRef:
+ def get_dependency(self, identifier: str) -> 'ResourceVersionRef':
...
@abstractmethod
diff --git a/src/hydrilla/proxy/state_impl/_operations/load_packages.py b/src/hydrilla/proxy/state_impl/_operations/load_packages.py
index af9557a..288ee5b 100644
--- a/src/hydrilla/proxy/state_impl/_operations/load_packages.py
+++ b/src/hydrilla/proxy/state_impl/_operations/load_packages.py
@@ -29,9 +29,6 @@
....
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import io
import mimetypes
import sqlite3
diff --git a/src/hydrilla/proxy/state_impl/_operations/prune_orphans.py b/src/hydrilla/proxy/state_impl/_operations/prune_orphans.py
index 5eb8cf7..7bb5eb5 100644
--- a/src/hydrilla/proxy/state_impl/_operations/prune_orphans.py
+++ b/src/hydrilla/proxy/state_impl/_operations/prune_orphans.py
@@ -29,9 +29,6 @@
....
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import sqlite3
from pathlib import Path
diff --git a/src/hydrilla/proxy/state_impl/_operations/pull_missing_files.py b/src/hydrilla/proxy/state_impl/_operations/pull_missing_files.py
index 7c20522..b4bc1ac 100644
--- a/src/hydrilla/proxy/state_impl/_operations/pull_missing_files.py
+++ b/src/hydrilla/proxy/state_impl/_operations/pull_missing_files.py
@@ -29,9 +29,6 @@
....
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import sqlite3
import hashlib
diff --git a/src/hydrilla/proxy/state_impl/_operations/recompute_dependencies.py b/src/hydrilla/proxy/state_impl/_operations/recompute_dependencies.py
index 4cc4e7a..399e20e 100644
--- a/src/hydrilla/proxy/state_impl/_operations/recompute_dependencies.py
+++ b/src/hydrilla/proxy/state_impl/_operations/recompute_dependencies.py
@@ -29,9 +29,6 @@
....
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import sqlite3
import typing as t
diff --git a/src/hydrilla/proxy/state_impl/base.py b/src/hydrilla/proxy/state_impl/base.py
index d99feab..357ae88 100644
--- a/src/hydrilla/proxy/state_impl/base.py
+++ b/src/hydrilla/proxy/state_impl/base.py
@@ -31,9 +31,6 @@ This module defines fields that will later be part of a concrete HaketiloState
subtype.
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import sqlite3
import threading
import secrets
diff --git a/src/hydrilla/proxy/state_impl/concrete_state.py b/src/hydrilla/proxy/state_impl/concrete_state.py
index f189aa2..d7998d6 100644
--- a/src/hydrilla/proxy/state_impl/concrete_state.py
+++ b/src/hydrilla/proxy/state_impl/concrete_state.py
@@ -30,9 +30,6 @@ This module contains logic for keeping track of all settings, rules, mappings
and resources.
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import sqlite3
import secrets
import typing as t
diff --git a/src/hydrilla/proxy/state_impl/items.py b/src/hydrilla/proxy/state_impl/items.py
index 6a41300..9fa12ab 100644
--- a/src/hydrilla/proxy/state_impl/items.py
+++ b/src/hydrilla/proxy/state_impl/items.py
@@ -31,9 +31,6 @@ This module provides an interface to interact with mappings, and resources
inside Haketilo.
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import sqlite3
import typing as t
import dataclasses as dc
diff --git a/src/hydrilla/proxy/state_impl/payloads.py b/src/hydrilla/proxy/state_impl/payloads.py
index ebc7152..383217c 100644
--- a/src/hydrilla/proxy/state_impl/payloads.py
+++ b/src/hydrilla/proxy/state_impl/payloads.py
@@ -29,9 +29,6 @@
This module provides an interface to interact with payloads inside Haketilo.
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import sqlite3
import dataclasses as dc
import typing as t
diff --git a/src/hydrilla/proxy/state_impl/repos.py b/src/hydrilla/proxy/state_impl/repos.py
index 85117c8..7e38a90 100644
--- a/src/hydrilla/proxy/state_impl/repos.py
+++ b/src/hydrilla/proxy/state_impl/repos.py
@@ -30,9 +30,6 @@ This module provides an interface to interact with repositories configured
inside Haketilo.
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import re
import json
import tempfile
diff --git a/src/hydrilla/proxy/state_impl/rules.py b/src/hydrilla/proxy/state_impl/rules.py
index 0cdcf2c..2fed2c1 100644
--- a/src/hydrilla/proxy/state_impl/rules.py
+++ b/src/hydrilla/proxy/state_impl/rules.py
@@ -30,9 +30,6 @@ This module provides an interface to interact with script allowing/blocking
rules configured inside Haketilo.
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import sqlite3
import typing as t
import dataclasses as dc
diff --git a/src/hydrilla/proxy/web_ui/items.py b/src/hydrilla/proxy/web_ui/items.py
index 01b201d..808fb6d 100644
--- a/src/hydrilla/proxy/web_ui/items.py
+++ b/src/hydrilla/proxy/web_ui/items.py
@@ -29,9 +29,6 @@
.....
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import typing as t
from urllib.parse import unquote
diff --git a/src/hydrilla/proxy/web_ui/items_import.py b/src/hydrilla/proxy/web_ui/items_import.py
index b335237..a5b5f18 100644
--- a/src/hydrilla/proxy/web_ui/items_import.py
+++ b/src/hydrilla/proxy/web_ui/items_import.py
@@ -29,9 +29,6 @@
.....
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import tempfile
import zipfile
import re
diff --git a/src/hydrilla/proxy/web_ui/prompts.py b/src/hydrilla/proxy/web_ui/prompts.py
index 699409d..b5e052d 100644
--- a/src/hydrilla/proxy/web_ui/prompts.py
+++ b/src/hydrilla/proxy/web_ui/prompts.py
@@ -26,9 +26,6 @@
# code in a proprietary program, I am not going to enforce this in
# court.
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import typing as t
from urllib.parse import urlencode
diff --git a/src/hydrilla/proxy/web_ui/repos.py b/src/hydrilla/proxy/web_ui/repos.py
index f5006c5..bdccd76 100644
--- a/src/hydrilla/proxy/web_ui/repos.py
+++ b/src/hydrilla/proxy/web_ui/repos.py
@@ -29,9 +29,6 @@
.....
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import typing as t
import flask
diff --git a/src/hydrilla/proxy/web_ui/root.py b/src/hydrilla/proxy/web_ui/root.py
index 14b44ff..18ea18e 100644
--- a/src/hydrilla/proxy/web_ui/root.py
+++ b/src/hydrilla/proxy/web_ui/root.py
@@ -29,9 +29,6 @@
.....
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import typing as t
from threading import Lock
diff --git a/src/hydrilla/proxy/web_ui/rules.py b/src/hydrilla/proxy/web_ui/rules.py
index 3ceb294..56753a3 100644
--- a/src/hydrilla/proxy/web_ui/rules.py
+++ b/src/hydrilla/proxy/web_ui/rules.py
@@ -25,9 +25,6 @@
# code in a proprietary program, I am not going to enforce this in
# court.
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import typing as t
import flask
diff --git a/src/hydrilla/server/config.py b/src/hydrilla/server/config.py
index c0b1c5c..42aabab 100644
--- a/src/hydrilla/server/config.py
+++ b/src/hydrilla/server/config.py
@@ -25,9 +25,6 @@
# code in a proprietary program, I am not going to enforce this in
# court.
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import json
import typing as t
diff --git a/src/hydrilla/server/malcontent.py b/src/hydrilla/server/malcontent.py
index 8e4eaa7..9bdf6dc 100644
--- a/src/hydrilla/server/malcontent.py
+++ b/src/hydrilla/server/malcontent.py
@@ -25,9 +25,6 @@
# code in a proprietary program, I am not going to enforce this in
# court.
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import logging
import dataclasses as dc
import typing as t
diff --git a/src/hydrilla/server/serve.py b/src/hydrilla/server/serve.py
index 00682aa..68dde7a 100644
--- a/src/hydrilla/server/serve.py
+++ b/src/hydrilla/server/serve.py
@@ -25,9 +25,6 @@
# code in a proprietary program, I am not going to enforce this in
# court.
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import re
import os
import json
diff --git a/src/hydrilla/translations.py b/src/hydrilla/translations.py
index ce6e779..62c8c88 100644
--- a/src/hydrilla/translations.py
+++ b/src/hydrilla/translations.py
@@ -25,9 +25,6 @@
# code in a proprietary program, I am not going to enforce this in
# court.
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import locale as lcl
import gettext
import typing as t
diff --git a/src/hydrilla/url_patterns.py b/src/hydrilla/url_patterns.py
index 81f65f2..115a040 100644
--- a/src/hydrilla/url_patterns.py
+++ b/src/hydrilla/url_patterns.py
@@ -32,9 +32,6 @@ Haketilo URL patterns.
Data structures for querying data using URL patterns are also defined there.
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import re
import urllib.parse as up
import typing as t
diff --git a/src/hydrilla/versions.py b/src/hydrilla/versions.py
index c217d4f..2071864 100644
--- a/src/hydrilla/versions.py
+++ b/src/hydrilla/versions.py
@@ -30,9 +30,6 @@ This module contains functions for deconstruction and construction of version
strings and version tuples.
"""
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import typing as t
from itertools import takewhile
diff --git a/tests/test_build.py b/tests/test_build.py
index a4dd684..28d3e80 100644
--- a/tests/test_build.py
+++ b/tests/test_build.py
@@ -4,9 +4,6 @@
#
# Available under the terms of Creative Commons Zero v1.0 Universal.
-# Enable using with Python 3.7.
-from __future__ import annotations
-
import pytest
import json
import shutil