Commits

Chris Mutel committed edeff3a

Ignore warnings with Database.copy()

Comments (0)

Files changed (2)

 ===================
 
 - CHANGE: ``categories`` is no longer required by ``utils.activity_hash``.
+- CHANGE: ``Database.copy()`` no longer emits a not registered warning.
 
 0.13 (2014-02-13)
 ===================

bw2data/database.py

         """
         assert name not in databases, ValueError("This database exists")
         data = self.relabel_data(self.load(), name)
-        new_database = Database(name)
-        new_database.register(
-            format="Brightway2 copy",
-            depends=databases[self.name]["depends"],
-            num_processes=len(data)
-        )
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore")
+            new_database = Database(name)
+            new_database.register(
+                format="Brightway2 copy",
+                depends=databases[self.name]["depends"],
+                num_processes=len(data)
+            )
+
         new_database.write(data)
         return new_database