Skip to content

Commit 0ef4da9

Browse files
committed
Fix indentation and regex character classes + escapes
1 parent ac432eb commit 0ef4da9

File tree

9 files changed

+11
-11
lines changed

9 files changed

+11
-11
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ The following guidelines for contribution should be followed if you want to subm
2222

2323
* You need a [GitHub account](https://github.com/signup/free)
2424
* Submit an [issue ticket](https://github.com/ClouDev/CloudBot/issues) for your issue if there is no one yet.
25-
* Try to describe the issue and include steps to reproduce if it's a bug.
25+
* Try to describe the issue and include steps to reproduce if it's a bug.
2626
* If you are able and want to fix this, fork the repository on GitHub
2727

2828
## Make Changes
2929

30-
* In your forked repository, create a topic branch for your upcoming patch. (optional)
30+
* In your forked repository, create a topic branch for your upcoming patch. (optional)
3131
* Make sure you stick to the coding style that is used already.
3232
* Make use of the [`.editorconfig`](http://editorconfig.org/) file.
3333
* 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
3838

3939
* Push your changes to a topic branch in your fork of the repository.
4040
* Open a pull request to the original repository and choose the `python3.4` branch.
41-
_Advanced users may use [`hub`](https://github.com/defunkt/hub#git-pull-request) gem for that._
41+
_Advanced users may use [`hub`](https://github.com/defunkt/hub#git-pull-request) gem for that._
4242
* 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_.
4343
_Notice: You can [turn your previously filed issues into a pull-request here](http://issue2pr.herokuapp.com/)._
4444

cloudbot/util/formatting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def dict_format(args, formats):
266266
# Check if values can be mapped
267267
m = f.format(**args)
268268
# Insert match and number of matched values (max matched values if already in dict)
269-
matches[m] = max([matches.get(m, 0), len(re.findall(r'(\{.*?\})', f))])
269+
matches[m] = max([matches.get(m, 0), len(re.findall(r'({.*?\})', f))])
270270
except Exception:
271271
continue
272272

cloudbot/util/textgen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
import random
4646
import re
4747

48-
TEMPLATE_RE = re.compile(r"\{(.+?)\}")
48+
TEMPLATE_RE = re.compile(r"{(.+?)\}")
4949

5050

5151
class TextGenerator(object):

plugins/amazon.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def amazon(text, reply, _parsed=False):
9393
try:
9494
# get the rating
9595
rating = item.find('i', {'class': 'a-icon-star'}).find('span', {'class': 'a-icon-alt'}).text
96-
rating = re.search(r"([0-9]+(?:(?:\.|,)[0-9])?).*5", rating).group(1).replace(",", ".")
96+
rating = re.search(r"([0-9]+(?:[.,][0-9])?).*5", rating).group(1).replace(",", ".")
9797
# get the rating count
9898
pattern = re.compile(r'(product-reviews|#customerReviews)')
9999
num_ratings = item.find('a', {'href': pattern}).text.replace(".", ",")

plugins/history.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def seen(text, nick, chan, db, event):
9696
if text.lower() == nick.lower():
9797
return "Have you looked in a mirror lately?"
9898

99-
if not re.match("^[A-Za-z0-9_|\^\*\`.\-\]\[\{\}\\\\]*$", text.lower()):
99+
if not re.match("^[A-Za-z0-9_|^*`.\-\]\[{\}\\\\]*$", text.lower()):
100100
return "I can't look up that name, its impossible to use!"
101101

102102
if '_' in text:

plugins/karma.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from cloudbot.util import database
99

1010
karmaplus_re = re.compile('^.*\+\+$')
11-
karmaminus_re = re.compile('^.*\-\-$')
11+
karmaminus_re = re.compile('^.*--$')
1212

1313
karma_table = Table(
1414
'karma',

plugins/link_announcer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from cloudbot.hook import Priority, Action
99

1010
# This will match any URL, blacklist removed and abstracted to a priority/halting system
11-
url_re = re.compile(r'https?://(?:[a-zA-Z]|[0-9]|[$-_@.&+~]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', re.I)
11+
url_re = re.compile(r'https?://(?:[a-zA-Z]|[0-9]|[$-_@.&+~]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', re.I)
1212

1313
HEADERS = {
1414
'Accept-Language': 'en-US,en;q=0.5',

plugins/utility.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
# helper functions
4545

46-
strip_re = re.compile("(\x03|\x02|\x1f|\x0f)(?:,?\d{1,2}(?:,\d{1,2})?)?")
46+
strip_re = re.compile("[\u0003\u0002\u001F\u000F](?:,?\d{1,2}(?:,\d{1,2})?)?")
4747

4848

4949
def strip(string):

plugins/yelling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
OPT_IN = ["#yelling"]
77
YELL_RE = re.compile('[^a-zA-Z]')
8-
URL_RE = re.compile('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+~]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+')
8+
URL_RE = re.compile('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+~]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+')
99

1010

1111
@hook.event([EventType.message, EventType.action])

0 commit comments

Comments
 (0)