-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: multiple improvements from kfsone
* chore: increase the line limit in the .editorconfig * chore: relax tox warnings by disabling spaces-after-: * refactor: Cleanup pass on cache and spansh_plug - introduce type annotations, - Small performance considerations, * refactor: flake and pylint rules - ignore warnings that are overly opinionated for our needs, - tell pylint to quit complaining about lines > 100 * fix: ensure db gets closed before trying to rename it. * perf: modernize small performance factors in spansh - lookup systems and stations by id rather than name, - move several 'is it registered' tests out of ensure_ methods so we can avoid calling the method if there is no work to do (calling a function in python is expensive) - fix ingest_stream looking up body ids rather than system ids * chore: remove vestigial numpy stuff that annoyed linters I couldn't see any evidence of this code still being useful. * chore: move uprint into a mixin tradeenv was already hard enough to read, but the utf8 wrapping of uprint made it worse, and less pythonic. this change moves the io behavior into a base Mixin class, then provides the non-utf8 variant as an optional override mixin. finally, we do a simple if on which one to use as the favored implementation to mixin to TradeEnv. This should be far more readable to both humans and linters etc. At least, on my machine, PyCharm no-longer catches fire. (* it's possible that it never caught fire and that I just ate an overly hot chilli last night, but who are we to question the universe? not deflecting enough, well LOOK A SQUIRREL) * chore: appease the gods of pylint pylint gives deeper code warnings than flake8 can, but is slower and more spammy. * chore: change terribly misnamed 'str' to 'text' * chore: tox/pylint: now we've appeased, lets ask for more this will enable some more useful pylint warnings/messages, and also making it think a little harder about others so they're more useful. * feat: introduce theming in tradeenv two fold reasoning: 1- so people can opt out of any kind of decoration if it becomes inconvenient/problematic, 2- localization and style In particular: the colors people want for light-vs-dark background terminals might vary, and this would make it easy to switch; second, this makes it possible to configure various strings to be localizable through the theme. The demo-case included here is that when you use --color the word "NOTE" will be replaced with the "information-source" emoji and the word "WARNING" will be replaced with a warning-symbol emoji, the '#' for bugs will be replaced with a bug emoji. * chore: cleanup/performance tradedb.py this eliminates some dead methods, and switches some of the math operations to their favored modern-python/performant/64-bit versions specifically: %timeit 2 ** 2 94ns %timeit 2 * 2 24ns Also, when I originally feared math_sqrt vs ** it was probably because I didn't realize that "math.sqrt" was having to lookup math and sqrt each time it was called, duh. * feat: spansh import presentation - Adds Progresser to spansh_plugin as an experimental ui presentation layer using rich, -- active progress bars with timers that run asynchronously (so they shouldn't have a significant performance overhead), -- opt-out to plain-text mode incase it needs turning off quickly, - present statistics with the view to give you a sense of progress, - small perf tweaks * style: blank lines have same indent as following non-blank line * fix: Use same supply/demand levels as before * fix: having the fdev_id listed as a unique column causes dump prices to break. * refactor: tox was configured to give flake8 its own environment The idea is that flake8 is really fast, so you give it it's own environment and it comes back and says "YA MADE A TYPO OLIVER YA DID IT AGAIN WHY YOU ALWAYS..." *cough*, sorry, anyway. I usually run tox one of two ways: ``` tox -e flake8 # for a quick what-did-I-type-wrong check tox --parallel # run em all, but, like, in parallel so I don't retire before you finish ``` * test: flake8 appeasement turning on flake8 made linters very shouty * refactor: tox.ini flake8 now runs its own environment that is JUST flake8 so it's fast, it doesn't install the package for itself; added lots of flake8 ignores for formatting issues I'm unclear on * chore: flake8 warnings * refactor: tox.ini added a lot more ignores and some file-specific ignores, but generally got it to a point where flake8 becomes proper useful. * chore: fix all the tox warnings This fixes all of the tox warnings that I haven't disabled, and several that I did. * chore: bump pylint score up to 9.63/10 fixed a few actual problems while I was at it. * fix: formatting needs __str__ methods When I first created the 'str' methods, it was because I wanted a display name but repr and str both confused me at the time; I've now renamed it text but apparently I forgot that in Py2.x def str() worked like __str__... * refactor: use ijson instead of simdjson to reduce memory use in big imports * refactor: logic reversal for plugin option handling * fix: presentation was a bit wonky with doubled progress bars --------- Co-authored-by: eyeonus <eyeonus@panther> Co-authored-by: Jonathan Jones <[email protected]>
- Loading branch information
1 parent
1801216
commit 7c60def
Showing
82 changed files
with
1,796 additions
and
1,528 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,5 @@ flake8 | |
importlib-metadata>=1 | ||
wheel | ||
coverage | ||
pysimdjson~=6.0.2 | ||
ijson | ||
rich==13.7.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.