Skip to content

Commit

Permalink
changed pyparsing function calls to set_parse_action and set_results_…
Browse files Browse the repository at this point in the history
…name.
  • Loading branch information
rick authored and joachimmetz committed Apr 9, 2024
1 parent 44aa5d5 commit 2bbd46e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions plaso/parsers/ips_plugins/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ class IPSPlugin(plugins.BasePlugin):
REQUIRED_HEADER_KEYS = []
REQUIRED_CONTENT_KEYS = []

_TWO_DIGITS = pyparsing.Word(pyparsing.nums, exact=2).setParseAction(
_TWO_DIGITS = pyparsing.Word(pyparsing.nums, exact=2).set_parse_action(
lambda tokens: int(tokens[0], 10))

_FOUR_DIGITS = pyparsing.Word(pyparsing.nums, exact=4).setParseAction(
_FOUR_DIGITS = pyparsing.Word(pyparsing.nums, exact=4).set_parse_action(
lambda tokens: int(tokens[0], 10))

_VARYING_DIGITS = pyparsing.Word(pyparsing.nums)

TIMESTAMP_GRAMMAR = (
_FOUR_DIGITS.setResultsName('year') + pyparsing.Suppress('-') +
_TWO_DIGITS.setResultsName('month') + pyparsing.Suppress('-') +
_TWO_DIGITS.setResultsName('day') +
_TWO_DIGITS.setResultsName('hours') + pyparsing.Suppress(':') +
_TWO_DIGITS.setResultsName('minutes') + pyparsing.Suppress(':') +
_TWO_DIGITS.setResultsName('seconds') + pyparsing.Suppress('.') +
_VARYING_DIGITS.setResultsName('fraction') +
_FOUR_DIGITS.set_results_name('year') + pyparsing.Suppress('-') +
_TWO_DIGITS.set_results_name('month') + pyparsing.Suppress('-') +
_TWO_DIGITS.set_results_name('day') +
_TWO_DIGITS.set_results_name('hours') + pyparsing.Suppress(':') +
_TWO_DIGITS.set_results_name('minutes') + pyparsing.Suppress(':') +
_TWO_DIGITS.set_results_name('seconds') + pyparsing.Suppress('.') +
_VARYING_DIGITS.set_results_name('fraction') +
pyparsing.Word(
pyparsing.nums + '+' + '-').setResultsName('timezone_delta'))
pyparsing.nums + '+' + '-').set_results_name('timezone_delta'))

def _ParseTimestampValue(self, parser_mediator, timestamp_text):
"""Parses a timestamp string.
Expand Down

0 comments on commit 2bbd46e

Please sign in to comment.