
import abc

import six

from .._table_writer import AbstractTableWriter


@six.add_metaclass(abc.ABCMeta)
class BinaryWriterInterface(object):
    @abc.abstractmethod
    def is_opened(self):  # pragma: no cover
        pass

    @abc.abstractmethod
    def open(self, file_path):  # pragma: no cover
        pass


class AbstractBinaryTableWriter(AbstractTableWriter, BinaryWriterInterface):
    def dumps(self):
        raise NotImplementedError("binary format writers did not support dumps method")


import abc

import six

from .._table_writer import AbstractTableWriter


@six.add_metaclass(abc.ABCMeta)
class BinaryWriterInterface(object):
    @abc.abstractmethod
    def is_opened(self):  # pragma: no cover
        pass

    @abc.abstractmethod
    def open(self, file_path):  # pragma: no cover
        pass


class AbstractBinaryTableWriter(AbstractTableWriter, BinaryWriterInterface):
    def dumps(self):
        raise NotImplementedError("binary format writers did not support dumps method")

    def _verify_stream(self):
        if self.stream is None:
            raise IOError("null output stream. required to open(file_path) first.")

Add stream verification for binary format writers
Add stream verification for binary format writers

  
  import abc
  
  import six
  
  from .._table_writer import AbstractTableWriter
  
  
  @six.add_metaclass(abc.ABCMeta)
  class BinaryWriterInterface(object):
      @abc.abstractmethod
      def is_opened(self):  # pragma: no cover
          pass
  
      @abc.abstractmethod
      def open(self, file_path):  # pragma: no cover
          pass
  
  
  class AbstractBinaryTableWriter(AbstractTableWriter, BinaryWriterInterface):
      def dumps(self):
          raise NotImplementedError("binary format writers did not support dumps method")
  
+     def _verify_stream(self):
+         if self.stream is None:
+             raise IOError("null output stream. required to open(file_path) first.")
+ 
Add stream verification for binary format writers
## Code Before:

import abc

import six

from .._table_writer import AbstractTableWriter


@six.add_metaclass(abc.ABCMeta)
class BinaryWriterInterface(object):
    @abc.abstractmethod
    def is_opened(self):  # pragma: no cover
        pass

    @abc.abstractmethod
    def open(self, file_path):  # pragma: no cover
        pass


class AbstractBinaryTableWriter(AbstractTableWriter, BinaryWriterInterface):
    def dumps(self):
        raise NotImplementedError("binary format writers did not support dumps method")

## Instruction:
Add stream verification for binary format writers
## Code After:

import abc

import six

from .._table_writer import AbstractTableWriter


@six.add_metaclass(abc.ABCMeta)
class BinaryWriterInterface(object):
    @abc.abstractmethod
    def is_opened(self):  # pragma: no cover
        pass

    @abc.abstractmethod
    def open(self, file_path):  # pragma: no cover
        pass


class AbstractBinaryTableWriter(AbstractTableWriter, BinaryWriterInterface):
    def dumps(self):
        raise NotImplementedError("binary format writers did not support dumps method")

    def _verify_stream(self):
        if self.stream is None:
            raise IOError("null output stream. required to open(file_path) first.")
