3434from bravado_core .spec import Spec , _identity , build_api_serving_url
3535from bravado_core .validate import validate_object
3636from bson .objectid import ObjectId
37- from cachetools import LRUCache , cached
38- from cachetools .keys import hashkey
37+ from cachetools import LRUCache , cached # type: ignore[import-untyped]
38+ from cachetools .keys import hashkey # type: ignore[import-untyped]
3939from jsonschema .exceptions import ValidationError
4040from pint .errors import DimensionalityError
4141from pyisemail import is_email
4747from tqdm .auto import tqdm
4848from urllib3 .util .retry import Retry
4949
50- from mp_api .client .contribs ._types import Attachment , MPCDict , MPCStructure , Table
50+ from mp_api .client .contribs ._types import (
51+ Attachment ,
52+ MPCDict ,
53+ MPCStructure ,
54+ Table ,
55+ _Component ,
56+ )
5157from mp_api .client .contribs ._units import ureg
5258from mp_api .client .contribs .logger import MPCC_LOGGER , TqdmToLogger
5359from mp_api .client .contribs .schemas import (
@@ -738,7 +744,7 @@ def query_projects(
738744 fields : list | None = None ,
739745 sort : str | None = None ,
740746 timeout : int = - 1 ,
741- ) -> list [dict ] | list [ContribsProject ]:
747+ ) -> list [MPCDict ] | list [ContribsProject ]:
742748 """Query projects by query and/or term (Atlas Search).
743749
744750 See `client.available_query_params(resource="projects")` for keyword arguments used in
@@ -758,7 +764,7 @@ def query_projects(
758764 query = query or {}
759765
760766 if self .project or "name" in query :
761- return self .get_project (name = query .get ("name" ), fields = fields )
767+ return [ self .get_project (name = query .get ("name" ), fields = fields )] # type: ignore[return-value]
762768
763769 if term :
764770
@@ -1219,7 +1225,7 @@ def init_columns(
12191225 f"Can't convert { existing_unit } to { new_unit } for { path } "
12201226 )
12211227 try :
1222- factor = ureg .convert (1 , * conv_args )
1228+ factor = ureg .convert (1 , * conv_args ) # type: ignore[arg-type]
12231229 except DimensionalityError :
12241230 raise MPContribsClientError (
12251231 f"Can't convert { existing_unit } to { new_unit } for { path } "
@@ -1704,7 +1710,7 @@ def query_contributions(
17041710 ).result ()
17051711
17061712 if len (ret ["data" ]) > 0 and self .use_document_model : # type: ignore[arg-type]
1707- ret ["data" ] = [ContribData (** doc ) for doc in ret ["data" ]]
1713+ ret ["data" ] = [ContribData (** doc ) for doc in ret ["data" ]] # type: ignore[arg-type,misc,union-attr]
17081714
17091715 return (
17101716 _convert_to_model ( # type: ignore[return-value]
@@ -2327,7 +2333,7 @@ def download_contributions(
23272333
23282334 match component :
23292335 case "structures" :
2330- component_cls = MPCStructure
2336+ component_cls : type [ _Component ] = MPCStructure
23312337 case "tables" :
23322338 component_cls = Table
23332339 case "attachments" :
0 commit comments