<s> '''<STR_LIT>''' <EOL> import os <EOL> from arelle import XmlUtil <EOL> from arelle . ModelObject import ModelObject <EOL> edgr = "<STR_LIT>" <EOL> edgrDescription = "<STR_LIT>" <EOL> edgrFile = "<STR_LIT>" <EOL> edgrSequence = "<STR_LIT>" <EOL> edgrType = "<STR_LIT>" <EOL> edgrUrl = "<STR_LIT>" <EOL> newRssWatchOptions = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : None , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : False , <EOL> "<STR_LIT>" : False , <EOL> "<STR_LIT>" : False , <EOL> "<STR_LIT>" : False , <EOL> "<STR_LIT>" : False , <EOL> "<STR_LIT>" : False , <EOL> "<STR_LIT>" : False , <EOL> "<STR_LIT>" : None , <EOL> } <EOL> class ModelRssItem ( ModelObject ) : <EOL> def init ( self , modelDocument ) : <EOL> super ( ModelRssItem , self ) . init ( modelDocument ) <EOL> try : <EOL> if ( self . modelXbrl . modelManager . rssWatchOptions . latestPubDate and <EOL> self . pubDate <= self . modelXbrl . modelManager . rssWatchOptions . latestPubDate ) : <EOL> self . status = _ ( "<STR_LIT>" ) <EOL> else : <EOL> self . status = _ ( "<STR_LIT>" ) <EOL> except AttributeError : <EOL> self . status = _ ( "<STR_LIT>" ) <EOL> self . results = None <EOL> self . assertions = None <EOL> @ property <EOL> def cikNumber ( self ) : <EOL> return XmlUtil . text ( XmlUtil . descendant ( self , edgr , "<STR_LIT>" ) ) <EOL> @ property <EOL> def accessionNumber ( self ) : <EOL> return XmlUtil . text ( XmlUtil . descendant ( self , edgr , "<STR_LIT>" ) ) <EOL> @ property <EOL> def fileNumber ( self ) : <EOL> return XmlUtil . text ( XmlUtil . descendant ( self , edgr , "<STR_LIT>" ) ) <EOL> @ property <EOL> def companyName ( self ) : <EOL> return XmlUtil . text ( XmlUtil . descendant ( self , edgr , "<STR_LIT>" ) ) <EOL> @ property <EOL> def formType ( self ) : <EOL> return XmlUtil . text ( XmlUtil . descendant ( self , edgr , "<STR_LIT>" ) ) <EOL> @ property <EOL> def pubDate ( self ) : <EOL> try : <EOL> return self . _pubDate <EOL> except AttributeError : <EOL> from arelle . UrlUtil import parseRfcDatetime <EOL> self . _pubDate = parseRfcDatetime ( XmlUtil . text ( XmlUtil . descendant ( self , None , "<STR_LIT>" ) ) ) <EOL> return self . _pubDate <EOL> @ property <EOL> def filingDate ( self ) : <EOL> try : <EOL> return self . _filingDate <EOL> except AttributeError : <EOL> import datetime <EOL> self . _filingDate = None <EOL> date = XmlUtil . text ( XmlUtil . descendant ( self , edgr , "<STR_LIT>" ) ) <EOL> d = date . split ( "<STR_LIT:/>" ) <EOL> if d and len ( d ) == <NUM_LIT:3> : <EOL> self . _filingDate = datetime . date ( _INT ( d [ <NUM_LIT:2> ] ) , _INT ( d [ <NUM_LIT:0> ] ) , _INT ( d [ <NUM_LIT:1> ] ) ) <EOL> return self . _filingDate <EOL> @ property <EOL> def period ( self ) : <EOL> per = XmlUtil . text ( XmlUtil . descendant ( self , edgr , "<STR_LIT>" ) ) <EOL> if per and len ( per ) == <NUM_LIT:8> : <EOL> return "<STR_LIT>" . format ( per [ <NUM_LIT:0> : <NUM_LIT:4> ] , per [ <NUM_LIT:4> : <NUM_LIT:6> ] , per [ <NUM_LIT:6> : <NUM_LIT:8> ] ) <EOL> return None <EOL> @ property <EOL> def assignedSic ( self ) : <EOL> return XmlUtil . text ( XmlUtil . descendant ( self , edgr , "<STR_LIT>" ) ) <EOL> @ property <EOL> def acceptanceDatetime ( self ) : <EOL> try : <EOL> return self . _acceptanceDatetime <EOL> except AttributeError : <EOL> import datetime <EOL> self . _acceptanceDatetime = None <EOL> date = XmlUtil . text ( XmlUtil . descendant ( self , edgr , "<STR_LIT>" ) ) <EOL> if date and len ( date ) == <NUM_LIT> : <EOL> self . _acceptanceDatetime = datetime . datetime ( _INT ( date [ <NUM_LIT:0> : <NUM_LIT:4> ] ) , _INT ( date [ <NUM_LIT:4> : <NUM_LIT:6> ] ) , _INT ( date [ <NUM_LIT:6> : <NUM_LIT:8> ] ) , _INT ( date [ <NUM_LIT:8> : <NUM_LIT:10> ] ) , _INT ( date [ <NUM_LIT:10> : <NUM_LIT:12> ] ) , _INT ( date [ <NUM_LIT:12> : <NUM_LIT> ] ) ) <EOL> return self . _acceptanceDatetime <EOL> @ property <EOL> def fiscalYearEnd ( self ) : <EOL> yrEnd = XmlUtil . text ( XmlUtil . descendant ( self , edgr , "<STR_LIT>" ) ) <EOL> if yrEnd and len ( yrEnd ) == <NUM_LIT:4> : <EOL> return "<STR_LIT>" . format ( yrEnd [ <NUM_LIT:0> : <NUM_LIT:2> ] , yrEnd [ <NUM_LIT:2> : <NUM_LIT:4> ] ) <EOL> return None <EOL> @ property <EOL> def htmlUrl ( self ) : <EOL> htmlDocElt = XmlUtil . descendant ( self , edgr , "<STR_LIT>" , attrName = edgrSequence , attrValue = "<STR_LIT:1>" ) <EOL> if htmlDocElt is not None : <EOL> return htmlDocElt . get ( edgrUrl ) <EOL> return None <EOL> @ property <EOL> def url ( self ) : <EOL> try : <EOL> return self . _url <EOL> except AttributeError : <EOL> self . _url = None <EOL> for instDocElt in XmlUtil . descendants ( self , edgr , "<STR_LIT>" ) : <EOL> if instDocElt . get ( edgrType ) . endswith ( "<STR_LIT>" ) : <EOL> self . _url = instDocElt . get ( edgrUrl ) <EOL> break <EOL> return self . _url <EOL> @ property <EOL> def zippedUrl ( self ) : <EOL> enclosure = XmlUtil . childAttr ( self , None , "<STR_LIT>" , "<STR_LIT:url>" ) <EOL> if enclosure : <EOL> path , sep , file = self . url . rpartition ( "<STR_LIT:/>" ) <EOL> return enclosure + sep + file <EOL> else : <EOL> return self . url <EOL> @ property <EOL> def htmURLs ( self ) : <EOL> try : <EOL> return self . _htmURLs <EOL> except AttributeError : <EOL> self . _htmURLs = [ <EOL> ( instDocElt . get ( edgrDescription ) , instDocElt . get ( edgrUrl ) ) <EOL> for instDocElt in XmlUtil . descendants ( self , edgr , "<STR_LIT>" ) <EOL> if instDocElt . get ( edgrFile ) . endswith ( "<STR_LIT>" ) ] <EOL> return self . _htmURLs <EOL> @ property <EOL> def primaryDocumentURL ( self ) : <EOL> try : <EOL> return self . _primaryDocumentURL <EOL> except AttributeError : <EOL> formType = self . formType <EOL> self . _primaryDocumentURL = None <EOL> for instDocElt in XmlUtil . descendants ( self , edgr , "<STR_LIT>" ) : <EOL> if instDocElt . get ( edgrType ) == formType : <EOL> self . _primaryDocumentURL = instDocElt . get ( edgrUrl ) <EOL> break <EOL> return self . _primaryDocumentURL <EOL> def setResults ( self , modelXbrl ) : <EOL> self . results = [ ] <EOL> self . assertionUnsuccessful = False <EOL> self . status = "<STR_LIT>" <EOL> for error in modelXbrl . errors : <EOL> if isinstance ( error , dict ) : <EOL> self . assertions = error <EOL> for countSuccessful , countNotsuccessful in error . items ( ) : <EOL> if countNotsuccessful > <NUM_LIT:0> : <EOL> self . assertionUnsuccessful = True <EOL> self . status = "<STR_LIT>" <EOL> else : <EOL> self . results . append ( error ) <EOL> self . status = "<STR_LIT>" <EOL> self . results . sort ( ) <EOL> @ property <EOL> def propertyView ( self ) : <EOL> return ( ( "<STR_LIT>" , self . cikNumber ) , <EOL> ( "<STR_LIT>" , self . companyName ) , <EOL> ( "<STR_LIT>" , self . pubDate ) , <EOL> ( "<STR_LIT>" , self . formType ) , <EOL> ( "<STR_LIT>" , self . filingDate ) , <EOL> ( "<STR_LIT>" , self . period ) , <EOL> ( "<STR_LIT>" , self . fiscalYearEnd ) , <EOL> ( "<STR_LIT:status>" , self . status ) , <EOL> ( "<STR_LIT>" , os . path . basename ( self . url ) ) , <EOL> ) <EOL> def __repr__ ( self ) : <EOL> return ( "<STR_LIT>" . format ( self . objectId ( ) , self . propertyView ) ) </s>
