<commit_before>#!/usr/bin/python2.4
#
# Copyright (c) 2008 rPath, Inc.
#

import os
import sys
import StringIO
from lxml import etree

import descriptor_errors as errors
import descriptor_nodes as dnodes
import constants

class _BaseClass(object):
    version = constants.version
    defaultNamespace = constants.defaultNamespaceList[0]
    xmlSchemaNamespace = constants.xmlSchemaNamespace
    xmlSchemaLocation = constants.xmlSchemaLocation

    schemaDir = "/usr/share/descriptor"

    _SchemaName = 'descriptor'

    def __init__(self, fromStream = None, validate = False, schemaDir = None):
        self._initFields()
        self._validate = validate
        if schemaDir:
            self.schemaDir = schemaDir

        if fromStream:
            self.parseStream(fromStream, validate = validate,
                schemaDir = self.schemaDir)

    def parseStream(self, fromStream, validate = False, schemaDir = None):
        """
        Initialize the current object from an XML stream.<commit_msg>Making schemaDir match the installation path<commit_after>#!/usr/bin/python2.4
#
# Copyright (c) 2008 rPath, Inc.
#

import os
import sys
import StringIO
from lxml import etree

import descriptor_errors as errors
import descriptor_nodes as dnodes
import constants

class _BaseClass(object):
    version = constants.version
    defaultNamespace = constants.defaultNamespaceList[0]
    xmlSchemaNamespace = constants.xmlSchemaNamespace
    xmlSchemaLocation = constants.xmlSchemaLocation

    schemaDir = "/usr/share/smartform"

    _SchemaName = 'descriptor'

    def __init__(self, fromStream = None, validate = False, schemaDir = None):
        self._initFields()
        self._validate = validate
        if schemaDir:
            self.schemaDir = schemaDir

        if fromStream:
            self.parseStream(fromStream, validate = validate,
                schemaDir = self.schemaDir)

    def parseStream(self, fromStream, validate = False, schemaDir = None):
        """
        Initialize the current object from an XML stream.
{'fraction_non_alphanumeric': 0.07450980392156863, 'fraction_numerical': 0.006862745098039216, 'mean_word_length': 3.182377049180328, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, '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': '1750990', 'n_tokens_mistral': 546, 'n_tokens_neox': 524, 'n_words': 158}