<commit_before>#! /usr/bin/python
# -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------
# Name:     settings.py
# Purpose:  Store session settings and project parameters
#
# Author:   <NAME>
#
# Created:  2008/01/22
# Licence:  GPLv3 or newer
#-----------------------------------------------------------------------------
# Last commit info:
# ----------------------------------
# $LastChangedDate:: xxxx/xx/xx xx:xx:xx $
# $Rev::                                 $
# $Author::                              $
#-----------------------------------------------------------------------------
# Revision list :
#
# Date      |  By                | Changes
# 18/11/2008|  <NAME>    | adding script property
#
#-----------------------------------------------------------------------------

__doc__ = "Session settings and project parameters"
__version__ = "1.0.0"
__versionTime__ = "xx/xx/xxxx"
__author__ = "<NAME> <<EMAIL>> and "+\
             "<NAME> <<EMAIL>>"

import cmd, re, os, sys
from periphondemand.bin.utils import wrappersystem as sy
from periphondemand.bin.define import *
from periphondemand.bin.utils.configfile import ConfigFile
from periphondemand.bin.utils.error import Error
from periphondemand.bin.define import PODPATH

class Settings(object):
    """Settings class implements a Singleton design pattern to share the same
    state to all instance of this class.
    This class will store the application settings like directory location,
    active component and active project.
    """
    __instance = None
    __do_init = False

    def __new__(cls, *args, **kwargs):
        if cls.__instance:
            cls.__instance.__do_init = False
            return cls.__instance

        cls.__instance = object.__new__(cls, *args, **kwargs)
        cls.__instance.__do_init = True
        return cls.__instance

    def __init__(self):
        if self.__do_init:
            pathname, scriptname = os.path.split(sys.argv[0])
            self.history = []
            self.historyroot = []
            self.__script_dir = os.path.abspath(pathname)
            self.path = PODPATH
            self.projectpath = sy.pwd()
            self.headertpl = "/headervhdl.tpl"
            self.script = 0
            self.color_status = 1
            # init personnal libraries path:
            try:
                self.configfile = ConfigFile(POD_CONFIG)
            except Error, e:
                pass
            try:
                self.personal_lib_path_list = self.configfile.getLibraries()<commit_msg>src/bin/utils/settings.py: fix PODPATH -> POD_PATH<commit_after>#! /usr/bin/python
# -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------
# Name:     settings.py
# Purpose:  Store session settings and project parameters
#
# Author:   <NAME>
#
# Created:  2008/01/22
# Licence:  GPLv3 or newer
#-----------------------------------------------------------------------------
# Last commit info:
# ----------------------------------
# $LastChangedDate:: xxxx/xx/xx xx:xx:xx $
# $Rev::                                 $
# $Author::                              $
#-----------------------------------------------------------------------------
# Revision list :
#
# Date      |  By                | Changes
# 18/11/2008|  <NAME>    | adding script property
#
#-----------------------------------------------------------------------------

__doc__ = "Session settings and project parameters"
__version__ = "1.0.0"
__versionTime__ = "xx/xx/xxxx"
__author__ = "<NAME> <<EMAIL>> and "+\
             "<NAME> <<EMAIL>>"

import cmd, re, os, sys
from periphondemand.bin.utils import wrappersystem as sy
from periphondemand.bin.define import *
from periphondemand.bin.utils.configfile import ConfigFile
from periphondemand.bin.utils.error import Error
from periphondemand.bin.define import POD_PATH

class Settings(object):
    """Settings class implements a Singleton design pattern to share the same
    state to all instance of this class.
    This class will store the application settings like directory location,
    active component and active project.
    """
    __instance = None
    __do_init = False

    def __new__(cls, *args, **kwargs):
        if cls.__instance:
            cls.__instance.__do_init = False
            return cls.__instance

        cls.__instance = object.__new__(cls, *args, **kwargs)
        cls.__instance.__do_init = True
        return cls.__instance

    def __init__(self):
        if self.__do_init:
            pathname, scriptname = os.path.split(sys.argv[0])
            self.history = []
            self.historyroot = []
            self.__script_dir = os.path.abspath(pathname)
            self.path = POD_PATH
            self.projectpath = sy.pwd()
            self.headertpl = "/headervhdl.tpl"
            self.script = 0
            self.color_status = 1
            # init personnal libraries path:
            try:
                self.configfile = ConfigFile(POD_CONFIG)
            except Error, e:
                pass
            try:
                self.personal_lib_path_list = self.configfile.getLibraries()
{'fraction_non_alphanumeric': 0.22065364532972345, 'fraction_numerical': 0.009282537226842004, 'mean_word_length': 1.4419263456090652, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 20, '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': '1520709', 'n_tokens_mistral': 1370, 'n_tokens_neox': 1331, 'n_words': 348}