5050def flatten (vals ):
5151 """Flatten vals recursively, lazily using yield"""
5252
53- def is_coll (thing ):
53+ def is_coll (thing ) -> bool :
5454 """Return True if the thing looks like a collection.
5555
5656 This is not exhaustive, do not use in general.
@@ -77,7 +77,7 @@ def flatten_type(t):
7777 return [t ]
7878
7979
80- def overlaps (a : list , b : list ):
80+ def overlaps (a : list , b : list ) -> bool :
8181 """Return true if there are any elements in common between a and b"""
8282 return len (set (a ).intersection (set (b ))) > 0
8383
@@ -266,7 +266,7 @@ class _ValueObject(Entity, ABC):
266266 See https://en.wikipedia.org/wiki/Value_object for more on Value Objects.
267267 """
268268
269- def __hash__ (self ):
269+ def __hash__ (self ) -> int :
270270 return encode_canonical_json (self .ga4gh_serialize ()).decode ("utf-8" ).__hash__ ()
271271
272272 def ga4gh_serialize (self ) -> dict :
@@ -298,14 +298,14 @@ class Ga4ghIdentifiableObject(_ValueObject, ABC):
298298 description = "A sha512t24u digest created using the VRS Computed Identifier algorithm." ,
299299 )
300300
301- def __lt__ (self , other ):
301+ def __lt__ (self , other ) -> bool :
302302 return self .get_or_create_digest () < other .get_or_create_digest ()
303303
304304 @staticmethod
305305 def is_ga4gh_identifiable () -> bool :
306306 return True
307307
308- def has_valid_ga4gh_id (self ):
308+ def has_valid_ga4gh_id (self ) -> bool | str | None :
309309 return self .id and GA4GH_IR_REGEXP .match (self .id ) is not None
310310
311311 def compute_digest (
@@ -372,7 +372,7 @@ def get_or_create_ga4gh_identifier(
372372 else :
373373 return self .compute_ga4gh_identifier (recompute )
374374
375- def compute_ga4gh_identifier (self , recompute : bool = False , as_version = None ):
375+ def compute_ga4gh_identifier (self , recompute : bool = False , as_version = None ) -> str :
376376 """Return a GA4GH Computed Identifier.
377377
378378 If ``as_version`` is provided, other parameters are ignored and a computed
@@ -629,7 +629,7 @@ def validate_start_end(
629629 raise ValueError (err_msg )
630630 return v
631631
632- def ga4gh_serialize_as_version (self , as_version : PrevVrsVersion ):
632+ def ga4gh_serialize_as_version (self , as_version : PrevVrsVersion ) -> str :
633633 """Return a serialized string following the conventions for SequenceLocation
634634 serialization as defined in the VRS version specified by ``as_version``.
635635
@@ -661,7 +661,7 @@ def ga4gh_serialize_as_version(self, as_version: PrevVrsVersion):
661661 msg = f"Received an unexpected value for `as_version`: { as_version } . MUST be an instance of `PrevVrsVersion`."
662662 raise TypeError (msg )
663663
664- def get_refget_accession (self ):
664+ def get_refget_accession (self ) -> str | None :
665665 if isinstance (self .sequenceReference , SequenceReference ):
666666 return self .sequenceReference .refgetAccession
667667 if isinstance (self .sequenceReference , iriReference ):
@@ -769,7 +769,7 @@ class Allele(_VariationBase, BaseModelForbidExtra):
769769 Field (..., description = "An expression of the sequence state" )
770770 )
771771
772- def ga4gh_serialize_as_version (self , as_version : PrevVrsVersion ):
772+ def ga4gh_serialize_as_version (self , as_version : PrevVrsVersion ) -> str :
773773 """Return a serialized string following the conventions for
774774 Allele serialization as defined in the VRS version specified by 'as_version`.
775775
0 commit comments