From acd4be94a62ead362ac1073a57561c598f0c1b0f Mon Sep 17 00:00:00 2001 From: Minijackson Date: Tue, 5 Dec 2023 13:36:27 +0100 Subject: [PATCH 1/3] feat: add editor config file Ensures consistent style for the various languages --- .editorconfig | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..78419d6 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,30 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +trim_trailing_whitespace = true + +[*.nix] +indent_style = space +indent_size = 2 + +[*.{toml,yml,yaml}] +indent_style = space +indent_size = 2 + +[*.md] +indent_style = space + +[*.py] +indent_style = space +indent_size = 4 + +[*.sh] +indent_style = tab +indent_size = 4 + +[*.{db,dbd}] +indent_style = tab +indent_size = 4 From 1e32e20b90317ba8b5ed253a217a7de206b4cbed Mon Sep 17 00:00:00 2001 From: Minijackson Date: Tue, 5 Dec 2023 13:39:06 +0100 Subject: [PATCH 2/3] feat(ci): add editor config check as GitHub action --- .github/workflows/editorconfig.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/editorconfig.yml diff --git a/.github/workflows/editorconfig.yml b/.github/workflows/editorconfig.yml new file mode 100644 index 0000000..9fe857e --- /dev/null +++ b/.github/workflows/editorconfig.yml @@ -0,0 +1,18 @@ +name: "Check EditorConfig" + +permissions: read-all + +on: + push: + pull_request: + +jobs: + editorconfig: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v20 + - name: "Check EditorConfig" + # Python already has Ruff, + # and doesn't necessarily have a consistent 4 spaces indent + run: nix run 'nixpkgs#eclint' --inputs-from . -- -show_all_errors -exclude "**/*.py" From d2c12e60d5e6ee11c6e0cb644e5329140ad1845e Mon Sep 17 00:00:00 2001 From: Minijackson Date: Wed, 6 Dec 2023 08:49:12 +0100 Subject: [PATCH 3/3] chore: remove trailing whitespace, ensure final newlines to make the editorconfig check pass --- LICENSE | 2 +- wetest/generic/README.md | 4 +- ...unctional_CAENels_PS_FAST_1K5_current.yaml | 14 +++---- .../weTest_functional_basicPowerSupply.yaml | 42 +++++++++---------- ...unctional_generic_power_supply_config.yaml | 14 +++---- wetest/gui/base.py | 8 +--- wetest/resources/scenario_schema.yaml | 2 +- wetest/tests/macro-testing.yaml | 2 +- wetest/tests/scenario_range.yaml | 2 +- wetest/tests/type-testing.yaml | 2 +- 10 files changed, 44 insertions(+), 48 deletions(-) diff --git a/LICENSE b/LICENSE index cd09906..991d22d 100644 --- a/LICENSE +++ b/LICENSE @@ -13,4 +13,4 @@ Software: WeTest c. Modified copies and works based on the Software must carry prominent notices stating that you changed specified portions of the Software. 5. Portions of the Software resulted from work developed under a French Government contract and are subject to the following license: the Government is granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable worldwide license in this computer software to reproduce, prepare derivative works, and perform publicly and display publicly. 6. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDERS, THEIR THIRD PARTY LICENSORS, THE FRENCH, THE FRENCH DEPARTMENT OF ENERGY, AND THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4) DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL BE CORRECTED. -7. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT HOLDERS, THEIR THIRD PARTY LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGES. \ No newline at end of file +7. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT HOLDERS, THEIR THIRD PARTY LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGES. diff --git a/wetest/generic/README.md b/wetest/generic/README.md index 610b99b..ac232d5 100644 --- a/wetest/generic/README.md +++ b/wetest/generic/README.md @@ -26,7 +26,7 @@ See ```specific/weTest_functional_CAENels_PS_FAST_1K5_current.yaml``` to get an As you can see in the above script, it is sometimes necessary to call several times the ```config``` (or an other part) to fit the power supply behavior. Here you have to first power on the channel and then set the setpoint (current command). -## Specific models +## Specific models Files in ```specific``` folder can be seen as example but you can also use them if it is the power suplly you want to control. @@ -40,4 +40,4 @@ Don't hesitate to: - ask for new features (ex: polarity and regulation mode (current or voltage) were the last features added) - add more specific models scripts -Contact: Victor Nadot, victor.nadot@cea.fr \ No newline at end of file +Contact: Victor Nadot, victor.nadot@cea.fr diff --git a/wetest/generic/specific/weTest_functional_CAENels_PS_FAST_1K5_current.yaml b/wetest/generic/specific/weTest_functional_CAENels_PS_FAST_1K5_current.yaml index 1462053..4127e9c 100644 --- a/wetest/generic/specific/weTest_functional_CAENels_PS_FAST_1K5_current.yaml +++ b/wetest/generic/specific/weTest_functional_CAENels_PS_FAST_1K5_current.yaml @@ -5,22 +5,22 @@ name: "${TEST_TITLE}" macros: - TEST_TITLE: "functional test of CAENels fast PS 1K5" P: "Sec-Sub(x):Dis-Dev-Idx:" - DELAY: 1 - RETRY: 5 + DELAY: 1 + RETRY: 5 ## not specific to power supply (user inputs) # current CURRENT: 0.1 # A # ramp - RAMP_UP: 0.1 # A/s + RAMP_UP: 0.1 # A/s DELAY_RAMP_UP: 5 # sec ## specific to power supply (won't change) # ramp SET_RAMP_UP: "IRampSet" - GET_RAMP_UP: "IRampRb" + GET_RAMP_UP: "IRampRb" # regulation mode (current or voltage) - SET_REGULATION: "RegModeSet" - GET_REGULATION: "RegModeRb" + SET_REGULATION: "RegModeSet" + GET_REGULATION: "RegModeRb" # on/off SET_ON_OFF: "EnaCmd" GET_ON_OFF: "EnaRb" @@ -84,7 +84,7 @@ include: SET_ON_OFF: ${SET_ON_OFF} GET_ON_OFF: ${GET_ON_OFF} ON_STATE: 1 - DELAY_RAMP_UP: ${DELAY} # no ramp up here, waintoing for user setpoint (next move) + DELAY_RAMP_UP: ${DELAY} # no ramp up here, waintoing for user setpoint (next move) # config current diff --git a/wetest/generic/specific/weTest_functional_basicPowerSupply.yaml b/wetest/generic/specific/weTest_functional_basicPowerSupply.yaml index 9c51998..31ed270 100644 --- a/wetest/generic/specific/weTest_functional_basicPowerSupply.yaml +++ b/wetest/generic/specific/weTest_functional_basicPowerSupply.yaml @@ -16,8 +16,8 @@ name: "${TEST_TITLE}" macros: - TEST_TITLE: "functional test of DeltaESxxx" P: "CEA:" - DELAY: 1 - RETRY: 2 + DELAY: 1 + RETRY: 2 ## not specific to power supply (user inputs) # config VOLTAGE: 2 # Volts @@ -27,12 +27,12 @@ macros: POLARITY: "Positive field" DELAY_RAMP_UP: 1 # sec # check desired output (measured value) - GET_DESIRED_OUTPUT: "IMes" - DESIRED_OUTPUT: ${CURRENT} - DESIRED_OUTPUT_MARGIN: 1 #% + GET_DESIRED_OUTPUT: "IMes" + DESIRED_OUTPUT: ${CURRENT} + DESIRED_OUTPUT_MARGIN: 1 #% - ## specific to power supply (won't change) + ## specific to power supply (won't change) ## but user can still change them if needed # on/off SET_ON_OFF: "PwrEnaCmd" @@ -42,17 +42,17 @@ macros: DELAY_RAMP_DOWN: 1 # sec # voltage SET_VOLTAGE: "USet" - GET_VOLTAGE: "URb" + GET_VOLTAGE: "URb" # current SET_CURRENT: "ISet" GET_CURRENT: "IRb" # UVL SET_POLARITY: "BPosSet" - GET_POLARITY: "BPosRb" - # check CC/CV mode + GET_POLARITY: "BPosRb" + # check CC/CV mode GET_OPERATION_MODE: "CcStat" OPERATION_MODE: "CC" - + include: @@ -60,7 +60,7 @@ include: - path: 'wetest/generic/weTest_functional_generic_power_supply_init.yaml' TEST_TITLE: "init power supply ${P}" P: ${P} - DELAY: ${DELAY} + DELAY: ${DELAY} RETRY: ${RETRY} # init IGNORE_CLEAR: True @@ -80,16 +80,16 @@ include: RETRY: "${RETRY}" # set target voltage - IGNORE_VOLTAGE: False + IGNORE_VOLTAGE: False SET_VOLTAGE: "${SET_VOLTAGE}" - GET_VOLTAGE: "${GET_VOLTAGE}" + GET_VOLTAGE: "${GET_VOLTAGE}" VOLTAGE: "${VOLTAGE}" MARGIN_VOLTAGE: 0 # % # set current IGNORE_CURRENT: False SET_CURRENT: "${SET_CURRENT}" - GET_CURRENT: "${GET_CURRENT}" + GET_CURRENT: "${GET_CURRENT}" CURRENT: ${CURRENT} MARGIN_CURRENT: 0 # % @@ -97,7 +97,7 @@ include: IGNORE_POLARITY: $(IGNORE_POLARITY) SET_POLARITY: ${SET_POLARITY} GET_POLARITY: ${GET_POLARITY} - POLARITY: ${POLARITY} + POLARITY: ${POLARITY} # check desired output @@ -106,20 +106,20 @@ include: P: "${P}" DELAY: "${DELAY}" RETRY: "${RETRY}" - # on/off + # on/off IGNORE_ON_OFF: False SET_ON_OFF: ${SET_ON_OFF} GET_ON_OFF: ${GET_ON_OFF} ON_STATE: ${ON_STATE} - DELAY_RAMP_UP: ${DELAY_RAMP_UP} - # check CC/CV mode + DELAY_RAMP_UP: ${DELAY_RAMP_UP} + # check CC/CV mode IGNORE_CH_STATUS: ${IGNORE_CH_STATUS} GET_CH_STATUS: ${GET_OPERATION_MODE} CH_STATUS: ${OPERATION_MODE} # check desired output (measured value) - IGNORE_MEASURED_VALUE: False - GET_MEASURED_VALUE: ${GET_DESIRED_OUTPUT} + IGNORE_MEASURED_VALUE: False + GET_MEASURED_VALUE: ${GET_DESIRED_OUTPUT} MARGIN_MEASURED_VALUE: ${DESIRED_OUTPUT_MARGIN} MEASURED_VALUE: ${DESIRED_OUTPUT} - + diff --git a/wetest/generic/weTest_functional_generic_power_supply_config.yaml b/wetest/generic/weTest_functional_generic_power_supply_config.yaml index 715e128..09c4189 100644 --- a/wetest/generic/weTest_functional_generic_power_supply_config.yaml +++ b/wetest/generic/weTest_functional_generic_power_supply_config.yaml @@ -15,7 +15,7 @@ macros: DELAY: 0.2 # sec: defaut delay (timeout between setter and checking getter) RETRY: 2 # remote mode - IGNORE_REMOTE: True + IGNORE_REMOTE: True SET_REMOTE: "LocRemSet" REMOTE: 1 # set interclock @@ -33,7 +33,7 @@ macros: SET_RAMP_DOWN : "RDwnSet" GET_RAMP_DOWN : "RDwnRb" RAMP_DOWN: 50 # volt/sec or ms - # polarity + # polarity IGNORE_POLARITY: True SET_POLARITY: "BPosSet" GET_POLARITY: "BPosRb" @@ -43,7 +43,7 @@ macros: SET_REGULATION: "RegModeSet" GET_REGULATION: "RegModeRb" REGULATION_STATE: 0 # 0:CV, 1:CC - # voltage + # voltage IGNORE_VOLTAGE: True # by default, voltage tests are skipped SET_VOLTAGE: "USet" GET_VOLTAGE: "UMes" # should it be RBV or measure value her? TBD @@ -51,25 +51,25 @@ macros: MARGIN_VOLTAGE: 0 # % # voltage min IGNORE_VOLTAGE_MIN: True - SET_VOLTAGE_MIN: "UNVThrSet" + SET_VOLTAGE_MIN: "UNVThrSet" GET_VOLTAGE_MIN: "UNVThrRb" MARGIN_VOLTAGE_MIN: 0 # % VOLTAGE_MIN: 5 # volts # voltage max IGNORE_VOLTAGE_MAX: True - SET_VOLTAGE_MAX: "OVVThrSet" + SET_VOLTAGE_MAX: "OVVThrSet" GET_VOLTAGE_MAX: "OVVThrRb" MARGIN_VOLTAGE_MAX: 0 # % VOLTAGE_MAX: 15 # volts # current min IGNORE_CURRENT_MIN: True - SET_CURRENT_MIN: "UNCThrSet" + SET_CURRENT_MIN: "UNCThrSet" GET_CURRENT_MIN: "UNCThrRb" MARGIN_CURRENT_MIN: 0 # % CURRENT_MIN: 5 # A # current max IGNORE_CURRENT_MAX: True - SET_CURRENT_MAX: "OVCThrSet" + SET_CURRENT_MAX: "OVCThrSet" GET_CURRENT_MAX: "OVCThrRb" MARGIN_CURRENT_MAX: 0 # % CURRENT_MAX: 15 # A diff --git a/wetest/gui/base.py b/wetest/gui/base.py index 01774ff..0722742 100644 --- a/wetest/gui/base.py +++ b/wetest/gui/base.py @@ -209,12 +209,8 @@ class Tooltip: see: - http://stackoverflow.com/questions/3221956/ - what-is-the-simplest-way-to-make-tooltips- - in-tkinter/36221216#36221216 - - http://www.daniweb.com/programming/software-development/ - code/484591/a-tooltip-class-for-tkinter + http://stackoverflow.com/questions/3221956/what-is-the-simplest-way-to-make-tooltips-in-tkinter/36221216#36221216 + http://www.daniweb.com/programming/software-development/code/484591/a-tooltip-class-for-tkinter - Originally written by vegaseat on 2014.09.09. diff --git a/wetest/resources/scenario_schema.yaml b/wetest/resources/scenario_schema.yaml index ec063b9..84fc34f 100644 --- a/wetest/resources/scenario_schema.yaml +++ b/wetest/resources/scenario_schema.yaml @@ -183,4 +183,4 @@ mapping: type: int desc: | number of retry before marking test as failed, - defaults to config's `retry`, -1 for infinite number of retry \ No newline at end of file + defaults to config's `retry`, -1 for infinite number of retry diff --git a/wetest/tests/macro-testing.yaml b/wetest/tests/macro-testing.yaml index 3bd1cde..1015c24 100644 --- a/wetest/tests/macro-testing.yaml +++ b/wetest/tests/macro-testing.yaml @@ -198,4 +198,4 @@ tests: - ${test_1} - - ${test_2} \ No newline at end of file + - ${test_2} diff --git a/wetest/tests/scenario_range.yaml b/wetest/tests/scenario_range.yaml index daf4812..c0a3ef1 100644 --- a/wetest/tests/scenario_range.yaml +++ b/wetest/tests/scenario_range.yaml @@ -171,4 +171,4 @@ tests: step: 5 lin: 5 geom: 5 - sort: reverse \ No newline at end of file + sort: reverse diff --git a/wetest/tests/type-testing.yaml b/wetest/tests/type-testing.yaml index ae19c51..cd5611f 100644 --- a/wetest/tests/type-testing.yaml +++ b/wetest/tests/type-testing.yaml @@ -152,7 +152,7 @@ tests: value: [] - name: 'single-value waveform issue' - message: pyepics get returns a float rather than a waveform, is that true for regular EPICS records as well ? + message: pyepics get returns a float rather than a waveform, is that true for regular EPICS records as well ? commands: - name: "single-value waveform" setter: :UIncPwrMes-BPTR