1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-16 09:10:35 +03:00

2643 Commits

Author SHA1 Message Date
A_D
ddb53a6ca1 Added type checker magic to make TRACE work
Relatively simple. Because all of our loggers are created out of
EDMCLogging, we can create a fake type in EDMCLogging that inherits
from logging.Logger but also defines a trace method.

Once that is done, we just have to annotate our methods to get loggers
with the new type, cast all of the returns, and suddenly we no longer
have any complaints about logger.trace. This doesn't _actually_ change
any behaviour at runtime, and logging.Logger.trace and logging.TRACE
will continue to be broken, but those are used far less than
logger.trace is used throughout the codebase, and therefore I think we
can live with `# type: ignore` comments everywhere
2021-04-01 14:45:44 +01:00
dependabot[bot]
18c0ea82a0 Bump isort from 5.6.3 to 5.6.4
Bumps [isort](https://github.com/pycqa/isort) from 5.6.3 to 5.6.4.
- [Release notes](https://github.com/pycqa/isort/releases)
- [Changelog](https://github.com/PyCQA/isort/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/pycqa/isort/compare/5.6.3...5.6.4)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-01 14:45:44 +01:00
A_D
fe26359170 passed only what was needed to StatsDialog
passing the entire AppWindow just made a mess of typing
2021-04-01 14:45:44 +01:00
A_D
2819c92006 Removed tabs 2021-04-01 14:45:44 +01:00
A_D
7f5bfa36f0 added logging of exception 2021-04-01 14:45:44 +01:00
A_D
ecd13b094b Removed mutable default 2021-04-01 14:45:44 +01:00
A_D
ad8fdd763a made ships() return a List of NamedTuples
This way, we can access items without remembing indexes, if needed
2021-04-01 14:45:44 +01:00
A_D
3b4d56b842 Added docstrings, type annotations
This looks quite large, but it makes no code changes other than
docstrings and type annotations. Along with a small code style fix.
2021-04-01 14:45:44 +01:00
A_D
d1e2e2b1f3 Removed uneeded list comprehensions 2021-04-01 14:45:44 +01:00
A_D
53c6f85124 Fixed (im)possible UnboundLocalExceptions 2021-04-01 14:45:44 +01:00
A_D
84a093a7e3 replaced string formatting with interpolation 2021-04-01 14:45:44 +01:00
A_D
c7e0850ea1 removed star import 2021-04-01 14:45:44 +01:00
A_D
a25ea9dfa9 autoformatted code 2021-04-01 14:45:44 +01:00
A_D
c13caa22ef sorted imports, manually formatted some super long lines 2021-04-01 14:45:44 +01:00
Athanasius
2f35275024 config.py: Revert conditional orders for Windows Registry gets
I failed to realise the values I'd moved earlier in the conditional were
being passed by reference to the ctypes call.  Thus they had initial
values only upon test, rather than the 'returned' values as they should.

This caused no values to be loaded from the Registry!
2021-04-01 14:45:44 +01:00
Athanasius
61a714513e config.py: Final function type annotations 2021-04-01 14:45:44 +01:00
Athanasius
1e24c297e0 config.py: Don't need to sub-class object 2021-04-01 14:45:44 +01:00
Athanasius
cb795b2230 config.py: Remove u-prefix from strings. More specific Exceptions
* u-prefix is un-necessary, remove it.
* We should get ValueError in some cases, so catch it first.
* Change debug log for if linux config file not yet present.
2021-04-01 14:45:44 +01:00
Athanasius
0274c98e50 config.py: Convert darwin test to isinstance(val, list) as well 2021-04-01 14:45:44 +01:00
Athanasius
f356d9c1d1 config.py: No need for typing.Iterable 2021-04-01 14:45:44 +01:00
Athanasius
93dc1a988a config.py: linux Config class & overall typing
* This changes the test in set() from hasattr(val, '__iter__') to
  isinstance(val, list) as the passed values *should* be lists for that
  case.
2021-04-01 14:45:43 +01:00
Athanasius
b7f41796c9 config.py: win32 Config class cleanup 2021-04-01 14:45:43 +01:00
Athanasius
854c79c070 config.py: Log exception type from darwin getint()
* Also sets up `logger`.
2021-04-01 14:45:43 +01:00
Athanasius
fcb7685d71 config.py: darwin Config class code cleanup
# Conflicts:
#	config.py
2021-04-01 14:45:43 +01:00
Athanasius
07fd4dc634 config.py: ctypes import order 2021-04-01 14:45:43 +01:00
Athanasius
c3150dae76 config.py: More import clean & misc. 2021-04-01 14:45:43 +01:00
Athanasius
b2629286b4 config.py: top-level docstring, import order, minor edits 2021-04-01 14:45:43 +01:00
Athanasius
6ae6efaee9 EDMarketConnector: Annotate save_raw() complexity noqa 2021-04-01 14:45:43 +01:00
Athanasius
4ac9e9010e EDMarketConnector: Two minor cleanups. journal_event & dashboard_event
* journal_event() annotate the noqa complexity comment.
* dashboard_event() convert to 'bail early' to save indentiation.
2021-04-01 14:45:43 +01:00
Athanasius
07c7639345 EDMarketConnector: Switch to Optional[int] rather than Union... 2021-04-01 14:45:43 +01:00
Athanasius
e5e0eb0373 EDMarketConnector: Revert to tearoff=tk.FALSE
And added `# type: ignore` comments.

This is a mess.  On the tkinter side it *is* an int, default 0.  But
enough python stuff has assumed it's a bool for typeshed to define that
tearoff should be.  It doesn't match, mypy complains.
2021-04-01 14:45:43 +01:00
Athanasius
c1fdd27020 EDMarketConnector: More typing, and removal of retry_for_shipyard()
* retry_for_shipyard() was only called by itself (for further retry),
  and tried to call self.eddn.export_shipyard() which doesn't even
  exist.
  I suspect this has been unused code since the EDDN code was extracted
  out into an internal plugin.
* self.drag_offset given proper typing.
* All functions have at least some typing now.  Left the 'event' Tk
  arguments bare as mypy seems to infer without complaint.
2021-04-01 14:45:43 +01:00
Athanasius
5b7876a22b pre-commit: Try local flake8 2021-04-01 14:45:43 +01:00
Athanasius
5d8e2a80af EDMarketConnector: noqa CCR001
Some of our code is just cognitively complex.
2021-04-01 14:45:43 +01:00
Athanasius
58787bc65e EDMarketConnector: Final type annotation fixups.
* Ignore Tkinter 'name' complaints.  I've opened
  <https://github.com/python/typeshed/issues/4658> to get this
  fixed in typeshed.
* If checking `import update` so it's available.
* Don't annotate journal_event 'event' arg, as it's passed through Tk
  events mechanism, so let mypy infer it.
2021-04-01 14:45:43 +01:00
Athanasius
aafc419124 EDMarketConnector: Initialise self.updater with type, but None value
This allows the type to be known, but leaves the proper setting of the
value until later (after UI creation).
2021-04-01 14:45:43 +01:00
Athanasius
a038b30855 EDMarketConnector: Remove call to deprecated config.getpassword() 2021-04-01 14:45:43 +01:00
Athanasius
55f1e11f0b EDMarketConnector: Correct __init__ master type & misc 2021-04-01 14:45:43 +01:00
Athanasius
97f3af2568 EDMarketConnector: Refactor of getandsend() and journal_event() 2021-04-01 14:45:43 +01:00
Athanasius
a4422c2065 pre-commit: Update config as per cleanup/config.py 2021-04-01 14:45:43 +01:00
Athanasius
da9e406e81 EDMarketConnector: Convert debug data dump to f-string & misc
* docstring indent on Class A.
* Minor white space adjustments.
2021-04-01 14:45:43 +01:00
Athanasius
8a3fa50c97 EDMarketConnector: Pass on docstrings & Misc.
* Removed a couple of E501 ignores tagged as now un-necessary.
2021-04-01 14:45:43 +01:00
dependabot[bot]
3e6998cfbe Bump mypy from 0.782 to 0.790
Bumps [mypy](https://github.com/python/mypy) from 0.782 to 0.790.
- [Release notes](https://github.com/python/mypy/releases)
- [Commits](https://github.com/python/mypy/compare/v0.782...v0.790)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-01 14:45:43 +01:00
dependabot[bot]
68406f82cf Bump isort from 5.6.1 to 5.6.3
Bumps [isort](https://github.com/pycqa/isort) from 5.6.1 to 5.6.3.
- [Release notes](https://github.com/pycqa/isort/releases)
- [Changelog](https://github.com/PyCQA/isort/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/pycqa/isort/compare/5.6.1...5.6.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-01 14:45:43 +01:00
Athanasius
6c9045ba13 setup.py: Convert to rf'' strings, no need to escape backslashes. 2021-04-01 14:45:43 +01:00
Athanasius
550ee394e3 setup.py: Convert one f-string to rf-string. 2021-04-01 14:45:43 +01:00
dependabot[bot]
5201777d9d Bump isort from 5.5.5 to 5.6.1
Bumps [isort](https://github.com/pycqa/isort) from 5.5.5 to 5.6.1.
- [Release notes](https://github.com/pycqa/isort/releases)
- [Changelog](https://github.com/PyCQA/isort/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/pycqa/isort/compare/5.5.5...5.6.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-01 14:45:43 +01:00
Athanasius
1297ba9c0d setup.py: typing cleanups
* I didn't go looking for darwin 'py2app' docs to find the possible
  return types of py2app.recipes['member']['check'], so 'Any' will have
  to do.

* re.search may return None, which then doesn't have .group(), so mypy
  complains.  Just tell it to ignore that code.
2021-04-01 14:45:43 +01:00
Athanasius
db40197f80 requirements-dev.txt: Add mypy and safety 2021-04-01 14:45:43 +01:00
Athanasius
7d4bef686c Releasing.md: Update to Windows SDK 19041 2021-04-01 14:45:43 +01:00