<commit_before>from __future__ import generators

import py
from conftesthandle import Conftest
from py.__.test.defaultconftest import adddefaultoptions

optparse = py.compat.optparse

# XXX move to Config class
basetemp = None
_pid = None
def ensuretemp(string, dir=1): 
    """ return temporary directory path with
        the given string as the trailing part. 
    """ 
    global basetemp, _pid
    currpid = py.std.os.getpid()
    if basetemp is None or _pid != currpid:
        _pid = currpid
        basetemp = py.path.local.make_numbered_dir(prefix='pytest-')
    return basetemp.ensure(string, dir=dir) 
  
class CmdOptions(object):
    """ pure container instance for holding cmdline options 
        as attributes. 
    """
    def __repr__(self):<commit_msg>[svn r38184] avoid globals and add a comment<commit_after>from __future__ import generators

import py
from conftesthandle import Conftest
from py.__.test.defaultconftest import adddefaultoptions

optparse = py.compat.optparse

def ensuretemp(string, dir=1, _pid2dir={}): 
    """ return temporary directory path with
        the given string as the trailing part. 
    """ 
    # we may be in a forking situation and want to use
    # separate dirs then (XXX or not?)
    pid = py.std.os.getpid()
    basetemp = _pid2dir.get(pid, None)
    if basetemp is None: 
        basetemp = py.path.local.make_numbered_dir(prefix='pytest-')
        _pid2dir[pid] = basetemp 
    return basetemp.ensure(string, dir=dir) 
  
class CmdOptions(object):
    """ pure container instance for holding cmdline options 
        as attributes. 
    """
    def __repr__(self):
{'fraction_non_alphanumeric': 0.08481868469575907, 'fraction_numerical': 0.006146281499692686, 'mean_word_length': 3.2842105263157895, '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': '1828124', 'n_tokens_mistral': 517, 'n_tokens_neox': 493, 'n_words': 156}