From a3330d43407e677a9ffc3650f13ac045e7baeade Mon Sep 17 00:00:00 2001 From: Yusur Princeps Date: Wed, 30 Jul 2025 02:01:11 +0200 Subject: [PATCH] code style, minor fixes --- CHANGELOG.md | 4 ++-- src/suou/__init__.py | 10 ++++++---- src/suou/classtools.py | 8 +++----- src/suou/dorks.py | 1 + src/suou/legal.py | 1 + src/suou/quart.py | 17 +++++++++++++++++ 6 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 src/suou/quart.py diff --git a/CHANGELOG.md b/CHANGELOG.md index cce9c06..4df9892 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,8 @@ ## 0.5.0 + `sqlalchemy`: add `unbound_fk()`, `bound_fk()` -+ Add `timed_cache()`, `TimedDict()`, `age_and_days()` -+ Add date conversion utilities ++ Add `timed_cache()`, `TimedDict()` ++ Add module `calendar` with `want_*` date type conversion utilities and `age_and_days()` + Move obsolete stuff to `obsolete` package (includes configparse 0.3 as of now) + Add more exceptions: `NotFoundError()` diff --git a/src/suou/__init__.py b/src/suou/__init__.py index 81955cf..d00606e 100644 --- a/src/suou/__init__.py +++ b/src/suou/__init__.py @@ -30,19 +30,21 @@ from .i18n import I18n, JsonI18n, TomlI18n from .snowflake import Snowflake, SnowflakeGen from .lex import symbol_table, lex, ilex from .strtools import PrefixIdentifier +from .validators import matches -__version__ = "0.5.0-dev29" +__version__ = "0.5.0-dev30" __all__ = ( 'ConfigOptions', 'ConfigParserConfigSource', 'ConfigSource', 'ConfigValue', 'DictConfigSource', 'EnvConfigSource', 'I18n', 'Incomplete', 'JsonI18n', - 'MissingConfigError', 'MissingConfigWarning', 'PrefixIdentifier', 'Siq', 'SiqCache', 'SiqGen', - 'SiqType', 'Snowflake', 'SnowflakeGen', 'StringCase', 'TimedDict', 'TomlI18n', 'Wanted', + 'MissingConfigError', 'MissingConfigWarning', 'PrefixIdentifier', + 'Siq', 'SiqCache', 'SiqGen', 'SiqType', 'Snowflake', 'SnowflakeGen', + 'StringCase', 'TimedDict', 'TomlI18n', 'Wanted', 'addattr', 'additem', 'age_and_days', 'b2048decode', 'b2048encode', 'b32ldecode', 'b32lencode', 'b64encode', 'b64decode', 'cb32encode', 'cb32decode', 'count_ones', 'deprecated', 'ilex', 'join_bits', 'jsonencode', 'kwargs_prefix', 'lex', 'ltuple', 'makelist', 'mask_shift', - 'mod_ceil', 'mod_floor', 'not_implemented', 'rtuple', 'split_bits', + 'matches', 'mod_ceil', 'mod_floor', 'not_implemented', 'rtuple', 'split_bits', 'ssv_list', 'symbol_table', 'timed_cache', 'want_bytes', 'want_datetime', 'want_isodate', 'want_str', 'want_timestamp', 'want_urlsafe', 'want_urlsafe_bytes' ) diff --git a/src/suou/classtools.py b/src/suou/classtools.py index eefdba3..c27fa61 100644 --- a/src/suou/classtools.py +++ b/src/suou/classtools.py @@ -16,12 +16,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. from __future__ import annotations -from abc import ABCMeta, abstractmethod +from abc import abstractmethod from typing import Any, Callable, Generic, Iterable, Mapping, TypeVar import logging -from suou.codecs import StringCase - _T = TypeVar('_T') logger = logging.getLogger(__name__) @@ -69,8 +67,6 @@ class Incomplete(Generic[_T]): Missing arguments must be passed in the appropriate positions (positional or keyword) as a Wanted() object. """ - # XXX disabled for https://stackoverflow.com/questions/45864273/slots-conflicts-with-a-class-variable-in-a-generic-class - #__slots__ = ('_obj', '_args', '_kwargs') _obj = Callable[Any, _T] _args: Iterable _kwargs: dict @@ -193,3 +189,5 @@ class ValueProperty(Generic[_T]): return self._srcs['default'] +__all__ = ('Wanted', 'Incomplete', 'ValueSource', 'ValueProperty') + diff --git a/src/suou/dorks.py b/src/suou/dorks.py index 1d56c6e..81f860a 100644 --- a/src/suou/dorks.py +++ b/src/suou/dorks.py @@ -38,5 +38,6 @@ SENSITIVE_ENDPOINTS = """ /.backup /db.sql /database.sql +/.vite """.split() diff --git a/src/suou/legal.py b/src/suou/legal.py index f1da0ea..422486d 100644 --- a/src/suou/legal.py +++ b/src/suou/legal.py @@ -16,6 +16,7 @@ This software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. """ +# TODO more snippets INDEMNIFY = """ You agree to indemnify and hold harmless {0} from any and all claims, damages, liabilities, costs and expenses, including reasonable and unreasonable counsel and attorney’s fees, arising out of any breach of this agreement. diff --git a/src/suou/quart.py b/src/suou/quart.py new file mode 100644 index 0000000..9caaee1 --- /dev/null +++ b/src/suou/quart.py @@ -0,0 +1,17 @@ +""" +Utilities for Quart, asynchronous successor of Flask + +--- + +Copyright (c) 2025 Sakuragasaki46. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +See LICENSE for the specific language governing permissions and +limitations under the License. + +This software is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +""" + +# TODO everything \ No newline at end of file