Skip to content

Commit 6073cad

Browse files
change default argument list to None (#413)
1 parent 99d7e68 commit 6073cad

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

linebot/api.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1291,7 +1291,7 @@ def get_bot_info(self, timeout=None):
12911291

12921292
return BotInfo.new_from_json_dict(response.json)
12931293

1294-
def create_audience_group(self, audience_group_name, audiences=[],
1294+
def create_audience_group(self, audience_group_name, audiences=None,
12951295
is_ifa=False, timeout=None):
12961296
"""Create an audience group.
12971297
@@ -1302,6 +1302,9 @@ def create_audience_group(self, audience_group_name, audiences=[],
13021302
:param bool is_ifa: true | false
13031303
:return: audience group id
13041304
"""
1305+
if audiences is None:
1306+
audiences = []
1307+
13051308
if audiences:
13061309
audiences = [Audience.new_from_json_dict(audience) for audience in audiences]
13071310
response = self._post(

linebot/async_api.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ async def get_bot_info(self, timeout=None):
13381338
return BotInfo.new_from_json_dict((await response.json))
13391339

13401340
async def create_audience_group(
1341-
self, audience_group_name, audiences=[], is_ifa=False, timeout=None
1341+
self, audience_group_name, audiences=None, is_ifa=False, timeout=None
13421342
):
13431343
"""Create an audience group.
13441344
@@ -1349,6 +1349,9 @@ async def create_audience_group(
13491349
:param bool is_ifa: true | false
13501350
:return: audience group id
13511351
"""
1352+
if audiences is None:
1353+
audiences = []
1354+
13521355
if audiences:
13531356
audiences = [
13541357
Audience.new_from_json_dict(audience) for audience in audiences

linebot/models/filter.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def __init__(self, **kwargs):
6868
class GenderFilter(DemographicFilter):
6969
"""GenderFilter."""
7070

71-
def __init__(self, one_of=[], **kwargs):
71+
def __init__(self, one_of=None, **kwargs):
7272
"""__init__ method.
7373
7474
:param one_of: Send messages to users of a given gender. One of:
@@ -78,14 +78,17 @@ def __init__(self, one_of=[], **kwargs):
7878
"""
7979
super(GenderFilter, self).__init__(**kwargs)
8080

81+
if one_of is None:
82+
one_of = []
83+
8184
self.type = "gender"
8285
self.one_of = one_of
8386

8487

8588
class AppTypeFilter(DemographicFilter):
8689
"""AppTypeFilter."""
8790

88-
def __init__(self, one_of=[], **kwargs):
91+
def __init__(self, one_of=None, **kwargs):
8992
"""__init__ method.
9093
9194
:param one_of: Send messages to users of the specified OS. One of:
@@ -95,21 +98,27 @@ def __init__(self, one_of=[], **kwargs):
9598
"""
9699
super(AppTypeFilter, self).__init__(**kwargs)
97100

101+
if one_of is None:
102+
one_of = []
103+
98104
self.type = "appType"
99105
self.one_of = one_of
100106

101107

102108
class AreaFilter(DemographicFilter):
103109
"""AreaFilter."""
104110

105-
def __init__(self, one_of=[], **kwargs):
111+
def __init__(self, one_of=None, **kwargs):
106112
"""__init__ method.
107113
108114
:param one_of: Send messages to users in the specified region.
109115
:type one_of: list[str]
110116
"""
111117
super(AreaFilter, self).__init__(**kwargs)
112118

119+
if one_of is None:
120+
one_of = []
121+
113122
self.type = "area"
114123
self.one_of = one_of
115124

0 commit comments

Comments
 (0)