Best Python code snippet using localstack_python
method.py
Source:method.py  
...159    """160    Decorator for methods on a `Node` subclass. `@publisher(T)` causes the method to be161    able to publish to the topic `T`.162    """163    def publisher_wrapper(method: PublisherType) -> PublisherType:164        metadata = get_method_metadata(method)165        metadata.published_topics.append(topic)166        metadata.validate()167        return method168    return publisher_wrapper169class Subscriber(NodeMethod):170    """171    Represents a Labgraph method decorated by `@subscriber`.172    """173    subscribed_topic_path: str174    def __init__(self, name: str, subscribed_topic_path: str) -> None:175        NodeMethod.__init__(self, name)176        self.subscribed_topic_path = subscribed_topic_path177def subscriber(topic: Topic) -> Callable[[SubscriberType], SubscriberType]:...cli.py
Source:cli.py  
...38    The emitted event contains the invoked command, plus any parameter names if their associated values are truthy (but39    not the values themselves).40    """41    @functools.wraps(fn)42    def publisher_wrapper(*args, **kwargs):43        if config.DISABLE_EVENTS:44            return fn(*args, **kwargs)45        ctx = click.get_current_context()46        full_command = " ".join(_get_parent_commands(ctx) + [ctx.command.name])47        publish_cmd_process = Process(48            target=_publish_cmd_as_analytics_event,49            args=(full_command, [k for k, v in ctx.params.items() if v]),50        )51        publish_cmd_process.start()52        publish_cmd_process.join(ANALYTICS_API_RESPONSE_TIMEOUT_SECS)53        publish_cmd_process.terminate()54        return fn(*args, **kwargs)...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
