From ce61357f26e1e729d67ad80a4fe6f2ecb0752465 Mon Sep 17 00:00:00 2001 From: RamanjaneyuluIdavalapati Date: Wed, 8 Aug 2018 10:51:28 +0200 Subject: [PATCH] #64 Getting proper types from typing annotations in apidoc and properly checking the method whether it gives stream or not basing on return type --- .travis.yml | 4 ++-- kwikapi/api.py | 4 +++- kwikapi/apidoc.py | 3 --- setup.py | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index b236fb7..7240fe7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,8 +16,8 @@ deploy: - LICENSE - kwikapi/api.py - kwikapi/__init__.py - name: kwikapi-0.4.1 - tag_name: 0.4.1 + name: kwikapi-0.4.2 + tag_name: 0.4.2 on: repo: deep-compute/kwikapi - provider: pypi diff --git a/kwikapi/api.py b/kwikapi/api.py index 0e7c352..d9a2d6b 100644 --- a/kwikapi/api.py +++ b/kwikapi/api.py @@ -240,11 +240,13 @@ def _get_fn_info(self, fn): except KeyError: _return_type = 'None' + stream = True if _return_type == typing.Generator else False + info = dict( doc=fn.__doc__, params=params, return_type=_return_type, - gives_stream=inspect.isgeneratorfunction(fn) + gives_stream=stream ) if N_PREFIX_ARGS == 2: diff --git a/kwikapi/apidoc.py b/kwikapi/apidoc.py index a4d1245..bc9169f 100644 --- a/kwikapi/apidoc.py +++ b/kwikapi/apidoc.py @@ -11,9 +11,6 @@ def _type_str(self, t): if t is None: return str(None) - if isinstance(t, typing.TypingMeta): - return str(t) - return t.__name__ def apidoc(self, version: str=None, namespace: str=None) -> dict: diff --git a/setup.py b/setup.py index ebe71ea..a28bb4b 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -version = '0.4.1' +version = '0.4.2' setup( name="kwikapi", version=version,