Install isort and fix all imports.

This commit is contained in:
Emil Stenström 2019-11-24 11:00:45 +01:00
parent cbe2bcc9c9
commit 40ebd6b936
8 changed files with 28 additions and 5 deletions

View file

@ -1,8 +1,11 @@
from django.template.loader import render_to_string
from .component_registry import ComponentRegistry, AlreadyRegistered, NotRegistered # NOQA
from django.forms.widgets import MediaDefiningClass
from django.template.loader import render_to_string
from six import with_metaclass
# Allow "component.AlreadyRegistered" instead of having to import these everywhere
from django_components.component_registry import AlreadyRegistered, ComponentRegistry, NotRegistered # NOQA
class Component(with_metaclass(MediaDefiningClass)):
def context(self):
return {}

View file

@ -1,7 +1,8 @@
from django import template
from django_components.component import registry
from django.utils.safestring import mark_safe
from django_components.component import registry
register = template.Library()
@register.simple_tag(name="component_dependencies")

View file

@ -3,3 +3,4 @@
tox
pytest
flake8
isort

View file

@ -1,3 +1,11 @@
[flake8]
ignore = E302
max-line-length = 119
[isort]
line_length = 119
multi_line_output = 5
include_trailing_comma = True
not_skip = __init__.py
known_first_party =
django_components

View file

@ -1,4 +1,4 @@
from setuptools import setup, find_packages
from setuptools import find_packages, setup
setup(
name='django-components',

View file

@ -1,8 +1,12 @@
from textwrap import dedent
from django.test import SimpleTestCase
from django_components import component
from .django_test_setup import * # NOQA
class SimpleComponent(component.Component):
def context(self, variable=None):
return {

View file

@ -1,6 +1,8 @@
import unittest
from django_components import component
class MockComponent(object):
pass

View file

@ -1,9 +1,13 @@
from textwrap import dedent
from django.template import Context, Template
from django.test import SimpleTestCase
from django.template import Template, Context
from django_components import component
from .django_test_setup import * # NOQA
class SimpleComponent(component.Component):
def context(self, variable):
return {