partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | WechatExt.upload_file | 上传素材 (图片/音频/视频)
:param filepath: 本地文件路径
:return: 直接返回上传后的文件 ID (fid)
:raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据
:raises ValueError: 参数出错, 错误原因直接打印异常即可 (常见错误内容: ``file not exist``: 找不到本地文件, ``audio too long``: 音频文件过长, ``file invalid type``: 文件格式不正确, 还有其他错误请自行检查) | wechat_sdk/ext.py | def upload_file(self, filepath):
"""
上传素材 (图片/音频/视频)
:param filepath: 本地文件路径
:return: 直接返回上传后的文件 ID (fid)
:raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据
:raises ValueError: 参数出错, 错误原因直接打印异常即可 (常见错误内容: ``file not exist``: 找不到本地文件, ``audio too long``: 音频文件过长, ``... | def upload_file(self, filepath):
"""
上传素材 (图片/音频/视频)
:param filepath: 本地文件路径
:return: 直接返回上传后的文件 ID (fid)
:raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据
:raises ValueError: 参数出错, 错误原因直接打印异常即可 (常见错误内容: ``file not exist``: 找不到本地文件, ``audio too long``: 音频文件过长, ``... | [
"上传素材",
"(",
"图片",
"/",
"音频",
"/",
"视频",
")",
":",
"param",
"filepath",
":",
"本地文件路径",
":",
"return",
":",
"直接返回上传后的文件",
"ID",
"(",
"fid",
")",
":",
"raises",
"NeedLoginError",
":",
"操作未执行成功",
"需要再次尝试登录",
"异常内容为服务器返回的错误数据",
":",
"raises",
"ValueError",
"... | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/ext.py#L766-L806 | [
"def",
"upload_file",
"(",
"self",
",",
"filepath",
")",
":",
"self",
".",
"_init_ticket",
"(",
")",
"url",
"=",
"'https://mp.weixin.qq.com/cgi-bin/filetransfer?action=upload_material&f=json&ticket_id={ticket_id}&ticket={ticket}&token={token}&lang=zh_CN'",
".",
"format",
"(",
"... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatExt.send_file | 向特定用户发送媒体文件
:param fakeid: 用户 UID (即 fakeid)
:param fid: 文件 ID
:param type: 文件类型 (2: 图片, 3: 音频, 15: 视频)
:raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据
:raises ValueError: 参数出错, 错误原因直接打印异常即可 (常见错误内容: ``system error`` 或 ``can not send this type of msg``: 文件类型不匹配, ``user... | wechat_sdk/ext.py | def send_file(self, fakeid, fid, type):
"""
向特定用户发送媒体文件
:param fakeid: 用户 UID (即 fakeid)
:param fid: 文件 ID
:param type: 文件类型 (2: 图片, 3: 音频, 15: 视频)
:raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据
:raises ValueError: 参数出错, 错误原因直接打印异常即可 (常见错误内容: ``system ... | def send_file(self, fakeid, fid, type):
"""
向特定用户发送媒体文件
:param fakeid: 用户 UID (即 fakeid)
:param fid: 文件 ID
:param type: 文件类型 (2: 图片, 3: 音频, 15: 视频)
:raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据
:raises ValueError: 参数出错, 错误原因直接打印异常即可 (常见错误内容: ``system ... | [
"向特定用户发送媒体文件",
":",
"param",
"fakeid",
":",
"用户",
"UID",
"(",
"即",
"fakeid",
")",
":",
"param",
"fid",
":",
"文件",
"ID",
":",
"param",
"type",
":",
"文件类型",
"(",
"2",
":",
"图片",
"3",
":",
"音频",
"15",
":",
"视频",
")",
":",
"raises",
"NeedLoginError",... | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/ext.py#L808-L868 | [
"def",
"send_file",
"(",
"self",
",",
"fakeid",
",",
"fid",
",",
"type",
")",
":",
"if",
"type",
"==",
"4",
":",
"# 此处判断为兼容历史版本, 微信官方已经将视频类型修改为 15",
"type",
"=",
"15",
"url",
"=",
"'https://mp.weixin.qq.com/cgi-bin/singlesend?t=ajax-response&f=json&token={token}&lang=zh... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatExt.get_user_info | 获取指定用户的个人信息
返回JSON示例::
{
"province": "湖北",
"city": "武汉",
"gender": 1,
"nick_name": "Doraemonext",
"country": "中国",
"remark_name": "",
"fake_id": 844735403,
"signature": "... | wechat_sdk/ext.py | def get_user_info(self, fakeid):
"""
获取指定用户的个人信息
返回JSON示例::
{
"province": "湖北",
"city": "武汉",
"gender": 1,
"nick_name": "Doraemonext",
"country": "中国",
"remark_name": "",
... | def get_user_info(self, fakeid):
"""
获取指定用户的个人信息
返回JSON示例::
{
"province": "湖北",
"city": "武汉",
"gender": 1,
"nick_name": "Doraemonext",
"country": "中国",
"remark_name": "",
... | [
"获取指定用户的个人信息"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/ext.py#L966-L1012 | [
"def",
"get_user_info",
"(",
"self",
",",
"fakeid",
")",
":",
"url",
"=",
"'https://mp.weixin.qq.com/cgi-bin/getcontactinfo'",
"payloads",
"=",
"{",
"'ajax'",
":",
"1",
",",
"'lang'",
":",
"'zh_CN'",
",",
"'random'",
":",
"round",
"(",
"random",
".",
"random",... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatExt.get_avatar | 获取用户头像信息
:param fakeid: 用户的 UID (即 fakeid)
:return: 二进制 JPG 数据字符串, 可直接作为 File Object 中 write 的参数
:raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据 | wechat_sdk/ext.py | def get_avatar(self, fakeid):
"""
获取用户头像信息
:param fakeid: 用户的 UID (即 fakeid)
:return: 二进制 JPG 数据字符串, 可直接作为 File Object 中 write 的参数
:raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据
"""
url = 'https://mp.weixin.qq.com/misc/getheadimg?fakeid={fakeid}&token=... | def get_avatar(self, fakeid):
"""
获取用户头像信息
:param fakeid: 用户的 UID (即 fakeid)
:return: 二进制 JPG 数据字符串, 可直接作为 File Object 中 write 的参数
:raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据
"""
url = 'https://mp.weixin.qq.com/misc/getheadimg?fakeid={fakeid}&token=... | [
"获取用户头像信息",
":",
"param",
"fakeid",
":",
"用户的",
"UID",
"(",
"即",
"fakeid",
")",
":",
"return",
":",
"二进制",
"JPG",
"数据字符串",
"可直接作为",
"File",
"Object",
"中",
"write",
"的参数",
":",
"raises",
"NeedLoginError",
":",
"操作未执行成功",
"需要再次尝试登录",
"异常内容为服务器返回的错误数据"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/ext.py#L1014-L1034 | [
"def",
"get_avatar",
"(",
"self",
",",
"fakeid",
")",
":",
"url",
"=",
"'https://mp.weixin.qq.com/misc/getheadimg?fakeid={fakeid}&token={token}&lang=zh_CN'",
".",
"format",
"(",
"fakeid",
"=",
"fakeid",
",",
"token",
"=",
"self",
".",
"__token",
",",
")",
"headers",... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatExt.get_new_message_num | 获取新消息的数目
:param lastid: 最近获取的消息 ID, 为 0 时获取总消息数目
:return: 消息数目 | wechat_sdk/ext.py | def get_new_message_num(self, lastid=0):
"""
获取新消息的数目
:param lastid: 最近获取的消息 ID, 为 0 时获取总消息数目
:return: 消息数目
"""
url = 'https://mp.weixin.qq.com/cgi-bin/getnewmsgnum?f=json&t=ajax-getmsgnum&lastmsgid={lastid}&token={token}&lang=zh_CN'.format(
lastid=lastid,
... | def get_new_message_num(self, lastid=0):
"""
获取新消息的数目
:param lastid: 最近获取的消息 ID, 为 0 时获取总消息数目
:return: 消息数目
"""
url = 'https://mp.weixin.qq.com/cgi-bin/getnewmsgnum?f=json&t=ajax-getmsgnum&lastmsgid={lastid}&token={token}&lang=zh_CN'.format(
lastid=lastid,
... | [
"获取新消息的数目",
":",
"param",
"lastid",
":",
"最近获取的消息",
"ID",
"为",
"0",
"时获取总消息数目",
":",
"return",
":",
"消息数目"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/ext.py#L1036-L1065 | [
"def",
"get_new_message_num",
"(",
"self",
",",
"lastid",
"=",
"0",
")",
":",
"url",
"=",
"'https://mp.weixin.qq.com/cgi-bin/getnewmsgnum?f=json&t=ajax-getmsgnum&lastmsgid={lastid}&token={token}&lang=zh_CN'",
".",
"format",
"(",
"lastid",
"=",
"lastid",
",",
"token",
"=",
... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatExt.get_message_list | 获取消息列表
返回JSON示例::
{
"msg_item": [
{
"id": 206439583,
"type": 1,
"fakeid": "844735403",
"nick_name": "Doraemonext",
"date_time": 1408671892,
... | wechat_sdk/ext.py | def get_message_list(self, lastid=0, offset=0, count=20, day=7, star=False):
"""
获取消息列表
返回JSON示例::
{
"msg_item": [
{
"id": 206439583,
"type": 1,
"fakeid": "844735403",
... | def get_message_list(self, lastid=0, offset=0, count=20, day=7, star=False):
"""
获取消息列表
返回JSON示例::
{
"msg_item": [
{
"id": 206439583,
"type": 1,
"fakeid": "844735403",
... | [
"获取消息列表"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/ext.py#L1101-L1184 | [
"def",
"get_message_list",
"(",
"self",
",",
"lastid",
"=",
"0",
",",
"offset",
"=",
"0",
",",
"count",
"=",
"20",
",",
"day",
"=",
"7",
",",
"star",
"=",
"False",
")",
":",
"if",
"star",
":",
"star_param",
"=",
"'&action=star'",
"else",
":",
"star... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatExt.get_message_voice | 根据消息 ID 获取语音消息内容
:param msgid: 消息 ID
:return: 二进制 MP3 音频字符串, 可直接作为 File Object 中 write 的参数
:raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据
:raises ValueError: 参数出错, 错误原因直接打印异常即可, 错误内容: ``voice message not exist``: msg参数无效 | wechat_sdk/ext.py | def get_message_voice(self, msgid):
"""
根据消息 ID 获取语音消息内容
:param msgid: 消息 ID
:return: 二进制 MP3 音频字符串, 可直接作为 File Object 中 write 的参数
:raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据
:raises ValueError: 参数出错, 错误原因直接打印异常即可, 错误内容: ``voice message not exist``: msg参数无效... | def get_message_voice(self, msgid):
"""
根据消息 ID 获取语音消息内容
:param msgid: 消息 ID
:return: 二进制 MP3 音频字符串, 可直接作为 File Object 中 write 的参数
:raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据
:raises ValueError: 参数出错, 错误原因直接打印异常即可, 错误内容: ``voice message not exist``: msg参数无效... | [
"根据消息",
"ID",
"获取语音消息内容",
":",
"param",
"msgid",
":",
"消息",
"ID",
":",
"return",
":",
"二进制",
"MP3",
"音频字符串",
"可直接作为",
"File",
"Object",
"中",
"write",
"的参数",
":",
"raises",
"NeedLoginError",
":",
"操作未执行成功",
"需要再次尝试登录",
"异常内容为服务器返回的错误数据",
":",
"raises",
"Val... | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/ext.py#L1221-L1249 | [
"def",
"get_message_voice",
"(",
"self",
",",
"msgid",
")",
":",
"url",
"=",
"'https://mp.weixin.qq.com/cgi-bin/getvoicedata?msgid={msgid}&fileid=&token={token}&lang=zh_CN'",
".",
"format",
"(",
"msgid",
"=",
"msgid",
",",
"token",
"=",
"self",
".",
"__token",
",",
")... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatExt._init_self_information | 初始化公众号自身的属性值 (目前包括 ``Ticket`` 值 及 公众号自身的 ``fakeid`` 值)
:raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据 | wechat_sdk/ext.py | def _init_self_information(self):
"""
初始化公众号自身的属性值 (目前包括 ``Ticket`` 值 及 公众号自身的 ``fakeid`` 值)
:raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据
"""
url = 'https://mp.weixin.qq.com/cgi-bin/home?t=home/index&lang=zh_CN&token={token}'.format(token=self.__token)
heade... | def _init_self_information(self):
"""
初始化公众号自身的属性值 (目前包括 ``Ticket`` 值 及 公众号自身的 ``fakeid`` 值)
:raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据
"""
url = 'https://mp.weixin.qq.com/cgi-bin/home?t=home/index&lang=zh_CN&token={token}'.format(token=self.__token)
heade... | [
"初始化公众号自身的属性值",
"(",
"目前包括",
"Ticket",
"值",
"及",
"公众号自身的",
"fakeid",
"值",
")",
":",
"raises",
"NeedLoginError",
":",
"操作未执行成功",
"需要再次尝试登录",
"异常内容为服务器返回的错误数据"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/ext.py#L1297-L1326 | [
"def",
"_init_self_information",
"(",
"self",
")",
":",
"url",
"=",
"'https://mp.weixin.qq.com/cgi-bin/home?t=home/index&lang=zh_CN&token={token}'",
".",
"format",
"(",
"token",
"=",
"self",
".",
"__token",
")",
"headers",
"=",
"{",
"'x-requested-with'",
":",
"'XMLHttpR... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatExt._init_plugin_token_appid | 初始化公众号的 ``PluginToken`` 值及公众号自身的 ``appid`` 值
:raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据 | wechat_sdk/ext.py | def _init_plugin_token_appid(self):
"""
初始化公众号的 ``PluginToken`` 值及公众号自身的 ``appid`` 值
:raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据
"""
if not self.__plugin_token or not self.__appid:
url = 'https://mp.weixin.qq.com/misc/pluginloginpage?action=stat_article... | def _init_plugin_token_appid(self):
"""
初始化公众号的 ``PluginToken`` 值及公众号自身的 ``appid`` 值
:raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据
"""
if not self.__plugin_token or not self.__appid:
url = 'https://mp.weixin.qq.com/misc/pluginloginpage?action=stat_article... | [
"初始化公众号的",
"PluginToken",
"值及公众号自身的",
"appid",
"值",
":",
"raises",
"NeedLoginError",
":",
"操作未执行成功",
"需要再次尝试登录",
"异常内容为服务器返回的错误数据"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/ext.py#L1344-L1370 | [
"def",
"_init_plugin_token_appid",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__plugin_token",
"or",
"not",
"self",
".",
"__appid",
":",
"url",
"=",
"'https://mp.weixin.qq.com/misc/pluginloginpage?action=stat_article_detail&pluginid=luopan&t=statistics/index&token={token... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatConf.set_appid_appsecret | 设置当前 App ID 及 App Secret | wechat_sdk/core/conf.py | def set_appid_appsecret(self, appid, appsecret):
""" 设置当前 App ID 及 App Secret"""
self.__appid = appid
self.__appsecret = appsecret
self._update_crypto() | def set_appid_appsecret(self, appid, appsecret):
""" 设置当前 App ID 及 App Secret"""
self.__appid = appid
self.__appsecret = appsecret
self._update_crypto() | [
"设置当前",
"App",
"ID",
"及",
"App",
"Secret"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/core/conf.py#L111-L115 | [
"def",
"set_appid_appsecret",
"(",
"self",
",",
"appid",
",",
"appsecret",
")",
":",
"self",
".",
"__appid",
"=",
"appid",
"self",
".",
"__appsecret",
"=",
"appsecret",
"self",
".",
"_update_crypto",
"(",
")"
] | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatConf.access_token | 获取当前 access token 值, 本方法会自行维护 access token 有效性 | wechat_sdk/core/conf.py | def access_token(self):
""" 获取当前 access token 值, 本方法会自行维护 access token 有效性 """
self._check_appid_appsecret()
if callable(self.__access_token_getfunc):
self.__access_token, self.__access_token_expires_at = self.__access_token_getfunc()
if self.__access_token:
now... | def access_token(self):
""" 获取当前 access token 值, 本方法会自行维护 access token 有效性 """
self._check_appid_appsecret()
if callable(self.__access_token_getfunc):
self.__access_token, self.__access_token_expires_at = self.__access_token_getfunc()
if self.__access_token:
now... | [
"获取当前",
"access",
"token",
"值",
"本方法会自行维护",
"access",
"token",
"有效性"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/core/conf.py#L144-L157 | [
"def",
"access_token",
"(",
"self",
")",
":",
"self",
".",
"_check_appid_appsecret",
"(",
")",
"if",
"callable",
"(",
"self",
".",
"__access_token_getfunc",
")",
":",
"self",
".",
"__access_token",
",",
"self",
".",
"__access_token_expires_at",
"=",
"self",
".... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatConf.jsapi_ticket | 获取当前 jsapi ticket 值, 本方法会自行维护 jsapi ticket 有效性 | wechat_sdk/core/conf.py | def jsapi_ticket(self):
""" 获取当前 jsapi ticket 值, 本方法会自行维护 jsapi ticket 有效性 """
self._check_appid_appsecret()
if callable(self.__jsapi_ticket_getfunc):
self.__jsapi_ticket, self.__jsapi_ticket_expires_at = self.__jsapi_ticket_getfunc()
if self.__jsapi_ticket:
now... | def jsapi_ticket(self):
""" 获取当前 jsapi ticket 值, 本方法会自行维护 jsapi ticket 有效性 """
self._check_appid_appsecret()
if callable(self.__jsapi_ticket_getfunc):
self.__jsapi_ticket, self.__jsapi_ticket_expires_at = self.__jsapi_ticket_getfunc()
if self.__jsapi_ticket:
now... | [
"获取当前",
"jsapi",
"ticket",
"值",
"本方法会自行维护",
"jsapi",
"ticket",
"有效性"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/core/conf.py#L160-L173 | [
"def",
"jsapi_ticket",
"(",
"self",
")",
":",
"self",
".",
"_check_appid_appsecret",
"(",
")",
"if",
"callable",
"(",
"self",
".",
"__jsapi_ticket_getfunc",
")",
":",
"self",
".",
"__jsapi_ticket",
",",
"self",
".",
"__jsapi_ticket_expires_at",
"=",
"self",
".... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatConf.grant_access_token | 获取 access token 并更新当前配置
:return: 返回的 JSON 数据包 (传入 access_token_refreshfunc 参数后返回 None) | wechat_sdk/core/conf.py | def grant_access_token(self):
"""
获取 access token 并更新当前配置
:return: 返回的 JSON 数据包 (传入 access_token_refreshfunc 参数后返回 None)
"""
self._check_appid_appsecret()
if callable(self.__access_token_refreshfunc):
self.__access_token, self.__access_token_expires_at = self... | def grant_access_token(self):
"""
获取 access token 并更新当前配置
:return: 返回的 JSON 数据包 (传入 access_token_refreshfunc 参数后返回 None)
"""
self._check_appid_appsecret()
if callable(self.__access_token_refreshfunc):
self.__access_token, self.__access_token_expires_at = self... | [
"获取",
"access",
"token",
"并更新当前配置",
":",
"return",
":",
"返回的",
"JSON",
"数据包",
"(",
"传入",
"access_token_refreshfunc",
"参数后返回",
"None",
")"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/core/conf.py#L190-L216 | [
"def",
"grant_access_token",
"(",
"self",
")",
":",
"self",
".",
"_check_appid_appsecret",
"(",
")",
"if",
"callable",
"(",
"self",
".",
"__access_token_refreshfunc",
")",
":",
"self",
".",
"__access_token",
",",
"self",
".",
"__access_token_expires_at",
"=",
"s... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatConf.grant_jsapi_ticket | 获取 jsapi ticket 并更新当前配置
:return: 返回的 JSON 数据包 (传入 jsapi_ticket_refreshfunc 参数后返回 None) | wechat_sdk/core/conf.py | def grant_jsapi_ticket(self):
"""
获取 jsapi ticket 并更新当前配置
:return: 返回的 JSON 数据包 (传入 jsapi_ticket_refreshfunc 参数后返回 None)
"""
self._check_appid_appsecret()
if callable(self.__jsapi_ticket_refreshfunc):
self.__jsapi_ticket, self.__jsapi_ticket_expires_at = self... | def grant_jsapi_ticket(self):
"""
获取 jsapi ticket 并更新当前配置
:return: 返回的 JSON 数据包 (传入 jsapi_ticket_refreshfunc 参数后返回 None)
"""
self._check_appid_appsecret()
if callable(self.__jsapi_ticket_refreshfunc):
self.__jsapi_ticket, self.__jsapi_ticket_expires_at = self... | [
"获取",
"jsapi",
"ticket",
"并更新当前配置",
":",
"return",
":",
"返回的",
"JSON",
"数据包",
"(",
"传入",
"jsapi_ticket_refreshfunc",
"参数后返回",
"None",
")"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/core/conf.py#L218-L242 | [
"def",
"grant_jsapi_ticket",
"(",
"self",
")",
":",
"self",
".",
"_check_appid_appsecret",
"(",
")",
"if",
"callable",
"(",
"self",
".",
"__jsapi_ticket_refreshfunc",
")",
":",
"self",
".",
"__jsapi_ticket",
",",
"self",
".",
"__jsapi_ticket_expires_at",
"=",
"s... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatConf._update_crypto | 根据当前配置内容更新 Crypto 类 | wechat_sdk/core/conf.py | def _update_crypto(self):
"""
根据当前配置内容更新 Crypto 类
"""
if self.__encrypt_mode in ['compatible', 'safe'] and self.__encoding_aes_key is not None:
if self.__token is None or self.__appid is None:
raise NeedParamError('Please provide token and appid parameters in ... | def _update_crypto(self):
"""
根据当前配置内容更新 Crypto 类
"""
if self.__encrypt_mode in ['compatible', 'safe'] and self.__encoding_aes_key is not None:
if self.__token is None or self.__appid is None:
raise NeedParamError('Please provide token and appid parameters in ... | [
"根据当前配置内容更新",
"Crypto",
"类"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/core/conf.py#L286-L295 | [
"def",
"_update_crypto",
"(",
"self",
")",
":",
"if",
"self",
".",
"__encrypt_mode",
"in",
"[",
"'compatible'",
",",
"'safe'",
"]",
"and",
"self",
".",
"__encoding_aes_key",
"is",
"not",
"None",
":",
"if",
"self",
".",
"__token",
"is",
"None",
"or",
"sel... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.conf | 设置当前 WechatConf 实例 | wechat_sdk/basic.py | def conf(self, conf):
""" 设置当前 WechatConf 实例 """
self.__conf = conf
self.__request = WechatRequest(conf=self.__conf) | def conf(self, conf):
""" 设置当前 WechatConf 实例 """
self.__conf = conf
self.__request = WechatRequest(conf=self.__conf) | [
"设置当前",
"WechatConf",
"实例"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L77-L80 | [
"def",
"conf",
"(",
"self",
",",
"conf",
")",
":",
"self",
".",
"__conf",
"=",
"conf",
"self",
".",
"__request",
"=",
"WechatRequest",
"(",
"conf",
"=",
"self",
".",
"__conf",
")"
] | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.check_signature | 验证微信消息真实性
:param signature: 微信加密签名
:param timestamp: 时间戳
:param nonce: 随机数
:return: 通过验证返回 True, 未通过验证返回 False | wechat_sdk/basic.py | def check_signature(self, signature, timestamp, nonce):
"""
验证微信消息真实性
:param signature: 微信加密签名
:param timestamp: 时间戳
:param nonce: 随机数
:return: 通过验证返回 True, 未通过验证返回 False
"""
if not signature or not timestamp or not nonce:
return False
... | def check_signature(self, signature, timestamp, nonce):
"""
验证微信消息真实性
:param signature: 微信加密签名
:param timestamp: 时间戳
:param nonce: 随机数
:return: 通过验证返回 True, 未通过验证返回 False
"""
if not signature or not timestamp or not nonce:
return False
... | [
"验证微信消息真实性",
":",
"param",
"signature",
":",
"微信加密签名",
":",
"param",
"timestamp",
":",
"时间戳",
":",
"param",
"nonce",
":",
"随机数",
":",
"return",
":",
"通过验证返回",
"True",
"未通过验证返回",
"False"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L92-L109 | [
"def",
"check_signature",
"(",
"self",
",",
"signature",
",",
"timestamp",
",",
"nonce",
")",
":",
"if",
"not",
"signature",
"or",
"not",
"timestamp",
"or",
"not",
"nonce",
":",
"return",
"False",
"tmp_list",
"=",
"[",
"self",
".",
"conf",
".",
"token",
... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.generate_jsapi_signature | 使用 jsapi_ticket 对 url 进行签名
:param timestamp: 时间戳
:param noncestr: 随机数
:param url: 要签名的 url,不包含 # 及其后面部分
:param jsapi_ticket: (可选参数) jsapi_ticket 值 (如不提供将自动通过 appid 和 appsecret 获取)
:return: 返回sha1签名的hexdigest值 | wechat_sdk/basic.py | def generate_jsapi_signature(self, timestamp, noncestr, url, jsapi_ticket=None):
"""
使用 jsapi_ticket 对 url 进行签名
:param timestamp: 时间戳
:param noncestr: 随机数
:param url: 要签名的 url,不包含 # 及其后面部分
:param jsapi_ticket: (可选参数) jsapi_ticket 值 (如不提供将自动通过 appid 和 appsecret 获取)
... | def generate_jsapi_signature(self, timestamp, noncestr, url, jsapi_ticket=None):
"""
使用 jsapi_ticket 对 url 进行签名
:param timestamp: 时间戳
:param noncestr: 随机数
:param url: 要签名的 url,不包含 # 及其后面部分
:param jsapi_ticket: (可选参数) jsapi_ticket 值 (如不提供将自动通过 appid 和 appsecret 获取)
... | [
"使用",
"jsapi_ticket",
"对",
"url",
"进行签名",
":",
"param",
"timestamp",
":",
"时间戳",
":",
"param",
"noncestr",
":",
"随机数",
":",
"param",
"url",
":",
"要签名的",
"url,不包含",
"#",
"及其后面部分",
":",
"param",
"jsapi_ticket",
":",
"(",
"可选参数",
")",
"jsapi_ticket",
"值",
... | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L111-L132 | [
"def",
"generate_jsapi_signature",
"(",
"self",
",",
"timestamp",
",",
"noncestr",
",",
"url",
",",
"jsapi_ticket",
"=",
"None",
")",
":",
"if",
"not",
"jsapi_ticket",
":",
"jsapi_ticket",
"=",
"self",
".",
"conf",
".",
"jsapi_ticket",
"data",
"=",
"{",
"'... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.parse_data | 解析微信服务器发送过来的数据并保存类中
:param data: HTTP Request 的 Body 数据
:param msg_signature: EncodingAESKey 的 msg_signature
:param timestamp: EncodingAESKey 用时间戳
:param nonce: EncodingAESKey 用随机数
:raises ParseError: 解析微信服务器数据错误, 数据不合法 | wechat_sdk/basic.py | def parse_data(self, data, msg_signature=None, timestamp=None, nonce=None):
"""
解析微信服务器发送过来的数据并保存类中
:param data: HTTP Request 的 Body 数据
:param msg_signature: EncodingAESKey 的 msg_signature
:param timestamp: EncodingAESKey 用时间戳
:param nonce: EncodingAESKey 用随机数
:ra... | def parse_data(self, data, msg_signature=None, timestamp=None, nonce=None):
"""
解析微信服务器发送过来的数据并保存类中
:param data: HTTP Request 的 Body 数据
:param msg_signature: EncodingAESKey 的 msg_signature
:param timestamp: EncodingAESKey 用时间戳
:param nonce: EncodingAESKey 用随机数
:ra... | [
"解析微信服务器发送过来的数据并保存类中",
":",
"param",
"data",
":",
"HTTP",
"Request",
"的",
"Body",
"数据",
":",
"param",
"msg_signature",
":",
"EncodingAESKey",
"的",
"msg_signature",
":",
"param",
"timestamp",
":",
"EncodingAESKey",
"用时间戳",
":",
"param",
"nonce",
":",
"EncodingAES... | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L134-L168 | [
"def",
"parse_data",
"(",
"self",
",",
"data",
",",
"msg_signature",
"=",
"None",
",",
"timestamp",
"=",
"None",
",",
"nonce",
"=",
"None",
")",
":",
"result",
"=",
"{",
"}",
"if",
"isinstance",
"(",
"data",
",",
"six",
".",
"text_type",
")",
":",
... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.response_text | 将文字信息 content 组装为符合微信服务器要求的响应数据
:param content: 回复文字
:param escape: 是否转义该文本内容 (默认不转义)
:return: 符合微信服务器要求的 XML 响应数据 | wechat_sdk/basic.py | def response_text(self, content, escape=False):
"""
将文字信息 content 组装为符合微信服务器要求的响应数据
:param content: 回复文字
:param escape: 是否转义该文本内容 (默认不转义)
:return: 符合微信服务器要求的 XML 响应数据
"""
self._check_parse()
content = self._transcoding(content)
if escape:
... | def response_text(self, content, escape=False):
"""
将文字信息 content 组装为符合微信服务器要求的响应数据
:param content: 回复文字
:param escape: 是否转义该文本内容 (默认不转义)
:return: 符合微信服务器要求的 XML 响应数据
"""
self._check_parse()
content = self._transcoding(content)
if escape:
... | [
"将文字信息",
"content",
"组装为符合微信服务器要求的响应数据",
":",
"param",
"content",
":",
"回复文字",
":",
"param",
"escape",
":",
"是否转义该文本内容",
"(",
"默认不转义",
")",
":",
"return",
":",
"符合微信服务器要求的",
"XML",
"响应数据"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L207-L224 | [
"def",
"response_text",
"(",
"self",
",",
"content",
",",
"escape",
"=",
"False",
")",
":",
"self",
".",
"_check_parse",
"(",
")",
"content",
"=",
"self",
".",
"_transcoding",
"(",
"content",
")",
"if",
"escape",
":",
"if",
"six",
".",
"PY2",
":",
"c... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.response_image | 将 media_id 所代表的图片组装为符合微信服务器要求的响应数据
:param media_id: 图片的 MediaID
:return: 符合微信服务器要求的 XML 响应数据 | wechat_sdk/basic.py | def response_image(self, media_id):
"""
将 media_id 所代表的图片组装为符合微信服务器要求的响应数据
:param media_id: 图片的 MediaID
:return: 符合微信服务器要求的 XML 响应数据
"""
self._check_parse()
response = ImageReply(message=self.__message, media_id=media_id).render()
return self._encrypt_res... | def response_image(self, media_id):
"""
将 media_id 所代表的图片组装为符合微信服务器要求的响应数据
:param media_id: 图片的 MediaID
:return: 符合微信服务器要求的 XML 响应数据
"""
self._check_parse()
response = ImageReply(message=self.__message, media_id=media_id).render()
return self._encrypt_res... | [
"将",
"media_id",
"所代表的图片组装为符合微信服务器要求的响应数据",
":",
"param",
"media_id",
":",
"图片的",
"MediaID",
":",
"return",
":",
"符合微信服务器要求的",
"XML",
"响应数据"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L226-L235 | [
"def",
"response_image",
"(",
"self",
",",
"media_id",
")",
":",
"self",
".",
"_check_parse",
"(",
")",
"response",
"=",
"ImageReply",
"(",
"message",
"=",
"self",
".",
"__message",
",",
"media_id",
"=",
"media_id",
")",
".",
"render",
"(",
")",
"return"... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.response_voice | 将 media_id 所代表的语音组装为符合微信服务器要求的响应数据
:param media_id: 语音的 MediaID
:return: 符合微信服务器要求的 XML 响应数据 | wechat_sdk/basic.py | def response_voice(self, media_id):
"""
将 media_id 所代表的语音组装为符合微信服务器要求的响应数据
:param media_id: 语音的 MediaID
:return: 符合微信服务器要求的 XML 响应数据
"""
self._check_parse()
response = VoiceReply(message=self.__message, media_id=media_id).render()
return self._encrypt_res... | def response_voice(self, media_id):
"""
将 media_id 所代表的语音组装为符合微信服务器要求的响应数据
:param media_id: 语音的 MediaID
:return: 符合微信服务器要求的 XML 响应数据
"""
self._check_parse()
response = VoiceReply(message=self.__message, media_id=media_id).render()
return self._encrypt_res... | [
"将",
"media_id",
"所代表的语音组装为符合微信服务器要求的响应数据",
":",
"param",
"media_id",
":",
"语音的",
"MediaID",
":",
"return",
":",
"符合微信服务器要求的",
"XML",
"响应数据"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L237-L246 | [
"def",
"response_voice",
"(",
"self",
",",
"media_id",
")",
":",
"self",
".",
"_check_parse",
"(",
")",
"response",
"=",
"VoiceReply",
"(",
"message",
"=",
"self",
".",
"__message",
",",
"media_id",
"=",
"media_id",
")",
".",
"render",
"(",
")",
"return"... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.response_video | 将 media_id 所代表的视频组装为符合微信服务器要求的响应数据
:param media_id: 视频的 MediaID
:param title: 视频消息的标题
:param description: 视频消息的描述
:return: 符合微信服务器要求的 XML 响应数据 | wechat_sdk/basic.py | def response_video(self, media_id, title=None, description=None):
"""
将 media_id 所代表的视频组装为符合微信服务器要求的响应数据
:param media_id: 视频的 MediaID
:param title: 视频消息的标题
:param description: 视频消息的描述
:return: 符合微信服务器要求的 XML 响应数据
"""
self._check_parse()
title = sel... | def response_video(self, media_id, title=None, description=None):
"""
将 media_id 所代表的视频组装为符合微信服务器要求的响应数据
:param media_id: 视频的 MediaID
:param title: 视频消息的标题
:param description: 视频消息的描述
:return: 符合微信服务器要求的 XML 响应数据
"""
self._check_parse()
title = sel... | [
"将",
"media_id",
"所代表的视频组装为符合微信服务器要求的响应数据",
":",
"param",
"media_id",
":",
"视频的",
"MediaID",
":",
"param",
"title",
":",
"视频消息的标题",
":",
"param",
"description",
":",
"视频消息的描述",
":",
"return",
":",
"符合微信服务器要求的",
"XML",
"响应数据"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L248-L261 | [
"def",
"response_video",
"(",
"self",
",",
"media_id",
",",
"title",
"=",
"None",
",",
"description",
"=",
"None",
")",
":",
"self",
".",
"_check_parse",
"(",
")",
"title",
"=",
"self",
".",
"_transcoding",
"(",
"title",
")",
"description",
"=",
"self",
... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.response_music | 将音乐信息组装为符合微信服务器要求的响应数据
:param music_url: 音乐链接
:param title: 音乐标题
:param description: 音乐描述
:param hq_music_url: 高质量音乐链接, WIFI环境优先使用该链接播放音乐
:param thumb_media_id: 缩略图的 MediaID
:return: 符合微信服务器要求的 XML 响应数据 | wechat_sdk/basic.py | def response_music(self, music_url, title=None, description=None, hq_music_url=None, thumb_media_id=None):
"""
将音乐信息组装为符合微信服务器要求的响应数据
:param music_url: 音乐链接
:param title: 音乐标题
:param description: 音乐描述
:param hq_music_url: 高质量音乐链接, WIFI环境优先使用该链接播放音乐
:param thumb_me... | def response_music(self, music_url, title=None, description=None, hq_music_url=None, thumb_media_id=None):
"""
将音乐信息组装为符合微信服务器要求的响应数据
:param music_url: 音乐链接
:param title: 音乐标题
:param description: 音乐描述
:param hq_music_url: 高质量音乐链接, WIFI环境优先使用该链接播放音乐
:param thumb_me... | [
"将音乐信息组装为符合微信服务器要求的响应数据",
":",
"param",
"music_url",
":",
"音乐链接",
":",
"param",
"title",
":",
"音乐标题",
":",
"param",
"description",
":",
"音乐描述",
":",
"param",
"hq_music_url",
":",
"高质量音乐链接",
"WIFI环境优先使用该链接播放音乐",
":",
"param",
"thumb_media_id",
":",
"缩略图的",
"Media... | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L263-L281 | [
"def",
"response_music",
"(",
"self",
",",
"music_url",
",",
"title",
"=",
"None",
",",
"description",
"=",
"None",
",",
"hq_music_url",
"=",
"None",
",",
"thumb_media_id",
"=",
"None",
")",
":",
"self",
".",
"_check_parse",
"(",
")",
"music_url",
"=",
"... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.response_news | 将新闻信息组装为符合微信服务器要求的响应数据
:param articles: list 对象, 每个元素为一个 dict 对象, key 包含 `title`, `description`, `picurl`, `url`
:return: 符合微信服务器要求的 XML 响应数据 | wechat_sdk/basic.py | def response_news(self, articles):
"""
将新闻信息组装为符合微信服务器要求的响应数据
:param articles: list 对象, 每个元素为一个 dict 对象, key 包含 `title`, `description`, `picurl`, `url`
:return: 符合微信服务器要求的 XML 响应数据
"""
self._check_parse()
for article in articles:
if article.get('title'... | def response_news(self, articles):
"""
将新闻信息组装为符合微信服务器要求的响应数据
:param articles: list 对象, 每个元素为一个 dict 对象, key 包含 `title`, `description`, `picurl`, `url`
:return: 符合微信服务器要求的 XML 响应数据
"""
self._check_parse()
for article in articles:
if article.get('title'... | [
"将新闻信息组装为符合微信服务器要求的响应数据",
":",
"param",
"articles",
":",
"list",
"对象",
"每个元素为一个",
"dict",
"对象",
"key",
"包含",
"title",
"description",
"picurl",
"url",
":",
"return",
":",
"符合微信服务器要求的",
"XML",
"响应数据"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L283-L305 | [
"def",
"response_news",
"(",
"self",
",",
"articles",
")",
":",
"self",
".",
"_check_parse",
"(",
")",
"for",
"article",
"in",
"articles",
":",
"if",
"article",
".",
"get",
"(",
"'title'",
")",
":",
"article",
"[",
"'title'",
"]",
"=",
"self",
".",
"... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.group_transfer_message | 将 message 群发到多客服系统
:return: 符合微信服务器要求的 XML 响应数据 | wechat_sdk/basic.py | def group_transfer_message(self):
"""
将 message 群发到多客服系统
:return: 符合微信服务器要求的 XML 响应数据
"""
self._check_parse()
response = GroupTransferReply(message=self.__message).render()
return self._encrypt_response(response) | def group_transfer_message(self):
"""
将 message 群发到多客服系统
:return: 符合微信服务器要求的 XML 响应数据
"""
self._check_parse()
response = GroupTransferReply(message=self.__message).render()
return self._encrypt_response(response) | [
"将",
"message",
"群发到多客服系统",
":",
"return",
":",
"符合微信服务器要求的",
"XML",
"响应数据"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L307-L314 | [
"def",
"group_transfer_message",
"(",
"self",
")",
":",
"self",
".",
"_check_parse",
"(",
")",
"response",
"=",
"GroupTransferReply",
"(",
"message",
"=",
"self",
".",
"__message",
")",
".",
"render",
"(",
")",
"return",
"self",
".",
"_encrypt_response",
"("... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.create_menu | 创建自定义菜单 ::
# -*- coding: utf-8 -*-
wechat = WechatBasic(appid='appid', appsecret='appsecret')
wechat.create_menu({
'button':[
{
'type': 'click',
'name': '今日歌曲',
'key': 'V1001_... | wechat_sdk/basic.py | def create_menu(self, menu_data):
"""
创建自定义菜单 ::
# -*- coding: utf-8 -*-
wechat = WechatBasic(appid='appid', appsecret='appsecret')
wechat.create_menu({
'button':[
{
'type': 'click',
... | def create_menu(self, menu_data):
"""
创建自定义菜单 ::
# -*- coding: utf-8 -*-
wechat = WechatBasic(appid='appid', appsecret='appsecret')
wechat.create_menu({
'button':[
{
'type': 'click',
... | [
"创建自定义菜单",
"::"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L332-L380 | [
"def",
"create_menu",
"(",
"self",
",",
"menu_data",
")",
":",
"menu_data",
"=",
"self",
".",
"_transcoding_dict",
"(",
"menu_data",
")",
"return",
"self",
".",
"request",
".",
"post",
"(",
"url",
"=",
"'https://api.weixin.qq.com/cgi-bin/menu/create'",
",",
"dat... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.upload_media | 上传多媒体文件
详情请参考 http://mp.weixin.qq.com/wiki/10/78b15308b053286e2a66b33f0f0f5fb6.html
:param media_type: 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)
:param media_file: 要上传的文件,一个 File object 或 StringIO object
:param extension: 如果 media_file 传入的为 StringIO object,那么必须传入 extension 显示指明该... | wechat_sdk/basic.py | def upload_media(self, media_type, media_file, extension=''):
"""
上传多媒体文件
详情请参考 http://mp.weixin.qq.com/wiki/10/78b15308b053286e2a66b33f0f0f5fb6.html
:param media_type: 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)
:param media_file: 要上传的文件,一个 File object 或 StringIO object
... | def upload_media(self, media_type, media_file, extension=''):
"""
上传多媒体文件
详情请参考 http://mp.weixin.qq.com/wiki/10/78b15308b053286e2a66b33f0f0f5fb6.html
:param media_type: 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)
:param media_file: 要上传的文件,一个 File object 或 StringIO object
... | [
"上传多媒体文件",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"10",
"/",
"78b15308b053286e2a66b33f0f0f5fb6",
".",
"html",
":",
"param",
"media_type",
":",
"媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)",
":",
"param",
... | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L398-L410 | [
"def",
"upload_media",
"(",
"self",
",",
"media_type",
",",
"media_file",
",",
"extension",
"=",
"''",
")",
":",
"if",
"six",
".",
"PY2",
":",
"return",
"self",
".",
"_upload_media_py2",
"(",
"media_type",
",",
"media_file",
",",
"extension",
")",
"else",
... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.download_media | 下载多媒体文件
详情请参考 http://mp.weixin.qq.com/wiki/10/78b15308b053286e2a66b33f0f0f5fb6.html
:param media_id: 媒体文件 ID
:return: requests 的 Response 实例 | wechat_sdk/basic.py | def download_media(self, media_id):
"""
下载多媒体文件
详情请参考 http://mp.weixin.qq.com/wiki/10/78b15308b053286e2a66b33f0f0f5fb6.html
:param media_id: 媒体文件 ID
:return: requests 的 Response 实例
"""
return self.request.get(
'https://api.weixin.qq.com/cgi-bin/media/g... | def download_media(self, media_id):
"""
下载多媒体文件
详情请参考 http://mp.weixin.qq.com/wiki/10/78b15308b053286e2a66b33f0f0f5fb6.html
:param media_id: 媒体文件 ID
:return: requests 的 Response 实例
"""
return self.request.get(
'https://api.weixin.qq.com/cgi-bin/media/g... | [
"下载多媒体文件",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"10",
"/",
"78b15308b053286e2a66b33f0f0f5fb6",
".",
"html",
":",
"param",
"media_id",
":",
"媒体文件",
"ID",
":",
"return",
":",
"requests",
"的",
"Response",... | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L461-L474 | [
"def",
"download_media",
"(",
"self",
",",
"media_id",
")",
":",
"return",
"self",
".",
"request",
".",
"get",
"(",
"'https://api.weixin.qq.com/cgi-bin/media/get'",
",",
"params",
"=",
"{",
"'media_id'",
":",
"media_id",
",",
"}",
",",
"stream",
"=",
"True",
... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.move_user | 移动用户分组
详情请参考 http://mp.weixin.qq.com/wiki/13/be5272dc4930300ba561d927aead2569.html
:param user_id: 用户 ID 。 就是你收到的 WechatMessage 的 source
:param group_id: 分组 ID
:return: 返回的 JSON 数据包 | wechat_sdk/basic.py | def move_user(self, user_id, group_id):
"""
移动用户分组
详情请参考 http://mp.weixin.qq.com/wiki/13/be5272dc4930300ba561d927aead2569.html
:param user_id: 用户 ID 。 就是你收到的 WechatMessage 的 source
:param group_id: 分组 ID
:return: 返回的 JSON 数据包
"""
return self.request.post(
... | def move_user(self, user_id, group_id):
"""
移动用户分组
详情请参考 http://mp.weixin.qq.com/wiki/13/be5272dc4930300ba561d927aead2569.html
:param user_id: 用户 ID 。 就是你收到的 WechatMessage 的 source
:param group_id: 分组 ID
:return: 返回的 JSON 数据包
"""
return self.request.post(
... | [
"移动用户分组",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"13",
"/",
"be5272dc4930300ba561d927aead2569",
".",
"html",
":",
"param",
"user_id",
":",
"用户",
"ID",
"。",
"就是你收到的",
"WechatMessage",
"的",
"source",
":",
... | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L533-L547 | [
"def",
"move_user",
"(",
"self",
",",
"user_id",
",",
"group_id",
")",
":",
"return",
"self",
".",
"request",
".",
"post",
"(",
"url",
"=",
"'https://api.weixin.qq.com/cgi-bin/groups/members/update'",
",",
"data",
"=",
"{",
"'openid'",
":",
"user_id",
",",
"'t... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.get_user_info | 获取用户基本信息
详情请参考 http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71fa0f319c66.html
:param user_id: 用户 ID, 就是你收到的 WechatMessage 的 source
:param lang: 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语
:return: 返回的 JSON 数据包 | wechat_sdk/basic.py | def get_user_info(self, user_id, lang='zh_CN'):
"""
获取用户基本信息
详情请参考 http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71fa0f319c66.html
:param user_id: 用户 ID, 就是你收到的 WechatMessage 的 source
:param lang: 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语
:return: 返回的 JSON 数据包
"""
... | def get_user_info(self, user_id, lang='zh_CN'):
"""
获取用户基本信息
详情请参考 http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71fa0f319c66.html
:param user_id: 用户 ID, 就是你收到的 WechatMessage 的 source
:param lang: 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语
:return: 返回的 JSON 数据包
"""
... | [
"获取用户基本信息",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"14",
"/",
"bb5031008f1494a59c6f71fa0f319c66",
".",
"html",
":",
"param",
"user_id",
":",
"用户",
"ID",
"就是你收到的",
"WechatMessage",
"的",
"source",
":",
"pa... | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L549-L563 | [
"def",
"get_user_info",
"(",
"self",
",",
"user_id",
",",
"lang",
"=",
"'zh_CN'",
")",
":",
"return",
"self",
".",
"request",
".",
"get",
"(",
"url",
"=",
"'https://api.weixin.qq.com/cgi-bin/user/info'",
",",
"params",
"=",
"{",
"'openid'",
":",
"user_id",
"... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.get_followers | 获取关注者列表
详情请参考 http://mp.weixin.qq.com/wiki/3/17e6919a39c1c53555185907acf70093.html
:param first_user_id: 可选。第一个拉取的OPENID,不填默认从头开始拉取
:return: 返回的 JSON 数据包 | wechat_sdk/basic.py | def get_followers(self, first_user_id=None):
"""
获取关注者列表
详情请参考 http://mp.weixin.qq.com/wiki/3/17e6919a39c1c53555185907acf70093.html
:param first_user_id: 可选。第一个拉取的OPENID,不填默认从头开始拉取
:return: 返回的 JSON 数据包
"""
params = dict()
if first_user_id:
par... | def get_followers(self, first_user_id=None):
"""
获取关注者列表
详情请参考 http://mp.weixin.qq.com/wiki/3/17e6919a39c1c53555185907acf70093.html
:param first_user_id: 可选。第一个拉取的OPENID,不填默认从头开始拉取
:return: 返回的 JSON 数据包
"""
params = dict()
if first_user_id:
par... | [
"获取关注者列表",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"3",
"/",
"17e6919a39c1c53555185907acf70093",
".",
"html",
":",
"param",
"first_user_id",
":",
"可选。第一个拉取的OPENID,不填默认从头开始拉取",
":",
"return",
":",
"返回的",
"JSON... | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L565-L575 | [
"def",
"get_followers",
"(",
"self",
",",
"first_user_id",
"=",
"None",
")",
":",
"params",
"=",
"dict",
"(",
")",
"if",
"first_user_id",
":",
"params",
"[",
"'next_openid'",
"]",
"=",
"first_user_id",
"return",
"self",
".",
"request",
".",
"get",
"(",
"... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.send_text_message | 发送文本消息
详情请参考 http://mp.weixin.qq.com/wiki/7/12a5a320ae96fecdf0e15cb06123de9f.html
:param user_id: 用户 ID, 就是你收到的 WechatMessage 的 source
:param content: 消息正文
:return: 返回的 JSON 数据包 | wechat_sdk/basic.py | def send_text_message(self, user_id, content):
"""
发送文本消息
详情请参考 http://mp.weixin.qq.com/wiki/7/12a5a320ae96fecdf0e15cb06123de9f.html
:param user_id: 用户 ID, 就是你收到的 WechatMessage 的 source
:param content: 消息正文
:return: 返回的 JSON 数据包
"""
return self.request.pos... | def send_text_message(self, user_id, content):
"""
发送文本消息
详情请参考 http://mp.weixin.qq.com/wiki/7/12a5a320ae96fecdf0e15cb06123de9f.html
:param user_id: 用户 ID, 就是你收到的 WechatMessage 的 source
:param content: 消息正文
:return: 返回的 JSON 数据包
"""
return self.request.pos... | [
"发送文本消息",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"7",
"/",
"12a5a320ae96fecdf0e15cb06123de9f",
".",
"html",
":",
"param",
"user_id",
":",
"用户",
"ID",
"就是你收到的",
"WechatMessage",
"的",
"source",
":",
"param... | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L577-L594 | [
"def",
"send_text_message",
"(",
"self",
",",
"user_id",
",",
"content",
")",
":",
"return",
"self",
".",
"request",
".",
"post",
"(",
"url",
"=",
"'https://api.weixin.qq.com/cgi-bin/message/custom/send'",
",",
"data",
"=",
"{",
"'touser'",
":",
"user_id",
",",
... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.send_image_message | 发送图片消息
详情请参考 http://mp.weixin.qq.com/wiki/7/12a5a320ae96fecdf0e15cb06123de9f.html
:param user_id: 用户 ID, 就是你收到的 WechatMessage 的 source
:param media_id: 图片的媒体ID。 可以通过 :func:`upload_media` 上传。
:return: 返回的 JSON 数据包 | wechat_sdk/basic.py | def send_image_message(self, user_id, media_id):
"""
发送图片消息
详情请参考 http://mp.weixin.qq.com/wiki/7/12a5a320ae96fecdf0e15cb06123de9f.html
:param user_id: 用户 ID, 就是你收到的 WechatMessage 的 source
:param media_id: 图片的媒体ID。 可以通过 :func:`upload_media` 上传。
:return: 返回的 JSON 数据包
... | def send_image_message(self, user_id, media_id):
"""
发送图片消息
详情请参考 http://mp.weixin.qq.com/wiki/7/12a5a320ae96fecdf0e15cb06123de9f.html
:param user_id: 用户 ID, 就是你收到的 WechatMessage 的 source
:param media_id: 图片的媒体ID。 可以通过 :func:`upload_media` 上传。
:return: 返回的 JSON 数据包
... | [
"发送图片消息",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"7",
"/",
"12a5a320ae96fecdf0e15cb06123de9f",
".",
"html",
":",
"param",
"user_id",
":",
"用户",
"ID",
"就是你收到的",
"WechatMessage",
"的",
"source",
":",
"param... | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L596-L613 | [
"def",
"send_image_message",
"(",
"self",
",",
"user_id",
",",
"media_id",
")",
":",
"return",
"self",
".",
"request",
".",
"post",
"(",
"url",
"=",
"'https://api.weixin.qq.com/cgi-bin/message/custom/send'",
",",
"data",
"=",
"{",
"'touser'",
":",
"user_id",
","... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.send_voice_message | 发送语音消息
详情请参考 http://mp.weixin.qq.com/wiki/7/12a5a320ae96fecdf0e15cb06123de9f.html
:param user_id: 用户 ID, 就是你收到的 WechatMessage 的 source
:param media_id: 发送的语音的媒体ID。 可以通过 :func:`upload_media` 上传。
:return: 返回的 JSON 数据包 | wechat_sdk/basic.py | def send_voice_message(self, user_id, media_id):
"""
发送语音消息
详情请参考 http://mp.weixin.qq.com/wiki/7/12a5a320ae96fecdf0e15cb06123de9f.html
:param user_id: 用户 ID, 就是你收到的 WechatMessage 的 source
:param media_id: 发送的语音的媒体ID。 可以通过 :func:`upload_media` 上传。
:return: 返回的 JSON 数据包
... | def send_voice_message(self, user_id, media_id):
"""
发送语音消息
详情请参考 http://mp.weixin.qq.com/wiki/7/12a5a320ae96fecdf0e15cb06123de9f.html
:param user_id: 用户 ID, 就是你收到的 WechatMessage 的 source
:param media_id: 发送的语音的媒体ID。 可以通过 :func:`upload_media` 上传。
:return: 返回的 JSON 数据包
... | [
"发送语音消息",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"7",
"/",
"12a5a320ae96fecdf0e15cb06123de9f",
".",
"html",
":",
"param",
"user_id",
":",
"用户",
"ID",
"就是你收到的",
"WechatMessage",
"的",
"source",
":",
"param... | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L615-L632 | [
"def",
"send_voice_message",
"(",
"self",
",",
"user_id",
",",
"media_id",
")",
":",
"return",
"self",
".",
"request",
".",
"post",
"(",
"url",
"=",
"'https://api.weixin.qq.com/cgi-bin/message/custom/send'",
",",
"data",
"=",
"{",
"'touser'",
":",
"user_id",
","... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.send_video_message | 发送视频消息
详情请参考 http://mp.weixin.qq.com/wiki/7/12a5a320ae96fecdf0e15cb06123de9f.html
:param user_id: 用户 ID, 就是你收到的 WechatMessage 的 source
:param media_id: 发送的视频的媒体ID。 可以通过 :func:`upload_media` 上传。
:param title: 视频消息的标题
:param description: 视频消息的描述
:return: 返回的 JSON 数据包 | wechat_sdk/basic.py | def send_video_message(self, user_id, media_id, title=None, description=None):
"""
发送视频消息
详情请参考 http://mp.weixin.qq.com/wiki/7/12a5a320ae96fecdf0e15cb06123de9f.html
:param user_id: 用户 ID, 就是你收到的 WechatMessage 的 source
:param media_id: 发送的视频的媒体ID。 可以通过 :func:`upload_media` 上传。
... | def send_video_message(self, user_id, media_id, title=None, description=None):
"""
发送视频消息
详情请参考 http://mp.weixin.qq.com/wiki/7/12a5a320ae96fecdf0e15cb06123de9f.html
:param user_id: 用户 ID, 就是你收到的 WechatMessage 的 source
:param media_id: 发送的视频的媒体ID。 可以通过 :func:`upload_media` 上传。
... | [
"发送视频消息",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"7",
"/",
"12a5a320ae96fecdf0e15cb06123de9f",
".",
"html",
":",
"param",
"user_id",
":",
"用户",
"ID",
"就是你收到的",
"WechatMessage",
"的",
"source",
":",
"param... | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L634-L659 | [
"def",
"send_video_message",
"(",
"self",
",",
"user_id",
",",
"media_id",
",",
"title",
"=",
"None",
",",
"description",
"=",
"None",
")",
":",
"video_data",
"=",
"{",
"'media_id'",
":",
"media_id",
",",
"}",
"if",
"title",
":",
"video_data",
"[",
"'tit... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.send_article_message | 发送图文消息
详情请参考 http://mp.weixin.qq.com/wiki/7/12a5a320ae96fecdf0e15cb06123de9f.html
:param user_id: 用户 ID, 就是你收到的 WechatMessage 的 source
:param articles: list 对象, 每个元素为一个 dict 对象, key 包含 `title`, `description`, `picurl`, `url`
:param media_id: 待发送的图文 Media ID
:return: 返回的 JSON 数据包 | wechat_sdk/basic.py | def send_article_message(self, user_id, articles=None, media_id=None):
"""
发送图文消息
详情请参考 http://mp.weixin.qq.com/wiki/7/12a5a320ae96fecdf0e15cb06123de9f.html
:param user_id: 用户 ID, 就是你收到的 WechatMessage 的 source
:param articles: list 对象, 每个元素为一个 dict 对象, key 包含 `title`, `descriptio... | def send_article_message(self, user_id, articles=None, media_id=None):
"""
发送图文消息
详情请参考 http://mp.weixin.qq.com/wiki/7/12a5a320ae96fecdf0e15cb06123de9f.html
:param user_id: 用户 ID, 就是你收到的 WechatMessage 的 source
:param articles: list 对象, 每个元素为一个 dict 对象, key 包含 `title`, `descriptio... | [
"发送图文消息",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"7",
"/",
"12a5a320ae96fecdf0e15cb06123de9f",
".",
"html",
":",
"param",
"user_id",
":",
"用户",
"ID",
"就是你收到的",
"WechatMessage",
"的",
"source",
":",
"param... | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L692-L737 | [
"def",
"send_article_message",
"(",
"self",
",",
"user_id",
",",
"articles",
"=",
"None",
",",
"media_id",
"=",
"None",
")",
":",
"# neither 'articles' nor 'media_id' is specified",
"if",
"articles",
"is",
"None",
"and",
"media_id",
"is",
"None",
":",
"raise",
"... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.create_qrcode | 创建二维码
详情请参考 http://mp.weixin.qq.com/wiki/18/28fc21e7ed87bec960651f0ce873ef8a.html
:param data: 你要发送的参数 dict
:return: 返回的 JSON 数据包 | wechat_sdk/basic.py | def create_qrcode(self, data):
"""
创建二维码
详情请参考 http://mp.weixin.qq.com/wiki/18/28fc21e7ed87bec960651f0ce873ef8a.html
:param data: 你要发送的参数 dict
:return: 返回的 JSON 数据包
"""
data = self._transcoding_dict(data)
return self.request.post(
url='https://... | def create_qrcode(self, data):
"""
创建二维码
详情请参考 http://mp.weixin.qq.com/wiki/18/28fc21e7ed87bec960651f0ce873ef8a.html
:param data: 你要发送的参数 dict
:return: 返回的 JSON 数据包
"""
data = self._transcoding_dict(data)
return self.request.post(
url='https://... | [
"创建二维码",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"18",
"/",
"28fc21e7ed87bec960651f0ce873ef8a",
".",
"html",
":",
"param",
"data",
":",
"你要发送的参数",
"dict",
":",
"return",
":",
"返回的",
"JSON",
"数据包"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L739-L750 | [
"def",
"create_qrcode",
"(",
"self",
",",
"data",
")",
":",
"data",
"=",
"self",
".",
"_transcoding_dict",
"(",
"data",
")",
"return",
"self",
".",
"request",
".",
"post",
"(",
"url",
"=",
"'https://api.weixin.qq.com/cgi-bin/qrcode/create'",
",",
"data",
"=",
... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.set_template_industry | 设置所属行业
详情请参考 http://mp.weixin.qq.com/wiki/17/304c1885ea66dbedf7dc170d84999a9d.html
:param industry_id1: 主营行业代码
:param industry_id2: 副营行业代码
:return: 返回的 JSON 数据包 | wechat_sdk/basic.py | def set_template_industry(self, industry_id1, industry_id2):
"""
设置所属行业
详情请参考 http://mp.weixin.qq.com/wiki/17/304c1885ea66dbedf7dc170d84999a9d.html
:param industry_id1: 主营行业代码
:param industry_id2: 副营行业代码
:return: 返回的 JSON 数据包
"""
return self.request.post(
... | def set_template_industry(self, industry_id1, industry_id2):
"""
设置所属行业
详情请参考 http://mp.weixin.qq.com/wiki/17/304c1885ea66dbedf7dc170d84999a9d.html
:param industry_id1: 主营行业代码
:param industry_id2: 副营行业代码
:return: 返回的 JSON 数据包
"""
return self.request.post(
... | [
"设置所属行业",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"17",
"/",
"304c1885ea66dbedf7dc170d84999a9d",
".",
"html",
":",
"param",
"industry_id1",
":",
"主营行业代码",
":",
"param",
"industry_id2",
":",
"副营行业代码",
":",
... | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L766-L780 | [
"def",
"set_template_industry",
"(",
"self",
",",
"industry_id1",
",",
"industry_id2",
")",
":",
"return",
"self",
".",
"request",
".",
"post",
"(",
"url",
"=",
"'https://api.weixin.qq.com/cgi-bin/template/api_set_industry'",
",",
"data",
"=",
"{",
"'industry_id1'",
... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.get_template_id | 获得模板ID
详情请参考 http://mp.weixin.qq.com/wiki/17/304c1885ea66dbedf7dc170d84999a9d.html
:param template_id_short: 模板库中模板的编号,有“TM**”和“OPENTMTM**”等形式
:return: 返回的 JSON 数据包 | wechat_sdk/basic.py | def get_template_id(self, template_id_short):
"""
获得模板ID
详情请参考 http://mp.weixin.qq.com/wiki/17/304c1885ea66dbedf7dc170d84999a9d.html
:param template_id_short: 模板库中模板的编号,有“TM**”和“OPENTMTM**”等形式
:return: 返回的 JSON 数据包
"""
return self.request.post(
url='ht... | def get_template_id(self, template_id_short):
"""
获得模板ID
详情请参考 http://mp.weixin.qq.com/wiki/17/304c1885ea66dbedf7dc170d84999a9d.html
:param template_id_short: 模板库中模板的编号,有“TM**”和“OPENTMTM**”等形式
:return: 返回的 JSON 数据包
"""
return self.request.post(
url='ht... | [
"获得模板ID",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"17",
"/",
"304c1885ea66dbedf7dc170d84999a9d",
".",
"html",
":",
"param",
"template_id_short",
":",
"模板库中模板的编号,有“TM",
"**",
"”和“OPENTMTM",
"**",
"”等形式",
":",
... | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L782-L794 | [
"def",
"get_template_id",
"(",
"self",
",",
"template_id_short",
")",
":",
"return",
"self",
".",
"request",
".",
"post",
"(",
"url",
"=",
"'https://api.weixin.qq.com/cgi-bin/template/api_add_template'",
",",
"data",
"=",
"{",
"'template_id_short'",
":",
"str",
"(",... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic.send_template_message | 发送模版消息
详情请参考 http://mp.weixin.qq.com/wiki/17/304c1885ea66dbedf7dc170d84999a9d.html
:param user_id: 用户 ID, 就是你收到的 WechatMessage 的 source (OpenID)
:param template_id: 模板ID
:param data: 模板消息数据 (dict形式),示例如下:
{
"first": {
"value": "恭喜你购买成功!",
... | wechat_sdk/basic.py | def send_template_message(self, user_id, template_id, data, url='', topcolor='#FF0000'):
"""
发送模版消息
详情请参考 http://mp.weixin.qq.com/wiki/17/304c1885ea66dbedf7dc170d84999a9d.html
:param user_id: 用户 ID, 就是你收到的 WechatMessage 的 source (OpenID)
:param template_id: 模板ID
:param da... | def send_template_message(self, user_id, template_id, data, url='', topcolor='#FF0000'):
"""
发送模版消息
详情请参考 http://mp.weixin.qq.com/wiki/17/304c1885ea66dbedf7dc170d84999a9d.html
:param user_id: 用户 ID, 就是你收到的 WechatMessage 的 source (OpenID)
:param template_id: 模板ID
:param da... | [
"发送模版消息",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"17",
"/",
"304c1885ea66dbedf7dc170d84999a9d",
".",
"html",
":",
"param",
"user_id",
":",
"用户",
"ID",
"就是你收到的",
"WechatMessage",
"的",
"source",
"(",
"Open... | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L796-L842 | [
"def",
"send_template_message",
"(",
"self",
",",
"user_id",
",",
"template_id",
",",
"data",
",",
"url",
"=",
"''",
",",
"topcolor",
"=",
"'#FF0000'",
")",
":",
"unicode_data",
"=",
"{",
"}",
"if",
"data",
":",
"unicode_data",
"=",
"self",
".",
"_transc... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBasic._check_official_error | 检测微信公众平台返回值中是否包含错误的返回码
:raises OfficialAPIError: 如果返回码提示有错误,抛出异常;否则返回 True | wechat_sdk/basic.py | def _check_official_error(self, json_data):
"""
检测微信公众平台返回值中是否包含错误的返回码
:raises OfficialAPIError: 如果返回码提示有错误,抛出异常;否则返回 True
"""
if "errcode" in json_data and json_data["errcode"] != 0:
raise OfficialAPIError(errcode=json_data.get('errcode'), errmsg=json_data.get('errms... | def _check_official_error(self, json_data):
"""
检测微信公众平台返回值中是否包含错误的返回码
:raises OfficialAPIError: 如果返回码提示有错误,抛出异常;否则返回 True
"""
if "errcode" in json_data and json_data["errcode"] != 0:
raise OfficialAPIError(errcode=json_data.get('errcode'), errmsg=json_data.get('errms... | [
"检测微信公众平台返回值中是否包含错误的返回码",
":",
"raises",
"OfficialAPIError",
":",
"如果返回码提示有错误,抛出异常;否则返回",
"True"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/basic.py#L860-L866 | [
"def",
"_check_official_error",
"(",
"self",
",",
"json_data",
")",
":",
"if",
"\"errcode\"",
"in",
"json_data",
"and",
"json_data",
"[",
"\"errcode\"",
"]",
"!=",
"0",
":",
"raise",
"OfficialAPIError",
"(",
"errcode",
"=",
"json_data",
".",
"get",
"(",
"'er... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatRequest.request | 向微信服务器发送请求
:param method: 请求方法
:param url: 请求地址
:param access_token: access token 值, 如果初始化时传入 conf 会自动获取, 如果没有传入则请提供此值
:param kwargs: 附加数据
:return: 微信服务器响应的 JSON 数据 | wechat_sdk/lib/request.py | def request(self, method, url, access_token=None, **kwargs):
"""
向微信服务器发送请求
:param method: 请求方法
:param url: 请求地址
:param access_token: access token 值, 如果初始化时传入 conf 会自动获取, 如果没有传入则请提供此值
:param kwargs: 附加数据
:return: 微信服务器响应的 JSON 数据
"""
access_token =... | def request(self, method, url, access_token=None, **kwargs):
"""
向微信服务器发送请求
:param method: 请求方法
:param url: 请求地址
:param access_token: access token 值, 如果初始化时传入 conf 会自动获取, 如果没有传入则请提供此值
:param kwargs: 附加数据
:return: 微信服务器响应的 JSON 数据
"""
access_token =... | [
"向微信服务器发送请求",
":",
"param",
"method",
":",
"请求方法",
":",
"param",
"url",
":",
"请求地址",
":",
"param",
"access_token",
":",
"access",
"token",
"值",
"如果初始化时传入",
"conf",
"会自动获取",
"如果没有传入则请提供此值",
":",
"param",
"kwargs",
":",
"附加数据",
":",
"return",
":",
"微信服务器响应的"... | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/lib/request.py#L22-L60 | [
"def",
"request",
"(",
"self",
",",
"method",
",",
"url",
",",
"access_token",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"access_token",
"=",
"self",
".",
"__conf",
".",
"access_token",
"if",
"self",
".",
"__conf",
"is",
"not",
"None",
"else",
... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatRequest.post | 使用 POST 方法向微信服务器发出请求
:param url: 请求地址
:param access_token: access token 值, 如果初始化时传入 conf 会自动获取, 如果没有传入则请提供此值
:param kwargs: 附加数据
:return: 微信服务器响应的 JSON 数据 | wechat_sdk/lib/request.py | def post(self, url, access_token=None, **kwargs):
"""
使用 POST 方法向微信服务器发出请求
:param url: 请求地址
:param access_token: access token 值, 如果初始化时传入 conf 会自动获取, 如果没有传入则请提供此值
:param kwargs: 附加数据
:return: 微信服务器响应的 JSON 数据
"""
return self.request(
method="po... | def post(self, url, access_token=None, **kwargs):
"""
使用 POST 方法向微信服务器发出请求
:param url: 请求地址
:param access_token: access token 值, 如果初始化时传入 conf 会自动获取, 如果没有传入则请提供此值
:param kwargs: 附加数据
:return: 微信服务器响应的 JSON 数据
"""
return self.request(
method="po... | [
"使用",
"POST",
"方法向微信服务器发出请求",
":",
"param",
"url",
":",
"请求地址",
":",
"param",
"access_token",
":",
"access",
"token",
"值",
"如果初始化时传入",
"conf",
"会自动获取",
"如果没有传入则请提供此值",
":",
"param",
"kwargs",
":",
"附加数据",
":",
"return",
":",
"微信服务器响应的",
"JSON",
"数据"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/lib/request.py#L77-L90 | [
"def",
"post",
"(",
"self",
",",
"url",
",",
"access_token",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"request",
"(",
"method",
"=",
"\"post\"",
",",
"url",
"=",
"url",
",",
"access_token",
"=",
"access_token",
",",
"*",... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | XMLStore.xml2dict | 将 XML 转换为 dict | wechat_sdk/lib/parser.py | def xml2dict(self):
"""
将 XML 转换为 dict
"""
self._remove_whitespace_nodes(self._doc.childNodes[0])
return self._element2dict(self._doc.childNodes[0]) | def xml2dict(self):
"""
将 XML 转换为 dict
"""
self._remove_whitespace_nodes(self._doc.childNodes[0])
return self._element2dict(self._doc.childNodes[0]) | [
"将",
"XML",
"转换为",
"dict"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/lib/parser.py#L15-L20 | [
"def",
"xml2dict",
"(",
"self",
")",
":",
"self",
".",
"_remove_whitespace_nodes",
"(",
"self",
".",
"_doc",
".",
"childNodes",
"[",
"0",
"]",
")",
"return",
"self",
".",
"_element2dict",
"(",
"self",
".",
"_doc",
".",
"childNodes",
"[",
"0",
"]",
")"
... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | XMLStore._element2dict | 将单个节点转换为 dict | wechat_sdk/lib/parser.py | def _element2dict(self, parent):
"""
将单个节点转换为 dict
"""
d = {}
for node in parent.childNodes:
if not isinstance(node, minidom.Element):
continue
if not node.hasChildNodes():
continue
if node.childNodes[0].nodeTyp... | def _element2dict(self, parent):
"""
将单个节点转换为 dict
"""
d = {}
for node in parent.childNodes:
if not isinstance(node, minidom.Element):
continue
if not node.hasChildNodes():
continue
if node.childNodes[0].nodeTyp... | [
"将单个节点转换为",
"dict"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/lib/parser.py#L22-L41 | [
"def",
"_element2dict",
"(",
"self",
",",
"parent",
")",
":",
"d",
"=",
"{",
"}",
"for",
"node",
"in",
"parent",
".",
"childNodes",
":",
"if",
"not",
"isinstance",
"(",
"node",
",",
"minidom",
".",
"Element",
")",
":",
"continue",
"if",
"not",
"node"... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | XMLStore._remove_whitespace_nodes | 删除空白无用节点 | wechat_sdk/lib/parser.py | def _remove_whitespace_nodes(self, node, unlink=True):
"""
删除空白无用节点
"""
remove_list = []
for child in node.childNodes:
if child.nodeType == Node.TEXT_NODE and not child.data.strip():
remove_list.append(child)
elif child.hasChildNodes():
... | def _remove_whitespace_nodes(self, node, unlink=True):
"""
删除空白无用节点
"""
remove_list = []
for child in node.childNodes:
if child.nodeType == Node.TEXT_NODE and not child.data.strip():
remove_list.append(child)
elif child.hasChildNodes():
... | [
"删除空白无用节点"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/lib/parser.py#L43-L56 | [
"def",
"_remove_whitespace_nodes",
"(",
"self",
",",
"node",
",",
"unlink",
"=",
"True",
")",
":",
"remove_list",
"=",
"[",
"]",
"for",
"child",
"in",
"node",
".",
"childNodes",
":",
"if",
"child",
".",
"nodeType",
"==",
"Node",
".",
"TEXT_NODE",
"and",
... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | to_binary | 将 values 转为 bytes,默认编码 utf-8
:param value: 待转换的值
:param encoding: 编码 | wechat_sdk/utils.py | def to_binary(value, encoding='utf-8'):
"""将 values 转为 bytes,默认编码 utf-8
:param value: 待转换的值
:param encoding: 编码
"""
if not value:
return b''
if isinstance(value, six.binary_type):
return value
if isinstance(value, six.text_type):
return value.encode(encoding)
if... | def to_binary(value, encoding='utf-8'):
"""将 values 转为 bytes,默认编码 utf-8
:param value: 待转换的值
:param encoding: 编码
"""
if not value:
return b''
if isinstance(value, six.binary_type):
return value
if isinstance(value, six.text_type):
return value.encode(encoding)
if... | [
"将",
"values",
"转为",
"bytes,默认编码",
"utf",
"-",
"8"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/utils.py#L24-L39 | [
"def",
"to_binary",
"(",
"value",
",",
"encoding",
"=",
"'utf-8'",
")",
":",
"if",
"not",
"value",
":",
"return",
"b''",
"if",
"isinstance",
"(",
"value",
",",
"six",
".",
"binary_type",
")",
":",
"return",
"value",
"if",
"isinstance",
"(",
"value",
",... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBase._transcoding | 编码转换
:param data: 需要转换的数据
:return: 转换好的数据 | wechat_sdk/base.py | def _transcoding(cls, data):
"""编码转换
:param data: 需要转换的数据
:return: 转换好的数据
"""
if not data:
return data
result = None
if isinstance(data, str) and hasattr(data, 'decode'):
result = data.decode('utf-8')
else:
result = dat... | def _transcoding(cls, data):
"""编码转换
:param data: 需要转换的数据
:return: 转换好的数据
"""
if not data:
return data
result = None
if isinstance(data, str) and hasattr(data, 'decode'):
result = data.decode('utf-8')
else:
result = dat... | [
"编码转换",
":",
"param",
"data",
":",
"需要转换的数据",
":",
"return",
":",
"转换好的数据"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/base.py#L8-L21 | [
"def",
"_transcoding",
"(",
"cls",
",",
"data",
")",
":",
"if",
"not",
"data",
":",
"return",
"data",
"result",
"=",
"None",
"if",
"isinstance",
"(",
"data",
",",
"str",
")",
"and",
"hasattr",
"(",
"data",
",",
"'decode'",
")",
":",
"result",
"=",
... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBase._transcoding_list | 编码转换 for list
:param data: 需要转换的 list 数据
:return: 转换好的 list | wechat_sdk/base.py | def _transcoding_list(cls, data):
"""编码转换 for list
:param data: 需要转换的 list 数据
:return: 转换好的 list
"""
if not isinstance(data, list):
raise ValueError('Parameter data must be list object.')
result = []
for item in data:
if isinstance(item, d... | def _transcoding_list(cls, data):
"""编码转换 for list
:param data: 需要转换的 list 数据
:return: 转换好的 list
"""
if not isinstance(data, list):
raise ValueError('Parameter data must be list object.')
result = []
for item in data:
if isinstance(item, d... | [
"编码转换",
"for",
"list",
":",
"param",
"data",
":",
"需要转换的",
"list",
"数据",
":",
"return",
":",
"转换好的",
"list"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/base.py#L24-L40 | [
"def",
"_transcoding_list",
"(",
"cls",
",",
"data",
")",
":",
"if",
"not",
"isinstance",
"(",
"data",
",",
"list",
")",
":",
"raise",
"ValueError",
"(",
"'Parameter data must be list object.'",
")",
"result",
"=",
"[",
"]",
"for",
"item",
"in",
"data",
":... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBase._transcoding_dict | 编码转换 for dict
:param data: 需要转换的 dict 数据
:return: 转换好的 dict | wechat_sdk/base.py | def _transcoding_dict(cls, data):
"""
编码转换 for dict
:param data: 需要转换的 dict 数据
:return: 转换好的 dict
"""
if not isinstance(data, dict):
raise ValueError('Parameter data must be dict object.')
result = {}
for k, v in data.items():
k = ... | def _transcoding_dict(cls, data):
"""
编码转换 for dict
:param data: 需要转换的 dict 数据
:return: 转换好的 dict
"""
if not isinstance(data, dict):
raise ValueError('Parameter data must be dict object.')
result = {}
for k, v in data.items():
k = ... | [
"编码转换",
"for",
"dict",
":",
"param",
"data",
":",
"需要转换的",
"dict",
"数据",
":",
"return",
":",
"转换好的",
"dict"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/base.py#L43-L62 | [
"def",
"_transcoding_dict",
"(",
"cls",
",",
"data",
")",
":",
"if",
"not",
"isinstance",
"(",
"data",
",",
"dict",
")",
":",
"raise",
"ValueError",
"(",
"'Parameter data must be dict object.'",
")",
"result",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | PKCS7Encoder.encode | 对需要加密的明文进行填充补位
@param text: 需要进行填充补位操作的明文
@return: 补齐明文字符串 | wechat_sdk/lib/crypto/pkcs7.py | def encode(cls, text):
"""
对需要加密的明文进行填充补位
@param text: 需要进行填充补位操作的明文
@return: 补齐明文字符串
"""
text_length = len(text)
# 计算需要填充的位数
amount_to_pad = cls.block_size - (text_length % cls.block_size)
if amount_to_pad == 0:
amount_to_pad = cls.blo... | def encode(cls, text):
"""
对需要加密的明文进行填充补位
@param text: 需要进行填充补位操作的明文
@return: 补齐明文字符串
"""
text_length = len(text)
# 计算需要填充的位数
amount_to_pad = cls.block_size - (text_length % cls.block_size)
if amount_to_pad == 0:
amount_to_pad = cls.blo... | [
"对需要加密的明文进行填充补位"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/lib/crypto/pkcs7.py#L11-L24 | [
"def",
"encode",
"(",
"cls",
",",
"text",
")",
":",
"text_length",
"=",
"len",
"(",
"text",
")",
"# 计算需要填充的位数",
"amount_to_pad",
"=",
"cls",
".",
"block_size",
"-",
"(",
"text_length",
"%",
"cls",
".",
"block_size",
")",
"if",
"amount_to_pad",
"==",
"0",... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | PKCS7Encoder.decode | 删除解密后明文的补位字符
@param decrypted: 解密后的明文
@return: 删除补位字符后的明文 | wechat_sdk/lib/crypto/pkcs7.py | def decode(cls, decrypted):
"""
删除解密后明文的补位字符
@param decrypted: 解密后的明文
@return: 删除补位字符后的明文
"""
pad = ord(decrypted[-1])
if pad < 1 or pad > 32:
pad = 0
return decrypted[:-pad] | def decode(cls, decrypted):
"""
删除解密后明文的补位字符
@param decrypted: 解密后的明文
@return: 删除补位字符后的明文
"""
pad = ord(decrypted[-1])
if pad < 1 or pad > 32:
pad = 0
return decrypted[:-pad] | [
"删除解密后明文的补位字符"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/lib/crypto/pkcs7.py#L27-L36 | [
"def",
"decode",
"(",
"cls",
",",
"decrypted",
")",
":",
"pad",
"=",
"ord",
"(",
"decrypted",
"[",
"-",
"1",
"]",
")",
"if",
"pad",
"<",
"1",
"or",
"pad",
">",
"32",
":",
"pad",
"=",
"0",
"return",
"decrypted",
"[",
":",
"-",
"pad",
"]"
] | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | BaseCrypto.decrypt | 对解密后的明文进行补位删除
@param text: 密文
@return: 删除填充补位后的明文 | wechat_sdk/lib/crypto/base.py | def decrypt(self, text, appid):
"""对解密后的明文进行补位删除
@param text: 密文
@return: 删除填充补位后的明文
"""
try:
cryptor = AES.new(self.key, self.mode, self.key[:16])
# 使用BASE64对密文进行解码,然后AES-CBC解密
plain_text = cryptor.decrypt(base64.b64decode(text))
exce... | def decrypt(self, text, appid):
"""对解密后的明文进行补位删除
@param text: 密文
@return: 删除填充补位后的明文
"""
try:
cryptor = AES.new(self.key, self.mode, self.key[:16])
# 使用BASE64对密文进行解码,然后AES-CBC解密
plain_text = cryptor.decrypt(base64.b64decode(text))
exce... | [
"对解密后的明文进行补位删除"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/lib/crypto/base.py#L45-L75 | [
"def",
"decrypt",
"(",
"self",
",",
"text",
",",
"appid",
")",
":",
"try",
":",
"cryptor",
"=",
"AES",
".",
"new",
"(",
"self",
".",
"key",
",",
"self",
".",
"mode",
",",
"self",
".",
"key",
"[",
":",
"16",
"]",
")",
"# 使用BASE64对密文进行解码,然后AES-CBC解密"... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | BaseCrypto.get_random_str | 随机生成16位字符串
@return: 16位字符串 | wechat_sdk/lib/crypto/base.py | def get_random_str(self):
""" 随机生成16位字符串
@return: 16位字符串
"""
rule = string.ascii_letters + string.digits
return "".join(random.sample(rule, 16)) | def get_random_str(self):
""" 随机生成16位字符串
@return: 16位字符串
"""
rule = string.ascii_letters + string.digits
return "".join(random.sample(rule, 16)) | [
"随机生成16位字符串"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/lib/crypto/base.py#L77-L83 | [
"def",
"get_random_str",
"(",
"self",
")",
":",
"rule",
"=",
"string",
".",
"ascii_letters",
"+",
"string",
".",
"digits",
"return",
"\"\"",
".",
"join",
"(",
"random",
".",
"sample",
"(",
"rule",
",",
"16",
")",
")"
] | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBaseCrypto._check_signature | 验证签名有效性
:param msg_signature: 签名串,对应URL参数的msg_signature
:param timestamp: 时间戳,对应URL参数的timestamp
:param nonce: 随机串,对应URL参数的nonce
:param echostr: 随机串,对应URL参数的echostr
:return: 解密之后的echostr
:raise ValidateSignatureError: 签名无效异常 | wechat_sdk/lib/crypto/cryptos.py | def _check_signature(self, msg_signature, timestamp, nonce, echostr):
"""验证签名有效性
:param msg_signature: 签名串,对应URL参数的msg_signature
:param timestamp: 时间戳,对应URL参数的timestamp
:param nonce: 随机串,对应URL参数的nonce
:param echostr: 随机串,对应URL参数的echostr
:return: 解密之后的echostr
:rai... | def _check_signature(self, msg_signature, timestamp, nonce, echostr):
"""验证签名有效性
:param msg_signature: 签名串,对应URL参数的msg_signature
:param timestamp: 时间戳,对应URL参数的timestamp
:param nonce: 随机串,对应URL参数的nonce
:param echostr: 随机串,对应URL参数的echostr
:return: 解密之后的echostr
:rai... | [
"验证签名有效性"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/lib/crypto/cryptos.py#L33-L49 | [
"def",
"_check_signature",
"(",
"self",
",",
"msg_signature",
",",
"timestamp",
",",
"nonce",
",",
"echostr",
")",
":",
"signature",
"=",
"get_sha1_signature",
"(",
"self",
".",
"__token",
",",
"timestamp",
",",
"nonce",
",",
"echostr",
")",
"if",
"not",
"... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBaseCrypto._encrypt_message | 将公众号回复用户的消息加密打包
:param msg: 待回复用户的消息,xml格式的字符串
:param nonce: 随机串,可以自己生成,也可以用URL参数的nonce
:param timestamp: 时间戳,可以自己生成,也可以用URL参数的timestamp,如为None则自动用当前时间
:return: 加密后的可以直接回复用户的密文,包括msg_signature, timestamp, nonce, encrypt的xml格式的字符串 | wechat_sdk/lib/crypto/cryptos.py | def _encrypt_message(self, msg, nonce, timestamp=None):
"""将公众号回复用户的消息加密打包
:param msg: 待回复用户的消息,xml格式的字符串
:param nonce: 随机串,可以自己生成,也可以用URL参数的nonce
:param timestamp: 时间戳,可以自己生成,也可以用URL参数的timestamp,如为None则自动用当前时间
:return: 加密后的可以直接回复用户的密文,包括msg_signature, timestamp, nonce, encrypt的... | def _encrypt_message(self, msg, nonce, timestamp=None):
"""将公众号回复用户的消息加密打包
:param msg: 待回复用户的消息,xml格式的字符串
:param nonce: 随机串,可以自己生成,也可以用URL参数的nonce
:param timestamp: 时间戳,可以自己生成,也可以用URL参数的timestamp,如为None则自动用当前时间
:return: 加密后的可以直接回复用户的密文,包括msg_signature, timestamp, nonce, encrypt的... | [
"将公众号回复用户的消息加密打包"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/lib/crypto/cryptos.py#L51-L75 | [
"def",
"_encrypt_message",
"(",
"self",
",",
"msg",
",",
"nonce",
",",
"timestamp",
"=",
"None",
")",
":",
"xml",
"=",
"\"\"\"<xml>\n<Encrypt><![CDATA[{encrypt}]]></Encrypt>\n<MsgSignature><![CDATA[{signature}]]></MsgSignature>\n<TimeStamp>{timestamp}</TimeStamp>\n<Nonce><![CDATA[{no... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | WechatBaseCrypto._decrypt_message | 检验消息的真实性,并且获取解密后的明文
:param msg: 密文,对应POST请求的数据
:param msg_signature: 签名串,对应URL参数的msg_signature
:param timestamp: 时间戳,对应URL参数的timestamp
:param nonce: 随机串,对应URL参数的nonce
:return: 解密后的原文 | wechat_sdk/lib/crypto/cryptos.py | def _decrypt_message(self, msg, msg_signature, timestamp, nonce):
"""检验消息的真实性,并且获取解密后的明文
:param msg: 密文,对应POST请求的数据
:param msg_signature: 签名串,对应URL参数的msg_signature
:param timestamp: 时间戳,对应URL参数的timestamp
:param nonce: 随机串,对应URL参数的nonce
:return: 解密后的原文
"""
... | def _decrypt_message(self, msg, msg_signature, timestamp, nonce):
"""检验消息的真实性,并且获取解密后的明文
:param msg: 密文,对应POST请求的数据
:param msg_signature: 签名串,对应URL参数的msg_signature
:param timestamp: 时间戳,对应URL参数的timestamp
:param nonce: 随机串,对应URL参数的nonce
:return: 解密后的原文
"""
... | [
"检验消息的真实性,并且获取解密后的明文"
] | doraemonext/wechat-python-sdk | python | https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/lib/crypto/cryptos.py#L77-L98 | [
"def",
"_decrypt_message",
"(",
"self",
",",
"msg",
",",
"msg_signature",
",",
"timestamp",
",",
"nonce",
")",
":",
"timestamp",
"=",
"to_binary",
"(",
"timestamp",
")",
"nonce",
"=",
"to_binary",
"(",
"nonce",
")",
"if",
"isinstance",
"(",
"msg",
",",
"... | bf6f6f3d4a5440feb73a51937059d7feddc335a0 |
valid | Lastovka_Shaw | r'''Calculate ideal-gas constant-pressure heat capacitiy with the similarity
variable concept and method as shown in [1]_.
.. math::
C_p^0 = \left(A_2 + \frac{A_1 - A_2}{1 + \exp(\frac{\alpha-A_3}{A_4})}\right)
+ (B_{11} + B_{12}\alpha)\left(-\frac{(C_{11} + C_{12}\alpha)}{T}\right)^2
\... | thermo/heat_capacity.py | def Lastovka_Shaw(T, similarity_variable, cyclic_aliphatic=False):
r'''Calculate ideal-gas constant-pressure heat capacitiy with the similarity
variable concept and method as shown in [1]_.
.. math::
C_p^0 = \left(A_2 + \frac{A_1 - A_2}{1 + \exp(\frac{\alpha-A_3}{A_4})}\right)
+ (B_{11} + B... | def Lastovka_Shaw(T, similarity_variable, cyclic_aliphatic=False):
r'''Calculate ideal-gas constant-pressure heat capacitiy with the similarity
variable concept and method as shown in [1]_.
.. math::
C_p^0 = \left(A_2 + \frac{A_1 - A_2}{1 + \exp(\frac{\alpha-A_3}{A_4})}\right)
+ (B_{11} + B... | [
"r",
"Calculate",
"ideal",
"-",
"gas",
"constant",
"-",
"pressure",
"heat",
"capacitiy",
"with",
"the",
"similarity",
"variable",
"concept",
"and",
"method",
"as",
"shown",
"in",
"[",
"1",
"]",
"_",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L125-L192 | [
"def",
"Lastovka_Shaw",
"(",
"T",
",",
"similarity_variable",
",",
"cyclic_aliphatic",
"=",
"False",
")",
":",
"a",
"=",
"similarity_variable",
"if",
"cyclic_aliphatic",
":",
"A1",
"=",
"-",
"0.1793547",
"A2",
"=",
"3.86944439",
"first",
"=",
"A1",
"+",
"A2"... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Lastovka_Shaw_integral_over_T | r'''Calculate the integral over temperature of ideal-gas constant-pressure
heat capacitiy with the similarity variable concept and method as shown in
[1]_.
Parameters
----------
T : float
Temperature of gas [K]
similarity_variable : float
similarity variable as defined in [1]_,... | thermo/heat_capacity.py | def Lastovka_Shaw_integral_over_T(T, similarity_variable, cyclic_aliphatic=False):
r'''Calculate the integral over temperature of ideal-gas constant-pressure
heat capacitiy with the similarity variable concept and method as shown in
[1]_.
Parameters
----------
T : float
Temperature of ... | def Lastovka_Shaw_integral_over_T(T, similarity_variable, cyclic_aliphatic=False):
r'''Calculate the integral over temperature of ideal-gas constant-pressure
heat capacitiy with the similarity variable concept and method as shown in
[1]_.
Parameters
----------
T : float
Temperature of ... | [
"r",
"Calculate",
"the",
"integral",
"over",
"temperature",
"of",
"ideal",
"-",
"gas",
"constant",
"-",
"pressure",
"heat",
"capacitiy",
"with",
"the",
"similarity",
"variable",
"concept",
"and",
"method",
"as",
"shown",
"in",
"[",
"1",
"]",
"_",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L260-L330 | [
"def",
"Lastovka_Shaw_integral_over_T",
"(",
"T",
",",
"similarity_variable",
",",
"cyclic_aliphatic",
"=",
"False",
")",
":",
"from",
"cmath",
"import",
"log",
",",
"exp",
"a",
"=",
"similarity_variable",
"if",
"cyclic_aliphatic",
":",
"A1",
"=",
"-",
"0.179354... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | TRCCp | r'''Calculates ideal gas heat capacity using the model developed in [1]_.
The ideal gas heat capacity is given by:
.. math::
C_p = R\left(a_0 + (a_1/T^2) \exp(-a_2/T) + a_3 y^2
+ (a_4 - a_5/(T-a_7)^2 )y^j \right)
y = \frac{T-a_7}{T+a_6} \text{ for } T > a_7 \text{ otherwise } 0
P... | thermo/heat_capacity.py | def TRCCp(T, a0, a1, a2, a3, a4, a5, a6, a7):
r'''Calculates ideal gas heat capacity using the model developed in [1]_.
The ideal gas heat capacity is given by:
.. math::
C_p = R\left(a_0 + (a_1/T^2) \exp(-a_2/T) + a_3 y^2
+ (a_4 - a_5/(T-a_7)^2 )y^j \right)
y = \frac{T-a_7}{T+a_6... | def TRCCp(T, a0, a1, a2, a3, a4, a5, a6, a7):
r'''Calculates ideal gas heat capacity using the model developed in [1]_.
The ideal gas heat capacity is given by:
.. math::
C_p = R\left(a_0 + (a_1/T^2) \exp(-a_2/T) + a_3 y^2
+ (a_4 - a_5/(T-a_7)^2 )y^j \right)
y = \frac{T-a_7}{T+a_6... | [
"r",
"Calculates",
"ideal",
"gas",
"heat",
"capacity",
"using",
"the",
"model",
"developed",
"in",
"[",
"1",
"]",
"_",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L333-L375 | [
"def",
"TRCCp",
"(",
"T",
",",
"a0",
",",
"a1",
",",
"a2",
",",
"a3",
",",
"a4",
",",
"a5",
",",
"a6",
",",
"a7",
")",
":",
"if",
"T",
"<=",
"a7",
":",
"y",
"=",
"0.",
"else",
":",
"y",
"=",
"(",
"T",
"-",
"a7",
")",
"/",
"(",
"T",
... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | TRCCp_integral | r'''Integrates ideal gas heat capacity using the model developed in [1]_.
Best used as a delta only.
The difference in enthalpy with respect to 0 K is given by:
.. math::
\frac{H(T) - H^{ref}}{RT} = a_0 + a_1x(a_2)/(a_2T) + I/T + h(T)/T
h(T) = (a_5 + a_7)\left[(2a_3 + 8a_4)\ln(1-y... | thermo/heat_capacity.py | def TRCCp_integral(T, a0, a1, a2, a3, a4, a5, a6, a7, I=0):
r'''Integrates ideal gas heat capacity using the model developed in [1]_.
Best used as a delta only.
The difference in enthalpy with respect to 0 K is given by:
.. math::
\frac{H(T) - H^{ref}}{RT} = a_0 + a_1x(a_2)/(a_2T) + I/T + h(T)... | def TRCCp_integral(T, a0, a1, a2, a3, a4, a5, a6, a7, I=0):
r'''Integrates ideal gas heat capacity using the model developed in [1]_.
Best used as a delta only.
The difference in enthalpy with respect to 0 K is given by:
.. math::
\frac{H(T) - H^{ref}}{RT} = a_0 + a_1x(a_2)/(a_2T) + I/T + h(T)... | [
"r",
"Integrates",
"ideal",
"gas",
"heat",
"capacity",
"using",
"the",
"model",
"developed",
"in",
"[",
"1",
"]",
"_",
".",
"Best",
"used",
"as",
"a",
"delta",
"only",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L378-L441 | [
"def",
"TRCCp_integral",
"(",
"T",
",",
"a0",
",",
"a1",
",",
"a2",
",",
"a3",
",",
"a4",
",",
"a5",
",",
"a6",
",",
"a7",
",",
"I",
"=",
"0",
")",
":",
"if",
"T",
"<=",
"a7",
":",
"y",
"=",
"0.",
"else",
":",
"y",
"=",
"(",
"T",
"-",
... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | TRCCp_integral_over_T | r'''Integrates ideal gas heat capacity over T using the model developed in
[1]_. Best used as a delta only.
The difference in ideal-gas entropy with respect to 0 K is given by:
.. math::
\frac{S^\circ}{R} = J + a_0\ln T + \frac{a_1}{a_2^2}\left(1
+ \frac{a_2}{T}\right)x(a_2) + s(T)
... | thermo/heat_capacity.py | def TRCCp_integral_over_T(T, a0, a1, a2, a3, a4, a5, a6, a7, J=0):
r'''Integrates ideal gas heat capacity over T using the model developed in
[1]_. Best used as a delta only.
The difference in ideal-gas entropy with respect to 0 K is given by:
.. math::
\frac{S^\circ}{R} = J + a_0\ln T + \fra... | def TRCCp_integral_over_T(T, a0, a1, a2, a3, a4, a5, a6, a7, J=0):
r'''Integrates ideal gas heat capacity over T using the model developed in
[1]_. Best used as a delta only.
The difference in ideal-gas entropy with respect to 0 K is given by:
.. math::
\frac{S^\circ}{R} = J + a_0\ln T + \fra... | [
"r",
"Integrates",
"ideal",
"gas",
"heat",
"capacity",
"over",
"T",
"using",
"the",
"model",
"developed",
"in",
"[",
"1",
"]",
"_",
".",
"Best",
"used",
"as",
"a",
"delta",
"only",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L444-L520 | [
"def",
"TRCCp_integral_over_T",
"(",
"T",
",",
"a0",
",",
"a1",
",",
"a2",
",",
"a3",
",",
"a4",
",",
"a5",
",",
"a6",
",",
"a7",
",",
"J",
"=",
"0",
")",
":",
"# Possible optimizations: pre-cache as much as possible.",
"# If this were replaced by a cache, much ... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Rowlinson_Poling | r'''Calculate liquid constant-pressure heat capacitiy with the [1]_ CSP method.
This equation is not terrible accurate.
The heat capacity of a liquid is given by:
.. math::
\frac{Cp^{L} - Cp^{g}}{R} = 1.586 + \frac{0.49}{1-T_r} +
\omega\left[ 4.2775 + \frac{6.3(1-T_r)^{1/3}}{T_r} + \frac{... | thermo/heat_capacity.py | def Rowlinson_Poling(T, Tc, omega, Cpgm):
r'''Calculate liquid constant-pressure heat capacitiy with the [1]_ CSP method.
This equation is not terrible accurate.
The heat capacity of a liquid is given by:
.. math::
\frac{Cp^{L} - Cp^{g}}{R} = 1.586 + \frac{0.49}{1-T_r} +
\omega\left[ ... | def Rowlinson_Poling(T, Tc, omega, Cpgm):
r'''Calculate liquid constant-pressure heat capacitiy with the [1]_ CSP method.
This equation is not terrible accurate.
The heat capacity of a liquid is given by:
.. math::
\frac{Cp^{L} - Cp^{g}}{R} = 1.586 + \frac{0.49}{1-T_r} +
\omega\left[ ... | [
"r",
"Calculate",
"liquid",
"constant",
"-",
"pressure",
"heat",
"capacitiy",
"with",
"the",
"[",
"1",
"]",
"_",
"CSP",
"method",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L892-L937 | [
"def",
"Rowlinson_Poling",
"(",
"T",
",",
"Tc",
",",
"omega",
",",
"Cpgm",
")",
":",
"Tr",
"=",
"T",
"/",
"Tc",
"Cplm",
"=",
"Cpgm",
"+",
"R",
"*",
"(",
"1.586",
"+",
"0.49",
"/",
"(",
"1.",
"-",
"Tr",
")",
"+",
"omega",
"*",
"(",
"4.2775",
... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Rowlinson_Bondi | r'''Calculate liquid constant-pressure heat capacitiy with the CSP method
shown in [1]_.
The heat capacity of a liquid is given by:
.. math::
\frac{Cp^L - Cp^{ig}}{R} = 1.45 + 0.45(1-T_r)^{-1} + 0.25\omega
[17.11 + 25.2(1-T_r)^{1/3}T_r^{-1} + 1.742(1-T_r)^{-1}]
Parameters
--------... | thermo/heat_capacity.py | def Rowlinson_Bondi(T, Tc, omega, Cpgm):
r'''Calculate liquid constant-pressure heat capacitiy with the CSP method
shown in [1]_.
The heat capacity of a liquid is given by:
.. math::
\frac{Cp^L - Cp^{ig}}{R} = 1.45 + 0.45(1-T_r)^{-1} + 0.25\omega
[17.11 + 25.2(1-T_r)^{1/3}T_r^{-1} + 1.... | def Rowlinson_Bondi(T, Tc, omega, Cpgm):
r'''Calculate liquid constant-pressure heat capacitiy with the CSP method
shown in [1]_.
The heat capacity of a liquid is given by:
.. math::
\frac{Cp^L - Cp^{ig}}{R} = 1.45 + 0.45(1-T_r)^{-1} + 0.25\omega
[17.11 + 25.2(1-T_r)^{1/3}T_r^{-1} + 1.... | [
"r",
"Calculate",
"liquid",
"constant",
"-",
"pressure",
"heat",
"capacitiy",
"with",
"the",
"CSP",
"method",
"shown",
"in",
"[",
"1",
"]",
"_",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L940-L987 | [
"def",
"Rowlinson_Bondi",
"(",
"T",
",",
"Tc",
",",
"omega",
",",
"Cpgm",
")",
":",
"Tr",
"=",
"T",
"/",
"Tc",
"Cplm",
"=",
"Cpgm",
"+",
"R",
"*",
"(",
"1.45",
"+",
"0.45",
"/",
"(",
"1.",
"-",
"Tr",
")",
"+",
"0.25",
"*",
"omega",
"*",
"("... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Dadgostar_Shaw | r'''Calculate liquid constant-pressure heat capacitiy with the similarity
variable concept and method as shown in [1]_.
.. math::
C_{p} = 24.5(a_{11}\alpha + a_{12}\alpha^2)+ (a_{21}\alpha
+ a_{22}\alpha^2)T +(a_{31}\alpha + a_{32}\alpha^2)T^2
Parameters
----------
T : float
... | thermo/heat_capacity.py | def Dadgostar_Shaw(T, similarity_variable):
r'''Calculate liquid constant-pressure heat capacitiy with the similarity
variable concept and method as shown in [1]_.
.. math::
C_{p} = 24.5(a_{11}\alpha + a_{12}\alpha^2)+ (a_{21}\alpha
+ a_{22}\alpha^2)T +(a_{31}\alpha + a_{32}\alpha^2)T^2
... | def Dadgostar_Shaw(T, similarity_variable):
r'''Calculate liquid constant-pressure heat capacitiy with the similarity
variable concept and method as shown in [1]_.
.. math::
C_{p} = 24.5(a_{11}\alpha + a_{12}\alpha^2)+ (a_{21}\alpha
+ a_{22}\alpha^2)T +(a_{31}\alpha + a_{32}\alpha^2)T^2
... | [
"r",
"Calculate",
"liquid",
"constant",
"-",
"pressure",
"heat",
"capacitiy",
"with",
"the",
"similarity",
"variable",
"concept",
"and",
"method",
"as",
"shown",
"in",
"[",
"1",
"]",
"_",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L990-L1050 | [
"def",
"Dadgostar_Shaw",
"(",
"T",
",",
"similarity_variable",
")",
":",
"a",
"=",
"similarity_variable",
"a11",
"=",
"-",
"0.3416",
"a12",
"=",
"2.2671",
"a21",
"=",
"0.1064",
"a22",
"=",
"-",
"0.3874",
"a31",
"=",
"-",
"9.8231E-05",
"a32",
"=",
"4.182E... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Dadgostar_Shaw_integral | r'''Calculate the integral of liquid constant-pressure heat capacitiy
with the similarity variable concept and method as shown in [1]_.
Parameters
----------
T : float
Temperature of gas [K]
similarity_variable : float
similarity variable as defined in [1]_, [mol/g]
Returns
... | thermo/heat_capacity.py | def Dadgostar_Shaw_integral(T, similarity_variable):
r'''Calculate the integral of liquid constant-pressure heat capacitiy
with the similarity variable concept and method as shown in [1]_.
Parameters
----------
T : float
Temperature of gas [K]
similarity_variable : float
simila... | def Dadgostar_Shaw_integral(T, similarity_variable):
r'''Calculate the integral of liquid constant-pressure heat capacitiy
with the similarity variable concept and method as shown in [1]_.
Parameters
----------
T : float
Temperature of gas [K]
similarity_variable : float
simila... | [
"r",
"Calculate",
"the",
"integral",
"of",
"liquid",
"constant",
"-",
"pressure",
"heat",
"capacitiy",
"with",
"the",
"similarity",
"variable",
"concept",
"and",
"method",
"as",
"shown",
"in",
"[",
"1",
"]",
"_",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L1053-L1103 | [
"def",
"Dadgostar_Shaw_integral",
"(",
"T",
",",
"similarity_variable",
")",
":",
"a",
"=",
"similarity_variable",
"a2",
"=",
"a",
"*",
"a",
"T2",
"=",
"T",
"*",
"T",
"a11",
"=",
"-",
"0.3416",
"a12",
"=",
"2.2671",
"a21",
"=",
"0.1064",
"a22",
"=",
... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Dadgostar_Shaw_integral_over_T | r'''Calculate the integral of liquid constant-pressure heat capacitiy
with the similarity variable concept and method as shown in [1]_.
Parameters
----------
T : float
Temperature of gas [K]
similarity_variable : float
similarity variable as defined in [1]_, [mol/g]
Returns
... | thermo/heat_capacity.py | def Dadgostar_Shaw_integral_over_T(T, similarity_variable):
r'''Calculate the integral of liquid constant-pressure heat capacitiy
with the similarity variable concept and method as shown in [1]_.
Parameters
----------
T : float
Temperature of gas [K]
similarity_variable : float
... | def Dadgostar_Shaw_integral_over_T(T, similarity_variable):
r'''Calculate the integral of liquid constant-pressure heat capacitiy
with the similarity variable concept and method as shown in [1]_.
Parameters
----------
T : float
Temperature of gas [K]
similarity_variable : float
... | [
"r",
"Calculate",
"the",
"integral",
"of",
"liquid",
"constant",
"-",
"pressure",
"heat",
"capacitiy",
"with",
"the",
"similarity",
"variable",
"concept",
"and",
"method",
"as",
"shown",
"in",
"[",
"1",
"]",
"_",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L1106-L1155 | [
"def",
"Dadgostar_Shaw_integral_over_T",
"(",
"T",
",",
"similarity_variable",
")",
":",
"a",
"=",
"similarity_variable",
"a2",
"=",
"a",
"*",
"a",
"a11",
"=",
"-",
"0.3416",
"a12",
"=",
"2.2671",
"a21",
"=",
"0.1064",
"a22",
"=",
"-",
"0.3874",
"a31",
"... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Zabransky_quasi_polynomial | r'''Calculates liquid heat capacity using the model developed in [1]_.
.. math::
\frac{C}{R}=A_1\ln(1-T_r) + \frac{A_2}{1-T_r}
+ \sum_{j=0}^m A_{j+3} T_r^j
Parameters
----------
T : float
Temperature [K]
Tc : float
Critical temperature of fluid, [K]
a1-a6 : floa... | thermo/heat_capacity.py | def Zabransky_quasi_polynomial(T, Tc, a1, a2, a3, a4, a5, a6):
r'''Calculates liquid heat capacity using the model developed in [1]_.
.. math::
\frac{C}{R}=A_1\ln(1-T_r) + \frac{A_2}{1-T_r}
+ \sum_{j=0}^m A_{j+3} T_r^j
Parameters
----------
T : float
Temperature [K]
Tc ... | def Zabransky_quasi_polynomial(T, Tc, a1, a2, a3, a4, a5, a6):
r'''Calculates liquid heat capacity using the model developed in [1]_.
.. math::
\frac{C}{R}=A_1\ln(1-T_r) + \frac{A_2}{1-T_r}
+ \sum_{j=0}^m A_{j+3} T_r^j
Parameters
----------
T : float
Temperature [K]
Tc ... | [
"r",
"Calculates",
"liquid",
"heat",
"capacity",
"using",
"the",
"model",
"developed",
"in",
"[",
"1",
"]",
"_",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L1473-L1514 | [
"def",
"Zabransky_quasi_polynomial",
"(",
"T",
",",
"Tc",
",",
"a1",
",",
"a2",
",",
"a3",
",",
"a4",
",",
"a5",
",",
"a6",
")",
":",
"Tr",
"=",
"T",
"/",
"Tc",
"return",
"R",
"*",
"(",
"a1",
"*",
"log",
"(",
"1",
"-",
"Tr",
")",
"+",
"a2",... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Zabransky_quasi_polynomial_integral | r'''Calculates the integral of liquid heat capacity using the
quasi-polynomial model developed in [1]_.
Parameters
----------
T : float
Temperature [K]
a1-a6 : float
Coefficients
Returns
-------
H : float
Difference in enthalpy from 0 K, [J/mol]
Notes
... | thermo/heat_capacity.py | def Zabransky_quasi_polynomial_integral(T, Tc, a1, a2, a3, a4, a5, a6):
r'''Calculates the integral of liquid heat capacity using the
quasi-polynomial model developed in [1]_.
Parameters
----------
T : float
Temperature [K]
a1-a6 : float
Coefficients
Returns
-------
... | def Zabransky_quasi_polynomial_integral(T, Tc, a1, a2, a3, a4, a5, a6):
r'''Calculates the integral of liquid heat capacity using the
quasi-polynomial model developed in [1]_.
Parameters
----------
T : float
Temperature [K]
a1-a6 : float
Coefficients
Returns
-------
... | [
"r",
"Calculates",
"the",
"integral",
"of",
"liquid",
"heat",
"capacity",
"using",
"the",
"quasi",
"-",
"polynomial",
"model",
"developed",
"in",
"[",
"1",
"]",
"_",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L1517-L1557 | [
"def",
"Zabransky_quasi_polynomial_integral",
"(",
"T",
",",
"Tc",
",",
"a1",
",",
"a2",
",",
"a3",
",",
"a4",
",",
"a5",
",",
"a6",
")",
":",
"Tc2",
"=",
"Tc",
"*",
"Tc",
"Tc3",
"=",
"Tc2",
"*",
"Tc",
"term",
"=",
"T",
"-",
"Tc",
"return",
"R"... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Zabransky_quasi_polynomial_integral_over_T | r'''Calculates the integral of liquid heat capacity over T using the
quasi-polynomial model developed in [1]_.
Parameters
----------
T : float
Temperature [K]
a1-a6 : float
Coefficients
Returns
-------
S : float
Difference in entropy from 0 K, [J/mol/K]
N... | thermo/heat_capacity.py | def Zabransky_quasi_polynomial_integral_over_T(T, Tc, a1, a2, a3, a4, a5, a6):
r'''Calculates the integral of liquid heat capacity over T using the
quasi-polynomial model developed in [1]_.
Parameters
----------
T : float
Temperature [K]
a1-a6 : float
Coefficients
Returns... | def Zabransky_quasi_polynomial_integral_over_T(T, Tc, a1, a2, a3, a4, a5, a6):
r'''Calculates the integral of liquid heat capacity over T using the
quasi-polynomial model developed in [1]_.
Parameters
----------
T : float
Temperature [K]
a1-a6 : float
Coefficients
Returns... | [
"r",
"Calculates",
"the",
"integral",
"of",
"liquid",
"heat",
"capacity",
"over",
"T",
"using",
"the",
"quasi",
"-",
"polynomial",
"model",
"developed",
"in",
"[",
"1",
"]",
"_",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L1560-L1603 | [
"def",
"Zabransky_quasi_polynomial_integral_over_T",
"(",
"T",
",",
"Tc",
",",
"a1",
",",
"a2",
",",
"a3",
",",
"a4",
",",
"a5",
",",
"a6",
")",
":",
"term",
"=",
"T",
"-",
"Tc",
"logT",
"=",
"log",
"(",
"T",
")",
"Tc2",
"=",
"Tc",
"*",
"Tc",
"... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Zabransky_cubic | r'''Calculates liquid heat capacity using the model developed in [1]_.
.. math::
\frac{C}{R}=\sum_{j=0}^3 A_{j+1} \left(\frac{T}{100}\right)^j
Parameters
----------
T : float
Temperature [K]
a1-a4 : float
Coefficients
Returns
-------
Cp : float
Liquid h... | thermo/heat_capacity.py | def Zabransky_cubic(T, a1, a2, a3, a4):
r'''Calculates liquid heat capacity using the model developed in [1]_.
.. math::
\frac{C}{R}=\sum_{j=0}^3 A_{j+1} \left(\frac{T}{100}\right)^j
Parameters
----------
T : float
Temperature [K]
a1-a4 : float
Coefficients
Returns... | def Zabransky_cubic(T, a1, a2, a3, a4):
r'''Calculates liquid heat capacity using the model developed in [1]_.
.. math::
\frac{C}{R}=\sum_{j=0}^3 A_{j+1} \left(\frac{T}{100}\right)^j
Parameters
----------
T : float
Temperature [K]
a1-a4 : float
Coefficients
Returns... | [
"r",
"Calculates",
"liquid",
"heat",
"capacity",
"using",
"the",
"model",
"developed",
"in",
"[",
"1",
"]",
"_",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L1606-L1641 | [
"def",
"Zabransky_cubic",
"(",
"T",
",",
"a1",
",",
"a2",
",",
"a3",
",",
"a4",
")",
":",
"T",
"=",
"T",
"/",
"100.",
"return",
"R",
"*",
"(",
"(",
"(",
"a4",
"*",
"T",
"+",
"a3",
")",
"*",
"T",
"+",
"a2",
")",
"*",
"T",
"+",
"a1",
")"
... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Zabransky_cubic_integral | r'''Calculates the integral of liquid heat capacity using the model
developed in [1]_.
Parameters
----------
T : float
Temperature [K]
a1-a4 : float
Coefficients
Returns
-------
H : float
Difference in enthalpy from 0 K, [J/mol]
Notes
-----
The ana... | thermo/heat_capacity.py | def Zabransky_cubic_integral(T, a1, a2, a3, a4):
r'''Calculates the integral of liquid heat capacity using the model
developed in [1]_.
Parameters
----------
T : float
Temperature [K]
a1-a4 : float
Coefficients
Returns
-------
H : float
Difference in enthal... | def Zabransky_cubic_integral(T, a1, a2, a3, a4):
r'''Calculates the integral of liquid heat capacity using the model
developed in [1]_.
Parameters
----------
T : float
Temperature [K]
a1-a4 : float
Coefficients
Returns
-------
H : float
Difference in enthal... | [
"r",
"Calculates",
"the",
"integral",
"of",
"liquid",
"heat",
"capacity",
"using",
"the",
"model",
"developed",
"in",
"[",
"1",
"]",
"_",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L1644-L1676 | [
"def",
"Zabransky_cubic_integral",
"(",
"T",
",",
"a1",
",",
"a2",
",",
"a3",
",",
"a4",
")",
":",
"T",
"=",
"T",
"/",
"100.",
"return",
"100",
"*",
"R",
"*",
"T",
"*",
"(",
"T",
"*",
"(",
"T",
"*",
"(",
"T",
"*",
"a4",
"*",
"0.25",
"+",
... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Zabransky_cubic_integral_over_T | r'''Calculates the integral of liquid heat capacity over T using the model
developed in [1]_.
Parameters
----------
T : float
Temperature [K]
a1-a4 : float
Coefficients
Returns
-------
S : float
Difference in entropy from 0 K, [J/mol/K]
Notes
-----
... | thermo/heat_capacity.py | def Zabransky_cubic_integral_over_T(T, a1, a2, a3, a4):
r'''Calculates the integral of liquid heat capacity over T using the model
developed in [1]_.
Parameters
----------
T : float
Temperature [K]
a1-a4 : float
Coefficients
Returns
-------
S : float
Differ... | def Zabransky_cubic_integral_over_T(T, a1, a2, a3, a4):
r'''Calculates the integral of liquid heat capacity over T using the model
developed in [1]_.
Parameters
----------
T : float
Temperature [K]
a1-a4 : float
Coefficients
Returns
-------
S : float
Differ... | [
"r",
"Calculates",
"the",
"integral",
"of",
"liquid",
"heat",
"capacity",
"over",
"T",
"using",
"the",
"model",
"developed",
"in",
"[",
"1",
"]",
"_",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L1679-L1713 | [
"def",
"Zabransky_cubic_integral_over_T",
"(",
"T",
",",
"a1",
",",
"a2",
",",
"a3",
",",
"a4",
")",
":",
"T",
"=",
"T",
"/",
"100.",
"return",
"R",
"*",
"(",
"T",
"*",
"(",
"T",
"*",
"(",
"T",
"*",
"a4",
"/",
"3",
"+",
"a3",
"/",
"2",
")",... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Lastovka_solid | r'''Calculate solid constant-pressure heat capacitiy with the similarity
variable concept and method as shown in [1]_.
.. math::
C_p = 3(A_1\alpha + A_2\alpha^2)R\left(\frac{\theta}{T}\right)^2
\frac{\exp(\theta/T)}{[\exp(\theta/T)-1]^2}
+ (C_1\alpha + C_2\alpha^2)T + (D_1\alpha + D_2\a... | thermo/heat_capacity.py | def Lastovka_solid(T, similarity_variable):
r'''Calculate solid constant-pressure heat capacitiy with the similarity
variable concept and method as shown in [1]_.
.. math::
C_p = 3(A_1\alpha + A_2\alpha^2)R\left(\frac{\theta}{T}\right)^2
\frac{\exp(\theta/T)}{[\exp(\theta/T)-1]^2}
+... | def Lastovka_solid(T, similarity_variable):
r'''Calculate solid constant-pressure heat capacitiy with the similarity
variable concept and method as shown in [1]_.
.. math::
C_p = 3(A_1\alpha + A_2\alpha^2)R\left(\frac{\theta}{T}\right)^2
\frac{\exp(\theta/T)}{[\exp(\theta/T)-1]^2}
+... | [
"r",
"Calculate",
"solid",
"constant",
"-",
"pressure",
"heat",
"capacitiy",
"with",
"the",
"similarity",
"variable",
"concept",
"and",
"method",
"as",
"shown",
"in",
"[",
"1",
"]",
"_",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L2193-L2257 | [
"def",
"Lastovka_solid",
"(",
"T",
",",
"similarity_variable",
")",
":",
"A1",
"=",
"0.013183",
"A2",
"=",
"0.249381",
"theta",
"=",
"151.8675",
"C1",
"=",
"0.026526",
"C2",
"=",
"-",
"0.024942",
"D1",
"=",
"0.000025",
"D2",
"=",
"-",
"0.000123",
"Cp",
... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Lastovka_solid_integral | r'''Integrates solid constant-pressure heat capacitiy with the similarity
variable concept and method as shown in [1]_.
Uses a explicit form as derived with Sympy.
Parameters
----------
T : float
Temperature of solid [K]
similarity_variable : float
similarity variable as de... | thermo/heat_capacity.py | def Lastovka_solid_integral(T, similarity_variable):
r'''Integrates solid constant-pressure heat capacitiy with the similarity
variable concept and method as shown in [1]_.
Uses a explicit form as derived with Sympy.
Parameters
----------
T : float
Temperature of solid [K]
simi... | def Lastovka_solid_integral(T, similarity_variable):
r'''Integrates solid constant-pressure heat capacitiy with the similarity
variable concept and method as shown in [1]_.
Uses a explicit form as derived with Sympy.
Parameters
----------
T : float
Temperature of solid [K]
simi... | [
"r",
"Integrates",
"solid",
"constant",
"-",
"pressure",
"heat",
"capacitiy",
"with",
"the",
"similarity",
"variable",
"concept",
"and",
"method",
"as",
"shown",
"in",
"[",
"1",
"]",
"_",
".",
"Uses",
"a",
"explicit",
"form",
"as",
"derived",
"with",
"Symp... | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L2260-L2313 | [
"def",
"Lastovka_solid_integral",
"(",
"T",
",",
"similarity_variable",
")",
":",
"A1",
"=",
"0.013183",
"A2",
"=",
"0.249381",
"theta",
"=",
"151.8675",
"C1",
"=",
"0.026526",
"C2",
"=",
"-",
"0.024942",
"D1",
"=",
"0.000025",
"D2",
"=",
"-",
"0.000123",
... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Lastovka_solid_integral_over_T | r'''Integrates over T solid constant-pressure heat capacitiy with the
similarity variable concept and method as shown in [1]_.
Uses a explicit form as derived with Sympy.
Parameters
----------
T : float
Temperature of solid [K]
similarity_variable : float
similarity variab... | thermo/heat_capacity.py | def Lastovka_solid_integral_over_T(T, similarity_variable):
r'''Integrates over T solid constant-pressure heat capacitiy with the
similarity variable concept and method as shown in [1]_.
Uses a explicit form as derived with Sympy.
Parameters
----------
T : float
Temperature of sol... | def Lastovka_solid_integral_over_T(T, similarity_variable):
r'''Integrates over T solid constant-pressure heat capacitiy with the
similarity variable concept and method as shown in [1]_.
Uses a explicit form as derived with Sympy.
Parameters
----------
T : float
Temperature of sol... | [
"r",
"Integrates",
"over",
"T",
"solid",
"constant",
"-",
"pressure",
"heat",
"capacitiy",
"with",
"the",
"similarity",
"variable",
"concept",
"and",
"method",
"as",
"shown",
"in",
"[",
"1",
"]",
"_",
".",
"Uses",
"a",
"explicit",
"form",
"as",
"derived",
... | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L2316-L2373 | [
"def",
"Lastovka_solid_integral_over_T",
"(",
"T",
",",
"similarity_variable",
")",
":",
"A1",
"=",
"0.013183",
"A2",
"=",
"0.249381",
"theta",
"=",
"151.8675",
"C1",
"=",
"0.026526",
"C2",
"=",
"-",
"0.024942",
"D1",
"=",
"0.000025",
"D2",
"=",
"-",
"0.00... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | HeatCapacityGas.load_all_methods | r'''Method which picks out coefficients for the specified chemical
from the various dictionaries and DataFrames storing it. All data is
stored as attributes. This method also sets :obj:`Tmin`, :obj:`Tmax`,
and :obj:`all_methods` as a set of methods for which the data exists for.
Called ... | thermo/heat_capacity.py | def load_all_methods(self):
r'''Method which picks out coefficients for the specified chemical
from the various dictionaries and DataFrames storing it. All data is
stored as attributes. This method also sets :obj:`Tmin`, :obj:`Tmax`,
and :obj:`all_methods` as a set of methods for which t... | def load_all_methods(self):
r'''Method which picks out coefficients for the specified chemical
from the various dictionaries and DataFrames storing it. All data is
stored as attributes. This method also sets :obj:`Tmin`, :obj:`Tmax`,
and :obj:`all_methods` as a set of methods for which t... | [
"r",
"Method",
"which",
"picks",
"out",
"coefficients",
"for",
"the",
"specified",
"chemical",
"from",
"the",
"various",
"dictionaries",
"and",
"DataFrames",
"storing",
"it",
".",
"All",
"data",
"is",
"stored",
"as",
"attributes",
".",
"This",
"method",
"also"... | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L662-L711 | [
"def",
"load_all_methods",
"(",
"self",
")",
":",
"methods",
"=",
"[",
"]",
"Tmins",
",",
"Tmaxs",
"=",
"[",
"]",
",",
"[",
"]",
"if",
"self",
".",
"CASRN",
"in",
"TRC_gas_data",
".",
"index",
":",
"methods",
".",
"append",
"(",
"TRCIG",
")",
"_",
... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | HeatCapacityGas.calculate | r'''Method to calculate surface tension of a liquid at temperature `T`
with a given method.
This method has no exception handling; see `T_dependent_property`
for that.
Parameters
----------
T : float
Temperature at which to calculate heat capacity, [K]
... | thermo/heat_capacity.py | def calculate(self, T, method):
r'''Method to calculate surface tension of a liquid at temperature `T`
with a given method.
This method has no exception handling; see `T_dependent_property`
for that.
Parameters
----------
T : float
Temperature at whi... | def calculate(self, T, method):
r'''Method to calculate surface tension of a liquid at temperature `T`
with a given method.
This method has no exception handling; see `T_dependent_property`
for that.
Parameters
----------
T : float
Temperature at whi... | [
"r",
"Method",
"to",
"calculate",
"surface",
"tension",
"of",
"a",
"liquid",
"at",
"temperature",
"T",
"with",
"a",
"given",
"method",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L713-L749 | [
"def",
"calculate",
"(",
"self",
",",
"T",
",",
"method",
")",
":",
"if",
"method",
"==",
"TRCIG",
":",
"Cp",
"=",
"TRCCp",
"(",
"T",
",",
"*",
"self",
".",
"TRCIG_coefs",
")",
"elif",
"method",
"==",
"COOLPROP",
":",
"Cp",
"=",
"PropsSI",
"(",
"... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | HeatCapacityGas.calculate_integral | r'''Method to calculate the integral of a property with respect to
temperature, using a specified method. Implements the analytical
integrals of all available methods except for tabular data.
Parameters
----------
T1 : float
Lower limit of integration, [K]
... | thermo/heat_capacity.py | def calculate_integral(self, T1, T2, method):
r'''Method to calculate the integral of a property with respect to
temperature, using a specified method. Implements the analytical
integrals of all available methods except for tabular data.
Parameters
----------
T1 ... | def calculate_integral(self, T1, T2, method):
r'''Method to calculate the integral of a property with respect to
temperature, using a specified method. Implements the analytical
integrals of all available methods except for tabular data.
Parameters
----------
T1 ... | [
"r",
"Method",
"to",
"calculate",
"the",
"integral",
"of",
"a",
"property",
"with",
"respect",
"to",
"temperature",
"using",
"a",
"specified",
"method",
".",
"Implements",
"the",
"analytical",
"integrals",
"of",
"all",
"available",
"methods",
"except",
"for",
... | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L804-L844 | [
"def",
"calculate_integral",
"(",
"self",
",",
"T1",
",",
"T2",
",",
"method",
")",
":",
"if",
"method",
"==",
"TRCIG",
":",
"H2",
"=",
"TRCCp_integral",
"(",
"T2",
",",
"*",
"self",
".",
"TRCIG_coefs",
")",
"H1",
"=",
"TRCCp_integral",
"(",
"T1",
",... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | HeatCapacityGas.calculate_integral_over_T | r'''Method to calculate the integral of a property over temperature
with respect to temperature, using a specified method. Implements the
analytical integrals of all available methods except for tabular data.
Parameters
----------
T1 : float
Lower limit of i... | thermo/heat_capacity.py | def calculate_integral_over_T(self, T1, T2, method):
r'''Method to calculate the integral of a property over temperature
with respect to temperature, using a specified method. Implements the
analytical integrals of all available methods except for tabular data.
Parameters
... | def calculate_integral_over_T(self, T1, T2, method):
r'''Method to calculate the integral of a property over temperature
with respect to temperature, using a specified method. Implements the
analytical integrals of all available methods except for tabular data.
Parameters
... | [
"r",
"Method",
"to",
"calculate",
"the",
"integral",
"of",
"a",
"property",
"over",
"temperature",
"with",
"respect",
"to",
"temperature",
"using",
"a",
"specified",
"method",
".",
"Implements",
"the",
"analytical",
"integrals",
"of",
"all",
"available",
"method... | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L847-L887 | [
"def",
"calculate_integral_over_T",
"(",
"self",
",",
"T1",
",",
"T2",
",",
"method",
")",
":",
"if",
"method",
"==",
"TRCIG",
":",
"S2",
"=",
"TRCCp_integral_over_T",
"(",
"T2",
",",
"*",
"self",
".",
"TRCIG_coefs",
")",
"S1",
"=",
"TRCCp_integral_over_T"... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Zabransky_quasipolynomial.calculate_integral | r'''Method to compute the enthalpy integral of heat capacity from
`T1` to `T2`.
Parameters
----------
T1 : float
Initial temperature, [K]
T2 : float
Final temperature, [K]
Returns
-------
dH : float
... | thermo/heat_capacity.py | def calculate_integral(self, T1, T2):
r'''Method to compute the enthalpy integral of heat capacity from
`T1` to `T2`.
Parameters
----------
T1 : float
Initial temperature, [K]
T2 : float
Final temperature, [K]
Re... | def calculate_integral(self, T1, T2):
r'''Method to compute the enthalpy integral of heat capacity from
`T1` to `T2`.
Parameters
----------
T1 : float
Initial temperature, [K]
T2 : float
Final temperature, [K]
Re... | [
"r",
"Method",
"to",
"compute",
"the",
"enthalpy",
"integral",
"of",
"heat",
"capacity",
"from",
"T1",
"to",
"T2",
".",
"Parameters",
"----------",
"T1",
":",
"float",
"Initial",
"temperature",
"[",
"K",
"]",
"T2",
":",
"float",
"Final",
"temperature",
"["... | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L1222-L1239 | [
"def",
"calculate_integral",
"(",
"self",
",",
"T1",
",",
"T2",
")",
":",
"return",
"(",
"Zabransky_quasi_polynomial_integral",
"(",
"T2",
",",
"self",
".",
"Tc",
",",
"*",
"self",
".",
"coeffs",
")",
"-",
"Zabransky_quasi_polynomial_integral",
"(",
"T1",
",... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Zabransky_quasipolynomial.calculate_integral_over_T | r'''Method to compute the entropy integral of heat capacity from
`T1` to `T2`.
Parameters
----------
T1 : float
Initial temperature, [K]
T2 : float
Final temperature, [K]
Returns
-------
dS : float
... | thermo/heat_capacity.py | def calculate_integral_over_T(self, T1, T2):
r'''Method to compute the entropy integral of heat capacity from
`T1` to `T2`.
Parameters
----------
T1 : float
Initial temperature, [K]
T2 : float
Final temperature, [K]
... | def calculate_integral_over_T(self, T1, T2):
r'''Method to compute the entropy integral of heat capacity from
`T1` to `T2`.
Parameters
----------
T1 : float
Initial temperature, [K]
T2 : float
Final temperature, [K]
... | [
"r",
"Method",
"to",
"compute",
"the",
"entropy",
"integral",
"of",
"heat",
"capacity",
"from",
"T1",
"to",
"T2",
".",
"Parameters",
"----------",
"T1",
":",
"float",
"Initial",
"temperature",
"[",
"K",
"]",
"T2",
":",
"float",
"Final",
"temperature",
"[",... | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L1241-L1258 | [
"def",
"calculate_integral_over_T",
"(",
"self",
",",
"T1",
",",
"T2",
")",
":",
"return",
"(",
"Zabransky_quasi_polynomial_integral_over_T",
"(",
"T2",
",",
"self",
".",
"Tc",
",",
"*",
"self",
".",
"coeffs",
")",
"-",
"Zabransky_quasi_polynomial_integral_over_T"... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Zabransky_spline.add_coeffs | Called internally during the parsing of the Zabransky database, to
add coefficients as they are read one per line | thermo/heat_capacity.py | def add_coeffs(self, Tmin, Tmax, coeffs):
'''Called internally during the parsing of the Zabransky database, to
add coefficients as they are read one per line'''
self.n += 1
if not self.Ts:
self.Ts = [Tmin, Tmax]
self.coeff_sets = [coeffs]
else:
... | def add_coeffs(self, Tmin, Tmax, coeffs):
'''Called internally during the parsing of the Zabransky database, to
add coefficients as they are read one per line'''
self.n += 1
if not self.Ts:
self.Ts = [Tmin, Tmax]
self.coeff_sets = [coeffs]
else:
... | [
"Called",
"internally",
"during",
"the",
"parsing",
"of",
"the",
"Zabransky",
"database",
"to",
"add",
"coefficients",
"as",
"they",
"are",
"read",
"one",
"per",
"line"
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L1299-L1315 | [
"def",
"add_coeffs",
"(",
"self",
",",
"Tmin",
",",
"Tmax",
",",
"coeffs",
")",
":",
"self",
".",
"n",
"+=",
"1",
"if",
"not",
"self",
".",
"Ts",
":",
"self",
".",
"Ts",
"=",
"[",
"Tmin",
",",
"Tmax",
"]",
"self",
".",
"coeff_sets",
"=",
"[",
... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Zabransky_spline._coeff_ind_from_T | Determines the index at which the coefficients for the current
temperature are stored in `coeff_sets`. | thermo/heat_capacity.py | def _coeff_ind_from_T(self, T):
'''Determines the index at which the coefficients for the current
temperature are stored in `coeff_sets`.
'''
# DO NOT CHANGE
if self.n == 1:
return 0
for i in range(self.n):
if T <= self.Ts[i+1]:
ret... | def _coeff_ind_from_T(self, T):
'''Determines the index at which the coefficients for the current
temperature are stored in `coeff_sets`.
'''
# DO NOT CHANGE
if self.n == 1:
return 0
for i in range(self.n):
if T <= self.Ts[i+1]:
ret... | [
"Determines",
"the",
"index",
"at",
"which",
"the",
"coefficients",
"for",
"the",
"current",
"temperature",
"are",
"stored",
"in",
"coeff_sets",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L1317-L1327 | [
"def",
"_coeff_ind_from_T",
"(",
"self",
",",
"T",
")",
":",
"# DO NOT CHANGE",
"if",
"self",
".",
"n",
"==",
"1",
":",
"return",
"0",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"n",
")",
":",
"if",
"T",
"<=",
"self",
".",
"Ts",
"[",
"i",
"+"... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Zabransky_spline.calculate | r'''Method to actually calculate heat capacity as a function of
temperature.
Parameters
----------
T : float
Temperature, [K]
Returns
-------
Cp : float
Liquid heat capacity as T, [J/mol/K] | thermo/heat_capacity.py | def calculate(self, T):
r'''Method to actually calculate heat capacity as a function of
temperature.
Parameters
----------
T : float
Temperature, [K]
Returns
-------
Cp : float
Liquid heat capacity as T, [J/mol/K]
... | def calculate(self, T):
r'''Method to actually calculate heat capacity as a function of
temperature.
Parameters
----------
T : float
Temperature, [K]
Returns
-------
Cp : float
Liquid heat capacity as T, [J/mol/K]
... | [
"r",
"Method",
"to",
"actually",
"calculate",
"heat",
"capacity",
"as",
"a",
"function",
"of",
"temperature",
".",
"Parameters",
"----------",
"T",
":",
"float",
"Temperature",
"[",
"K",
"]"
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L1329-L1343 | [
"def",
"calculate",
"(",
"self",
",",
"T",
")",
":",
"return",
"Zabransky_cubic",
"(",
"T",
",",
"*",
"self",
".",
"coeff_sets",
"[",
"self",
".",
"_coeff_ind_from_T",
"(",
"T",
")",
"]",
")"
] | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Zabransky_spline.calculate_integral | r'''Method to compute the enthalpy integral of heat capacity from
`T1` to `T2`. Analytically integrates across the piecewise spline
as necessary.
Parameters
----------
T1 : float
Initial temperature, [K]
T2 : float
Final temperature, ... | thermo/heat_capacity.py | def calculate_integral(self, T1, T2):
r'''Method to compute the enthalpy integral of heat capacity from
`T1` to `T2`. Analytically integrates across the piecewise spline
as necessary.
Parameters
----------
T1 : float
Initial temperature, [K]
... | def calculate_integral(self, T1, T2):
r'''Method to compute the enthalpy integral of heat capacity from
`T1` to `T2`. Analytically integrates across the piecewise spline
as necessary.
Parameters
----------
T1 : float
Initial temperature, [K]
... | [
"r",
"Method",
"to",
"compute",
"the",
"enthalpy",
"integral",
"of",
"heat",
"capacity",
"from",
"T1",
"to",
"T2",
".",
"Analytically",
"integrates",
"across",
"the",
"piecewise",
"spline",
"as",
"necessary",
".",
"Parameters",
"----------",
"T1",
":",
"float"... | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L1345-L1390 | [
"def",
"calculate_integral",
"(",
"self",
",",
"T1",
",",
"T2",
")",
":",
"# Simplify the problem so we can assume T2 >= T1",
"if",
"T2",
"<",
"T1",
":",
"flipped",
"=",
"True",
"T1",
",",
"T2",
"=",
"T2",
",",
"T1",
"else",
":",
"flipped",
"=",
"False",
... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | Zabransky_spline.calculate_integral_over_T | r'''Method to compute the entropy integral of heat capacity from
`T1` to `T2`. Analytically integrates across the piecewise spline
as necessary.
Parameters
----------
T1 : float
Initial temperature, [K]
T2 : float
Final temperature, [... | thermo/heat_capacity.py | def calculate_integral_over_T(self, T1, T2):
r'''Method to compute the entropy integral of heat capacity from
`T1` to `T2`. Analytically integrates across the piecewise spline
as necessary.
Parameters
----------
T1 : float
Initial temperature, [K... | def calculate_integral_over_T(self, T1, T2):
r'''Method to compute the entropy integral of heat capacity from
`T1` to `T2`. Analytically integrates across the piecewise spline
as necessary.
Parameters
----------
T1 : float
Initial temperature, [K... | [
"r",
"Method",
"to",
"compute",
"the",
"entropy",
"integral",
"of",
"heat",
"capacity",
"from",
"T1",
"to",
"T2",
".",
"Analytically",
"integrates",
"across",
"the",
"piecewise",
"spline",
"as",
"necessary",
".",
"Parameters",
"----------",
"T1",
":",
"float",... | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L1392-L1437 | [
"def",
"calculate_integral_over_T",
"(",
"self",
",",
"T1",
",",
"T2",
")",
":",
"# Simplify the problem so we can assume T2 >= T1",
"if",
"T2",
"<",
"T1",
":",
"flipped",
"=",
"True",
"T1",
",",
"T2",
"=",
"T2",
",",
"T1",
"else",
":",
"flipped",
"=",
"Fa... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | HeatCapacityLiquid.load_all_methods | r'''Method which picks out coefficients for the specified chemical
from the various dictionaries and DataFrames storing it. All data is
stored as attributes. This method also sets :obj:`Tmin`, :obj:`Tmax`,
and :obj:`all_methods` as a set of methods for which the data exists for.
Called ... | thermo/heat_capacity.py | def load_all_methods(self):
r'''Method which picks out coefficients for the specified chemical
from the various dictionaries and DataFrames storing it. All data is
stored as attributes. This method also sets :obj:`Tmin`, :obj:`Tmax`,
and :obj:`all_methods` as a set of methods for which t... | def load_all_methods(self):
r'''Method which picks out coefficients for the specified chemical
from the various dictionaries and DataFrames storing it. All data is
stored as attributes. This method also sets :obj:`Tmin`, :obj:`Tmax`,
and :obj:`all_methods` as a set of methods for which t... | [
"r",
"Method",
"which",
"picks",
"out",
"coefficients",
"for",
"the",
"specified",
"chemical",
"from",
"the",
"various",
"dictionaries",
"and",
"DataFrames",
"storing",
"it",
".",
"All",
"data",
"is",
"stored",
"as",
"attributes",
".",
"This",
"method",
"also"... | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L1911-L1972 | [
"def",
"load_all_methods",
"(",
"self",
")",
":",
"methods",
"=",
"[",
"]",
"Tmins",
",",
"Tmaxs",
"=",
"[",
"]",
",",
"[",
"]",
"if",
"self",
".",
"CASRN",
"in",
"zabransky_dict_const_s",
":",
"methods",
".",
"append",
"(",
"ZABRANSKY_SPLINE",
")",
"s... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | HeatCapacityLiquid.calculate | r'''Method to calculate heat capacity of a liquid at temperature `T`
with a given method.
This method has no exception handling; see `T_dependent_property`
for that.
Parameters
----------
T : float
Temperature at which to calculate heat capacity, [K]
... | thermo/heat_capacity.py | def calculate(self, T, method):
r'''Method to calculate heat capacity of a liquid at temperature `T`
with a given method.
This method has no exception handling; see `T_dependent_property`
for that.
Parameters
----------
T : float
Temperature at which... | def calculate(self, T, method):
r'''Method to calculate heat capacity of a liquid at temperature `T`
with a given method.
This method has no exception handling; see `T_dependent_property`
for that.
Parameters
----------
T : float
Temperature at which... | [
"r",
"Method",
"to",
"calculate",
"heat",
"capacity",
"of",
"a",
"liquid",
"at",
"temperature",
"T",
"with",
"a",
"given",
"method",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L1975-L2024 | [
"def",
"calculate",
"(",
"self",
",",
"T",
",",
"method",
")",
":",
"if",
"method",
"==",
"ZABRANSKY_SPLINE",
":",
"return",
"self",
".",
"Zabransky_spline",
".",
"calculate",
"(",
"T",
")",
"elif",
"method",
"==",
"ZABRANSKY_QUASIPOLYNOMIAL",
":",
"return",... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | HeatCapacityLiquid.calculate_integral | r'''Method to calculate the integral of a property with respect to
temperature, using a specified method. Implements the
analytical integrals of all available methods except for tabular data,
the case of multiple coefficient sets needed to encompass the temperature
range of any of the ... | thermo/heat_capacity.py | def calculate_integral(self, T1, T2, method):
r'''Method to calculate the integral of a property with respect to
temperature, using a specified method. Implements the
analytical integrals of all available methods except for tabular data,
the case of multiple coefficient sets needed to ... | def calculate_integral(self, T1, T2, method):
r'''Method to calculate the integral of a property with respect to
temperature, using a specified method. Implements the
analytical integrals of all available methods except for tabular data,
the case of multiple coefficient sets needed to ... | [
"r",
"Method",
"to",
"calculate",
"the",
"integral",
"of",
"a",
"property",
"with",
"respect",
"to",
"temperature",
"using",
"a",
"specified",
"method",
".",
"Implements",
"the",
"analytical",
"integrals",
"of",
"all",
"available",
"methods",
"except",
"for",
... | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L2094-L2140 | [
"def",
"calculate_integral",
"(",
"self",
",",
"T1",
",",
"T2",
",",
"method",
")",
":",
"if",
"method",
"==",
"ZABRANSKY_SPLINE",
":",
"return",
"self",
".",
"Zabransky_spline",
".",
"calculate_integral",
"(",
"T1",
",",
"T2",
")",
"elif",
"method",
"==",... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | HeatCapacityLiquid.calculate_integral_over_T | r'''Method to calculate the integral of a property over temperature
with respect to temperature, using a specified method. Implements the
analytical integrals of all available methods except for tabular data,
the case of multiple coefficient sets needed to encompass the temperature
ra... | thermo/heat_capacity.py | def calculate_integral_over_T(self, T1, T2, method):
r'''Method to calculate the integral of a property over temperature
with respect to temperature, using a specified method. Implements the
analytical integrals of all available methods except for tabular data,
the case of multiple co... | def calculate_integral_over_T(self, T1, T2, method):
r'''Method to calculate the integral of a property over temperature
with respect to temperature, using a specified method. Implements the
analytical integrals of all available methods except for tabular data,
the case of multiple co... | [
"r",
"Method",
"to",
"calculate",
"the",
"integral",
"of",
"a",
"property",
"over",
"temperature",
"with",
"respect",
"to",
"temperature",
"using",
"a",
"specified",
"method",
".",
"Implements",
"the",
"analytical",
"integrals",
"of",
"all",
"available",
"method... | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L2142-L2188 | [
"def",
"calculate_integral_over_T",
"(",
"self",
",",
"T1",
",",
"T2",
",",
"method",
")",
":",
"if",
"method",
"==",
"ZABRANSKY_SPLINE",
":",
"return",
"self",
".",
"Zabransky_spline",
".",
"calculate_integral_over_T",
"(",
"T1",
",",
"T2",
")",
"elif",
"me... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | HeatCapacitySolid.load_all_methods | r'''Method which picks out coefficients for the specified chemical
from the various dictionaries and DataFrames storing it. All data is
stored as attributes. This method also sets :obj:`Tmin`, :obj:`Tmax`,
and :obj:`all_methods` as a set of methods for which the data exists for.
Called ... | thermo/heat_capacity.py | def load_all_methods(self):
r'''Method which picks out coefficients for the specified chemical
from the various dictionaries and DataFrames storing it. All data is
stored as attributes. This method also sets :obj:`Tmin`, :obj:`Tmax`,
and :obj:`all_methods` as a set of methods for which t... | def load_all_methods(self):
r'''Method which picks out coefficients for the specified chemical
from the various dictionaries and DataFrames storing it. All data is
stored as attributes. This method also sets :obj:`Tmin`, :obj:`Tmax`,
and :obj:`all_methods` as a set of methods for which t... | [
"r",
"Method",
"which",
"picks",
"out",
"coefficients",
"for",
"the",
"specified",
"chemical",
"from",
"the",
"various",
"dictionaries",
"and",
"DataFrames",
"storing",
"it",
".",
"All",
"data",
"is",
"stored",
"as",
"attributes",
".",
"This",
"method",
"also"... | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L2489-L2520 | [
"def",
"load_all_methods",
"(",
"self",
")",
":",
"methods",
"=",
"[",
"]",
"Tmins",
",",
"Tmaxs",
"=",
"[",
"]",
",",
"[",
"]",
"if",
"self",
".",
"CASRN",
"and",
"self",
".",
"CASRN",
"in",
"_PerryI",
"and",
"'c'",
"in",
"_PerryI",
"[",
"self",
... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | HeatCapacitySolid.calculate | r'''Method to calculate heat capacity of a solid at temperature `T`
with a given method.
This method has no exception handling; see `T_dependent_property`
for that.
Parameters
----------
T : float
Temperature at which to calculate heat capacity, [K]
... | thermo/heat_capacity.py | def calculate(self, T, method):
r'''Method to calculate heat capacity of a solid at temperature `T`
with a given method.
This method has no exception handling; see `T_dependent_property`
for that.
Parameters
----------
T : float
Temperature at which ... | def calculate(self, T, method):
r'''Method to calculate heat capacity of a solid at temperature `T`
with a given method.
This method has no exception handling; see `T_dependent_property`
for that.
Parameters
----------
T : float
Temperature at which ... | [
"r",
"Method",
"to",
"calculate",
"heat",
"capacity",
"of",
"a",
"solid",
"at",
"temperature",
"T",
"with",
"a",
"given",
"method",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L2523-L2552 | [
"def",
"calculate",
"(",
"self",
",",
"T",
",",
"method",
")",
":",
"if",
"method",
"==",
"PERRY151",
":",
"Cp",
"=",
"(",
"self",
".",
"PERRY151_const",
"+",
"self",
".",
"PERRY151_lin",
"*",
"T",
"+",
"self",
".",
"PERRY151_quadinv",
"/",
"T",
"**"... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | HeatCapacitySolid.calculate_integral | r'''Method to calculate the integral of a property with respect to
temperature, using a specified method. Implements the analytical
integrals of all available methods except for tabular data.
Parameters
----------
T1 : float
Lower limit of integration, [K]
... | thermo/heat_capacity.py | def calculate_integral(self, T1, T2, method):
r'''Method to calculate the integral of a property with respect to
temperature, using a specified method. Implements the analytical
integrals of all available methods except for tabular data.
Parameters
----------
T1 ... | def calculate_integral(self, T1, T2, method):
r'''Method to calculate the integral of a property with respect to
temperature, using a specified method. Implements the analytical
integrals of all available methods except for tabular data.
Parameters
----------
T1 ... | [
"r",
"Method",
"to",
"calculate",
"the",
"integral",
"of",
"a",
"property",
"with",
"respect",
"to",
"temperature",
"using",
"a",
"specified",
"method",
".",
"Implements",
"the",
"analytical",
"integrals",
"of",
"all",
"available",
"methods",
"except",
"for",
... | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L2599-L2634 | [
"def",
"calculate_integral",
"(",
"self",
",",
"T1",
",",
"T2",
",",
"method",
")",
":",
"if",
"method",
"==",
"PERRY151",
":",
"H2",
"=",
"(",
"self",
".",
"PERRY151_const",
"*",
"T2",
"+",
"0.5",
"*",
"self",
".",
"PERRY151_lin",
"*",
"T2",
"**",
... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | HeatCapacitySolid.calculate_integral_over_T | r'''Method to calculate the integral of a property over temperature
with respect to temperature, using a specified method. Implements the
analytical integrals of all available methods except for tabular data.
Parameters
----------
T1 : float
Lower limit of i... | thermo/heat_capacity.py | def calculate_integral_over_T(self, T1, T2, method):
r'''Method to calculate the integral of a property over temperature
with respect to temperature, using a specified method. Implements the
analytical integrals of all available methods except for tabular data.
Parameters
... | def calculate_integral_over_T(self, T1, T2, method):
r'''Method to calculate the integral of a property over temperature
with respect to temperature, using a specified method. Implements the
analytical integrals of all available methods except for tabular data.
Parameters
... | [
"r",
"Method",
"to",
"calculate",
"the",
"integral",
"of",
"a",
"property",
"over",
"temperature",
"with",
"respect",
"to",
"temperature",
"using",
"a",
"specified",
"method",
".",
"Implements",
"the",
"analytical",
"integrals",
"of",
"all",
"available",
"method... | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L2636-L2673 | [
"def",
"calculate_integral_over_T",
"(",
"self",
",",
"T1",
",",
"T2",
",",
"method",
")",
":",
"if",
"method",
"==",
"PERRY151",
":",
"S2",
"=",
"(",
"self",
".",
"PERRY151_const",
"*",
"log",
"(",
"T2",
")",
"+",
"self",
".",
"PERRY151_lin",
"*",
"... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | HeatCapacityLiquidMixture.load_all_methods | r'''Method to initialize the object by precomputing any values which
may be used repeatedly and by retrieving mixture-specific variables.
All data are stored as attributes. This method also sets :obj:`Tmin`,
:obj:`Tmax`, and :obj:`all_methods` as a set of methods which should
work to c... | thermo/heat_capacity.py | def load_all_methods(self):
r'''Method to initialize the object by precomputing any values which
may be used repeatedly and by retrieving mixture-specific variables.
All data are stored as attributes. This method also sets :obj:`Tmin`,
:obj:`Tmax`, and :obj:`all_methods` as a set of met... | def load_all_methods(self):
r'''Method to initialize the object by precomputing any values which
may be used repeatedly and by retrieving mixture-specific variables.
All data are stored as attributes. This method also sets :obj:`Tmin`,
:obj:`Tmax`, and :obj:`all_methods` as a set of met... | [
"r",
"Method",
"to",
"initialize",
"the",
"object",
"by",
"precomputing",
"any",
"values",
"which",
"may",
"be",
"used",
"repeatedly",
"and",
"by",
"retrieving",
"mixture",
"-",
"specific",
"variables",
".",
"All",
"data",
"are",
"stored",
"as",
"attributes",
... | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L2746-L2765 | [
"def",
"load_all_methods",
"(",
"self",
")",
":",
"methods",
"=",
"[",
"SIMPLE",
"]",
"if",
"len",
"(",
"self",
".",
"CASs",
")",
">",
"1",
"and",
"'7732-18-5'",
"in",
"self",
".",
"CASs",
":",
"wCASs",
"=",
"[",
"i",
"for",
"i",
"in",
"self",
".... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | HeatCapacityLiquidMixture.calculate | r'''Method to calculate heat capacity of a liquid mixture at
temperature `T`, pressure `P`, mole fractions `zs` and weight fractions
`ws` with a given method.
This method has no exception handling; see `mixture_property`
for that.
Parameters
----------
T : floa... | thermo/heat_capacity.py | def calculate(self, T, P, zs, ws, method):
r'''Method to calculate heat capacity of a liquid mixture at
temperature `T`, pressure `P`, mole fractions `zs` and weight fractions
`ws` with a given method.
This method has no exception handling; see `mixture_property`
for that.
... | def calculate(self, T, P, zs, ws, method):
r'''Method to calculate heat capacity of a liquid mixture at
temperature `T`, pressure `P`, mole fractions `zs` and weight fractions
`ws` with a given method.
This method has no exception handling; see `mixture_property`
for that.
... | [
"r",
"Method",
"to",
"calculate",
"heat",
"capacity",
"of",
"a",
"liquid",
"mixture",
"at",
"temperature",
"T",
"pressure",
"P",
"mole",
"fractions",
"zs",
"and",
"weight",
"fractions",
"ws",
"with",
"a",
"given",
"method",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L2767-L2803 | [
"def",
"calculate",
"(",
"self",
",",
"T",
",",
"P",
",",
"zs",
",",
"ws",
",",
"method",
")",
":",
"if",
"method",
"==",
"SIMPLE",
":",
"Cplms",
"=",
"[",
"i",
"(",
"T",
")",
"for",
"i",
"in",
"self",
".",
"HeatCapacityLiquids",
"]",
"return",
... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | HeatCapacitySolidMixture.calculate | r'''Method to calculate heat capacity of a solid mixture at
temperature `T`, pressure `P`, mole fractions `zs` and weight fractions
`ws` with a given method.
This method has no exception handling; see `mixture_property`
for that.
Parameters
----------
T : float... | thermo/heat_capacity.py | def calculate(self, T, P, zs, ws, method):
r'''Method to calculate heat capacity of a solid mixture at
temperature `T`, pressure `P`, mole fractions `zs` and weight fractions
`ws` with a given method.
This method has no exception handling; see `mixture_property`
for that.
... | def calculate(self, T, P, zs, ws, method):
r'''Method to calculate heat capacity of a solid mixture at
temperature `T`, pressure `P`, mole fractions `zs` and weight fractions
`ws` with a given method.
This method has no exception handling; see `mixture_property`
for that.
... | [
"r",
"Method",
"to",
"calculate",
"heat",
"capacity",
"of",
"a",
"solid",
"mixture",
"at",
"temperature",
"T",
"pressure",
"P",
"mole",
"fractions",
"zs",
"and",
"weight",
"fractions",
"ws",
"with",
"a",
"given",
"method",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L2902-L2932 | [
"def",
"calculate",
"(",
"self",
",",
"T",
",",
"P",
",",
"zs",
",",
"ws",
",",
"method",
")",
":",
"if",
"method",
"==",
"SIMPLE",
":",
"Cpsms",
"=",
"[",
"i",
"(",
"T",
")",
"for",
"i",
"in",
"self",
".",
"HeatCapacitySolids",
"]",
"return",
... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
valid | HeatCapacityGasMixture.calculate | r'''Method to calculate heat capacity of a gas mixture at
temperature `T`, pressure `P`, mole fractions `zs` and weight fractions
`ws` with a given method.
This method has no exception handling; see `mixture_property`
for that.
Parameters
----------
T : float
... | thermo/heat_capacity.py | def calculate(self, T, P, zs, ws, method):
r'''Method to calculate heat capacity of a gas mixture at
temperature `T`, pressure `P`, mole fractions `zs` and weight fractions
`ws` with a given method.
This method has no exception handling; see `mixture_property`
for that.
... | def calculate(self, T, P, zs, ws, method):
r'''Method to calculate heat capacity of a gas mixture at
temperature `T`, pressure `P`, mole fractions `zs` and weight fractions
`ws` with a given method.
This method has no exception handling; see `mixture_property`
for that.
... | [
"r",
"Method",
"to",
"calculate",
"heat",
"capacity",
"of",
"a",
"gas",
"mixture",
"at",
"temperature",
"T",
"pressure",
"P",
"mole",
"fractions",
"zs",
"and",
"weight",
"fractions",
"ws",
"with",
"a",
"given",
"method",
"."
] | CalebBell/thermo | python | https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/heat_capacity.py#L3031-L3062 | [
"def",
"calculate",
"(",
"self",
",",
"T",
",",
"P",
",",
"zs",
",",
"ws",
",",
"method",
")",
":",
"if",
"method",
"==",
"SIMPLE",
":",
"Cpgms",
"=",
"[",
"i",
"(",
"T",
")",
"for",
"i",
"in",
"self",
".",
"HeatCapacityGases",
"]",
"return",
"... | 3857ed023a3e64fd3039a32d53576c24990ef1c3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.