Skip to content

Commit 21eab41

Browse files
Enforce ruff rule RUF019
RUF019 Unnecessary key check before dictionary access
1 parent 512f257 commit 21eab41

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

fsspec/implementations/gist.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,16 @@ def _get_kwargs_from_urls(path):
141141
"""
142142
so = infer_storage_options(path)
143143
out = {}
144-
if "username" in so and so["username"]:
144+
if so.get("username"):
145145
out["username"] = so["username"]
146-
if "password" in so and so["password"]:
146+
if so.get("password"):
147147
out["token"] = so["password"]
148-
if "host" in so and so["host"]:
148+
if so.get("host"):
149149
# We interpret 'host' as the gist ID
150150
out["gist_id"] = so["host"]
151151

152152
# Extract SHA and filename from path
153-
if "path" in so and so["path"]:
153+
if so.get("path"):
154154
path_parts = so["path"].rsplit("/", 2)[-2:]
155155
if len(path_parts) == 2:
156156
if path_parts[0]: # SHA present

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ select = [
180180
"RUF006",
181181
"RUF012",
182182
"RUF015",
183+
"RUF019",
183184
"RUF024",
184185
"SIM",
185186
"SLOT",

0 commit comments

Comments
 (0)