22
33import datetime
44import math
5- from typing import Any , Dict , List , Optional , Union
5+ from typing import Any , Optional , Union
66
77import pysolar .solar # type: ignore[import-untyped]
88import pytz # type: ignore[import-untyped]
@@ -41,7 +41,7 @@ def format_meteogram(
4141 output : str = ""
4242
4343 # Init graph
44- graph : Dict [int , str ] = {}
44+ graph : dict [int , str ] = {}
4545 tempheight : int = 11
4646 timeline : int = 13
4747 windline : int = 15
@@ -98,7 +98,7 @@ def format_meteogram(
9898 templow = temphigh - 1
9999
100100 # Create temp range
101- temps : List [int ] = []
101+ temps : list [int ] = []
102102 for t in range (int (temphigh ), int (templow ) - 1 , tempstep ):
103103 temps .append (t )
104104
@@ -118,7 +118,7 @@ def format_meteogram(
118118 pass
119119
120120 # create rainaxis #TODO: make this scale
121- rainaxis : List [str ] = []
121+ rainaxis : list [str ] = []
122122 for r in range (rainheight , 0 , rainstep ):
123123 if r <= rainhigh : # + 1
124124 rainaxis .append (f"{ r :2.0f} mm " )
@@ -181,7 +181,7 @@ def format_meteogram(
181181 for i in range (1 , tempheight ): # draw temp
182182 try :
183183 # parse out numbers to be compared
184- temptomatch : List [int ] = [temperature ]
184+ temptomatch : list [int ] = [temperature ]
185185 tempingraph : int = int (graph [i ][:3 ].strip ())
186186
187187 if tempstep < - 1 : # TODO: this should scale higher than one step
@@ -225,12 +225,6 @@ def format_meteogram(
225225 else : # if int(item['symbolnumber']) in [5,6,9,10,11,14]: #rain
226226 rainsymbol = "|"
227227
228- # if 0 > int(item['temperature']): #rain but cold
229- # rainsymbol = "*"
230-
231- # if verbose:
232- # print("rainmax: ", rainmax,"i",i,"rain",rain)
233-
234228 # if overflow, print number at top
235229 if rain > 10 and i == 1 :
236230 rainsymbol = f"{ rain :2.0f} "
@@ -268,14 +262,14 @@ def format_meteogram(
268262
269263
270264def print_units (
271- graph : Dict [int , str ],
265+ graph : dict [int , str ],
272266 screenwidth : int ,
273267 imperial : bool ,
274268 beaufort : bool ,
275269 windline : int ,
276270 windstrline : int ,
277271 timeline : int ,
278- ) -> Dict [int , str ]:
272+ ) -> dict [int , str ]:
279273 """Add units for rain, wind, etc."""
280274 graph [0 ] = " 'C" + str .rjust ("Rain (mm) " , screenwidth - 3 )
281275 if imperial :
@@ -306,7 +300,7 @@ def format_oneliner(
306300 offset : int = 0 ,
307301 wind_chill : bool = False ,
308302) -> str :
309- """Return a one-line weather forecast. TODO: remove json, respect windchill, imperial, etc. """
303+ """Return a one-line weather forecast."""
310304 start_time : Optional [datetime .datetime ] = None
311305 place : str = forecast .place .name
312306 next6 : str = forecast .json ["data" ]["properties" ]["timeseries" ][0 ]["data" ]["next_6_hours" ]
0 commit comments