mirror of
https://github.com/evennia/evennia.git
synced 2026-04-03 06:27:17 +02:00
Some cleanup code fixes.
This commit is contained in:
parent
ec54de4797
commit
792b3c9282
6 changed files with 10 additions and 67 deletions
|
|
@ -295,70 +295,6 @@ class BatchCommandProcessor(object):
|
|||
commands = [c for c in commands if c]
|
||||
return commands
|
||||
|
||||
# #helper function
|
||||
# def identify_line(line):
|
||||
# """
|
||||
# Identifies the line type (comment, commanddef or empty)
|
||||
# """
|
||||
# try:
|
||||
# if line.strip().startswith("#INSERT"):
|
||||
# return "insert"
|
||||
# elif line.strip()[0] == '#':
|
||||
# return "comment"
|
||||
# else:
|
||||
# return "commanddef"
|
||||
# except IndexError:
|
||||
# return "empty"
|
||||
#
|
||||
# #read the indata, if possible.
|
||||
# lines = read_batchfile(pythonpath, file_ending='.ev')
|
||||
#
|
||||
# #line = utils.to_unicode(line)
|
||||
# if not lines:
|
||||
# return None
|
||||
#
|
||||
# commands = []
|
||||
# curr_cmd = ""
|
||||
#
|
||||
# #purge all superfluous whitespace and newlines from lines
|
||||
# reg1 = re.compile(r"\s+")
|
||||
# lines = [reg1.sub(" ", l) for l in lines]
|
||||
#
|
||||
# #parse all command definitions into a list.
|
||||
# for line in lines:
|
||||
#
|
||||
# typ = identify_line(line)
|
||||
#
|
||||
# if typ == "commanddef":
|
||||
# curr_cmd += line
|
||||
# elif typ == "empty" and curr_cmd:
|
||||
# curr_cmd += "\r\n"
|
||||
# elif typ == "insert":
|
||||
# # note that we are not safeguarding for
|
||||
# # cyclic imports here!
|
||||
# if curr_cmd:
|
||||
# commands.append(curr_cmd.strip())
|
||||
# curr_cmd = ""
|
||||
# filename = line.lstrip("#INSERT").strip()
|
||||
# insert_commands = self.parse_file(filename)
|
||||
# if insert_commands is None:
|
||||
# insert_commands = ["{rINSERT ERROR: %s{n" % filename]
|
||||
# commands.extend(insert_commands)
|
||||
# else: #comment
|
||||
# if curr_cmd:
|
||||
# commands.append(curr_cmd.strip())
|
||||
# curr_cmd = ""
|
||||
# if curr_cmd:
|
||||
# commands.append(curr_cmd.strip())
|
||||
#
|
||||
# #second round to clean up now merged line edges etc.
|
||||
# reg2 = re.compile(r"[ \t\f\v]+")
|
||||
# commands = [reg2.sub(" ", c) for c in commands]
|
||||
#
|
||||
# #remove eventual newline at the end of commands
|
||||
# commands = [c.strip('\r\n') for c in commands]
|
||||
# return commands
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue