Skip to content

Commit add556f

Browse files
authored
Updated pre-commit hooks (#74)
* Updated pre-commit hooks * Updated receipt.py to fix typing
1 parent bda1bf4 commit add556f

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.5.0
3+
rev: v5.0.0
44
hooks:
55
- id: trailing-whitespace
66
- id: end-of-file-fixer
@@ -16,7 +16,7 @@ repos:
1616
name: isort
1717

1818
- repo: https://github.com/pycqa/flake8
19-
rev: 6.1.0
19+
rev: 7.1.1
2020
hooks:
2121
- id: flake8
2222
name: flake8
@@ -27,7 +27,7 @@ repos:
2727
- flake8-docstrings
2828

2929
- repo: https://github.com/pre-commit/mirrors-mypy
30-
rev: 'v1.7.1'
30+
rev: 'v1.14.0'
3131
hooks:
3232
- id: mypy
3333
name: mypy

monzo/endpoints/receipt.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,9 @@ def fetch(cls, auth: Authentication, external_id: str) -> List[Receipt]:
361361
receipt_data = res['data']['receipt']
362362
receipt_items: List[ReceiptItem] = []
363363
for item in receipt_data['items']:
364-
quantity = item['quantity'] if 'quantity' in item else None
365-
tax = item['tax'] if 'tax' in item else None
366-
unit = item['unit'] if 'unit' in item else None
364+
quantity = float(item['quantity']) if 'quantity' in item else 0.0
365+
tax = item['tax'] if 'tax' in item else 0
366+
unit = item['unit'] if 'unit' in item else ''
367367
receipt_item: ReceiptItem = ReceiptItem(
368368
description=item['description'],
369369
amount=item['amount'],
@@ -374,9 +374,9 @@ def fetch(cls, auth: Authentication, external_id: str) -> List[Receipt]:
374374
)
375375

376376
for sub_item in item['sub_items']:
377-
sub_item_quantity = sub_item['quantity'] if 'quantity' in sub_item else None
378-
sub_item_tax = sub_item['tax'] if 'tax' in sub_item else None
379-
sub_item_unit = sub_item['unit'] if 'unit' in sub_item else None
377+
sub_item_quantity = sub_item['quantity'] if 'quantity' in sub_item else 0.0
378+
sub_item_tax = sub_item['tax'] if 'tax' in sub_item else 0
379+
sub_item_unit = sub_item['unit'] if 'unit' in sub_item else ''
380380
receipt_sub_item = ReceiptItem(
381381
description=sub_item['description'],
382382
amount=sub_item['amount'],

0 commit comments

Comments
 (0)