Skip to content

Commit 786d8ac

Browse files
Add filter in readme
1 parent dbb6142 commit 786d8ac

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,30 @@ if __name__ == '__main__':
183183

184184
* running it outputs the previous PlantUML diagram in the terminal and writes it in a file.
185185

186+
### Additionally you can also pass filters to skip specific blocks and relations
187+
```python
188+
from py2puml.domain.umlrelation import UmlRelation
189+
from py2puml.domain.umlclass import UmlMethod
190+
from py2puml.domain.umlitem import UmlItem
191+
from py2puml.export.puml import Filters
192+
from py2puml.py2puml import py2puml
193+
194+
def skip_block(item: UmlItem) -> bool:
195+
return item.fqn.endswith('<block-to-ignore>')
196+
197+
def skip_relation(relation: UmlRelation) -> bool:
198+
return relation.source_fqn.endswith('<relation-source>') and relation.target_fqn.endswith('<relation-target>')
199+
200+
filters = Filters(skip_block, skip_relation)
201+
202+
puml_content = "".join(
203+
py2puml(
204+
'py2puml/domain',
205+
'py2puml.domain',
206+
filters
207+
)
208+
)
209+
```
186210

187211
# Tests
188212

0 commit comments

Comments
 (0)