Enable Ruff PLR (Pylint Refactor) (#13307)

This commit is contained in:
Avasam
2025-03-03 18:03:34 +01:00
committed by GitHub
parent 3e83e42a0f
commit 6f98c59f93
8 changed files with 18 additions and 8 deletions
+3 -2
View File
@@ -18,6 +18,7 @@ import re
import subprocess
import sys
import urllib.parse
from http import HTTPStatus
from importlib.metadata import distribution
import aiohttp
@@ -72,7 +73,7 @@ def run_ruff(stub_dir: str) -> None:
async def get_project_urls_from_pypi(project: str, session: aiohttp.ClientSession) -> dict[str, str]:
pypi_root = f"https://pypi.org/pypi/{urllib.parse.quote(project)}"
async with session.get(f"{pypi_root}/json") as response:
if response.status != 200:
if response.status != HTTPStatus.OK:
return {}
j: dict[str, dict[str, dict[str, str]]]
j = await response.json()
@@ -107,7 +108,7 @@ async def get_upstream_repo_url(project: str) -> str | None:
# truncate to https://site.com/user/repo
upstream_repo_url = "/".join(url.split("/")[:5])
async with session.get(upstream_repo_url) as response:
if response.status == 200:
if response.status == HTTPStatus.OK:
return upstream_repo_url
return None
+1 -1
View File
@@ -308,7 +308,7 @@ async def get_github_repo_info(session: aiohttp.ClientSession, stub_info: StubMe
assert len(Path(url_path).parts) == 2
github_tags_info_url = f"https://api.github.com/repos/{url_path}/tags"
async with session.get(github_tags_info_url, headers=get_github_api_headers()) as response:
if response.status == 200:
if response.status == HTTPStatus.OK:
tags: list[dict[str, Any]] = await response.json()
assert isinstance(tags, list)
return GitHubInfo(repo_path=url_path, tags=tags)