Skip to content

Refactor ASGITransport.request() - #1021

Merged
florimondmanca merged 2 commits into
masterfrom
refactor-asgi
Jun 13, 2020
Merged

Refactor ASGITransport.request()#1021
florimondmanca merged 2 commits into
masterfrom
refactor-asgi

Conversation

@florimondmanca

@florimondmancaflorimondmanca commented Jun 13, 2020

Copy link
Copy Markdown
Contributor

Prompted by #998 (comment), small bit of refactoring for ASGITransport to help reduce the diff there. I think these are valid readability improvements any case.

  • Unify typing import style.
  • Declare related variables in logical groups.
  • Cleanup any unnecessary nonlocal's
  • Add some comments on how everything is split.

@florimondmancaflorimondmanca added the refactor Issues and PRs related to code refactoring label Jun 13, 2020
await self.app(scope, receive, send)
except Exception:
if self.raise_app_exceptions or not response_complete:
if self.raise_app_exceptions or not response_complete.is_set():

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was a typo before.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think that was my mistake. Missed this when changing response_complete from a bool to an event. Also didn't realise the nonlocal could be removed 😬

@florimondmanca
florimondmanca requested a review from a teamJune 13, 2020 13:42

@JayH5JayH5 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

await self.app(scope, receive, send)
except Exception:
if self.raise_app_exceptions or not response_complete:
if self.raise_app_exceptions or not response_complete.is_set():

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think that was my mistake. Missed this when changing response_complete from a bool to an event. Also didn't realise the nonlocal could be removed 😬

@florimondmanca
florimondmanca merged commit b481166 into masterJun 13, 2020
@florimondmanca
florimondmanca deleted the refactor-asgi branch June 13, 2020 17:59
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactorIssues and PRs related to code refactoring

Development

Successfully merging this pull request may close these issues.

2 participants

@florimondmanca@JayH5