integrations: Remove usage of six.
This commit is contained in:
parent
1412403037
commit
46c78ce7b5
|
@ -7,7 +7,7 @@ import zulip
|
||||||
import sys
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
import re
|
import re
|
||||||
from six.moves import configparser
|
import configparser
|
||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ VERSION = "0.9"
|
||||||
|
|
||||||
if config.ZULIP_API_PATH is not None:
|
if config.ZULIP_API_PATH is not None:
|
||||||
sys.path.append(config.ZULIP_API_PATH)
|
sys.path.append(config.ZULIP_API_PATH)
|
||||||
import six
|
|
||||||
import zulip
|
import zulip
|
||||||
from typing import Any, List, Dict, Optional
|
from typing import Any, List, Dict, Optional
|
||||||
|
|
||||||
|
@ -301,7 +300,7 @@ def check_permissions():
|
||||||
sys.stderr.write(str(e))
|
sys.stderr.write(str(e))
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if not isinstance(config.RESUME_FILE, six.string_types):
|
if not isinstance(config.RESUME_FILE, str):
|
||||||
sys.stderr.write("RESUME_FILE path not given; refusing to continue")
|
sys.stderr.write("RESUME_FILE path not given; refusing to continue")
|
||||||
check_permissions()
|
check_permissions()
|
||||||
if config.LOG_FILE:
|
if config.LOG_FILE:
|
||||||
|
|
|
@ -10,7 +10,7 @@ import logging
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import pytz
|
import pytz
|
||||||
from six.moves import urllib
|
import urllib
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
import zulip
|
import zulip
|
||||||
import sys
|
import sys
|
||||||
from six.moves import range
|
|
||||||
from typing import Any, Optional, Text
|
from typing import Any, Optional, Text
|
||||||
from mercurial import ui, repository as repo
|
from mercurial import ui, repository as repo
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ import optparse
|
||||||
from sleekxmpp import ClientXMPP, InvalidJID, JID
|
from sleekxmpp import ClientXMPP, InvalidJID, JID
|
||||||
from sleekxmpp.stanza import Message as JabberMessage
|
from sleekxmpp.stanza import Message as JabberMessage
|
||||||
from sleekxmpp.exceptions import IqError, IqTimeout
|
from sleekxmpp.exceptions import IqError, IqTimeout
|
||||||
from six.moves.configparser import SafeConfigParser
|
from configparser import SafeConfigParser
|
||||||
import getpass
|
import getpass
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -8,10 +8,6 @@
|
||||||
# License: MIT <http://www.opensource.org/licenses/mit-license.php>
|
# License: MIT <http://www.opensource.org/licenses/mit-license.php>
|
||||||
#
|
#
|
||||||
import sys
|
import sys
|
||||||
import six
|
|
||||||
from six.moves import input
|
|
||||||
from six.moves import range
|
|
||||||
from six.moves import zip
|
|
||||||
if sys.hexversion < 0x02040000:
|
if sys.hexversion < 0x02040000:
|
||||||
# The limiter is the subprocess module
|
# The limiter is the subprocess module
|
||||||
sys.stderr.write("git-p4: requires Python 2.4 or later.\n")
|
sys.stderr.write("git-p4: requires Python 2.4 or later.\n")
|
||||||
|
@ -58,7 +54,7 @@ def p4_build_cmd(cmd):
|
||||||
"""
|
"""
|
||||||
real_cmd = ["p4"]
|
real_cmd = ["p4"]
|
||||||
|
|
||||||
if isinstance(cmd, six.string_types):
|
if isinstance(cmd, str):
|
||||||
real_cmd = ' '.join(real_cmd) + ' ' + cmd
|
real_cmd = ' '.join(real_cmd) + ' ' + cmd
|
||||||
else:
|
else:
|
||||||
real_cmd += cmd
|
real_cmd += cmd
|
||||||
|
@ -97,7 +93,7 @@ def write_pipe(c, stdin):
|
||||||
if verbose:
|
if verbose:
|
||||||
sys.stderr.write('Writing pipe: %s\n' % str(c))
|
sys.stderr.write('Writing pipe: %s\n' % str(c))
|
||||||
|
|
||||||
expand = isinstance(c, six.string_types)
|
expand = isinstance(c, str)
|
||||||
p = subprocess.Popen(c, stdin=subprocess.PIPE, shell=expand)
|
p = subprocess.Popen(c, stdin=subprocess.PIPE, shell=expand)
|
||||||
pipe = p.stdin
|
pipe = p.stdin
|
||||||
val = pipe.write(stdin)
|
val = pipe.write(stdin)
|
||||||
|
@ -115,7 +111,7 @@ def read_pipe(c, ignore_error=False):
|
||||||
if verbose:
|
if verbose:
|
||||||
sys.stderr.write('Reading pipe: %s\n' % str(c))
|
sys.stderr.write('Reading pipe: %s\n' % str(c))
|
||||||
|
|
||||||
expand = isinstance(c, six.string_types)
|
expand = isinstance(c, str)
|
||||||
p = subprocess.Popen(c, stdout=subprocess.PIPE, shell=expand)
|
p = subprocess.Popen(c, stdout=subprocess.PIPE, shell=expand)
|
||||||
pipe = p.stdout
|
pipe = p.stdout
|
||||||
val = pipe.read()
|
val = pipe.read()
|
||||||
|
@ -132,7 +128,7 @@ def read_pipe_lines(c):
|
||||||
if verbose:
|
if verbose:
|
||||||
sys.stderr.write('Reading pipe: %s\n' % str(c))
|
sys.stderr.write('Reading pipe: %s\n' % str(c))
|
||||||
|
|
||||||
expand = isinstance(c, six.string_types)
|
expand = isinstance(c, str)
|
||||||
p = subprocess.Popen(c, stdout=subprocess.PIPE, shell=expand)
|
p = subprocess.Popen(c, stdout=subprocess.PIPE, shell=expand)
|
||||||
pipe = p.stdout
|
pipe = p.stdout
|
||||||
val = pipe.readlines()
|
val = pipe.readlines()
|
||||||
|
@ -175,7 +171,7 @@ def p4_has_move_command():
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def system(cmd):
|
def system(cmd):
|
||||||
expand = isinstance(cmd, six.string_types)
|
expand = isinstance(cmd, str)
|
||||||
if verbose:
|
if verbose:
|
||||||
sys.stderr.write("executing %s\n" % str(cmd))
|
sys.stderr.write("executing %s\n" % str(cmd))
|
||||||
retcode = subprocess.call(cmd, shell=expand)
|
retcode = subprocess.call(cmd, shell=expand)
|
||||||
|
@ -185,7 +181,7 @@ def system(cmd):
|
||||||
def p4_system(cmd):
|
def p4_system(cmd):
|
||||||
"""Specifically invoke p4 as the system command. """
|
"""Specifically invoke p4 as the system command. """
|
||||||
real_cmd = p4_build_cmd(cmd)
|
real_cmd = p4_build_cmd(cmd)
|
||||||
expand = isinstance(real_cmd, six.string_types)
|
expand = isinstance(real_cmd, str)
|
||||||
retcode = subprocess.call(real_cmd, shell=expand)
|
retcode = subprocess.call(real_cmd, shell=expand)
|
||||||
if retcode:
|
if retcode:
|
||||||
raise CalledProcessError(retcode, real_cmd)
|
raise CalledProcessError(retcode, real_cmd)
|
||||||
|
@ -362,7 +358,7 @@ def getP4OpenedType(file):
|
||||||
# Return the set of all p4 labels
|
# Return the set of all p4 labels
|
||||||
def getP4Labels(depotPaths):
|
def getP4Labels(depotPaths):
|
||||||
labels = set()
|
labels = set()
|
||||||
if isinstance(depotPaths, six.string_types):
|
if isinstance(depotPaths, str):
|
||||||
depotPaths = [depotPaths]
|
depotPaths = [depotPaths]
|
||||||
|
|
||||||
for l in p4CmdList(["labels"] + ["%s..." % p for p in depotPaths]):
|
for l in p4CmdList(["labels"] + ["%s..." % p for p in depotPaths]):
|
||||||
|
@ -429,7 +425,7 @@ def isModeExecChanged(src_mode, dst_mode):
|
||||||
|
|
||||||
def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None):
|
def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None):
|
||||||
|
|
||||||
if isinstance(cmd, six.string_types):
|
if isinstance(cmd, str):
|
||||||
cmd = "-G " + cmd
|
cmd = "-G " + cmd
|
||||||
expand = True
|
expand = True
|
||||||
else:
|
else:
|
||||||
|
@ -446,7 +442,7 @@ def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None):
|
||||||
stdin_file = None
|
stdin_file = None
|
||||||
if stdin is not None:
|
if stdin is not None:
|
||||||
stdin_file = tempfile.TemporaryFile(prefix='p4-stdin', mode=stdin_mode)
|
stdin_file = tempfile.TemporaryFile(prefix='p4-stdin', mode=stdin_mode)
|
||||||
if isinstance(stdin, six.string_types):
|
if isinstance(stdin, str):
|
||||||
stdin_file.write(stdin)
|
stdin_file.write(stdin)
|
||||||
else:
|
else:
|
||||||
for i in stdin:
|
for i in stdin:
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
import calendar
|
import calendar
|
||||||
import errno
|
import errno
|
||||||
import hashlib
|
import hashlib
|
||||||
from six.moves.html_parser import HTMLParser
|
from html.parser import HTMLParser
|
||||||
import logging
|
import logging
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from six.moves import urllib
|
import urllib
|
||||||
from typing import Dict, List, Tuple, Any
|
from typing import Dict, List, Tuple, Any
|
||||||
|
|
||||||
import feedparser
|
import feedparser
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
from six.moves.configparser import ConfigParser, NoSectionError, NoOptionError
|
from configparser import ConfigParser, NoSectionError, NoOptionError
|
||||||
|
|
||||||
import zulip
|
import zulip
|
||||||
VERSION = "0.9"
|
VERSION = "0.9"
|
||||||
|
|
|
@ -9,7 +9,6 @@ import subprocess
|
||||||
import hashlib
|
import hashlib
|
||||||
import zephyr
|
import zephyr
|
||||||
import zulip
|
import zulip
|
||||||
from six.moves import range
|
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
from typing import Any, Dict, List, Set, Tuple
|
from typing import Any, Dict, List, Set, Tuple
|
||||||
|
|
|
@ -4,8 +4,6 @@ from typing import IO, Any, Dict, List, Text, Union, Set, Tuple, Optional, cast
|
||||||
from types import FrameType
|
from types import FrameType
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from six.moves import map
|
|
||||||
from six.moves import range
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
|
Loading…
Reference in a new issue