Skip to content

Commit

Permalink
Remove uses of: from __future__ import annotations
Browse files Browse the repository at this point in the history
Resolves #183
  • Loading branch information
davidfstr committed Feb 28, 2024
1 parent 222dcce commit 9122083
Show file tree
Hide file tree
Showing 19 changed files with 2 additions and 42 deletions.
2 changes: 0 additions & 2 deletions src/crystal/browser/entitytree.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from crystal.browser.icons import (
BADGED_ART_PROVIDER_TREE_NODE_ICON, BADGED_TREE_NODE_ICON, TREE_NODE_ICONS,
)
Expand Down
2 changes: 0 additions & 2 deletions src/crystal/doc/generic.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from typing import Optional


Expand Down
2 changes: 0 additions & 2 deletions src/crystal/doc/html/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
Parses HTML documents.
"""

from __future__ import annotations

from crystal.doc.generic import Document, Link
from typing import BinaryIO, Literal, Optional, Tuple, Union

Expand Down
2 changes: 0 additions & 2 deletions src/crystal/doc/html/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
HTML parser implementation that uses regular expressions.
"""

from __future__ import annotations

from crystal.doc.generic import Document, Link
import re
from typing import Optional
Expand Down
7 changes: 2 additions & 5 deletions src/crystal/doc/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
Parses JSON documents.
"""

from __future__ import absolute_import
from __future__ import annotations

from crystal.doc.generic import Document, Link
from crystal.doc.html.soup import ABSOLUTE_HTTP_LINK_RE, PROBABLE_EMBEDDED_URL_RE
import json
from typing import BinaryIO, Optional
from typing import BinaryIO, Optional, Union


def parse_json_and_links(
Expand Down Expand Up @@ -94,7 +91,7 @@ def _set_relative_url(self, url: str) -> None:


class _DictValueLink(_JsonLink):
def __init__(self, json_obj: dict, key_ref: _DictKeyLink | str) -> None:
def __init__(self, json_obj: dict, key_ref: Union[_DictKeyLink, str]) -> None:
self._json_obj = json_obj
self._key_ref = key_ref
super().__init__('Dict Value Reference')
Expand Down
3 changes: 0 additions & 3 deletions src/crystal/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
Home of the main function, which starts the program.
"""

# TODO: Eliminate use of deprecated "annotation" future
from __future__ import annotations

# NOTE: Avoid importing anything outside the Python standard library
# at the top-level of this module, including from the "crystal" package,
# in case the import itself fails.
Expand Down
2 changes: 0 additions & 2 deletions src/crystal/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
Callers that attempt to do otherwise may get thrown `ProgrammingError`s.
"""

from __future__ import annotations

from collections import OrderedDict
import copy
from crystal.doc.css import parse_css_and_links
Expand Down
2 changes: 0 additions & 2 deletions src/crystal/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
Runs on its own daemon thread.
"""

from __future__ import annotations

from crystal.doc.generic import Document, Link
from crystal.doc.html.soup import HtmlDocument
from crystal.model import Project, Resource, ResourceGroup, ResourceRevision, RootResource
Expand Down
2 changes: 0 additions & 2 deletions src/crystal/shell.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

import code
from crystal import __version__ as crystal_version
from crystal.browser import MainWindow
Expand Down
2 changes: 0 additions & 2 deletions src/crystal/task.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from contextlib import AbstractContextManager, contextmanager, nullcontext
import cProfile
from crystal.util.bulkheads import (
Expand Down
2 changes: 0 additions & 2 deletions src/crystal/tests/test_workflows.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from crystal.model import Project, Resource
from crystal.server import _DEFAULT_SERVER_PORT, get_request_url
from crystal.tests.util.console import console_output_copied
Expand Down
2 changes: 0 additions & 2 deletions src/crystal/tests/util/controls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from contextlib import asynccontextmanager, contextmanager
from crystal.tests.util.runner import pump_wx_events
from crystal.util.wx_treeitem_gettooltip import GetTooltipEvent
Expand Down
2 changes: 0 additions & 2 deletions src/crystal/tests/util/runner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

import asyncio
from crystal.util.xthreading import bg_affinity, fg_affinity, fg_call_and_wait
import sys
Expand Down
2 changes: 0 additions & 2 deletions src/crystal/tests/util/server.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from contextlib import contextmanager
from copy import deepcopy
from crystal.model import Project
Expand Down
2 changes: 0 additions & 2 deletions src/crystal/tests/util/tasks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from contextlib import contextmanager
from crystal.browser.tasktree import TaskTreeNode
from crystal.model import Project
Expand Down
2 changes: 0 additions & 2 deletions src/crystal/tests/util/wait.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from crystal.tests.util.screenshots import take_error_screenshot
from crystal.tests.util.runner import bg_sleep
import datetime
Expand Down
2 changes: 0 additions & 2 deletions src/crystal/tests/util/windows.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from contextlib import asynccontextmanager

from crystal.browser.new_root_url import NewRootUrlDialog as RealNewRootUrlDialog
Expand Down
2 changes: 0 additions & 2 deletions src/crystal/ui/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
* access to the underlying "peer" objects (i.e. wx.TreeCtrl, tree item index)
"""

from __future__ import annotations

from crystal.progress import OpenProjectProgressListener
from crystal.util.bulkheads import run_bulkhead_call
from crystal.util.wx_bind import bind
Expand Down
2 changes: 0 additions & 2 deletions src/crystal/util/db.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

import sqlite3
from typing import Callable
from typing_extensions import Self
Expand Down

0 comments on commit 9122083

Please sign in to comment.