Skip to content
Closed
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
24 changes: 24 additions & 0 deletions .github/workflows/pyright.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on: [ push, pull_request ]
name: Pyright type checking
jobs:
pyright:
runs-on: ubuntu-latest
container:
image: archlinux/archlinux:latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Prepare arch
run: |
pacman-key --init
pacman --noconfirm -Sy archlinux-keyring
pacman --noconfirm -Syyu
pacman --noconfirm -Sy python-pip python-pyparted pkgconfig gcc nodejs npm
- run: pip install --break-system-packages --upgrade pip
- name: Install Python dependencies
run: pip install --break-system-packages .[dev]
- name: Install Node.js dependencies
run: npm install
- name: Display Pyright version
run: npx --no -- pyright --version
- name: Run Pyright
run: npx --no -- pyright
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ requirements.txt
/.gitconfig
/actions-runner
/cmd_output.txt
node_modules/
uv.lock
8 changes: 3 additions & 5 deletions archinstall/lib/models/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,6 @@ class Size:
unit: Unit
sector_size: SectorSize

def __post_init__(self) -> None:
if not isinstance(self.sector_size, SectorSize):
raise ValueError('sector size must be of type SectorSize')

def json(self) -> _SizeSerialization:
return {
'value': self.value,
Expand Down Expand Up @@ -352,7 +348,9 @@ def convert(
norm = self._normalize()
return Size(norm, Unit.B, self.sector_size).convert(target_unit, sector_size)
else:
if target_unit == Unit.sectors and sector_size is not None:
if target_unit == Unit.sectors:
assert sector_size is not None

norm = self._normalize()
sectors = math.ceil(norm / sector_size.value)
return Size(sectors, Unit.sectors, sector_size)
Expand Down
44 changes: 44 additions & 0 deletions package-lock.json

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

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"devDependencies": {
"pyright": "1.1.405"
}
}
28 changes: 28 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ testpaths = ["tests"]
ignore-paths = [
"^build/",
"^docs/",
"^node_modules/",
]
load-plugins = ["pylint_pydantic"]
persistent = false
Expand Down Expand Up @@ -230,3 +231,30 @@ ignore = [

[tool.ruff.lint.mccabe]
max-complexity = 40

[tool.pyright]
pythonVersion = "3.12"
typeCheckingMode = "strict"
exclude = [
"**/node_modules",
"**/__pycache__",
"**/.*",
"build/",
]
reportArgumentType = false
reportAttributeAccessIssue = false
reportMatchNotExhaustive = false
reportMissingTypeStubs = false
reportPrivateUsage = false
reportTypedDictNotRequiredAccess = false
reportUnknownArgumentType = false
reportUnknownLambdaType = false
reportUnknownMemberType = false
reportUnknownVariableType = false
reportUnnecessaryComparison = false

# Additional flags that are not included in strict mode
deprecateTypingAliases = true
reportImplicitOverride = true
reportImportCycles = false
reportPropertyTypeMismatch = true