mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 23:13:25 +00:00
str_utils: Move force_bytes into ccache.py.
This is only used there, and so belongs in that bundle of barely-maintained code.
This commit is contained in:
@@ -43,15 +43,6 @@ def force_text(s: Union[str, bytes], encoding: str='utf-8') -> str:
|
||||
else:
|
||||
raise TypeError("force_text expects a string type")
|
||||
|
||||
def force_bytes(s: Union[str, bytes], encoding: str='utf-8') -> bytes:
|
||||
"""converts a string to binary string"""
|
||||
if isinstance(s, bytes):
|
||||
return s
|
||||
elif isinstance(s, str):
|
||||
return s.encode(encoding)
|
||||
else:
|
||||
raise TypeError("force_bytes expects a string type")
|
||||
|
||||
def force_str(s: Union[str, bytes], encoding: str='utf-8') -> str:
|
||||
"""converts a string to a native string"""
|
||||
if isinstance(s, str):
|
||||
|
||||
Reference in New Issue
Block a user