-
Notifications
You must be signed in to change notification settings - Fork 157
Closed
Milestone
Description
See #171
This should be reasonably easy with the API changes of #116. Matchers should probably be a triple of lists of Matcher[*], where Matcher is
T = TypeVar("T")
class Matcher(abc.ABC, Generic[T]):
@abc.abstractmethod
def __call__(self, ua: str) -> Optional[T]:
passand we can update e.g. class UserAgentMatcher(Matcher[UserAgent]), making the typing line up (hopefully).
The question is how to provide the lazy versions of the matchers:
- add one more generated file generating a triplet of lists of lazy matchers (at which point the codegen should probably be abstracted some as it's getting really messy)
- add a generator which yields arbitrarily applied thingie e.g.
maybe with a cache on
def user_agents(callback): yield callback('(GeoEvent Server) (\d+)(?:\.(\d+)(?:\.(\d+)|)|)') yield callback('(ArcGIS Pro)(?: (\d+)\.(\d+)\.([^ ]+)|)') ...
callbacksomehow? Not sure there's any way that can work, might make more sense with a wrapper converting that to a list and the callbacks are just intermediate convenience? - generate lists of the parameters and map to a new list at runtime
- use json? might parse faster than python file but requires re-mapping, and is eager, and might not work because it can't benefit from some optimisations (but not sure there are any optimisations to the generated modules, they create lists of function calls but there's no string sharing or key sharing or anything)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels