Skip to content

Commit 67432e7

Browse files
authored
Merge pull request #2947 from fedspendingtransparency/qat
Sprint 125 Production Deploy
2 parents 2206f31 + 579bff2 commit 67432e7

File tree

111 files changed

+1529
-1346
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+1529
-1346
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repos:
66
- id: debug-statements
77
- id: flake8
88
- repo: https://github.com/psf/black
9-
rev: 19.10b0
9+
rev: 20.8b1
1010
hooks:
1111
- id: black
1212
language_version: python3.7

requirements/requirements-app.txt

Lines changed: 18 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,39 @@
1-
appdirs==1.4.3
2-
asyncpg==0.18.3
1+
asyncpg==0.21.*
32
atomicwrites==1.3.0
4-
attrs==19.1.0
5-
boto3==1.9.224
6-
botocore==1.12.224
7-
certifi==2019.6.16
8-
chardet==3.0.4
3+
attrs==20.*
4+
boto3==1.16.*
5+
certifi==2020.12.5
96
dataclasses-json==0.5.*
10-
django_cte==1.1.*
117
ddtrace==0.37.1
128
dj-database-url==0.5.0
139
django-cors-headers==2.5.3
14-
django-debug-toolbar==2.1
10+
django-debug-toolbar==3.2
1511
django-extensions==2.2.5
1612
django-filter==0.14.0
1713
django-partial-index==0.6.0
18-
django-queryset-csv==1.0.1
1914
django-simple-history==2.7.3
20-
django-spaghetti-and-meatballs==0.2.2
15+
django-spaghetti-and-meatballs==0.4.0
2116
Django==2.2.*
22-
djangorestframework==3.11.0
17+
django_cte==1.1.*
18+
djangorestframework==3.12.2
2319
docutils==0.15.2
24-
drf-extensions==0.3.1
25-
drf-tracking==1.4.0
26-
elasticsearch==7.1.0
20+
drf-api-tracking==1.7.8
21+
drf-extensions==0.6.*
2722
elasticsearch-dsl==7.1.0
28-
entrypoints==0.3
23+
elasticsearch==7.1.0
2924
et-xmlfile==1.0.1
30-
filechunkio==1.8
3125
filelock==3.0.12
32-
fiscalyear==0.1.0
33-
idna==2.8
34-
importlib-metadata==0.20
35-
jdcal==1.4.1
36-
jmespath==0.9.4
37-
jsonpickle==1.2
26+
fiscalyear==0.2.0
3827
Markdown<3.0
39-
more-itertools==7.2.0
40-
numpy==1.17.2
28+
numpy==1.19.*
4129
openpyxl==2.4.7
42-
pandas==0.25.1
30+
pandas==1.1.*
4331
pip==20.*
44-
pluggy==0.12.0
4532
psutil==5.6.*
46-
psycopg2-binary==2.7.5
33+
psycopg2-binary==2.8.*
4734
py-gfm==0.1.4
48-
py==1.8.0
49-
pycodestyle==2.5.0
50-
pyflakes==2.1.1
51-
python-dateutil==2.8.0
5235
python-json-logger==0.1.9
53-
pytz==2019.2
54-
requests==2.22.0
36+
requests==2.25.*
5537
retrying==1.3.3
56-
s3transfer==0.2.1
57-
six==1.12.0
58-
sqlparse==0.3.0
59-
unicodecsv==0.14.1
60-
urllib3==1.25.*
61-
xlrd==1.0.0
62-
zipp==0.6.0
38+
urllib3==1.26.*
39+
xlrd3==1.0.0

requirements/requirements-dev.txt

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
black==19.10b0
2-
coverage==4.5.4
3-
docker==4.1.0
1+
black==20.8b1
2+
docker==4.4.1
43
dredd-hooks==0.2.0
5-
flake8==3.7.8
6-
mccabe==0.6.1
4+
flake8==3.8.4
75
mock==3.0.5
8-
model-mommy==1.6.0
6+
model-mommy==2.0.0
97
pre-commit==1.20.0
10-
pycodestyle==2.5.0
11-
pyflakes==2.1.1
12-
pytest-cov==2.8.1
13-
pytest-django==3.5.1
14-
pytest==4.3.1
8+
pytest-cov==2.10.1
9+
pytest-django==3.10.0
10+
pytest==6.2.1
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
django-elasticache==1.0.2
2-
django-redis==4.8.0
1+
django-elasticache==1.0.*
2+
django-redis==4.12.*
33
packaging==16.8
44
pylibmc==1.5.2
55
pyparsing==2.2.0
66
supervisor==4.0.2
7-
uwsgi==2.0.17.1
7+
uwsgi==2.0.*

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ addopts=--cov=usaspending_api
44

55
[flake8]
66
select=C,E,F,W,B,B950
7-
ignore=E501,W503,E203
7+
ignore=E501,W503,E203,F541
88
exclude=.venv,usaspending_api/*/migrations/*
99
max-line-length=120
1010

usaspending_api/accounts/tests/integration/test_federal_account.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
@pytest.mark.django_db
1919
def test_federal_account_spending_by_category_unique_program_activity_names(client):
2020
"""
21-
Test the spending by category endpoint for the federal account profile page to ensure a unique set of
22-
program activity names are returned
21+
Test the spending by category endpoint for the federal account profile page to ensure a unique set of
22+
program activity names are returned
2323
"""
2424

2525
models_to_mock = [

usaspending_api/awards/tests/test_transactions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_transaction_endpoint_v2_award_fk(client):
2626
)
2727
mommy.make("awards.TransactionNormalized", description="this should match", _fill_optional=True, award=awd)
2828

29-
resp = client.post("/api/v2/transactions/", {"award_id": "10"})
29+
resp = client.post("/api/v2/transactions/", {"award_id": 10})
3030
assert resp.status_code == status.HTTP_200_OK
3131
assert json.loads(resp.content.decode("utf-8"))["results"][0]["description"] == "this should match"
3232

usaspending_api/awards/v2/data_layer/orm_utils.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,21 @@ def delete_keys_from_dict(dictionary):
2626

2727
def split_mapper_into_qs(mapper):
2828
"""
29-
Django ORM has trouble using .annotate() when the destination field conflicts with an
30-
existing model field, even if it's the same source field (no renaming occurring)
29+
Django ORM has trouble using .annotate() when the destination field conflicts with an
30+
existing model field, even if it's the same source field (no renaming occurring)
3131
32-
Assuming there is a dictionary with model field names as keys and the target field as the value,
33-
Split that into two objects:
34-
values_list: a list of fields which you wish to retrieve without renaming
35-
aka when `key` == `value`
36-
annotate_dict: a dictionary/OrderedDict of target and source fields to rename
32+
Assuming there is a dictionary with model field names as keys and the target field as the value,
33+
Split that into two objects:
34+
values_list: a list of fields which you wish to retrieve without renaming
35+
aka when `key` == `value`
36+
annotate_dict: a dictionary/OrderedDict of target and source fields to rename
3737
38-
parameters
39-
- mapper: dictionary/OrderedDict
38+
parameters
39+
- mapper: dictionary/OrderedDict
4040
41-
return:
42-
- values_list: list
43-
-annotate_dict: OrderedDict
41+
return:
42+
- values_list: list
43+
-annotate_dict: OrderedDict
4444
"""
4545
values_list = [k for k, v in mapper.items() if k == v]
4646
annotate_dict = OrderedDict([(v, F(k)) for k, v in mapper.items() if k != v])

usaspending_api/awards/v2/filters/filter_helpers.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222

2323
def merge_date_ranges(date_range_list):
2424
"""
25-
Given a list of date ranges (using the defined namedtuple "Range"), combine overlapping date ranges
26-
While adjacent fiscal years do not overlap the desired behavior is to combine them
27-
FY2010 ends on 2010-09-30, FY2011 start on 2010-10-01.
28-
To address this, when comparing ranges 1 day is removed from the start date and 1 day is added to the end date
29-
Then the overlapping ranges must be > 1 instead of > 0
30-
Inspired by Raymond Hettinger [https://stackoverflow.com/a/9044111]
25+
Given a list of date ranges (using the defined namedtuple "Range"), combine overlapping date ranges
26+
While adjacent fiscal years do not overlap the desired behavior is to combine them
27+
FY2010 ends on 2010-09-30, FY2011 start on 2010-10-01.
28+
To address this, when comparing ranges 1 day is removed from the start date and 1 day is added to the end date
29+
Then the overlapping ranges must be > 1 instead of > 0
30+
Inspired by Raymond Hettinger [https://stackoverflow.com/a/9044111]
3131
"""
3232
ordered_list = sorted([sorted(t) for t in date_range_list])
3333
saved_range = Range(start=ordered_list[0][0], end=ordered_list[0][1])
@@ -142,7 +142,7 @@ def total_obligation_queryset(amount_obj, model, filters):
142142

143143
def can_use_month_aggregation(time_period):
144144
"""
145-
time_period is the list of action_date ranges from API
145+
time_period is the list of action_date ranges from API
146146
"""
147147
try:
148148
for v in time_period:
@@ -173,7 +173,7 @@ def can_use_total_obligation_enum(amount_obj):
173173

174174
def only_action_date_type(time_period):
175175
"""
176-
if a date_type is last_modified_date, don't use the matview this applies to
176+
if a date_type is last_modified_date, don't use the matview this applies to
177177
"""
178178
try:
179179
for v in time_period:

usaspending_api/awards/v2/filters/matview_filters.py renamed to usaspending_api/awards/v2/filters/search.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from usaspending_api.accounts.views.federal_accounts_v2 import filter_on
77
from usaspending_api.awards.models import FinancialAccountsByAwards
88
from usaspending_api.search.filters.postgres.psc import PSCCodes
9-
from usaspending_api.search.models import AwardSearchView, UniversalTransactionView
9+
from usaspending_api.search.models import AwardSearchView, TransactionSearch
1010
from usaspending_api.awards.v2.filters.filter_helpers import combine_date_range_queryset, total_obligation_queryset
1111
from usaspending_api.awards.v2.filters.location_filter_geocode import geocode_filter_locations
1212
from usaspending_api.common.exceptions import InvalidParameterException, NotImplementedException
@@ -26,8 +26,8 @@ def universal_award_matview_filter(filters):
2626
return matview_search_filter(filters, AwardSearchView, for_downloads=True)
2727

2828

29-
def universal_transaction_matview_filter(filters):
30-
return matview_search_filter(filters, UniversalTransactionView, for_downloads=True)
29+
def transaction_search_filter(filters):
30+
return matview_search_filter(filters, TransactionSearch, for_downloads=True)
3131

3232

3333
def matview_search_filter_determine_award_matview_model(filters):

0 commit comments

Comments
 (0)