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

Method set_flags

tools/python-3.11.9-amd64/Lib/mailbox.py:1666–1686  ·  view source on GitHub ↗

Set the given flags and unset all others.

(self, flags)

Source from the content-addressed store, hash-verified

1664 return self.get('Status', '') + self.get('X-Status', '')
1665
1666 def set_flags(self, flags):
1667 """Set the given flags and unset all others."""
1668 flags = set(flags)
1669 status_flags, xstatus_flags = '', ''
1670 for flag in ('R', 'O'):
1671 if flag in flags:
1672 status_flags += flag
1673 flags.remove(flag)
1674 for flag in ('D', 'F', 'A'):
1675 if flag in flags:
1676 xstatus_flags += flag
1677 flags.remove(flag)
1678 xstatus_flags += ''.join(sorted(flags))
1679 try:
1680 self.replace_header('Status', status_flags)
1681 except KeyError:
1682 self.add_header('Status', status_flags)
1683 try:
1684 self.replace_header('X-Status', xstatus_flags)
1685 except KeyError:
1686 self.add_header('X-Status', xstatus_flags)
1687
1688 def add_flag(self, flag):
1689 """Set the given flag(s) without changing others."""

Callers 2

add_flagMethod · 0.95
remove_flagMethod · 0.95

Calls 6

sortedFunction · 0.85
replace_headerMethod · 0.80
setFunction · 0.50
removeMethod · 0.45
joinMethod · 0.45
add_headerMethod · 0.45

Tested by

no test coverage detected