Need Updates for python 3.10, using `collections.Iterable` as an example
还没有人认领这个 Issue。
评估
调研方向
回溯指向 pyhive/common.py,尤其是第 248 行的 escape_item,它是通过 hive.py execute 和 escape_args 到达的。首先阅读这条调用路径,并在 Python 3.10 下复现参数转义失败的问题;当示例不再针对 Iterable 引发 AttributeError 时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
System Info:
Python 3.10.0 | packaged by conda-forge | (default, Nov 20 2021, 02:25:18) [GCC 9.4.0]
pyhive 0.6.4 | pyhd8ed1ab_0 | conda-forge
Logs:
~/anaconda3/envs/****/lib/python3.10/site-packages/pyhive/hive.py in execute(self, operation, parameters, **kwargs)
442 sql = operation
443 else:
--> 444 sql = operation % _escaper.escape_args(parameters)
445
446 self._reset_state()
~/anaconda3/envs/****/lib/python3.10/site-packages/pyhive/common.py in escape_args(self, parameters)
211 return {k: self.escape_item(v) for k, v in parameters.items()}
212 elif isinstance(parameters, (list, tuple)):
--> 213 return tuple(self.escape_item(x) for x in parameters)
214 else:
215 raise exc.ProgrammingError("Unsupported param format: {}".format(parameters))
~/anaconda3/envs/****/lib/python3.10/site-packages/pyhive/common.py in <genexpr>(.0)
211 return {k: self.escape_item(v) for k, v in parameters.items()}
212 elif isinstance(parameters, (list, tuple)):
--> 213 return tuple(self.escape_item(x) for x in parameters)
214 else:
215 raise exc.ProgrammingError("Unsupported param format: {}".format(parameters))
~/anaconda3/envs/****/lib/python3.10/site-packages/pyhive/common.py in escape_item(self, item)
246 elif isinstance(item, basestring):
247 return self.escape_string(item)
--> 248 elif isinstance(item, collections.Iterable):
249 return self.escape_sequence(item)
250 elif isinstance(item, datetime.datetime):
AttributeError: module 'collections' has no attribute 'Iterable'
This is because collections.Iterable is deprecated and we should use collections.abc.Iterable instead.
In fact, there has always been an DeprecationWarning in place:
DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
Are there any plans for a code review for such updates?
- 主要语言
- Python
- 星标
- 1.7k
- 派生
- 545
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
dropbox/PyHive 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 25/100
-
难度 3/5 1-2 天 新手友好度 35/100
-
难度 3/5 1-2 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 5/5 一周以上 新手友好度 20/100
相似的 Issue
-
good first issue
难度 2/5 1-3 小时 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 88/100
vllm-project/vllm-metal#822 ·
维护者通常 1 天内回复
-
vector-store
难度 1/5 1-3 小时 新手友好度 90/100
维护者通常 1 天内回复
-
[Bug]: chunk_span_bounds and _validated_chunk_spans reject Pydantic models ChunkSpan and AudioFile未关闭
难度 2/5 1-3 小时 新手友好度 78/100
BasedHardware/omi#19047 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复