1
0
forked from VimPlug/jedi

Fix attrs + remove dataclass_transform init=false tests

This commit is contained in:
Eric Masseran
2025-03-17 23:51:53 +01:00
parent bd1edfce78
commit e140523211
2 changed files with 17 additions and 29 deletions

View File

@@ -624,8 +624,11 @@ def _dataclass(value, arguments, callback):
)
]
)
else:
# Decorator customization
elif c.is_function():
# dataclass_transform on a decorator equivalent of @dataclass
return ValueSet([value])
elif value.name.string_name != "dataclass_transform":
# dataclass (or like) decorator customization
return ValueSet(
[
DataclassDecorator(
@@ -634,6 +637,9 @@ def _dataclass(value, arguments, callback):
)
]
)
else:
# dataclass_transform decorator customization; nothing impactful
return ValueSet([value])
return NO_VALUES
@@ -796,17 +802,6 @@ _implemented = {
# For now this works at least better than Jedi trying to understand it.
'dataclass': _dataclass
},
# attrs exposes declaration interface roughly compatible with dataclasses
# via attrs.define, attrs.frozen and attrs.mutable
# https://www.attrs.org/en/stable/names.html
'attr': {
'define': _dataclass,
'frozen': _dataclass,
},
'attrs': {
'define': _dataclass,
'frozen': _dataclass,
},
'os.path': {
'dirname': _create_string_input_function(os.path.dirname),
'abspath': _create_string_input_function(os.path.abspath),