Total Complexity | 6 |
Total Lines | 22 |
Duplicated Lines | 0 % |
Coverage | 86.67% |
1 | # -*- coding: utf-8 -*- |
||
12 | 1 | class InjectionStack(object): |
|
13 | |||
14 | 1 | def __init__(self, local): |
|
15 | 1 | local.stack = deque() |
|
16 | 1 | self._local = local |
|
17 | |||
18 | 1 | def push(self, item): |
|
19 | 1 | self._local.stack.append(item) |
|
20 | |||
21 | 1 | def pop(self): |
|
22 | 1 | return self._local.stack.pop() |
|
23 | |||
24 | 1 | @property |
|
25 | def top(self): |
||
26 | 1 | try: |
|
27 | 1 | return self._local.stack[-1] |
|
28 | except IndexError: |
||
29 | return None |
||
30 | |||
31 | 1 | @property |
|
32 | def is_empty(self): |
||
33 | 1 | return not self._local.stack |
|
34 | |||
65 |