Skip to content

Commit

Permalink
style: pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Feb 29, 2024
1 parent dfff08f commit 6da95a6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 21 deletions.
6 changes: 1 addition & 5 deletions src/uproot/writing/_cascade.py
Original file line number Diff line number Diff line change
Expand Up @@ -1790,11 +1790,7 @@ def copy_tree(
import uproot.writing._copytree

tree = uproot.writing._copytree.Tree(
self,
self._freesegments,
existing,
name,
file
self, self._freesegments, existing, name, file
)
tree.write_copy(sink)
return tree
Expand Down
22 changes: 11 additions & 11 deletions src/uproot/writing/_copytree.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def __init__(
):
# 1: are any of these actually attributes of whatever type source will end up being
# 2: so would source already be decompressed? Does any of this work? readonlyttree?
# Use "readonlykey" to get
# Use "readonlykey" to get
self.source = source
self._directory = directory # good
self._name = name
Expand Down Expand Up @@ -119,7 +119,7 @@ def __init__(
"fAutoSave": source.members["fAutoSave"],
"fAutoFlush": source.members["fAutoFlush"],
"fEstimate": source.members["fEstimate"],

}

self._key = None
Expand All @@ -138,7 +138,7 @@ def __init__(
for branch in source.branches:
self._branch_data.append({key: data for key, data in branch.all_members.items()})
self._branch_data[-1].update(
{
{
"arrays_write_start": 0,
"arrays_write_stop": 0,
"metadata_start": None,
Expand Down Expand Up @@ -317,23 +317,23 @@ def write_copy(self, sink):
special_struct = uproot.models.TLeaf._tleafs1_format1
elif encoded_classname == "Model_TLeafI_v1":
letter_upper = "I"
special_struct = uproot.models.TLeaf._tleafi1_format1
special_struct = uproot.models.TLeaf._tleafi1_format1
elif encoded_classname == "Model_TLeafL_v1":
letter_upper = "L"
special_struct = uproot.models.TLeaf._tleafl1_format0
special_struct = uproot.models.TLeaf._tleafl1_format0
elif encoded_classname == "Model_TLeafF_v1":
letter_upper = "F"
special_struct = uproot.models.TLeaf._tleaff1_format1
special_struct = uproot.models.TLeaf._tleaff1_format1
elif encoded_classname == "Model_TLeafD_v1":
letter_upper = "D"
special_struct = uproot.models.TLeaf._tleafd1_format1
special_struct = uproot.models.TLeaf._tleafd1_format1
elif encoded_classname == "Model_TLeafC_v1":
letter_upper = "C"
special_struct = uproot.models.TLeaf._tleafc1_format1
special_struct = uproot.models.TLeaf._tleafc1_format1
else:
letter_upper = "O"
special_struct = uproot.models.TLeaf._tleafO1_format1

out.append(("TLeaf" + letter_upper).encode() + b"\x00")

# if self._branch_data[branch_indx]["shape"] == ():
Expand Down Expand Up @@ -447,7 +447,7 @@ def write_copy(self, sink):
datum["counter"]["tleaf_reference_number"]
)
)

# # specialized TLeaf* members (fMinimum, fMaximum)
out.append(special_struct.pack(0, 0))
datum["tleaf_special_struct"] = special_struct
Expand Down Expand Up @@ -532,7 +532,7 @@ def write_copy(self, sink):
sum(len(x) for x in out[ttree_header_index + 1 :]), 20 # TTre[e
)
self._metadata_start = sum(len(x) for x in out[:metadata_out_index])

raw_data = b"".join(out)
self._key = self._directory.add_object(
sink,
Expand Down
8 changes: 3 additions & 5 deletions src/uproot/writing/writable.py
Original file line number Diff line number Diff line change
Expand Up @@ -1434,17 +1434,16 @@ def mkrntuple(
)
directory._file._new_ntuple(ntuple)
return ntuple


def backfill_copy( # my own variation of mktree
self,
source,
name
name,
# new_branch,
):
"""
Args:
source (TTree): existing TTree to copy/replace
source (TTree): existing TTree to copy/replace
Creates an empty TTree in this directory.
Note that TTrees can be created by assigning TTree-like data to a directory
Expand All @@ -1469,7 +1468,7 @@ def backfill_copy( # my own variation of mktree

# names.append(new_branch.name) # May need the TKey? (uproot.reading.ReadOnlyKey)

try: # Will this throw an error? proabably?
try: # Will this throw an error? proabably?
at = source.name.rindex("/")
except ValueError:
treename = source.name
Expand Down Expand Up @@ -1500,7 +1499,6 @@ def backfill_copy( # my own variation of mktree

# return tree


def copy_from(
self,
source,
Expand Down

0 comments on commit 6da95a6

Please sign in to comment.