|
3 | 3 | import itertools
|
4 | 4 | import operator
|
5 | 5 | import re
|
6 |
| -from typing import List, Optional, Union |
| 6 | +from typing import List, Optional, Sequence, Tuple, Union |
7 | 7 |
|
8 | 8 | import numpy as np
|
9 | 9 |
|
@@ -95,9 +95,12 @@ class BlockManager(PandasObject):
|
95 | 95 | __slots__ = ['axes', 'blocks', '_ndim', '_shape', '_known_consolidated',
|
96 | 96 | '_is_consolidated', '_blknos', '_blklocs']
|
97 | 97 |
|
98 |
| - def __init__(self, blocks, axes, do_integrity_check=True): |
| 98 | + def __init__(self, |
| 99 | + blocks: Sequence[Block], |
| 100 | + axes: Sequence[Index], |
| 101 | + do_integrity_check: bool = True): |
99 | 102 | self.axes = [ensure_index(ax) for ax in axes]
|
100 |
| - self.blocks = tuple(blocks) |
| 103 | + self.blocks = tuple(blocks) # type: Tuple[Block, ...] |
101 | 104 |
|
102 | 105 | for block in blocks:
|
103 | 106 | if block.is_sparse:
|
@@ -1415,8 +1418,11 @@ class SingleBlockManager(BlockManager):
|
1415 | 1418 | _known_consolidated = True
|
1416 | 1419 | __slots__ = ()
|
1417 | 1420 |
|
1418 |
| - def __init__(self, block, axis, do_integrity_check=False, fastpath=False): |
1419 |
| - |
| 1421 | + def __init__(self, |
| 1422 | + block: Block, |
| 1423 | + axis: Union[Index, List[Index]], |
| 1424 | + do_integrity_check: bool = False, |
| 1425 | + fastpath: bool = False): |
1420 | 1426 | if isinstance(axis, list):
|
1421 | 1427 | if len(axis) != 1:
|
1422 | 1428 | raise ValueError("cannot create SingleBlockManager with more "
|
@@ -1455,7 +1461,7 @@ def __init__(self, block, axis, do_integrity_check=False, fastpath=False):
|
1455 | 1461 | if not isinstance(block, Block):
|
1456 | 1462 | block = make_block(block, placement=slice(0, len(axis)), ndim=1)
|
1457 | 1463 |
|
1458 |
| - self.blocks = [block] |
| 1464 | + self.blocks = tuple([block]) |
1459 | 1465 |
|
1460 | 1466 | def _post_setstate(self):
|
1461 | 1467 | pass
|
|
0 commit comments