We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Upgrade packaged rfc3986
Upgrade to v1.3.2

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/urllib3/packages/rfc3986/__init__.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 # Copyright (c) 2014 Rackspace
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #    http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12 # implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 """
17 An implementation of semantics and validations described in RFC 3986.
18 
19 See http://rfc3986.readthedocs.io/ for detailed documentation.
20 
21 :copyright: (c) 2014 Rackspace
22 :license: Apache v2.0, see LICENSE for details
23 """
24 
25 from .api import iri_reference
26 from .api import IRIReference
27 from .api import is_valid_uri
28 from .api import normalize_uri
29 from .api import uri_reference
30 from .api import URIReference
31 from .api import urlparse
32 from .parseresult import ParseResult
33 
34 __title__ = 'rfc3986'
35 __author__ = 'Ian Stapleton Cordasco'
36 __author_email__ = 'graffatcolmingov@gmail.com'
37 __license__ = 'Apache v2.0'
38 __copyright__ = 'Copyright 2014 Rackspace'
39 __version__ = '1.3.1'
40 
41 __all__ = (
42     'ParseResult',
43     'URIReference',
44     'IRIReference',
45     'is_valid_uri',
46     'normalize_uri',
47     'uri_reference',
48     'iri_reference',
49     'urlparse',
50     '__title__',
51     '__author__',
52     '__author_email__',
53     '__license__',
54     '__copyright__',
55     '__version__',
56 )
57
```

Path: `src/urllib3/packages/rfc3986/misc.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 # Copyright (c) 2014 Rackspace
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #    http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12 # implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 """
16 Module containing compiled regular expressions and constants.
17 
18 This module contains important constants, patterns, and compiled regular
19 expressions for parsing and validating URIs and their components.
20 """
21 
22 import re
23 
24 from . import abnf_regexp
25 
26 # These are enumerated for the named tuple used as a superclass of
27 # URIReference
28 URI_COMPONENTS = ['scheme', 'authority', 'path', 'query', 'fragment']
29 
30 important_characters = {
31     'generic_delimiters': abnf_regexp.GENERIC_DELIMITERS,
32     'sub_delimiters': abnf_regexp.SUB_DELIMITERS,
33     # We need to escape the '*' in this case
34     're_sub_delimiters': abnf_regexp.SUB_DELIMITERS_RE,
35     'unreserved_chars': abnf_regexp.UNRESERVED_CHARS,
36     # We need to escape the '-' in this case:
37     're_unreserved': abnf_regexp.UNRESERVED_RE,
38 }
39 
40 # For details about delimiters and reserved characters, see:
41 # http://tools.ietf.org/html/rfc3986#section-2.2
42 GENERIC_DELIMITERS = abnf_regexp.GENERIC_DELIMITERS_SET
43 SUB_DELIMITERS = abnf_regexp.SUB_DELIMITERS_SET
44 RESERVED_CHARS = abnf_regexp.RESERVED_CHARS_SET
45 # For details about unreserved characters, see:
46 # http://tools.ietf.org/html/rfc3986#section-2.3
47 UNRESERVED_CHARS = abnf_regexp.UNRESERVED_CHARS_SET
48 NON_PCT_ENCODED = abnf_regexp.NON_PCT_ENCODED_SET
49 
50 URI_MATCHER = re.compile(abnf_regexp.URL_PARSING_RE)
51 
52 SUBAUTHORITY_MATCHER = re.compile((
53     '^(?:(?P<userinfo>{0})@)?'  # userinfo
54     '(?P<host>{1})'  # host
55     ':?(?P<port>{2})?$'  # port
56     ).format(abnf_regexp.USERINFO_RE,
57              abnf_regexp.HOST_PATTERN,
58              abnf_regexp.PORT_RE))
59 
60 
61 HOST_MATCHER = re.compile('^' + abnf_regexp.HOST_RE + '$')
62 IPv4_MATCHER = re.compile('^' + abnf_regexp.IPv4_RE + '$')
63 IPv6_MATCHER = re.compile(r'^\[' + abnf_regexp.IPv6_ADDRZ_RFC4007_RE + r'\]$')
64 
65 # Used by host validator
66 IPv6_NO_RFC4007_MATCHER = re.compile(r'^\[%s\]$' % (
67     abnf_regexp.IPv6_ADDRZ_RE
68 ))
69 
70 # Matcher used to validate path components
71 PATH_MATCHER = re.compile(abnf_regexp.PATH_RE)
72 
73 
74 # ##################################
75 # Query and Fragment Matcher Section
76 # ##################################
77 
78 QUERY_MATCHER = re.compile(abnf_regexp.QUERY_RE)
79 
80 FRAGMENT_MATCHER = QUERY_MATCHER
81 
82 # Scheme validation, see: http://tools.ietf.org/html/rfc3986#section-3.1
83 SCHEME_MATCHER = re.compile('^{0}$'.format(abnf_regexp.SCHEME_RE))
84 
85 RELATIVE_REF_MATCHER = re.compile(r'^%s(\?%s)?(#%s)?$' % (
86     abnf_regexp.RELATIVE_PART_RE,
87     abnf_regexp.QUERY_RE,
88     abnf_regexp.FRAGMENT_RE,
89 ))
90 
91 # See http://tools.ietf.org/html/rfc3986#section-4.3
92 ABSOLUTE_URI_MATCHER = re.compile(r'^%s:%s(\?%s)?$' % (
93     abnf_regexp.COMPONENT_PATTERN_DICT['scheme'],
94     abnf_regexp.HIER_PART_RE,
95     abnf_regexp.QUERY_RE[1:-1],
96 ))
97 
98 # ###############
99 # IRIs / RFC 3987
100 # ###############
101 
102 IRI_MATCHER = re.compile(abnf_regexp.URL_PARSING_RE, re.UNICODE)
103 
104 ISUBAUTHORITY_MATCHER = re.compile((
105     u'^(?:(?P<userinfo>{0})@)?'  # iuserinfo
106     u'(?P<host>{1})'  # ihost
107     u':?(?P<port>{2})?$'  # port
108     ).format(abnf_regexp.IUSERINFO_RE,
109              abnf_regexp.IHOST_RE,
110              abnf_regexp.PORT_RE), re.UNICODE)
111 
112 
113 IHOST_MATCHER = re.compile('^' + abnf_regexp.IHOST_RE + '$', re.UNICODE)
114 
115 IPATH_MATCHER = re.compile(abnf_regexp.IPATH_RE, re.UNICODE)
116 
117 IQUERY_MATCHER = re.compile(abnf_regexp.IQUERY_RE, re.UNICODE)
118 
119 IFRAGMENT_MATCHER = re.compile(abnf_regexp.IFRAGMENT_RE, re.UNICODE)
120 
121 
122 RELATIVE_IRI_MATCHER = re.compile(u'^%s(?:\\?%s)?(?:%s)?$' % (
123     abnf_regexp.IRELATIVE_PART_RE,
124     abnf_regexp.IQUERY_RE,
125     abnf_regexp.IFRAGMENT_RE
126 ), re.UNICODE)
127 
128 ABSOLUTE_IRI_MATCHER = re.compile(u'^%s:%s(?:\\?%s)?$' % (
129     abnf_regexp.COMPONENT_PATTERN_DICT['scheme'],
130     abnf_regexp.IHIER_PART_RE,
131     abnf_regexp.IQUERY_RE[1:-1]
132 ), re.UNICODE)
133 
134 
135 # Path merger as defined in http://tools.ietf.org/html/rfc3986#section-5.2.3
136 def merge_paths(base_uri, relative_path):
137     """Merge a base URI's path with a relative URI's path."""
138     if base_uri.path is None and base_uri.authority is not None:
139         return '/' + relative_path
140     else:
141         path = base_uri.path or ''
142         index = path.rfind('/')
143         return path[:index] + '/' + relative_path
144 
145 
146 UseExisting = object()
147
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/urllib3/packages/rfc3986/__init__.py b/src/urllib3/packages/rfc3986/__init__.py
--- a/src/urllib3/packages/rfc3986/__init__.py
+++ b/src/urllib3/packages/rfc3986/__init__.py
@@ -36,7 +36,7 @@
 __author_email__ = 'graffatcolmingov@gmail.com'
 __license__ = 'Apache v2.0'
 __copyright__ = 'Copyright 2014 Rackspace'
-__version__ = '1.3.1'
+__version__ = '1.3.2'
 
 __all__ = (
     'ParseResult',
diff --git a/src/urllib3/packages/rfc3986/misc.py b/src/urllib3/packages/rfc3986/misc.py
--- a/src/urllib3/packages/rfc3986/misc.py
+++ b/src/urllib3/packages/rfc3986/misc.py
@@ -110,28 +110,6 @@
              abnf_regexp.PORT_RE), re.UNICODE)
 
 
-IHOST_MATCHER = re.compile('^' + abnf_regexp.IHOST_RE + '$', re.UNICODE)
-
-IPATH_MATCHER = re.compile(abnf_regexp.IPATH_RE, re.UNICODE)
-
-IQUERY_MATCHER = re.compile(abnf_regexp.IQUERY_RE, re.UNICODE)
-
-IFRAGMENT_MATCHER = re.compile(abnf_regexp.IFRAGMENT_RE, re.UNICODE)
-
-
-RELATIVE_IRI_MATCHER = re.compile(u'^%s(?:\\?%s)?(?:%s)?$' % (
-    abnf_regexp.IRELATIVE_PART_RE,
-    abnf_regexp.IQUERY_RE,
-    abnf_regexp.IFRAGMENT_RE
-), re.UNICODE)
-
-ABSOLUTE_IRI_MATCHER = re.compile(u'^%s:%s(?:\\?%s)?$' % (
-    abnf_regexp.COMPONENT_PATTERN_DICT['scheme'],
-    abnf_regexp.IHIER_PART_RE,
-    abnf_regexp.IQUERY_RE[1:-1]
-), re.UNICODE)
-
-
 # Path merger as defined in http://tools.ietf.org/html/rfc3986#section-5.2.3
 def merge_paths(base_uri, relative_path):
     """Merge a base URI's path with a relative URI's path."""

{"golden_diff": "diff --git a/src/urllib3/packages/rfc3986/__init__.py b/src/urllib3/packages/rfc3986/__init__.py\n--- a/src/urllib3/packages/rfc3986/__init__.py\n+++ b/src/urllib3/packages/rfc3986/__init__.py\n@@ -36,7 +36,7 @@\n __author_email__ = 'graffatcolmingov@gmail.com'\n __license__ = 'Apache v2.0'\n __copyright__ = 'Copyright 2014 Rackspace'\n-__version__ = '1.3.1'\n+__version__ = '1.3.2'\n \n __all__ = (\n     'ParseResult',\ndiff --git a/src/urllib3/packages/rfc3986/misc.py b/src/urllib3/packages/rfc3986/misc.py\n--- a/src/urllib3/packages/rfc3986/misc.py\n+++ b/src/urllib3/packages/rfc3986/misc.py\n@@ -110,28 +110,6 @@\n              abnf_regexp.PORT_RE), re.UNICODE)\n \n \n-IHOST_MATCHER = re.compile('^' + abnf_regexp.IHOST_RE + '$', re.UNICODE)\n-\n-IPATH_MATCHER = re.compile(abnf_regexp.IPATH_RE, re.UNICODE)\n-\n-IQUERY_MATCHER = re.compile(abnf_regexp.IQUERY_RE, re.UNICODE)\n-\n-IFRAGMENT_MATCHER = re.compile(abnf_regexp.IFRAGMENT_RE, re.UNICODE)\n-\n-\n-RELATIVE_IRI_MATCHER = re.compile(u'^%s(?:\\\\?%s)?(?:%s)?$' % (\n-    abnf_regexp.IRELATIVE_PART_RE,\n-    abnf_regexp.IQUERY_RE,\n-    abnf_regexp.IFRAGMENT_RE\n-), re.UNICODE)\n-\n-ABSOLUTE_IRI_MATCHER = re.compile(u'^%s:%s(?:\\\\?%s)?$' % (\n-    abnf_regexp.COMPONENT_PATTERN_DICT['scheme'],\n-    abnf_regexp.IHIER_PART_RE,\n-    abnf_regexp.IQUERY_RE[1:-1]\n-), re.UNICODE)\n-\n-\n # Path merger as defined in http://tools.ietf.org/html/rfc3986#section-5.2.3\n def merge_paths(base_uri, relative_path):\n     \"\"\"Merge a base URI's path with a relative URI's path.\"\"\"\n", "issue": "Upgrade packaged rfc3986\nUpgrade to v1.3.2\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n# Copyright (c) 2014 Rackspace\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n# implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"\nAn implementation of semantics and validations described in RFC 3986.\n\nSee http://rfc3986.readthedocs.io/ for detailed documentation.\n\n:copyright: (c) 2014 Rackspace\n:license: Apache v2.0, see LICENSE for details\n\"\"\"\n\nfrom .api import iri_reference\nfrom .api import IRIReference\nfrom .api import is_valid_uri\nfrom .api import normalize_uri\nfrom .api import uri_reference\nfrom .api import URIReference\nfrom .api import urlparse\nfrom .parseresult import ParseResult\n\n__title__ = 'rfc3986'\n__author__ = 'Ian Stapleton Cordasco'\n__author_email__ = 'graffatcolmingov@gmail.com'\n__license__ = 'Apache v2.0'\n__copyright__ = 'Copyright 2014 Rackspace'\n__version__ = '1.3.1'\n\n__all__ = (\n    'ParseResult',\n    'URIReference',\n    'IRIReference',\n    'is_valid_uri',\n    'normalize_uri',\n    'uri_reference',\n    'iri_reference',\n    'urlparse',\n    '__title__',\n    '__author__',\n    '__author_email__',\n    '__license__',\n    '__copyright__',\n    '__version__',\n)\n", "path": "src/urllib3/packages/rfc3986/__init__.py"}, {"content": "# -*- coding: utf-8 -*-\n# Copyright (c) 2014 Rackspace\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n# implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"\nModule containing compiled regular expressions and constants.\n\nThis module contains important constants, patterns, and compiled regular\nexpressions for parsing and validating URIs and their components.\n\"\"\"\n\nimport re\n\nfrom . import abnf_regexp\n\n# These are enumerated for the named tuple used as a superclass of\n# URIReference\nURI_COMPONENTS = ['scheme', 'authority', 'path', 'query', 'fragment']\n\nimportant_characters = {\n    'generic_delimiters': abnf_regexp.GENERIC_DELIMITERS,\n    'sub_delimiters': abnf_regexp.SUB_DELIMITERS,\n    # We need to escape the '*' in this case\n    're_sub_delimiters': abnf_regexp.SUB_DELIMITERS_RE,\n    'unreserved_chars': abnf_regexp.UNRESERVED_CHARS,\n    # We need to escape the '-' in this case:\n    're_unreserved': abnf_regexp.UNRESERVED_RE,\n}\n\n# For details about delimiters and reserved characters, see:\n# http://tools.ietf.org/html/rfc3986#section-2.2\nGENERIC_DELIMITERS = abnf_regexp.GENERIC_DELIMITERS_SET\nSUB_DELIMITERS = abnf_regexp.SUB_DELIMITERS_SET\nRESERVED_CHARS = abnf_regexp.RESERVED_CHARS_SET\n# For details about unreserved characters, see:\n# http://tools.ietf.org/html/rfc3986#section-2.3\nUNRESERVED_CHARS = abnf_regexp.UNRESERVED_CHARS_SET\nNON_PCT_ENCODED = abnf_regexp.NON_PCT_ENCODED_SET\n\nURI_MATCHER = re.compile(abnf_regexp.URL_PARSING_RE)\n\nSUBAUTHORITY_MATCHER = re.compile((\n    '^(?:(?P<userinfo>{0})@)?'  # userinfo\n    '(?P<host>{1})'  # host\n    ':?(?P<port>{2})?$'  # port\n    ).format(abnf_regexp.USERINFO_RE,\n             abnf_regexp.HOST_PATTERN,\n             abnf_regexp.PORT_RE))\n\n\nHOST_MATCHER = re.compile('^' + abnf_regexp.HOST_RE + '$')\nIPv4_MATCHER = re.compile('^' + abnf_regexp.IPv4_RE + '$')\nIPv6_MATCHER = re.compile(r'^\\[' + abnf_regexp.IPv6_ADDRZ_RFC4007_RE + r'\\]$')\n\n# Used by host validator\nIPv6_NO_RFC4007_MATCHER = re.compile(r'^\\[%s\\]$' % (\n    abnf_regexp.IPv6_ADDRZ_RE\n))\n\n# Matcher used to validate path components\nPATH_MATCHER = re.compile(abnf_regexp.PATH_RE)\n\n\n# ##################################\n# Query and Fragment Matcher Section\n# ##################################\n\nQUERY_MATCHER = re.compile(abnf_regexp.QUERY_RE)\n\nFRAGMENT_MATCHER = QUERY_MATCHER\n\n# Scheme validation, see: http://tools.ietf.org/html/rfc3986#section-3.1\nSCHEME_MATCHER = re.compile('^{0}$'.format(abnf_regexp.SCHEME_RE))\n\nRELATIVE_REF_MATCHER = re.compile(r'^%s(\\?%s)?(#%s)?$' % (\n    abnf_regexp.RELATIVE_PART_RE,\n    abnf_regexp.QUERY_RE,\n    abnf_regexp.FRAGMENT_RE,\n))\n\n# See http://tools.ietf.org/html/rfc3986#section-4.3\nABSOLUTE_URI_MATCHER = re.compile(r'^%s:%s(\\?%s)?$' % (\n    abnf_regexp.COMPONENT_PATTERN_DICT['scheme'],\n    abnf_regexp.HIER_PART_RE,\n    abnf_regexp.QUERY_RE[1:-1],\n))\n\n# ###############\n# IRIs / RFC 3987\n# ###############\n\nIRI_MATCHER = re.compile(abnf_regexp.URL_PARSING_RE, re.UNICODE)\n\nISUBAUTHORITY_MATCHER = re.compile((\n    u'^(?:(?P<userinfo>{0})@)?'  # iuserinfo\n    u'(?P<host>{1})'  # ihost\n    u':?(?P<port>{2})?$'  # port\n    ).format(abnf_regexp.IUSERINFO_RE,\n             abnf_regexp.IHOST_RE,\n             abnf_regexp.PORT_RE), re.UNICODE)\n\n\nIHOST_MATCHER = re.compile('^' + abnf_regexp.IHOST_RE + '$', re.UNICODE)\n\nIPATH_MATCHER = re.compile(abnf_regexp.IPATH_RE, re.UNICODE)\n\nIQUERY_MATCHER = re.compile(abnf_regexp.IQUERY_RE, re.UNICODE)\n\nIFRAGMENT_MATCHER = re.compile(abnf_regexp.IFRAGMENT_RE, re.UNICODE)\n\n\nRELATIVE_IRI_MATCHER = re.compile(u'^%s(?:\\\\?%s)?(?:%s)?$' % (\n    abnf_regexp.IRELATIVE_PART_RE,\n    abnf_regexp.IQUERY_RE,\n    abnf_regexp.IFRAGMENT_RE\n), re.UNICODE)\n\nABSOLUTE_IRI_MATCHER = re.compile(u'^%s:%s(?:\\\\?%s)?$' % (\n    abnf_regexp.COMPONENT_PATTERN_DICT['scheme'],\n    abnf_regexp.IHIER_PART_RE,\n    abnf_regexp.IQUERY_RE[1:-1]\n), re.UNICODE)\n\n\n# Path merger as defined in http://tools.ietf.org/html/rfc3986#section-5.2.3\ndef merge_paths(base_uri, relative_path):\n    \"\"\"Merge a base URI's path with a relative URI's path.\"\"\"\n    if base_uri.path is None and base_uri.authority is not None:\n        return '/' + relative_path\n    else:\n        path = base_uri.path or ''\n        index = path.rfind('/')\n        return path[:index] + '/' + relative_path\n\n\nUseExisting = object()\n", "path": "src/urllib3/packages/rfc3986/misc.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n# Copyright (c) 2014 Rackspace\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n# implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"\nAn implementation of semantics and validations described in RFC 3986.\n\nSee http://rfc3986.readthedocs.io/ for detailed documentation.\n\n:copyright: (c) 2014 Rackspace\n:license: Apache v2.0, see LICENSE for details\n\"\"\"\n\nfrom .api import iri_reference\nfrom .api import IRIReference\nfrom .api import is_valid_uri\nfrom .api import normalize_uri\nfrom .api import uri_reference\nfrom .api import URIReference\nfrom .api import urlparse\nfrom .parseresult import ParseResult\n\n__title__ = 'rfc3986'\n__author__ = 'Ian Stapleton Cordasco'\n__author_email__ = 'graffatcolmingov@gmail.com'\n__license__ = 'Apache v2.0'\n__copyright__ = 'Copyright 2014 Rackspace'\n__version__ = '1.3.2'\n\n__all__ = (\n    'ParseResult',\n    'URIReference',\n    'IRIReference',\n    'is_valid_uri',\n    'normalize_uri',\n    'uri_reference',\n    'iri_reference',\n    'urlparse',\n    '__title__',\n    '__author__',\n    '__author_email__',\n    '__license__',\n    '__copyright__',\n    '__version__',\n)\n", "path": "src/urllib3/packages/rfc3986/__init__.py"}, {"content": "# -*- coding: utf-8 -*-\n# Copyright (c) 2014 Rackspace\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n# implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"\nModule containing compiled regular expressions and constants.\n\nThis module contains important constants, patterns, and compiled regular\nexpressions for parsing and validating URIs and their components.\n\"\"\"\n\nimport re\n\nfrom . import abnf_regexp\n\n# These are enumerated for the named tuple used as a superclass of\n# URIReference\nURI_COMPONENTS = ['scheme', 'authority', 'path', 'query', 'fragment']\n\nimportant_characters = {\n    'generic_delimiters': abnf_regexp.GENERIC_DELIMITERS,\n    'sub_delimiters': abnf_regexp.SUB_DELIMITERS,\n    # We need to escape the '*' in this case\n    're_sub_delimiters': abnf_regexp.SUB_DELIMITERS_RE,\n    'unreserved_chars': abnf_regexp.UNRESERVED_CHARS,\n    # We need to escape the '-' in this case:\n    're_unreserved': abnf_regexp.UNRESERVED_RE,\n}\n\n# For details about delimiters and reserved characters, see:\n# http://tools.ietf.org/html/rfc3986#section-2.2\nGENERIC_DELIMITERS = abnf_regexp.GENERIC_DELIMITERS_SET\nSUB_DELIMITERS = abnf_regexp.SUB_DELIMITERS_SET\nRESERVED_CHARS = abnf_regexp.RESERVED_CHARS_SET\n# For details about unreserved characters, see:\n# http://tools.ietf.org/html/rfc3986#section-2.3\nUNRESERVED_CHARS = abnf_regexp.UNRESERVED_CHARS_SET\nNON_PCT_ENCODED = abnf_regexp.NON_PCT_ENCODED_SET\n\nURI_MATCHER = re.compile(abnf_regexp.URL_PARSING_RE)\n\nSUBAUTHORITY_MATCHER = re.compile((\n    '^(?:(?P<userinfo>{0})@)?'  # userinfo\n    '(?P<host>{1})'  # host\n    ':?(?P<port>{2})?$'  # port\n    ).format(abnf_regexp.USERINFO_RE,\n             abnf_regexp.HOST_PATTERN,\n             abnf_regexp.PORT_RE))\n\n\nHOST_MATCHER = re.compile('^' + abnf_regexp.HOST_RE + '$')\nIPv4_MATCHER = re.compile('^' + abnf_regexp.IPv4_RE + '$')\nIPv6_MATCHER = re.compile(r'^\\[' + abnf_regexp.IPv6_ADDRZ_RFC4007_RE + r'\\]$')\n\n# Used by host validator\nIPv6_NO_RFC4007_MATCHER = re.compile(r'^\\[%s\\]$' % (\n    abnf_regexp.IPv6_ADDRZ_RE\n))\n\n# Matcher used to validate path components\nPATH_MATCHER = re.compile(abnf_regexp.PATH_RE)\n\n\n# ##################################\n# Query and Fragment Matcher Section\n# ##################################\n\nQUERY_MATCHER = re.compile(abnf_regexp.QUERY_RE)\n\nFRAGMENT_MATCHER = QUERY_MATCHER\n\n# Scheme validation, see: http://tools.ietf.org/html/rfc3986#section-3.1\nSCHEME_MATCHER = re.compile('^{0}$'.format(abnf_regexp.SCHEME_RE))\n\nRELATIVE_REF_MATCHER = re.compile(r'^%s(\\?%s)?(#%s)?$' % (\n    abnf_regexp.RELATIVE_PART_RE,\n    abnf_regexp.QUERY_RE,\n    abnf_regexp.FRAGMENT_RE,\n))\n\n# See http://tools.ietf.org/html/rfc3986#section-4.3\nABSOLUTE_URI_MATCHER = re.compile(r'^%s:%s(\\?%s)?$' % (\n    abnf_regexp.COMPONENT_PATTERN_DICT['scheme'],\n    abnf_regexp.HIER_PART_RE,\n    abnf_regexp.QUERY_RE[1:-1],\n))\n\n# ###############\n# IRIs / RFC 3987\n# ###############\n\nIRI_MATCHER = re.compile(abnf_regexp.URL_PARSING_RE, re.UNICODE)\n\nISUBAUTHORITY_MATCHER = re.compile((\n    u'^(?:(?P<userinfo>{0})@)?'  # iuserinfo\n    u'(?P<host>{1})'  # ihost\n    u':?(?P<port>{2})?$'  # port\n    ).format(abnf_regexp.IUSERINFO_RE,\n             abnf_regexp.IHOST_RE,\n             abnf_regexp.PORT_RE), re.UNICODE)\n\n\n# Path merger as defined in http://tools.ietf.org/html/rfc3986#section-5.2.3\ndef merge_paths(base_uri, relative_path):\n    \"\"\"Merge a base URI's path with a relative URI's path.\"\"\"\n    if base_uri.path is None and base_uri.authority is not None:\n        return '/' + relative_path\n    else:\n        path = base_uri.path or ''\n        index = path.rfind('/')\n        return path[:index] + '/' + relative_path\n\n\nUseExisting = object()\n", "path": "src/urllib3/packages/rfc3986/misc.py"}]}