Calling TM.dfd() a second time returns an empty diagram

オープン
#385 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

  • #386 @markthomaschurch による — マージされずにクローズ

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python

調査の方向性

A linked pull request, #386, is already open for this issue, so the work is under way. The report identifies TM.dfd() and each element's dfd() state as the relevant entry points; review the pull request to see how it handles repeated renders and preserves state set by check().

索引モデルが issue の本文から書いたものです。

説明

Description

Calling tm.dfd() a second time in the same process returns a diagram with no elements, only the empty digraph wrapper.

Reproduction

from pytm import TM, Actor, Server, Dataflow

tm = TM("example", description="d")
Dataflow(Actor("User"), Server("Web"), "Request")
tm.check()

first = tm.dfd()
second = tm.dfd()            # or tm.dfd(colormap=True), tm.dfd(levels=[1])
assert "actor_" in first
assert "actor_" in second    # fails: no nodes or edges

This affects scripts and tools that render more than one variant of the DFD from one model, such as plain and colormap versions, several levels, or per-element diagrams.

Cause

Each element's dfd() sets is_drawn = True, to avoid drawing it twice within a single pass, and nothing resets it. On the next call, every element is skipped.

Proposed fix

TM.dfd() saves each element's is_drawn before drawing and restores it afterwards. State set before drawing is preserved: duplicates hidden by onDuplicates=Action.IGNORE during check() stay hidden.

主要言語
Python
スター
1.2k
フォーク
237
平均マージ
4日 2時間
マージ済み PR(30日)
9

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

OWASP/pytm のほかの issue

OWASP/pytm の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。