Skip to content

Conversation

@MoralCode
Copy link
Contributor

Description
This PR takes two identical functions found in the codebase and refactors them to both import that function from the utils.py file in the application module

Signed commits

  • Yes, I signed my commits.

Signed-off-by: Adrian Edwards <adredwar@redhat.com>
@sgoggins sgoggins added the bug-fix Fixes a bug label Jul 18, 2025
@MoralCode MoralCode removed the bug-fix Fixes a bug label Jul 18, 2025
@MoralCode
Copy link
Contributor Author

i wouldnt exactly call this a bug fix, more just cleanup of potentially old tech debt or something - this doesnt fix anything (augur should operate exactly the same with or without this) - it just helps make the code more maintainable

@Ulincsys
Copy link
Contributor

I think that the preferable location for this function would be in the db/lib.py file. The augur.application.db module is intended to be independent, and so it should not import anything from parent or sibling modules.

We struggled a lot for a long time with circular imports, and the practice of isolating this module was intended to fix that. So, instead, it's better for functionality required by the module to be included in the module, and anything outside of the module that needs it should import it from db/.

@sgoggins sgoggins requested review from JohnStrunk and Ulincsys July 23, 2025 20:16
@sgoggins
Copy link
Member

@MoralCode : Have you seen @Ulincsys 's comment?

@sgoggins
Copy link
Member

I think that the preferable location for this function would be in the db/lib.py file. The augur.application.db module is intended to be independent, and so it should not import anything from parent or sibling modules.

We struggled a lot for a long time with circular imports, and the practice of isolating this module was intended to fix that. So, instead, it's better for functionality required by the module to be included in the module, and anything outside of the module that needs it should import it from db/.

This comment ^ @MoralCode

@MoralCode
Copy link
Contributor Author

Yep, just been distracted and haven't gotten around to moving the function

Signed-off-by: Adrian Edwards <adredwar@redhat.com>
@MoralCode
Copy link
Contributor Author

Oops, I don't think I was thinking when I made the code change, so I ended up moving it to db.utils.

It seems like it's a pretty standalone utility function, so it seems like it fits well there

Copy link
Contributor

@Ulincsys Ulincsys left a comment

Choose a reason for hiding this comment

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

LGTM

@sgoggins sgoggins merged commit 6cd41f6 into chaoss:main Jul 29, 2025
13 of 14 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