mirror of
https://github.com/simonw/datasette.git
synced 2026-06-15 05:26:59 +02:00
Switch to ruff and fix all lint errors, refs #2630
This commit is contained in:
parent
b0436faa5e
commit
66d2a033f8
21 changed files with 44 additions and 101 deletions
|
|
@ -6,7 +6,7 @@ import contextvars
|
|||
from typing import TYPE_CHECKING, Any, Dict, Iterable, List
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from datasette.permissions import AllowedResource, Resource
|
||||
from datasette.permissions import Resource
|
||||
import asgi_csrf
|
||||
import collections
|
||||
import dataclasses
|
||||
|
|
@ -1144,7 +1144,7 @@ class Datasette:
|
|||
|
||||
# Validate that resource is a Resource object or None
|
||||
if resource is not None and not isinstance(resource, Resource):
|
||||
raise TypeError(f"resource must be a Resource subclass instance or None.")
|
||||
raise TypeError("resource must be a Resource subclass instance or None.")
|
||||
|
||||
# Check if actor can see it
|
||||
if not await self.allowed(action=action, resource=resource, actor=actor):
|
||||
|
|
|
|||
|
|
@ -26,18 +26,18 @@ from datasette import hookimpl
|
|||
|
||||
# Re-export all hooks and public utilities
|
||||
from .restrictions import (
|
||||
actor_restrictions_sql,
|
||||
restrictions_allow_action,
|
||||
ActorRestrictions,
|
||||
actor_restrictions_sql as actor_restrictions_sql,
|
||||
restrictions_allow_action as restrictions_allow_action,
|
||||
ActorRestrictions as ActorRestrictions,
|
||||
)
|
||||
from .root import root_user_permissions_sql
|
||||
from .config import config_permissions_sql
|
||||
from .root import root_user_permissions_sql as root_user_permissions_sql
|
||||
from .config import config_permissions_sql as config_permissions_sql
|
||||
from .defaults import (
|
||||
default_allow_sql_check,
|
||||
default_action_permissions_sql,
|
||||
DEFAULT_ALLOW_ACTIONS,
|
||||
default_allow_sql_check as default_allow_sql_check,
|
||||
default_action_permissions_sql as default_action_permissions_sql,
|
||||
DEFAULT_ALLOW_ACTIONS as DEFAULT_ALLOW_ACTIONS,
|
||||
)
|
||||
from .tokens import actor_from_signed_api_token
|
||||
from .tokens import actor_from_signed_api_token as actor_from_signed_api_token
|
||||
|
||||
|
||||
@hookimpl
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import asyncio
|
||||
import csv
|
||||
import hashlib
|
||||
import json
|
||||
import sys
|
||||
import textwrap
|
||||
import time
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue