more readable code

This commit is contained in:
Jakub Trllo 2024-08-19 17:11:01 +02:00
parent e271b06c9f
commit 29825b6d0e

View file

@ -898,29 +898,24 @@ class PublishModel:
def get_next_process_func(self) -> partial: def get_next_process_func(self) -> partial:
# Validations of progress before using iterator # Validations of progress before using iterator
# - same conditions may be inside iterator but they may be used # Any unexpected error happened
# only in specific cases (e.g. when it happens for a first time) # - everything should stop
if self._publish_has_crashed:
return partial(self.stop_publish)
# Stop if validation is over and validation errors happened
# or publishing should stop at validation
if ( if (
# Any unexpected error happened self._publish_has_validated
# - everything should stop and (
self._publish_has_crashed self._publish_has_validation_errors
# Stop if validation is over and validation errors happened or self._publish_up_validation
# or publishing should stop at validation
or (
self._publish_has_validated
and (
self._publish_has_validation_errors
or self._publish_up_validation
)
) )
): ):
item = partial(self.stop_publish) return partial(self.stop_publish)
# Everything is ok so try to get new processing item # Everything is ok so try to get new processing item
else: return next(self._main_thread_iter)
item = next(self._main_thread_iter)
return item
def stop_publish(self): def stop_publish(self):
if self._publish_is_running: if self._publish_is_running: