~ubuntu-branches/ubuntu/karmic/bzr/karmic-proposed

« back to all changes in this revision

Viewing changes to bzrlib/lazy_import.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2008-05-12 00:14:54 UTC
  • mfrom: (1.1.42 upstream)
  • Revision ID: james.westby@ubuntu.com-20080512001454-yjpajuiocykl48p9
Tags: 1.5~rc1-1
New upstream release.

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:
174
 
            assert not children, \
175
 
                'Cannot supply both a member and children'
 
173
        if (member is not None) and children:
 
174
            raise ValueError('Cannot supply both a member and children')
176
175
 
177
176
        object.__setattr__(self, '_import_replacer_children', children)
178
177
        object.__setattr__(self, '_member', member)
260
259
 
261
260
        :param import_str: The import string to process
262
261
        """
263
 
        assert import_str.startswith('import ')
 
262
        if not import_str.startswith('import '):
 
263
            raise ValueError('bad import string %r' % (import_str,))
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
 
        assert from_str.startswith('from ')
 
308
        if not from_str.startswith('from '):
 
309
            raise ValueError('bad from/import %r' % from_str)
309
310
        from_str = from_str[len('from '):]
310
311
 
311
312
        from_module, import_list = from_str.split(' import ')