<s> """<STR_LIT>""" <EOL> import random <EOL> def calculate_wait_for_retry ( retry_attempt , max_wait = <NUM_LIT> ) : <EOL> """<STR_LIT>""" <EOL> wait_time = <NUM_LIT:2> ** retry_attempt <EOL> max_jitter = wait_time / <NUM_LIT> <EOL> wait_time += random . uniform ( - max_jitter , max_jitter ) <EOL> return max ( <NUM_LIT:1> , min ( wait_time , max_wait ) ) <EOL> def acceptable_mime_type ( accept_patterns , mime_type ) : <EOL> """<STR_LIT>""" <EOL> if '<STR_LIT:/>' not in mime_type : <EOL> raise ValueError ( <EOL> '<STR_LIT>' % mime_type ) <EOL> unsupported_patterns = [ p for p in accept_patterns if '<STR_LIT:;>' in p ] <EOL> if unsupported_patterns : <EOL> raise ValueError ( <EOL> '<STR_LIT>' % '<STR_LIT:U+002CU+0020>' . join ( <EOL> unsupported_patterns ) ) <EOL> def _match ( pattern , mime_type ) : <EOL> """<STR_LIT>""" <EOL> return all ( accept in ( '<STR_LIT:*>' , provided ) for accept , provided <EOL> in zip ( pattern . split ( '<STR_LIT:/>' ) , mime_type . split ( '<STR_LIT:/>' ) ) ) <EOL> return any ( _match ( pattern , mime_type ) for pattern in accept_patterns ) </s>
