DEV Community

Cover image for Aiotense - Time Processing Tool

Posted on

Aiotense - Time Processing Tool

aiotense - python time parsing tool.

GitHub -

Documentation -

aiotense is a tool that converts a string like "1day1minute 20seconds" into number of seconds or timedelta objects.

import asyncio 
from aiotense import TenseParser  

time_string = "1d2minutes 5 sec"

# <-- Digit parser --> 
digit_parser = TenseParser(TenseParser.DIGIT) 
digit_value = 
# <-- Assertions --> 
assert digit_value == 86525 
Enter fullscreen mode Exit fullscreen mode
  • If you need case insensitivity, you can use resolvers.

  • Custom parsing sequence - custom resolvers.

  • Need to convert result to string? You can write your own converter by inheriting aiotense.application.ports.converters.AbstractConverter.

  • Need to cache the result? Write your own parser by inheriting aiotense.application.ports.parsers.AbstractParser.

aiotense has been designed with maximum flexibility, practicality and user friendliness in mind. I hope our project helped you or you were just interested in seeing it.

Top comments (0)