Skip to content

Commit 4ebbafe

Browse files
author
nazarfil
committed
reuse type
1 parent a924cf1 commit 4ebbafe

2 files changed

Lines changed: 4 additions & 20 deletions

File tree

openhexa/sdk/workspaces/current_workspace.py

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
from dataclasses import fields, make_dataclass
88
from warnings import warn
99

10+
from openhexa.cli.api import OpenHexaClient
1011
from openhexa.utils import stringcase
1112

13+
from ...cli.graphql.graphql_client import GetCountriesWorkspaceCountries
1214
from ..datasets import Dataset
1315
from ..utils import graphql
1416
from .connection import (
@@ -20,23 +22,6 @@
2022
PostgreSQLConnection,
2123
S3Connection,
2224
)
23-
from openhexa.cli.api import OpenHexaClient
24-
25-
26-
class Country:
27-
"""Represents a country with its code, name, alpha3 code and flag."""
28-
29-
def __init__(self, code: str, name: str, alpha3: str, flag: str):
30-
"""Initialize a Country object."""
31-
self.code = code
32-
self.name = name
33-
self.alpha3 = alpha3
34-
self.flag = flag
35-
36-
def __repr__(self):
37-
"""Return a string representation of the Country object."""
38-
return f"Country(code={self.code}, name={self.name}, alpha3={self.alpha3}, flag={self.flag})"
39-
4025

4126
class WorkspaceConfigError(Exception):
4227
"""Raised whenever the system cannot find an environment variable required to configure the current workspace."""
@@ -76,7 +61,7 @@ def slug(self) -> str:
7661
raise WorkspaceConfigError("The workspace slug is not available in this environment.")
7762

7863
@property
79-
def countries(self) -> list[Country]:
64+
def countries(self) -> list[GetCountriesWorkspaceCountries]:
8065
"""The countries of the workspace."""
8166
try:
8267
return OpenHexaClient().get_countries(workspace_slug=self.slug).workspace.countries

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ ignore = [
9797
"ANN202",
9898
"ANN204",
9999
"ANN205",
100-
"ANN401",
101-
"D105"
100+
"ANN401"
102101
]
103102

104103
[tool.ruff.pycodestyle]

0 commit comments

Comments
 (0)