Skip to content

Commit 12c5927

Browse files
committed
Apply Black formatting to improve code style
1 parent 117820a commit 12c5927

30 files changed

+2868
-3292
lines changed

atlassian/__init__.py

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,41 +25,42 @@
2525
# Compatibility: ConfluenceV2 is now ConfluenceCloud
2626
ConfluenceV2 = ConfluenceCloud
2727

28+
2829
# Factory function for Confluence client
2930
def create_confluence(url, *args, api_version=1, **kwargs):
3031
"""
3132
Create a Confluence client with the specified API version.
32-
33+
3334
Args:
3435
url: The Confluence instance URL
3536
api_version: API version, 1 or 2, defaults to 1
3637
args: Arguments to pass to Confluence constructor
3738
kwargs: Keyword arguments to pass to Confluence constructor
38-
39+
3940
Returns:
4041
A Confluence client configured for the specified API version
4142
"""
4243
return ConfluenceBase.factory(url, *args, api_version=api_version, **kwargs)
4344

4445

4546
__all__ = [
46-
'Confluence',
47-
'ConfluenceBase',
48-
'ConfluenceCloud',
49-
'ConfluenceServer',
50-
'ConfluenceV2', # For backward compatibility
51-
'Jira',
52-
'Bitbucket',
53-
'CloudAdminOrgs',
54-
'CloudAdminUsers',
55-
'Portfolio',
56-
'Bamboo',
57-
'Stash',
58-
'Crowd',
59-
'ServiceDesk',
60-
'ServiceManagement',
61-
'MarketPlace',
62-
'Xray',
63-
'Insight',
64-
'Assets',
47+
"Confluence",
48+
"ConfluenceBase",
49+
"ConfluenceCloud",
50+
"ConfluenceServer",
51+
"ConfluenceV2", # For backward compatibility
52+
"Jira",
53+
"Bitbucket",
54+
"CloudAdminOrgs",
55+
"CloudAdminUsers",
56+
"Portfolio",
57+
"Bamboo",
58+
"Stash",
59+
"Crowd",
60+
"ServiceDesk",
61+
"ServiceManagement",
62+
"MarketPlace",
63+
"Xray",
64+
"Insight",
65+
"Assets",
6566
]

atlassian/confluence.py.bak

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
"""
2+
Legacy module for backward compatibility.
3+
New code should use the confluence package directly.
4+
"""
5+
6+
import warnings
7+
from typing import Optional, Union
8+
9+
from .confluence.cloud import ConfluenceCloud
10+
from .confluence.server import ConfluenceServer
11+
12+
13+
def Confluence(url: str, *args, cloud: Optional[bool] = None, api_version: Union[str, int] = 1, **kwargs):
14+
"""
15+
Factory function to create appropriate Confluence instance.
16+
17+
Args:
18+
url: The Confluence instance URL
19+
cloud: Whether this is a cloud instance. If None, will be auto-detected
20+
api_version: API version to use (1 or 2, only applicable for cloud)
21+
*args: Arguments to pass to the constructor
22+
**kwargs: Keyword arguments to pass to the constructor
23+
24+
Returns:
25+
ConfluenceCloud or ConfluenceServer instance
26+
"""
27+
warnings.warn(
28+
"Direct Confluence class instantiation is deprecated. "
29+
"Use ConfluenceCloud or ConfluenceServer classes from atlassian.confluence package.",
30+
DeprecationWarning,
31+
stacklevel=2,
32+
)
33+
34+
# Auto-detect cloud if not specified
35+
if cloud is None:
36+
cloud = any(domain in url.lower() for domain in [".atlassian.net", ".jira.com"])
37+
38+
if cloud:
39+
return ConfluenceCloud(url, *args, api_version=api_version, **kwargs)
40+
else:
41+
return ConfluenceServer(url, *args, **kwargs)

atlassian/confluence/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
"""
22
Confluence module for both Cloud and Server implementations
33
"""
4+
45
from .base import ConfluenceBase
56
from .cloud import ConfluenceCloud
67
from .server import ConfluenceServer
78
from typing import Union
89

10+
911
def Confluence(url: str, *args, **kwargs) -> Union[ConfluenceCloud, ConfluenceServer]:
1012
"""
1113
Factory function to create appropriate Confluence instance based on URL
12-
14+
1315
Args:
1416
url: The Confluence instance URL
1517
*args: Arguments to pass to the implementation
1618
**kwargs: Keyword arguments to pass to the implementation
17-
19+
1820
Returns:
1921
Either ConfluenceCloud or ConfluenceServer instance
2022
"""
2123
if ConfluenceBase._is_cloud_url(url):
2224
return ConfluenceCloud(url, *args, **kwargs)
2325
return ConfluenceServer(url, *args, **kwargs)
2426

25-
__all__ = ['Confluence', 'ConfluenceBase', 'ConfluenceCloud', 'ConfluenceServer']
27+
28+
__all__ = ["Confluence", "ConfluenceBase", "ConfluenceCloud", "ConfluenceServer"]

0 commit comments

Comments
 (0)