From 65c0c7e60d24cc9191f74cf90f47c84674a0fc8a Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Fri, 17 Jan 2020 11:46:58 +0200 Subject: [PATCH] logger: state: use lazy formatting --- dvc/state.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dvc/state.py b/dvc/state.py index 4b5b0889b..88e5c8107 100644 --- a/dvc/state.py +++ b/dvc/state.py @@ -141,7 +141,7 @@ class State(object): # pylint: disable=too-many-instance-attributes def _fetchall(self): ret = self.cursor.fetchall() - logger.debug("fetched: {}".format(ret)) + logger.debug("fetched: {}", ret) return ret def _to_sqlite(self, num): @@ -181,11 +181,12 @@ class State(object): # pylint: disable=too-many-instance-attributes __version__, self.VERSION, version ) elif version < self.VERSION: - msg = ( + logger.warning( "State file version '{}' is too old. " - "Reformatting to the current version '{}'." + "Reformatting to the current version '{}'.", + version, + self.VERSION, ) - logger.warning(msg.format(version, self.VERSION)) cmd = "DROP TABLE IF EXISTS {};" self._execute(cmd.format(self.STATE_TABLE)) self._execute(cmd.format(self.STATE_INFO_TABLE)) @@ -466,7 +467,7 @@ class State(object): # pylint: disable=too-many-instance-attributes actual_mtime, _ = get_mtime_and_size(path, self.repo.tree) if inode == actual_inode and mtime == actual_mtime: - logger.debug("Removing '{}' as unused link.".format(path)) + logger.debug("Removing '{}' as unused link.", path) remove(path) unused.append(relpath)