|
38 | 38 |
|
39 | 39 | fromtypingimportAny,Callable,Dict,Iterator,List,Optional,Sequence,TYPE_CHECKING,Union,cast,overload
|
40 | 40 |
|
41 |
| -fromgit.typesimportPathLike,Literal,TBD |
| 41 | +fromgit.typesimportPathLike,Literal,TBD,TypeGuard |
42 | 42 |
|
43 | 43 | ifTYPE_CHECKING:
|
44 | 44 | fromgit.repo.baseimportRepo
|
|
48 | 48 | fromgit.objects.tagimportTagObject
|
49 | 49 |
|
50 | 50 | flagKeyLiteral=Literal[' ','!','+','-','*','=','t']
|
| 51 | + |
| 52 | + |
| 53 | +defis_flagKeyLiteral(inp:str)->TypeGuard[flagKeyLiteral]: |
| 54 | +returninpin [' ','!','+','-','=','*','t'] |
| 55 | + |
| 56 | + |
51 | 57 | # -------------------------------------------------------------
|
52 | 58 |
|
| 59 | + |
53 | 60 | log=logging.getLogger('git.remote')
|
54 | 61 | log.addHandler(logging.NullHandler())
|
55 | 62 |
|
@@ -325,7 +332,7 @@ def _from_line(cls, repo: 'Repo', line: str, fetch_line: str) -> 'FetchInfo':
|
325 | 332 |
|
326 | 333 | # parse lines
|
327 | 334 | control_character,operation,local_remote_ref,remote_local_ref_str,note=match.groups()
|
328 |
| -control_character=cast(flagKeyLiteral,control_character)# can do this neater once 3.5 dropped |
| 335 | +assertis_flagKeyLiteral(control_character) |
329 | 336 |
|
330 | 337 | try:
|
331 | 338 | _new_hex_sha,_fetch_operation,fetch_note=fetch_line.split("\t")
|
|