From 4d763288e54316d20ded608633673d6e6fb314a5 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sun, 7 Jun 2015 19:36:21 -0700 Subject: [PATCH] rename utils._nicktoUid to utils.nickToUid Consistency in function capitalization is a good thing!! --- plugins/admin.py | 14 +++++++------- plugins/commands.py | 2 +- utils.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/admin.py b/plugins/admin.py index 0139fbe..e4edd18 100644 --- a/plugins/admin.py +++ b/plugins/admin.py @@ -38,10 +38,10 @@ def quitclient(irc, source, args): except IndexError: utils.msg(irc, source, "Error: not enough arguments. Needs 1: nick.") return - if irc.pseudoclient.uid == utils._nicktoUid(irc, nick): + if irc.pseudoclient.uid == utils.nickToUid(irc, nick): utils.msg(irc, source, "Error: cannot quit the main PyLink PseudoClient!") return - u = utils._nicktoUid(irc, nick) + u = utils.nickToUid(irc, nick) quitmsg = ' '.join(args[1:]) or 'Client quit' proto.quitClient(irc, u, quitmsg) @@ -56,7 +56,7 @@ def joinclient(irc, source, args): except IndexError: utils.msg(irc, source, "Error: not enough arguments. Needs 2: nick, comma separated list of channels.") return - u = utils._nicktoUid(irc, nick) + u = utils.nickToUid(irc, nick) for channel in clist: if not channel.startswith('#'): utils.msg(irc, source, "Error: channel names must start with #.") @@ -72,7 +72,7 @@ def nickclient(irc, source, args): except IndexError: utils.msg(irc, source, "Error: not enough arguments. Needs 2: nick, newnick.") return - u = utils._nicktoUid(irc, nick) + u = utils.nickToUid(irc, nick) proto.nickClient(irc, u, newnick) @utils.add_cmd @@ -85,7 +85,7 @@ def partclient(irc, source, args): except IndexError: utils.msg(irc, source, "Error: not enough arguments. Needs 2: nick, comma separated list of channels.") return - u = utils._nicktoUid(irc, nick) + u = utils.nickToUid(irc, nick) for channel in clist: if not channel.startswith('#'): utils.msg(irc, source, "Error: channel names must start with #.") @@ -103,8 +103,8 @@ def kickclient(irc, source, args): except IndexError: utils.msg(irc, source, "Error: not enough arguments. Needs 3-4: nick, channel, target, reason (optional).") return - u = utils._nicktoUid(irc, nick) - targetu = utils._nicktoUid(irc, target) + u = utils.nickToUid(irc, nick) + targetu = utils.nickToUid(irc, target) if not channel.startswith('#'): utils.msg(irc, source, "Error: channel names must start with #.") return diff --git a/plugins/commands.py b/plugins/commands.py index c7227f0..edda62d 100644 --- a/plugins/commands.py +++ b/plugins/commands.py @@ -12,7 +12,7 @@ def tell(irc, source, args): except IndexError: utils.msg(irc, source, 'Error: not enough arguments.') return - targetuid = proto._nicktoUid(irc, target) + targetuid = utils.nickToUid(irc, target) if targetuid is None: utils.msg(irc, source, 'Error: unknown user %r' % target) return diff --git a/utils.py b/utils.py index 0a09cdc..10bdbee 100644 --- a/utils.py +++ b/utils.py @@ -27,7 +27,7 @@ def add_cmd(func, name=None): name = name.lower() bot_commands[name] = func -def _nicktoUid(irc, nick): +def nickToUid(irc, nick): for k, v in irc.users.items(): if v.nick == nick: return k