Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ jobs:
fail-fast: false
matrix:
PY:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"

env:
CIRUN: true

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0

Expand All @@ -50,7 +50,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0

Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0

Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Setup conda
uses: conda-incubator/setup-miniconda@v3
Expand All @@ -145,5 +145,5 @@ jobs:
shell: bash -l {0}
run: |
cd ${{ matrix.FRIEND }}
pytest -v
pytest -v -W ignore::pytest.PytestRemovedIn9Warning
cd ..
4 changes: 2 additions & 2 deletions .github/workflows/pypipublish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: "3.x"
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ CI runtime. For local use, pick a version suitable for you.

```bash
# For a new environment (mamba / conda).
mamba create -n fsspec -c conda-forge python=3.9 -y
mamba create -n fsspec -c conda-forge python=3.10 -y
conda activate fsspec

# Standard dev install with docs and tests.
Expand Down
2 changes: 1 addition & 1 deletion docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ name: fsspec
channels:
- defaults
dependencies:
- python=3.9
- python=3.10
4 changes: 3 additions & 1 deletion fsspec/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ def ls(self, path, detail=True, **kwargs):
paths[p] = f
elif all(
(a == b)
for a, b in zip(path.split("/"), [""] + p.strip("/").split("/"))
for a, b in zip(
path.split("/"), [""] + p.strip("/").split("/"), strict=False
)
):
# root directory entry
ppath = p.rstrip("/").split("/", 1)[0]
Expand Down
17 changes: 11 additions & 6 deletions fsspec/asyn.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,10 @@ async def _copy(
)

batch_size = batch_size or self.batch_size
coros = [self._cp_file(p1, p2, **kwargs) for p1, p2 in zip(paths1, paths2)]
coros = [
self._cp_file(p1, p2, **kwargs)
for p1, p2 in zip(paths1, paths2, strict=False)
]
result = await _run_coros_in_chunks(
coros, batch_size=batch_size, return_exceptions=True, nofiles=True
)
Expand Down Expand Up @@ -469,7 +472,7 @@ async def _cat(
):
return {
k: v
for k, v in zip(paths, out)
for k, v in zip(paths, out, strict=False)
if on_error != "omit" or not is_exception(v)
}
else:
Expand Down Expand Up @@ -509,7 +512,7 @@ async def _cat_ranges(
raise ValueError
coros = [
self._cat_file(p, start=s, end=e, **kwargs)
for p, s, e in zip(paths, starts, ends)
for p, s, e in zip(paths, starts, ends, strict=False)
]
batch_size = batch_size or self.batch_size
return await _run_coros_in_chunks(
Expand Down Expand Up @@ -577,8 +580,10 @@ async def _put(
)

is_dir = {l: os.path.isdir(l) for l in lpaths}
rdirs = [r for l, r in zip(lpaths, rpaths) if is_dir[l]]
file_pairs = [(l, r) for l, r in zip(lpaths, rpaths) if not is_dir[l]]
rdirs = [r for l, r in zip(lpaths, rpaths, strict=False) if is_dir[l]]
file_pairs = [
(l, r) for l, r in zip(lpaths, rpaths, strict=False) if not is_dir[l]
]

await asyncio.gather(*[self._makedirs(d, exist_ok=True) for d in rdirs])
batch_size = batch_size or self.batch_size
Expand Down Expand Up @@ -662,7 +667,7 @@ async def _get(

coros = []
callback.set_size(len(lpaths))
for lpath, rpath in zip(lpaths, rpaths):
for lpath, rpath in zip(lpaths, rpaths, strict=False):
get_file = callback.branch_coro(self._get_file)
coros.append(get_file(rpath, lpath, **kwargs))
return await _run_coros_in_chunks(
Expand Down
13 changes: 3 additions & 10 deletions fsspec/caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,11 @@
import threading
import warnings
from collections import OrderedDict
from collections.abc import Callable
from concurrent.futures import Future, ThreadPoolExecutor
from itertools import groupby
from operator import itemgetter
from typing import (
TYPE_CHECKING,
Any,
Callable,
ClassVar,
Generic,
NamedTuple,
TypeVar,
)
from typing import TYPE_CHECKING, Any, ClassVar, Generic, NamedTuple, TypeVar

if TYPE_CHECKING:
import mmap
Expand Down Expand Up @@ -649,7 +642,7 @@ def __init__(
offsets.append((start, stop))
blocks.append(data.pop((start, stop)))

self.data = dict(zip(offsets, blocks))
self.data = dict(zip(offsets, blocks, strict=False))
else:
self.data = {}

Expand Down
4 changes: 2 additions & 2 deletions fsspec/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def rsync(
allfiles[k] = otherfile
logger.debug(f"{len(allfiles)} files to copy")
if allfiles:
source_files, target_files = zip(*allfiles.items())
source_files, target_files = zip(*allfiles.items(), strict=False)
fs.cp(source_files, target_files, **kwargs)
logger.debug(f"{len(to_delete)} files to delete")
if delete_missing and to_delete:
Expand Down Expand Up @@ -361,7 +361,7 @@ async def copy_file_op(
u2,
os.path.join(tempdir, uuid.uuid4().hex),
)
for u1, u2 in zip(url1, url2)
for u1, u2 in zip(url1, url2, strict=False)
]
out = await _run_coros_in_chunks(
coros, batch_size=batch_size, return_exceptions=True
Expand Down
14 changes: 8 additions & 6 deletions fsspec/implementations/cache_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

if TYPE_CHECKING:
from collections.abc import Iterator
from typing import Any, Literal

from typing_extensions import TypeAlias
from typing import Any, Literal, TypeAlias

from .cached import CachingFileSystem

Expand Down Expand Up @@ -57,7 +55,7 @@ def __init__(self, storage: list[str]):
def _load(self, fn: str) -> Detail:
"""Low-level function to load metadata from specific file"""
try:
with open(fn, "r") as f:
with open(fn) as f:
loaded = json.load(f)
except ValueError:
with open(fn, "rb") as f:
Expand Down Expand Up @@ -107,7 +105,9 @@ def check_file(
perform extra checks to reject possible matches, such as if they are
too old.
"""
for (fn, base, _), cache in zip(self._scan_locations(), self.cached_files):
for (fn, base, _), cache in zip(
self._scan_locations(), self.cached_files, strict=False
):
if path not in cache:
continue
detail = cache[path].copy()
Expand Down Expand Up @@ -194,7 +194,9 @@ def pop_file(self, path: str) -> str | None:

def save(self) -> None:
"""Save metadata to disk"""
for (fn, _, writable), cache in zip(self._scan_locations(), self.cached_files):
for (fn, _, writable), cache in zip(
self._scan_locations(), self.cached_files, strict=False
):
if not writable:
continue

Expand Down
19 changes: 10 additions & 9 deletions fsspec/implementations/cached.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
import tempfile
import time
import weakref
from collections.abc import Callable
from shutil import rmtree
from typing import TYPE_CHECKING, Any, Callable, ClassVar
from typing import TYPE_CHECKING, Any, ClassVar

from fsspec import filesystem
from fsspec.callbacks import DEFAULT_CALLBACK
Expand Down Expand Up @@ -573,12 +574,12 @@ def open_many(self, open_files, **kwargs):
if self.compression:
raise NotImplementedError
details = [self._check_file(sp) for sp in paths]
downpath = [p for p, d in zip(paths, details) if not d]
downpath = [p for p, d in zip(paths, details, strict=False) if not d]
downfn0 = [
os.path.join(self.storage[-1], self._mapper(p))
for p, d in zip(paths, details)
for p, d in zip(paths, details, strict=False)
] # keep these path names for opening later
downfn = [fn for fn, d in zip(downfn0, details) if not d]
downfn = [fn for fn, d in zip(downfn0, details, strict=False) if not d]
if downpath:
# skip if all files are already cached and up to date
self.fs.get(downpath, downfn)
Expand All @@ -594,7 +595,7 @@ def open_many(self, open_files, **kwargs):
}
for path in downpath
]
for path, detail in zip(downpath, newdetail):
for path, detail in zip(downpath, newdetail, strict=False):
self._metadata.update_file(path, detail)
self.save_cache()

Expand All @@ -604,7 +605,7 @@ def firstpart(fn):

return [
open(firstpart(fn0) if fn0 else fn1, mode=open_files.mode)
for fn0, fn1 in zip(details, downfn0)
for fn0, fn1 in zip(details, downfn0, strict=False)
]

def commit_many(self, open_files):
Expand Down Expand Up @@ -669,7 +670,7 @@ def cat(
self.save_cache()

callback.set_size(len(paths))
for p, fn in zip(paths, fns):
for p, fn in zip(paths, fns, strict=False):
with open(fn, "rb") as f:
out[p] = f.read()
callback.relative_update(1)
Expand Down Expand Up @@ -885,8 +886,8 @@ def cat_ranges(
):
logger.debug("cat ranges %s", paths)
lpaths = [self._check_file(p) for p in paths]
rpaths = [p for l, p in zip(lpaths, paths) if l is False]
lpaths = [l for l, p in zip(lpaths, paths) if l is False]
rpaths = [p for l, p in zip(lpaths, paths, strict=False) if l is False]
lpaths = [l for l, p in zip(lpaths, paths, strict=False) if l is False]
self.fs.get(rpaths, lpaths)
paths = [self._check_file(p) for p in paths]
return LocalFileSystem().cat_ranges(
Expand Down
3 changes: 1 addition & 2 deletions fsspec/implementations/data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import base64
import io
from typing import Optional
from urllib.parse import unquote

from fsspec import AbstractFileSystem
Expand Down Expand Up @@ -50,7 +49,7 @@ def _open(
return io.BytesIO(self.cat_file(path))

@staticmethod
def encode(data: bytes, mime: Optional[str] = None):
def encode(data: bytes, mime: str | None = None):
"""Format the given data into data-URL syntax

This version always base64 encodes, even when the data is ascii/url-safe.
Expand Down
2 changes: 1 addition & 1 deletion fsspec/implementations/libarchive.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def _open(
if mode != "rb":
raise NotImplementedError

data = bytes()
data = b""
with self._open_archive() as arc:
for entry in arc:
if entry.pathname != path:
Expand Down
Loading
Loading