recipe-498148.py 文件源码

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

项目:code 作者: ActiveState 项目源码 文件源码
def __init__(self, **kwargs):
        'Initialize the Key object.'
        assert kwargs, 'No Keyword Arguments Were Found'
        self.__repr, key, sub_key, sam, computer_name = '%s(%s)' % (self.__class__.__name__, ', '.join(['%s=%r' % (key, kwargs[key]) for key in kwargs])), kwargs.pop('key', None), kwargs.pop('sub_key', None), kwargs.pop('sam', None), kwargs.pop('computer_name', None)
        assert not kwargs, 'Invalid Keyword Arguments Were Found'
        if isinstance(key, (int, _winreg.HKEYType)) and sub_key is None and sam is None and computer_name is None:
            self.__self = _winreg.OpenKey(key, '')
        elif isinstance(key, Key) and sub_key is None and sam is None and computer_name is None:
            self.__self = _winreg.OpenKey(key.__self, '')
        elif isinstance(key, (int, _winreg.HKEYType)) and isinstance(sub_key, str) and sam is None and computer_name is None:
            self.__self = _winreg.OpenKey(key, sub_key)
        elif isinstance(key, Key) and isinstance(sub_key, str) and sam is None and computer_name is None:
            self.__self = _winreg.OpenKey(key.__self, sub_key)
        elif isinstance(key, (int, _winreg.HKEYType)) and sub_key is None and isinstance(sam, int) and computer_name is None:
            self.__self = _winreg.OpenKey(key, '', 0, sam)
        elif isinstance(key, Key) and sub_key is None and isinstance(sam, int) and computer_name is None:
            self.__self = _winreg.OpenKey(key.__self, '', 0, sam)
        elif isinstance(key, (int, _winreg.HKEYType)) and isinstance(sub_key, str) and isinstance(sam, int) and computer_name is None:
            self.__self = _winreg.OpenKey(key, sub_key, 0, sam)
        elif isinstance(key, Key) and isinstance(sub_key, str) and isinstance(sam, int) and computer_name is None:
            self.__self = _winreg.OpenKey(key.__self, sub_key, 0, sam)
        elif isinstance(key, int) and sub_key is None and sam is None and isinstance(computer_name, str):
            self.__self = _winreg.ConnectRegistry(computer_name, key)
        elif isinstance(key, int) and isinstance(sub_key, str) and sam is None and isinstance(computer_name, str):
            self.__self = _winreg.OpenKey(_winreg.ConnectRegistry(computer_name, key), sub_key)
        elif isinstance(key, int) and sub_key is None and isinstance(sam, int) and isinstance(computer_name, str):
            self.__self = _winreg.OpenKey(_winreg.ConnectRegistry(computer_name, key), '', 0, sam)
        elif isinstance(key, int) and isinstance(sub_key, str) and isinstance(sam, int) and isinstance(computer_name, str):
            self.__self = _winreg.OpenKey(_winreg.ConnectRegistry(computer_name, key), sub_key, 0, sam)
        else:
            raise TypeError, 'Key Could Not Be Initialized'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号