<s> __author__ = """<STR_LIT>""" <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> from os import getcwd <EOL> from os import sys <EOL> sys . path . append ( getcwd ( ) ) <EOL> from MOAL . helpers . display import Section <EOL> from MOAL . helpers . display import print_success <EOL> from MOAL . helpers . display import print_error <EOL> from MOAL . helpers . display import print_simple <EOL> from itertools import permutations <EOL> DEBUG = True if __name__ == '<STR_LIT:__main__>' else False <EOL> def bigrams ( conditions ) : <EOL> _bigrams = [ ] <EOL> for k , condition in enumerate ( conditions ) : <EOL> if k < len ( conditions ) - <NUM_LIT:1> : <EOL> _bigrams . append ( [ conditions [ k + <NUM_LIT:1> ] , condition , True , False ] ) <EOL> _bigrams . append ( [ conditions [ k + <NUM_LIT:1> ] , condition , True , True ] ) <EOL> _bigrams . append ( [ conditions [ k + <NUM_LIT:1> ] , condition , False , True ] ) <EOL> _bigrams . append ( [ conditions [ k + <NUM_LIT:1> ] , condition , False , False ] ) <EOL> return _bigrams <EOL> if DEBUG : <EOL> with Section ( '<STR_LIT>' ) : <EOL> conditions = [ '<STR_LIT:user>' , '<STR_LIT:email>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> perms = [ p for p in permutations ( conditions ) ] <EOL> print_simple ( '<STR_LIT>' , perms , newline = False ) <EOL> print_error ( '<STR_LIT>' . format ( len ( perms ) ) , prefix = '<STR_LIT>' ) <EOL> bgrams = bigrams ( conditions ) <EOL> print_simple ( '<STR_LIT>' , bgrams , newline = False ) <EOL> print_success ( '<STR_LIT>' . format ( len ( bgrams ) ) , prefix = '<STR_LIT>' ) </s>
