Server IP : 192.158.238.246 / Your IP : 52.14.123.251 Web Server : LiteSpeed System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64 User : jenniferflocom ( 1321) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/alt/python37/share/doc/alt-python37-psycopg2/doc/src/tools/lib/ |
Upload File : |
# -*- coding: utf-8 -*- """ extension ~~~~~~~~~ A directive to create a box warning that a certain bit of Psycopg is an extension to the DBAPI 2.0. :copyright: Copyright 2010 by Daniele Varrazzo. """ from docutils import nodes from sphinx.locale import _ from docutils.parsers.rst import Directive class extension_node(nodes.Admonition, nodes.Element): pass class Extension(Directive): """ An extension entry, displayed as an admonition. """ has_content = True required_arguments = 0 optional_arguments = 0 final_argument_whitespace = False option_spec = {} def run(self): node = extension_node('\n'.join(self.content)) node += nodes.title(_('DB API extension'), _('DB API extension')) self.state.nested_parse(self.content, self.content_offset, node) node['classes'].append('dbapi-extension') return [node] def visit_extension_node(self, node): self.visit_admonition(node) def depart_extension_node(self, node): self.depart_admonition(node) def setup(app): app.add_node(extension_node, html=(visit_extension_node, depart_extension_node), latex=(visit_extension_node, depart_extension_node), text=(visit_extension_node, depart_extension_node)) app.add_directive('extension', Extension)