Python utility for Tetra Task Scripts
Project description
ts-task-script-utils
Version
v1.4.0
Table of Contents
Summary
Utility functions for Tetra Task Scripts
Installation
pip install ts-task-script-utils
Usage
from task_script_utils.parse import to_int
string_value = '1.0'
int_value = to_int(string_value)
# `int_value` now has the parsed value of the string
assert isinstance(int_value, int)
assert int_value == 1
# it returns `None` if the value is unparseable
string_value = 'not an int'
int_value = to_int(string_value)
assert int_value is None
Datetime Parser
DEPRECATION WARNING!
- Do not use the old datetime parser:
convert_datetime_to_ts_format
(fromtask_script_utils.convert_datetime_to_ts_format
) - Instead, use the newer
parse
fromtask_script_utils.datetime_parser
parse
Usage
from task_script_utils.datetime_parser import parse
parse("2004-12-23T12:30 AM +05:30")
parse("2004-12-23T12:30 AM +05:30", <format_list>)
parse("2004-12-23T12:30 AM +05:30", <format_list>, <datetime_config>)
prase()
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.4.0
- Add
extract-to-decorate
functions
v1.3.1
- Update datetime parser usage in README.md
v1.3.0
- Added string parsing functions
v1.2.0
- Add boolean config parameter
require_unambiguous_formats
toDatetimeConfig
- Add logic to
parser._parse_with_formats
to be used whenDatetimeConfig.require_unambiguous_formats
is set toTrue
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
andLongDateTimeInfo
v1.1.1
- Remove
convert_to_ts_iso8601()
method
v1.1.0
- Add
datetime_parser
package
Project details
Release history Release notifications | RSS feed
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.4.0.tar.gz
(282.1 kB
view hashes)
Built Distribution
Close
Hashes for ts_task_script_utils-1.4.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1443e86b55dbfeb7516bd7073a92557118b5ce324eb676a1b00d5d8a93e3aab3 |
|
MD5 | 8d8e0a87429239cc9ca73aa995a8ebae |
|
BLAKE2b-256 | afa2b21fdcf88ffb7f5edc0cc3ca4e4a22a5d0ef0d80f4f9e12fee1034d7af7c |
Close
Hashes for ts_task_script_utils-1.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3428c0e64c5888a5d78b384e77941ccfba2295ab57bb775ccbd920ae7b0ec675 |
|
MD5 | d1a078f3263d0cca070af0b444edb4d0 |
|
BLAKE2b-256 | 334a4bbb5a755f9570a9e6b8fab81df089e77b36daae4bbbef445bacb550ed78 |