shared-class.snap•1.91 kB
---
/TEST_OUTPUT/workspace/another_consumer.py
References in File: 3
At: L5:C5, L16:C23, L37:C14
1|"""Another module that uses helpers and shared components."""
2|
3|from helper import (
4| SHARED_CONSTANT,
5| SharedClass,
6| helper_function,
7| Color,
8|)
9|
10|
11|class AnotherImplementation:
12| """A class that uses shared components but doesn't implement interfaces."""
13|
14| def __init__(self):
15| """Initialize the implementation."""
16| self.shared = SharedClass[str]("another", SHARED_CONSTANT)
17|
18| def do_something(self) -> str:
19| """Do something with the shared components.
20|
21| Returns:
...
31|def another_consumer_function() -> None:
32| """Another function that uses various shared components."""
33| # Use shared constants
34| print(f"Using constant: {SHARED_CONSTANT}")
35|
36| # Use shared class with a different type parameter
37| shared = SharedClass[float]("another example", 3.14)
38|
39| # Use methods from shared class
40| name = shared.get_name()
41| value = shared.get_value()
42| print(f"Name: {name}, Value: {value}")
---
/TEST_OUTPUT/workspace/consumer.py
References in File: 2
At: L6:C5, L46:C14
1|"""Consumer module that uses the helper module."""
2|
3|from helper import (
4| helper_function,
5| get_items,
6| SharedClass,
7| SharedInterface,
8| SHARED_CONSTANT,
9| Color,
10|)
11|
...
34|def consumer_function() -> None:
...
41| items = get_items()
42| for item in items:
43| print(f"Processing {item}")
44|
45| # Use the shared class
46| shared = SharedClass[str]("consumer", SHARED_CONSTANT)
47| print(f"Using shared class: {shared.get_name()} - {shared.get_value()}")
48|
49| # Use our implementation of the shared interface
50| impl = MyImplementation()
51| result = impl.process(items)