www.youtube.com###guide-content #endpoint[title="Shorts"]:upward(ytd-guide-entry-renderer)
www.youtube.com###items #endpoint[title="Shorts"]:upward(ytd-mini-guide-entry-renderer)
www.youtube.com##ytd-browse ytd-grid-video-renderer:has(span.ytd-thumbnail-overlay-time-status-renderer[aria-label="Shorts"])
www.youtube.com##ytd-browse ytd-rich-item-renderer:has(span.ytd-thumbnail-overlay-time-status-renderer[aria-label="Shorts"])
www.youtube.com##ytd-search ytd-video-renderer:has(span.ytd-thumbnail-overlay-time-status-renderer[aria-label="Shorts"])
www.youtube.com##ytd-watch-next-secondary-results-renderer ytd-compact-video-renderer:has(span.ytd-thumbnail-overlay-time-status-renderer[aria-label="Shorts"]) if __name__ == "__main__":
a = os.getenv("foo")
b = get_from_somewhere()
c = "some_hardcoded_variable"
my_app(a, b, c)
Is what I would expect in any reasonable codebase. The indirection and cognitive overhead was taken from Java where seeing @Autowired or @Inject, hitting reverse search and not being able to keyword search for the thing being injected is nightmare fuel. That is not something I would wish on an enemy, let alone on any user of a programming language I care for. di = Di()
@di.register('A')
class A:
def __init__(self, di: Di):
pass
def action(self):
print("Hi from A")
@di.register('B')
class B:
def __init__(self, di: Di):
self._di = di
self._a = None
def run(self):
self.get_a().action()
def get_a(self):
if self._a is None:
self._a = self._di.get('A')
return self._a
@di.override('A') # replace class A definition with a new one
class C:
def __init__(self, di: Di):
pass
def action(self):
print("Hi from C")
di.get('B').run() # prints "Hi from C"
di.remove('B') # removes the B dependency from the registry
My suggestion: please not that. class A:
def __init__(self):
pass
def action(self):
print("Hi from A")
class B:
# A is default for some reason
def __init__(self, a=A()):
self._a = a
def run(self):
self._a.action()
class C:
def __init__(self):
pass
def action(self):
print("Hi from C")
if __name__ == "__main__":
if os.getenv('ENV') == "PROD":
a = A()
b = B()
# test/non-prod/whatever version
else:
a = A()
b = B(C())
As someone who's been writing python for a while, I could walk into this having never read it before and say...ok sure, when prod, B takes A behavior, but when not prod, B takes C behavior.
The second example "Jessica | Record a commercial" is perfect. Confidence restored.
The third example "Laura | Help a client" is back to glass in your ears. This time an American is speaking American English transliterated from Russian.
Yikes. The English sounded fine, but the Russian has serious issues. Either there's a bug in your configuration (I hope) or your evals for Russian are unsound.
Edit: dial back the editorializing.