Skip to content

Commit

Permalink
style(executors): replace double quotes, add type hint
Browse files Browse the repository at this point in the history
  • Loading branch information
phamtrancsek12 committed May 17, 2020
1 parent 4d11e11 commit 7aceae3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion jina/executors/crafters/numeric/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ArrayReader(BaseSegmenter):
Numbers are split on the provided delimiter, default is comma (,)
"""

def __init__(self, delimiter=",", as_type="float32", *args, **kwargs):
def __init__(self, delimiter: str = ',', as_type: str = 'float32', *args, **kwargs):
"""
:param delimiter: delimiter between numbers
:param as_type: type of number
Expand Down
6 changes: 3 additions & 3 deletions tests/executors/crafters/numeric/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
class MyTestCase(JinaTestCase):
def test_array_reader(self):
size = 8
sample_array = np.random.rand(size).astype("float32")
raw_bytes = ",".join([str(x) for x in sample_array]).encode("utf8")
sample_array = np.random.rand(size).astype('float32')
raw_bytes = ','.join([str(x) for x in sample_array]).encode('utf8')

reader = ArrayReader()
crafted_chunk = reader.craft(raw_bytes, 0)[0]

np.testing.assert_array_equal(crafted_chunk["blob"], sample_array)
np.testing.assert_array_equal(crafted_chunk['blob'], sample_array)

if __name__ == '__main__':
unittest.main()

0 comments on commit 7aceae3

Please sign in to comment.