dgzlopes / cloud-detect

Module that determines a host's cloud provider.
https://pypi.org/project/cloud-detect/
MIT License
35 stars 13 forks source link

Close file handlers on all check_vendor_file() methods #13

Closed arossert closed 2 years ago

arossert commented 2 years ago

When reading the self.vendor_file the file is not closed, I will be happy to create a PR to use Path.read_text() instead of the open() call so the file will be closed.

arossert commented 2 years ago

Also it is a good idea to think of use async file operations with aiofiles or aiofile

kshivakumar commented 2 years ago

Also it is a good idea to think of use async file operations with aiofiles or aiofile

@arossert Reading files is pretty quick since they are present(or absent) locally unlike api calls that have network latency. IMO it's not worth the effort to use async for file operations that would result in additional dependencies and code complexity. The current detection speed is more than sufficient.

arossert commented 2 years ago

Would you accept the PR that wil close the file (using the read_text() function) ?

arossert commented 2 years ago

Created a PR #14 😃

dgzlopes commented 2 years ago

Thanks for the work folks! Closing this, as #14 has been merged.