Skip to content
This repository has been archived by the owner on Jan 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #81 from beojan/master
Browse files Browse the repository at this point in the history
Add TParameter class
  • Loading branch information
jpivarski authored May 7, 2020
2 parents 2e20897 + ee56b7f commit 64bc214
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
29 changes: 29 additions & 0 deletions uproot_methods/classes/TParameter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import uproot_methods.base


def _decode(seq):
if isinstance(seq, bytes):
return seq.decode("UTF-8")
else:
return seq


class Methods(uproot_methods.base.ROOTMethods):
def __repr__(self):
if self._fName is None:
return "<{0} at 0x{1:012x}>".format(_decode(self._classname), id(self))
else:
return "<{0} {1} 0x{2:012x}>".format(
_decode(self._classname), _decode(self._fName), id(self)
)

def __str__(self):
return str(self._fVal)

@property
def name(self):
return _decode(self._fName)

@property
def value(self):
return self._fVal
10 changes: 8 additions & 2 deletions uproot_methods/classes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot-methods/blob/master/LICENSE

def hasmethods(name):
if name not in globals() and name in hasmethods.loaders:
globals()[name] = hasmethods.loaders[name].load_module(name)
if name not in globals():
if name in hasmethods.loaders:
globals()[name] = hasmethods.loaders[name].load_module(name)
elif '_3c_' in name and '_3e_' in name:
bare_name = name.split('_3c_')[0]
if bare_name in hasmethods.loaders:
globals()[name] = hasmethods.loaders[bare_name].load_module(bare_name)

return name in globals() and isinstance(getattr(globals()[name], "Methods", None), type)

import pkgutil
Expand Down

0 comments on commit 64bc214

Please sign in to comment.