Brainiac11 / My-Projects

Re-defined variable from outer scope PYL-W0621
Anti-pattern
Major
8 occurrences in this check
Redefining name 'y' from outer scope (line 212)
172        def main():
173            # observations / data
174            x = np.array(data_point_list_x)
175            y = np.array(data_point_list_y)176
177            # estimating coefficients
178            b = estimate_coef(x, y)
Redefining name 'x' from outer scope (line 78)
171
172        def main():
173            # observations / data
174            x = np.array(data_point_list_x)175            y = np.array(data_point_list_y)
176
177            # estimating coefficients
Redefining name 'y' from outer scope (line 212)
150            return (b_0, b_1)
151
152
153        def plot_regression_line(x, y, b):154            # plotting the actual points as scatter plot
155            plt.scatter(x, y, color="m",
156                        marker="o", s=30)
Redefining name 'x' from outer scope (line 78)
150            return (b_0, b_1)
151
152
153        def plot_regression_line(x, y, b):154            # plotting the actual points as scatter plot
155            plt.scatter(x, y, color="m",
156                        marker="o", s=30)
Redefining name 'y' from outer scope (line 212)
131        
132        operatorReaction(x)
133        operatorReaction2(x)
134        def estimate_coef(x, y):135            # number of observations/points
136            n = np.size(x)
137
Redefining name 'x' from outer scope (line 78)
131        
132        operatorReaction(x)
133        operatorReaction2(x)
134        def estimate_coef(x, y):135            # number of observations/points
136            n = np.size(x)
137
Redefining name 'x' from outer scope (line 78)
106                print("Enter a valid function try again! ")
107                exit()
108                
109        def operatorReaction2(x):110            if function[index] in multiplication:
111                y_value = x * float(function[index+1])
112                ys.append(y_value)
Redefining name 'x' from outer scope (line 78)
 94                i=1
 95            index = index + 1
 96            
 97        def operatorReaction(x): 98            if function[index] in addition:
 99                y_value = x + float(function[index+1])
100                ys.append(y_value)