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

Skip to content

Commit dd8fcae

Browse files
committed
Minor refactoring of some revisited code
1 parent fc5802f commit dd8fcae

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

lib/parse/cmdline.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -801,10 +801,10 @@ def cmdLineParser(argv=None):
801801

802802
# Dirty hack to display longer options without breaking into two lines
803803
def _(self, *args):
804-
_ = parser.formatter._format_option_strings(*args)
805-
if len(_) > MAX_HELP_OPTION_LENGTH:
806-
_ = ("%%.%ds.." % (MAX_HELP_OPTION_LENGTH - parser.formatter.indent_increment)) % _
807-
return _
804+
retVal = parser.formatter._format_option_strings(*args)
805+
if len(retVal) > MAX_HELP_OPTION_LENGTH:
806+
retVal = ("%%.%ds.." % (MAX_HELP_OPTION_LENGTH - parser.formatter.indent_increment)) % retVal
807+
return retVal
808808

809809
parser.formatter._format_option_strings = parser.formatter.format_option_strings
810810
parser.formatter.format_option_strings = type(parser.formatter.format_option_strings)(_, parser, type(parser))

lib/utils/pivotdumptable.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,29 +116,29 @@ def pivotDumpTable(table, colList, count=None, blind=True):
116116
pivotValue = " "
117117
breakRetrieval = False
118118

119+
def _(column, pivotValue):
120+
if column == colList[0]:
121+
query = dumpNode.query.replace("'%s'", "%s") % (agent.preprocessField(table, column), table, agent.preprocessField(table, column), unescaper.escape(pivotValue, False))
122+
else:
123+
query = dumpNode.query2.replace("'%s'", "%s") % (agent.preprocessField(table, column), table, agent.preprocessField(table, colList[0]), unescaper.escape(pivotValue, False))
124+
125+
query = whereQuery(query)
126+
return unArrayizeValue(inject.getValue(query, blind=blind, time=blind, union=not blind, error=not blind))
127+
119128
try:
120129
for i in xrange(count):
121130
if breakRetrieval:
122131
break
123132

124133
for column in colList:
125-
def _(pivotValue):
126-
if column == colList[0]:
127-
query = dumpNode.query.replace("'%s'", "%s") % (agent.preprocessField(table, column), table, agent.preprocessField(table, column), unescaper.escape(pivotValue, False))
128-
else:
129-
query = dumpNode.query2.replace("'%s'", "%s") % (agent.preprocessField(table, column), table, agent.preprocessField(table, colList[0]), unescaper.escape(pivotValue, False))
130-
131-
query = whereQuery(query)
132-
133-
return unArrayizeValue(inject.getValue(query, blind=blind, time=blind, union=not blind, error=not blind))
134-
135-
value = _(pivotValue)
134+
value = _(column, pivotValue)
136135
if column == colList[0]:
137136
if isNoneValue(value):
138137
for pivotValue in filter(None, (" " if pivotValue == " " else None, "%s%s" % (pivotValue[0], unichr(ord(pivotValue[1]) + 1)) if len(pivotValue) > 1 else None, unichr(ord(pivotValue[0]) + 1))):
139-
value = _(pivotValue)
138+
value = _(column, pivotValue)
140139
if not isNoneValue(value):
141140
break
141+
142142
if isNoneValue(value):
143143
breakRetrieval = True
144144
break

0 commit comments

Comments
 (0)