MCPcopy Index your code
hub / github.com/pythonprofilers/memory_profiler / get_profiles

Function get_profiles

mprof.py:887–916  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

885
886
887def 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
918def main():
919 # Workaround for optparse limitation: insert -- before first negative

Callers 2

plot_actionFunction · 0.85
peak_actionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected