From a14998fd8b538876a89d2202588a8e1d843b801b Mon Sep 17 00:00:00 2001 From: Chibuotu Amadi Date: Tue, 30 Nov 2021 00:39:26 +0100 Subject: [PATCH] pre-commit linting --- .pre-commit-config.yaml | 18 +++++++++--------- app/dashboard/sync/helpers.py | 2 +- .../tests/factories/fulfillment_factory.py | 4 ++-- .../tests/models/test_bounty_fulfillment.py | 6 +++--- .../tests/views/test_bounty_payout.py | 2 +- app/grants/templatetags/grants_extra.py | 3 +++ .../tests/factories/clr_match_factory.py | 1 - app/grants/tests/factories/donation_factory.py | 2 +- app/grants/tests/factories/flag_factory.py | 2 +- .../tests/factories/grant_api_key_factory.py | 3 +-- .../tests/factories/grant_clr_factory.py | 3 +-- .../factories/grant_collection_factory.py | 3 +-- .../tests/factories/match_pledge_factory.py | 2 +- .../tests/factories/subscription_factory.py | 2 +- .../commands/test_grant_collections_shuffle.py | 1 - app/grants/tests/models/test_cart_activity.py | 1 - app/grants/tests/models/test_clr_match.py | 1 - app/grants/tests/models/test_donation.py | 1 - app/grants/tests/models/test_flag.py | 3 +-- app/grants/tests/models/test_grant_api_key.py | 1 - .../test_grant_branding_routing_policy.py | 1 - app/grants/tests/models/test_grant_category.py | 1 - app/grants/tests/models/test_grant_clr.py | 3 +-- .../tests/models/test_grant_clr_calculation.py | 1 - .../tests/models/test_grant_collection.py | 5 ++--- app/grants/tests/models/test_grant_stat.py | 1 - app/grants/tests/models/test_grant_type.py | 1 - app/grants/tests/models/test_match_pledge.py | 1 - 28 files changed, 30 insertions(+), 45 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2f2aa090055..c2a69ffbe16 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,12 +13,12 @@ repos: language: system entry: sh -c 'npm run stylelint:fix' files: .css$ -- repo: git://github.com/pre-commit/mirrors-isort - sha: 'v4.3.4' - hooks: - - id: isort - args: - - --recursive - - --settings-path - - ./setup.cfg - - . +# - repo: git://github.com/pre-commit/mirrors-isort +# sha: 'v4.3.4' +# hooks: +# - id: isort +# args: +# - --recursive +# - --settings-path +# - ./setup.cfg +# - . diff --git a/app/dashboard/sync/helpers.py b/app/dashboard/sync/helpers.py index cf27dd53c24..8268b75d0b7 100644 --- a/app/dashboard/sync/helpers.py +++ b/app/dashboard/sync/helpers.py @@ -1,9 +1,9 @@ import logging +from decimal import Decimal from dashboard.helpers import bounty_activity_event_adapter, get_bounty_data_for_activity from dashboard.models import Activity, BountyEvent, BountyFulfillment -from decimal import Decimal logger = logging.getLogger(__name__) diff --git a/app/dashboard/tests/factories/fulfillment_factory.py b/app/dashboard/tests/factories/fulfillment_factory.py index fba77211583..699ad1d37fd 100644 --- a/app/dashboard/tests/factories/fulfillment_factory.py +++ b/app/dashboard/tests/factories/fulfillment_factory.py @@ -1,6 +1,6 @@ import factory - from dashboard.models import BountyFulfillment + from .bounty_factory import BountyFactory from .profile_factory import ProfileFactory @@ -10,4 +10,4 @@ class Meta: model = BountyFulfillment bounty = factory.SubFactory(BountyFactory) - profile = factory.SubFactory(ProfileFactory) \ No newline at end of file + profile = factory.SubFactory(ProfileFactory) diff --git a/app/dashboard/tests/models/test_bounty_fulfillment.py b/app/dashboard/tests/models/test_bounty_fulfillment.py index 440c988ad1b..5b6c6cc71db 100644 --- a/app/dashboard/tests/models/test_bounty_fulfillment.py +++ b/app/dashboard/tests/models/test_bounty_fulfillment.py @@ -1,9 +1,9 @@ -from attr import has import pytest - +from attr import has from dashboard.models import BountyFulfillment -from dashboard.tests.factories.fulfillment_factory import FulfillmentFactory from dashboard.tests.factories.bounty_factory import BountyFactory +from dashboard.tests.factories.fulfillment_factory import FulfillmentFactory + @pytest.mark.django_db class TestBountyFulfillmentProperties: diff --git a/app/dashboard/tests/views/test_bounty_payout.py b/app/dashboard/tests/views/test_bounty_payout.py index 6cb2127b360..0a2f154b1ae 100644 --- a/app/dashboard/tests/views/test_bounty_payout.py +++ b/app/dashboard/tests/views/test_bounty_payout.py @@ -1,5 +1,5 @@ import pytest -from dashboard.tests.factories import ProfileFactory, BountyFactory, FulfillmentFactory +from dashboard.tests.factories import BountyFactory, FulfillmentFactory, ProfileFactory from rest_framework.test import APIClient diff --git a/app/grants/templatetags/grants_extra.py b/app/grants/templatetags/grants_extra.py index 2be65765ba5..70294a9c328 100644 --- a/app/grants/templatetags/grants_extra.py +++ b/app/grants/templatetags/grants_extra.py @@ -61,14 +61,17 @@ def modulo(num, val): return num % val return 0 + @register.simple_tag def is_team_member(grant, profile): return is_grant_team_member(grant, profile) + @register.simple_tag def is_grants_path(path): return path.lower().startswith('/grants') + @register.simple_tag def is_favorite(grant, profile): if profile: diff --git a/app/grants/tests/factories/clr_match_factory.py b/app/grants/tests/factories/clr_match_factory.py index e4747adbf4e..7a0a760d646 100644 --- a/app/grants/tests/factories/clr_match_factory.py +++ b/app/grants/tests/factories/clr_match_factory.py @@ -1,6 +1,5 @@ import factory import pytest - from grants.models.clr_match import CLRMatch from .contribution_factory import ContributionFactory diff --git a/app/grants/tests/factories/donation_factory.py b/app/grants/tests/factories/donation_factory.py index c059834cb42..30033535913 100644 --- a/app/grants/tests/factories/donation_factory.py +++ b/app/grants/tests/factories/donation_factory.py @@ -1,9 +1,9 @@ import factory import pytest +from dashboard.tests.factories import ProfileFactory from grants.models.donation import Donation from .contribution_factory import ContributionFactory -from dashboard.tests.factories import ProfileFactory from .subscription_factory import SubscriptionFactory diff --git a/app/grants/tests/factories/flag_factory.py b/app/grants/tests/factories/flag_factory.py index c1bca07f51f..3595c42bc64 100644 --- a/app/grants/tests/factories/flag_factory.py +++ b/app/grants/tests/factories/flag_factory.py @@ -1,9 +1,9 @@ import factory import pytest +from dashboard.tests.factories import ProfileFactory from grants.models.flag import Flag from .grant_factory import GrantFactory -from dashboard.tests.factories import ProfileFactory @pytest.mark.django_db diff --git a/app/grants/tests/factories/grant_api_key_factory.py b/app/grants/tests/factories/grant_api_key_factory.py index 74d2b7f69b0..82cded95a50 100644 --- a/app/grants/tests/factories/grant_api_key_factory.py +++ b/app/grants/tests/factories/grant_api_key_factory.py @@ -1,7 +1,6 @@ import factory -from grants.models.grant_api_key import GrantAPIKey - from dashboard.tests.factories import ProfileFactory +from grants.models.grant_api_key import GrantAPIKey class GrantAPIKeyFactory(factory.django.DjangoModelFactory): diff --git a/app/grants/tests/factories/grant_clr_factory.py b/app/grants/tests/factories/grant_clr_factory.py index 7e74c932fe0..825074e0f88 100644 --- a/app/grants/tests/factories/grant_clr_factory.py +++ b/app/grants/tests/factories/grant_clr_factory.py @@ -3,9 +3,8 @@ import factory import pytest -from grants.models.grant import GrantCLR - from dashboard.tests.factories import ProfileFactory +from grants.models.grant import GrantCLR @pytest.mark.django_db diff --git a/app/grants/tests/factories/grant_collection_factory.py b/app/grants/tests/factories/grant_collection_factory.py index f90029cc08f..04f2bc9f373 100644 --- a/app/grants/tests/factories/grant_collection_factory.py +++ b/app/grants/tests/factories/grant_collection_factory.py @@ -1,7 +1,6 @@ import factory -from grants.models.grant_collection import GrantCollection - from dashboard.tests.factories import ProfileFactory +from grants.models.grant_collection import GrantCollection class GrantCollectionFactory(factory.django.DjangoModelFactory): diff --git a/app/grants/tests/factories/match_pledge_factory.py b/app/grants/tests/factories/match_pledge_factory.py index 03888bbf477..d2d2b7e6d31 100644 --- a/app/grants/tests/factories/match_pledge_factory.py +++ b/app/grants/tests/factories/match_pledge_factory.py @@ -1,10 +1,10 @@ import json import factory +from dashboard.tests.factories import ProfileFactory from grants.models.match_pledge import MatchPledge from .grant_clr_factory import GrantCLRFactory -from dashboard.tests.factories import ProfileFactory class MatchPledgeFactory(factory.django.DjangoModelFactory): diff --git a/app/grants/tests/factories/subscription_factory.py b/app/grants/tests/factories/subscription_factory.py index b7d70df889b..a3dc928deca 100644 --- a/app/grants/tests/factories/subscription_factory.py +++ b/app/grants/tests/factories/subscription_factory.py @@ -1,8 +1,8 @@ import factory +from dashboard.tests.factories import ProfileFactory from grants.models.subscription import Subscription from .grant_factory import GrantFactory -from dashboard.tests.factories import ProfileFactory class SubscriptionFactory(factory.django.DjangoModelFactory): diff --git a/app/grants/tests/management/commands/test_grant_collections_shuffle.py b/app/grants/tests/management/commands/test_grant_collections_shuffle.py index 2a083563e1e..c3c59331f5b 100644 --- a/app/grants/tests/management/commands/test_grant_collections_shuffle.py +++ b/app/grants/tests/management/commands/test_grant_collections_shuffle.py @@ -5,7 +5,6 @@ import pytest from grants.management.commands.grant_collections_shuffle import grant_collection_age_score, grant_meta_data_score - from grants.tests.factories import GrantFactory diff --git a/app/grants/tests/models/test_cart_activity.py b/app/grants/tests/models/test_cart_activity.py index 1e65aa6ea95..aee5291fc6b 100644 --- a/app/grants/tests/models/test_cart_activity.py +++ b/app/grants/tests/models/test_cart_activity.py @@ -2,7 +2,6 @@ from dashboard.models import Profile from grants.models.cart_activity import CartActivity from grants.models.grant import Grant - from grants.tests.factories import CartActivityFactory diff --git a/app/grants/tests/models/test_clr_match.py b/app/grants/tests/models/test_clr_match.py index 023e5316932..577402fcf25 100644 --- a/app/grants/tests/models/test_clr_match.py +++ b/app/grants/tests/models/test_clr_match.py @@ -2,7 +2,6 @@ from grants.models.clr_match import CLRMatch from grants.models.contribution import Contribution from grants.models.grant import Grant - from grants.tests.factories import CLRMatchFactory diff --git a/app/grants/tests/models/test_donation.py b/app/grants/tests/models/test_donation.py index 330d6821146..fd1ddb336ff 100644 --- a/app/grants/tests/models/test_donation.py +++ b/app/grants/tests/models/test_donation.py @@ -3,7 +3,6 @@ from grants.models.contribution import Contribution from grants.models.donation import Donation from grants.models.subscription import Subscription - from grants.tests.factories import DonationFactory diff --git a/app/grants/tests/models/test_flag.py b/app/grants/tests/models/test_flag.py index 4cb81017518..2015f14cb0b 100644 --- a/app/grants/tests/models/test_flag.py +++ b/app/grants/tests/models/test_flag.py @@ -4,9 +4,8 @@ from dashboard.models import Activity, Profile from grants.models.flag import Flag from grants.models.grant import Grant -from townsquare.models import Comment - from grants.tests.factories import FlagFactory +from townsquare.models import Comment @pytest.mark.django_db diff --git a/app/grants/tests/models/test_grant_api_key.py b/app/grants/tests/models/test_grant_api_key.py index 01398458ab0..c8133491934 100644 --- a/app/grants/tests/models/test_grant_api_key.py +++ b/app/grants/tests/models/test_grant_api_key.py @@ -1,7 +1,6 @@ import pytest from dashboard.models import Profile from grants.models.grant_api_key import GrantAPIKey - from grants.tests.factories import GrantAPIKeyFactory diff --git a/app/grants/tests/models/test_grant_branding_routing_policy.py b/app/grants/tests/models/test_grant_branding_routing_policy.py index ba8275a1c35..4c7344e4a1a 100644 --- a/app/grants/tests/models/test_grant_branding_routing_policy.py +++ b/app/grants/tests/models/test_grant_branding_routing_policy.py @@ -2,7 +2,6 @@ import pytest from grants.models.grant_branding_routing_policy import GrantBrandingRoutingPolicy - from grants.tests.factories import GrantBrandingRoutingPolicyFactory diff --git a/app/grants/tests/models/test_grant_category.py b/app/grants/tests/models/test_grant_category.py index 258f7690778..5523aae1fa8 100644 --- a/app/grants/tests/models/test_grant_category.py +++ b/app/grants/tests/models/test_grant_category.py @@ -1,6 +1,5 @@ import pytest from grants.models.grant_category import GrantCategory - from grants.tests.factories import GrantCategoryFactory diff --git a/app/grants/tests/models/test_grant_clr.py b/app/grants/tests/models/test_grant_clr.py index ff69d0ed019..bd13294bc79 100644 --- a/app/grants/tests/models/test_grant_clr.py +++ b/app/grants/tests/models/test_grant_clr.py @@ -7,8 +7,7 @@ from grants.models.grant import Grant, GrantCLR from grants.models.grant_clr_calculation import GrantCLRCalculation from grants.models.grant_collection import GrantCollection - -from grants.tests.factories import GrantFactory, GrantCLRFactory, GrantCollectionFactory +from grants.tests.factories import GrantCLRFactory, GrantCollectionFactory, GrantFactory @pytest.mark.django_db diff --git a/app/grants/tests/models/test_grant_clr_calculation.py b/app/grants/tests/models/test_grant_clr_calculation.py index e8cc302d0a0..629b7f73e67 100644 --- a/app/grants/tests/models/test_grant_clr_calculation.py +++ b/app/grants/tests/models/test_grant_clr_calculation.py @@ -1,7 +1,6 @@ import pytest from grants.models.grant import Grant, GrantCLR from grants.models.grant_clr_calculation import GrantCLRCalculation - from grants.tests.factories import GrantCLRCalculationFactory diff --git a/app/grants/tests/models/test_grant_collection.py b/app/grants/tests/models/test_grant_collection.py index c8e5d8261fc..45ca47262f6 100644 --- a/app/grants/tests/models/test_grant_collection.py +++ b/app/grants/tests/models/test_grant_collection.py @@ -1,10 +1,9 @@ import pytest from dashboard.models import Profile +from dashboard.tests.factories import ProfileFactory from grants.models.grant import Grant from grants.models.grant_collection import GrantCollection - -from grants.tests.factories import GrantFactory, GrantCollectionFactory -from dashboard.tests.factories import ProfileFactory +from grants.tests.factories import GrantCollectionFactory, GrantFactory @pytest.mark.django_db diff --git a/app/grants/tests/models/test_grant_stat.py b/app/grants/tests/models/test_grant_stat.py index 43c82ed455d..a1ad3ca230c 100644 --- a/app/grants/tests/models/test_grant_stat.py +++ b/app/grants/tests/models/test_grant_stat.py @@ -1,7 +1,6 @@ import pytest from grants.models.grant import Grant from grants.models.grant_stat import GrantStat - from grants.tests.factories import GrantStatFactory diff --git a/app/grants/tests/models/test_grant_type.py b/app/grants/tests/models/test_grant_type.py index 6453276d74e..ff5632c755d 100644 --- a/app/grants/tests/models/test_grant_type.py +++ b/app/grants/tests/models/test_grant_type.py @@ -3,7 +3,6 @@ import pytest from grants.models.grant import GrantCLR from grants.models.grant_type import GrantType - from grants.tests.factories import GrantTypeFactory diff --git a/app/grants/tests/models/test_match_pledge.py b/app/grants/tests/models/test_match_pledge.py index c5ad91a0086..01826a9ea6b 100644 --- a/app/grants/tests/models/test_match_pledge.py +++ b/app/grants/tests/models/test_match_pledge.py @@ -7,7 +7,6 @@ from dashboard.models import Profile from grants.models.grant import GrantCLR from grants.models.match_pledge import MatchPledge - from grants.tests.factories import MatchPledgeFactory