feat: key executives

This commit is contained in:
montezdesousa
2024-02-12 11:38:51 +00:00
parent 3cd7a4d169
commit aad97cd9ea
5 changed files with 12 additions and 23 deletions

View File

@@ -1,6 +1,6 @@
"""Key Executives Standard Model."""
from typing import List, Optional, Set, Union
from typing import Optional
from pydantic import Field, field_validator
@@ -16,11 +16,9 @@ class KeyExecutivesQueryParams(QueryParams):
@field_validator("symbol", mode="before", check_fields=False)
@classmethod
def upper_symbol(cls, v: Union[str, List[str], Set[str]]):
def upper_symbol(cls, v: str) -> str:
"""Convert symbol to uppercase."""
if isinstance(v, str):
return v.upper()
return ",".join([symbol.upper() for symbol in list(v)])
return v.upper()
class KeyExecutivesData(Data):

View File

@@ -5,8 +5,7 @@ from typing import Optional
def check_single(field: str, value: Optional[str]) -> Optional[str]:
"""Check that string is a single value."""
if value:
if "," in value or ";" in value:
if value and ("," in value or ";" in value):
raise ValueError(f"multiple values not allowed for field '{field}'")
return value