nebius/SWE-bench-extra huggingface dataset:
Repository: mmerickel/wired

Issue:
Lookup by class (instead of name) doesn't use fully qualified name
I just did this in a test and was surprised it passed:

```python
# from wired.samples.simple_factory import Greeter
class Greeter:
    pass
factory = registry.find_factory(Greeter)
```

I have a registry with wired.samples.simple_factory.Greeter registered. I made a local Greeter, expecting it to fail on lookup. It passed. 

It appears `wired` only uses the class name, thus two different classes, same name but different modules/packages, would be considered "the same".


Comments:

Patch:
diff --git a/CHANGES.rst b/CHANGES.rst
index 8f65c20..971a172 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -3,6 +3,9 @@ unreleased
 
 - Add support for Python 3.7.
 
+- Fix an issue where two different service classes with the same name would
+  be treated as the same service, defeating the type-based lookup.
+
 0.1.1 (2018-08-04)
 ==================
 
diff --git a/src/wired/container.py b/src/wired/container.py
index 84d7726..37ea146 100644
--- a/src/wired/container.py
+++ b/src/wired/container.py
@@ -418,9 +418,10 @@ def _iface_for_type(obj):
         return iface
 
     # make a new iface and cache it on the object
-    name = obj.__name__
+    name = obj.__qualname__
     iface = InterfaceClass(
-        '%s_IService' % name, __doc__='service_factory generated interface'
+        '%s_%s_IService' % (name, id(obj)),
+        __doc__='service_factory generated interface',
     )
     obj._service_iface = iface
     return iface


Test patch:
diff --git a/tests/test_container.py b/tests/test_container.py
index a27c16b..144ce00 100644
--- a/tests/test_container.py
+++ b/tests/test_container.py
@@ -204,3 +204,16 @@ def test_unregistered_lookup(registry):
     with pytest.raises(LookupError):
         c.get(IBarService)  # IFooService is not specific enough
     assert c.get(IBarService, default=marker) is marker
+
+
+def test_unique_class_objects_with_same_name_dont_conflict(registry):
+    def make_class():
+        class Greeter:
+            pass
+
+        return Greeter
+
+    ClassA = make_class()
+    ClassB = make_class()
+    registry.register_singleton(ClassA(), ClassA)
+    assert registry.find_factory(ClassB) is None