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

Commit 248709e

Browse files
authored
Merge pull request #7 from Natim/add-isort
Add isort.
2 parents d3b1279 + fc081a0 commit 248709e

12 files changed

Lines changed: 101 additions & 13 deletions

.pre-commit-config.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v2.3.0
6+
hooks:
7+
- id: check-added-large-files
8+
- id: check-ast
9+
- id: check-toml
10+
- id: check-yaml
11+
- id: debug-statements
12+
- id: detect-private-key
13+
- id: end-of-file-fixer
14+
- id: trailing-whitespace
15+
16+
- repo: https://github.com/psf/black
17+
rev: 19.10b0
18+
hooks:
19+
- id: black
20+
21+
- repo: https://github.com/pre-commit/mirrors-isort
22+
rev: v4.3.21
23+
hooks:
24+
- id: isort

Makefile

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
VIRTUALENV = virtualenv --python=python3
2+
3+
VENV := $(shell echo $${VIRTUAL_ENV-.venv})
4+
PYTHON = $(VENV)/bin/python
5+
6+
INSTALL_STAMP = $(VENV)/.install.stamp
7+
DEV_STAMP = $(VENV)/.dev_env_installed.stamp
8+
TEMPDIR := $(shell mktemp -du)
9+
10+
help:
11+
@echo "Please use 'make <target>' where <target> is one of"
12+
@echo " format reformat code: black and isort"
13+
@echo " install install dependencies and prepare environment"
14+
@echo " install-dev install dependencies and everything needed to run tests"
15+
@echo " black run the black tool, which will automatically reformat the code"
16+
@echo " isort run the isort tool, which will automatically sort all of the imports"
17+
@echo " clean remove *.pyc files and __pycache__ directory"
18+
@echo " distclean remove *.egg-info files and *.egg, build and dist directories"
19+
@echo " maintainer-clean remove the .tox and the .venv directories"
20+
@echo "Check the Makefile to know exactly what each target is doing."
21+
22+
virtualenv: $(PYTHON)
23+
$(PYTHON):
24+
$(VIRTUALENV) $(VENV)
25+
26+
install: $(INSTALL_STAMP)
27+
$(INSTALL_STAMP): $(PYTHON) setup.py requirements.txt
28+
$(VENV)/bin/pip install -U pip
29+
$(VENV)/bin/pip install -Ue . -c requirements.txt
30+
touch $(INSTALL_STAMP)
31+
32+
install-dev: $(INSTALL_STAMP) $(DEV_STAMP)
33+
$(DEV_STAMP): $(PYTHON) dev-requirements.txt
34+
$(VENV)/bin/pip install -Ur dev-requirements.txt
35+
touch $(DEV_STAMP)
36+
37+
format: black isort
38+
39+
black: install-dev
40+
$(VENV)/bin/black setup.py alma
41+
42+
isort: install-dev
43+
$(VENV)/bin/isort --recursive setup.py alma
44+
45+
build-requirements:
46+
$(VIRTUALENV) $(TEMPDIR)
47+
$(TEMPDIR)/bin/pip install -U pip
48+
$(TEMPDIR)/bin/pip install -Ue .
49+
$(TEMPDIR)/bin/pip freeze | grep -v -- '-e' > requirements.txt
50+
51+
clean:
52+
find . -name '__pycache__' -type d | xargs rm -fr
53+
54+
distclean: clean
55+
rm -fr *.egg *.egg-info/ dist/ build/
56+
57+
maintainer-clean: distclean
58+
rm -fr .venv/ .tox/

alma/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
from . import endpoints
2-
from . import entities
3-
4-
from .client import Client
1+
from . import endpoints, entities
52
from .api_modes import ApiModes
3+
from .client import Client
64

75
import pkg_resources
86

alma/endpoints/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from .base import Base
22
from .merchants import Merchants
3-
from .payments import Payments
43
from .orders import Orders
4+
from .payments import Payments

alma/endpoints/merchants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from . import Base
21
from ..entities import Merchant
2+
from . import Base
33

44

55
class Merchants(Base):

alma/endpoints/orders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from functools import partial
22

3-
from . import Base
43
from ..entities import Order
54
from ..paginated_results import PaginatedResults
5+
from . import Base
66

77

88
class Orders(Base):

alma/endpoints/payments.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from functools import partial
2-
from typing import Union, List
2+
from typing import List, Union
33

4-
from . import Base
5-
from ..entities import Payment, Eligibility, Order
4+
from ..entities import Eligibility, Order, Payment
65
from ..paginated_results import PaginatedResults
6+
from . import Base
77

88

99
class Payments(Base):

alma/entities/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
from .installment import Installment, InstallmentState
44
from .merchant import Merchant
55
from .order import Order
6+
from .payment import Payment, PaymentFraudType, PaymentState
67
from .refund import Refund
7-
from .payment import Payment, PaymentState, PaymentFraudType

alma/paginated_results.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from collections.abc import Sequence, Iterable
1+
from collections.abc import Iterable, Sequence
22
from typing import Callable, Type, Union
33

44
from alma.entities import Base as BaseEntity

dev-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
black
2+
isort

0 commit comments

Comments
 (0)