parameters: (pkg)
docstring: Checks whether pkg was installed by pip
  
      This is used not to display the upgrade message when pip is in fact
      installed by system package manager, such as dnf on Fedora.
docstring_summary: Checks whether pkg was installed by pip
docstring_tokens: Checks whether pkg was installed by pip
function: def was_installed_by_pip(pkg):
      # type: (str) -> bool
      """Checks whether pkg was installed by pip
  
      This is used not to display the upgrade message when pip is in fact
      installed by system package manager, such as dnf on Fedora.
      """
      try:
          dist = pkg_resources.get_distribution(pkg)
          return (dist.has_metadata('INSTALLER') and
                  'pip' in dist.get_metadata_lines('INSTALLER'))
      except pkg_resources.DistributionNotFound:
          return False
function_tokens: def was_installed_by_pip ( pkg ) : # type: (str) -> bool try : dist = pkg_resources . get_distribution ( pkg ) return ( dist . has_metadata ( 'INSTALLER' ) and 'pip' in dist . get_metadata_lines ( 'INSTALLER' ) ) except pkg_resources . DistributionNotFound : return False