<s> import sys <EOL> import psycopg2 <EOL> import json <EOL> import argparse <EOL> import os <EOL> import subprocess <EOL> parser = argparse . ArgumentParser ( ) <EOL> parser . add_argument ( "<STR_LIT>" , type = int ) <EOL> parser . add_argument ( "<STR_LIT>" , type = int ) <EOL> arguments = parser . parse_args ( ) <EOL> os . setgid ( arguments . gid ) <EOL> os . setuid ( arguments . uid ) <EOL> data = json . load ( sys . stdin ) <EOL> os . environ [ "<STR_LIT>" ] = data [ "<STR_LIT>" ] <EOL> os . chdir ( os . environ [ "<STR_LIT>" ] ) <EOL> db = psycopg2 . connect ( database = "<STR_LIT>" ) <EOL> cursor = db . cursor ( ) <EOL> cursor . execute ( "<STR_LIT>" ) <EOL> for ( path , ) in cursor : <EOL> temporary_refs = subprocess . check_output ( <EOL> [ data [ "<STR_LIT>" ] , <EOL> "<STR_LIT>" % path , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) . splitlines ( ) <EOL> for temporary_ref in temporary_refs : <EOL> subprocess . check_call ( <EOL> [ data [ "<STR_LIT>" ] , <EOL> "<STR_LIT>" % path , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , temporary_ref ] ) <EOL> if temporary_refs : <EOL> print "<STR_LIT>" % ( path , len ( temporary_refs ) ) </s>
