Skip to content

Commit 219b5d5

Browse files
reformat & black causal_dag.py
1 parent 0b8c38f commit 219b5d5

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

causal_testing/specification/causal_dag.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ def close_separator(
125125

126126

127127
class CausalDAG(nx.DiGraph):
128-
129128
"""A causal DAG is a directed acyclic graph in which nodes represent random variables and edges represent causality
130129
between a pair of random variables. We implement a CausalDAG as a networkx DiGraph with an additional check that
131130
ensures it is acyclic. A CausalDAG must be specified as a dot file.
@@ -502,9 +501,7 @@ def depends_on_outputs(self, node: Node, scenario: Scenario) -> bool:
502501

503502
@staticmethod
504503
def remove_hidden_adjustment_sets(minimal_adjustment_sets: list[str], scenario: Scenario):
505-
return [
506-
adj for adj in minimal_adjustment_sets if all([not scenario.variables.get(x).hidden for x in adj])
507-
]
504+
return [adj for adj in minimal_adjustment_sets if all(not scenario.variables.get(x).hidden for x in adj)]
508505

509506
def identification(self, base_test_case: BaseTestCase, scenario: Scenario = None):
510507
"""Identify and return the minimum adjustment set
@@ -525,7 +522,7 @@ def identification(self, base_test_case: BaseTestCase, scenario: Scenario = None
525522
)
526523
else:
527524
raise ValueError("Causal effect should be 'total' or 'direct'")
528-
525+
529526
if scenario is not None:
530527
minimal_adjustment_sets = self.remove_hidden_adjustment_sets(minimal_adjustment_sets, scenario)
531528

0 commit comments

Comments
 (0)