-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #375 from rtosholdings/latest-v1.17.0
v1.17.0
- Loading branch information
Showing
16 changed files
with
808 additions
and
381 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
python: | ||
- 3.11 | ||
- 3.12 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,65 @@ | ||
import riptable | ||
import contextlib | ||
|
||
# Standardized riptable configuration settings applied when doing docstring validation. | ||
|
||
# Standardize on these display settings when executing examples | ||
riptable.Display.FORCE_REPR = True # Don't auto-detect console dimensions, just use CONSOLE_X/Y | ||
riptable.Display.options.COL_MAX = 1_000_000 # display all Dataset columns (COL_ALL is incomplete) | ||
riptable.Display.options.E_MAX = 100_000_000 # render up to 100MM before using scientific notation | ||
riptable.Display.options.P_THRESHOLD = 0 # truncate small decimals, rather than scientific notation | ||
riptable.Display.options.NUMBER_SEPARATOR = True # put commas in numbers | ||
riptable.Display.options.HEAD_ROWS = 3 | ||
riptable.Display.options.TAIL_ROWS = 3 | ||
def _setup_display_config(): | ||
"""Initialize display config settings. | ||
Any options that can be modified should be set here, even if set to default values. | ||
""" | ||
riptable.Display.FORCE_REPR = True # Don't auto-detect console dimensions, just use CONSOLE_X/Y | ||
riptable.Display.options.CONSOLE_X = 150 | ||
riptable.Display.options.COL_MAX = 1_000_000 # display all Dataset columns (COL_ALL is incomplete) | ||
riptable.Display.options.E_MAX = 100_000_000 # render up to 100MM before using scientific notation | ||
riptable.Display.options.P_THRESHOLD = 0 # truncate small decimals, rather than scientific notation | ||
riptable.Display.options.NUMBER_SEPARATOR = True # put commas in numbers | ||
riptable.Display.options.HEAD_ROWS = 3 | ||
riptable.Display.options.TAIL_ROWS = 3 | ||
riptable.Display.options.ROW_ALL = False | ||
riptable.Display.options.COL_ALL = False | ||
riptable.Display.options.MAX_STRING_WIDTH = 15 | ||
|
||
|
||
def setup_init_config(): | ||
"""Initialize all config settings. Typically only done once.""" | ||
_setup_display_config() | ||
|
||
|
||
class ScopedExampleSetup(contextlib.AbstractContextManager): | ||
"""Context manager to clean up after any changes made during example setup.""" | ||
|
||
_CLEANUP_CALLBACKS = [] | ||
|
||
@staticmethod | ||
def add_cleanup_callback(fn): | ||
ScopedExampleSetup._CLEANUP_CALLBACKS.append(fn) | ||
|
||
def __enter__(self) -> None: | ||
return super().__enter__() | ||
|
||
def __exit__(self, exc_type, exc_value, traceback) -> bool | None: | ||
callbacks = ScopedExampleSetup._CLEANUP_CALLBACKS | ||
ScopedExampleSetup._CLEANUP_CALLBACKS = [] | ||
for callback in callbacks: | ||
callback() | ||
return super().__exit__(exc_type, exc_value, traceback) | ||
|
||
|
||
def setup_for_examples(*configs: tuple[str]): | ||
"""Applies specified config setups for an example. | ||
Configs are applied in order. | ||
Any modifications done here need to be undone by registering a cleanup task with ScopedExampleSetup. | ||
""" | ||
|
||
for config in configs: | ||
if config == "struct-display": | ||
riptable.Display.options.CONSOLE_X = 120 | ||
riptable.Display.options.HEAD_ROWS = 15 | ||
riptable.Display.options.TAIL_ROWS = 15 | ||
ScopedExampleSetup.add_cleanup_callback(_setup_display_config) # reset all display configs. | ||
|
||
else: | ||
raise NotImplementedError(f"Unknown config, {config}") | ||
|
||
|
||
# Initialize all config globally. | ||
setup_init_config() |
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
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
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
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
Oops, something went wrong.