
from __future__ import absolute_import, division, print_function

from xia2.Driver.DriverFactory import DriverFactory


def Xtriage(DriverType=None):
    """A factory for the Xtriage wrappers."""

    DriverInstance = DriverFactory.Driver("simple")

    class XtriageWrapper(DriverInstance.__class__):
        """A wrapper class for phenix.xtriage."""

        def __init__(self):
            DriverInstance.__class__.__init__(self)

            self.set_executable("mmtbx.xtriage")

            self._mtz = None

            return

        def set_mtz(self, mtz):
            self._mtz = mtz
            return

        def run(self):
            import os

            assert self._mtz is not None
            assert os.path.isfile(self._mtz)

            self.add_command_line(self._mtz)

            self.start()
            self.close_wait()
            self.check_for_errors()

    return XtriageWrapper()


if __name__ == "__main__":
    import sys

    assert len(sys.argv[1:]) == 1
    xtriage = Xtriage()
    xtriage.set_mtz(sys.argv[1])
    xtriage.run()
    print("".join(xtriage.get_all_output()))



from __future__ import absolute_import, division, print_function

from xia2.Driver.DriverFactory import DriverFactory


def Xtriage(DriverType=None):
    """A factory for the Xtriage wrappers."""

    DriverInstance = DriverFactory.Driver("simple")

    class XtriageWrapper(DriverInstance.__class__):
        """A wrapper class for phenix.xtriage."""

        def __init__(self):
            DriverInstance.__class__.__init__(self)

            self.set_executable("mmtbx.xtriage")

            self._mtz = None

            return

        def set_mtz(self, mtz):
            self._mtz = mtz
            return

        def run(self):
            import os

            assert self._mtz is not None
            assert os.path.isfile(self._mtz)

            self.add_command_line(self._mtz)

            self.start()
            self.close_wait()
            self.check_for_errors()

    return XtriageWrapper()

Clean __main__ + header boiler plate
Clean __main__ + header boiler plate

Then flake8 warnings re: os / sys etc.

+ 
  
  from __future__ import absolute_import, division, print_function
  
  from xia2.Driver.DriverFactory import DriverFactory
  
  
  def Xtriage(DriverType=None):
      """A factory for the Xtriage wrappers."""
  
      DriverInstance = DriverFactory.Driver("simple")
  
      class XtriageWrapper(DriverInstance.__class__):
          """A wrapper class for phenix.xtriage."""
  
          def __init__(self):
              DriverInstance.__class__.__init__(self)
  
              self.set_executable("mmtbx.xtriage")
  
              self._mtz = None
  
              return
  
          def set_mtz(self, mtz):
              self._mtz = mtz
              return
  
          def run(self):
              import os
  
              assert self._mtz is not None
              assert os.path.isfile(self._mtz)
  
              self.add_command_line(self._mtz)
  
              self.start()
              self.close_wait()
              self.check_for_errors()
  
      return XtriageWrapper()
  
- 
- if __name__ == "__main__":
-     import sys
- 
-     assert len(sys.argv[1:]) == 1
-     xtriage = Xtriage()
-     xtriage.set_mtz(sys.argv[1])
-     xtriage.run()
-     print("".join(xtriage.get_all_output()))
- 
Clean __main__ + header boiler plate
## Code Before:

from __future__ import absolute_import, division, print_function

from xia2.Driver.DriverFactory import DriverFactory


def Xtriage(DriverType=None):
    """A factory for the Xtriage wrappers."""

    DriverInstance = DriverFactory.Driver("simple")

    class XtriageWrapper(DriverInstance.__class__):
        """A wrapper class for phenix.xtriage."""

        def __init__(self):
            DriverInstance.__class__.__init__(self)

            self.set_executable("mmtbx.xtriage")

            self._mtz = None

            return

        def set_mtz(self, mtz):
            self._mtz = mtz
            return

        def run(self):
            import os

            assert self._mtz is not None
            assert os.path.isfile(self._mtz)

            self.add_command_line(self._mtz)

            self.start()
            self.close_wait()
            self.check_for_errors()

    return XtriageWrapper()


if __name__ == "__main__":
    import sys

    assert len(sys.argv[1:]) == 1
    xtriage = Xtriage()
    xtriage.set_mtz(sys.argv[1])
    xtriage.run()
    print("".join(xtriage.get_all_output()))

## Instruction:
Clean __main__ + header boiler plate
## Code After:


from __future__ import absolute_import, division, print_function

from xia2.Driver.DriverFactory import DriverFactory


def Xtriage(DriverType=None):
    """A factory for the Xtriage wrappers."""

    DriverInstance = DriverFactory.Driver("simple")

    class XtriageWrapper(DriverInstance.__class__):
        """A wrapper class for phenix.xtriage."""

        def __init__(self):
            DriverInstance.__class__.__init__(self)

            self.set_executable("mmtbx.xtriage")

            self._mtz = None

            return

        def set_mtz(self, mtz):
            self._mtz = mtz
            return

        def run(self):
            import os

            assert self._mtz is not None
            assert os.path.isfile(self._mtz)

            self.add_command_line(self._mtz)

            self.start()
            self.close_wait()
            self.check_for_errors()

    return XtriageWrapper()
