Skip to content

Commit 02eac0c

Browse files
committed
style: lint files with flake8
1 parent 047d4df commit 02eac0c

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

codeforces/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
from . import error
1+
"""
2+
Codeforces API wrapper for python
3+
"""
24
from . import api
5+
from . import error
36
from . import problem
7+
8+
__all__ = ['error', 'api', 'problem']

codeforces/api.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
Functions to call the codeforces api
3-
"""
1+
"""Functions to call the codeforces api."""
42
import hashlib
53
import json
64
import os
@@ -18,7 +16,7 @@
1816
CODEFORCES_API_URL = "https://codeforces.com/api/"
1917

2018

21-
def __generate_api_sig(method, args, secret):
19+
def generate_api_sig(method, args, secret):
2220
rand = "%06d" % random.randint(0, 999999)
2321
url_args = urllib.parse.urlencode(sorted(args.items()))
2422
return rand + hashlib.sha512(
@@ -28,7 +26,7 @@ def __generate_api_sig(method, args, secret):
2826

2927
def call(method, key=None, secret=None, **kwargs):
3028
"""
31-
Call a Codeforces API method
29+
Call a Codeforces API method.
3230
3331
Parameters
3432
----------
@@ -46,13 +44,14 @@ def call(method, key=None, secret=None, **kwargs):
4644
-------
4745
any
4846
A python object containing the results of the api call.
47+
4948
"""
5049
args = kwargs.copy()
5150

5251
if (key is not None) and (secret is not None):
5352
args['time'] = int(time.time())
5453
args['apiKey'] = key
55-
args['apiSig'] = __generate_api_sig(method, args, secret)
54+
args['apiSig'] = generate_api_sig(method, args, secret)
5655

5756
url_args = urllib.parse.urlencode(args)
5857
url = os.path.join(CODEFORCES_API_URL, "%s?%s" % (method, url_args))

codeforces/problem.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Functions to info about a problem."""
12
import os
23
import urllib.error
34
import urllib.request
@@ -33,8 +34,8 @@ def get_info(contest_id, index, lang='en'):
3334
Memory limit specification for the problem.
3435
sample_tests: zip
3536
Sample tests given for the problem.
36-
"""
3737
38+
"""
3839
problem_url = os.path.join(
3940
CODEFORCES_URL,
4041
"contest/%d/problem/%s?lang=%s" % (contest_id, index, lang)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
license='MIT',
2525
packages=find_packages(exclude=['docs']),
2626
install_requires=['bs4', 'colorama'],
27-
extras_requires={ 'docs': ['sphinx', 'sphinx_rtd_theme'] },
27+
extras_requires={'docs': ['sphinx', 'sphinx_rtd_theme']},
2828
scripts=['bin/cf-run'],
2929
python_requires='>=3.6,<4',
3030
project_urls={

0 commit comments

Comments
 (0)