blob: faaad2274ed2b379c1e18c3d10ffa45b68b3b4d8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
--- breezy/_rio_py.py.orig 2021-12-07 02:24:26 UTC
+++ breezy/_rio_py.py
@@ -17,6 +17,7 @@ import re
"""Python implementation of _read_stanza_*."""
import re
+from typing import Iterator, Optional
from .rio import (
Stanza,
@@ -25,13 +26,13 @@ _tag_re = re.compile(r'^[-a-zA-Z0-9_]+$')
_tag_re = re.compile(r'^[-a-zA-Z0-9_]+$')
-def _valid_tag(tag):
+def _valid_tag(tag: str) -> bool:
if not isinstance(tag, str):
raise TypeError(tag)
return bool(_tag_re.match(tag))
-def _read_stanza_utf8(line_iter):
+def _read_stanza_utf8(line_iter: Iterator[bytes]) -> Optional[Stanza]:
stanza = Stanza()
tag = None
accum_value = None
@@ -67,7 +68,7 @@ def _read_stanza_utf8(line_iter):
accum_value = [line[colon_index + 2:-1]]
if tag is not None: # add last tag-value
- stanza.add(tag, u''.join(accum_value))
+ stanza.add(tag, u''.join(accum_value)) # type: ignore
return stanza
else: # didn't see any content
return None
|