Repository navigation
Import CSTLogicError and BaseMetadataProvider from their defining modules - #1471
haampie-bot wants to merge 1 commit into
Conversation
…ules
Several modules imported CSTLogicError from the libcst package, and
reentrant_codegen imported BaseMetadataProvider from libcst.metadata,
while those packages import these modules. This only works because of
the order of the imports in the __init__.py files. For example, moving
`from libcst._nodes.base import ...` above `from libcst._exceptions
import ...` in libcst/__init__.py gives:
ImportError: cannot import name 'CSTLogicError' from 'libcst'
|
Hi @haampie-bot! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Summary
import libcstonly works because of the import order inlibcst/__init__.py. Movingfrom libcst._nodes.base import ...abovefrom libcst._exceptions import ...gives:Modules in
_nodesand_parserimportCSTLogicErrorfromlibcst, andmetadata/reentrant_codegen.pyimportsBaseMetadataProviderfromlibcst.metadata. This PR imports both from their defining modules.Test Plan
__init__.pyto the top and imported the package. 9 of these moves fail onmain, none on this branch. Found with uncycle.ufmt checkandflake8pass.AI disclosure: made with Claude (Anthropic). Opened from a bot account on behalf of @haampie.