<commit_before>from fusesoc import section
from fusesoc.fusesocconfigparser import FusesocConfigParser
from fusesoc.config import Config
import os
import logging

logger = logging.getLogger(__name__)

class System:
    def __init__(self, system_file):
        self.backend_name = None

        self.system_root = os.path.dirname(system_file)
        self.config = FusesocConfigParser(system_file)

        self.name = os.path.basename(system_file).split('.')[0]

        self.pre_build_scripts  = self.config.get_list('scripts','pre_build_scripts')
        self.post_build_scripts = self.config.get_list('scripts','post_build_scripts')

        if self.config.has_option('main', 'backend'):
            self.backend_name = self.config.get('main','backend')
            self.backend = section.load_section(self.config, self.backend_name,
                    name=self.name)


    def info(self):
        print("\nSYSTEM INFO")
        print("Name:                   " + self.name)

        show_list = lambda s: "\n                        ".join(s.split('\n'))

        if self.backend_name:
            print("Backend name:           " + self.backend_name)
            print("    family:             " + self.backend['family'])
            print("    device:             " + self.backend['device'])

            print("\n    tcl_files:          " + show_list(self.backend['tcl_files']))
            print("\n    sdc_files:          " + show_list(self.backend['sdc_files']))
<commit_msg>system.py: Fix system-info after section refactoring<commit_after>from fusesoc import section
from fusesoc.fusesocconfigparser import FusesocConfigParser
from fusesoc.config import Config
import os
import logging

logger = logging.getLogger(__name__)

class System:
    def __init__(self, system_file):
        self.backend_name = None

        self.system_root = os.path.dirname(system_file)
        self.config = FusesocConfigParser(system_file)

        self.name = os.path.basename(system_file).split('.')[0]

        self.pre_build_scripts  = self.config.get_list('scripts','pre_build_scripts')
        self.post_build_scripts = self.config.get_list('scripts','post_build_scripts')

        if self.config.has_option('main', 'backend'):
            self.backend_name = self.config.get('main','backend')
            self.backend = section.load_section(self.config, self.backend_name,
                    name=self.name)


    def info(self):
        print("\nSYSTEM INFO")
        print(self.backend)
{'fraction_non_alphanumeric': 0.11646586345381527, 'fraction_numerical': 0.0008032128514056225, 'mean_word_length': 2.6471449487554906, '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': '2529612', 'n_tokens_mistral': 730, 'n_tokens_neox': 712, 'n_words': 126}