def freeze(h, output_yaml, resolve, groups):
    """Output installed packages."""
    if not groups:
        groups = filter(lambda group: not group.lower().startswith("bower"),
                        h.requirements.keys())
    else:
        groups = [text_type.strip(group) for group in groups.split(",")]

    if output_yaml:
        for requirements in h.requirements.values():
            for requirement in requirements:
                if resolve and not requirement.version:
                    requirement.load_installed_version()
        click.echo(h.requirements.yaml)
    else:
        for group in groups:
            if not h.requirements[group]:
                continue
            click.echo("# {}".format(group))
            for requirement in h.requirements[group]:
                if resolve and not requirement.version:
                    requirement.load_installed_version()
                click.echo(str(requirement))
def test_accept_suggestion_with_set_of_string_adds_translation(self):
        self.save_new_default_exploration('exp1', self.author_id)
        exploration = exp_fetchers.get_exploration_by_id('exp1')
        self.assertEqual(exploration.get_translation_counts(), {})
        suggestion = suggestion_registry.SuggestionTranslateContent(
            self.suggestion_dict['suggestion_id'],
            self.suggestion_dict['target_id'],
            self.suggestion_dict['target_version_at_submission'],
            self.suggestion_dict['status'], self.author_id,
            self.reviewer_id,
            {
                'cmd': exp_domain.CMD_ADD_WRITTEN_TRANSLATION,
                'state_name': 'Introduction',
                'content_id': 'content',
                'language_code': 'hi',
                'content_html': ['text1', 'text2'],
                'translation_html': ['translated text1', 'translated text2'],
                'data_format': 'set_of_normalized_string'
            },
            self.suggestion_dict['score_category'],
            self.suggestion_dict['language_code'], False, self.fake_date)

        suggestion.accept(
            'Accepted suggestion by translator: Add translation change.')

        exploration = exp_fetchers.get_exploration_by_id('exp1')
        self.assertEqual(exploration.get_translation_counts(), {
            'hi': 1
        })