Skip to content

Commit

Permalink
Merge pull request #711 from pyvisa/typing-fixes
Browse files Browse the repository at this point in the history
Typing and cis fixes
  • Loading branch information
MatthieuDartiailh committed Dec 9, 2022
2 parents eb3fae3 + bdcfa5d commit 3ed2b25
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
pip install pytest-cov
python -X dev -m pytest --pyargs pyvisa --cov pyvisa --cov-report xml -v
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ repos:
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 22.10.0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.950 # Use the sha / tag you want to point at
rev: v0.991 # Use the sha / tag you want to point at
hooks:
- id: mypy
additional_dependencies: [numpy, typing_extensions]
8 changes: 5 additions & 3 deletions pyvisa/rname.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(self, msg: str) -> None:

@classmethod
def bad_syntax(
cls, syntax: str, resource_name: str, ex: Exception = None
cls, syntax: str, resource_name: str, ex: Optional[Exception] = None
) -> "InvalidResourceName":
"""Build an exception when the resource name cannot be parsed."""
if ex:
Expand All @@ -64,7 +64,9 @@ def bad_syntax(

@classmethod
def subclass_notfound(
cls, interface_type_resource_class: Tuple[str, str], resource_name: str = None
cls,
interface_type_resource_class: Tuple[str, str],
resource_name: Optional[str] = None,
) -> "InvalidResourceName":
"""Build an exception when no parser has been registered for a pair."""

Expand All @@ -77,7 +79,7 @@ def subclass_notfound(

@classmethod
def rc_notfound(
cls, interface_type: str, resource_name: str = None
cls, interface_type: str, resource_name: Optional[str] = None
) -> "InvalidResourceName":
"""Build an exception when no resource class is provided and no default is found."""

Expand Down
2 changes: 1 addition & 1 deletion pyvisa/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def parse_ieee_block_header(
def parse_hp_block_header(
block: Union[bytes, bytearray],
is_big_endian: bool,
length_before_block: int = None,
length_before_block: Optional[int] = None,
raise_on_late_block: bool = False,
) -> Tuple[int, int]:
"""Parse the header of a HP block.
Expand Down

0 comments on commit 3ed2b25

Please sign in to comment.