@@ -70,23 +70,23 @@ def _range ( now: datetime , begin: datetime , end: datetime ) :
7070
7171 return begin .strftime ( bf ) + ' - ' + end .strftime ( ef )
7272
73- def calendars ( config = CONFIG ) :
73+ def calendars ( config : str = CONFIG ) :
7474 with open (config , 'r' ) as fd :
7575 return list (filter (lambda c : not c .get ('hide' ), json .load ( fd )['calendars' ]))
7676
77- def load ( calendars , cache = CACHE ) :
77+ def load ( calendars , cache : str = CACHE ) :
7878 calendar = ics .Calendar ()
7979 calendar .events .update (_cache_load_calendars (calendars , cache = cache ))
8080 return calendar
8181
82- def _cache_load_calendars ( calendars , cache ) :
82+ def _cache_load_calendars ( calendars , cache : str ) :
8383 for _calendar in calendars :
8484 yield from _cache_load_url (cache , _calendar ['url' ])
8585
86- def url_hash ( url ) :
86+ def url_hash ( url : str ) :
8787 return hashlib .sha1 (url .encode ()).hexdigest ()
8888
89- def _cache_load_url ( cache , url ) :
89+ def _cache_load_url ( cache : str , url : str ) :
9090
9191 h = url_hash (url )
9292
@@ -118,17 +118,17 @@ def _cache_load_url ( cache , url ) :
118118 return set ()
119119
120120
121- def _match (it , text ):
121+ def _match (it : Iterable [ str ] , text : str ):
122122 for line in it :
123123 if line == text : break
124124
125- def _dropalarms (string ):
125+ def _dropalarms (string : str ):
126126 it = iter (string .splitlines ())
127127 for line in it :
128128 if line == 'BEGIN:VALARM' : _match (it , 'END:VALARM' )
129129 else : yield line
130130
131- def dropalarms (string ):
131+ def dropalarms (string : str ):
132132 return '\n ' .join (_dropalarms (string ))
133133
134134
0 commit comments