Skip to main content

Python utility for Tetra Task Scripts

Project description

ts-task-script-utils

Build Status

Utility functions for Tetra Task Scripts

Installation

pip install ts-task-script-utils

Usage

from task_script_utils.is_number import isnumber

print(isnumber('a'))

Datetime Parser

from task_script_utils.datetime_parser import parse

parse("2004-12-23T12:30 AM +05:30")
parse("2004-12-23T12:30 AM +05:30", <datetime_config>)
parse("2004-12-23T12:30 AM +05:30", <format_list>)
parse("2004-12-23T12:30 AM +05:30", <format_list>, <datetime_config>)

parse() returns a TSDatetime Object. You can use TSDatetime.tsformat() and TSDatetime.isoformat() to get datetime string. You can also use TSDatetime.datetime() to access python datetime object.

You can read more about the datetime parser here.

Changelog

v1.3.0

  • Added string parsing functions

v1.2.0

  • Add boolean config parameter require_unambiguous_formats to DatetimeConfig
  • Add logic to parser._parse_with_formats to be used when DatetimeConfig.require_unambiguous_formats is set to True
    • AmbiguousDatetimeFormatsError is raised if mutually ambiguous formats are detected and differing datetimes are parsed
  • Add parameter typing throughout repository
  • Refactor datetime_parser package
  • Add base class DateTimeInfo
  • Segregate parsing logic into ShortDateTimeInfo and LongDateTimeInfo

v1.1.1

  • Remove convert_to_ts_iso8601() method

v1.1.0

  • Add datetime_parser package

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ts-task-script-utils-1.3.0.tar.gz (281.4 kB view hashes)

Uploaded Source

Built Distribution

ts_task_script_utils-1.3.0-py3-none-any.whl (288.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page