44
55
66class ProjectVersionManager (models .Manager ):
7- def get_by_natural_key (self , name : str , version_number : str ) -> " ProjectVersion" :
7+ def get_by_natural_key (self , name : str , version_number : str ) -> ProjectVersion :
88 return self .get (
99 version_number = version_number ,
1010 )
1111
12- def get_latest (self ) -> " ProjectVersion" :
12+ def get_latest (self ) -> ProjectVersion :
1313 return self .order_by ("-sortable_version_number" )[0 ]
1414
1515
@@ -52,7 +52,7 @@ def generate_sortable_version_number(self) -> str:
5252class ModuleManager (models .Manager ):
5353 def get_by_natural_key (
5454 self , module_name : str , project_name : str , version_number : str
55- ) -> " Module" :
55+ ) -> Module :
5656 return self .get (
5757 name = module_name ,
5858 project_version = ProjectVersion .objects .get_by_natural_key (
@@ -110,7 +110,7 @@ def get_absolute_url(self) -> str:
110110class KlassManager (models .Manager ):
111111 def get_by_natural_key (
112112 self , klass_name : str , module_name : str , project_name : str , version_number : str
113- ) -> " Klass" :
113+ ) -> Klass :
114114 return self .get (
115115 name = klass_name ,
116116 module = Module .objects .get_by_natural_key (
@@ -120,7 +120,7 @@ def get_by_natural_key(
120120 ),
121121 )
122122
123- def get_latest_for_name (self , klass_name : str ) -> " Klass" :
123+ def get_latest_for_name (self , klass_name : str ) -> Klass :
124124 qs = self .filter (
125125 name__iexact = klass_name ,
126126 )
@@ -195,14 +195,14 @@ def get_source_url(self) -> str:
195195 line = self .line_number
196196 return f"{ url } { version } { path } #L{ line } "
197197
198- def get_ancestors (self ) -> models .QuerySet [" Klass" ]:
198+ def get_ancestors (self ) -> models .QuerySet [Klass ]:
199199 if not hasattr (self , "_ancestors" ):
200200 self ._ancestors = Klass .objects .filter (inheritance__child = self ).order_by (
201201 "inheritance__order"
202202 )
203203 return self ._ancestors
204204
205- def get_children (self ) -> models .QuerySet [" Klass" ]:
205+ def get_children (self ) -> models .QuerySet [Klass ]:
206206 if not hasattr (self , "_descendants" ):
207207 self ._descendants = Klass .objects .filter (
208208 ancestor_relationships__parent = self
@@ -211,7 +211,7 @@ def get_children(self) -> models.QuerySet["Klass"]:
211211
212212 # TODO: This is all mucho inefficient. Perhaps we should use mptt for
213213 # get_all_ancestors, get_all_children, get_methods, & get_attributes?
214- def get_all_ancestors (self ) -> list [" Klass" ]:
214+ def get_all_ancestors (self ) -> list [Klass ]:
215215 if not hasattr (self , "_all_ancestors" ):
216216 # Get immediate ancestors.
217217 ancestors = self .get_ancestors ().select_related ("module__project_version" )
@@ -233,31 +233,31 @@ def get_all_ancestors(self) -> list["Klass"]:
233233 self ._all_ancestors = cleaned_ancestors
234234 return self ._all_ancestors
235235
236- def get_all_children (self ) -> models .QuerySet [" Klass" ]:
236+ def get_all_children (self ) -> models .QuerySet [Klass ]:
237237 if not hasattr (self , "_all_descendants" ):
238238 children = self .get_children ().select_related ("module__project_version" )
239239 for child in children :
240240 children = children | child .get_all_children ()
241241 self ._all_descendants = children
242242 return self ._all_descendants
243243
244- def get_methods (self ) -> models .QuerySet [" Method" ]:
244+ def get_methods (self ) -> models .QuerySet [Method ]:
245245 if not hasattr (self , "_methods" ):
246246 methods = self .method_set .all ().select_related ("klass" )
247247 for ancestor in self .get_all_ancestors ():
248248 methods = methods | ancestor .get_methods ()
249249 self ._methods = methods
250250 return self ._methods
251251
252- def get_attributes (self ) -> models .QuerySet [" KlassAttribute" ]:
252+ def get_attributes (self ) -> models .QuerySet [KlassAttribute ]:
253253 if not hasattr (self , "_attributes" ):
254254 attrs = self .attribute_set .all ()
255255 for ancestor in self .get_all_ancestors ():
256256 attrs = attrs | ancestor .get_attributes ()
257257 self ._attributes = attrs
258258 return self ._attributes
259259
260- def get_prepared_attributes (self ) -> models .QuerySet [" KlassAttribute" ]:
260+ def get_prepared_attributes (self ) -> models .QuerySet [KlassAttribute ]:
261261 attributes = self .get_attributes ()
262262 # Make a dictionary of attributes based on name
263263 attribute_names : dict [str , list [KlassAttribute ]] = {}
0 commit comments