PEP8 cleanup of the entire codebase. Unchanged are many cases of too-long lines, partly because of the rewrite they would require but also because splitting many lines up would make the code harder to read. Also the third-party libraries (idmapper, prettytable etc) were not cleaned.
This commit is contained in:
parent
30b7d2a405
commit
1ae17bcbe4
154 changed files with 5613 additions and 4054 deletions
|
|
@ -0,0 +1 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
|
@ -32,6 +32,7 @@ from ev import default_cmds
|
|||
#from contrib import misc_commands
|
||||
#from contrib import chargen
|
||||
|
||||
|
||||
class ExampleCmdSet(CmdSet):
|
||||
"""
|
||||
Implements an empty, example cmdset.
|
||||
|
|
@ -44,7 +45,8 @@ class ExampleCmdSet(CmdSet):
|
|||
This is the only method defined in a cmdset, called during
|
||||
its creation. It should populate the set with command instances.
|
||||
|
||||
As and example we just add the empty base Command object. It prints some info.
|
||||
As and example we just add the empty base Command object.
|
||||
It prints some info.
|
||||
"""
|
||||
self.add(Command())
|
||||
|
||||
|
|
@ -75,6 +77,7 @@ class CharacterCmdSet(default_cmds.CharacterCmdSet):
|
|||
#self.add(lineeditor.CmdEditor())
|
||||
#self.add(misc_commands.CmdQuell())
|
||||
|
||||
|
||||
class UnloggedinCmdSet(default_cmds.UnloggedinCmdSet):
|
||||
"""
|
||||
This is an example of how to overload the command set of the
|
||||
|
|
@ -99,6 +102,7 @@ class UnloggedinCmdSet(default_cmds.UnloggedinCmdSet):
|
|||
# any commands you add below will overload the default ones.
|
||||
#
|
||||
|
||||
|
||||
class PlayerCmdSet(default_cmds.PlayerCmdSet):
|
||||
"""
|
||||
This is set is available to the player when they have no
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ from ev import Command, CmdSet
|
|||
# Commands defined on the red button
|
||||
#------------------------------------------------------------
|
||||
|
||||
|
||||
class CmdNudge(Command):
|
||||
"""
|
||||
Try to nudge the button's lid
|
||||
|
|
@ -27,7 +28,7 @@ class CmdNudge(Command):
|
|||
push the lid of the button away.
|
||||
"""
|
||||
|
||||
key = "nudge lid" # two-word command name!
|
||||
key = "nudge lid" # two-word command name!
|
||||
aliases = ["nudge"]
|
||||
locks = "cmd:all()"
|
||||
|
||||
|
|
@ -44,6 +45,7 @@ class CmdNudge(Command):
|
|||
self.caller.msg("You manage to get a nail under the lid.")
|
||||
self.caller.execute_cmd("open lid")
|
||||
|
||||
|
||||
class CmdPush(Command):
|
||||
"""
|
||||
Push the red button
|
||||
|
|
@ -82,7 +84,6 @@ class CmdPush(Command):
|
|||
self.caller.msg(string)
|
||||
|
||||
|
||||
|
||||
class CmdSmashGlass(Command):
|
||||
"""
|
||||
smash glass
|
||||
|
|
@ -118,7 +119,8 @@ class CmdSmashGlass(Command):
|
|||
string += " you should just try to open the lid instead?"
|
||||
self.caller.msg(string)
|
||||
self.caller.location.msg_contents("%s tries to smash the glass of the button." %
|
||||
(self.caller.name), exclude=self.caller)
|
||||
(self.caller.name), exclude=self.caller)
|
||||
|
||||
|
||||
class CmdOpenLid(Command):
|
||||
"""
|
||||
|
|
@ -144,12 +146,13 @@ class CmdOpenLid(Command):
|
|||
string += "the lid will soon close again."
|
||||
self.caller.msg(string)
|
||||
self.caller.location.msg_contents("%s opens the lid of the button." %
|
||||
(self.caller.name), exclude=self.caller)
|
||||
(self.caller.name), exclude=self.caller)
|
||||
# add the relevant cmdsets to button
|
||||
self.obj.cmdset.add(LidClosedCmdSet)
|
||||
# call object method
|
||||
self.obj.open_lid()
|
||||
|
||||
|
||||
class CmdCloseLid(Command):
|
||||
"""
|
||||
close the lid
|
||||
|
|
@ -174,6 +177,7 @@ class CmdCloseLid(Command):
|
|||
self.caller.location.msg_contents("%s closes the button's lid." %
|
||||
(self.caller.name), exclude=self.caller)
|
||||
|
||||
|
||||
class CmdBlindLook(Command):
|
||||
"""
|
||||
Looking around in darkness
|
||||
|
|
@ -209,7 +213,8 @@ class CmdBlindLook(Command):
|
|||
string += "Until it wears off, all you can do is feel around blindly."
|
||||
self.caller.msg(string)
|
||||
self.caller.location.msg_contents("%s stumbles around, blinded." %
|
||||
(self.caller.name), exclude=self.caller)
|
||||
(self.caller.name), exclude=self.caller)
|
||||
|
||||
|
||||
class CmdBlindHelp(Command):
|
||||
"""
|
||||
|
|
@ -232,7 +237,6 @@ class CmdBlindHelp(Command):
|
|||
# Command sets for the red button
|
||||
#---------------------------------------------------------------
|
||||
|
||||
|
||||
# We next tuck these commands into their respective command sets.
|
||||
# (note that we are overdoing the cdmset separation a bit here
|
||||
# to show how it works).
|
||||
|
|
@ -247,12 +251,13 @@ class DefaultCmdSet(CmdSet):
|
|||
using obj.cmdset.add_default().
|
||||
"""
|
||||
key = "RedButtonDefault"
|
||||
mergetype = "Union" # this is default, we don't really need to put it here.
|
||||
mergetype = "Union" # this is default, we don't really need to put it here.
|
||||
|
||||
def at_cmdset_creation(self):
|
||||
"Init the cmdset"
|
||||
self.add(CmdPush())
|
||||
|
||||
|
||||
class LidClosedCmdSet(CmdSet):
|
||||
"""
|
||||
A simple cmdset tied to the redbutton object.
|
||||
|
|
@ -274,6 +279,7 @@ class LidClosedCmdSet(CmdSet):
|
|||
self.add(CmdSmashGlass())
|
||||
self.add(CmdOpenLid())
|
||||
|
||||
|
||||
class LidOpenCmdSet(CmdSet):
|
||||
"""
|
||||
This is the opposite of the Closed cmdset.
|
||||
|
|
@ -288,6 +294,7 @@ class LidOpenCmdSet(CmdSet):
|
|||
"setup the cmdset (just one command)"
|
||||
self.add(CmdCloseLid())
|
||||
|
||||
|
||||
class BlindCmdSet(CmdSet):
|
||||
"""
|
||||
This is the cmdset added to the *player* when
|
||||
|
|
@ -300,8 +307,8 @@ class BlindCmdSet(CmdSet):
|
|||
# we want to stop the player from walking around
|
||||
# in this blinded state, so we hide all exits too.
|
||||
# (channel commands will still work).
|
||||
no_exits = True # keep player in the same room
|
||||
no_objs = True # don't allow object commands
|
||||
no_exits = True # keep player in the same room
|
||||
no_objs = True # don't allow object commands
|
||||
|
||||
def at_cmdset_creation(self):
|
||||
"Setup the blind cmdset"
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ from ev import Command as BaseCommand
|
|||
from ev import default_cmds
|
||||
from ev import utils
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
"""
|
||||
Inherit from this if you want to create your own
|
||||
|
|
@ -34,7 +35,6 @@ class Command(BaseCommand):
|
|||
# arg_regex = r"\s.*?|$" # optional regex detailing how the part after
|
||||
# the cmdname must look to match this command.
|
||||
|
||||
|
||||
# (we don't implement hook method access() here, you don't need to
|
||||
# modify that unless you want to change how the lock system works
|
||||
# (in that case see src.commands.command.Command))
|
||||
|
|
@ -104,8 +104,8 @@ class MuxCommand(default_cmds.MuxCommand):
|
|||
cmdhandler at this point, and stored in self.cmdname. The rest is stored
|
||||
in self.args.
|
||||
|
||||
The MuxCommand parser breaks self.args into its constituents and stores them in the
|
||||
following variables:
|
||||
The MuxCommand parser breaks self.args into its constituents and stores them
|
||||
in the following variables:
|
||||
self.switches = optional list of /switches (without the /)
|
||||
self.raw = This is the raw argument input, including switches
|
||||
self.args = This is re-defined to be everything *except* the switches
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue