python-fire
python-fire copied to clipboard
Add time_tools example (now, to_seconds, add_seconds)
Summary
This PR adds a new example module time_tools to the examples/ directory.
It follows the same format and structure as the existing Google examples such as
cipher, including licensing headers, function layout, Fire usage style, and
test patterns.
Details
- New folder:
examples/time_tools/ - Provides simple time utility functions:
-
now()— returns the current datetime string -
to_seconds(minutes, seconds)— converts to total seconds -
add_seconds(time_string, seconds)— adds seconds to a datetime
-
- Fire CLI is invoked without a target component, so all module functions become CLI commands, consistent with other examples.
- Includes a full test suite built using
testutils.BaseTestCase.
Checklist
- [x] Example follows Google style (license header, naming, docstrings)
- [x] Test file included following Google's
cipher_test.pypattern - [x] No modifications to core Fire library
- [x] CLA signed