Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make executable #38

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

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.

@@ -67,7 +67,7 @@ def to_str(self, join_char: str, add_comment: bool = False) -> str:
Returns:
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.

version: str = config_version

def __init__(self, *args, **kwargs) -> None:
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