(args)
| 885 | |
| 886 | |
| 887 | def get_profiles(args): |
| 888 | profiles = glob.glob("mprofile_??????????????.dat") |
| 889 | profiles.sort() |
| 890 | |
| 891 | if len(args.profiles) == 0: |
| 892 | if len(profiles) == 0: |
| 893 | print("No input file found. \nThis program looks for " |
| 894 | "mprofile_*.dat files, generated by the " |
| 895 | "'mprof run' command.") |
| 896 | sys.exit(-1) |
| 897 | print("Using last profile data.") |
| 898 | filenames = [profiles[-1]] |
| 899 | else: |
| 900 | filenames = [] |
| 901 | for prof in args.profiles: |
| 902 | if osp.exists(prof): |
| 903 | if not prof in filenames: |
| 904 | filenames.append(prof) |
| 905 | else: |
| 906 | try: |
| 907 | n = int(prof) |
| 908 | if not profiles[n] in filenames: |
| 909 | filenames.append(profiles[n]) |
| 910 | except ValueError: |
| 911 | print("Input file not found: " + prof) |
| 912 | if not len(filenames): |
| 913 | print("No files found from given input.") |
| 914 | sys.exit(-1) |
| 915 | |
| 916 | return filenames |
| 917 | |
| 918 | def main(): |
| 919 | # Workaround for optparse limitation: insert -- before first negative |
no outgoing calls
no test coverage detected