Skip to content

Commit f7aa776

Browse files
ShahriyarRKludex
andauthored
Small Pythonic code changes for datastructures.py file (#1167)
* Small Pythonic code changes for datastructures.py file * Reverting back .gitignore changes * reverting back newline in .gitignore * Reverting back the changes as requested during merge review Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
1 parent 214d1f1 commit f7aa776

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

starlette/datastructures.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,7 @@ def make_absolute_url(self, base_url: typing.Union[str, URL]) -> str:
180180
else:
181181
scheme = base_url.scheme
182182

183-
if self.host:
184-
netloc = self.host
185-
else:
186-
netloc = base_url.netloc
187-
183+
netloc = self.host or base_url.netloc
188184
path = base_url.path.rstrip("/") + str(self)
189185
return str(URL(scheme=scheme, netloc=netloc, path=path))
190186

@@ -246,11 +242,7 @@ def __init__(
246242
) -> None:
247243
assert len(args) < 2, "Too many arguments."
248244

249-
if args:
250-
value = args[0]
251-
else:
252-
value = []
253-
245+
value = args[0] if args else []
254246
if kwargs:
255247
value = (
256248
ImmutableMultiDict(value).multi_items()

0 commit comments

Comments
 (0)