<commit_before>"""
TODO
"""
class Regel():


    # All attributes of Regel should be initialized here
    # The rest of the code should not add any attributes.
    def __init__(self):
        # general attributes that should exist in all tiepes (SAPkeys in config)
        self.tiepe = None
        self.order = None
        self.ordernaam = None
        self.kostensoort = None
        self.kostensoortnaam = None
        self.kosten = None
        self.jaar = None
        self.periode = None

        #specific for 'salaris'
        self.personeelsnummer = None
        self.personeelsnaam = None
        self.schaal = None
        self.trede = None

        #specific for obligo
        self.omschrijving = None
        self.documentnummer = None


    def druk_af(self):
        print self.order
        print self.kostensoort
        print self.kosten
        print self.omschrijving


    def copy(self):
        new = Regel()
        for attribute, value in vars(self).iteritems():
            try:
                setattr(new, attribute, value)
            except:
                print 'Warning something went wrong with Regel.copy'
                exit()
        return new

    # Tries to load all available attributes from the db.select result
    # Delete all remaining 'None' attributes to make sure Python gives
    # an error when using an attribute that is not loaded/set.
    def import_from_db_select(self, dbRegel, tiepe, config):
        for attribute in vars(self):
            try:
                dbValue = dbRegel[config["SAPkeys"][tiepe][attribute]]
                setattr(self, attribute, dbValue)
            except:
                pass

        attributes_remove_list = []
        for attribute, value in vars(self).iteritems():
            if value == None:
                attributes_remove_list.append(attribute)

        for attribute in attributes_remove_list:
            delattr(self, attribute)


        #Specific rules per tiepe:
        if tiepe == 'obligo':
            self.omschrijving = self.omschrijving.decode('ascii', 'replace').encode('utf-8')
            self.kosten = float(self.kosten.replace(',',''))
<commit_msg>adds drukaf to regel for all attributes<commit_after>"""
TODO
"""
class Regel():


    # All attributes of Regel should be initialized here
    # The rest of the code should not add any attributes.
    def __init__(self):
        # general attributes that should exist in all tiepes (SAPkeys in config)
        self.tiepe = None
        self.order = None
        self.ordernaam = None
        self.kostensoort = None
        self.kostensoortnaam = None
        self.kosten = None
        self.jaar = None
        self.periode = None

        #specific for 'salaris'
        self.personeelsnummer = None
        self.personeelsnaam = None
        self.schaal = None
        self.trede = None

        #specific for obligo
        self.omschrijving = None
        self.documentnummer = None


    def drukAf(self):
        for attribute, value in vars(self).iteritems():
            print attribute 
            print value
            print ''


    def copy(self):
        new = Regel()
        for attribute, value in vars(self).iteritems():
            try:
                setattr(new, attribute, value)
            except:
                print 'Warning something went wrong with Regel.copy'
                exit()
        return new

    # Tries to load all available attributes from the db.select result
    # Delete all remaining 'None' attributes to make sure Python gives
    # an error when using an attribute that is not loaded/set.
    def import_from_db_select(self, dbRegel, tiepe, config):
        for attribute in vars(self):
            try:
                dbValue = dbRegel[config["SAPkeys"][tiepe][attribute]]
                setattr(self, attribute, dbValue)
            except:
                pass

        attributes_remove_list = []
        for attribute, value in vars(self).iteritems():
            if value == None:
                attributes_remove_list.append(attribute)

        for attribute in attributes_remove_list:
            delattr(self, attribute)


        #Specific rules per tiepe:
        if tiepe == 'obligo':
            self.omschrijving = self.omschrijving.decode('ascii', 'replace').encode('utf-8')
            self.kosten = float(self.kosten.replace(',',''))

{'fraction_non_alphanumeric': 0.08156271418779987, 'fraction_numerical': 0.0004569339730408956, 'mean_word_length': 1.9264705882352942, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5224683', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1166, 'n_words': 364}