Skip to content

Commit 23a1f8c

Browse files
committed
chore: replace use of %r with %s when possible
1 parent edfeae5 commit 23a1f8c

File tree

17 files changed

+61
-59
lines changed

17 files changed

+61
-59
lines changed

src/grizzly/args.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,11 @@ def sanity_check(self, args: Namespace) -> None:
349349
for asset, path in args.asset:
350350
if not supported_assets or asset not in supported_assets:
351351
self.parser.error(
352-
f"Asset {asset!r} not supported by target {args.platform!r}"
352+
f"Asset '{asset}' not supported by target '{args.platform}'"
353353
)
354354
if not exists(path):
355355
self.parser.error(
356-
f"Failed to add asset {asset!r} cannot find {path!r}"
356+
f"Failed to add asset '{asset}' cannot find '{path}'"
357357
)
358358

359359
if args.time_limit is not None and args.time_limit < 1:

src/grizzly/common/plugins.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ def load_plugin(name: str, group: str, base_type: type) -> Any:
3232
for entry in iter_entry_points(group):
3333
if entry.name == name:
3434
plugin = entry.load()
35-
LOG.debug("loading %r (%s)", name, base_type.__name__)
35+
LOG.debug("loading '%s' (%s)", name, base_type.__name__)
3636
break
3737
else:
38-
raise PluginLoadError(f"{name!r} not found in {group!r}")
38+
raise PluginLoadError(f"'{name}' not found in '{group}'")
3939
if not issubclass(plugin, base_type):
40-
raise PluginLoadError(f"{name!r} doesn't inherit from {base_type.__name__}")
40+
raise PluginLoadError(f"'{name}' doesn't inherit from {base_type.__name__}")
4141
return plugin
4242

4343

@@ -51,11 +51,11 @@ def scan_plugins(group: str) -> list[str]:
5151
Names of installed entry points.
5252
"""
5353
found: list[str] = []
54-
LOG.debug("scanning %r", group)
54+
LOG.debug("scanning '%s'", group)
5555
for entry in iter_entry_points(group):
5656
if entry.name in found:
5757
# not sure if this can even happen
58-
raise PluginLoadError(f"Duplicate entry {entry.name!r} in {group!r}")
58+
raise PluginLoadError(f"Duplicate entry '{entry.name}' in '{group}'")
5959
found.append(entry.name)
6060
return found
6161

src/grizzly/common/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ def run(
394394
else:
395395
# something is wrong so close the target
396396
# previous iteration put target in a bad state?
397-
LOG.debug("entry point not served (%r)", testcase.entry_point)
397+
LOG.debug("entry point not served (%s)", testcase.entry_point)
398398
self._target.close()
399399
# detect startup failures
400400
if self.initial:

src/grizzly/common/stack_hasher.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ def __str__(self) -> str:
6161
if self.stack_line is not None:
6262
out.append(f"{int(self.stack_line):02d}")
6363
if self.function is not None:
64-
out.append(f"function: {self.function!r}")
64+
out.append(f"function: '{self.function}'")
6565
if self.location is not None:
66-
out.append(f"location: {self.location!r}")
66+
out.append(f"location: '{self.location}'")
6767
if self.offset is not None:
68-
out.append(f"offset: {self.offset!r}")
68+
out.append(f"offset: '{self.offset}'")
6969
return " - ".join(out)
7070

7171
@classmethod
@@ -444,7 +444,7 @@ def from_text(cls, input_text: str, major_depth: int = MAJOR_DEPTH) -> Stack:
444444
else:
445445
frame = parser_class.from_line(line)
446446
except Exception: # pragma: no cover
447-
LOG.error("Error calling from_line() with: %r", line)
447+
LOG.error("Error calling from_line() with: '%s'", line)
448448
raise
449449
if frame is None:
450450
continue

src/grizzly/common/storage.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def add_from_file(
200200
else:
201201
url_path = self.sanitize_path(file_name)
202202
if url_path in self:
203-
raise TestFileExists(f"{url_path!r} exists in test")
203+
raise TestFileExists(f"'{url_path}' exists in test")
204204

205205
dst_file = self._root / url_path
206206
# don't move/copy data is already in place
@@ -546,12 +546,12 @@ def sanitize_path(path: str) -> str:
546546
"""
547547
# check for missing filename or path containing drive letter (Windows)
548548
if split(path)[-1] in ("", ".", "..") or ":" in path:
549-
raise ValueError(f"invalid path {path!r}")
549+
raise ValueError(f"invalid path '{path}'")
550550
# normalize path
551551
path = normpath(path).replace("\\", "/")
552552
# check normalized path does not resolve to location outside of '.'
553553
if path.startswith("../"):
554-
raise ValueError(f"invalid path {path!r}")
554+
raise ValueError(f"invalid path '{path}'")
555555
return path.lstrip("/")
556556

557557

@@ -591,7 +591,7 @@ def load_testcases(
591591
test.assets.clear()
592592
test.assets_path = None
593593
LOG.debug(
594-
"loaded TestCase(s): %d, assets: %r, env vars: %r",
594+
"loaded TestCase(s): %d, assets: %s, env vars: %s",
595595
len(tests),
596596
asset_mgr is not None,
597597
env_vars is not None,

src/grizzly/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ def main(args: Namespace) -> int:
126126
reporter.display_logs = args.smoke_test or reporter.display_logs
127127

128128
if args.limit:
129-
LOG.info("%r iteration(s) will be attempted", args.limit)
129+
LOG.info("%d iteration(s) will be attempted", args.limit)
130130
if args.runtime:
131-
LOG.info("Runtime is limited to %rs", args.runtime)
131+
LOG.info("Runtime is limited to %ds", args.runtime)
132132

133133
# set 'auto_close=1' so the client error pages (code 4XX) will
134134
# call 'window.close()' after a second.

src/grizzly/reduce/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,8 +654,8 @@ def run(
654654
except KeyboardInterrupt:
655655
if best_results:
656656
LOG.warning(
657-
"Ctrl+C detected, best reduction so far reported as %r",
658-
self._status.last_reports,
657+
"Ctrl+C detected, best reduction so far reported as '%s'",
658+
", ".join(self._status.last_reports),
659659
)
660660
raise
661661
finally:

src/grizzly/reduce/strategies/lithium.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def __iter__(self) -> Generator[list[TestCase]]:
100100
reduce_queue.sort() # not necessary, but helps make tests more predictable
101101
while reduce_queue:
102102
LOG.debug(
103-
"Reduce queue: %r",
103+
"Reduce queue: '%s'",
104104
", ".join(
105105
str(x.relative_to(self._testcase_root)) for x in reduce_queue
106106
),
@@ -145,15 +145,15 @@ def __iter__(self) -> Generator[list[TestCase]]:
145145
self._tried.add(self._calculate_testcase_hash())
146146
else:
147147
LOG.debug(
148-
"files being reduced before: %r",
148+
"files being reduced before: '%s'",
149149
", ".join(
150150
str(x.relative_to(self._testcase_root))
151151
for x in self._files_to_reduce
152152
),
153153
)
154154
self.rescan_files_to_reduce(testcases)
155155
LOG.debug(
156-
"files being reduced after: %r",
156+
"files being reduced after: '%s'",
157157
", ".join(
158158
str(x.relative_to(self._testcase_root))
159159
for x in self._files_to_reduce

src/grizzly/replay/replay.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ def harness_fn(_: str) -> bytes: # pragma: no cover
394394
assert not expect_hang
395395
assert self._signature is None
396396
LOG.debug(
397-
"no signature given, using short sig %r",
397+
"no signature given, using short sig '%s'",
398398
report.short_signature,
399399
)
400400
if runner.startup_failure:
@@ -447,7 +447,7 @@ def harness_fn(_: str) -> bytes: # pragma: no cover
447447
self.status.ignored += 1
448448
if run_result.timeout:
449449
LOG.info(
450-
"Result: Ignored (%d); timeout, idle: %r",
450+
"Result: Ignored (%d); timeout, idle: %s",
451451
self.status.ignored,
452452
run_result.idle,
453453
)
@@ -511,7 +511,7 @@ def harness_fn(_: str) -> bytes: # pragma: no cover
511511
if not success and result.expected:
512512
if not self._any_crash:
513513
LOG.debug(
514-
"%r less than minimum (%d/%d)",
514+
"'%s' less than minimum (%d/%d)",
515515
crash_hash,
516516
result.count,
517517
min_results,

src/grizzly/session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def run(
178178

179179
LOG.debug("calling adapter.setup()")
180180
self.adapter.setup(input_path, self.iomanager.server_map)
181-
LOG.debug("configuring harness (%r)", not no_harness)
181+
LOG.debug("configuring harness (%s)", not no_harness)
182182
harness = None if no_harness else self.adapter.get_harness()
183183
LOG.debug("configuring redirects (w/harness: %s)", harness is not None)
184184
if harness is None:
@@ -298,7 +298,7 @@ def run(
298298
self.status.ignored += 1
299299
if result.timeout:
300300
LOG.info(
301-
"Ignored - %d; timeout, idle: %r",
301+
"Ignored - %d; timeout, idle: %s",
302302
self.status.ignored,
303303
result.idle,
304304
)

0 commit comments

Comments
 (0)