<s> """<STR_LIT>""" <EOL> import os <EOL> import sys <EOL> from . . pakbase import Package <EOL> class ModflowLmt ( Package ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , model , output_file_name = '<STR_LIT>' , <EOL> output_file_unit = <NUM_LIT> , output_file_header = '<STR_LIT>' , <EOL> output_file_format = '<STR_LIT>' , extension = '<STR_LIT>' , <EOL> unitnumber = <NUM_LIT:30> ) : <EOL> Package . __init__ ( self , model , extension , '<STR_LIT>' , unitnumber ) <EOL> self . heading = '<STR_LIT>' <EOL> self . url = '<STR_LIT>' <EOL> self . output_file_name = output_file_name <EOL> self . output_file_unit = output_file_unit <EOL> self . output_file_header = output_file_header <EOL> self . output_file_format = output_file_format <EOL> self . parent . add_package ( self ) <EOL> return <EOL> def write_file ( self ) : <EOL> """<STR_LIT>""" <EOL> f_lmt = open ( self . fn_path , '<STR_LIT:w>' ) <EOL> f_lmt . write ( '<STR_LIT>' % self . heading ) <EOL> f_lmt . write ( '<STR_LIT>' % ( '<STR_LIT>' + self . output_file_name ) ) <EOL> f_lmt . write ( '<STR_LIT>' % ( '<STR_LIT>' , self . output_file_unit ) ) <EOL> f_lmt . write ( '<STR_LIT>' % ( '<STR_LIT>' + self . output_file_header ) ) <EOL> f_lmt . write ( '<STR_LIT>' % ( '<STR_LIT>' + self . output_file_format ) ) <EOL> f_lmt . close ( ) <EOL> @ staticmethod <EOL> def load ( f , model , ext_unit_dict = None ) : <EOL> """<STR_LIT>""" <EOL> if model . verbose : <EOL> sys . stdout . write ( '<STR_LIT>' ) <EOL> prefix = os . path . basename ( f ) <EOL> prefix = prefix [ : prefix . rfind ( '<STR_LIT:.>' ) ] <EOL> output_file_name = prefix + '<STR_LIT>' <EOL> output_file_unit = <NUM_LIT> <EOL> output_file_header = '<STR_LIT>' <EOL> output_file_format = '<STR_LIT>' <EOL> if not hasattr ( f , '<STR_LIT>' ) : <EOL> filename = f <EOL> f = open ( filename , '<STR_LIT:r>' ) <EOL> for line in f : <EOL> if line [ <NUM_LIT:0> ] == '<STR_LIT:#>' : <EOL> continue <EOL> t = line . strip ( ) . split ( ) <EOL> if len ( t ) < <NUM_LIT:2> : <EOL> continue <EOL> if t [ <NUM_LIT:0> ] . lower ( ) == '<STR_LIT>' : <EOL> output_file_name = t [ <NUM_LIT:1> ] <EOL> elif t [ <NUM_LIT:0> ] . lower ( ) == '<STR_LIT>' : <EOL> output_file_unit = int ( t [ <NUM_LIT:1> ] ) <EOL> elif t [ <NUM_LIT:0> ] . lower ( ) == '<STR_LIT>' : <EOL> output_file_header = t [ <NUM_LIT:1> ] <EOL> elif t [ <NUM_LIT:0> ] . lower ( ) == '<STR_LIT>' : <EOL> output_file_format = t [ <NUM_LIT:1> ] <EOL> lmt = ModflowLmt ( model , output_file_name , output_file_unit , <EOL> output_file_header , output_file_format ) <EOL> return lmt </s>
