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

refactor: Specified imports of file_utils in __init__.py #447

Merged
merged 1 commit into from
Aug 30, 2021

Conversation

zalakbhalani
Copy link
Contributor

Fixed error while importing functions like is_tf_available and is_torch_available because it is in file_utils.py file.

@fg-mindee
Copy link
Contributor

fg-mindee commented Aug 29, 2021

Hi @zalakbhalani 👋

Thanks for the PR!
While it's true that those functions are located in doctr/file_utils.py, we took some precaution to include this in the high-level __init__.py (cf. https://github.com/mindee/doctr/blob/main/doctr/__init__.py#L1)

As you can see, without any modification of the codebase, the following snippet does work:

from doctr import is_tf_available, is_torch_available

If you manage to run the snippet, I'm not sure this PR is a "fix" as stated in the title 😅 If not, could you open an issue showing the error that you got?

@fg-mindee fg-mindee added the awaiting response Waiting for feedback label Aug 29, 2021
@zalakbhalani
Copy link
Contributor Author

Oh ok. Thanks for the update. I faced this issue when I used doctr v0.2.1. I forgot to upgrade to newer versions. It is not a fix but can you approve the PR for the readability because at doctr/models/backbones/mobilenet/init.py you used from doctr.file_utils import is_tf_available, is_torch_available this confuses me.

@fg-mindee fg-mindee self-assigned this Aug 29, 2021
@fg-mindee fg-mindee added type: enhancement Improvement module: models Related to doctr.models and removed awaiting response Waiting for feedback labels Aug 29, 2021
@fg-mindee fg-mindee added this to the 0.4.0 milestone Aug 29, 2021
@fg-mindee fg-mindee changed the title fix: Change __init__.py files for functions present in file_utils.py refactor: Specified imports of file_utils in __init__.py Aug 29, 2021
@codecov
Copy link

codecov bot commented Aug 29, 2021

Codecov Report

Merging #447 (171c0ff) into main (369a787) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #447      +/-   ##
==========================================
+ Coverage   95.84%   95.87%   +0.02%     
==========================================
  Files          96       96              
  Lines        3997     3997              
==========================================
+ Hits         3831     3832       +1     
+ Misses        166      165       -1     
Flag Coverage Δ
unittests 95.87% <100.00%> (+0.02%) ⬆️

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

Impacted Files Coverage Δ
doctr/models/backbones/resnet/__init__.py 100.00% <100.00%> (ø)
doctr/models/backbones/vgg/__init__.py 100.00% <100.00%> (ø)
doctr/models/recognition/sar/__init__.py 100.00% <100.00%> (ø)
...dels/detection/differentiable_binarization/base.py 91.97% <0.00%> (+0.61%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 369a787...171c0ff. Read the comment docs.

@fg-mindee fg-mindee self-requested a review August 30, 2021 09:21
Copy link
Contributor

@fg-mindee fg-mindee left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

@fg-mindee fg-mindee merged commit d2fef17 into mindee:main Aug 30, 2021
@zalakbhalani
Copy link
Contributor Author

Thank you

@zalakbhalani zalakbhalani deleted the fixed-init-files branch August 30, 2021 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: models Related to doctr.models type: enhancement Improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants