Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix circular imports during loader registration #911

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Horofic
Copy link
Contributor

@Horofic Horofic commented Oct 17, 2024

(DIS-3463)

Fixes #910

Copy link
Member

@Schamper Schamper left a comment

Choose a reason for hiding this comment

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

Can you diagnose the root cause of the circular import? Because this seems to have always worked fine, so the PR title is not necessarily correct. This is bypassing the circular import issue with moving all Target imports to type checking.

dissect/target/loader.py Outdated Show resolved Hide resolved
from dissect.target.target import Target

if TYPE_CHECKING:
from dissect.target import Target
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
from dissect.target import Target
from dissect.target.target import Target

I'd make it the full import everywhere.

Copy link

codecov bot commented Oct 17, 2024

Codecov Report

Attention: Patch coverage is 72.50000% with 22 lines in your changes missing coverage. Please review.

Project coverage is 76.60%. Comparing base (cb69261) to head (18b0c8b).

Files with missing lines Patch % Lines
dissect/target/loaders/ab.py 75.00% 1 Missing ⚠️
dissect/target/loaders/cb.py 0.00% 1 Missing ⚠️
dissect/target/loaders/cyber.py 75.00% 1 Missing ⚠️
dissect/target/loaders/local.py 92.85% 1 Missing ⚠️
dissect/target/loaders/log.py 66.66% 1 Missing ⚠️
dissect/target/loaders/mqtt.py 66.66% 1 Missing ⚠️
dissect/target/loaders/multiraw.py 75.00% 1 Missing ⚠️
dissect/target/loaders/overlay.py 75.00% 1 Missing ⚠️
dissect/target/loaders/ovf.py 75.00% 1 Missing ⚠️
dissect/target/loaders/raw.py 75.00% 1 Missing ⚠️
... and 12 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #911      +/-   ##
==========================================
- Coverage   76.65%   76.60%   -0.05%     
==========================================
  Files         316      316              
  Lines       27101    27140      +39     
==========================================
+ Hits        20774    20791      +17     
- Misses       6327     6349      +22     
Flag Coverage Δ
unittests 76.60% <72.50%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

Fix circular imports error during Loader registration
2 participants