Exemplo n.º 1
0
    def test_import_dotted_symbol(self):
        """ import dotted symbol """

        import tarfile

        symbol = import_symbol("tarfile.TarFile")
        self.assertEqual(symbol, tarfile.TarFile)
Exemplo n.º 2
0
    def test_import_nested_symbol(self):
        """ import nested symbol """

        import tarfile

        symbol = import_symbol("tarfile:TarFile.open")
        self.assertEqual(symbol, tarfile.TarFile.open)
Exemplo n.º 3
0
    def test_import_dotted_module(self):
        """ import dotted module """

        symbol = import_symbol("traits.util.import_symbol:import_symbol")

        self.assertEqual(symbol, import_symbol)

        return
Exemplo n.º 4
0
    def test_import_dotted_module(self):
        """ import dotted module """

        symbol = import_symbol("traits.util.import_symbol:import_symbol")

        self.assertEqual(symbol, import_symbol)

        return
Exemplo n.º 5
0
    def test_import_nested_symbol(self):
        """ import nested symbol """

        import tarfile

        symbol = import_symbol("tarfile:TarFile.open")
        self.assertEqual(symbol, tarfile.TarFile.open)

        return
Exemplo n.º 6
0
    def test_import_dotted_symbol(self):
        """ import dotted symbol """

        import tarfile

        symbol = import_symbol("tarfile.TarFile")
        self.assertEqual(symbol, tarfile.TarFile)

        return
    def _get_from_protocol(self):
        """ Trait property getter. """

        if not self._from_protocol_loaded:
            if isinstance(self._from_protocol, str):
                self._from_protocol = import_symbol(self._from_protocol)

            self._from_protocol_loaded = True

        return self._from_protocol
    def _get_factory(self):
        """ Trait property getter. """

        if not self._factory_loaded:
            if isinstance(self._factory, str):
                self._factory = import_symbol(self._factory)

            self._factory_loaded = True

        return self._factory
Exemplo n.º 9
0
    def _get_factory(self):
        """ Trait property getter. """

        if not self._factory_loaded:
            if isinstance(self._factory, basestring):
                self._factory = import_symbol(self._factory)

            self._factory_loaded = True

        return self._factory
Exemplo n.º 10
0
    def _get_to_protocol(self):
        """ Trait property getter. """

        if not self._to_protocol_loaded:
            if isinstance(self._to_protocol, six.string_types):
                self._to_protocol = import_symbol(self._to_protocol)

            self._to_protocol_loaded = True

        return self._to_protocol
Exemplo n.º 11
0
    def _get_from_protocol(self):
        """ Trait property getter. """

        if not self._from_protocol_loaded:
            if isinstance(self._from_protocol, basestring):
                self._from_protocol = import_symbol(self._from_protocol)

            self._from_protocol_loaded = True

        return self._from_protocol