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

Type warning for fs.create_file using pathlib.Path #648

Closed
hofbi opened this issue Nov 16, 2021 · 4 comments
Closed

Type warning for fs.create_file using pathlib.Path #648

hofbi opened this issue Nov 16, 2021 · 4 comments

Comments

@hofbi
Copy link
Contributor

hofbi commented Nov 16, 2021

Thank you for this great project. I use it a lot in my tests.

If I use fs.create_file with a pathlib.Path my IDE shows me the warning _Expected type 'AnyStr', got 'Path' instead _.
Everything still works fine, so I just wanted to report that the warning exists.

According to the definition def create_file(self, file_path: AnyStr, ...) the function expects AnyStr. I guess the warning should be fixed using AnyPath as for the def create_dir(self, directory_path: AnyPath, ...)

@mrbean-bremen
Copy link
Member

Thanks for the report! Actually the correct typing is something that is not finished yet and is on my to-do list, I just didn't get to it for some time. Especially there are several places where AnyStr should be replaced by AnyPath, but I couldn't get it to work correctly at the first try - it is not as straightforward as I would have hoped, but I will see that I can get back to it in the near future.

@hofbi
Copy link
Contributor Author

hofbi commented Nov 16, 2021

Ok, then I guess it is related to #599

@mrbean-bremen
Copy link
Member

Yes, correct!

mrbean-bremen added a commit that referenced this issue Nov 16, 2021
github-actions bot pushed a commit that referenced this issue Nov 16, 2021
@mrbean-bremen
Copy link
Member

Turned out that fixing create_file was not a problem at all (contrary to most of the other methods), so I fixed this separately.

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

No branches or pull requests

2 participants