<s> from lixian_plugins . api import task_filter <EOL> import re <EOL> @ task_filter ( protocol = '<STR_LIT>' , batch = True ) <EOL> def fetch_by_total_size ( keyword , tasks ) : <EOL> '''<STR_LIT>''' <EOL> m = re . match ( r'<STR_LIT>' , keyword , flags = re . I ) <EOL> assert m , keyword <EOL> n , u = m . groups ( ) <EOL> limit = float ( n ) * { None : <NUM_LIT:1> , '<STR_LIT>' : <NUM_LIT:1000> ** <NUM_LIT:3> , '<STR_LIT:g>' : <NUM_LIT:1000> ** <NUM_LIT:3> , '<STR_LIT:M>' : <NUM_LIT:1000> ** <NUM_LIT:2> , '<STR_LIT:m>' : <NUM_LIT:1000> ** <NUM_LIT:2> } [ u ] <EOL> total = <NUM_LIT:0> <EOL> results = [ ] <EOL> for t in tasks : <EOL> total += t [ '<STR_LIT:size>' ] <EOL> if total <= limit : <EOL> results . append ( t ) <EOL> else : <EOL> return results <EOL> return results </s>
