From 371bb9e6f05fc99bdd269657e49ca3eadefe9ce9 Mon Sep 17 00:00:00 2001 From: Eduardo Almeida Date: Wed, 5 Oct 2022 21:09:29 +0100 Subject: [PATCH] Convert tabs to spaces in Python scripts --- examples/tutorial/second.py | 12 +++++----- examples/tutorial/third.py | 22 +++++++++---------- .../examples/wifi-olsr-flowmon.py | 4 ++-- src/lr-wpan/test/examples-to-run.py | 6 ++--- src/visualizer/visualizer/hud.py | 4 ++-- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/examples/tutorial/second.py b/examples/tutorial/second.py index e499efe89..3d7f24e18 100644 --- a/examples/tutorial/second.py +++ b/examples/tutorial/second.py @@ -31,10 +31,10 @@ using namespace ns3; CommandLine& GetCommandLine(std::string filename, int& nCsma, bool& verbose) { - static CommandLine cmd = CommandLine(filename); - cmd.AddValue("nCsma", "Number of extra CSMA nodes/devices", nCsma); - cmd.AddValue("verbose", "Tell echo applications to log if true", verbose); - return cmd; + static CommandLine cmd = CommandLine(filename); + cmd.AddValue("nCsma", "Number of extra CSMA nodes/devices", nCsma); + cmd.AddValue("verbose", "Tell echo applications to log if true", verbose); + return cmd; } """) from ctypes import c_int, c_bool @@ -47,8 +47,8 @@ nCsma = nCsma.value verbose = verbose.value if verbose == "True": - ns.core.LogComponentEnable("UdpEchoClientApplication", ns.core.LOG_LEVEL_INFO) - ns.core.LogComponentEnable("UdpEchoServerApplication", ns.core.LOG_LEVEL_INFO) + ns.core.LogComponentEnable("UdpEchoClientApplication", ns.core.LOG_LEVEL_INFO) + ns.core.LogComponentEnable("UdpEchoServerApplication", ns.core.LOG_LEVEL_INFO) nCsma = 1 if nCsma == 0 else nCsma p2pNodes = ns.network.NodeContainer() diff --git a/examples/tutorial/third.py b/examples/tutorial/third.py index b7e6f7f0b..622162af6 100644 --- a/examples/tutorial/third.py +++ b/examples/tutorial/third.py @@ -50,12 +50,12 @@ nWifi = int(nWifi) # allocator's configuration; the grid layout will exceed the # bounding box if more than 18 nodes are provided. if nWifi > 18: - print ("nWifi should be 18 or less; otherwise grid layout exceeds the bounding box") - sys.exit(1) + print("nWifi should be 18 or less; otherwise grid layout exceeds the bounding box") + sys.exit(1) if verbose == "True": - ns.core.LogComponentEnable("UdpEchoClientApplication", ns.core.LOG_LEVEL_INFO) - ns.core.LogComponentEnable("UdpEchoServerApplication", ns.core.LOG_LEVEL_INFO) + ns.core.LogComponentEnable("UdpEchoClientApplication", ns.core.LOG_LEVEL_INFO) + ns.core.LogComponentEnable("UdpEchoServerApplication", ns.core.LOG_LEVEL_INFO) p2pNodes = ns.network.NodeContainer() p2pNodes.Create(2) @@ -96,9 +96,9 @@ mac.SetType("ns3::ApWifiMac","Ssid", ns.wifi.SsidValue (ssid)) apDevices = wifi.Install(phy, mac, wifiApNode) mobility = ns.mobility.MobilityHelper() -mobility.SetPositionAllocator ("ns3::GridPositionAllocator", "MinX", ns.core.DoubleValue(0.0), - "MinY", ns.core.DoubleValue (0.0), "DeltaX", ns.core.DoubleValue(5.0), "DeltaY", ns.core.DoubleValue(10.0), - "GridWidth", ns.core.UintegerValue(3), "LayoutType", ns.core.StringValue("RowFirst")) +mobility.SetPositionAllocator("ns3::GridPositionAllocator", "MinX", ns.core.DoubleValue(0.0), + "MinY", ns.core.DoubleValue (0.0), "DeltaX", ns.core.DoubleValue(5.0), "DeltaY", ns.core.DoubleValue(10.0), + "GridWidth", ns.core.UintegerValue(3), "LayoutType", ns.core.StringValue("RowFirst")) mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel", "Bounds", ns.mobility.RectangleValue(ns.mobility.Rectangle (-50, 50, -50, 50))) mobility.Install(wifiStaNodes) @@ -142,10 +142,10 @@ ns.internet.Ipv4GlobalRoutingHelper.PopulateRoutingTables() ns.core.Simulator.Stop(ns.core.Seconds(10.0)) if tracing == "True": - phy.SetPcapDataLinkType(phy.DLT_IEEE802_11_RADIO) - pointToPoint.EnablePcapAll ("third") - phy.EnablePcap ("third", apDevices.Get (0)) - csma.EnablePcap ("third", csmaDevices.Get (0), True) + phy.SetPcapDataLinkType(phy.DLT_IEEE802_11_RADIO) + pointToPoint.EnablePcapAll ("third") + phy.EnablePcap ("third", apDevices.Get (0)) + csma.EnablePcap ("third", csmaDevices.Get (0), True) ns.core.Simulator.Run() ns.core.Simulator.Destroy() diff --git a/src/flow-monitor/examples/wifi-olsr-flowmon.py b/src/flow-monitor/examples/wifi-olsr-flowmon.py index 736d8984c..a806066b2 100644 --- a/src/flow-monitor/examples/wifi-olsr-flowmon.py +++ b/src/flow-monitor/examples/wifi-olsr-flowmon.py @@ -29,11 +29,11 @@ using namespace ns3; CommandLine& GetCommandLine(std::string filename, int& NumNodesSide, bool& Plot, std::string Results) { - static CommandLine cmd = CommandLine(filename); + static CommandLine cmd = CommandLine(filename); cmd.AddValue("NumNodesSide", "Grid side number of nodes (total number of nodes will be this number squared)", NumNodesSide); cmd.AddValue("Results", "Write XML results to file", Results); cmd.AddValue("Plot", "Plot the results using the matplotlib python module", Plot); - return cmd; + return cmd; } """) diff --git a/src/lr-wpan/test/examples-to-run.py b/src/lr-wpan/test/examples-to-run.py index 37b397052..dfe679888 100644 --- a/src/lr-wpan/test/examples-to-run.py +++ b/src/lr-wpan/test/examples-to-run.py @@ -9,10 +9,10 @@ # See test.py for more information. cpp_examples = [ ("lr-wpan-data", "True", "True"), - ("lr-wpan-error-distance-plot", "True", "True"), + ("lr-wpan-error-distance-plot", "True", "True"), ("lr-wpan-error-model-plot", "True", "True"), - ("lr-wpan-packet-print", "True", "True"), - ("lr-wpan-phy-test", "True", "True"), + ("lr-wpan-packet-print", "True", "True"), + ("lr-wpan-phy-test", "True", "True"), ] # A list of Python examples to run in order to ensure that they remain diff --git a/src/visualizer/visualizer/hud.py b/src/visualizer/visualizer/hud.py index 8aa0c3ec5..b806c066e 100644 --- a/src/visualizer/visualizer/hud.py +++ b/src/visualizer/visualizer/hud.py @@ -91,11 +91,11 @@ class Axes(object): for n in range(5): # iterate 5 times to find optimum division size #/* div: length of each division */ tbe = math.log10(dx_over_ndiv)#; /* looking for approx. 'ndiv' divisions in a length 'dx' */ - div = pow(10, rint(tbe))#; /* div: power of 10 closest to dx/ndiv */ + div = pow(10, rint(tbe))#; /* div: power of 10 closest to dx/ndiv */ if math.fabs(div/2 - dx_over_ndiv) < math.fabs(div - dx_over_ndiv): #/* test if div/2 is closer to dx/ndiv */ div /= 2 elif math.fabs(div*2 - dx_over_ndiv) < math.fabs(div - dx_over_ndiv): - div *= 2 # /* test if div*2 is closer to dx/ndiv */ + div *= 2 # /* test if div*2 is closer to dx/ndiv */ x0 = div*math.ceil(xi / div) - div if n > 1: ndiv = rint(size / text_width)