Format code with black. Add makefile to run fmt/tests

This commit is contained in:
Griatch 2019-09-28 18:18:11 +02:00
parent d00bce9288
commit c2c7fa311a
299 changed files with 19037 additions and 11611 deletions

View file

@ -18,31 +18,32 @@ def check_errors(settings):
DeprecationWarning if a critical deprecation is found.
"""
deprstring = ("settings.%s should be renamed to %s. If defaults are used, "
"their path/classname must be updated "
"(see evennia/settings_default.py).")
deprstring = (
"settings.%s should be renamed to %s. If defaults are used, "
"their path/classname must be updated "
"(see evennia/settings_default.py)."
)
if hasattr(settings, "CMDSET_DEFAULT"):
raise DeprecationWarning(deprstring % (
"CMDSET_DEFAULT", "CMDSET_CHARACTER"))
raise DeprecationWarning(deprstring % ("CMDSET_DEFAULT", "CMDSET_CHARACTER"))
if hasattr(settings, "CMDSET_OOC"):
raise DeprecationWarning(deprstring % ("CMDSET_OOC", "CMDSET_ACCOUNT"))
if settings.WEBSERVER_ENABLED and not isinstance(settings.WEBSERVER_PORTS[0], tuple):
raise DeprecationWarning(
"settings.WEBSERVER_PORTS must be on the form "
"[(proxyport, serverport), ...]")
"settings.WEBSERVER_PORTS must be on the form " "[(proxyport, serverport), ...]"
)
if hasattr(settings, "BASE_COMM_TYPECLASS"):
raise DeprecationWarning(deprstring % (
"BASE_COMM_TYPECLASS", "BASE_CHANNEL_TYPECLASS"))
raise DeprecationWarning(deprstring % ("BASE_COMM_TYPECLASS", "BASE_CHANNEL_TYPECLASS"))
if hasattr(settings, "COMM_TYPECLASS_PATHS"):
raise DeprecationWarning(deprstring % (
"COMM_TYPECLASS_PATHS", "CHANNEL_TYPECLASS_PATHS"))
raise DeprecationWarning(deprstring % ("COMM_TYPECLASS_PATHS", "CHANNEL_TYPECLASS_PATHS"))
if hasattr(settings, "CHARACTER_DEFAULT_HOME"):
raise DeprecationWarning(
"settings.CHARACTER_DEFAULT_HOME should be renamed to "
"DEFAULT_HOME. See also settings.START_LOCATION "
"(see evennia/settings_default.py).")
deprstring = ("settings.%s is now merged into settings.TYPECLASS_PATHS. "
"Update your settings file.")
"(see evennia/settings_default.py)."
)
deprstring = (
"settings.%s is now merged into settings.TYPECLASS_PATHS. " "Update your settings file."
)
if hasattr(settings, "OBJECT_TYPECLASS_PATHS"):
raise DeprecationWarning(deprstring % "OBJECT_TYPECLASS_PATHS")
if hasattr(settings, "SCRIPT_TYPECLASS_PATHS"):
@ -56,31 +57,45 @@ def check_errors(settings):
"settings.SEARCH_MULTIMATCH_SEPARATOR was replaced by "
"SEARCH_MULTIMATCH_REGEX and SEARCH_MULTIMATCH_TEMPLATE. "
"Update your settings file (see evennia/settings_default.py "
"for more info).")
"for more info)."
)
gametime_deprecation = ("The settings TIME_SEC_PER_MIN, TIME_MIN_PER_HOUR,"
"TIME_HOUR_PER_DAY, TIME_DAY_PER_WEEK, \n"
"TIME_WEEK_PER_MONTH and TIME_MONTH_PER_YEAR "
"are no longer supported. Remove them from your "
"settings file to continue.\nIf you want to use "
"and manipulate these time units, the tools from utils.gametime "
"are now found in contrib/convert_gametime.py instead.")
if any(hasattr(settings, value) for value in ("TIME_SEC_PER_MIN", "TIME_MIN_PER_HOUR",
"TIME_HOUR_PER_DAY", "TIME_DAY_PER_WEEK",
"TIME_WEEK_PER_MONTH",
"TIME_MONTH_PER_YEAR")):
gametime_deprecation = (
"The settings TIME_SEC_PER_MIN, TIME_MIN_PER_HOUR,"
"TIME_HOUR_PER_DAY, TIME_DAY_PER_WEEK, \n"
"TIME_WEEK_PER_MONTH and TIME_MONTH_PER_YEAR "
"are no longer supported. Remove them from your "
"settings file to continue.\nIf you want to use "
"and manipulate these time units, the tools from utils.gametime "
"are now found in contrib/convert_gametime.py instead."
)
if any(
hasattr(settings, value)
for value in (
"TIME_SEC_PER_MIN",
"TIME_MIN_PER_HOUR",
"TIME_HOUR_PER_DAY",
"TIME_DAY_PER_WEEK",
"TIME_WEEK_PER_MONTH",
"TIME_MONTH_PER_YEAR",
)
):
raise DeprecationWarning(gametime_deprecation)
game_directory_deprecation = ("The setting GAME_DIRECTORY_LISTING was removed. It must be "
"renamed to GAME_INDEX_LISTING instead.")
game_directory_deprecation = (
"The setting GAME_DIRECTORY_LISTING was removed. It must be "
"renamed to GAME_INDEX_LISTING instead."
)
if hasattr(settings, "GAME_DIRECTORY_LISTING"):
raise DeprecationWarning(game_directory_deprecation)
chan_connectinfo = settings.CHANNEL_CONNECTINFO
if chan_connectinfo is not None and not isinstance(chan_connectinfo, dict):
raise DeprecationWarning("settings.CHANNEL_CONNECTINFO has changed. It "
"must now be either None or a dict "
"specifying the properties of the channel to create.")
raise DeprecationWarning(
"settings.CHANNEL_CONNECTINFO has changed. It "
"must now be either None or a dict "
"specifying the properties of the channel to create."
)
def check_warnings(settings):