Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev: pull request changes #26

Merged
merged 6 commits into from
Aug 9, 2023
Merged

Dev: pull request changes #26

merged 6 commits into from
Aug 9, 2023

Conversation

fabaindaiz
Copy link
Owner

No description provided.

yilmazcabuk and others added 6 commits August 9, 2023 13:14
Added unit tests for utility functions in newly created `utils_test.py` and `iteration_test.py`. This was done to improve overall code reliability and ensure that the functions were behaving as expected.

Also, refactored the `utils.py` and `iteration.py` code for better readability. This involved:
- Updating the `POINTS` dictionary structure for improved visibility.
- Extended the docstring for the `pairwise` function for comprehensive understanding of its use-case and behavior.

Furthermore, renamed `itertools.py` to `iteration.py` to avoid confusion with Python's built-in `itertools` module.
Reformatted the code to improve readability and applied "black" style Python formatting. All code modifications were related to formatting—changing the location of line breaks, adding whitespace around operators, and similar tweaks. This refactoring affects no observable behavior and therefore, no changes in the application's functionality would be noted after the commit. The main goal is to make the code more aesthetically pleasing and easier to maintain in the future.
This commit introduces enhancements to the Timer class in the `src/utils/timer.py` module. The Timer class now provides improved functionality for measuring elapsed time intervals using various time units. This can be particularly useful for benchmarking or profiling code execution durations.

The changes include:
- The addition of the `timedelta` import from the `datetime` module to enable time unit conversions.
- Improved documentation for the Timer class, outlining its purpose and attributes.
- The `reset_timer` method has been updated to provide more comprehensive documentation and to set the starting time of the timer to the current time.
- The introduction of the `_elapsed_time` method, which calculates elapsed time in the specified time unit. This method improves the accuracy of elapsed time calculations and facilitates conversions to different time units.
- Refinements to the `elapsed_seconds` and `elapsed_millis` methods, including more detailed docstrings and improved accuracy in time calculations.

In addition to these changes, this commit also includes a new unit test suite for the Timer class. The `src/utils/timer_test.py` module contains tests to verify the correct functioning of the enhanced Timer class methods. Mocking of datetime objects has been used in the unit tests to ensure accurate testing of time-related functionality.

These enhancements contribute to the overall robustness and usability of the Timer class, making it a valuable tool for measuring elapsed time intervals in a more versatile and accurate manner. The unit tests further validate the correctness of the Timer class improvements.
Enhanced Timer Class and Code Refactoring
@fabaindaiz fabaindaiz merged commit afc6cd4 into dev Aug 9, 2023
@fabaindaiz fabaindaiz deleted the pr-#26 branch October 12, 2023 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants