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

Missing check for dir in the 'else' clause #1110

Merged
merged 6 commits into from
Jun 29, 2021
Merged

Conversation

achaiah
Copy link
Contributor

@achaiah achaiah commented Jun 18, 2021

Motivation

Fixing issue when recursively scanning directories with filenames starting with '.' Without this fix, the if not entry.name.startswith('.') and entry.is_file() logic falls through to the else clause which in the current code base will error out as it encounters '.' files (e.g. .DS_Store)

Modification

Add a check to make sure we only recurse on directories (and ignore '.' files)

BC-breaking (Optional)

No

Use cases (Optional)

N/A

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  3. If the modification has potential influence on downstream projects, this PR should be tested with downstream projects, like MMDet or MMCls.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

Fixing issue when recursively scanning directories with filenames starting with '.'  Without this fix, the `if not entry.name.startswith('.') and entry.is_file()` logic falls through to the `else` clause which in the current code base will error out as it encounters '.' files (e.g. .DS_Store)
@CLAassistant
Copy link

CLAassistant commented Jun 18, 2021

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Jun 21, 2021

Codecov Report

Merging #1110 (39913ba) into master (76d9bf1) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1110   +/-   ##
=======================================
  Coverage   67.96%   67.97%           
=======================================
  Files         159      159           
  Lines       10416    10413    -3     
  Branches     1896     1895    -1     
=======================================
- Hits         7079     7078    -1     
+ Misses       2969     2968    -1     
+ Partials      368      367    -1     
Flag Coverage Δ
unittests 67.97% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
mmcv/utils/path.py 75.51% <100.00%> (+2.43%) ⬆️

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 76d9bf1...39913ba. Read the comment docs.

mmcv/utils/path.py Outdated Show resolved Hide resolved
@ZwwWayne
Copy link
Collaborator

lint failed. Any progress @achaiah ? We are considering merge 1110 before the next release.

@achaiah
Copy link
Contributor Author

achaiah commented Jun 28, 2021

lint failed. Any progress @achaiah ? We are considering merge 1110 before the next release.

I updated the code per comments. Not sure if lint will still complain about line length. TBH that's a requirement that should be removed. We don't work in terminals with 80 chars length any more :)

mmcv/utils/path.py Outdated Show resolved Hide resolved
@zhouzaida
Copy link
Collaborator

you can refer to https://github.com/open-mmlab/mmcv/blob/master/CONTRIBUTING.md to fix the lint

@zhouzaida
Copy link
Collaborator

hi @achaiah, thanks for your contribution. I push a commit to fix the indenterror and CI will be passed

@ZwwWayne ZwwWayne merged commit 21845db into open-mmlab:master Jun 29, 2021
@achaiah achaiah deleted the patch-1 branch June 29, 2021 13:46
@OpenMMLab-Coodinator
Copy link

Hi @achaiah !First of all, we want to express our gratitude for your significant PR in this project. Your contribution is highly appreciated, and we are grateful for your efforts in helping improve this open-source project during your personal time. We believe that many developers will benefit from your PR.

We would also like to invite you to join our Special Interest Group (SIG) private channel on Discord, where you can share your experiences, ideas, and build connections with like-minded peers. To join the SIG channel, simply message moderator— OpenMMLab on Discord or briefly share your open-source contributions in the #introductions channel and we will assist you. Look forward to seeing you there! Join us :https://discord.gg/UjgXkPWNqA

If you have WeChat account,welcome to join our community on WeChat. You can add our assistant :openmmlabwx. Please add "mmsig + Github ID" as a remark when adding friends:)
Thank you again for your contribution❤

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.

5 participants