plotly / plotly/plotly.py

useless line in the _Quiver class definition

未关闭
#3,490 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug P3
主要语言
Python
星标
18.8k
派生
2.8k
平均合并
16 小时 26 分钟
30 天内合并 PR
21

描述

In the _Quiver class definition (more precisely within the body of one of its methods) there is a useless line https://github.com/plotly/plotly.py/blob/master/packages/python/plotly/plotly/figure_factory/_quiver.py#L257 which just leads to repeating the calculations of the elements in the four lists under the for loop:

for index in range(len(self.end_x)):
    point1_x = [i - j * self.scaleratio for i, j in zip(self.end_x, seg1_x)]
    point1_y = [i - j for i, j in zip(self.end_y, seg1_y)]
    point2_x = [i - j * self.scaleratio for i, j in zip(self.end_x, seg2_x)]
    point2_y = [i - j for i, j in zip(self.end_y, seg2_y)]

The for line must be removed and the next four lines moved a tab at left.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

打开 packages/python/plotly/plotly/figure_factory/_quiver.py 的第257行,并检查周围的 _Quiver 方法。删除循环行,并按要求将列出的四个赋值移到外部。完成的标志是计算只执行一次,而不是针对每个索引重复执行;之后验证现有的 quiver 行为。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
data-visualization
Issue 类型
重构
难度
1/5
预计耗时
1 小时以内
活跃度
停滞
描述清晰度
描述清楚
新手友好度
55/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。