Automatic ruff lint fixes, plus some type additions and docs.#58
Automatic ruff lint fixes, plus some type additions and docs.#58ialarmedalien merged 1 commit intomainfrom
Conversation
| print("Target DDL:") | ||
| print(target_ddl) | ||
|
|
||
| import duckdb |
There was a problem hiding this comment.
moved to top of file
| invertible: bool = False, # noqa: FBT001, FBT002 | ||
| index: bool = False, # noqa: FBT001, FBT002 |
There was a problem hiding this comment.
one of the linters gets in a tizzy if you have boolean arguments, so turning off warnings here
There was a problem hiding this comment.
I'm guessing that it wants to see them as keyword-only arguments? I do like that style, but I'm not opposed to ignoring it for now.
| msg = f"Test {node.originalname} has no docstring" | ||
| raise AssertionError(msg) |
There was a problem hiding this comment.
separate out the error message interpolation/composition from the raise statement, call the error using a variable
|
|
||
| @pytest.mark.parametrize( | ||
| "source_datatype,target_datatype,source_value,target_value,invertible", | ||
| ("source_datatype", "target_datatype", "source_value", "target_value", "invertible"), |
There was a problem hiding this comment.
preferred way to name variables in pytest parametrize
| typ = v["type"] | ||
| else: | ||
| typ = "D" | ||
| typ = v.get("type", "D") |
There was a problem hiding this comment.
use get's default instead of the if/else
| f"Class '{schema_class}' is missing in target" | ||
| ) | ||
| assert "Agent" in target_schema.classes.keys(), "Derived class 'Agent' is missing in target" | ||
| for schema_class in source_schema.classes: |
There was a problem hiding this comment.
no need for .keys() when iterating through dict keys
| f"Class '{schema_class}' is missing in target" | ||
| ) | ||
| assert "Agent" in target_schema.classes.keys(), "Derived class 'Agent' is missing in target" | ||
| for schema_class in source_schema.classes: |
There was a problem hiding this comment.
no need for .keys()
| target_schema = mapper.derive_schema(specification) | ||
| # classes must be the same with addition | ||
| for schema_class in source_schema.classes.keys(): | ||
| for schema_class in source_schema.classes: |
There was a problem hiding this comment.
more lost .keys()
| schema_url = "https://raw.githubusercontent.com/biolink/biolink-model/master/biolink-model.yaml" | ||
| sv = SchemaView(schema_url) | ||
| return sv | ||
| return SchemaView(schema_url) |
There was a problem hiding this comment.
no need to assign to variable - just return
| x = obj_tr._coerce_datatype("5", "integer") | ||
| def test_coerce(obj_tr: ObjectTransformer) -> None: | ||
| """Test datatype coercion.""" | ||
| x = obj_tr._coerce_datatype("5", "integer") # noqa: SLF001 |
There was a problem hiding this comment.
tell ruff that it's OK to reference a private function (._coerce_datatype())
| invertible: bool = False, # noqa: FBT001, FBT002 | ||
| index: bool = False, # noqa: FBT001, FBT002 |
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'm guessing that it wants to see them as keyword-only arguments? I do like that style, but I'm not opposed to ignoring it for now.
More ruff autofixes, plus some extra typing and docs to appease the pydocstyle gods.