-
Notifications
You must be signed in to change notification settings - Fork 3
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
WORK IN PROGRESS: test linting #21
Open
JohanKarlbergg
wants to merge
7
commits into
main
Choose a base branch
from
linting
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a5ae485
test linting
JohanKarlbergg 2324eaa
Fix linting and formatting
OdoctorG 7d52066
fix: address pylint warnings
OdoctorG 6c80872
fix: bug in pytest because of variable name change
OdoctorG fe8050f
fix: bug in ecu
OdoctorG 58b3f3c
fix: bug in simple-ecu example, because of typing
OdoctorG 610e94c
fix: typing errors with new mypy config
OdoctorG File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Code-QA | ||
|
||
on: push | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.8.18 | ||
architecture: x64 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install deps | ||
run: | | ||
pip install mypy==1.8.0 pylint==3.2.5 ruff==0.1.14 pylint-protobuf==0.22.0 remotivelabs-broker>=0.1.8 pytest | ||
- name: Run lint | ||
run: | | ||
cd python | ||
make | ||
cd - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.idea | ||
*.iml | ||
*.iml | ||
.venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
.pyc | ||
__pycache__ | ||
.venv | ||
__pycache__ | ||
.* | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
MAKEFLAGS += -j4 -O | ||
.DEFAULT_GOAL := lint | ||
|
||
.PHONY: lint | ||
lint: pylint mypy ruff-format ruff | ||
|
||
.PHONY: pylint | ||
pylint: | ||
pylint . | ||
@echo "" | ||
|
||
.PHONY: mypy | ||
mypy: | ||
mypy . --config-file pyproject.toml | ||
@echo "" | ||
|
||
.PHONY: ruff-format | ||
ruff-format: | ||
ruff format --check --diff | ||
@echo "" | ||
|
||
.PHONY: ruff | ||
ruff: | ||
ruff check | ||
@echo "" | ||
|
||
.PHONY: lint-fix | ||
fix: ruff-fix ruff-format-fix | ||
|
||
.PHONY: ruff-fix | ||
ruff-fix: | ||
ruff check --fix | ||
@echo "" | ||
|
||
.PHONY: ruff-format-fix | ||
ruff-format-fix: | ||
ruff format | ||
@echo "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import signal as signals | ||
import sys | ||
import threading | ||
from argparse import Namespace | ||
from typing import Any | ||
|
||
from lib import arguments | ||
from lib.broker import Broker | ||
|
||
# Simple program designed to be used with our cloud demo. | ||
# It is expected that you have followed the steps at | ||
# https://demo.remotivelabs.com and started a broker + uploaded | ||
# a recording. | ||
|
||
# Once you complete the stages in our cloud-demo you will get all | ||
# information required to run this program. It will look something like: | ||
|
||
# python3 cloud_demo.py \ | ||
# --url <broker_url> \ | ||
# --api-key <api_key> \ | ||
# --signals VehicleSpeed,ChassisAcceleratorPedalposition | ||
|
||
expected_available_signals = [ | ||
"VehicleSpeed", | ||
"ChassisSteeringwheelAngle", | ||
"ChassisAcceleratorPedalposition", | ||
"VehicleCurrentlocationLongitude", | ||
"VehicleCurrentlocationLatitude", | ||
] | ||
|
||
|
||
def print_signals(frame: Any) -> None: | ||
for s in frame: | ||
print(s) | ||
|
||
|
||
def main(argv: Namespace) -> None: | ||
print(f"Connecting to {argv.url}") | ||
|
||
broker = Broker(argv.url, argv.api_key, argv.access_token) | ||
|
||
print("Listing available signals") | ||
available_signals = broker.list_signal_names() | ||
for signal in available_signals: | ||
print(f" - {signal}") | ||
|
||
# Sanity check so we are running against the expected recording | ||
if available_signals != expected_available_signals: | ||
print( | ||
"It does not look like you have started the demo recording in cloud. \n" | ||
"Make sure you play turning-torso-drivecycle.zip on this broker from " | ||
"https://demo.remotivelabs.com/p/demo/brokers" | ||
) | ||
sys.exit(0) | ||
|
||
# Start subscribe to selected signals | ||
subscription = broker.subscribe(signals=argv.signals, on_frame=print_signals, changed_values_only=True) | ||
|
||
# play demo recording | ||
broker.play(namespace="custom_can", path="turning-torso-drivecycle.zip") | ||
|
||
# Wait 20 seconds and then shutdown. | ||
# Remove the lines below to just have it running | ||
sleep(seconds=20) | ||
|
||
print("Cancelling subscription (20 secs or ctr-c, you can change this to just keep it running)") | ||
subscription.cancel() | ||
|
||
|
||
def sleep(seconds: float) -> None: | ||
lock = threading.Event() | ||
signals.signal(signals.SIGINT, lambda signum, frame: lock.set()) | ||
lock.wait(timeout=seconds) | ||
|
||
|
||
if __name__ == "__main__": | ||
args = arguments.parse() | ||
main(args) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should ignore all dot files, lets remove ".*"