:param target_function str: :param upstream_depth int: :param downstream_depth int: :rtype: SubsetParams|Nonetype
(target_function, upstream_depth, downstream_depth)
| 68 | |
| 69 | @staticmethod |
| 70 | def generate(target_function, upstream_depth, downstream_depth): |
| 71 | """ |
| 72 | :param target_function str: |
| 73 | :param upstream_depth int: |
| 74 | :param downstream_depth int: |
| 75 | :rtype: SubsetParams|Nonetype |
| 76 | """ |
| 77 | if upstream_depth and not target_function: |
| 78 | raise AssertionError("--upstream-depth requires --target-function") |
| 79 | |
| 80 | if downstream_depth and not target_function: |
| 81 | raise AssertionError("--downstream-depth requires --target-function") |
| 82 | |
| 83 | if not target_function: |
| 84 | return None |
| 85 | |
| 86 | if not (upstream_depth or downstream_depth): |
| 87 | raise AssertionError("--target-function requires --upstream-depth or --downstream-depth") |
| 88 | |
| 89 | if upstream_depth < 0: |
| 90 | raise AssertionError("--upstream-depth must be >= 0. Exclude argument for complete depth.") |
| 91 | |
| 92 | if downstream_depth < 0: |
| 93 | raise AssertionError("--downstream-depth must be >= 0. Exclude argument for complete depth.") |
| 94 | |
| 95 | return SubsetParams(target_function, upstream_depth, downstream_depth) |
| 96 | |
| 97 | |
| 98 |