Skip to content

Commit

Permalink
Fixed the upper bound problem
Browse files Browse the repository at this point in the history
  • Loading branch information
vampolo committed Dec 18, 2010
1 parent 0cf9f6b commit 1ce0cf3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 1,203 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.pydev*
*.pyc
genkeyword/*
*/output/*
53 changes: 18 additions & 35 deletions aralib/keyword.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,44 +90,27 @@ def genXml(self, lower_bound, upper_bound, url=None, *args, **kwargs):
doc.appendChild(cat)

pbar = ProgressBar(maxval=len(self.keyword_entries)).start()
trees = list()
entries = list()
for i,obj in enumerate(self.keyword_entries):
pbar.update(i)
if len(obj.children) > lower_bound:
tree = None
if filter:
if self.__retrieve_keyword_presence_in_page(url, obj.key, filter_done, filter_missed):
valid = True
else:
valid = False

if valid:
tree = Tree(obj.keyword)

j = 0
for entry in obj.children:
if filter:
if self.__retrieve_keyword_presence_in_page(url, entry.key, filter_done, filter_missed):
valid = True
j += 1
else:
valid = False

if valid:
tree.next.append(unicode(entry.keyword))

if j >= upper_bound:
break
if tree:
trees.append(tree)

if filter:
if self.__retrieve_keyword_presence_in_page(url, obj.key, filter_done, filter_missed):
valid = True
else:
valid = False

if valid:
entries.append(obj.keyword)

if len(entries) >= upper_bound:
break

#Create the xml now
for tree in trees:
if len(tree.next) > lower_bound:
child = doc.createElement("entry")
child.setAttribute("key", tree.el)
cat.appendChild(child)

for entry in entries:
child = doc.createElement("entry")
child.setAttribute("key", entry)
cat.appendChild(child)

pbar.finish()
sys.stdout.write('\n')
return doc
Expand Down
211 changes: 0 additions & 211 deletions geanykeys/output/emule-a.xml

This file was deleted.

Loading

0 comments on commit 1ce0cf3

Please sign in to comment.