
import sys

try:
    if 'linux' in sys.platform:
        from twisted.internet import epollreactor
        epollreactor.install()
    elif 'win' in sys.platform:
        from twisted.internet import iocpreactor
        iocpreactor.install()
    elif 'freebsd' in sys.platform or 'darwin' in sys.platform:
        from twisted.internet import kqreactor
        kqreactor.install()
except AssertionError: # reactor already installed
    pass

from twisted.internet import reactor


import sys

try:
    if 'linux' in sys.platform:
        from twisted.internet import epollreactor
        epollreactor.install()
    elif 'freebsd' in sys.platform or 'darwin' in sys.platform:
        from twisted.internet import kqreactor
        kqreactor.install()
    elif 'win' in sys.platform:
        from twisted.internet import iocpreactor
        iocpreactor.install()
except AssertionError: # reactor already installed
    pass

from twisted.internet import reactor

Fix a bug on platform detection on Mac OSX
Fix a bug on platform detection on Mac OSX

  
  import sys
  
  try:
      if 'linux' in sys.platform:
          from twisted.internet import epollreactor
          epollreactor.install()
+     elif 'freebsd' in sys.platform or 'darwin' in sys.platform:
+         from twisted.internet import kqreactor
+         kqreactor.install()
      elif 'win' in sys.platform:
          from twisted.internet import iocpreactor
          iocpreactor.install()
-     elif 'freebsd' in sys.platform or 'darwin' in sys.platform:
-         from twisted.internet import kqreactor
-         kqreactor.install()
  except AssertionError: # reactor already installed
      pass
  
  from twisted.internet import reactor
  
Fix a bug on platform detection on Mac OSX
## Code Before:

import sys

try:
    if 'linux' in sys.platform:
        from twisted.internet import epollreactor
        epollreactor.install()
    elif 'win' in sys.platform:
        from twisted.internet import iocpreactor
        iocpreactor.install()
    elif 'freebsd' in sys.platform or 'darwin' in sys.platform:
        from twisted.internet import kqreactor
        kqreactor.install()
except AssertionError: # reactor already installed
    pass

from twisted.internet import reactor

## Instruction:
Fix a bug on platform detection on Mac OSX
## Code After:

import sys

try:
    if 'linux' in sys.platform:
        from twisted.internet import epollreactor
        epollreactor.install()
    elif 'freebsd' in sys.platform or 'darwin' in sys.platform:
        from twisted.internet import kqreactor
        kqreactor.install()
    elif 'win' in sys.platform:
        from twisted.internet import iocpreactor
        iocpreactor.install()
except AssertionError: # reactor already installed
    pass

from twisted.internet import reactor
