Skip to content

Commit

Permalink
Fix: all deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pylover committed Aug 14, 2024
1 parent 95c5add commit 7341619
Show file tree
Hide file tree
Showing 13 changed files with 635 additions and 71 deletions.
2 changes: 1 addition & 1 deletion bddrest/headerset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing.re import Pattern
from typing import Pattern


class HeaderSet(list):
Expand Down
20 changes: 10 additions & 10 deletions bddrest/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,7 @@ def encode_multipart_data(fields):
for key, value in fields.items():
values = [value] if not isinstance(value, list) else value
for value in values:
if not hasattr(value, 'read'):
lines.append('--' + boundary)
lines.append('Content-Disposition: form-data; name="%s"' % key)
lines.append('')
if not isinstance(value, str):
value = str(value)

lines.append(value)

else:
if hasattr(value, 'read'):
filename = value.name if hasattr(value, 'name') else key
lines.append('--' + boundary)
lines.append(
Expand All @@ -46,6 +37,15 @@ def encode_multipart_data(fields):
lines.append('')
lines.append(value.read())

else:
lines.append('--' + boundary)
lines.append('Content-Disposition: form-data; name="%s"' % key)
lines.append('')
if not isinstance(value, str):
value = str(value)

lines.append(value)

lines.append('--' + boundary + '--')
lines.append('')

Expand Down
1 change: 0 additions & 1 deletion requirements-ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ coveralls
pytest-cov
bddcli >= 2.4, < 3
flake8

Loading

0 comments on commit 7341619

Please sign in to comment.