Skip to content

Commit aded547

Browse files
🎨 style(client.py): standardize string quotes from single to double for consistency across the file
1 parent 576e8c1 commit aded547

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

‎squarecloud/client.py‎

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@
3232
from .listeners.request_listener import RequestListenerManager
3333
from .logger import logger
3434

35-
P = ParamSpec('P')
36-
R = TypeVar('R')
35+
P = ParamSpec("P")
36+
R = TypeVar("R")
3737

3838

3939
@deprecated(
40-
'create_config_file is deprecated, '
41-
'use squarecloud.utils.ConfigFile instead.'
40+
"create_config_file is deprecated, "
41+
"use squarecloud.utils.ConfigFile instead."
4242
)
4343
def create_config_file(
4444
path: str,
4545
display_name: str,
4646
main: str,
4747
memory: int,
48-
version: Literal['recommended', 'latest'] = 'recommended',
48+
version: Literal["recommended", "latest"] = "recommended",
4949
description: str | None = None,
5050
subdomain: str | None = None,
5151
start: str | None = None,
@@ -74,23 +74,23 @@ def create_config_file(
7474
:return: File content
7575
:rtype: str
7676
"""
77-
content: str = ''
77+
content: str = ""
7878
optionals: dict[str, Any] = {
79-
'DISPLAY_NAME': display_name,
80-
'MAIN': main,
81-
'MEMORY': memory,
82-
'VERSION': version,
83-
'DESCRIPTION': description,
84-
'SUBDOMAIN': subdomain,
85-
'START': start,
86-
'AUTORESTART': auto_restart,
79+
"DISPLAY_NAME": display_name,
80+
"MAIN": main,
81+
"MEMORY": memory,
82+
"VERSION": version,
83+
"DESCRIPTION": description,
84+
"SUBDOMAIN": subdomain,
85+
"START": start,
86+
"AUTORESTART": auto_restart,
8787
}
8888
for key, value in optionals.items():
8989
if value:
90-
string: str = f'{key}={value}\n'
90+
string: str = f"{key}={value}\n"
9191
content += string
92-
if kwargs.get('save', True):
93-
with open(f'./{path}/squarecloud.app', 'w', encoding='utf-8') as file:
92+
if kwargs.get("save", True):
93+
with open(f"./{path}/squarecloud.app", "w", encoding="utf-8") as file:
9494
file.write(content)
9595
return file
9696
return content
@@ -103,12 +103,12 @@ def __init__(
103103
self,
104104
api_key: str,
105105
log_level: Literal[
106-
'DEBUG',
107-
'INFO',
108-
'WARNING',
109-
'ERROR',
110-
'CRITICAL',
111-
] = 'INFO',
106+
"DEBUG",
107+
"INFO",
108+
"WARNING",
109+
"ERROR",
110+
"CRITICAL",
111+
] = "INFO",
112112
) -> None:
113113
"""
114114
The __init__ function is called when the class is instantiated.
@@ -197,12 +197,12 @@ async def decorator(
197197
response: Response
198198
result = await func(self, *args, **kwargs)
199199
response = self._http.last_response
200-
if kwargs.get('avoid_listener', False):
200+
if kwargs.get("avoid_listener", False):
201201
return result
202202
await self.notify(
203203
endpoint=endpoint,
204204
response=response,
205-
extra_value=kwargs.get('extra'),
205+
extra_value=kwargs.get("extra"),
206206
)
207207
return result
208208

@@ -227,7 +227,7 @@ async def user(self, **_kwargs) -> UserData:
227227
"""
228228
response: Response = await self._http.fetch_user_info()
229229
payload: dict[str, Any] = response.response
230-
return UserData(**payload['user'])
230+
return UserData(**payload["user"])
231231

232232
@_notify_listener(Endpoint.logs())
233233
async def get_logs(self, app_id: str, **_kwargs) -> LogsData:
@@ -423,8 +423,8 @@ async def app(self, app_id: str, **_kwargs) -> Application:
423423
payload = response.response
424424
app_data = list(
425425
filter(
426-
lambda application: application['id'] == app_id,
427-
payload['applications'],
426+
lambda application: application["id"] == app_id,
427+
payload["applications"],
428428
)
429429
)
430430
if not app_data:
@@ -433,8 +433,8 @@ async def app(self, app_id: str, **_kwargs) -> Application:
433433
app_data = AppData(**app_data).to_dict()
434434
return Application(client=self, http=self._http, **app_data)
435435

436-
@_notify_listener(Endpoint.user())
437-
async def all_apps(self, **_kwargs) -> list[Application]:
436+
# @_notify_listener(Endpoint.user())
437+
async def all_apps(self, **_kwargs) -> list[int]:
438438
"""
439439
The all_apps method returns a list of all applications that the user
440440
has access to.
@@ -451,7 +451,7 @@ async def all_apps(self, **_kwargs) -> list[Application]:
451451
"""
452452
response: Response = await self._http.fetch_user_info()
453453
payload = response.response
454-
apps_data: list = payload['applications']
454+
apps_data: list = payload["applications"]
455455
apps: list[Application] = []
456456
for data in apps_data:
457457
data = AppData(**data).to_dict()
@@ -503,12 +503,12 @@ async def upload_app(self, file: File, **_kwargs) -> UploadData:
503503
:raises InvalidDomain: Raised when a domain provided is invalid
504504
"""
505505
if not isinstance(file, File):
506-
raise InvalidFile(f'you need provide an {File.__name__} object')
506+
raise InvalidFile(f"you need provide an {File.__name__} object")
507507

508508
if (file.filename is not None) and (
509-
file.filename.split('.')[-1] != 'zip'
509+
file.filename.split(".")[-1] != "zip"
510510
):
511-
raise InvalidFile('the file must be a .zip file')
511+
raise InvalidFile("the file must be a .zip file")
512512
response: Response = await self._http.upload(file)
513513
payload: dict[str, Any] = response.response
514514
return UploadData(**payload)
@@ -540,7 +540,7 @@ async def app_files_list(
540540
if not response.response:
541541
return []
542542
return [
543-
FileInfo(**data, app_id=app_id, path=path + f'/{data.get("name")}')
543+
FileInfo(**data, app_id=app_id, path=path + f"/{data.get('name')}")
544544
for data in response.response
545545
]
546546

@@ -568,7 +568,7 @@ async def read_app_file(
568568
"""
569569
response: Response = await self._http.read_app_file(app_id, path)
570570
if response.response:
571-
return BytesIO(bytes(response.response.get('data')))
571+
return BytesIO(bytes(response.response.get("data")))
572572
return None
573573

574574
@validate
@@ -596,7 +596,7 @@ async def create_app_file(
596596
"""
597597
if not isinstance(file, File):
598598
raise SquareException(
599-
'the file must be an string or a squarecloud.File object'
599+
"the file must be an string or a squarecloud.File object"
600600
)
601601
file_bytes = list(file.bytes.read())
602602
response: Response = await self._http.create_app_file(
@@ -682,7 +682,7 @@ async def github_integration(
682682
app_id=app_id, github_access_token=access_token
683683
)
684684
data = response.response
685-
return data.get('webhook')
685+
return data.get("webhook")
686686

687687
@validate
688688
@_notify_listener(Endpoint.custom_domain())
@@ -751,7 +751,7 @@ async def all_apps_status(self, **_kwargs) -> list[ResumedStatus]:
751751
response: Response = await self._http.all_apps_status()
752752
all_status = []
753753
for status in response.response:
754-
if status['running'] is True:
754+
if status["running"] is True:
755755
all_status.append(ResumedStatus(**status))
756756
return all_status
757757

@@ -777,4 +777,4 @@ async def current_app_integration(self, app_id: str) -> str | None:
777777
response: Response = await self._http.get_app_current_integration(
778778
app_id
779779
)
780-
return response.response['webhook']
780+
return response.response["webhook"]

0 commit comments

Comments
 (0)