|
|
@ -4,7 +4,7 @@ import sys |
|
|
|
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 |
|
|
@ -133,7 +133,7 @@ class Author(BaseModel): |
|
|
|
|
|
|
|
class CommentsNode(BaseModel): |
|
|
|
createdAt: datetime |
|
|
|
author: Optional[Author] = None |
|
|
|
author: Union[Author, None] = None |
|
|
|
|
|
|
|
|
|
|
|
class Comments(BaseModel): |
|
|
@ -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 |
|
|
@ -179,7 +179,7 @@ class Labels(BaseModel): |
|
|
|
|
|
|
|
|
|
|
|
class ReviewNode(BaseModel): |
|
|
|
author: Optional[Author] = None |
|
|
|
author: Union[Author, None] = None |
|
|
|
state: str |
|
|
|
|
|
|
|
|
|
|
@ -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 |
|
|
@ -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} |
|
|
@ -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 |
|
|
|