fix lint checks
This commit is contained in:
parent
e6f91db4e4
commit
e6c07851d4
|
@ -192,7 +192,7 @@ class Line(tqdm):
|
|||
def error_message(self, *args):
|
||||
self._error_message = args
|
||||
|
||||
def close(self):
|
||||
def close(self): # noqa: C901
|
||||
"""
|
||||
Cleanup and (if leave=False) close the progressbar.
|
||||
"""
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import subprocess
|
||||
from contextlib import suppress
|
||||
from typing import Any, Set, TextIO
|
||||
from typing import Any, Set
|
||||
|
||||
from ereuse_devicehub.ereuse_utils import text
|
||||
|
||||
|
@ -96,9 +96,7 @@ class ProgressiveCmd:
|
|||
self.conn = conn = subprocess.Popen(
|
||||
self.cmd, universal_newlines=True, stderr=subprocess.PIPE, stdout=stdout
|
||||
)
|
||||
self.out = (
|
||||
conn.stdout if stdout == subprocess.PIPE else conn.stderr
|
||||
) # type: TextIO
|
||||
self.out = conn.stdout if stdout == subprocess.PIPE else conn.stderr
|
||||
self._callback = callback
|
||||
self.last_update_percentage = 0
|
||||
self.percentage = 0
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
from typing import Generator
|
||||
|
||||
|
||||
class NestedLookup:
|
||||
@staticmethod
|
||||
def __new__(cls, document, references, operation):
|
||||
|
@ -38,7 +35,7 @@ class NestedLookup:
|
|||
return key_value_containing_value
|
||||
|
||||
@staticmethod
|
||||
def _nested_lookup(document, references, operation):
|
||||
def _nested_lookup(document, references, operation): # noqa: C901
|
||||
"""Lookup a key in a nested document, yield a value"""
|
||||
if isinstance(document, list):
|
||||
for d in document:
|
||||
|
|
|
@ -5,7 +5,7 @@ from usb import CLASS_MASS_STORAGE
|
|||
from ereuse_devicehub.ereuse_utils.naming import Naming
|
||||
|
||||
|
||||
def plugged_usbs(multiple=True) -> map or dict:
|
||||
def plugged_usbs(multiple=True) -> map or dict: # noqa: C901
|
||||
"""
|
||||
Gets the plugged-in USB Flash drives (pen-drives).
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import datetime
|
||||
from functools import wraps
|
||||
|
||||
from flask import Response, make_response
|
||||
from flask import make_response
|
||||
|
||||
|
||||
def cache(expires: datetime.timedelta = None):
|
||||
|
@ -18,7 +18,7 @@ def cache(expires: datetime.timedelta = None):
|
|||
def cache_decorator(view):
|
||||
@wraps(view)
|
||||
def cache_func(*args, **kwargs):
|
||||
r = make_response(view(*args, **kwargs)) # type: Response
|
||||
r = make_response(view(*args, **kwargs))
|
||||
r.expires = datetime.datetime.now(datetime.timezone.utc) + expires
|
||||
r.cache_control.public = True
|
||||
return r
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
from typing import Dict, Set, Type
|
||||
|
||||
from boltons.typeutils import issubclass
|
||||
|
||||
from ereuse_devicehub.teal.resource import Resource
|
||||
|
@ -12,16 +10,16 @@ class Config:
|
|||
Subclass and set here your config values.
|
||||
"""
|
||||
|
||||
RESOURCE_DEFINITIONS = set() # type: Set[Type[Resource]]
|
||||
RESOURCE_DEFINITIONS = set()
|
||||
"""
|
||||
A list of resource definitions to load.
|
||||
"""
|
||||
|
||||
SQLALCHEMY_DATABASE_URI = None # type: str
|
||||
SQLALCHEMY_DATABASE_URI = None
|
||||
"""
|
||||
The access to the main Database.
|
||||
"""
|
||||
SQLALCHEMY_BINDS = {} # type: Dict[str, str]
|
||||
SQLALCHEMY_BINDS = {}
|
||||
"""
|
||||
Optional extra databases. See `here <http://flask-sqlalchemy.pocoo.org
|
||||
/2.3/binds/#referring-to-binds>`_ how bind your models to different
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
import inspect
|
||||
from typing import Dict, Type
|
||||
from typing import Type
|
||||
|
||||
import click_spinner
|
||||
import ereuse_devicehub.ereuse_utils
|
||||
import flask_cors
|
||||
from anytree import Node
|
||||
from apispec import APISpec
|
||||
from click import option
|
||||
from ereuse_devicehub.ereuse_utils import ensure_utf8
|
||||
from flask import Flask, jsonify
|
||||
from flask.globals import _app_ctx_stack
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from marshmallow import ValidationError
|
||||
from werkzeug.exceptions import HTTPException, UnprocessableEntity
|
||||
|
||||
import ereuse_devicehub.ereuse_utils
|
||||
from ereuse_devicehub.ereuse_utils import ensure_utf8
|
||||
from ereuse_devicehub.teal.auth import Auth
|
||||
from ereuse_devicehub.teal.cli import TealCliRunner
|
||||
from ereuse_devicehub.teal.client import Client
|
||||
|
@ -122,12 +122,12 @@ class Teal(Flask):
|
|||
|
||||
# noinspection PyAttributeOutsideInit
|
||||
def load_resources(self):
|
||||
self.resources = {} # type: Dict[str, Resource]
|
||||
self.resources = {}
|
||||
"""
|
||||
The resources definitions loaded on this App, referenced by their
|
||||
type name.
|
||||
"""
|
||||
self.tree = {} # type: Dict[str, Node]
|
||||
self.tree = {}
|
||||
"""
|
||||
A tree representing the hierarchy of the instances of
|
||||
ResourceDefinitions. ResourceDefinitions use these nodes to
|
||||
|
|
Reference in New Issue