From 86a0e2c86354cc3874a524e8f500ac8ee94eb08f Mon Sep 17 00:00:00 2001 From: Francois Chollet Date: Tue, 9 Jan 2018 16:01:46 -0800 Subject: [PATCH] Further formatting fixes --- keras/layers/recurrent.py | 2 +- keras/preprocessing/image.py | 5 +++-- keras/utils/data_utils.py | 11 +++++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/keras/layers/recurrent.py b/keras/layers/recurrent.py index 6179158aacb..f6a51d978a2 100644 --- a/keras/layers/recurrent.py +++ b/keras/layers/recurrent.py @@ -457,7 +457,7 @@ def build(self, input_shape): if self.state_spec is not None: # initial_state was passed in call, check compatibility - if not [spec.shape[-1] for spec in self.state_spec] == state_size: + if [spec.shape[-1] for spec in self.state_spec] != state_size: raise ValueError( 'An initial_state was passed that is not compatible with ' '`cell.state_size`. Received `state_spec`={}; ' diff --git a/keras/preprocessing/image.py b/keras/preprocessing/image.py index 1f1982029cd..e3386d43ae0 100644 --- a/keras/preprocessing/image.py +++ b/keras/preprocessing/image.py @@ -940,10 +940,11 @@ def next(self): def _count_valid_files_in_directory(directory, white_list_formats, follow_links): - """Count files with extension in `white_list_formats` contained in a directory. + """Count files with extension in `white_list_formats` contained in directory. # Arguments - directory: absolute path to the directory containing files to be counted + directory: absolute path to the directory + containing files to be counted white_list_formats: set of strings containing allowed extensions for the files to be counted. follow_links: boolean. diff --git a/keras/utils/data_utils.py b/keras/utils/data_utils.py index 1d8479c455d..72ec8af262f 100644 --- a/keras/utils/data_utils.py +++ b/keras/utils/data_utils.py @@ -515,7 +515,7 @@ def _wait_queue(self): return def _run(self): - """Function to submit request to the executor and queue the `Future` objects.""" + """Submits request to the executor and queue the `Future` objects.""" sequence = list(range(len(self.sequence))) self._send_sequence() # Share the initial sequence while True: @@ -625,10 +625,13 @@ def _data_generator_task(self): while not self._stop_event.is_set(): with self.genlock: try: - if self.queue is not None and self.queue.qsize() < self.max_queue_size: - # On all OSes, avoid **SYSTEMATIC** error in multithreading mode: + if (self.queue is not None and + self.queue.qsize() < self.max_queue_size): + # On all OSes, avoid **SYSTEMATIC** error + # in multithreading mode: # `ValueError: generator already executing` - # => Serialize calls to infinite iterator/generator's next() function + # => Serialize calls to + # infinite iterator/generator's next() function generator_output = next(self._generator) self.queue.put((True, generator_output)) else: