Generalize usage of relative import instead of importing from cubes.seda
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 11 Jan 2017 07:56:54 +0100
changeset 2267 8b4905c6d9c2
parent 2266 70cccf02d910
child 2268 96bda704e719
Generalize usage of relative import instead of importing from cubes.seda
entities/__init__.py
entities/custom.py
entities/html_generation.py
entities/itree.py
entities/profile_generation.py
hooks.py
views/__init__.py
views/archivetransfer.py
views/archiveunit.py
views/clone.py
views/content.py
views/dataobject.py
views/mgmt_rules.py
views/sedatree.py
views/simplified.py
views/viewlib.py
xsd2yams.py
--- a/entities/__init__.py	Wed Jan 11 07:54:26 2017 +0100
+++ b/entities/__init__.py	Wed Jan 11 07:56:54 2017 +0100
@@ -1,4 +1,4 @@
-# copyright 2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2016-2017 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 # contact http://www.logilab.fr -- mailto:contact@logilab.fr
 #
 # This program is free software: you can redistribute it and/or modify it under
@@ -21,9 +21,9 @@
 
 from cubes.compound.entities import IContainer, IContained, IClonableAdapter
 
-from cubes.seda import seda_profile_container_def
-from cubes.seda.xsd import XSDMMapping
-from cubes.seda.xsd2yams import RULE_TYPES
+from .. import seda_profile_container_def
+from ..xsd import XSDMMapping
+from ..xsd2yams import RULE_TYPES
 
 
 XSDM_MAPPING = XSDMMapping('ArchiveTransfer')
--- a/entities/custom.py	Wed Jan 11 07:54:26 2017 +0100
+++ b/entities/custom.py	Wed Jan 11 07:56:54 2017 +0100
@@ -14,7 +14,7 @@
 # You should have received a copy of the GNU Lesser General Public License along
 # with this program. If not, see <http://www.gnu.org/licenses/>.
 
-from cubes.seda.entities import generated
+from . import generated
 
 
 def _extract_title(annotation):
--- a/entities/html_generation.py	Wed Jan 11 07:54:26 2017 +0100
+++ b/entities/html_generation.py	Wed Jan 11 07:56:54 2017 +0100
@@ -19,8 +19,8 @@
 
 from cubicweb import _
 
-from cubes.seda.entities.profile_generation import SEDA2ExportAdapter, content_types
-from cubes.seda.entities.profile_generation import xselement_scheme_attribute, _concept_value
+from .profile_generation import SEDA2ExportAdapter, content_types
+from .profile_generation import xselement_scheme_attribute, _concept_value
 
 
 def element_uml_cardinality(occ, card_entity):
--- a/entities/itree.py	Wed Jan 11 07:54:26 2017 +0100
+++ b/entities/itree.py	Wed Jan 11 07:56:54 2017 +0100
@@ -1,4 +1,4 @@
-# copyright 2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2016-2017 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 # contact http://www.logilab.fr -- mailto:contact@logilab.fr
 #
 # This program is free software: you can redistribute it and/or modify it under
@@ -18,7 +18,7 @@
 from cubicweb.predicates import is_instance
 from cubicweb.view import EntityAdapter
 
-from cubes.seda.entities import simplified_profile
+from . import simplified_profile
 
 
 def parent_archive_unit(entity):
--- a/entities/profile_generation.py	Wed Jan 11 07:54:26 2017 +0100
+++ b/entities/profile_generation.py	Wed Jan 11 07:56:54 2017 +0100
@@ -30,9 +30,9 @@
 from cubicweb.predicates import is_instance
 from cubicweb.view import EntityAdapter
 
-from cubes.seda.xsd import XSDM_MAPPING, JUMP_ELEMENTS
-from cubes.seda.xsd2yams import SKIP_ATTRS
-from cubes.seda.entities import simplified_profile
+from ..xsd import XSDM_MAPPING, JUMP_ELEMENTS
+from ..xsd2yams import SKIP_ATTRS
+from . import simplified_profile
 
 
 JUMPED_OPTIONAL_ELEMENTS = set(('DataObjectPackage', 'FileInfo', 'PhysicalDimensions', 'Coverage'))
--- a/hooks.py	Wed Jan 11 07:54:26 2017 +0100
+++ b/hooks.py	Wed Jan 11 07:56:54 2017 +0100
@@ -25,8 +25,8 @@
 from cubicweb.predicates import is_instance, score_entity
 from cubicweb.server import hook
 
-from cubes.seda.entities import rule_type_from_etype, diag
-from cubes.seda.entities.generated import CHOICE_RTYPE
+from .entities import rule_type_from_etype, diag
+from .entities.generated import CHOICE_RTYPE
 
 
 SEDA_PARENT_RTYPES = {}
--- a/views/__init__.py	Wed Jan 11 07:54:26 2017 +0100
+++ b/views/__init__.py	Wed Jan 11 07:56:54 2017 +0100
@@ -24,9 +24,9 @@
 # XXX alias to avoid side effect: uicfg will become our uicfg submodule. Not necessary with 3.23?
 from cubicweb.web.views import uicfg as cwuicfg
 
-from cubes.seda.xsd import XSDM_MAPPING
-from cubes.seda.xsd2uicfg import FIRST_LEVEL_ETYPES
-from cubes.seda.views.widgets import SEDAMetaField
+from ..xsd import XSDM_MAPPING
+from ..xsd2uicfg import FIRST_LEVEL_ETYPES
+from .widgets import SEDAMetaField
 
 
 pvs = cwuicfg.primaryview_section
--- a/views/archivetransfer.py	Wed Jan 11 07:54:26 2017 +0100
+++ b/views/archivetransfer.py	Wed Jan 11 07:56:54 2017 +0100
@@ -25,11 +25,11 @@
 
 from cubes.relationwidget import views as rwdg
 
-from cubes.seda.xsd2yams import RULE_TYPES
-from cubes.seda.entities import full_seda2_profile, simplified_profile, parent_and_container
-from cubes.seda.views import rtags_from_xsd_element, rtags_from_rtype_role_targets, copy_rtag
-from cubes.seda.views import clone, viewlib
-from cubes.seda.views import uicfg as sedauicfg  # noqa - ensure those rules are defined first
+from ..xsd2yams import RULE_TYPES
+from ..entities import full_seda2_profile, simplified_profile, parent_and_container
+from . import rtags_from_xsd_element, rtags_from_rtype_role_targets, copy_rtag
+from . import clone, viewlib
+from . import uicfg as sedauicfg  # noqa - ensure those rules are defined first
 
 at_ordered_fields = [
     ('seda_archival_agency', 'subject'),
--- a/views/archiveunit.py	Wed Jan 11 07:54:26 2017 +0100
+++ b/views/archiveunit.py	Wed Jan 11 07:56:54 2017 +0100
@@ -27,12 +27,12 @@
 from cubes.compound import views as compound
 from cubes.relationwidget import views as rwdg
 
-from cubes.seda.entities import simplified_profile, parent_and_container
-from cubes.seda.entities.itree import parent_archive_unit
-from cubes.seda.views import (add_subobject_link, add_subobjects_button, dropdown_button,
-                              rtags_from_rtype_role_targets, copy_rtag, has_rel_perm)
-from cubes.seda.views import clone, viewlib, widgets, content
-from cubes.seda.views import uicfg as sedauicfg  # noqa - ensure those rules are defined first
+from ..entities import simplified_profile, parent_and_container
+from ..entities.itree import parent_archive_unit
+from . import (add_subobject_link, add_subobjects_button, dropdown_button,
+               rtags_from_rtype_role_targets, copy_rtag, has_rel_perm)
+from . import clone, viewlib, widgets, content
+from . import uicfg as sedauicfg  # noqa - ensure those rules are defined first
 
 
 afs = uicfg.autoform_section
--- a/views/clone.py	Wed Jan 11 07:54:26 2017 +0100
+++ b/views/clone.py	Wed Jan 11 07:56:54 2017 +0100
@@ -1,4 +1,4 @@
-# copyright 2015-2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2015-2017 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 # contact http://www.logilab.fr -- mailto:contact@logilab.fr
 #
 # This program is free software: you can redistribute it and/or modify it under
@@ -23,7 +23,7 @@
 from cubes.compound.entities import copy_entity
 from cubes.relationwidget import views as rwdg
 
-from cubes.seda.views.widgets import configure_relation_widget
+from .widgets import configure_relation_widget
 
 
 # Hide copy action for SEDA profiles
--- a/views/content.py	Wed Jan 11 07:54:26 2017 +0100
+++ b/views/content.py	Wed Jan 11 07:56:54 2017 +0100
@@ -24,10 +24,10 @@
 
 from cubes.relationwidget.views import RelationFacetWidget
 
-from cubes.seda.xsd import un_camel_case
-from cubes.seda.views import rtags_from_rtype_role_targets, rtags_from_xsd_element, copy_rtag
-from cubes.seda.views import viewlib, widgets
-from cubes.seda.views import uicfg as sedauicfg  # noqa - ensure those rules are defined first
+from ..xsd import un_camel_case
+from . import rtags_from_rtype_role_targets, rtags_from_xsd_element, copy_rtag
+from . import viewlib, widgets
+from . import uicfg as sedauicfg  # noqa - ensure those rules are defined first
 
 
 pvs = uicfg.primaryview_section
--- a/views/dataobject.py	Wed Jan 11 07:54:26 2017 +0100
+++ b/views/dataobject.py	Wed Jan 11 07:56:54 2017 +0100
@@ -28,11 +28,11 @@
 from cubes.relationwidget import views as rwdg
 from cubes.skos.views import widgets as skos
 
-from cubes.seda.xsd2yams import SCHEME_FROM_CONTAINER
-from cubes.seda.entities import parent_and_container, simplified_profile, full_seda2_profile
-from cubes.seda.views import rtags_from_xsd_element, add_subobject_link
-from cubes.seda.views import viewlib
-from cubes.seda.views import uicfg as sedauicfg  # noqa - ensure those rules are defined first
+from ..xsd2yams import SCHEME_FROM_CONTAINER
+from ..entities import parent_and_container, simplified_profile, full_seda2_profile
+from . import rtags_from_xsd_element, add_subobject_link
+from . import viewlib
+from . import uicfg as sedauicfg  # noqa - ensure those rules are defined first
 
 
 pvs = uicfg.primaryview_section
--- a/views/mgmt_rules.py	Wed Jan 11 07:54:26 2017 +0100
+++ b/views/mgmt_rules.py	Wed Jan 11 07:56:54 2017 +0100
@@ -25,9 +25,9 @@
 from cubicweb.web import INTERNAL_FIELD_VALUE
 from cubicweb.web.views import uicfg
 
-from cubes.seda.entities import parent_and_container, rule_type_from_etype
-from cubes.seda.views import viewlib
-from cubes.seda.views import uicfg as sedauicfg  # noqa - ensure those rules are defined first
+from ..entities import parent_and_container, rule_type_from_etype
+from . import viewlib
+from . import uicfg as sedauicfg  # noqa - ensure those rules are defined first
 
 
 affk = uicfg.autoform_field_kwargs
--- a/views/sedatree.py	Wed Jan 11 07:54:26 2017 +0100
+++ b/views/sedatree.py	Wed Jan 11 07:56:54 2017 +0100
@@ -19,8 +19,8 @@
 from cubicweb.predicates import adaptable, is_instance
 from cubicweb.web import component
 
-from cubes.seda.entities import simplified_profile, component_unit
-from cubes.seda.views import jqtree
+from ..entities import simplified_profile, component_unit
+from . import jqtree
 
 
 class ProfileTreeComponent(component.EntityCtxComponent):
--- a/views/simplified.py	Wed Jan 11 07:54:26 2017 +0100
+++ b/views/simplified.py	Wed Jan 11 07:56:54 2017 +0100
@@ -1,4 +1,4 @@
-# copyright 2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2016-2017 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 # contact http://www.logilab.fr -- mailto:contact@logilab.fr
 #
 # This program is free software: you can redistribute it and/or modify it under
@@ -20,10 +20,10 @@
 from cubicweb.predicates import is_instance
 from cubicweb.web.views import uicfg, autoform, formrenderers
 
-from cubes.seda.entities import simplified_profile
-from cubes.seda.views import copy_rtag
+from ..entities import simplified_profile
+from . import copy_rtag
 # ensure those are registered first
-from cubes.seda.views import mgmt_rules, archivetransfer, dataobject, archiveunit, content  # noqa
+from . import mgmt_rules, archivetransfer, dataobject, archiveunit, content  # noqa
 
 
 # Add arbitrary score using `yes` to overtake e.g. afs for DataObjectReference defined in content
--- a/views/viewlib.py	Wed Jan 11 07:54:26 2017 +0100
+++ b/views/viewlib.py	Wed Jan 11 07:56:54 2017 +0100
@@ -20,9 +20,9 @@
 from cubicweb.view import EntityView
 from cubicweb.web.views import baseviews, tabs
 
-from cubes.seda.xsd import un_camel_case
-from cubes.seda.xsd2uicfg import FIRST_LEVEL_ETYPES
-from cubes.seda.views import add_subobjects_button
+from ..xsd import un_camel_case
+from ..xsd2uicfg import FIRST_LEVEL_ETYPES
+from . import add_subobjects_button
 
 
 class XSDMetaEntityView(EntityView):
--- a/xsd2yams.py	Wed Jan 11 07:54:26 2017 +0100
+++ b/xsd2yams.py	Wed Jan 11 07:56:54 2017 +0100
@@ -1,4 +1,4 @@
-# copyright 2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2016-2017 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 # contact http://www.logilab.fr -- mailto:contact@logilab.fr
 #
 # This program is free software: you can redistribute it and/or modify it under