Skip to content

Commit bf1c118

Browse files
authored
Merge pull request 3scale-qe#175 from mdujava/codestyle
Some codestyle changes
2 parents 32de76d + b36113f commit bf1c118

15 files changed

Lines changed: 1403 additions & 1050 deletions

.github/workflows/lint-and-smoke.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
pipenv install --dev
2222
- name: lint
2323
run: |
24-
pipenv run python -m flake8 .
24+
pipenv run python -m flake8 threescale_api/
2525
- name: smoke
2626
run: |
2727
pipenv run python -m pytest -m smoke

Pipfile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
[[source]]
2-
name = "pypi"
3-
url = "https://pypi.org/simple"
4-
verify_ssl = true
5-
61
[dev-packages]
2+
black = "*"
3+
flake8 = "*"
4+
mypy = "*"
75
pylint = "*"
8-
pytest = "*"
96
responses = "*"
7+
types-requests = "*"
8+
109
python-dotenv = "*"
11-
flake8 = "*"
10+
pytest = "<9.0.0"
11+
12+
#python-language-server = "*"
13+
#pyls-mypy = "*"
14+
#pyls-isort = "*"
1215

1316
[packages]
1417
requests = "*"
15-
backoff = "*"
18+
python-backoff = "*"
1619

1720
[requires]
1821
python_version = "3"

Pipfile.lock

Lines changed: 752 additions & 369 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

setup.cfg

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
[metadata]
2+
name = 3scale-api
3+
version = 0.35.2
4+
description = 3scale API python client
5+
author = Peter Stanko
6+
author_email = stanko@mail.muni.cz
7+
maintainer = Matej Dujava
8+
maintainer_email = mdujava@redhat.com
9+
url = https://github.com/3scale-qe/3scale-api-python
10+
license = Apache-2.0
11+
license_files = LICENSE
12+
long_description = file: README.md
13+
long_description_content_type = text/markdown
14+
classifiers =
15+
Operating System :: OS Independent
16+
Intended Audience :: Developers
17+
Topic :: Utilities
18+
Programming Language :: Python :: 3
19+
20+
[options]
21+
packages = find:
22+
include_package_data = True
23+
install_requires =
24+
requests
25+
python-backoff
26+
27+
[options.packages.find]
28+
exclude = tests
29+
30+
[options.extras_require]
31+
dev =
32+
coverage
33+
flake8
34+
mypy
35+
pylint
36+
pytest
37+
python-dotenv
38+
responses
39+
docs = sphinx
40+
41+
[flake8]
42+
max-line-length = 120
43+
ignore = E203,W503
44+
45+
[mypy]
46+
ignore_missing_imports = True
47+
check_untyped_defs = true
48+
local_partial_types = true

setup.py

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,3 @@
1-
import re
2-
import sys
1+
from setuptools import setup
32

4-
from setuptools import find_packages, setup
5-
6-
with open("README.md", "r") as fh:
7-
long_description = fh.read()
8-
9-
VERSION = "devel"
10-
if sys.argv[1] == "--release-version":
11-
sys.argv.pop(1)
12-
VERSION = sys.argv.pop(1)
13-
assert re.match(r"[0-9]+\.[0-9]+\.[0-9]+", VERSION), "Version definition required as first arg"
14-
15-
requirements = ["requests", "backoff"]
16-
17-
extra_requirements = {"dev": ["pytest", "coverage", "python-dotenv", "responses"], "docs": ["sphinx"]}
18-
19-
setup(
20-
name="3scale-api",
21-
version=VERSION,
22-
description="3scale API python client",
23-
author="Peter Stanko",
24-
author_email="stanko@mail.muni.cz",
25-
maintainer="Matej Dujava",
26-
maintainer_email="mdujava@redhat.com",
27-
url="https://github.com/3scale-qe/3scale-api-python",
28-
packages=find_packages(exclude=("tests",)),
29-
long_description=long_description,
30-
long_description_content_type="text/markdown",
31-
include_package_data=True,
32-
install_requires=requirements,
33-
extras_require=extra_requirements,
34-
entry_points={},
35-
classifiers=[
36-
"Operating System :: OS Independent",
37-
"License :: OSI Approved :: Apache Software License",
38-
"Intended Audience :: Developers",
39-
"Topic :: Utilities",
40-
"Programming Language :: Python :: 3",
41-
"Programming Language :: Python :: 3.7",
42-
"Programming Language :: Python :: 3.8",
43-
"Programming Language :: Python :: 3.9",
44-
"Programming Language :: Python :: 3.10",
45-
"Programming Language :: Python :: 3.11",
46-
"Programming Language :: Python :: 3.12",
47-
"Programming Language :: Python :: 3.13",
48-
],
49-
)
3+
setup()

tests/integration/auth/test_app_key_authorization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def proxy(service, proxy):
1919
def test_app_key_authorization(proxy, application, ssl_verify):
2020
creds = application.authobj().credentials
2121
encoded = base64.b64encode(
22-
f"{creds['app_id']}:{creds['app_key']}".encode("utf-8")).decode("utf-8")
22+
f"{creds['app_id']}:{creds['app_key']}".encode()).decode("utf-8")
2323

2424
response = application.test_request(verify=ssl_verify)
2525

tests/integration/test_integration_response_headers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
def test_x_served_by(api):
32
response = api._rest.get(url=api.admin_api_url + '/accounts')
43
assert response.status_code == 200

tests/integration/test_integration_service_plans.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
from tests.integration import asserts
42

53
def test_list_service_plans(service):

tests/integration/test_integration_service_subscriptions.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
from tests.integration import asserts
32

43
def test_list_service_subscriptions(account):

threescale_api/auth.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ class UserKeyAuth(BaseClientAuth):
3838

3939
def __init__(self, app, location=None):
4040
super().__init__(app, location)
41-
self.credentials = {
42-
self.app.service.proxy.list()["auth_user_key"]: self.app["user_key"]
43-
}
41+
self.credentials = {self.app.service.proxy.list()["auth_user_key"]: self.app["user_key"]}
4442

4543
def __call__(self, request):
4644
if self.location == "authorization":
@@ -57,7 +55,7 @@ def __init__(self, app, location=None):
5755
proxy = self.app.service.proxy.list()
5856
self.credentials = {
5957
proxy["auth_app_id"]: self.app["application_id"],
60-
proxy["auth_app_key"]: self.app.keys.list()[-1]["value"]
58+
proxy["auth_app_key"]: self.app.keys.list()[-1]["value"],
6159
}
6260

6361
def __call__(self, request):

0 commit comments

Comments
 (0)