Skip to content

Commit

Permalink
Switch from pylint to ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
Moguri committed Oct 19, 2024
1 parent 85f098f commit fc24c83
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 31 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
DISPLAY: :1
run: |
python -m pip install -e .[test]
python -m ruff check
python -m pytest
- name: Build package
run: |
Expand Down
27 changes: 13 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,19 @@ requires-python = ">= 3.8"
homepage = "https://github.com/Moguri/panda3d-simplepbr"

[project.optional-dependencies]
test = ["pytest", "pylint~=3.0.0", "pytest-pylint"]
test = ["pytest", "ruff"]

[tool.ruff]
line-length = 100

[tool.ruff.lint]
select = [
"E", # pycodestyle
"F", # pyflakes
"UP", # pyupgrade
"B", # flake8-bugbear
"SIM", # flake8-simplify
]

[project.scripts]
hdr2env = "simplepbr.hdr2env:main"
Expand All @@ -40,16 +52,3 @@ version = {attr = "simplepbr.version.__version__"}

[tool.setuptools]
packages = ["simplepbr"]

[tool.pytest.ini_options]
addopts = "--pylint"

[tool.pylint.main]
jobs = 0

[tool.pylint."message control"]
disable = [
"r",
"missing-docstring",
"c-extension-no-member",
]
20 changes: 11 additions & 9 deletions simplepbr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
)
import builtins
import functools
import math
import os
from typing import (
ClassVar,
)
from typing_extensions import (
Any,
ClassVar,
Literal,
TypeAlias,
TypeVar,
Expand All @@ -25,7 +26,7 @@
from direct.filter.FilterManager import FilterManager
from direct.task.Task import TaskManager

from .version import __version__
from .version import __version__ as __version__
from .envmap import EnvMap
from .envpool import EnvPool
from . import logging
Expand Down Expand Up @@ -78,12 +79,13 @@ def _get_default_330() -> bool:
cvar.get_word(i)
for i in range(cvar.get_num_words())
]
if len(gl_version) >= 2 and gl_version[0] >= 3 and gl_version[1] >= 2:
# Not exactly accurate, but setting this variable to '3 2' is common for disabling
# the fixed-function pipeline and 3.2 support likely means 3.3 support as well.
return True

return False
# Not exactly accurate, but setting this variable to '3 2' is common for disabling
# the fixed-function pipeline and 3.2 support likely means 3.3 support as well.
return (
len(gl_version) >= 2
and gl_version[0] >= 3
and gl_version[1] >= 2
)


TypeT = TypeVar('TypeT', bound=type)
Expand Down
4 changes: 3 additions & 1 deletion simplepbr/_ibl_funcs_cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
import math
import struct
import typing
from typing import (
Final,
)
from typing_extensions import (
TypeAlias,
Final,
)

import panda3d.core as p3d
Expand Down
6 changes: 3 additions & 3 deletions simplepbr/_shaderutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import os

from typing import (
Any,
)
from typing_extensions import (
TYPE_CHECKING,
TypeAlias,
)

import panda3d.core as p3d

if TYPE_CHECKING:
from typing import Any

try:
from .shaders import shaders # type: ignore
Expand Down
9 changes: 5 additions & 4 deletions simplepbr/envpool.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

from pathlib import Path
from typing_extensions import (
Self,
)

import panda3d.core as p3d

Expand All @@ -13,7 +14,7 @@


class EnvPool:
_ptr: 'EnvPool' | None = None
_ptr: Self | None = None

def __init__(self) -> None:
self._envmaps: dict[p3d.Filename, EnvMap] = {}
Expand Down Expand Up @@ -73,7 +74,7 @@ def load(
return envmap

@classmethod
def ptr(cls) -> 'EnvPool':
def ptr(cls) -> Self:
if cls._ptr is None:
cls._ptr = cls()

Expand Down

0 comments on commit fc24c83

Please sign in to comment.