nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: zoofIO/flexx
Pull request #206 (2016-09-14 09:50:57)

Fix that handler could no longer connect to builtin functions
E.g. `foo.connect('bar', print)` would not work anymore.


Patch:
diff --git a/flexx/event/_handler.py b/flexx/event/_handler.py
index e686afb..9869b81 100644
--- a/flexx/event/_handler.py
+++ b/flexx/event/_handler.py
@@ -158,9 +158,10 @@ class Handler:
         if isinstance(func, tuple):
             self._ob2 = weakref.ref(func[1])
             func = func[0]
-        if getattr(func, '__self__', None) is not None:
-            self._ob2 = weakref.ref(func.__self__)
-            func = func.__func__
+        if getattr(func, '__self__', None) is not None:  # builtin funcs have __self__
+            if getattr(func, '__func__', None) is not None:
+                self._ob2 = weakref.ref(func.__self__)
+                func = func.__func__
         
         # Store func, name, and docstring (e.g. for sphinx docs)
         assert callable(func)


Test patch:
diff --git a/flexx/event/tests/test_handlers.py b/flexx/event/tests/test_handlers.py
index 60fa5cc..74077ca 100644
--- a/flexx/event/tests/test_handlers.py
+++ b/flexx/event/tests/test_handlers.py
@@ -192,6 +192,15 @@ def test_func_handlers_with_method_decorator():
     assert repr(foo)
 
 
+def test_handler_builtin_function():
+    
+    class Foo(event.HasEvents):
+        pass
+    
+    foo = Foo()
+    foo.connect('!bar', print)  # this should not error
+
+
 def test_method_handler_invoking():
     called = []
Repository: zoofIO/flexx
Pull request #284 (2016-11-24 10:51:32)

All modules implicitly depend on flexx.app.clientcore
Modules might need core Flexx stuff. But more importantly, the asset uses `flexx.spin`.


Patch:
diff --git a/flexx/app/asset.py b/flexx/app/asset.py
index ac9d5e5..19d4a52 100644
--- a/flexx/app/asset.py
+++ b/flexx/app/asset.py
@@ -231,6 +231,8 @@ class Bundle(Asset):
         bundles, so that bundles themselves can be sorted.
         """
         
+        ext = '.' + self.name.rsplit('.')[-1].lower()
+        
         # Check if module belongs here
         if not m.name.startswith(self._module_name):
             raise ValueError('Module %s does not belong in bundle %s.' %
@@ -241,15 +243,18 @@ class Bundle(Asset):
         self._need_sort = True
         
         # Add deps for this module
+        # Add implicit dependency of core Flexx functionality, like serializer, etc.
         deps = set()
-        for dep in m.deps:
+        module_deps = m.deps
+        if ext == '.js':
+            module_deps.add('flexx.app.clientcore')
+        for dep in module_deps:
             while '.' in dep:
                 deps.add(dep)
                 dep = dep.rsplit('.', 1)[0]
             deps.add(dep)
         
         # Clear deps that are represented by this bundle
-        ext = '.' + self.name.rsplit('.')[-1]
         for dep in deps:
             if not (dep.startswith(self._module_name) or
                     self._module_name.startswith(dep + '.')):


Test patch:
diff --git a/flexx/app/tests/test_asset.py b/flexx/app/tests/test_asset.py
index 90e4cfc..1bfc299 100644
--- a/flexx/app/tests/test_asset.py
+++ b/flexx/app/tests/test_asset.py
@@ -212,6 +212,7 @@ def test_bundle():
     assert bundle.modules == (m3, m1, m2)
     
     # Deps are agregated
+    assert 'flexx.app.clientcore.js' in bundle.deps
     assert 'flexx.app.js' in bundle.deps
     assert 'flexx.app.model.js' in bundle.deps
     assert not any('flexx.ui' in dep for dep in bundle.deps)