Replace pandas-backed data_mod with a plain dict - #12
Merged
Conversation
bot.data_mod was a DataFrame used purely as a keyed collection (mask
by message_id, concat to append, iterrows to list) - no aggregation
or numeric computation anywhere, evidenced by mod_row["x"].values[0]
unwrapping scattered through moderacion.py. Replaced with a plain
dict[message_id, dict], loaded via a new utils.read_csv_dicts()
(csv.DictReader) instead of pd.read_csv.
- bot.py: builds bot.data_mod as {message_id: row} directly, filtering
out already-accepted/rejected ids via set operations instead of
DataFrame masking.
- moderacion.py: ValidatedPost.mod_row is now a plain dict (dropped
the now-unneeded condition: pd.Series field); lookups are
data_mod.get(post_id), removal is del data_mod[post_id],
get_mod_pending iterates data.values().
- pandas dropped from requirements.txt and every import.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
bot.data_mod was a DataFrame used purely as a keyed collection (mask by message_id, concat to append, iterrows to list) - no aggregation or numeric computation anywhere, evidenced by mod_row["x"].values[0] unwrapping scattered through moderacion.py. Replaced with a plain dict[message_id, dict], loaded via a new utils.read_csv_dicts() (csv.DictReader) instead of pd.read_csv.