Reorders imports this way:
- system namespace imports
- system member imports
- imports from local files
This commit is contained in:
Benjamin Bouvier 2016-11-22 17:50:51 +01:00
Родитель 98f577a9e7
Коммит 9e788488b3
7 изменённых файлов: 47 добавлений и 44 удалений

Просмотреть файл

@ -3,12 +3,12 @@ def getBenchmark(benchmark):
section, name = benchmark.split(".")
if section == "local":
import benchmarks_local
return benchmarks_local.getBenchmark(name);
return benchmarks_local.getBenchmark(name)
elif section == "remote":
import benchmarks_remote
return benchmarks_remote.getBenchmark(name);
return benchmarks_remote.getBenchmark(name)
elif section == "shell":
import benchmarks_shell
return benchmarks_shell.getBenchmark(name);
return benchmarks_shell.getBenchmark(name)
else:
raise Exception("Unknown benchmark type")

Просмотреть файл

@ -1,11 +1,12 @@
import subprocess
import socket
import os
import time
import json
import os
import socket
import subprocess
import sys
import time
sys.path.insert(1, '../driver')
import utils
class Benchmark:
@ -157,7 +158,7 @@ def getBenchmark(name):
raise Exception("Unknown benchmark")
# Test if server is running and start server if needed.
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
result = s.connect_ex(("localhost", 8000))
s.close()
if result > 0:

Просмотреть файл

@ -1,18 +1,19 @@
import json
import urllib2
import urllib
import re
import os
import platform
import re
import shutil
import socket
import utils
import platform
import url_creator
import tarfile
import urllib
import urllib2
import zipfile
socket.setdefaulttimeout(120)
import url_creator
import utils
DEBUG = True
class DownloadTools(object):
@ -58,13 +59,13 @@ class Downloader(object):
def valid(self):
return self.getfilename() != None
def setOutputFolder(self, folder):
def set_output_folder(self, folder):
if not folder.endswith("/"):
folder += "/"
self.folder = folder
def download(self):
self.createOutputFolder()
self.create_output_folder()
filename = self.getfilename()
assert filename
@ -76,7 +77,7 @@ class Downloader(object):
json.dump(info, fp)
fp.close()
def createOutputFolder(self):
def create_output_folder(self):
if os.path.isdir(self.folder):
shutil.rmtree(self.folder)
os.makedirs(self.folder)
@ -295,7 +296,7 @@ if __name__ == "__main__":
elif options.repo:
downloader = DownloadTools.forRepo(options.repo, options.cset)
else:
raise Exception("You'll need to specify atleast an url or repo")
raise Exception("You'll need to specify at least an url or repo")
downloader.setOutputFolder(options.output)
downloader.set_output_folder(options.output)
downloader.download()

Просмотреть файл

@ -1,15 +1,16 @@
import benchmarks
import configs
import executors
import engineInfo
import submitter
import json
import sys
import traceback
import sys
from optparse import OptionParser
import benchmarks
import configs
import engineInfo
import executors
import submitter
import utils
from optparse import OptionParser
parser = OptionParser(usage="usage: %prog url [options]")
parser.add_option("-b", "--benchmark", action="append", dest="benchmarks",

Просмотреть файл

@ -1,10 +1,10 @@
import runners
import time
import os
import sys
import json
import utils
import runners
class ShellExecutor(object):
def __init__(self, engineInfo):
@ -235,13 +235,13 @@ class ServoExecutor(BrowserExecutor):
def getExecutor(engineInfo):
if engineInfo["shell"]:
return ShellExecutor(engineInfo)
if engineInfo["engine_type"] == "firefox" and not engineInfo["shell"]:
if engineInfo["engine_type"] == "firefox":
return FirefoxExecutor(engineInfo)
if engineInfo["engine_type"] == "chrome" and not engineInfo["shell"]:
if engineInfo["engine_type"] == "chrome":
return ChromeExecutor(engineInfo)
if engineInfo["engine_type"] == "webkit" and not engineInfo["shell"]:
if engineInfo["engine_type"] == "webkit":
return WebKitExecutor(engineInfo)
if engineInfo["engine_type"] == "edge" and not engineInfo["shell"]:
if engineInfo["engine_type"] == "edge":
return EdgeExecutor(engineInfo)
if engineInfo["engine_type"] == "servo":
return ServoExecutor(engineInfo)

Просмотреть файл

@ -1,16 +1,18 @@
import sys
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
import urlparse
import os
import json
import urllib
import httplib
from SocketServer import ThreadingMixIn
import hashlib
import httplib
import json
import os
import pickle
import utils
import signal
import sys
import urllib
import urlparse
from SimpleHTTPServer import SimpleHTTPRequestHandler
from SocketServer import ThreadingMixIn
import utils
class FakeHandler(SimpleHTTPRequestHandler):
@ -322,8 +324,6 @@ Protocol = "HTTP/1.0"
Port = 8000
ServerAddress = ('', Port)
import os
import utils
path = os.path.abspath(os.path.join(os.path.dirname(__file__),".."))
with utils.FolderChanger(path):
HandlerClass.protocol_version = Protocol

Просмотреть файл

@ -32,7 +32,7 @@ class Submitter(object):
def mode(self, engine_type, config):
name = engine_type + "," + config
if name in self.rules:
return self.rules[engine_type + "," + config]
return self.rules[name]
else:
return name