<commit_before># -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, <NAME>.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.

"""List duplicate tracks or albums.
"""
from __future__ import division, absolute_import, print_function

import shlex

from beets.plugins import BeetsPlugin
from beets.ui import decargs, print_, vararg_callback, Subcommand, UserError
from beets.util import command_output, displayable_path, subprocess
from beets.library import Item, Album
import six

PLUGIN = 'duplicates'


class DuplicatesPlugin(BeetsPlugin):
    """List duplicate tracks or albums
    """
    def __init__(self):
        super(DuplicatesPlugin, self).__init__()

        self.config.add({
            'album': False,
            'checksum': '',
            'copy': '',
            'count': False,
            'delete': False,
            'format': '',
            'full': False,
            'keys': [],
            'merge': False,
            'move': '',
            'path': False,
            'tiebreak': {},
            'strict': False,
            'tag': '',
        })

        self._command = Subcommand('duplicates',
                                   help=__doc__,
                                   aliases=['dup'])
        self._command.parser.add_option(
            u'-c', u'--count', dest='count',
            action='store_true',
            help=u'show duplicate counts',
        )
        self._command.parser.add_option(
            u'-C', u'--checksum', dest='checksum',
            action='store', metavar='PROG',
            help=u'report duplicates based on arbitrary command',
        )
        self._command.parser.add_option(
            u'-d', u'--delete', dest='delete',
            action='store_true',
            help=u'delete items from library and disk',
        )
        self._command.parser.add_option(
            u'-F', u'--full', dest='full',
            action='store_true',
            help=u'show all versions of duplicate tracks or albums',
        )
        self._command.parser.add_option(
            u'-s', u'--strict', dest='strict',
            action='store_true',
            help=u'report duplicates only if all attributes are set',
        )
        self._command.parser.add_option(
            u'-k', u'--keys', dest='keys',
            action='callback', metavar='KEY1 KEY2',
            callback=vararg_callback,
            help=u'report duplicates based on keys',
        )
        self._command.parser.add_option(
            u'-M', u'--merge', dest='merge',
            action='store_true',
            help=u'merge duplicate items',
        )
        self._command.parser.add_option(
            u'-m', u'--move', dest='move',
            action='store', metavar='DEST',
            help=u'move items to dest',
        )
        self._command.parser.add_option(
            u'-o', u'--copy', dest='copy',
            action='store', metavar='DEST',
            help=u'copy items to dest',
        )
        self._command.parser.add_option(
            u'-t', u'--tag', dest='tag',
            action='store',
            help=u'tag matched items with \'k=v\' attribute',
        )
        self._command.parser.add_all_common_options()

    def commands(self):

        def _dup(lib, opts, args):
            self.config.set_args(opts)
            album = self.config['album'].get(bool)
            checksum = self.config['checksum'].get(str)
            copy = self.config['copy'].get(str)
            count = self.config['count'].get(bool)
            delete = self.config['delete'].get(bool)
            fmt = self.config['format'].get(str)
            full = self.config['full'].get(bool)
            keys = self.config['keys'].get(list)
            merge = self.config['merge'].get(bool)
            move = self.config['move'].get(str)
            path = self.config['path'].get(bool)<commit_msg>s/get(list)/as_str_seq() for keys in duplicates plugin<commit_after># -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, <NAME>.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.

"""List duplicate tracks or albums.
"""
from __future__ import division, absolute_import, print_function

import shlex

from beets.plugins import BeetsPlugin
from beets.ui import decargs, print_, vararg_callback, Subcommand, UserError
from beets.util import command_output, displayable_path, subprocess
from beets.library import Item, Album
import six

PLUGIN = 'duplicates'


class DuplicatesPlugin(BeetsPlugin):
    """List duplicate tracks or albums
    """
    def __init__(self):
        super(DuplicatesPlugin, self).__init__()

        self.config.add({
            'album': False,
            'checksum': '',
            'copy': '',
            'count': False,
            'delete': False,
            'format': '',
            'full': False,
            'keys': [],
            'merge': False,
            'move': '',
            'path': False,
            'tiebreak': {},
            'strict': False,
            'tag': '',
        })

        self._command = Subcommand('duplicates',
                                   help=__doc__,
                                   aliases=['dup'])
        self._command.parser.add_option(
            u'-c', u'--count', dest='count',
            action='store_true',
            help=u'show duplicate counts',
        )
        self._command.parser.add_option(
            u'-C', u'--checksum', dest='checksum',
            action='store', metavar='PROG',
            help=u'report duplicates based on arbitrary command',
        )
        self._command.parser.add_option(
            u'-d', u'--delete', dest='delete',
            action='store_true',
            help=u'delete items from library and disk',
        )
        self._command.parser.add_option(
            u'-F', u'--full', dest='full',
            action='store_true',
            help=u'show all versions of duplicate tracks or albums',
        )
        self._command.parser.add_option(
            u'-s', u'--strict', dest='strict',
            action='store_true',
            help=u'report duplicates only if all attributes are set',
        )
        self._command.parser.add_option(
            u'-k', u'--keys', dest='keys',
            action='callback', metavar='KEY1 KEY2',
            callback=vararg_callback,
            help=u'report duplicates based on keys',
        )
        self._command.parser.add_option(
            u'-M', u'--merge', dest='merge',
            action='store_true',
            help=u'merge duplicate items',
        )
        self._command.parser.add_option(
            u'-m', u'--move', dest='move',
            action='store', metavar='DEST',
            help=u'move items to dest',
        )
        self._command.parser.add_option(
            u'-o', u'--copy', dest='copy',
            action='store', metavar='DEST',
            help=u'copy items to dest',
        )
        self._command.parser.add_option(
            u'-t', u'--tag', dest='tag',
            action='store',
            help=u'tag matched items with \'k=v\' attribute',
        )
        self._command.parser.add_all_common_options()

    def commands(self):

        def _dup(lib, opts, args):
            self.config.set_args(opts)
            album = self.config['album'].get(bool)
            checksum = self.config['checksum'].get(str)
            copy = self.config['copy'].get(str)
            count = self.config['count'].get(bool)
            delete = self.config['delete'].get(bool)
            fmt = self.config['format'].get(str)
            full = self.config['full'].get(bool)
            keys = self.config['keys'].as_str_seq()
            merge = self.config['merge'].get(bool)
            move = self.config['move'].get(str)
            path = self.config['path'].get(bool)
{'fraction_non_alphanumeric': 0.13160270880361175, 'fraction_numerical': 0.001580135440180587, 'mean_word_length': 2.0345890410958902, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6401704', 'n_tokens_mistral': 2467, 'n_tokens_neox': 2401, 'n_words': 632}