Skip to content

Commit 8e6f7c4

Browse files
committed
style: Lint api.py
1 parent f5d3874 commit 8e6f7c4

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

codeforces/api.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
import time
2-
import os
1+
"""
2+
Functions to call the codeforces api
3+
"""
4+
import hashlib
35
import json
6+
import os
47
import random
5-
import hashlib
6-
import urllib.request
8+
import time
79
import urllib.error
810
import urllib.parse
9-
from . import error
11+
import urllib.request
1012

13+
from . import error
1114

1215
__all__ = ['call']
1316

@@ -24,7 +27,7 @@ def __generate_api_sig(method, args, secret):
2427

2528

2629
def call(method, key=None, secret=None, **kargs):
27-
"""call a Codeforces API method"""
30+
"""Call a Codeforces API method"""
2831
args = kargs.copy()
2932

3033
if (key is not None) and (secret is not None):
@@ -42,8 +45,11 @@ def call(method, key=None, secret=None, **kargs):
4245
if err.code == 400:
4346
data = json.loads(err.read())
4447
elif err.code == 404:
45-
data = {'status': 'FAILED', 'comment': "%s: No such method" % method}
46-
elif (err.code in (429, 503)):
48+
data = {
49+
'status': 'FAILED',
50+
'comment': "%s: No such method" % method
51+
}
52+
elif err.code in (429, 503):
4753
time.sleep(1)
4854
return call(method, key, secret, **kargs)
4955
else:

0 commit comments

Comments
 (0)