AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 18.223.43.117
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python2.7/site-packages/iniparse/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /usr/lib/python2.7/site-packages/iniparse/utils.py
import compat
from ini import LineContainer, EmptyLine

def tidy(cfg):
    """Clean up blank lines.

    This functions makes the configuration look clean and
    handwritten - consecutive empty lines and empty lines at
    the start of the file are removed, and one is guaranteed
    to be at the end of the file.
    """

    if isinstance(cfg, compat.RawConfigParser):
        cfg = cfg.data
    cont = cfg._data.contents
    i = 1
    while i < len(cont):
        if isinstance(cont[i], LineContainer):
            tidy_section(cont[i])
            i += 1
        elif (isinstance(cont[i-1], EmptyLine) and
              isinstance(cont[i], EmptyLine)):
            del cont[i]
        else:
            i += 1

    # Remove empty first line
    if cont and isinstance(cont[0], EmptyLine):
        del cont[0]

    # Ensure a last line
    if cont and not isinstance(cont[-1], EmptyLine):
        cont.append(EmptyLine())

def tidy_section(lc):
    cont = lc.contents
    i = 1
    while i < len(cont):
        if (isinstance(cont[i-1], EmptyLine) and
            isinstance(cont[i], EmptyLine)):
            del cont[i]
        else:
            i += 1

    # Remove empty first line
    if len(cont) > 1 and isinstance(cont[1], EmptyLine):
        del cont[1]

Anon7 - 2022
AnonSec Team