You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
individual_tests = [
re.sub(r"\.py$", "", test) + ".py" for test in tests if not test.endswith('*')]
Running flynt --stdout --transform-concats file.py or cat file.py | flynt --transform-concats - on a file that contains this causes an empty output.
Running flynt --transform-concats file.py on such a file causes the file to be untouched, even if it contains "%" formatted strings to be updated.
A sample to reproduce the issue:
import re
tests = [
"a.py",
"b.py",
"c*",
]
spam0 = "%s %s" % ("foo", "bar")
individual_tests = [
re.sub(r"\.py$", "", test) + ".py" for test in tests if not test.endswith('*')]
spam = "%s %s" % ("foo", "bar")
The text was updated successfully, but these errors were encountered:
Fabcien
pushed a commit
to Bitcoin-ABC/bitcoin-abc
that referenced
this issue
Apr 5, 2023
Summary:
See ikamensh/flynt#173
The linter will still be able to convert "%"-formatted strings and `"{}".format(` occurences to f-strings.
It will no longer simplify string concatenations.
Test Plan:
Touch test_runner.py and make sure `arc lint` does not clear the file.
Add actual lines that flynt will update, and check that the changes from `arc lint` is as expected. E.g:
```
diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py
index 38ac427eeb..079079e3bb 100755
--- a/test/functional/test_runner.py
+++ b/test/functional/test_runner.py
@@ -163,6 +163,9 @@ class TestCase:
self.test_num = test_num
self.failfast_event = failfast_event
self.flags = flags
+ a = "%s " % "toto"
+ b = "{}".format(a)
+ print(a + b)
def run(self):
if self.failfast_event.is_set():
```
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D13573
Flynt does not seem to be able to process this file when option
--transform-concats
is set: https://reviews.bitcoinabc.org/source/bitcoin-abc/browse/master/test/functional/test_runner.pyI narrowed the issue down to these lines:
Running
flynt --stdout --transform-concats file.py
orcat file.py | flynt --transform-concats -
on a file that contains this causes an empty output.Running
flynt --transform-concats file.py
on such a file causes the file to be untouched, even if it contains "%" formatted strings to be updated.A sample to reproduce the issue:
The text was updated successfully, but these errors were encountered: