<s> "<STR_LIT>" <EOL> import csv <EOL> import re <EOL> from datetime import date <EOL> from time import mktime , strptime <EOL> first_cap_re = re . compile ( '<STR_LIT>' ) <EOL> all_cap_re = re . compile ( '<STR_LIT>' ) <EOL> def simple_text_to_html ( content ) : <EOL> """<STR_LIT>""" <EOL> current_tag = None <EOL> output = "<STR_LIT>" <EOL> for line in content . split ( '<STR_LIT:\n>' ) : <EOL> re . sub ( '<STR_LIT>' , '<STR_LIT>' , line ) <EOL> if not line : <EOL> if current_tag == '<STR_LIT>' : <EOL> output += "<STR_LIT>" <EOL> current_tag = None <EOL> else : <EOL> if line [ <NUM_LIT:0> ] == '<STR_LIT:*>' : <EOL> if current_tag != '<STR_LIT>' : <EOL> output += "<STR_LIT>" <EOL> current_tag = '<STR_LIT>' <EOL> output += "<STR_LIT>" % line [ <NUM_LIT:2> : ] <EOL> else : <EOL> if current_tag == '<STR_LIT>' : <EOL> output += '<STR_LIT>' <EOL> current_tag = None <EOL> output += '<STR_LIT>' % line <EOL> if current_tag == '<STR_LIT>' : <EOL> output += '<STR_LIT>' <EOL> return output <EOL> def UnicodeDictReader ( utf8_data , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> reader = csv . DictReader ( utf8_data , ** kwargs ) <EOL> for row in reader : <EOL> yield dict ( [ ( key , unicode ( value , '<STR_LIT:utf-8>' ) ) <EOL> for key , value in row . iteritems ( ) ] ) <EOL> def camel_case ( name ) : <EOL> """<STR_LIT>""" <EOL> first_pass = first_cap_re . sub ( r'<STR_LIT>' , name ) <EOL> return all_cap_re . sub ( r'<STR_LIT>' , first_pass ) . lower ( ) <EOL> special_chars_re = re . compile ( '<STR_LIT>' ) <EOL> dash_and_space_re = re . compile ( '<STR_LIT>' ) <EOL> def slugify ( value ) : <EOL> """<STR_LIT>""" <EOL> value = special_chars_re . sub ( '<STR_LIT>' , value ) . strip ( ) . lower ( ) <EOL> return dash_and_space_re . sub ( '<STR_LIT:->' , value ) <EOL> def make_timestamp ( string , formatter ) : <EOL> """<STR_LIT>""" <EOL> struct = strptime ( string , formatter ) <EOL> return format ( mktime ( struct ) , '<STR_LIT>' ) <EOL> def date_from_string ( string , formatter ) : <EOL> """<STR_LIT>""" <EOL> struct = strptime ( string , formatter ) <EOL> if ( '<STR_LIT>' not in formatter and <EOL> '<STR_LIT>' not in formatter and <EOL> struct . tm_year == <NUM_LIT> ) : <EOL> return date ( date . today ( ) . year , struct . tm_mon , struct . tm_mday ) <EOL> return date . fromtimestamp ( mktime ( struct ) ) <EOL> def url_parameter_match ( route , parameter ) : <EOL> """<STR_LIT>""" <EOL> return re . search ( '<STR_LIT>' . format ( parameter ) , route ) is not None <EOL> import os . path <EOL> directory = os . path . dirname ( os . path . abspath ( __file__ ) ) <EOL> tests_directory = os . path . abspath ( os . path . join ( directory , '<STR_LIT>' ) ) <EOL> csv_test_file = tests_directory + '<STR_LIT>' </s>
