abinazebinoy commited on
Commit
09e56ee
·
1 Parent(s): 4f306fa

fix(encoding): strip all non-ASCII chars from all Python source files

Browse files

GitHub Actions runner was failing with:
UnicodeDecodeError: utf-8 codec cannot decode byte 0x97

Root cause: em dashes (U+2014 --), arrows (U+2192 ->), and other
Unicode punctuation in comments across all 8 files we added/modified.
The runner's system locale read api/main.py as bytes and hit the
multi-byte UTF-8 sequence for -- at byte position 436.

Fix: replaced all non-ASCII chars with ASCII equivalents in all files:
U+2014 (em dash) -> --
U+2192 (arrow) -> ->
all curly quotes -> straight quotes

Also moved route-check logic to scripts/verify_routes.py which uses
explicit encoding='utf-8' to be runner-locale independent.

Files changed (1) hide show
  1. scripts/verify_routes.py +11 -9
scripts/verify_routes.py CHANGED
@@ -1,4 +1,5 @@
1
  #!/usr/bin/env python3
 
2
  import re, os, sys
3
 
4
  def verify_routes():
@@ -10,15 +11,16 @@ def verify_routes():
10
  sys.exit(1)
11
 
12
  m = re.findall(r'from api\.routes import (.*)', main)
13
- if m:
14
- mods = [x.strip() for x in m[0].split(',')]
15
- missing = [x for x in mods if not os.path.exists(f'api/routes/{x}.py')]
16
- if missing:
17
- print('MISSING ROUTE FILES:', missing)
18
- sys.exit(1)
19
- print(f'PASS: All {len(mods)} route files present')
20
- else:
21
- print('PASS: No route imports to check')
 
22
 
23
  if __name__ == '__main__':
24
  verify_routes()
 
1
  #!/usr/bin/env python3
2
+ """CI check: verify all route modules in api/main.py exist on disk."""
3
  import re, os, sys
4
 
5
  def verify_routes():
 
11
  sys.exit(1)
12
 
13
  m = re.findall(r'from api\.routes import (.*)', main)
14
+ if not m:
15
+ print("PASS: no route imports found")
16
+ return
17
+
18
+ mods = [x.strip() for x in m[0].split(',')]
19
+ missing = [x for x in mods if not os.path.exists(f'api/routes/{x}.py')]
20
+ if missing:
21
+ print('MISSING ROUTE FILES:', missing)
22
+ sys.exit(1)
23
+ print(f'PASS: All {len(mods)} route files present')
24
 
25
  if __name__ == '__main__':
26
  verify_routes()