We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add links section to text format
Update the [text based rule report](https://github.com/RedHatInsights/insights-core/blob/master/insights/formats/text.py) to automatically include links associated with rules. simple_html and html already include them.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `insights/formats/text.py`
Content:
```
1 from __future__ import print_function
2 import six
3 import sys
4 import inspect
5 from collections import namedtuple
6 
7 from pprint import pprint
8 from insights import dr, datasource, rule, condition, incident, parser
9 from insights.core.context import ExecutionContext
10 from insights.formats import Formatter, FormatterAdapter, render
11 
12 
13 try:
14     from colorama import Fore, Style, init
15     init()
16 except ImportError:
17     print("Install colorama if console colors are preferred.")
18 
19     class Default(type):
20         def __getattr__(*args):
21             return ""
22 
23     class Fore(six.with_metaclass(Default)):
24         pass
25 
26     class Style(six.with_metaclass(Default)):
27         pass
28 
29 
30 def _find_context(broker):
31     for k, v in broker.instances.items():
32         if inspect.isclass(k) and issubclass(k, ExecutionContext):
33             return v
34 
35 
36 class HumanReadableFormat(Formatter):
37     """
38     This class prints a human readable summary of rule hits. It should be used
39     as a context manager and given an instance of an
40     ``insights.core.dr.Broker``. ``dr.run`` should be called within the context
41     using the same broker.
42 
43     Args:
44         broker (Broker): the broker to watch and provide a summary about.
45         missing (bool): shows rules with missing dependencies if True.
46         tracebacks (bool): shows tracebacks if any exceptions were raised.
47             Useful for debugging.
48         dropped (bool): Shows any files that weren't collected if running
49             against an archive. Included for a corner case and typically not
50             used in general.
51         stream (file-like): Output is written to stream. Defaults to sys.stdout.
52     """
53     def __init__(self, broker,
54             missing=False,
55             tracebacks=False,
56             dropped=False,
57             fail_only=False,
58             stream=sys.stdout):
59         self.broker = broker
60         self.missing = missing
61         self.tracebacks = tracebacks
62         self.dropped = dropped
63         self.fail_only = fail_only
64         self.stream = stream
65 
66     def print_header(self, header, color):
67         ln = len(header)
68         print(color + '-' * ln, file=self.stream)
69         print(header, file=self.stream)
70         print('-' * ln + Style.RESET_ALL, file=self.stream)
71 
72     def preprocess(self):
73         response = namedtuple('response', 'color label intl title')
74         self.responses = {
75             'pass': response(color=Fore.GREEN, label="PASS", intl='P', title="Passed      : "),
76             'rule': response(color=Fore.RED, label="FAIL", intl='F', title="Failed      : "),
77             'info': response(color=Fore.WHITE, label="INFO", intl='I', title="Info        : "),
78             'skip': response(color=Fore.BLUE, label="SKIP", intl='S', title="Missing Deps: "),
79             'fingerprint': response(color=Fore.YELLOW, label="FINGERPRINT", intl='P',
80                                   title="Fingerprint : "),
81             'metadata': response(color=Fore.YELLOW, label="META", intl='M', title="Metadata    : "),
82             'metadata_key': response(color=Fore.MAGENTA, label="META", intl='K', title="Metadata Key: "),
83             'exception': response(color=Fore.RED, label="EXCEPT", intl='E', title="Exceptions  : ")
84         }
85 
86         self.counts = {}
87         for key in self.responses:
88             self.counts[key] = 0
89 
90         self.print_header("Progress:", Fore.CYAN)
91         self.broker.add_observer(self.progress_bar, rule)
92         self.broker.add_observer(self.progress_bar, condition)
93         self.broker.add_observer(self.progress_bar, incident)
94         self.broker.add_observer(self.progress_bar, parser)
95 
96     def progress_bar(self, c, broker):
97         """
98         Print the formated progress information for the processed return types
99         """
100         v = broker.get(c)
101 
102         if v and isinstance(v, dict) and len(v) > 0 and 'type' in v:
103             if v["type"] in self.responses:
104                 print(self.responses[v["type"]].color + self.responses[v["type"]].intl + Style.RESET_ALL, end="", file=self.stream)
105             else:
106                 print(".", end="", file=self.stream)
107         elif c in broker.exceptions:
108             self.counts['exception'] += len(broker.exceptions[c])
109             print(Fore.RED + "E" + Style.RESET_ALL, end="", file=self.stream)
110         return self
111 
112     def show_tracebacks(self):
113         """ Show tracebacks """
114         if self.broker.tracebacks:
115             print(file=self.stream)
116             print("Tracebacks:", file=self.stream)
117             for t in self.broker.tracebacks.values():
118                 print(t, file=self.stream)
119 
120     def show_dropped(self):
121         """ Show dropped files """
122         ctx = _find_context(self.broker)
123         if ctx and ctx.all_files:
124             ds = self.broker.get_by_type(datasource)
125             vals = []
126             for v in ds.values():
127                 if isinstance(v, list):
128                     vals.extend(d.path for d in v)
129                 else:
130                     vals.append(v.path)
131             dropped = set(ctx.all_files) - set(vals)
132             pprint("Dropped Files:", stream=self.stream)
133             pprint(dropped, indent=4, stream=self.stream)
134 
135     def show_description(self):
136         """ Prints the formatted response for the matching return type """
137 
138         def printit(c, v):
139             resp = self.responses[v["type"]]
140             name = "[%s] %s" % (resp.label, dr.get_name(c))
141             underline = "-" * len(name)
142             name = "%s%s%s" % (resp.color, name, Style.RESET_ALL)
143             print(name, file=self.stream)
144             print(underline, file=self.stream)
145             print(render(c, v), file=self.stream)
146             print(file=self.stream)
147 
148         for c in sorted(self.broker.get_by_type(rule), key=dr.get_name):
149             v = self.broker[c]
150             _type = v.get('type')
151             if _type in self.responses:
152                 self.counts[_type] += 1
153             if (_type and ((self.fail_only and _type == 'rule') or
154                            ((self.missing and _type == 'skip') or
155                             (not self.fail_only and _type != 'skip')))):
156                 printit(c, v)
157         print(file=self.stream)
158 
159         self.print_header("Rule Execution Summary", Fore.CYAN)
160         for c in self.counts:
161             print(self.responses[c].color + self.responses[c].title + str(self.counts[c]) + Style.RESET_ALL, file=self.stream)
162 
163     def postprocess(self):
164         if self.tracebacks:
165             self.show_tracebacks()
166         if self.dropped:
167             self.show_dropped()
168 
169         print(file=self.stream)
170         print(file=self.stream)
171         self.print_header("Rules Executed", Fore.CYAN)
172         self.show_description()
173 
174 
175 class HumanReadableFormatAdapter(FormatterAdapter):
176     """ Displays results in a human readable format. """
177 
178     @staticmethod
179     def configure(p):
180         p.add_argument("-m", "--missing", help="Show missing requirements.", action="store_true")
181         p.add_argument("-t", "--tracebacks", help="Show stack traces.", action="store_true")
182         p.add_argument("-d", "--dropped", help="Show collected files that weren't processed.", action="store_true")
183         p.add_argument("-F", "--fail-only", help="Show FAIL results only. Conflict with '-m' or '-f', will be dropped when using them together", action="store_true")
184 
185     def __init__(self, args):
186         self.missing = args.missing
187         self.tracebacks = args.tracebacks
188         self.dropped = args.dropped
189         self.fail_only = args.fail_only
190         self.formatter = None
191         if self.missing and self.fail_only:
192             print(Fore.YELLOW + 'Options conflict: -m and -F, drops -F', file=sys.stderr)
193             self.fail_only = False
194 
195     def preprocess(self, broker):
196         self.formatter = HumanReadableFormat(broker,
197                 self.missing, self.tracebacks, self.dropped, self.fail_only)
198         self.formatter.preprocess()
199 
200     def postprocess(self, broker):
201         self.formatter.postprocess()
202
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/insights/formats/text.py b/insights/formats/text.py
--- a/insights/formats/text.py
+++ b/insights/formats/text.py
@@ -5,6 +5,7 @@
 from collections import namedtuple
 
 from pprint import pprint
+from six import StringIO
 from insights import dr, datasource, rule, condition, incident, parser
 from insights.core.context import ExecutionContext
 from insights.formats import Formatter, FormatterAdapter, render
@@ -33,6 +34,24 @@
             return v
 
 
+def render_links(component):
+    links = dr.get_delegate(component).links or {}
+    if any(links.values()):
+        space = " " * 4
+        dbl_space = space * 2
+        output = StringIO()
+        output.write("Links:\n")
+        for key in sorted(links):
+            values = sorted(links[key])
+            if values:
+                output.write(space + key + ":\n")
+                for v in values:
+                    output.write(dbl_space + v + "\n")
+        output.seek(0)
+        return output.read()
+    return ""
+
+
 class HumanReadableFormat(Formatter):
     """
     This class prints a human readable summary of rule hits. It should be used
@@ -142,6 +161,7 @@
             name = "%s%s%s" % (resp.color, name, Style.RESET_ALL)
             print(name, file=self.stream)
             print(underline, file=self.stream)
+            print(render_links(c), file=self.stream)
             print(render(c, v), file=self.stream)
             print(file=self.stream)

{"golden_diff": "diff --git a/insights/formats/text.py b/insights/formats/text.py\n--- a/insights/formats/text.py\n+++ b/insights/formats/text.py\n@@ -5,6 +5,7 @@\n from collections import namedtuple\n \n from pprint import pprint\n+from six import StringIO\n from insights import dr, datasource, rule, condition, incident, parser\n from insights.core.context import ExecutionContext\n from insights.formats import Formatter, FormatterAdapter, render\n@@ -33,6 +34,24 @@\n             return v\n \n \n+def render_links(component):\n+    links = dr.get_delegate(component).links or {}\n+    if any(links.values()):\n+        space = \" \" * 4\n+        dbl_space = space * 2\n+        output = StringIO()\n+        output.write(\"Links:\\n\")\n+        for key in sorted(links):\n+            values = sorted(links[key])\n+            if values:\n+                output.write(space + key + \":\\n\")\n+                for v in values:\n+                    output.write(dbl_space + v + \"\\n\")\n+        output.seek(0)\n+        return output.read()\n+    return \"\"\n+\n+\n class HumanReadableFormat(Formatter):\n     \"\"\"\n     This class prints a human readable summary of rule hits. It should be used\n@@ -142,6 +161,7 @@\n             name = \"%s%s%s\" % (resp.color, name, Style.RESET_ALL)\n             print(name, file=self.stream)\n             print(underline, file=self.stream)\n+            print(render_links(c), file=self.stream)\n             print(render(c, v), file=self.stream)\n             print(file=self.stream)\n", "issue": "Add links section to text format\nUpdate the [text based rule report](https://github.com/RedHatInsights/insights-core/blob/master/insights/formats/text.py) to automatically include links associated with rules. simple_html and html already include them.\n", "before_files": [{"content": "from __future__ import print_function\nimport six\nimport sys\nimport inspect\nfrom collections import namedtuple\n\nfrom pprint import pprint\nfrom insights import dr, datasource, rule, condition, incident, parser\nfrom insights.core.context import ExecutionContext\nfrom insights.formats import Formatter, FormatterAdapter, render\n\n\ntry:\n    from colorama import Fore, Style, init\n    init()\nexcept ImportError:\n    print(\"Install colorama if console colors are preferred.\")\n\n    class Default(type):\n        def __getattr__(*args):\n            return \"\"\n\n    class Fore(six.with_metaclass(Default)):\n        pass\n\n    class Style(six.with_metaclass(Default)):\n        pass\n\n\ndef _find_context(broker):\n    for k, v in broker.instances.items():\n        if inspect.isclass(k) and issubclass(k, ExecutionContext):\n            return v\n\n\nclass HumanReadableFormat(Formatter):\n    \"\"\"\n    This class prints a human readable summary of rule hits. It should be used\n    as a context manager and given an instance of an\n    ``insights.core.dr.Broker``. ``dr.run`` should be called within the context\n    using the same broker.\n\n    Args:\n        broker (Broker): the broker to watch and provide a summary about.\n        missing (bool): shows rules with missing dependencies if True.\n        tracebacks (bool): shows tracebacks if any exceptions were raised.\n            Useful for debugging.\n        dropped (bool): Shows any files that weren't collected if running\n            against an archive. Included for a corner case and typically not\n            used in general.\n        stream (file-like): Output is written to stream. Defaults to sys.stdout.\n    \"\"\"\n    def __init__(self, broker,\n            missing=False,\n            tracebacks=False,\n            dropped=False,\n            fail_only=False,\n            stream=sys.stdout):\n        self.broker = broker\n        self.missing = missing\n        self.tracebacks = tracebacks\n        self.dropped = dropped\n        self.fail_only = fail_only\n        self.stream = stream\n\n    def print_header(self, header, color):\n        ln = len(header)\n        print(color + '-' * ln, file=self.stream)\n        print(header, file=self.stream)\n        print('-' * ln + Style.RESET_ALL, file=self.stream)\n\n    def preprocess(self):\n        response = namedtuple('response', 'color label intl title')\n        self.responses = {\n            'pass': response(color=Fore.GREEN, label=\"PASS\", intl='P', title=\"Passed      : \"),\n            'rule': response(color=Fore.RED, label=\"FAIL\", intl='F', title=\"Failed      : \"),\n            'info': response(color=Fore.WHITE, label=\"INFO\", intl='I', title=\"Info        : \"),\n            'skip': response(color=Fore.BLUE, label=\"SKIP\", intl='S', title=\"Missing Deps: \"),\n            'fingerprint': response(color=Fore.YELLOW, label=\"FINGERPRINT\", intl='P',\n                                  title=\"Fingerprint : \"),\n            'metadata': response(color=Fore.YELLOW, label=\"META\", intl='M', title=\"Metadata    : \"),\n            'metadata_key': response(color=Fore.MAGENTA, label=\"META\", intl='K', title=\"Metadata Key: \"),\n            'exception': response(color=Fore.RED, label=\"EXCEPT\", intl='E', title=\"Exceptions  : \")\n        }\n\n        self.counts = {}\n        for key in self.responses:\n            self.counts[key] = 0\n\n        self.print_header(\"Progress:\", Fore.CYAN)\n        self.broker.add_observer(self.progress_bar, rule)\n        self.broker.add_observer(self.progress_bar, condition)\n        self.broker.add_observer(self.progress_bar, incident)\n        self.broker.add_observer(self.progress_bar, parser)\n\n    def progress_bar(self, c, broker):\n        \"\"\"\n        Print the formated progress information for the processed return types\n        \"\"\"\n        v = broker.get(c)\n\n        if v and isinstance(v, dict) and len(v) > 0 and 'type' in v:\n            if v[\"type\"] in self.responses:\n                print(self.responses[v[\"type\"]].color + self.responses[v[\"type\"]].intl + Style.RESET_ALL, end=\"\", file=self.stream)\n            else:\n                print(\".\", end=\"\", file=self.stream)\n        elif c in broker.exceptions:\n            self.counts['exception'] += len(broker.exceptions[c])\n            print(Fore.RED + \"E\" + Style.RESET_ALL, end=\"\", file=self.stream)\n        return self\n\n    def show_tracebacks(self):\n        \"\"\" Show tracebacks \"\"\"\n        if self.broker.tracebacks:\n            print(file=self.stream)\n            print(\"Tracebacks:\", file=self.stream)\n            for t in self.broker.tracebacks.values():\n                print(t, file=self.stream)\n\n    def show_dropped(self):\n        \"\"\" Show dropped files \"\"\"\n        ctx = _find_context(self.broker)\n        if ctx and ctx.all_files:\n            ds = self.broker.get_by_type(datasource)\n            vals = []\n            for v in ds.values():\n                if isinstance(v, list):\n                    vals.extend(d.path for d in v)\n                else:\n                    vals.append(v.path)\n            dropped = set(ctx.all_files) - set(vals)\n            pprint(\"Dropped Files:\", stream=self.stream)\n            pprint(dropped, indent=4, stream=self.stream)\n\n    def show_description(self):\n        \"\"\" Prints the formatted response for the matching return type \"\"\"\n\n        def printit(c, v):\n            resp = self.responses[v[\"type\"]]\n            name = \"[%s] %s\" % (resp.label, dr.get_name(c))\n            underline = \"-\" * len(name)\n            name = \"%s%s%s\" % (resp.color, name, Style.RESET_ALL)\n            print(name, file=self.stream)\n            print(underline, file=self.stream)\n            print(render(c, v), file=self.stream)\n            print(file=self.stream)\n\n        for c in sorted(self.broker.get_by_type(rule), key=dr.get_name):\n            v = self.broker[c]\n            _type = v.get('type')\n            if _type in self.responses:\n                self.counts[_type] += 1\n            if (_type and ((self.fail_only and _type == 'rule') or\n                           ((self.missing and _type == 'skip') or\n                            (not self.fail_only and _type != 'skip')))):\n                printit(c, v)\n        print(file=self.stream)\n\n        self.print_header(\"Rule Execution Summary\", Fore.CYAN)\n        for c in self.counts:\n            print(self.responses[c].color + self.responses[c].title + str(self.counts[c]) + Style.RESET_ALL, file=self.stream)\n\n    def postprocess(self):\n        if self.tracebacks:\n            self.show_tracebacks()\n        if self.dropped:\n            self.show_dropped()\n\n        print(file=self.stream)\n        print(file=self.stream)\n        self.print_header(\"Rules Executed\", Fore.CYAN)\n        self.show_description()\n\n\nclass HumanReadableFormatAdapter(FormatterAdapter):\n    \"\"\" Displays results in a human readable format. \"\"\"\n\n    @staticmethod\n    def configure(p):\n        p.add_argument(\"-m\", \"--missing\", help=\"Show missing requirements.\", action=\"store_true\")\n        p.add_argument(\"-t\", \"--tracebacks\", help=\"Show stack traces.\", action=\"store_true\")\n        p.add_argument(\"-d\", \"--dropped\", help=\"Show collected files that weren't processed.\", action=\"store_true\")\n        p.add_argument(\"-F\", \"--fail-only\", help=\"Show FAIL results only. Conflict with '-m' or '-f', will be dropped when using them together\", action=\"store_true\")\n\n    def __init__(self, args):\n        self.missing = args.missing\n        self.tracebacks = args.tracebacks\n        self.dropped = args.dropped\n        self.fail_only = args.fail_only\n        self.formatter = None\n        if self.missing and self.fail_only:\n            print(Fore.YELLOW + 'Options conflict: -m and -F, drops -F', file=sys.stderr)\n            self.fail_only = False\n\n    def preprocess(self, broker):\n        self.formatter = HumanReadableFormat(broker,\n                self.missing, self.tracebacks, self.dropped, self.fail_only)\n        self.formatter.preprocess()\n\n    def postprocess(self, broker):\n        self.formatter.postprocess()\n", "path": "insights/formats/text.py"}], "after_files": [{"content": "from __future__ import print_function\nimport six\nimport sys\nimport inspect\nfrom collections import namedtuple\n\nfrom pprint import pprint\nfrom six import StringIO\nfrom insights import dr, datasource, rule, condition, incident, parser\nfrom insights.core.context import ExecutionContext\nfrom insights.formats import Formatter, FormatterAdapter, render\n\n\ntry:\n    from colorama import Fore, Style, init\n    init()\nexcept ImportError:\n    print(\"Install colorama if console colors are preferred.\")\n\n    class Default(type):\n        def __getattr__(*args):\n            return \"\"\n\n    class Fore(six.with_metaclass(Default)):\n        pass\n\n    class Style(six.with_metaclass(Default)):\n        pass\n\n\ndef _find_context(broker):\n    for k, v in broker.instances.items():\n        if inspect.isclass(k) and issubclass(k, ExecutionContext):\n            return v\n\n\ndef render_links(component):\n    links = dr.get_delegate(component).links or {}\n    if any(links.values()):\n        space = \" \" * 4\n        dbl_space = space * 2\n        output = StringIO()\n        output.write(\"Links:\\n\")\n        for key in sorted(links):\n            values = sorted(links[key])\n            if values:\n                output.write(space + key + \":\\n\")\n                for v in values:\n                    output.write(dbl_space + v + \"\\n\")\n        output.seek(0)\n        return output.read()\n    return \"\"\n\n\nclass HumanReadableFormat(Formatter):\n    \"\"\"\n    This class prints a human readable summary of rule hits. It should be used\n    as a context manager and given an instance of an\n    ``insights.core.dr.Broker``. ``dr.run`` should be called within the context\n    using the same broker.\n\n    Args:\n        broker (Broker): the broker to watch and provide a summary about.\n        missing (bool): shows rules with missing dependencies if True.\n        tracebacks (bool): shows tracebacks if any exceptions were raised.\n            Useful for debugging.\n        dropped (bool): Shows any files that weren't collected if running\n            against an archive. Included for a corner case and typically not\n            used in general.\n        stream (file-like): Output is written to stream. Defaults to sys.stdout.\n    \"\"\"\n    def __init__(self, broker,\n            missing=False,\n            tracebacks=False,\n            dropped=False,\n            fail_only=False,\n            stream=sys.stdout):\n        self.broker = broker\n        self.missing = missing\n        self.tracebacks = tracebacks\n        self.dropped = dropped\n        self.fail_only = fail_only\n        self.stream = stream\n\n    def print_header(self, header, color):\n        ln = len(header)\n        print(color + '-' * ln, file=self.stream)\n        print(header, file=self.stream)\n        print('-' * ln + Style.RESET_ALL, file=self.stream)\n\n    def preprocess(self):\n        response = namedtuple('response', 'color label intl title')\n        self.responses = {\n            'pass': response(color=Fore.GREEN, label=\"PASS\", intl='P', title=\"Passed      : \"),\n            'rule': response(color=Fore.RED, label=\"FAIL\", intl='F', title=\"Failed      : \"),\n            'info': response(color=Fore.WHITE, label=\"INFO\", intl='I', title=\"Info        : \"),\n            'skip': response(color=Fore.BLUE, label=\"SKIP\", intl='S', title=\"Missing Deps: \"),\n            'fingerprint': response(color=Fore.YELLOW, label=\"FINGERPRINT\", intl='P',\n                                  title=\"Fingerprint : \"),\n            'metadata': response(color=Fore.YELLOW, label=\"META\", intl='M', title=\"Metadata    : \"),\n            'metadata_key': response(color=Fore.MAGENTA, label=\"META\", intl='K', title=\"Metadata Key: \"),\n            'exception': response(color=Fore.RED, label=\"EXCEPT\", intl='E', title=\"Exceptions  : \")\n        }\n\n        self.counts = {}\n        for key in self.responses:\n            self.counts[key] = 0\n\n        self.print_header(\"Progress:\", Fore.CYAN)\n        self.broker.add_observer(self.progress_bar, rule)\n        self.broker.add_observer(self.progress_bar, condition)\n        self.broker.add_observer(self.progress_bar, incident)\n        self.broker.add_observer(self.progress_bar, parser)\n\n    def progress_bar(self, c, broker):\n        \"\"\"\n        Print the formated progress information for the processed return types\n        \"\"\"\n        v = broker.get(c)\n\n        if v and isinstance(v, dict) and len(v) > 0 and 'type' in v:\n            if v[\"type\"] in self.responses:\n                print(self.responses[v[\"type\"]].color + self.responses[v[\"type\"]].intl + Style.RESET_ALL, end=\"\", file=self.stream)\n            else:\n                print(\".\", end=\"\", file=self.stream)\n        elif c in broker.exceptions:\n            self.counts['exception'] += len(broker.exceptions[c])\n            print(Fore.RED + \"E\" + Style.RESET_ALL, end=\"\", file=self.stream)\n        return self\n\n    def show_tracebacks(self):\n        \"\"\" Show tracebacks \"\"\"\n        if self.broker.tracebacks:\n            print(file=self.stream)\n            print(\"Tracebacks:\", file=self.stream)\n            for t in self.broker.tracebacks.values():\n                print(t, file=self.stream)\n\n    def show_dropped(self):\n        \"\"\" Show dropped files \"\"\"\n        ctx = _find_context(self.broker)\n        if ctx and ctx.all_files:\n            ds = self.broker.get_by_type(datasource)\n            vals = []\n            for v in ds.values():\n                if isinstance(v, list):\n                    vals.extend(d.path for d in v)\n                else:\n                    vals.append(v.path)\n            dropped = set(ctx.all_files) - set(vals)\n            pprint(\"Dropped Files:\", stream=self.stream)\n            pprint(dropped, indent=4, stream=self.stream)\n\n    def show_description(self):\n        \"\"\" Prints the formatted response for the matching return type \"\"\"\n\n        def printit(c, v):\n            resp = self.responses[v[\"type\"]]\n            name = \"[%s] %s\" % (resp.label, dr.get_name(c))\n            underline = \"-\" * len(name)\n            name = \"%s%s%s\" % (resp.color, name, Style.RESET_ALL)\n            print(name, file=self.stream)\n            print(underline, file=self.stream)\n            print(render_links(c), file=self.stream)\n            print(render(c, v), file=self.stream)\n            print(file=self.stream)\n\n        for c in sorted(self.broker.get_by_type(rule), key=dr.get_name):\n            v = self.broker[c]\n            _type = v.get('type')\n            if _type in self.responses:\n                self.counts[_type] += 1\n            if (_type and ((self.fail_only and _type == 'rule') or\n                           ((self.missing and _type == 'skip') or\n                            (not self.fail_only and _type != 'skip')))):\n                printit(c, v)\n        print(file=self.stream)\n\n        self.print_header(\"Rule Execution Summary\", Fore.CYAN)\n        for c in self.counts:\n            print(self.responses[c].color + self.responses[c].title + str(self.counts[c]) + Style.RESET_ALL, file=self.stream)\n\n    def postprocess(self):\n        if self.tracebacks:\n            self.show_tracebacks()\n        if self.dropped:\n            self.show_dropped()\n\n        print(file=self.stream)\n        print(file=self.stream)\n        self.print_header(\"Rules Executed\", Fore.CYAN)\n        self.show_description()\n\n\nclass HumanReadableFormatAdapter(FormatterAdapter):\n    \"\"\" Displays results in a human readable format. \"\"\"\n\n    @staticmethod\n    def configure(p):\n        p.add_argument(\"-m\", \"--missing\", help=\"Show missing requirements.\", action=\"store_true\")\n        p.add_argument(\"-t\", \"--tracebacks\", help=\"Show stack traces.\", action=\"store_true\")\n        p.add_argument(\"-d\", \"--dropped\", help=\"Show collected files that weren't processed.\", action=\"store_true\")\n        p.add_argument(\"-F\", \"--fail-only\", help=\"Show FAIL results only. Conflict with '-m' or '-f', will be dropped when using them together\", action=\"store_true\")\n\n    def __init__(self, args):\n        self.missing = args.missing\n        self.tracebacks = args.tracebacks\n        self.dropped = args.dropped\n        self.fail_only = args.fail_only\n        self.formatter = None\n        if self.missing and self.fail_only:\n            print(Fore.YELLOW + 'Options conflict: -m and -F, drops -F', file=sys.stderr)\n            self.fail_only = False\n\n    def preprocess(self, broker):\n        self.formatter = HumanReadableFormat(broker,\n                self.missing, self.tracebacks, self.dropped, self.fail_only)\n        self.formatter.preprocess()\n\n    def postprocess(self, broker):\n        self.formatter.postprocess()\n", "path": "insights/formats/text.py"}]}