File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 1515from __future__ import annotations
1616
1717import io
18- from collections import namedtuple
18+ from typing import NamedTuple
1919
20- MimetypeAndCounter = namedtuple ("MimetypeAndCounter" , ["mimetype" , "value" ])
21- CounterMap = dict [
22- type (MimetypeAndCounter .mimetype ), type (MimetypeAndCounter .value ) # pyright: ignore
23- ]
20+
21+ class MimetypeAndCounter (NamedTuple ):
22+ mimetype : str
23+ value : int
24+
25+
26+ type CounterMap = dict [str , int ]
2427
2528
2629def getline (src : io .StringIO , delim : str | None = None ) -> tuple [bool , str ]:
Original file line number Diff line number Diff line change 1717import libzim .search # Query, Searcher # pyright: ignore
1818import libzim .suggestion # SuggestionSearcher # pyright: ignore
1919
20- from zimscraperlib .zim ._libkiwix import convertTags , parseMimetypeCounter
20+ from zimscraperlib .zim ._libkiwix import CounterMap , convertTags , parseMimetypeCounter
2121
2222
2323class Archive (libzim .reader .Archive ):
@@ -101,7 +101,7 @@ def get_search_results_count(self, query: str) -> int:
101101 return search .getEstimatedMatches ()
102102
103103 @property
104- def counters (self ) -> dict [ str , int ] :
104+ def counters (self ) -> CounterMap :
105105 try :
106106 return parseMimetypeCounter (self .get_text_metadata ("Counter" ))
107107 except RuntimeError : # pragma: no cover (no ZIM avail to test itl)
You can’t perform that action at this time.
0 commit comments