(cap, *args, **kwargs)
| 9 | cache = None |
| 10 | |
| 11 | def get(cap, *args, **kwargs): |
| 12 | default = kwargs.pop('default', '') |
| 13 | |
| 14 | if 'PWNLIB_NOTERM' in os.environ: |
| 15 | return default |
| 16 | |
| 17 | if kwargs != {}: |
| 18 | raise TypeError("get(): No such argument %r" % kwargs.popitem()[0]) |
| 19 | |
| 20 | if cache is None: |
| 21 | init() |
| 22 | |
| 23 | s = cache.get(cap) |
| 24 | if s: |
| 25 | if args: |
| 26 | return s(*args) |
| 27 | return s |
| 28 | return default |
| 29 | |
| 30 | def init(): |
| 31 | global cache |