Show More
@@ -72,8 +72,10 class _shlexpy3proxy: | |||
|
72 | 72 | return _encodeornone(self._l.get_token()) |
|
73 | 73 | |
|
74 | 74 | @property |
|
75 | def infile(self): | |
|
76 |
|
|
|
75 | def infile(self) -> bytes: | |
|
76 | if self._l.infile is not None: | |
|
77 | return encoding.strtolocal(self._l.infile) | |
|
78 | return b'<unknown>' | |
|
77 | 79 | |
|
78 | 80 | @property |
|
79 | 81 | def lineno(self) -> int: |
@@ -82,7 +84,7 class _shlexpy3proxy: | |||
|
82 | 84 | |
|
83 | 85 | def shlexer( |
|
84 | 86 | data=None, |
|
85 |
filepath: Optional[ |
|
|
87 | filepath: Optional[bytes] = None, | |
|
86 | 88 | wordchars: Optional[bytes] = None, |
|
87 | 89 | whitespace: Optional[bytes] = None, |
|
88 | 90 | ): |
@@ -94,7 +96,8 def shlexer( | |||
|
94 | 96 | b'shlexer only accepts data or filepath, not both' |
|
95 | 97 | ) |
|
96 | 98 | data = data.decode('latin1') |
|
97 | l = shlex.shlex(data, infile=filepath, posix=True) | |
|
99 | infile = encoding.strfromlocal(filepath) if filepath is not None else None | |
|
100 | l = shlex.shlex(data, infile=infile, posix=True) | |
|
98 | 101 | if whitespace is not None: |
|
99 | 102 | l.whitespace_split = True |
|
100 | 103 | l.whitespace += whitespace.decode('latin1') |
@@ -76,7 +76,7 class filemapper: | |||
|
76 | 76 | rename: MutableMapping[bytes, bytes] |
|
77 | 77 | targetprefixes: Optional[Set[bytes]] |
|
78 | 78 | |
|
79 | def __init__(self, ui: "uimod.ui", path=None) -> None: | |
|
79 | def __init__(self, ui: "uimod.ui", path: Optional[bytes] = None) -> None: | |
|
80 | 80 | self.ui = ui |
|
81 | 81 | self.include = {} |
|
82 | 82 | self.exclude = {} |
@@ -86,8 +86,7 class filemapper: | |||
|
86 | 86 | if self.parse(path): |
|
87 | 87 | raise error.Abort(_(b'errors in filemap')) |
|
88 | 88 | |
|
89 | # TODO: cmd==b'source' case breaks if ``path``is str | |
|
90 | def parse(self, path) -> int: | |
|
89 | def parse(self, path: Optional[bytes]) -> int: | |
|
91 | 90 | errs = 0 |
|
92 | 91 | |
|
93 | 92 | def check(name: bytes, mapping, listname: bytes): |
@@ -218,7 +217,9 class filemapper: | |||
|
218 | 217 | |
|
219 | 218 | |
|
220 | 219 | class filemap_source(common.converter_source): |
|
221 | def __init__(self, ui: "uimod.ui", baseconverter, filemap) -> None: | |
|
220 | def __init__( | |
|
221 | self, ui: "uimod.ui", baseconverter, filemap: Optional[bytes] | |
|
222 | ) -> None: | |
|
222 | 223 | super(filemap_source, self).__init__(ui, baseconverter.repotype) |
|
223 | 224 | self.base = baseconverter |
|
224 | 225 | self.filemapper = filemapper(ui, filemap) |
General Comments 0
You need to be logged in to leave comments.
Login now