From 2ea3b05bdec8d86288cdd7ce6d1903a1dd4ec54c Mon Sep 17 00:00:00 2001 From: Brandon Butler Date: Tue, 17 May 2022 11:15:52 -0400 Subject: [PATCH 01/11] fix: Adding non-default loggables explicitly. Now `hoomd.logging.Logger.add` will add non-default loggables when explicitly asked. --- hoomd/logging.py | 12 ++++++++---- hoomd/pytest/test_logging.py | 13 ++++++++----- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/hoomd/logging.py b/hoomd/logging.py index f2f43d936e..b948c43422 100644 --- a/hoomd/logging.py +++ b/hoomd/logging.py @@ -624,12 +624,16 @@ def only_default(self): quantities.""" return self._only_default - def _filter_quantities(self, quantities): + def _filter_quantities(self, quantities, force_quantities=False): for quantity in quantities: - if self._only_default and not quantity.default: + if quantity.category not in self._categories: continue - elif quantity.category in self._categories: + # Must be before default check to overwrite _only_default + if force_quantities: yield quantity + if self._only_default and not quantity.default: + continue + yield quantity def _get_loggables_by_name(self, obj, quantities): if quantities is None: @@ -643,7 +647,7 @@ def _get_loggables_by_name(self, obj, quantities): "object {} has not loggable quantities {}.".format( obj, bad_keys)) yield from self._filter_quantities( - map(lambda q: obj._export_dict[q], quantities)) + map(lambda q: obj._export_dict[q], quantities), True) def add(self, obj, quantities=None, user_name=None): """Add loggables from obj to logger. diff --git a/hoomd/pytest/test_logging.py b/hoomd/pytest/test_logging.py index 64c07f2142..cf5a1ba41e 100644 --- a/hoomd/pytest/test_logging.py +++ b/hoomd/pytest/test_logging.py @@ -56,6 +56,10 @@ def prop(self): def proplist(self): return [1, 2, 3] + @log(category="string", default=False) + def prop_nondefault(self): + return "foo" + def __eq__(self, other): return isinstance(other, type(self)) @@ -242,7 +246,7 @@ def test_get_loggables_by_names(self, blank_logger, logged_obj): ]) # Check when quantities is given - accepted_quantities = ['prop', 'proplist'] + accepted_quantities = ['proplist', "prop_nondefault"] log_quanities = blank_logger._get_loggables_by_name( logged_obj, accepted_quantities) assert all([ @@ -275,10 +279,9 @@ def test_add(self, blank_logger, logged_obj, base_namespace): # Test multiple quantities blank_logger._dict = dict() - blank_logger.add(logged_obj, ['prop', 'proplist']) - expected_namespaces = [ - base_namespace + ('prop',), base_namespace + ('proplist',) - ] + loggables = ['prop', 'proplist', "prop_nondefault"] + blank_logger.add(logged_obj, loggables) + expected_namespaces = [base_namespace + (name,) for name in loggables] assert all([ns in blank_logger for ns in expected_namespaces]) assert len(blank_logger) == 2 From 6047864f431b92e0e4c72b411c94350e6faedd50 Mon Sep 17 00:00:00 2001 From: Brandon Butler Date: Mon, 23 May 2022 12:03:24 -0400 Subject: [PATCH 02/11] refactor: Remove redundent test code line. Just renamed a fixture. --- hoomd/pytest/test_logging.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/hoomd/pytest/test_logging.py b/hoomd/pytest/test_logging.py index cf5a1ba41e..49ad7a222b 100644 --- a/hoomd/pytest/test_logging.py +++ b/hoomd/pytest/test_logging.py @@ -214,15 +214,14 @@ def base_namespace(): class TestLogger: def test_setitem(self, blank_logger): - logger = blank_logger - logger['a'] = (5, '__eq__', 'scalar') - logger[('b', 'c')] = (5, '__eq__', 'scalar') - logger['c'] = (lambda: [1, 2, 3], 'sequence') + blank_logger['a'] = (5, '__eq__', 'scalar') + blank_logger[('b', 'c')] = (5, '__eq__', 'scalar') + blank_logger['c'] = (lambda: [1, 2, 3], 'sequence') for value in [dict(), list(), None, 5, (5, 2), (5, 2, 1)]: with raises(ValueError): - logger[('c', 'd')] = value + blank_logger[('c', 'd')] = value with raises(KeyError): - logger['a'] = (lambda: [1, 2, 3], 'sequence') + blank_logger['a'] = (lambda: [1, 2, 3], 'sequence') def test_add_single_quantity(self, blank_logger, log_quantity): blank_logger._add_single_quantity(None, log_quantity, None) From 8538562ce2a144063eb5d1f04f44e2e7e94beccc Mon Sep 17 00:00:00 2001 From: Brandon Butler Date: Mon, 23 May 2022 14:42:10 -0400 Subject: [PATCH 03/11] fix: Don't repeat items in Logger._filter_quantities --- hoomd/logging.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hoomd/logging.py b/hoomd/logging.py index b948c43422..c68b1b8fe6 100644 --- a/hoomd/logging.py +++ b/hoomd/logging.py @@ -629,11 +629,8 @@ def _filter_quantities(self, quantities, force_quantities=False): if quantity.category not in self._categories: continue # Must be before default check to overwrite _only_default - if force_quantities: + if not self._only_default or quantity.default or force_quantities: yield quantity - if self._only_default and not quantity.default: - continue - yield quantity def _get_loggables_by_name(self, obj, quantities): if quantities is None: From 020a5bc4a8b33a894ca3ed3a2b55ec86df2fdfa8 Mon Sep 17 00:00:00 2001 From: Brandon Butler Date: Mon, 23 May 2022 14:43:23 -0400 Subject: [PATCH 04/11] fix: Raise ValueError with Logger.__setitem__ and incompatible category --- hoomd/logging.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hoomd/logging.py b/hoomd/logging.py index c68b1b8fe6..101acc845a 100644 --- a/hoomd/logging.py +++ b/hoomd/logging.py @@ -728,10 +728,12 @@ def __setitem__(self, namespace, value): name and category. If using a method it should not take arguments or have defaults for all arguments. """ - if isinstance(value, _LoggerEntry): - super().__setitem__(namespace, value) - else: - super().__setitem__(namespace, _LoggerEntry.from_tuple(value)) + if not isinstance(value, _LoggerEntry): + value = _LoggerEntry.from_tuple(value) + if value.category not in self.categories: + raise ValueError( + "User specified loggable is not of an accepted category.") + super().__setitem__(namespace, value) def __iadd__(self, obj): """Add quantities from object or list of objects to logger. From e1c05bead6b9ba92fc6d9b94057268f891cf7ca8 Mon Sep 17 00:00:00 2001 From: Brandon Butler Date: Mon, 23 May 2022 14:46:21 -0400 Subject: [PATCH 05/11] test: Improve and refactor Logger testing * Test multiple constructor arguments in Logger * Add some additional checks to existing tests --- hoomd/pytest/test_logging.py | 188 ++++++++++++++++++++++------------- 1 file changed, 119 insertions(+), 69 deletions(-) diff --git a/hoomd/pytest/test_logging.py b/hoomd/pytest/test_logging.py index 49ad7a222b..7710b2a7fa 100644 --- a/hoomd/pytest/test_logging.py +++ b/hoomd/pytest/test_logging.py @@ -2,7 +2,7 @@ # Part of HOOMD-blue, released under the BSD 3-Clause License. from hoomd.conftest import pickling_check -from pytest import raises, fixture +from pytest import raises, fixture, mark from hoomd.logging import (_LoggerQuantity, _SafeNamespaceDict, Logger, dict_map, Loggable, LoggerCategories, log) @@ -85,7 +85,7 @@ def propnotinherented(self): not_dummy_loggable_inher = NotInherentedDummy def test_logger_functor_application(self): - loggable_list = ['prop', 'proplist'] + loggable_list = ['prop', 'proplist', "prop_nondefault"] assert set( self.dummy_loggable._export_dict.keys()) == set(loggable_list) expected_namespace = _LoggerQuantity._generate_namespace( @@ -113,7 +113,11 @@ def test_loggable_inherentence(self): def test_loggables(self): dummy_obj = self.dummy_loggable() - assert dummy_obj.loggables == {'prop': 'scalar', 'proplist': 'sequence'} + assert dummy_obj.loggables == { + 'prop': 'scalar', + 'proplist': 'sequence', + 'prop_nondefault': 'string' + } # ------- Test dict_map function @@ -191,9 +195,21 @@ def test_len(self, namespace_dict, blank_namespace_dict): # ------ Test Logger -@fixture -def blank_logger(): - return Logger() +@fixture(params=( + {}, + { + "only_default": False + }, + { + "categories": ("scalar", "string") + }, + { + "only_default": False, + "categories": ("scalar",) + }, +)) +def blank_logger(request): + return Logger(**request.param) @fixture @@ -211,19 +227,54 @@ def base_namespace(): return ('pytest', 'test_logging', 'DummyLoggable') +def nested_getitem(obj, namespace): + for k in namespace: + obj = obj[k] + return obj + + class TestLogger: + def get_filter(self, logger, overwrite_default=False): + + def filter(loggable): + with_default = not logger.only_default or loggable.default + return (loggable.category in logger.categories + and (with_default or overwrite_default)) + + return filter + def test_setitem(self, blank_logger): - blank_logger['a'] = (5, '__eq__', 'scalar') - blank_logger[('b', 'c')] = (5, '__eq__', 'scalar') - blank_logger['c'] = (lambda: [1, 2, 3], 'sequence') + + def check(logger, namespace, loggable): + if LoggerCategories[loggable[-1]] not in logger.categories: + with raises(ValueError): + logger[namespace] = loggable + return + logger[namespace] = loggable + assert namespace in logger + log_quantity = nested_getitem(logger, namespace) + assert log_quantity.obj == loggable[0] + if len(loggable) == 3: + assert log_quantity.attr == loggable[1] + assert log_quantity.category == LoggerCategories[loggable[-1]] + + # Valid values with potentially incompatible categories + check(blank_logger, 'a', (5, '__eq__', 'scalar')) + check(blank_logger, ('b', 'c'), (5, '__eq__', 'scalar')) + check(blank_logger, 'c', (lambda: [1, 2, 3], 'sequence')) + # Invalid values for value in [dict(), list(), None, 5, (5, 2), (5, 2, 1)]: with raises(ValueError): blank_logger[('c', 'd')] = value + # Existent key + extant_key = next(iter(blank_logger.keys())) + # Requires that scalar category accepted or raises a ValueError with raises(KeyError): - blank_logger['a'] = (lambda: [1, 2, 3], 'sequence') + blank_logger[extant_key] = (lambda: 1, 'scalar') def test_add_single_quantity(self, blank_logger, log_quantity): + # Assumes "scalar" is always accepted blank_logger._add_single_quantity(None, log_quantity, None) namespace = log_quantity.namespace + (log_quantity.name,) assert namespace in blank_logger @@ -238,19 +289,33 @@ def test_add_single_quantity(self, blank_logger, log_quantity): def test_get_loggables_by_names(self, blank_logger, logged_obj): # Check when quantities is None - log_quanities = blank_logger._get_loggables_by_name(logged_obj, None) - logged_names = ['prop', 'proplist'] + log_quantities = list( + blank_logger._get_loggables_by_name(logged_obj, None)) + log_filter = self.get_filter(blank_logger) + logged_names = [ + loggable.name + for loggable in logged_obj._export_dict.values() + if log_filter(loggable) + ] + assert len(log_quantities) == len(logged_names) assert all([ - log_quantity.name in logged_names for log_quantity in log_quanities + log_quantity.name in logged_names for log_quantity in log_quantities ]) # Check when quantities is given accepted_quantities = ['proplist', "prop_nondefault"] - log_quanities = blank_logger._get_loggables_by_name( - logged_obj, accepted_quantities) + log_filter = self.get_filter(blank_logger, overwrite_default=True) + log_quantities = list( + blank_logger._get_loggables_by_name(logged_obj, + accepted_quantities)) + logged_names = [ + loggable.name + for loggable in logged_obj._export_dict.values() + if loggable.name in accepted_quantities and log_filter(loggable) + ] + assert len(log_quantities) == len(logged_names) assert all([ - log_quantity.name in accepted_quantities - for log_quantity in log_quanities + log_quantity.name in logged_names for log_quantity in log_quantities ]) # Check when quantities has a bad value @@ -259,59 +324,38 @@ def test_get_loggables_by_names(self, blank_logger, logged_obj): a = blank_logger._get_loggables_by_name(logged_obj, bad_quantities) list(a) - def test_add(self, blank_logger, logged_obj, base_namespace): + @mark.parametrize("quantities", ([], [ + "prop", + ], ['prop', 'proplist', "prop_nondefault"])) + def test_add(self, blank_logger, logged_obj, base_namespace, quantities): + + if len(quantities) != 0: + blank_logger.add(logged_obj, quantities) + log_filter = self.get_filter(blank_logger, overwrite_default=True) + else: + blank_logger.add(logged_obj) + log_filter = self.get_filter(blank_logger) - # Test adding everything - blank_logger.add(logged_obj) expected_namespaces = [ - base_namespace + ('prop',), base_namespace + ('proplist',) + base_namespace + (loggable.name,) + for loggable in logged_obj._export_dict.values() + if log_filter(loggable) ] + if len(quantities) != 0: + expected_namespaces = [ + name for name in expected_namespaces + if any(name[-1] in q for q in quantities) + ] assert all(ns in blank_logger for ns in expected_namespaces) - assert len(blank_logger) == 2 + assert len(blank_logger) == len(expected_namespaces) - # Test adding specific quantity - blank_logger._dict = dict() - blank_logger.add(logged_obj, 'prop') - expected_namespace = base_namespace + ('prop',) - assert expected_namespace in blank_logger - assert len(blank_logger) == 1 - - # Test multiple quantities - blank_logger._dict = dict() - loggables = ['prop', 'proplist', "prop_nondefault"] - blank_logger.add(logged_obj, loggables) - expected_namespaces = [base_namespace + (name,) for name in loggables] - assert all([ns in blank_logger for ns in expected_namespaces]) - assert len(blank_logger) == 2 - - # Test with category - blank_logger._dict = dict() - blank_logger._categories = LoggerCategories['scalar'] - blank_logger.add(logged_obj) - expected_namespace = base_namespace + ('prop',) - assert expected_namespace in blank_logger - assert len(blank_logger) == 1 - - def test_add_with_user_names(self, blank_logger, logged_obj, - base_namespace): + def test_add_with_user_names(self, logged_obj, base_namespace): + logger = Logger() # Test adding a user specified identifier into the namespace user_name = 'UserName' - blank_logger.add(logged_obj, user_name=user_name) - assert base_namespace[:-1] + (user_name, 'prop') in blank_logger - assert base_namespace[:-1] + (user_name, 'proplist') in blank_logger - - def test_add_with_categories(self, blank_logger, logged_obj, - base_namespace): - blank_logger._categories = LoggerCategories['scalar'] - # Test adding everything should filter non-scalar - blank_logger.add(logged_obj) - expected_namespace = base_namespace + ('prop',) - assert expected_namespace in blank_logger - blank_logger._categories = LoggerCategories['sequence'] - expected_namespace = base_namespace + ('proplist',) - blank_logger.add(logged_obj) - assert expected_namespace in blank_logger - assert len(blank_logger) == 2 + logger.add(logged_obj, user_name=user_name) + assert base_namespace[:-1] + (user_name, 'prop') in logger + assert base_namespace[:-1] + (user_name, 'proplist') in logger def test_remove(self, logged_obj, base_namespace): @@ -361,13 +405,13 @@ def test_remove(self, logged_obj, base_namespace): assert prop_namespace[:-2] + (prop_namespace[-2] + '_1', prop_namespace[-1]) not in log - def test_remove_with_user_name(self, blank_logger, logged_obj, - base_namespace): + def test_remove_with_user_name(self, logged_obj, base_namespace): # Test remove using a user specified namespace identifier + logger = Logger() user_name = 'UserName' - blank_logger.add(logged_obj, user_name=user_name) - assert base_namespace[:-1] + (user_name, 'prop') in blank_logger - assert base_namespace[:-1] + (user_name, 'proplist') in blank_logger + logger.add(logged_obj, user_name=user_name) + assert base_namespace[:-1] + (user_name, 'prop') in logger + assert base_namespace[:-1] + (user_name, 'proplist') in logger def test_iadd(self, blank_logger, logged_obj): blank_logger.add(logged_obj) @@ -375,7 +419,13 @@ def test_iadd(self, blank_logger, logged_obj): blank_logger._dict = dict() blank_logger += logged_obj assert add_log == blank_logger._dict - assert len(blank_logger) == 2 + log_filter = self.get_filter(blank_logger) + expected_loggables = [ + loggable.name + for loggable in logged_obj._export_dict.values() + if log_filter(loggable) + ] + assert len(blank_logger) == len(expected_loggables) def test_isub(self, logged_obj, base_namespace): From 642583ff21d90b3028c59c60f1a15c8df398cef4 Mon Sep 17 00:00:00 2001 From: Brandon Butler Date: Tue, 24 May 2022 13:41:39 -0400 Subject: [PATCH 06/11] test: Update Table writer tests with new Logger error --- hoomd/pytest/test_table.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hoomd/pytest/test_table.py b/hoomd/pytest/test_table.py index d67cc3731a..5806436f08 100644 --- a/hoomd/pytest/test_table.py +++ b/hoomd/pytest/test_table.py @@ -32,7 +32,7 @@ def __eq__(self, other): @pytest.fixture def logger(): - logger = hoomd.logging.Logger(categories=['scalar']) + logger = hoomd.logging.Logger(categories=['scalar', "string"]) logger[('dummy', 'loggable', 'int')] = (Identity(42000000), 'scalar') logger[('dummy', 'loggable', 'float')] = (Identity(3.1415), 'scalar') logger[('dummy', 'loggable', 'string')] = (Identity("foobarbaz"), 'string') From 3aa807c6942e07039d7c4a68ab4aa4f298689eba Mon Sep 17 00:00:00 2001 From: Corwin Kerr Date: Thu, 26 May 2022 23:23:34 -0400 Subject: [PATCH 07/11] Propose clarification of docstrings --- hoomd/logging.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/hoomd/logging.py b/hoomd/logging.py index 101acc845a..eb3b4b2cb4 100644 --- a/hoomd/logging.py +++ b/hoomd/logging.py @@ -568,9 +568,9 @@ class they come from. For instance, the `hoomd.md.pair.LJ` class has a ``categories`` determines what if any types of loggable quantities (see `LoggerCategories`) are appropriate for a given `Logger` object. This helps logging backends determine if a `Logger` object is compatible. The - ``only_default`` flag is mainly a convenience by allowing quantities not - commonly logged (but available) to be passed over unless explicitly asked - for. You can override the ``only_default`` flag by explicitly listing the + ``only_default`` flag affects performance by controlling whether available + quantities not commonly logged are skipped (the default) or logged. + You can override the ``only_default`` flag by explicitly listing the quantities you want in `add`, but the same is not true with regards to ``categories``. @@ -595,9 +595,8 @@ class they come from. For instance, the `hoomd.md.pair.LJ` class has a the only types of loggable quantities that can be logged by this logger. Defaults to allowing every type. only_default (`bool`, optional): Whether to log only quantities that are - logged by "default", defaults to ``True``. This mostly means that - performance centric loggable quantities will be passed over when - logging when false. + logged by "default". Defaults to ``True``. If ``False``, loggable + quantities that would slow performance are not be logged. """ def __init__(self, categories=None, only_default=True): From 35311f729854f8aa144c4fe4153bb7c17976c88b Mon Sep 17 00:00:00 2001 From: Brandon Butler Date: Fri, 27 May 2022 11:29:45 -0400 Subject: [PATCH 08/11] doc: Clarity only_default in Logger --- hoomd/logging.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/hoomd/logging.py b/hoomd/logging.py index eb3b4b2cb4..aa83ffab21 100644 --- a/hoomd/logging.py +++ b/hoomd/logging.py @@ -568,11 +568,12 @@ class they come from. For instance, the `hoomd.md.pair.LJ` class has a ``categories`` determines what if any types of loggable quantities (see `LoggerCategories`) are appropriate for a given `Logger` object. This helps logging backends determine if a `Logger` object is compatible. The - ``only_default`` flag affects performance by controlling whether available - quantities not commonly logged are skipped (the default) or logged. - You can override the ``only_default`` flag by explicitly listing the - quantities you want in `add`, but the same is not true with regards - to ``categories``. + ``only_default`` flag determines whether generally undesired quantities + (e.g. performance measures) are logged when using `Logger.__iadd__` and + `Logger.add` without specifying quantities. In `Logger.add`, you can + override the ``only_default`` flag by explicitly listing the quantities you + want to add. On the other hand, ``categories`` is rigidly obeyed as it is a + promise to logging backends. Note: The logger provides a way for users to create their own logger back @@ -595,8 +596,9 @@ class they come from. For instance, the `hoomd.md.pair.LJ` class has a the only types of loggable quantities that can be logged by this logger. Defaults to allowing every type. only_default (`bool`, optional): Whether to log only quantities that are - logged by "default". Defaults to ``True``. If ``False``, loggable - quantities that would slow performance are not be logged. + logged by _default_. Defaults to ``True``. Non-default quantities + are typically measures of operation performance rather than + information about simulation state. """ def __init__(self, categories=None, only_default=True): From 3d8b208b4de63a6a9f80d097c6612f19c52e3a6c Mon Sep 17 00:00:00 2001 From: Corwin Kerr Date: Tue, 31 May 2022 10:36:17 -0400 Subject: [PATCH 09/11] Add example of what only_default excludes plus grammar fixes --- hoomd/logging.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/hoomd/logging.py b/hoomd/logging.py index aa83ffab21..5fd23252e4 100644 --- a/hoomd/logging.py +++ b/hoomd/logging.py @@ -383,23 +383,23 @@ def log(func=None, loggable quantity, defaults to 'scalar'. See `LoggerCategories` for available types. Keyword only argument. default (`bool`, optional): Whether the quantity should be logged - by default, defaults to True. This is orthogonal to the loggable - quantity's type. An example would be performance orientated loggable - quantities. Many users may not want to log such quantities even - when logging other quantities of that type. The default category - allows for these to be pass over by `Logger` objects by default. - Keyword only argument. + by default. Defaults to True. This is orthogonal to the loggable + quantity's type. Many users may not want to log such quantities even + when logging other quantities of that type. An example would be + performance orientated loggable quantities, like the number of + neighborlist builds. The `default` argument allows for these to be + skipped by `Logger` objects by default. Keyword only argument. requires_run (`bool`, optional): Whether this property requires the simulation to run before being accessible. Note: The namespace (where the loggable object is stored in the `Logger` - object's nested dictionary, is determined by the module/script and class + object's nested dictionary) is determined by the module/script and class name the loggable class comes from. In creating subclasses of `hoomd.custom.Action`, for instance, if the module the subclass is defined in is ``user.custom.action`` and the class name is ``Foo`` then the namespace used will be ``('user', 'custom', 'action', 'Foo')``. This - helps to prevent naming conflicts, and automate the logging + helps to prevent naming conflicts and automates the logging specification for developers and users. Example:: @@ -563,14 +563,14 @@ class they come from. For instance, the `hoomd.md.pair.LJ` class has a `Logger` objects support two ways of discriminating what loggable quantities they will accept: ``categories`` and ``only_default`` (the constructor - arguments). Both of these are static meaning that once instantiated a + arguments). Both of these are static, meaning that once instantiated, a `Logger` object will not change the values of these two properties. - ``categories`` determines what if any types of loggable quantities (see + ``categories`` determines what types of loggable quantities (see `LoggerCategories`) are appropriate for a given `Logger` object. This helps logging backends determine if a `Logger` object is compatible. The - ``only_default`` flag determines whether generally undesired quantities - (e.g. performance measures) are logged when using `Logger.__iadd__` and - `Logger.add` without specifying quantities. In `Logger.add`, you can + ``only_default`` flag prevents rarely-used quantities (e.g. the number of + neighborlist builds) from being added to the logger when using `Logger.__iadd__` + and `Logger.add` without specifying them explicitly. In `Logger.add`, you can override the ``only_default`` flag by explicitly listing the quantities you want to add. On the other hand, ``categories`` is rigidly obeyed as it is a promise to logging backends. @@ -596,7 +596,7 @@ class they come from. For instance, the `hoomd.md.pair.LJ` class has a the only types of loggable quantities that can be logged by this logger. Defaults to allowing every type. only_default (`bool`, optional): Whether to log only quantities that are - logged by _default_. Defaults to ``True``. Non-default quantities + logged by default. Defaults to ``True``. Non-default quantities are typically measures of operation performance rather than information about simulation state. """ From 05a3429e0a1106b69dfe9f9cebe0a447e1a69ccc Mon Sep 17 00:00:00 2001 From: Corwin Kerr Date: Tue, 31 May 2022 11:29:22 -0400 Subject: [PATCH 10/11] Reflow text --- hoomd/logging.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hoomd/logging.py b/hoomd/logging.py index 5fd23252e4..56d2dc6d47 100644 --- a/hoomd/logging.py +++ b/hoomd/logging.py @@ -569,11 +569,11 @@ class they come from. For instance, the `hoomd.md.pair.LJ` class has a `LoggerCategories`) are appropriate for a given `Logger` object. This helps logging backends determine if a `Logger` object is compatible. The ``only_default`` flag prevents rarely-used quantities (e.g. the number of - neighborlist builds) from being added to the logger when using `Logger.__iadd__` - and `Logger.add` without specifying them explicitly. In `Logger.add`, you can - override the ``only_default`` flag by explicitly listing the quantities you - want to add. On the other hand, ``categories`` is rigidly obeyed as it is a - promise to logging backends. + neighborlist builds) from being added to the logger when + using`Logger.__iadd__` and `Logger.add` without specifying them explicitly. + In `Logger.add`, you can override the ``only_default`` flag by explicitly + listing the quantities you want to add. On the other hand, ``categories`` is + rigidly obeyed as it is a promise to logging backends. Note: The logger provides a way for users to create their own logger back From 292e382bd2ff6c27d59ca611589add2126ef8308 Mon Sep 17 00:00:00 2001 From: Brandon Butler Date: Tue, 31 May 2022 12:20:16 -0400 Subject: [PATCH 11/11] doc: Explicitly set language to "en" (English) --- sphinx-doc/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx-doc/conf.py b/sphinx-doc/conf.py index 7f690582a5..fe5791e40c 100644 --- a/sphinx-doc/conf.py +++ b/sphinx-doc/conf.py @@ -59,7 +59,7 @@ version = '3.1.0' release = '3.1.0' -language = None +language = "en" default_role = 'any'