aboutsummaryrefslogtreecommitdiffstats
path: root/build_scripts/options.py
diff options
context:
space:
mode:
authorCristián Maureira-Fredes <cristian.maureira-fredes@qt.io>2019-11-17 13:06:37 +0100
committerCristián Maureira-Fredes <cristian.maureira-fredes@qt.io>2019-11-25 21:50:17 +0100
commit69d511949fdf1da8309c9adab8b00ed6f80053a0 (patch)
tree313e4f8578fcd4797a8b411c31aedaf35f3ee9a7 /build_scripts/options.py
parent2914408d9017d192f254b4c7b2d298bb7b6e885e (diff)
Improve code style with flake8
- We agreed on 100 columns time ago, so I move around a few things, - Removing unused modules, - Fix white-spaces tabs without being multiple of 4, - Encourage the use of os.path.join when joining paths, - Using .format() for string formatting, - Remove white-spaces from default arguments, - Adjusting white-spaces before inline comments, - Adding extra newlines when expected, - Adjust spaces for lines under-indented for visual indent, - Remove white-spaces from parenthesis, and adding them for arithmetic operators. Change-Id: I9cb28cefd114d63580b584a063c452f90d3ca885 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'build_scripts/options.py')
-rw-r--r--build_scripts/options.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/build_scripts/options.py b/build_scripts/options.py
index c17f6a100..0e38566d5 100644
--- a/build_scripts/options.py
+++ b/build_scripts/options.py
@@ -44,8 +44,8 @@ import warnings
def _warn_multiple_option(option):
- w = 'Option "{}" occurs multiple times on the command line.'.format(option)
- warnings.warn(w)
+ warnings.warn('Option "{}" occurs multiple times on the command line.'.format(option))
+
def _warn_deprecated_option(option, replacement=None):
w = 'Option "{}" is deprecated and may be removed in a future release.'.format(option)
@@ -53,6 +53,7 @@ def _warn_deprecated_option(option, replacement=None):
w = '{}\nUse "{}" instead.'.format(w, replacement)
warnings.warn(w)
+
class Options(object):
def __init__(self):
@@ -62,13 +63,13 @@ class Options(object):
def has_option(self, name, remove=True):
""" Returns True if argument '--name' was passed on the command
line. """
- option = '--' + name
+ option = '--{}'.format(name)
count = sys.argv.count(option)
remove_count = count
if not remove and count > 0:
remove_count -= 1
for i in range(remove_count):
- sys.argv.remove(option)
+ sys.argv.remove(option)
if count > 1:
_warn_multiple_option(option)
return count > 0
@@ -127,8 +128,8 @@ def has_option(*args, **kwargs):
return options.has_option(*args, **kwargs)
-def option_value(*args,**kwargs):
- return options.option_value(*args,**kwargs)
+def option_value(*args, **kwargs):
+ return options.option_value(*args, **kwargs)
# Declare options