<commit_before># 1998 - 2003
# Author: <NAME>
# Copyright: SciPy

import gist
import pl3d, plwf
import Numeric
from Numeric import ravel, reshape, repeat, arange, transpose, compress, \
     where, ones, NewAxis, asarray
import MLab
from MLab import pi, cos, sin, arctan2, array, angle
import types
import write_style
from write_style import inches, points
import scipy
import scipy_base
import scipy.signal as signal

_dpi = 75
_hold = 0
_maxcolors=256
_textcolor=None

gist.pldefault(dpi=_dpi,maxcolors=_maxcolors)

# Get a directory that the user has write access to for
#  storing temporary *.gp and *.gs files
import weave
import tempfile
import os
import sys

def _getdir(name='scipy_xplt'):
    try:
        path = os.path.join(os.environ['HOME'],'.' + name)
    except KeyError:
        path = os.path.join(tempfile.gettempdir(),"%s"%weave.catalog.whoami(),
                            name)
    if not os.path.exists(path):
        weave.catalog.create_dir(path)
        os.chmod(path,0700)
    if not weave.catalog.is_writable(path):
        print "warning: default directory is not write accessible."<commit_msg>Removed dependency on weave from xplt/Mplot.py --- copied needed routines to Mplot.py --- could think about refactoring some of these.<commit_after># 1998 - 2003
# Author: <NAME>
# Copyright: SciPy

import gist
import pl3d, plwf
import Numeric
from Numeric import ravel, reshape, repeat, arange, transpose, compress, \
     where, ones, NewAxis, asarray
import MLab
from MLab import pi, cos, sin, arctan2, array, angle
import types
import write_style
from write_style import inches, points
import scipy
import scipy_base
import scipy.signal as signal

_dpi = 75
_hold = 0
_maxcolors=256
_textcolor=None

gist.pldefault(dpi=_dpi,maxcolors=_maxcolors)

# Get a directory that the user has write access to for
#  storing temporary *.gp and *.gs files
import tempfile
import os
import sys

# functions copied from weave.catalog

def whoami():
    """return a string identifying the user."""
    return os.environ.get("USER") or os.environ.get("USERNAME") or "unknown"

def create_dir(p):
    """ Create a directory and any necessary intermediate directories."""
    if not os.path.exists(p):
        try:
            os.mkdir(p)
        except OSError:
            # perhaps one or more intermediate path components don't exist
            # try to create them
            base,dir = os.path.split(p)
            create_dir(base)
            # don't enclose this one in try/except - we want the user to
            # get failure info
            os.mkdir(p)

def is_writable(dir):
    dummy = os.path.join(dir, "dummy")
    try:
        open(dummy, 'w')
    except IOError:
        return 0
    os.unlink(dummy)
    return 1

# end functions copied from weave.catalog

def _getdir(name='scipy_xplt'):
    try:
        path = os.path.join(os.environ['HOME'],'.' + name)
    except KeyError:
        path = os.path.join(tempfile.gettempdir(),"%s"%whoami(),
                            name)
    if not os.path.exists(path):
        create_dir(path)
        os.chmod(path,0700)
    if not is_writable(path):
        print "warning: default directory is not write accessible."
{'fraction_non_alphanumeric': 0.09652146662488248, 'fraction_numerical': 0.013162018176120338, 'mean_word_length': 3.0405063291139243, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2048317', 'n_tokens_mistral': 1050, 'n_tokens_neox': 1011, 'n_words': 328}