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
17 changes: 0 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,23 +106,6 @@ jobs:
curl -L -O https://gitlab.tiker.net/inducer/ci-support/raw/main/build-and-test-py-project.sh
. ./build-and-test-py-project.sh

#examples:
# name: Examples Py3
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v6
# -
# uses: actions/setup-python@v6
# with:
# python-version: '3.x'
# - name: "Main Script"
# run: |
# EXTRA_INSTALL="numpy pymbolic"
# curl -L -O https://tiker.net/ci-support-v0
# . ./ci-support-v0
# build_py_project_in_venv
# run_examples

downstream_tests:
strategy:
matrix:
Expand Down
12 changes: 0 additions & 12 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,6 @@ Pytest without Numpy:
reports:
junit: test/pytest.xml

# Examples:
# script: |
# EXTRA_INSTALL="numpy pymbolic"
# curl -L -O https://tiker.net/ci-support-v0
# . ./ci-support-v0
# build_py_project_in_venv
# run_examples
# tags:
# - python3
# except:
# - tags

Ruff:
script: |
pipx install ruff
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ exclude = [
preview = true

[tool.ruff.lint]
extend-select = [
select = [
"B", # flake8-bugbear
"C", # flake8-comprehensions
"E", # pycodestyle
Expand Down
14 changes: 5 additions & 9 deletions pytools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,8 @@ def register_fields(self, new_fields):
fields.update(new_fields)

def __getattr__(self, name):
# This method is implemented to avoid pylint 'no-member' errors for
# attribute access.
raise AttributeError(
"'{}' object has no attribute '{}'".format(
self.__class__.__name__, name))
f"'{self.__class__.__name__}' object has no attribute '{name}'")


class Record(RecordWithoutPickling):
Expand Down Expand Up @@ -629,9 +626,10 @@ def copy(self) -> DependentDictionary[T, R]:
def __contains__(self, key: T) -> bool:
try:
self[key]
return True
except KeyError:
return False
else:
return True

def __getitem__(self, key: T) -> R:
try:
Expand Down Expand Up @@ -1609,7 +1607,7 @@ def generate_all_integer_tuples_below(
n, length, least_abs))


class _ConcatenableSequence(Generic[T_co], Protocol):
class _ConcatenableSequence(Protocol, Generic[T_co]):
"""
A protocol that supports the following:

Expand Down Expand Up @@ -2185,9 +2183,7 @@ def invoke_editor(s: str, filename: str = "edit.txt", descr: str = "the file"):
"dropped directly into an editor next time.)")
input(f"Edit {descr} at {full_path} now, then hit [Enter]:")

result = full_path.read_text()

return result
return full_path.read_text()

# }}}

Expand Down
6 changes: 3 additions & 3 deletions pytools/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ def is_excluded(o):
print("type expression, obj is your object:")
expr_str = input()
try:
res = eval(expr_str, {"obj": r}) # pylint:disable=eval-used
except Exception: # pylint:disable=broad-except
res = eval(expr_str, {"obj": r})
except Exception:
from traceback import print_exc
print_exc()
print(res)
Expand Down Expand Up @@ -156,7 +156,7 @@ def setup_readline():
if exists(hist_filename):
try:
readline.read_history_file(hist_filename)
except Exception: # pylint:disable=broad-except
except Exception:
# http://docs.python.org/3/howto/pyporting.html#capturing-the-currently-raised-exception
import sys
e = sys.exc_info()[1]
Expand Down
6 changes: 3 additions & 3 deletions pytools/mpiwrap.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"""See pytools.prefork for this module's reason for being."""
from __future__ import annotations

import mpi4py.rc # pylint:disable=import-error
import mpi4py.rc


mpi4py.rc.initialize = False

from mpi4py.MPI import * # noqa: F403 pylint:disable=wildcard-import,wrong-import-position
from mpi4py.MPI import * # noqa: F403

import pytools.prefork # pylint:disable=wrong-import-position
import pytools.prefork


pytools.prefork.enable_prefork()
Expand Down
2 changes: 1 addition & 1 deletion pytools/prefork.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def _fork_server(sock: socket.socket) -> None:
try:
result = funcs[func_name](*args, **kwargs)
# FIXME: Is catching all exceptions the right course of action?
except Exception as e: # pylint:disable=broad-except
except Exception as e:
_send_packet(sock, ("exception", e))
else:
_send_packet(sock, ("ok", result))
Expand Down
4 changes: 2 additions & 2 deletions pytools/test/test_dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ class A:
else:
a.x = 2

assert a.__dataclass_params__.frozen is __debug__ # pylint: disable=no-member
assert a.__dataclass_params__.frozen is __debug__

# }}}

with pytest.raises(TypeError):
# Can't specify frozen parameter
@opt_frozen_dataclass(frozen=False) # pylint: disable=unexpected-keyword-arg
@opt_frozen_dataclass(frozen=False)
class B:
x: int

Expand Down
4 changes: 2 additions & 2 deletions pytools/test/test_pytools.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ def __getitem__(self, idx):
def test_make_obj_array_iteration():
pytest.importorskip("numpy")

import pytools.obj_array as obj_array
from pytools import obj_array
obj_array.new_1d([FakeArray()])

assert FakeArray.nopes == 0, FakeArray.nopes
Expand All @@ -430,7 +430,7 @@ def test_obj_array_vectorize(c=1):
np = pytest.importorskip("numpy")
la = pytest.importorskip("numpy.linalg")

import pytools.obj_array as obj_array
from pytools import obj_array

# {{{ functions

Expand Down
Loading