A bit niche but I tried setting my bareasc prefix to an empty string,
and was getting an obtuse error. This should help make clearer what is
happening when queries fail.
The exception is not properly raised up the stack in the first place
because it happens across 2 FFI boundaries: the DB query
(Python -> SQLite), and the custom DB function (SQLite -> Python).
Thus Python cannot forwarded it back to itself through SQLite, and it's
treated as an "unraisable" exception.
We could override `sys.unraisablehook` to not print anything for the
original exception, and store it in a global for the outer Python
interpreter to fetch and raise properly, but that's pretty hacky,
limited to a single DB instance and query at once, and risks swallowing
other "unraisable" exceptions.
Instead we just tell the user to look above for what Python prints.
Sample output:
```
Exception ignored in: <function unidecode_expect_ascii at
0x7f7fa20bb060>
Traceback (most recent call last):
File "site-packages/unidecode/__init__.py", line 60, in
unidecode_expect_ascii
bytestring = string.encode('ASCII')
^^^^^^^^^^^^^
AttributeError: 'bytes' object has no attribute 'encode'
Traceback (most recent call last):
File "site-packages/beets/dbcore/db.py", line 988, in query
cursor = self.db._connection().execute(statement, subvals)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: user-defined function raised exception
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "site-packages/beets/__main__.py", line 9, in <module>
sys.exit(main())
^^^^^^
File "site-packages/beets/ui/__init__.py", line 1865, in main
_raw_main(args)
File "site-packages/beets/ui/__init__.py", line 1852, in _raw_main
subcommand.func(lib, suboptions, subargs)
File "site-packages/beets/ui/commands.py", line 1599, in list_func
list_items(lib, decargs(args), opts.album)
File "site-packages/beets/ui/commands.py", line 1594, in list_items
for item in lib.items(query):
^^^^^^^^^^^^^^^^
File "site-packages/beets/library.py", line 1695, in items
return self._fetch(Item, query, sort or
self.get_default_item_sort())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "site-packages/beets/library.py", line 1673, in _fetch
return super()._fetch(model_cls, query, sort)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "site-packages/beets/dbcore/db.py", line 1301, in _fetch
rows = tx.query(sql, subvals)
^^^^^^^^^^^^^^^^^^^^^^
File "site-packages/beets/dbcore/db.py", line 991, in query
raise DBCustomFunctionError()
beets.dbcore.db.DBCustomFunctionError: beets defined SQLite function
failed; see the other errors above for details
```
Simplify wording by replacing flowery or pretentious terms throughout the project.
A bouquet refers to trees or flowers. The etymology is pretty clear on
the Latin root via French.
Co-authored-by: Sebastian Mohr <sebastian@mohrenclan.de>
- Test non-whitelisted genres resolving "up" in the tree.
- Test whitelisted original and whitelisted new genre resolving "up"
- Test non-whitelisted original genre resolving "up" (and deduplication
works)
Centralise plugin loading in `beets.plugins` and refactor the plugin
loading system to be more straightforward and eliminate complex mocking
in tests. Replace the two-stage class collection and instantiation
process with direct instance creation and storage.
Add plugins.PluginImportError and adjust plugin import tests to only
complain about plugin import issues.
Add `py.typed` marker file to support PEP 561 typing
This PR adds a `py.typed` marker file to the package directory to
indicate that the package includes inline type hints and is PEP 561
compliant.
Convert static _types dictionaries to dynamic cached class properties to
enable proper plugin type inheritance and avoid mutating shared state.
Key changes:
- Replace static _types dicts with @cached_classproperty decorators
- Update cached_classproperty to support proper caching with class names
- Remove manual _types mutation in plugin loading/unloading
- Add pluginload event and cache clearing for proper plugin integration
- Fix test to trigger type checking during item creation
This ensures plugin types are properly inherited through the class
hierarchy and eliminates issues with shared mutable state between
test runs.