mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-04 15:34:01 -07:00
Selectively assign the getter for better performance
Introduces the `inherit` param for FieldAttributes, which is now used in BaseMeta when constructing the getter property to enhance performance by reducing the amount of work the getter generally has to do.
This commit is contained in:
parent
3a51587220
commit
96e2be9bf8
3 changed files with 60 additions and 21 deletions
|
@ -23,7 +23,7 @@ from copy import deepcopy
|
|||
|
||||
class Attribute:
|
||||
|
||||
def __init__(self, isa=None, private=False, default=None, required=False, listof=None, priority=0, class_type=None, always_post_validate=False):
|
||||
def __init__(self, isa=None, private=False, default=None, required=False, listof=None, priority=0, class_type=None, always_post_validate=False, inherit=True):
|
||||
|
||||
self.isa = isa
|
||||
self.private = private
|
||||
|
@ -33,6 +33,7 @@ class Attribute:
|
|||
self.priority = priority
|
||||
self.class_type = class_type
|
||||
self.always_post_validate = always_post_validate
|
||||
self.inherit = inherit
|
||||
|
||||
if default is not None and self.isa in ('list', 'dict', 'set'):
|
||||
self.default = deepcopy(default)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue