def __init__(self, inRecord, sFile = "", sLine = 0):
        """See help on [Record](./Record.html#metaknowledge.Record) for details"""
        bad = False
        error = None
        fieldDict = None
        try:
            if isinstance(inRecord, dict) or isinstance(inRecord, collections.OrderedDict):
                fieldDict = collections.OrderedDict(inRecord)
            elif isinstance(inRecord, itertools.chain):
                fieldDict = recordParser(inRecord)
            elif isinstance(inRecord, io.IOBase):
                fieldDict = recordParser(enumerate(inRecord))
            elif isinstance(inRecord, str):
                def addChartoEnd(lst):
                    for s in lst:
                        yield s + '\n'
                fieldDict = recordParser(enumerate(addChartoEnd(inRecord.split('\n')), start = 1))
                #string io
            else:
                raise TypeError("Unsupported input type '{}', WOSRecords cannot be created from '{}'".format(inRecord, type(inRecord)))
        except BadWOSRecord as b:
            self.bad = True
            self.error = b
            fieldDict = collections.OrderedDict()
        if fieldDict is not None:
            if 'UT' in fieldDict:
                self._wosNum = fieldDict['UT'][0]
            else:
                self._wosNum = 'WOS:Missing'
                bad = True
                error = BadWOSRecord("Missing WOS number")
        ExtendedRecord.__init__(self, fieldDict, self._wosNum, bad, error, sFile = sFile, sLine = sLine)
def __init__ ( self , inRecord , sFile = "" , sLine = 0 ) : bad = False error = None fieldDict = None try : if isinstance ( inRecord , dict ) or isinstance ( inRecord , collections . OrderedDict ) : fieldDict = collections . OrderedDict ( inRecord ) elif isinstance ( inRecord , itertools . chain ) : fieldDict = recordParser ( inRecord ) elif isinstance ( inRecord , io . IOBase ) : fieldDict = recordParser ( enumerate ( inRecord ) ) elif isinstance ( inRecord , str ) : def addChartoEnd ( lst ) : for s in lst : yield s + '\n' fieldDict = recordParser ( enumerate ( addChartoEnd ( inRecord . split ( '\n' ) ) , start = 1 ) ) else : raise TypeError ( "Unsupported input type '{}', WOSRecords cannot be created from '{}'" . format ( inRecord , type ( inRecord ) ) ) except BadWOSRecord as b : self . bad = True self . error = b fieldDict = collections . OrderedDict ( ) if fieldDict is not None : if 'UT' in fieldDict : self . _wosNum = fieldDict [ 'UT' ] [ 0 ] else : self . _wosNum = 'WOS:Missing' bad = True error = BadWOSRecord ( "Missing WOS number" ) ExtendedRecord . __init__ ( self , fieldDict , self . _wosNum , bad , error , sFile = sFile , sLine = sLine )
See help on [Record](./Record.html#metaknowledge.Record) for details