Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/reflectionhandler.py

Issue 2019923002: Fix pylint unused-* warnings in webkitpy/tool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/rebaselineserver.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2011 Google Inc. All rights reserved. 1 # Copyright (c) 2011 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 json.dump(json_object, self.wfile) 119 json.dump(json_object, self.wfile)
120 120
121 def _serve_file(self, file_path, cacheable_seconds=0, headers_only=False): 121 def _serve_file(self, file_path, cacheable_seconds=0, headers_only=False):
122 if not os.path.exists(file_path): 122 if not os.path.exists(file_path):
123 self.send_error(404, "File not found") 123 self.send_error(404, "File not found")
124 return 124 return
125 with codecs.open(file_path, "rb") as static_file: 125 with codecs.open(file_path, "rb") as static_file:
126 self.send_response(200) 126 self.send_response(200)
127 self._send_access_control_header() 127 self._send_access_control_header()
128 self.send_header("Content-Length", os.path.getsize(file_path)) 128 self.send_header("Content-Length", os.path.getsize(file_path))
129 mime_type, encoding = mimetypes.guess_type(file_path) 129 mime_type, _ = mimetypes.guess_type(file_path)
130 if mime_type: 130 if mime_type:
131 self.send_header("Content-type", mime_type) 131 self.send_header("Content-type", mime_type)
132 132
133 if cacheable_seconds: 133 if cacheable_seconds:
134 expires_time = (datetime.datetime.now() + 134 expires_time = (datetime.datetime.now() +
135 datetime.timedelta(0, cacheable_seconds)) 135 datetime.timedelta(0, cacheable_seconds))
136 expires_formatted = wsgiref.handlers.format_date_time( 136 expires_formatted = wsgiref.handlers.format_date_time(
137 time.mktime(expires_time.timetuple())) 137 time.mktime(expires_time.timetuple()))
138 self.send_header("Expires", expires_formatted) 138 self.send_header("Expires", expires_formatted)
139 self.end_headers() 139 self.end_headers()
140 140
141 if not headers_only: 141 if not headers_only:
142 shutil.copyfileobj(static_file, self.wfile) 142 shutil.copyfileobj(static_file, self.wfile)
143 143
144 def _serve_xml(self, xml): 144 def _serve_xml(self, xml):
145 self.send_response(200) 145 self.send_response(200)
146 self._send_access_control_header() 146 self._send_access_control_header()
147 self.send_header("Content-type", "text/xml") 147 self.send_header("Content-type", "text/xml")
148 self.end_headers() 148 self.end_headers()
149 xml = xml.encode('utf-8') 149 xml = xml.encode('utf-8')
150 self.wfile.write(xml) 150 self.wfile.write(xml)
OLDNEW
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/rebaselineserver.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698