Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#284)
Browse files Browse the repository at this point in the history
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 Feb 6, 2023
1 parent acd1737 commit 85b616b
Show file tree
Hide file tree
Showing 7 changed files with 377 additions and 377 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.19.2
rev: 0.21.0
hooks:
- id: check-github-workflows

Expand All @@ -31,12 +31,12 @@ repos:
[mdformat-gfm, mdformat-frontmatter, mdformat-footnote]

- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.1.0
hooks:
- id: black

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.237
rev: v0.0.241
hooks:
- id: ruff
args: ["--fix"]
8 changes: 4 additions & 4 deletions oct2py/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Oct2Py:
The graphics_toolkit to use for plotting.
"""

def __init__(
def __init__( # noqa
self,
logger=None,
timeout=None,
Expand Down Expand Up @@ -153,7 +153,7 @@ def push(self, name, var, timeout=None, verbose=True):
name = [name]
var = [var]

for (n, v) in zip(name, var):
for n, v in zip(name, var):
self.feval("assignin", "base", n, v, nout=0, timeout=timeout, verbose=verbose)

def pull(self, var, timeout=None, verbose=True):
Expand Down Expand Up @@ -576,7 +576,7 @@ def restart(self):
# Add local Octave scripts.
self._engine.eval('addpath("%s");' % HERE.replace(osp.sep, "/"))

def _feval(
def _feval( # noqa
self,
func_name,
func_args=(),
Expand All @@ -601,7 +601,7 @@ def _feval(

func_args = list(func_args)
ref_indices = []
for (i, value) in enumerate(func_args):
for i, value in enumerate(func_args):
if isinstance(value, OctavePtr):
ref_indices.append(i + 1)
func_args[i] = value.address
Expand Down
2 changes: 1 addition & 1 deletion oct2py/dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def __call__(self, *inputs, **kwargs):
]

extras = {}
for (key, _) in kwargs.copy().items():
for key, _ in kwargs.copy().items():
if key not in allowed:
extras[key] = kwargs.pop(key)

Expand Down
12 changes: 6 additions & 6 deletions oct2py/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def read_file(path, session=None):
except UnicodeDecodeError as e:
raise Oct2PyError(str(e)) from None
out = {}
for (key, value) in data.items():
for key, value in data.items():
out[key] = _extract(value, session)
return out

Expand Down Expand Up @@ -164,7 +164,7 @@ def __new__(cls, value, session=None):

# Extract the values.
obj = np.empty(value.size, dtype=value.dtype).view(cls)
for (i, item) in enumerate(value.ravel()):
for i, item in enumerate(value.ravel()):
for name in value.dtype.names:
obj[i][name] = _extract(item[name], session)
return obj.reshape(value.shape)
Expand Down Expand Up @@ -234,7 +234,7 @@ def __new__(cls, value, session=None):

# Extract the values.
obj = np.empty(value.size, dtype=object).view(cls)
for (i, item) in enumerate(value.ravel()):
for i, item in enumerate(value.ravel()):
obj[i] = _extract(item, session)
obj = obj.reshape(value.shape) # type:ignore

Expand Down Expand Up @@ -347,7 +347,7 @@ def _encode(data, convert_to_float):
# Extract and encode values from dict-like objects.
if isinstance(data, dict):
out = {}
for (key, value) in data.items():
for key, value in data.items():
out[key] = _encode(value, ctf)
return out

Expand All @@ -368,7 +368,7 @@ def _encode(data, convert_to_float):
# Tuples are handled as cells.
if isinstance(data, tuple):
obj = np.empty(len(data), dtype=object)
for (i, item) in enumerate(data):
for i, item in enumerate(data):
obj[i] = _encode(item, ctf)
return obj

Expand All @@ -383,7 +383,7 @@ def _encode(data, convert_to_float):
# Extract and encode data from object-like arrays.
if data.dtype.kind in "OV":
out = np.empty(data.size, dtype=data.dtype)
for (i, item) in enumerate(data.ravel()):
for i, item in enumerate(data.ravel()):
if data.dtype.names:
for name in data.dtype.names:
out[i][name] = _encode(item[name], ctf)
Expand Down
2 changes: 1 addition & 1 deletion oct2py/speed_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def run(self):
log.info(f" {avg * 1e6:0.01f} usec per loop")
sides = [1, 10, 100, 1000]
runs = [10, 10, 10, 5]
for (side, nruns) in zip(sides, runs):
for side, nruns in zip(sides, runs):
self.array = np.reshape(np.arange(side**2), (-1)) # type:ignore
log.info(f"Put {side}x{side}: ")
avg = timeit.timeit(self.large_array_put, number=nruns) / nruns
Expand Down

0 comments on commit 85b616b

Please sign in to comment.