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

build: Update dependencies to temporarily use the GitHub repo for tm_data_types #2

Merged
merged 5 commits into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check-api-for-breaking-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ jobs:
check-api-for-breaking-changes:
uses: tektronix/python-package-ci-cd/.github/workflows/[email protected]
with:
package-name: TekHSI
package-name: tekhsi # griffe requires the package name in lowercase
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ _readthedocs/
# Distribution / packaging
.Python build/
develop-eggs/
dist/
dist*/
downloads/
eggs/
.eggs/
Expand Down
4 changes: 2 additions & 2 deletions docs/_static/css/theme_overrides.css
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ span.doc-object-name {
}

/* Customize link color */
a.autorefs, a.autorefs code {
a.autorefs, a.autorefs code, .rst-content .admonition a.autorefs code {
color: dodgerblue !important;
}

a.autorefs:hover, a.autorefs:hover code {
a.autorefs:hover, a.autorefs:hover code, .rst-content .admonition a.autorefs:hover code {
color: #d600d6 !important;
}

Expand Down
22 changes: 11 additions & 11 deletions docs/_static/js/copybutton.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ const clearSelection = () => {
// Changes tooltip text for a moment, then changes it back
// We want the timeout of our `success` class to be a bit shorter than the
// tooltip and icon change, so that we can hide the icon before changing back.
var timeoutIcon = 2000;
var timeoutSuccessClass = 1500;
const timeoutIcon = 2000;
const timeoutSuccessClass = 1500;

const temporarilyChangeTooltip = (el, oldText, newText) => {
el.setAttribute('data-tooltip', newText)
Expand Down Expand Up @@ -159,12 +159,12 @@ function filterText(target, exclude) {
// Callback when a copy button is clicked. Will be passed the node that was clicked
// should then grab the text and replace pieces of text that shouldn't be used in output
function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, onlyCopyPromptLines = true, removePrompts = true, copyEmptyLines = true, lineContinuationChar = "", hereDocDelim = "") {
var regexp;
var match;
let regexp;
let match;

// Do we check for line continuation characters and "HERE-documents"?
var useLineCont = !!lineContinuationChar
var useHereDoc = !!hereDocDelim
let useLineCont = !!lineContinuationChar
let useHereDoc = !!hereDocDelim

// create regexp to capture prompt and remaining line
if (isRegexp) {
Expand All @@ -174,9 +174,9 @@ function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, onl
}

const outputLines = [];
var promptFound = false;
var gotLineCont = false;
var gotHereDoc = false;
let promptFound = false;
let gotLineCont = false;
let gotHereDoc = false;
const lineGotPrompt = [];
for (const line of textContent.split('\n')) {
match = line.match(regexp)
Expand Down Expand Up @@ -211,8 +211,8 @@ function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, onl
}


var copyTargetText = (trigger) => {
var target = document.querySelector(trigger.attributes['data-clipboard-target'].value);
const copyTargetText = (trigger) => {
let target = document.querySelector(trigger.attributes['data-clipboard-target'].value);

// get filtered text
let exclude = '.linenos'; // Can use ".linenos, .gp, .go" to exclude prompt characters and output in code blocks
Expand Down
4 changes: 2 additions & 2 deletions docs/_static/js/insert-hr.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
document.addEventListener('DOMContentLoaded', function () {
// Selects all h2 elements within divs that have both the "doc" and "doc-children" classes
var headings = document.querySelectorAll('.doc.doc-children h2');
let headings = document.querySelectorAll('.doc.doc-children h2');

headings.forEach(function(heading) {
var hr = document.createElement('hr'); // Creates a new <hr> element
let hr = document.createElement('hr'); // Creates a new <hr> element
// Inserts the <hr> element before the current h2 element
heading.parentNode.insertBefore(hr, heading);
});
Expand Down
2 changes: 1 addition & 1 deletion docs/generate_api_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def sort_paths(path_object: Path) -> Tuple[int, str]:
parts = parts[:-1]
doc_path = doc_path.with_name("index.md")
full_doc_path = full_doc_path.with_name("index.md")
elif parts[-1] == "__main__":
elif parts[-1] == "__main__" or parts[-1].startswith("_"):
continue

nav[parts] = doc_path.as_posix()
Expand Down
3 changes: 2 additions & 1 deletion examples/custom_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

from tekhsi import TekHSIConnect, WaveformHeader
from tm_data_types import AnalogWaveform, write_file
from typing import Dict, List

addr = "192.168.0.1" # Replace with the IP address of your instrument


def custom_filter(prevheader: dict[WaveformHeader], currentheader: list[WaveformHeader]):
def custom_filter(prevheader: Dict[WaveformHeader], currentheader: List[WaveformHeader]):
"""A custom criterion for deciding when to consider an acquisition for acceptance."""
for key, cur in currentheader.items():
if key not in prevheader:
Expand Down
4 changes: 2 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ site_name: TekHSI
repo_url: https://github.com/tektronix/TekHSI
edit_uri: ''
site_author: Tektronix
# site_description: # TODO: fill in
site_description: Transfer waveforms from Tektronix Oscilloscopes using the High-Speed
Serial Interface
copyright: © Copyright 2022, Tektronix
strict: true
site_url: !ENV [READTHEDOCS_CANONICAL_URL, null]
use_directory_urls: true
exclude_docs: |
_*
*.py
*.txt
_templates/
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ scipy = [
{python = "^3.8, <3.12", version = "^1.10"}
]
six = "^1.16.0"
tm_data_types = "^0.1.0"
tm_data_types = {develop = true, git = "https://github.com/tektronix/tm_data_types.git"}
typing_extensions = "^4.12.0"

[tool.poetry.group.dev.dependencies]
Expand Down Expand Up @@ -323,7 +323,7 @@ spaces_before_inline_comment = 2
overrides."tool.poetry.*".inline_arrays = false
overrides."tool.pylint.*".table_keys = false

# Tox configuration
# TODO: enable --doctest-modules line
[tool.tox]
legacy_tox_ini = """
[tox]
Expand Down Expand Up @@ -358,7 +358,7 @@ commands =
!tests: poetry build --output=dist_{envname}
!tests: twine check --strict dist_{envname}/*
!tests: pre-commit run --all-files
!tests: pytest -vv --doctest-modules --doctest-report=ndiff --showlocals --junitxml={tox_root}/.results_{envname}/results_doctests.xml --self-contained-html --html={tox_root}/.results_{envname}/results_doctests.html src
# !tests: pytest -vv --doctest-modules --doctest-report=ndiff --showlocals --junitxml={tox_root}/.results_{envname}/results_doctests.xml --self-contained-html --html={tox_root}/.results_{envname}/results_doctests.html src
pytest -vv -k "not test_docs" --showlocals --cov --junitxml={tox_root}/.results_{envname}/results.xml --cov-report=term --cov-report=xml:{tox_root}/.coverage_{envname}.xml --cov-report=html:{tox_root}/.results_{envname}/html --self-contained-html --html={tox_root}/.results_{envname}/results.html

[testenv:tests]
Expand Down
18 changes: 9 additions & 9 deletions src/tekhsi/tek_hsi_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from enum import Enum
from contextlib import contextmanager

from typing import List, Optional
from typing import List, Optional, Dict

import grpc
import numpy as np
Expand Down Expand Up @@ -149,11 +149,11 @@
# Properties - Private and Public
################################################################################################
@property
def available_symbols(self) -> list[str]:
def available_symbols(self) -> List[str]:
"""Returns the list of available symbols on the instrument.

Returns:
list[str]: List of available symbols.
List[str]: List of available symbols.
"""
return self._available_symbols()

Expand Down Expand Up @@ -185,11 +185,11 @@
self._instrument = value

@property
def source_names(self) -> list[str]:
def source_names(self) -> List[str]:
"""Returns the list of names of sources on the instrument.

Returns:
list[str]: list of sources
List[str]: list of sources
"""
return self.activesymbols

Expand Down Expand Up @@ -248,7 +248,7 @@

@staticmethod
def any_horizontal_change(
prevheader: dict[str, WaveformHeader], currentheader: dict[str, WaveformHeader]
prevheader: Dict[str, WaveformHeader], currentheader: Dict[str, WaveformHeader]
) -> bool:
"""Prebuilt acq acceptance filter that accepts only acqs with changes to horizontal settings.

Expand All @@ -275,7 +275,7 @@

@staticmethod
def any_vertical_change(
prevheader: dict[str, WaveformHeader], currentheader: dict[str, WaveformHeader]
prevheader: Dict[str, WaveformHeader], currentheader: Dict[str, WaveformHeader]
) -> bool:
"""Prebuilt acq acceptance filter that accepts only acqs with changes to vertical settings.

Expand All @@ -299,11 +299,11 @@
return True
return False

def active_symbols(self, symbols: list[str]) -> None:
def active_symbols(self, symbols: List[str]) -> None:
"""Sets symbols to consider moving from instrument into data cache.

Args:
symbols (list[str]): list of symbols to be moved
symbols (List[str]): list of symbols to be moved
"""
self.activesymbols = symbols

Expand Down Expand Up @@ -721,7 +721,7 @@
waveform = self._read_waveform(header)
self._recordlength = waveform.record_length
datasize += waveform.record_length * header.sourcewidth
# TODO: reuse this variable later

Check notice on line 724 in src/tekhsi/tek_hsi_connect.py

View check run for this annotation

codefactor.io / CodeFactor

src/tekhsi/tek_hsi_connect.py#L724

Unresolved comment '# TODO: reuse this variable later'. (C100)
_ = (
waveform.record_length
* header.sourcewidth
Expand Down
Empty file removed tests/__init__.py
Empty file.
4 changes: 2 additions & 2 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from tekhsi.helpers import print_with_timestamp
from tekhsi.tek_hsi_connect import TekHSIConnect, AcqWaitOn
from tekhsi._tek_highspeed_server_pb2 import ConnectRequest, ConnectStatus, WaveformHeader # pylint: disable=no-name-in-module
from tests.conftest import DerivedWaveform, DerivedWaveformHandler
from conftest import DerivedWaveform, DerivedWaveformHandler
Fixed Show fixed Hide fixed


@pytest.mark.parametrize(
Expand Down Expand Up @@ -996,7 +996,7 @@ def test_read_waveforms(tekhsi_client, headers, expected_datasize):
assert len(waveforms) == len(headers)


def test_data_arrival(derived_waveform_handler):
def test_data_arrival(derived_waveform_handler: DerivedWaveformHandler):
"""Test the data_arrival method of DerivedWaveformHandler.

Args:
Expand Down
Loading