Farama-Foundation / Minigrid

Simple and easily configurable grid world environments for reinforcement learning
https://minigrid.farama.org/
Other
2.09k stars 604 forks source link

Add type hinting for Core API #267

Closed arjun-kg closed 1 year ago

arjun-kg commented 1 year ago

Description

I had some trouble with pyright, there was a particular case which I wasn't sure how to deal with,

suppose,

def func(x: Optional[int] = None):
   if x is None:
      x = 3
   ... 
   y = x + 5 # pyright has a problem with this saying None type does not support addition 

My solution was to add a assert x is not None above where the problem occurs to fix this, I might be missing a simpler fix.

Type of change

Checklist: