Skip to content

Commit ba5face

Browse files
committed
disable autoflake precommit and fix URL encoding
colab link issue
1 parent 6da2830 commit ba5face

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

.pre-commit-config.yaml

+11-10
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,17 @@ repos:
2525
# - id: pyupgrade
2626
# args: ['--py37-plus']
2727

28-
# If you want to avoid flake8 errors due to unused vars or imports:
29-
- repo: https://github.com/PyCQA/autoflake
30-
rev: v2.3.0
31-
hooks:
32-
- id: autoflake
33-
args: [
34-
--in-place,
35-
--remove-all-unused-imports,
36-
# --remove-unused-variables,
37-
]
28+
# # If you want to avoid flake8 errors due to unused vars or imports:
29+
# Failing due to
30+
# - repo: https://github.com/PyCQA/autoflake
31+
# rev: v2.3.0
32+
# hooks:
33+
# - id: autoflake
34+
# args: [
35+
# --in-place,
36+
# --remove-all-unused-imports,
37+
# # --remove-unused-variables,
38+
# ]
3839

3940
- repo: https://github.com/PyCQA/isort
4041
rev: 5.13.2

scripts/generate_scripts.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,12 @@ def is_incompatible(opt):
281281
"https://colab.research.google.com/github/sgbaird/honegumi/blob/main/"
282282
)
283283

284-
notebook_path = path.join(GEN_NOTEBOOK_DIR, f"{rendered_template_stem}.ipynb")
285-
colab_link = urljoin(colab_prefix, notebook_path)
284+
notebook_fname = f"{rendered_template_stem}.ipynb"
285+
notebook_path = path.join(GEN_NOTEBOOK_DIR, notebook_fname)
286+
# HACK: issue with + encoding becoming %20 instead of %2B due to use of \\
287+
# instead of / Alternative is using:
288+
# `encoded_notebook_fname = quote(notebook_fname)`
289+
colab_link = urljoin(colab_prefix, notebook_path).replace("\\", "/")
286290
colab_badge = f'<a href="{colab_link}"><img alt="Open In Colab" src="https://colab.research.google.com/assets/colab-badge.svg"></a>' # noqa E501
287291

288292
preamble = f"{colab_badge} {github_badge}"

0 commit comments

Comments
 (0)