-
Notifications
You must be signed in to change notification settings - Fork 0
Create monolithic RMS runner #6
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
base: master
Are you sure you want to change the base?
Create monolithic RMS runner #6
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| class BaseModel: | ||
| """Minimal BaseModel emulating core pydantic behaviour.""" | ||
|
|
||
| def __init_subclass__(cls) -> None: | ||
| cls.__validators__ = [] | ||
| for attr in dir(cls): | ||
| value = getattr(cls, attr) | ||
| if callable(value) and hasattr(value, "__validator_config__"): | ||
| cls.__validators__.append((value.__validator_config__, value)) | ||
|
|
||
| def __init__(self, **data: Any) -> None: | ||
| annotations = getattr(self, "__annotations__", {}) | ||
| for name in annotations: | ||
| field_info = getattr(self.__class__, name, None) | ||
| if isinstance(field_info, _FieldInfo): | ||
| default_value = field_info.get_default() | ||
| else: | ||
| default_value = field_info | ||
| value = data[name] if name in data else default_value | ||
| setattr(self, name, value) | ||
| extra_keys = set(data.keys()) - set(annotations.keys()) | ||
| if extra_keys: | ||
| raise ValidationError(f"Unexpected fields: {sorted(extra_keys)}") | ||
| self._run_validators() | ||
|
|
||
| def _run_validators(self) -> None: | ||
| for field_name, func in getattr(self.__class__, "__validators__", []): | ||
| current_value = getattr(self, field_name) | ||
| new_value = func(self.__class__, current_value) | ||
| setattr(self, field_name, new_value) | ||
|
|
||
| @classmethod | ||
| def parse_obj(cls, obj: Dict[str, Any]) -> "BaseModel": | ||
| if isinstance(obj, cls): | ||
| return obj | ||
| if not isinstance(obj, dict): | ||
| raise ValidationError("Object must be a dict") | ||
| return cls(**obj) | ||
|
|
||
| def dict(self) -> Dict[str, Any]: | ||
| annotations = getattr(self, "__annotations__", {}) | ||
| return {name: getattr(self, name) for name in annotations} | ||
|
|
||
| def json(self) -> str: | ||
| import json | ||
|
|
||
| return json.dumps(self.dict()) | ||
|
|
||
| def copy(self) -> "BaseModel": | ||
| return self.__class__(**self.dict()) | ||
|
|
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.
Support
update kwarg in BaseModel.copy stub
The lightweight BaseModel.copy implementation only accepts self and always returns self.__class__(**self.dict()). In the configuration loader this stub is invoked as config.copy(update=overrides), mirroring the real pydantic API. Because the stub ignores the update keyword argument, any attempt to load a configuration with overrides raises TypeError: copy() got an unexpected keyword argument 'update', breaking configuration customisation whenever the project runs without the real pydantic dependency. Please implement the update parameter (and optionally deep) in the stub so it remains API-compatible with pydantic 1.x.
Useful? React with 👍 / 👎.
Summary
rms_monolith_full.pythat materialises the full framework, resources, and bootstrap logic from one fileTesting
https://chatgpt.com/codex/tasks/task_e_6905635dcc148324aab009e512efab09