summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeandro Lucarella <leandro.lucarella@sociomantic.com>2014-10-23 17:00:00 +0200
committerMihails Strasuns <mihails.strasuns@sociomantic.com>2014-10-24 08:50:18 +0200
commit5e03300c8054926de71577d0ac5d4fc49ef36299 (patch)
tree2657afe8cc4077cdcd8a853b5eb1c975bbb34ddd
parentdac2d775de52c06730eb35203eb465b66a121e89 (diff)
Move import urlparse to the top of the file
Is the only import that was done locally, and now is used in more than one place, so it makes sense to have it at the top like the rest.
-rwxr-xr-xgit-hub11
1 files changed, 5 insertions, 6 deletions
diff --git a/git-hub b/git-hub
index f6dd08f..f82a6d4 100755
--- a/git-hub
+++ b/git-hub
@@ -46,6 +46,7 @@ import pprint
import urllib2
import getpass
import os.path
+import urlparse
import argparse
import subprocess
@@ -326,8 +327,7 @@ class Config:
opts=['--bool']) == "true"
def sanitize_url(self, name, url):
- from urlparse import urlsplit, urlunsplit
- u = urlsplit(url)
+ u = urlparse.urlsplit(url)
name = GIT_CONFIG_PREFIX + name
# interpret www.github.com/api/v4 as www.github.com, /api/v4
if not u.hostname or not u.scheme:
@@ -341,8 +341,8 @@ class Config:
netloc = u.hostname
if u.port:
netloc += ':' + u.port
- return urlunsplit((u.scheme, netloc, u.path.rstrip('/'),
- u.query, u.fragment))
+ return urlparse.urlunsplit((u.scheme, netloc,
+ u.path.rstrip('/'), u.query, u.fragment))
def check(self, name):
if getattr(self, name) is None:
@@ -744,8 +744,7 @@ class CloneCmd (object):
@classmethod
def run(cls, parser, args):
- from urlparse import urlsplit
- upstream = urlsplit(args.repository).path
+ upstream = urlparse.urlsplit(args.repository).path
if upstream.endswith('.git'): upstream = upstream[:-4]
if '/' in upstream:
(owner, proj) = upstream.split('/')[-2:]