Ran black on sources

This commit is contained in:
Griatch 2022-09-18 23:58:32 +02:00
parent 6fa68745ba
commit 43378b4c41
30 changed files with 473 additions and 275 deletions

View file

@ -7,13 +7,13 @@ import evennia.accounts.manager
class Migration(migrations.Migration):
dependencies = [
('accounts', '0009_auto_20191025_0831'),
("accounts", "0009_auto_20191025_0831"),
]
operations = [
migrations.AlterField(
model_name='accountdb',
name='first_name',
field=models.CharField(blank=True, max_length=150, verbose_name='first name'),
model_name="accountdb",
name="first_name",
field=models.CharField(blank=True, max_length=150, verbose_name="first name"),
),
]

View file

@ -41,7 +41,7 @@ PATH_REMAP_PREFIX = {
"auditing": "evennia.contrib.utils",
"fieldfill": "evennia.contrib.utils",
"random_string_generator": "evennia.contrib.utils",
"tree_select": "evennia.contrib.utils"
"tree_select": "evennia.contrib.utils",
}
@ -52,43 +52,45 @@ def convert_contrib_typeclass_paths(apps, schema_editor):
try:
package_path = obj.db_typeclass_path.split(".")[2:]
package_name = package_path[0]
if package_path[0] == 'security':
if package_path[0] == "security":
# renamed package and changed path
package_name = 'auditing'
package_name = "auditing"
package_path.pop(0) # no longer security/auditing
if package_path[-1] == ".Clothing":
# renamed Clothing class to ContribClothing
package_path[-1] = "ContribClothing"
package_path = '.'.join(package_path)
package_path = ".".join(package_path)
except IndexError:
print(f"obj.db_typeclass_path={obj.db_typeclass_path} could not be parsed "
"for converting to the new contrib location.")
print(
f"obj.db_typeclass_path={obj.db_typeclass_path} could not be parsed "
"for converting to the new contrib location."
)
continue
if package_name in PATH_REMAP_PREFIX:
obj.db_typeclass_path = f"{PATH_REMAP_PREFIX[package_name]}.{package_path}"
obj.save(update_fields=['db_typeclass_path'])
obj.save(update_fields=["db_typeclass_path"])
for obj in AccountDB.objects.filter(db_cmdset_storage__startswith="evennia.contrib."):
try:
package_path = obj.db_cmdset_storage.split(".")[2:]
package_name = package_path[0]
package_path = '.'.join(package_path)
package_path = ".".join(package_path)
except IndexError:
print(f"obj.db_cmdset_storage={obj.db_cmdset_storage} could not be parsed "
"for converting to the new contrib location.")
print(
f"obj.db_cmdset_storage={obj.db_cmdset_storage} could not be parsed "
"for converting to the new contrib location."
)
continue
if package_name in PATH_REMAP_PREFIX:
obj.db_cmdset_storage = f"{PATH_REMAP_PREFIX[package_name]}.{package_path}"
obj.save(update_fields=['db_cmdset_storage'])
obj.save(update_fields=["db_cmdset_storage"])
class Migration(migrations.Migration):
dependencies = [
('accounts', '0010_auto_20210520_2137'),
("accounts", "0010_auto_20210520_2137"),
]
operations = [
migrations.RunPython(convert_contrib_typeclass_paths, migrations.RunPython.noop)
]
operations = [migrations.RunPython(convert_contrib_typeclass_paths, migrations.RunPython.noop)]