def test_starred_and_different_types(obj): assert Starred() & obj == AttrAnd([Starred(), obj])
def __and__(self, other): if not isinstance(other, self.make): return AttrAnd([self, other]) attr = self.make() attr.value = self.value and other.value return attr
from sunpy.net.attr import AttrAnd, AttrOr ta = Time(time_now, format='datetime', scale='tai') ta1 = Time(time_now - datetime.timedelta(days=2), format='datetime', scale='tai') ta2 = Time(time_now - datetime.timedelta(days=1), format='datetime', scale='tai') segments = ['inclination', 'azimuth', 'disambig', 'field'] series = 'hmi.B_720s' interval = 10 * u.min email = '*****@*****.**' response = Fido.search( a.jsoc.Time(ta1, ta2), a.jsoc.Series(series), a.jsoc.Notify(email), a.Sample(interval), AttrAnd(list(map(a.jsoc.Segment, segments))) # i.e. attrs.jsoc.Segment('...') & attrs.jsoc.Segment('...') ... ) response Fido.search(a.jsoc.Time('2014-01-01T00:00:00', '2014-01-01T01:00:00'), a.jsoc.Series('hmi.sharp_720s'), a.jsoc.Notify('*****@*****.**'), a.jsoc.Segment('image')) Fido.search(a.jsoc.Time('2019-01-15T00:00:00', '2019-01-16T01:00:00'), a.jsoc.Series('hmi.M_720s_nrt'), a.jsoc.Notify('*****@*****.**'), a.jsoc.Segment('image'))