sob/meta.py
def writable(model: Union[type, abc.Model]) -> Any:
    """
    This function returns an instance of [sob.meta.Meta](#Meta) which can
    be safely modified. If the class or model instance inherits its metadata
    from a class or base class, this function will create and return a
    duplicate of that metadata assigned directly to the class or instance
    represented by `model`.
    """
    assert _is_model(model)
    if isinstance(model, abc.Model):
        if getattr(model, "_meta") is None:
            model._meta = deepcopy(writable(type(model)))
    elif isinstance(model, type) and issubclass(
        model, (abc.Object, abc.Dictionary, abc.Array)
    ):
        model_meta: Union[
            abc.ObjectMeta, abc.DictionaryMeta, abc.ArrayMeta
        ] = getattr(model, "_meta")
        if model_meta is None:
            # If this model doesn't have any metadata yet--create an
            # appropriate metadata instance
            model._meta = (
                Object()
                if issubclass(model, abc.Object)
                else Array()
                if issubclass(model, abc.Array)
                else Dictionary()
            )
        else:
            # Ensure that the metadata is not being inherited from a base
            # class by copying the metadata if it has the same ID as any
            # base class
            for base in model.__bases__:
                base_meta: Optional[abc.Meta] = None
                try:
                    base_meta = getattr(base, "_meta")
                except AttributeError:
                    pass
                if base_meta is not None:
                    if model_meta is base_meta:
                        model._meta = deepcopy(model_meta)
                        break
    else:
        repr_model = represent(model)
        raise TypeError(
            "%s requires a parameter which is an instance or sub-class of "
            "`%s`, not%s"
            % (
                calling_function_qualified_name(),
                qualified_name(abc.Model),
                (
                    ":\n" + repr_model
                    if "\n" in repr_model
                    else " `%s`" % repr_model
                ),
            )
        )
    return getattr(model, "_meta")

    This function returns an instance of [sob.meta.Meta](#Meta) which can
    be safely modified. If the class or model instance inherits its metadata
    from a class or base class, this function will create and return a
    duplicate of that metadata assigned directly to the class or instance
    represented by `model`.
    
This function returns an instance of [sob.meta.Meta](#Meta) which can
be safely modified. If the class or model instance inherits its metadata
from a class or base class, this function will create and return a
duplicate of that metadata assigned directly to the class or instance
represented by `model`.
This function returns an instance of [ sob . meta . Meta ] ( #Meta ) which can be safely modified . If the class or model instance inherits its metadata from a class or base class this function will create and return a duplicate of that metadata assigned directly to the class or instance represented by ` model ` .
def writable(model: Union[type, abc.Model]) -> Any:
    assert _is_model(model)
    if isinstance(model, abc.Model):
        if getattr(model, "_meta") is None:
            model._meta = deepcopy(writable(type(model)))
    elif isinstance(model, type) and issubclass(
        model, (abc.Object, abc.Dictionary, abc.Array)
    ):
        model_meta: Union[
            abc.ObjectMeta, abc.DictionaryMeta, abc.ArrayMeta
        ] = getattr(model, "_meta")
        if model_meta is None:
            model._meta = (
                Object()
                if issubclass(model, abc.Object)
                else Array()
                if issubclass(model, abc.Array)
                else Dictionary()
            )
        else:
            for base in model.__bases__:
                base_meta: Optional[abc.Meta] = None
                try:
                    base_meta = getattr(base, "_meta")
                except AttributeError:
                    pass
                if base_meta is not None:
                    if model_meta is base_meta:
                        model._meta = deepcopy(model_meta)
                        break
    else:
        repr_model = represent(model)
        raise TypeError(
            "%s requires a parameter which is an instance or sub-class of "
            "`%s`, not%s"
            % (
                calling_function_qualified_name(),
                qualified_name(abc.Model),
                (
                    ":\n" + repr_model
                    if "\n" in repr_model
                    else " `%s`" % repr_model
                ),
            )
        )
    return getattr(model, "_meta")
def writable ( model : Union [ type , abc . Model ] ) -> Any : assert _is_model ( model ) if isinstance ( model , abc . Model ) : if getattr ( model , "_meta" ) is None : model . _meta = deepcopy ( writable ( type ( model ) ) ) elif isinstance ( model , type ) and issubclass ( model , ( abc . Object , abc . Dictionary , abc . Array ) ) : model_meta : Union [ abc . ObjectMeta , abc . DictionaryMeta , abc . ArrayMeta ] = getattr ( model , "_meta" ) if model_meta is None : model . _meta = ( Object ( ) if issubclass ( model , abc . Object ) else Array ( ) if issubclass ( model , abc . Array ) else Dictionary ( ) ) else : for base in model . __bases__ : base_meta : Optional [ abc . Meta ] = None try : base_meta = getattr ( base , "_meta" ) except AttributeError : pass if base_meta is not None : if model_meta is base_meta : model . _meta = deepcopy ( model_meta ) break else : repr_model = represent ( model ) raise TypeError ( "%s requires a parameter which is an instance or sub-class of " "`%s`, not%s" % ( calling_function_qualified_name ( ) , qualified_name ( abc . Model ) , ( ":\n" + repr_model if "\n" in repr_model else " `%s`" % repr_model ) , ) ) return getattr ( model , "_meta" )
This function returns an instance of [sob.meta.Meta](#Meta) which can
be safely modified.
This function returns an instance of [ sob . meta . Meta ] ( #Meta ) which can be safely modified .
"""
    This function returns an instance of [sob.meta.Meta](#Meta) which can
    be safely modified. If the class or model instance inherits its metadata
    from a class or base class, this function will create and return a
    duplicate of that metadata assigned directly to the class or instance
    represented by `model`.
    """ # If this model doesn't have any metadata yet--create an # appropriate metadata instance # Ensure that the metadata is not being inherited from a base # class by copying the metadata if it has the same ID as any # base class
model
Union[type, abc.Model]