Commit Graph
2194 Commits
Author SHA1 Message Date
A_D fb080f8080 Removed unused imports 2020-09-22 14:48:53 +02:00
A_D 893cab3c23 cleaned up logic where possible 2020-09-22 14:48:52 +02:00
A_D f2add920c7 replaced constant contains checks with tuples 2020-09-22 14:48:52 +02:00
A_D 62f3203c3f Added type checker hint for unbound names
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.
2020-09-22 14:48:51 +02:00
A_D 7ab697a807 Used default option for .get on dicts 2020-09-22 14:48:00 +02:00
A_D 25adf29779 Fixed possible error if credentials is None 2020-09-22 14:48:00 +02:00
A_D 2c2ade05e0 fixed some naming 2020-09-22 14:46:23 +02:00
A_D 20357b3deb replaced modulo formatting with fstrings 2020-09-22 14:46:22 +02:00
A_D 81c977d0da Added type annotations to functions 2020-09-22 14:46:22 +02:00
A_D 14617e72da cleaned up overlong lines 2020-09-22 14:43:24 +02:00
A_D 199e76701d Added line breaks around scope changes 2020-09-22 14:43:24 +02:00
A_D 743984eb11 Added fake definition for _
_ is added by magic in the plugin loading system, which means there are
no imports to indicate its existence to static analysis tools.
2020-09-22 14:41:34 +02:00
A_D d2a1f09fac sorted imports 2020-09-22 14:41:34 +02:00
A_D 37c53e233e autoformatted code with autopep8 2020-09-22 14:41:33 +02:00
Athanasius 0f12959d53 plugins/edsm: Also DEBUG log Location and Docked events. 2020-09-22 12:26:54 +01:00
Athanasius 29ecfdb789 Merge pull request #712 from EDCD/fix/771-utf8-locale
Attempt to select UTF-8 code page in manifest.
2020-09-21 19:08:34 +01:00
Athanasius 468912f4ec Attempt to select UTF-8 code page in manifest. 2020-09-21 13:30:17 +01:00
Athanasius c1584d06fa EDMarketConnector.py: Tweak setting of UTF-8.
"UTF-8" is the official name, although it results in the same "utf8"
afterwards in this case.
2020-09-21 10:58:33 +01:00
Athanasius 10524c89dc Bug Report Template: Reference Debug Log File as well. 2020-09-21 09:45:03 +01:00
Athanasius 0752303ab0 Issue Template: Bug: Point out our Troubleshooting Wiki page. 2020-09-19 09:13:30 +01:00
Athanasius ffa3e9c9a9 Pre-Release 4.1.0-beta5 Release/4.1.0-beta5 2020-09-18 15:54:34 +01:00
Athanasius 3516f1cf6d Translations: Updated with latest from OneSkyApp 2020-09-18 15:42:56 +01:00
Athanasius 3864f1fd80 Merge pull request #710 from EDCD/fix/edsm-carrierjump
Add detailed logging of Carrier/FSDJump to edsm plugin
2020-09-18 15:35:55 +01:00
Athanasius 0efe38540f Extend logging to FSDJump as well for ease of testing.
FSDJump happens, relatively, seldom enough to not be too spammy.
2020-09-18 15:33:18 +01:00
Athanasius 3f001a383f plugins/edsm: Add extra logging for CarrierJump events.
We've had reports about EDSM not updating for these, so add logging to
see if it's a bug our end.
2020-09-18 15:15:02 +01:00
Athanasius a19fd3cbf6 PLUGINS.md: Emphasise the correct way to get a logger.
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.
2020-09-18 13:07:44 +01:00
Athanasius 7c9b8861fc Merge pull request #707 from EDCD/fix/671-no-modules
Catch where station modules and shipyard from CAPI aren't as expected.
2020-09-18 13:00:40 +01:00
Athanasius f485ffa737 Correctly return and receive bare Tuple, not nested. 2020-09-18 12:59:09 +01:00
Athanasius 030ae05889 Adjust return type of companion.session.station()
Now we're correctly always returning `data` it can't be None.
2020-09-18 12:58:16 +01:00
Athanasius be541571d9 companion.py: Return CAPI data if not docked
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.
2020-09-18 12:48:21 +01:00
Athanasius 7d66a47b4b Merge pull request #709 from EDCD/fix/found-plugin-logging
Plugin logging needs to be DEBUG, to let channels decide later.
2020-09-18 12:37:38 +01:00
Athanasius ed8403f303 Plugin logging needs to be DEBUG, to let channels decide later.
This should have been changed when the rotating file logging was
implemented.
2020-09-18 12:17:08 +01:00
Athanasius 22a8da5bf7 Add ships sanity checking, and it's all in a helper function now.
* Moved these modules and ships checks to safe_modules_and_ships().
* Applied some paranoia checks to ships as well.
2020-09-18 11:38:20 +01:00
Athanasius 81f71c88ff Catch where station modules from CAPI is an empty list.
Out of paranoia we're also checking if it's a non-empty list and logging
that as an error if encountered.  It should be a dictionary!
2020-09-18 11:15:15 +01:00
Athanasius 42c826f04b Merge pull request #704 from EDCD/cleanup/commodity.py
Cleanup/commodity.py
2020-09-16 21:01:27 +01:00
Athanasius beeadf266a Merge pull request #703 from EDCD/feature/tk-dir-dialog
Locale: More detailed login at startup around changes
2020-09-16 09:43:39 +01:00
Athanasius c9bea98021 Refer to Known Issues in Bug Report Template. 2020-09-16 09:42:05 +01:00
Athanasius 14d1a0ad5e companion.py: Re-format next(...) to be more obvious. 2020-09-15 17:30:23 +01:00
Athanasius ed52528718 companion.py: Slight tweaks from running mypy
NB: Using `mypy --follow-imports skip` for now to limit how much it
checks each time.
2020-09-15 16:15:13 +01:00
Athanasius c311957eff companion.py: import requests does belong down there. 2020-09-15 15:49:28 +01:00
Athanasius 55fcfbeb17 companion.py: Further PyCharm-prompted cleanup.
* 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().
2020-09-15 15:33:00 +01:00
Athanasius 4575353923 companion.py: CAPIData type & PyCharm-prompted cleanup.
* 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.
2020-09-15 15:00:22 +01:00
Athanasius da2a582c46 companion.py: Use custom type for CAPI Data.
This way if we get more stringent about it (could be a class) we don't
need to edit all the references.
2020-09-15 14:35:37 +01:00
Athanasius c12c739c11 companion.py: Full pass to 100% pass flake8
* docstrings added throughout.
* .format() all now f-strings.
* Type annotations added throughout.
* White space tweaked.
2020-09-15 14:15:07 +01:00
Athanasius 8b5e5e73de Locale: More detailed login at startup around changes
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.
2020-09-15 10:28:28 +01:00
Athanasius faf4906eea Merge pull request #701 from EDCD/fix/671-no-modules
Fix the detection of no modules being available at a station, so is_horizons() doesn't blindly modules.values().
2020-09-14 16:16:39 +01:00
Athanasius c7f8b3dada Translations: Fix erroneous newline in a RU string 2020-09-14 15:44:03 +01:00
Athanasius 62851bfe3b Merge pull request #702 from EDCD/feature/tk-dir-dialog
Use tkinter.filedialog on win32, because we now fix locale encoding
2020-09-14 15:43:49 +01:00
Athanasius 31203270bc Switch to "thing is None" on tests. 2020-09-14 15:43:15 +01:00
Athanasius 52dcd3b28a Use tkinter.filedialog on win32, because we now fix locale encoding
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.
2020-09-14 15:16:26 +01:00