Skip to content

Commit aaa5129

Browse files
authored
Merge pull request #24196 from matthewfeickert/mnt/update-pre-commit-hooks
MNT: Update pre-commit hooks
2 parents 101cbaa + b41e130 commit aaa5129

File tree

3 files changed

+25
-20
lines changed

3 files changed

+25
-20
lines changed

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ repos:
2525
- id: trailing-whitespace
2626
exclude_types: [svg]
2727
- repo: https://github.com/pycqa/flake8
28-
rev: 4.0.1
28+
rev: 5.0.4
2929
hooks:
3030
- id: flake8
3131
additional_dependencies: [pydocstyle>5.1.0, flake8-docstrings>1.4.0, flake8-force]
3232
args: ["--docstring-convention=all"]
3333
- repo: https://github.com/codespell-project/codespell
34-
rev: v2.1.0
34+
rev: v2.2.2
3535
hooks:
3636
- id: codespell
3737
files: ^.*\.(py|c|cpp|h|m|md|rst|yml)$

ci/codespell-ignore-words.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ ba
44
cannotation
55
coo
66
curvelinear
7+
dedented
8+
falsy
79
flate
10+
hax
811
hist
12+
inh
913
inout
1014
ment
1115
nd
1216
oly
13-
sur
17+
resizeable
1418
te
1519
thisy
1620
whis

tools/subset.py

+18-17
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,21 @@
3535
import fontforge
3636

3737

38-
def log_namelist(nam, unicode):
39-
if nam and isinstance(unicode, int):
40-
print(f"0x{unicode:04X}", fontforge.nameFromUnicode(unicode), file=nam)
38+
def log_namelist(name, unicode):
39+
if name and isinstance(unicode, int):
40+
print(f"0x{unicode:04X}", fontforge.nameeFromUnicode(unicode),
41+
file=name)
4142

4243

43-
def select_with_refs(font, unicode, newfont, pe=None, nam=None):
44+
def select_with_refs(font, unicode, newfont, pe=None, name=None):
4445
newfont.selection.select(('more', 'unicode'), unicode)
45-
log_namelist(nam, unicode)
46+
log_namelist(name, unicode)
4647
if pe:
4748
print(f"SelectMore({unicode})", file=pe)
4849
try:
4950
for ref in font[unicode].references:
5051
newfont.selection.select(('more',), ref[0])
51-
log_namelist(nam, ref[0])
52+
log_namelist(name, ref[0])
5253
if pe:
5354
print(f'SelectMore("{ref[0]}")', file=pe)
5455
except Exception:
@@ -60,11 +61,11 @@ def subset_font_raw(font_in, font_out, unicodes, opts):
6061
# 2010-12-06 DC To allow setting namelist filenames,
6162
# change getopt.gnu_getopt from namelist to namelist=
6263
# and invert comments on following 2 lines
63-
# nam_fn = opts['--namelist']
64-
nam_fn = f'{font_out}.nam'
65-
nam = open(nam_fn, 'w')
64+
# name_fn = opts['--namelist']
65+
name_fn = f'{font_out}.name'
66+
name = open(name_fn, 'w')
6667
else:
67-
nam = None
68+
name = None
6869
if '--script' in opts:
6970
pe_fn = "/tmp/script.pe"
7071
pe = open(pe_fn, 'w')
@@ -75,7 +76,7 @@ def subset_font_raw(font_in, font_out, unicodes, opts):
7576
print(f'Open("{font_in}")', file=pe)
7677
extract_vert_to_script(font_in, pe)
7778
for i in unicodes:
78-
select_with_refs(font, i, font, pe, nam)
79+
select_with_refs(font, i, font, pe, name)
7980

8081
addl_glyphs = []
8182
if '--nmr' in opts:
@@ -86,9 +87,9 @@ def subset_font_raw(font_in, font_out, unicodes, opts):
8687
addl_glyphs.append('.notdef')
8788
for glyph in addl_glyphs:
8889
font.selection.select(('more',), glyph)
89-
if nam:
90+
if name:
9091
print(f"0x{fontforge.unicodeFromName(glyph):0.4X}", glyph,
91-
file=nam)
92+
file=name)
9293
if pe:
9394
print(f'SelectMore("{glyph}")', file=pe)
9495

@@ -112,7 +113,7 @@ def subset_font_raw(font_in, font_out, unicodes, opts):
112113
new.em = font.em
113114
new.layers['Fore'].is_quadratic = font.layers['Fore'].is_quadratic
114115
for i in unicodes:
115-
select_with_refs(font, i, new, pe, nam)
116+
select_with_refs(font, i, new, pe, name)
116117
new.paste()
117118
# This is a hack - it should have been taken care of above.
118119
font.selection.select('space')
@@ -149,9 +150,9 @@ def subset_font_raw(font_in, font_out, unicodes, opts):
149150
font.selection.select(glname)
150151
font.cut()
151152

152-
if nam:
153+
if name:
153154
print("Writing NameList", end="")
154-
nam.close()
155+
name.close()
155156

156157
if pe:
157158
print(f'Generate("{font_out}")', file=pe)
@@ -177,7 +178,7 @@ def subset_font(font_in, font_out, unicodes, opts):
177178
if font_out != font_out_raw:
178179
os.rename(font_out_raw, font_out)
179180
# 2011-02-14 DC this needs to only happen with --namelist is used
180-
# os.rename(font_out_raw + '.nam', font_out + '.nam')
181+
# os.rename(font_out_raw + '.name', font_out + '.name')
181182

182183

183184
def getsubset(subset, font_in):

0 commit comments

Comments
 (0)