Skip to content

Commit

Permalink
Add deprecation note for gamedata change
Browse files Browse the repository at this point in the history
  • Loading branch information
tweakimp committed Feb 25, 2019
1 parent d6e84b7 commit 65f97e4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sc2/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ class Units(list):
# Add keyword argument 'game_data=None' to provide downwards
# compatibility for bots that use '__init__' or 'from_proto' functions.
@classmethod
def from_proto(cls, units): # game_data=None
def from_proto(cls, units, game_data=None): # game_data=None
if game_data:
logger.info("Keyword argument 'game_data' in Units classmethod 'from_proto' is deprecated.")
logger.info("You can safely remove it.")
return cls((Unit(u) for u in units))

def __init__(self, units): # game_data=None
def __init__(self, units, game_data=None):
if game_data:
logger.info("Keyword argument 'game_data' in Units function '__init__' is deprecated.")
logger.info("You can safely remove it.")
super().__init__(units)

def __call__(self, *args, **kwargs):
Expand Down

0 comments on commit 65f97e4

Please sign in to comment.