Skip to content

Commit 7875134

Browse files
committed
format all
1 parent 4a82d63 commit 7875134

File tree

57 files changed

+1720
-1813
lines changed

Some content is hidden

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

57 files changed

+1720
-1813
lines changed

datacrunch/InferenceClient/inference_client.py

Lines changed: 200 additions & 65 deletions
Large diffs are not rendered by default.

datacrunch/_version.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
try:
22
from importlib.metadata import version
3+
34
__version__ = version('datacrunch')
45
except Exception:
5-
__version__ = "0.0.0+dev" # fallback for development
6+
__version__ = '0.0.0+dev' # fallback for development

datacrunch/authentication/authentication.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,12 @@ def authenticate(self) -> dict:
3434
"""
3535
url = self._base_url + TOKEN_ENDPOINT
3636
payload = {
37-
"grant_type": CLIENT_CREDENTIALS,
38-
"client_id": self._client_id,
39-
"client_secret": self._client_secret
37+
'grant_type': CLIENT_CREDENTIALS,
38+
'client_id': self._client_id,
39+
'client_secret': self._client_secret,
4040
}
4141

42-
response = requests.post(
43-
url, json=payload, headers=self._generate_headers())
42+
response = requests.post(url, json=payload, headers=self._generate_headers())
4443
handle_error(response)
4544

4645
auth_data = response.json()
@@ -71,13 +70,9 @@ def refresh(self) -> dict:
7170
"""
7271
url = self._base_url + TOKEN_ENDPOINT
7372

74-
payload = {
75-
"grant_type": REFRESH_TOKEN,
76-
"refresh_token": self._refresh_token
77-
}
73+
payload = {'grant_type': REFRESH_TOKEN, 'refresh_token': self._refresh_token}
7874

79-
response = requests.post(
80-
url, json=payload, headers=self._generate_headers())
75+
response = requests.post(url, json=payload, headers=self._generate_headers())
8176

8277
# if refresh token is also expired, authenticate again:
8378
if response.status_code == 401 or response.status_code == 400:
@@ -98,9 +93,7 @@ def refresh(self) -> dict:
9893
def _generate_headers(self):
9994
# get the first 10 chars of the client id
10095
client_id_truncated = self._client_id[:10]
101-
headers = {
102-
'User-Agent': 'datacrunch-python-' + client_id_truncated
103-
}
96+
headers = {'User-Agent': 'datacrunch-python-' + client_id_truncated}
10497
return headers
10598

10699
def is_expired(self) -> bool:

datacrunch/balance/balance.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
BALANCE_ENDPOINT = '/balance'
32

43

@@ -48,4 +47,4 @@ def get(self) -> Balance:
4847
:rtype: Balance
4948
"""
5049
balance = self._http_client.get(BALANCE_ENDPOINT).json()
51-
return Balance(balance["amount"], balance["currency"])
50+
return Balance(balance['amount'], balance['currency'])

datacrunch/constants.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,42 +36,42 @@ def __init__(self):
3636

3737

3838
class VolumeStatus:
39-
ORDERED = "ordered"
40-
CREATING = "creating"
41-
ATTACHED = "attached"
42-
DETACHED = "detached"
43-
DELETING = "deleting"
44-
DELETED = "deleted"
39+
ORDERED = 'ordered'
40+
CREATING = 'creating'
41+
ATTACHED = 'attached'
42+
DETACHED = 'detached'
43+
DELETING = 'deleting'
44+
DELETED = 'deleted'
4545
CLONING = 'cloning'
4646

4747
def __init__(self):
4848
return
4949

5050

5151
class VolumeTypes:
52-
NVMe = "NVMe"
53-
HDD = "HDD"
52+
NVMe = 'NVMe'
53+
HDD = 'HDD'
5454

5555
def __init__(self):
5656
return
5757

5858

5959
class Locations:
60-
FIN_01: str = "FIN-01"
61-
ICE_01: str = "ICE-01"
60+
FIN_01: str = 'FIN-01'
61+
ICE_01: str = 'ICE-01'
6262

6363
def __init__(self):
6464
return
6565

6666

6767
class ErrorCodes:
68-
INVALID_REQUEST = "invalid_request"
69-
UNAUTHORIZED_REQUEST = "unauthorized_request"
70-
INSUFFICIENT_FUNDS = "insufficient_funds"
71-
FORBIDDEN_ACTION = "forbidden_action"
72-
NOT_FOUND = "not_found"
73-
SERVER_ERROR = "server_error"
74-
SERVICE_UNAVAILABLE = "service_unavailable"
68+
INVALID_REQUEST = 'invalid_request'
69+
UNAUTHORIZED_REQUEST = 'unauthorized_request'
70+
INSUFFICIENT_FUNDS = 'insufficient_funds'
71+
FORBIDDEN_ACTION = 'forbidden_action'
72+
NOT_FOUND = 'not_found'
73+
SERVER_ERROR = 'server_error'
74+
SERVICE_UNAVAILABLE = 'service_unavailable'
7575

7676
def __init__(self):
7777
return

0 commit comments

Comments
 (0)