Skip to content

Commit

Permalink
Merge branch 'master' into no-limiter-for-exit
Browse files Browse the repository at this point in the history
  • Loading branch information
adriangb committed Jul 12, 2022
2 parents 0892b02 + bea5194 commit d822171
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
6 changes: 3 additions & 3 deletions .github/actions/comment-docs-preview-in-pr/app/main.py
@@ -1,7 +1,7 @@
import logging
import sys
from pathlib import Path
from typing import Optional
from typing import Union

import httpx
from github import Github
Expand All @@ -14,7 +14,7 @@
class Settings(BaseSettings):
github_repository: str
github_event_path: Path
github_event_name: Optional[str] = None
github_event_name: Union[str, None] = None
input_token: SecretStr
input_deploy_url: str

Expand Down Expand Up @@ -42,7 +42,7 @@ class PartialGithubEvent(BaseModel):
except ValidationError as e:
logging.error(f"Error parsing event file: {e.errors()}")
sys.exit(0)
use_pr: Optional[PullRequest] = None
use_pr: Union[PullRequest, None] = None
for pr in repo.get_pulls():
if pr.head.sha == event.workflow_run.head_commit.id:
use_pr = pr
Expand Down
6 changes: 3 additions & 3 deletions .github/actions/notify-translations/app/main.py
Expand Up @@ -2,7 +2,7 @@
import random
import time
from pathlib import Path
from typing import Dict, Optional
from typing import Dict, Union

import yaml
from github import Github
Expand All @@ -18,8 +18,8 @@ class Settings(BaseSettings):
github_repository: str
input_token: SecretStr
github_event_path: Path
github_event_name: Optional[str] = None
input_debug: Optional[bool] = False
github_event_name: Union[str, None] = None
input_debug: Union[bool, None] = False


class PartialGitHubEventIssue(BaseModel):
Expand Down
18 changes: 9 additions & 9 deletions .github/actions/people/app/main.py
Expand Up @@ -4,7 +4,7 @@
from collections import Counter, defaultdict
from datetime import datetime, timedelta, timezone
from pathlib import Path
from typing import Container, DefaultDict, Dict, List, Optional, Set
from typing import Container, DefaultDict, Dict, List, Set, Union

import httpx
import yaml
Expand Down Expand Up @@ -133,7 +133,7 @@ class Author(BaseModel):

class CommentsNode(BaseModel):
createdAt: datetime
author: Optional[Author] = None
author: Union[Author, None] = None


class Comments(BaseModel):
Expand All @@ -142,7 +142,7 @@ class Comments(BaseModel):

class IssuesNode(BaseModel):
number: int
author: Optional[Author] = None
author: Union[Author, None] = None
title: str
createdAt: datetime
state: str
Expand Down Expand Up @@ -179,7 +179,7 @@ class Labels(BaseModel):


class ReviewNode(BaseModel):
author: Optional[Author] = None
author: Union[Author, None] = None
state: str


Expand All @@ -190,7 +190,7 @@ class Reviews(BaseModel):
class PullRequestNode(BaseModel):
number: int
labels: Labels
author: Optional[Author] = None
author: Union[Author, None] = None
title: str
createdAt: datetime
state: str
Expand Down Expand Up @@ -263,7 +263,7 @@ class Settings(BaseSettings):


def get_graphql_response(
*, settings: Settings, query: str, after: Optional[str] = None
*, settings: Settings, query: str, after: Union[str, None] = None
):
headers = {"Authorization": f"token {settings.input_token.get_secret_value()}"}
variables = {"after": after}
Expand All @@ -280,19 +280,19 @@ def get_graphql_response(
return data


def get_graphql_issue_edges(*, settings: Settings, after: Optional[str] = None):
def get_graphql_issue_edges(*, settings: Settings, after: Union[str, None] = None):
data = get_graphql_response(settings=settings, query=issues_query, after=after)
graphql_response = IssuesResponse.parse_obj(data)
return graphql_response.data.repository.issues.edges


def get_graphql_pr_edges(*, settings: Settings, after: Optional[str] = None):
def get_graphql_pr_edges(*, settings: Settings, after: Union[str, None] = None):
data = get_graphql_response(settings=settings, query=prs_query, after=after)
graphql_response = PRsResponse.parse_obj(data)
return graphql_response.data.repository.pullRequests.edges


def get_graphql_sponsor_edges(*, settings: Settings, after: Optional[str] = None):
def get_graphql_sponsor_edges(*, settings: Settings, after: Union[str, None] = None):
data = get_graphql_response(settings=settings, query=sponsors_query, after=after)
graphql_response = SponsorsResponse.parse_obj(data)
return graphql_response.data.user.sponsorshipsAsMaintainer.edges
Expand Down
6 changes: 3 additions & 3 deletions .github/actions/watch-previews/app/main.py
@@ -1,7 +1,7 @@
import logging
from datetime import datetime
from pathlib import Path
from typing import List, Optional
from typing import List, Union

import httpx
from github import Github
Expand All @@ -16,7 +16,7 @@ class Settings(BaseSettings):
input_token: SecretStr
github_repository: str
github_event_path: Path
github_event_name: Optional[str] = None
github_event_name: Union[str, None] = None


class Artifact(BaseModel):
Expand Down Expand Up @@ -74,7 +74,7 @@ def get_message(commit: str) -> str:
logging.info(f"Docs preview was notified: {notified}")
if not notified:
artifact_name = f"docs-zip-{commit}"
use_artifact: Optional[Artifact] = None
use_artifact: Union[Artifact, None] = None
for artifact in artifacts_response.artifacts:
if artifact.name == artifact_name:
use_artifact = artifact
Expand Down
1 change: 1 addition & 0 deletions docs/en/docs/release-notes.md
Expand Up @@ -2,6 +2,7 @@

## Latest Changes

* ♻️ Move from `Optional[X]` to `Union[X, None]` for internal utils. PR [#5124](https://github.com/tiangolo/fastapi/pull/5124) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Update sponsors, remove Dropbase, add Doist. PR [#5096](https://github.com/tiangolo/fastapi/pull/5096) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Update sponsors, remove Classiq, add ImgWhale. PR [#5079](https://github.com/tiangolo/fastapi/pull/5079) by [@tiangolo](https://github.com/tiangolo).

Expand Down

0 comments on commit d822171

Please sign in to comment.