Make the code more like PEP8 for readability (#862)

This commit is contained in:
oobabooga 2023-04-07 00:15:45 -03:00 committed by GitHub
parent 848c4edfd5
commit ea6e77df72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 302 additions and 165 deletions

View file

@ -9,6 +9,7 @@ state = {}
available_extensions = []
setup_called = set()
def load_extensions():
global state
for i, name in enumerate(shared.args.extensions):
@ -23,12 +24,16 @@ def load_extensions():
traceback.print_exc()
# This iterator returns the extensions in the order specified in the command-line
def iterator():
for name in sorted(state, key=lambda x : state[x][1]):
for name in sorted(state, key=lambda x: state[x][1]):
if state[name][0] == True:
yield eval(f"extensions.{name}.script"), name
# Extension functions that map string -> string
def apply_extensions(text, typ):
for extension, _ in iterator():
if typ == "input" and hasattr(extension, "input_modifier"):
@ -39,6 +44,7 @@ def apply_extensions(text, typ):
text = extension.bot_prefix_modifier(text)
return text
def create_extensions_block():
global setup_called