From c8d3a9cee235af5da9fa7fe75dccdef90ee0c635 Mon Sep 17 00:00:00 2001 From: Joachim Metz Date: Sat, 13 Jun 2020 20:18:43 +0200 Subject: [PATCH] Removed TimestampEvent #910 --- plaso/containers/time_events.py | 36 ++++++--------------------------- tests/containers/time_events.py | 15 -------------- 2 files changed, 6 insertions(+), 45 deletions(-) diff --git a/plaso/containers/time_events.py b/plaso/containers/time_events.py index 65360621c4..83aaa47a01 100644 --- a/plaso/containers/time_events.py +++ b/plaso/containers/time_events.py @@ -7,53 +7,29 @@ from plaso.lib import timelib -class TimestampEvent(events.EventObject): - """Plaso timestamp-based event attribute container. +class DateTimeValuesEvent(events.EventObject): + """dfDateTime date time values-based event attribute container. Attributes: - data_type (str): event data type. timestamp (int): timestamp, which contains the number of microseconds since January 1, 1970, 00:00:00 UTC. timestamp_desc (str): description of the meaning of the timestamp. """ - def __init__(self, timestamp, timestamp_description, data_type=None): - """Initializes an event. - - Args: - timestamp (int): timestamp, which contains the number of microseconds - since January 1, 1970, 00:00:00 UTC. - timestamp_description (str): description of the meaning of the timestamp - value. - data_type (Optional[str]): event data type. If the data type is not set - it is derived from the DATA_TYPE class attribute. - """ - super(TimestampEvent, self).__init__() - self.timestamp = timestamp - self.timestamp_desc = timestamp_description - - if data_type: - self.data_type = data_type - - -class DateTimeValuesEvent(TimestampEvent): - """dfDateTime date time values-based event attribute container.""" - def __init__( - self, date_time, date_time_description, data_type=None, time_zone=None): + self, date_time, date_time_description, time_zone=None): """Initializes an event. Args: date_time (dfdatetime.DateTimeValues): date and time values. date_time_description (str): description of the meaning of the date and time values. - data_type (Optional[str]): event data type. If the data type is not set - it is derived from the DATA_TYPE class attribute. time_zone (Optional[datetime.tzinfo]): time zone. """ timestamp = date_time.GetPlasoTimestamp() if date_time.is_local_time and time_zone: timestamp = timelib.Timestamp.LocaltimeToUTC(timestamp, time_zone) - super(DateTimeValuesEvent, self).__init__( - timestamp, date_time_description, data_type=data_type) + super(DateTimeValuesEvent, self).__init__() + self.timestamp = timestamp + self.timestamp_desc = date_time_description diff --git a/tests/containers/time_events.py b/tests/containers/time_events.py index 6d0f3d9b45..42be279607 100644 --- a/tests/containers/time_events.py +++ b/tests/containers/time_events.py @@ -13,21 +13,6 @@ from tests import test_lib as shared_test_lib -class TimestampEventTest(shared_test_lib.BaseTestCase): - """Tests for the Plaso timestamp-based event attribute container.""" - - def testGetAttributeNames(self): - """Tests the GetAttributeNames function.""" - attribute_container = time_events.TimestampEvent(0, 'usage') - - expected_attribute_names = [ - '_event_data_row_identifier', 'parser', 'timestamp', 'timestamp_desc'] - - attribute_names = sorted(attribute_container.GetAttributeNames()) - - self.assertEqual(attribute_names, expected_attribute_names) - - class DateTimeValuesEventTest(shared_test_lib.BaseTestCase): """Tests for the dfDateTime-based event attribute container."""