<s> """<STR_LIT>""" <EOL> from __future__ import print_function , division <EOL> from sympy . core import Symbol <EOL> from sympy . logic . boolalg import And , Or <EOL> import re <EOL> def load ( s ) : <EOL> """<STR_LIT>""" <EOL> clauses = [ ] <EOL> lines = s . split ( '<STR_LIT:\n>' ) <EOL> pComment = re . compile ( '<STR_LIT>' ) <EOL> pStats = re . compile ( '<STR_LIT>' ) <EOL> while len ( lines ) > <NUM_LIT:0> : <EOL> line = lines . pop ( <NUM_LIT:0> ) <EOL> if not pComment . match ( line ) : <EOL> m = pStats . match ( line ) <EOL> if not m : <EOL> nums = line . rstrip ( '<STR_LIT:\n>' ) . split ( '<STR_LIT:U+0020>' ) <EOL> list = [ ] <EOL> for lit in nums : <EOL> if lit != '<STR_LIT>' : <EOL> if int ( lit ) == <NUM_LIT:0> : <EOL> continue <EOL> num = abs ( int ( lit ) ) <EOL> sign = True <EOL> if int ( lit ) < <NUM_LIT:0> : <EOL> sign = False <EOL> if sign : <EOL> list . append ( Symbol ( "<STR_LIT>" % num ) ) <EOL> else : <EOL> list . append ( ~ Symbol ( "<STR_LIT>" % num ) ) <EOL> if len ( list ) > <NUM_LIT:0> : <EOL> clauses . append ( Or ( * list ) ) <EOL> return And ( * clauses ) <EOL> def load_file ( location ) : <EOL> """<STR_LIT>""" <EOL> with open ( location ) as f : <EOL> s = f . read ( ) <EOL> return load ( s ) </s>
