Skip to content

Commit 64f12f0

Browse files
Add flake8 plugin pep8-naming (#767)
Co-authored-by: Everett Hildenbrandt <everett.hildenbrandt@gmail.com>
1 parent d48b514 commit 64f12f0

4 files changed

Lines changed: 16 additions & 13 deletions

File tree

kmir/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ dev = [
3838
"flake8-type-checking",
3939
"isort",
4040
"mypy",
41-
"pep8",
41+
"pep8-naming",
4242
"pytest",
4343
"pytest-cov",
4444
"pytest-mock",

kmir/src/kmir/linker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def apply_offset(info: SMIRInfo, offset: int) -> None:
197197

198198
info._smir['functions'] = [(ty + offset, sym) for ty, sym in info._smir['functions']]
199199
info._smir['types'] = [
200-
(ty + offset, apply_offset_typeInfo(typeInfo, offset)) for ty, typeInfo in info._smir['types']
200+
(ty + offset, apply_offset_type_info(type_info, offset)) for ty, type_info in info._smir['types']
201201
]
202202
info._smir['spans'] = [(i + offset, span) for i, span in info._smir['spans']]
203203

@@ -224,7 +224,7 @@ def apply_offset(info: SMIRInfo, offset: int) -> None:
224224
apply_offset_item(item['mono_item_kind'], offset)
225225

226226

227-
def apply_offset_typeInfo(typeinfo: dict, offset: int) -> dict:
227+
def apply_offset_type_info(typeinfo: dict, offset: int) -> dict:
228228
# traverses type information, updating all `Ty`-valued fields and `adt_def` fields within
229229
# returns the updated (i.e., mutated) `typeinfo`` dictionary
230230
# 'PrimitiveType' in typeinfo:

kmir/src/kmir/parse/parser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ def _parse_mir_bytes_json(self, json: JSON, prod: KProduction) -> ParseResult:
449449
import string
450450

451451
# Characters that need special escaping (using hex encoding)
452-
ESCAPE_CHARS = {'\n': '\\x0a', '@': '\\x40', '"': '\\x34'}
452+
escape_chars = {'\n': '\\x0a', '@': '\\x40', '"': '\\x34'}
453453

454454
# TODO: Handle uninitialized bytes instead of defaulting to 0
455455
if all((chr(int(i)) if i is not None else chr(0)) in string.printable for i in json):
@@ -458,8 +458,8 @@ def format_printable_byte(byte_val):
458458
if byte_val is None:
459459
return '\\x00'
460460
char = chr(byte_val)
461-
if char in ESCAPE_CHARS:
462-
return ESCAPE_CHARS[char]
461+
if char in escape_chars:
462+
return escape_chars[char]
463463
else:
464464
return char
465465

kmir/uv.lock

Lines changed: 10 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)