forked from littlecodersh/ItChat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fd6236d
commit 79b756d
Showing
5 changed files
with
68 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
try: | ||
import Queue as queue | ||
except ImportError: | ||
import queue | ||
|
||
class Queue(queue.Queue): | ||
def put(self, message): | ||
queue.Queue.put(self, Message(message)) | ||
|
||
class Message(dict): | ||
def download(self, fileName): | ||
if hasattr(self.text, '__call__'): | ||
return self.text(fileName) | ||
else: | ||
return b'' | ||
def __getattr__(self, value): | ||
value = value[0].upper() + value[1:] | ||
return self.get(value, '') | ||
def __str__(self): | ||
return '{%s}' % ', '.join( | ||
['%s: %s' % (repr(k),repr(v)) for k,v in self.items()]) | ||
def __repr__(self): | ||
return '<%s: %s>' % (self.__class__.__name__.split('.')[-1], | ||
self.__str__()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters