Skip to content

Commit 291a42a

Browse files
committed
Force encodings to utf-8
1 parent 5b8794d commit 291a42a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ lint: .venv/.EXISTS ## Run all linting
2424
test: lint ## Run unit tests
2525
. .venv/bin/activate && python3 -m pytest --cov=snooty
2626

27-
dist/snooty/.EXISTS: .venv/.EXISTS
27+
dist/snooty/.EXISTS: .venv/.EXISTS pyproject.toml snooty/*.py snooty/gizaparser/*.py
2828
-rm -rf snooty.dist dist
2929
mkdir dist
3030
echo 'from snooty import main; main.main()' > snooty.py

snooty/rstparser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ def __init__(self, project_config: ProjectConfig, visitor_class: Type[_V]) -> No
346346
self.visitor_class = visitor_class
347347

348348
if not self.spec:
349-
with PACKAGE_ROOT.joinpath('rstspec.toml').open() as f:
349+
with PACKAGE_ROOT.joinpath('rstspec.toml').open(encoding='utf-8') as f:
350350
spec = Parser.spec = specparser.Spec.loads(f.read())
351351
register_spec_with_docutils(spec)
352352

snooty/types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def open(cls, root: Path) -> Tuple['ProjectConfig', List[Diagnostic]]:
137137
path = root
138138
while path.parent != path:
139139
try:
140-
with path.joinpath('snooty.toml').open() as f:
140+
with path.joinpath('snooty.toml').open(encoding='utf-8') as f:
141141
data = toml.load(f)
142142
data['root'] = path
143143
result, diagnostics = check_type(ProjectConfig, data).render_constants()
@@ -162,7 +162,7 @@ def render_constants(self) -> Tuple['ProjectConfig', List[Diagnostic]]:
162162
return self, all_diagnostics
163163

164164
def read(self, path: Path) -> Tuple[str, List[Diagnostic]]:
165-
text = path.open().read()
165+
text = path.read_text(encoding='utf-8')
166166
return ProjectConfig.substitute(self.constants, text)
167167

168168
@staticmethod

0 commit comments

Comments
 (0)