コード例 #1
0
    def _action_(self, action: usage.UsageAction,
                 input_opts: dict, output_opts: dict):
        action_f, action_sig = action.get_action()
        self._update_imports(action_f)

        t = self._template_action(action_f, input_opts, output_opts)
        self._recorder.append(t)

        return output_opts
コード例 #2
0
def feature_table_merge_example(use):
    feature_table1 = use.init_data('feature_table1', ft1_factory)
    feature_table2 = use.init_data('feature_table2', ft2_factory)

    use.action(
        UsageAction(plugin_id='feature_table', action_id='merge'),
        UsageInputs(tables=[feature_table1, feature_table2]),
        UsageOutputNames(merged_table='merged_table'),
    )
コード例 #3
0
def feature_table_merge_three_tables_example(use):
    feature_table1 = use.init_data('feature_table1', ft1_factory)
    feature_table2 = use.init_data('feature_table2', ft2_factory)
    feature_table3 = use.init_data('feature_table3', ft3_factory)

    use.action(
        UsageAction(plugin_id='feature_table', action_id='merge'),
        UsageInputs(tables=[feature_table1, feature_table2, feature_table3],
                    overlap_method='sum'),
        UsageOutputNames(merged_table='merged_table'),
    )
コード例 #4
0
    def _action_(self, action: usage.UsageAction, input_opts: dict,
                 output_opts: dict):
        action_f, action_sig = action.get_action()
        self._update_imports(action_f)

        new_output_opts = {k: k for k in output_opts.keys()}

        t = self._template_action(action_f, input_opts, new_output_opts)
        self._recorder.append(t)

        return new_output_opts
コード例 #5
0
 def test_get_action_if_plugin_present_plugin_missing(self):
     fake_action = UsageAction('imaginary', 'action')
     with self.assertRaisesRegex(
             MissingPluginError,
             "(?s)missing one or more plugins.*library"):
         _get_action_if_plugin_present(fake_action)
コード例 #6
0
 def test_get_action_if_plugin_present_plugin_present(self):
     real_action = UsageAction('diversity', 'core_metrics')
     action = _get_action_if_plugin_present(real_action)
     self.assertEqual('diversity', action.plugin_id)
     self.assertEqual('core_metrics', action.id)