summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/docgen.py3
-rwxr-xr-xdoc/python_stub.py6
2 files changed, 6 insertions, 3 deletions
diff --git a/doc/docgen.py b/doc/docgen.py
index 1c0a09663..0589395f2 100644
--- a/doc/docgen.py
+++ b/doc/docgen.py
@@ -487,7 +487,8 @@ class AutogenDoc():
f'autogen_{name}.{self.locale[:2]}.adoc',
)
self.filename_tmp = f'{self.filename}.tmp'
- self._file = open(self.filename_tmp, 'w')
+ # pylint: disable=consider-using-with
+ self._file = open(self.filename_tmp, 'w', encoding='utf-8')
def write_autogen_files(self, weechat_doc):
"""Write auto-generated files."""
diff --git a/doc/python_stub.py b/doc/python_stub.py
index a5422af0b..7778d9753 100755
--- a/doc/python_stub.py
+++ b/doc/python_stub.py
@@ -56,7 +56,8 @@ def print_stub_constants() -> None:
"string": "str",
}
constant_pattern = re.compile(CONSTANT_RE)
- with open(DOC_DIR / "weechat_scripting.en.adoc") as scripting_file:
+ with open(DOC_DIR / "weechat_scripting.en.adoc",
+ encoding="utf-8") as scripting_file:
scripting = scripting_file.read()
for match in constant_pattern.finditer(scripting):
print(f'{match["constant"]}: {types[match["type"]]}')
@@ -65,7 +66,8 @@ def print_stub_constants() -> None:
def print_stub_functions() -> None:
"""Print function prototypes, extracted from the Plugin API reference."""
function_pattern = re.compile(FUNCTION_RE, re.DOTALL)
- with open(DOC_DIR / "weechat_plugin_api.en.adoc") as api_doc_file:
+ with open(DOC_DIR / "weechat_plugin_api.en.adoc",
+ encoding="utf-8") as api_doc_file:
api_doc = api_doc_file.read()
for match in function_pattern.finditer(api_doc):
url = f'https://weechat.org/doc/api/#_{match["function"]}'