ClamSageCaleb / UNCC-SIX-MANS

The official 6 mans bot for the UNC Charlotte Rocket League Community
https://clamsagecaleb.github.io/UNCC-SIX-MANS/
MIT License
2 stars 0 forks source link

TinyDb Implementation, Typing Added, and More! #16

Closed mattwells19 closed 4 years ago

mattwells19 commented 4 years ago

This is a big pull request. Grab a snack and a cup of coffee before attempting review.

TinyDb

TinyDb is a python library that makes reading, writing, and organizing data into a JSON format super easy and efficient. This fits our use case perfectly and has cleaned up a lot of code because of it. Now all data is stored in a single data.json file instead of three separate files.

Typing

Python has built-in Typing support that just wasn't implemented. I've gone back and added types to all parameters and functions. The bot.py file may not have types everywhere but I'm not too concerned about that since those functions are only used inside that file.

File Name Changes

JSONMethod is now Queue

This module name no longer makes sense so it has been renamed to Queue to better reflect the file contents.

FilePaths is now DataFiles

This file was originally named FilePaths because its main purpose was to construct the paths to all of the data files. Since there are only two files and one path now, the name wasn't as applicable anymore.

BREAKING - Channel IDs

To make Norm more reusable, channel IDs are now read from the config file. We'll need to add these fields before deploying v6.

TestHelper Functions Debug Only

The helper commands like !fill and !flipCap are only meant for testing Norm. To make sure these commands cannot be used when deployed, they've been wrapped in the __debug__ flag so that the commands will only register in development.

Dictionary Keys

The keys for each dictionary has been exported to Types.py. This helps eliminate spelling and capitalization mistakes when referencing the data files.

mattwells19 commented 4 years ago

Here's the repo for TinyDB if you're interested: https://github.com/msiemens/tinydb