(self, fn)
| 818 | ) |
| 819 | |
| 820 | def _init_closure(self, fn): |
| 821 | build_py_wrappers = self.build_py_wrappers |
| 822 | closure = fn.__closure__ |
| 823 | |
| 824 | track_bound_values = self.track_bound_values |
| 825 | track_closure_variables = self.track_closure_variables |
| 826 | bindparam_trackers = self.bindparam_trackers |
| 827 | closure_trackers = self.closure_trackers |
| 828 | |
| 829 | for closure_index, (fv, cell) in enumerate( |
| 830 | zip(fn.__code__.co_freevars, closure) |
| 831 | ): |
| 832 | _bound_value = self._roll_down_to_literal(cell.cell_contents) |
| 833 | |
| 834 | if coercions._deep_is_literal(_bound_value): |
| 835 | build_py_wrappers.append((fv, closure_index)) |
| 836 | if track_bound_values: |
| 837 | bindparam_trackers.append( |
| 838 | self._bound_parameter_getter_func_closure( |
| 839 | fv, closure_index |
| 840 | ) |
| 841 | ) |
| 842 | else: |
| 843 | # for normal cell contents, add them to a list that |
| 844 | # we can compare later when we get new lambdas. if |
| 845 | # any identities have changed, then we will |
| 846 | # recalculate the whole lambda and run it again. |
| 847 | |
| 848 | if track_closure_variables: |
| 849 | closure_trackers.append( |
| 850 | self._cache_key_getter_closure_variable( |
| 851 | fn, fv, closure_index, cell.cell_contents |
| 852 | ) |
| 853 | ) |
| 854 | |
| 855 | def _setup_additional_closure_trackers(self, fn, lambda_element, opts): |
| 856 | # an additional step is to actually run the function, then |
no test coverage detected