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 * ``cache.py`` implements a Least-Recently-Used (LRU) cache, which is used for
caching chunks in memory as the rendering happens. 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. but is not really involved in the definitions of individual settings therein.
* ``dispatcher.py`` is the code that sets up multiprocessing, so Overviewer can * ``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 logger
from overviewer_core import textures from overviewer_core import textures
from overviewer_core import optimizeimages, world 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 cache
from overviewer_core import observer from overviewer_core import observer
from overviewer_core.nbt import CorruptNBTError from overviewer_core.nbt import CorruptNBTError
@@ -291,7 +291,7 @@ def main():
######################################################################### #########################################################################
# These two halfs of this if statement unify config-file mode and # These two halfs of this if statement unify config-file mode and
# command-line mode. # command-line mode.
mw_parser = configParser.MultiWorldParser() mw_parser = config_parser.MultiWorldParser()
if not args.config: if not args.config:
# No config file mode. # No config file mode.
@@ -326,7 +326,7 @@ def main():
# Parse the config file # Parse the config file
try: try:
mw_parser.parse(os.path.expanduser(args.config)) 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 # this isn't a "bug", so don't print scary traceback
logging.error(str(e)) logging.error(str(e))
util.nice_exit(1) util.nice_exit(1)

View File

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

View File

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