Skip to content

Commit

Permalink
Dev (#21)
Browse files Browse the repository at this point in the history
* Fixed issue where the layers writer does not have a new line input.

* Fixed issue where there were no newlines between multiple layers

* * Added the pytest plugin for poetry run
* Updated the create valve code to use the mintdevice method instead of using parchmint api
* Autoformatted `mintcompler.py` code

* style: format code with Black and isort

This commit fixes the style issues introduced in 27ec437 according to the output
from Black and isort.

Details: #21

* Updated the test CI

* Updated actions to include graphviz install

* Added sudo for it to install

---------

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
  • Loading branch information
rkrishnasanka and deepsource-autofix[bot] authored Oct 23, 2023
1 parent b2c13b9 commit e4ef183
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 19 deletions.
29 changes: 17 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,28 @@ jobs:
use-isort: true

test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: [3.8]
poetry-version: [1.3.1]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install graphviz deps
run: sudo apt-get install -y graphviz-dev
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Poetry
uses: snok/install-poetry@v1
python-version: ${{ matrix.python-version }}
- name: Run image
uses: abatilo/actions-poetry@v2.0.0
with:
version: 1.1.1
virtualenvs-create: false
- name: Install Dependencies
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
run: poetry install
- name: Running pytest
run: poetry run pytest
- name: Run tests
run: poetry run pytest

docs:
needs: [test]
Expand Down
18 changes: 11 additions & 7 deletions pymint/mintcompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Dict, Optional

from parchmint import Layer, Target
from parchmint.device import ValveType

from pymint.antlrgen.mintListener import mintListener
from pymint.antlrgen.mintParser import mintParser
Expand Down Expand Up @@ -384,12 +385,8 @@ def exitValveStat(self, ctx: mintParser.ValveStatContext):
valve_name = ctx.ufname()[0].getText() # type: ignore
if not (self._current_layer is not None and self._current_layer.ID is not None):
raise AssertionError
valve_component = self.current_device.create_mint_component(
valve_name,
entity,
self.current_params,
[self._current_layer.ID],
)

# Get the connection information
connection_name = ctx.ufname()[1].getText() # type: ignore
valve_connection = self.current_device.device.get_connection(connection_name)
if valve_connection is None:
Expand All @@ -399,7 +396,14 @@ def exitValveStat(self, ctx: mintParser.ValveStatContext):
)
)

self.current_device.device.map_valve(valve_component, valve_connection)
self.current_device.create_valve(
name=valve_name,
technology=entity,
params=self.current_params,
layer_ids=[self._current_layer.ID],
connection=valve_connection,
valve_type=ValveType.NORMALLY_OPEN,
)

def enterViaStat(self, ctx: mintParser.ViaStatContext):
if self.current_device is None:
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ docs = ["sphinx"]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.pytest.ini_options]
minversion = "6.0"
testpaths = [
"./tests/"
]

0 comments on commit e4ef183

Please sign in to comment.