Skip to content

Commit 87df249

Browse files
authored
Merge pull request #1024 from asottile/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2 parents df14c9a + 065b007 commit 87df249

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ repos:
3636
hooks:
3737
- id: flake8
3838
- repo: https://github.com/pre-commit/mirrors-mypy
39-
rev: v1.16.1
39+
rev: v1.17.0
4040
hooks:
4141
- id: mypy

pyupgrade/_plugins/percent_format.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def _fix_percent_format_dict(
195195
elif k.value in KEYWORDS:
196196
return
197197
seen_keys.add(k.value)
198-
keys[ast_to_offset(k)] = k
198+
keys[ast_to_offset(k)] = k.value
199199

200200
# TODO: this is overly timid
201201
brace = i + 4
@@ -211,13 +211,13 @@ def _fix_percent_format_dict(
211211
if key is None:
212212
continue
213213
# we found the key, but the string didn't match (implicit join?)
214-
elif ast.literal_eval(token.src) != key.value:
214+
elif ast.literal_eval(token.src) != key:
215215
return
216216
# the map uses some strange syntax that's not `'key': value`
217217
elif tokens[j + 1].src != ':' or tokens[j + 2].src != ' ':
218218
return
219219
else:
220-
key_indices.append((j, key.value))
220+
key_indices.append((j, key))
221221
assert not keys, keys
222222

223223
tokens[brace_end] = tokens[brace_end]._replace(src=')')

0 commit comments

Comments
 (0)