Skip to content

Commit 433dba0

Browse files
chore: make code PEP597 compliant
Use `encoding="utf-8"` in `open()` and open-like functions. https://peps.python.org/pep-0597/
1 parent 8ba97aa commit 433dba0

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

gitlab/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def __init__(
135135

136136
def _parse_config(self) -> None:
137137
_config = configparser.ConfigParser()
138-
_config.read(self._files)
138+
_config.read(self._files, encoding="utf-8")
139139

140140
if self.gitlab_id and not _config.has_section(self.gitlab_id):
141141
raise GitlabDataError(

tests/meta/test_v4_objects_imported.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def test_verify_v4_objects_imported() -> None:
1313
assert len(gitlab.v4.objects.__path__) == 1
1414

1515
init_files: Set[str] = set()
16-
with open(gitlab.v4.objects.__file__, "r") as in_file:
16+
with open(gitlab.v4.objects.__file__, "r", encoding="utf-8") as in_file:
1717
for line in in_file.readlines():
1818
if line.startswith("from ."):
1919
init_files.add(line.rstrip())

tests/unit/objects/test_packages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def test_delete_project_package_file_from_package_file_object(
276276

277277
def test_upload_generic_package(tmp_path, project, resp_upload_generic_package):
278278
path = tmp_path / file_name
279-
path.write_text(file_content)
279+
path.write_text(file_content, encoding="utf-8")
280280
package = project.generic_packages.upload(
281281
package_name=package_name,
282282
package_version=package_version,

tests/unit/test_config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ def test_data_from_helper(m_open, monkeypatch, tmp_path):
290290
#!/bin/sh
291291
echo "secret"
292292
"""
293-
)
293+
),
294+
encoding="utf-8",
294295
)
295296
helper.chmod(0o755)
296297

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy