当前位置: 首页>>代码示例>>Python>>正文


Python Account.get_name方法代码示例

本文整理汇总了Python中account.Account.get_name方法的典型用法代码示例。如果您正苦于以下问题:Python Account.get_name方法的具体用法?Python Account.get_name怎么用?Python Account.get_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在account.Account的用法示例。


在下文中一共展示了Account.get_name方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _view_range_budget

# 需要导入模块: from account import Account [as 别名]
# 或者: from account.Account import get_name [as 别名]
def _view_range_budget(a: Account, timeframe: [(int, int)], width: int) -> str:
    """Returns string of Account's budget tuple over a certain time period
    """
    bud_lim = ((width-10)//11)                                                  # How many budgets can be on one line
    it = len(timeframe)                                                         # How many budgets that will be displayed 
    set_lim = it//bud_lim + 1                                                   # How many sets to iterate through  
    set_apprch = 0; bud_apprch = 0; lines = list() 
        
    while set_apprch != set_lim: 
        set_apprch += 1
        title_sub_str = "Account {} for set {}".format(a.get_name(), set_apprch)
        hd          = "="*width + "\n"
        space_amt   = width//2-len(title_sub_str)
        title_str   = "{}{}{}".format(" "*space_amt, title_sub_str, " "*space_amt)
        attrib_str  = "Attribute|"
        goal_str    = "Goal.....|"
        reach_str   = 'Reached..|'
        remain_str  = "Remaining|"
                
        for y,m in timeframe[(set_apprch-1)*min(bud_lim, it):set_apprch*min(bud_lim, it)]:
            bud_apprch += 1

            attrib_str += "  {} {}|".format(bc.months_abv(m), y+1)
            
            g_str = "{:.2f}".format(a.get_goal(y,m)/100) 
            goal_str += "."*(10-len(g_str)) + g_str+"|"
            
            r_str = "{:.2f}".format(a.get_reached(y,m)/100)
            reach_str += "."*(10-len(r_str)) + r_str+"|"
            
            e_str = "{:.2f}".format(a.get_remain(y,m)/100)
            remain_str += "."*(10-len(e_str)) + e_str + "|"
        lines.append(title_str + "\n" + hd + attrib_str + "\n" + goal_str + "\n" + reach_str + "\n" + remain_str + "\n")
    return "\n".join(lines)
开发者ID:mankaine,项目名称:Finance_program,代码行数:36,代码来源:account_view.py

示例2: cprint

# 需要导入模块: from account import Account [as 别名]
# 或者: from account.Account import get_name [as 别名]
 def cprint(a: Account):
     """Clean prints an Account
     """
     print("Account({},{},".format(a.get_name(), a.get_kind()))
     pprint(a.get_ts())
     print(",")
     pprint(a.get_budgets())
开发者ID:mankaine,项目名称:Finance_program,代码行数:9,代码来源:initialize.py

示例3: _pce_str

# 需要导入模块: from account import Account [as 别名]
# 或者: from account.Account import get_name [as 别名]
def _pce_str(i: int, a: Account, tf: [(int, int)]) -> str: 
    """Returns string indicating pacing of how goals have been reaching transaction 
    """    
    bar_len = 60                                            # space in between brackets
    budget_total  = _budget_total(a, "goal", tf)            # used to place | 
    reached_total = _budget_total(a, "reached", tf)         # used to place -
    days_left = _days_remaining(tf)

    reach_int       = round((reached_total/budget_total)*60)
    pace_int        = _calculate_pace_placement(tf, bar_len)
    remain_total    = (budget_total - reached_total)
    ideal_pace      = (budget_total - reached_total)
    if days_left != 0:                                      # Account for division by zero error
        ideal_pace /= days_left
    else: 
        ideal_pace = days_left
        
    bar_str = "["
    for n in range(bar_len): 
        if n == pace_int: 
            bar_str += "|"
        elif n < reach_int: 
            bar_str += "-"
        else:
            bar_str += " "
    bar_str += '|]' if "|" not in bar_str else "]"
            
    return "{:>3}. {:20} {:65} {:8.2f} {:8.2f} {:8.2f} {:8.2f}/day".format(
        i, a.get_name(), bar_str, reached_total/100, budget_total/100, 
        remain_total/100, ideal_pace/100)
开发者ID:mankaine,项目名称:Finance_program,代码行数:32,代码来源:account_analysis.py

示例4: _breakdown_str

# 需要导入模块: from account import Account [as 别名]
# 或者: from account.Account import get_name [as 别名]
def _breakdown_str(i: int, a: Account, tf: [(int, int)], net: float, line: str) -> str:
    """Returns string indicating the breakdown of an Account 
    """
    tf_amount   = round(
        sum(t.get_amount() for t in a.get_ts() \
            if (t.get_year(), t.get_month()) in tf)/100, 2)
    tf_perc     = round((tf_amount/net)*100, 2)
    return line.format(i, a.get_name(), tf_amount, tf_perc)
开发者ID:mankaine,项目名称:Finance_program,代码行数:10,代码来源:account_analysis.py

示例5: __init__

# 需要导入模块: from account import Account [as 别名]
# 或者: from account.Account import get_name [as 别名]
 def __init__(self, a: Account, tf: [(int, int)], master=None):
     Graph.__init__(self, a, tf, master)
         
     min_year, min_month = self._tf[0][0]+1,  months_abv(self._tf[0][1])
     max_year, max_month = self._tf[-1][0]+1, months_abv(self._tf[-1][1])
     self._t.title(
         "Cash Flow of Account "+ a.get_name()+" ({}) from {} {} to {} {}".format(
             kind_to_str[a.get_kind()],min_month, min_year, max_month, max_year))
         
     self._canvas = tk.Canvas(master=self._t, height=1200, width=800)
     self._canvas.grid(row=0,column=0,sticky = tk.N + tk.S + tk.W + tk.E)
     self._canvas.bind('<Configure>', self._resize)
         
     self._t.rowconfigure(0, weight = 1)
     self._t.columnconfigure(0, weight = 1)
开发者ID:mankaine,项目名称:Finance_program,代码行数:17,代码来源:account_graph_cash_flow.py

示例6: _view_tf_budget

# 需要导入模块: from account import Account [as 别名]
# 或者: from account.Account import get_name [as 别名]
def _view_tf_budget(a: Account, tf: (int, int)) -> str:
    """Returns string of Account's budget tuple within timeframe
    """ 
    chosen_year, chosen_month = tf
    hd = "Account {} for {} {}\n".format(
        a.get_name(), chosen_year+1, bc.months(chosen_month)) 
    
    amt = "{:>.2f}".format(a.get_goal(chosen_year, chosen_month)/100)
    amt_full = "\tGoal........" + ("."*(10-len(amt))) + amt + "\n"

    rch = "{:>.2f}".format(a.get_reached(chosen_year, chosen_month)/100)
    reach_full = "\tReached....." + ("."*(10-len(rch))) + amt + "\n"
    
    rmn = "{:>.2f}".format(a.get_remain(chosen_year, chosen_month)/100)
    rem_full = "\tRemain......" + ("."*(10-len(rmn))) + amt + "\n"
    
    return "\n"+hd+("="*40)+"\n"+amt_full+reach_full+rem_full
开发者ID:mankaine,项目名称:Finance_program,代码行数:19,代码来源:account_view.py

示例7: Transaction

# 需要导入模块: from account import Account [as 别名]
# 或者: from account.Account import get_name [as 别名]
    t7  = Transaction(2015, 7, 24, "Fast Food", "Cash", 'McDonald\'s', 800)
    t8  = Transaction(2015, 8, 24, "Fast Food", "Debit", "McDonald's", 900)
    t9  = Transaction(2015, 9, 24, "Fast Food", "Cash", "Wendy's", 1000)
    t10 = Transaction(2015, 10, 23, "Fast Food", "Gifts", "Wendy's", 1100)
    t11 = Transaction(2015, 11, 22, "Fast Food", "Savings", "Coffee", 1200)
    t12 = Transaction(2016, 11, 22, "Fast Food", "Savings", "Coffee", 1300)
    t13 = Transaction(2016, 10, 22, "Fast Food", "Savings", "Coffee", 1300)
    t14 = Transaction(2016, 10, 22, "Drinks", "Savings", "Coffee", 1200)
    
    a1 = Account("Drinks", 0, [t14], {2016: {10: Budget(1500, 1200, 1)}})
    a2 = Account("Fast Food", 0, [t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13], {})
    
    ats = [a1, a2]
    
    # Testing edit_name
    print("Previous value for a1.name" + a1.get_name())
    print("Previous value for a2.name" + a2.get_name())
 
    edit_name(ats)
     
    print("New value for a1.name" + a1.get_name())
    print("New value for a2.name" + a2.get_name())


    # Testing edit_kind
    print("Previous value for a1.kind {}".format(a1.get_kind()))
    print("Previous value for a2.kind {}".format(a2.get_kind()))
 
    edit_kind(ats)
     
    print("New value for a1.kind {}".format(a1.get_kind()))
开发者ID:mankaine,项目名称:Finance_program,代码行数:33,代码来源:account_edit.py


注:本文中的account.Account.get_name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。