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

Unified Diff: tools/telemetry/telemetry/util/classes.py

Issue 625123002: Make credential_path a page attribute instead of page_set attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/util/classes.py
diff --git a/tools/telemetry/telemetry/util/classes.py b/tools/telemetry/telemetry/util/classes.py
new file mode 100644
index 0000000000000000000000000000000000000000..c8556b113f3a1f851bc29a2c7fb3e5650dc9a13b
--- /dev/null
+++ b/tools/telemetry/telemetry/util/classes.py
@@ -0,0 +1,20 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import inspect
+
+def IsDirectlyConstructable(cls):
+ assert inspect.isclass(cls)
+ # Case class A: pass
+ if not hasattr(cls, '__init__'):
+ return True
+ # Case class A(object): pass
+ if cls.__init__ is object.__init__:
+ return True
+ # Case class has __init__ method which is not object.__init__.
+ args, _1, _2, defaults = inspect.getargspec(cls.__init__)
+ if defaults is None:
+ defaults = []
+ return ('self' in args and
+ len(args) == len(defaults) + 1)

Powered by Google App Engine
This is Rietveld 408576698