<s> """<STR_LIT>""" <EOL> from __future__ import print_function <EOL> import hmac <EOL> from hashlib import sha1 <EOL> from os . path import basename <EOL> from time import time <EOL> def main ( argv ) : <EOL> if len ( argv ) != <NUM_LIT:7> : <EOL> prog = basename ( argv [ <NUM_LIT:0> ] ) <EOL> print ( '<STR_LIT>' <EOL> '<STR_LIT>' % prog ) <EOL> print ( ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( ) <EOL> print ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( ) <EOL> print ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> return <NUM_LIT:1> <EOL> path , redirect , max_file_size , max_file_count , seconds , key = argv [ <NUM_LIT:1> : ] <EOL> try : <EOL> max_file_size = int ( max_file_size ) <EOL> except ValueError : <EOL> max_file_size = - <NUM_LIT:1> <EOL> if max_file_size < <NUM_LIT:0> : <EOL> print ( '<STR_LIT>' ) <EOL> return <NUM_LIT:1> <EOL> try : <EOL> max_file_count = int ( max_file_count ) <EOL> except ValueError : <EOL> max_file_count = <NUM_LIT:0> <EOL> if max_file_count < <NUM_LIT:1> : <EOL> print ( '<STR_LIT>' ) <EOL> return <NUM_LIT:1> <EOL> try : <EOL> expires = int ( time ( ) + int ( seconds ) ) <EOL> except ValueError : <EOL> expires = <NUM_LIT:0> <EOL> if expires < <NUM_LIT:1> : <EOL> print ( '<STR_LIT>' ) <EOL> return <NUM_LIT:1> <EOL> parts = path . split ( '<STR_LIT:/>' , <NUM_LIT:4> ) <EOL> if len ( parts ) < <NUM_LIT:4> or parts [ <NUM_LIT:0> ] or parts [ <NUM_LIT:1> ] != '<STR_LIT>' or not parts [ <NUM_LIT:2> ] or not parts [ <NUM_LIT:3> ] : <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> return <NUM_LIT:1> <EOL> sig = hmac . new ( key , '<STR_LIT>' % ( path , redirect , max_file_size , <EOL> max_file_count , expires ) , <EOL> sha1 ) . hexdigest ( ) <EOL> print ( '<STR_LIT>' , expires ) <EOL> print ( '<STR_LIT>' , sig ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' <EOL> % path ) <EOL> if redirect : <EOL> print ( '<STR_LIT>' <EOL> % redirect ) <EOL> print ( '<STR_LIT>' <EOL> % max_file_size ) <EOL> print ( '<STR_LIT>' <EOL> % max_file_count ) <EOL> print ( '<STR_LIT>' % expires ) <EOL> print ( '<STR_LIT>' % sig ) <EOL> print ( '<STR_LIT>' <EOL> % max_file_count ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> for i in range ( max_file_count ) : <EOL> print ( '<STR_LIT>' % i ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> return <NUM_LIT:0> </s>
