Skip to content

Commit ccd763e

Browse files
committed
format
1 parent 94d05bf commit ccd763e

File tree

3 files changed

+34
-15
lines changed

3 files changed

+34
-15
lines changed

.pre-commit-config.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,22 @@ repos:
3737
hooks:
3838
- id: black
3939

40+
- repo: https://github.com/asottile/pyupgrade
41+
rev: v3.3.1
42+
hooks:
43+
- id: pyupgrade
44+
args: [--py38-plus]
45+
46+
- repo: https://github.com/pycqa/flake8
47+
rev: 6.0.0
48+
hooks:
49+
- id: flake8
50+
51+
- repo: https://github.com/asottile/reorder_python_imports
52+
rev: v3.9.0
53+
hooks:
54+
- id: reorder-python-imports
55+
args: [--py38-plus]
56+
4057
ci:
4158
skip: [hadolint-docker]

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[flake8]
2+
max-line-length = 100

update.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
2424
Update.py should be run often enough to catch individual Matlab release updates.
2525
"""
26-
2726
import re
28-
from subprocess import DEVNULL, run
27+
from subprocess import DEVNULL
28+
from subprocess import run
2929
from urllib import request
3030

31-
from packaging import version
3231
from bs4 import BeautifulSoup
32+
from packaging import version
3333

3434
REL_URL = "https://www.mathworks.com/products/compiler/matlab-runtime.html"
3535
VER_LIMIT = "9.3" # release URLs get weird before that..
@@ -69,7 +69,7 @@ def call(cmd, split=True):
6969
if "glnxa64" not in link:
7070
raise RuntimeError("Error parsing matlab release page link")
7171
if match := rel_re.search(link):
72-
mcr_ver = "{}.{}".format(mcr_ver, match.groups()[0])
72+
mcr_ver = f"{mcr_ver}.{match.groups()[0]}"
7373
dockers.append((mcr_name, mcr_ver, link))
7474

7575

@@ -79,17 +79,17 @@ def call(cmd, split=True):
7979
for docker in dockers:
8080
mcr_name, mcr_ver, link = docker
8181
if len(mcr_ver.split(".")) == 2:
82-
mcr_ver = mcr_ver + ".0"
83-
mcr_ver_maj = ".".join(mcr_ver.split(".")[0:2])
84-
mcr_ver_dir = "v{}".format(mcr_ver_maj.replace(".", ""))
85-
if not call("git checkout {}".format(mcr_name)):
86-
call("git checkout -b {}".format(mcr_name))
82+
mcr_ver = f"{mcr_ver}.0"
83+
mcr_ver_maj = ".".join(mcr_ver.split(".")[:2])
84+
mcr_ver_dir = f'v{mcr_ver_maj.replace(".", "")}'
85+
if not call(f"git checkout {mcr_name}"):
86+
call(f"git checkout -b {mcr_name}")
8787
for (template, suffix) in variants:
88-
tag = "{}{}".format(mcr_ver, suffix)
89-
if call("git rev-parse --verify {}".format(tag)):
90-
print("Skipping {}/{}, already present".format(mcr_name, tag))
88+
tag = f"{mcr_ver}{suffix}"
89+
if call(f"git rev-parse --verify {tag}"):
90+
print(f"Skipping {mcr_name}/{tag}, already present")
9191
continue
92-
print("Adding {}/{}".format(mcr_name, tag))
92+
print(f"Adding {mcr_name}/{tag}")
9393
if not call("git merge master"):
9494
raise RuntimeError("Merging master failed, will not continue")
9595
with open(template) as f:
@@ -102,12 +102,12 @@ def call(cmd, split=True):
102102
call("git add Dockerfile")
103103
# Tag X.Y.Z[-variant] - see circle CI for shared tag X.Y[-variant]
104104
call(["git", "commit", "-m", "Auto-Update"], split=False)
105-
call("git tag {}".format(tag))
105+
call(f"git tag {tag}")
106106
new_tags.append(tag)
107107
call("git checkout master")
108108

109109
if new_tags:
110110
print("New tags have been added, verify and update to git with:")
111111
print("git push --all")
112112
for tag in reversed(new_tags):
113-
print("git push origin {}".format(tag))
113+
print(f"git push origin {tag}")

0 commit comments

Comments
 (0)