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

Add ruff for linting, remove flake8, remove isort #114

Merged
merged 35 commits into from
Jan 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
bd8874c
run ruff and fix errors
gsheni Dec 30, 2022
e71f138
fix lint workflow
gsheni Dec 30, 2022
c3dca06
fix pre-commit order
gsheni Dec 30, 2022
17d2173
fix Makefile order
gsheni Dec 30, 2022
503d072
fix ruff settings
gsheni Dec 30, 2022
b713247
fix ruff settings
gsheni Dec 30, 2022
bb811c5
remove isort, ruff has same function
gsheni Dec 30, 2022
8b79c98
fix imports
gsheni Dec 30, 2022
af8e3f7
fix rules
gsheni Dec 30, 2022
67237b0
fix func
gsheni Dec 30, 2022
6e884f3
consistent line length
gsheni Jan 2, 2023
bb215e4
preview line length changes
gsheni Jan 2, 2023
3e655ad
fix conflict
gsheni Jan 2, 2023
0cdfa6b
Merge branch 'main' into ruff
gsheni Jan 2, 2023
8e3d95f
shortening some lines
gsheni Jan 2, 2023
761e7b4
shortening some lines
gsheni Jan 2, 2023
da5ae91
passes lint
gsheni Jan 2, 2023
06972d5
fix docstrings
gsheni Jan 2, 2023
9cd0267
fix docstrings
gsheni Jan 3, 2023
740be4b
fix long line
gsheni Jan 3, 2023
04f8c82
more docstring fixes
gsheni Jan 3, 2023
b4a18e6
more docstring fixes
gsheni Jan 3, 2023
2c40bfc
more docstring fixes
gsheni Jan 3, 2023
5a63367
more docstring fixes
gsheni Jan 3, 2023
d0a5974
more docstring fixes
gsheni Jan 3, 2023
19ae08a
lint
gsheni Jan 3, 2023
a0686b7
more docstring fixes
gsheni Jan 3, 2023
fd27f2d
lint
gsheni Jan 3, 2023
c742cad
more docstring fixes
gsheni Jan 3, 2023
fcff613
more docstring fixes
gsheni Jan 3, 2023
ef88cda
one last docstring
gsheni Jan 3, 2023
3de8ccc
one last docstring
gsheni Jan 3, 2023
09f14ab
one last docstring, promise
gsheni Jan 3, 2023
f81c193
Merge branch 'main' into ruff
kmax12 Jan 3, 2023
830399c
Update isone.py
kmax12 Jan 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 3 additions & 15 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
name: Lint Check
on:
pull_request:
types: [opened, synchronize]
push:
branches:
- main

on: [pull_request]
jobs:
lint_test:
lint_check:
name: 3.11 lint check
runs-on: ubuntu-latest
steps:
Expand All @@ -19,11 +13,5 @@ jobs:
- name: Install package with dev deps
run: |
python -m pip install -e ".[dev]"
- name: Run lint test
- name: Run lint check
run: make lint
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
15 changes: 11 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/MarcoGorelli/absolufy-imports
Expand All @@ -16,14 +17,20 @@ repos:
hooks:
- id: add-trailing-comma
name: Add trailing comma
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.10.1
hooks:
- id: isort
- id: validate-pyproject
- repo: https://github.com/python/black
rev: 22.12.0
hooks:
- id: black
args: [--target-version=py311]
args:
- --target-version=py311
- --line-length=88
additional_dependencies: [".[jupyter]"]
types_or: [python, jupyter]
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.202
hooks:
- id: ruff
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ installdeps-docs:

.PHONY: lint
lint:
isort --check-only gridstatus/
black gridstatus/ -t py311 --check
ruff gridstatus/
black gridstatus/ --check

.PHONY: lint-fix
lint-fix:
black gridstatus/ -t py311
isort gridstatus/
ruff gridstatus/ --fix
black gridstatus/

.PHONY: upgradepip
upgradepip:
Expand Down
33 changes: 6 additions & 27 deletions docs/Examples/spp/LMP Data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,7 @@
}
],
"source": [
"df = iso.get_lmp(\n",
" date=\"latest\",\n",
" market=\"REAL_TIME_5_MIN\"\n",
")\n",
"df = iso.get_lmp(date=\"latest\", market=\"REAL_TIME_5_MIN\")\n",
"df"
]
},
Expand Down Expand Up @@ -333,9 +330,7 @@
],
"source": [
"df = iso.get_lmp(\n",
" date=\"latest\",\n",
" market=\"REAL_TIME_5_MIN\",\n",
" location_type=\"SETTLEMENT_LOCATION\"\n",
" date=\"latest\", market=\"REAL_TIME_5_MIN\", location_type=\"SETTLEMENT_LOCATION\"\n",
")\n",
"df.head(5)"
]
Expand Down Expand Up @@ -500,11 +495,7 @@
}
],
"source": [
"df = iso.get_lmp(\n",
" date=\"latest\",\n",
" market=\"REAL_TIME_5_MIN\",\n",
" location_type=\"Interface\"\n",
")\n",
"df = iso.get_lmp(date=\"latest\", market=\"REAL_TIME_5_MIN\", location_type=\"Interface\")\n",
"df.head(5)"
]
},
Expand Down Expand Up @@ -637,11 +628,7 @@
}
],
"source": [
"df = iso.get_lmp(\n",
" date=\"today\",\n",
" market=\"REAL_TIME_5_MIN\",\n",
" location_type=\"Interface\"\n",
")\n",
"df = iso.get_lmp(date=\"today\", market=\"REAL_TIME_5_MIN\", location_type=\"Interface\")\n",
"df.head(5)"
]
},
Expand Down Expand Up @@ -776,11 +763,7 @@
}
],
"source": [
"df = iso.get_lmp(\n",
" date=\"today\",\n",
" market=\"DAY_AHEAD_HOURLY\",\n",
" location_type=\"Hub\"\n",
")\n",
"df = iso.get_lmp(date=\"today\", market=\"DAY_AHEAD_HOURLY\", location_type=\"Hub\")\n",
"df.head(5)"
]
},
Expand Down Expand Up @@ -915,11 +898,7 @@
}
],
"source": [
"df = iso.get_lmp(\n",
" date=\"today\",\n",
" market=\"DAY_AHEAD_HOURLY\",\n",
" location_type=\"Interface\"\n",
")\n",
"df = iso.get_lmp(date=\"today\", market=\"DAY_AHEAD_HOURLY\", location_type=\"Interface\")\n",
"df.head(5)"
]
}
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"sphinx-favicon",
"sphinx.ext.inheritance_diagram",
"sphinxext.opengraph",
"sphinx.ext.napoleon",
]

templates_path = ["_templates"]
Expand Down
1 change: 0 additions & 1 deletion docs/update_docs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import gridstatus
from gridstatus.utils import make_availability_table, make_lmp_availability_table


Expand Down
15 changes: 0 additions & 15 deletions gridstatus/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,6 @@ def get_status(self, date, end=None, verbose=False):
raise NotImplementedError()

def get_fuel_mix(self, date, end=None, verbose=False):
"""Get fuel mix in 5 minute intervals for a provided day
Arguments:
date (datetime or str): "latest", "today", or an object that can be parsed as a datetime for the day to return data.
start (datetime or str): start of date range to return. alias for `date` parameter. Only specify one of `date` or `start`.
end (datetime or str): "today" or an object that can be parsed as a datetime for the day to return data. Only used if requesting a range of dates.
verbose (bool): print verbose output. Defaults to False.
Returns:
pd.Dataframe: dataframe with columns: Time and columns for each fuel type
"""
raise NotImplementedError()

def get_load(self, date, end=None, verbose=False):
Expand Down