Skip to content

Conversation

@lachlangrose
Copy link
Member

Description

📝 Thanks for contributing to map2loop!
Please describe the issue that this pull request addresses and summarize the changes you are implementing.
Include relevant motivation and context, if appropriate.
List any new dependencies that are required for this change.

Fixes #(issue)

Type of change

  • Documentation update
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Test improvement

How Has This Been Tested?

Please describe any tests that you ran to verify your changes.
Provide branch name so we can reproduce.

Checklist:

  • This branch is up-to-date with master
  • All gh-action checks are passing
  • I have performed a self-review of my own code
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • My tests run with pytest from the map2loop folder
  • New and existing tests pass locally with my changes

Checklist continued (if PR includes changes to documentation)

  • I have built the documentation locally with make.bat
  • I have built this documentation in docker, following the docker configuration in map2loop/docs
  • I have checked my spelling and grammar

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Sorter class hierarchy by moving data dependencies from the sort() method parameters to the class constructor (__init__()). This is an architectural improvement that follows better object-oriented design principles by making sorters stateful objects that are initialized with their required data rather than receiving it on each method call.

Key Changes:

  • Moved data parameters (unit_relationships, contacts, geology_data, structure_data, dtm_data) from sort() method to __init__() in all Sorter classes
  • Updated the abstract sort() method signature to only accept units parameter
  • Modified project.py to pass data during sorter instantiation and implement fallback logic for None values

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 10 comments.

File Description
map2loop/sorter.py Refactored all Sorter classes to accept data in __init__() and access it via instance variables; updated sort() method signatures; added Optional type hints; fixed logic bug in SorterMaximiseContacts
map2loop/project.py Updated sorter instantiation to pass required data; added fallback logic to inject data into sorters when not provided at initialization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lachlangrose lachlangrose changed the title fix: move extra arguments to init fix: move extra sort arguments to sorter init Nov 26, 2025
Copy link
Member

@rabii-chaarani rabii-chaarani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks all good to me

@rabii-chaarani rabii-chaarani merged commit 3414fec into master Dec 1, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants