From 6da95a6206914ff0c84ff77ebe8748d26a2c54b5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 29 Feb 2024 15:54:05 +0000 Subject: [PATCH] style: pre-commit fixes --- src/uproot/writing/_cascade.py | 6 +----- src/uproot/writing/_copytree.py | 22 +++++++++++----------- src/uproot/writing/writable.py | 8 +++----- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/src/uproot/writing/_cascade.py b/src/uproot/writing/_cascade.py index ebfcf6dfe..942bd65a3 100644 --- a/src/uproot/writing/_cascade.py +++ b/src/uproot/writing/_cascade.py @@ -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 diff --git a/src/uproot/writing/_copytree.py b/src/uproot/writing/_copytree.py index 58e6d0cfd..171bd8a59 100644 --- a/src/uproot/writing/_copytree.py +++ b/src/uproot/writing/_copytree.py @@ -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 @@ -119,7 +119,7 @@ def __init__( "fAutoSave": source.members["fAutoSave"], "fAutoFlush": source.members["fAutoFlush"], "fEstimate": source.members["fEstimate"], - + } self._key = None @@ -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, @@ -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"] == (): @@ -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 @@ -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, diff --git a/src/uproot/writing/writable.py b/src/uproot/writing/writable.py index fca898483..a9590b3bb 100644 --- a/src/uproot/writing/writable.py +++ b/src/uproot/writing/writable.py @@ -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 @@ -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 @@ -1500,7 +1499,6 @@ def backfill_copy( # my own variation of mktree # return tree - def copy_from( self, source,