From 68678177ed905405c4961e3f869b91b149c674d9 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Mon, 16 Mar 2020 02:55:36 -0500 Subject: [PATCH] type hinted bytesconverter --- src/onionrutils/bytesconverter.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/onionrutils/bytesconverter.py b/src/onionrutils/bytesconverter.py index b6ef9741..66cbcc5b 100644 --- a/src/onionrutils/bytesconverter.py +++ b/src/onionrutils/bytesconverter.py @@ -1,12 +1,14 @@ -def str_to_bytes(data): - '''Converts a string to bytes with .encode()''' +def str_to_bytes(data: str) -> bytes: + '''Convert a string to bytes with .encode(), utf8''' try: data = data.encode('UTF-8') except AttributeError: pass return data -def bytes_to_str(data): + +def bytes_to_str(data: bytes) -> str: + """Convert bytes to strings with .decode(), utf8""" try: data = data.decode('UTF-8') except AttributeError: