From a47821e1cbd353c250ec827c9c4cf3b7614ce152 Mon Sep 17 00:00:00 2001 From: AdrianSosic Date: Wed, 13 Nov 2024 10:43:49 +0100 Subject: [PATCH] Fix spelling of (de-)serialization and (un-)structuring --- CHANGELOG.md | 6 +++--- README.md | 2 +- baybe/acquisition/base.py | 2 +- baybe/campaign.py | 2 +- baybe/kernels/base.py | 2 +- baybe/objectives/base.py | 2 +- baybe/priors/base.py | 2 +- baybe/serialization/core.py | 2 +- baybe/surrogates/gaussian_process/kernel_factory.py | 2 +- docs/userguide/campaigns.md | 2 +- docs/userguide/constraints.md | 2 +- docs/userguide/recommenders.md | 2 +- docs/userguide/serialization.md | 2 +- examples/Serialization/Serialization_Header.md | 2 +- 14 files changed, 16 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a081030f0..4c4218970 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -301,7 +301,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Simulation no longer fails for targets in `MATCH` mode - `closest_element` now works for array-like input of all kinds - Structuring concrete subclasses no longer requires providing an explicit `type` field -- `_target(s)` attributes of `Objectives` are now de-/serialized without leading +- `_target(s)` attributes of `Objectives` are now (de-)serialized without leading underscore to support user-friendly serialization strings - Telemetry does not execute any code if it was disabled - Running simulations no longer alters the states of the global random number generators @@ -439,7 +439,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `mypy` for targets and intervals - Tests for code blocks in README and user guides - `hypothesis` strategies and roundtrip tests for targets, intervals, and dataframes -- De-/serialization of target subclasses via base class +- (De-)serialization of target subclasses via base class - Docs building check now part of CI - Automatic formatting checks for code examples in documentation - Deserialization of classes with classmethod constructors can now be customized @@ -464,7 +464,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Use pydoclint as flake8 plugin and not as a stand-alone linter - Margins in documentation for desktop and mobile version - `Interval`s can now also be deserialized from a bounds iterable -- `SubspaceDiscrete` and `SubspaceContinuous` now have de-/serialization methods +- `SubspaceDiscrete` and `SubspaceContinuous` now have (de-)serialization methods ### Removed - Conda install instructions and version badge diff --git a/README.md b/README.md index 18f179d72..6a339f902 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Besides functionality to perform a typical recommend-measure loop, BayBE's highl - ⚙️ Custom surrogate models: Enhance your predictions through mechanistic understanding - 📈 Comprehensive backtest, simulation and imputation utilities: Benchmark and find your best settings - 📝 Fully typed and hypothesis-tested: Robust code base -- 🔄 All objects are fully de-/serializable: Useful for storing results in databases or use in wrappers like APIs +- 🔄 All objects are fully (de-)serializable: Useful for storing results in databases or use in wrappers like APIs ## ⚡ Quick Start diff --git a/baybe/acquisition/base.py b/baybe/acquisition/base.py index 410a308e0..09b907c00 100644 --- a/baybe/acquisition/base.py +++ b/baybe/acquisition/base.py @@ -159,7 +159,7 @@ def _get_botorch_acqf_class( ) -# Register de-/serialization hooks +# Register (un-)structure hooks def _add_deprecation_hook(hook): """Add deprecation warnings to the default hook. diff --git a/baybe/campaign.py b/baybe/campaign.py index 07b3faa86..0b3e8a6b7 100644 --- a/baybe/campaign.py +++ b/baybe/campaign.py @@ -482,7 +482,7 @@ def _drop_version(dict_: dict) -> dict: return dict_ -# Register de-/serialization hooks +# Register (un-)structure hooks unstructure_hook = cattrs.gen.make_dict_unstructure_fn( Campaign, converter, _cattrs_include_init_false=True ) diff --git a/baybe/kernels/base.py b/baybe/kernels/base.py index 2686829a8..9cb190ae2 100644 --- a/baybe/kernels/base.py +++ b/baybe/kernels/base.py @@ -125,7 +125,7 @@ class CompositeKernel(Kernel, ABC): """Abstract base class for all composite kernels.""" -# Register de-/serialization hooks +# Register (un-)structure hooks converter.register_structure_hook(Kernel, get_base_structure_hook(Kernel)) converter.register_unstructure_hook(Kernel, unstructure_base) diff --git a/baybe/objectives/base.py b/baybe/objectives/base.py index 375bb7b55..3ba307ba0 100644 --- a/baybe/objectives/base.py +++ b/baybe/objectives/base.py @@ -60,7 +60,7 @@ def to_objective(x: Target | Objective, /) -> Objective: return x if isinstance(x, Objective) else x.to_objective() -# Register de-/serialization hooks +# Register (un-)structure hooks converter.register_structure_hook(Objective, structure_objective) converter.register_unstructure_hook( Objective, diff --git a/baybe/priors/base.py b/baybe/priors/base.py index a7f203c1e..9c0a2e90c 100644 --- a/baybe/priors/base.py +++ b/baybe/priors/base.py @@ -39,7 +39,7 @@ def to_gpytorch(self, *args, **kwargs): return prior_cls(*args, **kwargs) -# Register de-/serialization hooks +# Register (un-)structure hooks converter.register_structure_hook(Prior, get_base_structure_hook(Prior)) converter.register_unstructure_hook(Prior, unstructure_base) diff --git a/baybe/serialization/core.py b/baybe/serialization/core.py index e3e53f052..8c18262c6 100644 --- a/baybe/serialization/core.py +++ b/baybe/serialization/core.py @@ -161,7 +161,7 @@ def select_constructor_hook(specs: dict, cls: type[_T]) -> _T: return converter.structure_attrs_fromdict(specs, cls) -# Register custom un-/structure hooks +# Register custom (un-)structure hooks converter.register_unstructure_hook(pd.DataFrame, _unstructure_dataframe_hook) converter.register_structure_hook(pd.DataFrame, _structure_dataframe_hook) converter.register_unstructure_hook(datetime, lambda x: x.isoformat()) diff --git a/baybe/surrogates/gaussian_process/kernel_factory.py b/baybe/surrogates/gaussian_process/kernel_factory.py index 9ac08a44e..315ba1709 100644 --- a/baybe/surrogates/gaussian_process/kernel_factory.py +++ b/baybe/surrogates/gaussian_process/kernel_factory.py @@ -32,7 +32,7 @@ def __call__( ... -# Register de-/serialization hooks +# Register (un-)structure hooks converter.register_structure_hook(KernelFactory, get_base_structure_hook(KernelFactory)) converter.register_unstructure_hook(KernelFactory, unstructure_base) diff --git a/docs/userguide/campaigns.md b/docs/userguide/campaigns.md index 19535f6c7..faa3dd5fd 100644 --- a/docs/userguide/campaigns.md +++ b/docs/userguide/campaigns.md @@ -161,7 +161,7 @@ This requirement can be disabled using the method's ## Serialization -Like other BayBE objects, [`Campaigns`](baybe.campaign.Campaign) can be de-/serialized +Like other BayBE objects, [`Campaigns`](baybe.campaign.Campaign) can be (de-)serialized using their [`from_json`](baybe.serialization.mixin.SerialMixin.from_json)/ [`to_json`](baybe.serialization.mixin.SerialMixin.to_json) methods, which allow to convert between Python objects and their corresponding representation in JSON diff --git a/docs/userguide/constraints.md b/docs/userguide/constraints.md index 7212fcaa2..61fff3e71 100644 --- a/docs/userguide/constraints.md +++ b/docs/userguide/constraints.md @@ -402,7 +402,7 @@ Find a detailed example [here](../../examples/Constraints_Discrete/custom_constr ```{warning} Due to the arbitrary nature of code and dependencies that can be used in the -`DiscreteCustomConstraint`, de-/serializability cannot be guaranteed. As a consequence, +`DiscreteCustomConstraint`, (de-)serializability cannot be guaranteed. As a consequence, using a `DiscreteCustomConstraint` results in an error if you attempt to serialize the corresponding object or higher-level objects containing it. ``` \ No newline at end of file diff --git a/docs/userguide/recommenders.md b/docs/userguide/recommenders.md index bff60ce68..351c25d8e 100644 --- a/docs/userguide/recommenders.md +++ b/docs/userguide/recommenders.md @@ -125,7 +125,7 @@ recommender = TwoPhaseMetaRecommender( enables the utilization of *arbitrary* iterables to select recommender. ```{warning} - Due to the arbitrary nature of iterables that can be used, de-/serializability cannot + Due to the arbitrary nature of iterables that can be used, (de-)serializability cannot be guaranteed. As a consequence, using a `StreamingSequentialMetaRecommender` results in an error if you attempt to serialize the corresponding object or higher-level objects containing it. diff --git a/docs/userguide/serialization.md b/docs/userguide/serialization.md index 6f96a31de..2f7e7aee7 100644 --- a/docs/userguide/serialization.md +++ b/docs/userguide/serialization.md @@ -22,7 +22,7 @@ i.e., reassembling the corresponding Python object from its serialization string ``` (JSON_SERIALIZATION)= -## JSON de-/serialization +## JSON (de-)serialization Most BayBE objects can be conveniently serialized into an equivalent JSON representation by calling their {meth}`to_json ` method. diff --git a/examples/Serialization/Serialization_Header.md b/examples/Serialization/Serialization_Header.md index 1c8b26b28..f841b8039 100644 --- a/examples/Serialization/Serialization_Header.md +++ b/examples/Serialization/Serialization_Header.md @@ -1,3 +1,3 @@ # Serialization -These examples demonstrate BayBE's de-/serialization capabilities. \ No newline at end of file +These examples demonstrate BayBE's (de-)serialization capabilities. \ No newline at end of file