KOSASIH / cosmic-pi-network

Re-defined variable from outer scope PYL-W0621
Anti-pattern
Major
3 months ago3 months old
Redefining name 'data' from outer scope (line 23)
 8    data = pd.read_csv(file_path)
 9    return data
10
11def visualize_results(data):12    """
13    Visualize the analysis results
14    """
Redefining name 'data' from outer scope (line 23)
 5    """
 6    Load data from a CSV file
 7    """
 8    data = pd.read_csv(file_path) 9    return data
10
11def visualize_results(data):
Redefining name 'file_path' from outer scope (line 22)
 1import matplotlib.pyplot as plt
 2import pandas as pd
 3
 4def load_data(file_path): 5    """
 6    Load data from a CSV file
 7    """
Redefining name 'model' from outer scope (line 33)
20    model.fit(X_train, y_train)
21    return model
22
23def save_model(model, file_path):24    """
25    Save the trained model to a file
26    """
Redefining name 'file_path' from outer scope (line 31)
20    model.fit(X_train, y_train)
21    return model
22
23def save_model(model, file_path):24    """
25    Save the trained model to a file
26    """