esgvoc 0.2.1__py3-none-any.whl → 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of esgvoc might be problematic. Click here for more details.

Files changed (79) hide show
  1. esgvoc/__init__.py +3 -1
  2. esgvoc/api/__init__.py +96 -72
  3. esgvoc/api/data_descriptors/__init__.py +18 -12
  4. esgvoc/api/data_descriptors/activity.py +8 -45
  5. esgvoc/api/data_descriptors/area_label.py +6 -0
  6. esgvoc/api/data_descriptors/branded_suffix.py +5 -0
  7. esgvoc/api/data_descriptors/branded_variable.py +5 -0
  8. esgvoc/api/data_descriptors/consortium.py +16 -56
  9. esgvoc/api/data_descriptors/data_descriptor.py +106 -0
  10. esgvoc/api/data_descriptors/date.py +3 -46
  11. esgvoc/api/data_descriptors/directory_date.py +3 -46
  12. esgvoc/api/data_descriptors/experiment.py +19 -54
  13. esgvoc/api/data_descriptors/forcing_index.py +3 -45
  14. esgvoc/api/data_descriptors/frequency.py +6 -43
  15. esgvoc/api/data_descriptors/grid_label.py +6 -44
  16. esgvoc/api/data_descriptors/horizontal_label.py +6 -0
  17. esgvoc/api/data_descriptors/initialisation_index.py +3 -44
  18. esgvoc/api/data_descriptors/institution.py +11 -54
  19. esgvoc/api/data_descriptors/license.py +4 -44
  20. esgvoc/api/data_descriptors/mip_era.py +6 -44
  21. esgvoc/api/data_descriptors/model_component.py +7 -45
  22. esgvoc/api/data_descriptors/organisation.py +3 -40
  23. esgvoc/api/data_descriptors/physic_index.py +3 -45
  24. esgvoc/api/data_descriptors/product.py +4 -43
  25. esgvoc/api/data_descriptors/realisation_index.py +3 -44
  26. esgvoc/api/data_descriptors/realm.py +4 -42
  27. esgvoc/api/data_descriptors/resolution.py +6 -44
  28. esgvoc/api/data_descriptors/source.py +18 -53
  29. esgvoc/api/data_descriptors/source_type.py +3 -41
  30. esgvoc/api/data_descriptors/sub_experiment.py +3 -41
  31. esgvoc/api/data_descriptors/table.py +6 -48
  32. esgvoc/api/data_descriptors/temporal_label.py +6 -0
  33. esgvoc/api/data_descriptors/time_range.py +3 -27
  34. esgvoc/api/data_descriptors/variable.py +13 -71
  35. esgvoc/api/data_descriptors/variant_label.py +3 -47
  36. esgvoc/api/data_descriptors/vertical_label.py +5 -0
  37. esgvoc/api/project_specs.py +3 -2
  38. esgvoc/api/projects.py +727 -446
  39. esgvoc/api/py.typed +0 -0
  40. esgvoc/api/report.py +29 -16
  41. esgvoc/api/search.py +140 -95
  42. esgvoc/api/universe.py +362 -156
  43. esgvoc/apps/__init__.py +3 -4
  44. esgvoc/apps/drs/constants.py +1 -1
  45. esgvoc/apps/drs/generator.py +185 -198
  46. esgvoc/apps/drs/report.py +272 -136
  47. esgvoc/apps/drs/validator.py +132 -145
  48. esgvoc/apps/py.typed +0 -0
  49. esgvoc/cli/drs.py +32 -21
  50. esgvoc/cli/get.py +35 -31
  51. esgvoc/cli/install.py +11 -8
  52. esgvoc/cli/main.py +0 -2
  53. esgvoc/cli/status.py +5 -5
  54. esgvoc/cli/valid.py +40 -40
  55. esgvoc/core/constants.py +1 -1
  56. esgvoc/core/db/__init__.py +2 -4
  57. esgvoc/core/db/connection.py +5 -3
  58. esgvoc/core/db/models/project.py +50 -8
  59. esgvoc/core/db/models/universe.py +51 -12
  60. esgvoc/core/db/project_ingestion.py +60 -46
  61. esgvoc/core/db/universe_ingestion.py +58 -29
  62. esgvoc/core/exceptions.py +33 -0
  63. esgvoc/core/logging_handler.py +1 -1
  64. esgvoc/core/repo_fetcher.py +4 -3
  65. esgvoc/core/service/__init__.py +37 -5
  66. esgvoc/core/service/configuration/config_manager.py +188 -0
  67. esgvoc/core/service/configuration/setting.py +88 -0
  68. esgvoc/core/service/state.py +49 -32
  69. {esgvoc-0.2.1.dist-info → esgvoc-0.4.0.dist-info}/METADATA +34 -3
  70. esgvoc-0.4.0.dist-info/RECORD +80 -0
  71. esgvoc/api/_utils.py +0 -39
  72. esgvoc/cli/config.py +0 -82
  73. esgvoc/core/service/settings.py +0 -73
  74. esgvoc/core/service/settings.toml +0 -17
  75. esgvoc/core/service/settings_default.toml +0 -17
  76. esgvoc-0.2.1.dist-info/RECORD +0 -73
  77. {esgvoc-0.2.1.dist-info → esgvoc-0.4.0.dist-info}/WHEEL +0 -0
  78. {esgvoc-0.2.1.dist-info → esgvoc-0.4.0.dist-info}/entry_points.txt +0 -0
  79. {esgvoc-0.2.1.dist-info → esgvoc-0.4.0.dist-info}/licenses/LICENSE.txt +0 -0
esgvoc/__init__.py CHANGED
@@ -1 +1,3 @@
1
- import esgvoc.core.logging_handler
1
+ import esgvoc.core.logging_handler # noqa
2
+
3
+ __version__ = "0.4.0"
esgvoc/api/__init__.py CHANGED
@@ -1,73 +1,97 @@
1
- from esgvoc.api.search import MatchingTerm, SearchType, SearchSettings
2
- from esgvoc.api.report import (ValidationError,
3
- ValidationReport,
4
- ValidationErrorVisitor,
5
- ProjectTermError,
6
- UniverseTermError)
7
- from esgvoc.api.universe import (get_all_terms_in_universe,
8
- get_all_data_descriptors_in_universe,
9
- find_data_descriptors_in_universe,
10
- get_all_terms_in_data_descriptor,
11
- find_terms_in_universe,
12
- find_terms_in_data_descriptor)
13
- from esgvoc.api.projects import (get_all_projects,
14
- find_project,
15
- get_all_terms_in_all_projects,
16
- get_all_terms_in_project,
17
- get_all_collections_in_project,
18
- find_collections_in_project,
19
- get_all_terms_in_collection,
20
- find_terms_in_project,
21
- find_terms_in_all_projects,
22
- find_terms_from_data_descriptor_in_all_projects,
23
- find_terms_from_data_descriptor_in_project,
24
- find_terms_in_collection,
25
- valid_term_in_all_projects,
26
- valid_term_in_project,
27
- valid_term_in_collection,
28
- valid_term)
29
- from esgvoc.api.project_specs import (DrsType,
30
- DrsPartKind,
31
- DrsConstant,
32
- DrsCollection,
33
- DrsPart,
34
- DrsSpecification,
35
- ProjectSpecs)
1
+ from esgvoc.api.project_specs import (
2
+ DrsCollection,
3
+ DrsConstant,
4
+ DrsPart,
5
+ DrsPartKind,
6
+ DrsSpecification,
7
+ DrsType,
8
+ ProjectSpecs,
9
+ )
10
+ from esgvoc.api.projects import (
11
+ find_collections_in_project,
12
+ find_items_in_project,
13
+ find_terms_in_all_projects,
14
+ find_terms_in_collection,
15
+ find_terms_in_project,
16
+ get_all_collections_in_project,
17
+ get_all_projects,
18
+ get_all_terms_in_all_projects,
19
+ get_all_terms_in_collection,
20
+ get_all_terms_in_project,
21
+ get_collection_from_data_descriptor_in_all_projects,
22
+ get_collection_from_data_descriptor_in_project,
23
+ get_collection_in_project,
24
+ get_project,
25
+ get_term_in_collection,
26
+ get_term_in_project,
27
+ valid_term,
28
+ valid_term_in_all_projects,
29
+ valid_term_in_collection,
30
+ valid_term_in_project,
31
+ )
32
+ from esgvoc.api.report import (
33
+ ProjectTermError,
34
+ UniverseTermError,
35
+ ValidationError,
36
+ ValidationErrorVisitor,
37
+ ValidationReport,
38
+ )
39
+ from esgvoc.api.search import MatchingTerm
40
+ from esgvoc.api.universe import (
41
+ find_data_descriptors_in_universe,
42
+ find_items_in_universe,
43
+ find_terms_in_data_descriptor,
44
+ find_terms_in_universe,
45
+ get_all_data_descriptors_in_universe,
46
+ get_all_terms_in_data_descriptor,
47
+ get_all_terms_in_universe,
48
+ get_data_descriptor_in_universe,
49
+ get_term_in_data_descriptor,
50
+ get_term_in_universe,
51
+ )
36
52
 
37
- __all__ = ["MatchingTerm",
38
- "SearchType",
39
- "SearchSettings",
40
- "ValidationError",
41
- "ValidationReport",
42
- "ValidationErrorVisitor",
43
- "ProjectTermError",
44
- "UniverseTermError",
45
- "get_all_terms_in_universe",
46
- "get_all_data_descriptors_in_universe",
47
- "find_data_descriptors_in_universe",
48
- "get_all_terms_in_data_descriptor",
49
- "find_terms_in_universe",
50
- "find_terms_in_data_descriptor",
51
- "get_all_projects",
52
- "find_project",
53
- "get_all_terms_in_all_projects",
54
- "get_all_terms_in_project",
55
- "get_all_collections_in_project",
56
- "find_collections_in_project",
57
- "get_all_terms_in_collection",
58
- "find_terms_in_project",
59
- "find_terms_in_all_projects",
60
- "find_terms_from_data_descriptor_in_all_projects",
61
- "find_terms_from_data_descriptor_in_project",
62
- "find_terms_in_collection",
63
- "valid_term_in_all_projects",
64
- "valid_term_in_project",
65
- "valid_term_in_collection",
66
- "valid_term",
67
- "DrsType",
68
- "DrsPartKind",
69
- "DrsConstant",
70
- "DrsCollection",
71
- "DrsPart",
72
- "DrsSpecification",
73
- "ProjectSpecs"]
53
+ __all__ = [
54
+ "DrsCollection",
55
+ "DrsConstant",
56
+ "DrsPart",
57
+ "DrsPartKind",
58
+ "DrsSpecification",
59
+ "DrsType",
60
+ "find_collections_in_project",
61
+ "find_data_descriptors_in_universe",
62
+ "find_items_in_project",
63
+ "find_items_in_universe",
64
+ "find_terms_in_all_projects",
65
+ "find_terms_in_collection",
66
+ "find_terms_in_data_descriptor",
67
+ "find_terms_in_project",
68
+ "find_terms_in_universe",
69
+ "get_all_collections_in_project",
70
+ "get_all_data_descriptors_in_universe",
71
+ "get_all_projects",
72
+ "get_all_terms_in_all_projects",
73
+ "get_all_terms_in_collection",
74
+ "get_all_terms_in_data_descriptor",
75
+ "get_all_terms_in_project",
76
+ "get_all_terms_in_universe",
77
+ "get_collection_from_data_descriptor_in_all_projects",
78
+ "get_collection_from_data_descriptor_in_project",
79
+ "get_collection_in_project",
80
+ "get_data_descriptor_in_universe",
81
+ "get_project",
82
+ "get_term_in_collection",
83
+ "get_term_in_data_descriptor",
84
+ "get_term_in_project",
85
+ "get_term_in_universe",
86
+ "MatchingTerm",
87
+ "ProjectSpecs",
88
+ "ProjectTermError",
89
+ "UniverseTermError",
90
+ "valid_term",
91
+ "valid_term_in_all_projects",
92
+ "valid_term_in_collection",
93
+ "valid_term_in_project",
94
+ "ValidationError",
95
+ "ValidationErrorVisitor",
96
+ "ValidationReport"
97
+ ]
@@ -1,9 +1,8 @@
1
- from esgvoc.api.data_descriptors.directory_date import DirectoryDate
2
- from pydantic import BaseModel
3
-
4
1
  from esgvoc.api.data_descriptors.activity import Activity
5
2
  from esgvoc.api.data_descriptors.consortium import Consortium
3
+ from esgvoc.api.data_descriptors.data_descriptor import DataDescriptor
6
4
  from esgvoc.api.data_descriptors.date import Date
5
+ from esgvoc.api.data_descriptors.directory_date import DirectoryDate
7
6
  from esgvoc.api.data_descriptors.experiment import Experiment
8
7
  from esgvoc.api.data_descriptors.forcing_index import ForcingIndex
9
8
  from esgvoc.api.data_descriptors.frequency import Frequency
@@ -26,10 +25,14 @@ from esgvoc.api.data_descriptors.table import Table
26
25
  from esgvoc.api.data_descriptors.time_range import TimeRange
27
26
  from esgvoc.api.data_descriptors.variable import Variable
28
27
  from esgvoc.api.data_descriptors.variant_label import VariantLabel
29
- from esgvoc.api.data_descriptors.directory_date import DirectoryDate
30
-
28
+ from esgvoc.api.data_descriptors.area_label import AreaLabel
29
+ from esgvoc.api.data_descriptors.vertical_label import VerticalLabel
30
+ from esgvoc.api.data_descriptors.horizontal_label import HorizontalLabel
31
+ from esgvoc.api.data_descriptors.temporal_label import TemporalLabel
32
+ from esgvoc.api.data_descriptors.branded_suffix import BrandedSuffix
33
+ from esgvoc.api.data_descriptors.branded_variable import BrandedVariable
31
34
 
32
- DATA_DESCRIPTOR_CLASS_MAPPING: dict[str, type[BaseModel]] = {
35
+ DATA_DESCRIPTOR_CLASS_MAPPING: dict[str, type[DataDescriptor]] = {
33
36
  "activity": Activity,
34
37
  "consortium": Consortium,
35
38
  "date": Date,
@@ -37,9 +40,8 @@ DATA_DESCRIPTOR_CLASS_MAPPING: dict[str, type[BaseModel]] = {
37
40
  "experiment": Experiment,
38
41
  "forcing_index": ForcingIndex,
39
42
  "frequency": Frequency,
40
- "grid": GridLabel, # DEBUG: the value of the key type for the terms of the DD grid is not consistent.
41
- "grid-label": GridLabel, # DEBUG: the value of the key type for the terms of the DD grid is not consistent.
42
- "grid_label": GridLabel, # DEBUG: the value of the key type for the terms of the DD grid is not consistent.
43
+ "grid": GridLabel,#Universe
44
+ "grid_label": GridLabel, # cmip6, cmip6plus
43
45
  "initialisation_index": InitialisationIndex,
44
46
  "institution": Institution,
45
47
  "license": License,
@@ -57,7 +59,11 @@ DATA_DESCRIPTOR_CLASS_MAPPING: dict[str, type[BaseModel]] = {
57
59
  "table" : Table,
58
60
  "time_range": TimeRange,
59
61
  "variable": Variable,
60
- "real": Variable, # DEBUG: key type should be the pydantic class for the terms of DD variable!
61
- "integer": Variable, # DEBUG: key type should be the pydantic class for the terms of DD variable!
62
- "variant_label": VariantLabel
62
+ "variant_label": VariantLabel,
63
+ "area_label": AreaLabel,
64
+ "temporal_label": TemporalLabel,
65
+ "vertical_label" : VerticalLabel,
66
+ "horizontal_label" : HorizontalLabel,
67
+ "branded_suffix" : BrandedSuffix,
68
+ "branded_variable" : BrandedVariable
63
69
  }
@@ -1,51 +1,14 @@
1
+ from esgvoc.api.data_descriptors.data_descriptor import PlainTermDataDescriptor
1
2
 
2
- from __future__ import annotations
3
- from typing import (
4
- Optional
5
- )
6
- from pydantic.version import VERSION as PYDANTIC_VERSION
7
- if int(PYDANTIC_VERSION[0])>=2:
8
- from pydantic import (
9
- BaseModel,
10
- ConfigDict,
11
- Field
12
- )
13
- else:
14
- from pydantic import (
15
- BaseModel,
16
- Field
17
- )
18
3
 
19
- metamodel_version = "None"
20
- version = "None"
21
-
22
-
23
- class ConfiguredBaseModel(BaseModel):
24
- model_config = ConfigDict(
25
- validate_assignment = True,
26
- validate_default = True,
27
- extra = "allow",
28
- arbitrary_types_allowed = True,
29
- use_enum_values = True,
30
- strict = False,
31
- )
32
- pass
33
-
34
-
35
-
36
- class Activity(ConfiguredBaseModel):
4
+ class Activity(PlainTermDataDescriptor):
37
5
  """
38
- an 'activity' refers to a coordinated set of modeling experiments designed to address specific scientific questions or objectives. Each activity is focused on different aspects of climate science and utilizes various models to study a wide range of climate phenomena. Activities are often organized around key research themes and may involve multiple experiments, scenarios, and model configurations.
6
+ An 'activity' refers to a coordinated set of modeling experiments designed to address specific \
7
+ scientific questions or objectives. Each activity is focused on different aspects of climate \
8
+ science and utilizes various models to study a wide range of climate phenomena. \
9
+ Activities are often organized around key research themes and may involve multiple experiments, \
10
+ scenarios, and model configurations.
39
11
  """
40
-
41
- id: str
42
- validation_method: str = Field(default = "list")
43
12
  name: str
44
13
  long_name: str
45
- cmip_acronym: str
46
- url: Optional[str]
47
-
48
-
49
- # Model rebuild
50
- # see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
51
- Activity.model_rebuild()
14
+ url: str|None
@@ -0,0 +1,6 @@
1
+ from esgvoc.api.data_descriptors.data_descriptor import PlainTermDataDescriptor
2
+
3
+
4
+ class AreaLabel(PlainTermDataDescriptor):
5
+ description: str
6
+ label: str
@@ -0,0 +1,5 @@
1
+ from esgvoc.api.data_descriptors.data_descriptor import CompositeTermDataDescriptor
2
+
3
+
4
+ class BrandedSuffix(CompositeTermDataDescriptor):
5
+ description: str
@@ -0,0 +1,5 @@
1
+ from esgvoc.api.data_descriptors.data_descriptor import CompositeTermDataDescriptor
2
+
3
+
4
+ class BrandedVariable(CompositeTermDataDescriptor):
5
+ description: str
@@ -1,66 +1,26 @@
1
-
2
- from __future__ import annotations
3
- from typing import (
4
- List,
5
- Optional,
6
- Union
7
- )
8
- from pydantic.version import VERSION as PYDANTIC_VERSION
9
- if int(PYDANTIC_VERSION[0])>=2:
10
- from pydantic import (
11
- BaseModel,
12
- ConfigDict,
13
- Field
14
- )
15
- else:
16
- from pydantic import (
17
- BaseModel,
18
- Field
19
- )
20
-
21
- metamodel_version = "None"
22
- version = "None"
23
-
24
-
25
- class ConfiguredBaseModel(BaseModel):
26
- model_config = ConfigDict(
27
- validate_assignment = True,
28
- validate_default = True,
29
- extra = "allow",
30
- arbitrary_types_allowed = True,
31
- use_enum_values = True,
32
- strict = False,
33
- )
34
- pass
1
+ from pydantic import Field
2
+ from esgvoc.api.data_descriptors.data_descriptor import PlainTermDataDescriptor, ConfiguredBaseModel
35
3
 
36
4
 
37
5
  class Dates(ConfiguredBaseModel):
38
-
39
- phase : str
40
- from_ : int = Field(...,alias="from") # cause from is a keyword
41
- to: Union[int,str]
6
+ phase: str
7
+ from_: int = Field(...,alias="from") # Cause from is a keyword
8
+ to: int|str
42
9
 
43
10
 
44
11
  class Member(ConfiguredBaseModel):
45
-
46
12
  type : str
47
- institution : str # id
48
- dates : List[Dates] = Field(default_factory=list)
49
- membership_type : str # prior, current
13
+ institution: str # id
14
+ dates: list[Dates] = Field(default_factory=list)
15
+ membership_type: str # prior, current
50
16
 
51
- class Consortium(ConfiguredBaseModel):
52
17
 
53
- id: str
18
+ class Consortium(PlainTermDataDescriptor):
54
19
  validation_method: str = Field(default = "list")
55
- type: str
56
- name: Optional[str] = None
57
- cmip_acronym: str = Field(...,alias="cmip-acronym")
58
- status : Optional[str] = None
59
- changes : Optional[str]
60
- members : List[Member] = Field(default_factory=list)
61
- url: Optional[str]
62
-
63
-
64
- # Model rebuild
65
- # see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
66
- Consortium.model_rebuild()
20
+ name: str|None = None
21
+ status: str|None = None
22
+ changes: str|None
23
+ members: list[Member] = Field(default_factory=list)
24
+ url: str|None
25
+ # TODO: remove default value when all json will have their description.
26
+ description: str = Field(default = "")
@@ -0,0 +1,106 @@
1
+ from typing import Protocol, Any, ClassVar
2
+ from abc import ABC, abstractmethod
3
+ from pydantic import BaseModel, ConfigDict
4
+
5
+
6
+ class ConfiguredBaseModel(BaseModel):
7
+ model_config = ConfigDict(
8
+ validate_assignment = True,
9
+ validate_default = True,
10
+ extra = "allow",
11
+ arbitrary_types_allowed = True,
12
+ use_enum_values = True,
13
+ strict = False,
14
+ )
15
+
16
+
17
+ class DataDescriptorVisitor(Protocol):
18
+ """
19
+ The specifications for a term visitor.
20
+ """
21
+ def visit_sub_set_term(self, term: "DataDescriptorSubSet") -> Any:
22
+ """Visit a sub set of the information of a term."""
23
+ pass
24
+ def visit_plain_term(self, term: "PlainTermDataDescriptor") -> Any:
25
+ """Visit a plain term."""
26
+ pass
27
+ def visit_pattern_term(self, term: "PatternTermDataDescriptor") -> Any:
28
+ """Visit a pattern term."""
29
+ pass
30
+ def visit_composite_term(self, term: "CompositeTermDataDescriptor") -> Any:
31
+ """Visit a composite term."""
32
+
33
+
34
+ class DataDescriptor(ConfiguredBaseModel, ABC):
35
+ """
36
+ Generic class for the data descriptor classes.
37
+ """
38
+ id: str
39
+ """The identifier of the terms."""
40
+ type: str
41
+ """The data descriptor to which the term belongs."""
42
+
43
+ @abstractmethod
44
+ def accept(self, visitor: DataDescriptorVisitor) -> Any:
45
+ """
46
+ Accept an term visitor.
47
+
48
+ :param visitor: The term visitor.
49
+ :type visitor: DataDescriptorVisitor
50
+ :return: Depending on the visitor.
51
+ :rtype: Any
52
+ """
53
+ pass
54
+
55
+
56
+ class DataDescriptorSubSet(DataDescriptor):
57
+ """
58
+ A sub set of the information contains in a term.
59
+ """
60
+ MANDATORY_TERM_FIELDS: ClassVar[tuple[str, str]] = ('id', 'type')
61
+ """The set of mandatory term fields."""
62
+ def accept(self, visitor: DataDescriptorVisitor) -> Any:
63
+ return visitor.visit_sub_set_term(self)
64
+
65
+
66
+ class PlainTermDataDescriptor(DataDescriptor):
67
+ """
68
+ A data descriptor that describes hand written terms.
69
+ """
70
+ drs_name: str
71
+ def accept(self, visitor: DataDescriptorVisitor) -> Any:
72
+ return visitor.visit_plain_term(self)
73
+
74
+
75
+ class PatternTermDataDescriptor(DataDescriptor):
76
+ """
77
+ A data descriptor that describes terms defined by a regular expression.
78
+ """
79
+ regex: str
80
+ """The regular expression."""
81
+ def accept(self, visitor: DataDescriptorVisitor) -> Any:
82
+ return visitor.visit_pattern_term(self)
83
+
84
+
85
+ class CompositeTermPart(ConfiguredBaseModel):
86
+ """
87
+ A reference to a term, part of a composite term.
88
+ """
89
+ id: str
90
+ """The id of the referenced term."""
91
+ type: str
92
+ """The type of the referenced term."""
93
+ is_required : bool
94
+ """Denote if the term is optional as part of a composite term."""
95
+
96
+
97
+ class CompositeTermDataDescriptor(DataDescriptor):
98
+ """
99
+ A data descriptor that describes terms composed of other terms.
100
+ """
101
+ separator: str
102
+ """The components separator character."""
103
+ parts: list[CompositeTermPart]
104
+ """The components."""
105
+ def accept(self, visitor: DataDescriptorVisitor) -> Any:
106
+ return visitor.visit_composite_term(self)
@@ -1,48 +1,5 @@
1
+ from esgvoc.api.data_descriptors.data_descriptor import PatternTermDataDescriptor
1
2
 
2
3
 
3
-
4
-
5
-
6
-
7
-
8
- from __future__ import annotations
9
- from pydantic.version import VERSION as PYDANTIC_VERSION
10
- if int(PYDANTIC_VERSION[0])>=2:
11
- from pydantic import (
12
- BaseModel,
13
- ConfigDict
14
- )
15
- else:
16
- from pydantic import (
17
- BaseModel
18
- )
19
-
20
- metamodel_version = "None"
21
- version = "None"
22
-
23
-
24
- class ConfiguredBaseModel(BaseModel):
25
- model_config = ConfigDict(
26
- validate_assignment = True,
27
- validate_default = True,
28
- extra = "allow",
29
- arbitrary_types_allowed = True,
30
- use_enum_values = True,
31
- strict = False,
32
- )
33
- pass
34
-
35
-
36
-
37
-
38
-
39
- class Date(ConfiguredBaseModel):
40
-
41
-
42
-
43
- id: str
44
- type : str
45
- regex : str
46
- # Model rebuild
47
- # see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
48
- Date.model_rebuild()
4
+ class Date(PatternTermDataDescriptor):
5
+ pass
@@ -1,48 +1,5 @@
1
+ from esgvoc.api.data_descriptors.data_descriptor import PatternTermDataDescriptor
1
2
 
2
3
 
3
-
4
- from __future__ import annotations
5
- from typing import (
6
- List
7
- )
8
- from pydantic.version import VERSION as PYDANTIC_VERSION
9
- if int(PYDANTIC_VERSION[0])>=2:
10
- from pydantic import (
11
- BaseModel,
12
- ConfigDict
13
- )
14
- else:
15
- from pydantic import (
16
- BaseModel
17
- )
18
-
19
- metamodel_version = "None"
20
- version = "None"
21
-
22
-
23
- class ConfiguredBaseModel(BaseModel):
24
- model_config = ConfigDict(
25
- validate_assignment = True,
26
- validate_default = True,
27
- extra = "allow",
28
- arbitrary_types_allowed = True,
29
- use_enum_values = True,
30
- strict = False,
31
- )
32
- pass
33
-
34
- class Part(ConfiguredBaseModel):
35
- id: str
36
- type : str
37
- is_required : bool
38
-
39
- class DirectoryDate(ConfiguredBaseModel):
40
-
41
-
42
- id: str
43
- type: str
44
- regex : str
45
-
46
- # Model rebuild
47
- # see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
48
- DirectoryDate.model_rebuild()
4
+ class DirectoryDate(PatternTermDataDescriptor):
5
+ pass