I've been getting this error on xcode and vi. Python says the line class LeastModel has an IndentationError: expected an indented block. I checked my preferences on Xcode to use 4 spaces for a tab and everywhere I've been using tab. Please help me!
def make_model(data,model):
class LeastModel():
"""
linear system solved using linear least squares
This class serves as an example that fulfills the model interface needed by the ransa function.
"""
def __init__(self,input_columns,output_columns):
self.input_columns = input_columns
self.output_columns = output_columns
#self.debug = debug
Your problem is that you have no indented code after the line:
def make_model(data,model):
You can either:
Get rid of that line
Write some indented code into the body of that function
Indent your entire class definition so that you are defining the class LeastModel
within the function.
Judging by the fact that you called your function make_model
and your class LeastModel
, I think you somehow intended to put the class definition within the function. But this might be a mistake on your part- note that if you define it in a function, you won't be able to use the class outside of the function (unless you return the class itself from the function, with the line return LeastModel
.