D5017: py3: use raw strings in statprof.py

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Fri Oct 12 17:02:33 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb594db74dc13: py3: use raw strings in statprof.py (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5017?vs=11930&id=11952

REVISION DETAIL
  https://phab.mercurial-scm.org/D5017

AFFECTED FILES
  mercurial/statprof.py

CHANGE DETAILS

diff --git a/mercurial/statprof.py b/mercurial/statprof.py
--- a/mercurial/statprof.py
+++ b/mercurial/statprof.py
@@ -902,17 +902,17 @@
 
     optstart = 2
     displayargs['function'] = None
-    if argv[1] == 'hotpath':
+    if argv[1] == r'hotpath':
         displayargs['format'] = DisplayFormats.Hotpath
-    elif argv[1] == 'lines':
+    elif argv[1] == r'lines':
         displayargs['format'] = DisplayFormats.ByLine
-    elif argv[1] == 'functions':
+    elif argv[1] == r'functions':
         displayargs['format'] = DisplayFormats.ByMethod
-    elif argv[1] == 'function':
+    elif argv[1] == r'function':
         displayargs['format'] = DisplayFormats.AboutMethod
         displayargs['function'] = argv[2]
         optstart = 3
-    elif argv[1] == 'flame':
+    elif argv[1] == r'flame':
         displayargs['format'] = DisplayFormats.FlameGraph
     else:
         printusage()
@@ -930,29 +930,29 @@
     displayargs['limit'] = 0.05
     path = None
     for o, value in opts:
-        if o in ("-l", "--limit"):
+        if o in (r"-l", r"--limit"):
             displayargs['limit'] = float(value)
-        elif o in ("-f", "--file"):
+        elif o in (r"-f", r"--file"):
             path = value
-        elif o in ("-o", "--output-file"):
+        elif o in (r"-o", r"--output-file"):
             displayargs['outputfile'] = value
-        elif o in ("-p", "--script-path"):
+        elif o in (r"-p", r"--script-path"):
             displayargs['scriptpath'] = value
-        elif o in ("-h", "help"):
+        elif o in (r"-h", r"help"):
             printusage()
             return 0
         else:
             assert False, "unhandled option %s" % o
 
     if not path:
-        print('must specify --file to load')
+        print(r'must specify --file to load')
         return 1
 
     load_data(path=path)
 
     display(**pycompat.strkwargs(displayargs))
 
     return 0
 
-if __name__ == "__main__":
+if __name__ == r"__main__":
     sys.exit(main())



To: indygreg, #hg-reviewers, pulkit
Cc: mercurial-devel


More information about the Mercurial-devel mailing list