From 4c8e2c3d47f34a2f4ca8e921b360b15d8c6c88c3 Mon Sep 17 00:00:00 2001 From: Dinesh Yeduguru Date: Tue, 5 Nov 2024 11:39:57 -0800 Subject: [PATCH] linter fix --- llama_stack/providers/utils/kvstore/config.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/llama_stack/providers/utils/kvstore/config.py b/llama_stack/providers/utils/kvstore/config.py index 5829650d6..b2f56b885 100644 --- a/llama_stack/providers/utils/kvstore/config.py +++ b/llama_stack/providers/utils/kvstore/config.py @@ -4,12 +4,12 @@ # This source code is licensed under the terms described in the LICENSE file in # the root directory of this source tree. +import re from enum import Enum from typing import Literal, Optional, Union from pydantic import BaseModel, Field, field_validator from typing_extensions import Annotated -import re from llama_stack.distribution.utils.config_dirs import RUNTIME_BASE_DIR @@ -54,17 +54,19 @@ class PostgresKVStoreConfig(CommonConfig): password: Optional[str] = None table_name: str = "llamastack_kvstore" - @field_validator('table_name') - def validate_table_name(cls, v: str) -> str: + @field_validator("table_name") + def validate_table_name(self, v: str) -> str: # PostgreSQL identifiers rules: # - Must start with a letter or underscore # - Can contain letters, numbers, and underscores # - Maximum length is 63 bytes - pattern = r'^[a-zA-Z_][a-zA-Z0-9_]*$' + pattern = r"^[a-zA-Z_][a-zA-Z0-9_]*$" if not re.match(pattern, v): - raise ValueError('Invalid table name. Must start with letter or underscore and contain only letters, numbers, and underscores') + raise ValueError( + "Invalid table name. Must start with letter or underscore and contain only letters, numbers, and underscores" + ) if len(v) > 63: - raise ValueError('Table name must be less than 63 characters') + raise ValueError("Table name must be less than 63 characters") return v