Skip to content

Commit

Permalink
removed a deprecated import from pydantic
Browse files Browse the repository at this point in the history
  • Loading branch information
maxme1 committed May 30, 2024
1 parent fd55592 commit 7032bb6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bev/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.11.4"
__version__ = "0.11.5"
10 changes: 6 additions & 4 deletions bev/config/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import yaml
from jboc import collect
from paramiko.config import SSHConfig
from pydantic import validator
from pytimeparse.timeparse import timeparse
from tarn import S3, SCP, SFTP, DiskDict, Fanout, Level, Levels, Location, Nginx, RedisLocation, SmallLocation
from tarn.config import CONFIG_NAME as STORAGE_CONFIG_NAME, StorageConfig as TarnStorageConfig
Expand Down Expand Up @@ -100,7 +99,10 @@ class LevelsConfig(LocationConfig):
@collect
def _from_location(cls, vs):
for v in vs:
if (isinstance(v, dict) and set(v) <= {'location', 'write', 'replicate', 'touch'}) or isinstance(v, LevelConfig):
if (
(isinstance(v, dict) and set(v) <= {'location', 'write', 'replicate', 'touch'}) or
isinstance(v, LevelConfig)
):
yield v
else:
yield {'location': v}
Expand Down Expand Up @@ -241,7 +243,7 @@ def build(self) -> Optional[Location]:
raise ValueError(f'The time format could not be parsed: {self.ttl}')
else:
ttl = self.ttl
return RedisLocation(self.url, prefix=self.prefix, keep_labels=self.keep_labels,
return RedisLocation(self.url, prefix=self.prefix, keep_labels=self.keep_labels,
keep_usage=self.keep_usage, ttl=ttl)


Expand All @@ -250,7 +252,7 @@ class SmallConfig(LocationConfig):
location: LocationConfig
max_size: int

@validator('max_size', pre=True)
@field_validator('max_size', mode='before')
def _from_str(cls, v):
if isinstance(v, str):
return humanfriendly.parse_size(v)
Expand Down

0 comments on commit 7032bb6

Please sign in to comment.