comparison mercurial/hgweb/wsgiheaders.py @ 52664:9db77d46de79

py3: drop redundant `u''` prefixes on string literals Strings are unicode on Python 3. These were rewritten by `pyupgrade`. It's arguably better to fix the `contrib` stuff upstream and then re-vendor it, but I don't feel like waiting for that, and then all of the regression testing involved to get a minor improvement in the codebase. It was last vendored 5 years ago, and will likely be a large change anyway to drop py2 support. Also, we've already made minor formatting changes to it locally.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 06 Jan 2025 14:15:40 -0500
parents f4733654f144
children
comparison
equal deleted inserted replaced
52663:dc36535a5edc 52664:9db77d46de79
46 def _convert_string_type(self, value): 46 def _convert_string_type(self, value):
47 """Convert/check value type.""" 47 """Convert/check value type."""
48 if type(value) is bytes: 48 if type(value) is bytes:
49 return value 49 return value
50 raise AssertionError( 50 raise AssertionError(
51 u"Header names/values must be" 51 "Header names/values must be"
52 u" of type bytes (got %s)" % repr(value) 52 " of type bytes (got %s)" % repr(value)
53 ) 53 )
54 54
55 def __len__(self): 55 def __len__(self):
56 """Return the total number of headers, including duplicates.""" 56 """Return the total number of headers, including duplicates."""
57 return len(self._headers) 57 return len(self._headers)