Skip to content

Commit

Permalink
Avoid vendoring anything
Browse files Browse the repository at this point in the history
  • Loading branch information
twm committed Jan 2, 2024
1 parent e03348f commit 0a3d17b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 102 deletions.
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -35,14 +35,14 @@
"Twisted[tls] >= 22.10.0", # For #11635
"attrs",
"typing_extensions >= 3.10.0",
"multipart",
],
extras_require={
"dev": [
"pep8",
"pyflakes",
"httpbin==0.7.0",
"werkzeug==2.0.3",
"multipart",
],
"docs": [
"sphinx<7.0.0", # Removal of 'style' key breaks RTD.
Expand Down
98 changes: 0 additions & 98 deletions src/treq/_cgi.py

This file was deleted.

6 changes: 3 additions & 3 deletions src/treq/content.py
@@ -1,6 +1,7 @@
import json
from typing import Any, Callable, FrozenSet, List, Optional, cast

import multipart # type: ignore
from twisted.internet.defer import Deferred, succeed
from twisted.internet.protocol import Protocol, connectionDone
from twisted.python.failure import Failure
Expand All @@ -9,8 +10,6 @@
from twisted.web.http_headers import Headers
from twisted.web.iweb import IResponse

from treq import _cgi


"""Characters that are valid in a charset name per RFC 2978.
Expand All @@ -30,10 +29,11 @@ def _encoding_from_headers(headers: Headers) -> Optional[str]:

# This seems to be the choice browsers make when encountering multiple
# content-type headers.
media_type, params = _cgi.parse_header(content_types[-1])
media_type, params = multipart.parse_options_header(content_types[-1])

charset = params.get("charset")
if charset:
assert isinstance(charset, str) # for MyPy
charset = charset.strip("'\"").lower()
if not charset:
return None
Expand Down

0 comments on commit 0a3d17b

Please sign in to comment.