Skip to content
Myr

Tiny refactor on _multipart.py & _main.py (#1971)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* remove unnecessary casting in f-string * merge nested condition

authored by Mohammadreza Jafari · committed by GitHub · parent 82ba15b · Browse files · 2 files+2 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+2 added−2 removed

  • other:+2 added−2 removed

2 files+2 added−2 removed

modified:httpx/_main.py+1 added-1 removed
485 unmodified lines
486 print_response(response)487488 except RequestError as exc:489 console = rich.console.Console()490 console.print(f"[red]{type(exc).__name__}[/red]: {str(exc)}")490 console.print(f"[red]{type(exc).__name__}[/red]: {exc}")491 sys.exit(1)492493 sys.exit(0 if response.is_success else 1)
modified:httpx/_multipart.py+1 added-1 removed
87 unmodified lines
88 filename = Path(str(getattr(value, "name", "upload"))).name89 fileobj = value90 content_type = guess_content_type(filename)9192 if isinstance(fileobj, str) or isinstance(fileobj, io.StringIO):92 if isinstance(fileobj, (str, io.StringIO)):93 raise TypeError(f"Expected bytes or bytes-like object got: {type(fileobj)}")9495 self.filename = filename96 self.file = fileobj
122 unmodified lines