1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-15 08:40:34 +03:00

2980 Commits

Author SHA1 Message Date
dependabot[bot]
cc49a53556 Bump flake8-docstrings from 1.5.0 to 1.6.0
Bumps [flake8-docstrings](https://gitlab.com/pycqa/flake8-docstrings) from 1.5.0 to 1.6.0.
- [Release notes](https://gitlab.com/pycqa/flake8-docstrings/tags)
- [Changelog](https://gitlab.com/pycqa/flake8-docstrings/blob/master/HISTORY.rst)
- [Commits](https://gitlab.com/pycqa/flake8-docstrings/compare/1.5.0...1.6.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-01 14:45:51 +01:00
dependabot[bot]
383776882d Bump flake8-comprehensions from 3.3.1 to 3.4.0
Bumps [flake8-comprehensions](https://github.com/adamchainz/flake8-comprehensions) from 3.3.1 to 3.4.0.
- [Release notes](https://github.com/adamchainz/flake8-comprehensions/releases)
- [Changelog](https://github.com/adamchainz/flake8-comprehensions/blob/main/HISTORY.rst)
- [Commits](https://github.com/adamchainz/flake8-comprehensions/compare/3.3.1...3.4.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-01 14:45:51 +01:00
Athanasius
73dadca308 Add 'wheel' to requirements-dev.txt to avoid warnings 2021-04-01 14:45:51 +01:00
dependabot[bot]
9634c914c3 Bump autopep8 from 1.5.5 to 1.5.6
Bumps [autopep8](https://github.com/hhatto/autopep8) from 1.5.5 to 1.5.6.
- [Release notes](https://github.com/hhatto/autopep8/releases)
- [Commits](https://github.com/hhatto/autopep8/compare/v1.5.5...v1.5.6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-01 14:45:51 +01:00
Athanasius
d8fb17df9f plugins/eddn: Add paranoia about data in is_horizons()
A damaged station has `"modules": []`, so trips over modules.values().
2021-04-01 14:45:51 +01:00
Athanasius
bc7767c5ce Also wrap as dict(data) in dump_capi_data() 2021-04-01 14:45:51 +01:00
A_D
e475ad6659 Ensured that CAPIData objects are JSON Serialisable
While it isnt directly an issue in main (right now), the fix applies
here forward, so we may as well do it here and not deal with a headache
later.
2021-04-01 14:45:51 +01:00
Athanasius
740da49ce1 Add similar extra logging for localhost handler
* This also adjusts the logging in Session.auth_callback() because it
  can be called from either protocol.  Saying 'edmc://' there is
  misleading.
2021-04-01 14:45:51 +01:00
Athanasius
baa86b4fbf Add extra logging for Frontier Auth, especially via edmc:// 2021-04-01 14:45:51 +01:00
Athanasius
74afcb085a JournalLock: Catch when journal_dir is None
* If it's None then set journal_dir_path to None as well.  Setting '' or
  nothing results in '.' (CWD), which could cause other issues.
* As we do this in three places, it's in a helper function.
* New JournalLockResult.JOURNALDIR_IS_NONE to signal this.
* Fix checking of return from obtain_lock() to specifically reference
  JournalLockResult.ALREADY_LOCKED.
2021-04-01 14:45:51 +01:00
dependabot[bot]
831981f383 Bump py2exe from 0.10.2.1 to 0.10.3.0
Bumps [py2exe](https://github.com/py2exe/py2exe) from 0.10.2.1 to 0.10.3.0.
- [Release notes](https://github.com/py2exe/py2exe/releases)
- [Changelog](https://github.com/py2exe/py2exe/blob/master/ChangeLog)
- [Commits](https://github.com/py2exe/py2exe/compare/v0.10.2.1...v0.10.3.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-01 14:45:51 +01:00
dependabot[bot]
34876f28a2 Bump flake8 from 3.8.4 to 3.9.0
Bumps [flake8](https://gitlab.com/pycqa/flake8) from 3.8.4 to 3.9.0.
- [Release notes](https://gitlab.com/pycqa/flake8/tags)
- [Commits](https://gitlab.com/pycqa/flake8/compare/3.8.4...3.9.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-01 14:45:51 +01:00
Athanasius
87c88b80ea Slightly more paranoia in that NSCFArray check 2021-04-01 14:45:50 +01:00
Athanasius
6a4ab10cd4 Add comment about the __NSCFArray issue 2021-04-01 14:45:50 +01:00
Athanasius
1c269e9f4b Change darwin __raw_get() check for list to check it's not the OTHERS
On darwin this comes back with the type `__NSCFArray`, which I can't
find the definition of (in order to test against it).  So instead let's
check that `res` is not-None, and not one of `str` or `int`, because
then it should be (meant to be) `list`.

Yes, this is weird given the pre-rewrite code is:

```python
        def get(self, key: str) -> Union[None, list, str]:
            """Look up a string configuration value."""
            val = self.settings.get(key)
            if val is None:
                return None

            elif isinstance(val, str):
                return str(val)

            elif isinstance(val, list):
                return list(val)  # make writeable

            else:
                return None
```
But maybe something changed since 3.43 was tested and built.
2021-04-01 14:45:50 +01:00
Athanasius
0f83e5b035 macos config: Respect suppress argument to config.delete()
Else the blind deletion of the shipyard key at startup causes a fatal
exception.
2021-04-01 14:45:50 +01:00
Athanasius
e777727658 Change JournalLock.obtain_lock() return to an Enum.
This way we can tell the difference between:

1. This process obtained the lock.
2. Another process has the lock.
3. We couldn't get the lock due to not being able to open the lock file
   read-write.

Case 3 is currently also returned if the configured journal directory
doesn't exist.  This will be the case on any MacOS system that never had
the game running.  Likely given the OS hasn't been supported for the
game in years now.

# Conflicts:
#	EDMarketConnector.py
2021-04-01 14:45:50 +01:00
A_D
60dd93a3de Fixed invalid type annotation 2021-04-01 14:45:50 +01:00
A_D
e4c0703142 fixed log wording 2021-04-01 14:45:50 +01:00
A_D
ee4451560a added regression test 2021-04-01 14:45:50 +01:00
A_D
f5575e5b8e Fixed broken suppress_call calls 2021-04-01 14:45:50 +01:00
A_D
7707c26d18 tiny mypy cleanup 2021-04-01 14:45:50 +01:00
A_D
45e14ee86c added stacktrace to debug log 2021-04-01 14:45:50 +01:00
Athanasius
ba91aa4733 Two final s/getint/get_int/g instances.
Tested with firing up under debugger, switching to transparent theme,
repeatedly mousing in and out, switching back to Dark theme.
2021-04-01 14:45:50 +01:00
Athanasius
84afe6821a import of watchdog.events.FileCreatedEvent needed even when not type checking
PyCharm debugging bailed out due to the lack.
2021-04-01 14:45:50 +01:00
Athanasius
eef4acd30b Document line param to parse_entry() 2021-04-01 14:45:50 +01:00
Athanasius
3997dbab3a update pre-commit 2021-04-01 14:45:50 +01:00
Athanasius
4a1feb4d49 Type hints should be 100% now.
There's something around line 324:

                entry: OrderedDictT[str, Any] = OrderedDict([

producing an error with pre-commit's run of mypy
2021-04-01 14:45:50 +01:00
Athanasius
20772e7daf Fixed current mypy complaints.
There are still *missing* type annotations.
2021-04-01 14:45:50 +01:00
Athanasius
1c82605d9f monitor.py: General cleanup work on flake8 output.
* docstrings added as per flake8 complaints.
* Some type hints added (as I was documenting param and return).
* Also reworked two uses of .format()
* A number of functions had noqa added for cognitive complexity.
2021-04-01 14:45:50 +01:00
Athanasius
3fddd2bdf9 try/except ModulesInfo.json load & fully document 2021-04-01 14:45:50 +01:00
Athanasius
fd0ce63341 Add basic support for ModuleInfo event.
This still needs documentation adding in PLUGINS.md, which is easiest
done after #897 is merged and re-based upon.
2021-04-01 14:45:50 +01:00
Athanasius
361cd168af Actually show exception on json.load(<NavRoute.json>) exception 2021-04-01 14:45:50 +01:00
Athanasius
f280a7e863 try/except for NavRoute json.load() 2021-04-01 14:45:50 +01:00
Athanasius
0dc7c62fa8 Correct Route to NavRoute in the code/comments as well 2021-04-01 14:45:50 +01:00
Athanasius
1ee2be8fc8 Call out discrepancies between Journal doc v28 and reality in 3.7.x 2021-04-01 14:45:50 +01:00
Athanasius
b3a1b0492e Correct event and file name to NavRoute(.json) & expand docs
* Despite what section 4.18 of v28 Journal docs say, the event is
  `NavRoute`, not `Route`, and the file is `NavRoute.json`.  The array
  of hops is still keyed as `Route` though.

* Calls out that both `NavRoute` and `Cargo` events, as passed to
  plugins, are augmented with the data from their respective files, and
  are not simply the 'bare' event as seen in the Journal.
2021-04-01 14:45:50 +01:00
Athanasius
ef891fa8bd Initial support for Route.json file 2021-04-01 14:45:50 +01:00
A_D
e293f0f334 Removed star import 2021-04-01 14:45:50 +01:00
A_D
82db2e1a06 Removed star import from ctypes 2021-04-01 14:45:50 +01:00
Athanasius
933ec723bd plugins/eddn: Call requests.Session.close() in EDDN.close()
Avoids a `-W default` warning on shutdown.
2021-04-01 14:45:50 +01:00
Athanasius
6aa4ccaf90 plugins/edsm: Don't try to r.close(), that's not even valid 2021-04-01 14:45:50 +01:00
Athanasius
3d3674da5f plugins/edsm: Call requests.Session.close() after we've shutdown worker thread
This properly closes any sockets and avoids a -W default warning on
shutdown.
2021-04-01 14:45:50 +01:00
Athanasius
d7d3dc19e4 companion.py: Add Auth destructor to close session.
It's created in the constructor, so destructor is the place for this.
2021-04-01 14:45:50 +01:00
Athanasius
745c2ce8d2 edsm: Ensure Request handles are closed. 2021-04-01 14:45:50 +01:00
Athanasius
96953744c9 monitor: Close journal loghandle if signalled to close down. 2021-04-01 14:45:50 +01:00
Athanasius
f2ce63bfe7 l10n: Close localisation files after reading content
* These are opened in self.file() using codecs.open(), so no quick way
  to convert to a 'with'.
2021-04-01 14:45:50 +01:00
Athanasius
114379c8ed hotkey: Load good/bad sounds without leaking an open file descriptor. 2021-04-01 14:45:50 +01:00
Athanasius
a6866fb4d1 EDMCLogging: Return 'best efforts' if erroring in caller_attributes() 2021-04-01 14:45:50 +01:00
Athanasius
d589ca6ed2 Expand caller_attributes() docstring to params and return 2021-04-01 14:45:50 +01:00