Esempio n. 1
0
 def from_dict(obj: Any) -> 'Category':
     assert isinstance(obj, dict)
     id = parsers.from_str(obj.get("id"))
     category_group_id = parsers.from_str(obj.get("category_group_id"))
     name = parsers.from_str(obj.get("name"))
     hidden = parsers.from_bool(obj.get("hidden"))
     original_category_group_id = parsers.from_union(
         [parsers.from_str, parsers.from_none],
         obj.get("original_category_group_id"))
     note = parsers.from_union([parsers.from_str, parsers.from_none],
                               obj.get("note"))
     budgeted = parsers.from_int(obj.get("budgeted"))
     activity = parsers.from_int(obj.get("activity"))
     balance = parsers.from_int(obj.get("balance"))
     goal_type = parsers.from_union([parsers.from_str, parsers.from_none],
                                    obj.get("note"))
     goal_creation_month = parsers.from_union(
         [parsers.from_str, parsers.from_none],
         obj.get("goal_creation_month"))
     goal_target = parsers.from_union([parsers.from_int, parsers.from_none],
                                      obj.get("goal_target"))
     goal_target_month = parsers.from_union(
         [parsers.from_str, parsers.from_none],
         obj.get("goal_target_month"))
     goal_percentage_complete = parsers.from_union(
         [parsers.from_int, parsers.from_none],
         obj.get("goal_percentage_complete"))
     deleted = parsers.from_bool(obj.get("deleted"))
     return Category(id, category_group_id, name, hidden,
                     original_category_group_id, note, budgeted, activity,
                     balance, goal_type, goal_creation_month, goal_target,
                     goal_target_month, goal_percentage_complete, deleted)
Esempio n. 2
0
 def from_dict(obj: Any) -> "Account":
     assert isinstance(obj, dict)
     account_id = parsers.from_str(obj.get("id"))
     name = parsers.from_str(obj.get("name"))
     account_type = parsers.from_str(obj.get("type"))
     on_budget = parsers.from_bool(obj.get("on_budget"))
     closed = parsers.from_bool(obj.get("closed"))
     note = parsers.from_str(obj.get("note"), True)
     balance = parsers.from_int(obj.get("balance"))
     cleared_balance = parsers.from_int(obj.get("cleared_balance"))
     uncleared_balance = parsers.from_int(obj.get("uncleared_balance"))
     transfer_payee_id = parsers.from_str(obj.get("transfer_payee_id"),
                                          True)
     deleted = parsers.from_bool(obj.get("deleted"))
     return Account(
         account_id,
         name,
         account_type,
         on_budget,
         closed,
         note,
         balance,
         cleared_balance,
         uncleared_balance,
         transfer_payee_id,
         deleted,
     )
Esempio n. 3
0
 def from_dict(obj: Any) -> "ScheduledTransaction":
     assert isinstance(obj, dict)
     scheduled_transaction_id = parsers.from_str(obj.get("id"))
     date_first = parsers.from_str(obj.get("date_first"))
     date_next = parsers.from_str(obj.get("date_next"))
     frequency = parsers.from_str(obj.get("frequency"))
     amount = parsers.from_int(obj.get("amount"))
     memo = parsers.from_str(obj.get("memo"), True)
     flag_color = parsers.from_str(obj.get("flag_color"), True)
     account_id = parsers.from_str(obj.get("account_id"))
     payee_id = parsers.from_str(obj.get("payee_id"), True)
     category_id = parsers.from_str(obj.get("category_id"), True)
     transfer_account_id = parsers.from_str(obj.get("transfer_account_id"), True)
     deleted = parsers.from_bool(obj.get("deleted"))
     return ScheduledTransaction(
         scheduled_transaction_id,
         date_first,
         date_next,
         frequency,
         amount,
         memo,
         flag_color,
         account_id,
         payee_id,
         category_id,
         transfer_account_id,
         deleted,
     )
Esempio n. 4
0
 def from_dict(obj: Any) -> "Subtransaction":
     assert isinstance(obj, dict)
     sub_transaction_id = parsers.from_str(obj.get("id"))
     scheduled_transaction_id = parsers.from_union(
         [parsers.from_str, parsers.from_none], obj.get("scheduled_transaction_id")
     )
     amount = parsers.from_int(obj.get("amount"))
     memo = parsers.from_str(obj.get("memo"), True)
     payee_id = parsers.from_union(
         [parsers.from_str, parsers.from_none], obj.get("payee_id")
     )
     category_id = parsers.from_str(obj.get("category_id"), True)
     transfer_account_id = parsers.from_union(
         [parsers.from_str, parsers.from_none], obj.get("transfer_account_id")
     )
     deleted = parsers.from_bool(obj.get("deleted"))
     transaction_id = parsers.from_union(
         [parsers.from_str, parsers.from_none], obj.get("transaction_id")
     )
     return Subtransaction(
         sub_transaction_id,
         scheduled_transaction_id,
         amount,
         memo,
         payee_id,
         category_id,
         transfer_account_id,
         deleted,
         transaction_id,
     )
Esempio n. 5
0
 def from_dict(obj: Any) -> 'Budget':
     assert isinstance(obj, dict)
     id = parsers.from_str(obj.get("id"))
     name = parsers.from_str(obj.get("name"))
     last_modified_on = parsers.from_datetime(obj.get("last_modified_on"))
     first_month = parsers.from_str(obj.get("first_month"))
     last_month = parsers.from_str(obj.get("last_month"))
     date_format = DateFormat.from_dict(obj.get("date_format"))
     currency_format = CurrencyFormat.from_dict(obj.get("currency_format"))
     accounts = parsers.from_list(Account.from_dict, obj.get("accounts"))
     payees = parsers.from_list(CategoryGroup.from_dict, obj.get("payees"))
     payee_locations = parsers.from_list(PayeeLocation.from_dict,
                                         obj.get("payee_locations"))
     category_groups = parsers.from_list(CategoryGroup.from_dict,
                                         obj.get("category_groups"))
     categories = parsers.from_list(Category.from_dict,
                                    obj.get("categories"))
     months = parsers.from_list(Month.from_dict, obj.get("months"))
     transactions = parsers.from_list(Transaction.from_dict,
                                      obj.get("transactions"))
     subtransactions = parsers.from_list(Subtransaction.from_dict,
                                         obj.get("subtransactions"))
     scheduled_transactions = parsers.from_list(
         ScheduledTransaction.from_dict, obj.get("scheduled_transactions"))
     scheduled_subtransactions = parsers.from_list(
         Subtransaction.from_dict, obj.get("scheduled_subtransactions"))
     return Budget(id, name, last_modified_on, first_month, last_month,
                   date_format, currency_format, accounts, payees,
                   payee_locations, category_groups, categories, months,
                   transactions, subtransactions, scheduled_transactions,
                   scheduled_subtransactions)
Esempio n. 6
0
 def from_dict(obj: Any) -> 'Transaction':
     assert isinstance(obj, dict)
     id = parsers.from_str(obj.get("id"))
     date = parsers.from_str(obj.get("date"))
     amount = parsers.from_int(obj.get("amount"))
     memo = parsers.from_union([parsers.from_str, parsers.from_none],
                               obj.get("memo"))
     cleared = parsers.from_str(obj.get("cleared"))
     approved = parsers.from_bool(obj.get("approved"))
     flag_color = parsers.from_union([parsers.from_str, parsers.from_none],
                                     obj.get("flag_color"))
     account_id = parsers.from_str(obj.get("account_id"))
     payee_id = parsers.from_union([parsers.from_str, parsers.from_none],
                                   obj.get("payee_id"))
     category_id = parsers.from_union([parsers.from_str, parsers.from_none],
                                      obj.get("category_id"))
     transfer_account_id = parsers.from_union(
         [parsers.from_str, parsers.from_none],
         obj.get("transfer_account_id"))
     transfer_transaction_id = parsers.from_union(
         [parsers.from_str, parsers.from_none],
         obj.get("transfer_transaction_id"))
     matched_transaction_id = parsers.from_union(
         [parsers.from_str, parsers.from_none],
         obj.get("matched_transaction_id"))
     import_id = parsers.from_union([parsers.from_str, parsers.from_none],
                                    obj.get("import_id"))
     deleted = parsers.from_bool(obj.get("deleted"))
     return Transaction(id, date, amount, memo, cleared, approved,
                        flag_color, account_id, payee_id, category_id,
                        transfer_account_id, transfer_transaction_id,
                        matched_transaction_id, import_id, deleted)
Esempio n. 7
0
 def from_dict(obj: Any) -> 'PayeeLocation':
     assert isinstance(obj, dict)
     id = parsers.from_str(obj.get("id"))
     payee_id = parsers.from_str(obj.get("payee_id"))
     latitude = parsers.from_str(obj.get("latitude"))
     longitude = parsers.from_str(obj.get("longitude"))
     deleted = parsers.from_bool(obj.get("deleted"))
     return PayeeLocation(id, payee_id, latitude, longitude, deleted)
Esempio n. 8
0
 def from_dict(obj: Any) -> "Payee":
     assert isinstance(obj, dict)
     payee_id = parsers.from_str(obj.get("id"))
     name = parsers.from_str(obj.get("name"))
     transfer_account_id = parsers.from_str(obj.get("transfer_account_id"),
                                            True)
     deleted = parsers.from_bool(obj.get("deleted"))
     return Payee(payee_id, name, transfer_account_id, deleted)
Esempio n. 9
0
 def from_dict(obj: Any) -> 'CategoryGroup':
     assert isinstance(obj, dict)
     id = parsers.from_str(obj.get("id"))
     name = parsers.from_str(obj.get("name"))
     hidden = parsers.from_bool(obj.get("hidden"))
     deleted = parsers.from_bool(obj.get("deleted"))
     categories = parsers.from_list(Category.from_dict,
                                    obj.get("categories"))
     return CategoryGroup(id, name, hidden, deleted, categories)
Esempio n. 10
0
 def from_dict(obj: Any) -> 'CategoryGroup':
     assert isinstance(obj, dict)
     id = parsers.from_str(obj.get("id"))
     name = parsers.from_str(obj.get("name"))
     hidden = parsers.from_union([parsers.from_bool, parsers.from_none],
                                 obj.get("hidden"))
     deleted = parsers.from_bool(obj.get("deleted"))
     transfer_account_id = parsers.from_union(
         [parsers.from_str, parsers.from_none],
         obj.get("transfer_account_id"))
     return CategoryGroup(id, name, hidden, deleted, transfer_account_id)
Esempio n. 11
0
 def from_dict(obj: Any) -> 'Budget':
     assert isinstance(obj, dict)
     id = parsers.from_str(obj.get("id"))
     name = parsers.from_str(obj.get("name"))
     last_modified_on = parsers.from_datetime(obj.get("last_modified_on"))
     first_month = parsers.from_str(obj.get("first_month"))
     last_month = parsers.from_str(obj.get("last_month"))
     date_format = DateFormat.from_dict(obj.get("date_format"))
     currency_format = CurrencyFormat.from_dict(obj.get("currency_format"))
     return Budget(id, name, last_modified_on, first_month, last_month,
                   date_format, currency_format)
Esempio n. 12
0
 def from_dict(obj: Any) -> 'CurrencyFormat':
     assert isinstance(obj, dict)
     iso_code = parsers.from_str(obj.get("iso_code"))
     example_format = parsers.from_str(obj.get("example_format"))
     decimal_digits = parsers.from_int(obj.get("decimal_digits"))
     decimal_separator = parsers.from_str(obj.get("decimal_separator"))
     symbol_first = parsers.from_bool(obj.get("symbol_first"))
     group_separator = parsers.from_str(obj.get("group_separator"))
     currency_symbol = parsers.from_str(obj.get("currency_symbol"))
     display_symbol = parsers.from_bool(obj.get("display_symbol"))
     return CurrencyFormat(iso_code, example_format, decimal_digits,
                           decimal_separator, symbol_first, group_separator,
                           currency_symbol, display_symbol)
Esempio n. 13
0
 def from_dict(obj: Any) -> "Month":
     assert isinstance(obj, dict)
     month_name = parsers.from_str(obj.get("month"))
     note = parsers.from_union(
         [parsers.from_str, parsers.from_none], obj.get("note")
     )
     income = parsers.from_int(obj.get("income"))
     budgeted = parsers.from_int(obj.get("budgeted"))
     activity = parsers.from_int(obj.get("activity"))
     to_be_budgeted = parsers.from_int(obj.get("to_be_budgeted"))
     age_of_money = parsers.from_union(
         [parsers.from_int, parsers.from_none], obj.get("age_of_money")
     )
     deleted = parsers.from_bool(obj.get("deleted"))
     categories = parsers.from_list(Category.from_dict, obj.get("categories"))
     return Month(
         month_name,
         note,
         income,
         budgeted,
         activity,
         to_be_budgeted,
         age_of_money,
         deleted,
         categories,
     )
Esempio n. 14
0
 def from_dict(obj: Any) -> 'Account':
     assert isinstance(obj, dict)
     id = parsers.from_str(obj.get("id"))
     name = parsers.from_str(obj.get("name"))
     type = parsers.from_str(obj.get("type"))
     on_budget = parsers.from_bool(obj.get("on_budget"))
     closed = parsers.from_bool(obj.get("closed"))
     note = parsers.from_union([parsers.from_str, parsers.from_none],
                               obj.get("note"))
     balance = parsers.from_int(obj.get("balance"))
     cleared_balance = parsers.from_int(obj.get("cleared_balance"))
     uncleared_balance = parsers.from_int(obj.get("uncleared_balance"))
     transfer_payee_id = parsers.from_str(obj.get("transfer_payee_id"))
     deleted = parsers.from_bool(obj.get("deleted"))
     return Account(id, name, type, on_budget, closed, note, balance,
                    cleared_balance, uncleared_balance, transfer_payee_id,
                    deleted)
Esempio n. 15
0
 def from_dict(obj: Any) -> 'Subtransaction':
     assert isinstance(obj, dict)
     id = parsers.from_str(obj.get("id"))
     transaction_id = parsers.from_str(obj.get("transaction_id"))
     amount = parsers.from_int(obj.get("amount"))
     memo = parsers.from_str(obj.get("memo"), True)
     payee_id = parsers.from_str(obj.get("payee_id"), True)
     category_id = parsers.from_str(obj.get("category_id"))
     transfer_account_id = parsers.from_str(obj.get("transfer_account_id"),
                                            True)
     deleted = parsers.from_bool(obj.get("deleted"))
     return Subtransaction(id, transaction_id, amount, memo, payee_id,
                           category_id, transfer_account_id, deleted)
Esempio n. 16
0
 def from_dict(obj: Any) -> 'DateFormat':
     assert isinstance(obj, dict)
     format = parsers.from_str(obj.get("format"))
     return DateFormat(format)
Esempio n. 17
0
 def from_dict(obj: Any) -> 'Transaction':
     assert isinstance(obj, dict)
     id = parsers.from_str(obj.get("id"))
     date = parsers.from_str(obj.get("date"))
     amount = parsers.from_int(obj.get("amount"))
     memo = parsers.from_str(obj.get("memo"), True)
     cleared = parsers.from_str(obj.get("cleared"))
     approved = parsers.from_bool(obj.get("approved"))
     flag_color = parsers.from_str(obj.get("flag_color"), True)
     account_id = parsers.from_str(obj.get("account_id"))
     payee_id = parsers.from_str(obj.get("payee_id"), True)
     category_id = parsers.from_str(obj.get("category_id"), True)
     transfer_account_id = parsers.from_str(obj.get("transfer_account_id"),
                                            True)
     transfer_transaction_id = parsers.from_str(
         obj.get("transfer_transaction_id"), True)
     matched_transaction_id = parsers.from_str(
         obj.get("matched_transaction_id"), True)
     import_id = parsers.from_str(obj.get("import_id"), True)
     deleted = parsers.from_bool(obj.get("deleted"))
     account_name = parsers.from_str(obj.get("account_name"))
     payee_name = parsers.from_str(obj.get("payee_name"), True)
     category_name = parsers.from_str(obj.get("category_name"), True)
     subtransactions = parsers.from_list(Subtransaction.from_dict,
                                         obj.get("subtransactions"))
     return Transaction(id, date, amount, memo, cleared, approved,
                        flag_color, account_id, payee_id, category_id,
                        transfer_account_id, transfer_transaction_id,
                        matched_transaction_id, import_id, deleted,
                        account_name, payee_name, category_name,
                        subtransactions)
Esempio n. 18
0
 def from_dict(obj: Any) -> "DateFormat":
     assert isinstance(obj, dict)
     date_format = parsers.from_str(obj.get("format"))
     return DateFormat(date_format)