Code Duplication    Length = 16-16 lines in 6 locations

myems-api/reports/equipmentefficiency.py 1 location

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

myems-api/reports/equipmentload.py 1 location

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

myems-api/reports/equipmentenergyitem.py 1 location

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

myems-api/reports/equipmentenergycategory.py 1 location

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

myems-api/reports/equipmentstatistics.py 1 location

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

myems-api/reports/equipmentoutput.py 1 location

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