Code Duplication    Length = 11-13 lines in 4 locations

bika/lims/exportimport/setupdata/__init__.py 4 locations

@@ 1100-1112 (lines=13) @@
1097
1098
class Sample_Matrices(WorksheetImporter):
1099
1100
    def Import(self):
1101
        folder = self.context.bika_setup.bika_samplematrices
1102
        for row in self.get_rows(3):
1103
            if not row['title']:
1104
                continue
1105
            obj = _createObjectByType("SampleMatrix", folder, tmpID())
1106
            obj.edit(
1107
                title=row['title'],
1108
                description=row.get('description', '')
1109
            )
1110
            obj.unmarkCreationFlag()
1111
            renameAfterCreation(obj)
1112
            notify(ObjectInitializedEvent(obj))
1113
1114
1115
class Batch_Labels(WorksheetImporter):
@@ 1346-1357 (lines=12) @@
1343
1344
class Sampling_Deviations(WorksheetImporter):
1345
1346
    def Import(self):
1347
        folder = self.context.bika_setup.bika_samplingdeviations
1348
        for row in self.get_rows(3):
1349
            if row['title']:
1350
                obj = _createObjectByType("SamplingDeviation", folder, tmpID())
1351
                obj.edit(
1352
                    title=row['title'],
1353
                    description=row.get('description', '')
1354
                )
1355
                obj.unmarkCreationFlag()
1356
                renameAfterCreation(obj)
1357
                notify(ObjectInitializedEvent(obj))
1358
1359
1360
class Calculations(WorksheetImporter):
@@ 1259-1270 (lines=12) @@
1256
1257
class Sample_Conditions(WorksheetImporter):
1258
1259
    def Import(self):
1260
        folder = self.context.bika_setup.bika_sampleconditions
1261
        for row in self.get_rows(3):
1262
            if row['title']:
1263
                obj = _createObjectByType("SampleCondition", folder, tmpID())
1264
                obj.edit(
1265
                    title=row['title'],
1266
                    description=row.get('description', '')
1267
                )
1268
                obj.unmarkCreationFlag()
1269
                renameAfterCreation(obj)
1270
                notify(ObjectInitializedEvent(obj))
1271
1272
1273
class Analysis_Categories(WorksheetImporter):
@@ 629-639 (lines=11) @@
626
627
class Container_Types(WorksheetImporter):
628
629
    def Import(self):
630
        folder = self.context.bika_setup.bika_containertypes
631
        for row in self.get_rows(3):
632
            if not row['title']:
633
                continue
634
            obj = _createObjectByType("ContainerType", folder, tmpID())
635
            obj.edit(title=row['title'],
636
                     description=row.get('description', ''))
637
            obj.unmarkCreationFlag()
638
            renameAfterCreation(obj)
639
            notify(ObjectInitializedEvent(obj))
640
641
642
class Preservations(WorksheetImporter):