Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/pyapi/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
from __future__ import annotations

import json
from dataclasses import dataclass
from pathlib import Path
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from typing import TypedDict

from npe2 import PluginManifest

Version = str
PluginName = str

class Plugins(TypedDict):
@dataclass
class Plugins:
active: dict[PluginName, list[Version]]
withdrawn: dict[PluginName, list[Version]]
deleted: dict[PluginName, list[Version]]
Expand Down
15 changes: 10 additions & 5 deletions lib/pyapi/github.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import json
import os
import re
from dataclasses import dataclass
from functools import lru_cache
from itertools import chain
from pathlib import Path
from typing import Literal, TypedDict
from typing import Literal

import requests
from gql import Client, gql
Expand All @@ -16,14 +17,16 @@
PluginName = str


class CommitInfo(TypedDict):
@dataclass
class CommitInfo:
date: str
message: str
author_name: str
author_login: str


class GithubActivity(TypedDict):
@dataclass
class GithubActivity:
default_branch: str
open_issues: int
pull_requests: int
Expand All @@ -35,7 +38,8 @@ class GithubActivity(TypedDict):
open_runtime_vulnerability_alerts: int


class CoverageInfo(TypedDict):
@dataclass
class CoverageInfo:
hits: int
lines: int
ratio: float
Expand All @@ -44,7 +48,8 @@ class CoverageInfo(TypedDict):
branch: str


class RepoSummary(TypedDict):
@dataclass
class RepoSummary:
url: str
activity: GithubActivity
coverage: CoverageInfo | None
Expand Down
5 changes: 3 additions & 2 deletions scripts/fetch_manifests.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import json
import sys
from concurrent.futures import ProcessPoolExecutor
from dataclasses import dataclass
from pathlib import Path
from typing import TypedDict

from npe2 import fetch_manifest
from packaging.version import Version
Expand Down Expand Up @@ -41,7 +41,8 @@ def _current_manifest_is_valid(name: str, version: str) -> bool:
return False


class ManifestError(TypedDict):
@dataclass
class ManifestError:
name: str
version: str
error: str
Expand Down
6 changes: 4 additions & 2 deletions scripts/reindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
import re
import sys
from concurrent.futures import ThreadPoolExecutor
from dataclasses import dataclass
from pathlib import Path
from typing import Any, TypedDict
from typing import Any
from urllib import error, request

from packaging.utils import canonicalize_name
Expand All @@ -33,7 +34,8 @@
PluginName = str


class SummaryDict(TypedDict):
@dataclass
class SummaryDict:
"""Structure of dicts in index.json."""

normalized_name: str
Expand Down
Loading