Closed miwaniza closed 3 months ago
I can't see any changes in the device settings files. The start and end gcode parameters are shown as changed, but I've compared the two strings and can't find a difference. What was changed?
Also, for the pydantic, I believe we make it work for any version with the following code:
from pydantic import BaseModel, __version__
if int(__version__.split('.')[0]) >= 2:
from pydantic import model_validator as validator
validator_args = {"mode": "before"}
else:
from pydantic import root_validator as validator
validator_args = {"pre": True}
class BaseModelPlus(BaseModel):
...
...
...
@classmethod
@validator(**validator_args)
def check_card_number_omitted(cls, values):
Please implement that unless you see any issues.
The pydantic update is now implemented in commit bf8066836df2c0adc2e7d82ae9dc794dbb9dfce0
It required a few changes to some other bits of the repo too.
Thanks for raising the issue! requirements.txt and pyproject.toml have been updated to allow all versions of pydantic. The updated fullcontrol code checks which version of pydantic is installed and implements the appropriate function for the installed version.
See my comment above about device settings files. Please raise a new pr for that aspect if it is valid.
I can't see any changes in the device settings files. The start and end gcode parameters are shown as changed, but I've compared the two strings and can't find a difference. What was changed?
That's about line endings. Somewhere it was CR LF inserted within the gcode strings, so I removed them, because pylance used to highlight that these line breaks can't be within the string.
Also, for the pydantic, I believe we make it work for any version with the following code:
No, it won't, because pydantic also have updated decorators, e.g. to @model_validator
Ah that makes sense with the CR LF. Github didn't highlight the changes and they didn't manifest when I cipy/pasted
I believe the pydantic code does work (I tested it on two versions of pydantic) cos the correct validator is selected and applied dynamically
Migration to latest pydantic with bump-pydantic tool highlighted the issues with gcode in some device setting files. Sorted them out, too.