Skip to content
This repository was archived by the owner on Dec 8, 2023. It is now read-only.

Commit f4b3826

Browse files
authored
Merge pull request #10 from Natim/add-mypy
Add mypy
2 parents 30fa8a9 + 9f4a47d commit f4b3826

17 files changed

Lines changed: 73 additions & 25 deletions

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,8 @@ repos:
2929
- id: flake8
3030
args: [--max-line-length=99]
3131
language_version: python3.7
32+
33+
- repo: https://github.com/pre-commit/mirrors-mypy
34+
rev: 'v0.761'
35+
hooks:
36+
- id: mypy

.travis.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
dist: bionic
2+
language: python
3+
cache: pip
4+
install: pip install tox tox-travis
5+
script: tox -v
6+
python:
7+
- 3.7
8+
- 3.8
9+
matrix:
10+
fast_finish: true
11+
include:
12+
- python: 3.8
13+
env: TOXENV=flake8

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@
77
- Handle the refund endpoint
88
- Handle pagination for orders
99
- Handle the send-sms API for payments.
10-

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include README.md CHANGELOG.md tox.ini Makefile LICENSE

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,13 @@ black: install-dev
4040
$(VENV)/bin/black setup.py alma
4141

4242
isort: install-dev
43-
$(VENV)/bin/isort --recursive setup.py alma
43+
$(VENV)/bin/isort --recursive setup.py alma tests
4444

4545
flake8: install-dev
46-
$(VENV)/bin/flake8 setup.py alma
46+
$(VENV)/bin/flake8 setup.py alma tests
47+
48+
mypy: install-dev
49+
$(VENV)/bin/mypy --ignore-missing-imports --scripts-are-modules alma
4750

4851
build-requirements:
4952
$(VIRTUALENV) $(TEMPDIR)

alma/__init__.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
# flake8: noqa
2-
3-
import pkg_resources
4-
5-
from . import endpoints, entities
61
from .api_modes import ApiModes
72
from .client import Client
3+
from .version import __version__
84

9-
__version__ = pkg_resources.get_distribution(__package__).version
5+
__all__ = ["Client", "ApiModes", "__version__"]

alma/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import logging
22
import platform
33

4-
from . import __version__ as alma_version
54
from . import endpoints
65
from .api_modes import ApiModes
76
from .context import Context
7+
from .version import __version__ as alma_version
88

99

1010
class Client:

alma/endpoints/orders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def update(self, order_id, data):
1313
return Order(response.json)
1414

1515
def fetch_all(self, limit: int = 20, starting_after: str = None, **filters):
16-
args = {"limit": limit}
16+
args = {"limit": str(limit)}
1717

1818
if starting_after:
1919
args["starting_after"] = starting_after

alma/endpoints/payments.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def create(self, data):
1919
return Payment(response.json)
2020

2121
def fetch_all(self, limit: int = 20, states: list = None, starting_after: str = None):
22-
args = {"limit": limit}
22+
args = {"limit": str(limit)}
2323
if starting_after:
2424
args["starting_after"] = starting_after
2525
if states:
@@ -55,7 +55,7 @@ def add_orders_to(self, payment_id, order_data: Union[List[dict], dict]) -> List
5555
or a list of such dicts for several
5656
:return: List of Order instances that were added to the payment
5757
"""
58-
if type(order_data) is dict:
58+
if isinstance(order_data, dict):
5959
order_data = [order_data]
6060

6161
response = (
@@ -75,7 +75,7 @@ def set_orders_for(self, payment_id, order_data: Union[List[dict], dict]) -> Lis
7575
or a list of such dicts for several
7676
:return: List of Order instances that were added to the payment
7777
"""
78-
if type(order_data) is dict:
78+
if isinstance(order_data, dict):
7979
order_data = [order_data]
8080

8181
response = (

alma/entities/eligibility.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from . import Base
1+
from .base import Base
22

33

44
class Eligibility(Base):

0 commit comments

Comments
 (0)