Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
python -m pip install -r requirements-dev.txt
- name: "Run pytest"
run: |
pytest
pytest -vvv --log-cli-level=info --typeguard-packages=cmake_file_api

check-typing:
runs-on: ubuntu-latest
Expand All @@ -34,7 +34,7 @@ jobs:
with:
python-version: "3.10"
- run: pip install mypy
- run: mypy --install-types --non-interactive
- run: mypy --install-types --non-interactive --strict

pylint:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions cmake_file_api/kinds/cache/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from enum import Enum
import json
from pathlib import Path
from typing import Any
from typing import Any, ClassVar

from cmake_file_api.kinds.common import VersionMajorMinor
from cmake_file_api.kinds.kind import ObjectKind
Expand Down Expand Up @@ -44,7 +44,7 @@ def from_dict(cls, dikt: dict[str, Any]) -> "CacheEntry":
return cls(name, value, type, properties)

class CacheV2:
KIND = ObjectKind.CACHE
KIND: ClassVar = ObjectKind.CACHE

__slots__ = ("version", "entries")

Expand Down
4 changes: 2 additions & 2 deletions cmake_file_api/kinds/codemodel/target/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ class ArchiveFragmentRole(enum.Enum):
class BacktraceNode:
__slots__ = ("file", "line", "command", "parent")

def __init__(self, file: Path, line: Optional[int], command: Optional[str]):
def __init__(self, file: Path, line: Optional[int], command: Optional[str]) -> None:
self.file = file
self.line = line
self.command = command
self.parent = None
self.parent: Optional[BacktraceNode] = None

@classmethod
def from_dict(cls, dikt: dict[str, Any], commands: list[str], files: list[Path]) -> "BacktraceNode":
Expand Down
8 changes: 4 additions & 4 deletions cmake_file_api/kinds/codemodel/v2.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
from pathlib import Path
from typing import Any, Optional
from typing import Any, ClassVar, Optional

from cmake_file_api.kinds.common import CMakeSourceBuildPaths, VersionMajorMinor
from cmake_file_api.kinds.kind import ObjectKind
Expand All @@ -18,7 +18,7 @@ def __init__(self, name: str):
self.targets: list[CMakeTarget] = []

@classmethod
def from_dict(cls, dikt: dict[str, str]) -> "CMakeProject":
def from_dict(cls, dikt: dict[str, Any]) -> "CMakeProject":
name = dikt["name"]
return cls(name)

Expand Down Expand Up @@ -57,7 +57,7 @@ def __init__(self, source: Path, build: Path, minimumCMakeVersion: Optional[str]
def from_dict(cls, dikt: dict[str, Any]) -> "CMakeDirectory":
source = Path(dikt["source"])
build = Path(dikt["build"])
minimumCMakeVersion = dikt.get("minimumCMakeVersion", None)
minimumCMakeVersion = dikt['minimumCMakeVersion']['string'] if 'minimumCMakeVersion' in dikt else None
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Thanks!

hasInstallRule = dikt.get("hasInstallRule", False)
return cls(source, build, minimumCMakeVersion, hasInstallRule)

Expand Down Expand Up @@ -154,7 +154,7 @@ def __repr__(self) -> str:


class CodemodelV2:
KIND = ObjectKind.CODEMODEL
KIND: ClassVar = ObjectKind.CODEMODEL

__slots__ = ("version", "paths", "configurations")

Expand Down
2 changes: 1 addition & 1 deletion cmake_file_api/kinds/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def __init__(self, major: int, minor: int):
self.minor = minor

@classmethod
def from_dict(cls, d: dict[str, str]) -> "VersionMajorMinor":
def from_dict(cls, d: dict[str, int]) -> "VersionMajorMinor":
return cls(int(d["major"]), int(d["minor"]))

def __repr__(self) -> str:
Expand Down
4 changes: 2 additions & 2 deletions cmake_file_api/kinds/configureLog/v1.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import json
from pathlib import Path
from typing import Any
from typing import Any, ClassVar

from cmake_file_api.kinds.common import VersionMajorMinor
from cmake_file_api.kinds.kind import ObjectKind


class ConfigureLogV1:
KIND = ObjectKind.CONFIGURELOG
KIND: ClassVar = ObjectKind.CONFIGURELOG

__slots__ = ("version", "path", "eventKindNames")

Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pytest
mypy
typeguard