Replace asserts in __init__ files with __all__

Defines __all__ in place of assert statements in the __init__.py files.

Change-Id: I0e871789d012e3ec579a8563a61d7ae32e20ed96
Closes-bug: #1251546
This commit is contained in:
Radomir Dopieralski 2013-11-15 10:37:10 +01:00
parent afc501b802
commit 66419fef50
10 changed files with 74 additions and 72 deletions

View File

@ -14,8 +14,6 @@
# License for the specific language governing permissions and limitations
# under the License.
# Importing non-modules that are not used explicitly
from horizon.browsers.base import ResourceBrowser # noqa
from horizon.browsers.views import ResourceBrowserView # noqa
assert ResourceBrowser
assert ResourceBrowserView

View File

@ -14,9 +14,15 @@
# License for the specific language governing permissions and limitations
# under the License.
# Importing non-modules that are not used explicitly
# FIXME(gabriel): Legacy imports for API compatibility.
from django.forms import * # noqa
from django.core.exceptions import ValidationError # noqa
from django.forms.fields import * # noqa
from django.forms.forms import * # noqa
from django.forms import widgets
from django.forms.widgets import * # noqa
# Convenience imports for public API components.
from horizon.forms.base import DateForm # noqa
@ -27,11 +33,36 @@ from horizon.forms.fields import DynamicTypedChoiceField # noqa
from horizon.forms.views import ModalFormMixin # noqa
from horizon.forms.views import ModalFormView # noqa
assert widgets
assert SelfHandlingMixin
assert SelfHandlingForm
assert DateForm
assert ModalFormView
assert ModalFormMixin
assert DynamicTypedChoiceField
assert DynamicChoiceField
__all__ = [
"SelfHandlingMixin",
"SelfHandlingForm",
"DateForm",
"ModalFormView",
"ModalFormMixin",
"DynamicTypedChoiceField",
"DynamicChoiceField",
# From django.forms
"ValidationError",
# From django.forms.fields
'Field', 'CharField', 'IntegerField', 'DateField', 'TimeField',
'DateTimeField', 'TimeField', 'RegexField', 'EmailField', 'FileField',
'ImageField', 'URLField', 'BooleanField', 'NullBooleanField',
'ChoiceField', 'MultipleChoiceField', 'ComboField', 'MultiValueField',
'FloatField', 'DecimalField', 'SplitDateTimeField', 'IPAddressField',
'GenericIPAddressField', 'FilePathField', 'SlugField', 'TypedChoiceField',
'TypedMultipleChoiceField',
# From django.forms.widgets
"widgets",
'Media', 'MediaDefiningClass', 'Widget', 'TextInput', 'PasswordInput',
'HiddenInput', 'MultipleHiddenInput', 'ClearableFileInput', 'FileInput',
'DateInput', 'DateTimeInput', 'TimeInput', 'Textarea', 'CheckboxInput',
'Select', 'NullBooleanSelect', 'SelectMultiple', 'RadioSelect',
'CheckboxSelectMultiple', 'MultiWidget', 'SplitDateTimeWidget',
# From django.forms.forms
'BaseForm', 'Form',
]

View File

@ -15,6 +15,8 @@
# under the License.
# Convenience imports for public API components.
# Importing non-modules that are not used explicitly
from horizon.tables.actions import Action # noqa
from horizon.tables.actions import BatchAction # noqa
from horizon.tables.actions import DeleteAction # noqa
@ -29,18 +31,3 @@ from horizon.tables.views import DataTableView # noqa
from horizon.tables.views import MixedDataTableView # noqa
from horizon.tables.views import MultiTableMixin # noqa
from horizon.tables.views import MultiTableView # noqa
assert Action
assert BatchAction
assert DeleteAction
assert LinkAction
assert UpdateAction
assert FilterAction
assert FixedFilterAction
assert DataTable
assert Column
assert Row
assert DataTableView
assert MultiTableView
assert MultiTableMixin
assert MixedDataTableView

View File

@ -14,14 +14,10 @@
# License for the specific language governing permissions and limitations
# under the License.
# Importing non-modules that are not used explicitly
from horizon.tabs.base import Tab # noqa
from horizon.tabs.base import TabGroup # noqa
from horizon.tabs.base import TableTab # noqa
from horizon.tabs.views import TabbedTableView # noqa
from horizon.tabs.views import TabView # noqa
assert TabGroup
assert Tab
assert TableTab
assert TabView
assert TabbedTableView

View File

@ -10,16 +10,11 @@
# License for the specific language governing permissions and limitations
# under the License.
# Importing non-modules that are not used explicitly
from horizon.workflows.base import Action # noqa
from horizon.workflows.base import MembershipAction # noqa
from horizon.workflows.base import Step # noqa
from horizon.workflows.base import UpdateMembersStep # noqa
from horizon.workflows.base import Workflow # noqa
from horizon.workflows.views import WorkflowView # noqa
assert Action
assert MembershipAction
assert Step
assert UpdateMembersStep
assert Workflow
assert WorkflowView

View File

@ -48,17 +48,20 @@ from openstack_dashboard.api import swift
from openstack_dashboard.api import trove
from openstack_dashboard.api import vpn
assert base
assert cinder
assert fwaas
assert glance
assert heat
assert keystone
assert lbaas
assert network
assert neutron
assert nova
assert swift
assert ceilometer
assert trove
assert vpn
__all__ = [
"base",
"cinder",
"fwaas",
"glance",
"heat",
"keystone",
"lbaas",
"network",
"neutron",
"nova",
"swift",
"ceilometer",
"trove",
"vpn",
]

View File

@ -1,3 +1,3 @@
from create_backup import CreateBackup
# Importing non-modules that are not used explicitly
assert CreateBackup
from create_backup import CreateBackup # noqa

View File

@ -1,3 +1,3 @@
from create_instance import LaunchInstance
# Importing non-modules that are not used explicitly
assert LaunchInstance
from create_instance import LaunchInstance # noqa

View File

@ -1,7 +1,5 @@
from create_instance import LaunchInstance
from resize_instance import ResizeInstance
from update_instance import UpdateInstance
# Importing non-modules that are not used explicitly
assert LaunchInstance
assert UpdateInstance
assert ResizeInstance
from create_instance import LaunchInstance # noqa
from resize_instance import ResizeInstance # noqa
from update_instance import UpdateInstance # noqa

View File

@ -14,6 +14,8 @@
# License for the specific language governing permissions and limitations
# under the License.
# Importing non-modules that are not used explicitly
from openstack_dashboard.usage.base import BaseUsage # noqa
from openstack_dashboard.usage.base import GlobalUsage # noqa
from openstack_dashboard.usage.base import ProjectUsage # noqa
@ -21,11 +23,3 @@ from openstack_dashboard.usage.tables import BaseUsageTable # noqa
from openstack_dashboard.usage.tables import GlobalUsageTable # noqa
from openstack_dashboard.usage.tables import ProjectUsageTable # noqa
from openstack_dashboard.usage.views import UsageView # noqa
assert BaseUsage
assert ProjectUsage
assert GlobalUsage
assert UsageView
assert BaseUsageTable
assert ProjectUsageTable
assert GlobalUsageTable