<s> """<STR_LIT>""" <EOL> from __future__ import unicode_literals <EOL> import collections <EOL> from nameparser . util import lc <EOL> from nameparser . config . prefixes import PREFIXES <EOL> from nameparser . config . capitalization import CAPITALIZATION_EXCEPTIONS <EOL> from nameparser . config . conjunctions import CONJUNCTIONS <EOL> from nameparser . config . suffixes import SUFFIXES <EOL> from nameparser . config . titles import TITLES <EOL> from nameparser . config . titles import FIRST_NAME_TITLES <EOL> from nameparser . config . regexes import REGEXES <EOL> class SetManager ( collections . Set ) : <EOL> '''<STR_LIT>''' <EOL> def __init__ ( self , elements ) : <EOL> self . elements = set ( elements ) <EOL> def __call__ ( self ) : <EOL> return self . elements <EOL> def __repr__ ( self ) : <EOL> return "<STR_LIT>" . format ( self . elements ) <EOL> def __iter__ ( self ) : <EOL> return iter ( self . elements ) <EOL> def __contains__ ( self , value ) : <EOL> return value in self . elements <EOL> def __len__ ( self ) : <EOL> return len ( self . elements ) <EOL> def next ( self ) : <EOL> return self . __next__ ( ) <EOL> def __next__ ( self ) : <EOL> if self . count >= len ( self . elements ) : <EOL> self . count = <NUM_LIT:0> <EOL> raise StopIteration <EOL> else : <EOL> c = self . count <EOL> self . count = c + <NUM_LIT:1> <EOL> return getattr ( self , self . elements [ c ] ) or next ( self ) <EOL> def add ( self , * strings ) : <EOL> """<STR_LIT>""" <EOL> [ self . elements . add ( lc ( s ) ) for s in strings ] <EOL> return self <EOL> def remove ( self , * strings ) : <EOL> """<STR_LIT>""" <EOL> [ self . elements . remove ( lc ( s ) ) for s in strings if lc ( s ) in self . elements ] <EOL> return self <EOL> class TupleManager ( dict ) : <EOL> '''<STR_LIT>''' <EOL> def __getattr__ ( self , attr ) : <EOL> return self . get ( attr ) <EOL> __setattr__ = dict . __setitem__ <EOL> __delattr__ = dict . __delitem__ <EOL> class Constants ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , <EOL> prefixes = PREFIXES , <EOL> suffixes = SUFFIXES , <EOL> titles = TITLES , <EOL> first_name_titles = FIRST_NAME_TITLES , <EOL> conjunctions = CONJUNCTIONS , <EOL> capitalization_exceptions = CAPITALIZATION_EXCEPTIONS , <EOL> regexes = REGEXES <EOL> ) : <EOL> self . prefixes = SetManager ( prefixes ) <EOL> self . suffixes = SetManager ( suffixes ) <EOL> self . titles = SetManager ( titles ) <EOL> self . first_name_titles = SetManager ( first_name_titles ) <EOL> self . conjunctions = SetManager ( conjunctions ) <EOL> self . capitalization_exceptions = TupleManager ( capitalization_exceptions ) <EOL> self . regexes = TupleManager ( regexes ) <EOL> @ property <EOL> def suffixes_prefixes_titles ( self ) : <EOL> return self . prefixes | self . suffixes | self . titles <EOL> def __repr__ ( self ) : <EOL> return "<STR_LIT>" <EOL> CONSTANTS = Constants ( ) </s>
