]> Frank Brehm's Git Trees - pixelpark/puppet-tools.git/commitdiff
Adding lib/dpx_puppettools/__init__.py
authorFrank Brehm <frank.brehm@pixelpark.com>
Fri, 3 Feb 2023 15:48:40 +0000 (16:48 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Fri, 3 Feb 2023 15:48:40 +0000 (16:48 +0100)
lib/dpx_puppettools/__init__.py [new file with mode: 0644]

diff --git a/lib/dpx_puppettools/__init__.py b/lib/dpx_puppettools/__init__.py
new file mode 100644 (file)
index 0000000..a241254
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/env python3
+# -*- coding: utf-8 -*-
+from __future__ import absolute_import
+
+# Standard modules
+import shutil
+
+# Own modules
+import fb_tools.common
+
+__version__ = '0.1.0'
+
+MAX_PORT_NUMBER = (2 ** 16) - 1
+DEFAULT_CONFIG_DIR = 'pixelpark'
+DEFAULT_TERMINAL_WIDTH = 99
+DEFAULT_TERMINAL_HEIGHT = 40
+
+
+# =============================================================================
+def pp(value, indent=4, width=None, depth=None):
+    """
+    Return a pretty print string of the given value.
+
+    @return: pretty print string
+    @rtype: str
+    """
+
+    if not width:
+        term_size = shutil.get_terminal_size((DEFAULT_TERMINAL_WIDTH, DEFAULT_TERMINAL_HEIGHT))
+        width = term_size.columns
+
+    return fb_tools.common.pp(value, indent=indent, width=width, depth=depth)
+
+
+# =============================================================================
+
+# vim: ts=4 et list