nathanwilliams-ct commented on code in PR #2167:
URL: https://github.com/apache/buildstream/pull/2167#discussion_r3765063037


##########
src/buildstream/_loader/loader.py:
##########
@@ -841,6 +869,10 @@ def provenance_str():
 
         element = Element._new_from_load_element(load_element)
 
+        from ..plugins.elements.junction import JunctionElement

Review Comment:
   It's a cyclic import as JunctionElement imports Element already.
   
   I am not a big fan of the cast here, but I am not sure on better way to do 
it with python's type checking. The cast is mainly to keep the type checker 
happy, and I am unsure if it's 'free' at runtime and makes the import 
unnecessary. I did debate wrapping it behind a `if TYPE_CHECKING` gate.
   
   An `assert isinstance(element,JunctionElement)` also didn't play nice, as 
Element is it's base class.
   
   I was trying to work out how I might get _new_from_load_element to just 
return a JunctionElement.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to