From bca0806c06baccd6775ea0e10a26f490602e9520 Mon Sep 17 00:00:00 2001 From: Wolfgang Müller Date: Thu, 30 Mar 2023 21:06:25 +0200 Subject: Perform initial linting with ruff --- quarg/database/filters.py | 4 +++- quarg/database/tables.py | 12 ++++++++++-- quarg/quassel/formatter.py | 3 ++- quarg/quassel/types.py | 1 + quarg/utils.py | 4 +++- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/quarg/database/filters.py b/quarg/database/filters.py index a78b117..75142ac 100644 --- a/quarg/database/filters.py +++ b/quarg/database/filters.py @@ -1,6 +1,8 @@ -from sqlalchemy.sql.expression import or_, between +from sqlalchemy.sql.expression import between, or_ + from quarg.database.tables import Backlog, Buffer, Network, QuasselUser, Sender + def msg_like(query): return Backlog.message.like(query, escape='\\') diff --git a/quarg/database/tables.py b/quarg/database/tables.py index 9b819d9..0b14eca 100644 --- a/quarg/database/tables.py +++ b/quarg/database/tables.py @@ -1,9 +1,17 @@ import datetime -from sqlalchemy.schema import Column, ForeignKey -from sqlalchemy.types import BigInteger, Boolean, DateTime, Integer, Text, TypeDecorator, TypeEngine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship +from sqlalchemy.schema import Column, ForeignKey +from sqlalchemy.types import ( + BigInteger, + Boolean, + DateTime, + Integer, + Text, + TypeDecorator, + TypeEngine, +) # Timestamps are saved in the database in UTC without timezone info, so attach diff --git a/quarg/quassel/formatter.py b/quarg/quassel/formatter.py index 6a78d7a..888d145 100644 --- a/quarg/quassel/formatter.py +++ b/quarg/quassel/formatter.py @@ -1,9 +1,10 @@ import datetime - from functools import partial from typing import NamedTuple + from quarg.quassel.types import MessageType + class User(NamedTuple): nick: str host: str diff --git a/quarg/quassel/types.py b/quarg/quassel/types.py index 0ba5a11..2632151 100644 --- a/quarg/quassel/types.py +++ b/quarg/quassel/types.py @@ -1,5 +1,6 @@ from enum import Enum + class BufferType(Enum): # INVALID = 0x0 STATUS = 0x1 diff --git a/quarg/utils.py b/quarg/utils.py index 903c057..33b9198 100644 --- a/quarg/utils.py +++ b/quarg/utils.py @@ -1,6 +1,8 @@ import sys + import dateutil.parser + def errx(msg): sys.exit(f'quarg: {msg}') @@ -9,7 +11,7 @@ def parse_isodate(date): parsed = dateutil.parser.isoparse(date) except ValueError as err: errx(f'isoparse: invalid date format \'{date}\', {err}') - except OverflowError as err: + except OverflowError: errx(f'isoparse: date overflows: \'{date}\'') # If no offset is given, assume local time -- cgit v1.2.3-2-gb3c3