死磕itchat源码--__init__.py
itchat包中的__init__.py
是该库的入口;在该文件中的源码如下:
# -*- coding: utf-8 -*- from . import content from .core import Core from .config import VERSION from .log import set_logging __version__ = VERSION # 实例列表,添加处理微信的实例对象 instanceList = [] def new_instance(): """ 用于创建一个新的`Core`的实例化对象,并且返回, newInstance = Core()是最终封装的实例化对象,封装了Storage,requests,等属性 """ newInstance = Core() instanceList.append(newInstance) return newInstance # 封装`Core`的实例化对象在`originInstance` # `originInstance` = `newInstance` = `Core()` originInstance = new_instance() # I really want to use sys.modules[__name__] = originInstance # but it makes auto-fill a real mess, so forgive me for my following ** # actually it toke me less than 30 seconds, god bless Uganda # components.login # 在components.login中实现重构 login = originInstance.login get_QRuuid = originInstance.get_QRuuid get_QR = originInstance.get_QR check_login = originInstance.check_login web_init = originInstance.web_init show_mobile_login = originInstance.show_mobile_login start_receiving = originInstance.start_receiving get_msg = originInstance.get_msg logout = originInstance.logout # components.contact # 在components.contact中实现重构 update_chatroom = originInstance.update_chatroom update_friend = originInstance.update_friend get_contact = originInstance.get_contact get_friends = originInstance.get_friends get_chatrooms = originInstance.get_chatrooms get_mps = originInstance.get_mps set_alias = originInstance.set_alias set_pinned = originInstance.set_pinned add_friend = originInstance.add_friend get_head_img = originInstance.get_head_img create_chatroom = originInstance.create_chatroom set_chatroom_name = originInstance.set_chatroom_name delete_member_from_chatroom = originInstance.delete_member_from_chatroom add_member_into_chatroom = originInstance.add_member_into_chatroom # components.messages # 在components.login中实现重构 send_raw_msg = originInstance.send_raw_msg send_msg = originInstance.send_msg upload_file = originInstance.upload_file send_file = originInstance.send_file send_image = originInstance.send_image send_video = originInstance.send_video send = originInstance.send revoke = originInstance.revoke # components.hotreload # 在components.hotreload中实现重构 dump_login_status = originInstance.dump_login_status load_login_status = originInstance.load_login_status # components.register # 在components.register中实现重构 auto_login = originInstance.auto_login configured_reply = originInstance.configured_reply msg_register = originInstance.msg_register run = originInstance.run # other functions search_friends = originInstance.search_friends search_chatrooms = originInstance.search_chatrooms search_mps = originInstance.search_mps set_logging = set_logging
作者: 咕咚!
出处: https://www.cnblogs.com/linga/
关于作者:专注虚拟化,运维开发,RPA,Rust,Go,Python!
本文版权归作者和博客园共有,禁止*.csdn.net转载,禁止以盈利为目的的转载,转载文章,但未经作者同意必须保留此段声明,且在文章页面明显位置给出, 原文链接 如有问题, 可邮件(oldsixa@163.com)咨询.
标签:
Python
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
2018-06-11 函数