Code Duplication    Length = 11-13 lines in 4 locations

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

@@ 1087-1099 (lines=13) @@
1084
1085
class Sample_Matrices(WorksheetImporter):
1086
1087
    def Import(self):
1088
        folder = self.context.bika_setup.bika_samplematrices
1089
        for row in self.get_rows(3):
1090
            if not row['title']:
1091
                continue
1092
            obj = _createObjectByType("SampleMatrix", folder, tmpID())
1093
            obj.edit(
1094
                title=row['title'],
1095
                description=row.get('description', '')
1096
            )
1097
            obj.unmarkCreationFlag()
1098
            renameAfterCreation(obj)
1099
            notify(ObjectInitializedEvent(obj))
1100
1101
1102
class Batch_Labels(WorksheetImporter):
@@ 1333-1344 (lines=12) @@
1330
1331
class Sampling_Deviations(WorksheetImporter):
1332
1333
    def Import(self):
1334
        folder = self.context.bika_setup.bika_samplingdeviations
1335
        for row in self.get_rows(3):
1336
            if row['title']:
1337
                obj = _createObjectByType("SamplingDeviation", folder, tmpID())
1338
                obj.edit(
1339
                    title=row['title'],
1340
                    description=row.get('description', '')
1341
                )
1342
                obj.unmarkCreationFlag()
1343
                renameAfterCreation(obj)
1344
                notify(ObjectInitializedEvent(obj))
1345
1346
1347
class Calculations(WorksheetImporter):
@@ 1246-1257 (lines=12) @@
1243
1244
class Sample_Conditions(WorksheetImporter):
1245
1246
    def Import(self):
1247
        folder = self.context.bika_setup.bika_sampleconditions
1248
        for row in self.get_rows(3):
1249
            if row['Title']:
1250
                obj = _createObjectByType("SampleCondition", folder, tmpID())
1251
                obj.edit(
1252
                    title=row['Title'],
1253
                    description=row.get('Description', '')
1254
                )
1255
                obj.unmarkCreationFlag()
1256
                renameAfterCreation(obj)
1257
                notify(ObjectInitializedEvent(obj))
1258
1259
1260
class Analysis_Categories(WorksheetImporter):
@@ 616-626 (lines=11) @@
613
614
class Container_Types(WorksheetImporter):
615
616
    def Import(self):
617
        folder = self.context.bika_setup.bika_containertypes
618
        for row in self.get_rows(3):
619
            if not row['title']:
620
                continue
621
            obj = _createObjectByType("ContainerType", folder, tmpID())
622
            obj.edit(title=row['title'],
623
                     description=row.get('description', ''))
624
            obj.unmarkCreationFlag()
625
            renameAfterCreation(obj)
626
            notify(ObjectInitializedEvent(obj))
627
628
629
class Preservations(WorksheetImporter):