def show_status(path, text, binary, quote): def show(): if (quote): print show_string(path) else: print path if (text and binary): show() else: status = detect_binary_file.from_initial_block(file_name=path) if (status is None or status is binary): show()
def try_all_readers(file_name): try: content = mtz.object(file_name=file_name) except RuntimeError: pass else: return ("ccp4_mtz", content) if (detect_binary_file.from_initial_block(file_name=file_name)): try: content = unpickle_miller_arrays(file_name=file_name) except KeyboardInterrupt: raise except Exception: pass else: return ("cctbx.miller.array", content) return (None, None) try: content = cns_reflection_reader.cns_reflection_file( open(file_name)) except cns_reflection_reader.CNS_input_Error: pass else: return ("cns_reflection_file", content) try: content = cns_index_fobs_sigma_reader.reader( file_name=file_name) except RuntimeError: pass else: return ("cns_index_fobs_sigma", content) try: content = scalepack_merge.reader( open(file_name)) except scalepack_merge.FormatError: pass else: return ("scalepack_merge", content) try: content = scalepack_no_merge.reader(file_name) except KeyboardInterrupt: raise except Exception: pass else: return ("scalepack_no_merge_original_index", content) try: content = dtrek_reflnlist_reader.reflnlist( open(file_name)) except KeyboardInterrupt: raise except Exception: pass else: return ("dtrek_reflnlist", content) try: content = shelx_hklf.reader( file_name=file_name) except KeyboardInterrupt: raise except Exception: pass else: return ("shelx_hklf", content) try: content = cif_reader(file_path=file_name) looks_like_a_reflection_file = False for block in content.model().values(): if '_refln_index_h' in block or '_refln.index_h' in block: looks_like_a_reflection_file = True break if not looks_like_a_reflection_file: raise RuntimeError except KeyboardInterrupt: raise except Exception: pass else: return ("cif", content) try: content = xds_ascii_reader( open(file_name)) except KeyboardInterrupt: raise except Exception: pass else: return ("xds_ascii", content) try: content = xds_integrate_hkl_reader() content.read_file(file_name) except KeyboardInterrupt: raise except Exception: pass else: return ("xds_integrate_hkl", content) try: content = solve_fpfm_reader(file_name=file_name) except KeyboardInterrupt: raise except Exception: pass else: return ("solve_fpfm", content) return (None, None)