Enable convenient typing of LocalSite-or-ALL parameters.

Review Request #13144 — Created July 13, 2023 and submitted — Latest diff uploaded


Review Board


Review Board 5 introduced a LocalSite.ALL value, which could be used
to query state without considering a LocalSite value (as opposed to a
None value for the global site). This was a bit hard to type
correctly, and we ran the risk of different blocks of code attempting
their own typing.

This change introduces an AnyOrAllLocalSites type, which supports a
LocalSite instance, None, or ALL.

To make this work, ALL needed to be converted from a singleton object
to a value supported in Literal. The safest approach was to use an
enum (which won't unintentionally cast to a string or integer in a
query). So we now have a private enum with only an ALL value.

All unit tests pass.