This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FileStorage: | |
def create_with_name(self, name): | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __name__ == '__main__': | |
if settings.config.storage = FileStorage: | |
storage = FileStorage() | |
if settings.config.storage = DatabaseStorage: | |
storage = DatabaseStorage() | |
user = User(storage=storage) | |
user.create_with_name(name=...) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from accessify import implements | |
class HumanInterface: | |
@staticmethod | |
def eat(food, *args, allergy=None, **kwargs): | |
pass | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "examples/interfaces/single.py", line 18, in <module> | |
@implements(HumanInterface) | |
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/accessify/interfaces.py", line 66, in decorator | |
interface_method_arguments=interface_method.arguments_as_string, | |
accessify.errors.InterfaceMemberHasNotBeenImplementedException: class Human | |
does not implement interface member HumanInterface.eat(food, args, allergy, kwargs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from accessify import implements | |
class HumanInterface: | |
@staticmethod | |
def eat(food, *args, allergy=None, **kwargs): | |
pass | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "examples/interfaces/single_arguments.py", line 16, in <module> | |
@implements(HumanInterface) | |
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/accessify/interfaces.py", line 87, in decorator | |
interface_method_arguments=interface_method.arguments_as_string, | |
accessify.errors.InterfaceMemberHasNotBeenImplementedWithMismatchedArgumentsException: | |
class Human implements interface member HumanInterface.eat(food, args, allergy, kwargs) | |
with mismatched arguments |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from accessify import implements, private | |
class HumanInterface: | |
@private | |
@staticmethod | |
def eat(food, *args, allergy=None, **kwargs): | |
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "examples/interfaces/single_access.py", line 18, in <module> | |
@implements(HumanInterface) | |
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/accessify/interfaces.py", line 77, in decorator | |
interface_method_name=interface_method.name, | |
accessify.errors.ImplementedInterfaceMemberHasIncorrectAccessModifierException: | |
Human.eat(food, args, allergy, kwargs) mismatches | |
HumanInterface.eat() member access modifier. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from accessify import implements | |
class HumanSoulInterface: | |
def love(self, who, *args, **kwargs): | |
pass | |
class HumanBasicsInterface: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "examples/interfaces/multiple.py", line 19, in <module> | |
@implements(HumanSoulInterface, HumanBasicsInterface) | |
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/accessify/interfaces.py", line 66, in decorator | |
interface_method_arguments=interface_method.arguments_as_string, | |
accessify.errors.InterfaceMemberHasNotBeenImplementedException: | |
class Human does not implement interface member | |
HumanBasicsInterface.eat(food, args, allergy, kwargs) |