-
Couldn't load subscription status.
- Fork 27
Closed
@mkorpela
Description
Please add the following "hacky" Optional removal to
PythonLibCore/src/robotlibcore.py
Line 232 in 9fcb620
return hints
def _remove_optional_none_type_hints(self, type_hints, defaults):
# If argument has None as a default, typing.get_type_hints adds
# optional None to the information it returns. We don't want that.
for arg in defaults:
if defaults[arg] is None and arg in type_hints:
type_ = type_hints[arg]
if self._is_union(type_):
try:
types = type_.__args__
except AttributeError:
# Python 3.5.2's typing uses __union_params__ instead
# of __args__. This block can likely be safely removed
# when Python 3.5 support is dropped
types = type_.__union_params__
if len(types) == 2 and types[1] is type(None):
type_hints[arg] = types[0]