2222import os
2323import typing
2424
25- from robot import __version__ as robot_version
2625from robot .utils import PY_VERSION
2726
2827
2928from robot .api .deco import keyword # noqa F401
3029
31- RF32 = robot_version < '4.'
32-
3330__version__ = '3.0.1.dev1'
3431
3532
@@ -244,9 +241,6 @@ def _get_typing_hints(cls, function):
244241 # remove return and self statements
245242 if arg_with_hint not in all_args :
246243 hints .pop (arg_with_hint )
247- if RF32 :
248- default = cls ._get_defaults (arg_spec )
249- return cls ._remove_optional_none_type_hints (hints , default )
250244 return hints
251245
252246 @classmethod
@@ -260,29 +254,6 @@ def _args_as_list(cls, function, arg_spec):
260254 function_args .append (arg_spec .varkw )
261255 return function_args
262256
263- # TODO: Remove when support RF 3.2 is dropped
264- # Copied from: robot.running.arguments.argumentparser
265- @classmethod
266- def _remove_optional_none_type_hints (cls , type_hints , defaults ):
267- # If argument has None as a default, typing.get_type_hints adds
268- # optional None to the information it returns. We don't want that.
269- for arg , default in defaults :
270- if default is None and arg in type_hints :
271- type_ = type_hints [arg ]
272- if cls ._is_union (type_ ):
273- types = type_ .__args__
274- if len (types ) == 2 and types [1 ] is type (None ): # noqa
275- type_hints [arg ] = types [0 ]
276- return type_hints
277-
278- # TODO: Remove when support RF 3.2 is dropped
279- # Copied from: robot.running.arguments.argumentparser
280- @classmethod
281- def _is_union (cls , typing_type ):
282- if PY_VERSION >= (3 , 7 ) and hasattr (typing_type , '__origin__' ):
283- typing_type = typing_type .__origin__
284- return isinstance (typing_type , type (typing .Union ))
285-
286257 @classmethod
287258 def _get_defaults (cls , arg_spec ):
288259 if not arg_spec .defaults :
0 commit comments