def worksheets(self): """The gspread Worksheets recognized by any of the interpreters.""" l = [] for worksheet in self.spreadsheet.worksheets(): try: InterpreterFactory.make_interpreter(self, worksheet.title) l.append(worksheet) except InterpreterNotFound: pass # worksheet not recognized return l
def worksheets(self): '''The gspread Worksheets recognized by any of the interpreters.''' l = [] for worksheet in self.spreadsheet.worksheets(): try: InterpreterFactory.make_interpreter(self, worksheet.title) l.append(worksheet) except InterpreterNotFound: pass # worksheet not recognized return l
def __init__(self): actionSelectorFactory = ActionSelectorFactory() interpreterFactory = InterpreterFactory() InterpreterClass = interpreterFactory.get_interpreter() ActionSelectorClass = ActionSelectorFactory().create() self.profile = PersonProfile() self.working_memory = WorkingMemory() self.a_s = ActionSelectorClass(self.working_memory, self.profile) self.interpreter = InterpreterClass(self.working_memory, self.profile)
def simulate(self, worksheet_name): """ Receives a worksheet name, parses it, and returns a list of annotated dicts with errors and warnings. Example: ish = Importsheet(name='Schools Mapping', project=p, ...) ish.simulate('organization') """ worksheet = self.spreadsheet.worksheet(worksheet_name) worksheet_interpreter = InterpreterFactory.make_interpreter(self, worksheet.title) worksheet_interpreter.parse() return worksheet_interpreter
def simulate(self, worksheet_name): ''' Receives a worksheet name, parses it, and returns a list of annotated dicts with errors and warnings. Example: ish = Importsheet(name='Schools Mapping', project=p, ...) ish.simulate('organization') ''' worksheet = self.spreadsheet.worksheet(worksheet_name) worksheet_interpreter = InterpreterFactory.make_interpreter( self, worksheet.title) worksheet_interpreter.parse() return worksheet_interpreter
def insert(self, worksheet_name): """ Imports data from each one of the worksheets in the spreadsheet. Example: ish = Importsheet(name='Schools Mapping', project=p, ...) ish.insert() """ worksheet = self.spreadsheet.worksheet(worksheet_name) interpreter = InterpreterFactory.make_interpreter(self, worksheet.title) success = interpreter.insert() if success: # link objects to importsheet and to project for obj in interpreter.objects: self.project.save_related_object(obj) self.save_related_object(obj) obj.save() self.inserted = True self.save() return success
def insert(self, worksheet_name): ''' Imports data from each one of the worksheets in the spreadsheet. Example: ish = Importsheet(name='Schools Mapping', project=p, ...) ish.insert() ''' worksheet = self.spreadsheet.worksheet(worksheet_name) interpreter = InterpreterFactory.make_interpreter( self, worksheet.title) success = interpreter.insert() if success: # link objects to importsheet and to project for obj in interpreter.objects: self.project.save_related_object(obj) self.save_related_object(obj) obj.save() self.inserted = True self.save() return success