Skip to content

Commit

Permalink
Merge branch 'main' into mlss
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbrq authored Apr 17, 2024
2 parents fc32c08 + 30cdde8 commit edcf162
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 3 deletions.
27 changes: 27 additions & 0 deletions .github/pyright-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"include": [
"type_check.py",
"../worlds/AutoSNIClient.py",
"../Patch.py"
],

"exclude": [
"**/__pycache__"
],

"stubPath": "../typings",

"typeCheckingMode": "strict",
"reportImplicitOverride": "error",
"reportMissingImports": true,
"reportMissingTypeStubs": true,

"pythonVersion": "3.8",
"pythonPlatform": "Windows",

"executionEnvironments": [
{
"root": ".."
}
]
}
15 changes: 15 additions & 0 deletions .github/type_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from pathlib import Path
import subprocess

config = Path(__file__).parent / "pyright-config.json"

command = ("pyright", "-p", str(config))
print(" ".join(command))

try:
result = subprocess.run(command)
except FileNotFoundError as e:
print(f"{e} - Is pyright installed?")
exit(1)

exit(result.returncode)
33 changes: 33 additions & 0 deletions .github/workflows/strict-type-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: type check

on:
pull_request:
paths:
- "**.py"
- ".github/pyright-config.json"
- ".github/workflows/strict-type-check.yml"
- "**.pyi"
push:
paths:
- "**.py"
- ".github/pyright-config.json"
- ".github/workflows/strict-type-check.yml"
- "**.pyi"

jobs:
pyright:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: "Install dependencies"
run: |
python -m pip install --upgrade pip pyright==1.1.358
python ModuleUpdate.py --append "WebHostLib/requirements.txt" --force --yes
- name: "pyright: strict check on specific files"
run: python .github/type_check.py
2 changes: 1 addition & 1 deletion ModuleUpdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def install_pkg_resources(yes=False):
subprocess.call([sys.executable, "-m", "pip", "install", "--upgrade", "setuptools"])


def update(yes=False, force=False):
def update(yes: bool = False, force: bool = False) -> None:
global update_ran
if not update_ran:
update_ran = True
Expand Down
2 changes: 1 addition & 1 deletion typings/kivy/uix/widget.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
""" FillType_* is not a real kivy type - just something to fill unknown typing. """

from typing import Any, Optional, Protocol
from ..graphics import FillType_Drawable, FillType_Vec
from ..graphics.texture import FillType_Drawable, FillType_Vec


class FillType_BindCallback(Protocol):
Expand Down
2 changes: 1 addition & 1 deletion worlds/LauncherComponents.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class SuffixIdentifier:
def __init__(self, *args: str):
self.suffixes = args

def __call__(self, path: str):
def __call__(self, path: str) -> bool:
if isinstance(path, str):
for suffix in self.suffixes:
if path.endswith(suffix):
Expand Down

0 comments on commit edcf162

Please sign in to comment.