Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b699f98

Browse files
committed
minor refactoring
1 parent 34a8cd7 commit b699f98

1 file changed

Lines changed: 40 additions & 39 deletions

File tree

lib/core/common.py

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,46 @@
7777
from lib.core.settings import ACCESS_ALIASES
7878
from lib.core.settings import FIREBIRD_ALIASES
7979

80+
81+
class UnicodeRawConfigParser(RawConfigParser):
82+
def write(self, fp):
83+
"""
84+
Write an .ini-format representation of the configuration state.
85+
"""
86+
87+
if self._defaults:
88+
fp.write("[%s]\n" % DEFAULTSECT)
89+
90+
for (key, value) in self._defaults.items():
91+
fp.write("%s = %s\n" % (key, getUnicode(value).replace('\n', '\n\t')))
92+
93+
fp.write("\n")
94+
95+
for section in self._sections:
96+
fp.write("[%s]\n" % section)
97+
98+
for (key, value) in self._sections[section].items():
99+
if key != "__name__":
100+
if value is None:
101+
fp.write("%s\n" % (key))
102+
else:
103+
fp.write("%s = %s\n" % (key, getUnicode(value).replace('\n', '\n\t')))
104+
105+
fp.write("\n")
106+
107+
108+
class DynamicContentItem:
109+
"""
110+
Represents line in content page with dynamic properties (candidate for removal prior detection phase)
111+
"""
112+
113+
def __init__(self, lineNumber, pageTotal, lineContentBefore, lineContentAfter):
114+
self.lineNumber = lineNumber
115+
self.pageTotal = pageTotal
116+
self.lineContentBefore = lineContentBefore
117+
self.lineContentAfter = lineContentAfter
118+
119+
80120
def paramToDict(place, parameters=None):
81121
"""
82122
Split the parameters into names and values, check if these parameters
@@ -1469,42 +1509,3 @@ def smokeTest():
14691509
infoMsg += "FAILED"
14701510
logger.error(infoMsg)
14711511
return retVal
1472-
1473-
1474-
class UnicodeRawConfigParser(RawConfigParser):
1475-
def write(self, fp):
1476-
"""
1477-
Write an .ini-format representation of the configuration state.
1478-
"""
1479-
1480-
if self._defaults:
1481-
fp.write("[%s]\n" % DEFAULTSECT)
1482-
1483-
for (key, value) in self._defaults.items():
1484-
fp.write("%s = %s\n" % (key, getUnicode(value).replace('\n', '\n\t')))
1485-
1486-
fp.write("\n")
1487-
1488-
for section in self._sections:
1489-
fp.write("[%s]\n" % section)
1490-
1491-
for (key, value) in self._sections[section].items():
1492-
if key != "__name__":
1493-
if value is None:
1494-
fp.write("%s\n" % (key))
1495-
else:
1496-
fp.write("%s = %s\n" % (key, getUnicode(value).replace('\n', '\n\t')))
1497-
1498-
fp.write("\n")
1499-
1500-
1501-
class DynamicContentItem:
1502-
"""
1503-
Represents line in content page with dynamic properties (candidate for removal prior detection phase)
1504-
"""
1505-
1506-
def __init__(self, lineNumber, pageTotal, lineContentBefore, lineContentAfter):
1507-
self.lineNumber = lineNumber
1508-
self.pageTotal = pageTotal
1509-
self.lineContentBefore = lineContentBefore
1510-
self.lineContentAfter = lineContentAfter

0 commit comments

Comments
 (0)