From db49a47ce58ada598547efe1d1fbbe8e8efa6beb Mon Sep 17 00:00:00 2001 From: Yusur Princeps Date: Wed, 5 Nov 2025 18:08:49 +0100 Subject: [PATCH 1/3] 0.7.8 missing type guard in *bound_fk() --- aliases/sakuragasaki46_suou/pyproject.toml | 2 +- src/suou/__init__.py | 2 +- src/suou/sqlalchemy/orm.py | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/aliases/sakuragasaki46_suou/pyproject.toml b/aliases/sakuragasaki46_suou/pyproject.toml index 91b035a..d61a99a 100644 --- a/aliases/sakuragasaki46_suou/pyproject.toml +++ b/aliases/sakuragasaki46_suou/pyproject.toml @@ -10,7 +10,7 @@ license = "Apache-2.0" readme = "README.md" dependencies = [ - "suou==0.7.6", + "suou==0.7.8", "itsdangerous", "toml", "pydantic", diff --git a/src/suou/__init__.py b/src/suou/__init__.py index 7411deb..e1bc39b 100644 --- a/src/suou/__init__.py +++ b/src/suou/__init__.py @@ -37,7 +37,7 @@ from .redact import redact_url_password from .http import WantsContentType from .color import chalk -__version__ = "0.7.7" +__version__ = "0.7.8" __all__ = ( 'ConfigOptions', 'ConfigParserConfigSource', 'ConfigSource', 'ConfigValue', diff --git a/src/suou/sqlalchemy/orm.py b/src/suou/sqlalchemy/orm.py index 37b4def..bac68d3 100644 --- a/src/suou/sqlalchemy/orm.py +++ b/src/suou/sqlalchemy/orm.py @@ -256,6 +256,8 @@ def unbound_fk(target: str | Column | InstrumentedAttribute, typ: _T | None = No target_name = target if typ is None: typ = IdType + else: + raise TypeError('target must be a str, a Column or a InstrumentedAttribute') return Column(typ, ForeignKey(target_name, ondelete='SET NULL'), nullable=True, **kwargs) @@ -277,6 +279,8 @@ def bound_fk(target: str | Column | InstrumentedAttribute, typ: _T = None, **kwa target_name = target if typ is None: typ = IdType + else: + raise TypeError('target must be a str, a Column or a InstrumentedAttribute') return Column(typ, ForeignKey(target_name, ondelete='CASCADE'), nullable=False, **kwargs) From d454eaea2c24ddfb08301399189437b7621eec70 Mon Sep 17 00:00:00 2001 From: Yusur Princeps Date: Mon, 10 Nov 2025 17:18:13 +0100 Subject: [PATCH 2/3] 0.7.9 fix chalk behavior --- CHANGELOG.md | 17 ++++++++++++++ aliases/sakuragasaki46_suou/pyproject.toml | 2 +- src/suou/__init__.py | 7 ++++-- src/suou/color.py | 14 +++++++++++ tests/test_color.py | 27 ++++++++++++++++++++++ 5 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 tests/test_color.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c3b718..58ef000 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## 0.8.2 and 0.7.9 + ++ `.color`: fix `chalk` not behaving as expected + +## 0.8.1 and 0.7.8 + ++ Fix missing type guard in `unbound_fk()` and `bound_fk()` + +## 0.8.0 + ++ Add `username_column()` to `.sqlalchemy` ++ Improve (experimental) `Waiter` + +## 0.7.7 + ++ Fix imports in `.sqlalchemy` + ## 0.7.5 + Delay release of `FakeModule` to 0.9.0 diff --git a/aliases/sakuragasaki46_suou/pyproject.toml b/aliases/sakuragasaki46_suou/pyproject.toml index d61a99a..967dbec 100644 --- a/aliases/sakuragasaki46_suou/pyproject.toml +++ b/aliases/sakuragasaki46_suou/pyproject.toml @@ -10,7 +10,7 @@ license = "Apache-2.0" readme = "README.md" dependencies = [ - "suou==0.7.8", + "suou==0.7.9", "itsdangerous", "toml", "pydantic", diff --git a/src/suou/__init__.py b/src/suou/__init__.py index e1bc39b..387cd8b 100644 --- a/src/suou/__init__.py +++ b/src/suou/__init__.py @@ -35,9 +35,11 @@ from .strtools import PrefixIdentifier from .validators import matches from .redact import redact_url_password from .http import WantsContentType -from .color import chalk +from .color import chalk, WebColor + + +__version__ = "0.7.9" -__version__ = "0.7.8" __all__ = ( 'ConfigOptions', 'ConfigParserConfigSource', 'ConfigSource', 'ConfigValue', @@ -45,6 +47,7 @@ __all__ = ( 'MissingConfigError', 'MissingConfigWarning', 'PrefixIdentifier', 'Siq', 'SiqCache', 'SiqGen', 'SiqType', 'Snowflake', 'SnowflakeGen', 'StringCase', 'TimedDict', 'TomlI18n', 'UserSigner', 'Wanted', 'WantsContentType', + 'WebColor', 'addattr', 'additem', 'age_and_days', 'alru_cache', 'b2048decode', 'b2048encode', 'b32ldecode', 'b32lencode', 'b64encode', 'b64decode', 'cb32encode', 'cb32decode', 'chalk', 'count_ones', 'dei_args', 'deprecated', diff --git a/src/suou/color.py b/src/suou/color.py index 07241ba..633bfaa 100644 --- a/src/suou/color.py +++ b/src/suou/color.py @@ -55,24 +55,34 @@ class Chalk: return Chalk(self._flags + (beg,), self._ends + (end,)) def __call__(self, s: str) -> str: return ''.join(self._flags) + s + ''.join(reversed(self._ends)) + @property def red(self): return self._wrap(self.RED, self.END_COLOR) + @property def green(self): return self._wrap(self.GREEN, self.END_COLOR) + @property def blue(self): return self._wrap(self.BLUE, self.END_COLOR) + @property def yellow(self): return self._wrap(self.YELLOW, self.END_COLOR) + @property def cyan(self): return self._wrap(self.CYAN, self.END_COLOR) + @property def purple(self): return self._wrap(self.PURPLE, self.END_COLOR) + @property def grey(self): return self._wrap(self.GREY, self.END_COLOR) gray = grey marine = blue + magenta = purple + @property def bold(self): return self._wrap(self.BOLD, self.END_BOLD) + @property def faint(self): return self._wrap(self.FAINT, self.END_BOLD) @@ -130,3 +140,7 @@ class WebColor(namedtuple('_WebColor', 'red green blue')): def __str__(self): return f"rgb({self.red}, {self.green}, {self.blue})" + + +__all__ = ('chalk', 'WebColor') + diff --git a/tests/test_color.py b/tests/test_color.py new file mode 100644 index 0000000..9b20478 --- /dev/null +++ b/tests/test_color.py @@ -0,0 +1,27 @@ + + + +import unittest +from suou import chalk + +class TestColor(unittest.TestCase): + def setUp(self) -> None: + ... + def tearDown(self) -> None: + ... + + def test_chalk_colors(self): + strg = "The quick brown fox jumps over the lazy dog" + + self.assertEqual(f'\x1b[31m{strg}\x1b[39m', chalk.red(strg)) + self.assertEqual(f'\x1b[32m{strg}\x1b[39m', chalk.green(strg)) + self.assertEqual(f'\x1b[34m{strg}\x1b[39m', chalk.blue(strg)) + self.assertEqual(f'\x1b[36m{strg}\x1b[39m', chalk.cyan(strg)) + self.assertEqual(f'\x1b[33m{strg}\x1b[39m', chalk.yellow(strg)) + self.assertEqual(f'\x1b[35m{strg}\x1b[39m', chalk.purple(strg)) + + def test_chalk_bold(self): + strg = "The quick brown fox jumps over the lazy dog" + self.assertEqual(f'\x1b[1m{strg}\x1b[22m', chalk.bold(strg)) + self.assertEqual(f'\x1b[2m{strg}\x1b[22m', chalk.faint(strg)) + self.assertEqual(f'\x1b[1m\x1b[33m{strg}\x1b[39m\x1b[22m', chalk.bold.yellow(strg)) \ No newline at end of file From 764efd9530af1939079922eb96d1eda45bd2f4cd Mon Sep 17 00:00:00 2001 From: Yusur Princeps Date: Sun, 23 Nov 2025 21:52:01 +0100 Subject: [PATCH 3/3] 0.7.10 fix missing imports --- CHANGELOG.md | 15 +++++++++++++++ src/suou/__init__.py | 2 +- src/suou/peewee.py | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58ef000..aa40a97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 0.10.1 and 0.7.10 + ++ `peewee`: fix missing imports + +## 0.10.0 + ++ `peewee`: add `SnowflakeField` class + +## 0.9.0 + ++ Fix to make experimental `Waiter` usable ++ Suspend `glue()` release indefinitely ++ Add `yesno()` ++ Document validators + ## 0.8.2 and 0.7.9 + `.color`: fix `chalk` not behaving as expected diff --git a/src/suou/__init__.py b/src/suou/__init__.py index 387cd8b..1b64def 100644 --- a/src/suou/__init__.py +++ b/src/suou/__init__.py @@ -38,7 +38,7 @@ from .http import WantsContentType from .color import chalk, WebColor -__version__ = "0.7.9" +__version__ = "0.7.10" __all__ = ( diff --git a/src/suou/peewee.py b/src/suou/peewee.py index f1a3f1e..c086f95 100644 --- a/src/suou/peewee.py +++ b/src/suou/peewee.py @@ -18,7 +18,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. from contextvars import ContextVar from typing import Iterable from playhouse.shortcuts import ReconnectMixin -from peewee import CharField, Database, MySQLDatabase, _ConnectionState +from peewee import CharField, Database, Field, MySQLDatabase, _ConnectionState import re from suou.iding import Siq