Skip to content

Commit

Permalink
Removed quotes on __base.py. Made Agency non Optional. Changed docstr…
Browse files Browse the repository at this point in the history
…ing of categories method. Added omit_defaults to category.py

Signed-off-by: javier.hernandez <javier.hernandez@meaningfuldata.eu>
  • Loading branch information
javihern98 committed May 2, 2024
1 parent 2739b1c commit 40e23ff
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 59 deletions.
114 changes: 57 additions & 57 deletions src/pysdmx/model/__base.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,29 +114,6 @@ class VersionableArtefact(NameableArtefact, frozen=True, omit_defaults=True):
valid_to: Optional[datetime] = None


class MaintainableArtefact(
VersionableArtefact, frozen=True, omit_defaults=True
):
"""Maintainable Artefact class.
An abstract class to group together primary structural metadata
artefacts that are maintained by an Agency.
Attributes:
is_final: Whether the artefact is final.
is_external_reference: Whether the artefact is an external reference.
service_url: The URL of the service.
structure_url: The URL of the structure.
agency: The maintainer of the artefact.
"""

is_final: bool = False
is_external_reference: bool = False
service_url: Optional[str] = None
structure_url: Optional[str] = None
agency: Optional[Union[str, "Agency"]] = None


class Item(NameableArtefact, frozen=True, omit_defaults=True):
"""Item class.
Expand All @@ -147,19 +124,34 @@ class Item(NameableArtefact, frozen=True, omit_defaults=True):
"""


class ItemScheme(MaintainableArtefact, frozen=True, omit_defaults=True):
"""ItemScheme class.
The descriptive information for an arrangement or division of objects
into groups based on characteristics, which the objects have in common.
class Contact(Struct, frozen=True, omit_defaults=True):
"""Contact details such as the name of a contact and his email address.
Attributes:
items: The list of items in the scheme.
is_partial: Whether the scheme is partial.
id: An identifier for a contact. If the contact represents a person,
this could be the person's username in the organisation.
name: The contact name, which could be the name of a person, the name
of a service ("e.g. Support"), etc.
department: The department in which the contact is located (e.g.
"Statistics").
role: The contact's role, which could be his job title, or a role such
as data owner, data steward, subject matter expert, etc.
telephones: A list of telephone numbers.
faxes: A list of fax numbers.
uris: A list of URLs relevant for the contact (e.g. a link to an online
form that can be used to send questions, a link to a support forum,
etc.).
emails: a list of email addresses.
"""

items: Sequence["Item"] = ()
is_partial: bool = False
id: Optional[str] = None
name: Optional[str] = None
department: Optional[str] = None
role: Optional[str] = None
telephones: Optional[Sequence[str]] = None
faxes: Optional[Sequence[str]] = None
uris: Optional[Sequence[str]] = None
emails: Optional[Sequence[str]] = None


class Organisation(Item, frozen=True, omit_defaults=True):
Expand All @@ -169,7 +161,7 @@ class Organisation(Item, frozen=True, omit_defaults=True):
contacts: The contact of the agency.
"""

contacts: Sequence["Contact"] = ()
contacts: Sequence[Contact] = ()


class Agency(Organisation, frozen=True, omit_defaults=True):
Expand All @@ -182,31 +174,39 @@ class Agency(Organisation, frozen=True, omit_defaults=True):
"""


class Contact(Struct, frozen=True, omit_defaults=True):
"""Contact details such as the name of a contact and his email address.
class MaintainableArtefact(
VersionableArtefact, frozen=True, omit_defaults=True
):
"""Maintainable Artefact class.
An abstract class to group together primary structural metadata
artefacts that are maintained by an Agency.
Attributes:
id: An identifier for a contact. If the contact represents a person,
this could be the person's username in the organisation.
name: The contact name, which could be the name of a person, the name
of a service ("e.g. Support"), etc.
department: The department in which the contact is located (e.g.
"Statistics").
role: The contact's role, which could be his job title, or a role such
as data owner, data steward, subject matter expert, etc.
telephones: A list of telephone numbers.
faxes: A list of fax numbers.
uris: A list of URLs relevant for the contact (e.g. a link to an online
form that can be used to send questions, a link to a support forum,
etc.).
emails: a list of email addresses.
is_final: Whether the artefact is final.
is_external_reference: Whether the artefact is an external reference.
service_url: The URL of the service.
structure_url: The URL of the structure.
agency: The maintainer of the artefact.
"""

id: Optional[str] = None
name: Optional[str] = None
department: Optional[str] = None
role: Optional[str] = None
telephones: Optional[Sequence[str]] = None
faxes: Optional[Sequence[str]] = None
uris: Optional[Sequence[str]] = None
emails: Optional[Sequence[str]] = None
is_final: bool = False
is_external_reference: bool = False
service_url: Optional[str] = None
structure_url: Optional[str] = None
agency: Union[str, Agency] = ""


class ItemScheme(MaintainableArtefact, frozen=True, omit_defaults=True):
"""ItemScheme class.
The descriptive information for an arrangement or division of objects
into groups based on characteristics, which the objects have in common.
Attributes:
items: The list of items in the scheme.
is_partial: Whether the scheme is partial.
"""

items: Sequence[Item] = ()
is_partial: bool = False
4 changes: 2 additions & 2 deletions src/pysdmx/model/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pysdmx.model.organisation import DataflowRef


class Category(Item, frozen=False): # type: ignore[misc]
class Category(Item, frozen=False, omit_defaults=True): # type: ignore[misc]
"""A category, ie a way to **organize and group** things.
Categories are used to organize and group other artefacts in SDMX.
Expand Down Expand Up @@ -68,7 +68,7 @@ class CategoryScheme(ItemScheme, frozen=True, omit_defaults=True):

@property
def categories(self) -> Sequence[Category]:
"""Extract the items in the Category Scheme."""
"""The list of top level categories in the scheme."""
return self.items # type: ignore[return-value]

@property
Expand Down

0 comments on commit 40e23ff

Please sign in to comment.