()
| 587 | cache: cabc.MutableMapping[t.TextIO, t.TextIO] = WeakKeyDictionary() |
| 588 | |
| 589 | def func() -> t.TextIO | None: |
| 590 | stream = src_func() |
| 591 | |
| 592 | if stream is None: |
| 593 | return None |
| 594 | |
| 595 | try: |
| 596 | rv = cache.get(stream) |
| 597 | except Exception: |
| 598 | rv = None |
| 599 | if rv is not None: |
| 600 | return rv |
| 601 | rv = wrapper_func() |
| 602 | try: |
| 603 | cache[stream] = rv |
| 604 | except Exception: |
| 605 | pass |
| 606 | return rv |
| 607 | |
| 608 | return func |
| 609 |
no outgoing calls
no test coverage detected