mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-12 23:37:14 +03:00
[2051] Remove More Old Types
This commit is contained in:
parent
cb2a18025c
commit
170b86b5dc
9
build.py
9
build.py
@ -9,7 +9,6 @@ import os
|
||||
import shutil
|
||||
import sys
|
||||
import pathlib
|
||||
from typing import List, Tuple
|
||||
from string import Template
|
||||
from os.path import join, isdir
|
||||
import py2exe
|
||||
@ -57,8 +56,8 @@ def system_check(dist_dir: str) -> str:
|
||||
|
||||
|
||||
def generate_data_files(
|
||||
app_name: str, gitversion_file: str, plugins: List[str]
|
||||
) -> List[Tuple[str, List[str]]]:
|
||||
app_name: str, gitversion_file: str, plugins: list[str]
|
||||
) -> list[tuple[str, list[str]]]:
|
||||
"""Create the required datafiles to build."""
|
||||
l10n_dir = "L10n"
|
||||
fdevids_dir = "FDevIDs"
|
||||
@ -106,7 +105,7 @@ def build() -> None:
|
||||
gitversion_filename: str = system_check(dist_dir)
|
||||
|
||||
# Constants
|
||||
plugins: List[str] = [
|
||||
plugins: list[str] = [
|
||||
"plugins/coriolis.py",
|
||||
"plugins/eddn.py",
|
||||
"plugins/edsm.py",
|
||||
@ -141,7 +140,7 @@ def build() -> None:
|
||||
}
|
||||
|
||||
# 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
|
||||
)
|
||||
|
||||
|
@ -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.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import tkinter as tk
|
||||
from typing import Optional
|
||||
|
||||
import myNotebook as nb # noqa: N813
|
||||
from config import appname, config
|
||||
|
||||
@ -48,7 +47,7 @@ class ClickCounter:
|
||||
"""
|
||||
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.
|
||||
|
||||
@ -127,7 +126,7 @@ def plugin_stop() -> None:
|
||||
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.
|
||||
|
||||
@ -145,7 +144,7 @@ def prefs_changed(cmdr: str, is_beta: bool) -> None:
|
||||
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.
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
"""Handle keyboard input for manual update triggering."""
|
||||
from __future__ import annotations
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import abc
|
||||
import sys
|
||||
from abc import abstractmethod
|
||||
from typing import Optional, Tuple, Union
|
||||
|
||||
|
||||
class AbstractHotkeyMgr(abc.ABC):
|
||||
@ -31,7 +32,7 @@ class AbstractHotkeyMgr(abc.ABC):
|
||||
pass
|
||||
|
||||
@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.
|
||||
|
||||
|
@ -10,7 +10,6 @@ from __future__ import annotations
|
||||
import json
|
||||
from collections import OrderedDict
|
||||
from typing import OrderedDict as OrderedDictT
|
||||
|
||||
from config import config
|
||||
from edmc_data import (
|
||||
outfitting_armour_map as armour_map,
|
||||
|
@ -41,7 +41,6 @@ from typing import (
|
||||
MutableMapping,
|
||||
)
|
||||
from typing import OrderedDict as OrderedDictT
|
||||
from typing import Tuple, Union
|
||||
import requests
|
||||
import companion
|
||||
import edmc_data
|
||||
@ -100,8 +99,8 @@ class This:
|
||||
# Avoid duplicates
|
||||
self.marketId: str | None = None
|
||||
self.commodities: list[OrderedDictT[str, Any]] | None = None
|
||||
self.outfitting: Tuple[bool, list[str]] | None = None
|
||||
self.shipyard: Tuple[bool, list[Mapping[str, Any]]] | None = None
|
||||
self.outfitting: tuple[bool, list[str]] | None = None
|
||||
self.shipyard: tuple[bool, list[Mapping[str, Any]]] | None = None
|
||||
self.fcmaterials_marketid: int = 0
|
||||
self.fcmaterials: list[OrderedDictT[str, Any]] | None = None
|
||||
self.fcmaterials_capi_marketid: int = 0
|
||||
@ -714,7 +713,7 @@ class EDDN:
|
||||
# Send any FCMaterials.json-equivalent 'orders' as well
|
||||
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.
|
||||
|
||||
@ -1091,7 +1090,7 @@ class EDDN:
|
||||
entry: MutableMapping[str, Any],
|
||||
system_name: str,
|
||||
system_coordinates: list
|
||||
) -> Union[str, MutableMapping[str, Any]]:
|
||||
) -> str | MutableMapping[str, Any]:
|
||||
"""
|
||||
Augment a journal entry with necessary system data.
|
||||
|
||||
|
5
prefs.py
5
prefs.py
@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""EDMC preferences library."""
|
||||
from __future__ import annotations
|
||||
|
||||
import contextlib
|
||||
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 ttk
|
||||
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 plug
|
||||
@ -276,7 +277,7 @@ class PreferencesDialog(tk.Toplevel):
|
||||
|
||||
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.cmdrchanged_alarm: Optional[str] = None # This stores an ID that can be used to cancel a scheduled call
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user