~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lazy_import.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-12-20 16:16:34 UTC
  • mfrom: (3123.5.18 hardlinks)
  • Revision ID: pqm@pqm.ubuntu.com-20071220161634-2kcjb650o21ydko4
Accelerate build_tree using similar workingtrees (abentley)

Show diffs side-by-side

added added

removed removed

Lines of Context:
170
170
            from foo import bar, baz would get translated into 2 import
171
171
            requests. On for 'name=bar' and one for 'name=baz'
172
172
        """
173
 
        if (member is not None) and children:
174
 
            raise ValueError('Cannot supply both a member and children')
 
173
        if member is not None:
 
174
            assert not children, \
 
175
                'Cannot supply both a member and children'
175
176
 
176
177
        object.__setattr__(self, '_import_replacer_children', children)
177
178
        object.__setattr__(self, '_member', member)
259
260
 
260
261
        :param import_str: The import string to process
261
262
        """
262
 
        if not import_str.startswith('import '):
263
 
            raise ValueError('bad import string %r' % (import_str,))
 
263
        assert import_str.startswith('import ')
264
264
        import_str = import_str[len('import '):]
265
265
 
266
266
        for path in import_str.split(','):
305
305
 
306
306
        :param from_str: The import string to process
307
307
        """
308
 
        if not from_str.startswith('from '):
309
 
            raise ValueError('bad from/import %r' % from_str)
 
308
        assert from_str.startswith('from ')
310
309
        from_str = from_str[len('from '):]
311
310
 
312
311
        from_module, import_list = from_str.split(' import ')