Replace deprecated stacked `@classmethod` and `@property` (#79952)

pull/79963/head
Matt Martz 2 years ago committed by GitHub
parent 09e0fb3516
commit 243d1b5e3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
minor_changes:
- Playbook objects - Replace deprecated stacked ``@classmethod`` and ``@property``

@ -70,16 +70,18 @@ def _validate_action_group_metadata(action, found_group_metadata, fq_group_name)
display.warning(" ".join(metadata_warnings))
class _ClassProperty:
def __set_name__(self, owner, name):
self.name = name
def __get__(self, obj, objtype=None):
return getattr(objtype, f'_{self.name}')()
class FieldAttributeBase:
@classmethod # type: ignore[misc]
@property
def fattributes(cls):
return cls._fattributes()
fattributes = _ClassProperty()
# mypy complains with "misc: Decorated property not supported"
# when @property and @cache are used together,
# split fattributes above into two methods
@classmethod
@cache
def _fattributes(cls):

Loading…
Cancel
Save