mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00: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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user