keras-team / keras-preprocessing

Utilities for working with image data, text data, and sequence data.
Other
1.02k stars 444 forks source link

List valid filenames in directory efficiency #277

Closed itaihay closed 4 years ago

itaihay commented 4 years ago

Summary

In the utils._list_valid_filenames_in_directory function, when providing a 'split' tuple, the functions calls the list() function twice: once with the len() function and another to save the split list.

This PR changes the code so that the list would just be saved beforehand. A little change for better readability and efficiency

Related Issues

PR Overview

itaihay commented 4 years ago

Hi guys. This is my first public PR ever so please let me know if there are any newcomer problems with it. It's quite simple so I hope everything is good.

Dref360 commented 4 years ago

Hello! You have some PEP8 errors. To find them you can run py.test --pep8 -m pep8 See our contribution guidelines: https://github.com/keras-team/keras-preprocessing/blob/master/CONTRIBUTING.md

itaihay commented 4 years ago

Hello! You have some PEP8 errors. To find them you can run py.test --pep8 -m pep8 See our contribution guidelines: https://github.com/keras-team/keras-preprocessing/blob/master/CONTRIBUTING.md

Hello Frédéric, thank you for the reply. The PEP8 issue is now corrected.

itaihay commented 4 years ago

@Dref360 Passed the testing