<commit_before>#!/usr/bin/python3
# -*- encoding: utf-8 -*-
# PKGBUILDer v2.1.5.3
# An AUR helper (and library) in Python 3.
# Copyright © 2011-2012, Kwpolska.
# See /LICENSE for licensing information.

# Names convention: pkg = a package object, pkgname = a package name.

"""
    pkgbuilder.Utils
    ~~~~~~~~~~~~~~~~
    Common global utilities.  Provides useful data.

    :Copyright: © 2011-2012, Kwpolska.
    :License: BSD (see /LICENSE).
"""

from . import DS, _, PBError
from .aur import AUR
import pyalpm
import pycman
import os
import subprocess
import textwrap
import datetime


### Utils           common global utilities ###
class Utils:
    """Common global utilities.  Provides useful data."""

    aur = AUR()

    def info(self, pkgnames):
        """
        .. versionchanged:: 2.1.4.8

        Returns info about packages.
        """
        aur_pkgs = self.aur.multiinfo(pkgnames, DS.protocol)
        if aur_pkgs == []:
            return []
        elif aur_pkgs['results'] == 'No results found':
            return []
        else:
            return aur_pkgs['results']<commit_msg>Raise exception on type = error response to avoid “pb -Ss” blowing up<commit_after>#!/usr/bin/python3
# -*- encoding: utf-8 -*-
# PKGBUILDer v2.1.5.3
# An AUR helper (and library) in Python 3.
# Copyright © 2011-2012, Kwpolska.
# See /LICENSE for licensing information.

# Names convention: pkg = a package object, pkgname = a package name.

"""
    pkgbuilder.Utils
    ~~~~~~~~~~~~~~~~
    Common global utilities.  Provides useful data.

    :Copyright: © 2011-2012, Kwpolska.
    :License: BSD (see /LICENSE).
"""

from . import DS, _, PBError
from .aur import AUR
import pyalpm
import pycman
import os
import subprocess
import textwrap
import datetime


### Utils           common global utilities ###
class Utils:
    """Common global utilities.  Provides useful data."""

    aur = AUR()

    def info(self, pkgnames):
        """
        .. versionchanged:: 2.1.4.8

        Returns info about packages.
        """
        aur_pkgs = self.aur.multiinfo(pkgnames, DS.protocol)
        if aur_pkgs == []:
            return []
        elif aur_pkgs['results'] == 'No results found':
            return []
        elif aur_pkgs['type'] == 'error':
            # There are other cases where the "results" element is a string;
            # type = error seems to cover at least one case
            raise EnvironmentError(aur_pkgs['results'])
        else:
            return aur_pkgs['results']
{'fraction_non_alphanumeric': 0.12644595133625847, 'fraction_numerical': 0.02153968887116075, 'mean_word_length': 2.4403292181069958, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7515392', 'n_tokens_mistral': 797, 'n_tokens_neox': 738, 'n_words': 245}