Skip to content

Fixed imports in external samples python code. #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions external_samples/color_range_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# @author [email protected] (Alan Smith)

from component import Component, PortType, InvalidPortException
from collections.abc import Protocol
from typing import Protocol

class DistanceCallable(Protocol):
def __call__(self, distance : float) -> None:
Expand Down Expand Up @@ -78,4 +78,4 @@ def register_when_saturation_in_range(self, min_saturation : int,
max_saturation : int,
callback : ColorCallable) -> None:
'''Event when saturation is in range'''
self.saturation_in_range_callback = callback
self.saturation_in_range_callback = callback
4 changes: 2 additions & 2 deletions external_samples/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from abc import ABC, abstractmethod
from enum import Enum
from collections.abc import Protocol
from typing import Protocol

class EmptyCallable(Protocol):
def __call__(self) -> None:
Expand Down Expand Up @@ -83,4 +83,4 @@ def get_connection_port_type(self) -> list[PortType]:
# to talk to hardware and then call callbacks
@abstractmethod
def periodic(self) -> None:
pass
pass
17 changes: 16 additions & 1 deletion external_samples/sparkfun_led_stick.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

__author__ = "[email protected] (Liz Looney)"

from component import Component, PortType, InvalidPortException
from enum import Enum
import wpilib

class SparkFunLEDStick(Component):
Expand Down