Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
emanuelfeld committed Jun 22, 2016
2 parents 346c5b7 + 3f0e80b commit af8f12d
Show file tree
Hide file tree
Showing 11 changed files with 311 additions and 318 deletions.
1 change: 1 addition & 0 deletions README.rst
Expand Up @@ -71,6 +71,7 @@ To invoke Poirot and see his findings, call him from the command line with :code
* **--before**: Date restriction on revisions. Default value: none.
* **--after**: Date restriction on revisions. Default value: none.
* **--author**: Authorship restriction on revisions. Default value: none.
* **--output**: File to output results as JSON. Default value: none.

Examples
_________
Expand Down
1 change: 1 addition & 0 deletions README_PYPI.rst
Expand Up @@ -53,6 +53,7 @@ To invoke Poirot and see his findings, call him from the command line with :code
* **--before**: Date restriction on revisions. Default value: none.
* **--after**: Date restriction on revisions. Default value: none.
* **--author**: Authorship restriction on revisions. Default value: none.
* **--output**: File to output results as JSON. Default value: none.

Examples
_________
Expand Down
4 changes: 2 additions & 2 deletions poirot/clients.py
Expand Up @@ -6,14 +6,14 @@
import subprocess
from jinja2 import Environment, PackageLoader

from .filters import fail, ok, highlight, style, wrap, strip
from .filters import fail, okay, highlight, style, wrap, strip
from .utils import merge_dicts


def render(results, case):
env = Environment(loader=PackageLoader("poirot", "templates"))
filters = {
"ok": ok,
"okay": okay,
"fail": fail,
"style": style,
"wrap": wrap,
Expand Down
22 changes: 15 additions & 7 deletions poirot/filters.py
Expand Up @@ -36,7 +36,7 @@
STYLE_CODES[code] = PREFIX + STYLE_CODES[code]

SYMBOL_CODES = {
"ok": u"\u2713",
"okay": u"\u2713",
"fail": u"\u2716",
}

Expand All @@ -50,20 +50,26 @@ def style(text, _code):
return "%s" % (text)


def ok(text):
"""Takes a string and prepends a green check to it"""
def okay(text):
"""
Takes a string and prepends a green check to it
"""

return "%s %s" % (style(SYMBOL_CODES["ok"], "green"), text)
return "%s %s" % (style(SYMBOL_CODES["okay"], "green"), text)


def fail(text=""):
"""Takes a string and prepends a red x mark to it"""
"""
Takes a string and prepends a red x mark to it
"""

return "%s %s" % (style(SYMBOL_CODES["fail"], "red"), text)


def highlight(text, pattern):
"""Takes a string and highlights substrings matching a pattern"""
"""
Takes a string and highlights substrings matching a pattern
"""

pattern_re = regex.compile(pattern, regex.I)
match = pattern_re.search(text)
Expand All @@ -72,7 +78,9 @@ def highlight(text, pattern):
return text

def strip(text):
return text.rstrip("\n ")
"""Strips whitespace from end of line"""

return text.rstrip("\n\t ")


def wrap(text, line_length, padding):
Expand Down
4 changes: 3 additions & 1 deletion poirot/parser.py
Expand Up @@ -30,7 +30,7 @@ def parse_arguments(args):
on a new line. Accepts a comma-separated list
of file paths.""")
query.add_argument("--output", "-o", dest="output", required=False,
help="""Output results as JSON to FILE.""")
help="""Output results as JSON to FILE.""")
query.add_argument("--revlist", "-rl", dest="revlist", required=False, default="HEAD^!",
help="""A comma-delimited list of revision (commit)
ranges to search. Defaults to HEAD^!. Specify
Expand Down Expand Up @@ -87,6 +87,8 @@ def parse_patterns(path):


def format_arguments(args):
"""Cleans up arguments passed to argparse"""

def format_revlist():
if args.revlist == "all":
return ["--all"]
Expand Down

0 comments on commit af8f12d

Please sign in to comment.