From d306c255838e3c04a2f48d973d0cb3aedce27431 Mon Sep 17 00:00:00 2001 From: Vincent Le Goff Date: Tue, 25 Jul 2017 22:25:29 +0200 Subject: [PATCH] Rename the generator contrib into random_string_generator --- evennia/contrib/README.md | 4 ++-- .../contrib/{generator.py => random_string_generator.py} | 4 ++-- evennia/contrib/tests.py | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) rename evennia/contrib/{generator.py => random_string_generator.py} (98%) diff --git a/evennia/contrib/README.md b/evennia/contrib/README.md index a30b7cb64a..5515cfd923 100644 --- a/evennia/contrib/README.md +++ b/evennia/contrib/README.md @@ -30,8 +30,6 @@ things you want from here into your game folder and change them there. multiple descriptions for time and season as well as details. * GenderSub (Griatch 2015) - Simple example (only) of storing gender on a character and access it in an emote with a custom marker. -* Generator (Vincent Le Goff 2017) - Simple pseudo-random generator of - strings with rules, avoiding repetitions. * Mail (grungies1138 2016) - An in-game mail system for communication. * Menu login (Griatch 2011) - A login system using menus asking for name/password rather than giving them as one command @@ -40,6 +38,8 @@ things you want from here into your game folder and change them there. * Menu Login (Vincent-lg 2016) - Alternate login system using EvMenu. * Multidescer (Griatch 2016) - Advanced descriptions combined from many separate description components, inspired by MUSH. +* Random_string_generator (Vincent Le Goff 2017) - Simple pseudo-random + gereator of strings with rules, avoiding repetitions. * RPLanguage (Griatch 2015) - Dynamic obfuscation of emotes when speaking unfamiliar languages. Also obfuscates whispers. * RPSystem (Griatch 2015) - Full director-style emoting system diff --git a/evennia/contrib/generator.py b/evennia/contrib/random_string_generator.py similarity index 98% rename from evennia/contrib/generator.py rename to evennia/contrib/random_string_generator.py index a1a48eacae..76198c5729 100644 --- a/evennia/contrib/generator.py +++ b/evennia/contrib/random_string_generator.py @@ -11,7 +11,7 @@ stored and won't be available again in order to avoid repetition. Here's a very simple example: ```python -from evennia.contrib.generator import Generator +from evennia.contrib.random_string_generator import Generator # Create a generator for phone numbers phone_generator = Generator("phone number", r"555-\d{3}-\d{4}") # Generate a phone number (555-XXX-XXXX with X as numbers) @@ -163,7 +163,7 @@ class Generator(object): try: script = ScriptDB.objects.get(db_key="generator_script") except ScriptDB.DoesNotExist: - script = create_script("contrib.generator.GeneratorScript") + script = create_script("contrib.random_string_generator.GeneratorScript") type(self).script = script return script diff --git a/evennia/contrib/tests.py b/evennia/contrib/tests.py index 6add0571a4..bc37eb42de 100644 --- a/evennia/contrib/tests.py +++ b/evennia/contrib/tests.py @@ -987,11 +987,11 @@ class TestUnixCommand(CommandTest): self.assertTrue(any(l.startswith("dummy: error:") for l in lines)) -from evennia.contrib import generator +from evennia.contrib import random_string_generator -SIMPLE_GENERATOR = generator.Generator("simple", "[01]{2}") +SIMPLE_GENERATOR = random_string_generator.Generator("simple", "[01]{2}") -class TestGenerator(EvenniaTest): +class TestRandomStringGenerator(EvenniaTest): def test_generate(self): """Generate and fail when exhausted.""" @@ -1004,5 +1004,5 @@ class TestGenerator(EvenniaTest): # At this point, we have generated 4 strings. # We can't generate one more - with self.assertRaises(generator.ExhaustedGenerator): + with self.assertRaises(random_string_generator.ExhaustedGenerator): SIMPLE_GENERATOR.get()