MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / del_param

Method del_param

tools/python-3.11.9-amd64/Lib/email/message.py:780–800  ·  view source on GitHub ↗

Remove the given parameter completely from the Content-Type header. The header will be re-written in place without the parameter or its value. All values will be quoted as necessary unless requote is False. Optional header specifies an alternative to the Content-Type

(self, param, header='content-type', requote=True)

Source from the content-addressed store, hash-verified

778 self[header] = ctype
779
780 def del_param(self, param, header='content-type', requote=True):
781 """Remove the given parameter completely from the Content-Type header.
782
783 The header will be re-written in place without the parameter or its
784 value. All values will be quoted as necessary unless requote is
785 False. Optional header specifies an alternative to the Content-Type
786 header.
787 """
788 if header not in self:
789 return
790 new_ctype = ''
791 for p, v in self.get_params(header=header, unquote=requote):
792 if p.lower() != param.lower():
793 if not new_ctype:
794 new_ctype = _formatparam(p, v, requote)
795 else:
796 new_ctype = SEMISPACE.join([new_ctype,
797 _formatparam(p, v, requote)])
798 if new_ctype != self.get(header):
799 del self[header]
800 self[header] = new_ctype
801
802 def set_type(self, type, header='Content-Type', requote=True):
803 """Set the main type and subtype for the Content-Type header.

Callers 1

set_charsetMethod · 0.95

Calls 5

get_paramsMethod · 0.95
getMethod · 0.95
_formatparamFunction · 0.70
lowerMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected