<s> """<STR_LIT>""" <EOL> from django . conf import settings <EOL> import os <EOL> from . . utils import format_to_extension , suggest_extension <EOL> def source_name_as_path ( generator ) : <EOL> """<STR_LIT>""" <EOL> source_filename = getattr ( generator . source , '<STR_LIT:name>' , None ) <EOL> if source_filename is None or os . path . isabs ( source_filename ) : <EOL> dir = settings . IMAGEKIT_CACHEFILE_DIR <EOL> else : <EOL> dir = os . path . join ( settings . IMAGEKIT_CACHEFILE_DIR , <EOL> os . path . splitext ( source_filename ) [ <NUM_LIT:0> ] ) <EOL> ext = suggest_extension ( source_filename or '<STR_LIT>' , generator . format ) <EOL> return os . path . normpath ( os . path . join ( dir , <EOL> '<STR_LIT>' % ( generator . get_hash ( ) , ext ) ) ) <EOL> def source_name_dot_hash ( generator ) : <EOL> """<STR_LIT>""" <EOL> source_filename = getattr ( generator . source , '<STR_LIT:name>' , None ) <EOL> if source_filename is None or os . path . isabs ( source_filename ) : <EOL> dir = settings . IMAGEKIT_CACHEFILE_DIR <EOL> else : <EOL> dir = os . path . join ( settings . IMAGEKIT_CACHEFILE_DIR , <EOL> os . path . dirname ( source_filename ) ) <EOL> ext = suggest_extension ( source_filename or '<STR_LIT>' , generator . format ) <EOL> basename = os . path . basename ( source_filename ) <EOL> return os . path . normpath ( os . path . join ( dir , '<STR_LIT>' % ( <EOL> os . path . splitext ( basename ) [ <NUM_LIT:0> ] , generator . get_hash ( ) [ : <NUM_LIT:12> ] , ext ) ) ) <EOL> def hash ( generator ) : <EOL> """<STR_LIT>""" <EOL> format = getattr ( generator , '<STR_LIT>' , None ) <EOL> ext = format_to_extension ( format ) if format else '<STR_LIT>' <EOL> return os . path . normpath ( os . path . join ( settings . IMAGEKIT_CACHEFILE_DIR , <EOL> '<STR_LIT>' % ( generator . get_hash ( ) , ext ) ) ) </s>
