Skip to content

Commit 26fd760

Browse files
committed
Merge branch 'bugs/pallets-eco#25-type-hints-support-3.5' into develop
2 parents 22275b4 + 3da3bce commit 26fd760

File tree

5 files changed

+55
-4
lines changed

5 files changed

+55
-4
lines changed

.travis.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ language: python
33
env:
44
global:
55
- MOST_TESTED_PYTHON_VERSION=2.7
6-
- FLASK_LATEST=0.10.1
6+
- COVERAGE_PYTHON_VERSION=3.5
7+
- FLASK_LATEST=0.11.1
78
- GH_REPO="teracyhq/flask-classful"
89
- secure: WP/pK+Hcm7s3992sy6atnm+znXal6ZipVe4GIv90E71CqxhUG/dv6h+C4V4w48LEbDuW19tt6y5EOUeyoBl1bIAaIruBgJAyvQsi8PO6rAhnqQmfkPTnjfoOjHuWXO8dyFrQFhl9R2P/BxSmrYb/HFVhrjMHqwe0JnfSpwyDqjVN1xFYkg81fCjXnQA60uCY8TNPSnwkUb1w1vKG7Aot46uMJk1aWUmWFlDRBfQaqhw2y2KK/G4xB0t9UL4lRl66xER4iXjkYuGQEAik5OVKnpPf9IZRUDMUdPCdxzsbbw6qdrNls5FhvNhfz/PN+65l3Ui3eRQZs74Yw2eOI77pUUQ/6oYdbwm346cyrS33GiHWwvylQHsKdTIGf2C4AlyUAYzOIMmuNHaKuWSgt++czxEQQKfoNRp7Zthru0PuPS0Y9M3G2AsbiX05XpNL+qbhvnRzE/TYiTUoqKpB9TrTDF5FX6wLsgluHxroU27Tu2i5iB+DkNDeDCv1oZFnY3VZQd5rH8hu5BA6r5SWfe4VrUoTXABNAniCWvVZLu+zfY/kYcbd/RY8Tcm914I2TDU3tZa0rPjZl90y5NjoNJyu4+3mO3xUg/1fOWsTmdSW3EsLC0VqzJeSJTi9xX6zy62twcvGxivlgW2fippEZ6azboHJQHAjKS2PyUn//+MFRzk=
910
matrix:
1011
- Flask=0.9.0
1112
- Flask=0.10.0
1213
- Flask=0.10.1
14+
- Flask=0.11
15+
- Flask=0.11.1
1316
matrix:
1417
exclude:
1518
- python: 3.3
@@ -41,7 +44,7 @@ after_script:
4144
- if [[ ! -z ${DEPLOY_HTML_DIR+x} && $TRAVIS_PYTHON_VERSION == $MOST_TESTED_PYTHON_VERSION && $Flask == $FLASK_LATEST ]]; then
4245
pip install -r docs/requirements.txt && cd docs && make setup_gh_pages && make generate && make deploy; fi
4346
after_success:
44-
- if [[ $TRAVIS_PYTHON_VERSION == $MOST_TESTED_PYTHON_VERSION && $Flask == $FLASK_LATEST ]]; then pip install
47+
- if [[ $TRAVIS_PYTHON_VERSION == $COVERAGE_PYTHON_VERSION && $Flask == $FLASK_LATEST ]]; then pip install
4548
--quiet python-coveralls && make report-coverage && coveralls; fi
4649
- make check-style
4750
notifications:

flask_classful.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,11 @@ def get_interesting_members(base_class, cls):
357357
def get_true_argspec(method):
358358
"""Drills through layers of decorators attempting to locate the actual argspec for the method."""
359359

360-
argspec = inspect.getargspec(method)
360+
try:
361+
argspec = inspect.getargspec(method)
362+
except ValueError:
363+
argspec = inspect.getfullargspec(method)
364+
361365
args = argspec[0]
362366
if args and args[0] == 'self':
363367
return argspec

setup.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[nosetests]
2+
where=test_classful
3+
py3where=.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def find_version(*file_paths):
3737
url='https://github.com/teracyhq/flask-classful',
3838
license='BSD',
3939
author='Freedom Dumlao & Teracy, Inc',
40-
author_email='teracyhq@teracy.com',
40+
author_email='hq@teracy.com',
4141
description='Class based views for Flask',
4242
long_description=__doc__,
4343
py_modules=['flask_classful'],

test_classful_py3/test_type_hints.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import sys
2+
3+
import json
4+
from flask import Flask
5+
from flask_classful import FlaskView, route
6+
from nose.tools import *
7+
8+
9+
# python3 only
10+
11+
class TypingView(FlaskView):
12+
13+
def index(self):
14+
return "Index"
15+
16+
@route('/<id>', methods=['POST'])
17+
def post(self, id: str) -> str:
18+
return "Post"
19+
20+
def patch(self, id: str) -> str:
21+
return "Patch"
22+
23+
24+
app = Flask('typing-app')
25+
TypingView.register(app)
26+
client = app.test_client()
27+
28+
29+
def test_index():
30+
resp = client.get('/typing/')
31+
eq_(b"Index", resp.data)
32+
33+
34+
def test_post():
35+
resp = client.post('/typing/123')
36+
eq_(b"Post", resp.data)
37+
38+
39+
def test_patch():
40+
resp = client.patch('/typing/123')
41+
eq_(b"Patch", resp.data)

0 commit comments

Comments
 (0)