Skip to content

Commit

Permalink
pep8 aaaaaaall the way
Browse files Browse the repository at this point in the history
  • Loading branch information
juliatessler committed Oct 14, 2021
1 parent 9e76e2e commit 85e270f
Show file tree
Hide file tree
Showing 72 changed files with 125 additions and 132 deletions.
1 change: 0 additions & 1 deletion contrib/update/cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from dopy.manager import DoManager


NAME = "serenata-update"


Expand Down
2 changes: 1 addition & 1 deletion jarbas/celery.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import logging
import os

from celery import Celery
from celery.schedules import crontab

from django.conf import settings

logger = logging.getLogger('celery')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

from bulk_update.helper import bulk_update

from jarbas.core.management.commands import LoadCommand
from jarbas.chamber_of_deputies.models import Reimbursement
from jarbas.core.management.commands import LoadCommand


class Command(LoadCommand):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from csv import DictReader

from jarbas.core.management.commands import LoadCommand
from jarbas.chamber_of_deputies.models import Reimbursement
from jarbas.chamber_of_deputies.tasks import serialize
from jarbas.core.management.commands import LoadCommand


class Command(LoadCommand):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from django.core.management.base import BaseCommand
from django.contrib.postgres.search import SearchVector

from django.core.management.base import BaseCommand
from tqdm import tqdm

from jarbas.chamber_of_deputies.models import Reimbursement
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import csv
import os

from jarbas.core.management.commands import LoadCommand
from jarbas.chamber_of_deputies.models import SocialMedia
from jarbas.core.management.commands import LoadCommand


class Command(LoadCommand):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from bulk_update.helper import bulk_update
from django.core.exceptions import ObjectDoesNotExist

from jarbas.core.management.commands import LoadCommand
from jarbas.chamber_of_deputies.models import Reimbursement
from jarbas.core.management.commands import LoadCommand


class Command(LoadCommand):
Expand Down
4 changes: 2 additions & 2 deletions jarbas/chamber_of_deputies/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# Generated by Django 1.11.5 on 2017-10-14 07:45
from __future__ import unicode_literals

from django.conf import settings
import django.contrib.postgres.fields.jsonb
import django.contrib.postgres.indexes
import django.contrib.postgres.search
from django.db import migrations, models
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Generated by Django 2.0.8 on 2018-09-13 03:25

import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Generated by Django 2.0.8 on 2018-09-13 04:42

import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
6 changes: 2 additions & 4 deletions jarbas/chamber_of_deputies/querysets.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import re
from functools import reduce

from django.contrib.postgres.search import SearchQuery, SearchRank
from django.db import models
from django.db.models import Q
from django.db.models import F
from django.contrib.postgres.search import SearchQuery
from django.contrib.postgres.search import SearchRank
from django.db.models import F, Q


class ReimbursementQuerySet(models.QuerySet):
Expand Down
5 changes: 3 additions & 2 deletions jarbas/chamber_of_deputies/tasks.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from itertools import chain
from jarbas.chamber_of_deputies.fields import ArrayField, DateAsStringField, FloatField, IntegerField
from jarbas.chamber_of_deputies.models import Reimbursement

from jarbas.chamber_of_deputies.fields import (ArrayField, DateAsStringField,
FloatField, IntegerField)
from jarbas.chamber_of_deputies.models import Reimbursement

INTEGERS = (
'applicant_id',
Expand Down
2 changes: 1 addition & 1 deletion jarbas/chamber_of_deputies/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from datetime import date
from random import randrange

from django.utils import timezone

from jarbas.chamber_of_deputies.models import Tweet


suspicions = {
'over_monthly_subquota': {'is_suspect': True, 'probability': 1.0}
}
Expand Down
2 changes: 1 addition & 1 deletion jarbas/chamber_of_deputies/tests/test_receipts_command.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from unittest.mock import Mock, call, patch

from django.test import TestCase
from django.db.models import QuerySet
from django.test import TestCase
from requests.exceptions import ConnectionError

from jarbas.chamber_of_deputies.management.commands.receipts import Command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

from django.test import TestCase

from jarbas.chamber_of_deputies.management.commands.receipts_text import Command
from jarbas.chamber_of_deputies.management.commands.receipts_text import \
Command
from jarbas.chamber_of_deputies.models import Reimbursement


Expand Down
4 changes: 2 additions & 2 deletions jarbas/chamber_of_deputies/tests/test_reimbursement_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from freezegun import freeze_time
from mixer.backend.django import mixer

from jarbas.chamber_of_deputies.tests import get_sample_reimbursement_api_response
from jarbas.chamber_of_deputies.models import Reimbursement, Tweet
from jarbas.chamber_of_deputies.tests import random_tweet_status
from jarbas.chamber_of_deputies.tests import (
get_sample_reimbursement_api_response, random_tweet_status)


def get_reimbursement(**kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from django.conf import settings
from django.test import TestCase

from jarbas.chamber_of_deputies.management.commands.reimbursements import Command
from jarbas.chamber_of_deputies.management.commands.reimbursements import \
Command
from jarbas.chamber_of_deputies.models import Reimbursement


Expand Down
4 changes: 2 additions & 2 deletions jarbas/chamber_of_deputies/tests/test_same_day_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from django.test import TestCase

from jarbas.chamber_of_deputies.models import Reimbursement
from jarbas.core.models import Company
from jarbas.chamber_of_deputies.serializers import format_cnpj
from jarbas.chamber_of_deputies.tests import sample_reimbursement_data
from jarbas.core.models import Company
from jarbas.core.tests import sample_company_data
from jarbas.chamber_of_deputies.serializers import format_cnpj


class TestSameDay(TestCase):
Expand Down
3 changes: 1 addition & 2 deletions jarbas/chamber_of_deputies/tests/test_tweets_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
from django.test import TestCase
from mixer.backend.django import mixer

from jarbas.chamber_of_deputies.models import Reimbursement, Tweet
from jarbas.chamber_of_deputies.management.commands.tweets import Command
from jarbas.chamber_of_deputies.models import Reimbursement, Tweet
from jarbas.chamber_of_deputies.tests import random_tweet_status


KEYS = (
'TWITTER_CONSUMER_KEY',
'TWITTER_CONSUMER_SECRET',
Expand Down
2 changes: 1 addition & 1 deletion jarbas/chamber_of_deputies/twitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from random import choice

import twitter
from django.db.models import Subquery
from django.conf import settings
from django.db.models import Subquery

from jarbas.chamber_of_deputies.models import Reimbursement, SocialMedia, Tweet

Expand Down
15 changes: 6 additions & 9 deletions jarbas/chamber_of_deputies/urls.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
from django.urls import path

from jarbas.chamber_of_deputies.views import (
ReimbursementListView,
ReimbursementDetailView,
ReceiptDetailView,
SameDayReimbursementListView,
ApplicantListView,
SubquotaListView,
)

from jarbas.chamber_of_deputies.views import (ApplicantListView,
ReceiptDetailView,
ReimbursementDetailView,
ReimbursementListView,
SameDayReimbursementListView,
SubquotaListView)

app_name = 'chamber_of_deputies'

Expand Down
8 changes: 3 additions & 5 deletions jarbas/chamber_of_deputies/views.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from rest_framework.generics import ListAPIView, RetrieveAPIView

from jarbas.chamber_of_deputies.models import Reimbursement
from jarbas.chamber_of_deputies.serializers import (ReimbursementSerializer,
ReceiptSerializer,
SameDayReimbursementSerializer,
ApplicantSerializer,
SubquotaSerializer, clean_cnpj_cpf)
from jarbas.chamber_of_deputies.serializers import (
ApplicantSerializer, ReceiptSerializer, ReimbursementSerializer,
SameDayReimbursementSerializer, SubquotaSerializer, clean_cnpj_cpf)


class ReimbursementListView(ListAPIView):
Expand Down
1 change: 1 addition & 0 deletions jarbas/core/migrations/0005_add_receipt_url_last_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import unicode_literals

import datetime

from django.db import migrations, models
from django.utils.timezone import utc

Expand Down
2 changes: 1 addition & 1 deletion jarbas/core/migrations/0010_extract_receipt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Generated by Django 1.10.1 on 2016-09-29 16:07
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
4 changes: 2 additions & 2 deletions jarbas/core/migrations/0025_historicalreimbursement.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# Generated by Django 1.11.1 on 2017-05-28 21:55
from __future__ import unicode_literals

from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
2 changes: 1 addition & 1 deletion jarbas/core/migrations/0035_create_model_tweet.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Generated by Django 1.11.2 on 2017-06-24 04:03
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
1 change: 0 additions & 1 deletion jarbas/core/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from django.utils import timezone


sample_activity_data = dict(
code='42',
description='So long, so long, and thanks for all the fish'
Expand Down
1 change: 1 addition & 0 deletions jarbas/core/tests/test_company_model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.test import TestCase

from jarbas.core.models import Activity, Company
from jarbas.core.tests import sample_activity_data, sample_company_data

Expand Down
2 changes: 1 addition & 1 deletion jarbas/core/tests/test_company_view.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
import json
import re

from django.shortcuts import resolve_url
from django.test import TestCase
Expand Down
1 change: 0 additions & 1 deletion jarbas/core/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from jarbas.core.views import CompanyDetailView


app_name = 'core'

urlpatterns = [
Expand Down
2 changes: 1 addition & 1 deletion jarbas/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from django.shortcuts import get_object_or_404
from rest_framework.generics import RetrieveAPIView

from jarbas.chamber_of_deputies.serializers import format_cnpj
from jarbas.core.models import Company
from jarbas.core.serializers import CompanySerializer
from jarbas.chamber_of_deputies.serializers import format_cnpj


class CompanyDetailView(RetrieveAPIView):
Expand Down
9 changes: 3 additions & 6 deletions jarbas/dashboard/admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,16 @@
from django.db.models.functions import Concat
from django.utils.safestring import mark_safe

from jarbas.chamber_of_deputies.models import (
Reimbursement,
ReimbursementSummary,
SocialMedia,
)
from jarbas.chamber_of_deputies.models import (Reimbursement,
ReimbursementSummary,
SocialMedia)
from jarbas.chamber_of_deputies.serializers import clean_cnpj_cpf
from jarbas.dashboard.admin import list_filters, widgets
from jarbas.dashboard.admin.paginators import CachedCountPaginator
from jarbas.dashboard.admin.subquotas import Subquotas
from jarbas.public_admin.admin import PublicAdminModelAdmin
from jarbas.public_admin.sites import public_admin


ALL_FIELDS = sorted(Reimbursement._meta.fields, key=lambda f: f.verbose_name)
CUSTOM_WIDGETS = ('receipt_url', 'subquota_description', 'suspicions')
READONLY_FIELDS = (f.name for f in ALL_FIELDS if f.name not in CUSTOM_WIDGETS)
Expand Down
2 changes: 1 addition & 1 deletion jarbas/dashboard/admin/list_filters.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.core.cache import cache
from django.contrib.admin import SimpleListFilter
from django.core.cache import cache

from jarbas.chamber_of_deputies.models import Reimbursement
from jarbas.dashboard.admin.subquotas import Subquotas
Expand Down
2 changes: 1 addition & 1 deletion jarbas/dashboard/templatetags/dashboard.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from datetime import datetime

from django import template
from django.template.defaultfilters import stringfilter

from jarbas.dashboard.admin.subquotas import Subquotas


BR_NUMBER_TRANSLATION = str.maketrans(',.', '.,')
register = template.Library()

Expand Down
4 changes: 2 additions & 2 deletions jarbas/dashboard/tests/test_dashboard_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from jarbas.chamber_of_deputies.models import Reimbursement
from jarbas.dashboard.admin import ReimbursementModelAdmin
from jarbas.dashboard.admin.list_filters import SubquotaListFilter
from jarbas.dashboard.admin.widgets import ReceiptUrlWidget, SubquotaWidget, SuspiciousWidget

from jarbas.dashboard.admin.widgets import (ReceiptUrlWidget, SubquotaWidget,
SuspiciousWidget)

Request = namedtuple('Request', ('method',))
ReimbursementMock = namedtuple('Reimbursement', ('cnpj_cpf'))
Expand Down
1 change: 0 additions & 1 deletion jarbas/dashboard/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from jarbas.public_admin.sites import public_admin


urlpatterns = [
path('', public_admin.urls)
]
Loading

0 comments on commit 85e270f

Please sign in to comment.