Create a :class:`Transform` from user-provided functions.
| 244 | |
| 245 | |
| 246 | class TransformFactory(Transform): |
| 247 | """ |
| 248 | Create a :class:`Transform` from user-provided functions. |
| 249 | """ |
| 250 | def __init__(self, name=None, **kwargs): |
| 251 | """ |
| 252 | Args: |
| 253 | name (str, optional): the name of this transform |
| 254 | **kwargs: mapping from `'apply_xxx'` to implementation of such functions. |
| 255 | """ |
| 256 | for k, v in kwargs.items(): |
| 257 | if k.startswith('apply_'): |
| 258 | setattr(self, k, v) |
| 259 | else: |
| 260 | raise KeyError("Unknown argument '{}' in TransformFactory!".format(k)) |
| 261 | self._name = name |
| 262 | |
| 263 | def __str__(self): |
| 264 | return "imgaug.TransformFactory({})".format(self._name if self._name else "") |
| 265 | |
| 266 | __repr__ = __str__ |
| 267 | |
| 268 | |
| 269 | """ |
no outgoing calls
no test coverage detected