[LNT] r293979 - Rename some stuff
Chris Matthews via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 2 16:52:33 PST 2017
Author: cmatthews
Date: Thu Feb 2 18:52:33 2017
New Revision: 293979
URL: http://llvm.org/viewvc/llvm-project?rev=293979&view=rev
Log:
Rename some stuff
This old code has some strange names, refactor them to PEP8
Modified:
lnt/trunk/lnt/lnttool/main.py
lnt/trunk/lnt/server/config.py
lnt/trunk/lnt/server/instance.py
lnt/trunk/lnt/tests/builtintest.py
lnt/trunk/lnt/tests/nt.py
lnt/trunk/tests/server/db/CreateV4TestSuite.py
lnt/trunk/tests/server/db/CreateV4TestSuiteInstance.py
lnt/trunk/tests/server/db/ImportV4TestSuiteInstance.py
lnt/trunk/tests/server/ui/change_processing.py
Modified: lnt/trunk/lnt/lnttool/main.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/lnttool/main.py?rev=293979&r1=293978&r2=293979&view=diff
==============================================================================
--- lnt/trunk/lnt/lnttool/main.py (original)
+++ lnt/trunk/lnt/lnttool/main.py Thu Feb 2 18:52:33 2017
@@ -145,7 +145,7 @@ def action_checkformat(name, args):
import lnt.server.db.v4db
import lnt.server.config
db = lnt.server.db.v4db.V4DB('sqlite:///:memory:',
- lnt.server.config.Config.dummyInstance())
+ lnt.server.config.Config.dummy_instance())
result = lnt.util.ImportData.import_and_report(
None, None, db, input, 'json', commit = True)
lnt.util.ImportData.print_report_result(result, sys.stdout, sys.stderr,
Modified: lnt/trunk/lnt/server/config.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/config.py?rev=293979&r1=293978&r2=293979&view=diff
==============================================================================
--- lnt/trunk/lnt/server/config.py (original)
+++ lnt/trunk/lnt/server/config.py Thu Feb 2 18:52:33 2017
@@ -11,7 +11,7 @@ import lnt.server.db.v4db
class EmailConfig:
@staticmethod
- def fromData(data):
+ def from_data(data):
# The email to field can either be a string, or a list of tuples of
# the form [(accept-regexp-pattern, to-address)].
to_address = data.get('to')
@@ -39,8 +39,8 @@ class EmailConfig:
class DBInfo:
@staticmethod
- def fromData(baseDir, dict, default_email_config, default_baseline_revision):
- dbPath = dict.get('path')
+ def from_data(baseDir, config_data, default_email_config, default_baseline_revision):
+ dbPath = config_data.get('path')
# If the path does not contain a database specifier, assume it is a
# relative path.
@@ -56,20 +56,20 @@ class DBInfo:
# Support per-database email configurations.
email_config = default_email_config
- if 'emailer' in dict:
- email_config = EmailConfig.fromData(dict['emailer'])
+ if 'emailer' in config_data:
+ email_config = EmailConfig.from_data(config_data['emailer'])
- baseline_revision = dict.get('baseline_revision',
- default_baseline_revision)
+ baseline_revision = config_data.get('baseline_revision',
+ default_baseline_revision)
return DBInfo(dbPath,
- str(dict.get('db_version', '0.4')),
- dict.get('shadow_import', None),
+ str(config_data.get('db_version', '0.4')),
+ config_data.get('shadow_import', None),
email_config,
baseline_revision)
@staticmethod
- def dummyInstance():
+ def dummy_instance():
return DBInfo("sqlite:///:memory:", "0.4", None,
EmailConfig(False, '', '', []), 0)
@@ -89,7 +89,7 @@ class DBInfo:
class Config:
@staticmethod
- def fromData(path, data):
+ def from_data(path, data):
# Paths are resolved relative to the absolute real path of the
# config file.
baseDir = os.path.dirname(os.path.abspath(path))
@@ -97,7 +97,7 @@ class Config:
# Get the default email config.
emailer = data.get('nt_emailer')
if emailer:
- default_email_config = EmailConfig.fromData(emailer)
+ default_email_config = EmailConfig.from_data(emailer)
else:
default_email_config = EmailConfig(False, '', '', [])
@@ -119,20 +119,20 @@ class Config:
return Config(data.get('name', 'LNT'), data['zorgURL'],
dbDir, os.path.join(baseDir, tempDir),
os.path.join(baseDir, profileDir), secretKey,
- dict([(k, DBInfo.fromData(dbDirPath, v,
- default_email_config,
- 0))
+ dict([(k, DBInfo.from_data(dbDirPath, v,
+ default_email_config,
+ 0))
for k, v in data['databases'].items()]),
blacklist)
@staticmethod
- def dummyInstance():
+ def dummy_instance():
baseDir = tempfile.mkdtemp()
dbDir = '.'
profileDirPath = os.path.join(baseDir, 'profiles')
tempDir = os.path.join(baseDir, 'tmp')
secretKey = None
- dbInfo = {'dummy': DBInfo.dummyInstance()}
+ dbInfo = {'dummy': DBInfo.dummy_instance()}
blacklist = None
return Config('LNT',
Modified: lnt/trunk/lnt/server/instance.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/instance.py?rev=293979&r1=293978&r2=293979&view=diff
==============================================================================
--- lnt/trunk/lnt/server/instance.py (original)
+++ lnt/trunk/lnt/server/instance.py Thu Feb 2 18:52:33 2017
@@ -55,7 +55,7 @@ class Instance(object):
config_data = {}
exec open(config_path) in config_data
- config = lnt.server.config.Config.fromData(config_path, config_data)
+ config = lnt.server.config.Config.from_data(config_path, config_data)
return Instance(config_path, config, tmpdir)
Modified: lnt/trunk/lnt/tests/builtintest.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/tests/builtintest.py?rev=293979&r1=293978&r2=293979&view=diff
==============================================================================
--- lnt/trunk/lnt/tests/builtintest.py (original)
+++ lnt/trunk/lnt/tests/builtintest.py Thu Feb 2 18:52:33 2017
@@ -74,7 +74,7 @@ class BuiltinTest(object):
self.log("submitting result to dummy instance")
db = lnt.server.db.v4db.V4DB("sqlite:///:memory:",
- server_config.Config.dummyInstance())
+ server_config.Config.dummy_instance())
server_report = ImportData.import_and_report(
None, None, db, report_path, 'json', commit)
Modified: lnt/trunk/lnt/tests/nt.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/tests/nt.py?rev=293979&r1=293978&r2=293979&view=diff
==============================================================================
--- lnt/trunk/lnt/tests/nt.py (original)
+++ lnt/trunk/lnt/tests/nt.py Thu Feb 2 18:52:33 2017
@@ -2011,7 +2011,7 @@ class NTTest(builtintest.BuiltinTest):
import lnt.server.db.v4db
import lnt.server.config
db = lnt.server.db.v4db.V4DB("sqlite:///:memory:",
- lnt.server.config.Config.dummyInstance())
+ lnt.server.config.Config.dummy_instance())
result = lnt.util.ImportData.import_and_report(
None, None, db, report_path, 'json', commit)
Modified: lnt/trunk/tests/server/db/CreateV4TestSuite.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/server/db/CreateV4TestSuite.py?rev=293979&r1=293978&r2=293979&view=diff
==============================================================================
--- lnt/trunk/tests/server/db/CreateV4TestSuite.py (original)
+++ lnt/trunk/tests/server/db/CreateV4TestSuite.py Thu Feb 2 18:52:33 2017
@@ -11,7 +11,7 @@ from lnt.server.db import testsuite
from lnt.server.db import v4db
# Create an in memory database.
-db = v4db.V4DB("sqlite:///:memory:", Config.dummyInstance(), echo=True)
+db = v4db.V4DB("sqlite:///:memory:", Config.dummy_instance(), echo=True)
# We expect exactly two test suites, one for NTS and one for Compile.
test_suites = list(db.query(testsuite.TestSuite))
Modified: lnt/trunk/tests/server/db/CreateV4TestSuiteInstance.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/server/db/CreateV4TestSuiteInstance.py?rev=293979&r1=293978&r2=293979&view=diff
==============================================================================
--- lnt/trunk/tests/server/db/CreateV4TestSuiteInstance.py (original)
+++ lnt/trunk/tests/server/db/CreateV4TestSuiteInstance.py Thu Feb 2 18:52:33 2017
@@ -11,7 +11,7 @@ from lnt.server.db import v4db
from lnt.server.db.fieldchange import RegressionState
# Create an in memory database.
-db = v4db.V4DB("sqlite:///:memory:", Config.dummyInstance(), echo=True)
+db = v4db.V4DB("sqlite:///:memory:", Config.dummy_instance(), echo=True)
# Get the test suite wrapper.
ts_db = db.testsuite['nts']
Modified: lnt/trunk/tests/server/db/ImportV4TestSuiteInstance.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/server/db/ImportV4TestSuiteInstance.py?rev=293979&r1=293978&r2=293979&view=diff
==============================================================================
--- lnt/trunk/tests/server/db/ImportV4TestSuiteInstance.py (original)
+++ lnt/trunk/tests/server/db/ImportV4TestSuiteInstance.py Thu Feb 2 18:52:33 2017
@@ -43,7 +43,7 @@ from lnt.server.db import testsuite
from lnt.server.db import v4db
# Load the test database.
-db = v4db.V4DB("sqlite:///%s" % sys.argv[1], Config.dummyInstance(), echo=True)
+db = v4db.V4DB("sqlite:///%s" % sys.argv[1], Config.dummy_instance(), echo=True)
# Get the status kinds, and validate the IDs align with the testing IDs.
pass_kind = db.query(db.StatusKind).filter_by(id = lnt.testing.PASS).one()
Modified: lnt/trunk/tests/server/ui/change_processing.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/server/ui/change_processing.py?rev=293979&r1=293978&r2=293979&view=diff
==============================================================================
--- lnt/trunk/tests/server/ui/change_processing.py (original)
+++ lnt/trunk/tests/server/ui/change_processing.py Thu Feb 2 18:52:33 2017
@@ -28,7 +28,7 @@ class ChangeProcessingTests(unittest.Tes
def setUp(self):
"""Bind to the LNT test instance."""
- self.db = v4db.V4DB("sqlite:///:memory:", Config.dummyInstance(), echo=False)
+ self.db = v4db.V4DB("sqlite:///:memory:", Config.dummy_instance(), echo=False)
# Get the test suite wrapper.
ts_db = self.ts_db = self.db.testsuite['nts']
More information about the llvm-commits
mailing list