Updated Marketplace models & log_level settings#14
Conversation
67719c6 to
ce22091
Compare
|
|
||
| [tool.ruff.format] | ||
| line-ending = "lf" | ||
| #quote-style="single" |
There was a problem hiding this comment.
Remove comment or uncomment
| ) -> BaseModel: | ||
| def fetch_config(self, data: str) -> (BaseModel, int): | ||
| """ | ||
| Fetch and validate the configuration from either the data string or the filepath |
There was a problem hiding this comment.
Remove file path reference in comment
| elif config: | ||
| lvl = config.log_level | ||
| else: | ||
| lvl = "DEBUG" |
There was a problem hiding this comment.
The model default is INFO. Not a big deal, just surfacing the delta. Also, might as well use your enum
| from pydantic import BaseModel, Field, model_validator | ||
| from pydantic.functional_validators import model_validator |
There was a problem hiding this comment.
I dont see where model_validator is used, but it's somewhere hidden from me, alias one of these. I suspect this is IDE (un)helpfully importing a dependency and not cleaning up.
There was a problem hiding this comment.
Consider adding SemVer as project.version type
| ] | ||
|
|
||
|
|
||
| class TenintConnectorTimeout(BaseModel): |
There was a problem hiding this comment.
Comment with unit (seconds)
|
|
||
|
|
||
| class TenintConnectorResources(BaseModel): | ||
| disk: int = 1024 |
| # The default maximum run time in seconds | ||
| timeout = 3600 | ||
| [tool.tenint.connector.timeout] | ||
| default = 3600 |
There was a problem hiding this comment.
Does validate_default=True do some magic that populates timeout.min and timeout.max?
There was a problem hiding this comment.
yup. forces the default value to enter sub-model
| # No longer need to test file input as this functionality has been removed as it's | ||
| # no longer necessary at this time. | ||
| # | ||
| # def test_connector_fetch_config_json_file(AppSettings, tmp_path): | ||
| # fn = tmp_path.joinpath("example.json") | ||
| # fn.write_text('{"is_bool": true}') | ||
| # connector = Connector(settings=AppSettings) | ||
| # assert connector.fetch_config(fn=fn) == AppSettings(is_bool=True) |
| # def test_connector_fetch_config_toml_file(AppSettings, tmp_path): | ||
| # fn = tmp_path.joinpath("example.toml") | ||
| # fn.write_text("is_bool = true") | ||
| # connector = Connector(settings=AppSettings) | ||
| # assert connector.fetch_config(fn=fn) == AppSettings(is_bool=True) |
Description
runcommand to improve readabilityType of change
Please delete options that are not relevant.
How Has This Been Tested?
Unit testing and additional tests have been added
Test Configuration:
Checklist: