Skip to content

Commit 75a89db

Browse files
committed
[qa] Fixed mypy violations and added docstrings to the generator
1 parent 95ebee7 commit 75a89db

15 files changed

+215
-14
lines changed

pyatlan/generator/templates/custom_relationship.jinja2

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class {{ relationship_info.name | to_cls_name }}(RelationshipAttributes):
1616
default="{{ relationship_info.name }}",
1717
description="{{ relationship_info.description }}",
1818
)
19-
attributes: {{ relationship_info.name | to_cls_name }}.Attributes = Field(
19+
attributes: {{ relationship_info.name | to_cls_name }}.Attributes = Field( # type: ignore[name-defined]
2020
default_factory=lambda: {{ relationship_info.name | to_cls_name }}.Attributes(),
2121
description="Map of attributes in the instance and their values",
2222
)
@@ -84,6 +84,14 @@ class {{ relationship_info.name | to_cls_name }}(RelationshipAttributes):
8484
def {{ relationship_info.end_def1["name"] | to_snake_case }}(
8585
self, related: Asset, semantic: SaveSemantic = SaveSemantic.REPLACE
8686
) -> {{ relationship_info.name | to_cls_name }}.{{ relationship_info.end_def1["name"] | to_cls_name }}:
87+
"""
88+
Build the {{ relationship_info.name | to_cls_name }} relationship (with attributes) into a related object.
89+
90+
:param: related asset to which to build the detailed relationship
91+
:param: semantic to use for saving the relationship
92+
:returns: a detailed Atlan relationship that conforms
93+
to the necessary interface for a related asset
94+
"""
8795
if related.guid:
8896
return {{ relationship_info.name | to_cls_name }}.{{ relationship_info.end_def1["name"] | to_cls_name }}._create_ref(
8997
type_name=related.type_name,
@@ -104,6 +112,14 @@ class {{ relationship_info.name | to_cls_name }}(RelationshipAttributes):
104112
def {{ relationship_info.end_def2["name"] | to_snake_case }}(
105113
self, related: Asset, semantic: SaveSemantic = SaveSemantic.REPLACE
106114
) -> {{ relationship_info.name | to_cls_name }}.{{ relationship_info.end_def2["name"] | to_cls_name }}:
115+
"""
116+
Build the {{ relationship_info.name | to_cls_name }} relationship (with attributes) into a related object.
117+
118+
:param: related asset to which to build the detailed relationship
119+
:param: semantic to use for saving the relationship
120+
:returns: a detailed Atlan relationship that conforms
121+
to the necessary interface for a related asset
122+
"""
107123
if related.guid:
108124
return {{ relationship_info.name | to_cls_name }}.{{ relationship_info.end_def2["name"] | to_cls_name }}._create_ref(
109125
type_name=related.type_name,

pyatlan/model/assets/relations/atlas_glossary_antonym.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class AtlasGlossaryAntonym(RelationshipAttributes):
1616
default="AtlasGlossaryAntonym",
1717
description="Terms that have the opposite (or near opposite) meaning, in the same language.",
1818
)
19-
attributes: AtlasGlossaryAntonym.Attributes = Field(
19+
attributes: AtlasGlossaryAntonym.Attributes = Field( # type: ignore[name-defined]
2020
default_factory=lambda: AtlasGlossaryAntonym.Attributes(),
2121
description="Map of attributes in the instance and their values",
2222
)
@@ -74,6 +74,14 @@ def __init__(__pydantic_self__, **data: Any) -> None:
7474
def antonyms(
7575
self, related: Asset, semantic: SaveSemantic = SaveSemantic.REPLACE
7676
) -> AtlasGlossaryAntonym.Antonyms:
77+
"""
78+
Build the AtlasGlossaryAntonym relationship (with attributes) into a related object.
79+
80+
:param: related asset to which to build the detailed relationship
81+
:param: semantic to use for saving the relationship
82+
:returns: a detailed Atlan relationship that conforms
83+
to the necessary interface for a related asset
84+
"""
7785
if related.guid:
7886
return AtlasGlossaryAntonym.Antonyms._create_ref(
7987
type_name=related.type_name,

pyatlan/model/assets/relations/atlas_glossary_is_a_relationship.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class AtlasGlossaryIsARelationship(RelationshipAttributes):
1616
default="AtlasGlossaryIsARelationship",
1717
description="Relationship between a more abstract and more concrete concept. For example, this relationship would be use to say that 'Cat' ISA 'Animal'.",
1818
)
19-
attributes: AtlasGlossaryIsARelationship.Attributes = Field(
19+
attributes: AtlasGlossaryIsARelationship.Attributes = Field( # type: ignore[name-defined]
2020
default_factory=lambda: AtlasGlossaryIsARelationship.Attributes(),
2121
description="Map of attributes in the instance and their values",
2222
)
@@ -96,6 +96,14 @@ def __init__(__pydantic_self__, **data: Any) -> None:
9696
def classifies(
9797
self, related: Asset, semantic: SaveSemantic = SaveSemantic.REPLACE
9898
) -> AtlasGlossaryIsARelationship.Classifies:
99+
"""
100+
Build the AtlasGlossaryIsARelationship relationship (with attributes) into a related object.
101+
102+
:param: related asset to which to build the detailed relationship
103+
:param: semantic to use for saving the relationship
104+
:returns: a detailed Atlan relationship that conforms
105+
to the necessary interface for a related asset
106+
"""
99107
if related.guid:
100108
return AtlasGlossaryIsARelationship.Classifies._create_ref(
101109
type_name=related.type_name,
@@ -115,6 +123,14 @@ def classifies(
115123
def is_a(
116124
self, related: Asset, semantic: SaveSemantic = SaveSemantic.REPLACE
117125
) -> AtlasGlossaryIsARelationship.IsA:
126+
"""
127+
Build the AtlasGlossaryIsARelationship relationship (with attributes) into a related object.
128+
129+
:param: related asset to which to build the detailed relationship
130+
:param: semantic to use for saving the relationship
131+
:returns: a detailed Atlan relationship that conforms
132+
to the necessary interface for a related asset
133+
"""
118134
if related.guid:
119135
return AtlasGlossaryIsARelationship.IsA._create_ref(
120136
type_name=related.type_name,

pyatlan/model/assets/relations/atlas_glossary_preferred_term.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class AtlasGlossaryPreferredTerm(RelationshipAttributes):
1616
default="AtlasGlossaryPreferredTerm",
1717
description="Indicates term(s) should be used in place of another. This relationship can be used to encourage adoption of newer vocabularies. This is a weaker version of ReplacementTerm.",
1818
)
19-
attributes: AtlasGlossaryPreferredTerm.Attributes = Field(
19+
attributes: AtlasGlossaryPreferredTerm.Attributes = Field( # type: ignore[name-defined]
2020
default_factory=lambda: AtlasGlossaryPreferredTerm.Attributes(),
2121
description="Map of attributes in the instance and their values",
2222
)
@@ -96,6 +96,14 @@ def __init__(__pydantic_self__, **data: Any) -> None:
9696
def preferred_terms(
9797
self, related: Asset, semantic: SaveSemantic = SaveSemantic.REPLACE
9898
) -> AtlasGlossaryPreferredTerm.PreferredTerms:
99+
"""
100+
Build the AtlasGlossaryPreferredTerm relationship (with attributes) into a related object.
101+
102+
:param: related asset to which to build the detailed relationship
103+
:param: semantic to use for saving the relationship
104+
:returns: a detailed Atlan relationship that conforms
105+
to the necessary interface for a related asset
106+
"""
99107
if related.guid:
100108
return AtlasGlossaryPreferredTerm.PreferredTerms._create_ref(
101109
type_name=related.type_name,
@@ -115,6 +123,14 @@ def preferred_terms(
115123
def preferred_to_terms(
116124
self, related: Asset, semantic: SaveSemantic = SaveSemantic.REPLACE
117125
) -> AtlasGlossaryPreferredTerm.PreferredToTerms:
126+
"""
127+
Build the AtlasGlossaryPreferredTerm relationship (with attributes) into a related object.
128+
129+
:param: related asset to which to build the detailed relationship
130+
:param: semantic to use for saving the relationship
131+
:returns: a detailed Atlan relationship that conforms
132+
to the necessary interface for a related asset
133+
"""
118134
if related.guid:
119135
return AtlasGlossaryPreferredTerm.PreferredToTerms._create_ref(
120136
type_name=related.type_name,

pyatlan/model/assets/relations/atlas_glossary_related_term.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class AtlasGlossaryRelatedTerm(RelationshipAttributes):
1616
default="AtlasGlossaryRelatedTerm",
1717
description="Links terms that may also be of interest. It is like a 'see also' link in a dictionary.",
1818
)
19-
attributes: AtlasGlossaryRelatedTerm.Attributes = Field(
19+
attributes: AtlasGlossaryRelatedTerm.Attributes = Field( # type: ignore[name-defined]
2020
default_factory=lambda: AtlasGlossaryRelatedTerm.Attributes(),
2121
description="Map of attributes in the instance and their values",
2222
)
@@ -74,6 +74,14 @@ def __init__(__pydantic_self__, **data: Any) -> None:
7474
def see_also(
7575
self, related: Asset, semantic: SaveSemantic = SaveSemantic.REPLACE
7676
) -> AtlasGlossaryRelatedTerm.SeeAlso:
77+
"""
78+
Build the AtlasGlossaryRelatedTerm relationship (with attributes) into a related object.
79+
80+
:param: related asset to which to build the detailed relationship
81+
:param: semantic to use for saving the relationship
82+
:returns: a detailed Atlan relationship that conforms
83+
to the necessary interface for a related asset
84+
"""
7785
if related.guid:
7886
return AtlasGlossaryRelatedTerm.SeeAlso._create_ref(
7987
type_name=related.type_name,

pyatlan/model/assets/relations/atlas_glossary_replacement_term.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class AtlasGlossaryReplacementTerm(RelationshipAttributes):
1616
default="AtlasGlossaryReplacementTerm",
1717
description="Indicates term(s) must be used instead of another. This is stronger version of the PreferredTerm.",
1818
)
19-
attributes: AtlasGlossaryReplacementTerm.Attributes = Field(
19+
attributes: AtlasGlossaryReplacementTerm.Attributes = Field( # type: ignore[name-defined]
2020
default_factory=lambda: AtlasGlossaryReplacementTerm.Attributes(),
2121
description="Map of attributes in the instance and their values",
2222
)
@@ -96,6 +96,14 @@ def __init__(__pydantic_self__, **data: Any) -> None:
9696
def replaced_by(
9797
self, related: Asset, semantic: SaveSemantic = SaveSemantic.REPLACE
9898
) -> AtlasGlossaryReplacementTerm.ReplacedBy:
99+
"""
100+
Build the AtlasGlossaryReplacementTerm relationship (with attributes) into a related object.
101+
102+
:param: related asset to which to build the detailed relationship
103+
:param: semantic to use for saving the relationship
104+
:returns: a detailed Atlan relationship that conforms
105+
to the necessary interface for a related asset
106+
"""
99107
if related.guid:
100108
return AtlasGlossaryReplacementTerm.ReplacedBy._create_ref(
101109
type_name=related.type_name,
@@ -115,6 +123,14 @@ def replaced_by(
115123
def replacement_terms(
116124
self, related: Asset, semantic: SaveSemantic = SaveSemantic.REPLACE
117125
) -> AtlasGlossaryReplacementTerm.ReplacementTerms:
126+
"""
127+
Build the AtlasGlossaryReplacementTerm relationship (with attributes) into a related object.
128+
129+
:param: related asset to which to build the detailed relationship
130+
:param: semantic to use for saving the relationship
131+
:returns: a detailed Atlan relationship that conforms
132+
to the necessary interface for a related asset
133+
"""
118134
if related.guid:
119135
return AtlasGlossaryReplacementTerm.ReplacementTerms._create_ref(
120136
type_name=related.type_name,

pyatlan/model/assets/relations/atlas_glossary_semantic_assignment.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class AtlasGlossarySemanticAssignment(RelationshipAttributes):
1616
default="AtlasGlossarySemanticAssignment",
1717
description="Assigns meaning to an asset by linking the term that describes the meaning of the asset. The semantic assignment needs to be a controlled relationship when glossary definitions are used to provide classifications for the data assets and hence define how the data is to be governed.",
1818
)
19-
attributes: AtlasGlossarySemanticAssignment.Attributes = Field(
19+
attributes: AtlasGlossarySemanticAssignment.Attributes = Field( # type: ignore[name-defined]
2020
default_factory=lambda: AtlasGlossarySemanticAssignment.Attributes(),
2121
description="Map of attributes in the instance and their values",
2222
)
@@ -104,6 +104,14 @@ def __init__(__pydantic_self__, **data: Any) -> None:
104104
def assigned_entities(
105105
self, related: Asset, semantic: SaveSemantic = SaveSemantic.REPLACE
106106
) -> AtlasGlossarySemanticAssignment.AssignedEntities:
107+
"""
108+
Build the AtlasGlossarySemanticAssignment relationship (with attributes) into a related object.
109+
110+
:param: related asset to which to build the detailed relationship
111+
:param: semantic to use for saving the relationship
112+
:returns: a detailed Atlan relationship that conforms
113+
to the necessary interface for a related asset
114+
"""
107115
if related.guid:
108116
return AtlasGlossarySemanticAssignment.AssignedEntities._create_ref(
109117
type_name=related.type_name,
@@ -123,6 +131,14 @@ def assigned_entities(
123131
def meanings(
124132
self, related: Asset, semantic: SaveSemantic = SaveSemantic.REPLACE
125133
) -> AtlasGlossarySemanticAssignment.Meanings:
134+
"""
135+
Build the AtlasGlossarySemanticAssignment relationship (with attributes) into a related object.
136+
137+
:param: related asset to which to build the detailed relationship
138+
:param: semantic to use for saving the relationship
139+
:returns: a detailed Atlan relationship that conforms
140+
to the necessary interface for a related asset
141+
"""
126142
if related.guid:
127143
return AtlasGlossarySemanticAssignment.Meanings._create_ref(
128144
type_name=related.type_name,

pyatlan/model/assets/relations/atlas_glossary_synonym.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class AtlasGlossarySynonym(RelationshipAttributes):
1616
default="AtlasGlossarySynonym",
1717
description="Terms that have the same (or a very similar) meaning, in the same language.",
1818
)
19-
attributes: AtlasGlossarySynonym.Attributes = Field(
19+
attributes: AtlasGlossarySynonym.Attributes = Field( # type: ignore[name-defined]
2020
default_factory=lambda: AtlasGlossarySynonym.Attributes(),
2121
description="Map of attributes in the instance and their values",
2222
)
@@ -74,6 +74,14 @@ def __init__(__pydantic_self__, **data: Any) -> None:
7474
def synonyms(
7575
self, related: Asset, semantic: SaveSemantic = SaveSemantic.REPLACE
7676
) -> AtlasGlossarySynonym.Synonyms:
77+
"""
78+
Build the AtlasGlossarySynonym relationship (with attributes) into a related object.
79+
80+
:param: related asset to which to build the detailed relationship
81+
:param: semantic to use for saving the relationship
82+
:returns: a detailed Atlan relationship that conforms
83+
to the necessary interface for a related asset
84+
"""
7785
if related.guid:
7886
return AtlasGlossarySynonym.Synonyms._create_ref(
7987
type_name=related.type_name,

pyatlan/model/assets/relations/atlas_glossary_term_categorization.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class AtlasGlossaryTermCategorization(RelationshipAttributes):
1616
default="AtlasGlossaryTermCategorization",
1717
description="Organizes terms into categories. A term may be linked with many categories and a category may have many terms linked to it. This relationship may connect terms and categories both in the same glossary or in different glossaries.",
1818
)
19-
attributes: AtlasGlossaryTermCategorization.Attributes = Field(
19+
attributes: AtlasGlossaryTermCategorization.Attributes = Field( # type: ignore[name-defined]
2020
default_factory=lambda: AtlasGlossaryTermCategorization.Attributes(),
2121
description="Map of attributes in the instance and their values",
2222
)
@@ -84,6 +84,14 @@ def __init__(__pydantic_self__, **data: Any) -> None:
8484
def terms(
8585
self, related: Asset, semantic: SaveSemantic = SaveSemantic.REPLACE
8686
) -> AtlasGlossaryTermCategorization.Terms:
87+
"""
88+
Build the AtlasGlossaryTermCategorization relationship (with attributes) into a related object.
89+
90+
:param: related asset to which to build the detailed relationship
91+
:param: semantic to use for saving the relationship
92+
:returns: a detailed Atlan relationship that conforms
93+
to the necessary interface for a related asset
94+
"""
8795
if related.guid:
8896
return AtlasGlossaryTermCategorization.Terms._create_ref(
8997
type_name=related.type_name,
@@ -103,6 +111,14 @@ def terms(
103111
def categories(
104112
self, related: Asset, semantic: SaveSemantic = SaveSemantic.REPLACE
105113
) -> AtlasGlossaryTermCategorization.Categories:
114+
"""
115+
Build the AtlasGlossaryTermCategorization relationship (with attributes) into a related object.
116+
117+
:param: related asset to which to build the detailed relationship
118+
:param: semantic to use for saving the relationship
119+
:returns: a detailed Atlan relationship that conforms
120+
to the necessary interface for a related asset
121+
"""
106122
if related.guid:
107123
return AtlasGlossaryTermCategorization.Categories._create_ref(
108124
type_name=related.type_name,

pyatlan/model/assets/relations/atlas_glossary_translation.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class AtlasGlossaryTranslation(RelationshipAttributes):
1616
default="AtlasGlossaryTranslation",
1717
description="Related terms that represent the same meaning, but each written in a different language. Hence one is a translation of the other. The language of each term is defined in the Glossary object that anchors the term.",
1818
)
19-
attributes: AtlasGlossaryTranslation.Attributes = Field(
19+
attributes: AtlasGlossaryTranslation.Attributes = Field( # type: ignore[name-defined]
2020
default_factory=lambda: AtlasGlossaryTranslation.Attributes(),
2121
description="Map of attributes in the instance and their values",
2222
)
@@ -96,6 +96,14 @@ def __init__(__pydantic_self__, **data: Any) -> None:
9696
def translated_terms(
9797
self, related: Asset, semantic: SaveSemantic = SaveSemantic.REPLACE
9898
) -> AtlasGlossaryTranslation.TranslatedTerms:
99+
"""
100+
Build the AtlasGlossaryTranslation relationship (with attributes) into a related object.
101+
102+
:param: related asset to which to build the detailed relationship
103+
:param: semantic to use for saving the relationship
104+
:returns: a detailed Atlan relationship that conforms
105+
to the necessary interface for a related asset
106+
"""
99107
if related.guid:
100108
return AtlasGlossaryTranslation.TranslatedTerms._create_ref(
101109
type_name=related.type_name,
@@ -115,6 +123,14 @@ def translated_terms(
115123
def translation_terms(
116124
self, related: Asset, semantic: SaveSemantic = SaveSemantic.REPLACE
117125
) -> AtlasGlossaryTranslation.TranslationTerms:
126+
"""
127+
Build the AtlasGlossaryTranslation relationship (with attributes) into a related object.
128+
129+
:param: related asset to which to build the detailed relationship
130+
:param: semantic to use for saving the relationship
131+
:returns: a detailed Atlan relationship that conforms
132+
to the necessary interface for a related asset
133+
"""
118134
if related.guid:
119135
return AtlasGlossaryTranslation.TranslationTerms._create_ref(
120136
type_name=related.type_name,

0 commit comments

Comments
 (0)