-
Notifications
You must be signed in to change notification settings - Fork 191
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
Bump ruff version #6614
Bump ruff version #6614
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
#!/usr/bin/env runaiida | ||
from aiida.engine import run | ||
from serialize_workchain import SerializeWorkChain | ||
|
||
from aiida.engine import run | ||
|
||
if __name__ == '__main__': | ||
print(run(SerializeWorkChain, a=1, b=1.2, c=True)) | ||
# Result: {'a': 1, 'b': 1.2, 'c': True} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from aiida.engine import ToContext, WorkChain | ||
from child import ChildWorkChain | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This rearrangement is not that great, but whatever. |
||
from aiida.engine import ToContext, WorkChain | ||
|
||
|
||
class ComplexParentWorkChain(WorkChain): | ||
@classmethod | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,7 +177,7 @@ def list_options(self, entry_point: str) -> list: | |
# ``typing.Union[str, None].__args__`` will return the tuple ``(str, NoneType)``. So to get the real type, | ||
# we simply remove all ``NoneType`` and the remaining type should be the type of the option. | ||
if hasattr(field_info.annotation, '__args__'): | ||
args = list(filter(lambda e: e != type(None), field_info.annotation.__args__)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is one of the few changes, I think this is correct, but please check. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @edan-bainglass I think you familiar with this part? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only way a different result can be achieved is when a custom type overwrites the equal function. That is not the case for |
||
args = list(filter(lambda e: e is not type(None), field_info.annotation.__args__)) | ||
# Click parameters only support specifying a single type, so we default to the first one even if the | ||
# pydantic model defines multiple. | ||
field_type = args[0] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -208,7 +208,7 @@ def _resolve_nested_context(self, key: str) -> tuple[AttributeDict, str]: | |
# (subclasses of AttributeDict) but after resolution of an Awaitable this will be the value itself | ||
# * assumption: a resolved value is never a plain AttributeDict, on the other hand if a resolved Awaitable | ||
# would be an AttributeDict we can append things to it since the order of tasks is maintained. | ||
if type(ctx) != AttributeDict: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if type(ctx) is not AttributeDict: | ||
raise ValueError( | ||
f'Can not update the context for key `{key}`:' | ||
f' found instance of `{type(ctx)}` at `{".".join(ctx_path[:index+1])}`, expected AttributeDict' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
import io | ||
|
||
import pytest | ||
|
||
from aiida import orm | ||
from aiida.common import datastructures | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
import os | ||
|
||
import pytest | ||
|
||
from aiida import orm | ||
from aiida.common import datastructures | ||
|
||
|
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.
do you know what this did?
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.
This was excluding files
docs/source/topics/processes/include/snippets/functions/parse_docstring_expose_ipython.py
anddocs/source/topics/processes/include/snippets/functions/signature_plain_python_call_illegal.py
from linting and formatting.I've moved this configuration to pyproject.toml which I think is a much better place for it. For example, you can now run ruff also manually outside of pre-commit and it will have the same configuration.
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.
Ah this is reusing a yaml anchor! thanks!
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.
What you said, yes 😅
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.
FTR: I am refusing to google what is "yaml anchor" :-D