Skip to content

Commit 897448f

Browse files
author
JD
committed
chore(types): clean types annotations
1 parent 281335a commit 897448f

File tree

19 files changed

+600
-559
lines changed

19 files changed

+600
-559
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CS_TOKEN="secret_token"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ wheels/
1616
.venv/
1717
venv/
1818
env/
19+
*.env
1920

2021
.pytest_cache

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ install: ## Sets up the development environment
1212
@echo "2. Installing all dependencies (including 'dev')..."
1313
uv pip install -e '.[dev]'
1414
@echo "3. Installing git hooks with pre-commit..."
15-
pre-commit install --hook-type commit-msg --hook-type pre-commit --hook-type pre-push
15+
uv run pre-commit install --hook-type commit-msg --hook-type pre-commit --hook-type pre-push
1616
@echo "\n\033[0;32mSetup complete! Please activate the virtual environment with 'source .venv/bin/activate'.\033[0m"
1717

1818
commit: ## Starts Commitizen for a guided commit message
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
import asyncio
2-
import pprint
32
from codesphere import CodesphereSDK
43

54

65
async def main():
76
"""Fetches datacenters."""
87
async with CodesphereSDK() as sdk:
98
datacenters = await sdk.metadata.datacenters()
10-
119
for datacenter in datacenters:
12-
pprint.pprint(datacenter.name)
13-
pprint.pprint(datacenter.city)
14-
pprint.pprint(datacenter.countryCode)
15-
pprint.pprint(datacenter.id)
10+
print(datacenter.model_dump_json(indent=2))
11+
1612

1713
if __name__ == "__main__":
1814
asyncio.run(main())
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
import asyncio
2-
import pprint
32
from codesphere import CodesphereSDK
43

54

65
async def main():
76
"""Fetches base images."""
87
async with CodesphereSDK() as sdk:
98
images = await sdk.metadata.images()
10-
119
for image in images:
12-
pprint.pprint(image.id)
13-
pprint.pprint(image.name)
14-
pprint.pprint(image.supportedUntil)
10+
print(image.model_dump_json(indent=2))
11+
1512

1613
if __name__ == "__main__":
1714
asyncio.run(main())
Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import asyncio
2-
import pprint
32
from codesphere import CodesphereSDK
43

54

@@ -9,18 +8,8 @@ async def main():
98
plans = await sdk.metadata.plans()
109

1110
for plan in plans:
12-
pprint.pprint(plan.id)
13-
pprint.pprint(plan.title)
14-
pprint.pprint(plan.priceUsd)
15-
pprint.pprint(plan.deprecated)
16-
pprint.pprint(plan.characteristics.id)
17-
pprint.pprint(plan.characteristics.CPU)
18-
pprint.pprint(plan.characteristics.GPU)
19-
pprint.pprint(plan.characteristics.RAM)
20-
pprint.pprint(plan.characteristics.SSD)
21-
pprint.pprint(plan.characteristics.TempStorage)
22-
pprint.pprint(plan.characteristics.onDemand)
23-
pprint.pprint(plan.maxReplicas)
11+
print(plan.model_dump_json(indent=2))
12+
2413

2514
if __name__ == "__main__":
2615
asyncio.run(main())

examples/teams/create_team.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
import asyncio
2-
import pprint
3-
4-
from codesphere import CodesphereSDK
2+
from codesphere import CodesphereSDK, TeamCreate
53

64

75
async def main():
86
try:
97
async with CodesphereSDK() as sdk:
10-
created_team = await sdk.teams.create(name="hello", dc=2)
8+
newTeam = TeamCreate(name="test", dc=2)
9+
created_team = await sdk.teams.create(data=newTeam)
1110
print("\n--- Details for the created team ---")
12-
pprint.pprint(created_team.model_dump())
13-
14-
print(f"Team ID: {created_team.id}, Name: {created_team.name}")
15-
11+
print(created_team.model_dump_json(indent=2))
1612
except Exception as e:
1713
print(f"An error occurred: {e}")
1814

examples/teams/delete_team.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import asyncio
2-
import pprint
3-
42
from codesphere import CodesphereSDK
53

64

@@ -9,7 +7,7 @@ async def main():
97
async with CodesphereSDK() as sdk:
108
team_to_delete = await sdk.teams.get(team_id="<id>")
119
print("\n--- Details of the team to be deleted ---")
12-
pprint.pprint(team_to_delete.model_dump())
10+
print(team_to_delete.model_dump_json(indent=2))
1311
await team_to_delete.delete()
1412
print(f"Team with ID {team_to_delete.id} was successfully deleted.")
1513

examples/teams/get_team.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import asyncio
2-
import pprint
32

43
from codesphere import CodesphereSDK
54

@@ -8,9 +7,10 @@ async def main():
87
try:
98
async with CodesphereSDK() as sdk:
109
teams = await sdk.teams.list()
10+
print(teams[0].model_dump_json(indent=2))
1111
first_team = await sdk.teams.get(team_id=teams[0].id)
1212
print("\n--- Details for the first team ---")
13-
pprint.pprint(first_team.model_dump())
13+
print(first_team.model_dump_json(indent=2))
1414

1515
except Exception as e:
1616
print(f"An error occurred: {e}")

examples/teams/list_teams.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ async def main():
77
try:
88
async with CodesphereSDK() as sdk:
99
teams = await sdk.teams.list()
10-
print(f"Found {len(teams)} teams:")
1110
for team in teams:
12-
print(f"Team ID: {team.id}, Name: {team.name}")
11+
print(team.model_dump_json(indent=2))
1312

1413
except Exception as e:
1514
print(f"An error occurred: {e}")

0 commit comments

Comments
 (0)