diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fb0c43fd7e..6d89c2124a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: exclude: ^source/3rdparty - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.15.8 + rev: v0.15.9 hooks: - id: ruff args: ["--fix"] diff --git a/deepmd/tf/env.py b/deepmd/tf/env.py index 8fc14a61a9..1fd08ecdf7 100644 --- a/deepmd/tf/env.py +++ b/deepmd/tf/env.py @@ -138,7 +138,7 @@ def filter(self, record: logging.LogRecord) -> bool: # \3: layer index # The rest: types of neighbor atoms # IMPORTANT: the order is critical to match the pattern -EMBEDDING_NET_PATTERN = str( +EMBEDDING_NET_PATTERN = ( r"filter_type_(\d+)/(matrix)_(\d+)_(\d+)|" r"filter_type_(\d+)/(bias)_(\d+)_(\d+)|" r"filter_type_(\d+)/(idt)_(\d+)_(\d+)|" @@ -157,7 +157,7 @@ def filter(self, record: logging.LogRecord) -> bool: # \1: layer index or "final" # \2: type of centeral atom, optional # the last: weight name -FITTING_NET_PATTERN = str( +FITTING_NET_PATTERN = ( r"layer_(\d+)/(matrix)|" r"layer_(\d+)_type_(\d+)/(matrix)|" r"layer_(\d+)/(bias)|" @@ -182,13 +182,13 @@ def filter(self, record: logging.LogRecord) -> bool: # subpatterns: # \1: weight name # \2: layer index -TYPE_EMBEDDING_PATTERN = str( +TYPE_EMBEDDING_PATTERN = ( r"type_embed_net/(matrix)_(\d+)|" r"type_embed_net/(bias)_(\d+)|" r"type_embed_net/(idt)_(\d+)|" )[:-1] -ATTENTION_LAYER_PATTERN = str( +ATTENTION_LAYER_PATTERN = ( r"attention_layer_(\d+)/(c_query)/(matrix)|" r"attention_layer_(\d+)/(c_query)/(bias)|" r"attention_layer_(\d+)/(c_key)/(matrix)|" @@ -207,7 +207,7 @@ def filter(self, record: logging.LogRecord) -> bool: EMBEDDING_NET_PATTERN + FITTING_NET_PATTERN + TYPE_EMBEDDING_PATTERN - + str( + + ( r"descrpt_attr/t_avg|" r"descrpt_attr/t_std|" r"fitting_attr/t_fparam_avg|"