Skip to content

Commit

Permalink
Merge pull request #10 from dbonadiman/master
Browse files Browse the repository at this point in the history
added docstring pylint 10/10
  • Loading branch information
dbonadiman committed May 14, 2014
2 parents c9dfcb1 + 33b208e commit 8b3893f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
10 changes: 10 additions & 0 deletions wordlist/_util.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
""".util
is a private module containing utility
used for the actual implementation of
the wordlist generator
"""

from collections import OrderedDict


Expand Down Expand Up @@ -31,5 +37,9 @@ def parse_charset(charset):


def scan_pattern(string):
"""
Scans the pattern in the form @@@a@@ returning an OrderedDict
containing the position of the fixed characters.
"""
res = OrderedDict([(i, x) for i, x in enumerate(string) if x != '@'])
return res
26 changes: 25 additions & 1 deletion wordlist/wordlist.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

# -*- coding: utf-8 -*-
############################################
# #
# Wordlist generator, creates dictionaries #
Expand All @@ -7,6 +7,30 @@
# dbonadiman. #
# #
############################################
"""Wordlist
Generates all possible permutations of a given charset.
Usage:
>>>import wordlist
>>>generator = wordlist.Generator('ab')
>>>for each in generator.generate(1, 2):
... print(each)
a
b
aa
ab
ba
bb
>>>import wordlist
>>>generator = wordlist.Generator('ab')
>>>for each in generator.generate_with_pattern('@a'):
... print(each)
aa
ba
"""

from __future__ import print_function

from itertools import product
Expand Down

0 comments on commit 8b3893f

Please sign in to comment.