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
2 changes: 2 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
platform: x64
- name: Install the project
run: uv sync
- name: Linting checks
run: uv run ruff check .
- name: Type checks
run: uv run ty check .
- name: Tests
Expand Down
5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dev = [
"pre-commit>=4.5.1",
"pytest>=9.0.2",
"pytest-xdist>=3.8.0",
"ruff>=0.14.14",
"ty>=0.0.14",
]

Expand All @@ -47,10 +48,6 @@ select = [
"I", # Isort
"W", # Pycodestyle
]
ignore = [
"B006", # Do not use mutable data structures for argument defaults TODO: Fix this.
"B018", # Found useless expression. Either assign it to a variable or remove it. TODO: Fix this.
]
fixable = ["ALL"]
unfixable = []

Expand Down
7 changes: 4 additions & 3 deletions src/xyz/cppmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ def __repr__(self) -> str:


class Function(_Function):
def __init__(self, cursor, namespaces=[]):
def __init__(self, cursor, namespaces: list[str] | None = None):
namespaces = namespaces or []
_Function.__init__(self, cursor)
self.namespace: str = "::".join(namespaces)
self.qualified_name: str = self.name
Expand Down Expand Up @@ -232,11 +233,11 @@ def extend(self, translation_unit: TranslationUnit):
if is_new:
self.functions.append(new_function)

def _add_child_nodes(self, cursor: Any, namespaces: List[str] = []):
def _add_child_nodes(self, cursor: Any, namespaces: List[str] | None = None):
namespaces = namespaces or []
for c in cursor.get_children():
try:
c.kind
_ = c.kind
except ValueError: # Handle unknown cursor kind
# TODO(jbcoe): Fix cindex.py upstream to avoid needing to do this.
continue
Expand Down
5 changes: 5 additions & 0 deletions test.macos.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#!/usr/bin/env bash

set -eu

# Install dependencies
uv sync

# Linting
uv run ruff check . --fix

# Type checks
uv run ty check .

Expand Down
28 changes: 28 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.