Simon Willison
Simon Willison
Here's my first attempt at a plugin for this: ```python from datasette import hookimpl import jinja2 START = " { let hash = el.getAttribute('hash'); let type = el.getAttribute('type'); let path...
Thanks to help from Dr. Laura Cantino at Science Hack Day San Francisco I've been able to pull together this query: ```sql select rsid, genotype, case genotype when 'AA' then...
Related code search in the Click source code: https://github.com/search?q=repo%3Apallets%2Fclick+%2F%5B%5E-%5D--%5B%5E-%5D%2F&type=code - had to search for `repo:pallets/click /[^-]--[^-]/`.
Here's a test that illustrates the bug: ```python @click.group(cls=DefaultGroup, default="baz", invoke_without_command=True) def cli_with_argument_and_option(): pass @cli_with_argument_and_option.command() @click.argument("argument") @click.option("--option") def baz(argument, option): click.echo(f"baz: argument: {argument}, option: {option}") def test_cli_with_argument_and_option(): result = r.invoke(...
Stepping through with the debugger it gets to here: ``` > /Users/simon/.local/share/virtualenvs/click-default-group-mhmnP7bF/lib/python3.10/site-packages/click/core.py(1644)parse_args() -> rest = super().parse_args(ctx, args) (Pdb) list 1639 def parse_args(self, ctx: Context, args: t.List[str]) -> t.List[str]: 1640 if...
More debugger: ``` > /Users/simon/.local/share/virtualenvs/click-default-group-mhmnP7bF/lib/python3.10/site-packages/click/parser.py(335)parse_args() -> state = ParsingState(args) (Pdb) list 330 for the parsed options and arguments as well as the leftover 331 arguments if there are any. The...
I think I found it: ``` > /Users/simon/.local/share/virtualenvs/click-default-group-mhmnP7bF/lib/python3.10/site-packages/click/parser.py(358)_process_args_for_options() -> arglen = len(arg) (Pdb) list 353 state.rargs = [] 354 355 def _process_args_for_options(self, state: ParsingState) -> None: 356 while state.rargs: 357...
... and that's as far as I got. I'm lost in Click internals now and I'm not sure how to fix this. Here's my diff from where I was investigating...
Looks like everything your are using is encapsulated in this code: https://github.com/wagtail/wagtail-ai/blob/c8539f78902731647334c9ac775868dfe74222bb/src/wagtail_ai/ai/llm.py#L40-L60