vallettea / koala

Transpose your Excel calculations into python for better performances and scaling.
GNU General Public License v3.0
143 stars 60 forks source link

Merging fix of Spreadsheet/ExcelCompiler, updated tests, Attempt 3 #222

Closed bradbase closed 4 years ago

bradbase commented 4 years ago
bradbase commented 4 years ago

I have run all the tests on my machine, all pass. Have also run both examples, both run. And the Travis tests (above Python 2.7 run)

bradbase commented 4 years ago

needs a bugfix.

bradbase commented 4 years ago

The bug I thought was there isn't.

bradbase commented 4 years ago

There is certainly a bug.

It's not likely to affect the majority of users but is having an impact on my use case. So I'd say this PR is still ok.

I'm having trouble characterizing the bug though.

The bug is related to gen_graph no longer behaving correctly. Calling gen_graph looses state when you call it with arguments.

So this is fine: from koala.ExcelCompiler import ExcelCompiler from koala.tokenizer import ExcelParser excel_compiler = ExcelCompiler(file_name, ignore_sheets=ignore_sheets) excel_compiler.clean_pointer() excel_compiler.gen_graph()

This is also fine: from koala.ExcelCompiler import ExcelCompiler from koala.tokenizer import ExcelParser from koala.Spreadsheet import Spreadsheet excel_compiler = Spreadsheet.from_file_name(file_name, ignore_sheets=ignore_sheets) excel_compiler.clean_pointer() excel_compiler.gen_graph()

This looses named ranges: from koala.ExcelCompiler import ExcelCompiler from koala.tokenizer import ExcelParser excel_compiler = ExcelCompiler(file_name, ignore_sheets=ignore_sheets) excel_compiler.clean_pointer() parser = ExcelParser() tokens = parser.parse(model.formula) inputs = parser.getOperandRanges() excel_compiler.gen_graph(inputs=["Temp_min", "Temp_max"], outputs=["GrowingDegreesDay"])

And so does this: from koala.ExcelCompiler import ExcelCompiler from koala.tokenizer import ExcelParser from koala.Spreadsheet import Spreadsheet excel_compiler = Spreadsheet.from_file_name(file_name, ignore_sheets=ignore_sheets) excel_compiler.clean_pointer() parser = ExcelParser() tokens = parser.parse(model.formula) inputs = parser.getOperandRanges() excel_compiler.gen_graph(inputs=["Temp_min", "Temp_max"], outputs=["GrowingDegreesDay"])

I think it's to do with the call to read_named_ranges(). Moving the gen_graph method from ExcelCompiler to the Spreadsheet object has interrupted something or put it out of order.

bradbase commented 4 years ago

Have fixed it. Will issue a new PR.