fix some type errors
This commit is contained in:
parent
237203b149
commit
b69019d814
2 changed files with 10 additions and 3 deletions
|
@ -40,7 +40,7 @@ class DictFormatter(PyTeXFormatter):
|
||||||
with open(self.input_file, newline='') as csvfile:
|
with open(self.input_file, newline='') as csvfile:
|
||||||
spamreader = csv.reader(csvfile, delimiter=',', quotechar='|')
|
spamreader = csv.reader(csvfile, delimiter=',', quotechar='|')
|
||||||
next(spamreader) # Skip languages line
|
next(spamreader) # Skip languages line
|
||||||
translations = {}
|
translations: Dict = {}
|
||||||
for language in self._languages:
|
for language in self._languages:
|
||||||
translations[language] = {}
|
translations[language] = {}
|
||||||
for line in spamreader:
|
for line in spamreader:
|
||||||
|
@ -54,7 +54,7 @@ class DictFormatter(PyTeXFormatter):
|
||||||
build_dir.mkdir(parents=True, exist_ok=True)
|
build_dir.mkdir(parents=True, exist_ok=True)
|
||||||
self.make_header()
|
self.make_header()
|
||||||
for language in self._languages:
|
for language in self._languages:
|
||||||
lines = [self.header, '']
|
lines: List[str] = [self.make_header(), '']
|
||||||
lines += r'\ProvidesDictionary{{{dict_name}}}{{{language}}}'.format(
|
lines += r'\ProvidesDictionary{{{dict_name}}}{{{language}}}'.format(
|
||||||
dict_name=self._dict_name,
|
dict_name=self._dict_name,
|
||||||
language=language
|
language=language
|
||||||
|
|
|
@ -85,11 +85,16 @@ class TexFormatter(PyTeXFormatter):
|
||||||
self.write_line(line)
|
self.write_line(line)
|
||||||
|
|
||||||
def write_line(self, line: str):
|
def write_line(self, line: str):
|
||||||
|
if self._output_file is None:
|
||||||
|
raise NotImplementedError
|
||||||
self._output_file.write(line)
|
self._output_file.write(line)
|
||||||
|
|
||||||
def open_output_stream(self):
|
def open_output_stream(self):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def close_output_stream(self):
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def future_config(self) -> Optional[List[Tuple[str, Dict]]]:
|
def future_config(self) -> Optional[List[Tuple[str, Dict]]]:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
@ -98,6 +103,8 @@ class TexFormatter(PyTeXFormatter):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def format_header(self):
|
def format_header(self):
|
||||||
|
if self._output_file is None:
|
||||||
|
raise NotImplementedError
|
||||||
self._output_file.write(self.make_header())
|
self._output_file.write(self.make_header())
|
||||||
|
|
||||||
def format_post_header(self) -> None:
|
def format_post_header(self) -> None:
|
||||||
|
@ -121,5 +128,5 @@ class TexFormatter(PyTeXFormatter):
|
||||||
self.format_header()
|
self.format_header()
|
||||||
self.format_post_header()
|
self.format_post_header()
|
||||||
self.format_document()
|
self.format_document()
|
||||||
self._output_file.close()
|
self.close_output_stream()
|
||||||
return self.future_config
|
return self.future_config
|
||||||
|
|
Loading…
Reference in a new issue