graphite-project / carbon

Consider decorating method with @staticmethod PYL-R0201
Performance
Major
4 occurrences in this check
Method doesn't use the class instance and could be converted into a static method
165        for exp, act in zip(expected, actual):
166            self.assertEqual(exp, act)
167
168    def test_wrong_dest(self):169        # Some cases of invalid input, e.g. invalid/missing port.
170        dests = [
171            "1.2.3.4",                      # No port
Method doesn't use the class instance and could be converted into a static method
 17            def getHandle(self):
 18                return s
 19
 20            def setTcpKeepAlive(self, value): 21                s.setsockopt(socket.SOL_TCP, socket.SO_KEEPALIVE, value)
 22
 23        enableTcpKeepAlive(_Transport(), True, None)
Method doesn't use the class instance and could be converted into a static method
 14        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 15
 16        class _Transport():
 17            def getHandle(self): 18                return s
 19
 20            def setTcpKeepAlive(self, value):
Method doesn't use the class instance and could be converted into a static method
121        port = self.instance_ports[(server, instance)]
122        yield (server, port, instance)
123
124  def getKey(self, metric):125    return metric
126
127