Commit 18870cd29b2f4edb0b105988cce82d9378352bd2
1 parent
360b3b2c
Improve PEP8 compliance in service_keywords.py
Showing
1 changed file
with
16 additions
and
7 deletions
... | ... | @@ -24,16 +24,20 @@ import calendar |
24 | 24 | |
25 | 25 | TZ = timezone(os.environ['TZ'] if 'TZ' in os.environ else 'Europe/Kiev') |
26 | 26 | |
27 | + | |
27 | 28 | def get_now(): |
28 | 29 | return datetime.now(TZ) |
29 | 30 | |
31 | + | |
30 | 32 | def get_date(): |
31 | - return get_now().isoformat() | |
33 | + return get_now().isoformat() | |
34 | + | |
32 | 35 | |
33 | 36 | def get_file_contents(path): |
34 | 37 | with open(path, 'r') as f: |
35 | 38 | return unicode(f.read()) or u'' |
36 | 39 | |
40 | + | |
37 | 41 | def change_state(arguments): |
38 | 42 | try: |
39 | 43 | if arguments[0] == "shouldfail": |
... | ... | @@ -42,22 +46,25 @@ def change_state(arguments): |
42 | 46 | except IndexError: |
43 | 47 | return "pass" |
44 | 48 | |
49 | + | |
45 | 50 | def prepare_prom_test_tender_data(): |
46 | 51 | return munchify({'data': prom_test_tender_data()}) |
47 | 52 | |
53 | + | |
48 | 54 | def compare_date(data1, data2): |
49 | - data1=parse(data1) | |
50 | - data2=parse(data2) | |
55 | + data1 = parse(data1) | |
56 | + data2 = parse(data2) | |
51 | 57 | if data1.tzinfo is None: |
52 | 58 | data1 = TZ.localize(data1) |
53 | 59 | if data2.tzinfo is None: |
54 | 60 | data2 = TZ.localize(data2) |
55 | 61 | |
56 | - delta = (data1-data2).total_seconds() | |
62 | + delta = (data1 - data2).total_seconds() | |
57 | 63 | if abs(delta) > 60: |
58 | - return False | |
64 | + return False | |
59 | 65 | return True |
60 | 66 | |
67 | + | |
61 | 68 | def log_object_data(data, file_name=None, format="yaml"): |
62 | 69 | """Log object data in pretty format (JSON or YAML) |
63 | 70 | |
... | ... | @@ -89,10 +96,12 @@ def log_object_data(data, file_name=None, format="yaml"): |
89 | 96 | with open(os.path.join(output_dir, file_name + '.' + format), "w") as file_obj: |
90 | 97 | file_obj.write(data) |
91 | 98 | |
99 | + | |
92 | 100 | def convert_date_to_prom_format(isodate): |
93 | - iso_dt=parse_date(isodate) | |
101 | + iso_dt = parse_date(isodate) | |
94 | 102 | day_string = iso_dt.strftime("%d.%m.%Y %H:%M") |
95 | - return day_string | |
103 | + return day_string | |
104 | + | |
96 | 105 | |
97 | 106 | def load_initial_data_from(file_name): |
98 | 107 | if not os.path.exists(file_name): | ... | ... |
Please
register
or
login
to post a comment