Skip to content

Commit 0e19d63

Browse files
authored
Fixed imports in external samples python code. (#110)
1 parent 4302a9b commit 0e19d63

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

external_samples/color_range_sensor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# @author [email protected] (Alan Smith)
1818

1919
from component import Component, PortType, InvalidPortException
20-
from collections.abc import Protocol
20+
from typing import Protocol
2121

2222
class DistanceCallable(Protocol):
2323
def __call__(self, distance : float) -> None:
@@ -78,4 +78,4 @@ def register_when_saturation_in_range(self, min_saturation : int,
7878
max_saturation : int,
7979
callback : ColorCallable) -> None:
8080
'''Event when saturation is in range'''
81-
self.saturation_in_range_callback = callback
81+
self.saturation_in_range_callback = callback

external_samples/component.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
from abc import ABC, abstractmethod
2020
from enum import Enum
21-
from collections.abc import Protocol
21+
from typing import Protocol
2222

2323
class EmptyCallable(Protocol):
2424
def __call__(self) -> None:
@@ -83,4 +83,4 @@ def get_connection_port_type(self) -> list[PortType]:
8383
# to talk to hardware and then call callbacks
8484
@abstractmethod
8585
def periodic(self) -> None:
86-
pass
86+
pass

external_samples/sparkfun_led_stick.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
__author__ = "[email protected] (Liz Looney)"
16+
117
from component import Component, PortType, InvalidPortException
2-
from enum import Enum
318
import wpilib
419

520
class SparkFunLEDStick(Component):

0 commit comments

Comments
 (0)