util.py 443 B

1234567891011121314
  1. def parse_shift(shift):
  2. if shift in ['ML', 'AL', 'A/L', 'BH', 'SD']:
  3. return None, None, 8
  4. if shift.startswith('T/'):
  5. return None, None, float(shift[2:])
  6. if shift == 'N':
  7. return 21, 21 + 12, 12
  8. if shift == 'R':
  9. return None, None, None
  10. if shift[0].isdigit():
  11. start, end = shift.split('/')
  12. return float(start), float(end), float(end) - float(start)
  13. return None, None, None