Skip to content

Commit 37c9a1a

Browse files
chore: enable pylint check "raise-missing-from"
Enable the pylint check "raise-missing-from" and fix errors detected.
1 parent 02b5153 commit 37c9a1a

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

gitlab/config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ def _get_config_files(
5656
try:
5757
resolved = _resolve_file(config_file)
5858
except OSError as e:
59-
raise GitlabConfigMissingError(f"Cannot read config from file: {e}")
59+
raise GitlabConfigMissingError(
60+
f"Cannot read config from file: {e}"
61+
) from e
6062
resolved_files.append(resolved)
6163

6264
return resolved_files
@@ -69,7 +71,7 @@ def _get_config_files(
6971
except OSError as e:
7072
raise GitlabConfigMissingError(
7173
f"Cannot read config from PYTHON_GITLAB_CFG: {e}"
72-
)
74+
) from e
7375

7476
for config_file in _DEFAULT_FILES:
7577
try:

gitlab/v4/objects/packages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ def upload(
7373
try:
7474
with open(path, "rb") as f:
7575
file_data = f.read()
76-
except OSError:
77-
raise exc.GitlabUploadError(f"Failed to read package file {path}")
76+
except OSError as e:
77+
raise exc.GitlabUploadError(f"Failed to read package file {path}") from e
7878

7979
url = f"{self._computed_path}/{package_name}/{package_version}/{file_name}"
8080
server_data = self.gitlab.http_put(url, post_data=file_data, raw=True, **kwargs)

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ disable = [
6161
"no-else-return",
6262
"no-self-use",
6363
"protected-access",
64-
"raise-missing-from",
6564
"redefined-builtin",
6665
"redefined-outer-name",
6766
"signature-differs",

0 commit comments

Comments
 (0)