# coding=utf-8

import logging

from rarfile import RarFile as _RarFile, UNRAR_TOOL, ORIG_OPEN_ARGS as OPEN_ARGS, custom_popen, check_returncode, \
    XTempFile

log = logging.getLogger(__name__)


class RarFile(_RarFile):
    def read(self, fname, psw=None):
        """
        read specific content of rarfile without parsing
        :param fname:
        :param psw:
        :return:
        """
        cmd = [UNRAR_TOOL] + list(OPEN_ARGS)

        with XTempFile(self._rarfile) as rf:
            log.debug(u"RAR CMD: %s", cmd + [rf, fname])
            p = custom_popen(cmd + [rf, fname])
            output = p.communicate()[0]
            check_returncode(p, output)

            return output

@@ -28,135 +28,19 @@
 ing%0A
-%0Afrom rarfile import RarFile as _RarFile, UNRAR_TOOL, ORIG_OPEN_ARGS as OPEN_ARGS, custom_popen, check_returncode, %5C%0A    XTempF
+import rarf
 ile%0A
@@ -90,17 +90,24 @@
 RarFile(
-_
+rarfile.
 RarFile)
@@ -300,16 +300,24 @@
  cmd = %5B
+rarfile.
 UNRAR_TO
@@ -327,16 +327,24 @@
  + list(
+rarfile.
 OPEN_ARG
@@ -360,16 +360,24 @@
    with 
+rarfile.
 XTempFil
@@ -473,16 +473,24 @@
     p = 
+rarfile.
 custom_p
@@ -565,16 +565,24 @@
         
+rarfile.
 check_re

use rarfile explicitly instead of individual imports