• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Gallopsled / pwntools / 8912ca5a8c3a9725c3ba6d30561607150a6faebe-PR-2205

pending completion
8912ca5a8c3a9725c3ba6d30561607150a6faebe-PR-2205

Pull #2205

github-actions

web-flow
Merge 81f463e2c into 8b4cacf8b
Pull Request #2205: Fix stable Python 2 installation from a built wheel

3878 of 6371 branches covered (60.87%)

12199 of 16604 relevant lines covered (73.47%)

0.73 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

53.33
/pwnlib/internal/dochelper.py
1
from __future__ import division
1✔
2

3
import sys
1✔
4
from os.path import basename
1✔
5

6
from docutils import nodes
1✔
7
from docutils import statemachine
1✔
8
try:
1✔
9
    from sphinx.util.compat import Directive
1✔
10
except ImportError:
1✔
11
    from docutils.parsers.rst import Directive
1✔
12

13
try:
1✔
14
    from StringIO import StringIO
1✔
15
except ImportError:
×
16
    from io import StringIO
×
17

18

19
class ExecDirective(Directive):
1✔
20
    """Execute the specified python code and insert the output into the document"""
21
    has_content = True
1✔
22

23
    def run(self):
1✔
24
        old_stdout, sys.stdout = sys.stdout, StringIO()
×
25

26
        tab_width = self.options.get('tab-width', self.state.document.settings.tab_width)
×
27
        source = self.state_machine.input_lines.source(self.lineno - self.state_machine.input_offset - 1)
×
28

29
        try:
×
30
            exec('\n'.join(self.content), globals())
×
31
            text = sys.stdout.getvalue()
×
32
            lines = statemachine.string2lines(text, tab_width, convert_whitespace = True)
×
33
            self.state_machine.insert_input(lines, source)
×
34
            return []
×
35
        except Exception:
×
36
            return [nodes.error(None, nodes.paragraph(text = "Unable to execute python code at %s:%d:" % (basename(source), self.lineno)), nodes.paragraph(text = str(sys.exc_info()[1])))]
×
37
        finally:
38
            sys.stdout = old_stdout
×
39

40
def setup(app):
1✔
41
    app.add_directive('exec', ExecDirective)
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc