1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-17 17:42:20 +03:00

[2051] Remove More Old Types

This commit is contained in:
David Sangrey 2023-11-30 21:45:04 -05:00
parent cb2a18025c
commit 170b86b5dc
No known key found for this signature in database
GPG Key ID: 3AEADBB0186884BC
6 changed files with 18 additions and 20 deletions

View File

@ -9,7 +9,6 @@ import os
import shutil import shutil
import sys import sys
import pathlib import pathlib
from typing import List, Tuple
from string import Template from string import Template
from os.path import join, isdir from os.path import join, isdir
import py2exe import py2exe
@ -57,8 +56,8 @@ def system_check(dist_dir: str) -> str:
def generate_data_files( def generate_data_files(
app_name: str, gitversion_file: str, plugins: List[str] app_name: str, gitversion_file: str, plugins: list[str]
) -> List[Tuple[str, List[str]]]: ) -> list[tuple[str, list[str]]]:
"""Create the required datafiles to build.""" """Create the required datafiles to build."""
l10n_dir = "L10n" l10n_dir = "L10n"
fdevids_dir = "FDevIDs" fdevids_dir = "FDevIDs"
@ -106,7 +105,7 @@ def build() -> None:
gitversion_filename: str = system_check(dist_dir) gitversion_filename: str = system_check(dist_dir)
# Constants # Constants
plugins: List[str] = [ plugins: list[str] = [
"plugins/coriolis.py", "plugins/coriolis.py",
"plugins/eddn.py", "plugins/eddn.py",
"plugins/edsm.py", "plugins/edsm.py",
@ -141,7 +140,7 @@ def build() -> None:
} }
# Function to generate DATA_FILES list # Function to generate DATA_FILES list
data_files: List[Tuple[str, List[str]]] = generate_data_files( data_files: list[tuple[str, list[str]]] = generate_data_files(
appname, gitversion_filename, plugins appname, gitversion_filename, plugins
) )

View File

@ -3,11 +3,10 @@ Example EDMC plugin.
It adds a single button to the EDMC interface that displays the number of times it has been clicked. It adds a single button to the EDMC interface that displays the number of times it has been clicked.
""" """
from __future__ import annotations
import logging import logging
import tkinter as tk import tkinter as tk
from typing import Optional
import myNotebook as nb # noqa: N813 import myNotebook as nb # noqa: N813
from config import appname, config from config import appname, config
@ -48,7 +47,7 @@ class ClickCounter:
""" """
self.on_preferences_closed("", False) # Save our prefs self.on_preferences_closed("", False) # Save our prefs
def setup_preferences(self, parent: nb.Notebook, cmdr: str, is_beta: bool) -> Optional[tk.Frame]: def setup_preferences(self, parent: nb.Notebook, cmdr: str, is_beta: bool) -> tk.Frame | None:
""" """
setup_preferences is called by plugin_prefs below. setup_preferences is called by plugin_prefs below.
@ -127,7 +126,7 @@ def plugin_stop() -> None:
return cc.on_unload() return cc.on_unload()
def plugin_prefs(parent: nb.Notebook, cmdr: str, is_beta: bool) -> Optional[tk.Frame]: def plugin_prefs(parent: nb.Notebook, cmdr: str, is_beta: bool) -> tk.Frame | None:
""" """
Handle preferences tab for the plugin. Handle preferences tab for the plugin.
@ -145,7 +144,7 @@ def prefs_changed(cmdr: str, is_beta: bool) -> None:
return cc.on_preferences_closed(cmdr, is_beta) return cc.on_preferences_closed(cmdr, is_beta)
def plugin_app(parent: tk.Frame) -> Optional[tk.Frame]: def plugin_app(parent: tk.Frame) -> tk.Frame | None:
""" """
Set up the UI of the plugin. Set up the UI of the plugin.

View File

@ -1,10 +1,11 @@
"""Handle keyboard input for manual update triggering.""" """Handle keyboard input for manual update triggering."""
from __future__ import annotations
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import abc import abc
import sys import sys
from abc import abstractmethod from abc import abstractmethod
from typing import Optional, Tuple, Union
class AbstractHotkeyMgr(abc.ABC): class AbstractHotkeyMgr(abc.ABC):
@ -31,7 +32,7 @@ class AbstractHotkeyMgr(abc.ABC):
pass pass
@abstractmethod @abstractmethod
def fromevent(self, event) -> Optional[Union[bool, Tuple]]: def fromevent(self, event) -> bool | tuple | None:
""" """
Return configuration (keycode, modifiers) or None=clear or False=retain previous. Return configuration (keycode, modifiers) or None=clear or False=retain previous.

View File

@ -10,7 +10,6 @@ from __future__ import annotations
import json import json
from collections import OrderedDict from collections import OrderedDict
from typing import OrderedDict as OrderedDictT from typing import OrderedDict as OrderedDictT
from config import config from config import config
from edmc_data import ( from edmc_data import (
outfitting_armour_map as armour_map, outfitting_armour_map as armour_map,

View File

@ -41,7 +41,6 @@ from typing import (
MutableMapping, MutableMapping,
) )
from typing import OrderedDict as OrderedDictT from typing import OrderedDict as OrderedDictT
from typing import Tuple, Union
import requests import requests
import companion import companion
import edmc_data import edmc_data
@ -100,8 +99,8 @@ class This:
# Avoid duplicates # Avoid duplicates
self.marketId: str | None = None self.marketId: str | None = None
self.commodities: list[OrderedDictT[str, Any]] | None = None self.commodities: list[OrderedDictT[str, Any]] | None = None
self.outfitting: Tuple[bool, list[str]] | None = None self.outfitting: tuple[bool, list[str]] | None = None
self.shipyard: Tuple[bool, list[Mapping[str, Any]]] | None = None self.shipyard: tuple[bool, list[Mapping[str, Any]]] | None = None
self.fcmaterials_marketid: int = 0 self.fcmaterials_marketid: int = 0
self.fcmaterials: list[OrderedDictT[str, Any]] | None = None self.fcmaterials: list[OrderedDictT[str, Any]] | None = None
self.fcmaterials_capi_marketid: int = 0 self.fcmaterials_capi_marketid: int = 0
@ -714,7 +713,7 @@ class EDDN:
# Send any FCMaterials.json-equivalent 'orders' as well # Send any FCMaterials.json-equivalent 'orders' as well
self.export_capi_fcmaterials(data, is_beta, horizons) self.export_capi_fcmaterials(data, is_beta, horizons)
def safe_modules_and_ships(self, data: Mapping[str, Any]) -> Tuple[dict, dict]: def safe_modules_and_ships(self, data: Mapping[str, Any]) -> tuple[dict, dict]:
""" """
Produce a sanity-checked version of ships and modules from CAPI data. Produce a sanity-checked version of ships and modules from CAPI data.
@ -1091,7 +1090,7 @@ class EDDN:
entry: MutableMapping[str, Any], entry: MutableMapping[str, Any],
system_name: str, system_name: str,
system_coordinates: list system_coordinates: list
) -> Union[str, MutableMapping[str, Any]]: ) -> str | MutableMapping[str, Any]:
""" """
Augment a journal entry with necessary system data. Augment a journal entry with necessary system data.

View File

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""EDMC preferences library.""" """EDMC preferences library."""
from __future__ import annotations
import contextlib import contextlib
import logging import logging
@ -13,7 +14,7 @@ from os.path import expanduser, expandvars, join, normpath
from tkinter import colorchooser as tkColorChooser # type: ignore # noqa: N812 from tkinter import colorchooser as tkColorChooser # type: ignore # noqa: N812
from tkinter import ttk from tkinter import ttk
from types import TracebackType from types import TracebackType
from typing import TYPE_CHECKING, Any, Callable, Optional, Type, Union from typing import TYPE_CHECKING, Any, Callable, Optional, Type
import myNotebook as nb # noqa: N813 import myNotebook as nb # noqa: N813
import plug import plug
@ -276,7 +277,7 @@ class PreferencesDialog(tk.Toplevel):
self.resizable(tk.FALSE, tk.FALSE) self.resizable(tk.FALSE, tk.FALSE)
self.cmdr: Union[str, bool, None] = False # Note if Cmdr changes in the Journal self.cmdr: str | bool | None = False # Note if Cmdr changes in the Journal
self.is_beta: bool = False # Note if Beta status changes in the Journal self.is_beta: bool = False # Note if Beta status changes in the Journal
self.cmdrchanged_alarm: Optional[str] = None # This stores an ID that can be used to cancel a scheduled call self.cmdrchanged_alarm: Optional[str] = None # This stores an ID that can be used to cancel a scheduled call