Skip to content

Commit d3a5e84

Browse files
Apply ruff/flynt rule FLY002
FLY002 Consider f-string instead of string join
1 parent 176efbe commit d3a5e84

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

fsspec/gui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def _signal(self, event):
119119
widget components.
120120
"""
121121
if not self._ignoring_events:
122-
wn = "-".join([event.obj.name, event.name])
122+
wn = f"{event.obj.name}-{event.name}"
123123
if wn in self._map and self._map[wn] in self._sigs:
124124
self._emit(self._map[wn], event.new)
125125

fsspec/implementations/git.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def ls(self, path, detail=True, ref=None, **kwargs):
7979
out.append(
8080
{
8181
"type": "directory",
82-
"name": "/".join([path, obj.name]).lstrip("/"),
82+
"name": f"{path}/{obj.name}".lstrip("/"),
8383
"hex": str(obj.id),
8484
"mode": f"{obj.filemode:o}",
8585
"size": 0,
@@ -89,7 +89,7 @@ def ls(self, path, detail=True, ref=None, **kwargs):
8989
out.append(
9090
{
9191
"type": "file",
92-
"name": "/".join([path, obj.name]).lstrip("/"),
92+
"name": f"{path}/{obj.name}".lstrip("/"),
9393
"hex": str(obj.id),
9494
"mode": f"{obj.filemode:o}",
9595
"size": obj.size,

fsspec/implementations/reference.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,7 @@ def __getattr__(self, item):
160160

161161
def setup(self):
162162
self._items = {}
163-
self._items[".zmetadata"] = self.fs.cat_file(
164-
"/".join([self.root, ".zmetadata"])
165-
)
163+
self._items[".zmetadata"] = self.fs.cat_file(f"{self.root}/.zmetadata")
166164
met = json.loads(self._items[".zmetadata"])
167165
self.record_size = met["record_size"]
168166
self.zmetadata = met["metadata"]
@@ -207,7 +205,7 @@ def create(root, storage_options=None, fs=None, record_size=10000, **kwargs):
207205
if fs.exists(root):
208206
fs.rm(root, recursive=True)
209207
fs.makedirs(root, exist_ok=True)
210-
fs.pipe("/".join([root, ".zmetadata"]), json.dumps(met).encode())
208+
fs.pipe(f"{root}/.zmetadata", json.dumps(met).encode())
211209
return LazyReferenceMapper(root, fs, **kwargs)
212210

213211
@lru_cache()

fsspec/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def infer_storage_options(
7474
parsed_path = urlsplit(urlpath)
7575
protocol = parsed_path.scheme or "file"
7676
if parsed_path.fragment:
77-
path = "#".join([parsed_path.path, parsed_path.fragment])
77+
path = f"{parsed_path.path}#{parsed_path.fragment}"
7878
else:
7979
path = parsed_path.path
8080
if protocol == "file":
@@ -414,7 +414,7 @@ def other_paths(
414414
if exists:
415415
cp = cp.rsplit("/", 1)[0]
416416
if not cp and all(not s.startswith("/") for s in paths):
417-
path2 = ["/".join([path2, p]) for p in paths]
417+
path2 = [f"{path2}/{p}" for p in paths]
418418
else:
419419
path2 = [p.replace(cp, path2, 1) for p in paths]
420420
else:

0 commit comments

Comments
 (0)