44
55import logging
66from json import JSONDecodeError
7- from typing import Optional
7+ from typing import Any , Dict , Optional , Union
88
99import click
1010import requests
@@ -58,14 +58,14 @@ def cli(ctx: click.core.Context, debug: bool, access_token: str) -> None:
5858
5959
6060@cli .group ()
61- def transactions ():
61+ def transactions () -> None :
6262 """
6363 Interact with Lunch Money transactions
6464 """
6565
6666
6767@cli .group ()
68- def plugins ():
68+ def plugins () -> None :
6969 """
7070 Interact with Lunchable Plugins
7171 """
@@ -133,17 +133,19 @@ def plugins():
133133 help = "Pass in true if you’d like to include imported transactions with a pending status." ,
134134)
135135@click .pass_obj
136- def lunchmoney_transactions (context : LunchMoneyContext , ** kwargs ):
136+ def lunchmoney_transactions (
137+ context : LunchMoneyContext , ** kwargs : Dict [str , Any ]
138+ ) -> None :
137139 """
138140 Retrieve Lunch Money Transactions
139141 """
140142 lunch = LunchMoney (access_token = context .access_token )
141- transactions = lunch .get_transactions (** kwargs )
143+ transactions = lunch .get_transactions (** kwargs ) # type: ignore[arg-type]
142144 print_json (data = transactions , default = pydantic_encoder )
143145
144146
145147@plugins .group ()
146- def splitlunch ():
148+ def splitlunch () -> None :
147149 """
148150 Splitwise Plugin for lunchable, SplitLunch 💲🍱
149151 """
@@ -178,7 +180,7 @@ def splitlunch():
178180 default = None ,
179181 help = "ISO 8601 Date time. Return expenses updated before this date" ,
180182)
181- def splitlunch_expenses (** kwargs ) :
183+ def splitlunch_expenses (** kwargs : Union [ int , str , bool ]) -> None :
182184 """
183185 Retrieve Splitwise Expenses
184186 """
@@ -187,7 +189,7 @@ def splitlunch_expenses(**kwargs):
187189 splitlunch = SplitLunch ()
188190 if set (kwargs .values ()) == {None }:
189191 kwargs ["limit" ] = 5
190- expenses = splitlunch .get_expenses (** kwargs )
192+ expenses = splitlunch .get_expenses (** kwargs ) # type: ignore[arg-type]
191193 print_json (data = expenses , default = pydantic_encoder )
192194
193195
@@ -217,7 +219,7 @@ def splitlunch_expenses(**kwargs):
217219
218220@splitlunch .command ("splitlunch" )
219221@tag_transactions
220- def make_splitlunch (** kwargs ) :
222+ def make_splitlunch (** kwargs : Union [ int , str , bool ]) -> None :
221223 """
222224 Split all `SplitLunch` tagged transactions in half.
223225
@@ -226,7 +228,7 @@ def make_splitlunch(**kwargs):
226228 from lunchable .plugins .splitlunch import SplitLunch
227229
228230 splitlunch = SplitLunch ()
229- results = splitlunch .make_splitlunch (** kwargs )
231+ results = splitlunch .make_splitlunch (** kwargs ) # type: ignore[arg-type]
230232 print_json (data = results , default = pydantic_encoder )
231233
232234
@@ -235,7 +237,7 @@ def make_splitlunch(**kwargs):
235237@financial_partner_id
236238@financial_partner_email
237239@financial_partner_group_id
238- def make_splitlunch_import (** kwargs ) :
240+ def make_splitlunch_import (** kwargs : Union [ int , str , bool ]) -> None :
239241 """
240242 Import `SplitLunchImport` tagged transactions to Splitwise and Split them in Lunch Money
241243
@@ -245,15 +247,21 @@ def make_splitlunch_import(**kwargs):
245247 """
246248 from lunchable .plugins .splitlunch import SplitLunch
247249
248- financial_partner_id = kwargs .pop ("financial_partner_id" )
249- financial_partner_email = kwargs .pop ("financial_partner_email" )
250- financial_partner_group_id = kwargs .pop ("financial_partner_group_id" )
250+ financial_partner_id : Optional [int ] = kwargs .pop (
251+ "financial_partner_id"
252+ ) # type: ignore[assignment]
253+ financial_partner_email : Optional [str ] = kwargs .pop (
254+ "financial_partner_email"
255+ ) # type: ignore[assignment]
256+ financial_partner_group_id : Optional [int ] = kwargs .pop (
257+ "financial_partner_group_id"
258+ ) # type: ignore[assignment]
251259 splitlunch = SplitLunch (
252260 financial_partner_id = financial_partner_id ,
253261 financial_partner_email = financial_partner_email ,
254262 financial_partner_group_id = financial_partner_group_id ,
255263 )
256- results = splitlunch .make_splitlunch_import (** kwargs )
264+ results = splitlunch .make_splitlunch_import (** kwargs ) # type: ignore[arg-type]
257265 print_json (data = results , default = pydantic_encoder )
258266
259267
@@ -262,7 +270,7 @@ def make_splitlunch_import(**kwargs):
262270@financial_partner_id
263271@financial_partner_email
264272@financial_partner_group_id
265- def make_splitlunch_direct_import (** kwargs ) :
273+ def make_splitlunch_direct_import (** kwargs : Union [ int , str , bool ]) -> None :
266274 """
267275 Import `SplitLunchDirectImport` tagged transactions to Splitwise and Split them in Lunch Money
268276
@@ -272,20 +280,26 @@ def make_splitlunch_direct_import(**kwargs):
272280 """
273281 from lunchable .plugins .splitlunch import SplitLunch
274282
275- financial_partner_id = kwargs .pop ("financial_partner_id" )
276- financial_partner_email = kwargs .pop ("financial_partner_email" )
277- financial_partner_group_id = kwargs .pop ("financial_partner_group_id" )
283+ financial_partner_id : Optional [int ] = kwargs .pop (
284+ "financial_partner_id"
285+ ) # type: ignore[assignment]
286+ financial_partner_email : Optional [str ] = kwargs .pop (
287+ "financial_partner_email"
288+ ) # type: ignore[assignment]
289+ financial_partner_group_id : Optional [int ] = kwargs .pop (
290+ "financial_partner_group_id"
291+ ) # type: ignore[assignment]
278292 splitlunch = SplitLunch (
279293 financial_partner_id = financial_partner_id ,
280294 financial_partner_email = financial_partner_email ,
281295 financial_partner_group_id = financial_partner_group_id ,
282296 )
283- results = splitlunch .make_splitlunch_direct_import (** kwargs )
297+ results = splitlunch .make_splitlunch_direct_import (** kwargs ) # type: ignore[arg-type]
284298 print_json (data = results , default = pydantic_encoder )
285299
286300
287301@splitlunch .command ("update-balance" )
288- def update_splitwise_balance (** kwargs ) :
302+ def update_splitwise_balance () -> None :
289303 """
290304 Update the Splitwise Asset Balance
291305 """
@@ -297,7 +311,7 @@ def update_splitwise_balance(**kwargs):
297311
298312
299313@splitlunch .command ("refresh" )
300- def refresh_splitwise_transactions (** kwargs ) :
314+ def refresh_splitwise_transactions () -> None :
301315 """
302316 Import New Splitwise Transactions to Lunch Money and
303317
@@ -313,7 +327,7 @@ def refresh_splitwise_transactions(**kwargs):
313327
314328
315329@plugins .group ()
316- def pushlunch ():
330+ def pushlunch () -> None :
317331 """
318332 Push Notifications for Lunch Money: PushLunch 📲
319333 """
@@ -338,7 +352,7 @@ def pushlunch():
338352 default = None ,
339353 help = "Pushover User Key. Defaults to `PUSHOVER_USER_KEY` env var" ,
340354)
341- def notify (continuous : bool , interval : int , user_key : str ):
355+ def notify (continuous : bool , interval : int , user_key : str ) -> None :
342356 """
343357 Send a Notification for each Uncleared Transaction
344358 """
@@ -355,7 +369,7 @@ def notify(continuous: bool, interval: int, user_key: str):
355369@click .option ("-X" , "--request" , default = "GET" , help = "Specify request command to use" )
356370@click .option ("-d" , "--data" , default = None , help = "HTTP POST data" )
357371@click .pass_obj
358- def http (context : LunchMoneyContext , url : str , request : str , data : str ):
372+ def http (context : LunchMoneyContext , url : str , request : str , data : str ) -> None :
359373 """
360374 Interact with the LunchMoney API
361375
@@ -386,7 +400,7 @@ def http(context: LunchMoneyContext, url: str, request: str, data: str):
386400
387401
388402@plugins .group ()
389- def primelunch ():
403+ def primelunch () -> None :
390404 """
391405 PrimeLunch CLI - Syncing LunchMoney with Amazon
392406 """
0 commit comments