@@ -1420,9 +1420,9 @@ def _get_next_invoice(cls, customer=None, subscription=None,
14201420 if subscription_items :
14211421 for si in subscription_items :
14221422 if 'plan' in si :
1423- Plan ._api_retrieve (si ['plan' ]) # to return 404 if not existant
1423+ Plan ._api_retrieve (si ['plan' ])
14241424 if 'price' in si :
1425- Price ._api_retrieve (si ['price' ]) # to return 404 if not existant
1425+ Price ._api_retrieve (si ['price' ])
14261426 # To return 404 if not existant:
14271427 if len (si ['tax_rates' ]):
14281428 [TaxRate ._api_retrieve (tr ) for tr in si ['tax_rates' ]]
@@ -1733,7 +1733,7 @@ def __init__(self, invoice=None, subscription=None, plan=None, price=None,
17331733 if plan is not None :
17341734 plan = Plan ._api_retrieve (plan ) # to return 404 if not existant
17351735 if price is not None :
1736- price = Price ._api_retrieve (price ) # to return 404 if not existant
1736+ price = Price ._api_retrieve (price )
17371737 if len (tax_rates ):
17381738 # To return 404 if not existant:
17391739 tax_rates = [TaxRate ._api_retrieve (tr ) for tr in tax_rates ]
@@ -1798,7 +1798,10 @@ def __init__(self, item):
17981798 self .plan = item .plan
17991799 self .price = item .price
18001800 self .proration = False
1801- self .currency = item .plan .currency if item .plan else item .price .currency
1801+ self .currency = (
1802+ item .plan .currency if item .plan else
1803+ item .price .currency
1804+ )
18021805 self .description = item .plan .name if item .plan else None
18031806 self .amount = item ._calculate_amount ()
18041807 self .period = item ._current_period ()
@@ -2600,7 +2603,8 @@ def __init__(self, id=None, active=None, currency=None, metadata=None,
26002603 assert 'interval' in recurring
26012604 assert recurring ['interval' ] in ('day' , 'week' , 'month' , 'year' )
26022605 if 'interval_count' in recurring :
2603- interval_count = try_convert_to_int (recurring ['interval_count' ])
2606+ interval_count = \
2607+ try_convert_to_int (recurring ['interval_count' ])
26042608 assert type (interval_count ) is int and interval_count > 0
26052609 # TODO: Add support for "meter" and "usage_type".
26062610 if product is not None :
@@ -3053,9 +3057,9 @@ def __init__(self, customer=None, metadata=None, items=None,
30533057 Customer ._api_retrieve (customer ) # to return 404 if not existant
30543058 for item in items :
30553059 if 'price' in item :
3056- Price ._api_retrieve (item ['price' ]) # to return 404 if not existant
3060+ Price ._api_retrieve (item ['price' ])
30573061 elif 'plan' in item :
3058- Plan ._api_retrieve (item ['plan' ]) # to return 404 if not existant
3062+ Plan ._api_retrieve (item ['plan' ])
30593063 # To return 404 if not existant:
30603064 if len (item ['tax_rates' ]):
30613065 [TaxRate ._api_retrieve (tr ) for tr in item ['tax_rates' ]]
@@ -3110,7 +3114,7 @@ def __init__(self, customer=None, metadata=None, items=None,
31103114 @property
31113115 def plan (self ):
31123116 return self .items ._list [0 ].plan
3113-
3117+
31143118 @property
31153119 def price (self ):
31163120 return self .items ._list [0 ].price
@@ -3262,11 +3266,11 @@ def _update(self, metadata=None, items=None, trial_end=None,
32623266 if old_plan :
32633267 if not items [0 ].get ('plan' ):
32643268 items [0 ]['plan' ] = self .plan .id
3265- Plan ._api_retrieve (items [0 ]['plan' ]) # to return 404 if not existant
3269+ Plan ._api_retrieve (items [0 ]['plan' ])
32663270 elif old_price :
32673271 if not items [0 ].get ('price' ):
32683272 items [0 ]['price' ] = self .price .id
3269- Price ._api_retrieve (items [0 ]['price' ]) # to return 404 if not existant
3273+ Price ._api_retrieve (items [0 ]['price' ])
32703274
32713275 # To return 404 if not existant:
32723276 if len (items [0 ]['tax_rates' ]):
@@ -3352,8 +3356,10 @@ def _update(self, metadata=None, items=None, trial_end=None,
33523356 )
33533357 ) or (
33543358 self .price and
3355- self .price .interval != old_price .interval or
3356- self .price .interval_count != old_price .interval_count
3359+ (
3360+ self .price .interval != old_price .interval or
3361+ self .price .interval_count != old_price .interval_count
3362+ )
33573363 )
33583364 if create_an_invoice :
33593365 self ._create_invoice ()
0 commit comments