-
Notifications
You must be signed in to change notification settings - Fork 35
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
base: main
Are you sure you want to change the base?
Make executable #38
Conversation
There was a problem hiding this 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] |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
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