Buckets:
| from django.utils.version import PY313 | |
| if PY313: | |
| from copy import replace | |
| else: | |
| # Backport of copy.replace() from Python 3.13. | |
| def replace(obj, /, **changes): | |
| """Return a new object replacing specified fields with new values. | |
| This is especially useful for immutable objects, like named tuples or | |
| frozen dataclasses. | |
| """ | |
| cls = obj.__class__ | |
| func = getattr(cls, "__replace__", None) | |
| if func is None: | |
| raise TypeError(f"replace() does not support {cls.__name__} objects") | |
| return func(obj, **changes) | |
Xet Storage Details
- Size:
- 586 Bytes
- Xet hash:
- 039b6bdb5a7b7b5f32e5cc0b0bbd1bc61d87979c6361f9a8c7e5046e0d67b406
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.