Code Duplication    Length = 18-19 lines in 2 locations

bbarchivist/hashutils.py 1 location

@@ 488-506 (lines=19) @@
485
        base_hash("sha224", source, workingdir, block, hs224, target, kwargs)
486
        base_hash("sha256", source, workingdir, block, hs256, target, kwargs)
487
        base_hash("sha384", source, workingdir, block, hs384, target, kwargs)
488
        base_hash("sha512", source, workingdir, block, hs512, target, kwargs)
489
        base_hash("ripemd160", source, workingdir, block, hr160, target, kwargs)
490
        base_hash("whirlpool", source, workingdir, block, hwp, target, kwargs)
491
        base_hash("sha3224", source, workingdir, block, hs3224, target, kwargs)
492
        base_hash("sha3256", source, workingdir, block, hs3256, target, kwargs)
493
        base_hash("sha3384", source, workingdir, block, hs3384, target, kwargs)
494
        base_hash("sha3512", source, workingdir, block, hs3512, target, kwargs)
495
496
497
def filefilter(file, workingdir, extras=()):
498
    """
499
    Check if file in folder is a folder, or if it's got a forbidden extension.
500
501
    :param file: File to be hashed.
502
    :type file: str
503
504
    :param workingdir: Path containing files you wish to verify.
505
    :type workingdir: str
506
507
    :param extras: Tuple of extra extensions.
508
    :type extras: tuple
509
    """

bbarchivist/utilities.py 1 location

@@ 668-685 (lines=18) @@
665
    :type a_dir: str
666
    """
667
    if not is_windows():
668
        pass
669
    else:
670
        files = [file for file in os.listdir(a_dir) if not os.path.isdir(file)]
671
        brokens = []
672
        for file in files:
673
            if file.endswith(".exe") and file.startswith(bbconstants.PREFIXES):
674
                print("TESTING: {0}".format((file)))
675
                if not verify_loader_integrity(file):
676
                    brokens.append(file)
677
        return brokens
678
679
680
def workers(input_data):
681
    """
682
    Count number of CPU workers, smaller of number of threads and length of data.
683
684
    :param input_data: Input data, some iterable.
685
    :type input_data: list
686
    """
687
    runners = len(input_data) if len(input_data) < compat.enum_cpus() else compat.enum_cpus()
688
    return runners