<commit_before># -*- coding: utf-8 -*-

import os
import re
import string
import subprocess

from module.plugins.internal.Extractor import Extractor, ArchiveError, CRCError, PasswordError
from module.plugins.internal.misc import decode, encode, fsjoin, renice


class UnRar(Extractor):
    __name__    = "UnRar"
    __type__    = "extractor"
    __version__ = "1.31"
    __status__  = "testing"

    __description__ = """RAR extractor plugin"""
    __license__     = "GPLv3"
    __authors__     = [("RaNaN"         , "<EMAIL>" ),
                       ("<NAME>", "<EMAIL>"),
                       ("Immenz"        , "<EMAIL>"   )]


    CMD        = "unrar"
    EXTENSIONS = ["rar", "zip", "cab", "arj", "lzh", "tar", "gz", "ace", "uue",
                  "bz2", "jar", "iso", "7z", "xz", "z"]

    _RE_PART    = re.compile(r'\.(part|r)\d+(\.rar|\.rev)?(\.bad)?', re.I)
    _RE_FIXNAME = re.compile(r'Building (.+)')
    _RE_FILES   = re.compile(r'^(.)(\s*[\w\-.]+)\s+(\d+\s+)+(?:\d+\%\s+)?[\d\-]{8}\s+[\d\:]{5}', re.I | re.M)
    _RE_BADPWD  = re.compile(r'password', re.I)
    _RE_BADCRC  = re.compile(r'encrypted|damaged|CRC failed|checksum error|corrupt', re.I)
    _RE_VERSION = re.compile(r'(?:UN)?RAR\s(\d+\.\d+)', re.I)


    @classmethod
    def find(cls):
        try:
            if os.name == "nt":
                cls.CMD = os.path.join(pypath, "RAR.exe")
            else:
                cls.CMD = "rar"

            p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            out, err = p.communicate()
            # cls.__name__ = "RAR"
            cls.REPAIR = True

        except OSError:
            try:
                if os.name == "nt":<commit_msg>[UnRar] Fix problem with password protected archives Some tiny error in a regular expression caused unexpected behavior with password protected archives<commit_after># -*- coding: utf-8 -*-

import os
import re
import string
import subprocess

from module.plugins.internal.Extractor import Extractor, ArchiveError, CRCError, PasswordError
from module.plugins.internal.misc import decode, encode, fsjoin, renice


class UnRar(Extractor):
    __name__    = "UnRar"
    __type__    = "extractor"
    __version__ = "1.31"
    __status__  = "testing"

    __description__ = """RAR extractor plugin"""
    __license__     = "GPLv3"
    __authors__     = [("RaNaN"         , "<EMAIL>" ),
                       ("<NAME>", "<EMAIL>"),
                       ("Immenz"        , "<EMAIL>"   )]


    CMD        = "unrar"
    EXTENSIONS = ["rar", "zip", "cab", "arj", "lzh", "tar", "gz", "ace", "uue",
                  "bz2", "jar", "iso", "7z", "xz", "z"]

    _RE_PART    = re.compile(r'\.(part|r)\d+(\.rar|\.rev)?(\.bad)?', re.I)
    _RE_FIXNAME = re.compile(r'Building (.+)')
    _RE_FILES = re.compile(r'^(.)(\s*[\w\-.]+)\s+(\d+\s+)+(?:\d+\%\s+)?[\d\-]{8,}\s+[\d\:]{5}', re.I | re.M)
    _RE_BADPWD  = re.compile(r'password', re.I)
    _RE_BADCRC  = re.compile(r'encrypted|damaged|CRC failed|checksum error|corrupt', re.I)
    _RE_VERSION = re.compile(r'(?:UN)?RAR\s(\d+\.\d+)', re.I)


    @classmethod
    def find(cls):
        try:
            if os.name == "nt":
                cls.CMD = os.path.join(pypath, "RAR.exe")
            else:
                cls.CMD = "rar"

            p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            out, err = p.communicate()
            # cls.__name__ = "RAR"
            cls.REPAIR = True

        except OSError:
            try:
                if os.name == "nt":
{'fraction_non_alphanumeric': 0.18890765765765766, 'fraction_numerical': 0.005067567567567568, 'mean_word_length': 2.141467727674624, 'pattern_counts': {'":': 4, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2468849', 'n_tokens_mistral': 1337, 'n_tokens_neox': 1257, 'n_words': 251}