code style, minor fixes

This commit is contained in:
Yusur 2025-07-30 02:01:11 +02:00
parent 38ff59c76a
commit a3330d4340
6 changed files with 30 additions and 11 deletions

View file

@ -3,8 +3,8 @@
## 0.5.0 ## 0.5.0
+ `sqlalchemy`: add `unbound_fk()`, `bound_fk()` + `sqlalchemy`: add `unbound_fk()`, `bound_fk()`
+ Add `timed_cache()`, `TimedDict()`, `age_and_days()` + Add `timed_cache()`, `TimedDict()`
+ Add date conversion utilities + 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) + Move obsolete stuff to `obsolete` package (includes configparse 0.3 as of now)
+ Add more exceptions: `NotFoundError()` + Add more exceptions: `NotFoundError()`

View file

@ -30,19 +30,21 @@ from .i18n import I18n, JsonI18n, TomlI18n
from .snowflake import Snowflake, SnowflakeGen from .snowflake import Snowflake, SnowflakeGen
from .lex import symbol_table, lex, ilex from .lex import symbol_table, lex, ilex
from .strtools import PrefixIdentifier from .strtools import PrefixIdentifier
from .validators import matches
__version__ = "0.5.0-dev29" __version__ = "0.5.0-dev30"
__all__ = ( __all__ = (
'ConfigOptions', 'ConfigParserConfigSource', 'ConfigSource', 'ConfigValue', 'ConfigOptions', 'ConfigParserConfigSource', 'ConfigSource', 'ConfigValue',
'DictConfigSource', 'EnvConfigSource', 'I18n', 'Incomplete', 'JsonI18n', 'DictConfigSource', 'EnvConfigSource', 'I18n', 'Incomplete', 'JsonI18n',
'MissingConfigError', 'MissingConfigWarning', 'PrefixIdentifier', 'Siq', 'SiqCache', 'SiqGen', 'MissingConfigError', 'MissingConfigWarning', 'PrefixIdentifier',
'SiqType', 'Snowflake', 'SnowflakeGen', 'StringCase', 'TimedDict', 'TomlI18n', 'Wanted', 'Siq', 'SiqCache', 'SiqGen', 'SiqType', 'Snowflake', 'SnowflakeGen',
'StringCase', 'TimedDict', 'TomlI18n', 'Wanted',
'addattr', 'additem', 'age_and_days', 'b2048decode', 'b2048encode', 'addattr', 'additem', 'age_and_days', 'b2048decode', 'b2048encode',
'b32ldecode', 'b32lencode', 'b64encode', 'b64decode', 'cb32encode', 'b32ldecode', 'b32lencode', 'b64encode', 'b64decode', 'cb32encode',
'cb32decode', 'count_ones', 'deprecated', 'ilex', 'join_bits', 'cb32decode', 'count_ones', 'deprecated', 'ilex', 'join_bits',
'jsonencode', 'kwargs_prefix', 'lex', 'ltuple', 'makelist', 'mask_shift', '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', 'ssv_list', 'symbol_table', 'timed_cache', 'want_bytes', 'want_datetime',
'want_isodate', 'want_str', 'want_timestamp', 'want_urlsafe', 'want_urlsafe_bytes' 'want_isodate', 'want_str', 'want_timestamp', 'want_urlsafe', 'want_urlsafe_bytes'
) )

View file

@ -16,12 +16,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
from __future__ import annotations from __future__ import annotations
from abc import ABCMeta, abstractmethod from abc import abstractmethod
from typing import Any, Callable, Generic, Iterable, Mapping, TypeVar from typing import Any, Callable, Generic, Iterable, Mapping, TypeVar
import logging import logging
from suou.codecs import StringCase
_T = TypeVar('_T') _T = TypeVar('_T')
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -69,8 +67,6 @@ class Incomplete(Generic[_T]):
Missing arguments must be passed in the appropriate positions Missing arguments must be passed in the appropriate positions
(positional or keyword) as a Wanted() object. (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] _obj = Callable[Any, _T]
_args: Iterable _args: Iterable
_kwargs: dict _kwargs: dict
@ -193,3 +189,5 @@ class ValueProperty(Generic[_T]):
return self._srcs['default'] return self._srcs['default']
__all__ = ('Wanted', 'Incomplete', 'ValueSource', 'ValueProperty')

View file

@ -38,5 +38,6 @@ SENSITIVE_ENDPOINTS = """
/.backup /.backup
/db.sql /db.sql
/database.sql /database.sql
/.vite
""".split() """.split()

View file

@ -16,6 +16,7 @@ This software is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
""" """
# TODO more snippets
INDEMNIFY = """ 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 attorneys fees, arising out of any breach of this agreement. You agree to indemnify and hold harmless {0} from any and all claims, damages, liabilities, costs and expenses, including reasonable and unreasonable counsel and attorneys fees, arising out of any breach of this agreement.

17
src/suou/quart.py Normal file
View file

@ -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