Due to the fact that cmdr and entry are only assigned if item exists, a
situation can arise where any access to the names will raise an
UnboundLocalException, this tells the type checker to ignore that
possibility by using a TYPE_CHECKING guarded assignment to those names.
This does not fix the issue at runtime, it just tells the type checker
that its fine. As this remains a bug, I have left TODOs in to note its
existence.
A_D had accidentally used 'ClickCounter' for this when their folder name
was 'click_counter'. This lead to using a very bare `logger` which
still used our defined format leading to things blowing up when there
was no adapter to handle `qualname` format string.
Else at least one caller to .station() blows up when it can't find the
commander data.
The call has to be to .station() so as to populate the market/shipyard
added dictionaries.
* Correct use of error[0] to just error.
* We don't want methods not referencing self to be static in this case,
so annotate them.
* Take suggestion of "if v == []:" equivalent to "if not v:".
* Preserve CAPIData typing throughout filter_ship().
* CAPI Data really is just a Dict. Define a custom type so it could
easily be a class in future with minimal edits.
* Auth.refresh() *can* also return a str (Access Token).
* Catch specific (but still quite loose) exceptions in Auth.refresh().
* Set self.server in Session.__init__.
* Remove some extraneous () on conditionals.
As we might run into some special cases with users we need to log in
more detail what the locale is around our changes.
NB: Also contains some misc. PyCharm-enacted formatting changes, white
space, wrapping etc.
tkinter ends up calling something where utf8 characters won't work
because of the windows encoding, e.g. cp1252.
We can't set encoding just for the dialogs, as it's not thread safe. So
we'll just set it at startup instead. Utilising:
locale.setlocale(locale.LC_ALL, '')
to get things set up initially, so we can properly retrieve the language
to go with the encoding on the subsequent setlocale() call.
There are cases where a station/FC doesn't have outfitting modules or a
ships list. Let's make the checks happen in both those functions and be
extra paranoid with some logging.
Closes#671