mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-11 23:10:10 +01:00
Switch uses of %r to %s with quotes to avoid escaped backslashes in logs, especially in windows paths
This commit is contained in:
committed by
Ruslan Kuprieiev
parent
03b789e206
commit
c59f935cc5
+1
-1
@@ -187,4 +187,4 @@ def _find_or_create_user_id():
|
||||
return user_id
|
||||
|
||||
except LockError:
|
||||
logger.debug("Failed to acquire %r", lockfile)
|
||||
logger.debug("Failed to acquire '%s'", lockfile)
|
||||
|
||||
@@ -16,7 +16,7 @@ class CmdFreezeBase(CmdBase):
|
||||
try:
|
||||
func(target)
|
||||
except DvcException:
|
||||
logger.exception("failed to %s %r", name, target)
|
||||
logger.exception("failed to %s '%s'", name, target)
|
||||
ret = 1
|
||||
return ret
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class CmdGetUrl(CmdBaseNoRepo):
|
||||
Repo.get_url(self.args.url, out=self.args.out, jobs=self.args.jobs)
|
||||
return 0
|
||||
except DvcException:
|
||||
logger.exception("failed to get %r", self.args.url)
|
||||
logger.exception("failed to get '%s'", self.args.url)
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class CmdList(CmdBaseNoRepo):
|
||||
ui.write("\n".join(entries))
|
||||
return 0
|
||||
except DvcException:
|
||||
logger.exception("failed to list %r", self.args.url)
|
||||
logger.exception("failed to list '%s'", self.args.url)
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -187,7 +187,7 @@ class Config(dict):
|
||||
filename = self.files[level]
|
||||
fs = self._get_fs(level)
|
||||
|
||||
logger.debug("Writing %r.", filename)
|
||||
logger.debug("Writing '%s'.", filename)
|
||||
|
||||
fs.makedirs(os.path.dirname(filename))
|
||||
|
||||
|
||||
+2
-2
@@ -81,7 +81,7 @@ def _spawn_posix(cmd, env):
|
||||
|
||||
|
||||
def _spawn(cmd, env):
|
||||
logger.debug("Trying to spawn %r", cmd)
|
||||
logger.debug("Trying to spawn '%s'", cmd)
|
||||
|
||||
if os.name == "nt":
|
||||
_spawn_windows(cmd, env)
|
||||
@@ -90,7 +90,7 @@ def _spawn(cmd, env):
|
||||
else:
|
||||
raise NotImplementedError
|
||||
|
||||
logger.debug("Spawned %r", cmd)
|
||||
logger.debug("Spawned '%s'", cmd)
|
||||
|
||||
|
||||
def daemon(args):
|
||||
|
||||
+1
-1
@@ -197,7 +197,7 @@ class SingleStageFile(FileMixin):
|
||||
assert not isinstance(stage, PipelineStage)
|
||||
if self.verify:
|
||||
check_dvcfile_path(self.repo, self.path)
|
||||
logger.debug("Saving information to %r.", relpath(self.path))
|
||||
logger.debug("Saving information to '%s'.", relpath(self.path))
|
||||
dump_yaml(self.path, serialize.to_single_stage_file(stage))
|
||||
self.repo.scm_context.track_file(self.relpath)
|
||||
|
||||
|
||||
@@ -348,7 +348,7 @@ class BaseExecutor(ABC):
|
||||
|
||||
if git_remote == dvc.root_dir:
|
||||
logger.warning(
|
||||
"%r points to the current Git repo, experiment "
|
||||
"'%s' points to the current Git repo, experiment "
|
||||
"Git refs will not be pushed. But DVC cache and run cache "
|
||||
"will automatically be pushed to the default DVC remote "
|
||||
"(if any) on each experiment commit.",
|
||||
@@ -604,7 +604,7 @@ class BaseExecutor(ABC):
|
||||
except BaseException as exc: # pylint: disable=broad-except
|
||||
logger.warning(
|
||||
"Something went wrong while auto pushing experiment "
|
||||
"to the remote %r: %s",
|
||||
"to the remote '%s': %s",
|
||||
git_remote,
|
||||
exc,
|
||||
)
|
||||
|
||||
@@ -82,7 +82,7 @@ def _pull(
|
||||
force: bool,
|
||||
) -> Mapping[SyncStatus, List["ExpRefInfo"]]:
|
||||
refspec_list = [f"{exp_ref}:{exp_ref}" for exp_ref in refs]
|
||||
logger.debug("git pull experiment %r -> '%s'", git_remote, refspec_list)
|
||||
logger.debug("git pull experiment '%s' -> '%s'", git_remote, refspec_list)
|
||||
|
||||
with TqdmGit(desc="Fetching git refs") as pbar:
|
||||
results: Mapping[str, SyncStatus] = repo.scm.fetch_refspecs(
|
||||
|
||||
@@ -85,7 +85,7 @@ def _push(
|
||||
from ...scm import GitAuthError
|
||||
|
||||
refspec_list = [f"{exp_ref}:{exp_ref}" for exp_ref in refs]
|
||||
logger.debug("git push experiment %r -> '%s'", refspec_list, git_remote)
|
||||
logger.debug("git push experiment '%s' -> '%s'", refspec_list, git_remote)
|
||||
|
||||
with TqdmGit(desc="Pushing git refs") as pbar:
|
||||
try:
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ def gc(
|
||||
|
||||
removed = ogc(odb, used_obj_ids, jobs=jobs)
|
||||
if not removed:
|
||||
logger.info("No unused %r cache to remove.", scheme)
|
||||
logger.info("No unused '%s' cache to remove.", scheme)
|
||||
|
||||
if not cloud:
|
||||
return
|
||||
|
||||
@@ -323,7 +323,7 @@ class Stage(params.StageParams):
|
||||
status = dep.status()
|
||||
if status:
|
||||
logger.debug(
|
||||
"Dependency '%s' of %s changed because it is %r.",
|
||||
"Dependency '%s' of %s changed because it is '%s'.",
|
||||
dep,
|
||||
self,
|
||||
status[str(dep)],
|
||||
@@ -337,7 +337,7 @@ class Stage(params.StageParams):
|
||||
status = out.status()
|
||||
if status:
|
||||
logger.debug(
|
||||
"Output '%s' of %s changed because it is %r.",
|
||||
"Output '%s' of %s changed because it is '%s'.",
|
||||
out,
|
||||
self,
|
||||
status[str(out)],
|
||||
@@ -452,7 +452,7 @@ class Stage(params.StageParams):
|
||||
m = None
|
||||
else:
|
||||
m = compute_md5(self)
|
||||
logger.debug("Computed %s md5: %r", self, m)
|
||||
logger.debug("Computed %s md5: '%s'", self, m)
|
||||
return m
|
||||
|
||||
def save(self, allow_missing=False):
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ def find_pager():
|
||||
|
||||
def pager(text: str) -> None:
|
||||
_pager = find_pager()
|
||||
logger.trace("Using pager: %r", _pager) # type: ignore[attr-defined]
|
||||
logger.trace("Using pager: '%s'", _pager) # type: ignore[attr-defined]
|
||||
make_pager(_pager)(text)
|
||||
|
||||
|
||||
|
||||
+3
-3
@@ -37,7 +37,7 @@ class Updater:
|
||||
ctime = os.path.getmtime(self.updater_file)
|
||||
outdated = time.time() - ctime >= self.TIMEOUT
|
||||
if outdated:
|
||||
logger.debug("%r is outdated", self.updater_file)
|
||||
logger.debug("'%s' is outdated", self.updater_file)
|
||||
return outdated
|
||||
|
||||
def _with_lock(self, func, action):
|
||||
@@ -48,7 +48,7 @@ class Updater:
|
||||
func()
|
||||
except LockError:
|
||||
logger.debug(
|
||||
"Failed to acquire %r before %s updates",
|
||||
"Failed to acquire '%s' before %s updates",
|
||||
self.lock.lockfile,
|
||||
action,
|
||||
)
|
||||
@@ -79,7 +79,7 @@ class Updater:
|
||||
latest = info["version"]
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
logger.debug(
|
||||
"%r is not a valid json: %s", self.updater_file, exc
|
||||
"'%s' is not a valid json: %s", self.updater_file, exc
|
||||
)
|
||||
self.fetch()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user