a [f@sJdZddlZdddZddZddZejr6d d Znd d Zd d ZdS)z!Utilities for the Response class.NcsR|fdd}dur*fdd}nfdd}fdd}t||||S) aCreate a header getter/setter. Args: name: Header name, e.g., "Content-Type" doc: Docstring for the property transform: Transformation function to use when setting the property. The value will be passed to the function, and the function should return the transformed value to use as the value of the header (default ``None``). cs&z |jWSty YdS0dSN_headersKeyErrorselfnormalized_name{/sparta/input/_build_configuration/image_build+validate/lib/bmcenv/lib64/python3.9/site-packages/falcon/response_helpers.pyfget"s  zheader_property..fgetNcs<|dur*z |j=Wq8ty&Yq80nt||j<dSr)rrstrrvaluerr r fset)s   zheader_property..fsetcs<|dur*z |j=Wq8ty&Yq80n||j<dSrrrr transformr r r2s   cs |j=dSr)rrrr r fdel;szheader_property..fdel)lowerproperty)namedocrr rrr rr header_propertys    rcCsZt|dkr.d|d|d|d|df}nd|d|d|df}tjrVt|}|S)zmFormat a range header tuple per the HTTP spec. Args: value: ``tuple`` passed to `req.range` z %s %s-%s/%srzbytes %s-%s/%s)lensixPY2r )rresultr r r format_rangeAs "r!cCs d|dS)z6Formats a Content-Disposition header given a filename.zattachment; filename=""r )rr r r format_content_dispositionXsr#cCstd|Sz(Join an iterable of strings with commas.z, )r joiniterabler r r format_header_value_list_sr(cCs d|Sr$)r%r&r r r r(cscCsLz|dWn8ty"YdSty4YdStyFYdS0dS)z1Check if argument encodes to ascii without error.asciiFT)encodeUnicodeEncodeErrorUnicodeDecodeErrorAttributeError)sr r r is_ascii_encodablehs   r/)N)__doc__rrr!r#rr(r/r r r r s -