<s> """<STR_LIT>""" <EOL> import logging <EOL> import csv <EOL> import gzip <EOL> import os <EOL> from docopt import docopt <EOL> from iepy . data . db import DocumentManager <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> logging . basicConfig ( level = logging . INFO , <EOL> format = u"<STR_LIT>" ) <EOL> opts = docopt ( __doc__ , version = <NUM_LIT:0.1> ) <EOL> name = opts [ "<STR_LIT>" ] <EOL> if name . endswith ( "<STR_LIT>" ) : <EOL> fin = gzip . open ( name , "<STR_LIT>" ) <EOL> else : <EOL> fin = open ( name , "<STR_LIT>" ) <EOL> reader = csv . DictReader ( fin ) <EOL> name = os . path . basename ( name ) <EOL> docdb = DocumentManager ( ) <EOL> seen = set ( ) <EOL> for i , d in enumerate ( reader ) : <EOL> mid = d [ "<STR_LIT>" ] <EOL> if mid in seen : <EOL> continue <EOL> seen . add ( mid ) <EOL> docdb . create_document ( identifier = mid , <EOL> text = d [ "<STR_LIT:description>" ] , <EOL> metadata = { "<STR_LIT>" : name } ) </s>
