title: "Expected type 'Union[str, bytearray]' got 'int' instead" warning in write method
body: <p>My script writes to file chunk by chunk, using pre-generated data patterns:</p>
  
  <pre><code>#  Data pattern generator    
  def get_random_chunk_pattern():
              return ''.join(random.choice(ascii_uppercase + digits + ascii_lowercase) for _ in range(8))
  </code></pre>
  
  <p>....</p>
  
  <pre><code># DedupChunk class CTOR:
  class DedupChunk:
      def __init__(self, chunk_size, chunk_pattern, chunk_position=0, state=DedupChunkStates.PENDING):
          self._chunk_size = chunk_size  # chunk size in bytes
          self._chunk_pattern = chunk_pattern
          self._chunk_position = chunk_position
          self._state = state
          self.mapping = None
  
      @property
      def size(self):
          return self._chunk_size
  
      @property
      def pattern(self):
          return self._chunk_pattern
  
      @property
      def position(self):
          return self._chunk_position
  
      @property
      def state(self):
          return self._state
  </code></pre>
  
  <p>....</p>
  
  <pre><code># Here Chunk object is being initialized (inside other class's CTOR):
  chunk_size = random.randint(64, 192) * 1024  # in bytes
          while (position + chunk_size) &lt; self.file_size:  # generating random chunks number
              self.chunks.append(DedupChunk(chunk_size, DedupChunkPattern.get_random_chunk_pattern(), position))
  </code></pre>
  
  <p>....</p>
  
  <pre><code># Actual writing
      with open(self.path, 'rb+') as f:
          for chunk in self.chunks:
              f.write(chunk.pattern * (chunk.size // 8))
  </code></pre>
  
  <p><code>PyCharm</code> displays "<code>Expected type 'Union[str, bytearray]'  got 'int' instead</code>" warning in write method</p>
  
  <p>But when removing the division in
  <code>f.write(chunk.pattern * chunk.size)</code>,  or doing division outside:</p>
  
  <pre><code>chunk.size //= 8
  f.write(chunk.pattern * chunk.size)
  </code></pre>
  
  <p>warning disappeared </p>
  
  <p>What actually happened here?</p>
  
  <p>Thanks</p>