pymod_main.py 文件源码

python
阅读 38 收藏 0 点赞 0 评论 0

项目:pymod 作者: pymodproject 项目源码 文件源码
def find_class(self, module, name):
        """
        Overridden from the original 'Unpickler' class. Needed to rebuild PyMod object which have
        complex modules names. 'Unpickler' rebuilds objects using the 'fully qualified' name
        reference of their classes (the class name is pickled, along with the name of the module the
        class is defined in). Since PyMOL plugin modules may yield different 'fully qualified' names
        depending on the system, PyMod objects are rebuilt using only the name of their classes.
        """
        try:
            # Try the standard routine of pickle.
            __import__(module)
            mod = sys.modules[module]
            klass = getattr(mod, name)
            return klass
        except:
            # Build object by class name.
            try:
                name = name.rstrip("\n\r") # Needed to fix some old Windows versions behaviour.
            except:
                pass
            return globals()[name]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号