Skip to content

Commit

Permalink
minor improvment to performance
Browse files Browse the repository at this point in the history
  • Loading branch information
hgromer committed Apr 9, 2021
1 parent 7bff385 commit 231a4f7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pymarshaler/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.2.2'
__version__ = '0.2.3'
__all__ = ['Marshal', 'utils', 'arg_delegates', 'errors']

from pymarshaler.marshal import Marshal
Expand Down
6 changes: 3 additions & 3 deletions pymarshaler/marshal.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def register(self, cls, delegate: ArgBuilderDelegate):

def get_for(self, cls):
try:
for val in self.registered_delegates:
if cls == val or issubclass(cls, val):
return self.registered_delegates[val]
for delegate_cls, delegate in self.registered_delegates.items():
if cls == delegate_cls or issubclass(cls, delegate_cls):
return delegate
return None
except TypeError:
return None
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setuptools.setup(
name="pymarshaler",
version="0.2.2",
version="0.2.3",
author="Hernan Romer",
author_email="[email protected]",
description="Package to marshal and unmarshal python objects",
Expand Down
1 change: 0 additions & 1 deletion tests/test_marshaling.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import json
import unittest

from pymarshaler import marshal
from pymarshaler.errors import MissingFieldsError, UnknownFieldError
from pymarshaler.marshal import Marshal
from tests.test_classes import *
Expand Down

0 comments on commit 231a4f7

Please sign in to comment.