diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d1f10ac55..a8245f1de 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,12 +22,12 @@ The following guidelines for contribution should be followed if you want to subm * You need a [GitHub account](https://github.com/signup/free) * Submit an [issue ticket](https://github.com/ClouDev/CloudBot/issues) for your issue if there is no one yet. - * Try to describe the issue and include steps to reproduce if it's a bug. + * Try to describe the issue and include steps to reproduce if it's a bug. * If you are able and want to fix this, fork the repository on GitHub ## Make Changes -* In your forked repository, create a topic branch for your upcoming patch. (optional) +* In your forked repository, create a topic branch for your upcoming patch. (optional) * Make sure you stick to the coding style that is used already. * Make use of the [`.editorconfig`](http://editorconfig.org/) file. * Make commits that make sense and describe them properly. @@ -38,7 +38,7 @@ The following guidelines for contribution should be followed if you want to subm * Push your changes to a topic branch in your fork of the repository. * Open a pull request to the original repository and choose the `python3.4` branch. - _Advanced users may use [`hub`](https://github.com/defunkt/hub#git-pull-request) gem for that._ + _Advanced users may use [`hub`](https://github.com/defunkt/hub#git-pull-request) gem for that._ * If not done in commit messages (which you really should do) please reference and update your issue with the code changes. But _please do not close the issue yourself_. _Notice: You can [turn your previously filed issues into a pull-request here](http://issue2pr.herokuapp.com/)._ diff --git a/cloudbot/util/formatting.py b/cloudbot/util/formatting.py index 4ee7cb102..1357455de 100644 --- a/cloudbot/util/formatting.py +++ b/cloudbot/util/formatting.py @@ -266,7 +266,7 @@ def dict_format(args, formats): # Check if values can be mapped m = f.format(**args) # Insert match and number of matched values (max matched values if already in dict) - matches[m] = max([matches.get(m, 0), len(re.findall(r'(\{.*?\})', f))]) + matches[m] = max([matches.get(m, 0), len(re.findall(r'({.*?\})', f))]) except Exception: continue diff --git a/cloudbot/util/textgen.py b/cloudbot/util/textgen.py index fdc6bab89..6c2b630de 100644 --- a/cloudbot/util/textgen.py +++ b/cloudbot/util/textgen.py @@ -45,7 +45,7 @@ import random import re -TEMPLATE_RE = re.compile(r"\{(.+?)\}") +TEMPLATE_RE = re.compile(r"{(.+?)\}") class TextGenerator(object): diff --git a/plugins/amazon.py b/plugins/amazon.py index e29a3ea12..507475a5f 100644 --- a/plugins/amazon.py +++ b/plugins/amazon.py @@ -93,7 +93,7 @@ def amazon(text, reply, _parsed=False): try: # get the rating rating = item.find('i', {'class': 'a-icon-star'}).find('span', {'class': 'a-icon-alt'}).text - rating = re.search(r"([0-9]+(?:(?:\.|,)[0-9])?).*5", rating).group(1).replace(",", ".") + rating = re.search(r"([0-9]+(?:[.,][0-9])?).*5", rating).group(1).replace(",", ".") # get the rating count pattern = re.compile(r'(product-reviews|#customerReviews)') num_ratings = item.find('a', {'href': pattern}).text.replace(".", ",") diff --git a/plugins/history.py b/plugins/history.py index e3e76abfb..39eda614a 100644 --- a/plugins/history.py +++ b/plugins/history.py @@ -96,7 +96,7 @@ def seen(text, nick, chan, db, event): if text.lower() == nick.lower(): return "Have you looked in a mirror lately?" - if not re.match("^[A-Za-z0-9_|\^\*\`.\-\]\[\{\}\\\\]*$", text.lower()): + if not re.match("^[A-Za-z0-9_|^*`.\-\]\[{\}\\\\]*$", text.lower()): return "I can't look up that name, its impossible to use!" if '_' in text: diff --git a/plugins/karma.py b/plugins/karma.py index 5511aebbe..b1bba6371 100644 --- a/plugins/karma.py +++ b/plugins/karma.py @@ -8,7 +8,7 @@ from cloudbot.util import database karmaplus_re = re.compile('^.*\+\+$') -karmaminus_re = re.compile('^.*\-\-$') +karmaminus_re = re.compile('^.*--$') karma_table = Table( 'karma', diff --git a/plugins/link_announcer.py b/plugins/link_announcer.py index 78f340e5e..ba058dcdb 100644 --- a/plugins/link_announcer.py +++ b/plugins/link_announcer.py @@ -8,7 +8,7 @@ from cloudbot.hook import Priority, Action # This will match any URL, blacklist removed and abstracted to a priority/halting system -url_re = re.compile(r'https?://(?:[a-zA-Z]|[0-9]|[$-_@.&+~]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', re.I) +url_re = re.compile(r'https?://(?:[a-zA-Z]|[0-9]|[$-_@.&+~]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', re.I) HEADERS = { 'Accept-Language': 'en-US,en;q=0.5', diff --git a/plugins/utility.py b/plugins/utility.py index 5ae669da7..8dc9a3f72 100644 --- a/plugins/utility.py +++ b/plugins/utility.py @@ -43,7 +43,7 @@ # helper functions -strip_re = re.compile("(\x03|\x02|\x1f|\x0f)(?:,?\d{1,2}(?:,\d{1,2})?)?") +strip_re = re.compile("[\u0003\u0002\u001F\u000F](?:,?\d{1,2}(?:,\d{1,2})?)?") def strip(string): diff --git a/plugins/yelling.py b/plugins/yelling.py index 7819e1a0b..a112f9ea4 100644 --- a/plugins/yelling.py +++ b/plugins/yelling.py @@ -5,7 +5,7 @@ OPT_IN = ["#yelling"] YELL_RE = re.compile('[^a-zA-Z]') -URL_RE = re.compile('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+~]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+') +URL_RE = re.compile('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+~]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+') @hook.event([EventType.message, EventType.action])