Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ click-plugins = "^1.1.1"
cli = ["click", "click_plugins"]

[tool.poetry.group.dev.dependencies]
pydantic-openapi-helper = "^1.0.2"
pydantic-openapi-helper = "^1.0.4"
coverage = ">=6"
coveralls = ">=3"
pytest = ">=6.2.4"
Expand Down
15 changes: 10 additions & 5 deletions queenbee/base/basemodel.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Queenbee utility functions."""
import hashlib
import json
from typing import List, Union, Dict, Any
from typing import List, Dict, Any, Optional

import yaml
from pydantic import BaseModel as PydanticBaseModel
Expand Down Expand Up @@ -150,14 +149,20 @@ def _referenced_values(self, var_names: List[str]) -> Dict[str, List[str]]:
class BaseModel(BaseModelNoType):
"""BaseModel with functionality to return the object as a yaml string."""

type: str = Field('BaseModel', pattern='^BaseModel$')
type: str = Field(default='BaseModel', pattern='^BaseModel$')

annotations: Dict[str, Any] = Field(
annotations: Optional[Dict[str, Any]] = Field(
default_factory=dict,
description='An optional dictionary to add annotations to inputs. These '
'annotations will be used by the client side libraries.'
'annotations will be used by the client side libraries.',
validate_default=True
)

@field_validator('annotations', mode='before')
@classmethod
def convert_none_to_empty_dict(cls, v):
return v if v is not None else {}

@field_validator('type')
@classmethod
def ensure_type_match(cls, v: str) -> str:
Expand Down
1 change: 0 additions & 1 deletion queenbee/base/request.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import pathlib
import platform
from urllib import request
from typing import Dict

Expand Down
5 changes: 0 additions & 5 deletions queenbee/cli/config/view.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import os
import shutil

from pydantic import ValidationError

try:
import click
from click_plugins import with_plugins
Expand Down
2 changes: 1 addition & 1 deletion queenbee/cli/plugin/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def lint(path):
try:
op = Plugin.from_folder(path)
obj = op.to_dict()
Plugin.parse_obj(obj)
Plugin.model_validate(obj)
except ValidationError as error:
raise click.ClickException(error)
except FileNotFoundError as error:
Expand Down
4 changes: 1 addition & 3 deletions queenbee/cli/recipe/link.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import os
import shutil

from pydantic import ValidationError

from ...recipe import Recipe, BakedRecipe
from ...recipe import Recipe

try:
import click
Expand Down
2 changes: 1 addition & 1 deletion queenbee/cli/recipe/lint.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

from pydantic import ValidationError
from ...recipe import Recipe, BakedRecipe
from ...recipe import BakedRecipe

try:
import click
Expand Down
2 changes: 1 addition & 1 deletion queenbee/cli/recipe/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pydantic import ValidationError

from ...recipe import Recipe, BakedRecipe
from ...recipe import BakedRecipe
from ...repository import PackageVersion

try:
Expand Down
5 changes: 4 additions & 1 deletion queenbee/cli/repository/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ def index(path, index_path, new, force, skip):
if new:
repo_index = RepositoryIndex.from_folder(path)
else:
repo_index = RepositoryIndex.parse_file(index_path)
with open(index_path, 'r') as f:
content = f.read()
repo_index = RepositoryIndex.model_validate_json(content)

repo_index.merge_folder(path, force, skip)
except ValueError as error:
raise click.ClickException(error)
Expand Down
2 changes: 0 additions & 2 deletions queenbee/cli/repository/manage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import json

try:
Expand All @@ -10,7 +9,6 @@
)

from ...config.repositories import RepositoryReference
from ...repository.index import RepositoryIndex, RepositoryMetadata


@click.command('add')
Expand Down
4 changes: 0 additions & 4 deletions queenbee/cli/repository/search.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import os
import json
from urllib.parse import urlparse

try:
import click
Expand All @@ -10,8 +8,6 @@
'click modules not installed. Try `pip install queenbee[cli]` command.'
)

from ...config.repositories import RepositoryReference


@click.command('search')
@click.option('-r', '--repository', help='Only search within the named repository')
Expand Down
4 changes: 2 additions & 2 deletions queenbee/io/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def parameter_unique_names(cls, v: List[Any]) -> List[Any]:
if not hasattr(io, 'alias') or not io.alias:
# function inputs/outputs
return v
for alias in io['alias']:
for alias in io.alias:
for platform in alias.platform:
platforms.append(platform)

Expand All @@ -246,7 +246,7 @@ def parameter_unique_names(cls, v: List[Any]) -> List[Any]:
# no alias use the original name
names.append(io.name)
continue
for alias in io['alias']:
for alias in io.alias:
if platform in alias.platform:
names.append(alias.name)
break
Expand Down
Loading