Skip to content

Commit

Permalink
Merge pull request #4 from SynBioDex/3-accept_method
Browse files Browse the repository at this point in the history
Support visitor pattern
  • Loading branch information
bbartley authored May 21, 2021
2 parents b846167 + 9e27808 commit 2f09b19
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions sbol_factory/sbol_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,14 @@ def __init__(self, *args, **kwargs):
# print(kw, val, type(self.__dict__[kw]))
# raise

def accept(self, visitor):
visitor_method = f'visit_{CLASS_NAME}'.lower()
getattr(visitor, visitor_method)(self)

# Instantiate metaclass
attribute_dict = {}
attribute_dict['__init__'] = __init__
attribute_dict['accept'] = accept
Class = type(CLASS_NAME, (globals()[SUPERCLASS_NAME],), attribute_dict)
globals()[CLASS_NAME] = Class
self.symbol_table[CLASS_NAME] = Class
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

setup(name='sbol_factory',
description='Ontology-driven data modeling',
version='1.0a3',
version='1.0a4',
install_requires=[
'sbol3==1.0a8',
'sbol3==1.0a9',
'rdflib>=5.0.0',
'rdflib-jsonld>=0.5.0',
'sparqlwrapper>=1.8.5',
Expand Down

0 comments on commit 2f09b19

Please sign in to comment.