Commit Graph
1809 Commits
Author SHA1 Message Date
Athanasius 44fe00a410 Copy push-checks.yml to pr-checks.yml 2020-07-28 15:03:20 +01:00
Athanasius e645ee5675 Revert "Change the push-checks back into also PRs."
This reverts commit 4da1d9df4e.
2020-07-28 15:02:32 +01:00
Athanasius a3ea7008b4 Merge pull request #646 from EDCD/enhancement/638-flake8-prs
Run flake8 for status on all pull requests
2020-07-28 13:49:07 +01:00
Athanasius 4da1d9df4e Change the push-checks back into also PRs.
Renamed to suit.
2020-07-28 13:45:55 +01:00
Athanasius 525ebae61d Merge pull request #625 from A-UNDERSCORE-D/fix/624-inara-too-fast
Switched to using a timer for inara updates
2020-07-28 11:26:51 +01:00
Athanasius cbb64a60a8 Merge pull request #636 from EDCD/cleanup/EDMarketConnector.py
Continuing work on passing flake8 in EDMarketConnector.py
2020-07-27 18:35:11 +01:00
Athanasius b1d35e0579 Merge branch 'fix/639-crash-linux-unset-journal-dir' into develop 2020-07-27 18:12:40 +01:00
A_D 6ab4433c59 Add TODO regarding type config 2020-07-27 19:07:54 +02:00
A_D 1b543e5820 Dont crash when journal_dir is None
Ensures that journal_dir is always at least an empty string.

Fixes #639
2020-07-27 18:55:59 +02:00
Athanasius a5b7bea2ca Move comment to line above if 2020-07-27 15:16:23 +01:00
Athanasius b17b3a4a72 Merge pull request #632 from A-UNDERSCORE-D/cleanup/eddb
Cleanup eddb plugin
2020-07-27 14:56:29 +01:00
A_D b27e4a3628 fixed tk import and type annotations 2020-07-27 15:15:56 +02:00
A_D cad5f72b0a updated type annotation 2020-07-27 15:15:55 +02:00
A_D 7b231fb244 removed unicode specifier from string
python3 strings are always unicode
2020-07-27 15:15:55 +02:00
A_D 07c43d3057 added type annotations to globals 2020-07-27 15:15:54 +02:00
A_D e0462d8719 Replaced complex oneliner with multiline if 2020-07-27 15:15:54 +02:00
A_D 37181264c9 Added newline after scope changes 2020-07-27 15:15:53 +02:00
A_D 4eed4404c6 Added Any type hint to this
Resolves most type warnings
2020-07-27 15:15:53 +02:00
A_D ab58aa6355 autoformatted file 2020-07-27 15:15:52 +02:00
A_D d4299c224f dont force a send on exit
just try and send if we can
2020-07-27 15:12:32 +02:00
A_D bb817eee3b removed outdated comment 2020-07-27 15:08:47 +02:00
A_D 340f8928b3 switched to using config for last update time 2020-07-27 15:08:47 +02:00
A_D 34760683e5 added some debug logging 2020-07-27 15:08:46 +02:00
A_D 72498b3bbc Switched to using a timer for inara updates
This adds a new thread that will run in a loop sending inara events once
ever 30 seconds. The old method of sending once for "special" events has
been removed.
2020-07-27 15:08:46 +02:00
Athanasius 9face638fe Minor cleanups all done.
Only remaining are:

 * TAE001 too few type annotations
 * Multiple "Cognitive complexity is too high" / "is too complex"
2020-07-27 13:00:59 +01:00
Athanasius e0324cb9cd More flake8 cleanup 2020-07-27 11:15:03 +01:00
Athanasius 9fcaeb5feb Merge pull request #630 from EDCD/enhancement/563-proper-logging
Enhancement/563 proper logging

Covers only a few files for now.  But let's get this merged so we can move on.
2020-07-27 11:07:50 +01:00
Athanasius 63f3859af4 Remove extraneous __class__ in logging strings 2020-07-27 10:56:57 +01:00
Athanasius 19e750eddd Use logger.exception() not log.error(.., exc_info=..) 2020-07-27 10:47:57 +01:00
Athanasius 6429cae932 Use isinstance() for type checking 2020-07-27 10:37:36 +01:00
Athanasius 6c9139e395 TODO: unittest hint about testing logging
And comment out the use of it here.
2020-07-27 10:35:08 +01:00
Athanasius d7c2372417 Flake8 cleanup round #2 2020-07-27 10:14:16 +01:00
Athanasius cbba1ce28a Change time string in translations.
It makes the code far too complicated to sub {HH} -> %H and the like.
2020-07-27 09:44:12 +01:00
Athanasius f9a23cc831 Clean up flake8 output for this branch 2020-07-27 09:37:10 +01:00
Athanasius 3653a1342f No need to subclass object. 2020-07-27 06:57:53 +01:00
Athanasius 307910739a Remove now un-necessary imports for logging/traceback 2020-07-27 06:57:53 +01:00
Athanasius 66e2c354c7 Documentation update and getLogger() -> get_logger()
* Technically %(class)s can be e.g. A.B not just 'B' so say "name(s)".
* To not confuse EDMCLogging.getLogger() with logging.getLogger() it's
 been renamed to get_logger().
* Note how we signal errors with finding class and/or qualname.
* Call out EDMCLogging.py in Contributing.md.
2020-07-27 06:57:53 +01:00
Athanasius 2eba647f17 Simply walk up the stack finding the frame we want.
Also leave that 'A.B' test around as a hint for a unittest.  Obviously
that instantiation will need commenting out for a release.
2020-07-27 06:57:53 +01:00
Athanasius 5a779a3379 Cleanups and docstrings
* Added/fleshed out docstrings on file, classes and functions.
* No need to use a function for the stack frame getting.
* Check if LogRecord has class or qualname before setting, allowing
 upstream to implement them.
* Use setattr()/getattr() rather than __dict__ fiddling.
* Force an error string into class/qualname if we have issues finding
 them, rather than failing silently to ''.
2020-07-27 06:57:53 +01:00
Athanasius 596527bda2 Move logging setup to EDMCLogging.py with a class
* Also now providers single caller_class_and_qualname() method to get
 both strings, returned as a Tuple[str, str].  Either could be empty
 if something went wrong.
* Rather than a fragile 'skip' this now:
    1. Looks for the first up-stack frame with self of logging.Logger
    1. Then looks for the next up-stack frame with self NOT of
     logging.Logger.  This should be the call site we want.
2020-07-27 06:57:53 +01:00
Athanasius c196a38e09 Add logging TODOs. logger creation & frame detection
* Nothing should "from EDMarketConnector import logger" any more, so
 we can move this back inside __main__ section
* We shouldn't rely on a magic number of frames to skip.  Detect the
 proper frame automatically.
2020-07-27 06:57:52 +01:00
Athanasius a82824c0e9 Contributing.md: Update logging docs for auto qualname and proper import 2020-07-27 06:57:52 +01:00
Athanasius 2e58d106bd logging.getLogger(appname) instead of import from EDMarketConnector
Using:

from EDMarketConnector import logger

causes issues if EDMarketConnector is already importing 'this' file.

So just get a logger using logger.getLogger(appname) instead.
`from config import appname` if needs be.
2020-07-27 06:57:52 +01:00
Athanasius bae2f25e19 companion.py: Convert to proper logging 2020-07-27 06:57:52 +01:00
Athanasius 2176187be7 Fix typos in class/qualname finders 2020-07-27 06:57:52 +01:00
Athanasius 8e1f3b8a90 plugins/inara: Fix typo on except: 2020-07-27 06:57:52 +01:00
Athanasius 7d060aa325 plugins/inara: Convert to proper logging 2020-07-27 06:57:52 +01:00
Athanasius 4d7f81cec1 Add emergency print()s if we can't find class/qualname 2020-07-27 06:57:52 +01:00
Athanasius 89cadbc0eb Add paranoia checks to class and qualname finders 2020-07-27 06:57:52 +01:00
Athanasius 7951463fba plugins/edsm: Converted to proper logging 2020-07-27 06:57:52 +01:00