<commit_before>import os
import re
import glob
import logging
from copy import copy
import shutil
from cached_property import cached_property
from natsort import natsorted
from ..readers import YamlReader
from ..writers import YamlWriter
from ..errors import PipelineOSError

logger = logging.getLogger(__name__)


def list_jtprojects(directory):
    '''
    List Jterator projects in a given directory.
    A Jterator project is defined as a folder containing a `.pipe` file.

    Parameters
    ----------
    directory: str
        absolute path to a directory
    '''
    projects = [
        os.path.join(directory, name)
        for name in os.listdir(directory)
        if os.path.isdir(os.path.join(directory, name))
        and glob.glob(os.path.join(directory, name, '*.pipe'))
    ]
    if not projects:
        logger.warning('No Jterator projects found in %s' % directory)
    return projects


class JtProject(object):<commit_msg>Fix bug in jterator project module<commit_after>import os
import re
import glob
import logging
from copy import copy
import shutil
from cached_property import cached_property
from natsort import natsorted
from ..readers import YamlReader
from ..writers import YamlWriter
from ..errors import PipelineOSError

logger = logging.getLogger(__name__)


def list_jtprojects(directory):
    '''
    List Jterator projects in a given directory.
    A Jterator project is defined as a folder containing a `.pipe` file.

    Parameters
    ----------
    directory: str
        absolute path to a directory
    '''
    projects = [
        os.path.join(directory, name)
        for name in os.listdir(directory)
        if os.path.isdir(os.path.join(directory, name))
        and glob.glob(os.path.join(directory, name, '*.pipe.yml'))
    ]
    if not projects:
        logger.warning('No Jterator projects found in %s' % directory)
    return projects


class JtProject(object):
{'fraction_non_alphanumeric': 0.08625196027182436, 'fraction_numerical': 0.0, 'mean_word_length': 3.0985010706638114, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '98565', 'n_tokens_mistral': 545, 'n_tokens_neox': 529, 'n_words': 190}