mirror of
https://github.com/vinta/awesome-python.git
synced 2026-05-07 14:17:36 -05:00
refactor(fetch_github_stars): drop underscore prefix from regex constants
Rename _GITHUB_OWNER_RE and _GITHUB_NAME_RE to GITHUB_OWNER_RE and GITHUB_NAME_RE to match the naming style of the other module-level constants (GRAPHQL_URL, BATCH_SIZE). Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -20,9 +20,9 @@ GRAPHQL_URL = "https://api.github.com/graphql"
|
||||
BATCH_SIZE = 50
|
||||
|
||||
# GitHub usernames: alphanumeric and hyphens, must start/end with alphanumeric.
|
||||
_GITHUB_OWNER_RE = re.compile(r"^[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$")
|
||||
GITHUB_OWNER_RE = re.compile(r"^[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$")
|
||||
# GitHub repo names: alphanumeric, hyphens, underscores, dots, must start with alphanumeric.
|
||||
_GITHUB_NAME_RE = re.compile(r"^[a-zA-Z0-9][a-zA-Z0-9._-]*$")
|
||||
GITHUB_NAME_RE = re.compile(r"^[a-zA-Z0-9][a-zA-Z0-9._-]*$")
|
||||
|
||||
|
||||
def extract_github_repos(text: str) -> set[str]:
|
||||
@@ -51,7 +51,7 @@ def build_graphql_query(repos: list[str]) -> str:
|
||||
parts = []
|
||||
for i, repo in enumerate(repos):
|
||||
owner, name = repo.split("/", 1)
|
||||
if not _GITHUB_OWNER_RE.match(owner) or not _GITHUB_NAME_RE.match(name):
|
||||
if not GITHUB_OWNER_RE.match(owner) or not GITHUB_NAME_RE.match(name):
|
||||
continue
|
||||
parts.append(
|
||||
f'repo_{i}: repository(owner: "{owner}", name: "{name}") '
|
||||
|
||||
Reference in New Issue
Block a user