Skip to content

Commit

Permalink
Merge pull request #83 from glyph/docstrings
Browse files Browse the repository at this point in the history
re-wrap some docstrings that are mis-formatted or too long
  • Loading branch information
glyph committed Jan 16, 2017
2 parents 9886934 + 3498bb7 commit e84abc9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 14 deletions.
19 changes: 10 additions & 9 deletions imaginary/eimaginary.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,24 @@ class NoSuchCommand(ImaginaryError):

class AmbiguousArgument(ImaginaryError):
"""
One or more of the inputs specified can not be narrowed down to
just one thing. This can be due to the presence of multiple
things with similar names, or due to the absence of anything named
similarly to the given input.
One or more of the inputs specified can not be narrowed down to just one
thing. This can be due to the presence of multiple things with similar
names, or due to the absence of anything named similarly to the given
input.
@ivar action: The action which was being processed when an ambiguity was
found.
found.
@ivar part: The part of the command which was ambiguous. Typically
something like 'target' or 'tool'.
@type part: C{str}
@ivar part: The part of the command which was ambiguous.
Typically something like 'target' or 'tool'.
@ivar partValue: The string which was supplied by the user for the
indicated part.
@type partValue: C{str}
@ivar partValue: The string which was supplied by the user for the indicated part.
@type objects: C{list} of C{IThing}
@ivar objects: The objects which were involved in the ambiguity.
@type objects: C{list} of C{IThing}
"""

def __init__(self, action, part, partValue, objects):
Expand Down
9 changes: 5 additions & 4 deletions imaginary/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ class Thing(item.Item):
A L{Thing} is also the object which serves as the persistent nexus of
powerups that define behavior. An L{_Enhancement} is a powerup for a
L{Thing}. L{Thing}s can be powered up for a number of different interfaces:
L{Thing}. L{Thing}s can be powered up for a number of different
interfaces:
- L{iimaginary.IMovementRestriction}, for preventing the L{Thing} from
moving around,
Expand All @@ -100,9 +101,9 @@ class Thing(item.Item):
- L{iimaginary.ILinkAnnotator}, which can provide annotations on links
incoming to or outgoing from the L{Thing}'s L{Idea},
- L{iimaginary.ILocationLinkAnnotator}, which can provide annotations on
links to or from any L{Thing}'s L{Idea} which is ultimately located
within the powered-up L{Thing}.
- L{iimaginary.ILocationLinkAnnotator}, which can provide annotations
on links to or from any L{Thing}'s L{Idea} which is ultimately
located within the powered-up L{Thing}.
- L{iimaginary.IDescriptionContributor}, which provide components of
the L{Thing}'s description when viewed with the L{Look} action.
Expand Down
13 changes: 12 additions & 1 deletion imaginary/test/test_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def testPopEmpty(self):



class UTF8TerminalBuffer(helper.TerminalBuffer):
class UTF8TerminalBuffer(helper.TerminalBuffer, object):
# An unfortunate hack'n'paste of
# helper.TerminalBuffer.insertAtCursor
def insertAtCursor(self, b):
Expand All @@ -343,6 +343,17 @@ def insertAtCursor(self, b):
self.x += 1


def __str__(self):
"""
Workaround for https://twistedmatrix.com/trac/ticket/8843
"""
supered = super(UTF8TerminalBuffer, self)
maybeBytes = getattr(supered, "__bytes__")
if maybeBytes:
return maybeBytes()
return supered.__str__()



class TextServerTestCase(unittest.TestCase):
"""
Expand Down

0 comments on commit e84abc9

Please sign in to comment.