[CLN] core: upgrade to python 3.6
& sort imports
closes odoo/documentation#2957
X-original-commit: 8a5aa384d3
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
parent
5ec67044a8
commit
5128208495
6
conf.py
6
conf.py
@ -1,14 +1,14 @@
|
||||
import re
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import docutils
|
||||
import sphinx
|
||||
from pygments.lexers import JsonLexer, XmlLexer
|
||||
from sphinx.ext import graphviz
|
||||
from sphinx.util import logging
|
||||
import sphinx
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
@ -277,7 +277,7 @@ latex_documents = [
|
||||
('legal/terms/i18n/partnership_tex_fr',
|
||||
'odoo_partnership_agreement_fr.tex', 'Odoo Partnership Agreement (FR)', '', 'howto'),
|
||||
('legal/terms/i18n/terms_of_sale_fr', 'terms_of_sale_fr.tex',
|
||||
u'Conditions Générales de Vente Odoo', '', 'howto'),
|
||||
'Conditions Générales de Vente Odoo', '', 'howto'),
|
||||
|
||||
('legal/terms/i18n/enterprise_tex_nl', 'odoo_enterprise_agreement_nl.tex',
|
||||
'Odoo Enterprise Subscription Agreement (NL)', '', 'howto'),
|
||||
|
@ -1,7 +1,8 @@
|
||||
import base64
|
||||
import time
|
||||
import sys
|
||||
import json
|
||||
import sys
|
||||
import time
|
||||
|
||||
import requests
|
||||
|
||||
account_token = "integration_token" # Use your token
|
||||
|
@ -3,12 +3,11 @@ from typing import Sequence
|
||||
|
||||
from docutils.parsers.rst import directives
|
||||
from docutils.parsers.rst.states import RSTState
|
||||
from sphinx.domains.python import PyClasslike, PyAttribute
|
||||
from sphinx.domains.python import PyAttribute, PyClasslike
|
||||
from sphinx.ext.autodoc import AttributeDocumenter, ClassDocumenter
|
||||
|
||||
import odoo
|
||||
|
||||
|
||||
nested_parse = RSTState.nested_parse
|
||||
def patched_nested_parse(self, block, input_offset, node, match_titles=False,
|
||||
state_machine_class=None, state_machine_kwargs=None):
|
||||
|
@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
ReST directive for embedding Youtube and Vimeo videos.
|
||||
There are two directives added: ``youtube`` and ``vimeo``. The only
|
||||
@ -13,7 +12,6 @@
|
||||
:copyright: (c) 2012 by Danilo Bargen.
|
||||
:license: BSD 3-clause
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from docutils import nodes
|
||||
from docutils.parsers.rst import Directive, directives
|
||||
|
||||
|
@ -19,9 +19,10 @@ Notes
|
||||
* explicitly imports ``odoo``, so useless for anyone else
|
||||
"""
|
||||
|
||||
import inspect
|
||||
import importlib
|
||||
import inspect
|
||||
import os.path
|
||||
|
||||
import werkzeug
|
||||
|
||||
|
||||
@ -60,7 +61,7 @@ def setup(app):
|
||||
try:
|
||||
obj_source_path = inspect.getsourcefile(obj)
|
||||
_, line = inspect.getsourcelines(obj)
|
||||
except (TypeError, IOError):
|
||||
except (TypeError, OSError):
|
||||
# obj doesn't have a module, or something
|
||||
return None
|
||||
|
||||
@ -115,4 +116,4 @@ def add_doc_link(app, pagename, templatename, context, doctree):
|
||||
source_suffix = app.config.source_suffix
|
||||
source_suffix = next(iter(source_suffix))
|
||||
context['github_link'] = lambda mode='edit': make_github_link(
|
||||
app, 'content/%s%s' % (pagename, source_suffix), mode=mode)
|
||||
app, f'content/{pagename}{source_suffix}', mode=mode)
|
||||
|
@ -1,5 +1,5 @@
|
||||
from docutils.parsers.rst import Directive, directives
|
||||
from docutils import nodes
|
||||
from docutils.parsers.rst import Directive, directives
|
||||
|
||||
|
||||
class PlaceHolder(Directive):
|
||||
|
@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Defines a "raw HTML" domain with a ``div[classes]`` and a number of roles
|
||||
rendered more or less directly to HTML.
|
||||
@ -13,12 +11,11 @@ for directives likes .. h:div::
|
||||
TO REMOVE AS SOON AS WE DROP MEMENTOES
|
||||
"""
|
||||
|
||||
import sphinx
|
||||
import sphinx.roles
|
||||
from docutils import nodes, utils
|
||||
from docutils.parsers.rst import Directive, directives
|
||||
from docutils.parsers.rst.directives.body import LineBlock
|
||||
|
||||
import sphinx
|
||||
import sphinx.roles
|
||||
from sphinx.domains import Domain
|
||||
|
||||
|
||||
@ -78,7 +75,7 @@ class address(nodes.General, nodes.Element):
|
||||
|
||||
class Address(LineBlock):
|
||||
def run(self):
|
||||
[node] = super(Address, self).run()
|
||||
[node] = super().run()
|
||||
ad = address(node.rawsource, *node.children)
|
||||
return [ad]
|
||||
|
||||
|
@ -25,7 +25,7 @@ def set_missing_meta(app, pagename, templatename, context, doctree):
|
||||
if context.get('meta') is None: # Pages without title (used with `include::`) have no meta
|
||||
context['meta'] = {}
|
||||
|
||||
class Monkey(object):
|
||||
class Monkey:
|
||||
""" Replace patched method of an object by a new method receiving the old one in argument. """
|
||||
def __init__(self, obj):
|
||||
self.obj = obj
|
||||
|
@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from pygments.style import Style
|
||||
from pygments.token import Keyword, Name, Comment, String, Error, \
|
||||
Number, Other, Whitespace, Generic
|
||||
@ -40,8 +39,9 @@ class OdooStyle(Style):
|
||||
Error: 'bg:#ffe2e2 #a61717'
|
||||
}
|
||||
|
||||
import types
|
||||
import sys
|
||||
import types
|
||||
|
||||
modname = 'pygments.styles.odoo'
|
||||
m = types.ModuleType(modname)
|
||||
m.OdooStyle = OdooStyle
|
||||
|
@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from docutils import nodes
|
||||
from sphinx.locale import admonitionlabels
|
||||
from sphinx.writers.html5 import HTML5Translator
|
||||
@ -77,16 +75,16 @@ class BootstrapTranslator(HTML5Translator):
|
||||
|
||||
def encode(self, text):
|
||||
return str(text).translate({
|
||||
ord('&'): u'&',
|
||||
ord('<'): u'<',
|
||||
ord('"'): u'"',
|
||||
ord('>'): u'>',
|
||||
0xa0: u' '
|
||||
ord('&'): '&',
|
||||
ord('<'): '<',
|
||||
ord('"'): '"',
|
||||
ord('>'): '>',
|
||||
0xa0: ' '
|
||||
})
|
||||
|
||||
def unknown_visit(self, node):
|
||||
print("unknown node", node.__class__.__name__)
|
||||
self.body.append(u'[UNKNOWN NODE {}]'.format(node.__class__.__name__))
|
||||
self.body.append(f'[UNKNOWN NODE {node.__class__.__name__}]')
|
||||
raise nodes.SkipNode
|
||||
|
||||
# NOTE: seems that when we remove/comment this, we get the titles 5 times in the global toc
|
||||
@ -100,7 +98,7 @@ class BootstrapTranslator(HTML5Translator):
|
||||
# close "parent" or preceding section, unless this is the opening of
|
||||
# the first section
|
||||
if self.section_level:
|
||||
self.body.append(u'</section>')
|
||||
self.body.append('</section>')
|
||||
self.section_level += 1
|
||||
|
||||
self.body.append(self.starttag(node, 'section'))
|
||||
@ -108,7 +106,7 @@ class BootstrapTranslator(HTML5Translator):
|
||||
self.section_level -= 1
|
||||
# close last section of document
|
||||
if not self.section_level:
|
||||
self.body.append(u'</section>')
|
||||
self.body.append('</section>')
|
||||
|
||||
# overwritten
|
||||
# Class mapping:
|
||||
@ -135,7 +133,7 @@ class BootstrapTranslator(HTML5Translator):
|
||||
|
||||
def depart_title(self, node):
|
||||
if isinstance(node.parent, nodes.Admonition):
|
||||
self.body.append(u"</p>")
|
||||
self.body.append("</p>")
|
||||
else:
|
||||
super().depart_title(node)
|
||||
|
||||
@ -148,7 +146,7 @@ class BootstrapTranslator(HTML5Translator):
|
||||
# c/p of https://github.com/pydata/pydata-sphinx-theme/pull/509/files
|
||||
self._table_row_indices.append(0)
|
||||
|
||||
classes = [cls.strip(u' \t\n')
|
||||
classes = [cls.strip(' \t\n')
|
||||
for cls in self.settings.table_style.split(',')]
|
||||
classes.insert(0, "docutils") # compat
|
||||
classes.insert(0, "table") # compat
|
||||
|
@ -1,6 +1,5 @@
|
||||
# Adapted from https://github.com/sphinx-contrib/redirects
|
||||
|
||||
import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
@ -23,7 +22,7 @@ def generate_redirects(app):
|
||||
return
|
||||
|
||||
source_suffix = next(iter(app.config.source_suffix))
|
||||
escaped_source_suffix = source_suffix.replace('.', '\.')
|
||||
escaped_source_suffix = source_suffix.replace('.', r'\.')
|
||||
pattern = re.compile(
|
||||
r'^[ \t]*([\w\-/]+{0})[ \t]+([\w\-/]+{0})[ \t]*(?:#.*)?$'.format(escaped_source_suffix)
|
||||
)
|
||||
|
@ -5,18 +5,16 @@ Salvaged from https://github.com/executablebooks/sphinx-tabs
|
||||
"""
|
||||
|
||||
import base64
|
||||
from pathlib import Path
|
||||
from functools import partial
|
||||
from pathlib import Path
|
||||
|
||||
import sphinx
|
||||
|
||||
|
||||
from docutils import nodes
|
||||
from docutils.parsers.rst import directives
|
||||
from pygments.lexers import get_all_lexers
|
||||
from sphinx.directives.code import CodeBlock
|
||||
from sphinx.highlighting import lexer_classes
|
||||
from sphinx.util.docutils import SphinxDirective
|
||||
from sphinx.directives.code import CodeBlock
|
||||
|
||||
|
||||
FILES = [
|
||||
"tabs.js",
|
||||
|
Loading…
Reference in New Issue
Block a user