MCPcopy Create free account
hub / github.com/nodejs/node / _SetDefaultsFromSchema

Method _SetDefaultsFromSchema

tools/gyp/pylib/gyp/xcodeproj_file.py:920–939  ·  view source on GitHub ↗

Assign object default values according to the schema. This will not overwrite properties that have already been set.

(self)

Source from the content-addressed store, hash-verified

918 raise KeyError(self.__class__.__name__ + " requires " + property)
919
920 def _SetDefaultsFromSchema(self):
921 """Assign object default values according to the schema. This will not
922 overwrite properties that have already been set."""
923
924 defaults = {}
925 for property, attributes in self._schema.items():
926 (_is_list, _property_type, _is_strong, is_required) = attributes[0:4]
927 if (
928 is_required
929 and len(attributes) >= 5
930 and property not in self._properties
931 ):
932 default = attributes[4]
933
934 defaults[property] = default
935
936 if len(defaults) > 0:
937 # Use do_copy=True so that each new object gets its own copy of strong
938 # objects, lists, and dicts.
939 self.UpdateProperties(defaults, do_copy=True)
940
941
942class XCHierarchicalElement(XCObject):

Callers 1

__init__Method · 0.95

Calls 2

UpdatePropertiesMethod · 0.95
itemsMethod · 0.45

Tested by

no test coverage detected