1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
|
Description: Revert the bitarray 3 bump
Author: Keir Fraser <keir.xen@gmail.com>
Forwarded: not-needed
This reverts 6d806059ad7a9323435fdfef0d711bb2b38d2dd0.
diff --git c/setup.py i/setup.py
index 9013214..155b53a 100644
--- c/setup.py
+++ i/setup.py
@@ -18,7 +18,7 @@ setup(name = 'greaseweazle',
version = version(),
install_requires = [
'crcmod',
- 'bitarray>=3',
+ 'bitarray<3',
'pyserial',
'requests'
],
diff --git c/src/greaseweazle/codec/amiga/amigados.py i/src/greaseweazle/codec/amiga/amigados.py
index 7c8e3f9..69784dc 100644
--- c/src/greaseweazle/codec/amiga/amigados.py
+++ i/src/greaseweazle/codec/amiga/amigados.py
@@ -84,7 +84,7 @@ class AmigaDOS(codec.Codec):
clock = self.clock, data = track, pll = pll)
bits, _ = raw.get_all_data()
- for offs in bits.search(sync):
+ for offs in bits.itersearch(sync):
if self.nr_missing() == 0:
break
diff --git c/src/greaseweazle/codec/apple2/apple2_gcr.py i/src/greaseweazle/codec/apple2/apple2_gcr.py
index e660e57..7c3913c 100644
--- c/src/greaseweazle/codec/apple2/apple2_gcr.py
+++ i/src/greaseweazle/codec/apple2/apple2_gcr.py
@@ -98,7 +98,7 @@ class Apple2GCR(codec.Codec):
lowpass_thresh = 2.5e-6)
bits, _ = raw.get_all_data()
- for offs in bits.search(addr_sync):
+ for offs in bits.itersearch(addr_sync):
if self.nr_missing() == 0:
break
@@ -131,7 +131,7 @@ class Apple2GCR(codec.Codec):
# Find data
offs += 8*8
- dat_offs = list(bits[offs:offs+100*8].search(data_sync))
+ dat_offs = bits[offs:offs+100*8].search(data_sync)
if len(dat_offs) != 1:
continue
offs += dat_offs[0]
diff --git c/src/greaseweazle/codec/commodore/c64_gcr.py i/src/greaseweazle/codec/commodore/c64_gcr.py
index d40a9ce..9402bb0 100644
--- c/src/greaseweazle/codec/commodore/c64_gcr.py
+++ i/src/greaseweazle/codec/commodore/c64_gcr.py
@@ -94,7 +94,7 @@ class C64GCR(codec.Codec):
lowpass_thresh = 2.5e-6)
bits, _ = raw.get_all_data()
- for offs in bits.search(sector_sync):
+ for offs in bits.itersearch(sector_sync):
if self.nr_missing() == 0:
break
@@ -128,7 +128,7 @@ class C64GCR(codec.Codec):
# Find data
offs += 8*8
- dat_offs = list(bits[offs:offs+100*8].search(data_sync))
+ dat_offs = bits[offs:offs+100*8].search(data_sync)
if len(dat_offs) != 1:
continue
offs += dat_offs[0]
diff --git c/src/greaseweazle/codec/hp/hp_mmfm.py i/src/greaseweazle/codec/hp/hp_mmfm.py
index 63fdc13..c875dde 100644
--- c/src/greaseweazle/codec/hp/hp_mmfm.py
+++ i/src/greaseweazle/codec/hp/hp_mmfm.py
@@ -136,7 +136,7 @@ class HPMMFM(codec.Codec):
clock = self.clock, data = track, pll = pll)
bits, _ = raw.get_all_data()
- for offs in bits.search(sector_sync):
+ for offs in bits.itersearch(sector_sync):
if self.nr_missing() == 0:
break
@@ -160,7 +160,7 @@ class HPMMFM(codec.Codec):
# Find data
offs += 8*16
- dat_offs = list(bits[offs:offs+50*16].search(data_sync))
+ dat_offs = bits[offs:offs+50*16].search(data_sync)
if len(dat_offs) != 1:
continue
offs += dat_offs[0] + 2*16
diff --git c/src/greaseweazle/codec/ibm/ibm.py i/src/greaseweazle/codec/ibm/ibm.py
index 2d8dab7..019e9f1 100644
--- c/src/greaseweazle/codec/ibm/ibm.py
+++ i/src/greaseweazle/codec/ibm/ibm.py
@@ -241,11 +241,11 @@ class DEC_MMFM:
pre_bits.frombytes(pre)
post_bits = bitarray(endian='big')
post_bits.frombytes(mfm_encode(encode(pre)))
- for x in pre_bits.search(self.encode_search):
+ for x in pre_bits.itersearch(self.encode_search):
post_bits[x*2+1:x*2+12] = self.encode_replace
return post_bits.tobytes()
def decode(self, bits: bitarray) -> bytes:
- for x in bits.search(self.decode_search):
+ for x in bits.itersearch(self.decode_search):
if x&1 != 0: # Only matches starting on a data bit
bits[x:x+3] = self.decode_replace
return decode(bits.tobytes())
@@ -448,14 +448,14 @@ class IBMTrack(codec.Codec):
## 1. Calculate offsets within dump
- for offs in bits.search(mfm_iam_sync):
+ for offs in bits.itersearch(mfm_iam_sync):
if len(bits) < offs+4*16:
continue
mark = decode(bits[offs+3*16:offs+4*16].tobytes())[0]
if mark == Mark.IAM:
areas.append(IAM(offs, offs+4*16))
- for offs in bits.search(mfm_sync):
+ for offs in bits.itersearch(mfm_sync):
if len(bits) < offs+4*16:
continue
@@ -515,18 +515,18 @@ class IBMTrack(codec.Codec):
if mmfm_raw is not None:
mmfm_bits, mmfm_times = mmfm_raw.get_all_data()
- mmfm_iter = mmfm_bits.search(dec_mmfm.sync_prefix)
+ mmfm_iter = mmfm_bits.itersearch(dec_mmfm.sync_prefix)
mmfm_offs = next(mmfm_iter, None)
fm_time, prev_fm_offs = 0.0, 0
mmfm_time, prev_mmfm_offs = 0.0, 0
## 1. Calculate offsets within dump
- for offs in bits.search(fm_iam_sync):
+ for offs in bits.itersearch(fm_iam_sync):
offs += 16
areas.append(IAM(offs, offs+1*16))
- for offs in bits.search(fm_sync_prefix):
+ for offs in bits.itersearch(fm_sync_prefix):
# DEC MMFM track: Ensure this looks like an FM mark even at
# double rate. This also finds the equivalent point in the
diff --git c/src/greaseweazle/codec/macintosh/mac_gcr.py i/src/greaseweazle/codec/macintosh/mac_gcr.py
index 51d09ee..f6448fe 100644
--- c/src/greaseweazle/codec/macintosh/mac_gcr.py
+++ i/src/greaseweazle/codec/macintosh/mac_gcr.py
@@ -101,7 +101,7 @@ class MacGCR(codec.Codec):
clock = self.clock, data = track, pll = pll)
bits, _ = raw.get_all_data()
- for offs in bits.search(sector_sync):
+ for offs in bits.itersearch(sector_sync):
if self.nr_missing() == 0:
break
@@ -130,7 +130,7 @@ class MacGCR(codec.Codec):
# Find data
offs += 5*8
- dat_offs = list(bits[offs:offs+100*8].search(data_sync))
+ dat_offs = bits[offs:offs+100*8].search(data_sync)
if len(dat_offs) != 1:
continue
offs += dat_offs[0]
diff --git c/src/greaseweazle/codec/northstar/northstar.py i/src/greaseweazle/codec/northstar/northstar.py
index 4cbcb37..28970fb 100644
--- c/src/greaseweazle/codec/northstar/northstar.py
+++ i/src/greaseweazle/codec/northstar/northstar.py
@@ -132,9 +132,9 @@ class NorthStar(codec.Codec):
s, e = hardsector_bits[sec_id], hardsector_bits[sec_id+1]
offs = bits[s:e].search(self.sync)
- if (off := next(offs, None)) is None:
+ if len(offs) == 0:
continue
- off += (1 + self.sync_bytes) * 16
+ off = offs[0] + (1 + self.sync_bytes) * 16
data = decode(bits[s+off:s+off+(self.bps+1)*16].tobytes())
if csum(data[:-1]) == data[-1]:
self.add(sec_id, data[:-1])
diff --git c/src/greaseweazle/image/caps.py i/src/greaseweazle/image/caps.py
index e1871c3..928e356 100644
--- c/src/greaseweazle/image/caps.py
+++ i/src/greaseweazle/image/caps.py
@@ -283,7 +283,7 @@ class IPFTrack(MasterTrack):
raw_area = raw_bits[max(self.splice + s - self.tolerance, 0)
: self.splice + s + l + self.tolerance]
# All we care about is at least one match (this is a bit fuzzy)
- if next(raw_area.search(sector), None) is None:
+ if next(raw_area.itersearch(sector), None) is None:
return False
return True
diff --git c/src/greaseweazle/image/edsk.py i/src/greaseweazle/image/edsk.py
index c78d995..937006c 100644
--- c/src/greaseweazle/image/edsk.py
+++ i/src/greaseweazle/image/edsk.py
@@ -117,8 +117,8 @@ class EDSKTrack:
track.verify = self
return track
- def _find_sync(self, bits: bitarray, sync, start) -> Optional[int]:
- for offs in bits.search(sync):
+ def _find_sync(self, bits, sync, start) -> Optional[int]:
+ for offs in bits.itersearch(sync):
if offs >= start:
return offs
return None
diff --git c/src/greaseweazle/track.py i/src/greaseweazle/track.py
index cbe7fdd..330488c 100644
--- c/src/greaseweazle/track.py
+++ i/src/greaseweazle/track.py
@@ -59,20 +59,20 @@ class Precomp:
scale: float) -> None:
t = self.ns * scale
if self.type == Precomp.MFM:
- for i in bits.search(bitarray('10100', endian='big')):
+ for i in bits.itersearch(bitarray('10100', endian='big')):
bit_ticks[i+2] -= t
bit_ticks[i+3] += t
- for i in bits.search(bitarray('00101', endian='big')):
+ for i in bits.itersearch(bitarray('00101', endian='big')):
bit_ticks[i+2] += t
bit_ticks[i+3] -= t
# This is primarily for GCR and FM which permit adjacent 1s (and
# have correspondingly slower bit times). However it may be useful
# for illegal MFM sequences too, especially on Amiga (custom syncwords,
# 4us-bitcell tracks). Normal MFM should not trigger these patterns.
- for i in bits.search(bitarray('110', endian='big')):
+ for i in bits.itersearch(bitarray('110', endian='big')):
bit_ticks[i+1] -= t
bit_ticks[i+2] += t
- for i in bits.search(bitarray('011', endian='big')):
+ for i in bits.itersearch(bitarray('011', endian='big')):
bit_ticks[i+1] += t
bit_ticks[i+2] -= t
|