after_merge
stringlengths
28
79.6k
before_merge
stringlengths
20
79.6k
url
stringlengths
38
71
full_traceback
stringlengths
43
922k
traceback_type
stringclasses
555 values
def set_length_validator(cls, v: "Optional[Set[T]]") -> "Optional[Set[T]]": if v is None: return None v = set_validator(v) v_len = len(v) if cls.min_items is not None and v_len < cls.min_items: raise errors.SetMinLengthError(limit_value=cls.min_items) if cls.max_items is not None ...
def set_length_validator( cls, v: "Optional[Set[T]]", field: "ModelField" ) -> "Optional[Set[T]]": v = set_validator(v) v_len = len(v) if cls.min_items is not None and v_len < cls.min_items: raise errors.SetMinLengthError(limit_value=cls.min_items) if cls.max_items is not None and v_len > ...
https://github.com/samuelcolvin/pydantic/issues/2320
Info model set: network_segments=None Info model conset: network_segments=None Info settings set: network_segments=None Traceback (most recent call last): File "/home/mihai/bug.py", line 25, in <module> print(f"Info settings conset: {InfoSettingsConset()}") File "pydantic/env_settings.py", line 34, in pydantic.env_set...
pydantic.error_wrappers.ValidationError
def __new__(mcs, name, bases, namespace, **kwargs): # noqa C901 fields: Dict[str, ModelField] = {} config = BaseConfig validators: "ValidatorListDict" = {} pre_root_validators, post_root_validators = [], [] private_attributes: Dict[str, ModelPrivateAttr] = {} slots: SetStr = namespace.get("__s...
def __new__(mcs, name, bases, namespace, **kwargs): # noqa C901 fields: Dict[str, ModelField] = {} config = BaseConfig validators: "ValidatorListDict" = {} pre_root_validators, post_root_validators = [], [] private_attributes: Dict[str, ModelPrivateAttr] = {} slots: SetStr = namespace.get("__s...
https://github.com/samuelcolvin/pydantic/issues/1943
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "main.py", line 5, in init main class MyModel(BaseModel): File "pydantic/main.py", line 285, in pydantic.main.ModelMetaclass.__new__ File "pydantic/fields.py", line 309, in pydantic.fields.ModelField.infer File "pydantic/fields.py", line 271, i...
RuntimeError
def _type_analysis(self) -> None: # noqa: C901 (ignore complexity) # typing interface is horrible, we have to do some ugly checks if lenient_issubclass(self.type_, JsonWrapper): self.type_ = self.type_.inner_type self.parse_json = True elif lenient_issubclass(self.type_, Json): self...
def _type_analysis(self) -> None: # noqa: C901 (ignore complexity) # typing interface is horrible, we have to do some ugly checks if lenient_issubclass(self.type_, JsonWrapper): self.type_ = self.type_.inner_type self.parse_json = True elif lenient_issubclass(self.type_, Json): self...
https://github.com/samuelcolvin/pydantic/issues/2318
Traceback (most recent call last): File "pydantic/validators.py", line 615, in pydantic.validators.find_validators TypeError: issubclass() arg 1 must be a class During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "...", line 1...
TypeError
def __init__(self, function: "AnyCallableT", config: "ConfigType"): # noqa C901 from inspect import Parameter, signature parameters: Mapping[str, Parameter] = signature(function).parameters if parameters.keys() & { ALT_V_ARGS, ALT_V_KWARGS, V_POSITIONAL_ONLY_NAME, V_DUPLIC...
def __init__(self, function: "AnyCallableT", config: "ConfigType"): # noqa C901 from inspect import Parameter, signature parameters: Mapping[str, Parameter] = signature(function).parameters if parameters.keys() & {ALT_V_ARGS, ALT_V_KWARGS, V_POSITIONAL_ONLY_NAME}: raise ConfigError( f...
https://github.com/samuelcolvin/pydantic/issues/2249
from pydantic import validate_arguments @validate_arguments def foo(x: int): print(x) def bar(x: int): print(x) foo(1) 1 foo(1, x=2) 2 bar(1) 1 bar(1, x=2) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: bar() got multiple values for argument 'x'
TypeError
def build_values(self, args: Tuple[Any, ...], kwargs: Dict[str, Any]) -> Dict[str, Any]: values: Dict[str, Any] = {} if args: arg_iter = enumerate(args) while True: try: i, a = next(arg_iter) except StopIteration: break arg_name...
def build_values(self, args: Tuple[Any, ...], kwargs: Dict[str, Any]) -> Dict[str, Any]: values: Dict[str, Any] = {} if args: arg_iter = enumerate(args) while True: try: i, a = next(arg_iter) except StopIteration: break arg_name...
https://github.com/samuelcolvin/pydantic/issues/2249
from pydantic import validate_arguments @validate_arguments def foo(x: int): print(x) def bar(x: int): print(x) foo(1) 1 foo(1, x=2) 2 bar(1) 1 bar(1, x=2) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: bar() got multiple values for argument 'x'
TypeError
def create_model( self, fields: Dict[str, Any], takes_args: bool, takes_kwargs: bool, config: "ConfigType", ) -> None: pos_args = len(self.arg_mapping) class CustomConfig: pass if not TYPE_CHECKING: # pragma: no branch if isinstance(config, dict): CustomCon...
def create_model( self, fields: Dict[str, Any], takes_args: bool, takes_kwargs: bool, config: "ConfigType", ) -> None: pos_args = len(self.arg_mapping) class CustomConfig: pass if not TYPE_CHECKING: # pragma: no branch if isinstance(config, dict): CustomCon...
https://github.com/samuelcolvin/pydantic/issues/2249
from pydantic import validate_arguments @validate_arguments def foo(x: int): print(x) def bar(x: int): print(x) foo(1) 1 foo(1, x=2) 2 bar(1) 1 bar(1, x=2) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: bar() got multiple values for argument 'x'
TypeError
def __new__(mcs, name, bases, namespace, **kwargs): # noqa C901 fields: Dict[str, ModelField] = {} config = BaseConfig validators: "ValidatorListDict" = {} pre_root_validators, post_root_validators = [], [] private_attributes: Dict[str, ModelPrivateAttr] = {} slots: Set[str] = namespace.get("_...
def __new__(mcs, name, bases, namespace, **kwargs): # noqa C901 fields: Dict[str, ModelField] = {} config = BaseConfig validators: "ValidatorListDict" = {} pre_root_validators, post_root_validators = [], [] private_attributes: Dict[str, ModelPrivateAttr] = {} slots: Set[str] = namespace.get("_...
https://github.com/samuelcolvin/pydantic/issues/2086
from pydantic import BaseModel, Field from typing import Callable class Foo(BaseModel): ... # without default value, getting user warning ... callback: Callable[[], dict] ... Foo.schema() __main__:1: UserWarning: Callable callback was excluded from schema since JSON schema has no equivalent type. {'title': 'Foo...
TypeError
def get_field_info_schema(field: ModelField) -> Tuple[Dict[str, Any], bool]: schema_overrides = False # If no title is explicitly set, we don't set title in the schema for enums. # The behaviour is the same as `BaseModel` reference, where the default title # is in the definitions part of the schema. ...
def get_field_info_schema(field: ModelField) -> Tuple[Dict[str, Any], bool]: schema_overrides = False # If no title is explicitly set, we don't set title in the schema for enums. # The behaviour is the same as `BaseModel` reference, where the default title # is in the definitions part of the schema. ...
https://github.com/samuelcolvin/pydantic/issues/2086
from pydantic import BaseModel, Field from typing import Callable class Foo(BaseModel): ... # without default value, getting user warning ... callback: Callable[[], dict] ... Foo.schema() __main__:1: UserWarning: Callable callback was excluded from schema since JSON schema has no equivalent type. {'title': 'Foo...
TypeError
def _process_class( _cls: Type[Any], init: bool, repr: bool, eq: bool, order: bool, unsafe_hash: bool, frozen: bool, config: Optional[Type[Any]], ) -> Type["Dataclass"]: import dataclasses post_init_original = getattr(_cls, "__post_init__", None) if post_init_original and po...
def _process_class( _cls: Type[Any], init: bool, repr: bool, eq: bool, order: bool, unsafe_hash: bool, frozen: bool, config: Optional[Type[Any]], ) -> Type["Dataclass"]: import dataclasses post_init_original = getattr(_cls, "__post_init__", None) if post_init_original and po...
https://github.com/samuelcolvin/pydantic/issues/2111
--------------------------------------------------------------------------- PicklingError Traceback (most recent call last) <ipython-input-14-7d67a44cf353> in <module> 15 16 print(pickle.dumps( ---> 17 PydanticModel(built_in_dataclass=BuiltInDataclass(value=0)) 18 )) PicklingError: Can'...
PicklingError
def _type_analysis(self) -> None: # noqa: C901 (ignore complexity) # typing interface is horrible, we have to do some ugly checks if lenient_issubclass(self.type_, JsonWrapper): self.type_ = self.type_.inner_type self.parse_json = True elif lenient_issubclass(self.type_, Json): self...
def _type_analysis(self) -> None: # noqa: C901 (ignore complexity) # typing interface is horrible, we have to do some ugly checks if lenient_issubclass(self.type_, JsonWrapper): self.type_ = self.type_.inner_type self.parse_json = True elif lenient_issubclass(self.type_, Json): self...
https://github.com/samuelcolvin/pydantic/issues/2132
Traceback (most recent call last): File "pydantic/validators.py", line 615, in pydantic.validators.find_validators TypeError: issubclass() arg 1 must be a class During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<input>", line 2, in <module> File "pydantic/datac...
TypeError
def _validate_sequence_like( # noqa: C901 (ignore complexity) self, v: Any, values: Dict[str, Any], loc: "LocStr", cls: Optional["ModelOrDc"] ) -> "ValidateReturn": """ Validate sequence-like containers: lists, tuples, sets and generators Note that large if-else blocks are necessary to enable Cython ...
def _validate_sequence_like( # noqa: C901 (ignore complexity) self, v: Any, values: Dict[str, Any], loc: "LocStr", cls: Optional["ModelOrDc"] ) -> "ValidateReturn": """ Validate sequence-like containers: lists, tuples, sets and generators Note that large if-else blocks are necessary to enable Cython ...
https://github.com/samuelcolvin/pydantic/issues/2132
Traceback (most recent call last): File "pydantic/validators.py", line 615, in pydantic.validators.find_validators TypeError: issubclass() arg 1 must be a class During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<input>", line 2, in <module> File "pydantic/datac...
TypeError
def is_valid_private_name(name: str) -> bool: return not is_valid_field(name) and name not in { "__annotations__", "__classcell__", "__doc__", "__module__", "__orig_bases__", "__qualname__", }
def is_valid_private_name(name: str) -> bool: return not is_valid_field(name) and name not in { "__annotations__", "__classcell__", "__doc__", "__module__", "__qualname__", }
https://github.com/samuelcolvin/pydantic/issues/2138
TypeError Traceback (most recent call last) <ipython-input-17-86d3af5f0365> in <module> ----> 1 class Model(GenericModel, Generic[T]): 2 class Config: 3 underscore_attrs_are_private = True 4 id: T 5 /nix/store/5mlyrz5jm75dbjd92wsq89b9lsd0bhww-python3-3.7.7-env/lib/python...
TypeError
def make_dataclass_validator( _cls: Type[Any], config: Type["BaseConfig"] ) -> "CallableGenerator": """ Create a pydantic.dataclass from a builtin dataclass to add type validation and yield the validators It retrieves the parameters of the dataclass and forwards them to the newly created dataclass ...
def make_dataclass_validator( _cls: Type[Any], config: Type["BaseConfig"] ) -> "CallableGenerator": """ Create a pydantic.dataclass from a builtin dataclass to add type validation and yield the validators """ cls = dataclass(_cls, config=config) yield from _get_validators(cls)
https://github.com/samuelcolvin/pydantic/issues/2065
Traceback (most recent call last): File "/home/user/debug_pydantic.py", line 11, in <module> class Example(BaseModel): File "pydantic/main.py", line 262, in pydantic.main.ModelMetaclass.__new__ File "pydantic/fields.py", line 315, in pydantic.fields.ModelField.infer File "pydantic/fields.py", line 284, in pydantic.fiel...
TypeError
def _process_class( _cls: Type[Any], init: bool, repr: bool, eq: bool, order: bool, unsafe_hash: bool, frozen: bool, config: Optional[Type[Any]], ) -> Type["Dataclass"]: import dataclasses post_init_original = getattr(_cls, "__post_init__", None) if post_init_original and po...
def _process_class( _cls: Type[Any], init: bool, repr: bool, eq: bool, order: bool, unsafe_hash: bool, frozen: bool, config: Optional[Type[Any]], ) -> Type["Dataclass"]: import dataclasses post_init_original = getattr(_cls, "__post_init__", None) if post_init_original and po...
https://github.com/samuelcolvin/pydantic/issues/2042
Traceback (most recent call last): File "dataclass.py", line 15, in <module> @dataclass File "pydantic/dataclasses.py", line 214, in pydantic.dataclasses.dataclass # name and type are filled in after the fact, not in __init__. File "pydantic/dataclasses.py", line 209, in pydantic.dataclasses.dataclass.wrap File "pydan...
TypeError
def make_dataclass_validator( _cls: Type[Any], config: Type["BaseConfig"] ) -> "CallableGenerator": """ Create a pydantic.dataclass from a builtin dataclass to add type validation and yield the validators """ cls = dataclass(_cls, config=config) yield from _get_validators(cls)
def make_dataclass_validator(_cls: Type[Any], **kwargs: Any) -> "CallableGenerator": """ Create a pydantic.dataclass from a builtin dataclass to add type validation and yield the validators """ cls = dataclass(_cls, **kwargs) yield from _get_validators(cls)
https://github.com/samuelcolvin/pydantic/issues/2042
Traceback (most recent call last): File "dataclass.py", line 15, in <module> @dataclass File "pydantic/dataclasses.py", line 214, in pydantic.dataclasses.dataclass # name and type are filled in after the fact, not in __init__. File "pydantic/dataclasses.py", line 209, in pydantic.dataclasses.dataclass.wrap File "pydan...
TypeError
def find_validators( # noqa: C901 (ignore complexity) type_: Type[Any], config: Type["BaseConfig"] ) -> Generator[AnyCallable, None, None]: from .dataclasses import is_builtin_dataclass, make_dataclass_validator if type_ is Any: return type_type = type_.__class__ if type_type == ForwardRef...
def find_validators( # noqa: C901 (ignore complexity) type_: Type[Any], config: Type["BaseConfig"] ) -> Generator[AnyCallable, None, None]: from .dataclasses import is_builtin_dataclass, make_dataclass_validator if type_ is Any: return type_type = type_.__class__ if type_type == ForwardRef...
https://github.com/samuelcolvin/pydantic/issues/2042
Traceback (most recent call last): File "dataclass.py", line 15, in <module> @dataclass File "pydantic/dataclasses.py", line 214, in pydantic.dataclasses.dataclass # name and type are filled in after the fact, not in __init__. File "pydantic/dataclasses.py", line 209, in pydantic.dataclasses.dataclass.wrap File "pydan...
TypeError
def is_valid_private_name(name: str) -> bool: return not is_valid_field(name) and name not in { "__annotations__", "__classcell__", "__module__", "__qualname__", }
def is_valid_private_name(name: str) -> bool: return not is_valid_field(name) and name not in { "__annotations__", "__module__", "__annotations__", "__qualname__", }
https://github.com/samuelcolvin/pydantic/issues/2047
test.py:4: DeprecationWarning: __class__ not set defining 'TestObject' as <class '__main__.TestObject'>. Was __classcell__ propagated to type.__new__? class TestObject(BaseModel): Traceback (most recent call last): File "test.py", line 15, in <module> print(TestObject(public_field="foo")) File "test.py", line 12, in __...
TypeError
def add_field_type_to_schema(field_type: Any, schema: Dict[str, Any]) -> None: """ Update the given `schema` with the type-specific metadata for the given `field_type`. This function looks through `field_class_to_schema` for a class that matches the given `field_type`, and then modifies the given `sche...
def add_field_type_to_schema(field_type: Any, schema: Dict[str, Any]) -> None: """ Update the given `schema` with the type-specific metadata for the given `field_type`. This function looks through `field_class_to_schema` for a class that matches the given `field_type`, and then modifies the given `sche...
https://github.com/samuelcolvin/pydantic/issues/1767
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-13-c3756917c641> in <module> ----> 1 model_process_schema(Test, model_name_map={}) ~/.cache/pypoetry/virtualenvs/chatbot-py3.6/lib/python3.6/site-packag...
TypeError
def prepare_field(cls, field: ModelField) -> None: env_names: Union[List[str], AbstractSet[str]] field_info_from_config = cls.get_field_info(field.name) env = field_info_from_config.get("env") or field.field_info.extra.get("env") if env is None: if field.has_alias: warnings.warn( ...
def prepare_field(cls, field: ModelField) -> None: env_names: Union[List[str], AbstractSet[str]] env = field.field_info.extra.get("env") if env is None: if field.has_alias: warnings.warn( "aliases are no longer used by BaseSettings to define which environment variables to...
https://github.com/samuelcolvin/pydantic/issues/1561
In [2]: from pydantic import AnyUrl, BaseSettings In [4]: %set_env FOO=7 env: FOO=7 In [9]: class A(BaseSettings): ...: foo : int ...: class Config: ...: env_prefix = 'PREFIX_' ...: fields = { ...: 'foo': {'env': ['FOO', 'PREFIX_FOO'],}, ...: } ...: ...: In [10]: A().foo Out...
ValidationError
def __new__(mcs, name, bases, namespace, **kwargs): # noqa C901 fields: Dict[str, ModelField] = {} config = BaseConfig validators: "ValidatorListDict" = {} fields_defaults: Dict[str, Any] = {} pre_root_validators, post_root_validators = [], [] for base in reversed(bases): if ( ...
def __new__(mcs, name, bases, namespace, **kwargs): # noqa C901 fields: Dict[str, ModelField] = {} config = BaseConfig validators: "ValidatorListDict" = {} fields_defaults: Dict[str, Any] = {} pre_root_validators, post_root_validators = [], [] for base in reversed(bases): if ( ...
https://github.com/samuelcolvin/pydantic/issues/1419
FullArgSpec(args=['self'], varargs=None, varkw=None, defaults=None, kwonlyargs=['foo'], kwonlydefaults=None, annotations={'foo': <class 'str'>}) Traceback (most recent call last): File "/usr/lib/python3.8/inspect.py", line 1123, in getfullargspec sig = _signature_from_callable(func, File "/usr/lib/python3.8/inspect.py"...
TypeError
def __init__(self, name: str, value: Any) -> None: self.name = name self.value = value
def __init__( self, value: Any, items: Union["AbstractSetIntStr", "MappingIntStrAny"] ) -> None: if TYPE_CHECKING: self._items: Union["AbstractSetIntStr", "MappingIntStrAny"] self._type: Type[Union[set, dict]] # type: ignore # For further type checks speed-up if isinstance(items, dict)...
https://github.com/samuelcolvin/pydantic/issues/1419
FullArgSpec(args=['self'], varargs=None, varkw=None, defaults=None, kwonlyargs=['foo'], kwonlydefaults=None, annotations={'foo': <class 'str'>}) Traceback (most recent call last): File "/usr/lib/python3.8/inspect.py", line 1123, in getfullargspec sig = _signature_from_callable(func, File "/usr/lib/python3.8/inspect.py"...
TypeError
def populate_validators(self) -> None: """ Prepare self.pre_validators, self.validators, and self.post_validators based on self.type_'s __get_validators__ and class validators. This method should be idempotent, e.g. it should be safe to call multiple times without mis-configuring the field. """ ...
def populate_validators(self) -> None: """ Prepare self.pre_validators, self.validators, and self.post_validators based on self.type_'s __get_validators__ and class validators. This method should be idempotent, e.g. it should be safe to call multiple times without mis-configuring the field. """ ...
https://github.com/samuelcolvin/pydantic/issues/1410
import os from pathlib import Path import pydantic class Config1(pydantic.BaseSettings): ... port: int = pydantic.Field(1234, const=True) ... class Config2(pydantic.BaseSettings): ... port: int = pydantic.Field("1234", const=True) ... print("No env") No env print("Config1", Config1().dict()) Config1 {'port': 1...
pydantic.error_wrappers.ValidationError
def generate_model_signature( init: Callable[..., None], fields: Dict[str, "ModelField"], config: Type["BaseConfig"], ) -> "Signature": """ Generate signature for model based on its fields """ from inspect import Parameter, Signature, signature present_params = signature(init).parameter...
def generate_model_signature( init: Callable[..., None], fields: Dict[str, "ModelField"], config: Type["BaseConfig"], ) -> "Signature": """ Generate signature for model based on its fields """ from inspect import Parameter, Signature, signature present_params = signature(init).parameter...
https://github.com/samuelcolvin/pydantic/issues/1418
Traceback (most recent call last): File "/home/jrootjunior/work/aiogram3/expetiment.py", line 7, in <module> class MyObject(BaseModel): File "/home/jrootjunior/.cache/pypoetry/virtualenvs/aiogram-BAWpo_Vh-py3.8/lib/python3.8/site-packages/pydantic/main.py", line 303, in __new__ cls.__signature__ = generate_model_signat...
ValueError
def __class_getitem__( cls: Type[GenericModelT], params: Union[Type[Any], Tuple[Type[Any], ...]] ) -> Type[Any]: cached = _generic_types_cache.get((cls, params)) if cached is not None: return cached if cls.__concrete__: raise TypeError( "Cannot parameterize a concrete instant...
def __class_getitem__( cls: Type[GenericModelT], params: Union[Type[Any], Tuple[Type[Any], ...]] ) -> Type[Any]: cached = _generic_types_cache.get((cls, params)) if cached is not None: return cached if cls.__concrete__: raise TypeError( "Cannot parameterize a concrete instant...
https://github.com/samuelcolvin/pydantic/issues/1366
Traceback (most recent call last): File "test_model_name.py", line 3, in <module> @dataclass File "pydantic/dataclasses.py", line 146, in pydantic.dataclasses.dataclass # File "pydantic/dataclasses.py", line 141, in pydantic.dataclasses.dataclass.wrap # | True | True | True | add | raise | Frozen, so hashable Fi...
TypeError
def create_model( __model_name: str, *, __config__: Type[BaseConfig] = None, __base__: Type[BaseModel] = None, __module__: Optional[str] = None, __validators__: Dict[str, classmethod] = None, **field_definitions: Any, ) -> Type[BaseModel]: """ Dynamically create a model. :param _...
def create_model( model_name: str, *, __config__: Type[BaseConfig] = None, __base__: Type[BaseModel] = None, __module__: Optional[str] = None, __validators__: Dict[str, classmethod] = None, **field_definitions: Any, ) -> Type[BaseModel]: """ Dynamically create a model. :param mod...
https://github.com/samuelcolvin/pydantic/issues/1366
Traceback (most recent call last): File "test_model_name.py", line 3, in <module> @dataclass File "pydantic/dataclasses.py", line 146, in pydantic.dataclasses.dataclass # File "pydantic/dataclasses.py", line 141, in pydantic.dataclasses.dataclass.wrap # | True | True | True | add | raise | Frozen, so hashable Fi...
TypeError
def __get_validators__(cls) -> "CallableGenerator": yield cls.list_length_validator
def __get_validators__(cls) -> "CallableGenerator": yield list_validator yield cls.list_length_validator
https://github.com/samuelcolvin/pydantic/issues/1295
class Foo(BaseModel): ... bar: List = Field(None) ... baz: List = Field(None, max_items=10) ... Foo() Foo(bar=None, baz=None) Foo(bar=None) Foo(bar=None, baz=None) Foo(baz=None) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/spike/.pyenv/versions/3.8.2/lib/python3.8/site-pac...
pydantic.error_wrappers.ValidationError
def list_length_validator( cls, v: "Optional[List[T]]", field: "ModelField" ) -> "Optional[List[T]]": if v is None and not field.required: return None v = list_validator(v) v_len = len(v) if cls.min_items is not None and v_len < cls.min_items: raise errors.ListMinLengthError(limit_...
def list_length_validator(cls, v: "List[T]") -> "List[T]": v_len = len(v) if cls.min_items is not None and v_len < cls.min_items: raise errors.ListMinLengthError(limit_value=cls.min_items) if cls.max_items is not None and v_len > cls.max_items: raise errors.ListMaxLengthError(limit_value=c...
https://github.com/samuelcolvin/pydantic/issues/1295
class Foo(BaseModel): ... bar: List = Field(None) ... baz: List = Field(None, max_items=10) ... Foo() Foo(bar=None, baz=None) Foo(bar=None) Foo(bar=None, baz=None) Foo(baz=None) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/spike/.pyenv/versions/3.8.2/lib/python3.8/site-pac...
pydantic.error_wrappers.ValidationError
def validate(cls: Type["Model"], value: Any) -> "Model": if isinstance(value, dict): return cls(**value) elif isinstance(value, cls): return value.copy() elif cls.__config__.orm_mode: return cls.from_orm(value) elif cls.__custom_root_type__: return cls.parse_obj(value) ...
def validate(cls: Type["Model"], value: Any) -> "Model": if isinstance(value, dict): return cls(**value) elif isinstance(value, cls): return value.copy() elif cls.__config__.orm_mode: return cls.from_orm(value) else: try: value_as_dict = dict(value) ex...
https://github.com/samuelcolvin/pydantic/issues/1190
from pydantic import BaseModel class OperationData(BaseModel): id: str class Operation(BaseModel): __root__: Tuple[int, OperationData] data = [0, {'id': '1.11.0'}] # this one works as expected print(Operation.parse_obj(data)) # printed: __root__=(0, OperationData(id='1.11.0')) # However, this one doesn't print(pars...
pydantic.error_wrappers.ValidationError
def __init__(self, default: Any, **kwargs: Any) -> None: self.default = default self.alias = kwargs.pop("alias", None) self.alias_priority = kwargs.pop("alias_priority", 2 if self.alias else None) self.title = kwargs.pop("title", None) self.description = kwargs.pop("description", None) self.cons...
def __init__(self, default: Any, **kwargs: Any) -> None: self.default = default self.alias = kwargs.pop("alias", None) self.title = kwargs.pop("title", None) self.description = kwargs.pop("description", None) self.const = kwargs.pop("const", None) self.gt = kwargs.pop("gt", None) self.ge = k...
https://github.com/samuelcolvin/pydantic/issues/1177
MyModel() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<snip>/site-packages/pydantic/main.py", line 274, in __init__ raise validation_error pydantic.error_wrappers.ValidationError: 1 validation error for MyModel myATTRIBUTE field required (type=value_error.missing) MyOtherModel() Traceba...
pydantic.error_wrappers.ValidationError
def set_config(self, config: Type["BaseConfig"]) -> None: self.model_config = config info_from_config = config.get_field_info(self.name) config.prepare_field(self) new_alias = info_from_config.get("alias") new_alias_priority = info_from_config.get("alias_priority") or 0 if new_alias and new_alia...
def set_config(self, config: Type["BaseConfig"]) -> None: self.model_config = config info_from_config = config.get_field_info(self.name) config.prepare_field(self) if info_from_config: self.field_info.alias = ( info_from_config.get("alias") or self.field_info.alias or self.name ...
https://github.com/samuelcolvin/pydantic/issues/1177
MyModel() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<snip>/site-packages/pydantic/main.py", line 274, in __init__ raise validation_error pydantic.error_wrappers.ValidationError: 1 validation error for MyModel myATTRIBUTE field required (type=value_error.missing) MyOtherModel() Traceba...
pydantic.error_wrappers.ValidationError
def get_field_info(cls, name: str) -> Dict[str, Any]: fields_value = cls.fields.get(name) if isinstance(fields_value, str): field_info: Dict[str, Any] = {"alias": fields_value} elif isinstance(fields_value, dict): field_info = fields_value else: field_info = {} if "alias" i...
def get_field_info(cls, name: str) -> Dict[str, Any]: field_info = cls.fields.get(name) or {} if isinstance(field_info, str): field_info = {"alias": field_info} elif cls.alias_generator and "alias" not in field_info: alias = cls.alias_generator(name) if not isinstance(alias, str): ...
https://github.com/samuelcolvin/pydantic/issues/1177
MyModel() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<snip>/site-packages/pydantic/main.py", line 274, in __init__ raise validation_error pydantic.error_wrappers.ValidationError: 1 validation error for MyModel myATTRIBUTE field required (type=value_error.missing) MyOtherModel() Traceba...
pydantic.error_wrappers.ValidationError
def validate_luhn_check_digit(cls, card_number: str) -> str: """ Based on: https://en.wikipedia.org/wiki/Luhn_algorithm """ sum_ = int(card_number[-1]) length = len(card_number) parity = length % 2 for i in range(length - 1): digit = int(card_number[i]) if i % 2 == parity: ...
def validate_luhn_check_digit(cls, card_number: str) -> str: """ Based on: https://en.wikipedia.org/wiki/Luhn_algorithm """ sum_ = int(card_number[-1]) length = len(card_number) parity = length % 2 for i in range(length - 1): digit = int(card_number[i]) if i % 2 == parity: ...
https://github.com/samuelcolvin/pydantic/issues/1166
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.7/site-packages/pydantic/types.py", line 657, in validate_luhn_check_digit raise errors.LuhnValidationError pydantic.errors.LuhnValidationError: card number is not luhn valid
pydantic.errors.LuhnValidationError
def validate(cls, value: Union[str]) -> Union[str]: if cls.curtail_length and len(value) > cls.curtail_length: value = value[: cls.curtail_length] if cls.regex: if not cls.regex.match(value): raise errors.StrRegexError(pattern=cls.regex.pattern) return value
def validate(cls, value: str) -> str: if cls.curtail_length and len(value) > cls.curtail_length: value = value[: cls.curtail_length] if cls.regex: if not cls.regex.match(value): raise errors.StrRegexError(pattern=cls.regex.pattern) return value
https://github.com/samuelcolvin/pydantic/issues/1060
Traceback (most recent call last): File "/opt/pycharm-eap/plugins/python/helpers/pydev/pydevd.py", line 1415, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "/opt/pycharm-eap/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n",...
pydantic.error_wrappers.ValidationError
def strict_str_validator(v: Any) -> Union[str]: if isinstance(v, str): return v raise errors.StrError()
def strict_str_validator(v: Any) -> str: if isinstance(v, str): return v raise errors.StrError()
https://github.com/samuelcolvin/pydantic/issues/1060
Traceback (most recent call last): File "/opt/pycharm-eap/plugins/python/helpers/pydev/pydevd.py", line 1415, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "/opt/pycharm-eap/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n",...
pydantic.error_wrappers.ValidationError
def get_annotation_from_schema(annotation: Any, schema: Schema) -> Type[Any]: """ Get an annotation with validation implemented for numbers and strings based on the schema. :param annotation: an annotation from a field specification, as ``str``, ``ConstrainedStr`` :param schema: an instance of Schema, ...
def get_annotation_from_schema(annotation: Any, schema: Schema) -> Type[Any]: """ Get an annotation with validation implemented for numbers and strings based on the schema. :param annotation: an annotation from a field specification, as ``str``, ``ConstrainedStr`` :param schema: an instance of Schema, ...
https://github.com/samuelcolvin/pydantic/issues/541
from pydantic import BaseModel, urlstr class DatabaseConfig(BaseModel): ... url: urlstr(schemes={'postgresql'}, require_tld=False) = ... ... DatabaseConfig(url='postgresql://diary_test@localhost/diary_test') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "pydantic/main.py", line 235, in...
pydantic.error_wrappers.ValidationError
def display_as_type(v: AnyType) -> str: if not isinstance(v, typing_base) and not isinstance(v, type): v = type(v) if isinstance(v, type) and issubclass(v, Enum): if issubclass(v, int): return "int" elif issubclass(v, str): return "str" else: ...
def display_as_type(v: AnyType) -> str: if not isinstance(v, typing_base) and not isinstance(v, type): v = type(v) if lenient_issubclass(v, Enum): if issubclass(v, int): return "int" elif issubclass(v, str): return "str" else: return "enum" ...
https://github.com/samuelcolvin/pydantic/issues/541
from pydantic import BaseModel, urlstr class DatabaseConfig(BaseModel): ... url: urlstr(schemes={'postgresql'}, require_tld=False) = ... ... DatabaseConfig(url='postgresql://diary_test@localhost/diary_test') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "pydantic/main.py", line 235, in...
pydantic.error_wrappers.ValidationError
def setattr_validate_assignment(self: "DataclassType", name: str, value: Any) -> None: if self.__initialised__: d = dict(self.__dict__) d.pop(name, None) known_field = self.__pydantic_model__.__fields__.get(name, None) if known_field: value, error_ = known_field.validate(...
def setattr_validate_assignment(self: "DataclassType", name: str, value: Any) -> None: if self.__initialised__: d = dict(self.__dict__) d.pop(name) value, error_ = self.__pydantic_model__.__fields__[name].validate( value, d, loc=name, cls=self.__class__ ) if error...
https://github.com/samuelcolvin/pydantic/issues/723
import contextlib import datetime import pydantic class ModelWithoutValidation(pydantic.BaseModel): name: str = None birthdate: datetime.date = None class Config: extra = pydantic.Extra.allow validate_assignment = False # <<< !!! obj = ModelWithoutValidation(name="Jim Smith") obj.name = "John Doe" # OK: Does not...
pydantic.ValidationError
def __setattr__(self, name, value): if self.__config__.extra is not Extra.allow and name not in self.__fields__: raise ValueError(f'"{self.__class__.__name__}" object has no field "{name}"') elif not self.__config__.allow_mutation: raise TypeError( f'"{self.__class__.__name__}" is im...
def __setattr__(self, name, value): if self.__config__.extra is not Extra.allow and name not in self.__fields__: raise ValueError(f'"{self.__class__.__name__}" object has no field "{name}"') elif not self.__config__.allow_mutation: raise TypeError( f'"{self.__class__.__name__}" is im...
https://github.com/samuelcolvin/pydantic/issues/723
import contextlib import datetime import pydantic class ModelWithoutValidation(pydantic.BaseModel): name: str = None birthdate: datetime.date = None class Config: extra = pydantic.Extra.allow validate_assignment = False # <<< !!! obj = ModelWithoutValidation(name="Jim Smith") obj.name = "John Doe" # OK: Does not...
pydantic.ValidationError
def __str__(self) -> str: permitted = ", ".join(repr(v.value) for v in self.ctx["enum_values"]) # type: ignore return f"value is not a valid enumeration member; permitted: {permitted}"
def __str__(self) -> str: permitted = ", ".join(repr(v.value) for v in self.ctx["enum_type"]) # type: ignore return f"value is not a valid enumeration member; permitted: {permitted}"
https://github.com/samuelcolvin/pydantic/issues/696
Traceback (most recent call last): File "<stdin>", line 2, in <module> File "/Users/josepcugat/.pyenv/versions/current/lib/python3.6/site-packages/pydantic/main.py", line 276, in __init__ values, fields_set, _ = validate_model(__pydantic_self__, data) File "/Users/josepcugat/.pyenv/versions/current/lib/python3.6/site-p...
pydantic.error_wrappers.ValidationError
def enum_validator(v: Any, field: "Field", config: "BaseConfig") -> Enum: try: enum_v = field.type_(v) except ValueError: # field.type_ should be an enum, so will be iterable raise errors.EnumError(enum_values=list(field.type_)) # type: ignore return enum_v.value if config.use_enum_...
def enum_validator(v: Any, field: "Field", config: "BaseConfig") -> Enum: try: enum_v = field.type_(v) except ValueError: raise errors.EnumError(enum_type=field.type_) return enum_v.value if config.use_enum_values else enum_v
https://github.com/samuelcolvin/pydantic/issues/696
Traceback (most recent call last): File "<stdin>", line 2, in <module> File "/Users/josepcugat/.pyenv/versions/current/lib/python3.6/site-packages/pydantic/main.py", line 276, in __init__ values, fields_set, _ = validate_model(__pydantic_self__, data) File "/Users/josepcugat/.pyenv/versions/current/lib/python3.6/site-p...
pydantic.error_wrappers.ValidationError
def truncate(v: Union[str], *, max_len: int = 80) -> str: """ Truncate a value and add a unicode ellipsis (three dots) to the end if it was too long """ if isinstance(v, str) and len(v) > (max_len - 2): # -3 so quote + string + … + quote has correct length return (v[: (max_len - 3)] + "…...
def truncate(v: Union[str], *, max_len: int = 80) -> str: """ Truncate a value and add a unicode ellipsis (three dots) to the end if it was too long """ if isinstance(v, str) and len(v) > (max_len - 2): # -3 so quote + string + … + quote has correct length return (v[: (max_len - 3)] + "…...
https://github.com/samuelcolvin/pydantic/issues/608
Traceback (most recent call last): File "test.py", line 23, in <module> print(TestSettings(cls=TestClass)) File "pydantic/main.py", line 534, in pydantic.main.BaseModel.__str__ File "pydantic/main.py", line 530, in genexpr File "pydantic/main.py", line 530, in genexpr File "pydantic/utils.py", line 158, in pydantic.uti...
TypeError
def _process_class( _cls: AnyType, init: bool, repr: bool, eq: bool, order: bool, unsafe_hash: bool, frozen: bool, config: Type["BaseConfig"], ) -> "DataclassType": post_init_original = getattr(_cls, "__post_init__", None) post_init_post_parse = getattr(_cls, "__post_init_post_pa...
def _process_class( _cls: AnyType, init: bool, repr: bool, eq: bool, order: bool, unsafe_hash: bool, frozen: bool, config: Type["BaseConfig"], ) -> "DataclassType": post_init_original = getattr(_cls, "__post_init__", None) post_init_post_parse = getattr(_cls, "__post_init_post_pa...
https://github.com/samuelcolvin/pydantic/issues/536
--------------------------------------------------------------------------- RecursionError Traceback (most recent call last) <ipython-input-28-55581d931e2a> in <module> ----> 1 B(b=1, a=2) <string> in __init__(self, a, b) [path_removed]/.venv/lib/python3.7/site-packages/pydantic/dataclasses...
RecursionError
def _pydantic_post_init(self: "DataclassType", *initvars: Any) -> None: if post_init_original is not None: post_init_original(self, *initvars) d = validate_model(self.__pydantic_model__, self.__dict__, cls=self.__class__)[0] object.__setattr__(self, "__dict__", d) object.__setattr__(self, "__ini...
def _pydantic_post_init(self: "DataclassType", *initvars: Any) -> None: if self.__post_init_original__: self.__post_init_original__(*initvars) d = validate_model(self.__pydantic_model__, self.__dict__, cls=self.__class__)[0] object.__setattr__(self, "__dict__", d) object.__setattr__(self, "__ini...
https://github.com/samuelcolvin/pydantic/issues/536
--------------------------------------------------------------------------- RecursionError Traceback (most recent call last) <ipython-input-28-55581d931e2a> in <module> ----> 1 B(b=1, a=2) <string> in __init__(self, a, b) [path_removed]/.venv/lib/python3.7/site-packages/pydantic/dataclasses...
RecursionError
def find_validators( type_: AnyType, arbitrary_types_allowed: bool = False ) -> List[AnyCallable]: if type_ is Any or type(type_) in (ForwardRef, TypeVar): return [] if type_ is Pattern: return pattern_validators if is_callable_type(type_): return [callable_validator] supert...
def find_validators( type_: AnyType, arbitrary_types_allowed: bool = False ) -> List[AnyCallable]: if type_ is Any or type(type_) == ForwardRef: return [] if type_ is Pattern: return pattern_validators if is_callable_type(type_): return [callable_validator] supertype = _find...
https://github.com/samuelcolvin/pydantic/issues/550
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) /scratch/miniconda3/envs/jupyter/lib/python3.7/site-packages/pydantic/validators.py in find_validators(type_, arbitrary_types_allowed) 385 try: --> 386 ...
TypeError
def _get_key_factory(self, by_alias: bool) -> Callable[..., str]: if by_alias: return lambda fields, key: fields[key].alias if key in fields else key return lambda _, key: key
def _get_key_factory(self, by_alias: bool) -> Callable[..., str]: if by_alias: return lambda fields, key: fields[key].alias return lambda _, key: key
https://github.com/samuelcolvin/pydantic/issues/488
Traceback (most recent call last): File "...", line 41, in ... print(m.dict(by_alias=True)) # error File ".../python3.7/site-packages/pydantic/main.py", line 282, in dict get_key(k): v for k, v in self._iter(by_alias=by_alias, skip_defaults=skip_defaults) File ".../python3.7/site-packages/pydantic/main.py", line 282, ...
KeyError
def include_in_schema(self) -> bool: """ False if this is a simple field just allowing None as used in Unions/Optional. """ return self.type_ != NoneType
def include_in_schema(self) -> bool: """ False if this is a simple field just allowing None as used in Unions/Optional. """ return len(self.validators) != 1 or self.validators[0][1] != is_none_validator
https://github.com/samuelcolvin/pydantic/issues/363
Traceback (most recent call last): File "<input>", line 1, in <module> File "/Users/.../lib/python3.6/site-packages/pydantic/main.py", line 292, in schema s = model_schema(cls, by_alias=by_alias) File "/Users/.../lib/python3.6/site-packages/pydantic/schema.py", line 193, in model_schema model, by_alias=by_alias, model_...
ValueError
def validator( *fields, pre: bool = False, whole: bool = False, always: bool = False, check_fields: bool = True, ): """ Decorate methods on the class indicating that they should be used to validate fields :param fields: which field(s) the method should be called on :param pre: whethe...
def validator( *fields, pre: bool = False, whole: bool = False, always: bool = False, check_fields: bool = True, ): """ Decorate methods on the class indicating that they should be used to validate fields :param fields: which field(s) the method should be called on :param pre: whethe...
https://github.com/samuelcolvin/pydantic/issues/312
Config ip=IPv4Address('123.0.0.200') name='asdf' port=2392 when the cell is called first and raises ConfigError Traceback (most recent call last) in () 3 from ipaddress import ip_address 4 ----> 5 class Config(BaseModel): 6 ip: str 7 name: str in Config() 8 port: int 9 ---> 10 @validator("ip") 11 def check_ip(cls, va...
ConfigError
def dec(f): # avoid validators with duplicated names since without this validators can be overwritten silently # which generally isn't the intended behaviour, don't run in ipython - see #312 if not in_ipython(): # pragma: no branch ref = f.__module__ + "." + f.__qualname__ if ref in _FUNCS:...
def dec(f): ref = f.__module__ + "." + f.__qualname__ if ref in _FUNCS: raise ConfigError(f'duplicate validator function "{ref}"') _FUNCS.add(ref) f_cls = classmethod(f) f_cls.__validator_config = fields, Validator(f, pre, whole, always, check_fields) return f_cls
https://github.com/samuelcolvin/pydantic/issues/312
Config ip=IPv4Address('123.0.0.200') name='asdf' port=2392 when the cell is called first and raises ConfigError Traceback (most recent call last) in () 3 from ipaddress import ip_address 4 ----> 5 class Config(BaseModel): 6 ip: str 7 name: str in Config() 8 port: int 9 ---> 10 @validator("ip") 11 def check_ip(cls, va...
ConfigError
def _process_class( _cls, init, repr, eq, order, unsafe_hash, frozen, validate_assignment ): post_init_original = getattr(_cls, "__post_init__", None) if post_init_original and post_init_original.__name__ == "_pydantic_post_init": post_init_original = None _cls.__post_init__ = _pydantic_post_ini...
def _process_class( _cls, init, repr, eq, order, unsafe_hash, frozen, validate_assignment ): post_init_original = getattr(_cls, "__post_init__", None) _cls.__post_init__ = post_init cls = dataclasses._process_class(_cls, init, repr, eq, order, unsafe_hash, frozen) fields = { name: (field.ty...
https://github.com/samuelcolvin/pydantic/issues/293
Traceback (most recent call last): File "/usr/local/pyenv/versions/3.6.7/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2881, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-9-10a7116ca691>", line 12, in <module> B(a='a', b='b') File "<string>", line 4, in __init_...
RecursionError
def _substitute_environ(self): """ Substitute environment variables into values. """ d = {} for field in self.__fields__.values(): if field.has_alias: env_name = field.alias else: env_name = self.__config__.env_prefix + field.name.upper() env_var = os....
def _substitute_environ(self): """ Substitute environment variables into values. """ d = {} for field in self.__fields__.values(): if field.alt_alias: env_name = field.alias else: env_name = self.__config__.env_prefix + field.name.upper() env_var = os....
https://github.com/samuelcolvin/pydantic/issues/275
❯ export test=foobar; pipenv run python Python 3.6.1 (default, Aug 1 2018, 10:30:03) [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin Type "help", "copyright", "credits" or "license" for more information. import os import pydantic class S(pydantic.BaseSettings): ... test:str ... class Config: ....
pydantic.error_wrappers.ValidationError
def __init__( self, *, name: str, type_: Type, class_validators: List[Validator], default: Any, required: bool, model_config: Any, alias: str = None, allow_none: bool = False, schema: Schema = None, ): self.name: str = name self.has_alias: bool = bool(alias) self....
def __init__( self, *, name: str, type_: Type, class_validators: List[Validator], default: Any, required: bool, model_config: Any, alias: str = None, allow_none: bool = False, schema: Schema = None, ): self.name: str = name self.alias: str = alias or name self.typ...
https://github.com/samuelcolvin/pydantic/issues/275
❯ export test=foobar; pipenv run python Python 3.6.1 (default, Aug 1 2018, 10:30:03) [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin Type "help", "copyright", "credits" or "license" for more information. import os import pydantic class S(pydantic.BaseSettings): ... test:str ... class Config: ....
pydantic.error_wrappers.ValidationError
def schema(self, by_alias=True): s = dict( title=self._schema.title or self.alias.title(), required=self.required, ) if not self.required and self.default is not None: s["default"] = self.default s.update(self._schema.extra) ts = self.type_schema(by_alias) s.update(ts i...
def schema(self, by_alias=True): s = self.type_.schema(by_alias) if hasattr(self.type_, "schema") else {} s.update( type=s.get("type") or display_as_type(self.type_), title=self._schema.title or s.get("title") or self.alias.title(), required=self.required, ) if not self.required...
https://github.com/samuelcolvin/pydantic/issues/213
Traceback (most recent call last): File "test_pydantic_schema.py", line 9, in <module> print(TestModel.schema_json(indent=2)) File "/pydantic/pydantic/main.py", line 288, in schema_json return json.dumps(cls.schema(by_alias=by_alias), default=pydantic_encoder, **dumps_kwargs) File "/pydantic/pydantic/main.py", line 278...
TypeError
def _populate_sub_fields(self): # typing interface is horrible, we have to do some ugly checks if isinstance(self.type_, type) and issubclass(self.type_, JsonWrapper): self.type_ = self.type_.inner_type self.parse_json = True origin = getattr(self.type_, "__origin__", None) if origin is...
def _populate_sub_fields(self): # typing interface is horrible, we have to do some ugly checks if isinstance(self.type_, type) and issubclass(self.type_, JsonWrapper): self.type_ = self.type_.inner_type self.parse_json = True origin = _get_type_origin(self.type_) if origin is None: ...
https://github.com/samuelcolvin/pydantic/issues/213
Traceback (most recent call last): File "test_pydantic_schema.py", line 9, in <module> print(TestModel.schema_json(indent=2)) File "/pydantic/pydantic/main.py", line 288, in schema_json return json.dumps(cls.schema(by_alias=by_alias), default=pydantic_encoder, **dumps_kwargs) File "/pydantic/pydantic/main.py", line 278...
TypeError
def schema(cls, by_alias=True) -> Dict[str, Any]: cached = cls._schema_cache.get(by_alias) if cached is not None: return cached s = {"title": cls.__config__.title or cls.__name__} if cls.__doc__: s["description"] = clean_docstring(cls.__doc__) s.update(cls.type_schema(by_alias)) ...
def schema(cls, by_alias=True) -> Dict[str, Any]: cached = cls._schema_cache.get(by_alias) if cached is not None: return cached s = { "type": "object", "title": cls.__config__.title or cls.__name__, } if cls.__doc__: s["description"] = clean_docstring(cls.__doc__) ...
https://github.com/samuelcolvin/pydantic/issues/213
Traceback (most recent call last): File "test_pydantic_schema.py", line 9, in <module> print(TestModel.schema_json(indent=2)) File "/pydantic/pydantic/main.py", line 288, in schema_json return json.dumps(cls.schema(by_alias=by_alias), default=pydantic_encoder, **dumps_kwargs) File "/pydantic/pydantic/main.py", line 278...
TypeError
def __init__( self, language: str, treebank: Optional[str] = None, stanza_debug_level="ERROR" ) -> None: """Constructor for ``get_stanza_models`` wrapper class. TODO: Do tests for all langs and available models for each >>> stanza_wrapper = StanzaWrapper(language='grc', stanza_debug_level="INFO") ...
def __init__( self, language: str, treebank: Optional[str] = None, stanza_debug_level="ERROR" ) -> None: """Constructor for ``get_stanza_models`` wrapper class. TODO: Do tests for all langs and available models for each >>> stanza_wrapper = StanzaWrapper(language='grc', stanza_debug_level="INFO") ...
https://github.com/cltk/cltk/issues/67
In [1]: from cltk.corpus.utils.importer import CorpusImporter In [2]: corpus_importer = CorpusImporter('latin') In [3]: corpus_importer. corpus_importer.import_corpus corpus_importer.list_corpora corpus_importer.language In [3]: corpus_importer. corpus_importer.import_corpus corpus_importer.list_corpora corpus_imp...
TypeError
def analyze(self, text: str) -> Doc: """The primary method for the NLP object, to which raw text strings are passed. >>> from cltkv1 import NLP >>> from cltkv1.languages.example_texts import get_example_text >>> from cltkv1.core.data_types import Doc >>> cltk_nlp = NLP(language="lat") >>> cltk_...
def analyze(self, text: str) -> Doc: """The primary method for the NLP object, to which raw text strings are passed. >>> from cltkv1 import NLP >>> from cltkv1.languages.example_texts import get_example_text >>> from cltkv1.core.data_types import Doc >>> cltk_nlp = NLP(language="lat") >>> cltk_...
https://github.com/cltk/cltk/issues/67
In [1]: from cltk.corpus.utils.importer import CorpusImporter In [2]: corpus_importer = CorpusImporter('latin') In [3]: corpus_importer. corpus_importer.import_corpus corpus_importer.list_corpora corpus_importer.language In [3]: corpus_importer. corpus_importer.import_corpus corpus_importer.list_corpora corpus_imp...
TypeError
def handle(self, *args, **options): """Create Customer objects for Subscribers without Customer objects associated.""" for subscriber in get_subscriber_model().objects.filter(djstripe_customers=None): # use get_or_create in case of race conditions on large subscriber bases Customer.get_or_create...
def handle(self, *args, **options): """Create Customer objects for Subscribers without Customer objects associated.""" for subscriber in get_subscriber_model().objects.filter(customer__isnull=True): # use get_or_create in case of race conditions on large subscriber bases Customer.get_or_create(s...
https://github.com/dj-stripe/dj-stripe/issues/497
Traceback (most recent call last): File "manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "/Users/jdln/.virtualenvs/djstripe/lib/python3.6/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line utility.execute() File "/Users/jdln/.virtualenvs/djstripe/lib/pyth...
django.core.exceptions.FieldError
def api_retrieve(self, api_key=settings.STRIPE_SECRET_KEY): # OVERRIDING the parent version of this function # Cards must be manipulated through a customer or account. # TODO: When managed accounts are supported, this method needs to check if # either a customer or account is supplied to determine the c...
def api_retrieve(self, api_key=settings.STRIPE_SECRET_KEY): # OVERRIDING the parent version of this function # Cards must be manipulated through a customer or account. # TODO: When managed accounts are supported, this method needs to check if either a customer or # account is supplied to determine...
https://github.com/dj-stripe/dj-stripe/issues/432
customer = Customer.retrieve(id="cus_ACOAhvtRVLJTDT", api_key=settings.STRIPE_SECRET_KEY) customer <Customer id=cus_ACOAhvtRVLJTDT at 0x7fd435fffae8> JSON: { "deleted": true, "id": "cus_ACOAhvtRVLJTDT" } "sources" in customer False customer.sources.retrieve(...) Traceback (most recent call last): File "<console>", line...
AttributeError
def parser_one_line(self, line): """Parse one string line into feature values. Args: line (str): a string indicating one instance Returns: list: Parsed results,including label, features and impression_id """ impression_id = 0 words = line.strip().split(self.ID_spliter) if ...
def parser_one_line(self, line): """Parse one string line into feature values. Args: line (str): a string indicating one instance Returns: list: Parsed results,including label, features and impression_id """ impression_id = None words = line.strip().split(self.ID_spliter) ...
https://github.com/microsoft/recommenders/issues/1132
=========================================================================== test session starts =========================================================================== platform linux -- Python 3.6.7, pytest-4.1.1, py-1.7.0, pluggy-0.8.1 rootdir: /home/miguel/repos/Recommenders, inifile: collected 1 item tests/smok...
PapermillExecutionError
def load_data_from_file(self, infile): """Read and parse data from a file. Args: infile (str): text input file. Each line in this file is an instance. Returns: obj: An iterator that will yields parsed results, in the format of graph feed_dict. """ label_list = [] features_list ...
def load_data_from_file(self, infile): """Read and parse data from a file. Args: infile (str): text input file. Each line in this file is an instance. Returns: obj: An iterator that will yields parsed results, in the format of graph feed_dict. """ label_list = [] features_list ...
https://github.com/microsoft/recommenders/issues/1132
=========================================================================== test session starts =========================================================================== platform linux -- Python 3.6.7, pytest-4.1.1, py-1.7.0, pluggy-0.8.1 rootdir: /home/miguel/repos/Recommenders, inifile: collected 1 item tests/smok...
PapermillExecutionError
def run_eval(self, filename): """Evaluate the given file and returns some evaluation metrics. Args: filename (str): A file name that will be evaluated. Returns: dict: A dictionary contains evaluation metrics. """ load_sess = self.sess preds = [] labels = [] imp_indexs =...
def run_eval(self, filename): """Evaluate the given file and returns some evaluation metrics. Args: filename (str): A file name that will be evaluated. Returns: dict: A dictionary contains evaluation metrics. """ load_sess = self.sess preds = [] labels = [] imp_indexs =...
https://github.com/microsoft/recommenders/issues/1132
=========================================================================== test session starts =========================================================================== platform linux -- Python 3.6.7, pytest-4.1.1, py-1.7.0, pluggy-0.8.1 rootdir: /home/miguel/repos/Recommenders, inifile: collected 1 item tests/smok...
PapermillExecutionError
def predict(self, infile_name, outfile_name): """Make predictions on the given data, and output predicted scores to a file. Args: infile_name (str): Input file name, format is same as train/val/test file. outfile_name (str): Output file name, each line is the predict score. Returns: ...
def predict(self, infile_name, outfile_name): """Make predictions on the given data, and output predicted scores to a file. Args: infile_name (str): Input file name, format is same as train/val/test file. outfile_name (str): Output file name, each line is the predict score. Returns: ...
https://github.com/microsoft/recommenders/issues/1132
=========================================================================== test session starts =========================================================================== platform linux -- Python 3.6.7, pytest-4.1.1, py-1.7.0, pluggy-0.8.1 rootdir: /home/miguel/repos/Recommenders, inifile: collected 1 item tests/smok...
PapermillExecutionError
def find_wikidata_id(name, limit=1, session=None): """Find the entity ID in wikidata from a title string. Args: name (str): A string with search terms (eg. "Batman (1989) film") limit (int): Number of results to return session (requests.Session): requests session to reuse connections ...
def find_wikidata_id(name, limit=1, session=None): """Find the entity ID in wikidata from a title string. Args: name (str): A string with search terms (eg. "Batman (1989) film") limit (int): Number of results to return session (requests.Session): requests session to reuse connections ...
https://github.com/microsoft/recommenders/issues/919
============================= test session starts ============================== platform linux -- Python 3.6.8, pytest-5.0.1, py-1.8.0, pluggy-0.12.0 rootdir: /data/home/recocat/cicd/28/s collected 29 items / 12 deselected / 17 selected tests/integration/test_criteo.py . [ 5%] t...
PapermillExecutionError
def query_entity_links(entity_id, session=None): """Query all linked pages from a wikidata entityID Args: entity_id (str): A wikidata entity ID session (requests.Session): requests session to reuse connections Returns: (json): dictionary with linked pages. """ query = ( ...
def query_entity_links(entity_id, session=None): """Query all linked pages from a wikidata entityID Args: entity_id (str): A wikidata entity ID session (requests.Session): requests session to reuse connections Returns: (json): dictionary with linked pages. """ query = ( ...
https://github.com/microsoft/recommenders/issues/919
============================= test session starts ============================== platform linux -- Python 3.6.8, pytest-5.0.1, py-1.8.0, pluggy-0.12.0 rootdir: /data/home/recocat/cicd/28/s collected 29 items / 12 deselected / 17 selected tests/integration/test_criteo.py . [ 5%] t...
PapermillExecutionError
def query_entity_description(entity_id, session=None): """Query entity wikidata description from entityID Args: entity_id (str): A wikidata page ID. session (requests.Session): requests session to reuse connections Returns: (str): Wikidata short description of the entityID ...
def query_entity_description(entity_id, session=None): """Query entity wikidata description from entityID Args: entity_id (str): A wikidata page ID. session (requests.Session): requests session to reuse connections Returns: (str): Wikidata short description of the entityID ...
https://github.com/microsoft/recommenders/issues/919
============================= test session starts ============================== platform linux -- Python 3.6.8, pytest-5.0.1, py-1.8.0, pluggy-0.12.0 rootdir: /data/home/recocat/cicd/28/s collected 29 items / 12 deselected / 17 selected tests/integration/test_criteo.py . [ 5%] t...
PapermillExecutionError
def process_split_ratio(ratio): """Generate split ratio lists. Args: ratio (float or list): a float number that indicates split ratio or a list of float numbers that indicate split ratios (if it is a multi-split). Returns: tuple: a tuple containing bool: A boolean varia...
def process_split_ratio(ratio): """Generate split ratio lists. Args: ratio (float or list): a float number that indicates split ratio or a list of float numbers that indicate split ratios (if it is a multi-split). Returns: tuple: a tuple containing bool: A boolean varia...
https://github.com/microsoft/recommenders/issues/866
Traceback (most recent call last): File "C:\Users\scgraham\AppData\Local\Continuum\anaconda3\envs\reco_base\lib\site-packages\IPython\core\interactiveshell.py", line 3325, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-5-49ca4e7e6410>", line 1, in <module> x, y, z = python_random_spl...
ValueError
def split_pandas_data_with_ratios(data, ratios, seed=42, shuffle=False): """Helper function to split pandas DataFrame with given ratios .. note:: Implementation referenced from `this source <https://stackoverflow.com/questions/38250710/how-to-split-data-into-3-sets-train-validation-and-test>`_. A...
def split_pandas_data_with_ratios(data, ratios, seed=42, shuffle=False): """Helper function to split pandas DataFrame with given ratios .. note:: Implementation referenced from `this source <https://stackoverflow.com/questions/38250710/how-to-split-data-into-3-sets-train-validation-and-test>`_. A...
https://github.com/microsoft/recommenders/issues/866
Traceback (most recent call last): File "C:\Users\scgraham\AppData\Local\Continuum\anaconda3\envs\reco_base\lib\site-packages\IPython\core\interactiveshell.py", line 3325, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-5-49ca4e7e6410>", line 1, in <module> x, y, z = python_random_spl...
ValueError
def get_experiment_status(status_url=NNI_STATUS_URL): """Helper method. Gets the experiment status from the REST endpoint Args: status_url (str): URL for the REST endpoint Returns: dict: status of the experiment """ return requests.get(status_url).json()
def get_experiment_status(status_url): """ Helper method. Gets the experiment status from the REST endpoint Args: status_url (str): URL for the REST endpoint Returns: str: status of the experiment """ nni_status = requests.get(status_url).json() return nni_status["status"]
https://github.com/microsoft/recommenders/issues/746
tests/integration/test_movielens.py ......... [ 62%] tests/integration/test_notebooks_python.py .....F [100%] =================================== FAILURES =================================== _____________________________ test_nni_tuning_svd ____________________________...
PapermillExecutionError
def check_experiment_status(wait=WAITING_TIME, max_retries=MAX_RETRIES): """Checks the status of the current experiment on the NNI REST endpoint Waits until the tuning has completed Args: wait (numeric) : time to wait in seconds max_retries (int): max number of retries """ i = 0 ...
def check_experiment_status(wait=WAITING_TIME, max_retries=MAX_RETRIES): """Checks the status of the current experiment on the NNI REST endpoint Waits until the tuning has completed Args: wait (numeric) : time to wait in seconds max_retries (int): max number of retries """ i = 0 ...
https://github.com/microsoft/recommenders/issues/746
tests/integration/test_movielens.py ......... [ 62%] tests/integration/test_notebooks_python.py .....F [100%] =================================== FAILURES =================================== _____________________________ test_nni_tuning_svd ____________________________...
PapermillExecutionError
def check_stopped(wait=WAITING_TIME, max_retries=MAX_RETRIES): """Checks that there is no NNI experiment active (the URL is not accessible) This method should be called after "nnictl stop" for verification Args: wait (numeric) : time to wait in seconds max_retries (int): max number of retri...
def check_stopped(wait=WAITING_TIME, max_retries=MAX_RETRIES): """ Checks that there is no NNI experiment active (the URL is not accessible) This method should be called after 'nnictl stop' for verification Args: wait (numeric) : time to wait in seconds max_retries (int): max number of ...
https://github.com/microsoft/recommenders/issues/746
tests/integration/test_movielens.py ......... [ 62%] tests/integration/test_notebooks_python.py .....F [100%] =================================== FAILURES =================================== _____________________________ test_nni_tuning_svd ____________________________...
PapermillExecutionError
def check_metrics_written(wait=WAITING_TIME, max_retries=MAX_RETRIES): """Waits until the metrics have been written to the trial logs Args: wait (numeric) : time to wait in seconds max_retries (int): max number of retries """ i = 0 while i < max_retries: all_trials = request...
def check_metrics_written(wait=WAITING_TIME, max_retries=MAX_RETRIES): """ Waits until the metrics have been written to the trial logs """ i = 0 while i < max_retries: all_trials = requests.get(NNI_TRIAL_JOBS_URL).json() if all(["finalMetricData" in trial for trial in all_trials]): ...
https://github.com/microsoft/recommenders/issues/746
tests/integration/test_movielens.py ......... [ 62%] tests/integration/test_notebooks_python.py .....F [100%] =================================== FAILURES =================================== _____________________________ test_nni_tuning_svd ____________________________...
PapermillExecutionError
def get_trials(optimize_mode): """Obtain information about the trials of the current experiment via the REST endpoint Args: optimize_mode (str): One of "minimize", "maximize". Determines how to obtain the best default metric. Returns: list: Trials info, list of (metrics, log path) ...
def get_trials(optimize_mode): """Obtain information about the trials of the current experiment via the REST endpoint Args: optimize_mode (str): One of 'minimize', 'maximize'. Determines how to obtain the best default metric. Returns: list: Trials info, list of (metrics, log path) ...
https://github.com/microsoft/recommenders/issues/746
tests/integration/test_movielens.py ......... [ 62%] tests/integration/test_notebooks_python.py .....F [100%] =================================== FAILURES =================================== _____________________________ test_nni_tuning_svd ____________________________...
PapermillExecutionError
def svd_training(params): """ Train Surprise SVD using the given hyper-parameters """ logger.debug("Start training...") train_data = pd.read_pickle( path=os.path.join(params["datastore"], params["train_datapath"]) ) validation_data = pd.read_pickle( path=os.path.join(params["...
def svd_training(params): """ Train Surprise SVD using the given hyper-parameters """ logger.debug("Start training...") train_data = pd.read_pickle( path=os.path.join(params["datastore"], params["train_datapath"]) ) validation_data = pd.read_pickle( path=os.path.join(params["...
https://github.com/microsoft/recommenders/issues/746
tests/integration/test_movielens.py ......... [ 62%] tests/integration/test_notebooks_python.py .....F [100%] =================================== FAILURES =================================== _____________________________ test_nni_tuning_svd ____________________________...
PapermillExecutionError
def get_params(): parser = argparse.ArgumentParser() # Data path parser.add_argument( "--datastore", type=str, dest="datastore", help="Datastore path" ) parser.add_argument("--train-datapath", type=str, dest="train_datapath") parser.add_argument("--validation-datapath", type=str, dest="v...
def get_params(): parser = argparse.ArgumentParser() # Data path parser.add_argument( "--datastore", type=str, dest="datastore", help="Datastore path" ) parser.add_argument("--train-datapath", type=str, dest="train_datapath") parser.add_argument("--validation-datapath", type=str, dest="v...
https://github.com/microsoft/recommenders/issues/746
tests/integration/test_movielens.py ......... [ 62%] tests/integration/test_notebooks_python.py .....F [100%] =================================== FAILURES =================================== _____________________________ test_nni_tuning_svd ____________________________...
PapermillExecutionError
def __init__(self, hparams, iterator_creator, graph=None): """ Initializing the model. Create common logics which are needed by all deeprec models, such as loss function, parameter set. :param hparams: a tf.contrib.training.HParams object, hold the entire set of hyperparameters. """ if not graph: ...
def __init__(self, hparams, iterator_creator, graph=None): """ Initializing the model. Create common logics which are needed by all deeprec models, such as loss function, parameter set. :param hparams: a tf.contrib.training.HParams object, hold the entire set of hyperparameters. """ if not graph: ...
https://github.com/microsoft/recommenders/issues/478
2019-01-31T18:59:24.6946026Z tests/smoke/test_deeprec_model.py ..FF [ 57%] 2019-01-31T19:00:09.5820104Z tests/smoke/test_notebooks_gpu.py ..F [100%] 2019-01-31T19:00:09.5820400Z 2019-01-31T19:00:09.5823428Z =================================== FAILURES...
PapermillExecutionError
def install_prerequisites(): # pre-requisites for bench repo cloning run_os_command( { "apt-get": [ "sudo apt-get update", "sudo apt-get install -y git build-essential python3-setuptools python3-dev libffi-dev", ], "yum": [ ...
def install_prerequisites(): # pre-requisites for bench repo cloning run_os_command( { "apt-get": [ "sudo apt-get update", "sudo apt-get install -y git build-essential python3-setuptools python3-dev libffi-dev", ], "yum": [ ...
https://github.com/frappe/bench/issues/1059
Checking System Compatibility... ubuntu 18 is compatible! Hit:1 http://mirror.hetzner.de/ubuntu/packages bionic InRelease Hit:2 http://mirror.hetzner.de/ubuntu/packages bionic-updates InRelease Hit:3 http://mirror.hetzner.de/ubuntu/packages bionic-backports InRelease Hit:4 http://mirror.hetzner.de/ubuntu/packages bioni...
ModuleNotFoundError
def update_checkpoint_dependencies(self, jobs=None): """Update dependencies of checkpoints.""" updated = False self.update_checkpoint_outputs() if jobs is None: jobs = [job for job in self.jobs if not self.needrun(job)] for job in jobs: if job.is_checkpoint: depending = l...
def update_checkpoint_dependencies(self, jobs=None): """Update dependencies of checkpoints.""" updated = False self.update_checkpoint_outputs() if jobs is None: jobs = [job for job in self.jobs if not self.needrun(job)] for job in jobs: if job.is_checkpoint: depending = l...
https://github.com/snakemake/snakemake/issues/817
Traceback (most recent call last): File "/mnt/data0/jmeppley/projects/snakemake_bugs/snakemake.272/DTR-phage-pipeline/snakemake/snakemake/__init__.py", line 687, in snakemake success = workflow.execute( File "/mnt/data0/jmeppley/projects/snakemake_bugs/snakemake.272/DTR-phage-pipeline/snakemake/snakemake/workflow.py", ...
KeyError
def __init__( self, workflow, rules=None, dryrun=False, targetfiles=None, targetrules=None, forceall=False, forcerules=None, forcefiles=None, priorityfiles=None, priorityrules=None, untilfiles=None, untilrules=None, omitfiles=None, omitrules=None, ignore_a...
def __init__( self, workflow, rules=None, dryrun=False, targetfiles=None, targetrules=None, forceall=False, forcerules=None, forcefiles=None, priorityfiles=None, priorityrules=None, untilfiles=None, untilrules=None, omitfiles=None, omitrules=None, ignore_a...
https://github.com/snakemake/snakemake/issues/806
Building DAG of jobs... Using shell: /usr/bin/bash Provided cores: 4 Rules claiming more threads will be scaled down. Job counts: count jobs 1 all 1 corpus 2 shard 4 [Wed Dec 16 11:46:00 2020] checkpoint shard: output: data/batches.es jobid: 2 wildcards: lang=es Downstream jobs will be updated after completion. [Wed...
FileNotFoundError
def update_ready(self, jobs=None): """Update information whether a job is ready to execute. Given jobs must be needrun jobs! """ if jobs is None: jobs = self.needrun_jobs potential_new_ready_jobs = False candidate_groups = set() for job in jobs: if job in self._ready_jobs ...
def update_ready(self, jobs=None): """Update information whether a job is ready to execute. Given jobs must be needrun jobs! """ if jobs is None: jobs = self.needrun_jobs potential_new_ready_jobs = False candidate_groups = set() for job in jobs: if job in self._ready_jobs:...
https://github.com/snakemake/snakemake/issues/806
Building DAG of jobs... Using shell: /usr/bin/bash Provided cores: 4 Rules claiming more threads will be scaled down. Job counts: count jobs 1 all 1 corpus 2 shard 4 [Wed Dec 16 11:46:00 2020] checkpoint shard: output: data/batches.es jobid: 2 wildcards: lang=es Downstream jobs will be updated after completion. [Wed...
FileNotFoundError
def register_running(self, jobs): self._running.update(jobs) self._ready_jobs -= jobs for job in jobs: try: del self._n_until_ready[job] except KeyError: # already gone pass
def register_running(self, jobs): self._ready_jobs -= jobs for job in jobs: try: del self._n_until_ready[job] except KeyError: # already gone pass
https://github.com/snakemake/snakemake/issues/806
Building DAG of jobs... Using shell: /usr/bin/bash Provided cores: 4 Rules claiming more threads will be scaled down. Job counts: count jobs 1 all 1 corpus 2 shard 4 [Wed Dec 16 11:46:00 2020] checkpoint shard: output: data/batches.es jobid: 2 wildcards: lang=es Downstream jobs will be updated after completion. [Wed...
FileNotFoundError
def finish(self, job, update_dynamic=True): """Finish a given job (e.g. remove from ready jobs, mark depending jobs as ready).""" self._running.remove(job) # turn off this job's Reason self.reason(job).mark_finished() try: self._ready_jobs.remove(job) except KeyError: pass...
def finish(self, job, update_dynamic=True): """Finish a given job (e.g. remove from ready jobs, mark depending jobs as ready).""" # turn off this job's Reason self.reason(job).mark_finished() try: self._ready_jobs.remove(job) except KeyError: pass if job.is_group(): ...
https://github.com/snakemake/snakemake/issues/806
Building DAG of jobs... Using shell: /usr/bin/bash Provided cores: 4 Rules claiming more threads will be scaled down. Job counts: count jobs 1 all 1 corpus 2 shard 4 [Wed Dec 16 11:46:00 2020] checkpoint shard: output: data/batches.es jobid: 2 wildcards: lang=es Downstream jobs will be updated after completion. [Wed...
FileNotFoundError
def replace_job(self, job, newjob, recursive=True): """Replace given job with new job.""" add_to_targetjobs = job in self.targetjobs jobid = self.jobid(job) depending = list(self.depending[job].items()) if self.finished(job): self._finished.add(newjob) self.delete_job(job, recursive=re...
def replace_job(self, job, newjob, recursive=True): """Replace given job with new job.""" add_to_targetjobs = job in self.targetjobs depending = list(self.depending[job].items()) if self.finished(job): self._finished.add(newjob) self.delete_job(job, recursive=recursive) if add_to_targ...
https://github.com/snakemake/snakemake/issues/806
Building DAG of jobs... Using shell: /usr/bin/bash Provided cores: 4 Rules claiming more threads will be scaled down. Job counts: count jobs 1 all 1 corpus 2 shard 4 [Wed Dec 16 11:46:00 2020] checkpoint shard: output: data/batches.es jobid: 2 wildcards: lang=es Downstream jobs will be updated after completion. [Wed...
FileNotFoundError
def finished(self, job, keep_metadata=True): if not keep_metadata: for f in job.expanded_output: self._delete_record(self._incomplete_path, f) return version = str(job.rule.version) if job.rule.version is not None else None code = self._code(job.rule) input = self._input(job...
def finished(self, job, keep_metadata=True): if not keep_metadata: for f in job.expanded_output: self._delete_record(self._incomplete_path, f) return version = str(job.rule.version) if job.rule.version is not None else None code = self._code(job.rule) input = self._input(job...
https://github.com/snakemake/snakemake/issues/741
user@:/analysis$ snakemake --cores 1 -pr --report test.html all Building DAG of jobs... Creating report... Adding shell_rule.txt (0 MB). Adding run_rule.txt (0 MB). Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/snakemake/__init__.py", line 668, in snakemake success = workflow.execute( ...
TypeError
def outputs_older_than_script_or_notebook(self): """return output that's older than script, i.e. script has changed""" path = self.rule.script or self.rule.notebook if not path: return if self.rule.basedir: # needed if rule is included from another subdirectory path = os.path.rel...
def outputs_older_than_script_or_notebook(self): """return output that's older than script, i.e. script has changed""" path = self.rule.script or self.rule.notebook if not path: return assert os.path.exists(path) # to make sure lstat works script_mtime = os.lstat(path).st_mtime for f in...
https://github.com/snakemake/snakemake/issues/417
$ snakemake --list-code-changes Building DAG of jobs... Traceback (most recent call last): File "/Users/haje01/.pyenv/versions/3.7.2/envs/ml2/lib/python3.7/site-packages/snakemake/__init__.py", line 654, in snakemake keepincomplete=keep_incomplete, File "/Users/haje01/.pyenv/versions/3.7.2/envs/ml2/lib/python3.7/site-...
AssertionError
def __init__(self, max_wait_time, nthreads=8): self.mtime = dict() self.mtime_target = PassthroughDict( self.mtime ) # filled in case of symlink with mtime of target self.exists_local = dict() self.exists_remote = dict() self.size = dict() # Indicator whether an inventory has been c...
def __init__(self, max_wait_time): self.mtime = dict() self.exists_local = ExistsDict(self) self.exists_remote = ExistsDict(self) self.size = dict() # Indicator whether an inventory has been created for the root of a given IOFile. # In case of remote objects the root is the bucket or server host...
https://github.com/snakemake/snakemake/issues/611
Building DAG of jobs... Traceback (most recent call last): File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/__init__.py", line 709, in snakemake keepincomplete=keep_incomplete, File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/workflow.py"...
FileNotFoundError
def needs_inventory(self, path): return path and path not in self.has_inventory
def needs_inventory(self, path): root = self.get_inventory_root(path) return root and root not in self.has_inventory
https://github.com/snakemake/snakemake/issues/611
Building DAG of jobs... Traceback (most recent call last): File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/__init__.py", line 709, in snakemake keepincomplete=keep_incomplete, File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/workflow.py"...
FileNotFoundError
def in_inventory(self, path): return path and path in self.has_inventory
def in_inventory(self, path): root = self.get_inventory_root(path) return root and root in self.has_inventory
https://github.com/snakemake/snakemake/issues/611
Building DAG of jobs... Traceback (most recent call last): File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/__init__.py", line 709, in snakemake keepincomplete=keep_incomplete, File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/workflow.py"...
FileNotFoundError
def clear(self): self.mtime.clear() self.mtime_target.clear() self.size.clear() self.exists_local.clear() self.exists_remote.clear() self.has_inventory.clear() self.remaining_wait_time = self.max_wait_time
def clear(self): self.mtime.clear() self.size.clear() self.exists_local.clear() self.exists_remote.clear() self.has_inventory.clear() self.remaining_wait_time = self.max_wait_time
https://github.com/snakemake/snakemake/issues/611
Building DAG of jobs... Traceback (most recent call last): File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/__init__.py", line 709, in snakemake keepincomplete=keep_incomplete, File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/workflow.py"...
FileNotFoundError
def deactivate(self): self.active = False for t in self.threads: t.join() self.threads = [] self.clear()
def deactivate(self): self.clear() self.active = False
https://github.com/snakemake/snakemake/issues/611
Building DAG of jobs... Traceback (most recent call last): File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/__init__.py", line 709, in snakemake keepincomplete=keep_incomplete, File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/workflow.py"...
FileNotFoundError
def __new__(cls, file): # Remove trailing slashes. obj = str.__new__(cls, file) obj._is_function = isfunction(file) or ismethod(file) obj._is_function = obj._is_function or ( isinstance(file, AnnotatedString) and bool(file.callable) ) obj._file = file obj.rule = None obj._regex =...
def __new__(cls, file): # Remove trailing slashes. obj = str.__new__(cls, file) obj._is_function = isfunction(file) or ismethod(file) obj._is_function = obj._is_function or ( isinstance(file, AnnotatedString) and bool(file.callable) ) obj._file = file obj.rule = None obj._regex =...
https://github.com/snakemake/snakemake/issues/611
Building DAG of jobs... Traceback (most recent call last): File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/__init__.py", line 709, in snakemake keepincomplete=keep_incomplete, File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/workflow.py"...
FileNotFoundError
def iocache(raise_error=False): def inner_iocache(func): @functools.wraps(func) def wrapper(self, *args, **kwargs): iocache = self.rule.workflow.iocache if not iocache.active or self.inventory_path is None: return func(self, *args, **kwargs) cache...
def iocache(func): @functools.wraps(func) def wrapper(self, *args, **kwargs): if self.rule.workflow.iocache.active: cache = getattr(self.rule.workflow.iocache, func.__name__) normalized = self.rstrip("/") if normalized in cache: return cache[normalized...
https://github.com/snakemake/snakemake/issues/611
Building DAG of jobs... Traceback (most recent call last): File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/__init__.py", line 709, in snakemake keepincomplete=keep_incomplete, File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/workflow.py"...
FileNotFoundError
def wrapper(self, *args, **kwargs): iocache = self.rule.workflow.iocache if not iocache.active or self.inventory_path is None: return func(self, *args, **kwargs) cache = getattr(iocache, func.__name__) # first check if file is present in cache if self.inventory_path in cache: res = ...
def wrapper(self, *args, **kwargs): if self.rule.workflow.iocache.active: cache = getattr(self.rule.workflow.iocache, func.__name__) normalized = self.rstrip("/") if normalized in cache: return cache[normalized] v = func(self, *args, **kwargs) cache[normalized] = ...
https://github.com/snakemake/snakemake/issues/611
Building DAG of jobs... Traceback (most recent call last): File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/__init__.py", line 709, in snakemake keepincomplete=keep_incomplete, File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/workflow.py"...
FileNotFoundError
def inventory(self): """Starting from the given file, try to cache as much existence and modification date information of this and other files as possible. """ cache = self.rule.workflow.iocache if ( cache.active and not self.inventory_path is None and cache.needs_inventory(s...
def inventory(self): """Starting from the given file, try to cache as much existence and modification date information of this and other files as possible. """ cache = self.rule.workflow.iocache if cache.active and cache.needs_inventory(self): if self.is_remote: # info not yet in...
https://github.com/snakemake/snakemake/issues/611
Building DAG of jobs... Traceback (most recent call last): File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/__init__.py", line 709, in snakemake keepincomplete=keep_incomplete, File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/workflow.py"...
FileNotFoundError
def _local_inventory(self, cache): # for local files, perform BFS via os.scandir to determine existence of files # obtaining mtime and size of the files is deferred for parallel execution # as this can be a slow step on network filesystems path = self.inventory_root if not os.path.exists(path): ...
def _local_inventory(self, cache): # for local files, perform BFS via os.scandir to determine existence of files if cache.remaining_wait_time <= 0: # No more time to create inventory. return start_time = time.time() root = cache.get_inventory_root(self) if root == self: # t...
https://github.com/snakemake/snakemake/issues/611
Building DAG of jobs... Traceback (most recent call last): File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/__init__.py", line 709, in snakemake keepincomplete=keep_incomplete, File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/workflow.py"...
FileNotFoundError
def update_remote_filepath(self): # if the file string is different in the iofile, update the remote object # (as in the case of wildcard expansion) remote_object = self.remote_object if remote_object._file != self._file: remote_object._iofile = self self.set_inventory_paths()
def update_remote_filepath(self): # if the file string is different in the iofile, update the remote object # (as in the case of wildcard expansion) remote_object = self.remote_object if remote_object._file != self._file: remote_object._iofile = self
https://github.com/snakemake/snakemake/issues/611
Building DAG of jobs... Traceback (most recent call last): File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/__init__.py", line 709, in snakemake keepincomplete=keep_incomplete, File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/workflow.py"...
FileNotFoundError
def mtime_local(self): # do not follow symlinks for modification time lstat = os.lstat(self.file) if stat.S_ISDIR(lstat.st_mode) and os.path.exists( os.path.join(self.file, TIMESTAMP_FILENAME) ): return os.lstat(os.path.join(self.file, TIMESTAMP_FILENAME)).st_mtime else: retu...
def mtime_local(self): # do not follow symlinks for modification time if os.path.isdir(self.file) and os.path.exists( os.path.join(self.file, ".snakemake_timestamp") ): return os.lstat(os.path.join(self.file, ".snakemake_timestamp")).st_mtime else: return os.lstat(self.file).st_m...
https://github.com/snakemake/snakemake/issues/611
Building DAG of jobs... Traceback (most recent call last): File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/__init__.py", line 709, in snakemake keepincomplete=keep_incomplete, File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/workflow.py"...
FileNotFoundError
def is_newer(self, time): """Returns true of the file is newer than time, or if it is a symlink that points to a file newer than time.""" if self.is_ancient: return False elif self.is_remote: return self.mtime > time else: return self.mtime > time or self.mtime_target > time
def is_newer(self, time): """Returns true of the file is newer than time, or if it is a symlink that points to a file newer than time.""" if self.is_ancient: return False elif self.is_remote: # If file is remote but provider does not override the implementation this # is the best...
https://github.com/snakemake/snakemake/issues/611
Building DAG of jobs... Traceback (most recent call last): File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/__init__.py", line 709, in snakemake keepincomplete=keep_incomplete, File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/workflow.py"...
FileNotFoundError
def touch(self, times=None): """times must be 2-tuple: (atime, mtime)""" try: if self.is_directory: file = os.path.join(self.file, TIMESTAMP_FILENAME) # Create the flag file if it doesn't exist if not os.path.exists(file): with open(file, "w") as f: ...
def touch(self, times=None): """times must be 2-tuple: (atime, mtime)""" try: if self.is_directory: file = os.path.join(self.file, ".snakemake_timestamp") # Create the flag file if it doesn't exist if not os.path.exists(file): with open(file, "w") as f...
https://github.com/snakemake/snakemake/issues/611
Building DAG of jobs... Traceback (most recent call last): File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/__init__.py", line 709, in snakemake keepincomplete=keep_incomplete, File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/workflow.py"...
FileNotFoundError
def touch_or_create(self): try: self.touch() except MissingOutputException: # first create directory if it does not yet exist dir = self.file if self.is_directory else os.path.dirname(self.file) if dir: os.makedirs(dir, exist_ok=True) # create empty file ...
def touch_or_create(self): try: self.touch() except MissingOutputException: # first create directory if it does not yet exist dir = self.file if self.is_directory else os.path.dirname(self.file) if dir: os.makedirs(dir, exist_ok=True) # create empty file ...
https://github.com/snakemake/snakemake/issues/611
Building DAG of jobs... Traceback (most recent call last): File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/__init__.py", line 709, in snakemake keepincomplete=keep_incomplete, File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/workflow.py"...
FileNotFoundError
def wrapper(self, *args, **kwargs): iocache = self.rule.workflow.iocache if not iocache.active or self.inventory_path is None: return func(self, *args, **kwargs) cache = getattr(iocache, func.__name__) # first check if file is present in cache if self.inventory_path in cache: res = ...
def wrapper(self, *args, **kwargs): if self.is_remote: if hasattr(self.remote_object, func.__name__): return getattr(self.remote_object, func.__name__)(*args, **kwargs) return func(self, *args, **kwargs)
https://github.com/snakemake/snakemake/issues/611
Building DAG of jobs... Traceback (most recent call last): File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/__init__.py", line 709, in snakemake keepincomplete=keep_incomplete, File "<base_path>/software/miniconda/envs/snakemake/lib/python3.7/site-packages/snakemake/workflow.py"...
FileNotFoundError