Code Duplication    Length = 16-16 lines in 6 locations

myems-api/reports/spaceenergycategory.py 1 location

@@ 203-218 (lines=16) @@
200
                                  " WHERE uuid = %s ", (space_uuid,))
201
            row_space = cursor_system.fetchone()
202
203
        if row_space is None:
204
            if cursor_system:
205
                cursor_system.close()
206
            if cnx_system:
207
                cnx_system.close()
208
209
            if cursor_energy:
210
                cursor_energy.close()
211
            if cnx_energy:
212
                cnx_energy.close()
213
214
            if cursor_historical:
215
                cursor_historical.close()
216
            if cnx_historical:
217
                cnx_historical.close()
218
            raise falcon.HTTPError(status=falcon.HTTP_404, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND')
219
220
        space = dict()
221
        space['id'] = row_space[0]

myems-api/reports/spaceenergyitem.py 1 location

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

myems-api/reports/spaceoutput.py 1 location

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

myems-api/reports/spaceefficiency.py 1 location

@@ 194-209 (lines=16) @@
191
                                  " WHERE uuid = %s ", (space_uuid,))
192
            row_space = cursor_system.fetchone()
193
194
        if row_space 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, title='API.NOT_FOUND', description='API.SPACE_NOT_FOUND')
210
211
        space = dict()
212
        space['id'] = row_space[0]

myems-api/reports/spacestatistics.py 1 location

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

myems-api/reports/spaceload.py 1 location

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