Skip to content

Commit 388d21a

Browse files
committed
Make generic property value names uppercase to comply with PEP
1 parent 315020b commit 388d21a

File tree

2 files changed

+54
-54
lines changed

2 files changed

+54
-54
lines changed

ev3dev.py

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -514,69 +514,69 @@ def time_sp(self, value):
514514
#~autogen generic-property-value classes.motor>currentClass
515515

516516
# Run the motor until another command is sent.
517-
command_run_forever = 'run-forever'
517+
COMMAND_RUN_FOREVER = 'run-forever'
518518

519519
# Run to an absolute position specified by `position_sp` and then
520520
# stop using the command specified in `stop_command`.
521-
command_run_to_abs_pos = 'run-to-abs-pos'
521+
COMMAND_RUN_TO_ABS_POS = 'run-to-abs-pos'
522522

523523
# Run to a position relative to the current `position` value.
524524
# The new position will be current `position` + `position_sp`.
525525
# When the new position is reached, the motor will stop using
526526
# the command specified by `stop_command`.
527-
command_run_to_rel_pos = 'run-to-rel-pos'
527+
COMMAND_RUN_TO_REL_POS = 'run-to-rel-pos'
528528

529529
# Run the motor for the amount of time specified in `time_sp`
530530
# and then stop the motor using the command specified by `stop_command`.
531-
command_run_timed = 'run-timed'
531+
COMMAND_RUN_TIMED = 'run-timed'
532532

533533
# Run the motor at the duty cycle specified by `duty_cycle_sp`.
534534
# Unlike other run commands, changing `duty_cycle_sp` while running *will*
535535
# take effect immediately.
536-
command_run_direct = 'run-direct'
536+
COMMAND_RUN_DIRECT = 'run-direct'
537537

538538
# Stop any of the run commands before they are complete using the
539539
# command specified by `stop_command`.
540-
command_stop = 'stop'
540+
COMMAND_STOP = 'stop'
541541

542542
# Reset all of the motor parameter attributes to their default value.
543543
# This will also have the effect of stopping the motor.
544-
command_reset = 'reset'
544+
COMMAND_RESET = 'reset'
545545

546546
# Sets the normal polarity of the rotary encoder.
547-
encoder_polarity_normal = 'normal'
547+
ENCODER_POLARITY_NORMAL = 'normal'
548548

549549
# Sets the inversed polarity of the rotary encoder.
550-
encoder_polarity_inversed = 'inversed'
550+
ENCODER_POLARITY_INVERSED = 'inversed'
551551

552552
# With `normal` polarity, a positive duty cycle will
553553
# cause the motor to rotate clockwise.
554-
polarity_normal = 'normal'
554+
POLARITY_NORMAL = 'normal'
555555

556556
# With `inversed` polarity, a positive duty cycle will
557557
# cause the motor to rotate counter-clockwise.
558-
polarity_inversed = 'inversed'
558+
POLARITY_INVERSED = 'inversed'
559559

560560
# The motor controller will vary the power supplied to the motor
561561
# to try to maintain the speed specified in `speed_sp`.
562-
speed_regulation_on = 'on'
562+
SPEED_REGULATION_ON = 'on'
563563

564564
# The motor controller will use the power specified in `duty_cycle_sp`.
565-
speed_regulation_off = 'off'
565+
SPEED_REGULATION_OFF = 'off'
566566

567567
# Power will be removed from the motor and it will freely coast to a stop.
568-
stop_command_coast = 'coast'
568+
STOP_COMMAND_COAST = 'coast'
569569

570570
# Power will be removed from the motor and a passive electrical load will
571571
# be placed on the motor. This is usually done by shorting the motor terminals
572572
# together. This load will absorb the energy from the rotation of the motors and
573573
# cause the motor to stop more quickly than coasting.
574-
stop_command_brake = 'brake'
574+
STOP_COMMAND_BRAKE = 'brake'
575575

576576
# Does not remove power from the motor. Instead it actively try to hold the motor
577577
# at the current position. If an external force tries to turn the motor, the motor
578578
# will ``push back`` to maintain its position.
579-
stop_command_hold = 'hold'
579+
STOP_COMMAND_HOLD = 'hold'
580580

581581

582582
#~autogen
@@ -838,37 +838,37 @@ def time_sp(self, value):
838838
#~autogen generic-property-value classes.dcMotor>currentClass
839839

840840
# Run the motor until another command is sent.
841-
command_run_forever = 'run-forever'
841+
COMMAND_RUN_FOREVER = 'run-forever'
842842

843843
# Run the motor for the amount of time specified in `time_sp`
844844
# and then stop the motor using the command specified by `stop_command`.
845-
command_run_timed = 'run-timed'
845+
COMMAND_RUN_TIMED = 'run-timed'
846846

847847
# Run the motor at the duty cycle specified by `duty_cycle_sp`.
848848
# Unlike other run commands, changing `duty_cycle_sp` while running *will*
849849
# take effect immediately.
850-
command_run_direct = 'run-direct'
850+
COMMAND_RUN_DIRECT = 'run-direct'
851851

852852
# Stop any of the run commands before they are complete using the
853853
# command specified by `stop_command`.
854-
command_stop = 'stop'
854+
COMMAND_STOP = 'stop'
855855

856856
# With `normal` polarity, a positive duty cycle will
857857
# cause the motor to rotate clockwise.
858-
polarity_normal = 'normal'
858+
POLARITY_NORMAL = 'normal'
859859

860860
# With `inversed` polarity, a positive duty cycle will
861861
# cause the motor to rotate counter-clockwise.
862-
polarity_inversed = 'inversed'
862+
POLARITY_INVERSED = 'inversed'
863863

864864
# Power will be removed from the motor and it will freely coast to a stop.
865-
stop_command_coast = 'coast'
865+
STOP_COMMAND_COAST = 'coast'
866866

867867
# Power will be removed from the motor and a passive electrical load will
868868
# be placed on the motor. This is usually done by shorting the motor terminals
869869
# together. This load will absorb the energy from the rotation of the motors and
870870
# cause the motor to stop more quickly than coasting.
871-
stop_command_brake = 'brake'
871+
STOP_COMMAND_BRAKE = 'brake'
872872

873873

874874
#~autogen
@@ -1060,18 +1060,18 @@ def state(self):
10601060
#~autogen generic-property-value classes.servoMotor>currentClass
10611061

10621062
# Drive servo to the position set in the `position_sp` attribute.
1063-
command_run = 'run'
1063+
COMMAND_RUN = 'run'
10641064

10651065
# Remove power from the motor.
1066-
command_float = 'float'
1066+
COMMAND_FLOAT = 'float'
10671067

10681068
# With `normal` polarity, a positive duty cycle will
10691069
# cause the motor to rotate clockwise.
1070-
polarity_normal = 'normal'
1070+
POLARITY_NORMAL = 'normal'
10711071

10721072
# With `inversed` polarity, a positive duty cycle will
10731073
# cause the motor to rotate counter-clockwise.
1074-
polarity_inversed = 'inversed'
1074+
POLARITY_INVERSED = 'inversed'
10751075

10761076

10771077
#~autogen
@@ -1284,19 +1284,19 @@ def __init__(self, port=None, name=SYSTEM_DEVICE_NAME_CONVENTION, **kwargs):
12841284
#~autogen generic-property-value classes.colorSensor>currentClass
12851285

12861286
# Reflected light. Red LED on.
1287-
mode_col_reflect = 'COL-REFLECT'
1287+
MODE_COL_REFLECT = 'COL-REFLECT'
12881288

12891289
# Ambient light. Red LEDs off.
1290-
mode_col_ambient = 'COL-AMBIENT'
1290+
MODE_COL_AMBIENT = 'COL-AMBIENT'
12911291

12921292
# Color. All LEDs rapidly cycling, appears white.
1293-
mode_col_color = 'COL-COLOR'
1293+
MODE_COL_COLOR = 'COL-COLOR'
12941294

12951295
# Raw reflected. Red LED on
1296-
mode_ref_raw = 'REF-RAW'
1296+
MODE_REF_RAW = 'REF-RAW'
12971297

12981298
# Raw Color Components. All LEDs rapidly cycling, appears white.
1299-
mode_rgb_raw = 'RGB-RAW'
1299+
MODE_RGB_RAW = 'RGB-RAW'
13001300

13011301

13021302
#~autogen
@@ -1321,22 +1321,22 @@ def __init__(self, port=None, name=SYSTEM_DEVICE_NAME_CONVENTION, **kwargs):
13211321

13221322
# Continuous measurement in centimeters.
13231323
# LEDs: On, steady
1324-
mode_us_dist_cm = 'US-DIST-CM'
1324+
MODE_US_DIST_CM = 'US-DIST-CM'
13251325

13261326
# Continuous measurement in inches.
13271327
# LEDs: On, steady
1328-
mode_us_dist_in = 'US-DIST-IN'
1328+
MODE_US_DIST_IN = 'US-DIST-IN'
13291329

13301330
# Listen. LEDs: On, blinking
1331-
mode_us_listen = 'US-LISTEN'
1331+
MODE_US_LISTEN = 'US-LISTEN'
13321332

13331333
# Single measurement in centimeters.
13341334
# LEDs: On momentarily when mode is set, then off
1335-
mode_us_si_cm = 'US-SI-CM'
1335+
MODE_US_SI_CM = 'US-SI-CM'
13361336

13371337
# Single measurement in inches.
13381338
# LEDs: On momentarily when mode is set, then off
1339-
mode_us_si_in = 'US-SI-IN'
1339+
MODE_US_SI_IN = 'US-SI-IN'
13401340

13411341

13421342
#~autogen
@@ -1360,19 +1360,19 @@ def __init__(self, port=None, name=SYSTEM_DEVICE_NAME_CONVENTION, **kwargs):
13601360
#~autogen generic-property-value classes.gyroSensor>currentClass
13611361

13621362
# Angle
1363-
mode_gyro_ang = 'GYRO-ANG'
1363+
MODE_GYRO_ANG = 'GYRO-ANG'
13641364

13651365
# Rotational speed
1366-
mode_gyro_rate = 'GYRO-RATE'
1366+
MODE_GYRO_RATE = 'GYRO-RATE'
13671367

13681368
# Raw sensor value
1369-
mode_gyro_fas = 'GYRO-FAS'
1369+
MODE_GYRO_FAS = 'GYRO-FAS'
13701370

13711371
# Angle and rotational speed
1372-
mode_gyro_g_a = 'GYRO-G&A'
1372+
MODE_GYRO_G_A = 'GYRO-G&A'
13731373

13741374
# Calibration ???
1375-
mode_gyro_cal = 'GYRO-CAL'
1375+
MODE_GYRO_CAL = 'GYRO-CAL'
13761376

13771377

13781378
#~autogen
@@ -1396,19 +1396,19 @@ def __init__(self, port=None, name=SYSTEM_DEVICE_NAME_CONVENTION, **kwargs):
13961396
#~autogen generic-property-value classes.infraredSensor>currentClass
13971397

13981398
# Proximity
1399-
mode_ir_prox = 'IR-PROX'
1399+
MODE_IR_PROX = 'IR-PROX'
14001400

14011401
# IR Seeker
1402-
mode_ir_seek = 'IR-SEEK'
1402+
MODE_IR_SEEK = 'IR-SEEK'
14031403

14041404
# IR Remote Control
1405-
mode_ir_remote = 'IR-REMOTE'
1405+
MODE_IR_REMOTE = 'IR-REMOTE'
14061406

14071407
# IR Remote Control. State of the buttons is coded in binary
1408-
mode_ir_rem_a = 'IR-REM-A'
1408+
MODE_IR_REM_A = 'IR-REM-A'
14091409

14101410
# Calibration ???
1411-
mode_ir_cal = 'IR-CAL'
1411+
MODE_IR_CAL = 'IR-CAL'
14121412

14131413

14141414
#~autogen
@@ -1434,10 +1434,10 @@ def __init__(self, port=None, name=SYSTEM_DEVICE_NAME_CONVENTION, **kwargs):
14341434
#~autogen generic-property-value classes.soundSensor>currentClass
14351435

14361436
# Sound pressure level. Flat weighting
1437-
mode_db = 'DB'
1437+
MODE_DB = 'DB'
14381438

14391439
# Sound pressure level. A weighting
1440-
mode_dba = 'DBA'
1440+
MODE_DBA = 'DBA'
14411441

14421442

14431443
#~autogen
@@ -1461,10 +1461,10 @@ def __init__(self, port=None, name=SYSTEM_DEVICE_NAME_CONVENTION, **kwargs):
14611461
#~autogen generic-property-value classes.lightSensor>currentClass
14621462

14631463
# Reflected light. LED on
1464-
mode_reflect = 'REFLECT'
1464+
MODE_REFLECT = 'REFLECT'
14651465

14661466
# Ambient light. LED off
1467-
mode_ambient = 'AMBIENT'
1467+
MODE_AMBIENT = 'AMBIENT'
14681468

14691469

14701470
#~autogen
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{% for prop in currentClass.propertyValues %}{%
22
assign className = currentClass.friendlyName | downcase | underscore_spaces %}{%
3-
assign propName = prop.propertyName | downcase | underscore_spaces %}{%
3+
assign propName = prop.propertyName | upcase | underscore_spaces %}{%
44
for value in prop.values %}{%
55
for line in value.description %}
66
# {{ line }}{%
77
endfor %}
8-
{{ propName }}_{{ value.name | downcase | underscore_non_wc }} = '{{ value.name }}'
8+
{{ propName }}_{{ value.name | upcase | underscore_non_wc }} = '{{ value.name }}'
99
{% endfor %}{%
1010
endfor %}

0 commit comments

Comments
 (0)