A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pydantic/pydantic/issues/1298 below:

issubclass() arg 1 must be a class · Issue #1298 · pydantic/pydantic · GitHub

Bug

Getting issubcluss error on /docs in Fastapi

Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())":

             pydantic version: 1.4
            pydantic compiled: False
                 install path: /Users/philippk/anaconda3/envs/py37/lib/python3.7/site-packages/pydantic
               python version: 3.7.3 | packaged by conda-forge | (default, Dec  6 2019, 08:36:57)  [Clang 9.0.0 (tags/RELEASE_900/final)]
                     platform: Darwin-19.2.0-x86_64-i386-64bit
     optional deps. installed: ['typing-extensions']
(py37) ZG00021:se-sestimate philippk$ docker run -it -p 80:80 -e ENVKEY -e SNOWFLAKE_PASSWORD='dummy' -e SNOWFLAKE_ACCOUNT='zillow' -e SNOWFLAKE_USER='philippk' -e SNOWFLAKE_WAREHOUSE='LOOKER_WH' -e SNOWFLAKE_DATABASE='FEATURESTORE' -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN -e AWS_SECURITY_TOKEN --entrypoint /bin/bash se-sestimate:local-api
root@d50a194c1238:/app# python -c "import pydantic.utils; print(pydantic.utils.version_info())"
             pydantic version: 1.4
            pydantic compiled: True
                 install path: /usr/local/lib/python3.7/site-packages/pydantic
               python version: 3.7.4 (default, Sep 12 2019, 15:40:15)  [GCC 8.3.0]
                     platform: Linux-4.19.76-linuxkit-x86_64-with-debian-10.1
     optional deps. installed: []

Here is the code of request_models:

from typing import List
from pydantic import BaseModel
from enum import Enum
from datetime import date


class ModelName(str, Enum):
    repeated_sale = "repeated_sale"
    main = "main"
    dummy = "dummy"


class Inference(BaseModel):
    price: int
    model: ModelName
    model_version: float
    date: date

@app.get("/infer", response_model=Inference)
def infer(
    params: dict,
    model: ModelName,
    v: Optional[float] = None,
    date: Optional["date"] = None,
) -> Inference:
    """attempts to pull predictions from snowflake"""
    result = app.model_registry.pull(model=model, v=v, date=date).predict(params)
    return {"model": model, "v": v, **result}

this results in:

  File "/Users/philippk/anaconda3/envs/py37/lib/python3.7/site-packages/pydantic/schema.py", line 657, in field_singleton_schema
    if issubclass(field_type, Enum):
TypeError: issubclass() arg 1 must be a class

Kilo59, daviskirk, BunnyMan1, hmalphettes, data-djinn and 4 more


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4