<commit_before># vim: set ts=4 sw=4 et: coding=UTF-8

import os
import datetime

from .rpmsection import Section


class RpmCopyright(Section):

    """
    Class that always creates default SUSE copyright.
    Keeps around Copyrights of other uses and some of the build defines
    that are still relevant. Everything else is ignored.
    """

    def __init__(self, specfile):
        Section.__init__(self, specfile)
        self.copyrights = []
        self.buildrules = []

    def _add_pkg_header(self):
        specname = os.path.splitext(os.path.basename(self.spec))[0]
        self.lines.append('''#
# spec file for package {0}
#'''.format(specname))

    def _create_default_copyright(self):
        year = datetime.datetime.now().year
        return '# Copyright (c) {0} SUSE LINUX GmbH, Nuernberg, Germany.'.format(year)

    def _add_copyright(self):
        my_copyright = self._create_default_copyright()
        self.lines.append(my_copyright)

        for i in self.copyrights:
            self.lines.append(i)

    def _add_default_license(self):
        self.lines.append('''#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a<commit_msg>Use var to store copyright<commit_after># vim: set ts=4 sw=4 et: coding=UTF-8

import os
import datetime

from .rpmsection import Section


class RpmCopyright(Section):

    """
    Class that always creates default SUSE copyright.
    Keeps around Copyrights of other uses and some of the build defines
    that are still relevant. Everything else is ignored.
    """

    def __init__(self, specfile):
        Section.__init__(self, specfile)
        self.copyrights = []
        self.buildrules = []
        self.my_copyright = ''

    def _add_pkg_header(self):
        specname = os.path.splitext(os.path.basename(self.spec))[0]
        self.lines.append('''#
# spec file for package {0}
#'''.format(specname))

    def _create_default_copyright(self):
        year = datetime.datetime.now().year
        self.my_copyright = '# Copyright (c) {0} SUSE LINUX GmbH, Nuernberg, Germany.'.format(year)

    def _add_copyright(self):
        self._create_default_copyright()
        self.lines.append(self.my_copyright)

        for i in self.copyrights:
            self.lines.append(i)

    def _add_default_license(self):
        self.lines.append('''#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
{'fraction_non_alphanumeric': 0.0890302066772655, 'fraction_numerical': 0.0038155802861685214, 'mean_word_length': 3.2861035422343323, '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': '898389', 'n_tokens_mistral': 899, 'n_tokens_neox': 860, 'n_words': 323}