Showing 5,781 of 10,536 total issues

Avoid deeply nested control flow statements.
Open

                    if len(current_point_value_list) > 0:
                        point_value_dict[previous_point_id] = current_point_value_list
                        current_point_value_list = list()

Severity: Major
Found in myems-cleaning/clean_energy_value.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            for row in rows:
                                point_values_dict[point['point_id']][row[0]] = row[1]
                        else:
    Severity: Major
    Found in myems-normalization/virtualpoint.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if current_factor is not None \
                                  and isinstance(current_factor, Decimal) \
                                  and current_energy is not None \
                                  and isinstance(current_energy, Decimal):
                              carbon_dict[current_datetime_utc] = current_energy * current_factor
      Severity: Major
      Found in myems-aggregation/energy_storage_container_carbon_charge.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                for i in range(len(energy_data_list)):
                                    for item in (energy_data_list[i]['date_time_utc'],):
                                        date_time_utc_list.append(item)
        
        
        Severity: Major
        Found in myems-normalization/datarepair.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if common_start_datetime_utc < min(energy_hourly.keys()):
                                  common_start_datetime_utc = min(energy_hourly.keys())
                              if common_end_datetime_utc > max(energy_hourly.keys()):
          Severity: Major
          Found in myems-aggregation/tenant_energy_input_category.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if common_end_datetime_utc > max(energy_hourly.keys()):
                                    common_end_datetime_utc = max(energy_hourly.keys())
            
            
            Severity: Major
            Found in myems-aggregation/tenant_energy_input_category.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if current_tariff is not None \
                                          and isinstance(current_tariff, Decimal) \
                                          and current_energy is not None \
                                          and isinstance(current_energy, Decimal):
                                      billing_dict[current_datetime_utc] = current_energy * current_tariff
              Severity: Major
              Found in myems-aggregation/energy_storage_container_billing_discharge.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        for energy_category_id in energy_category_list:
                                            current_carbon = carbon_dict[current_datetime_utc].get(energy_category_id)
                                            if current_carbon is not None and isinstance(current_carbon, Decimal):
                                                add_values += " (" + str(combined_equipment['id']) + ","
                                                add_values += " " + str(energy_category_id) + ","
                Severity: Major
                Found in myems-aggregation/combined_equipment_carbon_input_category.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      for row_offline_meter in rows_offline_meters:
                                          # valid offline meter id in excel file
                                          offline_meter_id_set.add(row_offline_meter[0])
                  
                  
                  Severity: Major
                  Found in myems-normalization/offlinemeter.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        for rows_point in rows_points:
                                            # valid point id in excel file
                                            system_point_id_set.add(rows_point[0])
                    
                    
                    Severity: Major
                    Found in myems-normalization/datarepair.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if cursor:
                                                  cursor.close()
                                              if cnx:
                      Severity: Major
                      Found in myems-normalization/datarepair.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if common_end_datetime_utc > max(energy_hourly.keys()):
                                                common_end_datetime_utc = max(energy_hourly.keys())
                        
                        
                        Severity: Major
                        Found in myems-normalization/virtualmeter.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  for energy_category_id in energy_category_list:
                                                      current_billing = billing_dict[current_datetime_utc].get(energy_category_id)
                                                      if current_billing is not None and isinstance(current_billing, Decimal):
                                                          add_values += " (" + str(combined_equipment['id']) + ","
                                                          add_values += " " + str(energy_category_id) + ","
                          Severity: Major
                          Found in myems-aggregation/combined_equipment_billing_input_category.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if aggregated_value['actual_value'] is not None and \
                                                            isinstance(aggregated_value['actual_value'], Decimal):
                                                        add_values += " (" + str(meter['id']) + ","
                                                        add_values += "'" + aggregated_value['start_datetime_utc'].isoformat()[0:19] + "',"
                                                        add_values += str(aggregated_value['actual_value']) + "), "
                            Severity: Major
                            Found in myems-aggregation/meter_billing.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  for energy_category_id in energy_category_list:
                                                      current_tariff = tariff_dict[energy_category_id].get(current_datetime_utc)
                                                      current_energy = energy_dict[current_datetime_utc].get(energy_category_id)
                                                      if current_tariff is not None \
                                                              and isinstance(current_tariff, Decimal) \
                              Severity: Major
                              Found in myems-aggregation/equipment_billing_output_category.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    for energy_category_id in energy_category_list:
                                                        current_tariff = tariff_dict[energy_category_id].get(current_datetime_utc)
                                                        current_energy = energy_dict[current_datetime_utc].get(energy_category_id)
                                                        if current_tariff is not None \
                                                                and isinstance(current_tariff, Decimal) \
                                Severity: Major
                                Found in myems-aggregation/shopfloor_billing_input_category.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          if aggregated_value['actual_value'] is not None and \
                                                                  isinstance(aggregated_value['actual_value'], Decimal):
                                                              add_values += " (" + str(virtual_meter['id']) + ","
                                                              add_values += "'" + aggregated_value['start_datetime_utc'].isoformat()[0:19] + "',"
                                                              add_values += str(aggregated_value['actual_value']) + "), "
                                  Severity: Major
                                  Found in myems-aggregation/virtual_meter_carbon.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            if current_datetime_utc not in energy_equipment_hourly[equipment_id]:
                                                                energy_equipment_hourly[equipment_id][current_datetime_utc] = dict()
                                                            energy_item_id = row_value[1]
                                    Severity: Major
                                    Found in myems-aggregation/space_energy_input_item.py - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                          if common_start_datetime_utc < min(energy_hourly.keys()):
                                                              common_start_datetime_utc = min(energy_hourly.keys())
                                                          if common_end_datetime_utc > max(energy_hourly.keys()):
                                      Severity: Major
                                      Found in myems-aggregation/combined_equipment_energy_input_category.py - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                            for energy_item_id in energy_item_list:
                                                                current_tariff = tariff_dict[energy_item_id].get(current_datetime_utc)
                                                                current_energy = energy_dict[current_datetime_utc].get(energy_item_id)
                                                                if current_tariff is not None \
                                                                        and isinstance(current_tariff, Decimal) \
                                        Severity: Major
                                        Found in myems-aggregation/space_billing_input_item.py - About 45 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language