Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdc32d54

Browse files
nejchJohnVillalovos
authored andcommitted
chore: consistently use open() encoding and file descriptor
1 parent618267c commitdc32d54

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

‎gitlab/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ def _parse_value(v: Any) -> Any:
257257
# If the user-provided value starts with @, we try to read the file
258258
# path provided after @ as the real value. Exit on any error.
259259
try:
260-
withopen(v[1:])asfl:
261-
returnfl.read()
260+
withopen(v[1:])asf:
261+
returnf.read()
262262
exceptExceptionase:
263263
sys.stderr.write(f"{e}\n")
264264
sys.exit(1)

‎setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66

77
defget_version()->str:
88
version=""
9-
withopen("gitlab/_version.py")asf:
9+
withopen("gitlab/_version.py","r",encoding="utf-8")asf:
1010
forlineinf:
1111
ifline.startswith("__version__"):
1212
version=eval(line.split("=")[-1])
1313
break
1414
returnversion
1515

1616

17-
withopen("README.rst","r")asreadme_file:
18-
readme=readme_file.read()
17+
withopen("README.rst","r",encoding="utf-8")asf:
18+
readme=f.read()
1919

2020
setup(
2121
name="python-gitlab",

‎tests/functional/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def set_token(container, fixture_dir):
8787
logging.info("Creating API token.")
8888
set_token_rb=fixture_dir/"set_token.rb"
8989

90-
withopen(set_token_rb,"r")asf:
90+
withopen(set_token_rb,"r",encoding="utf-8")asf:
9191
set_token_command=f.read().strip()
9292

9393
rails_command= [
@@ -206,7 +206,7 @@ def gitlab_config(check_is_alive, docker_ip, docker_services, temp_dir, fixture_
206206
private_token ={token}
207207
api_version = 4"""
208208

209-
withopen(config_file,"w")asf:
209+
withopen(config_file,"w",encoding="utf-8")asf:
210210
f.write(config)
211211

212212
returnconfig_file

‎tests/unit/objects/test_todos.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
@pytest.fixture()
1414
defjson_content(fixture_dir):
15-
withopen(fixture_dir/"todo.json","r")asjson_file:
16-
todo_content=json_file.read()
15+
withopen(fixture_dir/"todo.json","r",encoding="utf-8")asf:
16+
todo_content=f.read()
1717
returnjson.loads(todo_content)
1818

1919

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp