Skip to content

Commit

Permalink
Remove epydoc @type and @rtype on functions which now use type annota…
Browse files Browse the repository at this point in the history
…tions
  • Loading branch information
rodrigc committed Sep 19, 2020
1 parent 6e5632c commit 9f6fa1f
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions src/twisted/web/http_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ def _dashCapitalize(name: bytes) -> bytes:
Return a byte string which is capitalized using '-' as a word separator.
@param name: The name of the header to capitalize.
@type name: L{bytes}
@return: The given header capitalized using '-' as a word separator.
@rtype: L{bytes}
"""
return b"-".join([word.capitalize() for word in name.split(b"-")])

Expand All @@ -30,10 +28,8 @@ def _sanitizeLinearWhitespace(headerComponent: bytes) -> bytes:
or value with a single space.
@param headerComponent: The header key or value to sanitize.
@type headerComponent: L{bytes}
@return: The sanitized header key or value.
@rtype: L{bytes}
"""
return b" ".join(headerComponent.splitlines())

Expand Down Expand Up @@ -106,10 +102,8 @@ def _encodeName(self, name: Union[bytes, str]) -> bytes:
bytestring if required.
@param name: A HTTP header name
@type name: L{str} or L{bytes}
@return: C{name}, encoded if required, lowercased
@rtype: L{bytes}
"""
if isinstance(name, str):
return name.lower().encode("iso-8859-1")
Expand All @@ -120,10 +114,8 @@ def _encodeValue(self, value):
Encode a single header value to a UTF-8 encoded bytestring if required.
@param value: A single HTTP header value.
@type value: L{bytes} or L{str}
@return: C{value}, encoded if required
@rtype: L{bytes}
"""
if isinstance(value, str):
return value.encode("utf8")
Expand All @@ -135,10 +127,8 @@ def _encodeValues(self, values: List[Union[bytes, str]]) -> List[bytes]:
bytestrings if required.
@param values: A list of HTTP header values.
@type values: L{list} of L{bytes} or L{str} (mixed types allowed)
@return: C{values}, with each item encoded if required
@rtype: L{list} of L{bytes}
"""
newValues = []

Expand All @@ -151,10 +141,8 @@ def _decodeValues(self, values: List[bytes]) -> List[str]:
Decode a L{list} of header values into a L{list} of Unicode strings.
@param values: A list of HTTP header values.
@type values: L{list} of UTF-8 encoded L{bytes}
@return: C{values}, with each item decoded
@rtype: L{list} of L{str}
"""
newValues = []

Expand All @@ -174,10 +162,8 @@ def hasHeader(self, name: Union[bytes, str]) -> bool:
"""
Check for the existence of a given header.
@type name: L{bytes} or L{str}
@param name: The name of the HTTP header to check for.
@rtype: L{bool}
@return: C{True} if the header exists, otherwise C{False}.
"""
return self._encodeName(name) in self._rawHeaders
Expand All @@ -186,7 +172,6 @@ def removeHeader(self, name: Union[bytes, str]) -> None:
"""
Remove the named header from this header object.
@type name: L{bytes} or L{str}
@param name: The name of the HTTP header to remove.
@return: L{None}
Expand All @@ -199,10 +184,8 @@ def setRawHeaders(
"""
Sets the raw representation of the given header.
@type name: L{bytes} or L{str}
@param name: The name of the HTTP header to set the values for.
@type values: L{list} of L{bytes} or L{str} strings
@param values: A list of strings each one being a header value of
the given name.
Expand Down Expand Up @@ -245,10 +228,8 @@ def addRawHeader(self, name: Union[bytes, str], value: Union[bytes, str]) -> Non
"""
Add a new raw value for the given header.
@type name: L{bytes} or L{str}
@param name: The name of the header for which to set the value.
@type value: L{bytes} or L{str}
@param value: The value to set for the named header.
"""
if not isinstance(name, (bytes, str)):
Expand Down Expand Up @@ -278,14 +259,11 @@ def getRawHeaders(
Returns a list of headers matching the given name as the raw string
given.
@type name: L{bytes} or L{str}
@param name: The name of the HTTP header to get the values of.
@param default: The value to return if no header with the given C{name}
exists.
@rtype: L{list} of strings, same type as C{name} (except when
C{default} is returned).
@return: If the named header is present, a L{list} of its
values. Otherwise, C{default}.
"""
Expand All @@ -309,11 +287,9 @@ def _canonicalNameCaps(self, name: bytes) -> bytes:
"""
Return the canonical name for the given header.
@type name: L{bytes}
@param name: The all-lowercase header name to capitalize in its
canonical form.
@rtype: L{bytes}
@return: The canonical name of the header.
"""
return self._caseMappings.get(name, _dashCapitalize(name))
Expand Down

0 comments on commit 9f6fa1f

Please sign in to comment.