From: Bruno Donassolo Date: Tue, 17 Aug 2021 10:30:23 +0000 (+0200) Subject: Please sonar a little X-Git-Tag: v3.29~126^2~17 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/60a81418ae15d47b18247171b721e207b71d6279 Please sonar a little --- diff --git a/examples/python/clusters-multicpu/clusters-multicpu.py b/examples/python/clusters-multicpu/clusters-multicpu.py index dcedd657fd..53feb77cf3 100644 --- a/examples/python/clusters-multicpu/clusters-multicpu.py +++ b/examples/python/clusters-multicpu/clusters-multicpu.py @@ -175,7 +175,7 @@ def create_torus_cluster(): ##################################################################################################### -def create_fatTree_cluster(): +def create_fat_tree_cluster(): """ Creates a Fat-Tree cluster @@ -283,7 +283,7 @@ if __name__ == '__main__': if platform == "torus": create_torus_cluster() elif platform == "fatTree": - create_fatTree_cluster() + create_fat_tree_cluster() elif platform == "dragonfly": create_dragonfly_cluster() else: diff --git a/examples/python/network-nonlinear/network-nonlinear.py b/examples/python/network-nonlinear/network-nonlinear.py index e4892af839..69f39eb4fc 100644 --- a/examples/python/network-nonlinear/network-nonlinear.py +++ b/examples/python/network-nonlinear/network-nonlinear.py @@ -53,7 +53,7 @@ class Receiver: pending_comms = [] this_actor.info("Wait for %d messages asynchronously" % self.msg_count) - for i in range(self.msg_count): + for _ in range(self.msg_count): comm, data = mbox.get_async() pending_comms.append(comm) pending_msgs.append(data) diff --git a/src/bindings/python/simgrid_python.cpp b/src/bindings/python/simgrid_python.cpp index 0ac06a9699..3d3a86c1e8 100644 --- a/src/bindings/python/simgrid_python.cpp +++ b/src/bindings/python/simgrid_python.cpp @@ -223,9 +223,9 @@ PYBIND11_MODULE(simgrid, m) "Registers the main function of an actor"); /* Class Netzone */ - py::class_>(m, "NetZone", - "Networking Zones") - .def_static("create_full_zone", &simgrid::s4u::create_full_zone, "Creates a zone of type FullZone") + py::class_> netzone(m, "NetZone", + "Networking Zones"); + netzone.def_static("create_full_zone", &simgrid::s4u::create_full_zone, "Creates a zone of type FullZone") .def_static("create_torus_zone", &simgrid::s4u::create_torus_zone, "Creates a cluster of type Torus") .def_static("create_fatTree_zone", &simgrid::s4u::create_fatTree_zone, "Creates a cluster of type Fat-Tree") .def_static("create_dragonfly_zone", &simgrid::s4u::create_dragonfly_zone, "Creates a cluster of type Dragonfly") @@ -357,8 +357,8 @@ PYBIND11_MODULE(simgrid, m) .export_values(); /* Class NetPoint */ - py::class_>( - m, "NetPoint", "NetPoint object"); + py::class_> + netpoint(m, "NetPoint", "NetPoint object"); /* Class Link */ py::class_> link(m, "Link", "Network link"); @@ -451,7 +451,7 @@ PYBIND11_MODULE(simgrid, m) py::class_(m, "PyGetAsync", "Wrapper for async get communications") .def(py::init<>()) .def( - "get", [](PyGetAsync* self) { return py::reinterpret_steal(*(self->get())); }, + "get", [](const PyGetAsync* self) { return py::reinterpret_steal(*(self->get())); }, "Get python object after async communication in receiver side"); /* Class Comm */ diff --git a/teshsuite/python/platform-mix/platform-mix.py b/teshsuite/python/platform-mix/platform-mix.py index b138dfb955..ca018a7d17 100644 --- a/teshsuite/python/platform-mix/platform-mix.py +++ b/teshsuite/python/platform-mix/platform-mix.py @@ -51,7 +51,8 @@ def load_platform(): hosts = [] # dijkstra dijkstra = NetZone.create_dijkstra_zone("dijkstra") - this_actor.info("Creating zone: " + dijkstra.name) + msg_base = "Creating zone: " + this_actor.info(msg_base + dijkstra.name) dijkstra.set_parent(root) host1 = dijkstra.create_host("host1", [1e9, 1e8]).set_core_count(2) hosts.append(host1) @@ -68,7 +69,7 @@ def load_platform(): # vivaldi vivaldi = NetZone.create_vivaldi_zone("vivaldi") - this_actor.info("Creating zone: " + vivaldi.name) + this_actor.info(msg_base + vivaldi.name) vivaldi.set_parent(root) host3 = vivaldi.create_host("host3", 1e9).set_coordinates("1 1 1").seal() host4 = vivaldi.create_host("host4", "1Gf").set_coordinates("2 2 2").seal() @@ -77,7 +78,7 @@ def load_platform(): # empty empty = NetZone.create_empty_zone("empty") - this_actor.info("Creating zone: " + empty.name) + this_actor.info(msg_base + empty.name) empty.set_parent(root) host5 = empty.create_host("host5", 1e9) hosts.append(host5) @@ -85,7 +86,7 @@ def load_platform(): # wifi wifi = NetZone.create_wifi_zone("wifi") - this_actor.info("Creating zone: " + wifi.name) + this_actor.info(msg_base + wifi.name) wifi.set_parent(root) router = wifi.create_router("wifi_router") wifi.set_property("access_point", "wifi_router") @@ -97,15 +98,15 @@ def load_platform(): wifi.seal() # create routes between netzones - linkA = vivaldi.create_link("linkA", 1e9).seal() - linkB = vivaldi.create_link("linkB", "1GBps").seal() - linkC = vivaldi.create_link("linkC", "1GBps").seal() + link_a = vivaldi.create_link("linkA", 1e9).seal() + link_b = vivaldi.create_link("linkB", "1GBps").seal() + link_c = vivaldi.create_link("linkC", "1GBps").seal() root.add_route(dijkstra.get_netpoint(), vivaldi.get_netpoint( - ), host1.get_netpoint(), host3.get_netpoint(), [LinkInRoute(linkA)], True) + ), host1.get_netpoint(), host3.get_netpoint(), [LinkInRoute(link_a)], True) root.add_route(vivaldi.get_netpoint(), empty.get_netpoint( - ), host3.get_netpoint(), host5.get_netpoint(), [LinkInRoute(linkB)], True) + ), host3.get_netpoint(), host5.get_netpoint(), [LinkInRoute(link_b)], True) root.add_route(empty.get_netpoint(), wifi.get_netpoint( - ), host5.get_netpoint(), router, [LinkInRoute(linkC)], True) + ), host5.get_netpoint(), router, [LinkInRoute(link_c)], True) # create actors Sender/Receiver Actor.create("sender", hosts[0], Sender(hosts))