Skip to content

Conversation

@KanatSeytov
Copy link

@KanatSeytov KanatSeytov commented Aug 27, 2023

Using script for as cli app raise multiuple errors, starting from wrong field in model and in writing data in csv file, this request make it executable, example of request: python parser-2gis.py -i https://2gis.kz/almaty/search/%D0%9F%D0%BE%D0%B5%D1%81%D1%82%D1%8C -f csv -o C:\Users\Папин\Desktop\Kanat\commits
get default path to Config and remove wrong lines

Copy link
Owner

@interlark interlark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution, configuration's validation errors will be fixed in v1.2.0 anyway.

Schedule as a string.
"""
days_names = [x.name for x in self.__fields__.values() if x.type_ == ScheduleDay]
days_names = [x.name for x in self.__fields__.values() if type(x) == ScheduleDay]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not quite sure what version of Pydantic you use, but type(x) should always return pydantic.fields.ModelField, that's why there is special attribute type_ for the fields.

def setup_config(model: BaseModel) -> None:
"""Recursively setup config."""
self.Config.validate_assignment = True
# self.Config.validate_assignment = True
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assignments validation is important for any settings changes, why have you turned it off?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants