Skip to content
Open
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
96 changes: 0 additions & 96 deletions .basedpyright/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2403,86 +2403,6 @@
"lineCount": 1
}
},
{
"code": "reportUnknownParameterType",
"range": {
"startColumn": 4,
"endColumn": 11,
"lineCount": 1
}
},
{
"code": "reportUnknownParameterType",
"range": {
"startColumn": 12,
"endColumn": 20,
"lineCount": 1
}
},
{
"code": "reportMissingParameterType",
"range": {
"startColumn": 12,
"endColumn": 20,
"lineCount": 1
}
},
{
"code": "reportUnknownVariableType",
"range": {
"startColumn": 4,
"endColumn": 6,
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"range": {
"startColumn": 9,
"endColumn": 26,
"lineCount": 1
}
},
{
"code": "reportUnknownVariableType",
"range": {
"startColumn": 8,
"endColumn": 9,
"lineCount": 1
}
},
{
"code": "reportUnknownArgumentType",
"range": {
"startColumn": 17,
"endColumn": 19,
"lineCount": 1
}
},
{
"code": "reportUnknownVariableType",
"range": {
"startColumn": 8,
"endColumn": 13,
"lineCount": 1
}
},
{
"code": "reportUnknownVariableType",
"range": {
"startColumn": 8,
"endColumn": 9,
"lineCount": 1
}
},
{
"code": "reportUnknownVariableType",
"range": {
"startColumn": 11,
"endColumn": 18,
"lineCount": 1
}
},
{
"code": "reportUnknownParameterType",
"range": {
Expand Down Expand Up @@ -7461,22 +7381,6 @@
"lineCount": 1
}
},
{
"code": "reportAny",
"range": {
"startColumn": 4,
"endColumn": 8,
"lineCount": 1
}
},
{
"code": "reportAny",
"range": {
"startColumn": 28,
"endColumn": 32,
"lineCount": 1
}
},
{
"code": "reportAny",
"range": {
Expand Down
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,13 @@ extend-select = [
"FURB",
]
extend-ignore = [
"C90", # McCabe complexity
"multiple-spaces-before-operator",
"complex-structure",
"f-string",
"missing-whitespace-around-arithmetic-operator",
"module-import-not-at-top-of-file",
"multiple-spaces-before-operator",
"printf-string-formatting",
"f-string",
"pytest-parameter-with-default-argument",

# FIXME: This is a longer discussion...
"non-empty-init-module",
Expand Down
8 changes: 4 additions & 4 deletions pytools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,13 +839,13 @@ def wrapper(obj: T, *args: P.args, **kwargs: P.kwargs) -> R_co:

result = function(obj, *args, **kwargs)
if attribute_error:
object.__setattr__(obj, cache_dict_name, {key: result})
object.__setattr__(obj, cache_dict_name, {key: result}) # ruff: ignore[unnecessary-dunder-call]
return result
getattr(obj, cache_dict_name)[key] = result
return result

def clear_cache(obj):
object.__delattr__(obj, cache_dict_name)
object.__delattr__(obj, cache_dict_name) # ruff: ignore[unnecessary-dunder-call]

from functools import update_wrapper
new_wrapper = update_wrapper(wrapper, function)
Expand Down Expand Up @@ -1426,12 +1426,12 @@ def cartesian_product_sum(list1, list2):

# {{{ elementary statistics

def average(iterable):
def average(iterable: Iterator[float]) -> float:
"""Return the average of the values in iterable.

iterable may not be empty.
"""
it = iterable.__iter__()
it = iter(iterable)

try:
s = next(it)
Expand Down
4 changes: 2 additions & 2 deletions pytools/datatable.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ def without(indexable: tuple[str, ...], idx: int) -> tuple[str, ...]:
this_key_idx = self.column_indices[column]
other_key_idx = other_table.column_indices[other_column]

this_iter = self.data.__iter__()
other_iter = other_table.data.__iter__()
this_iter = iter(self.data)
other_iter = iter(other_table.data)

result_columns = tuple(self.column_names[this_key_idx]) + \
without(tuple(self.column_names), this_key_idx) + \
Expand Down
1 change: 1 addition & 0 deletions pytools/persistent_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ def rec(self, key_hash: Hash, key: Any) -> Hash:

if not isinstance(key, type):
try:
# ruff: ignore[unnecessary-dunder-call]
object.__setattr__(key, "_pytools_persistent_hash_digest", digest)
except AttributeError:
pass
Expand Down
4 changes: 2 additions & 2 deletions pytools/py_codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def _make_module(
code_obj = compile(
source_text.rstrip()+"\n", name, "exec")
result_dict["__code__"] = code_obj
exec(code_obj, result_dict) # ruff:ignore[exec-builtin]
exec(code_obj, result_dict)

return result_dict

Expand Down Expand Up @@ -157,7 +157,7 @@ def _get_empty_module_dict(filename: str | None = None) -> dict[str, Any]:
result_dict: dict[str, Any] = {}
code_obj = compile("", filename, "exec")
result_dict["__code__"] = code_obj
exec(code_obj, result_dict) # ruff:ignore[exec-builtin]
exec(code_obj, result_dict)
return result_dict


Expand Down
6 changes: 6 additions & 0 deletions pytools/test/test_pytools.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,14 @@ def test_strtobool():

with pytest.raises(ValueError):
strtobool("tru") # spellchecker: disable-line

with pytest.raises(ValueError):
strtobool("fal") # spellchecker: disable-line

with pytest.raises(ValueError):
strtobool("xxx")

with pytest.raises(ValueError):
strtobool(".")

assert strtobool(None, False) is False
Expand Down
Loading