<s> """<STR_LIT>""" <EOL> import re <EOL> from . . datasources import revision_oriented <EOL> from . . dependencies import DependentSet <EOL> from . feature import Feature <EOL> from . meta import bools <EOL> class Revision ( DependentSet ) : <EOL> def __init__ ( self , name , revision_datasources ) : <EOL> super ( ) . __init__ ( name ) <EOL> self . datasources = revision_datasources <EOL> if hasattr ( revision_datasources , '<STR_LIT>' ) : <EOL> self . parent = Revision ( <EOL> name + "<STR_LIT>" , <EOL> revision_datasources . parent <EOL> ) <EOL> """<STR_LIT>""" <EOL> if hasattr ( revision_datasources , '<STR_LIT>' ) : <EOL> self . page = Page ( <EOL> name + "<STR_LIT>" , <EOL> revision_datasources . page <EOL> ) <EOL> """<STR_LIT>""" <EOL> if hasattr ( revision_datasources , '<STR_LIT:user>' ) : <EOL> self . user = User ( <EOL> name + "<STR_LIT>" , <EOL> revision_datasources . user <EOL> ) <EOL> """<STR_LIT>""" <EOL> def comment_matches ( self , regex , name = None ) : <EOL> """<STR_LIT>""" <EOL> if not hasattr ( regex , '<STR_LIT>' ) : <EOL> regex = re . compile ( regex , re . I ) <EOL> if name is None : <EOL> name = "<STR_LIT>" . format ( self . _name + "<STR_LIT>" , <EOL> repr ( regex . pattern ) ) <EOL> return bools . regex_match ( regex , self . datasources . comment , <EOL> name = name ) <EOL> class Page ( DependentSet ) : <EOL> def __init__ ( self , name , page_datasources ) : <EOL> super ( ) . __init__ ( name ) <EOL> self . datasources = page_datasources <EOL> if hasattr ( page_datasources , "<STR_LIT>" ) : <EOL> self . namespace = Namespace ( name + "<STR_LIT>" , <EOL> page_datasources . namespace ) <EOL> """<STR_LIT>""" <EOL> def id_in_set ( self , ids , name = None ) : <EOL> """<STR_LIT>""" <EOL> if name is None : <EOL> name = "<STR_LIT>" . format ( self . _name + "<STR_LIT>" , repr ( ids ) ) <EOL> return bools . set_contains_item ( ids , self . datasources . id , name = name ) <EOL> def title_matches ( self , regex , name = None ) : <EOL> """<STR_LIT>""" <EOL> if not hasattr ( regex , '<STR_LIT>' ) : <EOL> regex = re . compile ( regex , re . I ) <EOL> if name is None : <EOL> name = "<STR_LIT>" . format ( self . _name + "<STR_LIT>" , <EOL> repr ( regex . pattern ) ) <EOL> return bools . regex_match ( regex , self . datasources . title , name = name ) <EOL> class Namespace ( DependentSet ) : <EOL> def __init__ ( self , name , namespace_datasources ) : <EOL> super ( ) . __init__ ( name ) <EOL> self . datasources = namespace_datasources <EOL> def id_in_set ( self , ids , name = None ) : <EOL> """<STR_LIT>""" <EOL> if name is None : <EOL> name = "<STR_LIT>" . format ( self . _name + "<STR_LIT>" , repr ( ids ) ) <EOL> return bools . set_contains_item ( ids , self . datasources . id , name = name ) <EOL> def name_matches ( self , regex , name = None ) : <EOL> """<STR_LIT>""" <EOL> if not hasattr ( regex , '<STR_LIT>' ) : <EOL> regex = re . compile ( regex , re . I ) <EOL> if name is None : <EOL> name = "<STR_LIT>" . format ( self . _name + "<STR_LIT>" , <EOL> repr ( regex . pattern ) ) <EOL> return bools . regex_match ( regex , self . datasources . name , name = name ) <EOL> class User ( DependentSet ) : <EOL> def __init__ ( self , name , user_datasources ) : <EOL> super ( ) . __init__ ( name ) <EOL> self . datasources = user_datasources <EOL> self . is_anon = Feature ( self . _name + "<STR_LIT>" , _process_is_anon , <EOL> returns = bool , depends_on = [ self . datasources . id ] ) <EOL> def id_in_set ( self , ids , name = None ) : <EOL> """<STR_LIT>""" <EOL> if name is None : <EOL> name = "<STR_LIT>" . format ( self . _name + "<STR_LIT>" , repr ( ids ) ) <EOL> return bools . set_contains_item ( ids , self . datasources . id , <EOL> name = name ) <EOL> def text_matches ( self , regex , name = None ) : <EOL> """<STR_LIT>""" <EOL> if not hasattr ( regex , '<STR_LIT>' ) : <EOL> regex = re . compile ( regex , re . I ) <EOL> if name is None : <EOL> name = "<STR_LIT>" . format ( self . _name + "<STR_LIT>" , <EOL> repr ( regex . pattern ) ) <EOL> return bools . regex_match ( regex , self . datasources . text , name = name ) <EOL> def in_group ( self , groups , name = None ) : <EOL> """<STR_LIT>""" <EOL> if name is None : <EOL> name = "<STR_LIT>" . format ( self . _name + "<STR_LIT>" , <EOL> repr ( groups ) ) <EOL> return bools . sets_intersect ( groups , self . datasources . info . groups , <EOL> name = name ) <EOL> def _process_is_anon ( user_id ) : <EOL> return user_id == <NUM_LIT:0> <EOL> revision = Revision ( "<STR_LIT>" , revision_oriented . revision ) <EOL> """<STR_LIT>""" </s>
