Raise valueerrors

This commit is contained in:
Stan Ulbrych 2025-07-13 07:55:11 +01:00
parent 609d5adc7c
commit cb8197ad6d
No known key found for this signature in database
GPG key ID: B8E58DBDB2A1A0B8
8 changed files with 52 additions and 16 deletions

View file

@ -14,7 +14,8 @@
### Codec APIs
def uu_encode(input, errors='strict', filename='<data>', mode=0o666):
assert errors == 'strict'
if errors != 'strict':
raise ValueError(f'Unsupported error handling mode: "{errors}" - must be "strict"')
infile = BytesIO(input)
outfile = BytesIO()
read = infile.read
@ -35,7 +36,8 @@ def uu_encode(input, errors='strict', filename='<data>', mode=0o666):
return (outfile.getvalue(), len(input))
def uu_decode(input, errors='strict'):
assert errors == 'strict'
if errors != 'strict':
raise ValueError(f'Unsupported error handling mode: "{errors}" - must be "strict"')
infile = BytesIO(input)
outfile = BytesIO()
readline = infile.readline