Raises a Python UserWarning if `value` is not None. This is typically going to be used inside setter functions for deprecated fields. The deprecation warning shouldn't be raised when the field is being initialized to ``None``.
(value)
| 30 | |
| 31 | |
| 32 | def warn(value): |
| 33 | """Raises a Python UserWarning if `value` is not None. |
| 34 | |
| 35 | This is typically going to be used inside setter functions for deprecated |
| 36 | fields. The deprecation warning shouldn't be raised when the field is being |
| 37 | initialized to ``None``. |
| 38 | |
| 39 | """ |
| 40 | if value is None: |
| 41 | return |
| 42 | |
| 43 | if is_sequence(value) and not value: |
| 44 | return |
| 45 | |
| 46 | fmt = "The use of this field has been deprecated. Received '{0}' object." |
| 47 | msg = fmt.format(type(value).__name__) |
| 48 | warnings.warn(msg) |
| 49 | |
| 50 | |
| 51 | class IdrefDeprecatedList(TypedList): |
no test coverage detected