Skip to content

Commit

Permalink
Dropped python 3.5 and below.
Browse files Browse the repository at this point in the history
  • Loading branch information
akornatskyy committed Nov 8, 2020
1 parent 13a0a92 commit 481adce
Show file tree
Hide file tree
Showing 24 changed files with 53 additions and 254 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ language: python

matrix:
include:
- python: 2.7
env: TOXENV=py27
- python: 3.6
env: TOXENV=py36
- python: 3.7
env: TOXENV=py37
- python: 3.8
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ Resources:
## Install

[wheezy.http](https://pypi.org/project/wheezy.http/) requires
[python](https://www.python.org) version 2.4 to 2.7 or 3.2+. It is
independent of operating system. You can install it from
[pypi](https://pypi.org/project/wheezy.http/) site:
[python](https://www.python.org) version 3.6+. It is independent of operating
system. You can install it from [pypi](https://pypi.org/project/wheezy.http/)
site:

```sh
pip install -U wheezy.http
Expand Down
5 changes: 2 additions & 3 deletions demos/ajax/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"""

import unittest

from wheezy.core.comp import json_dumps
from io import BytesIO
from json import dumps as json_dumps

from wheezy.http.functional import WSGIClient

Expand Down Expand Up @@ -37,7 +37,6 @@ def test_content(self):

def test_stream(self):
if has_json:
from wheezy.http.comp import BytesIO

assert 200 == self.client.ajax_post(
"/",
Expand Down
5 changes: 2 additions & 3 deletions demos/guestbook/guestbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
redirect,
)
from wheezy.http.cache import etag_md5crc32, response_cache
from wheezy.http.comp import ntou
from wheezy.http.middleware import http_cache_middleware_factory
from wheezy.http.transforms import gzip_transform, response_transforms

Expand Down Expand Up @@ -85,8 +84,8 @@ def add_record(request):
else:
form = last_item_adapter(request.query)
greeting = Greeting()
greeting.author = ntou(form["author"].strip(), request.encoding)
m = ntou(form["message"].replace("\r", "").strip(), request.encoding)
greeting.author = form["author"].strip()
m = form["message"].replace("\r", "").strip()
greeting.message = m
greetings.insert(0, greeting)
cache_dependency.delete("greetings")
Expand Down
5 changes: 1 addition & 4 deletions demos/wsgi_adapter/wsgi_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

from wheezy.http import CacheProfile, WSGIApplication, bootstrap_http_defaults
from wheezy.http.cache import etag_md5crc32, wsgi_cache
from wheezy.http.comp import b
from wheezy.http.middleware import (
environ_cache_adapter_middleware_factory,
http_cache_middleware_factory,
Expand All @@ -30,9 +29,7 @@
@wsgi_cache(profile=cache_profile)
def welcome(environ, start_response):
start_response("200 OK", [("Content-Type", "text/plain")])
return [
b("Hello World!!!\nThe time is %s" % datetime.now().isoformat(" "))
]
return [b"Hello World!!!\nThe time is %s" % datetime.now().isoformat(" ")]


options = {"wsgi_app": welcome, "http_cache": cache}
Expand Down
4 changes: 2 additions & 2 deletions doc/gettingstarted.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Getting Started
Install
-------

:ref:`wheezy.http` requires `python`_ version 2.4 to 2.7 or 3.2+.
It is operating system independent. You can install it from `pypi`_::
:ref:`wheezy.http` requires `python`_ version 3.6+. It is operating system
independent. You can install it from `pypi`_::

$ easy_install wheezy.http

Expand Down
36 changes: 0 additions & 36 deletions requirements/dev-py2.txt

This file was deleted.

File renamed without changes.
12 changes: 2 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
[os.path.join(p, "*.py")],
exclude=os.path.join(p, "__init__.py"),
nthreads=2,
compiler_directives={"language_level": 3},
quiet=True,
)
except ImportError:
Expand All @@ -32,6 +33,7 @@
setup(
name="wheezy.http",
version=VERSION,
python_requires=">=3.6",
description="A lightweight http request-response library",
long_description=README,
long_description_content_type="text/markdown",
Expand All @@ -46,16 +48,6 @@
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.4",
"Programming Language :: Python :: 2.5",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
Expand Down
3 changes: 2 additions & 1 deletion src/wheezy/http/application.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
""" ``application`` module.
"""

from wheezy.http.comp import reduce
from functools import reduce

from wheezy.http.request import HTTPRequest
from wheezy.http.response import not_found

Expand Down
4 changes: 2 additions & 2 deletions src/wheezy/http/cache.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
""" ``cache`` module
"""

from hashlib import md5
from zlib import crc32

from wheezy.http.cacheprofile import none_cache_profile
from wheezy.http.comp import b, md5


def response_cache(profile=None):
Expand Down Expand Up @@ -93,7 +93,7 @@ def etag(buf):
h = hasher()
for chunk in buf:
h.update(chunk)
return '"%08x"' % (crc32(b(h.hexdigest())) & 0xFFFFFFFF)
return '"%08x"' % (crc32(h.hexdigest().encode("latin1")) & 0xFFFFFFFF)

return etag

Expand Down
130 changes: 0 additions & 130 deletions src/wheezy/http/comp.py

This file was deleted.

4 changes: 1 addition & 3 deletions src/wheezy/http/cookie.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

from wheezy.core.datetime import format_http_datetime

from wheezy.http.comp import n


class HTTPCookie(object):
"""HTTP Cookie
Expand Down Expand Up @@ -82,7 +80,7 @@ def http_set_cookie(self, encoding):
append = directives.append
append(self.name + "=")
if self.value:
append(n(self.value, encoding))
append(self.value)
if self.domain:
append("; domain=" + self.domain)
if self.expires:
Expand Down

0 comments on commit 481adce

Please sign in to comment.