Best Python code snippet using gherkin-python
lapunow.py
Source:lapunow.py  
...10if not os.path.exists('tex/svg'):11    os.makedirs('tex/svg')12begin = time()13width, height = 10, 1014for_name("van_der_poll_1", width, height, arrows=[0.2, 0.6]) \15    (lambda t, y: van_der_poll(y, 1),16     lambda: init_points_on_rectangle(width, height), [17         lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")18     ])19for_name("van_der_poll_1_lin", width, height, arrows=[0.2, 0.6], linear=1) \20    (lambda t, y: van_der_poll(y, 1),21     lambda: init_points_on_rectangle(width, height, n=40), [22         lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")23     ])24for_name("van_der_poll_1_both_far", width, height, arrows=[0.2, 0.6], linear=2) \25    (lambda t, y: van_der_poll(y, 1),26     lambda: init_points_on_rectangle(width, height, n=40), [27         lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")28     ])29width /= 1030height /= 1031for_name("van_der_poll_1_both_close", width, height, arrows=[0.2, 0.6], linear=2) \32    (lambda t, y: van_der_poll(y, 1),33     lambda: init_points_on_rectangle(width, height, n=20), [34         lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")35     ])36width, height = 10, 1037for_name("van_der_poll_2", width, height, arrows=[0.2, 0.6]) \38    (lambda t, y: van_der_poll(y, 2),39     lambda: init_points_on_rectangle(width, height), [40         lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")41     ])42for_name("van_der_poll_2_lin", width, height, arrows=[0.2, 0.6], linear=1) \43    (lambda t, y: van_der_poll(y, 2),44     lambda: init_points_on_rectangle(width, height, n=40), [45         lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")46     ])47for_name("van_der_poll_2_both_far", width, height, arrows=[0.2, 0.6], linear=2) \48    (lambda t, y: van_der_poll(y, 2),49     lambda: init_points_on_rectangle(width, height, n=40), [50         lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")51     ])52width /= 1053height /= 1054for_name("van_der_poll_2_both_close", width, height, arrows=[0.2, 0.6], linear=2) \55    (lambda t, y: van_der_poll(y, 2),56     lambda: init_points_on_rectangle(width, height, n=20), [57         lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")58     ])59width, height = 10, 1060a = 5 / 261for_name("van_der_poll_5", width, height, arrows=[0.2, 0.6]) \62    (lambda t, y: van_der_poll(y, a),63     lambda: init_points_on_rectangle(width, height), [64         lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")65     ])66for_name("van_der_poll_5_lin", width, height, arrows=[0.2, 0.6], linear=1) \67    (lambda t, y: van_der_poll(y, a),68     lambda: init_points_on_rectangle(width, height, n=40), [69         lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")70     ])71for_name("van_der_poll_5_both_far", width, height, arrows=[0.2, 0.6], linear=2) \72    (lambda t, y: van_der_poll(y, a),73     lambda: init_points_on_rectangle(width, height, n=40), [74         lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")75     ])76width /= 1077height /= 1078for_name("van_der_poll_5_both_close", width, height, arrows=[0.2, 0.6], linear=2) \79    (lambda t, y: van_der_poll(y, a),80     lambda: init_points_on_rectangle(width, height, n=20), [81         lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")82     ])83width, height = 10, 1084for_name("van_der_poll_0", width, height, arrows=[0.1, 0.2]) \85    (lambda t, y: van_der_poll(y, 0),86     lambda: init_points_on_rectangle(width, height))87for_name("van_der_poll_0_lin", width, height, arrows=[0.2, 0.6], linear=1) \88    (lambda t, y: van_der_poll(y, 0),89     lambda: init_points_on_rectangle(width, height, n=40))90for_name("van_der_poll_0_both_far", width, height, arrows=[0.2, 0.6], linear=2) \91    (lambda t, y: van_der_poll(y, 0),92     lambda: init_points_on_rectangle(width, height, n=40))93width /= 1094height /= 1095for_name("van_der_poll_0_both_close", width, height, arrows=[0.2, 0.6], linear=2) \96    (lambda t, y: van_der_poll(y, 0),97     lambda: init_points_on_rectangle(width, height, n=20))98width, height = 10, 1099for_name("van_der_poll_0_5", width, height, arrows=[0.2, 0.6]) \100    (lambda t, y: van_der_poll(y, 0.5),101     lambda: init_points_on_rectangle(width, height), [102         lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")103     ])104for_name("van_der_poll_0_5_lin", width, height, arrows=[0.2, 0.6], linear=1) \105    (lambda t, y: van_der_poll(y, 0.5),106     lambda: init_points_on_rectangle(width, height, n=40), [107         lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")108     ])109for_name("van_der_poll_0_5_both_far", width, height, arrows=[0.2, 0.6], linear=2) \110    (lambda t, y: van_der_poll(y, 0.5),111     lambda: init_points_on_rectangle(width, height, n=40), [112         lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")113     ])114width /= 10115height /= 10116for_name("van_der_poll_0_5_both_close", width, height, arrows=[0.2, 0.6], linear=2) \117    (lambda t, y: van_der_poll(y, 0.5),118     lambda: init_points_on_rectangle(width, height, n=20), [119         lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")120     ])121temp = lambda x: 0.02517517 * x ** 3 + 0.23480313 * x ** 2 - 0.93830795 * x - 4.47556726 if -8 < x < 1 else -255 * x - 6122x = np.linspace(-20, 20, 300)123right = lambda x: temp(x - 2 * np.pi)124more_right = lambda x: right(x - 2 * np.pi)125middle = lambda x: right(x + 2 * np.pi)126left = lambda x: middle(x + 2 * np.pi)127left = np.array(list(map(left, x)))128middle = np.array(list(map(middle, x)))129more_right = np.array(list(map(more_right, x)))130right = np.array(list(map(right, x)))131height, width = 10, 20132for_name("pendulum_1", 20, 10, arrows=[0.2, 0.6]) \133    (lambda t, y: pendulum(y, 1, 1),134     lambda: init_points_on_rectangle(20, 10, n=100),135     [lambda: plt.fill_between(x, left, -height / 2 * np.ones(len(x)),136                               where=left > -height / 2,137                               facecolor='red', alpha=0.1),138      lambda: plt.fill_between(x, more_right, height / 2 * np.ones(len(x)),139                               where=right < height / 2,140                               facecolor='orange', alpha=0.1),141      lambda: plt.fill_between(x, more_right, right,142                               where=right < more_right / 2,143                               facecolor='green', alpha=0.1),144      lambda: plt.fill_between(x, left, middle,145                               where=left < middle,146                               facecolor='blue', alpha=0.1),147      lambda: plt.fill_between(x, middle, right,148                               where=left < right,149                               facecolor='yellow', alpha=0.1),150      lambda: plt.plot([-2 * np.pi, 0, 2 * np.pi], np.zeros(3), 'ro', label="Punkty równowagi asymptotycznie stabilne")151      ])152for_name("pendulum_1_lin", width, height, arrows=[0.2, 0.6], linear=1) \153    (lambda t, y: pendulum(y, 1, 1),154     lambda: init_points_on_rectangle(width, height, n=100),155     [lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")])156for_name("pendulum_1_both_far", width, height, arrows=[0.2, 0.6], linear=2) \157    (lambda t, y: pendulum(y, 1, 1),158     lambda: init_points_on_rectangle(width, height, n=100),159     [lambda: plt.plot([-2 * np.pi, 0, 2 * np.pi], np.zeros(3), 'ro',160                       label="Punkty równowagi asymptotycznie stabilne")])161width /= 10162height /= 10163for_name("pendulum_1_both_close", width, height, arrows=[0.2, 0.6], linear=2) \164    (lambda t, y: pendulum(y, 1, 1),165     lambda: init_points_on_rectangle(width, height, n=20),166     [lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")])167temp = lambda x: -2.267609 * x - 6.77998446168x = np.linspace(-20, 20, 300)169right = lambda x: temp(x - 2 * np.pi)170more_right = lambda x: right(x - 2 * np.pi)171middle = lambda x: right(x + 2 * np.pi)172left = lambda x: middle(x + 2 * np.pi)173left = np.array(list(map(left, x)))174middle = np.array(list(map(middle, x)))175more_right = np.array(list(map(more_right, x)))176right = np.array(list(map(right, x)))177height, width = 10, 20178for_name("pendulum_2", width, height, arrows=[0.2, 0.6]) \179    (lambda t, y: pendulum(y, 1, 2),180     lambda: init_points_on_rectangle(20, 10, n=100),181     [lambda: plt.fill_between(x, left, -height / 2 * np.ones(len(x)),182                               where=left > -height / 2,183                               facecolor='red', alpha=0.1),184      lambda: plt.fill_between(x, more_right, height / 2 * np.ones(len(x)),185                               where=right < height / 2,186                               facecolor='orange', alpha=0.1),187      lambda: plt.fill_between(x, more_right, right,188                               where=right < more_right / 2,189                               facecolor='green', alpha=0.1),190      lambda: plt.fill_between(x, left, middle,191                               where=left < middle,192                               facecolor='blue', alpha=0.1),193      lambda: plt.fill_between(x, middle, right,194                               where=left < right,195                               facecolor='yellow', alpha=0.1),196      lambda: plt.plot([-2 * np.pi, 0, 2 * np.pi], np.zeros(3), 'ro', label="Punkty równowagi asymptotycznie stabilne")197      ])198for_name("pendulum_2_lin", width, height, arrows=[0.2, 0.6], linear=1) \199    (lambda t, y: pendulum(y, 1, 2),200     lambda: init_points_on_rectangle(width, height, n=100),201     [lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")])202for_name("pendulum_2_both_far", width, height, arrows=[0.2, 0.6], linear=2) \203    (lambda t, y: pendulum(y, 1, 2),204     lambda: init_points_on_rectangle(width, height, n=100),205     [lambda: plt.plot([-2 * np.pi, 0, 2 * np.pi], np.zeros(3), 'ro',206                       label="Punkty równowagi asymptotycznie stabilne")])207width /= 10208height /= 10209for_name("pendulum_2_both_close", width, height, arrows=[0.2, 0.6], linear=2) \210    (lambda t, y: pendulum(y, 1, 2),211     lambda: init_points_on_rectangle(width, height, n=20),212     [lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")])213for_name("pendulum_3", 20, 10, arrows=[0.2, 0.6]) \214    (lambda t, y: pendulum(y, 4, 0),215     lambda: corner_case_dumping_init_points(20, 10))216x = np.linspace(-20, 20, 300)217right = lambda x: -3.26072184 * x + 10.24415909218more_right = lambda x: right(x - 2 * np.pi)219middle = lambda x: right(x + 2 * np.pi)220left = lambda x: middle(x + 2 * np.pi)221left = np.array(list(map(left, x)))222middle = np.array(list(map(middle, x)))223more_right = np.array(list(map(more_right, x)))224right = np.array(list(map(right, x)))225height, width = 10, 20226for_name("pendulum_4", width, height, arrows=[0.2, 0.6]) \227    (lambda t, y: pendulum(y, 1, 5 / 2),228     lambda: init_points_on_rectangle(width, height, 80),229     [lambda: plt.fill_between(x, left, -height / 2 * np.ones(len(x)),230                               where=left > -height / 2,231                               facecolor='red', alpha=0.1),232      lambda: plt.fill_between(x, more_right, height / 2 * np.ones(len(x)),233                               where=right < height / 2,234                               facecolor='orange', alpha=0.1),235      lambda: plt.fill_between(x, more_right, right,236                               where=right < more_right / 2,237                               facecolor='green', alpha=0.1),238      lambda: plt.fill_between(x, left, middle,239                               where=left < middle,240                               facecolor='blue', alpha=0.1),241      lambda: plt.fill_between(x, middle, right,242                               where=left < right,243                               facecolor='yellow', alpha=0.1),244      lambda: plt.plot([-2 * np.pi, 0, 2 * np.pi], np.zeros(3), 'ro', label="Punkty równowagi asymptotycznie stabilne")245      ])246for_name("pendulum_4_lin", width, height, arrows=[0.2, 0.6], linear=1) \247    (lambda t, y: pendulum(y, 1, 5 / 2),248     lambda: init_points_on_rectangle(width, height, 80),249     [lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")])250for_name("pendulum_4_both_far", width, height, arrows=[0.2, 0.6], linear=2) \251    (lambda t, y: pendulum(y, 1, 5 / 2),252     lambda: init_points_on_rectangle(20, 10, 80),253     [lambda: plt.plot([-2 * np.pi, 0, 2 * np.pi], np.zeros(3), 'ro',254                       label="Punkty równowagi asymptotycznie stabilne")])255for_name("pendulum_4_both_close", 2, 1, arrows=[0.2, 0.6], linear=2) \256    (lambda t, y: pendulum(y, 1, 5 / 2),257     lambda: init_points_on_rectangle(2, 1, 20),258     [lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")])259for_name("mechanical_hard_1", 10, 10, arrows=[0.3, 0.6]) \260    (lambda t, y: mechanical_system(y, 1, 1, 1.5),261     lambda: init_points_on_rectangle(10, 10, n=30),262     [lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")])263for_name("mechanical_hard_1_lin", 10, 10, arrows=[0.3, 0.6], linear=1) \264    (lambda t, y: mechanical_system(y, 1, 1, 1.5),265     lambda: init_points_on_rectangle(10, 10, n=30),266     [lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")])267for_name("mechanical_hard_1_both_close", 1, 1, arrows=[0.3, 0.6], linear=2) \268    (lambda t, y: mechanical_system(y, 1, 1, 1.5),269     lambda: init_points_on_rectangle(1, 1, n=20),270     [lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")])271for_name("mechanical_hard_2", 10, 10, arrows=[0.3, 0.6]) \272    (lambda t, y: mechanical_system(y, 2, 1, 1.5),273     lambda: init_points_on_rectangle(10, 10, n=30),274     [lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")])275for_name("mechanical_hard_2_lin", 10, 10, arrows=[0.3, 0.6], linear=1) \276    (lambda t, y: mechanical_system(y, 2, 1, 1.5),277     lambda: init_points_on_rectangle(10, 10, n=30),278     [lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")])279for_name("mechanical_hard_2_both_close", 1, 1, arrows=[0.3, 0.6], linear=2) \280    (lambda t, y: mechanical_system(y, 2, 1, 1.5),281     lambda: init_points_on_rectangle(1, 1, n=20),282     [lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")])283for_name("mechanical_hard_3", 10, 10, arrows=[0.3, 0.6]) \284    (lambda t, y: mechanical_system(y, 5 / 2, 1, 1.5),285     lambda: init_points_on_rectangle(10, 10, n=30),286     [lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")])287for_name("mechanical_hard_3_lin", 10, 10, arrows=[0.3, 0.6], linear=1) \288    (lambda t, y: mechanical_system(y, 5 / 2, 1, 1.5),289     lambda: init_points_on_rectangle(10, 10, n=30),290     [lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")])291for_name("mechanical_hard_3_both_close", 1, 1, arrows=[0.3, 0.6], linear=2) \292    (lambda t, y: mechanical_system(y, 5 / 2, 1, 1.5),293     lambda: init_points_on_rectangle(1, 1, n=20),294     [lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")])295width, height = 4, 4296x = np.linspace(-width / 2, width / 2)297lower_poly = lambda x: -0.13094286 * x ** 3 + 0.37710916 * x ** 2 - 1.08021611 * x - 1.1802789298upper_poly = lambda x: -lower_poly(-x)299upper_poly = np.array(list(map(upper_poly, x)))300lower_poly = np.array(list(map(lower_poly, x)))301for_name("mechanical_soft_1", width, height, arrows=[0.4, 0.6]) \302    (lambda t, y: mechanical_system(y, 1, 1, -1.5),303     lambda: special_init_for_negative_spring(),304     [lambda: plt.fill_between(x, lower_poly, -height / 2 * np.ones(len(x)),305                               where=lower_poly > -height / 2,306                               facecolor='red', alpha=0.1),307      lambda: plt.fill_between(x, upper_poly, height / 2 * np.ones(len(x)),308                               where=upper_poly < height / 2,309                               facecolor='red', alpha=0.1),310      lambda: plt.fill_between(x, lower_poly, upper_poly,311                               where=lower_poly < upper_poly,312                               facecolor='green', alpha=0.1),313      lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")314      ])315for_name("mechanical_soft_1_lin", width, height, arrows=[0.4, 0.6], linear=1) \316    (lambda t, y: mechanical_system(y, 1, 1, -1.5),317     lambda: init_points_on_rectangle(width, height),318     [lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")])319for_name("mechanical_soft_1_both_close", width / 10, height / 10, arrows=[0.4, 0.6], linear=2) \320    (lambda t, y: mechanical_system(y, 1, 1, -1.5),321     lambda: init_points_on_rectangle(width / 10, height / 10, n=20),322     [lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")])323width, height = 4, 4324x = np.linspace(-width / 2, width / 2)325lower_poly = lambda x: 0.01265222 * x ** 3 + 0.66256018 * x ** 2 - 1.87728598 * x - 1.96903007326upper_poly = lambda x: -lower_poly(-x)327upper_poly = np.array(list(map(upper_poly, x)))328lower_poly = np.array(list(map(lower_poly, x)))329for_name("mechanical_soft_2", width, height, arrows=[0.4, 0.6]) \330    (lambda t, y: mechanical_system(y, 2, 1, -1.5),331     lambda: special_init_for_negative_spring(),332     [lambda: plt.fill_between(x, lower_poly, -height / 2 * np.ones(len(x)),333                               where=lower_poly > -height / 2,334                               facecolor='red', alpha=0.1),335      lambda: plt.fill_between(x, upper_poly, height / 2 * np.ones(len(x)),336                               where=upper_poly < height / 2,337                               facecolor='red', alpha=0.1),338      lambda: plt.fill_between(x, lower_poly, upper_poly,339                               where=lower_poly < upper_poly,340                               facecolor='green', alpha=0.1),341      lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")342      ])343plt.show()344for_name("mechanical_soft_2_lin", width, height, arrows=[0.4, 0.6], linear=1) \345    (lambda t, y: mechanical_system(y, 2, 1, -1.5),346     lambda: init_points_on_rectangle(width, height),347     [lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")])348for_name("mechanical_soft_2_both_close", width / 10, height / 10, arrows=[0.4, 0.6], linear=2) \349    (lambda t, y: mechanical_system(y, 2, 1, -1.5),350     lambda: init_points_on_rectangle(width / 10, height / 10, n=20),351     [lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")])352width, height = 4, 4353x = np.linspace(-width / 2, width / 2)354lower_poly = lambda x: 0.80559558 * x ** 3 + 2.12435124 * x ** 2 - 1.53257783 * x - 2.17405905 if x < 0 else -50355upper_poly = lambda x: -lower_poly(-x)356upper_poly = np.array(list(map(upper_poly, x)))357lower_poly = np.array(list(map(lower_poly, x)))358for_name("mechanical_soft_3", width, height, arrows=[0.4, 0.6]) \359    (lambda t, y: mechanical_system(y, 5 / 2, 1, -1.5),360     lambda: special_init_for_negative_spring(),361     [lambda: plt.fill_between(x, lower_poly, -height / 2 * np.ones(len(x)),362                               where=lower_poly > -height / 2,363                               facecolor='red', alpha=0.1),364      lambda: plt.fill_between(x, upper_poly, height / 2 * np.ones(len(x)),365                               where=upper_poly < height / 2,366                               facecolor='red', alpha=0.1),367      lambda: plt.fill_between(x, lower_poly, upper_poly,368                               where=lower_poly < upper_poly,369                               facecolor='green', alpha=0.1),370      lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")371      ])372plt.show()373for_name("mechanical_soft_3_lin", width, height, arrows=[0.4, 0.6], linear=1) \374    (lambda t, y: mechanical_system(y, 5 / 2, 1, -1.5),375     lambda: init_points_on_rectangle(width, height),376     [lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")])377for_name("mechanical_soft_3_both_close", width / 10, height / 10, arrows=[0.4, 0.6], linear=2) \378    (lambda t, y: mechanical_system(y, 5 / 2, 1, -1.5),379     lambda: init_points_on_rectangle(width / 10, height / 10, n=20),380     [lambda: plt.plot([0], [0], 'ro', label="Punkt równowagi asymptotycznie stabilny")])381tex_image_format = """382\\begin{figure}[H]383    \\centering384    \\def \\svgwidth{0.7\\columnwidth}385    \\input{%s.pdf_tex}386    \\caption{TODO}387\\end{figure}\\noindent388"""389with open('tex/temp.tex', mode='w') as temp_tex:390    for fileName in fileNames:391        call(['inkscape -D -z --file=tex/svg/' + fileName + '.svg' +...models.py
Source:models.py  
1from django.core.urlresolvers import reverse2from django.db import models3from billing.models import BillingProfile4ADDRESS_TYPES = (5    ('billing', 'Billing'),6    ('shipping', 'Shipping')7)8class Address(models.Model):9    billing_profile = models.ForeignKey(BillingProfile)10    name = models.CharField(max_length=120, null=True, blank=True, help_text='Shipping to? Who is it for?')11    nickname = models.CharField(max_length=120, null=True, blank=True, help_text='Internal Reference Nickname')12    address_type = models.CharField(max_length=120, choices=ADDRESS_TYPES)13    address_line_1 = models.CharField(max_length=120)14    address_line_2 = models.CharField(max_length=120, null=True, blank=True)15    country = models.CharField(max_length=120, default='Russia')16    city = models.CharField(max_length=120)17    region = models.CharField(max_length=120)18    postal_code = models.CharField(max_length=120)19    def __str__(self):20        if self.nickname:21            return str(self.nickname)22        return str(self.billing_profile)23    def get_absolute_url(self):24        return reverse('address-update', kwargs={'pk': self.pk})25    def get_short_address(self):26        for_name = self.name27        if self.nickname:28            for_name = f"{self.nickname} | {for_name}"29        return "{for_name} {line1}, {city}".format(30            for_name=for_name or '',31            line1=self.address_line_1,32            city=self.city33        )34    def get_address(self):35        return "{for_name}\n{line1}\n{line2}\n{city}\n{region}, {postal}\n{country}".format(36            for_name=self.name or "",37            line1=self.address_line_1,38            line2=self.address_line_2 or "",39            city=self.city,40            region=self.region,41            postal=self.postal_code,42            country=self.country...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
