Commit ff39624d990008c7442f16b954f2af574f5a7dee

Authored by selurvedu
1 parent b0c4f5d6

Fix a few issues reported by Flake8

Also:

 * Imports in service_keywords.py were reordered.

 * A comment in op_faker.py was slightly changed.
@@ -47,7 +47,7 @@ def create_fake_doc(): @@ -47,7 +47,7 @@ def create_fake_doc():
47 47
48 def test_tender_data(intervals, periods=("enquiry", "tender")): 48 def test_tender_data(intervals, periods=("enquiry", "tender")):
49 now = get_now() 49 now = get_now()
50 - value_amount = round(random.uniform(3000, 250000000000), 2) #max value equals to budget of Ukraine in hryvnias 50 + value_amount = round(random.uniform(3000, 250000000000), 2) # max value equals to budget of Ukraine in hryvnias
51 data = { 51 data = {
52 "mode": "test", 52 "mode": "test",
53 "submissionMethodDetails": "quick", 53 "submissionMethodDetails": "quick",
@@ -211,7 +211,7 @@ def test_question_answer_data(): @@ -211,7 +211,7 @@ def test_question_answer_data():
211 211
212 def test_complaint_data(lot=False): 212 def test_complaint_data(lot=False):
213 data = munchify({ 213 data = munchify({
214 - "data" : { 214 + "data": {
215 "author": fake.procuringEntity(), 215 "author": fake.procuringEntity(),
216 "description": fake.description(), 216 "description": fake.description(),
217 "title": fake.title() 217 "title": fake.title()
@@ -339,14 +339,15 @@ def test_bid_params(): @@ -339,14 +339,15 @@ def test_bid_params():
339 ] 339 ]
340 }) 340 })
341 341
  342 +
342 def test_bid_value(max_value_amount): 343 def test_bid_value(max_value_amount):
343 return munchify({ 344 return munchify({
344 - "value": {  
345 - "currency": "UAH",  
346 - "amount": round(random.uniform(1, max_value_amount), 2),  
347 - "valueAddedTaxIncluded": True  
348 - }  
349 - }) 345 + "value": {
  346 + "currency": "UAH",
  347 + "amount": round(random.uniform(1, max_value_amount), 2),
  348 + "valueAddedTaxIncluded": True
  349 + }
  350 + })
350 351
351 352
352 def test_supplier_data(): 353 def test_supplier_data():
@@ -108,8 +108,8 @@ class OP_Provider(BaseProvider): @@ -108,8 +108,8 @@ class OP_Provider(BaseProvider):
108 Generate a random item for openprocurement tenders 108 Generate a random item for openprocurement tenders
109 109
110 :param cpv_group: gives possibility to generate items 110 :param cpv_group: gives possibility to generate items
111 - from one cpv group. Cpv group is three digits in the beginning  
112 - of each cpv id. 111 + from a specific cpv group. Cpv group is three digits
  112 + in the beginning of each cpv id.
113 """ 113 """
114 if cpv_group is None: 114 if cpv_group is None:
115 item_base_data = self.random_element(self.items_base_data) 115 item_base_data = self.random_element(self.items_base_data)
1 # -*- coding: utf-8 - 1 # -*- coding: utf-8 -
  2 +from .local_time import get_now, TZ
2 from copy import deepcopy 3 from copy import deepcopy
3 from datetime import timedelta 4 from datetime import timedelta
4 from dateutil.parser import parse 5 from dateutil.parser import parse
5 from dpath.util import new as xpathnew 6 from dpath.util import new as xpathnew
  7 +from haversine import haversine
6 from iso8601 import parse_date 8 from iso8601 import parse_date
7 from json import load 9 from json import load
8 from jsonpath_rw import parse as parse_path 10 from jsonpath_rw import parse as parse_path
9 from munch import fromYAML, Munch, munchify 11 from munch import fromYAML, Munch, munchify
10 -from restkit import request  
11 from robot.errors import ExecutionFailed 12 from robot.errors import ExecutionFailed
12 from robot.libraries.BuiltIn import BuiltIn 13 from robot.libraries.BuiltIn import BuiltIn
13 from robot.output import LOGGER 14 from robot.output import LOGGER
14 from robot.output.loggerhelper import Message 15 from robot.output.loggerhelper import Message
15 -from haversine import haversine  
16 -from math import radians, cos, sin, asin, sqrt  
17 # These imports are not pointless. Robot's resource and testsuite files 16 # These imports are not pointless. Robot's resource and testsuite files
18 # can access them by simply importing library "service_keywords". 17 # can access them by simply importing library "service_keywords".
19 # Please ignore the warning given by Flake8 or other linter. 18 # Please ignore the warning given by Flake8 or other linter.
@@ -48,9 +47,10 @@ from .initial_data import ( @@ -48,9 +47,10 @@ from .initial_data import (
48 test_tender_data_openeu, 47 test_tender_data_openeu,
49 test_tender_data_openua 48 test_tender_data_openua
50 ) 49 )
51 -from .local_time import get_now, TZ  
52 -import os  
53 from barbecue import chef 50 from barbecue import chef
  51 +from restkit import request
  52 +# End of non-pointless imports
  53 +import os
54 import re 54 import re
55 55
56 NUM_TYPES = (int, long, float) 56 NUM_TYPES = (int, long, float)
@@ -422,6 +422,7 @@ def get_object_index_by_id(data, object_id): @@ -422,6 +422,7 @@ def get_object_index_by_id(data, object_id):
422 index += 1 422 index += 1
423 return index 423 return index
424 424
  425 +
425 # GUI Frontends common 426 # GUI Frontends common
426 def add_data_for_gui_frontends(tender_data): 427 def add_data_for_gui_frontends(tender_data):
427 now = get_now() 428 now = get_now()
Please register or login to post a comment