Utilities¶
Note
The documentation in this section is aimed at people wishing to contribute to
rdial, and can be skipped if you are simply using the tool from the
command line.
Convenience functions and classes¶
-
rdial.utils.write_current(__fun)[source]¶ Decorator to write
.currentfile on function exit.See also
-
rdial.utils.remove_current(__fun)[source]¶ Decorator to remove
.currentfile on function exit.See also
Time handling¶
-
rdial.utils.iso_week_to_date(__year, __week)[source]¶ Generate date range for a given ISO-8601 week.
ISO-8601 defines a week as Monday to Sunday, with the first week of a year being the first week containing a Thursday.
Development tools¶
-
rdial.utils.maybe_profile()[source]¶ Profile the wrapped code block.
When
RDIAL_PROFILEis set execute the enclosed block under bprofile. The envvar’s value should be the name of the output file to generate.When
RDIAL_PROFILEis unset, this is just a no-op.- Return type
Abstractcontextmanager[+T_co]
Examples¶
Time handling¶
>>> parse_datetime_user('40 minutes ago')
datetime.datetime(2012, 2, 15, 18, 59, 18)
Development tools¶
>>> with maybe_profile():
... time.sleep(10)