parameters: (self, size=None)
docstring: Truncate the file's size.
  
          If the optional size argument is present, the file is truncated to
          (at most) that size. The size defaults to the current position.
          The current file position is not changed unless the position
          is beyond the new file size.
  
          If the specified size exceeds the file's current size, the
          file remains unchanged.
docstring_summary: Truncate the file's size.
docstring_tokens: Truncate the file s size .
function: def truncate(self, size=None):
          """Truncate the file's size.
  
          If the optional size argument is present, the file is truncated to
          (at most) that size. The size defaults to the current position.
          The current file position is not changed unless the position
          is beyond the new file size.
  
          If the specified size exceeds the file's current size, the
          file remains unchanged.
          """
          _complain_ifclosed(self.closed)
          if size is None:
              size = self.pos
          elif size < 0:
              raise IOError(22, "Negative size not allowed")
          elif size < self.pos:
              self.pos = size
          self.buf = self.getvalue()[:size]
          self.len = size
function_tokens: def truncate ( self , size = None ) : _complain_ifclosed ( self . closed ) if size is None : size = self . pos elif size < 0 : raise IOError ( 22 , "Negative size not allowed" ) elif size < self . pos : self . pos = size self . buf = self . getvalue ( ) [ : size ] self . len = size