[WIP] Limit class inheritance to a maximum of three levels#7
Conversation
…ions Co-authored-by: EthanThePhoenix38 <103653068+EthanThePhoenix38@users.noreply.github.com>
Co-authored-by: EthanThePhoenix38 <103653068+EthanThePhoenix38@users.noreply.github.com>
|
Co-authored-by: EthanThePhoenix38 <103653068+EthanThePhoenix38@users.noreply.github.com>
|
There was a problem hiding this comment.
Pull request overview
This PR successfully refactors the class inheritance structure to comply with a maximum of 3 levels of inheritance depth. The changes primarily focus on removing duplicate class definitions that were causing conflicts and updating the inheritance hierarchy to use a clean 2-level structure (Module → StatisticalModule → BaseCapsule).
Key Changes:
- Removed duplicate class definitions from all module files
- Fixed import paths (e.g., FrequenceModule now uses correct relative imports)
- Replaced BatchProcessor with instance-level
batch_sizeattributes where needed - Fixed an escape sequence in FactorielleModule.py
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
py_stats_toolkit/stats/variance/VarianceModule.py |
Removed duplicate class definition |
py_stats_toolkit/stats/temporelle/TimeSeriesModule.py |
Removed duplicate class definition, removed batch_size parameter from __init__, removed BatchProcessor import |
py_stats_toolkit/stats/regression/RegressionModule.py |
Removed duplicate class definition |
py_stats_toolkit/stats/probabilistes/ProbabilistesModule.py |
Removed duplicate class definition, removed BatchProcessor import, added self.batch_size instance variable to replace BatchProcessor functionality |
py_stats_toolkit/stats/frequence/FrequenceModule.py |
Removed duplicate class definition, fixed import paths from absolute to correct relative imports |
py_stats_toolkit/stats/factorielle/FactorielleModule.py |
Removed duplicate class definition, fixed string escape sequence in line 160 |
py_stats_toolkit/stats/descriptives/MoyenneGlissanteModule.py |
Removed duplicate class definition, removed BatchProcessor import, simplified processing logic but left unused code and redundant conditionals |
py_stats_toolkit/stats/correlation/CorrelationModule.py |
Removed duplicate class definition |
Comments suppressed due to low confidence (2)
py_stats_toolkit/stats/descriptives/MoyenneGlissanteModule.py:40
- The
_process_chunkmethod is no longer used after the refactoring. Consider removing this dead code.
def _process_chunk(self, chunk):
"""Traite un chunk de données."""
return pd.Series(chunk).rolling(window=self.window_size).mean()
py_stats_toolkit/stats/descriptives/MoyenneGlissanteModule.py:71
- The conditional logic is redundant. Both branches (lines 63-64 and 65-66) produce the same result type (a rolling mean Series), and the subsequent check (lines 68-71) then converts it to a Series again. Consider simplifying by converting to Series once at the beginning and applying
rolling().mean()directly.
# Calculate rolling mean
self.result = series_data.rolling(window=window_size).mean()
return self.result
def get_window_size(self):
"""Retourne la taille de la fenêtre utilisée."""
return self.window_size
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.



Refactoring Plan: Class Inheritance Structure
Analysis Results
Current Inheritance Structure
All modules now have clean 2-level inheritance:
Refactoring Checklist
Phase 1: Fix Critical Issues ✅
Phase 2: Verify Structure Compliance ✅
Phase 3: Testing & Documentation
Original prompt
This pull request was created as a result of the following prompt from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.