Fix typehinting and other inspection warnings