<commit_before># Copyright 2012 the rootpy developers
# distributed under the terms of the GNU General Public License
from __future__ import absolute_import

# First import
import warnings
# show deprecation warnings
warnings.filterwarnings('default', category=DeprecationWarning)

from .logger import log

# Needed for "from rootpy import QROOT" by other modules
from .util import quickroot as QROOT
from . import defaults
from .core import Object
from .info import __version_info__, __version__

import ROOT

# Note: requires defaults import
ROOT_VERSION = QROOT.gROOT.GetVersionInt()
ROOT_VERSION_STR = QROOT.gROOT.GetVersion()
log.debug("Using ROOT {0}".format(ROOT_VERSION_STR))


class ROOTError(RuntimeError):
    """
    Exception class representing a ROOT error/warning message.
    """
    def __init__(self, level, location, msg):
        self.level, self.location, self.msg = level, location, msg

    def __str__(self):
        return "level={0}, loc='{1}', msg='{2}'".format(
            self.level, self.location, self.msg)

def rootpy_source_dir():
    import rootpy
    from os.path import abspath, dirname
    from inspect import getfile
    from sys import modules
    path = dirname(getfile(modules[__name__]))
    absp = abspath(path)
    return path, absp

_ROOTPY_SOURCE_PATH, _ROOTPY_SOURCE_ABSPATH = rootpy_source_dir()
del rootpy_source_dir

"""
All rootpy wrappers are registered below. This dict maps the ROOT class name to
the path to the rootpy class or a tuple of both the path and keyword arguments
used in the dynamic_cls classmethod (see the ``Hist``, ``Hist2D`` and
``Hist3D`` classes in ``plotting.hist``).

This way rootpy is aware of all classes that inherit from ROOT classes without
needing to import everything when rootpy is first imported. This registry is
required to cast ROOT objects into the rootpy form when extracted from a ROOT
TFile, for example.
"""
INIT_REGISTRY = {
    
    'TList': 'root_collections.List',
    'TObjArray': 'root_collections.ObjArray',
    
    'TTree': 'tree.tree.Tree',
    'TNtuple': 'tree.tree.Ntuple',

    'TDirectoryFile': 'io.file.Directory',
    'TFile': 'io.file.File',

    'TStyle': 'plotting.style.Style',
    'TCanvas': 'plotting.canvas.Canvas',
    'TPad': 'plotting.canvas.Pad',
    'TLegend': 'plotting.legend.Legend',

    'TGraphAsymmErrors': 'plotting.graph.Graph',
    'TGraph2D': 'plotting.graph.Graph2D',

    'TProfile': 'plotting.profile.Profile',
    'TProfile2D': 'plotting.profile.Profile2D',
    'TProfile3D': 'plotting.profile.Profile3D',

    'TH1C': ('plotting.hist.Hist', dict(type='C')),
    'TH1S': ('plotting.hist.Hist', dict(type='S')),
    'TH1I': ('plotting.hist.Hist', dict(type='I')),<commit_msg>Add TEllipse and TLine to the registry<commit_after># Copyright 2012 the rootpy developers
# distributed under the terms of the GNU General Public License
from __future__ import absolute_import

# First import
import warnings
# show deprecation warnings
warnings.filterwarnings('default', category=DeprecationWarning)

from .logger import log

# Needed for "from rootpy import QROOT" by other modules
from .util import quickroot as QROOT
from . import defaults
from .core import Object
from .info import __version_info__, __version__

import ROOT

# Note: requires defaults import
ROOT_VERSION = QROOT.gROOT.GetVersionInt()
ROOT_VERSION_STR = QROOT.gROOT.GetVersion()
log.debug("Using ROOT {0}".format(ROOT_VERSION_STR))


class ROOTError(RuntimeError):
    """
    Exception class representing a ROOT error/warning message.
    """
    def __init__(self, level, location, msg):
        self.level, self.location, self.msg = level, location, msg

    def __str__(self):
        return "level={0}, loc='{1}', msg='{2}'".format(
            self.level, self.location, self.msg)

def rootpy_source_dir():
    import rootpy
    from os.path import abspath, dirname
    from inspect import getfile
    from sys import modules
    path = dirname(getfile(modules[__name__]))
    absp = abspath(path)
    return path, absp

_ROOTPY_SOURCE_PATH, _ROOTPY_SOURCE_ABSPATH = rootpy_source_dir()
del rootpy_source_dir

"""
All rootpy wrappers are registered below. This dict maps the ROOT class name to
the path to the rootpy class or a tuple of both the path and keyword arguments
used in the dynamic_cls classmethod (see the ``Hist``, ``Hist2D`` and
``Hist3D`` classes in ``plotting.hist``).

This way rootpy is aware of all classes that inherit from ROOT classes without
needing to import everything when rootpy is first imported. This registry is
required to cast ROOT objects into the rootpy form when extracted from a ROOT
TFile, for example.
"""
INIT_REGISTRY = {
    
    'TList': 'root_collections.List',
    'TObjArray': 'root_collections.ObjArray',
    
    'TTree': 'tree.tree.Tree',
    'TNtuple': 'tree.tree.Ntuple',

    'TDirectoryFile': 'io.file.Directory',
    'TFile': 'io.file.File',

    'TStyle': 'plotting.style.Style',
    'TCanvas': 'plotting.canvas.Canvas',
    'TPad': 'plotting.canvas.Pad',
    'TLegend': 'plotting.legend.Legend',
    'TEllipse': 'plotting.shapes.Ellipse',
    'TLine': 'plotting.shapes.Line',

    'TGraphAsymmErrors': 'plotting.graph.Graph',
    'TGraph2D': 'plotting.graph.Graph2D',

    'TProfile': 'plotting.profile.Profile',
    'TProfile2D': 'plotting.profile.Profile2D',
    'TProfile3D': 'plotting.profile.Profile3D',

    'TH1C': ('plotting.hist.Hist', dict(type='C')),
    'TH1S': ('plotting.hist.Hist', dict(type='S')),
    'TH1I': ('plotting.hist.Hist', dict(type='I')),
{'fraction_non_alphanumeric': 0.11764705882352941, 'fraction_numerical': 0.006877828054298643, 'mean_word_length': 4.288038277511962, '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': '2712785', 'n_tokens_mistral': 1772, 'n_tokens_neox': 1742, 'n_words': 525}