Skip to content
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

Update type annotations of PEP 695 nodes #2264

Merged
merged 1 commit into from Jul 31, 2023

Conversation

jacobtylerwalls
Copy link
Member

Type of Changes

Type
🔨 Refactoring

Description

Closes #2253

These attributes cannot be none in real-world situations, see python/cpython#106145.

@DanielNoord they were already required; we're just changing the type annotations, yes? It's not enforced anywhere in the code.

These attributes cannot be none in real-world situations,
see python/cpython#106145.
@jacobtylerwalls jacobtylerwalls added Maintenance Discussion or action around maintaining astroid or the dev workflow python 3.12 Unreleased labels Jul 31, 2023
@jacobtylerwalls jacobtylerwalls added this to the 3.0.0a9 milestone Jul 31, 2023
@codecov
Copy link

codecov bot commented Jul 31, 2023

Codecov Report

Merging #2264 (0cb48c9) into main (44c1ebb) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2264   +/-   ##
=======================================
  Coverage   92.78%   92.78%           
=======================================
  Files          94       94           
  Lines       10951    10951           
=======================================
  Hits        10161    10161           
  Misses        790      790           
Flag Coverage Δ
linux 92.59% <ø> (ø)
pypy 90.89% <ø> (ø)
windows 92.37% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
astroid/nodes/node_classes.py 94.81% <ø> (ø)

@Pierre-Sassoulas
Copy link
Member

Reading the cpython issue it's unclear to me if it was possible it was None in 3.10 and isn't anymore of if this was never possible that it's None. We still need to support older python interpreter if that's the case.

Copy link
Collaborator

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I had this on my todo list, but didn't get around to it before going on holiday.

I'm trying to keep up with all the ongoing developments but it is quite hard. Feel free to tag me if I missed something in either project!

@DanielNoord
Copy link
Collaborator

Reading the cpython issue it's unclear to me if it was possible it was None in 3.10 and isn't anymore of if this was never possible that it's None. We still need to support older python interpreter if that's the case.

This was only possible in beta's, so making this required is fine imo!

@jacobtylerwalls
Copy link
Member Author

These were new nodes in 3.12, so there's no real-world code that we need to support without these linenos.

@jacobtylerwalls jacobtylerwalls merged commit 3ddf09d into pylint-dev:main Jul 31, 2023
23 checks passed
@jacobtylerwalls jacobtylerwalls deleted the require-location branch July 31, 2023 15:30
@Pierre-Sassoulas
Copy link
Member

Damn, you're really keeping pylint bleeding edge, love that !

mbyrnepr2 pushed a commit to mbyrnepr2/astroid that referenced this pull request Aug 2, 2023
These attributes cannot be none in real-world situations,
see python/cpython#106145.
Pierre-Sassoulas pushed a commit that referenced this pull request Aug 5, 2023
…s__ container (#2263)

* Exclude type-annotated class attributes, which have no assigned value, from the ``__members__`` container of an ``Enum`` class.

Refs pylint-dev/pylint#7402

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix exising test.

The value if now `Uninferable` in the case of
an annotated attribute of an `enum.Enum` class with no assigned value.

* Update astroid/brain/brain_namedtuple_enum.py

Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>

* Update tests.

* Update test: Use `infer()` instead of `inferred()`.

* Update type annotations of PEP 695 nodes (#2264)

These attributes cannot be none in real-world situations,
see python/cpython#106145.

* Update sphinx requirement from ~=7.0 to ~=7.1 (#2265)

Updates the requirements on [sphinx](https://github.com/sphinx-doc/sphinx) to permit the latest version.
- [Release notes](https://github.com/sphinx-doc/sphinx/releases)
- [Changelog](https://github.com/sphinx-doc/sphinx/blob/master/CHANGES)
- [Commits](sphinx-doc/sphinx@v7.0.0...v7.1.1)

---
updated-dependencies:
- dependency-name: sphinx
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Ensure a node is inferred in the case when there is only one member.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Undo unintended changes.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintenance Discussion or action around maintaining astroid or the dev workflow python 3.12 Unreleased
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update location attributes of new Typing nodes
3 participants