15
0
Files
python-HTTPolice/py34-no-singledispatch.patch
Tomáš Chvátal 31f430ee16 Accepting request 679067 from home:jayvdb:coala:python3-bears
- Fix Python 3 tests
- Add py34-no-singledispatch.patch to remove unnecessary 'singledispatch'
  dependency, which is a backport from Python 3.4
- Update to v0.7.0
  * Changes
    + Reflecting changes in RFC 8187 and RFC 8259,
      notices 1253 (bad charset) and 1281 (bad encoding for JSON)
      are now reported for all encodings other than UTF-8, and
      notice 1255 (ISO-8859-1 in Content-Disposition) has been removed.
  * Added
    + Checks for quoted commas and semicolons that might confuse a naive parser
      (notices 1299 and 1300).
    + New checks for Link headers according to RFC 8288 (notices 1307,
      1308, and 1309).
    + Checks for immutable responses (notices 1301, 1302, and 1303).
    + Early hints are now recognized (due to their idiosyncratic semantics,
      they avoid many checks that are applied to all other responses).
    + Checks for the Accept-Post header (notice 1310).
    + Check for no Transfer-Encoding in response to HTTP/1.0 (notice 1306).
    + Check for 100 (Continue) before switching protocols (notice 1305).
    + Check that the sequence of responses to a request makes sense
      (notice 1304).
    + HAR files exported from Chrome and Insomnia are handled slightly better.
  * Fixed
    + Headers like Allow and Accept are now parsed more correctly
      (RFC Errata 5257).
    + gzip-encoded payloads are now decompressed more reliably.
    + When analyzing TCP streams, HTTPolice now uses a stricter heuristic
      for detecting HTTP/1.x streams, producing fewer spurious 1006/1009
      notices.
    + Notice 1291 (Preference-Applied needs Vary) is no longer reported
      on responses to POST.
- Use %license
- Remove unnecessary build dependencies
- Add more minimum versions

OBS-URL: https://build.opensuse.org/request/show/679067
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-HTTPolice?expand=0&rev=1
2019-02-26 08:52:26 +00:00

111 lines
3.4 KiB
Diff

From 4da2bde3d14a24b0623ee45ae10afd192d6fa771 Mon Sep 17 00:00:00 2001
From: John Vandenberg <jayvdb@gmail.com>
Date: Sat, 23 Feb 2019 16:54:20 +0700
Subject: [PATCH] Use functools.singledispatch on Python 3.4+
singledispatch dependency is a backport of the Python 3.4+
implementation of PEP 443
Closes https://github.com/vfaronov/httpolice/issues/6
---
httpolice/reports/common.py | 2 +-
httpolice/reports/html.py | 3 ++-
httpolice/reports/text.py | 2 +-
httpolice/util/moves.py | 5 +++++
setup.py | 2 +-
5 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/httpolice/reports/common.py b/httpolice/reports/common.py
index 7382851..fea50d8 100644
--- a/httpolice/reports/common.py
+++ b/httpolice/reports/common.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8; -*-
-from singledispatch import singledispatch
import six
from httpolice import known, notice
@@ -8,6 +7,7 @@
from httpolice.parse import ParseError, Symbol
from httpolice.structure import HeaderEntry, Parametrized
from httpolice.util.text import format_chars
+from httpolice.util.moves import singledispatch
def resolve_reference(ctx, path):
diff --git a/httpolice/reports/html.py b/httpolice/reports/html.py
index 9ba7f55..0e4f26f 100644
--- a/httpolice/reports/html.py
+++ b/httpolice/reports/html.py
@@ -5,7 +5,7 @@
import dominate
import dominate.tags as H
from dominate.util import text as text_node
-from singledispatch import singledispatch
+
import six
from httpolice import known, message, notice, structure
@@ -16,6 +16,7 @@
find_reason_phrase, resolve_reference)
from httpolice.structure import Unavailable
from httpolice.util.text import nicely_join, printable
+from httpolice.util.moves import singledispatch
###############################################################################
diff --git a/httpolice/reports/text.py b/httpolice/reports/text.py
index 243c812..62ceebf 100644
--- a/httpolice/reports/text.py
+++ b/httpolice/reports/text.py
@@ -2,7 +2,6 @@
import codecs
-from singledispatch import singledispatch
import six
from httpolice import notice
@@ -10,6 +9,7 @@
resolve_reference)
from httpolice.util.text import (detypographize, ellipsize, printable,
write_if_any)
+from httpolice.util.moves import singledispatch
def text_report(exchanges, buf):
diff --git a/httpolice/util/moves.py b/httpolice/util/moves.py
index 1cd93f9..630bfab 100644
--- a/httpolice/util/moves.py
+++ b/httpolice/util/moves.py
@@ -13,3 +13,8 @@
from urllib.parse import unquote_to_bytes
except ImportError: # Python 2; pragma: no cover
from urllib import unquote as unquote_to_bytes
+
+try: # pragma: no cover
+ from functools import singledispatch
+except ImportError: # Python 2 backport; pragma: no cover
+ from singledispatch import singledispatch
diff --git a/setup.py b/setup.py
index b514760..fae8f83 100644
--- a/setup.py
+++ b/setup.py
@@ -33,7 +33,6 @@
# NB: when updating these fields,
# make sure you don't break ``tools/minimum_requires.sh``.
install_requires=[
- 'singledispatch >= 3.4.0.3',
'six >= 1.10.0',
'lxml >= 4.1.0',
'bitstring >= 3.1.4',
@@ -44,6 +43,7 @@
extras_require={
':python_version == "2.7"': [
'enum34 >= 1.1.6',
+ 'singledispatch >= 3.4.0.3',
],
},