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

os: Fix DirEntry is_file and is_dir function #2649

Merged
merged 1 commit into from
May 16, 2021
Merged

os: Fix DirEntry is_file and is_dir function #2649

merged 1 commit into from
May 16, 2021

Conversation

deantvv
Copy link
Contributor

@deantvv deantvv commented May 15, 2021

Change perform_on_metadata to fit python document and tests.

From os.DirEntry.is_dir()

Return True if this entry is a directory or a symbolic link pointing to a directory;
return False if the entry is or points to any other kind of file, or if it doesn’t exist anymore.
...
This method can raise OSError, such as PermissionError, but FileNotFoundError is caught and not raised.

Related to #1175

Change `perform_on_metadata` to fit python document and tests.

From python document ->
> Return True if this entry is a directory or a symbolic link pointing to a directory;
> return False if the entry is or points to any other kind of file, or if it doesn’t exist anymore.
> ...
> This method can raise OSError, such as PermissionError, but FileNotFoundError is caught and not raised.
> - [python doc](https://docs.python.org/3/library/os.html?highlight=direntry#os.DirEntry.is_dir)
Copy link
Member

@coolreader18 coolreader18 left a comment

Choose a reason for hiding this comment

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

Nice, thank you for contributing!

@coolreader18 coolreader18 merged commit 2bcf7d4 into RustPython:master May 16, 2021
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.

2 participants