Skip to content

Commit 5b64d22

Browse files
author
nazarfil
committed
reuse type
1 parent a924cf1 commit 5b64d22

2 files changed

Lines changed: 4 additions & 19 deletions

File tree

openhexa/sdk/workspaces/current_workspace.py

Lines changed: 3 additions & 17 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,22 +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})"
3925

4026

4127
class WorkspaceConfigError(Exception):
@@ -76,7 +62,7 @@ def slug(self) -> str:
7662
raise WorkspaceConfigError("The workspace slug is not available in this environment.")
7763

7864
@property
79-
def countries(self) -> list[Country]:
65+
def countries(self) -> list[GetCountriesWorkspaceCountries]:
8066
"""The countries of the workspace."""
8167
try:
8268
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)