MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / update

Method update

lib/utils/progress.py:39–72  ·  view source on GitHub ↗

This method updates the progress bar

(self, newAmount=0)

Source from the content-addressed store, hash-verified

37 return "%.2d:%.2d" % (minutes, seconds)
38
39 def update(self, newAmount=0):
40 """
41 This method updates the progress bar
42 """
43
44 if newAmount < self._min:
45 newAmount = self._min
46 elif newAmount > self._max:
47 newAmount = self._max
48
49 self._amount = newAmount
50
51 # Figure out the new percent done, round to an integer
52 diffFromMin = float(self._amount - self._min)
53 percentDone = (diffFromMin / float(self._span)) * 100.0
54 percentDone = round(percentDone)
55 percentDone = min(100, int(percentDone))
56
57 # Figure out how many hash bars the percentage should be
58 allFull = self._width - len("100%% [] %s/%s (ETA 00:00)" % (self._max, self._max))
59 numHashes = (percentDone / 100.0) * allFull
60 numHashes = int(round(numHashes))
61
62 # Build a progress bar with an arrow of equal signs
63 if numHashes == 0:
64 self._progBar = "[>%s]" % (" " * (allFull - 1))
65 elif numHashes == allFull:
66 self._progBar = "[%s]" % ("=" * allFull)
67 else:
68 self._progBar = "[%s>%s]" % ("=" * (numHashes - 1), " " * (allFull - numHashes))
69
70 # Add the percentage at the beginning of the progress bar
71 percentString = getUnicode(percentDone) + "%"
72 self._progBar = "%s %s" % (percentString, self._progBar)
73
74 def progress(self, newAmount):
75 """

Callers 15

__init__Method · 0.95
progressMethod · 0.95
mainFunction · 0.45
get_all_optionsFunction · 0.45
do_REQUESTMethod · 0.45
phpass_passwdFunction · 0.45
do_GETMethod · 0.45
crawlFunction · 0.45
runGuiFunction · 0.45
toDictMethod · 0.45
_selectInjectionFunction · 0.45
_saveToHashDBFunction · 0.45

Calls 2

getUnicodeFunction · 0.90
roundFunction · 0.85

Tested by

no test coverage detected