mirror of
https://github.com/robmcmullen/atrcopy.git
synced 2025-01-17 09:29:46 +00:00
Workaround for numpy treating indexed arrays as copies: operate on original array using indexes
This commit is contained in:
parent
4c4882b2b3
commit
ee030df3e1
14
atrcopy.py
14
atrcopy.py
@ -322,8 +322,18 @@ class RawSectorsSegment(DefaultSegment):
|
||||
|
||||
class IndexedByteSegment(DefaultSegment):
|
||||
def __init__(self, byte_order, bytes, **kwargs):
|
||||
data = bytes[byte_order]
|
||||
DefaultSegment.__init__(self, 0, data, **kwargs)
|
||||
self.order = byte_order
|
||||
DefaultSegment.__init__(self, 0, bytes, **kwargs)
|
||||
|
||||
def __getitem__(self, index):
|
||||
return self.data[self.order[index]]
|
||||
|
||||
def __setitem__(self, index, value):
|
||||
self.data[self.order[index]] = value
|
||||
self._search_copy = None
|
||||
|
||||
def tostring(self):
|
||||
return self.data[self.order[:]].tostring()
|
||||
|
||||
|
||||
class AtariDosFile(object):
|
||||
|
Loading…
x
Reference in New Issue
Block a user