mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
typing
This commit is contained in:
@@ -16,9 +16,11 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell
|
||||
|
||||
|
||||
class Usecase:
|
||||
def __init__(self, file, library=None):
|
||||
def __init__(self, file: ifcopenshell.file, library: ifcopenshell.entity_instance):
|
||||
"""Adds a new reference to a library
|
||||
|
||||
A library represents an external data source, such as a database,
|
||||
@@ -54,7 +56,7 @@ class Usecase:
|
||||
"library": library,
|
||||
}
|
||||
|
||||
def execute(self):
|
||||
def execute(self) -> ifcopenshell.entity_instance:
|
||||
if self.file.schema == "IFC2X3":
|
||||
reference = self.file.createIfcLibraryReference()
|
||||
references = list(self.settings["library"].LibraryReference or [])
|
||||
|
||||
@@ -21,7 +21,7 @@ import ifcopenshell.util.element
|
||||
|
||||
|
||||
class Usecase:
|
||||
def __init__(self, file, reference=None):
|
||||
def __init__(self, file: ifcopenshell.file, reference: ifcopenshell.entity_instance):
|
||||
"""Removes a library reference
|
||||
|
||||
Any products which have relationships to this reference will not be
|
||||
@@ -44,7 +44,7 @@ class Usecase:
|
||||
self.file = file
|
||||
self.settings = {"reference": reference}
|
||||
|
||||
def execute(self):
|
||||
def execute(self) -> None:
|
||||
for rel in self.settings["reference"].LibraryRefForObjects:
|
||||
history = rel.OwnerHistory
|
||||
self.file.remove(rel)
|
||||
|
||||
Reference in New Issue
Block a user