From 7a5a98563b13c8a9c218fbf9d9998e59f5b7fde0 Mon Sep 17 00:00:00 2001 From: Markus Frank <Markus.Frank@cern.ch> Date: Fri, 15 Jul 2022 12:26:28 +0200 Subject: [PATCH] Fix python style according to Flake8 --- examples/DDG4/scripts/TestProperties.py | 42 ++++++++++++------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/examples/DDG4/scripts/TestProperties.py b/examples/DDG4/scripts/TestProperties.py index 222b168b6..a2e69be4c 100644 --- a/examples/DDG4/scripts/TestProperties.py +++ b/examples/DDG4/scripts/TestProperties.py @@ -9,11 +9,15 @@ # # ========================================================================== from __future__ import absolute_import, unicode_literals +import logging import DDG4 import os from g4units import GeV, m -# -# + +logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) +logger = logging.getLogger(__name__) + + """ dd4hep example setup using the python configuration @@ -85,7 +89,7 @@ def run(): (11 * GeV, 22 * GeV, 33 * GeV, 44 * GeV), (111 * GeV, 222 * GeV, 333 * GeV, 444 * GeV)] - act.list_str = ['aa', 'bb', 'cc' ,'dd'] + act.list_str = ['aa', 'bb', 'cc', 'dd'] act.list_bool = [0, 0, 0, 1, 1, 1] act.list_int = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] act.list_long = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] @@ -94,11 +98,11 @@ def run(): act.list_double = [0 * m, 1 * m, 2 * m, 3 * m, 4 * m, 5 * m, 6 * m, 7 * m, 8 * m, 8 * m, 8 * m] act.list_XYZPoint = [(1, 2, 3), (11, 22, 33), (111, 222, 333), (1111, 2222, 3333)] act.list_XYZVector = [(1, 2, 3), (11, 22, 33), (111, 222, 333), (1111, 2222, 3333)] - act.list_PxPyPzEVector = [(1 * GeV, 2 * GeV, 3 * GeV,4 * GeV), + act.list_PxPyPzEVector = [(1 * GeV, 2 * GeV, 3 * GeV, 4 * GeV), (11 * GeV, 22 * GeV, 33 * GeV, 44 * GeV), (111 * GeV, 222 * GeV, 333 * GeV, 444 * GeV)] - act.vector_str = ['aa', 'bb', 'cc' ,'dd'] + act.vector_str = ['aa', 'bb', 'cc', 'dd'] act.vector_bool = [0, 0, 0, 1, 1, 1] act.vector_int = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] act.vector_long = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] @@ -114,26 +118,20 @@ def run(): act.enableUI() # Check read access: - """ - print('--> {value}'.format(value='-------------------------------------------------------')) - print('--> {value}'.format(value=str(act.prop_str))) # 'Hello World!' - print('--> {value}'.format(value=str(act.prop_bool))) # True - print('--> {value}'.format(value=str(act.prop_int))) # 1234 - print('--> {value}'.format(value=str(act.prop_float))) # 1234567.8 - print('--> {value}'.format(value=str(act.prop_double))) # 1234567.8 - print('--> {value}'.format(value=str(act.prop_XYZPoint))) # (1,2,3) - print('--> {value}'.format(value=str(act.prop_XYZVector))) # (1 * m,2 * m,3 * m) - print('--> {value}'.format(value=str(act.prop_PxPyPzEVector))) # (1 * GeV,2 * GeV,3 * GeV,4 * GeV) - print('--> {value}'.format(value='-------------------------------------------------------')) - """ + logger.info('--> {value}'.format(value='-------------------------------------------------------')) + logger.info('--> {value}'.format(value=str(act.prop_str))) # 'Hello World!' + logger.info('--> {value}'.format(value=str(act.prop_bool))) # True + logger.info('--> {value}'.format(value=str(act.prop_int))) # 1234 + logger.info('--> {value}'.format(value=str(act.prop_float))) # 1234567.8 + logger.info('--> {value}'.format(value=str(act.prop_double))) # 1234567.8 + logger.info('--> {value}'.format(value=str(act.prop_XYZPoint))) # (1,2,3) + logger.info('--> {value}'.format(value=str(act.prop_XYZVector))) # (1 * m,2 * m,3 * m) + logger.info('--> {value}'.format(value=str(act.prop_PxPyPzEVector))) # (1 * GeV,2 * GeV,3 * GeV,4 * GeV) + logger.info('--> {value}'.format(value='-------------------------------------------------------')) phys = geant4.setupPhysics('FTFP_BERT') phys.dump() - ui.Commands = [ - '/ddg4/Test/show', - '/ddg4/Test/dumpProperties', - '/ddg4/UI/exit' - ] + ui.Commands = ['/ddg4/Test/show', '/ddg4/Test/dumpProperties', '/ddg4/UI/exit'] kernel.NumEvents = 0 kernel.configure() kernel.initialize() -- GitLab