Skip to content
This repository has been archived by the owner on Oct 23, 2019. It is now read-only.

Commit

Permalink
Fix indentation and regex character classes + escapes
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxdaemon committed Dec 13, 2017
1 parent ac432eb commit 0ef4da9
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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/)._

Expand Down
2 changes: 1 addition & 1 deletion cloudbot/util/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion cloudbot/util/textgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import random
import re

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


class TextGenerator(object):
Expand Down
2 changes: 1 addition & 1 deletion plugins/amazon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(".", ",")
Expand Down
2 changes: 1 addition & 1 deletion plugins/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion plugins/karma.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion plugins/link_announcer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion plugins/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion plugins/yelling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit 0ef4da9

Please sign in to comment.