-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to python 3 #15
base: master
Are you sure you want to change the base?
Conversation
pyrc/bots.py
Outdated
@@ -131,7 +132,7 @@ def parsefuncs(self, target, sender, message, funcs): | |||
|
|||
if group_dict and (len(groups) > len(group_dict)): | |||
# match.groups() also returns named parameters | |||
raise "You cannot use both named and unnamed parameters" | |||
raise IOError("You cannot use both named and unnamed parameters") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe TypeError
or ValueError
would be better here?
pyrc/bots.py
Outdated
@@ -95,8 +96,8 @@ def run_listeners(self, line): | |||
callback(*match.groups()) | |||
|
|||
def addhooks(self): | |||
for func in self.__class__.__dict__.values(): | |||
if callable(func) and hasattr(func, '_type'): | |||
for func in list(self.__class__.__dict__.values()): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for func in vars(self.__class__).values():
would work.
pyrc/bots.py
Outdated
@@ -5,7 +5,8 @@ | |||
import re | |||
import os | |||
|
|||
import threads | |||
from . import threads | |||
import collections |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: PEP8 would put collections
in the group above.
Reorder imports, use vars(), and throw a TypeError instead of an IOError when the user passes in named and unnamed parameters.
One sec, fixing the conflicts now. |
Note: now we use func.__name__ instead of func.func_name in hooks.py.
Hi there,
I got some errors when I tried to use pyrc with a python 3 project, so I made a few changes for it to work with python 3. Though it probably breaks backward compatibility with python 2, so I dunno if you'd want to merge it.
Anyway, no pressure, just thought I'd put it out there :)