Code Duplication    Length = 17-18 lines in 6 locations

myems-api/reports/combinedequipmentefficiency.py 1 location

@@ 190-206 (lines=17) @@
187
                                  " WHERE uuid = %s ", (combined_equipment_uuid,))
188
            row_combined_equipment = cursor_system.fetchone()
189
190
        if row_combined_equipment is None:
191
            if cursor_system:
192
                cursor_system.close()
193
            if cnx_system:
194
                cnx_system.close()
195
196
            if cursor_energy:
197
                cursor_energy.close()
198
            if cnx_energy:
199
                cnx_energy.close()
200
201
            if cursor_historical:
202
                cursor_historical.close()
203
            if cnx_historical:
204
                cnx_historical.close()
205
            raise falcon.HTTPError(status=falcon.HTTP_404, title='API.NOT_FOUND',
206
                                   description='API.COMBINED_EQUIPMENT_NOT_FOUND')
207
208
        combined_equipment = dict()
209
        combined_equipment['id'] = row_combined_equipment[0]

myems-api/reports/combinedequipmentstatistics.py 1 location

@@ 194-211 (lines=18) @@
191
                                  " WHERE uuid = %s ", (combined_equipment_uuid,))
192
            row_combined_equipment = cursor_system.fetchone()
193
194
        if row_combined_equipment is None:
195
            if cursor_system:
196
                cursor_system.close()
197
            if cnx_system:
198
                cnx_system.close()
199
200
            if cursor_energy:
201
                cursor_energy.close()
202
            if cnx_energy:
203
                cnx_energy.close()
204
205
            if cursor_historical:
206
                cursor_historical.close()
207
            if cnx_historical:
208
                cnx_historical.close()
209
            raise falcon.HTTPError(status=falcon.HTTP_404,
210
                                   title='API.NOT_FOUND',
211
                                   description='API.COMBINED_EQUIPMENT_NOT_FOUND')
212
213
        combined_equipment = dict()
214
        combined_equipment['id'] = row_combined_equipment[0]

myems-api/reports/combinedequipmentload.py 1 location

@@ 194-211 (lines=18) @@
191
                                  " WHERE uuid = %s ", (combined_equipment_uuid,))
192
            row_combined_equipment = cursor_system.fetchone()
193
194
        if row_combined_equipment is None:
195
            if cursor_system:
196
                cursor_system.close()
197
            if cnx_system:
198
                cnx_system.close()
199
200
            if cursor_energy:
201
                cursor_energy.close()
202
            if cnx_energy:
203
                cnx_energy.close()
204
205
            if cursor_historical:
206
                cursor_historical.close()
207
            if cnx_historical:
208
                cnx_historical.close()
209
            raise falcon.HTTPError(status=falcon.HTTP_404,
210
                                   title='API.NOT_FOUND',
211
                                   description='API.COMBINED_EQUIPMENT_NOT_FOUND')
212
213
        combined_equipment = dict()
214
        combined_equipment['id'] = row_combined_equipment[0]

myems-api/reports/combinedequipmentenergyitem.py 1 location

@@ 194-211 (lines=18) @@
191
                                  " WHERE uuid = %s ", (combined_equipment_uuid,))
192
            row_combined_equipment = cursor_system.fetchone()
193
194
        if row_combined_equipment is None:
195
            if cursor_system:
196
                cursor_system.close()
197
            if cnx_system:
198
                cnx_system.close()
199
200
            if cursor_energy:
201
                cursor_energy.close()
202
            if cnx_energy:
203
                cnx_energy.close()
204
205
            if cursor_historical:
206
                cursor_historical.close()
207
            if cnx_historical:
208
                cnx_historical.close()
209
            raise falcon.HTTPError(status=falcon.HTTP_404,
210
                                   title='API.NOT_FOUND',
211
                                   description='API.COMBINED_EQUIPMENT_NOT_FOUND')
212
213
        combined_equipment = dict()
214
        combined_equipment['id'] = row_combined_equipment[0]

myems-api/reports/combinedequipmentoutput.py 1 location

@@ 194-211 (lines=18) @@
191
                                  " WHERE uuid = %s ", (combined_equipment_uuid,))
192
            row_combined_equipment = cursor_system.fetchone()
193
194
        if row_combined_equipment is None:
195
            if cursor_system:
196
                cursor_system.close()
197
            if cnx_system:
198
                cnx_system.close()
199
200
            if cursor_energy:
201
                cursor_energy.close()
202
            if cnx_energy:
203
                cnx_energy.close()
204
205
            if cursor_historical:
206
                cursor_historical.close()
207
            if cnx_historical:
208
                cnx_historical.close()
209
            raise falcon.HTTPError(status=falcon.HTTP_404,
210
                                   title='API.NOT_FOUND',
211
                                   description='API.COMBINED_EQUIPMENT_NOT_FOUND')
212
213
        combined_equipment = dict()
214
        combined_equipment['id'] = row_combined_equipment[0]

myems-api/reports/combinedequipmentenergycategory.py 1 location

@@ 194-211 (lines=18) @@
191
                                  " WHERE uuid = %s ", (combined_equipment_uuid,))
192
            row_combined_equipment = cursor_system.fetchone()
193
194
        if row_combined_equipment is None:
195
            if cursor_system:
196
                cursor_system.close()
197
            if cnx_system:
198
                cnx_system.close()
199
200
            if cursor_energy:
201
                cursor_energy.close()
202
            if cnx_energy:
203
                cnx_energy.close()
204
205
            if cursor_historical:
206
                cursor_historical.close()
207
            if cnx_historical:
208
                cnx_historical.close()
209
            raise falcon.HTTPError(status=falcon.HTTP_404,
210
                                   title='API.NOT_FOUND',
211
                                   description='API.COMBINED_EQUIPMENT_NOT_FOUND')
212
213
        combined_equipment = dict()
214
        combined_equipment['id'] = row_combined_equipment[0]