@@ -76,9 +76,9 @@ class InvalidJsonPatch(JsonPatchException):
7676
7777class JsonPatchConflict (JsonPatchException ):
7878 """Raised if patch could not be applied due to conflict situation such as:
79- - attempt to add object key then it already exists;
79+ - attempt to add object key when it already exists;
8080 - attempt to operate with nonexistence object key;
81- - attempt to insert value to array at position beyond of it size;
81+ - attempt to insert value to array at position beyond its size;
8282 - etc.
8383 """
8484
@@ -144,7 +144,7 @@ def apply_patch(doc, patch, in_place=False):
144144
145145
146146def make_patch (src , dst ):
147- """Generates patch by comparing of two document objects. Actually is
147+ """Generates patch by comparing two document objects. Actually is
148148 a proxy to :meth:`JsonPatch.from_diff` method.
149149
150150 :param src: Data source document object.
@@ -184,8 +184,8 @@ class JsonPatch(object):
184184 >>> result == expected
185185 True
186186
187- JsonPatch object is iterable, so you could easily access to each patch
188- statement in loop:
187+ JsonPatch object is iterable, so you can easily access each patch
188+ statement in a loop:
189189
190190 >>> lpatch = list(patch)
191191 >>> expected = {'op': 'add', 'path': '/foo', 'value': 'bar'}
@@ -266,7 +266,7 @@ def from_string(cls, patch_str, loads=None):
266266
267267 @classmethod
268268 def from_diff (cls , src , dst , optimization = True , dumps = None ):
269- """Creates JsonPatch instance based on comparing of two document
269+ """Creates JsonPatch instance based on comparison of two document
270270 objects. Json patch would be created for `src` argument against `dst`
271271 one.
272272
@@ -305,13 +305,13 @@ def _ops(self):
305305 return tuple (map (self ._get_operation , self .patch ))
306306
307307 def apply (self , obj , in_place = False ):
308- """Applies the patch to given object.
308+ """Applies the patch to a given object.
309309
310310 :param obj: Document object.
311311 :type obj: dict
312312
313- :param in_place: Tweaks way how patch would be applied - directly to
314- specified `obj` or to his copy.
313+ :param in_place: Tweaks the way how patch would be applied - directly to
314+ specified `obj` or to its copy.
315315 :type in_place: bool
316316
317317 :return: Modified `obj`.
@@ -356,8 +356,8 @@ def __init__(self, operation):
356356 self .operation = operation
357357
358358 def apply (self , obj ):
359- """Abstract method that applies patch operation to specified object."""
360- raise NotImplementedError ('should implement patch operation.' )
359+ """Abstract method that applies a patch operation to the specified object."""
360+ raise NotImplementedError ('should implement the patch operation.' )
361361
362362 def __hash__ (self ):
363363 return hash (frozenset (self .operation .items ()))
@@ -396,7 +396,7 @@ def apply(self, obj):
396396 try :
397397 del subobj [part ]
398398 except (KeyError , IndexError ) as ex :
399- msg = "can't remove non-existent object '{0}'" .format (part )
399+ msg = "can't remove a non-existent object '{0}'" .format (part )
400400 raise JsonPatchConflict (msg )
401401
402402 return obj
@@ -471,7 +471,7 @@ def _on_undo_add(self, path, key):
471471
472472
473473class ReplaceOperation (PatchOperation ):
474- """Replaces an object property or an array element by new value."""
474+ """Replaces an object property or an array element by a new value."""
475475
476476 def apply (self , obj ):
477477 try :
@@ -491,7 +491,7 @@ def apply(self, obj):
491491
492492 elif isinstance (subobj , MutableMapping ):
493493 if part not in subobj :
494- msg = "can't replace non-existent object '{0}'" .format (part )
494+ msg = "can't replace a non-existent object '{0}'" .format (part )
495495 raise JsonPatchConflict (msg )
496496 else :
497497 if part is None :
@@ -510,7 +510,7 @@ def _on_undo_add(self, path, key):
510510
511511
512512class MoveOperation (PatchOperation ):
513- """Moves an object property or an array element to new location."""
513+ """Moves an object property or an array element to a new location."""
514514
515515 def apply (self , obj ):
516516 try :
@@ -534,7 +534,7 @@ def apply(self, obj):
534534
535535 if isinstance (subobj , MutableMapping ) and \
536536 self .pointer .contains (from_ptr ):
537- raise JsonPatchConflict ('Cannot move values into its own children' )
537+ raise JsonPatchConflict ('Cannot move values into their own children' )
538538
539539 obj = RemoveOperation ({
540540 'op' : 'remove' ,
@@ -839,7 +839,7 @@ def _compare_values(self, path, key, src, dst):
839839 self ._compare_lists (_path_join (path , key ), src , dst )
840840
841841 # To ensure we catch changes to JSON, we can't rely on a simple
842- # src == dst, or it would not recognize the difference between
842+ # src == dst, because it would not recognize the difference between
843843 # 1 and True, among other things. Using json.dumps is the most
844844 # fool-proof way to ensure we catch type changes that matter to JSON
845845 # and ignore those that don't. The performance of this could be
0 commit comments