Repository: boto/botocore (python)

Issue:
API Gateway Documentation Duplicate AWS CLI targets
This is coming from aws/aws-cli#2786. Looking over the botocore service files for API gateway, there are multiple links with the "AWS CLI" target including the `get-method` method. Needs to be something more specific to avoid sphinx target errors on the `aws-cli` side. Since I'm anticipating that these service files are auto generated I'm holding off on any sort of pull request.

Pull request:
Make links anonymous
Sphinx will throw warnings if you have two uri's with the same name
but different targets because it helpfully assumes your intent was
to make an embedded uri global. This add an additional underscore to
the end of those links to make Sphinx treat them as 'anonymous'.

The links do still work properly without this change, but the CLI
will spit out warnings without it, which is not a great customer
experience.

Fixes #1268
Fixes aws/aws-cli#2786

Patch:
diff --git a/botocore/docs/bcdoc/style.py b/botocore/docs/bcdoc/style.py
index 622974b26..ac42d55e2 100644
--- a/botocore/docs/bcdoc/style.py
+++ b/botocore/docs/bcdoc/style.py
@@ -220,18 +220,18 @@ class ReSTStyle(BaseStyle):
                 if ':' in last_write:
                     last_write = last_write.replace(':', r'\:')
                 self.doc.push_write(last_write)
-                self.doc.push_write(' <%s>`_' % self.a_href)
+                self.doc.push_write(' <%s>`__' % self.a_href)
             elif last_write == '`':
                 # Look at start_a().  It will do a self.doc.write('`')
                 # which is the start of the link title.  If that is the
                 # case then there was no link text.  We should just
                 # use an inline link.  The syntax of this is
                 # `<http://url>`_
-                self.doc.push_write('`<%s>`_' % self.a_href)
+                self.doc.push_write('`<%s>`__' % self.a_href)
             else:
                 self.doc.push_write(self.a_href)
                 self.doc.hrefs[self.a_href] = self.a_href
-                self.doc.write('`_')
+                self.doc.write('`__')
             self.a_href = None
         self.doc.write(' ')
 


Test patch:
diff --git a/tests/unit/docs/bcdoc/test_style.py b/tests/unit/docs/bcdoc/test_style.py
index c561a0fad..a6278733a 100644
--- a/tests/unit/docs/bcdoc/test_style.py
+++ b/tests/unit/docs/bcdoc/test_style.py
@@ -153,7 +153,7 @@ class TestStyle(unittest.TestCase):
         style.end_a()
         self.assertEqual(
             style.doc.getvalue(),
-            six.b('`example <http://example.org>`_ ')
+            six.b('`example <http://example.org>`__ ')
         )
 
     def test_escape_href_link(self):
@@ -163,14 +163,14 @@ class TestStyle(unittest.TestCase):
         style.end_a()
         self.assertEqual(
             style.doc.getvalue(),
-            six.b('`foo\\: the next bar <http://example.org>`_ '))
+            six.b('`foo\\: the next bar <http://example.org>`__ '))
 
     def test_handle_no_text_hrefs(self):
         style = ReSTStyle(ReSTDocument())
         style.start_a(attrs=[('href', 'http://example.org')])
         style.end_a()
         self.assertEqual(style.doc.getvalue(),
-                         six.b('`<http://example.org>`_ '))
+                         six.b('`<http://example.org>`__ '))
 
     def test_sphinx_reference_label_html(self):
         style = ReSTStyle(ReSTDocument())