-
Terence Tsang authored
commit eff25c5d Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 12 23:09:01 2025 +0100 commit 2508facf Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 12 23:06:38 2025 +0100 commit 242ec2ea Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 12 22:44:31 2025 +0100 commit a402e7fb Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 12 22:23:12 2025 +0100 Doc updates README.md - Updated docs on: - The `np_format_items_with_indenters` parameter - The `Numpy{ComplexNumber,Void{}Indenter` types - Note for 'technical details' -> 'indenter types' - Fixed typos - Added named anchors for the notes for more persistent links (instead of '#notes', '#note-1', etc. which are prone to breaking when notes and added and moved) ~[.api].linewrap_collection() Added parameter `np_format_items_with_indenters` and docs therefor commit 850898fe Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 12 21:49:04 2025 +0100 commit ddb2fb2a Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 12 18:13:16 2025 +0100 commit 132ef034 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 12 18:07:28 2025 +0100 commit 3b96ff7d Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 12 17:24:08 2025 +0100 Standalone `np.void` representation pyproject.toml Registered `NumpyVoidIndenter` under `project.entry-points.polyethylene.repr_indenter_getters` (entry point used by `~[.plugins].get_repr_indenter()`, `~[.api].linewrap_repr()`, etc.) ~._numbers.get_indenter() Added more metadata ~._numpy.NumpyVoidIndenter New indenter for standalone `np.void` objects ~._numpy.DataTypeIndenter.create_child_indenters() Fixed typo in error message ~.tests.test_numpy.test_{numpy_void_formatting,recursive_void}() New tests commit 93d26eb2 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 12 05:58:42 2025 +0100 commit 7f382404 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 12 01:08:29 2025 +0100 `numpy`-numeric-type formatting pyproject.toml Registered `~._numpy.NumpyComplexNumberIndenter` to `~._numbers.get_indenter()` via entry point ~._numbers.ComplexNumberIndenter Refactored internal method for generating representations ~._numpy.NumpyComplexNumberIndenter New subtype of the above specifically for generating representations for standalone `np.number` and `np.bool_` instances ~.constants.NORMALIZABLE_NAMES Registered normalization of `np.bool_` ('numpy.bool' -> 'numpy.bool_') ~.tests.test_numpy test_complex_structured_dtype_evaluability() Refactored to use `~.tests.utils.build_param_resolution_test()` test_type_preservation_in_structured_types() Added `.can_eval` checks since representations of standalone `numpy` numerals are now properly handled test_numpy_{bool,int,[long_]{float,complex}}_formatting() New tests for the representation or standalone `numpy` numerals ~.tests.utils.build_param_resolution_test() Added to `~~.__all__` commit ff08e6b3 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 11 20:35:18 2025 +0100 Handling of unstructured `np.void` types ~._numpy.NDimensionalArrayIndenter Added handling of unstructured `np.void` types to the internal indenter type handling void objects ~.tests.test_numpy.test_unstructured_dtype_evaluability() New test for the above commit 56a67140 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 11 19:14:45 2025 +0100 commit 243c1dba Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 11 17:26:13 2025 +0100 Various fixes in `~._numpy` ~~.NDimensionalArrayIndenter can_eval Fixed bug where shaped field in structured types impairs evaluation of evaluability (fixes broken subtest in `~.tests.test_numpy .test_complex_structured_dtype_evaluability()`) <Others> Fixed handling of `np.datetime64` fields in structured data types (so that they are formatted as in the array `repr()`) ~.tests.test_numpy.test_datetime_in_structured_data_types() New test for the `datetime64` fix commit 29d741aa Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 11 17:13:28 2025 +0100 commit def67ce8 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 11 16:33:59 2025 +0100 Complex data type handling in `~._numpy` ~~.DataTypeIndenter Fixed bugs when formatting structured void types where: - Shaped fields are not accounted for - Nested structures result in error ~~.NDimensionalArrayIndenter Fixed internal type used thereby for formatting structured data types: - Added doctest thereto - Now directly formatting `np.void` items (with `numpy`-native fields) instead of casting them into Python objects with `.item()` first - Fixed handling of shaped fields ~.tests.test_numpy.test_complex_structured_dtype_formatting() ~.tests.test_numpy.test_complex_structured_dtype_evaluability() ~.tests.test_numpy.test_type_preservation_in_structured_types() New tests for the above commit d33345e7 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 11 15:48:51 2025 +0100 commit 3bcd8aac Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 11 00:01:56 2025 +0100 Various fixes ~._numpy NDimensionalArrayIndenter.np_format_items_with_indenters Fixed bug where the aliases 'int' and 'int_kind' include `np.timedelta64` <Others> Fixed type hints of `.get_indenter_class()` of some internal indenter classes ~._type_hierarchy.TypeHierarchy.types Now pruning dead references to GC-ed types, which resulted in the type hierarchy being polluted by `None` ~._resolved_value.resolve_from_mapping(key=None) Changed order of attribute access on the internal `TypeHierarchy` so that the above doesn't result in inconsistencies commit 19f379c4 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Mon Feb 10 20:04:17 2025 +0100 More consistent alias resolution ~._resolved_value.ResolvedDescriptor.default_fset() Improved the resolution of aliases for mappings: - Between an alias and the alias target, prioritize the alias target - Between a broader alias and a narrower alias, prioritize the narrower alias ~.tests.test_misc.test_type_checking_type_classification() Test for the above commit 2dd4746d Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Sun Feb 9 04:22:52 2025 +0100 Added tools for debugging ~._debug_tools New internal submodule for debugging tools ~~.DebugAttributeAccessMeta New metaclass for tracking attribute access commit e3b41bf9 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Sun Feb 9 07:00:11 2025 +0100 commit 0c5704ad Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Sun Feb 9 04:48:36 2025 +0100 commit 2c60e31f Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Fri Feb 7 12:47:30 2025 +0100 commit eb609f15 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 5 16:24:16 2025 +0100 commit 35b52a58 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 5 14:28:21 2025 +0100 commit 4c43b1f7 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 4 19:24:00 2025 +0100 Removed type qualifiers for `numpy` array items ~~.NDimensionalArrayIndenter.create_child_indenters() - Fixed bug where the items of item-container arrays are not properly formatted with indenters - If `.np_format_items_with_indenters` resolves to true: - Indenters for `numpy`-native (byte) strings, booleans, and numeric types no longer include the '<type_name>(' and ')' affixes; i.e. the `numpy`-native base data types now behave like their `python`-native equivalents (`str`, `bytes`, `bool`, etc.) - If the array is of an integral type (incl. booleans and time deltas) and a `number_format` is specified, the `dtype` is always shown since float-like formatting options can obscure the data type ~._numbers.ComplexNumberIndenter _BaseTypes, _get_type_cast_toolbox() New (internal) hooks so that the above can be implemented ~.tests.test_numpy test_indenter_based_{numeric,string}_item_formatting() New tests for handling of item formatting when `.np_format_items_with_indenters` is true test_item_container_array() Fixed erroneous test: `object()` is not evaluable test_np_format_items_with_indenters_resolution() New test for resolution of `np_format_items_with_indenters` commit 08474682 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 4 17:26:01 2025 +0100 commit 6e02c873 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 4 16:55:37 2025 +0100 Various fixes in `~._numpy` - Fixed bug where attempting to retrieve the signature of `np.set_printoptions()` when `numpy` is not available results in an import-time error - Suppressed `DeprecationWarning` emitted (conversion of abstract `numpy` types like `np.integer` to `np.dtype`s deprecated) when setting up aliases for `~~.NDimensionalArrayIndenter.np_format_items_with_indenters` commit 2965e354 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 4 16:26:53 2025 +0100 WIP: `~._numpy`: customizable item formatting ~~.NDimensionalArrayIndenter __doc__ Updated np_format_items_with_indenters New parameter/resolved descriptor ~.constants.DEFAULTS['np_format_items_with_indenters'] New constant commit b202e0ae Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 4 14:04:29 2025 +0100 commit 2f7a2ae3 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 4 13:19:47 2025 +0100 New tests in `~.tests.test_numpy` for edge cases ~~.NDimensionalArrayIndenter .{get_indenter_class,create_child_indenters}() Fixed bug where item-container arrays of structured `np.void` is not referred to the appropriate `Indenter` subclass and does not have proper recursion handling ~~.DataTypeIndenter.create_child_indenters() Fixed formatting of data types corresponding to structured `np.void` types ~~.test_structured_dtype_formatting() ~~.test_recursive_array_with_structured_type() New tests for the above fixes ~~.test_recursive_array() ~~.test_indirect_recursive_array() Now checking against the array `repr()`s commit a9ff230f Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 4 12:55:20 2025 +0100 commit 529be1ae Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Jan 22 11:12:13 2025 +0100 Insulation against `np` print options ~._{collections,numpy}.NDimensionalArrayIndenter Now insulated against `np.[set_]printoptions()` so that array items are always formatted in a `repr()`-friendly form ~.tests.test_numpy.test_formatter_insulation() Test for the above ~.utils.strip_affixes() Migrated from private helper function in `~.api` commit af6371d2 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Jan 22 08:12:37 2025 +0100 Minor fixes in `~._numpy` ~.__version__ Bumped to 0.10.0 ~~.DataTypeIndenter .is_structured New descriptor <Others> Fixed internal method used for determining the short representation of an `np.dtype` (currently not used due to the availability of a curresponding `np` internal method) ~.tests.test_numpy.test_dtype_{abbr,implcation}_emulation() New tests to ensure that the vanilla implmentations of `DataTypeIndenter` methods are consistent with their `np` equivalents, as long as they are available
Terence Tsang authoredcommit eff25c5d Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 12 23:09:01 2025 +0100 commit 2508facf Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 12 23:06:38 2025 +0100 commit 242ec2ea Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 12 22:44:31 2025 +0100 commit a402e7fb Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 12 22:23:12 2025 +0100 Doc updates README.md - Updated docs on: - The `np_format_items_with_indenters` parameter - The `Numpy{ComplexNumber,Void{}Indenter` types - Note for 'technical details' -> 'indenter types' - Fixed typos - Added named anchors for the notes for more persistent links (instead of '#notes', '#note-1', etc. which are prone to breaking when notes and added and moved) ~[.api].linewrap_collection() Added parameter `np_format_items_with_indenters` and docs therefor commit 850898fe Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 12 21:49:04 2025 +0100 commit ddb2fb2a Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 12 18:13:16 2025 +0100 commit 132ef034 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 12 18:07:28 2025 +0100 commit 3b96ff7d Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 12 17:24:08 2025 +0100 Standalone `np.void` representation pyproject.toml Registered `NumpyVoidIndenter` under `project.entry-points.polyethylene.repr_indenter_getters` (entry point used by `~[.plugins].get_repr_indenter()`, `~[.api].linewrap_repr()`, etc.) ~._numbers.get_indenter() Added more metadata ~._numpy.NumpyVoidIndenter New indenter for standalone `np.void` objects ~._numpy.DataTypeIndenter.create_child_indenters() Fixed typo in error message ~.tests.test_numpy.test_{numpy_void_formatting,recursive_void}() New tests commit 93d26eb2 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 12 05:58:42 2025 +0100 commit 7f382404 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 12 01:08:29 2025 +0100 `numpy`-numeric-type formatting pyproject.toml Registered `~._numpy.NumpyComplexNumberIndenter` to `~._numbers.get_indenter()` via entry point ~._numbers.ComplexNumberIndenter Refactored internal method for generating representations ~._numpy.NumpyComplexNumberIndenter New subtype of the above specifically for generating representations for standalone `np.number` and `np.bool_` instances ~.constants.NORMALIZABLE_NAMES Registered normalization of `np.bool_` ('numpy.bool' -> 'numpy.bool_') ~.tests.test_numpy test_complex_structured_dtype_evaluability() Refactored to use `~.tests.utils.build_param_resolution_test()` test_type_preservation_in_structured_types() Added `.can_eval` checks since representations of standalone `numpy` numerals are now properly handled test_numpy_{bool,int,[long_]{float,complex}}_formatting() New tests for the representation or standalone `numpy` numerals ~.tests.utils.build_param_resolution_test() Added to `~~.__all__` commit ff08e6b3 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 11 20:35:18 2025 +0100 Handling of unstructured `np.void` types ~._numpy.NDimensionalArrayIndenter Added handling of unstructured `np.void` types to the internal indenter type handling void objects ~.tests.test_numpy.test_unstructured_dtype_evaluability() New test for the above commit 56a67140 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 11 19:14:45 2025 +0100 commit 243c1dba Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 11 17:26:13 2025 +0100 Various fixes in `~._numpy` ~~.NDimensionalArrayIndenter can_eval Fixed bug where shaped field in structured types impairs evaluation of evaluability (fixes broken subtest in `~.tests.test_numpy .test_complex_structured_dtype_evaluability()`) <Others> Fixed handling of `np.datetime64` fields in structured data types (so that they are formatted as in the array `repr()`) ~.tests.test_numpy.test_datetime_in_structured_data_types() New test for the `datetime64` fix commit 29d741aa Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 11 17:13:28 2025 +0100 commit def67ce8 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 11 16:33:59 2025 +0100 Complex data type handling in `~._numpy` ~~.DataTypeIndenter Fixed bugs when formatting structured void types where: - Shaped fields are not accounted for - Nested structures result in error ~~.NDimensionalArrayIndenter Fixed internal type used thereby for formatting structured data types: - Added doctest thereto - Now directly formatting `np.void` items (with `numpy`-native fields) instead of casting them into Python objects with `.item()` first - Fixed handling of shaped fields ~.tests.test_numpy.test_complex_structured_dtype_formatting() ~.tests.test_numpy.test_complex_structured_dtype_evaluability() ~.tests.test_numpy.test_type_preservation_in_structured_types() New tests for the above commit d33345e7 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 11 15:48:51 2025 +0100 commit 3bcd8aac Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 11 00:01:56 2025 +0100 Various fixes ~._numpy NDimensionalArrayIndenter.np_format_items_with_indenters Fixed bug where the aliases 'int' and 'int_kind' include `np.timedelta64` <Others> Fixed type hints of `.get_indenter_class()` of some internal indenter classes ~._type_hierarchy.TypeHierarchy.types Now pruning dead references to GC-ed types, which resulted in the type hierarchy being polluted by `None` ~._resolved_value.resolve_from_mapping(key=None) Changed order of attribute access on the internal `TypeHierarchy` so that the above doesn't result in inconsistencies commit 19f379c4 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Mon Feb 10 20:04:17 2025 +0100 More consistent alias resolution ~._resolved_value.ResolvedDescriptor.default_fset() Improved the resolution of aliases for mappings: - Between an alias and the alias target, prioritize the alias target - Between a broader alias and a narrower alias, prioritize the narrower alias ~.tests.test_misc.test_type_checking_type_classification() Test for the above commit 2dd4746d Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Sun Feb 9 04:22:52 2025 +0100 Added tools for debugging ~._debug_tools New internal submodule for debugging tools ~~.DebugAttributeAccessMeta New metaclass for tracking attribute access commit e3b41bf9 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Sun Feb 9 07:00:11 2025 +0100 commit 0c5704ad Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Sun Feb 9 04:48:36 2025 +0100 commit 2c60e31f Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Fri Feb 7 12:47:30 2025 +0100 commit eb609f15 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 5 16:24:16 2025 +0100 commit 35b52a58 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Feb 5 14:28:21 2025 +0100 commit 4c43b1f7 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 4 19:24:00 2025 +0100 Removed type qualifiers for `numpy` array items ~~.NDimensionalArrayIndenter.create_child_indenters() - Fixed bug where the items of item-container arrays are not properly formatted with indenters - If `.np_format_items_with_indenters` resolves to true: - Indenters for `numpy`-native (byte) strings, booleans, and numeric types no longer include the '<type_name>(' and ')' affixes; i.e. the `numpy`-native base data types now behave like their `python`-native equivalents (`str`, `bytes`, `bool`, etc.) - If the array is of an integral type (incl. booleans and time deltas) and a `number_format` is specified, the `dtype` is always shown since float-like formatting options can obscure the data type ~._numbers.ComplexNumberIndenter _BaseTypes, _get_type_cast_toolbox() New (internal) hooks so that the above can be implemented ~.tests.test_numpy test_indenter_based_{numeric,string}_item_formatting() New tests for handling of item formatting when `.np_format_items_with_indenters` is true test_item_container_array() Fixed erroneous test: `object()` is not evaluable test_np_format_items_with_indenters_resolution() New test for resolution of `np_format_items_with_indenters` commit 08474682 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 4 17:26:01 2025 +0100 commit 6e02c873 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 4 16:55:37 2025 +0100 Various fixes in `~._numpy` - Fixed bug where attempting to retrieve the signature of `np.set_printoptions()` when `numpy` is not available results in an import-time error - Suppressed `DeprecationWarning` emitted (conversion of abstract `numpy` types like `np.integer` to `np.dtype`s deprecated) when setting up aliases for `~~.NDimensionalArrayIndenter.np_format_items_with_indenters` commit 2965e354 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 4 16:26:53 2025 +0100 WIP: `~._numpy`: customizable item formatting ~~.NDimensionalArrayIndenter __doc__ Updated np_format_items_with_indenters New parameter/resolved descriptor ~.constants.DEFAULTS['np_format_items_with_indenters'] New constant commit b202e0ae Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 4 14:04:29 2025 +0100 commit 2f7a2ae3 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 4 13:19:47 2025 +0100 New tests in `~.tests.test_numpy` for edge cases ~~.NDimensionalArrayIndenter .{get_indenter_class,create_child_indenters}() Fixed bug where item-container arrays of structured `np.void` is not referred to the appropriate `Indenter` subclass and does not have proper recursion handling ~~.DataTypeIndenter.create_child_indenters() Fixed formatting of data types corresponding to structured `np.void` types ~~.test_structured_dtype_formatting() ~~.test_recursive_array_with_structured_type() New tests for the above fixes ~~.test_recursive_array() ~~.test_indirect_recursive_array() Now checking against the array `repr()`s commit a9ff230f Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Tue Feb 4 12:55:20 2025 +0100 commit 529be1ae Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Jan 22 11:12:13 2025 +0100 Insulation against `np` print options ~._{collections,numpy}.NDimensionalArrayIndenter Now insulated against `np.[set_]printoptions()` so that array items are always formatted in a `repr()`-friendly form ~.tests.test_numpy.test_formatter_insulation() Test for the above ~.utils.strip_affixes() Migrated from private helper function in `~.api` commit af6371d2 Author: Terence S.-C. Tsang <t.tsang.sci@gmail.com> Date: Wed Jan 22 08:12:37 2025 +0100 Minor fixes in `~._numpy` ~.__version__ Bumped to 0.10.0 ~~.DataTypeIndenter .is_structured New descriptor <Others> Fixed internal method used for determining the short representation of an `np.dtype` (currently not used due to the availability of a curresponding `np` internal method) ~.tests.test_numpy.test_dtype_{abbr,implcation}_emulation() New tests to ensure that the vanilla implmentations of `DataTypeIndenter` methods are consistent with their `np` equivalents, as long as they are available
Loading