您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

18 行
423 B

  1. from typing import Optional
  2. def pick_bool(*values: Optional[bool]) -> bool:
  3. """Pick the first non-none bool or return the last value.
  4. Args:
  5. *values (bool): Any number of boolean or None values.
  6. Returns:
  7. bool: First non-none boolean.
  8. """
  9. assert values, "1 or more values required"
  10. for value in values:
  11. if value is not None:
  12. return value
  13. return bool(value)