Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
h = self.haccess(name, "write")
if len(item_type) == 1:
try:
len(val)
except TypeError:
val = [val]
if item_type == "a":
offset = 0
else:
offset = _miriad.hwrite_init(h, item_type)
for v in val:
offset += _miriad.hwrite(h, offset, v, item_type)
else:
offset = _miriad.hwrite_init(h, "b")
for v, t in zip(val, item_type):
offset += _miriad.hwrite(h, offset, v, t)
_miriad.hdaccess(h)
def _wrhd_special(self, name, val):
"""Provide write access to special header items of type '?' to _wrhd."""
if name == "freqs":
h = self.haccess(name, "write")
_miriad.hwrite(h, 0, val[0], "i")
offset = 8
for i, v in enumerate(val[1:]):
if i % 3 == 0:
_miriad.hwrite(h, offset, v, "i")
else:
_miriad.hwrite(h, offset, v, "d")
offset += 8
_miriad.hdaccess(h)
else:
raise ValueError("Unknown special header: " + name)
def _wrhd_special(self, name, val):
"""Provide write access to special header items of type '?' to _wrhd."""
if name == "freqs":
h = self.haccess(name, "write")
_miriad.hwrite(h, 0, val[0], "i")
offset = 8
for i, v in enumerate(val[1:]):
if i % 3 == 0:
_miriad.hwrite(h, offset, v, "i")
else:
_miriad.hwrite(h, offset, v, "d")
offset += 8
_miriad.hdaccess(h)
else:
raise ValueError("Unknown special header: " + name)
def _wrhd_special(self, name, val):
"""Provide write access to special header items of type '?' to _wrhd."""
if name == "freqs":
h = self.haccess(name, "write")
_miriad.hwrite(h, 0, val[0], "i")
offset = 8
for i, v in enumerate(val[1:]):
if i % 3 == 0:
_miriad.hwrite(h, offset, v, "i")
else:
_miriad.hwrite(h, offset, v, "d")
offset += 8
_miriad.hdaccess(h)
else:
raise ValueError("Unknown special header: " + name)