Coder Social home page Coder Social logo

Comments (4)

mbyrnepr2 avatar mbyrnepr2 commented on May 26, 2024 1

I don't think so @jacobtylerwalls. That issue is basically about excluding dunders from __members__ (it isn't necessarily about data classes) while this issue is specifically about __members__ not being available at all when dataclass decorator is used. (I have a rough solution for 1730 from the past week or so :D)

from astroid.

mbyrnepr2 avatar mbyrnepr2 commented on May 26, 2024 1

Indeed @DanielNoord. Perhaps I was unclear in the comment. I meant that __members__ isn't present on the astroid representation of the class when it is decorated with dataclass. I agree that it exists on the Python class.

from astroid.

jacobtylerwalls avatar jacobtylerwalls commented on May 26, 2024

Possibly related: #1730

from astroid.

DanielNoord avatar DanielNoord commented on May 26, 2024

Pitching #1598 again as it would be nice to broaden our support for instance variables 😄

Note that this is an issue in astroid, __members__ does exist:

from dataclasses import dataclass
from enum import Enum


@dataclass
class Something(str, Enum):
	asd: str = 1  # [invalid-name]

class OtherSomething(str, Enum):
    asd: str = 1  # [invalid-name]

print(Something.__members__)
print(OtherSomething.__members__)
python test.py
{'asd': <Something.asd: '1'>}
{'asd': <OtherSomething.asd: '1'>}

from astroid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.