Skip to content

Commit

Permalink
* Fixing #189 mappings for mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
cdgriffith committed Feb 13, 2021
1 parent 9170539 commit 7a2d4c7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

Version 5.3.1
-------------

* Fixing #189 mappings for mypy

Version 5.3.0
-------------

Expand Down
2 changes: 1 addition & 1 deletion box/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

__author__ = "Chris Griffith"
__version__ = "5.3.0"
__version__ = "5.3.1"

from box.box import Box
from box.box_list import BoxList
Expand Down
14 changes: 7 additions & 7 deletions box/box.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,47 +236,47 @@ def __init__(

self._box_config["__created"] = True

def __add__(self, other: dict):
def __add__(self, other: Mapping[Any, Any]):
if not isinstance(other, dict):
raise BoxTypeError("Box can only merge two boxes or a box and a dictionary.")
new_box = self.copy()
new_box.merge_update(other)
return new_box

def __radd__(self, other: dict):
def __radd__(self, other: Mapping[Any, Any]):
if not isinstance(other, dict):
raise BoxTypeError("Box can only merge two boxes or a box and a dictionary.")
new_box = self.copy()
new_box.merge_update(other)
return new_box

def __iadd__(self, other: dict):
def __iadd__(self, other: Mapping[Any, Any]):
if not isinstance(other, dict):
raise BoxTypeError("Box can only merge two boxes or a box and a dictionary.")
self.merge_update(other)
return self

def __or__(self, other: dict):
def __or__(self, other: Mapping[Any, Any]):
if not isinstance(other, dict):
raise BoxTypeError("Box can only merge two boxes or a box and a dictionary.")
new_box = self.copy()
new_box.update(other)
return new_box

def __ror__(self, other: dict):
def __ror__(self, other: Mapping[Any, Any]):
if not isinstance(other, dict):
raise BoxTypeError("Box can only merge two boxes or a box and a dictionary.")
new_box = self.copy()
new_box.update(other)
return new_box

def __ior__(self, other: dict):
def __ior__(self, other: Mapping[Any, Any]):
if not isinstance(other, dict):
raise BoxTypeError("Box can only merge two boxes or a box and a dictionary.")
self.update(other)
return self

def __sub__(self, other: dict):
def __sub__(self, other: Mapping[Any, Any]):
frozen = self._box_config["frozen_box"]
config = self.__box_config()
config["frozen_box"] = False
Expand Down

0 comments on commit 7a2d4c7

Please sign in to comment.