Code Duplication    Length = 11-13 lines in 2 locations

src/amd/io.py 2 locations

@@ 718-730 (lines=13) @@
715
716
    # Atomic types
717
    asym_symbols = block._get_any(_CIF_TAGS['atom_symbol'])
718
    if asym_symbols is None:
719
        warnings.warn('missing atomic types will be labelled 0')
720
        asym_types = [0] * len(asym_unit)
721
    else:
722
        asym_types = []
723
        for label in asym_symbols:
724
            if label in ('.', '?'):
725
                warnings.warn('missing atomic types will be labelled 0')
726
                num = 0
727
            else:
728
                sym = re.search(r'([A-Z][a-z]?)', label).group(0)
729
                num = _ATOMIC_NUMBERS[sym]
730
            asym_types.append(num)
731
732
    # Find where sites have disorder if necassary
733
    has_disorder = []
@@ 975-985 (lines=11) @@
972
    # Atomic types
973
    for tag in _CIF_TAGS['atom_symbol']:
974
        asym_symbols = odict.get(tag)
975
        if asym_symbols is not None:
976
            asym_types = []
977
            for label in asym_symbols:
978
                if label in ('.', '?'):
979
                    warnings.warn('missing atomic types will be labelled 0')
980
                    num = 0
981
                else:
982
                    sym = re.search(r'([A-Z][a-z]?)', label).group(0)
983
                    num = _ATOMIC_NUMBERS[sym]
984
                asym_types.append(num)
985
            break
986
    else:
987
        warnings.warn('missing atomic types will be labelled 0')
988
        asym_types = [0] * len(asym_unit)