Skip to content

Remove the dependency on pyrsistent #645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions jsonschema/_types.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import numbers

from pyrsistent import pmap
import attr

from jsonschema.compat import int_types, str_types
Expand Down Expand Up @@ -61,7 +60,7 @@ class TypeChecker(object):

The initial mapping of types to their checking functions.
"""
_type_checkers = attr.ib(default=pmap(), converter=pmap)
_type_checkers = attr.ib(default=dict(), converter=dict)

def is_type(self, instance, type):
"""
Expand Down Expand Up @@ -131,8 +130,10 @@ def redefine_many(self, definitions=()):

A new `TypeChecker` instance.
"""
new_checkers = dict(self._type_checkers)
new_checkers.update(definitions)
return attr.evolve(
self, type_checkers=self._type_checkers.update(definitions),
self, type_checkers=new_checkers,
)

def remove(self, *types):
Expand All @@ -159,7 +160,8 @@ def remove(self, *types):
checkers = self._type_checkers
for each in types:
try:
checkers = checkers.remove(each)
checkers = dict(checkers)
checkers.pop(each)
except KeyError:
raise UndefinedTypeCheck(each)
return attr.evolve(self, type_checkers=checkers)
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ install_requires =
attrs>=17.4.0
functools32;python_version<'3'
importlib_metadata;python_version<'3.8'
pyrsistent>=0.14.0
six>=1.11.0

[options.extras_require]
Expand Down