diff --git a/docs/source/api/evennia.utils.hex_colors.md b/docs/source/api/evennia.utils.hex_colors.md new file mode 100644 index 0000000000..ef26cae11e --- /dev/null +++ b/docs/source/api/evennia.utils.hex_colors.md @@ -0,0 +1,10 @@ +```{eval-rst} +evennia.utils.hex\_colors +================================ + +.. automodule:: evennia.utils.hex_colors + :members: + :undoc-members: + :show-inheritance: + +``` \ No newline at end of file diff --git a/evennia/accounts/migrations/0001_initial.py b/evennia/accounts/migrations/0001_initial.py index 6540708fd0..1c094f23e3 100644 --- a/evennia/accounts/migrations/0001_initial.py +++ b/evennia/accounts/migrations/0001_initial.py @@ -44,7 +44,7 @@ class Migration(migrations.Migration): verbose_name="username", validators=[ django.core.validators.RegexValidator( - "^[\\w.@+-]+$", "Enter a valid username.", "invalid" + r"^[\w.@+-]+$", "Enter a valid username.", "invalid" ) ], ), diff --git a/evennia/accounts/migrations/0004_auto_20150403_2339.py b/evennia/accounts/migrations/0004_auto_20150403_2339.py index 1f10552c4f..5191eaf51b 100644 --- a/evennia/accounts/migrations/0004_auto_20150403_2339.py +++ b/evennia/accounts/migrations/0004_auto_20150403_2339.py @@ -2,9 +2,8 @@ import django.core.validators -from django.db import migrations, models - import evennia.accounts.manager +from django.db import migrations, models class Migration(migrations.Migration): @@ -47,7 +46,7 @@ class Migration(migrations.Migration): max_length=30, validators=[ django.core.validators.RegexValidator( - "^[\\w.@+-]+$", + r"^[\w.@+-]+$", "Enter a valid username. This value may contain only letters, numbers and @/./+/-/_ characters.", "invalid", ) diff --git a/evennia/accounts/migrations/0005_auto_20160905_0902.py b/evennia/accounts/migrations/0005_auto_20160905_0902.py index 12f5f154df..e005408f03 100644 --- a/evennia/accounts/migrations/0005_auto_20160905_0902.py +++ b/evennia/accounts/migrations/0005_auto_20160905_0902.py @@ -21,7 +21,7 @@ class Migration(migrations.Migration): unique=True, validators=[ django.core.validators.RegexValidator( - "^[\\w.@+-]+$", + r"^[\w.@+-]+$", "Enter a valid username. This value may contain only letters, numbers and @/./+/-/_ characters.", ) ], diff --git a/evennia/accounts/tests.py b/evennia/accounts/tests.py index f49438f69b..87bca0eea6 100644 --- a/evennia/accounts/tests.py +++ b/evennia/accounts/tests.py @@ -3,18 +3,14 @@ from random import randint from unittest import TestCase -from django.test import override_settings -from mock import MagicMock, Mock, patch - import evennia -from evennia.accounts.accounts import ( - AccountSessionHandler, - DefaultAccount, - DefaultGuest, -) +from django.test import override_settings +from evennia.accounts.accounts import (AccountSessionHandler, DefaultAccount, + DefaultGuest) from evennia.utils import create from evennia.utils.test_resources import BaseEvenniaTest from evennia.utils.utils import uses_database +from mock import MagicMock, Mock, patch class TestAccountSessionHandler(TestCase): @@ -172,7 +168,7 @@ class TestDefaultAccountAuth(BaseEvenniaTest): if not uses_database("mysql"): # TODO As of Mar 2019, mysql does not pass this test due to collation problems # that has not been possible to resolve - result, error = DefaultAccount.validate_username("¯\_(ツ)_/¯") + result, error = DefaultAccount.validate_username(r"¯\_(ツ)_/¯") self.assertFalse(result, "Validator allowed kanji in username.") # Should not allow duplicate username diff --git a/evennia/comms/comms.py b/evennia/comms/comms.py index a32b425df8..d6666a2bd4 100644 --- a/evennia/comms/comms.py +++ b/evennia/comms/comms.py @@ -5,11 +5,10 @@ Base typeclass for in-game Channels. import re +import evennia from django.contrib.contenttypes.models import ContentType from django.urls import reverse from django.utils.text import slugify - -import evennia from evennia.comms.managers import ChannelManager from evennia.comms.models import ChannelDB from evennia.typeclasses.models import TypeclassBase @@ -18,7 +17,7 @@ from evennia.utils.utils import inherits_from, make_iter class DefaultChannel(ChannelDB, metaclass=TypeclassBase): - """ + r""" This is the base class for all Channel Comms. Inherit from this to create different types of communication channels. @@ -35,7 +34,7 @@ class DefaultChannel(ChannelDB, metaclass=TypeclassBase): in front of every channel message; use `{channelmessage}` token to insert the name of the current channel. Set to `None` if you want no prefix (or want to handle it in a hook during message generation instead. - - `channel_msg_nick_pattern`(str, default `"{alias}\\s*?|{alias}\\s+?(?P.+?)") - + - `channel_msg_nick_pattern`(str, default `"{alias}\s*?|{alias}\s+?(?P.+?)") - this is what used when a channel subscriber gets a channel nick assigned to this channel. The nickhandler uses the pattern to pick out this channel's name from user input. The `{alias}` token will get both the channel's key and any set/custom aliases diff --git a/evennia/contrib/base_systems/awsstorage/tests.py b/evennia/contrib/base_systems/awsstorage/tests.py index 887aa5d7b9..37736fcc59 100644 --- a/evennia/contrib/base_systems/awsstorage/tests.py +++ b/evennia/contrib/base_systems/awsstorage/tests.py @@ -65,7 +65,7 @@ class S3Boto3StorageTests(S3Boto3TestCase): """ Test the _clean_name when the path has a trailing slash """ - path = self.storage._clean_name("path\\to\\somewhere") + path = self.storage._clean_name(r"path\to\somewhere") self.assertEqual(path, "path/to/somewhere") def test_pickle_with_bucket(self): diff --git a/evennia/utils/tests/test_funcparser.py b/evennia/utils/tests/test_funcparser.py index 5ca8824186..96892283fe 100644 --- a/evennia/utils/tests/test_funcparser.py +++ b/evennia/utils/tests/test_funcparser.py @@ -10,11 +10,10 @@ from ast import literal_eval from unittest.mock import MagicMock, patch from django.test import TestCase, override_settings +from evennia.utils import funcparser, test_resources from parameterized import parameterized from simpleeval import simple_eval -from evennia.utils import funcparser, test_resources - def _test_callable(*args, **kwargs): kwargs.pop("funcparser", None) @@ -144,12 +143,12 @@ class TestFuncParser(TestCase): (r'Test args3 $bar(foo, bar, " too")', "Test args3 _test(foo, bar, too)"), ("Test args4 $foo('')", "Test args4 _test('')"), # ' treated as literal ('Test args4 $foo("")', "Test args4 _test()"), - ("Test args5 $foo(\(\))", "Test args5 _test(())"), - ("Test args6 $foo(\()", "Test args6 _test(()"), + (r"Test args5 $foo(\(\))", "Test args5 _test(())"), + (r"Test args6 $foo(\()", "Test args6 _test(()"), ("Test args7 $foo(())", "Test args7 _test(())"), ("Test args8 $foo())", "Test args8 _test())"), ("Test args9 $foo(=)", "Test args9 _test(=)"), - ("Test args10 $foo(\,)", "Test args10 _test(,)"), + (r"Test args10 $foo(\,)", "Test args10 _test(,)"), (r'Test args10 $foo(",")', "Test args10 _test(,)"), ("Test args11 $foo(()", "Test args11 $foo(()"), # invalid syntax ( @@ -327,7 +326,7 @@ class TestFuncParser(TestCase): """ string = "Test $foo(a) and $bar() and $rep(c) things" ret = self.parser.parse(string, escape=True) - self.assertEqual("Test \$foo(a) and \$bar() and \$rep(c) things", ret) + self.assertEqual(r"Test \$foo(a) and \$bar() and \$rep(c) things", ret) def test_parse_lit(self): """