

import subprocess
import commands

from .base import *


def copy(string):
    """Copy given string into system clipboard."""
    try:
        subprocess.Popen(['pbcopy'], stdin=subprocess.PIPE).communicate(str(unicode(string)))
    except OSError as why:
        raise XcodeNotFound
    
    return
   
    
def paste():
    """Returns system clipboard contents."""
    try:
        return unicode(commands.getoutput('pbpaste'))
    except OSError as why:
        raise XcodeNotFound
    



import subprocess

from .base import *


def copy(string):
    """Copy given string into system clipboard."""
    try:
        subprocess.Popen(['pbcopy'], stdin=subprocess.PIPE).communicate(str(unicode(string)))
    except OSError as why:
        raise XcodeNotFound
    
    return
   
    
def paste():
    """Returns system clipboard contents."""
    try:
        return unicode(subprocess.check_output('pbpaste'))
    except OSError as why:
        raise XcodeNotFound
    

Use `subprocess.check_output` rather than `commands.getoutput`.
Use `subprocess.check_output` rather than `commands.getoutput`.

`commands` is deprecated.

  
  
  import subprocess
- import commands
  
  from .base import *
  
  
  def copy(string):
      """Copy given string into system clipboard."""
      try:
          subprocess.Popen(['pbcopy'], stdin=subprocess.PIPE).communicate(str(unicode(string)))
      except OSError as why:
          raise XcodeNotFound
      
      return
     
      
  def paste():
      """Returns system clipboard contents."""
      try:
-         return unicode(commands.getoutput('pbpaste'))
+         return unicode(subprocess.check_output('pbpaste'))
      except OSError as why:
          raise XcodeNotFound
      
  
Use `subprocess.check_output` rather than `commands.getoutput`.
## Code Before:


import subprocess
import commands

from .base import *


def copy(string):
    """Copy given string into system clipboard."""
    try:
        subprocess.Popen(['pbcopy'], stdin=subprocess.PIPE).communicate(str(unicode(string)))
    except OSError as why:
        raise XcodeNotFound
    
    return
   
    
def paste():
    """Returns system clipboard contents."""
    try:
        return unicode(commands.getoutput('pbpaste'))
    except OSError as why:
        raise XcodeNotFound
    

## Instruction:
Use `subprocess.check_output` rather than `commands.getoutput`.
## Code After:


import subprocess

from .base import *


def copy(string):
    """Copy given string into system clipboard."""
    try:
        subprocess.Popen(['pbcopy'], stdin=subprocess.PIPE).communicate(str(unicode(string)))
    except OSError as why:
        raise XcodeNotFound
    
    return
   
    
def paste():
    """Returns system clipboard contents."""
    try:
        return unicode(subprocess.check_output('pbpaste'))
    except OSError as why:
        raise XcodeNotFound
    
