11import re
2- from typing import Callable , Iterable , List , Tuple , cast
2+ from collections .abc import Iterable
3+ from typing import Callable , cast
34
45import yaml
56from docutils import nodes , utils
@@ -30,7 +31,7 @@ def role_fn(
3031 inliner : Inliner ,
3132 options : dict = {},
3233 content : list = [],
33- ) -> Tuple [list , list ]:
34+ ) -> tuple [list , list ]:
3435 match = GITHUB_FULL_REF .match (utils .unescape (text ))
3536 if match is not None :
3637 repo = match .group ('repo' )
@@ -83,15 +84,15 @@ def load_citation_file(self) -> dict:
8384 with open (citation_file , 'r' ) as f :
8485 return cast (dict , yaml .load (f , yaml .Loader ))
8586
86- def run (self ) -> List [nodes .Node ]:
87+ def run (self ) -> list [nodes .Node ]:
8788 if self .options ['format' ] == 'apa' :
8889 return self .run_apa ()
8990 elif self .options ['format' ] == 'biblatex' :
9091 return self .run_biblatex ()
9192 else :
9293 raise ValueError ("Unknown format" )
9394
94- def run_apa (self ) -> List [nodes .Node ]:
95+ def run_apa (self ) -> list [nodes .Node ]:
9596 citation = self .load_citation_file ()
9697 names = self .comma_ampersand_join (map (self .apa_name , citation ['authors' ]))
9798 year = citation ['date-released' ].year
@@ -118,7 +119,7 @@ def comma_ampersand_join(self, items: Iterable[str]) -> str:
118119 return items [0 ]
119120 return '{}, & {}' .format (', ' .join (items [:- 1 ]), items [- 1 ])
120121
121- def run_biblatex (self ) -> List [nodes .Node ]:
122+ def run_biblatex (self ) -> list [nodes .Node ]:
122123 citation = self .load_citation_file ()
123124
124125 year = citation ['date-released' ].year
0 commit comments