MCPcopy Create free account
hub / github.com/STIXProject/python-stix / set_produced_time

Method set_produced_time

stix/indicator/indicator.py:603–629  ·  view source on GitHub ↗

Sets the ``produced_time`` property of the ``producer`` property instance fo `produced_time`. This is the same as calling ``indicator.producer.time.produced_time = produced_time``. The `produced_time` parameter must be an instance of ``str``, ``datetime.date

(self, produced_time)

Source from the content-addressed store, hash-verified

601 self.producer.identity.name = str(identity)
602
603 def set_produced_time(self, produced_time):
604 """Sets the ``produced_time`` property of the ``producer`` property
605 instance fo `produced_time`.
606
607 This is the same as calling
608 ``indicator.producer.time.produced_time = produced_time``.
609
610 The `produced_time` parameter must be an instance of ``str``,
611 ``datetime.datetime``, or ``cybox.common.DateTimeWithPrecision``.
612
613 Note:
614 If `produced_time` is a ``str`` or ``datetime.datetime`` instance
615 an attempt will be made to convert it into an instance of
616 ``cybox.common.DateTimeWithPrecision``.
617
618 Args:
619 produced_time: An instance of ``str``,
620 ``datetime.datetime``, or ``cybox.common.DateTimeWithPrecision``.
621
622 """
623 if not self.producer:
624 self.producer = InformationSource()
625
626 if not self.producer.time:
627 self.producer.time = Time()
628
629 self.producer.time.produced_time = produced_time
630
631 def get_produced_time(self):
632 """Gets the produced time for this :class:`Indicator`.

Callers 2

mainFunction · 0.95
mainFunction · 0.95

Calls 2

InformationSourceClass · 0.90
TimeClass · 0.85

Tested by

no test coverage detected