Skip to content

Commit 4f9967f

Browse files
committed
use newer super() variant
Since this extension requires at least Python 3.7, the implementation can now use the newer version of `super()` (instead of requiring the class to be explicitly provided). Signed-off-by: James Knight <[email protected]>
1 parent 08f1467 commit 4f9967f

File tree

64 files changed

+83
-83
lines changed

Some content is hidden

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

64 files changed

+83
-83
lines changed

sphinxcontrib/confluencebuilder/builder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ def __init__(self, app, env=None):
5757
# assigned.
5858
if sphinx_version_info >= (5, 1):
5959
# pylint: disable=too-many-function-args
60-
super(ConfluenceBuilder, self).__init__(app, env)
60+
super().__init__(app, env)
6161
# pylint: enable=too-many-function-args
6262
else:
63-
super(ConfluenceBuilder, self).__init__(app)
63+
super().__init__(app)
6464

6565
self.cache_doctrees = {}
6666
self.cloud = False

sphinxcontrib/confluencebuilder/exceptions.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ConfluenceError(SphinxError):
1111

1212
class ConfluenceAuthenticationFailedUrlError(ConfluenceError):
1313
def __init__(self):
14-
super(ConfluenceAuthenticationFailedUrlError, self).__init__('''
14+
super().__init__('''
1515
---
1616
Unable to authenticate with Confluence
1717
@@ -25,7 +25,7 @@ def __init__(self):
2525

2626
class ConfluenceBadApiError(ConfluenceError):
2727
def __init__(self, code, details):
28-
super(ConfluenceBadApiError, self).__init__('''
28+
super().__init__('''
2929
---
3030
Unsupported Confluence API call
3131
@@ -43,7 +43,7 @@ def __init__(self, space_key, uname, pw_set, token_set, extras):
4343
uname_value = uname if uname else '(empty)'
4444
pw_value = '<set>' if pw_set else '(empty)'
4545
token_value = '<set>' if token_set else '(empty)'
46-
super(ConfluenceBadSpaceError, self).__init__('''
46+
super().__init__('''
4747
---
4848
Invalid Confluence URL detected
4949
@@ -66,7 +66,7 @@ def __init__(self, space_key, uname, pw_set, token_set, extras):
6666

6767
class ConfluenceBadServerUrlError(ConfluenceError):
6868
def __init__(self, server_url, ex):
69-
super(ConfluenceBadServerUrlError, self).__init__('''
69+
super().__init__('''
7070
---
7171
Invalid Confluence URL detected
7272
@@ -83,7 +83,7 @@ def __init__(self, server_url, ex):
8383

8484
class ConfluenceCertificateError(ConfluenceError):
8585
def __init__(self, ex):
86-
super(ConfluenceCertificateError, self).__init__('''
86+
super().__init__('''
8787
---
8888
SSL certificate issue
8989
@@ -101,7 +101,7 @@ class ConfluenceConfigurationError(ConfluenceError, ConfigError):
101101

102102
class ConfluenceMissingPageIdError(ConfluenceError):
103103
def __init__(self, space_key, page_id):
104-
super(ConfluenceMissingPageIdError, self).__init__('''
104+
super().__init__('''
105105
---
106106
Unable to find a requested page
107107
@@ -117,7 +117,7 @@ def __init__(self, space_key, page_id):
117117

118118
class ConfluencePermissionError(ConfluenceError):
119119
def __init__(self, details):
120-
super(ConfluencePermissionError, self).__init__('''
120+
super().__init__('''
121121
---
122122
Permission denied on Confluence ({desc})
123123
@@ -130,7 +130,7 @@ def __init__(self, details):
130130

131131
class ConfluenceProxyPermissionError(ConfluenceError):
132132
def __init__(self):
133-
super(ConfluenceProxyPermissionError, self).__init__('''
133+
super().__init__('''
134134
---
135135
Unable to authenticate with the proxy server
136136
@@ -148,7 +148,7 @@ class ConfluencePublishCheckError(ConfluenceError):
148148

149149
class ConfluencePublishAncestorError(ConfluencePublishCheckError):
150150
def __init__(self, page_name):
151-
super(ConfluencePublishAncestorError, self).__init__('''
151+
super().__init__('''
152152
---
153153
Ancestor publish check failed for: {name}
154154
@@ -177,7 +177,7 @@ def __init__(self, page_name):
177177

178178
class ConfluencePublishSelfAncestorError(ConfluencePublishCheckError):
179179
def __init__(self, page_name):
180-
super(ConfluencePublishSelfAncestorError, self).__init__('''
180+
super().__init__('''
181181
---
182182
Ancestor (self) publish check failed for: {name}
183183
@@ -198,7 +198,7 @@ def __init__(self, page_name):
198198

199199
class ConfluenceRateLimited(ConfluenceError):
200200
def __init__(self):
201-
super(ConfluenceRateLimited, self).__init__('''
201+
super().__init__('''
202202
---
203203
Request has been rate limited
204204
@@ -211,7 +211,7 @@ def __init__(self):
211211

212212
class ConfluenceSeraphAuthenticationFailedUrlError(ConfluenceError):
213213
def __init__(self):
214-
super(ConfluenceSeraphAuthenticationFailedUrlError, self).__init__('''
214+
super().__init__('''
215215
---
216216
Unable to authenticate with the Confluence instance (Seraph)
217217
@@ -226,7 +226,7 @@ def __init__(self):
226226

227227
class ConfluenceSslError(ConfluenceError):
228228
def __init__(self, server_url, ex):
229-
super(ConfluenceSslError, self).__init__('''
229+
super().__init__('''
230230
---
231231
SSL connection issue has been detected
232232
@@ -249,7 +249,7 @@ def __init__(self, server_url, ex):
249249

250250
class ConfluenceTimeoutError(ConfluenceError):
251251
def __init__(self, server_url):
252-
super(ConfluenceTimeoutError, self).__init__('''
252+
super().__init__('''
253253
---
254254
Connection has timed out
255255
@@ -265,7 +265,7 @@ def __init__(self, server_url):
265265

266266
class ConfluenceUnreconciledPageError(ConfluenceError):
267267
def __init__(self, page_name, page_id, url, ex):
268-
super(ConfluenceUnreconciledPageError, self).__init__('''
268+
super().__init__('''
269269
---
270270
Unable to update unreconciled page: {name} (id: {id})
271271

sphinxcontrib/confluencebuilder/rest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
class SslAdapter(HTTPAdapter):
3939
def __init__(self, config, *args, **kwargs):
4040
self._config = config
41-
super(SslAdapter, self).__init__(*args, **kwargs)
41+
super().__init__(*args, **kwargs)
4242

4343
def init_poolmanager(self, *args, **kwargs):
4444
context = ssl.create_default_context()
@@ -60,10 +60,10 @@ def init_poolmanager(self, *args, **kwargs):
6060
context.check_hostname = False
6161

6262
kwargs['ssl_context'] = context
63-
return super(SslAdapter, self).init_poolmanager(*args, **kwargs)
63+
return super().init_poolmanager(*args, **kwargs)
6464

6565
def cert_verify(self, conn, url, verify, *args, **kwargs):
66-
super(SslAdapter, self).cert_verify(conn, url, verify, *args, **kwargs)
66+
super().cert_verify(conn, url, verify, *args, **kwargs)
6767

6868
# prevent requests from injected an embedded certificates to instead
6969
# rely on the default certificate stores loaded by the context

tests/lib/testcase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_storage_example(self):
3131
...
3232
"""
3333

34-
super(ConfluenceTestCase, self).__init__(*args, **kwargs)
34+
super().__init__(*args, **kwargs)
3535

3636
self.builder = DEFAULT_BUILDER
3737

tests/unit-tests/test_config_checks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def run(self, result=None):
3030
# unique configuration each run to avoid copying it in each test
3131
self.config = prepare_conf()
3232

33-
super(TestConfluenceConfigChecks, self).run(result)
33+
super().run(result)
3434

3535
def _prepare_valid_publish(self):
3636
self.config['confluence_publish'] = True

tests/unit-tests/test_config_env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def run(self, result=None):
2020
# ensure environment overrides do not leak between tests
2121
old_env = dict(os.environ)
2222
try:
23-
super(TestConfluenceConfigEnvironment, self).run(result)
23+
super().run(result)
2424
finally:
2525
os.environ.clear()
2626
os.environ.update(old_env)

tests/unit-tests/test_config_header_footer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class TestConfluenceConfigHeaderFooter(ConfluenceTestCase):
1111
@classmethod
1212
def setUpClass(cls):
13-
super(TestConfluenceConfigHeaderFooter, cls).setUpClass()
13+
super().setUpClass()
1414

1515
cls.dataset = os.path.join(cls.datasets, 'header-footer')
1616

tests/unit-tests/test_config_hierarchy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class TestConfluenceHierarchy(ConfluenceTestCase):
1010
@classmethod
1111
def setUpClass(cls):
12-
super(TestConfluenceHierarchy, cls).setUpClass()
12+
super().setUpClass()
1313

1414
cls.dataset = os.path.join(cls.datasets, 'hierarchy')
1515

tests/unit-tests/test_config_orphan.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class TestConfluenceConfigOrphan(ConfluenceTestCase):
1414
@classmethod
1515
def setUpClass(cls):
16-
super(TestConfluenceConfigOrphan, cls).setUpClass()
16+
super().setUpClass()
1717

1818
cls.dataset = os.path.join(cls.datasets, 'orphan')
1919

@@ -25,7 +25,7 @@ def run(self, result=None):
2525
with patch.object(ConfluencePublisher, 'connect'), \
2626
patch.object(ConfluencePublisher, 'disconnect'), \
2727
patch.object(ConfluenceBuilder, 'publish_asset'):
28-
super(TestConfluenceConfigOrphan, self).run(result)
28+
super().run(result)
2929

3030
def test_config_orphan_allow_explicit(self):
3131
config = dict(self.config)

tests/unit-tests/test_config_postfix_formatting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def test_placeholder_with_format_type(self):
102102
class TestRegisterTitle(ConfluenceTestCase):
103103
@classmethod
104104
def setUpClass(cls):
105-
super(TestRegisterTitle, cls).setUpClass()
105+
super().setUpClass()
106106
cls.config['root_doc'] = 'index'
107107
cls.dataset = os.path.join(cls.datasets, 'postfix_formatting')
108108

0 commit comments

Comments
 (0)