Skip to content
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

feat: flake8 Job #13

Merged
merged 6 commits into from
Dec 7, 2023
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
23 changes: 23 additions & 0 deletions .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Pylint

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
- name: Analysing the code with flake8
run: |
flake8 $(git ls-files 'src/**.py')
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def get_demonstrations(self, env):
env_high = env.observation_space.high
env_distance = (env_high - env_low) / self.one_feature

raw_demo = np.load(file="../expert_demo/expert_demo.npy")
raw_demo = np.load(file="../src/irlwpython/expert_demo/expert_demo.npy")
demonstrations = np.zeros((len(raw_demo), len(raw_demo[0]), 3))
for x in range(len(raw_demo)):
for y in range(len(raw_demo[0])):
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ formats = bdist_wheel

[flake8]
# Some sane defaults for the code style checker flake8
max_line_length = 88
max_line_length = 120
extend_ignore = E203, W503
# ^ Black-compatible
# E203 and W503 have edge cases handled by black
Expand Down
4 changes: 2 additions & 2 deletions src/irlwpython/MaxEntropyIRL.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#

import numpy as np
import matplotlib.pyplot as plt

from irlwpython.FigurePrinter import FigurePrinter

Expand Down Expand Up @@ -135,7 +134,8 @@ def train(self, theta_learning_rate, episode_count=30000):
score_avg = np.mean(scores)
print('{} episode score is {:.2f}'.format(episode, score_avg))
self.printer.save_plot_as_png(episodes, scores,
f"src/irlwpython/learning_curves/maxent_{episode_count}_{episode}_qtable.png")
f"src/irlwpython/learning_curves/"
f"maxent_{episode_count}_{episode}_qtable.png")
self.printer.save_heatmap_as_png(learner.reshape((20, 20)),
f"src/irlwpython/heatmap/learner_{episode}_flat.png")
self.printer.save_heatmap_as_png(self.theta.reshape((20, 20)),
Expand Down
3 changes: 2 additions & 1 deletion src/irlwpython/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def parse_args(args):
version=f"IRLwPython {__version__}",
)
parser.add_argument('algorithm', metavar='ALGORITHM', type=str,
help='Currently supported training algorithm: [max-entropy, max-entropy-deep, max-entropy-deep-rl]')
help='Currently supported training algorithm: '
'[max-entropy, max-entropy-deep, max-entropy-deep-rl]')
parser.add_argument('--training', action='store_true', help="Enables training of model.")
parser.add_argument('--testing', action='store_true',
help="Enables testing of previously created model.")
Expand Down