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

Side by Side Diff: build/android/pylib/system_properties.py

Issue 132463007: Enable presubmit pylint in build/android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase vs tot and only disabling F0401 in specific spots Created 6 years, 10 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 | « build/android/pylib/screenshot.py ('k') | build/android/pylib/uiautomator/setup.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 5
6 class SystemProperties(dict): 6 class SystemProperties(dict):
7 7
8 """A dict interface to interact with device system properties. 8 """A dict interface to interact with device system properties.
9 9
10 System properties are key/value pairs as exposed by adb shell getprop/setprop. 10 System properties are key/value pairs as exposed by adb shell getprop/setprop.
(...skipping 11 matching lines...) Expand all
22 if self._IsStatic(key): 22 if self._IsStatic(key):
23 if key not in self._cached_static_properties: 23 if key not in self._cached_static_properties:
24 self._cached_static_properties[key] = self._GetProperty(key) 24 self._cached_static_properties[key] = self._GetProperty(key)
25 return self._cached_static_properties[key] 25 return self._cached_static_properties[key]
26 return self._GetProperty(key) 26 return self._GetProperty(key)
27 27
28 def __setitem__(self, key, value): 28 def __setitem__(self, key, value):
29 # TODO(tonyg): This can fail with no root. Verify that it succeeds. 29 # TODO(tonyg): This can fail with no root. Verify that it succeeds.
30 self._adb.SendShellCommand('setprop %s "%s"' % (key, value), retry_count=3) 30 self._adb.SendShellCommand('setprop %s "%s"' % (key, value), retry_count=3)
31 31
32 def _IsStatic(self, key): 32 @staticmethod
33 def _IsStatic(key):
33 # TODO(tonyg): This list is conservative and could be expanded as needed. 34 # TODO(tonyg): This list is conservative and could be expanded as needed.
34 return (key.startswith('ro.boot.') or 35 return (key.startswith('ro.boot.') or
35 key.startswith('ro.build.') or 36 key.startswith('ro.build.') or
36 key.startswith('ro.product.')) 37 key.startswith('ro.product.'))
37 38
38 def _GetProperty(self, key): 39 def _GetProperty(self, key):
39 return self._adb.SendShellCommand('getprop %s' % key, retry_count=3).strip() 40 return self._adb.SendShellCommand('getprop %s' % key, retry_count=3).strip()
OLDNEW
« no previous file with comments | « build/android/pylib/screenshot.py ('k') | build/android/pylib/uiautomator/setup.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698