Skip to content

Commit bacd636

Browse files
Enable reportGeneralTypeIssues in pyright (#305)
1 parent f1e30bc commit bacd636

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

pins/cache.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
from __future__ import annotations
2+
13
import logging
24
import os
35
import shutil
46
import time
57
import urllib.parse
68
from pathlib import Path
9+
from typing import Iterator
710

811
import humanize
912
from fsspec import register_implementation
@@ -20,7 +23,7 @@
2023
PLACEHOLDER_FILE = "file"
2124

2225

23-
def touch_access_time(path, access_time: "float | None" = None, strict=True):
26+
def touch_access_time(path, access_time: float | None = None, strict=True):
2427
"""Update access time of file.
2528
2629
Returns the new access time.
@@ -220,15 +223,15 @@ class CachePruner:
220223

221224
meta_path = "data.txt"
222225

223-
def __init__(self, cache_dir: "str | Path"):
226+
def __init__(self, cache_dir: str | Path):
224227
self.cache_dir = Path(cache_dir)
225228

226-
def versions(self) -> "iter[Path]":
229+
def versions(self) -> Iterator[Path]:
227230
for p_version in self.cache_dir.glob("*/*"):
228231
if p_version.is_dir() and (p_version / self.meta_path).exists():
229232
yield p_version
230233

231-
def should_prune_version(self, days, path: "str | Path"):
234+
def should_prune_version(self, days, path: str | Path):
232235
path = Path(path)
233236

234237
expiry_time_sec = days * 60 * 60 * 24
@@ -258,7 +261,7 @@ def prune(self, days=30):
258261
_log.info("Skipping cache deletion")
259262

260263

261-
def delete_version(path: "str | Path"):
264+
def delete_version(path: str | Path):
262265
path = Path(path)
263266
shutil.rmtree(str(path.absolute()))
264267

pins/constructors.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
from __future__ import annotations
2+
13
import os
24
import tempfile
35
import warnings
6+
from typing import Callable
47

58
import fsspec
69

@@ -26,10 +29,10 @@ def board(
2629
protocol: str,
2730
path: str = "",
2831
versioned: bool = True,
29-
cache: "type[DEFAULT] | None" = DEFAULT,
32+
cache: type[DEFAULT] | None = DEFAULT,
3033
allow_pickle_read=None,
31-
storage_options: "dict | None" = None,
32-
board_factory: "callable | type[BaseBoard] | None" = None,
34+
storage_options: dict | None = None,
35+
board_factory: Callable | type[BaseBoard] | None = None,
3336
):
3437
"""General function for constructing a pins board.
3538

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ reportArgumentType = false
102102
reportAssignmentType = false
103103
reportAttributeAccessIssue = false
104104
reportCallIssue = false
105-
reportGeneralTypeIssues = false
106105
reportIncompatibleMethodOverride = false
107106
reportIndexIssue = false
108107
reportMissingImports = false

0 commit comments

Comments
 (0)