(type_: Type, property_name: str)
return default
Get the default value for a property with name `property_name` on class `type_`
Get the default value for a property with name `property_name` on class `type_`
Get the default value for a property with name property_name on class type_
def get_property_default(type_: Type, property_name: str) -> ...:
    """ Get the default value for a property with name `property_name` on class `type_`"""
    if issubclass_safe(type_, tuple):
        # namedtuple
        if hasattr(type_, "_field_defaults"):
            default = type_._field_defaults.get(property_name, inspect.Parameter.empty)
        else:
            default = inspect.Parameter.empty
    else:
        # everything else
        default = getattr(type_, property_name, inspect.Parameter.empty)

    if callable(default) or isinstance(default, property):
        default = inspect.Parameter.empty

    return default
def get_property_default ( type_ : Type , property_name : str ) -> ... : if issubclass_safe ( type_ , tuple ) : # namedtuple if hasattr ( type_ , "_field_defaults" ) : default = type_ . _field_defaults . get ( property_name , inspect . Parameter . empty ) else : default = inspect . Parameter . empty else : # everything else default = getattr ( type_ , property_name , inspect . Parameter . empty ) if callable ( default ) or isinstance ( default , property ) : default = inspect . Parameter . empty return default