WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 9daa410

Browse files
committed
Run pyupgrade to migrate away from Python 2 code
1 parent e1a0d1d commit 9daa410

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+211
-211
lines changed

radish/background.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Background(Scenario):
1212
"""
1313

1414
def __init__(self, keyword, sentence, path, line, parent):
15-
super(Background, self).__init__(None, keyword, sentence, path, line, parent)
15+
super().__init__(None, keyword, sentence, path, line, parent)
1616

1717
def create_instance(self, parent=None, steps_runable=False):
1818
"""

radish/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from .parser import FeatureParser
99

1010

11-
class Configuration(object):
11+
class Configuration:
1212
"""
1313
Manage configuration. Attributes of the class are created from the
1414
names of the command line options and are set to the command line
@@ -33,7 +33,7 @@ def __init__(self, arguments):
3333

3434

3535
# FIXME: rename
36-
class Core(object):
36+
class Core:
3737
"""
3838
Provide some core functionalities like parsing and storing of the feature files
3939
"""

radish/customtyperegistry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
@singleton()
13-
class CustomTypeRegistry(object):
13+
class CustomTypeRegistry:
1414
"""
1515
Registry for all custom argument expressions
1616
"""
@@ -23,7 +23,7 @@ def register(self, name, func):
2323
Registers a custom type
2424
"""
2525
if name in self.custom_types:
26-
raise RadishError("Cannot register custom type with name {0} because it already exists".format(name))
26+
raise RadishError("Cannot register custom type with name {} because it already exists".format(name))
2727

2828
self.custom_types[name] = func
2929

radish/errororacle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ def write_error(text):
2020
"""
2121
Writes the given text to the console
2222
"""
23-
console_write("{0}: {1}".format(colorful.bold_red("Error"), colorful.red(text)))
23+
console_write("{}: {}".format(colorful.bold_red("Error"), colorful.red(text)))
2424

2525

2626
def write_failure(failure):
2727
"""
2828
Writes the failure to the console
2929
"""
30-
console_write("\n{0}".format(colorful.red(failure.traceback)))
30+
console_write("\n{}".format(colorful.red(failure.traceback)))
3131

3232

3333
def abort(return_code):

radish/examplescenario.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ExampleScenario(Scenario):
1111
"""
1212

1313
def __init__(self, id, keyword, sentence, path, line, parent, example, background=None):
14-
super(ExampleScenario, self).__init__(
14+
super().__init__(
1515
id, keyword, sentence, path, line, parent, parent.tags, background=background
1616
)
1717
self.example = example

radish/exceptions.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class LanguageNotSupportedError(RadishError):
1818

1919
def __init__(self, language):
2020
self.language = language
21-
super(LanguageNotSupportedError, self).__init__("Language {0} could not be found".format(language))
21+
super().__init__("Language {} could not be found".format(language))
2222

2323

2424
class FeatureFileNotFoundError(RadishError):
@@ -28,7 +28,7 @@ class FeatureFileNotFoundError(RadishError):
2828

2929
def __init__(self, featurefile):
3030
self.featurefile = featurefile
31-
super(FeatureFileNotFoundError, self).__init__("Feature file '{0}': No such file".format(featurefile))
31+
super().__init__("Feature file '{}': No such file".format(featurefile))
3232

3333

3434
class FeatureFileSyntaxError(RadishError, SyntaxError):
@@ -45,7 +45,7 @@ class FeatureFileSyntaxError(RadishError, SyntaxError):
4545
Link: {docs_link}"""
4646

4747
def __init__(self, msg):
48-
super(FeatureFileSyntaxError, self).__init__(
48+
super().__init__(
4949
FeatureFileSyntaxError.MESSAGE_TEMPLATE.format(msg=msg, docs_link=__DOCS__)
5050
)
5151

@@ -59,8 +59,8 @@ def __init__(self, regex, step_func_name, re_error):
5959
self.regex = regex
6060
self.step_func_name = step_func_name
6161
self.re_error = re_error
62-
super(StepRegexError, self).__init__(
63-
"Cannot compile regex '{0}' from step '{1}': {2}".format(regex, step_func_name, re_error)
62+
super().__init__(
63+
"Cannot compile regex '{}' from step '{}': {}".format(regex, step_func_name, re_error)
6464
)
6565

6666

@@ -73,8 +73,8 @@ def __init__(self, pattern, step_func_name, error):
7373
self.pattern = pattern
7474
self.step_func_name = step_func_name
7575
self.error = error
76-
super(StepPatternError, self).__init__(
77-
"Cannot compile pattern '{0}' of step '{1}': {2}".format(pattern, step_func_name, error)
76+
super().__init__(
77+
"Cannot compile pattern '{}' of step '{}': {}".format(pattern, step_func_name, error)
7878
)
7979

8080

@@ -95,7 +95,7 @@ def __init__(self, regex, func1, func2):
9595
self.regex = regex
9696
self.func1 = func1
9797
self.func2 = func2
98-
super(SameStepError, self).__init__(
98+
super().__init__(
9999
SameStepError.MESSAGE_TEMPLATE.format(func2.__name__, regex, func1.__name__)
100100
)
101101

@@ -118,7 +118,7 @@ def my_step(step):
118118

119119
def __init__(self, step):
120120
self.step = step
121-
super(StepDefinitionNotFoundError, self).__init__(
121+
super().__init__(
122122
StepDefinitionNotFoundError.MESSAGE_TEMPLATE.format(
123123
sentence=step.sentence,
124124
step_path=step.path,
@@ -144,8 +144,8 @@ class HookError(RadishError):
144144
def __init__(self, hook_function, failure):
145145
self.hook_function = hook_function
146146
self.failure = failure
147-
super(HookError, self).__init__(
148-
"Hook '{0}' from {1}:{2} raised: '{3}: {4}'".format(
147+
super().__init__(
148+
"Hook '{}' from {}:{} raised: '{}: {}'".format(
149149
hook_function.__name__,
150150
hook_function.__code__.co_filename,
151151
hook_function.__code__.co_firstlineno,
@@ -163,8 +163,8 @@ class ScenarioNotFoundError(RadishError):
163163
def __init__(self, scenario_id, amount_of_scenarios):
164164
self.scenario_id = scenario_id
165165
self.amount_of_scenarios = amount_of_scenarios
166-
super(ScenarioNotFoundError, self).__init__(
167-
"No scenario with id {0} found. Specify a scenario id between 1 and {1}".format(
166+
super().__init__(
167+
"No scenario with id {} found. Specify a scenario id between 1 and {}".format(
168168
scenario_id, amount_of_scenarios
169169
)
170170
)

radish/extensionregistry.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
@singleton()
9-
class ExtensionRegistry(object):
9+
class ExtensionRegistry:
1010
"""
1111
Registers all extensions
1212
"""
@@ -54,7 +54,7 @@ def get_options(self):
5454
options.extend(opt[0] for opt in ext.OPTIONS)
5555
except AttributeError:
5656
pass
57-
return "\n ".join("[{0}]".format(x) for x in options)
57+
return "\n ".join("[{}]".format(x) for x in options)
5858

5959
def get_option_description(self):
6060
"""
@@ -63,7 +63,7 @@ def get_option_description(self):
6363
options = []
6464
for ext in self.extensions:
6565
try:
66-
options.extend("{0} {1}".format(opt[0].ljust(43), opt[1]) for opt in ext.OPTIONS)
66+
options.extend("{} {}".format(opt[0].ljust(43), opt[1]) for opt in ext.OPTIONS)
6767
except AttributeError:
6868
pass
6969
return "\n ".join(options)

radish/extensions/bdd_xml_writer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
@extension
22-
class BDDXMLWriter(object):
22+
class BDDXMLWriter:
2323
"""
2424
BDD XML Writer radish extension
2525
"""
@@ -96,7 +96,7 @@ def generate_bdd_xml(self, features, marker):
9696
starttime=utils.format_utc_to_local_tz(features[0].starttime),
9797
endtime=utils.format_utc_to_local_tz(features[-1].endtime),
9898
duration=str(duration.total_seconds()),
99-
agent="{0}@{1}".format(user, gethostname()),
99+
agent="{}@{}".format(user, gethostname()),
100100
)
101101

102102
for feature in features:
@@ -129,7 +129,7 @@ def generate_bdd_xml(self, features, marker):
129129
tag_element = etree.Element("tag")
130130
tag_element.text = tag.name
131131
if tag.arg:
132-
tag_element.text += "({0})".format(tag.arg)
132+
tag_element.text += "({})".format(tag.arg)
133133
scenario_tags_element.append(tag_element)
134134

135135
for step in scenario.all_steps:

radish/extensions/codecoverage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
@extension
17-
class CodeCoverage(object):
17+
class CodeCoverage:
1818
"""
1919
Code Coverage radish extension
2020
"""
@@ -118,7 +118,7 @@ def coverage_stop(self, features, marker):
118118
total_percentage = int(match.groups()[0].split()[-1][:-1])
119119
if total_percentage < int(world.config.cover_min_percentage):
120120
raise RadishError(
121-
"Failed to reach minimum expected coverage of {0}% (reached: {1}%)".format(
121+
"Failed to reach minimum expected coverage of {}% (reached: {}%)".format(
122122
world.config.cover_min_percentage, total_percentage
123123
)
124124
)

radish/extensions/cucumber_json_writer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616

1717
@extension
18-
class CucumberJSONWriter(object):
18+
class CucumberJSONWriter:
1919
"""
2020
cucumber json Writer radish extension
2121
"""

0 commit comments

Comments
 (0)