<s> """<STR_LIT>""" <EOL> import os <EOL> import sys <EOL> from lxml import etree <EOL> from pptx . oxml import oxml_parser <EOL> _thisdir = os . path . split ( __file__ ) [ <NUM_LIT:0> ] <EOL> test_file_dir = os . path . abspath ( os . path . join ( _thisdir , '<STR_LIT:..>' , '<STR_LIT>' ) ) <EOL> def abspath ( relpath ) : <EOL> thisdir = os . path . split ( __file__ ) [ <NUM_LIT:0> ] <EOL> return os . path . abspath ( os . path . join ( thisdir , relpath ) ) <EOL> def absjoin ( * paths ) : <EOL> return os . path . abspath ( os . path . join ( * paths ) ) <EOL> def docx_path ( name ) : <EOL> """<STR_LIT>""" <EOL> return absjoin ( test_file_dir , '<STR_LIT>' % name ) <EOL> def parse_xml_file ( file_ ) : <EOL> """<STR_LIT>""" <EOL> return etree . parse ( file_ , oxml_parser ) <EOL> def snippet_seq ( name , offset = <NUM_LIT:0> , count = sys . maxsize ) : <EOL> """<STR_LIT>""" <EOL> path = os . path . join ( test_file_dir , '<STR_LIT>' , '<STR_LIT>' % name ) <EOL> with open ( path , '<STR_LIT:rb>' ) as f : <EOL> text = f . read ( ) . decode ( '<STR_LIT:utf-8>' ) <EOL> snippets = text . split ( '<STR_LIT>' ) <EOL> start , end = offset , offset + count <EOL> return tuple ( snippets [ start : end ] ) <EOL> def snippet_text ( snippet_file_name ) : <EOL> """<STR_LIT>""" <EOL> snippet_file_path = os . path . join ( <EOL> test_file_dir , '<STR_LIT>' , '<STR_LIT>' % snippet_file_name <EOL> ) <EOL> with open ( snippet_file_path , '<STR_LIT:rb>' ) as f : <EOL> snippet_bytes = f . read ( ) <EOL> return snippet_bytes . decode ( '<STR_LIT:utf-8>' ) <EOL> def testfile ( name ) : <EOL> """<STR_LIT>""" <EOL> return absjoin ( test_file_dir , name ) </s>
