X7ROOT File Manager
Current Path:
/usr/lib/python2.7/site-packages/iniparse
usr
/
lib
/
python2.7
/
site-packages
/
iniparse
/
📁
..
📄
__init__.py
(1.08 KB)
📄
__init__.pyc
(945 B)
📄
__init__.pyo
(945 B)
📄
compat.py
(11.82 KB)
📄
compat.pyc
(12.54 KB)
📄
compat.pyo
(12.54 KB)
📄
config.py
(8.11 KB)
📄
config.pyc
(9.37 KB)
📄
config.pyo
(9.37 KB)
📄
ini.py
(20.17 KB)
📄
ini.pyc
(19.94 KB)
📄
ini.pyo
(19.94 KB)
📄
utils.py
(1.24 KB)
📄
utils.pyc
(1.39 KB)
📄
utils.pyo
(1.39 KB)
Editing: 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]
Upload File
Create Folder