(self, properties, do_copy=False)
Merge the supplied properties into the _properties dictionary.

    The input properties must adhere to the class schema or a KeyError or
    TypeError exception will be raised.  If adding an object of an XCObject
    subclass and the schema indicates a strong relationship, the object's
    parent will be set to this object.

    If do_copy is True, then lists, dicts, strong-owned XCObjects, and
    strong-owned XCObjects in lists will be copied instead of having their
    references added.
Merge the supplied properties into the _properties dictionary.
Merge the supplied properties into the _properties dictionary .
def UpdateProperties(self, properties, do_copy=False):
        """Merge the supplied properties into the _properties dictionary.

    The input properties must adhere to the class schema or a KeyError or
    TypeError exception will be raised.  If adding an object of an XCObject
    subclass and the schema indicates a strong relationship, the object's
    parent will be set to this object.

    If do_copy is True, then lists, dicts, strong-owned XCObjects, and
    strong-owned XCObjects in lists will be copied instead of having their
    references added.
    """

        if properties is None:
            return

        for property, value in properties.items():
            # Make sure the property is in the schema.
            if property not in self._schema:
                raise KeyError(property + " not in " + self.__class__.__name__)

            # Make sure the property conforms to the schema.
            (is_list, property_type, is_strong) = self._schema[property][0:3]
            if is_list:
                if value.__class__ != list:
                    raise TypeError(
                        property
                        + " of "
                        + self.__class__.__name__
                        + " must be list, not "
                        + value.__class__.__name__
                    )
                for item in value:
                    if not isinstance(item, property_type) and not (
                        isinstance(item, str) and property_type == str
                    ):
                        # Accept unicode where str is specified.  str is treated as
                        # UTF-8-encoded.
                        raise TypeError(
                            "item of "
                            + property
                            + " of "
                            + self.__class__.__name__
                            + " must be "
                            + property_type.__name__
                            + ", not "
                            + item.__class__.__name__
                        )
            elif not isinstance(value, property_type) and not (
                isinstance(value, str) and property_type == str
            ):
                # Accept unicode where str is specified.  str is treated as
                # UTF-8-encoded.
                raise TypeError(
                    property
                    + " of "
                    + self.__class__.__name__
                    + " must be "
                    + property_type.__name__
                    + ", not "
                    + value.__class__.__name__
                )

            # Checks passed, perform the assignment.
            if do_copy:
                if isinstance(value, XCObject):
                    if is_strong:
                        self._properties[property] = value.Copy()
                    else:
                        self._properties[property] = value
                elif isinstance(value, (str, int)):
                    self._properties[property] = value
                elif isinstance(value, list):
                    if is_strong:
                        # If is_strong is True, each element is an XCObject,
                        # so it's safe to call Copy.
                        self._properties[property] = []
                        for item in value:
                            self._properties[property].append(item.Copy())
                    else:
                        self._properties[property] = value[:]
                elif isinstance(value, dict):
                    self._properties[property] = value.copy()
                else:
                    raise TypeError(
                        "Don't know how to copy a "
                        + value.__class__.__name__
                        + " object for "
                        + property
                        + " in "
                        + self.__class__.__name__
                    )
            else:
                self._properties[property] = value

            # Set up the child's back-reference to this object.  Don't use |value|
            # any more because it may not be right if do_copy is true.
            if is_strong:
                if not is_list:
                    self._properties[property].parent = self
                else:
                    for item in self._properties[property]:
                        item.parent = self
def UpdateProperties ( self , properties , do_copy = False ) : if properties is None : return for property , value in properties . items ( ) : # Make sure the property is in the schema. if property not in self . _schema : raise KeyError ( property + " not in " + self . __class__ . __name__ ) # Make sure the property conforms to the schema. ( is_list , property_type , is_strong ) = self . _schema [ property ] [ 0 : 3 ] if is_list : if value . __class__ != list : raise TypeError ( property + " of " + self . __class__ . __name__ + " must be list, not " + value . __class__ . __name__ ) for item in value : if not isinstance ( item , property_type ) and not ( isinstance ( item , str ) and property_type == str ) : # Accept unicode where str is specified.  str is treated as # UTF-8-encoded. raise TypeError ( "item of " + property + " of " + self . __class__ . __name__ + " must be " + property_type . __name__ + ", not " + item . __class__ . __name__ ) elif not isinstance ( value , property_type ) and not ( isinstance ( value , str ) and property_type == str ) : # Accept unicode where str is specified.  str is treated as # UTF-8-encoded. raise TypeError ( property + " of " + self . __class__ . __name__ + " must be " + property_type . __name__ + ", not " + value . __class__ . __name__ ) # Checks passed, perform the assignment. if do_copy : if isinstance ( value , XCObject ) : if is_strong : self . _properties [ property ] = value . Copy ( ) else : self . _properties [ property ] = value elif isinstance ( value , ( str , int ) ) : self . _properties [ property ] = value elif isinstance ( value , list ) : if is_strong : # If is_strong is True, each element is an XCObject, # so it's safe to call Copy. self . _properties [ property ] = [ ] for item in value : self . _properties [ property ] . append ( item . Copy ( ) ) else : self . _properties [ property ] = value [ : ] elif isinstance ( value , dict ) : self . _properties [ property ] = value . copy ( ) else : raise TypeError ( "Don't know how to copy a " + value . __class__ . __name__ + " object for " + property + " in " + self . __class__ . __name__ ) else : self . _properties [ property ] = value # Set up the child's back-reference to this object.  Don't use |value| # any more because it may not be right if do_copy is true. if is_strong : if not is_list : self . _properties [ property ] . parent = self else : for item in self . _properties [ property ] : item . parent = self