From 213c76aadd764b56b27c3f72e32b9e554fa9886f Mon Sep 17 00:00:00 2001 From: Cody Scott Date: Tue, 8 Mar 2022 18:02:05 -0500 Subject: [PATCH] Fix whitespace --- .../scripts/count_data_by_topic_pattern.py | 4 +-- .../scripts/rollup_data_by_time.py | 12 +++---- .../scripts/rollup_data_using_groupby.py | 4 +-- .../scheduler-example-agent.rst | 2 +- examples/CAgent/c_agent/driver/cdriver.py | 2 +- .../tests/test_config_actuation.py | 2 +- examples/DataPuller/puller/agent.py | 2 +- .../matlab/matlab_example.py | 4 +-- .../subscriber/subscriber_agent.py | 8 ++--- examples/FNCS/fncs_example/agent.py | 4 +-- examples/HELICS/helics_federate.py | 2 +- examples/MarketAgents/AHUAgent/ahu/agent.py | 10 +++--- .../schedule_example/agent.py | 2 +- .../tagging_scripts/insert_id_and_ref_tags.py | 2 +- .../ActuatorAgent/tests/test_actuator_rpc.py | 26 +++++++------- .../tests/test_forward_historian.py | 2 +- .../scripts/insert_test_data.py | 8 ++--- .../interfaces/modbus_tk/config_cmd.py | 4 +-- .../TopicWatcher/tests/test_topic_watcher.py | 2 +- .../base_market_agent/test_poly_line.py | 36 +++++++++---------- .../aggregate_historian/copy_test_data.py | 6 ++-- .../test_aggregate_historian.py | 18 +++++----- .../test_base_aggregate_historian.py | 2 +- .../market_service/test_market_service.py | 4 +-- .../services/tagging/test_tagging.py | 2 +- volttrontesting/utils/utils.py | 2 +- 26 files changed, 87 insertions(+), 85 deletions(-) diff --git a/deprecated/MongodbHistorian/scripts/count_data_by_topic_pattern.py b/deprecated/MongodbHistorian/scripts/count_data_by_topic_pattern.py index 872d39ac6b..6078fb22c2 100644 --- a/deprecated/MongodbHistorian/scripts/count_data_by_topic_pattern.py +++ b/deprecated/MongodbHistorian/scripts/count_data_by_topic_pattern.py @@ -21,5 +21,5 @@ count = count + db.data.find( {"topic_id":x['_id'], "ts":{"$gte":s_dt, "$lt":e_dt}}).count() -print (count) -print ("time taken: {}".format(datetime.datetime.now()-start)) \ No newline at end of file +print(count) +print("time taken: {}".format(datetime.datetime.now() - start)) diff --git a/deprecated/MongodbHistorian/scripts/rollup_data_by_time.py b/deprecated/MongodbHistorian/scripts/rollup_data_by_time.py index c351d4713d..52514f00e4 100644 --- a/deprecated/MongodbHistorian/scripts/rollup_data_by_time.py +++ b/deprecated/MongodbHistorian/scripts/rollup_data_by_time.py @@ -236,7 +236,7 @@ def execute_batch(table_type, bulk, count, topic_id, topic_name): "bulk execute of {} data for {}:{}.\nnumber of op sent to " "bulk execute ({}) does not match nModified count".format( table_type, topic_id, topic_name, count)) - print ("bulk execute result {}".format(result)) + print("bulk execute result {}".format(result)) errors = True except BulkWriteError as ex: print(str(ex.details)) @@ -338,7 +338,7 @@ def init_hourly_data(db, data_collection, start_dt, end_dt): if __name__ == '__main__': start = datetime.utcnow() - print ("Starting rollup of data from {} to {}. current time: {}".format( + print("Starting rollup of data from {} to {}. current time: {}".format( start_date, end_date, start)) pool = Pool(size=10) @@ -370,13 +370,13 @@ def init_hourly_data(db, data_collection, start_dt, end_dt): source_db = connect_mongodb(local_source_params) s_dt = datetime.strptime(start_date, '%d%b%YT%H:%M:%S.%f') e_dt = datetime.strptime(end_date, '%d%b%YT%H:%M:%S.%f') - print ("Starting init of tables") + print("Starting init of tables") init_start = datetime.utcnow() init_daily_data(source_db, source_tables['data_table'], s_dt, e_dt) - print ("Total time for init of daily data " + print("Total time for init of daily data " "between {} and {} : {} " "".format(start_date, end_date, datetime.utcnow() - init_start)) @@ -385,7 +385,7 @@ def init_hourly_data(db, data_collection, start_dt, end_dt): source_tables['data_table'], s_dt, e_dt) - print ("Total time for init of hourly data " + print("Total time for init of hourly data " "between {} and {} : {} " "".format(start_date, end_date, datetime.utcnow() - init_start)) @@ -419,7 +419,7 @@ def init_hourly_data(db, data_collection, start_dt, end_dt): print("Exception processing data: {}".format(e.args)) finally: pool.kill() - print ("Total time for roll up of data : {}".format( + print("Total time for roll up of data : {}".format( datetime.utcnow() - start)) if log: log.close() diff --git a/deprecated/MongodbHistorian/scripts/rollup_data_using_groupby.py b/deprecated/MongodbHistorian/scripts/rollup_data_using_groupby.py index b67b1f9c55..9f8d603f71 100644 --- a/deprecated/MongodbHistorian/scripts/rollup_data_using_groupby.py +++ b/deprecated/MongodbHistorian/scripts/rollup_data_using_groupby.py @@ -32,13 +32,13 @@ def connect_mongodb(connection_params): - print ("setup mongodb") + print("setup mongodb") mongo_conn_str = 'mongodb://{user}:{passwd}@{host}:{port}/{database}' if connection_params.get('authSource'): mongo_conn_str = mongo_conn_str+ '?authSource={authSource}' params = connection_params mongo_conn_str = mongo_conn_str.format(**params) - print (mongo_conn_str) + print(mongo_conn_str) mongo_client = pymongo.MongoClient(mongo_conn_str) db = mongo_client[connection_params['database']] return db diff --git a/docs/source/developing-volttron/developing-agents/example-agents/scheduler-example-agent.rst b/docs/source/developing-volttron/developing-agents/example-agents/scheduler-example-agent.rst index 83817ae8e8..36939d3535 100644 --- a/docs/source/developing-volttron/developing-agents/example-agents/scheduler-example-agent.rst +++ b/docs/source/developing-volttron/developing-agents/example-agents/scheduler-example-agent.rst @@ -41,7 +41,7 @@ The agent listens to schedule announcements from the actuator and then issues a @PubSub.subscribe('pubsub', topics.ACTUATOR_SCHEDULE_ANNOUNCE(campus='campus', building='building',unit='unit')) def actuate(self, peer, sender, bus, topic, headers, message): - print ("response:",topic,headers,message) + print("response:", topic, headers, message) if headers[headers_mod.REQUESTER_ID] != agent_id: return '''Match the announce for our fake device with our ID diff --git a/examples/CAgent/c_agent/driver/cdriver.py b/examples/CAgent/c_agent/driver/cdriver.py index 59e63b123f..9939fb645a 100644 --- a/examples/CAgent/c_agent/driver/cdriver.py +++ b/examples/CAgent/c_agent/driver/cdriver.py @@ -70,7 +70,7 @@ def so_lookup_function(shared_object, function_name): return function class CRegister(BaseRegister): - def __init__(self,read_only, pointName, units, description = ''): + def __init__(self, read_only, pointName, units, description=''): super(CRegister, self).__init__("byte", read_only, pointName, units, description = '') diff --git a/examples/ConfigActuation/tests/test_config_actuation.py b/examples/ConfigActuation/tests/test_config_actuation.py index 9fd17c1f3f..ecbd3abe33 100644 --- a/examples/ConfigActuation/tests/test_config_actuation.py +++ b/examples/ConfigActuation/tests/test_config_actuation.py @@ -87,7 +87,7 @@ def publish_agent(request, volttron_instance): assert process.returncode == 0 # Add platform driver configuration files to config store. - cmd = ['volttron-ctl', 'config', 'store',PLATFORM_DRIVER, + cmd = ['volttron-ctl', 'config', 'store', PLATFORM_DRIVER, 'fake.csv', 'fake_unit_testing.csv', '--csv'] process = Popen(cmd, env=volttron_instance.env, cwd='scripts/scalability-testing', diff --git a/examples/DataPuller/puller/agent.py b/examples/DataPuller/puller/agent.py index 18e897ae85..4c1682953e 100644 --- a/examples/DataPuller/puller/agent.py +++ b/examples/DataPuller/puller/agent.py @@ -139,7 +139,7 @@ def on_message(self, peer, sender, bus, topic, headers, message): _log.debug("data in capture_data {}".format(data)) if isinstance(data, dict): data = data - elif isinstance(data, (int,float)): + elif isinstance(data, (int, float)): data = data # else: # data = data[0] diff --git a/examples/ExampleMatlabApplication/matlab/matlab_example.py b/examples/ExampleMatlabApplication/matlab/matlab_example.py index e0f5842469..6d7e73a2b0 100644 --- a/examples/ExampleMatlabApplication/matlab/matlab_example.py +++ b/examples/ExampleMatlabApplication/matlab/matlab_example.py @@ -21,11 +21,11 @@ print("Sending config_params") config_params = {"zone_temperature_list": ["ZoneTemperature1", "ZoneTemperature2"], "zone_setpoint_list": ["ZoneTemperatureSP1", "ZoneTemperatureSP2"]} - config_socket.send_json(config_params,zmq.NOBLOCK) + config_socket.send_json(config_params, zmq.NOBLOCK) print("Sending data") data = {"zone_temperature_list": ["72.3", "78.5"]} - data_socket.send_json(data,zmq.NOBLOCK) + data_socket.send_json(data, zmq.NOBLOCK) except ZMQError: print("No Matlab process running to send message") diff --git a/examples/ExampleSubscriber/subscriber/subscriber_agent.py b/examples/ExampleSubscriber/subscriber/subscriber_agent.py index 2ea9b899d0..694c295a25 100644 --- a/examples/ExampleSubscriber/subscriber/subscriber_agent.py +++ b/examples/ExampleSubscriber/subscriber/subscriber_agent.py @@ -164,7 +164,7 @@ def lookup_data(self): order = "FIRST_TO_LAST").get(timeout=10) print('Query Result', result) except Exception as e: - print ("Could not contact historian. Is it running?") + print("Could not contact historian. Is it running?") print(e) @Core.schedule(periodic(10)) @@ -176,9 +176,9 @@ def pub_fake_data(self): ''' #Make some random readings - oat_reading = random.uniform(30,100) - mixed_reading = oat_reading + random.uniform(-5,5) - damper_reading = random.uniform(0,100) + oat_reading = random.uniform(30, 100) + mixed_reading = oat_reading + random.uniform(-5, 5) + damper_reading = random.uniform(0, 100) # Create a message for all points. all_message = [{'OutsideAirTemperature': oat_reading, 'MixedAirTemperature': mixed_reading, diff --git a/examples/FNCS/fncs_example/agent.py b/examples/FNCS/fncs_example/agent.py index 011135a1a1..220a56197e 100644 --- a/examples/FNCS/fncs_example/agent.py +++ b/examples/FNCS/fncs_example/agent.py @@ -46,7 +46,7 @@ def fncs_example(config_path, **kwargs): stop_agent_when_sim_complete = config.get("stop_agent_when_sim_complete", False) subscription_topic = config.get("subscription_topic", None) return FncsExample(topic_mapping=topic_mapping, federate_name=federate, broker_location=broker_location, - time_delta=time_delta,subscription_topic=subscription_topic, sim_length=sim_length, + time_delta=time_delta, subscription_topic=subscription_topic, sim_length=sim_length, stop_agent_when_sim_complete=stop_agent_when_sim_complete, **kwargs) @@ -56,7 +56,7 @@ class FncsExample(Agent): """ def __init__(self, topic_mapping, federate_name=None, broker_location="tcp://localhost:5570", - time_delta="1s",subscription_topic=None, simulation_start_time=None, sim_length="10s", + time_delta="1s", subscription_topic=None, simulation_start_time=None, sim_length="10s", stop_agent_when_sim_complete=False, **kwargs): super(FncsExample, self).__init__(enable_fncs=True, enable_store=False, **kwargs) _log.debug("vip_identity: " + self.core.identity) diff --git a/examples/HELICS/helics_federate.py b/examples/HELICS/helics_federate.py index 5674aca904..2b8d42a94f 100644 --- a/examples/HELICS/helics_federate.py +++ b/examples/HELICS/helics_federate.py @@ -73,7 +73,7 @@ def federate_example(config_path): endid = {} subid = {} pubid = {} - for i in range(0,endpoint_count): + for i in range(0, endpoint_count): endid["m{}".format(i)] = h.helicsFederateGetEndpointByIndex(fed, i) end_name = h.helicsEndpointGetName(endid["m{}".format(i)]) logger.info( 'Registered Endpoint ---> {}'.format(end_name)) diff --git a/examples/MarketAgents/AHUAgent/ahu/agent.py b/examples/MarketAgents/AHUAgent/ahu/agent.py index 7b956fb156..e0f0402bd1 100644 --- a/examples/MarketAgents/AHUAgent/ahu/agent.py +++ b/examples/MarketAgents/AHUAgent/ahu/agent.py @@ -79,14 +79,16 @@ def ahu_agent(config_path, **kwargs): c3= config.get('c3') COP= config.get('COP') verbose_logging= config.get('verbose_logging', True) - return AHUAgent(air_market_name,electric_market_name,agent_name,subscribing_topic,c0,c1,c2,c3,COP,verbose_logging, **kwargs) + return AHUAgent(air_market_name, electric_market_name, agent_name, + subscribing_topic, c0, c1, c2, c3, COP, verbose_logging, **kwargs) class AHUAgent(MarketAgent, AhuChiller): """ The SampleElectricMeterAgent serves as a sample of an electric meter that sells electricity for a single building at a fixed price. """ - def __init__(self, air_market_name, electric_market_name, agent_name,subscribing_topic,c0,c1,c2,c3,COP,verbose_logging, **kwargs): + def __init__(self, air_market_name, electric_market_name, agent_name, + subscribing_topic, c0, c1, c2, c3, COP, verbose_logging, **kwargs): super(AHUAgent, self).__init__(verbose_logging, **kwargs) self.air_market_name = air_market_name @@ -155,10 +157,10 @@ def create_air_supply_curve(self, electric_price, electric_quantity): supply_curve = PolyLine() price = 65 quantity = 100000 - supply_curve.add(Point(price=price,quantity=quantity)) + supply_curve.add(Point(price=price, quantity=quantity)) price = 65 quantity = 0 # negative quantities are not real -1*10000 - supply_curve.add(Point(price=price,quantity=quantity)) + supply_curve.add(Point(price=price, quantity=quantity)) return supply_curve def create_electric_demand_curve(self, aggregate_air_demand): diff --git a/examples/SchedulerExample/schedule_example/agent.py b/examples/SchedulerExample/schedule_example/agent.py index 3371418261..9552d88f6e 100644 --- a/examples/SchedulerExample/schedule_example/agent.py +++ b/examples/SchedulerExample/schedule_example/agent.py @@ -95,7 +95,7 @@ def startup(self, sender, **kwargs): @PubSub.subscribe('pubsub', topics.ACTUATOR_SCHEDULE_ANNOUNCE(campus='campus', building='building',unit='unit')) def actuate(self, peer, sender, bus, topic, headers, message): - print ("response:",topic,headers,message) + print("response:", topic, headers, message) if headers[headers_mod.REQUESTER_ID] != agent_id: return '''Match the announce for our fake device with our ID diff --git a/scripts/tagging_scripts/insert_id_and_ref_tags.py b/scripts/tagging_scripts/insert_id_and_ref_tags.py index 23c5738822..3c8a6ebb57 100644 --- a/scripts/tagging_scripts/insert_id_and_ref_tags.py +++ b/scripts/tagging_scripts/insert_id_and_ref_tags.py @@ -164,7 +164,7 @@ def mongo_insert(tags, execute_now=False): try: result = mongo_bulk.execute() if result['nInserted'] != mongo_batch_size: - print ("bulk execute result {}".format(result)) + print("bulk execute result {}".format(result)) errors = True except BulkWriteError as ex: print(str(ex.details)) diff --git a/services/core/ActuatorAgent/tests/test_actuator_rpc.py b/services/core/ActuatorAgent/tests/test_actuator_rpc.py index 17d45ac99f..47b0a348a5 100644 --- a/services/core/ActuatorAgent/tests/test_actuator_rpc.py +++ b/services/core/ActuatorAgent/tests/test_actuator_rpc.py @@ -215,7 +215,7 @@ def test_request_new_schedule(publish_agent, cancel_schedules, taskid, expected_ :param cancel_schedules: fixture used to cancel the schedule at the end of test so that other tests can use the same device and time slot """ - print ("\n**** test_schedule_success ****") + print("\n**** test_schedule_success ****") # used by cancel_schedules agentid = TEST_AGENT cancel_schedules.append({'agentid': agentid, 'taskid': taskid}) @@ -460,7 +460,7 @@ def test_request_new_schedule_should_suceed_on_preempt_active_task(publish_agent :param cancel_schedules: fixture used to cancel the schedule at the end of test so that other tests can use the same device and time slot """ - print ("\n**** test_schedule_preempt_active_task ****") + print("\n**** test_schedule_preempt_active_task ****") # used by cancel_schedules agentid = 'new_agent' taskid = 'task_high_priority2' @@ -656,7 +656,7 @@ def test_request_new_schedule_should_return_failure_on_preempt_active_task(publi :param cancel_schedules: fixture used to cancel the schedule at the end of test so that other tests can use the same device and time slot """ - print ("\n**** test_schedule_preempt_error_active_task ****") + print("\n**** test_schedule_preempt_error_active_task ****") # used by cancel_schedules agentid = TEST_AGENT taskid = 'task_low_priority3' @@ -713,7 +713,7 @@ def test_request_new_schedule_should_succeed_on_preempt_future_task(publish_agen :param cancel_schedules: fixture used to cancel the schedule at the end of test so that other tests can use the same device and time slot """ - print ("\n**** test_schedule_preempt_future_task ****") + print("\n**** test_schedule_preempt_future_task ****") # used by cancel_schedules agentid = 'new_agent' taskid = 'task_high_priority4' @@ -789,7 +789,7 @@ def test_request_new_schedule_should_return_failure_on_conflicting_time_slots(pu :param publish_agent: fixture invoked to setup all agents necessary and returns an instance of Agent object used for publishing """ - print ("\n**** test_schedule_conflict_self ****") + print("\n**** test_schedule_conflict_self ****") # used by cancel_schedules taskid = 'task_self_conflict' start = str(datetime.now()) @@ -868,7 +868,7 @@ def test_request_new_schedule_should_succeed_on_overlap_time_slots(publish_agent :param cancel_schedules: fixture used to cancel the schedule at the end of test so that other tests can use the same device and time slot """ - print ("\n**** test_schedule_overlap_success ****") + print("\n**** test_schedule_overlap_success ****") # set agentid and task id for cancel_schedules fixture agentid = TEST_AGENT taskid = 'task_overlap' @@ -902,7 +902,7 @@ def test_request_cancel_schedule_should_succeed(publish_agent): :param publish_agent: fixture invoked to setup all agents necessary and returns an instance of Agent object used for publishing """ - print ("\n**** test_cancel_success ****") + print("\n**** test_cancel_success ****") start = str(datetime.now()) end = str(datetime.now() + timedelta(seconds=2)) @@ -940,7 +940,7 @@ def test_request_cancel_schedule_should_return_failure_on_invalid_taskid(publish returns an instance of Agent object used for publishing """ - print ("\n**** test_cancel_error_invalid_taskid ****") + print("\n**** test_cancel_error_invalid_taskid ****") result = publish_agent.vip.rpc.call( PLATFORM_ACTUATOR, REQUEST_CANCEL_SCHEDULE, @@ -963,7 +963,7 @@ def test_get_point_should_succeed(publish_agent): :param publish_agent: fixture invoked to setup all agents necessary and returns an instance of Agent object used for publishing """ - print ("\n**** test_get_default ****") + print("\n**** test_get_default ****") result = publish_agent.vip.rpc.call( PLATFORM_ACTUATOR, # Target agent @@ -1072,7 +1072,7 @@ def test_revert_point_should_succeed(publish_agent, cancel_schedules): :param cancel_schedules: fixture used to cancel the schedule at the end of test so that other tests can use the same device and time slot """ - print ("\n**** test_set_float_value ****") + print("\n**** test_set_float_value ****") taskid = 'test_revert_point' agentid = TEST_AGENT cancel_schedules.append({'agentid': agentid, 'taskid': taskid}) @@ -1136,7 +1136,7 @@ def test_revert_point_with_point_should_succeed(publish_agent, cancel_schedules) :param cancel_schedules: fixture used to cancel the schedule at the end of test so that other tests can use the same device and time slot """ - print ("\n**** test_set_float_value ****") + print("\n**** test_set_float_value ****") taskid = 'test_revert_point' agentid = TEST_AGENT cancel_schedules.append({'agentid': agentid, 'taskid': taskid}) @@ -1380,7 +1380,7 @@ def test_set_point_raises_value_error(publish_agent, cancel_schedules): :param cancel_schedules: fixture used to cancel the schedule at the end of test so that other tests can use the same device and time slot """ - print ("\n**** test_set_value_error ****") + print("\n**** test_set_value_error ****") agentid = TEST_AGENT taskid = 'task_set_value_error' cancel_schedules.append({'agentid': agentid, 'taskid': taskid}) @@ -1562,7 +1562,7 @@ def test_set_point_raises_remote_error_on_lock_failure(publish_agent, cancel_sch :param cancel_schedules: fixture used to cancel the schedule at the end of test so that other tests can use the same device and time slot """ - print ("\n**** test_set_float_value ****") + print("\n**** test_set_float_value ****") agentid = TEST_AGENT with pytest.raises(RemoteError): diff --git a/services/core/ForwardHistorian/tests/test_forward_historian.py b/services/core/ForwardHistorian/tests/test_forward_historian.py index 668ff9b98f..7f66c95eb1 100644 --- a/services/core/ForwardHistorian/tests/test_forward_historian.py +++ b/services/core/ForwardHistorian/tests/test_forward_historian.py @@ -549,7 +549,7 @@ def test_old_config(volttron_instances, forwarder): # gevent.sleep(1) # wait for topic to be forwarded and callback to happen # # # assert query_agent.callback.call_count == 1 -# print ('call args ', query_agent.callback.call_args_list) +# print('call args ', query_agent.callback.call_args_list) # # assert query_agent.callback.call_args[0][1] == 'platform.actuator' # assert query_agent.callback.call_args[0][3] == \ # topics.ACTUATOR_SCHEDULE_RESULT diff --git a/services/core/MongodbTaggingService/scripts/insert_test_data.py b/services/core/MongodbTaggingService/scripts/insert_test_data.py index 2c468a9b23..ce3f7d9875 100644 --- a/services/core/MongodbTaggingService/scripts/insert_test_data.py +++ b/services/core/MongodbTaggingService/scripts/insert_test_data.py @@ -145,7 +145,7 @@ def mongo_insert(tags, execute_now=False): try: result = mongo_bulk.execute() if result['nInserted'] != mongo_batch_size: - print ("bulk execute result {}".format(result)) + print("bulk execute result {}".format(result)) errors = True except BulkWriteError as ex: print(str(ex.details)) @@ -205,7 +205,7 @@ def test_mongo_tags(): "equip_tag 7": {"$gt": 2}}, {"topic_prefix": 1}) topics = [record['_id'] for record in tags_cursor] print("example query result: {}".format(topics)) - print ("Time taken by mongo for result: {}".format( + print("Time taken by mongo for result: {}".format( datetime.datetime.now() - start)) @@ -230,8 +230,8 @@ def test_sqlite_tags(): ' INTERSECT ' 'select topic_prefix from test_tags where tag = "equip_tag 7" and ' 'value > 2') - print ("topics :{}".format(tags_cursor.fetchall())) - print ("Time taken by sqlite for result: {}".format( + print("topics :{}".format(tags_cursor.fetchall())) + print("Time taken by sqlite for result: {}".format( datetime.datetime.now() - start)) diff --git a/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/config_cmd.py b/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/config_cmd.py index ec58de4b96..5a8aa809bf 100644 --- a/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/config_cmd.py +++ b/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/config_cmd.py @@ -165,7 +165,7 @@ def get_existed_file(self, file_dir, file_name): if file_dir: while True: if not os.path.exists("{0}/{1}".format(file_dir, file_name)): - print ("'{0}' file '{1}' does not exist in the directory '{2}'".format(file_type, + print("'{0}' file '{1}' does not exist in the directory '{2}'".format(file_type, file_name, file_dir)) if file_name == 'maps.yaml': @@ -818,7 +818,7 @@ def do_delete_volttron_config(self, line): print("DRIVER NAME".ljust(16) + "| VOLTTRON PATH") for d in drivers.keys(): print("{0:15} | {1}".format(d, drivers[d])) - print ("\nEnter driver name to delete: ", end='') + print("\nEnter driver name to delete: ", end='') driver_name = input() if driver_name not in drivers: diff --git a/services/ops/TopicWatcher/tests/test_topic_watcher.py b/services/ops/TopicWatcher/tests/test_topic_watcher.py index 51dd500fc5..5d68f7e4b2 100644 --- a/services/ops/TopicWatcher/tests/test_topic_watcher.py +++ b/services/ops/TopicWatcher/tests/test_topic_watcher.py @@ -135,7 +135,7 @@ def test_basic(agent): """ global alert_messages, db_connection publish_time = get_aware_utc_now() - print (f"publish time is {publish_time}") + print(f"publish time is {publish_time}") for _ in range(5): alert_messages.clear() agent.vip.pubsub.publish(peer='pubsub', diff --git a/volttrontesting/platform/base_market_agent/test_poly_line.py b/volttrontesting/platform/base_market_agent/test_poly_line.py index e711093162..0032345bd5 100644 --- a/volttrontesting/platform/base_market_agent/test_poly_line.py +++ b/volttrontesting/platform/base_market_agent/test_poly_line.py @@ -47,55 +47,55 @@ @pytest.mark.market def test_poly_line_min(): - min = PolyLine.min(1,2) + min = PolyLine.min(1, 2) assert min == 1 @pytest.mark.market def test_poly_line_min_first_none(): - min = PolyLine.min(None,2) + min = PolyLine.min(None, 2) assert min == 2 @pytest.mark.market def test_poly_line_min_second_none(): - min = PolyLine.min(1,None) + min = PolyLine.min(1, None) assert min == 1 @pytest.mark.market def test_poly_line_max(): - max = PolyLine.max(1,2) + max = PolyLine.max(1, 2) assert max == 2 @pytest.mark.market def test_poly_line_max_first_none(): - max = PolyLine.max(None,2) + max = PolyLine.max(None, 2) assert max == 2 @pytest.mark.market def test_poly_line_max_second_none(): - max = PolyLine.max(1,None) + max = PolyLine.max(1, None) assert max == 1 @pytest.mark.market def test_poly_line_sum(): - sum = PolyLine.sum(1,2) + sum = PolyLine.sum(1, 2) assert sum == 3 @pytest.mark.market def test_poly_line_sum_first_none(): - sum = PolyLine.sum(None,2) + sum = PolyLine.sum(None, 2) assert sum == 2 @pytest.mark.market def test_poly_line_sum_second_none(): - sum = PolyLine.sum(1,None) + sum = PolyLine.sum(1, None) assert sum == 1 @@ -108,23 +108,23 @@ def test_poly_line_init_points_none(): @pytest.mark.market def test_poly_line_add_one_point(): line = PolyLine() - line.add(Point(4,8)) + line.add(Point(4, 8)) assert len(line.points) == 1 @pytest.mark.market def test_poly_line_add_two_points(): line = PolyLine() - line.add(Point(4,8)) - line.add(Point(2,4)) + line.add(Point(4, 8)) + line.add(Point(2, 4)) assert len(line.points) == 2 @pytest.mark.market def test_poly_line_add_points_is_sorted(): line = PolyLine() - line.add(Point(4,8)) - line.add(Point(2,4)) + line.add(Point(4, 8)) + line.add(Point(2, 4)) assert line.points[0].x == 2 @@ -156,10 +156,10 @@ def create_supply_curve(): supply_curve = PolyLine() price = 0 quantity = 0 - supply_curve.add(Point(price,quantity)) + supply_curve.add(Point(price, quantity)) price = 1000 quantity = 1000 - supply_curve.add(Point(price,quantity)) + supply_curve.add(Point(price, quantity)) return supply_curve @@ -167,8 +167,8 @@ def create_demand_curve(): demand_curve = PolyLine() price = 0 quantity = 1000 - demand_curve.add(Point(price,quantity)) + demand_curve.add(Point(price, quantity)) price = 1000 quantity = 0 - demand_curve.add(Point(price,quantity)) + demand_curve.add(Point(price, quantity)) return demand_curve diff --git a/volttrontesting/services/aggregate_historian/copy_test_data.py b/volttrontesting/services/aggregate_historian/copy_test_data.py index ac019e4542..2e43ca65a4 100644 --- a/volttrontesting/services/aggregate_historian/copy_test_data.py +++ b/volttrontesting/services/aggregate_historian/copy_test_data.py @@ -36,13 +36,13 @@ def connect_mongodb(connection_params): - print ("setup mongodb") + print("setup mongodb") mongo_conn_str = 'mongodb://{user}:{passwd}@{host}:{port}/{database}' if connection_params.get('authSource'): mongo_conn_str = mongo_conn_str+ '?authSource={authSource}' params = connection_params mongo_conn_str = mongo_conn_str.format(**params) - print (mongo_conn_str) + print(mongo_conn_str) mongo_client = pymongo.MongoClient(mongo_conn_str) db = mongo_client[connection_params['database']] return db @@ -118,7 +118,7 @@ def copy(source_params, dest_params, start_date, end_date): {'$and': [{'_id': {'$gte': ObjectId.from_datetime(start_date)}}, {'_id': {'$lte': ObjectId.from_datetime(end_date)}}]}) - print ("Record count from cursor {}".format(cursor.count())) + print("Record count from cursor {}".format(cursor.count())) for record in cursor: i += 1 records.append( diff --git a/volttrontesting/services/aggregate_historian/test_aggregate_historian.py b/volttrontesting/services/aggregate_historian/test_aggregate_historian.py index 7d7107b63b..62c58a317d 100644 --- a/volttrontesting/services/aggregate_historian/test_aggregate_historian.py +++ b/volttrontesting/services/aggregate_historian/test_aggregate_historian.py @@ -192,7 +192,7 @@ def setup_mysql(connection_params, table_names): - print ("setup mysql") + print("setup mysql") db_connection = mysql.connect(**connection_params) # clean up any rows from older runs cleanup_mysql(db_connection, None, drop_tables=True) @@ -200,11 +200,11 @@ def setup_mysql(connection_params, table_names): def setup_sqlite(connection_params, table_names): - print ("setup sqlite") + print("setup sqlite") database_path = connection_params['database'] - print ("connecting to sqlite path " + database_path) + print("connecting to sqlite path " + database_path) db_connection = sqlite3.connect(database_path) - print ("successfully connected to sqlite") + print("successfully connected to sqlite") cleanup_sqlite(db_connection, None, drop_tables=True) db_connection.commit() return db_connection @@ -328,9 +328,9 @@ def get_table_names(config): def publish_test_data(publish_agent, start_time, start_reading, count): reading = start_reading time = start_time - print ("publishing test data starttime is {} utcnow is {}".format( + print("publishing test data starttime is {} utcnow is {}".format( start_time, datetime.utcnow())) - print ("publishing test data value string {} at {}".format(reading, + print("publishing test data value string {} at {}".format(reading, datetime.now())) float_meta = {'units': 'F', 'tz': 'UTC', 'type': 'float'} @@ -426,7 +426,7 @@ def aggregate_agent(request, volttron_instance): # Set this hear so that we can create these table after connecting to db table_names = get_table_names(request.param) - print ("request.param -- {}".format(request.param)) + print("request.param -- {}".format(request.param)) # 2: Open db connection that can be used for row deletes after # each test method. Clean up old tables if any @@ -502,7 +502,7 @@ def test_get_supported_aggregations(aggregate_agent, query_agent): 'get_supported_aggregations').get(timeout=10) assert result - print (result) + print(result) conn = aggregate_agent.get("connection") if conn: if conn.get("type") == "mysql": @@ -1041,7 +1041,7 @@ def test_topic_reconfiguration(aggregate_agent, query_agent): AGG_AGENT_VIP, "config", new_config).get() - print ("After configure\n\n") + print("After configure\n\n") gevent.sleep(3) result1 = query_agent.vip.rpc.call( diff --git a/volttrontesting/services/aggregate_historian/test_base_aggregate_historian.py b/volttrontesting/services/aggregate_historian/test_base_aggregate_historian.py index c3931725cf..ede35b0ca5 100644 --- a/volttrontesting/services/aggregate_historian/test_base_aggregate_historian.py +++ b/volttrontesting/services/aggregate_historian/test_base_aggregate_historian.py @@ -124,7 +124,7 @@ def test_time_slice_calculation_realtime(): # month aggregation period start, end = AggregateHistorian.compute_aggregation_time_slice( utc_collection_start_time, '2M', False) - print (start, end) + print(start, end) assert end == utc_collection_start_time assert start == utc_collection_start_time - timedelta(days=60) try: diff --git a/volttrontesting/services/market_service/test_market_service.py b/volttrontesting/services/market_service/test_market_service.py index 41758a06ac..894f6b4169 100644 --- a/volttrontesting/services/market_service/test_market_service.py +++ b/volttrontesting/services/market_service/test_market_service.py @@ -103,10 +103,10 @@ def create_supply_curve(self): supply_curve = PolyLine() price = 100 quantity = 0 - supply_curve.add(Point(price,quantity)) + supply_curve.add(Point(price, quantity)) price = 100 quantity = 1000 - supply_curve.add(Point(price,quantity)) + supply_curve.add(Point(price, quantity)) return supply_curve def create_demand_curve(self): diff --git a/volttrontesting/services/tagging/test_tagging.py b/volttrontesting/services/tagging/test_tagging.py index 8164372354..c038ad7c8b 100644 --- a/volttrontesting/services/tagging/test_tagging.py +++ b/volttrontesting/services/tagging/test_tagging.py @@ -260,7 +260,7 @@ def test_init_failure(volttron_instance, tagging_service, query_agent): except: pass gevent.sleep(1) - print ("Call back count {}".format(query_agent.callback.call_count)) + print("Call back count {}".format(query_agent.callback.call_count)) assert query_agent.callback.call_count == 1 print("Call args {}".format(query_agent.callback.call_args)) assert query_agent.callback.call_args[0][1] == 'test.tagging.init' diff --git a/volttrontesting/utils/utils.py b/volttrontesting/utils/utils.py index cfd2a81df2..3ff7076d23 100644 --- a/volttrontesting/utils/utils.py +++ b/volttrontesting/utils/utils.py @@ -134,7 +134,7 @@ def build_devices_header_and_message(points=['abc', 'def']): for point in points: data[point] = random() * 10 - meta_data[point] = meta_templates[randint(0,len(meta_templates)-1)] + meta_data[point] = meta_templates[randint(0, len(meta_templates)-1)] time1 = utils.format_timestamp( datetime.utcnow()) headers = {