Closed aneroid closed 4 years ago
That just leaves UnitCompDict
in the init file since that's a more complex structure - dict values are each a list of sets. I could move that out to a csv and add a loader specifically for it but it seems like more effort than it's worth, especially when you want to edit/maintain that data in its text-based format.
I'd recommend just moving it out to its own .py file and importing it (in init). Since that change is a bit iffy, I've left it out of this pull request.
Let me know if it makes sense to you to have it that way. Would take all of 5 mins to do it, and transparently so that the import in ReplayAnalysis.py
remains unchanged.
I like the idea from over here (ie. without any stakes in the matter)
though I would totally squash those commits into one
Thanks!
I had originally done it as just 2 bulk changes. Decided to break them down per data item so that once merged, FluffyMaguro could easily revert an item if he/she/they decided that it was better left in FCBD.__init__.py
. But as a bulk change, it would need to be done afterwards and manually.
As a branch, if reorg_data
is merged with --no-ff
(no fast forward), it keeps the main branch clean. In any case, they could still choose to merge it --squash
ed.
Thank you, I'll add that.
Might be easier to maintain data in separate text-based files instead of large sets and dictionaries all in one big Python file.
FluffyChatBotDictionaries.py
is now a module with the same name, and the data is loaded/imported in__init__.py
.from FluffyChatBotDictionaries import UnitNameDict, CommanderMastery, ...
line inReplayAnalysis.py
needs no changes. And the referenced data structures are the same as the original..csv
files and sets to.txt
, while maintaining order. (Shouldn't matter for sets though.)comastery
dicts are specifically in akey: [value1, ..., value6]
format._data_utils.py
which are used in FCB.init to load them appropriatelyfactory
parameter when loading txt's which defaults toset
as per the original datalist
,frozenset
, etc. as needed_underscored
so as not to pollute the namespace with local vars or the helper functions.UnitNames
raw dict was 48k characters. TheUnitNames.csv
is 41 KB. (In-memory size remains the same of course.)