# Path: g_sorcery/exceptions.py
# class EclassError(GSorceryError):
#     pass
# 
# Path: g_sorcery/fileutils.py
# def get_pkgpath(root = None):
#     """
#     Get package path.
# 
#     Args:
#         root: module file path
# 
#     Returns:
#         Package path.
#     """
#     if not root:
#         root = __file__
#     if os.path.islink(root):
#         root = os.path.realpath(root)
#     return os.path.dirname(os.path.abspath(root))


import glob
import os
from .exceptions import EclassError
from .fileutils import get_pkgpath
        __init__ in a subclass should take no parameters.
        """
        self.eclass_dir = eclass_dir

    def list(self):
        """
        List all eclasses.
        
        Returns:
            List of all eclasses with string entries.
        """
        result = []

        for directory in [self.eclass_dir, os.path.join(get_pkgpath(), 'data')]:
            if directory:
                for f_name in glob.iglob(os.path.join(directory, '*.eclass')):
                    result.append(os.path.basename(f_name)[:-7])

        return list(set(result))

    def generate(self, eclass):
        """
        Generate a given eclass.

        Args:
            eclass: String containing eclass name.

        Returns:
            Eclass source as a list of strings.
        """

# Path: g_sorcery/exceptions.py
# class EclassError(GSorceryError):
#     pass
# 
# Path: g_sorcery/fileutils.py
# def get_pkgpath(root = None):
#     """
#     Get package path.
# 
#     Args:
#         root: module file path
# 
#     Returns:
#         Package path.
#     """
#     if not root:
#         root = __file__
#     if os.path.islink(root):
#         root = os.path.realpath(root)
#     return os.path.dirname(os.path.abspath(root))


# Path: g_sorcery/eclass.py
import glob
import os
from .exceptions import EclassError
from .fileutils import get_pkgpath

        __init__ in a subclass should take no parameters.
        """
        self.eclass_dir = eclass_dir

    def list(self):
        """
        List all eclasses.
        
        Returns:
            List of all eclasses with string entries.
        """
        result = []

        for directory in [self.eclass_dir, os.path.join(get_pkgpath(), 'data')]:
            if directory:
                for f_name in glob.iglob(os.path.join(directory, '*.eclass')):
                    result.append(os.path.basename(f_name)[:-7])

        return list(set(result))

    def generate(self, eclass):
        """
        Generate a given eclass.

        Args:
            eclass: String containing eclass name.

        Returns:
            Eclass source as a list of strings.
        """

        for directory in [self.eclass_dir, os.path.join(get_pkgpath(), 'data')]: