(self, component: IOComponent, **kwargs)
| 754 | s.report() |
| 755 | |
| 756 | def before_component(self, component: IOComponent, **kwargs): |
| 757 | if component is None or isinstance(component, gr.Blocks): |
| 758 | return |
| 759 | s = ScriptSummary('before-component') |
| 760 | for script in self.scripts: |
| 761 | if not hasattr(script, 'before_component'): |
| 762 | continue |
| 763 | for elem_id, callback in script.on_before_component_elem_id: |
| 764 | if elem_id == kwargs.get("elem_id"): |
| 765 | try: |
| 766 | callback(OnComponent(component=component)) |
| 767 | except Exception as e: |
| 768 | errors.display(e, f"Running script before component: id={elem_id} fn={script.filename}") |
| 769 | try: |
| 770 | script.before_component(component, **kwargs) |
| 771 | except Exception as e: |
| 772 | errors.display(e, f'Running script before component: fn={script.filename}') |
| 773 | s.record(script.title()) |
| 774 | s.report() |
| 775 | |
| 776 | def after_component(self, component: IOComponent, **kwargs): |
| 777 | if component is None or isinstance(component, gr.Blocks): |
no test coverage detected