comparison src/hggit_serve.py @ 10:c2ae14c981e1

fix format and typing issues
author Paul Fisher <paul@pfish.zone>
date Mon, 16 Feb 2026 00:25:27 -0500
parents 5000914da3ff
children
comparison
equal deleted inserted replaced
9:5000914da3ff 10:c2ae14c981e1
173 response.headers[k] = v 173 response.headers[k] = v
174 174
175 def write_the_rest() -> t.Iterator[bytes]: 175 def write_the_rest() -> t.Iterator[bytes]:
176 with call, rest: 176 with call, rest:
177 # if it's good enough for shutil it's good enough for me 177 # if it's good enough for shutil it's good enough for me
178 while more := rest.read(shutil.COPY_BUFSIZE): 178 # technically not in the docs but everybody it
179 bs = shutil.COPY_BUFSIZE # type: ignore[attr-defined]
180 while more := rest.read(bs):
179 yield more 181 yield more
180 if perm == _PUSH: 182 if perm == _PUSH:
181 _importing_enter(repo) 183 _importing_enter(repo)
182 try: 184 try:
183 gh = repo.githandler 185 gh = repo.githandler
209 """Call this before you start importing from Git.""" 211 """Call this before you start importing from Git."""
210 level = getattr(repo, _ILEVEL_ATTR, 0) + 1 212 level = getattr(repo, _ILEVEL_ATTR, 0) + 1
211 setattr(repo, _ILEVEL_ATTR, level) 213 setattr(repo, _ILEVEL_ATTR, level)
212 214
213 215
214 def _is_importing(repo: hgrepo.IRepo) -> None: 216 def _is_importing(repo: hgrepo.IRepo) -> bool:
215 """Call this to check if you're currently importing.""" 217 """Call this to check if you're currently importing."""
216 return hasattr(repo, _ILEVEL_ATTR) 218 return hasattr(repo, _ILEVEL_ATTR)
217 219
218 220
219 def _importing_exit(repo: hgrepo.IRepo) -> None: 221 def _importing_exit(repo: hgrepo.IRepo) -> None: