smbclientng.core.Config

 1#!/usr/bin/env python3
 2# -*- coding: utf-8 -*-
 3# File name          : Config.py
 4# Author             : Podalirius (@podalirius_)
 5# Date created       : 31 may 2024
 6
 7import platform
 8
 9
10class Config(object):
11    """
12    Configuration handler for smbclientng.
13
14    This class manages the configuration settings for the smbclientng tool, including debug and color output settings.
15    It provides a structured way to access and modify these settings throughout the application.
16
17    Attributes:
18        _debug (bool): Flag to enable or disable debug mode.
19        _no_colors (bool): Flag to enable or disable colored output, depending on the platform.
20
21    Methods:
22        debug: Property to get or set the debug mode.
23        no_colors: Property to get or set the colored output preference.
24    """
25
26    def __init__(self, debug=False, no_colors=None):
27        self._debug = debug
28
29        if no_colors is not None:
30            self._no_colors = no_colors
31        else:
32            if platform.system() == "Windows":
33                self._no_colors = False
34            else:
35                self._no_colors = True
36
37    @property
38    def debug(self):
39        return self._debug
40
41    @debug.setter
42    def debug(self, value):
43        if isinstance(value, bool):
44            self._debug = value
45        else:
46            raise ValueError("Debug must be a boolean value")
47
48    @property
49    def no_colors(self):
50        return self._no_colors
51
52    @no_colors.setter
53    def no_colors(self, value):
54        if isinstance(value, bool):
55            self._no_colors = value
56        else:
57            raise ValueError("Colored output must be a boolean value")
class Config:
11class Config(object):
12    """
13    Configuration handler for smbclientng.
14
15    This class manages the configuration settings for the smbclientng tool, including debug and color output settings.
16    It provides a structured way to access and modify these settings throughout the application.
17
18    Attributes:
19        _debug (bool): Flag to enable or disable debug mode.
20        _no_colors (bool): Flag to enable or disable colored output, depending on the platform.
21
22    Methods:
23        debug: Property to get or set the debug mode.
24        no_colors: Property to get or set the colored output preference.
25    """
26
27    def __init__(self, debug=False, no_colors=None):
28        self._debug = debug
29
30        if no_colors is not None:
31            self._no_colors = no_colors
32        else:
33            if platform.system() == "Windows":
34                self._no_colors = False
35            else:
36                self._no_colors = True
37
38    @property
39    def debug(self):
40        return self._debug
41
42    @debug.setter
43    def debug(self, value):
44        if isinstance(value, bool):
45            self._debug = value
46        else:
47            raise ValueError("Debug must be a boolean value")
48
49    @property
50    def no_colors(self):
51        return self._no_colors
52
53    @no_colors.setter
54    def no_colors(self, value):
55        if isinstance(value, bool):
56            self._no_colors = value
57        else:
58            raise ValueError("Colored output must be a boolean value")

Configuration handler for smbclientng.

This class manages the configuration settings for the smbclientng tool, including debug and color output settings. It provides a structured way to access and modify these settings throughout the application.

Attributes: _debug (bool): Flag to enable or disable debug mode. _no_colors (bool): Flag to enable or disable colored output, depending on the platform.

Methods: debug: Property to get or set the debug mode. no_colors: Property to get or set the colored output preference.

Config(debug=False, no_colors=None)
27    def __init__(self, debug=False, no_colors=None):
28        self._debug = debug
29
30        if no_colors is not None:
31            self._no_colors = no_colors
32        else:
33            if platform.system() == "Windows":
34                self._no_colors = False
35            else:
36                self._no_colors = True
debug
38    @property
39    def debug(self):
40        return self._debug
no_colors
49    @property
50    def no_colors(self):
51        return self._no_colors