From 2be89e587c057ee97d1b143de1a54ceeea22aa93 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Tue, 2 Apr 2019 10:56:45 +0100 Subject: [PATCH] sphinxext: Fix Sphinx 3.0 compatibility Sphinx is currently issuing the following warnings for projects using this extension. RemovedInSphinx30Warning: sphinx.locale.l_() is deprecated. Please use `_()` instead. Head this off before it becomes an issue. Change-Id: I108d36ab909a7afd4fd28bfb565812f69ae02118 Signed-off-by: Stephen Finucane --- wsmeext/sphinxext.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/wsmeext/sphinxext.py b/wsmeext/sphinxext.py index 7e40cfa..3881a90 100644 --- a/wsmeext/sphinxext.py +++ b/wsmeext/sphinxext.py @@ -10,7 +10,7 @@ from sphinx.ext import autodoc from sphinx.domains.python import PyClasslike, PyClassmember from sphinx.domains import Domain, ObjType from sphinx.directives import ObjectDescription -from sphinx.locale import l_, _ +from sphinx.locale import _ from sphinx.roles import XRefRole from sphinx.util.docfields import Field from sphinx.util.nodes import make_refnode @@ -156,7 +156,7 @@ class TypeDirective(PyClasslike): class AttributeDirective(PyClassmember): doc_field_types = [ - Field('datatype', label=l_('Type'), has_arg=False, + Field('datatype', label=_('Type'), has_arg=False, names=('type', 'datatype')) ] @@ -237,7 +237,7 @@ class TypeDocumenter(autodoc.ClassDocumenter): if protocols: sample_obj = make_sample_object(self.object) content.extend([ - l_(u'Data samples:'), + _(u'Data samples:'), u'', u'.. cssclass:: toggle', u'' @@ -441,7 +441,7 @@ def document_function(funcdef, docstrings=None, protocols=['restjson']): make_sample_object(arg.datatype) )) codesamples.extend([ - u':%s:' % l_(u'Parameters samples'), + u':%s:' % _(u'Parameters samples'), u' .. cssclass:: toggle', u'' ]) @@ -460,7 +460,7 @@ def document_function(funcdef, docstrings=None, protocols=['restjson']): if funcdef.return_type: codesamples.extend([ - u':%s:' % l_(u'Return samples'), + u':%s:' % _(u'Return samples'), u' .. cssclass:: toggle', u'' ]) @@ -547,8 +547,8 @@ class WSMEDomain(Domain): label = 'WSME' object_types = { - 'type': ObjType(l_('type'), 'type', 'obj'), - 'service': ObjType(l_('service'), 'service', 'obj') + 'type': ObjType(_('type'), 'type', 'obj'), + 'service': ObjType(_('service'), 'service', 'obj') } directives = {