소스 검색

Substitute \x0301 with \x0F for returning to "normal" colors.

tags/v0.1^2
Ben Kurtovic 12 년 전
부모
커밋
b42389d393
11개의 변경된 파일55개의 추가작업 그리고 55개의 파일을 삭제
  1. +5
    -5
      earwigbot/commands/afc_report.py
  2. +14
    -14
      earwigbot/commands/afc_status.py
  3. +2
    -2
      earwigbot/commands/geolocate.py
  4. +15
    -15
      earwigbot/commands/git.py
  5. +2
    -2
      earwigbot/commands/help.py
  6. +2
    -2
      earwigbot/commands/langcode.py
  7. +2
    -2
      earwigbot/commands/registration.py
  8. +1
    -1
      earwigbot/commands/replag.py
  9. +2
    -2
      earwigbot/commands/rights.py
  10. +9
    -9
      earwigbot/commands/threads.py
  11. +1
    -1
      earwigbot/irc/connection.py

+ 5
- 5
earwigbot/commands/afc_report.py 파일 보기

@@ -66,7 +66,7 @@ class AFCReport(Command):
if page:
return self.report(page)

self.reply(data, "submission \x0302{0}\x0301 not found.".format(title))
self.reply(data, "submission \x0302{0}\x0F not found.".format(title))

def get_page(self, title):
page = self.site.get_page(title, follow_redirects=False)
@@ -81,11 +81,11 @@ class AFCReport(Command):
user_name = user.name
user_url = user.get_talkpage().url

msg1 = "AfC submission report for \x0302{0}\x0301 ({1}):"
msg2 = "Status: \x0303{0}\x0301"
msg3 = "Submitted by \x0302{0}\x0301 ({1})"
msg1 = "AfC submission report for \x0302{0}\x0F ({1}):"
msg2 = "Status: \x0303{0}\x0F"
msg3 = "Submitted by \x0302{0}\x0F ({1})"
if status == "accepted":
msg3 = "Reviewed by \x0302{0}\x0301 ({1})"
msg3 = "Reviewed by \x0302{0}\x0F ({1})"

self.reply(self.data, msg1.format(short, url))
self.say(self.data.chan, msg2.format(status))


+ 14
- 14
earwigbot/commands/afc_status.py 파일 보기

@@ -54,17 +54,17 @@ class AFCStatus(Command):
action = data.args[0].lower()
if action.startswith("sub") or action == "s":
subs = self.count_submissions()
msg = "there are \x0305{0}\x0301 pending AfC submissions (\x0302WP:AFC\x0301)."
msg = "there are \x0305{0}\x0F pending AfC submissions (\x0302WP:AFC\x0F)."
self.reply(data, msg.format(subs))

elif action.startswith("redir") or action == "r":
redirs = self.count_redirects()
msg = "there are \x0305{0}\x0301 open redirect requests (\x0302WP:AFC/R\x0301)."
msg = "there are \x0305{0}\x0F open redirect requests (\x0302WP:AFC/R\x0F)."
self.reply(data, msg.format(redirs))

elif action.startswith("file") or action == "f":
files = self.count_redirects()
msg = "there are \x0305{0}\x0301 open file upload requests (\x0302WP:FFU\x0301)."
msg = "there are \x0305{0}\x0F open file upload requests (\x0302WP:FFU\x0F)."
self.reply(data, msg.format(files))

elif action.startswith("agg") or action == "a":
@@ -75,18 +75,18 @@ class AFCStatus(Command):
self.count_redirects(), self.count_files())
agg_num = self.get_aggregate_number(agg_data)
except ValueError:
msg = "\x0303{0}\x0301 isn't a number!"
msg = "\x0303{0}\x0F isn't a number!"
self.reply(data, msg.format(data.args[1]))
return
aggregate = self.get_aggregate(agg_num)
msg = "aggregate is \x0305{0}\x0301 (AfC {1})."
msg = "aggregate is \x0305{0}\x0F (AfC {1})."
self.reply(data, msg.format(agg_num, aggregate))

elif action.startswith("nocolor") or action == "n":
self.reply(data, self.get_status(color=False))

else:
msg = "unknown argument: \x0303{0}\x0301. Valid args are 'subs', 'redirs', 'files', 'agg', 'nocolor'."
msg = "unknown argument: \x0303{0}\x0F. Valid args are 'subs', 'redirs', 'files', 'agg', 'nocolor'."
self.reply(data, msg.format(data.args[0]))

else:
@@ -100,7 +100,7 @@ class AFCStatus(Command):
aggregate = self.get_aggregate(agg_num)

if color:
msg = "Articles for creation {0} (\x0302AFC\x0301: \x0305{1}\x0301; \x0302AFC/R\x0301: \x0305{2}\x0301; \x0302FFU\x0301: \x0305{3}\x0301)."
msg = "Articles for creation {0} (\x0302AFC\x0F: \x0305{1}\x0F; \x0302AFC/R\x0F: \x0305{2}\x0F; \x0302FFU\x0F: \x0305{3}\x0F)."
else:
msg = "Articles for creation {0} (AFC: {1}; AFC/R: {2}; FFU: {3})."
return msg.format(aggregate, subs, redirs, files)
@@ -140,19 +140,19 @@ class AFCStatus(Command):
FFU (for example) indicates that our work is *not* done and the
project-wide backlog is most certainly *not* clear."""
if num == 0:
return "is \x02\x0303clear\x0301\x0F"
return "is \x02\x0303clear\x0F"
elif num <= 200:
return "is \x0303almost clear\x0301"
return "is \x0303almost clear\x0F"
elif num <= 400:
return "is \x0312normal\x0301"
return "is \x0312normal\x0F"
elif num <= 600:
return "is \x0307lightly backlogged\x0301"
return "is \x0307lightly backlogged\x0F"
elif num <= 900:
return "is \x0304backlogged\x0301"
return "is \x0304backlogged\x0F"
elif num <= 1200:
return "is \x02\x0304heavily backlogged\x0301\x0F"
return "is \x02\x0304heavily backlogged\x0F"
else:
return "is \x02\x1F\x0304severely backlogged\x0301\x0F"
return "is \x02\x1F\x0304severely backlogged\x0F"

def get_aggregate_number(self, (subs, redirs, files)):
"""Returns an 'aggregate number' based on the real number of pending


+ 2
- 2
earwigbot/commands/geolocate.py 파일 보기

@@ -45,7 +45,7 @@ class Geolocate(Command):
return

if not self.key:
msg = 'I need an API key for http://ipinfodb.com/ stored as \x0303config.commands["{0}"]["apiKey"]\x0301.'
msg = 'I need an API key for http://ipinfodb.com/ stored as \x0303config.commands["{0}"]["apiKey"]\x0F.'
log = 'Need an API key for http://ipinfodb.com/ stored as config.commands["{0}"]["apiKey"]'
self.reply(data, msg.format(self.name) + ".")
self.logger.error(log.format(self.name))
@@ -64,7 +64,7 @@ class Geolocate(Command):
longitude = res["longitude"]
utcoffset = res["timeZone"]
except KeyError:
self.reply(data, "IP \x0302{0}\x0301 not found.".format(address))
self.reply(data, "IP \x0302{0}\x0F not found.".format(address))
return

msg = "{0}, {1}, {2} ({3}, {4}), UTC {5}"


+ 15
- 15
earwigbot/commands/git.py 파일 보기

@@ -78,12 +78,12 @@ class Git(Command):
elif command == "status":
self.do_status()
else: # They asked us to do something we don't know
msg = "unknown argument: \x0303{0}\x0301.".format(data.args[0])
msg = "unknown argument: \x0303{0}\x0F.".format(data.args[0])
self.reply(data, msg)

def get_repos(self):
data = self.repos.iteritems()
repos = ["\x0302{0}\x0301 ({1})".format(k, v) for k, v in data]
repos = ["\x0302{0}\x0F ({1})".format(k, v) for k, v in data]
return ", ".join(repos)

def get_remote(self):
@@ -94,7 +94,7 @@ class Git(Command):
try:
return getattr(self.repo.remotes, remote_name)
except AttributeError:
msg = "unknown remote: \x0302{0}\x0301.".format(remote_name)
msg = "unknown remote: \x0302{0}\x0F.".format(remote_name)
self.reply(self.data, msg)

def get_time_since(self, date):
@@ -119,21 +119,21 @@ class Git(Command):
}
subcommands = ""
for key in sorted(help.keys()):
subcommands += "\x0303{0}\x0301 ({1}), ".format(key, help[key])
subcommands += "\x0303{0}\x0F ({1}), ".format(key, help[key])
subcommands = subcommands[:-2] # Trim last comma and space
msg = "sub-commands are: {0}; repos are: {1}. Syntax: !git \x0303subcommand\x0301 \x0302repo\x0301."
msg = "sub-commands are: {0}; repos are: {1}. Syntax: !git \x0303subcommand\x0F \x0302repo\x0F."
self.reply(self.data, msg.format(subcommands, self.get_repos()))

def do_branch(self):
"""Get our current branch."""
branch = self.repo.active_branch.name
msg = "currently on branch \x0302{0}\x0301.".format(branch)
msg = "currently on branch \x0302{0}\x0F.".format(branch)
self.reply(self.data, msg)

def do_branches(self):
"""Get a list of branches."""
branches = [branch.name for branch in self.repo.branches]
msg = "branches: \x0302{0}\x0301.".format(", ".join(branches))
msg = "branches: \x0302{0}\x0F.".format(", ".join(branches))
self.reply(self.data, msg)

def do_checkout(self):
@@ -146,18 +146,18 @@ class Git(Command):

current_branch = self.repo.active_branch.name
if target == current_branch:
msg = "already on \x0302{0}\x0301!".format(target)
msg = "already on \x0302{0}\x0F!".format(target)
self.reply(self.data, msg)
return

try:
ref = getattr(self.repo.branches, target)
except AttributeError:
msg = "branch \x0302{0}\x0301 doesn't exist!".format(target)
msg = "branch \x0302{0}\x0F doesn't exist!".format(target)
self.reply(self.data, msg)
else:
ref.checkout()
ms = "switched from branch \x0302{0}\x0301 to \x0302{1}\x0301."
ms = "switched from branch \x0302{0}\x0F to \x0302{1}\x0F."
msg = ms.format(current_branch, target)
self.reply(self.data, msg)
log = "{0} checked out branch {1} of {2}"
@@ -181,11 +181,11 @@ class Git(Command):
try:
ref = getattr(self.repo.branches, target)
except AttributeError:
msg = "branch \x0302{0}\x0301 doesn't exist!".format(target)
msg = "branch \x0302{0}\x0F doesn't exist!".format(target)
self.reply(self.data, msg)
else:
self.repo.git.branch("-d", ref)
msg = "branch \x0302{0}\x0301 has been deleted locally."
msg = "branch \x0302{0}\x0F has been deleted locally."
self.reply(self.data, msg.format(target))
log = "{0} deleted branch {1} of {2}"
logmsg = log.format(self.data.nick, target, self.repo.working_dir)
@@ -194,7 +194,7 @@ class Git(Command):
def do_pull(self):
"""Pull from our remote repository."""
branch = self.repo.active_branch.name
msg = "pulling from remote (currently on \x0302{0}\x0301)..."
msg = "pulling from remote (currently on \x0302{0}\x0F)..."
self.reply(self.data, msg.format(branch))

remote = self.get_remote()
@@ -205,7 +205,7 @@ class Git(Command):

if updated:
branches = ", ".join([info.ref.remote_head for info in updated])
msg = "done; updates to \x0302{0}\x0301 (from {1})."
msg = "done; updates to \x0302{0}\x0F (from {1})."
self.reply(self.data, msg.format(branches, remote.url))
log = "{0} pulled {1} of {2} (updates to {3})"
self.logger.info(log.format(self.data.nick, remote.name,
@@ -227,7 +227,7 @@ class Git(Command):

if updated:
branches = ", ".join([info.ref.remote_head for info in updated])
msg = "last local commit was \x02{0}\x0F ago; updates to \x0302{1}\x0301."
msg = "last local commit was \x02{0}\x0F ago; updates to \x0302{1}\x0F."
self.reply(self.data, msg.format(since, branches))
log = "{0} got status of {1} of {2} (updates to {3})"
self.logger.info(log.format(self.data.nick, remote.name,


+ 2
- 2
earwigbot/commands/help.py 파일 보기

@@ -60,11 +60,11 @@ class Help(Command):
if command.__doc__:
doc = command.__doc__.replace("\n", "")
doc = re.sub("\s\s+", " ", doc)
msg = 'help for command \x0303{0}\x0301: "{1}"'
msg = 'help for command \x0303{0}\x0F: "{1}"'
self.reply(data, msg.format(target, doc))
return

msg = "sorry, no help for \x0303{0}\x0301.".format(target)
msg = "sorry, no help for \x0303{0}\x0F.".format(target)
self.reply(data, msg)

def do_hello(self, data):


+ 2
- 2
earwigbot/commands/langcode.py 파일 보기

@@ -46,8 +46,8 @@ class Langcode(Command):
if name != localname:
name += " ({0})".format(localname)
sites = ", ".join([s["url"] for s in site["site"]])
msg = "\x0302{0}\x0301 is {1} ({2})".format(code, name, sites)
msg = "\x0302{0}\x0F is {1} ({2})".format(code, name, sites)
self.reply(data, msg)
return

self.reply(data, "language \x0302{0}\x0301 not found.".format(code))
self.reply(data, "language \x0302{0}\x0F not found.".format(code))

+ 2
- 2
earwigbot/commands/registration.py 파일 보기

@@ -42,7 +42,7 @@ class Registration(Command):
try:
reg = user.registration
except exceptions.UserNotFoundError:
msg = "the user \x0302{0}\x0301 does not exist."
msg = "the user \x0302{0}\x0F does not exist."
self.reply(data, msg.format(name))
return

@@ -56,7 +56,7 @@ class Registration(Command):
else:
gender = "They're" # Singluar they?

msg = "\x0302{0}\x0301 registered on {1}. {2} {3} old."
msg = "\x0302{0}\x0F registered on {1}. {2} {3} old."
self.reply(data, msg.format(name, date, gender, age))

def get_diff(self, t1, t2):


+ 1
- 1
earwigbot/commands/replag.py 파일 보기

@@ -53,5 +53,5 @@ class Replag(Command):
replag = int(cursor.fetchall()[0][0])
conn.close()

msg = "replag on \x0302{0}\x0301 is \x02{1}\x0F seconds."
msg = "replag on \x0302{0}\x0F is \x02{1}\x0F seconds."
self.reply(data, msg.format(args["db"], replag))

+ 2
- 2
earwigbot/commands/rights.py 파일 보기

@@ -40,7 +40,7 @@ class Rights(Command):
try:
rights = user.groups
except exceptions.UserNotFoundError:
msg = "the user \x0302{0}\x0301 does not exist."
msg = "the user \x0302{0}\x0F does not exist."
self.reply(data, msg.format(name))
return

@@ -48,5 +48,5 @@ class Rights(Command):
rights.remove("*") # Remove the '*' group given to everyone
except ValueError:
pass
msg = "the rights for \x0302{0}\x0301 are {1}."
msg = "the rights for \x0302{0}\x0F are {1}."
self.reply(data, msg.format(name, ', '.join(rights)))

+ 9
- 9
earwigbot/commands/threads.py 파일 보기

@@ -55,7 +55,7 @@ class Threads(Command):
self.do_listall()

else: # They asked us to do something we don't know
msg = "unknown argument: \x0303{0}\x0301.".format(data.args[0])
msg = "unknown argument: \x0303{0}\x0F.".format(data.args[0])
self.reply(data, msg)

def do_list(self):
@@ -70,18 +70,18 @@ class Threads(Command):
for thread in threads:
tname = thread.name
if tname == "MainThread":
t = "\x0302MainThread\x0301 (id {0})"
t = "\x0302MainThread\x0F (id {0})"
normal_threads.append(t.format(thread.ident))
elif tname in self.config.components:
t = "\x0302{0}\x0301 (id {1})"
t = "\x0302{0}\x0F (id {1})"
normal_threads.append(t.format(tname, thread.ident))
elif tname.startswith("reminder"):
tname = tname.replace("reminder ", "")
t = "\x0302reminder\x0301 (until {0})"
t = "\x0302reminder\x0F (until {0})"
normal_threads.append(t.format(tname))
else:
tname, start_time = re.findall("^(.*?) \((.*?)\)$", tname)[0]
t = "\x0302{0}\x0301 (id {1}, since {2})"
t = "\x0302{0}\x0F (id {1}, since {2})"
daemon_threads.append(t.format(tname, thread.ident,
start_time))

@@ -107,12 +107,12 @@ class Threads(Command):
threadlist = [t for t in threads if t.name.startswith(task)]
ids = [str(t.ident) for t in threadlist]
if not ids:
tasklist.append("\x0302{0}\x0301 (idle)".format(task))
tasklist.append("\x0302{0}\x0F (idle)".format(task))
elif len(ids) == 1:
t = "\x0302{0}\x0301 (\x02active\x0F as id {1})"
t = "\x0302{0}\x0F (\x02active\x0F as id {1})"
tasklist.append(t.format(task, ids[0]))
else:
t = "\x0302{0}\x0301 (\x02active\x0F as ids {1})"
t = "\x0302{0}\x0F (\x02active\x0F as ids {1})"
tasklist.append(t.format(task, ', '.join(ids)))

tasks = ", ".join(tasklist)
@@ -139,5 +139,5 @@ class Threads(Command):

data.kwargs["fromIRC"] = True
self.bot.tasks.start(task_name, **data.kwargs)
msg = "task \x0302{0}\x0301 started.".format(task_name)
msg = "task \x0302{0}\x0F started.".format(task_name)
self.reply(data, msg)

+ 1
- 1
earwigbot/irc/connection.py 파일 보기

@@ -142,7 +142,7 @@ class IRCConnection(object):

def reply(self, data, msg, hidelog=False):
"""Send a private message as a reply to a user on the server."""
msg = "\x02{0}\x0f: {1}".format(data.nick, msg)
msg = "\x02{0}\x0F: {1}".format(data.nick, msg)
self.say(data.chan, msg, hidelog)

def action(self, target, msg, hidelog=False):


불러오는 중...
취소
저장