Skip to content

Commit d180cb7

Browse files
committed
Fix E226
E226 means "missing whitespace around arithmetic operator".
1 parent af4af7d commit d180cb7

File tree

11 files changed

+23
-23
lines changed

11 files changed

+23
-23
lines changed

botogram/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __init__(self, api_key, endpoint=None):
3636

3737
def call(self, method, params=None, files=None, expect=None):
3838
"""Call a method of the API"""
39-
url = self._endpoint+"bot%s/%s" % (self._api_key, method)
39+
url = self._endpoint + "bot%s/%s" % (self._api_key, method)
4040
response = requests.get(url, params=params, files=files)
4141
content = response.json()
4242

@@ -55,7 +55,7 @@ def call(self, method, params=None, files=None, expect=None):
5555

5656
def file_content(self, path):
5757
"""Get the content of an user-submitted file"""
58-
url = self._endpoint+"file/bot%s/%s" % (self._api_key, path)
58+
url = self._endpoint + "file/bot%s/%s" % (self._api_key, path)
5959
response = requests.get(url)
6060

6161
return response.content

botogram/bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def __init__(self, api_connection):
8383

8484
# This regex will match all commands pointed to this bot
8585
self._commands_re = re.compile(r'^\/([a-zA-Z0-9_]+)(@' +
86-
self.itself.username+r')?( .*)?$')
86+
self.itself.username + r')?( .*)?$')
8787

8888
def __reduce__(self):
8989
# Use the standard __reduce__

botogram/components.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def _get_commands(self):
166166
def merge_chains(main, *components):
167167
"""Merge multiple chains returned by the components"""
168168
merged = {}
169-
components = [main]+list(reversed(components))
169+
components = [main] + list(reversed(components))
170170

171171
# First of all, merge all the subchains of the different components
172172
# together -- This is a separate step so the order is preserved

botogram/hooks.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ class Hook:
1818
def __init__(self, func, component, args=None):
1919
prefix = ""
2020
if component.component_name:
21-
prefix = component.component_name+"::"
21+
prefix = component.component_name + "::"
2222

2323
self.func = func
24-
self.name = prefix+func.__name__
24+
self.name = prefix + func.__name__
2525
self.component = component
2626
self.component_id = component._component_id
2727

@@ -32,7 +32,7 @@ def __reduce__(self):
3232
return rebuild, (self.__class__, self.func, self.component, self._args)
3333

3434
def __repr__(self):
35-
return "<"+self.__class__.__name__+" \""+self.name+"\">"
35+
return "<" + self.__class__.__name__ + " \"" + self.name + "\">"
3636

3737
def _after_init(self, args):
3838
"""Prepare the object"""
@@ -167,7 +167,7 @@ def _after_init(self, args):
167167
raise ValueError("Invalid command name: %s" % args["name"])
168168

169169
# This regex will match all commands pointed to this bot
170-
self._regex = re.compile(r'^\/'+args["name"]+r'(@[a-zA-Z0-9_]+)?'
170+
self._regex = re.compile(r'^\/' + args["name"] + r'(@[a-zA-Z0-9_]+)?'
171171
r'( .*)?$')
172172

173173
def _call(self, bot, update):
@@ -178,7 +178,7 @@ def _call(self, bot, update):
178178
match = self._regex.match(text)
179179
if not match:
180180
return
181-
if match.group(1) and match.group(1) != "@"+bot.itself.username:
181+
if match.group(1) and match.group(1) != "@" + bot.itself.username:
182182
return
183183

184184
args = _command_args_split_re.split(text)[1:]

botogram/objects/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def name(self):
3131
"""Get the full name of the user"""
3232
result = self.first_name
3333
if self.last_name is not None:
34-
result += " "+self.last_name
34+
result += " " + self.last_name
3535

3636
return result
3737

@@ -99,7 +99,7 @@ def name(self):
9999
elif self.first_name is not None:
100100
result = self.first_name
101101
if self.last_name is not None:
102-
result += " "+self.last_name
102+
result += " " + self.last_name
103103

104104
return result
105105

@@ -145,12 +145,12 @@ def __init__(self, data, api=None):
145145
# Calculate the smaller and the biggest sizes
146146
with_size = {}
147147
for size in self.sizes:
148-
with_size[size.height*size.width] = size
148+
with_size[size.height * size.width] = size
149149
self.smallest = with_size[min(with_size.keys())]
150150
self.biggest = with_size[max(with_size.keys())]
151151

152152
# Publish all the attributes of the biggest-size photo
153-
attrs = list(PhotoSize.required.keys())+list(PhotoSize.optional.keys())
153+
attrs = list(PhotoSize.required.keys()) + list(PhotoSize.optional.keys())
154154
for attr in attrs:
155155
setattr(self, attr, getattr(self.biggest, attr))
156156

botogram/objects/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def set_api(self, api):
5858
self._api = api
5959

6060
# Recursively set the API
61-
for key in list(self.required.keys())+list(self.optional.keys()):
61+
for key in list(self.required.keys()) + list(self.optional.keys()):
6262
# Be sure to use the right key
6363
if key in self.replace_keys:
6464
key = self.replace_keys[key]

botogram/runner/ipc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def _write_on_socket(conn, data):
250250
"""Write a chunk of data on a connection"""
251251
remaining = len(data)
252252
while remaining > 0:
253-
sent = conn.send(data[len(data)-remaining:])
253+
sent = conn.send(data[len(data) - remaining:])
254254
if sent == 0:
255255
raise EOFError("Broken socket!")
256256

botogram/runner/processes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def loop(self):
191191

192192
try:
193193
updates = self.bot.api.call("getUpdates", {
194-
"offset": self.last_id+1,
194+
"offset": self.last_id + 1,
195195
"timeout": 1,
196196
}, expect=objects.Updates)
197197
except (api.APIError, ValueError, TypeError) as e:

botogram/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def now(self, current=None):
3737
if current is None:
3838
current = time.time()
3939

40-
res = self.last_run+self.interval <= current
40+
res = self.last_run + self.interval <= current
4141

4242
# Increment the last_run if the result is True
4343
if res:

botogram/utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
def _deprecated_message(name, removed_on, fix, back):
3535
before = "%s will be removed in botogram %s." % (name, removed_on)
3636
after = "Fix: %s" % fix
37-
warn(back-1, before, after)
37+
warn(back - 1, before, after)
3838

3939

4040
def deprecated(name, removed_on, fix):
@@ -60,7 +60,7 @@ def get(k):
6060

6161
if key in deprecated:
6262
_deprecated_message(
63-
get("__class__").__name__+"."+key,
63+
get("__class__").__name__ + "." + key,
6464
deprecated[key]["removed_on"],
6565
deprecated[key]["fix"],
6666
-2,
@@ -79,15 +79,15 @@ def warn(stack_pos, before_message, after_message=None):
7979
if sys.version_info[:3] == (3, 5, 0):
8080
stack_pos -= 1
8181

82-
frame = traceback.extract_stack()[stack_pos-1]
82+
frame = traceback.extract_stack()[stack_pos - 1]
8383
at_message = "At: %s (line %s)" % (frame[0], frame[1])
8484

8585
warn_logger.warn(before_message)
8686
if after_message is not None:
8787
warn_logger.warn(at_message)
88-
warn_logger.warn(after_message+"\n")
88+
warn_logger.warn(after_message + "\n")
8989
else:
90-
warn_logger.warn(at_message+"\n")
90+
warn_logger.warn(at_message + "\n")
9191

9292

9393
def wraps(func):

0 commit comments

Comments
 (0)