MCPcopy
hub / github.com/beetbox/beets / parse_query_string

Function parse_query_string

beets/library/queries.py:46–58  ·  view source on GitHub ↗

Given a beets query string, return the `Query` and `Sort` they represent. The string is split into components using shell-like syntax.

(s, model_cls)

Source from the content-addressed store, hash-verified

44
45
46def parse_query_string(s, model_cls):
47 """Given a beets query string, return the `Query` and `Sort` they
48 represent.
49
50 The string is split into components using shell-like syntax.
51 """
52 message = f"Query is not unicode: {s!r}"
53 assert isinstance(s, str), message
54 try:
55 parts = shlex.split(s)
56 except ValueError as exc:
57 raise dbcore.InvalidQueryError(s, exc)
58 return parse_query_parts(parts, model_cls)

Callers 7

test_build_queriesMethod · 0.90
_parse_one_queryMethod · 0.90
importedMethod · 0.90
do_i_hate_thisMethod · 0.90
in_no_convertMethod · 0.90
destinationMethod · 0.85
_fetchMethod · 0.85

Calls 1

parse_query_partsFunction · 0.85

Tested by 1

test_build_queriesMethod · 0.72