Browse files

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
  • Loading branch information...
1 parent afc501b commit 66419fef503b63821afc05238d08fdbe21b49c83 @deshipu deshipu committed Nov 15, 2013
View
4 horizon/browsers/__init__.py
@@ -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
49 horizon/forms/__init__.py
@@ -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.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
17 horizon/tables/__init__.py
@@ -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 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
8 horizon/tabs/__init__.py
@@ -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
9 horizon/workflows/__init__.py
@@ -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
31 openstack_dashboard/api/__init__.py
@@ -48,17 +48,20 @@
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
4 openstack_dashboard/dashboards/project/database_backups/workflows/__init__.py
@@ -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
4 openstack_dashboard/dashboards/project/databases/workflows/__init__.py
@@ -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
10 openstack_dashboard/dashboards/project/instances/workflows/__init__.py
@@ -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
10 openstack_dashboard/usage/__init__.py
@@ -14,18 +14,12 @@
# 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
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

0 comments on commit 66419fe

Please sign in to comment.