mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Replace usage of six.moves.urllib with urllib
Also organize some of the imports. Now that Servo only uses Python 3, this module is unnecessary. This is part of the gradual migration to using only Python 3.
This commit is contained in:
parent
53218621e9
commit
e9942bddb0
10 changed files with 37 additions and 35 deletions
|
@ -14,7 +14,7 @@ import six.moves.BaseHTTPServer
|
|||
import six.moves.SimpleHTTPServer
|
||||
import six.moves.socketserver
|
||||
import threading
|
||||
import six.moves.urllib.parse
|
||||
import urllib
|
||||
import six
|
||||
|
||||
# List of jQuery modules that will be tested.
|
||||
|
@ -149,13 +149,13 @@ def run_http_server():
|
|||
path = self.translate_path(self.path)
|
||||
f = None
|
||||
if os.path.isdir(path):
|
||||
parts = six.moves.urllib.parse.urlsplit(self.path)
|
||||
parts = urllib.parse.urlsplit(self.path)
|
||||
if not parts.path.endswith('/'):
|
||||
# redirect browser - doing basically what apache does
|
||||
self.send_response(301)
|
||||
new_parts = (parts[0], parts[1], parts[2] + '/',
|
||||
parts[3], parts[4])
|
||||
new_url = six.moves.urllib.parse.urlunsplit(new_parts)
|
||||
new_url = urllib.parse.urlunsplit(new_parts)
|
||||
self.send_header("Location", new_url)
|
||||
self.end_headers()
|
||||
return None
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
from __future__ import print_function
|
||||
|
||||
import json
|
||||
from six.moves.urllib.parse import urljoin
|
||||
import urllib
|
||||
|
||||
requests = None
|
||||
|
||||
class GitHubError(Exception):
|
||||
|
@ -36,7 +37,7 @@ class GitHub(object):
|
|||
return self._request("PUT", path, data=data)
|
||||
|
||||
def _request(self, method, path, data=None):
|
||||
url = urljoin(self.url_base, path)
|
||||
url = urllib.parse.urljoin(self.url_base, path)
|
||||
|
||||
kwargs = {"headers": self.headers,
|
||||
"auth": self.auth}
|
||||
|
@ -96,7 +97,7 @@ class GitHubRepo(object):
|
|||
return PullRequest.from_number(self, number)
|
||||
|
||||
def path(self, suffix):
|
||||
return urljoin(self.url_base, suffix)
|
||||
return urllib.parse.urljoin(self.url_base, suffix)
|
||||
|
||||
|
||||
class PullRequest(object):
|
||||
|
@ -126,7 +127,7 @@ class PullRequest(object):
|
|||
return cls(repo, data)
|
||||
|
||||
def path(self, suffix):
|
||||
return urljoin(self.repo.path("pulls/%i/" % self.number), suffix)
|
||||
return urllib.parse.urljoin(self.repo.path("pulls/%i/" % self.number), suffix)
|
||||
|
||||
@property
|
||||
def issue(self):
|
||||
|
@ -160,7 +161,7 @@ class Issue(object):
|
|||
return cls(repo, data)
|
||||
|
||||
def path(self, suffix):
|
||||
return urljoin(self.repo.path("issues/%i/" % self.number), suffix)
|
||||
return urllib.parse.urljoin(self.repo.path("issues/%i/" % self.number), suffix)
|
||||
|
||||
def add_label(self, label):
|
||||
"""Add a label to the issue.
|
||||
|
|
|
@ -4,7 +4,7 @@ import os
|
|||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import six.moves.urllib as urllib
|
||||
import urllib
|
||||
from six.moves import input
|
||||
from six import iteritems
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue