<s> """<STR_LIT>""" <EOL> from . init import * <EOL> class Profile ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , handle = "<STR_LIT>" ) : <EOL> self . site = "<STR_LIT>" <EOL> self . handle = handle <EOL> @ staticmethod <EOL> def get_tags ( problem_link ) : <EOL> response = get_request ( problem_link ) <EOL> if response == - <NUM_LIT:1> or response == { } : <EOL> return [ "<STR_LIT:->" ] <EOL> tags = BeautifulSoup ( response . text ) . find_all ( "<STR_LIT>" , id = "<STR_LIT>" ) <EOL> try : <EOL> tags = tags [ <NUM_LIT:0> ] . findAll ( "<STR_LIT>" ) <EOL> except IndexError : <EOL> return [ "<STR_LIT:->" ] <EOL> all_tags = [ ] <EOL> for tag in tags : <EOL> tmp = tag . contents <EOL> if tmp != [ ] : <EOL> all_tags . append ( tmp [ <NUM_LIT:0> ] [ <NUM_LIT:1> : ] ) <EOL> return all_tags <EOL> def get_submissions ( self , last_retrieved ) : <EOL> if self . handle : <EOL> handle = self . handle <EOL> else : <EOL> return - <NUM_LIT:1> <EOL> submissions = { handle : { } } <EOL> start = <NUM_LIT:0> <EOL> it = <NUM_LIT:1> <EOL> previd = - <NUM_LIT:1> <EOL> currid = <NUM_LIT:0> <EOL> page = <NUM_LIT:0> <EOL> url = "<STR_LIT>" + handle <EOL> tmpreq = get_request ( url ) <EOL> if tmpreq == - <NUM_LIT:1> : <EOL> return - <NUM_LIT:1> <EOL> if tmpreq . text . find ( "<STR_LIT>" ) == - <NUM_LIT:1> : <EOL> return submissions <EOL> while <NUM_LIT:1> : <EOL> flag = <NUM_LIT:0> <EOL> url = "<STR_LIT>" + handle + "<STR_LIT>" + str ( start ) <EOL> start += <NUM_LIT:20> <EOL> t = get_request ( url ) <EOL> if t == - <NUM_LIT:1> : <EOL> return - <NUM_LIT:1> <EOL> soup = bs4 . BeautifulSoup ( t . text ) <EOL> table_body = soup . find ( "<STR_LIT>" ) <EOL> if len ( table_body ) == <NUM_LIT:1> : <EOL> return submissions <EOL> row = <NUM_LIT:0> <EOL> submissions [ handle ] [ page ] = { } <EOL> for i in table_body : <EOL> submissions [ handle ] [ page ] [ it ] = [ ] <EOL> submission = submissions [ handle ] [ page ] [ it ] <EOL> append = submission . append <EOL> if isinstance ( i , bs4 . element . Tag ) : <EOL> if row == <NUM_LIT:0> : <EOL> currid = i . contents [ <NUM_LIT:1> ] . contents [ <NUM_LIT:0> ] <EOL> if currid == previd : <EOL> flag = <NUM_LIT:1> <EOL> break <EOL> row += <NUM_LIT:1> <EOL> previd = currid <EOL> tos = i . contents [ <NUM_LIT:3> ] . contents [ <NUM_LIT:1> ] . contents [ <NUM_LIT:0> ] <EOL> curr = time . strptime ( str ( tos ) , "<STR_LIT>" ) <EOL> if curr <= last_retrieved : <EOL> return submissions <EOL> append ( str ( tos ) ) <EOL> uri = i . contents [ <NUM_LIT:5> ] . contents [ <NUM_LIT:0> ] <EOL> uri [ "<STR_LIT>" ] = "<STR_LIT>" + uri [ "<STR_LIT>" ] <EOL> problem_link = eval ( repr ( uri [ "<STR_LIT>" ] ) . replace ( "<STR_LIT:\\>" , "<STR_LIT>" ) ) <EOL> append ( problem_link ) <EOL> append ( uri . contents [ <NUM_LIT:0> ] . strip ( ) ) <EOL> status = str ( i . contents [ <NUM_LIT:6> ] ) <EOL> if status . __contains__ ( "<STR_LIT>" ) : <EOL> st = "<STR_LIT>" <EOL> elif status . __contains__ ( "<STR_LIT>" ) : <EOL> st = "<STR_LIT>" <EOL> elif status . __contains__ ( "<STR_LIT>" ) : <EOL> st = "<STR_LIT>" <EOL> elif status . __contains__ ( "<STR_LIT>" ) : <EOL> st = "<STR_LIT>" <EOL> elif status . __contains__ ( "<STR_LIT>" ) : <EOL> st = "<STR_LIT>" <EOL> else : <EOL> st = "<STR_LIT>" <EOL> append ( st ) <EOL> if st == "<STR_LIT>" : <EOL> points = "<STR_LIT:100>" <EOL> else : <EOL> points = "<STR_LIT:0>" <EOL> append ( points ) <EOL> append ( i . contents [ <NUM_LIT:12> ] . contents [ <NUM_LIT:1> ] . contents [ <NUM_LIT:0> ] ) <EOL> view_link = "<STR_LIT>" <EOL> append ( view_link ) <EOL> it += <NUM_LIT:1> <EOL> page += <NUM_LIT:1> <EOL> if flag == <NUM_LIT:1> : <EOL> break <EOL> return submissions </s>
