diff options
author | Sviatoslav Sydorenko <wk@sydorenko.org.ua> | 2016-09-08 16:12:31 +0300 |
---|---|---|
committer | Sviatoslav Sydorenko <wk@sydorenko.org.ua> | 2016-09-08 16:12:31 +0300 |
commit | dc574c422886d192b33a48b036d0e9839c3cc6e0 (patch) | |
tree | c2f25676df9d99ee26521367aa1e01692d788a86 /cherrypy/lib/profiler.py | |
parent | 2035500ef638a079665a29548aea74761d8877ef (diff) | |
download | cherrypy-git-dc574c422886d192b33a48b036d0e9839c3cc6e0.tar.gz |
Convert all strings to conform single-quoted style
pre-commit run double-quote-string-fixer --all-files
Diffstat (limited to 'cherrypy/lib/profiler.py')
-rw-r--r-- | cherrypy/lib/profiler.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/cherrypy/lib/profiler.py b/cherrypy/lib/profiler.py index adacb6a9..94b87982 100644 --- a/cherrypy/lib/profiler.py +++ b/cherrypy/lib/profiler.py @@ -50,7 +50,7 @@ try: """Make profiler output more readable by adding `__init__` modules' parents """ filename, line, name = func_name - if filename.endswith("__init__.py"): + if filename.endswith('__init__.py'): return os.path.basename(filename[:-12]) + filename[-12:], line, name return os.path.basename(filename), line, name @@ -67,7 +67,7 @@ class Profiler(object): def __init__(self, path=None): if not path: - path = os.path.join(os.path.dirname(__file__), "profile") + path = os.path.join(os.path.dirname(__file__), 'profile') self.path = path if not os.path.exists(path): os.makedirs(path) @@ -76,7 +76,7 @@ class Profiler(object): """Dump profile data into self.path.""" global _count c = _count = _count + 1 - path = os.path.join(self.path, "cp_%04d.prof" % c) + path = os.path.join(self.path, 'cp_%04d.prof' % c) prof = profile.Profile() result = prof.runcall(func, *args, **params) prof.dump_stats(path) @@ -86,7 +86,7 @@ class Profiler(object): """:rtype: list of available profiles. """ return [f for f in os.listdir(self.path) - if f.startswith("cp_") and f.endswith(".prof")] + if f.startswith('cp_') and f.endswith('.prof')] def stats(self, filename, sortby='cumulative'): """:rtype stats(index): output of print_stats() for the given profile. @@ -126,8 +126,8 @@ class Profiler(object): @cherrypy.expose def menu(self): - yield "<h2>Profiling runs</h2>" - yield "<p>Click on one of the runs below to see profiling data.</p>" + yield '<h2>Profiling runs</h2>' + yield '<p>Click on one of the runs below to see profiling data.</p>' runs = self.statfiles() runs.sort() for i in runs: @@ -149,7 +149,7 @@ class ProfileAggregator(Profiler): self.profiler = profile.Profile() def run(self, func, *args, **params): - path = os.path.join(self.path, "cp_%04d.prof" % self.count) + path = os.path.join(self.path, 'cp_%04d.prof' % self.count) result = self.profiler.runcall(func, *args, **params) self.profiler.dump_stats(path) return result @@ -174,11 +174,11 @@ class make_app: """ if profile is None or pstats is None: - msg = ("Your installation of Python does not have a profile " + msg = ('Your installation of Python does not have a profile ' "module. If you're on Debian, try " - "`sudo apt-get install python-profiler`. " - "See http://www.cherrypy.org/wiki/ProfilingOnDebian " - "for details.") + '`sudo apt-get install python-profiler`. ' + 'See http://www.cherrypy.org/wiki/ProfilingOnDebian ' + 'for details.') warnings.warn(msg) self.nextapp = nextapp @@ -199,19 +199,19 @@ class make_app: def serve(path=None, port=8080): if profile is None or pstats is None: - msg = ("Your installation of Python does not have a profile module. " + msg = ('Your installation of Python does not have a profile module. ' "If you're on Debian, try " - "`sudo apt-get install python-profiler`. " - "See http://www.cherrypy.org/wiki/ProfilingOnDebian " - "for details.") + '`sudo apt-get install python-profiler`. ' + 'See http://www.cherrypy.org/wiki/ProfilingOnDebian ' + 'for details.') warnings.warn(msg) cherrypy.config.update({'server.socket_port': int(port), 'server.thread_pool': 10, - 'environment': "production", + 'environment': 'production', }) cherrypy.quickstart(Profiler(path)) -if __name__ == "__main__": +if __name__ == '__main__': serve(*tuple(sys.argv[1:])) |