From 72385a6981b38c870dc3c46346fe7eff86f1bba3 Mon Sep 17 00:00:00 2001 From: Lin Yang Date: Fri, 5 Sep 2014 15:51:07 +0800 Subject: [PATCH] Change method _sort_key_for to static This method does not reference to any attribute of this class, so it's better to change it to classstatic. Change-Id: I3ea0ca83cb29ceae9afb20da0c9817a9b044c084 Signed-off-by: Lin Yang --- swift/common/ring/builder.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/swift/common/ring/builder.py b/swift/common/ring/builder.py index ee10a934c2..0250c264eb 100644 --- a/swift/common/ring/builder.py +++ b/swift/common/ring/builder.py @@ -931,7 +931,8 @@ class RingBuilder(object): del dev['sort_key'] del dev['tiers'] - def _sort_key_for(self, dev): + @staticmethod + def _sort_key_for(dev): return (dev['parts_wanted'], random.randint(0, 0xFFFF), dev['id']) def _build_max_replicas_by_tier(self):