Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Commit

Permalink
Rename arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
reikdas committed May 1, 2020
1 parent 4ebbcd0 commit 3f68423
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions uproot/write/TKey.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def fLast(self):
def update(self):
self.cursor.update_fields(self.sink, self._format1, self.fNbytes, self._version, self.fObjlen, self.fDatime, self.fKeylen, self.fCycle, self.fSeekKey, self.fSeekPdir)

def write(self, cursor, sink, awkward=False):
def write(self, cursor, sink, isjagged=False):
self.cursor = uproot.write.sink.cursor.Cursor(cursor.index)
self.sink = sink

Expand All @@ -50,9 +50,9 @@ def write(self, cursor, sink, awkward=False):
cursor.write_string(sink, self.fTitle)

basketversion = 3
if awkward:
if isjagged:
if self.old_fLast == 0:
raise Exception("awkward flag should be False")
raise Exception("isjagged flag should be False")
cursor.write_fields(sink, self._format_basketkey, basketversion, self.fBufferSize, self.fNevBufSize, self.fNevBuf, self.old_fLast)
else:
cursor.write_fields(sink, self._format_basketkey, basketversion, self.fBufferSize, self.fNevBufSize, self.fNevBuf, self.fLast)
Expand Down Expand Up @@ -83,9 +83,9 @@ def fKeylen(self):
def update(self):
self.cursor.update_fields(self.sink, self._format1, self.fNbytes, self._version, self.fObjlen, self.fDatime, self.fKeylen, self.fCycle, self.fSeekKey, self.fSeekPdir)

def write(self, cursor, sink, awkward=False):
if awkward:
raise Exception("awkward flag should be False")
def write(self, cursor, sink, isjagged=False):
if isjagged:
raise Exception("isjagged flag should be False")
self.cursor = uproot.write.sink.cursor.Cursor(cursor.index)
self.sink = sink

Expand Down
18 changes: 9 additions & 9 deletions uproot/write/compress.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class LZ4(Compression): pass
uproot.const.kLZMA: LZMA,
uproot.const.kLZ4: LZ4}

def write(context, cursor, givenbytes, compression, key, keycursor, awkward=False):
def write(context, cursor, givenbytes, compression, key, keycursor, isjagged=False):
retaincursor = copy.copy(keycursor)
if compression is None:
algorithm, level = 0, 0
Expand All @@ -64,12 +64,12 @@ def write(context, cursor, givenbytes, compression, key, keycursor, awkward=Fals
uncompressedbytes = len(givenbytes)

if algorithm == 0 or level == 0:
if awkward:
if isjagged:
key.fObjlen += uncompressedbytes
else:
key.fObjlen = uncompressedbytes
key.fNbytes = key.fObjlen + key.fKeylen
key.write(keycursor, context._sink, awkward)
key.write(keycursor, context._sink, isjagged)
cursor.write_data(context._sink, givenbytes)
return

Expand Down Expand Up @@ -97,10 +97,10 @@ def write(context, cursor, givenbytes, compression, key, keycursor, awkward=Fals
cursor.write_fields(context._sink, _header, algo, method, c1, c2, c3, u1, u2, u3)
cursor.write_data(context._sink, after_compressed)
key.fNbytes += compressedbytes + 9
key.write(keycursor, context._sink, awkward)
key.write(keycursor, context._sink, isjagged)
else:
key.fNbytes += uncompressedbytes
key.write(keycursor, context._sink, awkward)
key.write(keycursor, context._sink, isjagged)
cursor.write_data(context._sink, givenbytes)

elif algorithm == uproot.const.kLZ4:
Expand Down Expand Up @@ -128,10 +128,10 @@ def write(context, cursor, givenbytes, compression, key, keycursor, awkward=Fals
cursor.write_data(context._sink, checksum)
cursor.write_data(context._sink, after_compressed)
key.fNbytes += compressedbytes + 9
key.write(keycursor, context._sink, awkward)
key.write(keycursor, context._sink, isjagged)
else:
key.fNbytes += uncompressedbytes
key.write(keycursor, context._sink, awkward)
key.write(keycursor, context._sink, isjagged)
cursor.write_data(context._sink, givenbytes)

elif algorithm == uproot.const.kLZMA:
Expand All @@ -154,10 +154,10 @@ def write(context, cursor, givenbytes, compression, key, keycursor, awkward=Fals
cursor.write_fields(context._sink, _header, algo, method, c1, c2, c3, u1, u2, u3)
cursor.write_data(context._sink, after_compressed)
key.fNbytes += compressedbytes + 9
key.write(keycursor, context._sink, awkward)
key.write(keycursor, context._sink, isjagged)
else:
key.fNbytes += uncompressedbytes
key.write(keycursor, context._sink, awkward)
key.write(keycursor, context._sink, isjagged)
cursor.write_data(context._sink, givenbytes)

elif algorithm == uproot.const.kOldCompressionAlgo:
Expand Down
2 changes: 1 addition & 1 deletion uproot/write/objects/TTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def newbasket(self, items, multidim=None):
offsetbytes += [0]
offsetbytes = numpy.array(offsetbytes, dtype=">i4").tostring()
uproot.write.compress.write(self._branch.file, cursor, offsetbytes, self._branch.compression, key,
copy(keycursor), awkward=True)
copy(keycursor), isjagged=True)

self._branch.file._expandfile(cursor)

Expand Down

0 comments on commit 3f68423

Please sign in to comment.