forked from pool/python-autopep8
31 lines
1.1 KiB
Diff
31 lines
1.1 KiB
Diff
|
|
From f961833919a6cc9198f05a7f1b2ac7eec1584724 Mon Sep 17 00:00:00 2001
|
||
|
|
From: paugier <pierre.augier@univ-grenoble-alpes.fr>
|
||
|
|
Date: Sun, 13 Aug 2023 23:06:33 +0200
|
||
|
|
Subject: [PATCH] Try to fix an AttributeError related to pycodestyle 2.11.0
|
||
|
|
|
||
|
|
---
|
||
|
|
autopep8.py | 10 ++++++++--
|
||
|
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/autopep8.py b/autopep8.py
|
||
|
|
index 5e2a9fda..84e3e1bf 100755
|
||
|
|
--- a/autopep8.py
|
||
|
|
+++ b/autopep8.py
|
||
|
|
@@ -757,8 +757,14 @@ def fix_e225(self, result):
|
||
|
|
return
|
||
|
|
if not check_syntax(fixed.lstrip()):
|
||
|
|
return
|
||
|
|
- errors = list(
|
||
|
|
- pycodestyle.missing_whitespace_around_operator(fixed, ts))
|
||
|
|
+ try:
|
||
|
|
+ _missing_whitespace = (
|
||
|
|
+ pycodestyle.missing_whitespace_around_operator
|
||
|
|
+ )
|
||
|
|
+ except AttributeError:
|
||
|
|
+ # pycodestyle >= 2.11.0
|
||
|
|
+ _missing_whitespace = pycodestyle.missing_whitespace
|
||
|
|
+ errors = list(_missing_whitespace(fixed, ts))
|
||
|
|
for e in reversed(errors):
|
||
|
|
if error_code != e[1].split()[0]:
|
||
|
|
continue
|