diff options
author | Florian Bruhin <me@the-compiler.org> | 2023-06-26 14:31:55 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2023-06-26 14:39:54 +0200 |
commit | 5fa878c7d190ba227aa05ab01385e640fc7ff42b (patch) | |
tree | b08153e2beb6b798066ee458371cf679e8a7ede9 | |
parent | 93c7fdd60c0f1f0d26415525914fdca997b06c42 (diff) | |
download | qutebrowser-drop-py37.tar.gz qutebrowser-drop-py37.zip |
py38: Run modified pyupgradedrop-py37
Modified to leave f-strings alone for now, and also not do some other
stuff we should do separately:
diff --git i/pyupgrade/_main.py w/pyupgrade/_main.py
index 4292174..37547b3 100644
--- i/pyupgrade/_main.py
+++ w/pyupgrade/_main.py
@@ -294,7 +294,8 @@ def _fix_tokens(contents_text: str) -> str:
token.utf8_byte_offset == 0 and
token.line < 3 and
token.name == 'COMMENT' and
- tokenize.cookie_re.match(token.src)
+ tokenize.cookie_re.match(token.src) and
+ False
):
del tokens[i]
assert tokens[i].name == 'NL', tokens[i].name
diff --git i/pyupgrade/_plugins/fstrings.py w/pyupgrade/_plugins/fstrings.py
index e648075..eb44c0c 100644
--- i/pyupgrade/_plugins/fstrings.py
+++ w/pyupgrade/_plugins/fstrings.py
@@ -88,7 +88,7 @@ def _format_params(call: ast.Call) -> set[str]:
return params
-@register(ast.Call)
+# @register(ast.Call)
def visit_Call(
state: State,
node: ast.Call,
diff --git i/pyupgrade/_plugins/open_mode.py w/pyupgrade/_plugins/open_mode.py
index a20b95c..0388781 100644
--- i/pyupgrade/_plugins/open_mode.py
+++ w/pyupgrade/_plugins/open_mode.py
@@ -28,7 +28,7 @@ def _permute(*args: str) -> tuple[str, ...]:
return tuple(''.join(p) for s in args for p in itertools.permutations(s))
-MODE_REMOVE = frozenset(_permute('U', 'r', 'rU', 'rt'))
+MODE_REMOVE = frozenset(_permute('U', 'rU', 'rt'))
MODE_REPLACE_R = frozenset(_permute('Ub'))
MODE_REMOVE_T = frozenset(_plus(_permute('at', 'rt', 'wt', 'xt')))
MODE_REMOVE_U = frozenset(_permute('rUb'))
Then run with:
git ls-files | grep -E '(\.py|misc/userscripts)' | xargs ~/tmp/pyupgrade/.venv/bin/pyupgrade --py38-plus
And manually reverted some changes (e.g. it picking up bash userscripts)
-rw-r--r-- | qutebrowser/browser/webkit/network/networkreply.py | 4 | ||||
-rw-r--r-- | qutebrowser/config/stylesheet.py | 2 | ||||
-rw-r--r-- | qutebrowser/config/websettings.py | 2 | ||||
-rw-r--r-- | qutebrowser/utils/jinja.py | 2 | ||||
-rw-r--r-- | tests/end2end/conftest.py | 2 |
5 files changed, 6 insertions, 6 deletions
diff --git a/qutebrowser/browser/webkit/network/networkreply.py b/qutebrowser/browser/webkit/network/networkreply.py index 4fb7dfea5..4c8e698ba 100644 --- a/qutebrowser/browser/webkit/network/networkreply.py +++ b/qutebrowser/browser/webkit/network/networkreply.py @@ -128,7 +128,7 @@ class ErrorNetworkReply(QNetworkReply): def readData(self, _maxlen): """No data available.""" - return bytes() + return b'' def isFinished(self): return True @@ -150,4 +150,4 @@ class RedirectNetworkReply(QNetworkReply): """Called when there's e.g. a redirection limit.""" def readData(self, _maxlen): - return bytes() + return b'' diff --git a/qutebrowser/config/stylesheet.py b/qutebrowser/config/stylesheet.py index 8ad873ab5..c840a99c2 100644 --- a/qutebrowser/config/stylesheet.py +++ b/qutebrowser/config/stylesheet.py @@ -48,7 +48,7 @@ def set_register(obj: QWidget, @debugcachestats.register() -@functools.lru_cache() +@functools.lru_cache def _render_stylesheet(stylesheet: str) -> str: """Render the given stylesheet jinja template.""" with jinja.environment.no_autoescape(): diff --git a/qutebrowser/config/websettings.py b/qutebrowser/config/websettings.py index 7f59367cb..e5dd2e037 100644 --- a/qutebrowser/config/websettings.py +++ b/qutebrowser/config/websettings.py @@ -203,7 +203,7 @@ class AbstractSettings: @debugcachestats.register(name='user agent cache') -@functools.lru_cache() +@functools.lru_cache def _format_user_agent(template: str, backend: usertypes.Backend) -> str: if backend == usertypes.Backend.QtWebEngine: from qutebrowser.browser.webengine import webenginesettings diff --git a/qutebrowser/utils/jinja.py b/qutebrowser/utils/jinja.py index 5775b317b..da8878aee 100644 --- a/qutebrowser/utils/jinja.py +++ b/qutebrowser/utils/jinja.py @@ -142,7 +142,7 @@ js_environment = jinja2.Environment(loader=Loader('javascript')) @debugcachestats.register() -@functools.lru_cache() +@functools.lru_cache def template_config_variables(template: str) -> FrozenSet[str]: """Return the config variables used in the template.""" unvisted_nodes: List[jinja2.nodes.Node] = [environment.parse(template)] diff --git a/tests/end2end/conftest.py b/tests/end2end/conftest.py index bdc172857..febe1b70b 100644 --- a/tests/end2end/conftest.py +++ b/tests/end2end/conftest.py @@ -69,7 +69,7 @@ def _check_version(op_str, running_version, version_str, as_hex=False): '<': operator.lt, } op = operators[op_str] - major, minor, patch = [int(e) for e in version_str.split('.')] + major, minor, patch = (int(e) for e in version_str.split('.')) if as_hex: version = (major << 16) | (minor << 8) | patch else: |