~ubuntu-branches/ubuntu/trusty/gnuradio/trusty-updates

« back to all changes in this revision

Viewing changes to grc/base/Connection.py

  • Committer: Package Import Robot
  • Author(s): A. Maitland Bottoms
  • Date: 2012-02-26 21:26:16 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20120226212616-vsfkbi1158xshdql
Tags: 3.5.1-1
* new upstream version, re-packaged from scratch with modern tools
    closes: #642716, #645332, #394849, #616832, #590048, #642580,
    #647018, #557050, #559640, #631863
* CMake build

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
"""
2
 
Copyright 2008, 2009 Free Software Foundation, Inc.
 
2
Copyright 2008-2011 Free Software Foundation, Inc.
3
3
This file is part of GNU Radio
4
4
 
5
5
GNU Radio Companion is free software; you can redistribute it and/or
37
37
                for port in (porta, portb):
38
38
                        if port.is_source(): source = port
39
39
                        if port.is_sink(): sink = port
40
 
                assert(source and sink)
 
40
                if not source: raise ValueError('Connection could not isolate source')
 
41
                if not sink: raise ValueError('Connection could not isolate sink')
41
42
                #ensure that this connection (source -> sink) is unique
42
43
                for connection in self.get_parent().get_connections():
43
 
                        assert not (connection.get_source() is source and connection.get_sink() is sink)
 
44
                        if connection.get_source() is source and connection.get_sink() is sink:
 
45
                                raise Exception('This connection between source and sink is not unique.')
44
46
                self._source = source
45
47
                self._sink = sink
46
48
 
62
64
                Element.validate(self)
63
65
                source_type = self.get_source().get_type()
64
66
                sink_type = self.get_sink().get_type()
65
 
                try: assert source_type == sink_type
66
 
                except AssertionError: self.add_error_message('Source type "%s" does not match sink type "%s".'%(source_type, sink_type))
 
67
                if source_type != sink_type:
 
68
                        self.add_error_message('Source type "%s" does not match sink type "%s".'%(source_type, sink_type))
67
69
 
68
70
        def get_enabled(self):
69
71
                """