Refactor: centralize config, improve logging, and clean up code#4
Draft
d-roho wants to merge 1 commit into
Draft
Refactor: centralize config, improve logging, and clean up code#4d-roho wants to merge 1 commit into
d-roho wants to merge 1 commit into
Conversation
…ctor 1. config.py — Centralises all hardcoded values (GSI auth token, port, timing thresholds, map codes, weapon lists) so they are easy to find and change without touching logic files. 2. Logging + exception hygiene — Replaces every print() with the stdlib logging module (INFO to console, DEBUG with -v flag). Fixes bare `except:` clauses in gsi_pinger.py and MainApp.py that were silently swallowing KeyboardInterrupt and SystemExit. Adds graceful handling for the missing pywin32 dependency on non-Windows platforms. 3. de_ancient collision fix + snapshot_arrayfier single-pass refactor — de_ancient was mapped to code 4 (same as de_nuke), causing the model to silently misclassify the map. It now gets its own code (8). The four separate player-iteration loops in snapshot_arrayfier are consolidated into one pass, halving the number of dict lookups and removing duplicated key-construction logic. https://claude.ai/code/session_01BpRrR55tsrkVo9W5rtwYMK
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.
Summary
This PR significantly improves code maintainability and observability by extracting hardcoded configuration values into a central config module, adding comprehensive logging throughout the application, and refactoring several functions for clarity and robustness.
Key Changes
Configuration Management
config.pymodule to centralize all configuration values (GSI settings, prediction thresholds, map codes, weapon classifications)gsi_pinger.py,snapshot_parser.py, andMainApp.pyinto configfrozensetfor better performance and immutabilityLogging Infrastructure
MainApp.pywith-vflag support for verbose outputCode Quality Improvements
Refactored
snapshot_parser.py:Refactored
MainApp.py:Refactored
gsi_pinger.py:Robustness
.get()calls with defaults throughout to handle missing GSI dataNotable Implementation Details
https://claude.ai/code/session_01BpRrR55tsrkVo9W5rtwYMK