gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit3e164b633e164b63Tracker: status after CL1mre3e164b63/tools/ref-params.py

1.9 KB

  1. # refparams.py <app dir> [--apply] [files...]: lambda parameters that a body only READS get `&` (hybriel#48: a lambda parameter
  2. # copies its argument since 4371b7aa; before it was a reference — `&` restores exactly that for read-only params, without the copy).
  3. # Skipped: params assigned (p = …), field-assigned (p.x = / p[k] =), list-mutated (p.push …), aliased (let x = p), defaults.
  4. import re,sys,glob,os
  5. os.chdir(sys.argv[1]); apply='--apply' in sys.argv
  6. files=[a for a in sys.argv[2:] if a!='--apply'] or (glob.glob('*.hl')+glob.glob('lib/*.hl')+glob.glob('components/*.hl')+glob.glob('tools/*.hl'))
  7. total=0; changed_files=0
  8. for f in sorted(files):
  9. src=open(f,encoding='utf-8').read(); out=[]; last=0; n=0
  10. for m in re.finditer(r'\(([^()]*)\)(\s*=>\s*\{)',src):
  11. params=[p.strip() for p in m.group(1).split(',')]
  12. if params==[''] : continue
  13. if not all(re.match(r'^&?\w+$',p) for p in params): continue
  14. i=m.end(); depth=1
  15. while depth and i<len(src):
  16. c=src[i]; depth += (c=='{') - (c=='}'); i+=1
  17. body=src[m.end():i-1]
  18. new=[]
  19. for p in params:
  20. if p.startswith('&'): new.append(p); continue
  21. bad = re.search(r'(?<![\w.])%s\s*=(?!=)'%p,body) or re.search(r'(?<![\w.])%s(?:\.\w+|\[[^\]]*\])+\s*=(?!=)'%p,body) \
  22. or re.search(r'(?<![\w.])%s(?:\.\w+|\[[^\]]*\])*\.(push|pop|shift|unshift|splice|sort|reverse)\('%p,body) \
  23. or re.search(r'=\s*%s\s*$'%p,body,re.M) or re.search(r'=\s*%s\s*[;}]'%p,body) or re.search(r'(?<![\w.])%s\s*(\+\+|--)'%p,body)
  24. new.append(p if bad else '&'+p)
  25. if new!=params:
  26. n+=1
  27. out.append(src[last:m.start()]); out.append('('+', '.join(new)+')'); last=m.start()+1+len(m.group(1))+1
  28. out.append(src[last:])
  29. if n:
  30. total+=n; changed_files+=1
  31. print(f'{f}: {n} lambdas')
  32. if apply: open(f,'w',encoding='utf-8').write(''.join(out))
  33. print('total lambdas changed',total,'files',changed_files)

Branches

Latest commits

  • 3e164b63Tracker: status after CL1mre
  • 9d686bb3Tracker: CL1 reviewedmre
  • b8bba562CL1: crash loop report (SIGPIPE confirmed, trap wrapper option)mre
  • 298785f2Tracker: CL1 startedmre
  • 36b22710Tracker: port slot, CL1 briefmre
  • a401190fTracker: GO for the crash loopmre
  • e195d372Tracker: token pathsmre
  • 7f541d11Tracker conductor: CONDUCTOR.md, short STATUS.md, old status + decisions archive to archive/2026-10-31mre
  • 8dd423f7README: login.js stays by caramboleyo's explicit rulemre
  • d8df1493tracker: standby service on port 45018 and a gap-free hand-over in deploy.sh step 4mre
  • 36dd1686ident#31: the selector's sign-in returns to the page the user started on (return attribute = the login callback with next), gate checkmre
  • ff9b838etracker: the Ended status pill uses the same red as layouts (pill danger); gate updatedmre
  • 40d9719eTP2: LOG line and report for the tracker pillsmre
  • ab3f2ba5tracker: status, genres, TMDB/IMDb/TVDB/TVmaze links and list kinds use the theme's pill; dense season list with the season check centred on its title line; gates for bothmre
  • 521061d6tracker header on phones: signed in, the brand fits whole at 360 and 390 px (tighter gaps and side paddings, slightly smaller brand, narrow screens and signed in only); mobile gate checks itmre
  • 18114a53tracker: franchises gate waits for the signed-out selector instead of the removed Log in buttonmre
  • 08561d73ident selector back in the header (creator 2026-10-24): selector top right signed in and out on phone and desktop, no second Log in button, new gate checks (WIP: gates not re-run after the last edits)mre
  • 59ef1e4atests/browser: repair 'done' check counts the 404 titles the first run already finished (race: failed=1 when Bulk Film 79 ran before the restart)mre
  • 5925fc4dreports/MK-mobile.md: rebase update, gate countsmre
  • 6adbc7f0extlink badges: background-clip after the background shorthand (it reset the clip: the pills were 44 px tall); gates check the lookmre