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

Commit

Permalink
Rename instances of 'uproot' string to 'uproot3'.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpivarski committed Nov 23, 2020
1 parent 7655097 commit 02f9911
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions uproot_methods/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,34 @@ def types(cls, obj):
yield y

if any(x == ("builtins", "bytes") or x == ("builtins", "str") or x == ("__builtin__", "str") or x == ("__builtin__", "unicode") for x in types(obj.__class__, obj)):
return (None, None, "uproot.write.objects.TObjString", "TObjString")
return (None, None, "uproot3.write.objects.TObjString", "TObjString")

# made with numpy.histogram
elif isinstance(obj, tuple) and len(obj) == 2 and any(x[:2] == ("numpy", "ndarray") for x in types(obj[0].__class__, obj[0])) and any(x[:2] == ("numpy", "ndarray") for x in types(obj[1].__class__, obj[1])) and len(obj[0].shape) == 1 and len(obj[1].shape) == 1 and obj[0].shape[0] == obj[1].shape[0] - 1:
return ("uproot_methods.classes.TH1", "from_numpy", "uproot.write.objects.TH", "TH")
return ("uproot_methods.classes.TH1", "from_numpy", "uproot3.write.objects.TH", "TH")

# made with numpy.histogram2d
elif isinstance(obj, tuple) and len(obj) == 3 and any(x[:2] == ("numpy", "ndarray") for x in types(obj[0].__class__, obj[0])) and any(x[:2] == ("numpy", "ndarray") for x in types(obj[1].__class__, obj[1])) and any(x[:2] == ("numpy", "ndarray") for x in types(obj[2].__class__, obj[2])) and len(obj[0].shape) == 2 and len(obj[1].shape) == 1 and len(obj[2].shape) == 1 and obj[0].shape[0] == obj[1].shape[0] - 1 and obj[0].shape[1] == obj[2].shape[0] - 1:
return ("uproot_methods.classes.TH2", "from_numpy", "uproot.write.objects.TH", "TH")
return ("uproot_methods.classes.TH2", "from_numpy", "uproot3.write.objects.TH", "TH")

# made with numpy.histogramdd (2-dimensional)
elif isinstance(obj, tuple) and len(obj) == 2 and any(x[:2] == ("numpy", "ndarray") for x in types(obj[0].__class__, obj[0])) and isinstance(obj[1], list) and len(obj[1]) == 2 and any(x[:2] == ("numpy", "ndarray") for x in types(obj[1][0].__class__, obj[1][0])) and any(x[:2] == ("numpy", "ndarray") for x in types(obj[1][1].__class__, obj[1][1])) and len(obj[0].shape) == 2 and len(obj[1][0].shape) == 1 and len(obj[1][1].shape) == 1 and obj[0].shape[0] == obj[1][0].shape[0] - 1 and obj[0].shape[1] == obj[1][1].shape[0] - 1:
return ("uproot_methods.classes.TH2", "from_numpy", "uproot.write.objects.TH", "TH")
return ("uproot_methods.classes.TH2", "from_numpy", "uproot3.write.objects.TH", "TH")

elif any(x[:3] == ("pandas.core.frame", "DataFrame", "IntervalIndex") and "count" in x[3] for x in types(obj.__class__, obj)):
return ("uproot_methods.classes.TH1", "from_pandas", "uproot.write.objects.TH", "TH")
return ("uproot_methods.classes.TH1", "from_pandas", "uproot3.write.objects.TH", "TH")

elif any(x == ("physt.histogram1d", "Histogram1D") for x in types(obj.__class__, obj)):
return ("uproot_methods.classes.TH1", "from_physt", "uproot.write.objects.TH", "TH")
return ("uproot_methods.classes.TH1", "from_physt", "uproot3.write.objects.TH", "TH")

elif any(x == ("uproot_methods.classes.TH1", "Methods") or x == ("TH1", "Methods") for x in types(obj.__class__, obj)):
return (None, None, "uproot.write.objects.TH", "TH")
return (None, None, "uproot3.write.objects.TH", "TH")

elif any(x == ("uproot_methods.classes.TH2", "Methods") or x == ("TH2", "Methods") for x in types(obj.__class__, obj)):
return (None, None, "uproot.write.objects.TH", "TH")
return (None, None, "uproot3.write.objects.TH", "TH")

elif any(x == ("uproot_methods.classes.TH3", "Methods") or x == ("TH3", "Methods") for x in types(obj.__class__, obj)):
return (None, None, "uproot.write.objects.TH", "TH")
return (None, None, "uproot3.write.objects.TH", "TH")

else:
raise TypeError("type {0} from module {1} is not writeable by uproot".format(obj.__class__.__name__, obj.__class__.__module__))
Expand Down
2 changes: 1 addition & 1 deletion uproot_methods/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import re

__version__ = "0.9.0"
__version__ = "0.9.1"
version = __version__
version_info = tuple(re.split(r"[-\.]", __version__))

Expand Down

0 comments on commit 02f9911

Please sign in to comment.