Skip to content

Commit c05db9d

Browse files
committed
Merge branch 'dev' into 080-backport-dev
2 parents 1ede5a3 + 6a2859a commit c05db9d

File tree

9 files changed

+17
-18
lines changed

9 files changed

+17
-18
lines changed

mpf/core/device_manager.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,7 @@ def __iter__(self):
301301
self.machine.log.warning("Iterating device collections directly is deprecated and will be removed. "
302302
"Access by value(): device_collections[%s] -> device_collections['%s'].values()",
303303
self.name, self.name)
304-
for item in self.values():
305-
yield item
304+
yield from self.values()
306305

307306
def items_tagged(self, tag) -> List["Device"]:
308307
"""Return of list of device objects which have a certain tag.

mpf/core/logging.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,13 @@ def format_log_line(self, msg, context, error_no) -> str:
160160
if error_no:
161161
error_slug = "Log-{}-{}".format(self.log.name if self.log else "", error_no)
162162
error_url = log_url.format(error_slug)
163-
if error_no and context:
164-
return "{} Context: {} Log Code: {} ({})".format(msg, context, error_slug, error_url)
163+
164+
if context:
165+
return "{} Context: {} Log Code: {} ({})".format(msg, context, error_slug, error_url)
166+
return "{} Log Code: {} ({})".format(msg, error_slug, error_url)
167+
165168
if context:
166169
return "{} Context: {} ".format(msg, context)
167-
if error_no:
168-
return "{} Log Code: {} ({})".format(msg, error_slug, error_url)
169170

170171
return msg
171172

mpf/core/utility_functions.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,7 @@ def flatten_list(incoming_list):
185185
"""Convert a list of nested lists and/or values into a single one-dimensional list."""
186186
for item in incoming_list:
187187
if isinstance(item, IterableCollection) and not isinstance(item, str):
188-
for inner_item in Util.flatten_list(item):
189-
yield inner_item
188+
yield from Util.flatten_list(item)
190189
else:
191190
yield item
192191

mpf/modes/service/code/service.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ def _generate_light_chains(self): # pylint: disable=too-many-locals
508508
for board, l in items:
509509
numbers = l.get_hw_numbers()
510510
chain_2 = None
511+
addr_2 = None
511512
# Just choose the first one as representative?
512513
number = numbers[0]
513514
if "-" in number:
@@ -557,7 +558,7 @@ def _generate_light_chains(self): # pylint: disable=too-many-locals
557558
items.append(LightChainMap(platform_name, chain_name, chain))
558559
# do not crash if no lights are configured
559560
if not items: # pragma: no cover
560-
return
561+
return []
561562

562563
items.sort(key=lambda x: x.chain)
563564
return items

mpf/platforms/fast/communicators/base.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,9 @@ async def _socket_writer(self):
448448
if self.pause_sending_flag.is_set():
449449
await self.pause_sending_flag.wait()
450450

451+
# TODO better way to catch shutting down?
451452
except SerialException as e:
452453
self.log.error(e)
453-
return # TODO better way to catch shutting down?
454454

455455
def write_to_port(self, msg, log_msg=None):
456456
"""Send a message as is, without encoding or adding a <CR> character."""
@@ -464,4 +464,3 @@ def write_to_port(self, msg, log_msg=None):
464464
self.writer.write(msg)
465465
except AttributeError:
466466
self.log.warning("Serial connection is not open. Cannot send message: %s", msg)
467-
return

mpf/platforms/fast/fast_driver.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,9 @@ def _pulse(self, pulse_settings: PulseSettings, hold_settings: HoldSettings = No
503503
reconfigured = True
504504

505505
if hold_settings is not None:
506+
hold_power = Util.float_to_pwm8_hex_string(hold_settings.power)
507+
hold_ms = "00"
508+
506509
if hold_settings.duration > 25500:
507510
raise AssertionError("FAST platform does not support hold durations > 25500ms")
508511
if 25500 >= hold_settings.duration > 255:
@@ -512,8 +515,6 @@ def _pulse(self, pulse_settings: PulseSettings, hold_settings: HoldSettings = No
512515
hold_ms = Util.int_to_hex_string(hold_settings.duration)
513516
mode = '10'
514517

515-
hold_power = Util.float_to_pwm8_hex_string(hold_settings.power)
516-
517518
else:
518519
hold_ms = self.current_driver_config.param3
519520
hold_power = self.current_driver_config.param4

mpf/platforms/light_segment_displays.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import logging
33

44
from mpf.devices.segment_display.segment_display_text import ColoredSegmentDisplayText
5-
from mpf.core.segment_mappings import SEVEN_SEGMENTS, BCD_SEGMENTS, FOURTEEN_SEGMENTS, SIXTEEN_SEGMENTS,\
5+
from mpf.core.segment_mappings import SEVEN_SEGMENTS, BCD_SEGMENTS, FOURTEEN_SEGMENTS, SIXTEEN_SEGMENTS, \
66
EIGHT_SEGMENTS, TextToSegmentMapper
77
from mpf.platforms.interfaces.segment_display_platform_interface import SegmentDisplaySoftwareFlashPlatformInterface
88
from mpf.core.platform import SegmentDisplaySoftwareFlashPlatform

mpf/platforms/opp/opp.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,6 @@ def parse_light_number_to_channels(self, number: str, subtype: str):
890890
]
891891

892892
self.raise_config_error("Unknown subtype {}".format(subtype), 8)
893-
return []
894893

895894
def configure_light(self, number, subtype, config, platform_settings):
896895
"""Configure a led or matrix light."""
@@ -949,7 +948,6 @@ def configure_light(self, number, subtype, config, platform_settings):
949948
return self.opp_incands[index].configure_software_fade_incand(light_num)
950949

951950
self.raise_config_error("Unknown subtype {}".format(subtype), 12)
952-
return None
953951

954952
async def _poll_sender(self, chain_serial):
955953
"""Poll switches."""
@@ -1148,6 +1146,7 @@ async def configure_servo(self, number, config: dict) -> OPPServo:
11481146
"""Generate an OPPServo class with the given number."""
11491147
del config
11501148
chain_serial, _, pin_number = number.split('-') # Unused value is 'card'
1149+
possible_inputs = None
11511150

11521151
if self.min_version[chain_serial] < 0x02020002:
11531152
self.raise_config_error("Servos not supported on this OPP FW version: {}.".format(
@@ -1157,7 +1156,7 @@ async def configure_servo(self, number, config: dict) -> OPPServo:
11571156
if inputs.chain_serial == chain_serial:
11581157
possible_inputs = self._get_numbers(inputs.mask)
11591158

1160-
if 8 <= int(pin_number) < 16 and int(pin_number) in possible_inputs:
1159+
if 8 <= int(pin_number) < 16 and possible_inputs and int(pin_number) in possible_inputs:
11611160
servo_number = int(pin_number) - 8
11621161
else:
11631162
self.raise_config_error("Servo unavailable at this number: {}.".format(number), 24)

mpf/plugins/auditor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def _load_defaults(self):
7878

7979
self.switchnames_to_audit = {
8080
# Don't audit tagged switches, or credit switches during free play
81-
x.name for x in self.machine.switches.values() if \
81+
x.name for x in self.machine.switches.values() if
8282
('no_audit' not in x.tags) and ('no_audit_free' not in x.tags or not is_free_play)
8383
}
8484

0 commit comments

Comments
 (0)