Skip to content

Commit 21d4ad6

Browse files
committed
Fix lints
1 parent 461fa56 commit 21d4ad6

11 files changed

Lines changed: 29 additions & 36 deletions

File tree

‎clr_loader/__init__.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
from .util.runtime_spec import DotnetCoreRuntimeSpec
88

99
__all__ = [
10-
"get_mono",
11-
"get_netfx",
12-
"get_coreclr",
10+
"Assembly",
11+
"DotnetCoreRuntimeSpec",
12+
"Runtime",
13+
"RuntimeInfo",
1314
"find_dotnet_root",
1415
"find_libmono",
1516
"find_runtimes",
16-
"Runtime",
17-
"Assembly",
18-
"RuntimeInfo",
19-
"DotnetCoreRuntimeSpec",
17+
"get_coreclr",
18+
"get_mono",
19+
"get_netfx",
2020
]
2121

2222

‎clr_loader/ffi/__init__.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ def load_hostfxr(dotnet_root: Path):
2424

2525
error_report: list[str] = []
2626

27-
for hostfxr_path in reversed(sorted(hostfxr_paths, key=_path_to_version)):
27+
for hostfxr_path in sorted(hostfxr_paths, key=_path_to_version, reverse=True):
2828
try:
2929
return ffi.dlopen(str(hostfxr_path))
30-
except Exception as err:
30+
except Exception as err: # noqa
3131
error_report.append(f"Path {hostfxr_path} gave the following error:\n{err}")
3232

3333
try:
3434
return ffi.dlopen(str(dotnet_root / hostfxr_name))
35-
except Exception as err:
35+
except Exception as err: # noqa
3636
error_report.append(f"Path {hostfxr_path} gave the following error:\n{err}")
3737

3838
raise RuntimeError(
@@ -72,7 +72,7 @@ def _path_to_version(path: Path) -> tuple[int, int, int]:
7272
version_part = name.split("-")[0]
7373
res = list(map(int, version_part.split(".")))
7474
return tuple(res + [0, 0, 0])[:3]
75-
except Exception:
75+
except Exception: # noqa
7676
return (0, 0, 0)
7777

7878

‎clr_loader/hostfxr.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
2-
from pathlib import Path
32
from collections.abc import Generator
3+
from pathlib import Path
44

55
from .ffi import ffi, load_hostfxr
66
from .types import Runtime, RuntimeInfo, StrOrPath

‎clr_loader/mono.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import atexit
22
import re
3+
from collections.abc import Sequence
34
from pathlib import Path
45
from typing import Any
5-
from collections.abc import Sequence
66

77
from .ffi import ffi, load_mono
88
from .types import Runtime, RuntimeInfo, StrOrPath

‎clr_loader/netfx.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ def info(self) -> RuntimeInfo:
3030
version="<undefined>",
3131
initialized=True,
3232
shutdown=_FW is None,
33-
properties=dict(
34-
domain=self._domain_name or "", config_file=str(self._config_file)
35-
),
33+
properties={
34+
"domain": self._domain_name or "",
35+
"config_file": str(self._config_file),
36+
},
3637
)
3738

3839
def _get_callable(self, assembly_path: StrOrPath, typename: str, function: str):

‎clr_loader/types.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from abc import ABCMeta, abstractmethod
2+
from collections.abc import Callable
23
from dataclasses import dataclass, field
34
from os import PathLike
45
from typing import Any
5-
from collections.abc import Callable
66

77
__all__ = ["StrOrPath"]
88

@@ -70,7 +70,7 @@ def __repr__(self) -> str:
7070

7171
class Assembly:
7272
def __init__(self, runtime: "Runtime", path: StrOrPath):
73-
self._runtime: "Runtime" = runtime
73+
self._runtime: Runtime = runtime
7474
self._path: StrOrPath = path
7575

7676
def get_function(self, name: str, func: str | None = None) -> ClrFunction:
@@ -108,7 +108,6 @@ class Runtime(metaclass=ABCMeta):
108108
@abstractmethod
109109
def info(self) -> RuntimeInfo:
110110
"""Get configuration and version information"""
111-
pass
112111

113112
def get_assembly(self, assembly_path: StrOrPath) -> Assembly:
114113
"""Get an assembly wrapper
@@ -124,15 +123,13 @@ def _get_callable(
124123
self, assembly_path: StrOrPath, typename: str, function: str
125124
) -> Callable[[Any, int], Any]:
126125
"""Private function to retrieve a low-level callable object"""
127-
pass
128126

129127
@abstractmethod
130128
def shutdown(self) -> None:
131129
"""Shut down the runtime as much as possible
132130
133131
Implementations should still be able to "reinitialize", thus the final
134132
cleanup will usually happen in an ``atexit`` handler."""
135-
pass
136133

137134
def __del__(self) -> None:
138135
self.shutdown()

‎clr_loader/util/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
__all__ = [
1010
"check_result",
1111
"find_dotnet_root",
12-
"path_as_string",
1312
"optional_path_as_string",
13+
"path_as_string",
1414
]
1515

1616

‎clr_loader/util/clr_error.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ def __str__(self):
2121
return f"{hex(self.hresult)}"
2222

2323
def __repr__(self):
24-
return f"<ClrError {str(self)}>"
24+
return f"<ClrError {self!s}>"

‎clr_loader/util/find.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
import platform
33
import shutil
44
import sys
5-
from pathlib import Path
65
from collections.abc import Iterator
7-
86
from ctypes.util import find_library
7+
from pathlib import Path
98

109
from ..types import StrOrPath
11-
1210
from .runtime_spec import DotnetCoreRuntimeSpec
1311

1412

‎clr_loader/util/hostfxr_errors.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def get_hostfxr_error(hresult: int) -> ClrError | None:
1010
return None
1111

1212

13-
_ERRORS = dict(
13+
_ERRORS = dict( # noqa
1414
Success=0,
1515
Success_HostAlreadyInitialized=0x00000001,
1616
Success_DifferentRuntimeProperties=0x00000002,

0 commit comments

Comments
 (0)