runs the extractor

        Args:
        -----
            output: ['filepath', None]
544651
def run(self, tag=None, output=None, **kwargs):
        
        start = datetime.datetime.now()
        count = 0
        if tag:
            tag = Uri(tag)
            xml_generator = etree.iterparse(self.source,
                                            #events=("start", "end"),
                                            tag=tag.etree)
        else:
            xml_generator = etree.iterparse(self.source) #,
                                            #events=("start", "end"))
        i = 0
        for event, element in xml_generator:
            type_tags = element.findall(_RDF_TYPE_TAG)
            rdf_types = [el.get(_RES_TAG)
                         for el in type_tags
                         if el.get(_RES_TAG)]
            # print(rdf_types)
            if str(self.filter_val) in rdf_types:
                pdb.set_trace()
                # print("%s - %s - %s - %s" % (event,
                #                              element.tag,
                #                              element.attrib,
                #                              element.text))
                count += 1
            # if i == 100:
            #     break
            i += 1
            element.clear()
        print("Found '{}' items in {}".format(count,
                (datetime.datetime.now() - start)))
1021322
def filepaths(self):
        
        if self.path is not None:
            yield from utils.filepaths(self.path, exclude=self.exclude,
                                       hidden=False, empty=False)
1239408
def run(*extractor_list, **kwargs):
    """"""
    args = _get_args(kwargs.get('args'))
    n_extractors = len(extractor_list)
    log.info('Going to run list of {} FeatureExtractors'.format(n_extractors))
    collection = fex.Collection(cache_path=args.cache_path)
    for extractor in extractor_list:
        collection.add_feature_extractor(extractor)

    out_path = args.path
    if args.deploy:
        out_path = _prefix_git_hash(out_path)
    collection.run(out_path)
527355
def main() -> None:
    
    main_only_quicksetup_rootlogger(level=logging.DEBUG)
    parser = argparse.ArgumentParser()
    parser.add_argument("directory", nargs="?", default=os.getcwd())
    parser.add_argument("--reportevery", default=10000)
    args = parser.parse_args()
    log.info("Extensions in directory {!r}:", args.directory)
    print("\n".join(repr(x) for x in
                    list_file_extensions(args.directory,
                                         reportevery=args.reportevery)))
1004916
def extractall(self, path=None, members=None, pwd=None):
        
        if members is None:
            members = self.namelist()

        for zipinfo in members:
            self.extract(zipinfo, path, pwd)
95172
def run_example(path):
    
    cmd = "{0} {1}".format(sys.executable, path)
    proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    res = proc.communicate()
    if proc.returncode:
        print(res[1].decode())
    return proc.returncode
282086
def main():  # pragma: nocover
    
    p = argparse.ArgumentParser(add_help="Recursively list interesting files.")
    p.add_argument(
        'directory', nargs="?", default="",
        help="The directory to process (current dir if omitted)."
    )
    p.add_argument(
        '--verbose', '-v', action='store_true',
        help="Increase verbosity."
    )

    args = p.parse_args()
    args.curdir = os.getcwd()
    if not args.directory:
        args.direcotry = args.curdir
    if args.verbose:
        print(args)

    for chsm, fname in list_files(args.directory):
        print(chsm, fname)
835432
def execute(self):
        
        # Preprocess options to extract --settings and --pythonpath.
        # These options could affect the commands that are available, so they
        # must be processed early.
        parser = NewOptionParser(prog=self.prog_name,
                             usage=self.usage_info,
#                             version=self.get_version(),
                             formatter = NewFormatter(),
                             add_help_option = False,
                             option_list=self.option_list)

        options, args = parser.parse_args(self.argv)
        self.options = options
        if len(args) == 0:
            self.message("You should give at least one package name.", 'error')
            return

        subcommand = args[0]

        self.handle(args[1:], self.options, self.global_options, subcommand)
334691
def main():
    """"""

    parser = argparse.ArgumentParser(
        description=__doc__,
        formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument('source', help="location of the downloaded repos")
    parser.add_argument('destination', help="location of the extracted files")
    parser.add_argument(
        '-t', '--nb-test-files', help="number of testing files per language",
        type=int, default=5000)
    parser.add_argument(
        '-l', '--nb-learn-files', help="number of learning files per language",
        type=int, default=10000)
    parser.add_argument(
        '-r', '--remove', help="remove repos that cannot be read",
        action='store_true', default=False)
    parser.add_argument(
        '-d', '--debug', default=False, action='store_true',
        help="show debug messages")

    args = parser.parse_args()
    config_logging(args.debug)

    source = Path(args.source)
    destination = Path(args.destination)
    nb_test = args.nb_test_files
    nb_learn = args.nb_learn_files
    remove = args.remove

    repos = _find_repos(source)
    split_repos = _split_repos(repos, nb_test, nb_learn)
    split_files = _find_files(*split_repos, nb_test, nb_learn, remove)
    _unzip_all(*split_files, destination)
    LOGGER.info("Files saved into %s", destination)
    LOGGER.debug("Exit OK")
1007835
def run(self):
        

        init_folder = os.getcwd()
        os.chdir(self.folder)

        with zopen(self.log_file, 'w') as fout:
            subprocess.call([self._NWCHEM2FIESTA_cmd, self._nwcheminput_fn,
                             self._nwchemoutput_fn, self._nwchemmovecs_fn],
                            stdout=fout)

        os.chdir(init_folder)
1303021
def _run_dpkt(self, dpkt):
        """"""
        # if not self._flag_a:
        #     self._flag_a = True
        #     warnings.warn(f"'Extractor(engine=dpkt)' object is not iterable; "
        #                     "so 'auto=False' will be ignored", AttributeWarning, stacklevel=stacklevel())

        if self._exlyr != 'None' or self._exptl != 'null':
            warnings.warn("'Extractor(engine=dpkt)' does not support protocol and layer threshold; "
                          f"'layer={self._exlyr}' and 'protocol={self._exptl}' ignored",
                          AttributeWarning, stacklevel=stacklevel())

        # extract global header
        self.record_header()
        self._ifile.seek(0, os.SEEK_SET)

        # extract & analyse file
        self._expkg = dpkt
        self._extmp = iter(dpkt.pcap.Reader(self._ifile))

        # start iteration
        self.record_frames()
1145740
def run(self):
        
        if self.stdout:
            sys.stdout.write("extracted json data:\n" + json.dumps(
                self.metadata, default=to_str) + "\n")
        else:
            extract_dist.class_metadata = self.metadata
635653
def run(self, output=None, error=None):
        

        pylint_output = output if output is not None else sys.stdout
        pylint_error = error if error is not None else sys.stderr
        savedout, savederr = sys.__stdout__, sys.__stderr__
        sys.stdout = pylint_output
        sys.stderr = pylint_error

        pylint_files = self.get_files_from_dir(os.curdir)
        self._print_line(
            "Using pylint "
            + colorama.Fore.RED
            + pylint.__version__
            + colorama.Fore.RESET
            + " for python "
            + colorama.Fore.RED
            + PYTHON_VERSION
            + colorama.Fore.RESET
        )

        self._print_line("pylint running on the following files:")
        for pylint_file in pylint_files:
            # we need to recast this as a string, else pylint enters an endless recursion
            split_file = str(pylint_file).split("/")
            split_file[-1] = colorama.Fore.CYAN + split_file[-1] + colorama.Fore.RESET
            pylint_file = "/".join(split_file)
            self._print_line("- " + pylint_file)
        self._print_line("----")

        if not self._is_using_default_rcfile():
            self.args += ["--rcfile={}".format(self.rcfile)]

        exit_kwarg = {"do_exit": False}

        run = pylint.lint.Run(self.args + pylint_files, **exit_kwarg)
        sys.stdout = savedout
        sys.stderr = savederr

        sys.exit(run.linter.msg_status)
1277177
def extract(path_to_hex, output_path=None):
    
    with open(path_to_hex, 'r') as hex_file:
        python_script = extract_script(hex_file.read())
        if output_path:
            with open(output_path, 'w') as output_file:
                output_file.write(python_script)
        else:
            print(python_script)
188765
def run(command, verbose=False):
    
    def do_nothing(*args, **kwargs):
        return None

    v_print = print if verbose else do_nothing

    p = subprocess.Popen(
        command,
        shell=True,
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT,
        universal_newlines=True,
    )

    v_print("run:", command)

    def log_and_yield(line):
        if six.PY2:
            # If not unicode, try to decode it first
            if isinstance(line, str):
                line = line.decode('utf8', 'replace')
        v_print(line)
        return line

    output = ''.join(map(log_and_yield, p.stdout))
    status_code = p.wait()

    return CommandResult(command, output, status_code)
83226
def extract(self, target):
        

        if not foundations.common.path_exists(self.__archive):
            raise foundations.exceptions.FileExistsError("{0} | '{1}' file doesn't exists!".format(
                self.__class__.__name__, self.__archive))

        if not foundations.common.path_exists(target):
            raise foundations.exceptions.DirectoryExistsError("{0} | '{1}' directory doesn't exists!".format(
                self.__class__.__name__, target))

        archive = zipfile.ZipFile(self.__archive)
        content = archive.namelist()

        directories = [item for item in content if item.endswith("/")]
        files = [item for item in content if not item.endswith("/")]

        directories.sort()
        directories.reverse()

        for directory in directories:
            not os.path.isdir(os.path.join(target, directory)) and foundations.io.set_directory(
                os.path.join(target, directory))

        for file in files:
            LOGGER.info("{0} | Extracting '{1}' file!".format(self.__class__.__name__, file))
            with open(os.path.join(target, file), "w") as output:
                buffer = StringIO(archive.read(file))
                bufferSize = 2 ** 20
                data = buffer.read(bufferSize)
                while data:
                    output.write(data)
                    data = buffer.read(bufferSize)
        return True
425247
def extract
      FileUtils.mkdir_p source_dir

      opts = {}
      if tarball == "-"
        # FIXME: not really happy with reading everything in memory
        opts[:input] = $stdin.read
      end

      tarball_extract = Mixlib::ShellOut.new("tar xzf #{tarball} -C #{source_dir}", opts)
      tarball_extract.logger = Pkgr.logger
      tarball_extract.run_command
      tarball_extract.error!
    end