Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #60

Merged
merged 6 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
runs-on: [ubuntu-latest]
defaults:
run:
Expand Down
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
repos:
- repo: https://github.com/psf/black
rev: 24.4.0
rev: 24.10.0
hooks:
- id: black-jupyter

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand Down Expand Up @@ -37,7 +37,7 @@ repos:
args: [--prose-wrap=always]

- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
rev: 1.19.1
hooks:
- id: blacken-docs
additional_dependencies: [black==22.3.0]
Expand All @@ -49,13 +49,13 @@ repos:
args: ["-a", "from __future__ import annotations"] # Python 3.7+

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.2
rev: v3.19.0
hooks:
- id: pyupgrade
args: ["--py37-plus"]

- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.5.0
rev: v2.7.0
hooks:
- id: setup-cfg-fmt

Expand All @@ -77,21 +77,21 @@ repos:
- flake8-print

- repo: https://github.com/pycqa/flake8
rev: 7.0.0
rev: 7.1.1
hooks:
- id: flake8
exclude: docs/conf.py
additional_dependencies: *flake8_dependencies

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
rev: v1.13.0
hooks:
- id: mypy
files: src
args: []

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell

Expand All @@ -109,7 +109,7 @@ repos:
exclude: .pre-commit-config.yaml

- repo: https://github.com/mgedmin/check-manifest
rev: "0.49"
rev: "0.50"
hooks:
- id: check-manifest
stages: [manual]
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ testpaths = [

[tool.mypy]
files = "src"
python_version = "3.7"
python_version = "3.9"
warn_unused_configs = true
strict = true
show_error_codes = true
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ project_urls =
packages = find:
install_requires =
fsspec
python_requires = >=3.8
python_requires = >=3.9
include_package_data = True
package_dir =
=src
Expand Down
20 changes: 0 additions & 20 deletions src/fsspec_xrootd/xrootd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import annotations

Check warning on line 1 in src/fsspec_xrootd/xrootd.py

View workflow job for this annotation

GitHub Actions / Format

Missing module docstring

import asyncio
import io
Expand All @@ -15,18 +15,18 @@
from fsspec.asyn import AsyncFileSystem, _run_coros_in_chunks, sync, sync_wrapper
from fsspec.exceptions import FSTimeoutError
from fsspec.spec import AbstractBufferedFile
from XRootD import client

Check failure on line 18 in src/fsspec_xrootd/xrootd.py

View workflow job for this annotation

GitHub Actions / Format

Unable to import 'XRootD'
from XRootD.client.flags import (

Check failure on line 19 in src/fsspec_xrootd/xrootd.py

View workflow job for this annotation

GitHub Actions / Format

Unable to import 'XRootD.client.flags'
DirListFlags,
MkDirFlags,
OpenFlags,
QueryCode,
StatInfoFlags,
)
from XRootD.client.responses import HostList, XRootDStatus

Check failure on line 26 in src/fsspec_xrootd/xrootd.py

View workflow job for this annotation

GitHub Actions / Format

Unable to import 'XRootD.client.responses'


class ErrorCodes(IntEnum):

Check warning on line 29 in src/fsspec_xrootd/xrootd.py

View workflow job for this annotation

GitHub Actions / Format

Missing class docstring
INVALID_PATH = 400


Expand All @@ -51,13 +51,13 @@
asyncio.get_running_loop().create_future()
)

def callback(status: XRootDStatus, content: T, servers: HostList) -> None:

Check warning on line 54 in src/fsspec_xrootd/xrootd.py

View workflow job for this annotation

GitHub Actions / Format

Unused argument 'servers'
if future.cancelled():
return
loop = future.get_loop()
try:
loop.call_soon_threadsafe(future.set_result, (status, content))
except Exception as exc:

Check warning on line 60 in src/fsspec_xrootd/xrootd.py

View workflow job for this annotation

GitHub Actions / Format

Catching too general exception Exception
loop.call_soon_threadsafe(future.set_exception, exc)

async def wrapped(*args: Any, **kwargs: Any) -> tuple[XRootDStatus, T]:
Expand Down Expand Up @@ -142,7 +142,7 @@
handle: client.File


class ReadonlyFileHandleCache:

Check warning on line 145 in src/fsspec_xrootd/xrootd.py

View workflow job for this annotation

GitHub Actions / Format

Missing class docstring
def __init__(self, loop: Any, max_items: int | None, ttl: int):
self.loop = loop
self._max_items = max_items
Expand Down Expand Up @@ -170,7 +170,7 @@
item.handle.close(callback=lambda *args: None)
cache.clear()

def close_all(self) -> None:

Check warning on line 173 in src/fsspec_xrootd/xrootd.py

View workflow job for this annotation

GitHub Actions / Format

Missing function or method docstring
self._close_all(self.loop, self._cache)

async def _close(self, url: str, timeout: int) -> None:
Expand All @@ -183,7 +183,7 @@
close = sync_wrapper(_close)

async def _start_pruner(self) -> None:
self._prune_task = asyncio.create_task(self._pruner())

Check warning on line 186 in src/fsspec_xrootd/xrootd.py

View workflow job for this annotation

GitHub Actions / Format

Attribute '_prune_task' defined outside __init__

async def _pruner(self) -> None:
while True:
Expand Down Expand Up @@ -220,7 +220,7 @@
return handle


class XRootDFileSystem(AsyncFileSystem): # type: ignore[misc]

Check warning on line 223 in src/fsspec_xrootd/xrootd.py

View workflow job for this annotation

GitHub Actions / Format

Missing class docstring

Check warning on line 223 in src/fsspec_xrootd/xrootd.py

View workflow job for this annotation

GitHub Actions / Format

Method '_cp_file' is abstract in class 'AsyncFileSystem' but is not overridden in child class 'XRootDFileSystem'

Check warning on line 223 in src/fsspec_xrootd/xrootd.py

View workflow job for this annotation

GitHub Actions / Format

Method '_pipe_file' is abstract in class 'AsyncFileSystem' but is not overridden in child class 'XRootDFileSystem'
protocol = "root"
root_marker = "/"
default_timeout = 60
Expand Down Expand Up @@ -911,26 +911,6 @@
raise OSError(f"File did not read properly: {status.message}")
return data

def flush(self, force: bool = False) -> None:
if self.closed:
raise ValueError("Flush on closed file")
if force and self.forced:
raise ValueError("Force flush cannot be called more than once")
if force:
self.forced = True

if self.mode not in {"wb", "ab"}:
# no-op to flush on read-mode
return

if not force and self.buffer.tell() < self.blocksize:
# Defer write on small block
return

if self._upload_chunk(final=force) is not False:
self.offset += self.buffer.seek(0, 2)
self.buffer = io.BytesIO()

def _upload_chunk(self, final: bool = False) -> Any:
status, _n = self._myFile.write(
self.buffer.getvalue(),
Expand Down
Loading