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

Commit 64bc214

Browse files
authored
Merge pull request #81 from beojan/master
Add TParameter class
2 parents 2e20897 + ee56b7f commit 64bc214

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

uproot_methods/classes/TParameter.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import uproot_methods.base
2+
3+
4+
def _decode(seq):
5+
if isinstance(seq, bytes):
6+
return seq.decode("UTF-8")
7+
else:
8+
return seq
9+
10+
11+
class Methods(uproot_methods.base.ROOTMethods):
12+
def __repr__(self):
13+
if self._fName is None:
14+
return "<{0} at 0x{1:012x}>".format(_decode(self._classname), id(self))
15+
else:
16+
return "<{0} {1} 0x{2:012x}>".format(
17+
_decode(self._classname), _decode(self._fName), id(self)
18+
)
19+
20+
def __str__(self):
21+
return str(self._fVal)
22+
23+
@property
24+
def name(self):
25+
return _decode(self._fName)
26+
27+
@property
28+
def value(self):
29+
return self._fVal

uproot_methods/classes/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@
33
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot-methods/blob/master/LICENSE
44

55
def hasmethods(name):
6-
if name not in globals() and name in hasmethods.loaders:
7-
globals()[name] = hasmethods.loaders[name].load_module(name)
6+
if name not in globals():
7+
if name in hasmethods.loaders:
8+
globals()[name] = hasmethods.loaders[name].load_module(name)
9+
elif '_3c_' in name and '_3e_' in name:
10+
bare_name = name.split('_3c_')[0]
11+
if bare_name in hasmethods.loaders:
12+
globals()[name] = hasmethods.loaders[bare_name].load_module(bare_name)
13+
814
return name in globals() and isinstance(getattr(globals()[name], "Methods", None), type)
915

1016
import pkgutil

0 commit comments

Comments
 (0)