add flake8 and isort to pre-commit config, make flake8 and isort happy (#441)

* add flake8 to pre-commit config, and fixup many things to make flake8 happy

* add isort and sort all imports, add to pre-commit and requirements
This commit is contained in:
Thomas Steen Rasmussen 2020-02-12 13:10:41 +01:00 committed by GitHub
parent 8441620376
commit 00af109e2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
226 changed files with 755 additions and 553 deletions

4
.flake8 Normal file
View file

@ -0,0 +1,4 @@
[flake8]
max-line-length = 88
ignore = E501 W503

7
.isort.cfg Normal file
View file

@ -0,0 +1,7 @@
[settings]
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
line_length=88

View file

@ -4,4 +4,11 @@ repos:
hooks:
- id: "black"
language_version: "python3.7"
- repo: "https://github.com/pre-commit/pre-commit-hooks"
rev: "v2.3.0"
hooks:
- id: "flake8"
- repo: "https://github.com/pre-commit/mirrors-isort"
rev: "v4.3.21"
hooks:
- id: "isort"

View file

@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% load staticfiles %}
{% load static %}
{% load bootstrap3 %}
{% block extra_head %}

View file

@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% load staticfiles %}
{% load static %}
{% block extra_head %}
<script src="{% static "js/jquery.dataTables.min.js" %}"></script>

View file

@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% load staticfiles %}
{% load static %}
{% block extra_head %}
<script src="{% static "js/jquery.dataTables.min.js" %}"></script>

View file

@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% load staticfiles %}
{% load static %}
{% block extra_head %}
<script src="{% static "js/jquery.dataTables.min.js" %}"></script>

View file

@ -1,6 +1,34 @@
from django.urls import path, include
from .views import *
from django.urls import include, path
from .views import (
ApproveNamesView,
BackofficeIndexView,
BadgeHandoutView,
ChainDetailView,
ChainListView,
CredebtorDetailView,
EventProposalManageView,
ExpenseDetailView,
ExpenseListView,
ManageProposalsView,
MerchandiseOrdersView,
MerchandiseToOrderView,
ProductHandoutView,
ReimbursementCreateUserSelectView,
ReimbursementCreateView,
ReimbursementDeleteView,
ReimbursementDetailView,
ReimbursementListView,
ReimbursementUpdateView,
RevenueDetailView,
RevenueListView,
ScanTicketsView,
ShopTicketOverview,
SpeakerProposalManageView,
TicketCheckinView,
VillageOrdersView,
VillageToOrderView,
)
app_name = "backoffice"
@ -9,7 +37,7 @@ urlpatterns = [
# infodesk
path(
"infodesk/",
include([path("", ScanTicketsView.as_view(), name="scan_tickets"),]),
include([path("", ScanTicketsView.as_view(), name="scan_tickets")]),
),
path("shop_tickets/", ShopTicketOverview.as_view(), name="shop_ticket_overview"),
path("product_handout/", ProductHandoutView.as_view(), name="product_handout"),

View file

@ -8,20 +8,27 @@ from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.models import User
from django.core.files import File
from django.db.models import Sum
from django.shortcuts import redirect, get_object_or_404
from django.shortcuts import get_object_or_404, redirect
from django.urls import reverse
from django.utils import timezone
from django.views.generic import TemplateView, ListView, DetailView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.views.generic import DetailView, ListView, TemplateView
from django.views.generic.edit import CreateView, DeleteView, UpdateView
from camps.mixins import CampViewMixin
from economy.models import Chain, Credebtor, Expense, Reimbursement, Revenue
from profiles.models import Profile
from program.models import SpeakerProposal, EventProposal
from shop.models import OrderProductRelation, Order
from program.models import EventProposal, SpeakerProposal
from shop.models import Order, OrderProductRelation
from teams.models import Team
from tickets.models import ShopTicket, SponsorTicket, DiscountTicket, TicketType
from .mixins import *
from tickets.models import DiscountTicket, ShopTicket, SponsorTicket, TicketType
from .mixins import (
ContentTeamPermissionMixin,
EconomyTeamPermissionMixin,
InfoTeamPermissionMixin,
OrgaTeamPermissionMixin,
RaisePermissionRequiredMixin,
)
logger = logging.getLogger("bornhack.%s" % __name__)
@ -236,7 +243,7 @@ class VillageToOrderView(CampViewMixin, OrgaTeamPermissionMixin, TemplateView):
################################
###### CHAINS & CREDEBTORS #####
# CHAINS & CREDEBTORS
class ChainListView(CampViewMixin, EconomyTeamPermissionMixin, ListView):
@ -257,7 +264,7 @@ class CredebtorDetailView(CampViewMixin, EconomyTeamPermissionMixin, DetailView)
################################
########### EXPENSES ###########
# EXPENSES
class ExpenseListView(CampViewMixin, EconomyTeamPermissionMixin, ListView):
@ -306,7 +313,7 @@ class ExpenseDetailView(CampViewMixin, EconomyTeamPermissionMixin, UpdateView):
######################################
########### REIMBURSEMENTS ###########
# REIMBURSEMENTS
class ReimbursementListView(CampViewMixin, EconomyTeamPermissionMixin, ListView):
@ -497,7 +504,7 @@ class ReimbursementDeleteView(CampViewMixin, EconomyTeamPermissionMixin, DeleteV
################################
########### REVENUES ###########
# REVENUES
class RevenueListView(CampViewMixin, EconomyTeamPermissionMixin, ListView):

View file

@ -1,5 +1,6 @@
from django.contrib import admin
from .models import ProductCategory, Product
from .models import Product, ProductCategory
@admin.register(ProductCategory)

View file

@ -2,8 +2,8 @@
# Generated by Django 1.10.5 on 2017-08-25 23:28
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):

View file

@ -2,8 +2,8 @@
# Generated by Django 1.10.5 on 2017-09-16 19:28
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):

View file

@ -2,8 +2,8 @@
# Generated by Django 1.10.5 on 2018-03-18 08:06
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):

View file

@ -1,4 +1,5 @@
from django.db import models
from utils.models import CampRelatedModel

View file

@ -1,7 +1,9 @@
from camps.mixins import CampViewMixin
from .models import ProductCategory
from django.views.generic import ListView
from camps.mixins import CampViewMixin
from .models import ProductCategory
class MenuView(CampViewMixin, ListView):
model = ProductCategory

View file

@ -3,6 +3,7 @@ ASGI entrypoint. Configures Django and then runs the application
defined in the ASGI_APPLICATION setting.
"""
import os
import django
from channels.routing import get_default_application

View file

@ -1,10 +1,9 @@
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
from django.conf.urls import url
from channels.routing import ProtocolTypeRouter, URLRouter
from channels.auth import AuthMiddlewareStack
from program.consumers import ScheduleConsumer
application = ProtocolTypeRouter(
{
"websocket": AuthMiddlewareStack(

View file

@ -1,10 +1,8 @@
from graphene import relay, Schema, ObjectType
from graphene import ObjectType, Schema, relay
from graphene_django import DjangoObjectType
from graphene_django.filter import DjangoFilterConnectionField
from camps.models import Camp
from program.schema import ProgramQuery

View file

@ -1,19 +1,26 @@
from allauth.account.views import LoginView, LogoutView
from django.conf import settings
from django.conf.urls import include
from django.contrib import admin
from django.contrib.auth.decorators import login_required
from django.urls import path
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import TemplateView
from graphene_django.views import GraphQLView
from bar.views import MenuView
from camps.views import *
from camps.views import CampDetailView, CampListView, CampRedirectView
from feedback.views import FeedbackCreate
from info.views import *
from people.views import *
from program.views import *
from sponsors.views import *
from villages.views import *
from info.views import CampInfoView
from people.views import PeopleView
from sponsors.views import SponsorsView
from villages.views import (
VillageCreateView,
VillageDeleteView,
VillageDetailView,
VillageListView,
VillageUpdateView,
)
# require 2fa token entry (if enabled on admin account) when logging into /admin by using allauth login form
admin.site.login = login_required(admin.site.login)

View file

@ -1,4 +1,5 @@
from django.contrib import admin
from . import models

View file

@ -1,6 +1,5 @@
import factory
from django.utils import timezone
from factory.django import DjangoModelFactory
from psycopg2._range import DateTimeTZRange

View file

@ -1,8 +1,9 @@
# coding: utf-8
import os
from django.conf import settings
from django.core.management.base import BaseCommand
from django.utils import timezone
from django.conf import settings
import os
class Command(BaseCommand):

View file

@ -1,9 +1,10 @@
# -*- coding: utf-8 -*-
from django.db import models, migrations
import uuid
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):

View file

@ -2,8 +2,8 @@
# Generated by Django 1.9.1 on 2016-01-17 17:18
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

View file

@ -3,9 +3,10 @@
import datetime
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
from django.utils.timezone import utc

View file

@ -3,6 +3,7 @@
import datetime
from django.db import migrations, models
from django.utils.timezone import utc

View file

@ -1,6 +1,6 @@
from camps.models import Camp
from django.shortcuts import get_object_or_404
from django.utils.functional import cached_property
from camps.models import Camp
class CampViewMixin(object):

View file

@ -1,13 +1,14 @@
from django.db import models
from utils.models import UUIDModel, CreatedUpdatedModel
from program.models import EventType, EventLocation
from django.contrib.postgres.fields import DateTimeRangeField
from psycopg2.extras import DateTimeTZRange
from django.core.exceptions import ValidationError
from datetime import timedelta
from django.utils import timezone
from django.urls import reverse
import logging
from datetime import timedelta
from django.contrib.postgres.fields import DateTimeRangeField
from django.core.exceptions import ValidationError
from django.db import models
from django.urls import reverse
from psycopg2.extras import DateTimeTZRange
from program.models import EventLocation, EventType
from utils.models import CreatedUpdatedModel, UUIDModel
logger = logging.getLogger("bornhack.%s" % __name__)

View file

@ -1,6 +1,7 @@
from camps.models import Camp
from django.utils import timezone
from django.contrib import admin
from django.utils import timezone
from camps.models import Camp
def get_current_camp():

View file

@ -1,12 +1,14 @@
from django.views.generic import ListView, DetailView
from django.utils import timezone
from .models import Camp
from django.shortcuts import redirect
from .mixins import CampViewMixin
from django.views import View
from django.conf import settings
import logging
from django.conf import settings
from django.shortcuts import redirect
from django.utils import timezone
from django.views import View
from django.views.generic import DetailView, ListView
from .mixins import CampViewMixin
from .models import Camp
logger = logging.getLogger("bornhack.%s" % __name__)

View file

@ -2,8 +2,8 @@ from django.contrib import admin
from .models import Chain, Credebtor, Expense, Reimbursement, Revenue
### chains and credebtors
###############################
# chains and credebtors
@admin.register(Chain)
@ -14,13 +14,14 @@ class ChainAdmin(admin.ModelAdmin):
@admin.register(Credebtor)
class ChainAdmin(admin.ModelAdmin):
class CredebtorAdmin(admin.ModelAdmin):
list_filter = ["chain", "name"]
list_display = ["chain", "name", "notes"]
search_fields = ["chain", "name", "notes"]
### expenses
###############################
# expenses
def approve_expenses(modeladmin, request, queryset):
@ -64,7 +65,8 @@ class ExpenseAdmin(admin.ModelAdmin):
actions = [approve_expenses, reject_expenses]
### revenues
###############################
# revenues
def approve_revenues(modeladmin, request, queryset):
@ -99,7 +101,8 @@ class RevenueAdmin(admin.ModelAdmin):
actions = [approve_revenues, reject_revenues]
### reimbursements
###############################
# reimbursements
@admin.register(Reimbursement)

View file

@ -1,6 +1,8 @@
import os, magic, copy
import copy
import magic
from django import forms
from .models import Expense, Revenue

View file

@ -1,9 +1,10 @@
# Generated by Django 2.0.4 on 2018-08-29 22:14
import uuid
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):

View file

@ -1,9 +1,10 @@
# Generated by Django 2.0.4 on 2018-09-16 13:27
import uuid
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):

View file

@ -1,7 +1,7 @@
# Generated by Django 2.0.4 on 2018-09-17 17:33
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

View file

@ -1,8 +1,8 @@
# Generated by Django 2.1.3 on 2018-11-20 17:35
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):

View file

@ -1,9 +1,10 @@
# Generated by Django 2.1.7 on 2019-03-27 16:21
from django.db import migrations, models
import django.db.models.deletion
import uuid
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

View file

@ -1,7 +1,7 @@
# Generated by Django 2.1.7 on 2019-03-30 09:45
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

View file

@ -1,5 +1,5 @@
from django.http import HttpResponseRedirect, Http404
from django.shortcuts import redirect, get_object_or_404
from django.http import Http404
from django.shortcuts import get_object_or_404
from .models import Chain, Credebtor

View file

@ -1,14 +1,20 @@
import os
from django.db import models
from django.conf import settings
from django.db import models
from django.contrib import messages
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.text import slugify
from utils.models import CampRelatedModel, CreatedUpdatedModel, UUIDModel
from .email import *
from .email import (
send_accountingsystem_expense_email,
send_accountingsystem_revenue_email,
send_expense_approved_email,
send_expense_rejected_email,
send_revenue_approved_email,
send_revenue_rejected_email,
)
class ChainManager(models.Manager):
@ -219,9 +225,9 @@ class Revenue(CampRelatedModel, UUIDModel):
@property
def approval_status(self):
if self.approved == None:
if self.approved is None:
return "Pending approval"
elif self.approved == True:
elif self.approved:
return "Approved"
else:
return "Rejected"
@ -350,9 +356,9 @@ class Expense(CampRelatedModel, UUIDModel):
@property
def approval_status(self):
if self.approved == None:
if self.approved is None:
return "Pending approval"
elif self.approved == True:
elif self.approved:
return "Approved"
else:
return "Rejected"

View file

@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% load staticfiles %}
{% load static %}
{% block title %}
Economy | {{ block.super }}

View file

@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% load staticfiles %}
{% load static %}
{% block title %}
Expenses | {{ block.super }}

View file

@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% load staticfiles %}
{% load static %}
{% block title %}
Expenses | {{ block.super }}

View file

@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% load staticfiles %}
{% load static %}
{% block title %}
Revenues | {{ block.super }}

View file

@ -1,5 +1,26 @@
from django.urls import path, include
from .views import *
from django.urls import include, path
from .views import (
ChainCreateView,
ChainListView,
CredebtorCreateView,
CredebtorListView,
EconomyDashboardView,
ExpenseCreateView,
ExpenseDeleteView,
ExpenseDetailView,
ExpenseInvoiceView,
ExpenseListView,
ExpenseUpdateView,
ReimbursementDetailView,
ReimbursementListView,
RevenueCreateView,
RevenueDeleteView,
RevenueDetailView,
RevenueInvoiceView,
RevenueListView,
RevenueUpdateView,
)
app_name = "economy"

View file

@ -1,29 +1,40 @@
import os, magic
import os
from django.shortcuts import render, redirect
import magic
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.db.models import Sum
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import redirect
from django.urls import reverse
from django.views.generic import (
CreateView,
ListView,
DetailView,
ListView,
TemplateView,
UpdateView,
DeleteView,
)
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.db.models import Sum
from camps.mixins import CampViewMixin
from teams.models import Team
from utils.email import add_outgoing_email
from utils.mixins import RaisePermissionRequiredMixin
from teams.models import Team
from .models import *
from .mixins import *
from .forms import *
from .forms import (
ExpenseCreateForm,
ExpenseUpdateForm,
RevenueCreateForm,
RevenueUpdateForm,
)
from .mixins import (
ChainViewMixin,
CredebtorViewMixin,
ExpensePermissionMixin,
ReimbursementPermissionMixin,
RevenuePermissionMixin,
)
from .models import Chain, Credebtor, Expense, Reimbursement, Revenue
class EconomyDashboardView(LoginRequiredMixin, CampViewMixin, TemplateView):
@ -89,7 +100,8 @@ class EconomyDashboardView(LoginRequiredMixin, CampViewMixin, TemplateView):
return context
########### Chain/Creditor related views ###############
############################################
# Chain/Credebtor related views
class ChainCreateView(CampViewMixin, RaisePermissionRequiredMixin, CreateView):
@ -174,7 +186,8 @@ class CredebtorListView(
return context
########### Expense related views ###############
############################################
# Expense related views
class ExpenseListView(LoginRequiredMixin, CampViewMixin, ListView):
@ -322,7 +335,8 @@ class ExpenseInvoiceView(CampViewMixin, ExpensePermissionMixin, DetailView):
return response
########### Reimbursement related views ###############
############################################
# Reimbursement related views
class ReimbursementListView(LoginRequiredMixin, CampViewMixin, ListView):
@ -339,7 +353,8 @@ class ReimbursementDetailView(CampViewMixin, ReimbursementPermissionMixin, Detai
template_name = "reimbursement_detail.html"
########### Revenue related views ###############
############################################
# Revenue related views
class RevenueListView(LoginRequiredMixin, CampViewMixin, ListView):

View file

@ -1,5 +1,6 @@
from django.contrib import admin
from .models import Type, Routing
from .models import Routing, Type
@admin.register(Type)

View file

@ -1,8 +1,7 @@
from django.utils import timezone
from datetime import timedelta
from ircbot.utils import add_irc_message
import logging
from ircbot.utils import add_irc_message
logger = logging.getLogger("bornhack.%s" % __name__)
@ -93,3 +92,4 @@ def team_email_notification(
recipient_list = [resp.email for resp in team.responsible_members.all()]
# TODO: actually send the email here
logger.debug(f"sending test email to {recipient_list}")

View file

@ -2,8 +2,8 @@
# Generated by Django 1.10.5 on 2018-03-18 13:16
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):

View file

@ -1,6 +1,7 @@
from django.db import models
from utils.models import CreatedUpdatedModel
from teams.models import Team
from utils.models import CreatedUpdatedModel
class Type(CreatedUpdatedModel):

View file

@ -1,3 +0,0 @@
from django.test import TestCase
# Create your tests here.

View file

@ -1,3 +0,0 @@
from django.shortcuts import render
# Create your views here.

View file

@ -1,9 +1,10 @@
# Generated by Django 2.1 on 2018-08-20 13:13
import uuid
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):

View file

@ -1,7 +1,7 @@
# Generated by Django 2.1 on 2018-08-20 13:51
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

View file

@ -1,6 +1,6 @@
from django.db import models
from utils.models import UUIDModel, CreatedUpdatedModel, CampRelatedModel
from utils.models import CampRelatedModel, UUIDModel
class Feedback(CampRelatedModel, UUIDModel):

View file

@ -1,3 +0,0 @@
from django.test import TestCase
# Create your tests here.

View file

@ -6,6 +6,7 @@ from django.views.generic import CreateView
from camps.mixins import CampViewMixin
from tokens.models import Token
from .models import Feedback

View file

@ -1,6 +1,7 @@
from django.contrib import admin
from reversion.admin import VersionAdmin
from .models import InfoItem, InfoCategory
from .models import InfoCategory, InfoItem
@admin.register(InfoItem)

View file

@ -2,8 +2,8 @@
# Generated by Django 1.10.4 on 2016-12-24 22:11
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

View file

@ -1,7 +1,7 @@
# Generated by Django 2.0.4 on 2018-05-04 21:11
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

View file

@ -1,7 +1,7 @@
# Generated by Django 2.0.4 on 2018-05-08 07:42
from django.db import migrations
from django.core.exceptions import ObjectDoesNotExist
from django.db import migrations
def add_teams_to_categories(apps, schema_editor):

View file

@ -1,7 +1,7 @@
# Generated by Django 2.0.4 on 2018-05-20 16:13
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

View file

@ -1,7 +1,7 @@
# Generated by Django 2.0.4 on 2018-05-20 20:11
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

View file

@ -1,8 +1,8 @@
from django.db import models
from utils.models import CampRelatedModel
from django.core.exceptions import ValidationError
import reversion
from django.core.exceptions import ValidationError
from django.db import models
from utils.models import CampRelatedModel
class InfoCategory(CampRelatedModel):

View file

@ -1,7 +1,9 @@
from django.views.generic import ListView
from .models import *
from camps.mixins import CampViewMixin
from .models import InfoCategory
class CampInfoView(CampViewMixin, ListView):
model = InfoCategory

View file

@ -1,4 +1,5 @@
from django.contrib import admin
from .models import OutgoingIrcMessage
admin.site.register(OutgoingIrcMessage)

View file

@ -1,12 +1,13 @@
import irc3, re
from ircbot.models import OutgoingIrcMessage
from teams.models import Team, TeamMember
import logging
import re
import irc3
from django.conf import settings
from django.utils import timezone
from events.models import Routing
from teams.utils import get_team_from_irc_channel
import logging
from ircbot.models import OutgoingIrcMessage
from teams.models import Team, TeamMember
from teams.utils import get_team_from_irc_channel
logger = logging.getLogger("bornhack.%s" % __name__)
@ -24,7 +25,7 @@ class Plugin(object):
self.bot = bot
###############################################################################################
### builtin irc3 event methods
# builtin irc3 event methods
def server_ready(self, **kwargs):
"""triggered after the server sent the MOTD (require core plugin)"""
@ -54,7 +55,7 @@ class Plugin(object):
logger.debug("inside connection_made(), kwargs: %s" % kwargs)
###############################################################################################
### decorated irc3 event methods
# decorated irc3 event methods
@irc3.event(irc3.rfc.JOIN_PART_QUIT)
def on_join_part_quit(self, **kwargs):
@ -104,7 +105,7 @@ class Plugin(object):
logger.debug("inside on_kick(), kwargs: %s" % kwargs)
###############################################################################################
### custom irc3 methods below here
# custom irc3 methods below here
@irc3.extend
def do_stuff(self):
@ -158,7 +159,7 @@ class Plugin(object):
logger.warning("skipping message to %s" % msg.target)
###############################################################################################
### irc channel methods
# irc channel methods
@irc3.extend
def check_irc_channels(self):
@ -377,7 +378,7 @@ class Plugin(object):
self.bot.setup_public_channel(team.public_irc_channel_name)
###############################################################################################
### services (ChanServ & NickServ) methods
# services (ChanServ & NickServ) methods
@irc3.extend
def handle_chanserv_privmsg(self, **kwargs):
@ -429,7 +430,6 @@ class Plugin(object):
if match:
# the irc channel is now registered
channel = match.group(1)
botnick = match.group(2)
logger.debug(
"Channel %s was registered with ChanServ, looking up Team..." % channel
)

View file

@ -1,7 +1,7 @@
from django.conf import settings
import logging
import irc3
from events.models import Routing
from django.conf import settings
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("bornhack.%s" % __name__)
@ -33,5 +33,5 @@ def do_work():
try:
irc3.IrcBot(**config).run(forever=True)
except Exception as E:
logger.exception("Got exception inside do_work for %s" % self.workermodule)
logger.exception("Got exception inside irc3.IrcBot.run()")
raise E

View file

@ -3,6 +3,7 @@
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc

View file

@ -1,8 +1,9 @@
from django.core.exceptions import ValidationError
from utils.models import CreatedUpdatedModel
from django.db import models
from django.utils import timezone
from utils.models import CreatedUpdatedModel
class OutgoingIrcMessage(CreatedUpdatedModel):
target = models.CharField(max_length=100)

View file

@ -1,7 +1,7 @@
from django.conf import settings
from django.utils import timezone
from datetime import timedelta
import logging
from datetime import timedelta
from django.utils import timezone
logger = logging.getLogger("bornhack.%s" % __name__)

View file

@ -1,6 +1,6 @@
from django.db import models
from django.utils.text import slugify
from django.urls import reverse
from django.utils.text import slugify
from utils.models import CreatedUpdatedModel

View file

@ -1,4 +1,5 @@
from django.urls import path
from . import views
app_name = "news"

View file

@ -1,6 +1,6 @@
from django.views.generic import ListView, DetailView
from django.utils import timezone
from django.contrib.syndication.views import Feed
from django.utils import timezone
from django.views.generic import DetailView, ListView
from .models import NewsItem

View file

@ -1,4 +1,5 @@
from django.views.generic import ListView
from camps.models import Camp

View file

@ -1,4 +1,5 @@
from django.contrib import admin
from .models import Profile

View file

@ -1,8 +1,10 @@
from django.apps import AppConfig
from django.db.models.signals import pre_save, post_save
from .signal_handlers import create_profile, profile_pre_save
import logging
from django.apps import AppConfig
from django.db.models.signals import post_save, pre_save
from .signal_handlers import create_profile, profile_pre_save
logger = logging.getLogger("bornhack.%s" % __name__)

View file

@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
from django.db import models, migrations
from django.conf import settings
import uuid
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):

View file

@ -2,7 +2,7 @@ from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext_lazy as _
from utils.models import UUIDModel, CreatedUpdatedModel
from utils.models import CreatedUpdatedModel, UUIDModel
class Profile(CreatedUpdatedModel, UUIDModel):

View file

@ -1,7 +1,7 @@
from django.db.models.signals import post_save, pre_save
from events.handler import handle_team_event
import logging
from events.handler import handle_team_event
logger = logging.getLogger("bornhack.%s" % __name__)

View file

@ -1,7 +1,7 @@
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic import DetailView, UpdateView
from django.urls import reverse_lazy
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse_lazy
from django.views.generic import DetailView, UpdateView
from . import models

View file

@ -1,19 +1,18 @@
from django.contrib import admin, messages
from django.core.exceptions import ValidationError
from .models import (
Event,
Speaker,
EventType,
EventInstance,
EventLocation,
EventTrack,
SpeakerProposal,
EventProposal,
EventTrack,
EventType,
Favorite,
UrlType,
Speaker,
SpeakerProposal,
Url,
UrlType,
)

View file

@ -6,7 +6,7 @@ class ProgramConfig(AppConfig):
name = "program"
def ready(self):
from .models import Speaker, SpeakerProposal, EventProposal
from .models import Speaker
from .signal_handlers import (
check_speaker_event_camp_consistency,
check_speaker_camp_change,

View file

@ -1,13 +1,14 @@
from channels.generic.websocket import JsonWebsocketConsumer
from camps.models import Camp
from .models import (
Event,
EventInstance,
Favorite,
EventLocation,
EventType,
EventTrack,
EventType,
Favorite,
Speaker,
)

View file

@ -1,8 +1,9 @@
import logging
from django.core.exceptions import ObjectDoesNotExist
from utils.email import add_outgoing_email
from teams.models import Team
import logging
from utils.email import add_outgoing_email
logger = logging.getLogger("bornhack.%s" % __name__)

View file

@ -3,7 +3,7 @@ import logging
from django import forms
from django.core.exceptions import ImproperlyConfigured
from .models import SpeakerProposal, EventProposal, EventTrack, Url, UrlType
from .models import EventProposal, EventTrack, SpeakerProposal, Url, UrlType
logger = logging.getLogger("bornhack.%s" % __name__)

View file

@ -1,14 +1,14 @@
from django.core.management.base import BaseCommand
from django.conf import settings
from django.utils import timezone
from time import sleep
import irc3, sys, asyncio
from ircbot.models import OutgoingIrcMessage
from camps.utils import get_current_camp
from django.utils import timezone
from program.models import EventInstance
from datetime import timedelta
import logging
from datetime import timedelta
from time import sleep
from django.conf import settings
from django.core.management.base import BaseCommand
from django.utils import timezone
from camps.utils import get_current_camp
from ircbot.models import OutgoingIrcMessage
from program.models import EventInstance
logger = logging.getLogger("bornhack.%s" % __name__)

View file

@ -2,8 +2,8 @@
# Generated by Django 1.9.6 on 2016-07-13 19:38
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

View file

@ -2,8 +2,8 @@
# Generated by Django 1.10.4 on 2016-12-12 18:09
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

View file

@ -2,8 +2,8 @@
# Generated by Django 1.10.5 on 2017-01-21 12:12
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

View file

@ -2,8 +2,8 @@
# Generated by Django 1.10.5 on 2017-01-22 13:39
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

View file

@ -2,8 +2,8 @@
# Generated by Django 1.10.5 on 2017-02-05 18:40
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):

View file

@ -2,8 +2,8 @@
# Generated by Django 1.10.5 on 2017-02-05 18:40
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):

View file

@ -3,6 +3,7 @@
from __future__ import unicode_literals
from django.db import migrations, models
import program.models

View file

@ -2,9 +2,9 @@
# Generated by Django 1.10.5 on 2017-03-06 19:20
from __future__ import unicode_literals
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):

View file

@ -2,11 +2,13 @@
# Generated by Django 1.10.5 on 2017-03-12 11:30
from __future__ import unicode_literals
import uuid
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import program.models
import uuid
class Migration(migrations.Migration):

View file

@ -2,11 +2,13 @@
# Generated by Django 1.10.5 on 2017-03-12 17:57
from __future__ import unicode_literals
import uuid
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import program.models
import uuid
class Migration(migrations.Migration):

View file

@ -3,6 +3,7 @@
from __future__ import unicode_literals
from django.db import migrations, models
import program.models

View file

@ -3,6 +3,7 @@
from __future__ import unicode_literals
from django.db import migrations, models
import program.models

View file

@ -2,9 +2,9 @@
# Generated by Django 1.11 on 2017-04-15 23:21
from __future__ import unicode_literals
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):

Some files were not shown because too many files have changed in this diff Show more