aboutsummaryrefslogtreecommitdiffstats
path: root/tools/snippets_translate/converter.py
diff options
context:
space:
mode:
authorCristián Maureira-Fredes <Cristian.Maureira-Fredes@qt.io>2022-03-30 20:51:17 +0200
committerCristián Maureira-Fredes <cristian.maureira-fredes@qt.io>2022-04-02 16:43:45 +0200
commit7e87bbbe1f59e275d1076b90ab9b1cd640bef78a (patch)
tree853311ca24a27d02ca6a7d583a9e22c352fbb822 /tools/snippets_translate/converter.py
parentea86da2b9cd1996e50f0dce08b9cd144d49b364e (diff)
flake8: fix styling issues in tools/
Change-Id: I8cbf5d521900df4f55abf8f68997f8a71437f722 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'tools/snippets_translate/converter.py')
-rw-r--r--tools/snippets_translate/converter.py22
1 files changed, 10 insertions, 12 deletions
diff --git a/tools/snippets_translate/converter.py b/tools/snippets_translate/converter.py
index 8eeaee551..b437b9757 100644
--- a/tools/snippets_translate/converter.py
+++ b/tools/snippets_translate/converter.py
@@ -39,17 +39,15 @@
import re
-
-from handlers import (handle_casts, handle_class, handle_condition,
+from handlers import (handle_array_declarations, handle_casts, handle_class,
handle_conditions, handle_constructor_default_values,
handle_constructors, handle_cout_endl, handle_emit,
- handle_for, handle_foreach, handle_inc_dec,
- handle_include, handle_keywords, handle_negate,
- handle_type_var_declaration, handle_void_functions,
- handle_methods_return_type, handle_functions,
- handle_array_declarations, handle_useless_qt_classes,)
-
-from parse_utils import get_indent, dstrip, remove_ref
+ handle_for, handle_foreach, handle_functions,
+ handle_inc_dec, handle_include, handle_keywords,
+ handle_methods_return_type, handle_negate,
+ handle_type_var_declaration, handle_useless_qt_classes,
+ handle_void_functions)
+from parse_utils import dstrip, get_indent, remove_ref
def snippet_translate(x):
@@ -260,8 +258,8 @@ def snippet_translate(x):
# QSome thing = b(...)
# float v = 0.1
# QSome *thing = ...
- if (re.search(r"^[a-zA-Z0-9]+(<.*?>)? [\w\*]+ *= *[\w\.\"\']*(\(.*?\))?", x.strip()) and
- ("{" not in x and "}" not in x)):
+ if (re.search(r"^[a-zA-Z0-9]+(<.*?>)? [\w\*]+ *= *[\w\.\"\']*(\(.*?\))?", x.strip())
+ and ("{" not in x and "}" not in x)):
left, right = x.split("=", 1)
var_name = " ".join(left.strip().split()[1:])
x = f"{get_indent(x)}{remove_ref(var_name)} = {right.strip()}"
@@ -295,7 +293,7 @@ def snippet_translate(x):
# Arrays declarations with the form:
# type var_name[] = {...
# type var_name {...
- #if re.search(r"^[a-zA-Z0-9]+(<.*?>)? [\w\*]+\[\] * = *\{", x.strip()):
+ # if re.search(r"^[a-zA-Z0-9]+(<.*?>)? [\w\*]+\[\] * = *\{", x.strip()):
if re.search(r"^[a-zA-Z0-9]+(<.*?>)? [\w\*]+\[?\]? * =? *\{", x.strip()):
x = handle_array_declarations(x)