Fix typos and wrong types in remote_config.py
还没有人认领这个 Issue。
评估
调研方向
从 firebase_admin/remote_config.py 开始,阅读 evaluate_custom_signal_condition 和 _Value.as_int(),以及附近的类型处理代码。根据 issue 验证回退值和返回注解,然后在可用的情况下运行仓库中相关的 remote-config 测试;完成的标准是默认值和注解与其字段类型匹配,且没有回归问题。
由索引模型根据 Issue 内容生成。
描述
[READ] Step 1: Are you in the right place?
This is a bug in the code of this repository (firebase_admin/remote_config.py).
[REQUIRED] Step 2: Describe your environment
- Operating System version: Windows 11
- Firebase SDK version: 6.x (latest)
- Firebase Product: remote_config
- Python version: 3.11
- Pip version: 24.x
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
In firebase_admin/remote_config.py, the method evaluate_custom_signal_condition
uses {} (empty dict) as the default fallback for string and list fields:
custom_signal_operator = custom_signal_condition.get('customSignalOperator') or {}
custom_signal_key = custom_signal_condition.get('customSignalKey') or {}
target_custom_signal_values = custom_signal_condition.get('targetCustomSignalValues') or {}
These should be '' (string) and [] (list) respectively, as the fields are
not dicts. Using {} is semantically incorrect.
Also, _Value.as_int() has a wrong return type annotation -> float instead
of -> int.
Relevant Code:
# Wrong defaults — should be '' and []
custom_signal_operator = custom_signal_condition.get('customSignalOperator') or {}
custom_signal_key = custom_signal_condition.get('customSignalKey') or {}
target_custom_signal_values = custom_signal_condition.get('targetCustomSignalValues') or {}
# Wrong return type annotation — should be -> int
def as_int(self) -> float:
"""Returns the value as a number."""
- 主要语言
- Python
- 星标
- 1.2k
- 派生
- 359
- 平均合并
- 5 天 6 分钟
- 30 天内合并 PR
- 2
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
firebase/firebase-admin-python 的其他 Issue
-
api: database type: feature request
难度 2/5 1-3 小时 新手友好度 62/100
-
难度 4/5 3-5 天 新手友好度 45/100
firebase/firebase-admin-python#978 · 1 条评论 ·
-
[FR] Support VERIFY_AND_CHANGE_EMAIL in generate_email_action_link (parity with firebase-admin-node) 未关闭api: auth
firebase/firebase-admin-python#949 · 2 条评论 · 1 个 reaction · 已指派 1 人 ·
-
难度 4/5 3-5 天 新手友好度 43/100
firebase/firebase-admin-python#945 · 1 条评论 · 1 个 reaction ·
-
type: feature request
firebase/firebase-admin-python#915 · 5 条评论 · 3 个 reaction · 已指派 3 人 ·
查看 firebase/firebase-admin-python 的全部 Issue
相似的 Issue
-
documentation help wanted
难度 2/5 1-3 小时 新手友好度 90/100
-
难度 2/5 1-3 小时 新手友好度 90/100
simonw/sqlite-utils#872 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 78/100