Skip to content

Commit 9de4466

Browse files
author
hhsecond
committed
fixed readme for proper rendering in pypi
1 parent 8cfd097 commit 9de4466

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

redisai/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ def tensorget(self,
6262
self.commands.extend(args)
6363
self.commands.append("|>")
6464
self.result_processors.append(partial(utils.tensorget_postprocessor,
65-
as_numpy,
66-
meta_only))
65+
as_numpy=as_numpy,
66+
meta_only=meta_only))
6767
return self
6868

6969
def modelrun(self,
@@ -407,7 +407,7 @@ def tensorget(self,
407407
"""
408408
args = builder.tensorget(key, as_numpy, meta_only)
409409
res = self.execute_command(*args)
410-
return utils.tensorget_postprocessor(as_numpy, meta_only, res)
410+
return utils.tensorget_postprocessor(res, as_numpy, meta_only)
411411

412412
def scriptset(self, key: AnyStr, device: str, script: str, tag: AnyStr = None) -> str:
413413
"""

redisai/utils.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919

2020
def numpy2blob(tensor: np.ndarray) -> tuple:
21-
""" Convert the numpy input from user to `Tensor` """
21+
"""Convert the numpy input from user to `Tensor`."""
2222
try:
2323
dtype = dtype_dict[str(tensor.dtype)]
2424
except KeyError:
@@ -29,7 +29,7 @@ def numpy2blob(tensor: np.ndarray) -> tuple:
2929

3030

3131
def blob2numpy(value: ByteString, shape: Union[list, tuple], dtype: str) -> np.ndarray:
32-
""" Convert `BLOB` result from RedisAI to `np.ndarray` """
32+
"""Convert `BLOB` result from RedisAI to `np.ndarray`."""
3333
mm = {
3434
'FLOAT': 'float32',
3535
'DOUBLE': 'float64'
@@ -40,6 +40,7 @@ def blob2numpy(value: ByteString, shape: Union[list, tuple], dtype: str) -> np.n
4040

4141

4242
def list2dict(lst):
43+
"""Convert the list from RedisAI to a dict."""
4344
if len(lst) % 2 != 0:
4445
raise RuntimeError("Can't unpack the list: {}".format(lst))
4546
out = {}
@@ -55,10 +56,8 @@ def list2dict(lst):
5556
def recursive_bytetransform(arr: List[AnyStr], target: Callable) -> list:
5657
"""
5758
Recurse value, replacing each element of b'' with the appropriate element.
58-
Function returns the same array after inplace operation which updates `arr`
5959
60-
:param target: Type of tensor | array
61-
:param arr: The array with b'' numbers or recursive array of b''
60+
Function returns the same array after inplace operation which updates `arr`
6261
"""
6362
for ix in range(len(arr)):
6463
obj = arr[ix]
@@ -70,10 +69,16 @@ def recursive_bytetransform(arr: List[AnyStr], target: Callable) -> list:
7069

7170

7271
def listify(inp: Union[str, Sequence[str]]) -> Sequence[str]:
72+
"""Wrap the ``inp`` with a list if it's not a list already."""
7373
return (inp,) if not isinstance(inp, (list, tuple)) else inp
7474

7575

76-
def tensorget_postprocessor(as_numpy, meta_only, rai_result):
76+
def tensorget_postprocessor(rai_result, as_numpy, meta_only):
77+
"""Process the tensorget output.
78+
79+
If ``as_numpy`` is True, it'll be converted to a numpy array. The required
80+
information such as datatype and shape must be in ``rai_result`` itself.
81+
"""
7782
rai_result = list2dict(rai_result)
7883
if meta_only:
7984
return rai_result

setup.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
version='1.0.0',
1111
description='RedisAI Python Client',
1212
long_description=long_description,
13-
long_description_content_type='text/markdown',
13+
long_description_content_type='text/x-rst',
1414
url='http://github.com/RedisAI/redisai-py',
1515
author='RedisLabs',
1616
author_email='[email protected]',
1717
packages=find_packages(),
1818
install_requires=['redis', 'hiredis', 'numpy'],
19-
python_requires='>=3.2',
19+
python_requires='>=3.6',
2020
classifiers=[
2121
'Development Status :: 4 - Beta',
2222
'Intended Audience :: Developers',
@@ -26,7 +26,6 @@
2626
'Programming Language :: Python :: 3.6',
2727
'Programming Language :: Python :: 3.7',
2828
'Programming Language :: Python :: 3.8',
29-
'Topic :: Database',
30-
'Topic :: Software Development :: Testing'
29+
'Topic :: Database'
3130
]
3231
)

0 commit comments

Comments
 (0)