Ejemplo n.º 1
0
    def test_datetime_format(self):
        n = datetime.datetime.now().replace(microsecond=0)
        format = "%Y %m %d %H %M %S"

        element = etree.Element('test')
        XmlDocument().to_parent(None, DateTime(format=format), n, element, ns_test)
        element = element[0]

        assert element.text == datetime.datetime.strftime(n, format)
        dt = XmlDocument().from_element(None, DateTime(format=format), element)
        assert n == dt
Ejemplo n.º 2
0
    def test_datetime_unicode_format(self):
        n = datetime.datetime.now().replace(microsecond=0)
        format = u"%Y %m %d\u00a0%H %M %S"

        element = etree.Element('test')
        XmlDocument().to_parent(None, DateTime(format=format), n, element,
                                ns_test)
        element = element[0]

        assert element.text == n.strftime(format.encode('utf8')).decode('utf8')
        dt = XmlDocument().from_element(None, DateTime(format=format), element)
        assert n == dt
Ejemplo n.º 3
0
    def test_datetime_serialize_as(self):
        i = 1234567890123456
        v = datetime.datetime.fromtimestamp(i / 1e6)

        assert ProtocolBase().to_string(DateTime(serialize_as='sec'),
                                        v) == i // 1e6
        assert ProtocolBase().to_string(DateTime(serialize_as='sec_float'),
                                        v) == i / 1e6
        assert ProtocolBase().to_string(DateTime(serialize_as='msec'),
                                        v) == i // 1e3
        assert ProtocolBase().to_string(DateTime(serialize_as='msec_float'),
                                        v) == i / 1e3
        assert ProtocolBase().to_string(DateTime(serialize_as='usec'), v) == i
Ejemplo n.º 4
0
class Status(ComplexModel):
    """Current status information relevant to an entity."""
    _type_info = [
        ('dateTime', DateTime.customize(max_occurs=1, min_occurs=0)),
        ('reason', Unicode.customize(max_occurs=1, min_occurs=0)),
        ('remark', Unicode.customize(max_occurs=1, min_occurs=0)),
        ('value', Unicode.customize(max_occurs=1, min_occurs=0)),
    ]

    def __init__(self,
                 dateTime=None,
                 reason=None,
                 remark=None,
                 value=None,
                 **kwargs):
        super().__init__(dateTime=dateTime,
                         reason=reason,
                         remark=remark,
                         value=value,
                         **kwargs)
        if isinstance(dateTime, str):
            initvalue_ = datetime_.datetime.strptime(dateTime,
                                                     '%Y-%m-%dT%H:%M:%S')
        else:
            initvalue_ = dateTime
        self.dateTime = initvalue_
        self.reason = reason
        self.remark = remark
        self.value = value
Ejemplo n.º 5
0
class DERCurveData(ComplexModel):
    _type_info = [
        ('maxYValue', Float.customize(max_occurs=1, min_occurs=0)),
        ('minYValue', Float.customize(max_occurs=1, min_occurs=0)),
        ('nominalYValue', Float.customize(max_occurs=1, min_occurs=0)),
        ('timeStamp', DateTime.customize(max_occurs=1, min_occurs=1)),
    ]

    def __init__(self,
                 maxYValue=None,
                 minYValue=None,
                 nominalYValue=None,
                 timeStamp=None,
                 **kwargs):
        super().__init__(maxYValue=maxYValue,
                         minYValue=minYValue,
                         nominalYValue=nominalYValue,
                         timeStamp=timeStamp,
                         **kwargs)
        self.maxYValue = maxYValue
        self.minYValue = minYValue
        self.nominalYValue = nominalYValue
        if isinstance(timeStamp, str):
            initvalue_ = datetime_.datetime.strptime(timeStamp,
                                                     '%Y-%m-%dT%H:%M:%S')
        else:
            initvalue_ = timeStamp
        self.timeStamp = initvalue_
Ejemplo n.º 6
0
 def test_datetime_inclusive_boundaries(self):
     test_model = DateTime.customize(
         ge=datetime.datetime(2016, 1, 1, 12, 00).replace(tzinfo=spyne.LOCAL_TZ),
         le=datetime.datetime(2016, 2, 1, 12, 00).replace(tzinfo=spyne.LOCAL_TZ))
     self.assertTrue(test_model.validate_native(test_model,
                                                datetime.datetime(2016, 1, 1, 12, 00)))
     self.assertTrue(test_model.validate_native(test_model,
                                                datetime.datetime(2016, 2, 1, 12, 00)))
Ejemplo n.º 7
0
class Disinfection(ComplexModel):
    __namespace__ = ''
    Date = DateTime.customize(max_occurs=1, min_occurs=0)
    Method = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    Chemical = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    TemperatureTimes = String(max_len=100).customize(max_occurs=1,
                                                     min_occurs=0)
    Concentration = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    AdditionalInfo = String(max_len=2000).customize(max_occurs=1, min_occurs=0)
Ejemplo n.º 8
0
    def test_datetime_deserialize(self):
        i = 1234567890123456
        v = datetime.datetime.fromtimestamp(i / 1e6)

        assert ProtocolBase().from_unicode(
                    DateTime(serialize_as='sec'), i//1e6) == \
                                     datetime.datetime.fromtimestamp(i//1e6)
        assert ProtocolBase().from_unicode(
                    DateTime(serialize_as='sec_float'), i/1e6) == v

        assert ProtocolBase().from_unicode(
                    DateTime(serialize_as='msec'), i//1e3) == \
                                    datetime.datetime.fromtimestamp(i/1e3//1000)
        assert ProtocolBase().from_unicode(
                    DateTime(serialize_as='msec_float'), i/1e3) == v

        assert ProtocolBase().from_unicode(
                    DateTime(serialize_as='usec'), i) == v
Ejemplo n.º 9
0
class NonNillableClass(ComplexModel):
    __namespace__ = "hunk.sunk"

    nillable = False
    min_occurs = 1

    dt = DateTime(min_occurs=1, nillable=False)
    i = Integer(nillable=False)
    s = String(min_len=1, nillable=False)
Ejemplo n.º 10
0
class DERGroupStatusQueriesRequestType(ComplexModel):
    _type_info = [('StartTime', DateTime.customize(min_occurs=0)),
                  ('EndTime', DateTime.customize(min_occurs=0)),
                  ('Option',
                   OptionType.customize(max_occurs='unbounded', min_occurs=0)),
                  ('ID', Unicode.customize(max_occurs='unbounded',
                                           min_occurs=0)),
                  ('DERGroupStatusQueries', DERGroupStatusQueries),
                  ('__ANY__', AnyDict)]

    def __init__(self,
                 startTime=None,
                 endTime=None,
                 option=None,
                 id=None,
                 dERGroupStatusQueries=None,
                 **kwargs):
        super().__init__(StartTime=startTime,
                         EndTime=endTime,
                         Option=option,
                         ID=id,
                         DERGroupStatusQueries=dERGroupStatusQueries,
                         **kwargs)
        if isinstance(startTime, str):
            initvalue_ = datetime_.datetime.strptime(startTime,
                                                     '%Y-%m-%dT%H:%M:%S')
        else:
            initvalue_ = startTime
        self.startTime = initvalue_
        if isinstance(endTime, str):
            initvalue_ = datetime_.datetime.strptime(endTime,
                                                     '%Y-%m-%dT%H:%M:%S')
        else:
            initvalue_ = endTime
        self.endTime = initvalue_
        if option is None:
            self.option = []
        else:
            self.option = option
        if id is None:
            self.id = []
        else:
            self.id = id
        self.dERGroupStatusQueries = dERGroupStatusQueries
Ejemplo n.º 11
0
    def test_datetime_ancient(self):
        t = DateTime(dt_format="%Y-%m-%d %H:%M:%S")  # to trigger strftime
        v = datetime.datetime(1881, 1, 1)
        vs = '1881-01-01 00:00:00'

        dt = ProtocolBase().from_unicode(t, vs)
        self.assertEquals(v, dt)

        dt = ProtocolBase().to_unicode(t, v)
        self.assertEquals(vs, dt)
Ejemplo n.º 12
0
 def test_datetime_exclusive_boundaries(self):
     test_model = DateTime.customize(
         gt=datetime.datetime(2016, 1, 1, 12, 00)
                                             .replace(tzinfo=spyne.LOCAL_TZ),
         lt=datetime.datetime(2016, 2, 1, 12, 00)
                                             .replace(tzinfo=spyne.LOCAL_TZ),
     )
     self.assertFalse(test_model.validate_native(test_model,
                                      datetime.datetime(2016, 1, 1, 12, 00)))
     self.assertFalse(test_model.validate_native(test_model,
                                      datetime.datetime(2016, 2, 1, 12, 00)))
Ejemplo n.º 13
0
class SisMsg(ComplexModel):
    data_source = String(nillable=False,
                         min_occurs=1,
                         max_occurs=1,
                         max_len=50)
    direction = String(nillable=False, min_occurs=1, max_occurs=1, max_len=50)
    interface_name = String(nillable=False,
                            min_occurs=1,
                            max_occurs=1,
                            max_len=50)
    crt_dt = DateTime(nillable=False)
Ejemplo n.º 14
0
Archivo: log.py Proyecto: plq/jmapd
class LogEntry(ComplexModel):
    _type_info = [
        ('id', M(Integer64(pk=True))),
        ('time',
         M(
             DateTime(
                 timezone=False,
                 default_factory=lambda: datetime.utcnow(),
             ))),
        ('host', IpAddress),
        ('data', Any),
    ]
Ejemplo n.º 15
0
class LogEntryMixin(TableModel):
    __mixin__ = True
    __table_args__ = {"sqlite_autoincrement": True}

    id = Integer64(primary_key=True)
    time = DateTime(timezone=False)
    user = Unicode(256, index='btree')
    method = Unicode(64, index='btree')
    req_xml = AnyXml
    req_json = AnyDict(store_as='json')
    err_code = Integer
    resp_err = AnyDict(store_as='json')
    resp_int = Integer
    duration = Integer
Ejemplo n.º 16
0
class Certificate(ComplexModel):
    __namespace__ = ''
    ID = Integer.customize(max_occurs=1, min_occurs=0)
    GUID = Unicode(128, pattern='[^@]+@[^@]+')
    SendDateTime = DateTime.customize(max_occurs=1, min_occurs=0)
    Number = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    Date = DateTime.customize(max_occurs=1, min_occurs=0)
    Blanc = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    DepartureCountry = String(max_len=100).customize(max_occurs=1,
                                                     min_occurs=0)
    DepartureCountryCode = String(max_len=2).customize(max_occurs=1,
                                                       min_occurs=0)
    DestinationCountry = String(max_len=100).customize(max_occurs=1,
                                                       min_occurs=0)
    DestinationCountryCode = String(max_len=2).customize(max_occurs=1,
                                                         min_occurs=0)
    EntryCheckpoint = String(max_len=255).customize(max_occurs=1, min_occurs=0)
    EntryCheckpointCode = Integer.customize(max_occurs=1, min_occurs=0)
    consignor = Consignor
    consignee = Consignee
    transport = Transport
    disinfection = Disinfection
    productdescription = ProductDescription
    GeneralMarking = String(max_len=512).customize(max_occurs=1, min_occurs=0)
    GeneralQuarantineCondition = String(max_len=512).customize(max_occurs=1,
                                                               min_occurs=0)
    GeneralBaseDocument = String(max_len=512).customize(max_occurs=1,
                                                        min_occurs=0)
    GeneralAdditionalDeclaration = String(max_len=512).customize(max_occurs=1,
                                                                 min_occurs=0)
    GeneralMandatoryActions = String(max_len=512).customize(max_occurs=1,
                                                            min_occurs=0)
    AdditionalInfo = String(max_len=2000).customize(max_occurs=1, min_occurs=0)
    Inspector = String(max_len=255).customize(max_occurs=1, min_occurs=0)
    AnnexDoc = String(max_len=100000).customize(max_occurs=1, min_occurs=0)
    AnnexText = String(max_len=100000).customize(max_occurs=1, min_occurs=0)
    PDF = ByteArray.customize(max_occurs=1, min_occurs=0)
Ejemplo n.º 17
0
    def test_datetime_timezone(self):
        import pytz

        n = datetime.datetime.now(pytz.timezone('EST'))
        element = etree.Element('test')
        cls = DateTime(as_timezone=pytz.utc, timezone=False)
        XmlDocument().to_parent(None, cls, n, element, ns_test)
        element = element[0]

        c = n.astimezone(pytz.utc).replace(tzinfo=None)
        self.assertEquals(element.text, c.isoformat())
        dt = XmlDocument().from_element(None, cls, element)
        assert dt.tzinfo is not None
        dt = dt.replace(tzinfo=None)
        self.assertEquals(c, dt)
class request91(ComplexModel):
    __namespace__ = ''
    GUID = Unicode(128, pattern='[^@]+@[^@]+')
    SendDateTime = DateTime.customize(max_occurs=1, min_occurs=0)
    Certificate = certificate
    Status = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    StatusCode = Integer.customize(max_occurs=1, min_occurs=0)
    Inspector = String(max_len=255).customize(max_occurs=1, min_occurs=0)

    @staticmethod
    def generate():
        return {
            # 'GUID':
            'SendDateTime': 'hello',
            'certificate': Certificate,
            'Status': 'Выдан',
            'StatusCode': 'I dnt find',
            'Inspector': 'hello',
        }
class disinfection(ComplexModel):
    __namespace__ = ''
    Date = DateTime.customize(max_occurs=1, min_occurs=0)
    Method = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    Chemical = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    TemperatureTimes = String(max_len=100).customize(max_occurs=1,
                                                     min_occurs=0)
    Concentration = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    AdditionalInfo = String(max_len=2000).customize(max_occurs=1, min_occurs=0)

    @staticmethod
    def generate():
        return {
            'Date': 'hello',
            'Method': 'hello',
            'Chemical': 'hello',
            'TemperatureTimes': 'hello',
            'Concentration': 'hello',
            'AdditionalInfo': 'hello',
        }
Ejemplo n.º 20
0
class InteropPrimitive(ServiceBase):
    @srpc(AnyXml, _returns=AnyXml)
    def echo_any(xml):
        return xml

    @srpc(AnyDict, _returns=AnyDict)
    def echo_any_as_dict(xml_as_dict):
        return xml_as_dict

    @srpc(Integer, _returns=Integer)
    def echo_integer(i):
        return i

    @srpc(String, _returns=String)
    def echo_string(s):
        return s

    @srpc(DateTime, _returns=DateTime)
    def echo_datetime(dt):
        return dt

    @srpc(DateTime(format='ignored'), _returns=DateTime)
    def echo_datetime_with_invalid_format(dt):
        return dt

    @srpc(Date, _returns=Date)
    def echo_date(d):
        return d

    @srpc(Date(format='ignored'), _returns=Date)
    def echo_date_with_invalid_format(d):
        return d

    @srpc(Time, _returns=Time)
    def echo_time(t):
        return t

    @srpc(Time(format='ignored'), _returns=Time)
    def echo_time_with_invalid_format(t):
        return t

    @srpc(Float, _returns=Float)
    def echo_float(f):
        return f

    @srpc(Double, _returns=Double)
    def echo_double(f):
        return f

    @srpc(Boolean, _returns=Boolean)
    def echo_boolean(b):
        return b

    @srpc(DaysOfWeekEnum, _returns=DaysOfWeekEnum)
    def echo_enum(day):
        return day

    @srpc(Duration, _returns=Duration)
    def echo_duration(dur):
        return dur

    @srpc(ByteArray, _returns=ByteArray)
    def echo_bytearray(data):
        return data
Ejemplo n.º 21
0
Archivo: mail.py Proyecto: plq/jmapd
class Email(ComplexModel):
    _type_info = [
        #
        # Metadata
        #

        ('id', JmapId(
            sub_name='id',
            doc="(immutable; server-set) The id of the Email object. Note "
                "that this is the JMAP object id, NOT the Message-ID header "
                "field value of the message [@!RFC5322]."
        )),

        ('blob_id', JmapId(
            sub_name='blobId',
            doc="(immutable; server-set) The id representing the raw "
                "octets of the message [@!RFC5322] for this Email. This may "
                "be used to download the raw original message or to attach it "
                "directly to another Email, etc."
        )),

        ('thread_id', JmapId(
            sub_name='threadId',
            doc="(immutable; server-set) The id of the Thread to which "
                "this Email belongs."
        )),

        ('mailbox_ids', AnyDict(  # this is supposed to be a JmapId: bool dict
            sub_name='mailboxIds',
            doc="The set of Mailbox ids this Email belongs to. An "
                "Email in the mail store MUST belong to one or more Mailboxes "
                "at all times (until it is destroyed). The set is represented "
                "as an object, with each key being a Mailbox id. The value "
                "for each key in the object MUST be true."
        )),

        ('keywords', AnyDict(  # this is supposed to be a str: bool dict
            sub_name='keywords',
            doc="(default: {}) A set of keywords that apply "
                "to the Email. The set is represented as an object, with the "
                "keys being the keywords. The value for each key in the "
                "object MUST be true."
        )),

        ('size', UnsignedInteger(
            sub_name='size',
            doc="(immutable; server-set) The size, in octets, "
                "of the raw data for the message [@!RFC5322] (as referenced "
                "by the blobId, i.e., the number of octets in the file the "
                "user would download)."
        )),

        ('received_at', UtcDate(
            default_factory=lambda: datetime.utcnow().replace(tzinfo=pytz.utc)
                                                                   .isoformat(),
            sub_name='receivedAt',
            doc="(immutable; default: time of creation on server) The "
                "date the Email was received by the message store. This is "
                "the internal date in IMAP [@?RFC3501]."
        )),

        #
        # Header fields
        #

        ('message_id', Array(Unicode,
            sub_name='messageId',
            doc="(immutable) The value is identical to the "
                "value of header:Message-ID:asMessageIds. For messages "
                "conforming to RFC 5322 this will be an array with a single "
                "entry."
        )),

        ('in_reply_to', Array(Unicode,
            sub_name='inReplyTo',
            doc="(immutable) The value is identical to the "
                "value of header:In-Reply-To:asMessageIds."
        )),

        ('references', Array(Unicode,
            sub_name='references',
            doc="(immutable) The value is identical to the "
                "value of header:References:asMessageIds."
        )),

        ('sender', Array(EmailAddress,
            sub_name='sender',
            doc="(immutable) The value is identical to "
                "the value of header:Sender:asAddresses."
        )),

        ('from_', Array(Unicode,
            sub_name='from',
            doc="(immutable) The value is identical to "
                "the value of header:From:asAddresses."
        )),

        ('to', Array(Unicode,
            sub_name='to',
            doc="(immutable) The value is identical to "
                "the value of header:To:asAddresses."
        )),

        ('cc', Array(Unicode,
            sub_name='cc',
            doc="(immutable) The value is identical to "
                "the value of header:Cc:asAddresses."
        )),

        ('bcc', Array(Unicode,
            sub_name='bcc',
            doc="(immutable) The value is identical to "
                "the value of header:Bcc:asAddresses."
        )),

        ('reply_to', Unicode(
            sub_name='replyTo',
            doc="(immutable) The value is identical to "
                "the value of header:Reply-To:asAddresses."
        )),

        ('subject', Unicode(
            sub_name='subject',
            doc="(immutable) The value is identical to the value "
                "of header:Subject:asText."
        )),

        ('sent_at', DateTime(
            sub_name='sentAt',
            doc="(immutable; default on creation: current server "
                "time) The value is identical to the value of "
                "header:Date:asDate."
        )),

        #
        # Body Parts
        #

        ('body_structure', Array(EmailBodyPart,
            sub_name='bodyStructure',
            doc="(immutable) This is the full MIME structure of the message "
                "body, without recursing into message/rfc822 or message/global "
                "parts. Note that EmailBodyParts may have subParts if they "
                "are of type multipart."
        )),

        ('body_values', AnyDict(
            sub_name='bodyValues',
            doc="(immutable) This is a map of partId to an EmailBodyValue "
                "object for none, some, or all text parts. Which parts are "
                "included and whether the value is truncated is determined "
                "by various arguments to Email/get and Email/parse."
        )),

        ('text_body', Array(EmailBodyPart,
            sub_name='textBody',
            doc="(immutable) A list of text/plain, text/html, image, audio, "
                "and/or video parts to display (sequentially) as the message "
                "body, with a preference for text/plain when alternative "
                "versions are available."
        )),

        ('html_body', Array(EmailBodyPart,
            sub_name='htmlBody',
            doc="(immutable) A list of text/plain, text/html, image, audio, "
                "and/or video parts to display (sequentially) as the message "
                "body, with a preference for text/html when alternative "
                "versions are available."
        )),

        ('attachments', Array(EmailBodyPart,
            sub_name='attachments',
            doc="(immutable) A list, traversing depth-first, "
                "of all parts in bodyStructure that satisfy either of the "
                "following conditions:"
        )),

        ('has_attachment', M(Boolean(
            sub_name='hasAttachment', default=False,
            doc="(immutable; server-set) This is true if there are "
                "one or more parts in the message that a client UI should "
                "offer as downloadable. A server SHOULD set hasAttachment to "
                "true if the attachments list contains at least one item that "
                "does not have Content-Disposition: inline. The server MAY "
                "ignore parts in this list that are processed automatically "
                "in some way or are referenced as embedded images in one of "
                "the text/html parts of the message."
        ))),

        ('preview', Unicode(256,
            sub_name='preview', default=u'',
            doc="(immutable; server-set) A plaintext fragment of the "
                "message body. This is intended to be shown as a preview line "
                "when listing messages in the mail store and may be truncated "
                "when shown. The server may choose which part of the message "
                "to include in the preview; skipping quoted sections and "
                "salutations and collapsing white space can result in a more "
                "useful preview."
        )),
    ]
Ejemplo n.º 22
0
 def test_datetime_extreme_boundary(self):
     self.assertTrue(
                   DateTime.validate_native(DateTime, datetime.datetime.min))
     self.assertTrue(
                   DateTime.validate_native(DateTime, datetime.datetime.max))
Ejemplo n.º 23
0
class Request91(ComplexModel):
    __namespace__ = ''
    GUID = Unicode(128, pattern='[^@]+@[^@]+')
    SendDateTime = DateTime.customize(max_occurs=1, min_occurs=0)
    certificate = Certificate
Ejemplo n.º 24
0
# encoding: utf8
#
# This file is part of the jmapd project at https://github.com/arskom/jmapd.
#
# jmapd (c) 2020 and beyond, Arskom Ltd. All rights reserved.
#
# This file is subject to the terms of the 3-clause BSD license, which can be
# found in the LICENSE file distributed with this file. Alternatively, you can
# obtain a copy from the repository root cited above.
#

from spyne import M, Unicode, DateTime

UtcDate = DateTime(timezone=False)

#
# Quoting: https://jmap.io/spec-core.html#the-id-data-type
#
#     These characters are safe to use in almost any context (e.g., filesystems,
#     URIs, and IMAP atoms). For maximum safety, servers SHOULD also follow
#     defensive allocation strategies to avoid creating risks where glob
#     completion or data type detection may be present (e.g., on filesystems or
#     in spreadsheets). In particular, it is wise to avoid:
#
#      - Ids starting with a dash
#      - Ids starting with digits
#      - Ids that contain only digits
#      - Ids that differ only by ASCII case (for example, A vs. a)
#      - the specific sequence of three characters “NIL” (because this sequence
#      - can be confused with the IMAP protocol expression of the null value)
#
class certificate(ComplexModel):
    __namespace__ = ''
    ID = Integer.customize(max_occurs=1, min_occurs=0)
    GUID = Unicode(128, pattern='[^@]+@[^@]+')
    SendDateTime = DateTime.customize(max_occurs=1, min_occurs=0)
    Number = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    Date = DateTime.customize(max_occurs=1, min_occurs=0)
    Blanc = String(max_len=100).customize(max_occurs=1, min_occurs=0)
    DepartureCountry = String(max_len=100).customize(max_occurs=1,
                                                     min_occurs=0)
    DepartureCountryCode = String(max_len=2).customize(max_occurs=1,
                                                       min_occurs=0)
    DestinationCountry = String(max_len=100).customize(max_occurs=1,
                                                       min_occurs=0)
    DestinationCountryCode = String(max_len=2).customize(max_occurs=1,
                                                         min_occurs=0)
    EntryCheckpoint = String(max_len=255).customize(max_occurs=1, min_occurs=0)
    EntryCheckpointCode = Integer.customize(max_occurs=1, min_occurs=0)
    Consignor = consignor
    Consignee = consignee
    Transport = transport
    Disinfection = disinfection
    Productdescription = productDescription
    GeneralMarking = String(max_len=512).customize(max_occurs=1, min_occurs=0)
    GeneralQuarantineCondition = String(max_len=512).customize(max_occurs=1,
                                                               min_occurs=0)
    GeneralBaseDocument = String(max_len=512).customize(max_occurs=1,
                                                        min_occurs=0)
    GeneralAdditionalDeclaration = String(max_len=512).customize(max_occurs=1,
                                                                 min_occurs=0)
    GeneralMandatoryActions = String(max_len=512).customize(max_occurs=1,
                                                            min_occurs=0)
    AdditionalInfo = String(max_len=2000).customize(max_occurs=1, min_occurs=0)
    Inspector = String(max_len=255).customize(max_occurs=1, min_occurs=0)
    AnnexDoc = String(max_len=100000).customize(max_occurs=1, min_occurs=0)
    AnnexText = String(max_len=100000).customize(max_occurs=1, min_occurs=0)
    # PDF = ByteArray.customize(max_occurs=1, min_occurs=0)

    #         'Blanc'omize(max_occurs=1, min_occurs=0)
    # PDF = ByteArray.customize(max_occurs=1, min_occurs=0)

    @staticmethod
    def generate():
        return {
            'ID': 'hello',
            # Guid
            'SendDateTime': 'hello',
            'Number': 'hello',
            'Date': 'hello',
            'Blanc': 'hi',
            'DepartureCountry': 'hello',
            'DepartureCountryCode': 'hello',
            'DestinationCountry': 'hello',
            'DestinationCountryCode': 'hello',
            'consignor': Consignor,
            'consignee': Consignee,
            'transport': Transport,
            'disinfection': Disinfection,
            'productDescription': ProductDescription,
            'GeneralMarking': 'hello',
            'GeneralQuarantineCondition': 'Карантинных объектов не обнаружено',
            'GeneralBaseDocument': 'hi',
            'GeneralAdditionalDeclaration': 'hello',
            'GeneralMandatoryActions': 'hello',
            'AdditionalInfo': 'hello',
            'Inspector': 'hello',
        }