Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#285)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/charliermarsh/ruff-pre-commit: v0.0.241 → v0.0.254](astral-sh/ruff-pre-commit@v0.0.241...v0.0.254)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* sync deps and lint

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* lint

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* lint

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
  • Loading branch information
pre-commit-ci[bot] and blink1073 committed Mar 7, 2023
1 parent 85b616b commit f00964c
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ repos:
- id: black

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.241
rev: v0.0.254
hooks:
- id: ruff
args: ["--fix"]
2 changes: 1 addition & 1 deletion example/roundtrip.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
out, oclass = octave.roundtrip(x, nout=2)
import pprint

pprint.pprint([x, x.dtype, out, oclass, out.dtype]) # noqa
pprint.pprint([x, x.dtype, out, oclass, out.dtype])
2 changes: 1 addition & 1 deletion example/test_datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
out = octave.test_datatypes()
import pprint

pprint.pprint(out) # noqa
pprint.pprint(out)
2 changes: 1 addition & 1 deletion oct2py/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
try:
octave = Oct2Py()
except Oct2PyError as e:
print(e) # noqa
print(e)


def kill_octave():
Expand Down
14 changes: 8 additions & 6 deletions oct2py/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,8 +681,8 @@ def _parse_error(self, err):
errmsg += "\n %(name)s at line %(line)d" % item
try: # noqa
errmsg += ", column %(column)d" % item
except Exception:
pass # noqa
except Exception: # noqa
pass
return errmsg

def _handle_stdin(self, line):
Expand All @@ -703,7 +703,7 @@ def _print_doc(self, name):
out : None
"""
print(self._get_doc(name)) # noqa
print(self._get_doc(name))

def _get_doc(self, name):
"""
Expand Down Expand Up @@ -850,11 +850,13 @@ def _get_max_nout(self, func_path):
if line[0] != "f": # noqa # not function
if status == "NOT FUNCTION":
continue
line = line.translate(str.maketrans("", "", "[]()")).split() # type:ignore
line = line.translate( # noqa
str.maketrans("", "", "[]()")
).split() # type:ignore
try: # noqa
line.remove("function") # type:ignore
except Exception:
pass # noqa
except Exception: # noqa
pass
for char in line:
if char == "...":
status = "FUNCTION"
Expand Down
6 changes: 3 additions & 3 deletions oct2py/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ def demo(delay=1, interactive=True):
script = script.replace("raw_input", "input")

for line in script.strip().split("\n"):
line = line.strip()
line = line.strip() # noqa
if "input(" not in line:
time.sleep(delay)
print(f">>> {line}") # noqa
print(f">>> {line}")
time.sleep(delay)
if not interactive and ("plot" in line or "surf" in line or "input(" in line):
line = "print()"
line = "print()" # noqa
exec(line) # noqa


Expand Down
8 changes: 4 additions & 4 deletions oct2py/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def __getitem__(self, attr):
if frame is None or frame.f_back is None:
return None
# step into the function that called us
if frame.f_back.f_back and self._is_allowed(frame.f_back.f_back):
if frame.f_back.f_back and self._is_allowed(frame.f_back.f_back): # noqa
dict.__setitem__(self, attr, Struct())
elif self._is_allowed(frame.f_back):
dict.__setitem__(self, attr, Struct())
Expand Down Expand Up @@ -258,7 +258,7 @@ def __getitem__(self, key):
return super().__getitem__(key)


def _extract(data, session=None):
def _extract(data, session=None): # noqa
"""Convert the Octave values to values suitable for Python."""
# Extract each item of a list.
if isinstance(data, list):
Expand Down Expand Up @@ -311,7 +311,7 @@ def _create_struct(data, session):
return out


def _encode(data, convert_to_float):
def _encode(data, convert_to_float): # noqa
"""Convert the Python values to values suitable to send to Octave."""
ctf = convert_to_float

Expand Down Expand Up @@ -408,7 +408,7 @@ def _is_simple_numeric(data):
item_len = None
for item in data:
if isinstance(item, set):
item = list(item)
item = list(item) # noqa
if isinstance(item, list):
if not _is_simple_numeric(item):
return False
Expand Down
2 changes: 1 addition & 1 deletion oct2py/ipython/octavemagic.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def octave_pull(self, line):
nargs="*",
)
@line_cell_magic
def octave(self, line, cell=None, local_ns=None):
def octave(self, line, cell=None, local_ns=None): # noqa
"""
Execute code in Octave, and pull some of the results back into the
Python namespace::
Expand Down
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ dependencies = [
"black[jupyter]==23.1.0",
"mdformat>0.7",
"mdformat-gfm>=0.3.5",
"ruff==0.0.241"
"ruff==0.0.254"
]
detached = true
[tool.hatch.envs.lint.scripts]
Expand Down Expand Up @@ -165,8 +165,10 @@ ignore = [
# S101 Use of `assert` detected
# N806 Variable `V` in function should be lowercase
# PLR2004 Magic value used in comparison
"oct2py/tests/*" = ["S101", "N806", "PLR2004"]
"oct2py/ipython/tests/*" = ["S101", "N806"]
# SIM114 Combine `if` branches
# PLR0912 Too many branches
"oct2py/tests/*" = ["S101", "N806", "PLR2004", "SIM114", "PLR0912"]
"oct2py/ipython/tests/*" = ["S101", "N806", "SIM114", "PLR0912"]

[tool.interrogate]
ignore-init-module=true
Expand Down

0 comments on commit f00964c

Please sign in to comment.