PyLint fixes for tools-webrtc and webrtc/tools

Fix a lot of errors before bringing in the new config in
https://codereview.webrtc.org/2737963003/

BUG=webrtc:7303
NOTRY=True

Review-Url: https://codereview.webrtc.org/2736233003
Cr-Commit-Position: refs/heads/master@{#17137}
diff --git a/tools-webrtc/network_emulator/emulate.py b/tools-webrtc/network_emulator/emulate.py
index 82a6f48..08049a5 100755
--- a/tools-webrtc/network_emulator/emulate.py
+++ b/tools-webrtc/network_emulator/emulate.py
@@ -55,14 +55,14 @@
     return self.epilog
 
 
-def _get_external_ip():
+def _GetExternalIp():
   """Finds out the machine's external IP by connecting to google.com."""
   external_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
   external_socket.connect(('google.com', 80))
   return external_socket.getsockname()[0]
 
 
-def _parse_args():
+def _ParseArgs():
   """Define and parse the command-line arguments."""
   presets_string = '\n'.join(str(p) for p in _PRESETS)
   parser = NonStrippingEpilogOptionParser(epilog=(
@@ -123,11 +123,11 @@
   except ValueError:
     parser.error('Invalid port range specified.')
 
-  _set_logger(options.verbose)
+  _InitLogging(options.verbose)
   return options
 
 
-def _set_logger(verbose):
+def _InitLogging(verbose):
   """Setup logging."""
   log_level = _DEFAULT_LOG_LEVEL
   if verbose:
@@ -135,8 +135,8 @@
   logging.basicConfig(level=log_level, format='%(message)s')
 
 
-def _main():
-  options = _parse_args()
+def main():
+  options = _ParseArgs()
 
   # Build a configuration object. Override any preset configuration settings if
   # a value of a setting was also given as a flag.
@@ -154,19 +154,19 @@
   emulator = network_emulator.NetworkEmulator(connection_config,
                                               options.port_range)
   try:
-    emulator.check_permissions()
+    emulator.CheckPermissions()
   except network_emulator.NetworkEmulatorError as e:
     logging.error('Error: %s\n\nCause: %s', e.fail_msg, e.error)
     return -1
 
   if not options.target_ip:
-    external_ip = _get_external_ip()
+    external_ip = _GetExternalIp()
   else:
     external_ip = options.target_ip
 
   logging.info('Constraining traffic to/from IP: %s', external_ip)
   try:
-    emulator.emulate(external_ip)
+    emulator.Emulate(external_ip)
     logging.info('Started network emulation with the following configuration:\n'
                  '  Receive bandwidth: %s kbps (%s kB/s)\n'
                  '  Send bandwidth   : %s kbps (%s kB/s)\n'
@@ -184,7 +184,7 @@
                  options.port_range[0], options.port_range[1])
     raw_input('Press Enter to abort Network Emulation...')
     logging.info('Flushing all Dummynet rules...')
-    network_emulator.cleanup()
+    network_emulator.Cleanup()
     logging.info('Completed Network Emulation.')
     return 0
   except network_emulator.NetworkEmulatorError as e:
@@ -192,4 +192,4 @@
     return -2
 
 if __name__ == '__main__':
-  sys.exit(_main())
+  sys.exit(main())
diff --git a/tools-webrtc/network_emulator/network_emulator.py b/tools-webrtc/network_emulator/network_emulator.py
index 9bdf7bd..aa3ebda 100644
--- a/tools-webrtc/network_emulator/network_emulator.py
+++ b/tools-webrtc/network_emulator/network_emulator.py
@@ -53,20 +53,20 @@
     self._port_range = port_range
     self._connection_config = connection_config
 
-  def emulate(self, target_ip):
+  def Emulate(self, target_ip):
     """Starts a network emulation by setting up Dummynet rules.
 
     Args:
         target_ip: The IP address of the interface that shall be that have the
             network constraints applied to it.
     """
-    receive_pipe_id = self._create_dummynet_pipe(
+    receive_pipe_id = self._CreateDummynetPipe(
         self._connection_config.receive_bw_kbps,
         self._connection_config.delay_ms,
         self._connection_config.packet_loss_percent,
         self._connection_config.queue_slots)
     logging.debug('Created receive pipe: %s', receive_pipe_id)
-    send_pipe_id = self._create_dummynet_pipe(
+    send_pipe_id = self._CreateDummynetPipe(
         self._connection_config.send_bw_kbps,
         self._connection_config.delay_ms,
         self._connection_config.packet_loss_percent,
@@ -74,15 +74,15 @@
     logging.debug('Created send pipe: %s', send_pipe_id)
 
     # Adding the rules will start the emulation.
-    incoming_rule_id = self._create_dummynet_rule(receive_pipe_id, 'any',
-                                                  target_ip, self._port_range)
+    incoming_rule_id = self._CreateDummynetRule(receive_pipe_id, 'any',
+                                                target_ip, self._port_range)
     logging.debug('Created incoming rule: %s', incoming_rule_id)
-    outgoing_rule_id = self._create_dummynet_rule(send_pipe_id, target_ip,
-                                                  'any', self._port_range)
+    outgoing_rule_id = self._CreateDummynetRule(send_pipe_id, target_ip,
+                                                'any', self._port_range)
     logging.debug('Created outgoing rule: %s', outgoing_rule_id)
 
   @staticmethod
-  def check_permissions():
+  def CheckPermissions():
     """Checks if permissions are available to run Dummynet commands.
 
     Raises:
@@ -99,8 +99,8 @@
         raise NetworkEmulatorError('You must run this script with administrator'
                                    ' privileges.')
 
-  def _create_dummynet_rule(self, pipe_id, from_address, to_address,
-                            port_range):
+  def _CreateDummynetRule(self, pipe_id, from_address, to_address,
+                          port_range):
     """Creates a network emulation rule and returns its ID.
 
     Args:
@@ -118,14 +118,14 @@
     self._rule_counter += 100
     add_part = ['add', self._rule_counter, 'pipe', pipe_id,
                 'ip', 'from', from_address, 'to', to_address]
-    _run_ipfw_command(add_part + ['src-port', '%s-%s' % port_range],
+    _RunIpfwCommand(add_part + ['src-port', '%s-%s' % port_range],
                             'Failed to add Dummynet src-port rule.')
-    _run_ipfw_command(add_part + ['dst-port', '%s-%s' % port_range],
+    _RunIpfwCommand(add_part + ['dst-port', '%s-%s' % port_range],
                             'Failed to add Dummynet dst-port rule.')
     return self._rule_counter
 
-  def _create_dummynet_pipe(self, bandwidth_kbps, delay_ms, packet_loss_percent,
-                            queue_slots):
+  def _CreateDummynetPipe(self, bandwidth_kbps, delay_ms, packet_loss_percent,
+                          queue_slots):
     """Creates a Dummynet pipe and return its ID.
 
     Args:
@@ -146,21 +146,21 @@
     if sys.platform.startswith('linux'):
       error_message += ('Make sure you have loaded the ipfw_mod.ko module to '
                         'your kernel (sudo insmod /path/to/ipfw_mod.ko).')
-    _run_ipfw_command(cmd, error_message)
+    _RunIpfwCommand(cmd, error_message)
     return self._pipe_counter
 
-def cleanup():
+def Cleanup():
   """Stops the network emulation by flushing all Dummynet rules.
 
   Notice that this will flush any rules that may have been created previously
   before starting the emulation.
   """
-  _run_ipfw_command(['-f', 'flush'],
+  _RunIpfwCommand(['-f', 'flush'],
                           'Failed to flush Dummynet rules!')
-  _run_ipfw_command(['-f', 'pipe', 'flush'],
+  _RunIpfwCommand(['-f', 'pipe', 'flush'],
                           'Failed to flush Dummynet pipes!')
 
-def _run_ipfw_command(command, fail_msg=None):
+def _RunIpfwCommand(command, fail_msg=None):
   """Executes a command and prefixes the appropriate command for
      Windows or Linux/UNIX.