Skip to content

Commit

Permalink
Add ruff for linting, remove flake8, remove isort (#114)
Browse files Browse the repository at this point in the history
* run ruff and fix errors

* fix lint workflow

* fix pre-commit order

* fix Makefile order

* fix ruff settings

* fix ruff settings

* remove isort, ruff has same function

* fix imports

* fix rules

* fix func

* consistent line length

* preview line length changes

* fix conflict

* shortening some lines

* shortening some lines

* passes lint

* fix docstrings

* fix docstrings

* fix long line

* more docstring fixes

* more docstring fixes

* more docstring fixes

* more docstring fixes

* more docstring fixes

* lint

* more docstring fixes

* lint

* more docstring fixes

* more docstring fixes

* one last docstring

* one last docstring

* one last docstring, promise

* Update isone.py

Co-authored-by: Max Kanter <kmax12@gmail.com>
  • Loading branch information
gsheni and kmax12 committed Jan 3, 2023
1 parent dd77f70 commit 8b66f04
Show file tree
Hide file tree
Showing 25 changed files with 392 additions and 299 deletions.
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

0 comments on commit 8b66f04

Please sign in to comment.