0

rename configParser to config_parser

CamelCase does not bode well in Python land, so it's best we rename
these ill-named files before the Guidoists get us and throw us into
a damp dungeon.
This commit is contained in:
Nicolas F
2019-07-24 09:18:02 +02:00
parent f314de1403
commit c13d3aae3c
5 changed files with 12 additions and 12 deletions

View File

@@ -86,7 +86,7 @@ Let's take a closer look at the ``overviewer_core/`` directory:
* ``cache.py`` implements a Least-Recently-Used (LRU) cache, which is used for
caching chunks in memory as the rendering happens.
* ``configParser.py`` contains some code that sets up how the config is parsed,
* ``config_parser.py`` contains some code that sets up how the config is parsed,
but is not really involved in the definitions of individual settings therein.
* ``dispatcher.py`` is the code that sets up multiprocessing, so Overviewer can

View File

@@ -39,7 +39,7 @@ from overviewer_core import util
from overviewer_core import logger
from overviewer_core import textures
from overviewer_core import optimizeimages, world
from overviewer_core import configParser, tileset, assetmanager, dispatcher
from overviewer_core import config_parser, tileset, assetmanager, dispatcher
from overviewer_core import cache
from overviewer_core import observer
from overviewer_core.nbt import CorruptNBTError
@@ -291,7 +291,7 @@ def main():
#########################################################################
# These two halfs of this if statement unify config-file mode and
# command-line mode.
mw_parser = configParser.MultiWorldParser()
mw_parser = config_parser.MultiWorldParser()
if not args.config:
# No config file mode.
@@ -326,7 +326,7 @@ def main():
# Parse the config file
try:
mw_parser.parse(os.path.expanduser(args.config))
except configParser.MissingConfigException as e:
except config_parser.MissingConfigException as e:
# this isn't a "bug", so don't print scary traceback
logging.error(str(e))
util.nice_exit(1)

View File

@@ -31,7 +31,7 @@ from contextlib import closing
from multiprocessing import Pool
from argparse import ArgumentParser
from overviewer_core import configParser, logger, nbt, world
from overviewer_core import config_parser, logger, nbt, world
from overviewer_core.files import FileReplacer, get_fs_caps
UUID_LOOKUP_URL = 'https://sessionserver.mojang.com/session/minecraft/profile/'
@@ -96,7 +96,7 @@ bucketChunkFuncs = {}
def initBucketChunks(config_path):
global bucketChunkFuncs
mw_parser = configParser.MultiWorldParser()
mw_parser = config_parser.MultiWorldParser()
mw_parser.parse(config_path)
# ought not to fail since we already did it once
config = mw_parser.get_validated_config()
@@ -460,10 +460,10 @@ def main():
logger.configure(logging.WARN, False)
# Parse the config file
mw_parser = configParser.MultiWorldParser()
mw_parser = config_parser.MultiWorldParser()
try:
mw_parser.parse(args.config)
except configParser.MissingConfigException:
except config_parser.MissingConfigException:
parser.error("The configuration file '{}' does not exist.".format(args.config))
try:
config = mw_parser.get_validated_config()

View File

@@ -1,7 +1,7 @@
import unittest
from collections import OrderedDict
from overviewer_core import configParser
from overviewer_core import config_parser
from overviewer_core.settingsValidators import ValidationException
from overviewer_core import world
@@ -11,11 +11,11 @@ from overviewer_core import rendermodes
class SettingsTest(unittest.TestCase):
def setUp(self):
self.s = configParser.MultiWorldParser()
self.s = config_parser.MultiWorldParser()
def test_missing(self):
"Validates that a non-existant settings.py causes an exception"
self.assertRaises(configParser.MissingConfigException, self.s.parse, "doesnotexist.py")
self.assertRaises(config_parser.MissingConfigException, self.s.parse, "doesnotexist.py")
def test_existing_file(self):
self.s.parse("test/data/settings/settings_test_1.py")
@@ -41,7 +41,7 @@ class SettingsTest(unittest.TestCase):
to do it from a file
"""
fromfile = configParser.MultiWorldParser()
fromfile = config_parser.MultiWorldParser()
fromfile.parse("test/data/settings/settings_test_1.py")
self.s.set_config_item("worlds", {