示例#1
0
    def test_display_style_colon_list(self):
        """
        Test style_colon_list in display.py.
        """
        actual = display.style_colon_list("text:more:still")
        expected = "text:\033[94mmore:still\033[0m"

        self.assertEqual(actual, expected)
示例#2
0
def orient_me(do_print: bool = True) -> Union[None, str]:
    """Full system, python, user, and environemnt information.

    Args:
        do_print(bool): Return the string if True, else format and print.
    """

    text = get_platform_info()
    text += \
        f" User and directories:\n\n"\
        f"    User              : {getpass.getuser()}\n"\
        f"    User home dirctry : {Path.home()}\n"\
        f"    Current directory : {Path.cwd()}\n\n"\
        f"    Conda default env : {os.environ.get('CONDA_DEFAULT_ENV', 'N/A')}\n"\
        f"    Conda current env : {os.environ.get('CONDA_PREFIX', 'N/A')}\n"\
        f"    Python executable : {sys.executable}\n"\

    if do_print:
        text = style_colon_list(text, Color.BOLD, Color.END)
        print(text)
        return None
    else:
        return text