Server IP : 85.214.239.14 / Your IP : 3.129.42.59 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/3/task/3/cwd/srv/modoboa/env/lib/python3.5/site-packages/reportlab/lib/ |
Upload File : |
#Copyright ReportLab Europe Ltd. 2000-2017 #see license.txt for license details __version__='3.3.0' __doc__='''Utility functions for geometrical operations.''' def normalizeTRBL(p): ''' Useful for interpreting short descriptions of paddings, borders, margin, etc. Expects a single value or a tuple of length 2 to 4. Returns a tuple representing (clockwise) the value(s) applied to the 4 sides of a rectangle: If a single value is given, that value is applied to all four sides. If two or three values are given, the missing values are taken from the opposite side(s). If four values are given they are returned unchanged. >>> normalizeTRBL(1) (1, 1, 1, 1) >>> normalizeTRBL((1, 1.2)) (1, 1.2, 1, 1.2) >>> normalizeTRBL((1, 1.2, 0)) (1, 1.2, 0, 1.2) >>> normalizeTRBL((1, 1.2, 0, 8)) (1, 1.2, 0, 8) ''' if not isinstance(p, (tuple, list)): return (p,)*4 elif len(p)==1: return (p[0],)*4 l = len(p) if l < 2 or l > 4: raise ValueError('A padding must have between 2 and 4 values but got %d.' % l) return tuple(p) + tuple([ p[i-2] for i in range(l, 4) ])