/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/location.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-02-14 03:16:54 UTC
  • mfrom: (7479.2.3 no-more-python2)
  • Revision ID: breezy.the.bot@gmail.com-20200214031654-bp1xtv2jr9nmhto3
Drop python2 support.

Merged from https://code.launchpad.net/~jelmer/brz/no-more-python2/+merge/378694

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    urlutils,
26
26
    )
27
27
from .hooks import Hooks
28
 
from .sixish import (
29
 
    PY3,
30
 
    string_types,
31
 
    )
32
28
 
33
29
 
34
30
class LocationHooks(Hooks):
102
98
    :raise InvalidURL: If the location is already a URL, but not valid.
103
99
    :return: Byte string with resulting URL
104
100
    """
105
 
    if not isinstance(location, string_types):
 
101
    if not isinstance(location, str):
106
102
        raise AssertionError("location not a byte or unicode string")
107
103
 
108
104
    if location.startswith(':pserver:'):
120
116
                path=location, extra='URLs must be properly escaped')
121
117
        location = urlutils.local_path_to_url(location)
122
118
    else:
123
 
        if PY3:
124
 
            location = location.decode('ascii')
 
119
        location = location.decode('ascii')
125
120
 
126
121
    if location.startswith("file:") and not location.startswith("file://"):
127
122
        return urlutils.join(urlutils.local_path_to_url("."), location[5:])