Generates a string that would invoke the type specified in type_str with the specified arguments. Skips keyword arguments that are set to ``None``. For example: :: >>> make_invocable_impl("Example", None, "string", w=None, x=2, y=inline("test")) "Example(None, '
(type_str, *args, **kwargs)
| 97 | |
| 98 | |
| 99 | def make_invocable_impl(type_str, *args, **kwargs): |
| 100 | """ |
| 101 | Generates a string that would invoke the type specified in |
| 102 | type_str with the specified arguments. |
| 103 | Skips keyword arguments that are set to ``None``. |
| 104 | |
| 105 | For example: |
| 106 | :: |
| 107 | >>> make_invocable_impl("Example", None, "string", w=None, x=2, y=inline("test")) |
| 108 | "Example(None, 'string', x=2, y=test)" |
| 109 | |
| 110 | Args: |
| 111 | type_str (str): The type to invoke. |
| 112 | |
| 113 | Returns: |
| 114 | Tuple[str, bool]: |
| 115 | A tuple including the `invoke` string and a boolean |
| 116 | indicating whether all the arguments were default (i.e. None). |
| 117 | """ |
| 118 | # We don't need to check obj_str for safety since we know that any inline |
| 119 | # args/kwargs are already safe - other types need no checks |
| 120 | obj_str, all_args_default, all_kwargs_default = util.make_repr(type_str, *args, **kwargs) |
| 121 | return Script.String(obj_str, safe=True, inline=True), all_args_default, all_kwargs_default |
| 122 | |
| 123 | |
| 124 | @mod.export() |
no outgoing calls
no test coverage detected