Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#1988)
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 <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and blink1073 authored May 6, 2023
1 parent d519784 commit b56c272
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 20 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.260
rev: v0.0.263
hooks:
- id: ruff
args: ["--fix"]
9 changes: 5 additions & 4 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ sphinx:

formats: all

build:
image: latest

python:
version: 3.8
install:
- method: pip
path: .
extra_requirements:
- docs

build:
os: ubuntu-22.04
tools:
python: "3.11"
2 changes: 1 addition & 1 deletion nbconvert/exporters/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def run_command( # noqa
stdout=stdout,
stderr=subprocess.STDOUT,
stdin=null,
shell=shell,
shell=shell, # noqa
env=env,
)
out, _ = p.communicate()
Expand Down
12 changes: 4 additions & 8 deletions nbconvert/exporters/templateexporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,20 +645,16 @@ def get_template_names(self): # noqa
break
if not found_at_least_one:
paths = "\n\t".join(root_dirs)
raise ValueError(
"No template sub-directory with name %r found in the following paths:\n\t%s"
% (base_template, paths)
)
msg = f"No template sub-directory with name {base_template!r} found in the following paths:\n\t{paths}"
raise ValueError(msg)
merged_conf = recursive_update(dict(conf), merged_conf)
base_template = conf.get("base_template")
conf = merged_conf
mimetypes = [mimetype for mimetype, enabled in conf.get("mimetypes", {}).items() if enabled]
if self.output_mimetype and self.output_mimetype not in mimetypes and mimetypes:
supported_mimetypes = "\n\t".join(mimetypes)
raise ValueError(
"Unsupported mimetype %r for template %r, mimetypes supported are: \n\t%s"
% (self.output_mimetype, self.template_name, supported_mimetypes)
)
msg = f"Unsupported mimetype {self.output_mimetype!r} for template {self.template_name!r}, mimetypes supported are: \n\t{supported_mimetypes}"
raise ValueError(msg)
return template_names

def get_prefix_root_dirs(self):
Expand Down
4 changes: 2 additions & 2 deletions nbconvert/preprocessors/svg2pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def _to_format_default(self):
@default("inkscape_version")
def _inkscape_version_default(self):
p = subprocess.Popen(
[self.inkscape, "--version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE
[self.inkscape, "--version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE # noqa
)
output, _ = p.communicate()
if p.returncode != 0:
Expand Down Expand Up @@ -143,7 +143,7 @@ def convert_figure(self, data_format, data):
# For backwards compatibility with specifying strings
# Okay-ish, since the string is trusted
full_cmd = self.command.format(*template_vars)
subprocess.call(full_cmd, shell=isinstance(full_cmd, str))
subprocess.call(full_cmd, shell=isinstance(full_cmd, str)) # noqa

# Read output from drive
# return value expects a filename
Expand Down
2 changes: 1 addition & 1 deletion nbconvert/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def nbconvert(self, parameters, ignore_return_code=False, stdin=None):
if isinstance(parameters, (str,)):
parameters = shlex.split(parameters)
cmd += parameters
p = Popen(cmd, stdout=PIPE, stderr=PIPE, stdin=PIPE)
p = Popen(cmd, stdout=PIPE, stderr=PIPE, stdin=PIPE) # noqa
stdout, stderr = p.communicate(input=stdin)
if not (p.returncode == 0 or ignore_return_code):
raise OSError(stderr.decode("utf8", "replace"))
Expand Down
4 changes: 2 additions & 2 deletions nbconvert/utils/pandoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def pandoc(source, fmt, to, extra_args=None, encoding="utf-8"):
check_pandoc_version()

# we can safely continue
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE) # noqa
out, _ = p.communicate(source.encode())
out_str = TextIOWrapper(BytesIO(out), encoding, "replace").read()
return out_str.rstrip("\n")
Expand All @@ -75,7 +75,7 @@ def get_pandoc_version():
if not shutil.which("pandoc"):
raise PandocMissing()

out = subprocess.check_output(["pandoc", "-v"])
out = subprocess.check_output(["pandoc", "-v"]) # noqa
out_lines = out.splitlines()
version_pattern = re.compile(r"^\d+(\.\d+){1,}$")
for tok in out_lines[0].decode("ascii", "replace").split():
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ dependencies = [
"black[jupyter]==23.3.0",
"mdformat>0.7",
"mdformat-gfm>=0.3.5",
"ruff==0.0.260"
"ruff==0.0.263"
]
detached = true
[tool.hatch.envs.lint.scripts]
Expand Down

0 comments on commit b56c272

Please sign in to comment.