fix: Use Optional[] for forward reference type union (Python 3.10 compat)

- Changed 'pathspec.PathSpec' | None to Optional['pathspec.PathSpec']
- Fixes TypeError in Python 3.10/3.11 where | operator doesn't work with string literals
- Adds Optional to typing imports
This commit is contained in:
yusyus
2026-02-15 20:37:02 +03:00
parent 57061b7daf
commit c3abb83fc8

View File

@@ -21,7 +21,7 @@ import os
import re
import sys
from pathlib import Path
from typing import Any
from typing import Any, Optional
try:
from github import Github, GithubException, Repository
@@ -563,7 +563,7 @@ class GitHubScraper:
return False
def _load_gitignore(self) -> "pathspec.PathSpec" | None:
def _load_gitignore(self) -> Optional["pathspec.PathSpec"]:
"""
Load .gitignore file and create pathspec matcher (C2.1).