Commit f84fafed92e471a28cbbc1d2e32ea8811a1cb2ab

Authored by selurvedu
1 parent c6648759

Fix several warnings reported by Flake8

`E501 line too long` was not fixed because it is better
to fix this error in all files at once.
1 # -*- coding: utf-8 - 1 # -*- coding: utf-8 -
  2 +import os
  3 +import random
2 from datetime import timedelta 4 from datetime import timedelta
  5 +from tempfile import NamedTemporaryFile
  6 +from uuid import uuid4
3 from faker import Factory 7 from faker import Factory
4 from faker.providers.company.en_US import Provider as CompanyProviderEnUs 8 from faker.providers.company.en_US import Provider as CompanyProviderEnUs
5 from faker.providers.company.ru_RU import Provider as CompanyProviderRuRu 9 from faker.providers.company.ru_RU import Provider as CompanyProviderRuRu
6 from munch import munchify 10 from munch import munchify
7 -from uuid import uuid4  
8 -from tempfile import NamedTemporaryFile  
9 -from .local_time import get_now  
10 from op_faker import OP_Provider 11 from op_faker import OP_Provider
11 -import os  
12 -import random 12 +from .local_time import get_now
13 13
14 14
15 fake_en = Factory.create(locale='en_US') 15 fake_en = Factory.create(locale='en_US')
@@ -116,7 +116,7 @@ def test_tender_data(params, periods=("enquiry", "tender")): @@ -116,7 +116,7 @@ def test_tender_data(params, periods=("enquiry", "tender")):
116 if params.get('lot_meat'): 116 if params.get('lot_meat'):
117 new_feature = test_feature_data() 117 new_feature = test_feature_data()
118 new_feature['featureOf'] = "lot" 118 new_feature['featureOf'] = "lot"
119 - data['lots'][0]['id'] = data['lots'][0].get('id', uuid4().hex) 119 + data['lots'][0]['id'] = data['lots'][0].get('id', uuid4().hex)
120 new_feature['relatedItem'] = data['lots'][0]['id'] 120 new_feature['relatedItem'] = data['lots'][0]['id']
121 data['features'].append(new_feature) 121 data['features'].append(new_feature)
122 else: 122 else:
@@ -130,7 +130,7 @@ def test_tender_data(params, periods=("enquiry", "tender")): @@ -130,7 +130,7 @@ def test_tender_data(params, periods=("enquiry", "tender")):
130 if params.get('item_meat'): 130 if params.get('item_meat'):
131 new_feature = test_feature_data() 131 new_feature = test_feature_data()
132 new_feature['featureOf'] = "item" 132 new_feature['featureOf'] = "item"
133 - data['items'][0]['id'] = data['items'][0].get('id', uuid4().hex) 133 + data['items'][0]['id'] = data['items'][0].get('id', uuid4().hex)
134 new_feature['relatedItem'] = data['items'][0]['id'] 134 new_feature['relatedItem'] = data['items'][0]['id']
135 data['features'].append(new_feature) 135 data['features'].append(new_feature)
136 if not data['features']: 136 if not data['features']:
@@ -315,9 +315,9 @@ def test_item_data(cpv=None): @@ -315,9 +315,9 @@ def test_item_data(cpv=None):
315 data["description_ru"] = field_with_id("i", data["description_ru"]) 315 data["description_ru"] = field_with_id("i", data["description_ru"])
316 days = fake.random_int(min=1, max=30) 316 days = fake.random_int(min=1, max=30)
317 data["deliveryDate"] = { 317 data["deliveryDate"] = {
318 - "startDate":(get_now() + timedelta(days=days)).isoformat(),  
319 - "endDate":(get_now() + timedelta(days=days)).isoformat()  
320 - } 318 + "startDate": (get_now() + timedelta(days=days)).isoformat(),
  319 + "endDate": (get_now() + timedelta(days=days)).isoformat()
  320 + }
321 data["deliveryAddress"]["countryName_en"] = translate_country_en(data["deliveryAddress"]["countryName"]) 321 data["deliveryAddress"]["countryName_en"] = translate_country_en(data["deliveryAddress"]["countryName"])
322 data["deliveryAddress"]["countryName_ru"] = translate_country_ru(data["deliveryAddress"]["countryName"]) 322 data["deliveryAddress"]["countryName_ru"] = translate_country_ru(data["deliveryAddress"]["countryName"])
323 return munchify(data) 323 return munchify(data)
@@ -371,7 +371,6 @@ def test_lot_document_data(document, lot_id): @@ -371,7 +371,6 @@ def test_lot_document_data(document, lot_id):
371 return munchify(document) 371 return munchify(document)
372 372
373 373
374 -  
375 def test_tender_data_openua(params): 374 def test_tender_data_openua(params):
376 # We should not provide any values for `enquiryPeriod` when creating 375 # We should not provide any values for `enquiryPeriod` when creating
377 # an openUA or openEU procedure. That field should not be present at all. 376 # an openUA or openEU procedure. That field should not be present at all.
@@ -6,7 +6,6 @@ from datetime import timedelta @@ -6,7 +6,6 @@ from datetime import timedelta
6 from dateutil.parser import parse 6 from dateutil.parser import parse
7 from dpath.util import new as xpathnew 7 from dpath.util import new as xpathnew
8 from haversine import haversine 8 from haversine import haversine
9 -from iso8601 import parse_date  
10 from json import load, loads 9 from json import load, loads
11 from jsonpath_rw import parse as parse_path 10 from jsonpath_rw import parse as parse_path
12 from munch import Munch, munchify 11 from munch import Munch, munchify
Please register or login to post a comment