Skip to content

Commit

Permalink
Merge main.
Browse files Browse the repository at this point in the history
  • Loading branch information
nealkruis committed Dec 14, 2023
2 parents 3dea054 + f0de48f commit f586b06
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 26 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
path:
- 'atheneum' #'${{github.workspace}}'
- 'test/*.py'
defaults:
run:
shell: bash
Expand All @@ -20,16 +17,22 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set Project Name
run: echo "REPOSITORY_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
- name: Setup Python ${{ matrix.python-version }}
uses: bigladder/github-actions/setup-python-poetry@main
with:
python-version: ${{ matrix.python-version }}
- name: Lint with Pylint
run: |
poetry run pylint ${{ matrix.path }}
# - name: Static type checking
# run: |
# poetry run mypy ${{ matrix.path }}
poetry run pylint ${{env.REPOSITORY_NAME}}
poetry run pylint test/*.py
continue-on-error: true
- name: Static type checking
run: |
poetry run mypy ${{env.REPOSITORY_NAME}}
poetry run mypy test/*.py
continue-on-error: true
- name: Test
run: |
source $VENV
Expand Down
4 changes: 2 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -581,5 +581,5 @@ min-public-methods=2

# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception
overgeneral-exceptions=builtins.BaseException,
builtins.Exception
1 change: 1 addition & 0 deletions dimes/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
"""dimes public interface"""
from .dimes import TimeSeriesPlot, TimeSeriesData
23 changes: 12 additions & 11 deletions dimes/dimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ class TimeSeriesData:
def __init__(
self,
data_values: list,
name: str | None = None,
name: Union[str, None] = None,
native_units: str = "",
display_units: str | None = None,
color: str | None = None,
line_type: str | None = None,
display_units: Union[str, None] = None,
color: Union[str, None] = None,
line_type: Union[str, None] = None,
is_visible: bool = True,
):
self.data_values = data_values
Expand Down Expand Up @@ -83,7 +83,9 @@ def __init__(self, time_values: list):
self.subplots: List[Union[TimeSeriesSubplot, None]] = [None]
self.is_finalized = False

def add_time_series(self, time_series: TimeSeriesData, subplot_number: int | None = None):
def add_time_series(
self, time_series: TimeSeriesData, subplot_number: Union[int, None] = None
) -> None:
"""Add a TimeSeriesData object to the plot."""
if subplot_number is None:
# Default case
Expand Down Expand Up @@ -118,23 +120,22 @@ def finalize_plot(self):
name=time_series.name,
mode="lines",
visible="legendonly" if not time_series.is_visible else True,
line=dict(
color=time_series.color,
dash=time_series.line_type,
),
line={
"color": time_series.color,
"dash": time_series.line_type,
},
),
row=None if number_of_subplots == 1 else subplot_number,
col=None if number_of_subplots == 1 else 1,
)
else:
warnings.warn(f"Subplot {subplot_number} is unused.")

if not at_least_one_subplot:
raise Exception("No time series data provided.")

self.is_finalized = True

def write_html_plot(self, path: Path):
def write_html_plot(self, path: Path) -> None:
"Write plots to html file at specified path."
self.finalize_plot()
self.fig.write_html(path)
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ koozie = "^1.2.0"
[tool.poetry.dev-dependencies]
pytest = "^7.1.3"
pylint = "*"
autopep8 = "*"
black = "*"
mypy = "*"

Expand All @@ -27,10 +26,11 @@ build-backend = "poetry.core.masonry.api"
[tool.black]
line-length = 100

[tool.autopep8]
max_line_length = 100
in-place = true
recursive = true
[tool.mypy]
disallow_incomplete_defs = true
no_implicit_optional = true
check_untyped_defs = true

[[tool.mypy.overrides]]
disable_error_code = ["annotation-unchecked","import"]
module = "dimes.*"
disable_error_code = ["import"]

0 comments on commit f586b06

Please sign in to comment.