-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Improvements to Utilities #103
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add: `._utils` submodule. - Change: Move definitions from `.utils` to `._utils` - Change: Export only public utilities from `.utils`. - Change: Update affected modules and tests. All modules now import from `._utils` instead of `.utils`.
- Add: `._utils.query_cache`. - Add: `@._utils.cached_query`. - Change: Decorate the following with `@cached_query` instead of `@cached`: - `._utils.get_terminal_name_version()` - `._utils.get_fg_bg_colors()` - Change: Update query result cache invalidation in `.enable_queries()`.
- Fix: `UnboundLocalError` when ioctl fails and queries are disabled. - Fix: Update `cell_size` when text area size is determined via query. - Change: Compress query-based portion.
- Change: Cache query results only when queries are enabled. - Change: Update `@cached_query` and `get_cell_size()` accordingly. - Change: Remove no-longer-needed comment about invalidating cached query results.
- Change: Replace `@cached` with `@functools.lru_cache(maxsize=None)`. - Change: Remove from `._utils`: - `@cached` - `@terminal_size_cached`
AnonymouX47
added
improvement
Implementation of improvement to an existing feature
utils
Related to utilities
labels
Feb 1, 2024
AnonymouX47
force-pushed
the
utils-update
branch
from
February 15, 2024 20:47
2ae1958
to
c8191c1
Compare
- Change: Remove long-commented code for active terminal synchronization workaround for `termios` functions.
- Add: `NoActiveTerminalWarning`, `get_active_terminal()`. - Change: Move active terminal derivation code into `get_active_terminal()`. - Change: `_tty_fd` is now initialized to `None` and updated by the first call to `get_active_terminal()`. - Change: Update functions to use `get_active_terminal()` instead of `_tty_fd` directly. - Change: `NoActiveTerminalWarning` is now issued instead of the more generic `TermImageUserWarning`, when there's no active terminal.
- Change: Update term description. - Change: Update warning issued when there's no active terminal. - Change: "terminal/TTY device" -> "PTY device".
- Add: `TTYSyncProcess`, `NoMultiProcessSyncWarning`. - Change: Move multi-process TTY access and cell size synchronization into `TTYSyncProcess`. - Change: The active terminal is no longer determined at module load time. - Change: Update docstring of `@lock_tty`. - Change: Update type hints.
- Change: Ignore `NoActiveTerminalWarning` directly since the active terminal is no longer determined at package load time.
- Fix: Eliminate race condition between threads for changing locks and cell size cache while starting a `TTYSyncProcess`. - Change: Ensure the change of tty lock and cell size cache/lock are each attempted only once. - Change: Clean up code.
- Add: Attempt to set the inheritable flag of active terminal file descriptor and pass on the file descriptor to the subprocess if successful. Useful for spawned (non-forked) processes.
- Add: `CellSize`. Uses `fractions.Fraction` for cell dimensions to allow and preserve possible fractional cell sizes. - Change: `get_cell_size()` no longer uses `CSI 16 t`. This is to avoid early rounding as [@jerch](https://github.com/jerch) mentioned (on the chafa matrix chat) that cell sizes may be fractional in certain cases [on some TEs]. - Change: `get_cell_size()` now returns `CellSize` instead of `Size`. - Change: `_cell_size_cache` is now an array of 6 integers, to allow for fractional cell sizes. - Change: Update `term_image.set_cell_ratio()` and `term_image.get_cell_ratio()` to ensure they return the correct types. - Change: Update `set_cell_size()` in the tests to use `CellSize`. - Change: Update `GraphicsImage`'s size computation methods to: - keep return types consistent - round values late - remove redundant `math.ceil()`
- Add: `NameVersion` named tuple. - Change: Now returns `NameVersion` instead of a mere tuple. - Change: Use the return value as named tuple everywhere. - Change: Update the docstring.
AnonymouX47
force-pushed
the
utils-update
branch
from
March 18, 2024 04:46
d6c271a
to
ffd200d
Compare
- Change: Correct the grammar in `arg_value_error_range()`'s message.
- Add: Make the function public; Export from `.utils`. - Change: Now returns `Color` instead of `tuple | str`. - Change: Remove typing overloads. - Change: Update the use of the function all over. - Change: Update the docstring.
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
AnonymouX47
force-pushed
the
main
branch
2 times, most recently
from
June 26, 2024 02:47
130d999
to
8105a8e
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
._utils
and exports only public ones from.utils
.._utils.query_cache
@._utils.cached_query
NoActiveTerminalWarning
,get_active_terminal()
.NoActiveTerminalWarning
is now issued instead of the more genericTermImageUserWarning
, when there's no active terminal.TTYSyncProcess
,NoMultiProcessSyncWarning
.CellSize
.get_cell_size()
no longer usesCSI 16 t
to avoid premature rounding.get_cell_size()
now returnsCellSize
instead of.geometry.Size
.NameVersion
.get_terminal_name_version()
now returnsNameVersion
instead of a mere tuple..utils.get_fg_bg_colors()
(to the public API).get_fg_bg_colors()
now returnsColor
instead oftuple | str
.