XZise added a comment.

I'd suggest something like this: For each configuration variable there can be 
an callable that has a similar name (e.g. `_socket_timeout_type`) which takes 
the value and returns whether it's valid and it could be something like this 
then:

  _socket_timeout_type = lambda value: isinstance(value, (int, float, 
collections.Sequence)
  # afaik assigning lambda to a variable is a bad sport but just for 
demonstration purposes, we might have a '_is_multiple_types'

In theory it could be more advanced like:

  def _socket_timeout_type(value):
      if isinstance(value, collections.Sequence):
          return len(value) in [1, 2]
      else:
          return isinstance(value, (int, float))


TASK DETAIL
  https://phabricator.wikimedia.org/T103154

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: XZise
Cc: Aklapper, pywikibot-bugs-list, XZise, jayvdb, Malyacko, Mjbmr, P.Copp



_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to