Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
9 changes: 9 additions & 0 deletions src/server_common/schema/blocks.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
<xs:element ref="blk:log_deadband" minOccurs="0"/>
<xs:element ref="blk:set_block" minOccurs="0"/>
<xs:element ref="blk:set_block_val" minOccurs="0"/>
<xs:element ref="blk:alarm_enabled" minOccurs="0"/>
<xs:element ref="blk:alarm_latched" minOccurs="0"/>
<xs:element ref="blk:alarm_delay" minOccurs="0"/>
<xs:element ref="blk:alarm_guidance" minOccurs="0"/>

</xs:sequence>
</xs:complexType>
</xs:element>
Expand All @@ -42,4 +47,8 @@
<xs:element name="log_deadband" type="xs:double"/>
<xs:element name="set_block" type="xs:string"/>
<xs:element name="set_block_val" type="xs:string"/>
<xs:element name="alarm_enabled" type="xs:string"/>
<xs:element name="alarm_latched" type="xs:string"/>
<xs:element name="alarm_delay" type="xs:double"/>
<xs:element name="alarm_guidance" type="xs:string"/>
</xs:schema>
11 changes: 11 additions & 0 deletions src/server_common/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
MAJOR = "MAJOR"


def char_waveform(length):

Check failure on line 47 in src/server_common/utilities.py

View workflow job for this annotation

GitHub Actions / call-linter-workflow / ruff

Ruff (ANN001)

src\server_common\utilities.py:47:19: ANN001 Missing type annotation for function argument `length`

Check failure on line 47 in src/server_common/utilities.py

View workflow job for this annotation

GitHub Actions / call-linter-workflow / ruff

Ruff (ANN201)

src\server_common\utilities.py:47:5: ANN201 Missing return type annotation for public function `char_waveform`

Check failure on line 47 in src/server_common/utilities.py

View workflow job for this annotation

GitHub Actions / call-linter-workflow / ruff

Ruff (ANN001)

src\server_common\utilities.py:47:19: ANN001 Missing type annotation for function argument `length`

Check failure on line 47 in src/server_common/utilities.py

View workflow job for this annotation

GitHub Actions / call-linter-workflow / ruff

Ruff (ANN201)

src\server_common\utilities.py:47:5: ANN201 Missing return type annotation for public function `char_waveform`
"""
Helper function for creating a char waveform PV.

Expand All @@ -57,7 +57,7 @@
return {"type": "char", "count": length, "value": [0]}


def set_logger(logger):

Check failure on line 60 in src/server_common/utilities.py

View workflow job for this annotation

GitHub Actions / call-linter-workflow / ruff

Ruff (ANN001)

src\server_common\utilities.py:60:16: ANN001 Missing type annotation for function argument `logger`

Check failure on line 60 in src/server_common/utilities.py

View workflow job for this annotation

GitHub Actions / call-linter-workflow / ruff

Ruff (ANN201)

src\server_common\utilities.py:60:5: ANN201 Missing return type annotation for public function `set_logger`

Check failure on line 60 in src/server_common/utilities.py

View workflow job for this annotation

GitHub Actions / call-linter-workflow / ruff

Ruff (ANN001)

src\server_common\utilities.py:60:16: ANN001 Missing type annotation for function argument `logger`

Check failure on line 60 in src/server_common/utilities.py

View workflow job for this annotation

GitHub Actions / call-linter-workflow / ruff

Ruff (ANN201)

src\server_common\utilities.py:60:5: ANN201 Missing return type annotation for public function `set_logger`
"""Sets the logger used by the print_and_log function.

Args:
Expand All @@ -67,12 +67,12 @@
LOGGER = logger


def print_and_log(message, severity=SEVERITY.INFO, src="BLOCKSVR"):

Check failure on line 70 in src/server_common/utilities.py

View workflow job for this annotation

GitHub Actions / call-linter-workflow / ruff

Ruff (ANN001)

src\server_common\utilities.py:70:52: ANN001 Missing type annotation for function argument `src`

Check failure on line 70 in src/server_common/utilities.py

View workflow job for this annotation

GitHub Actions / call-linter-workflow / ruff

Ruff (ANN001)

src\server_common\utilities.py:70:28: ANN001 Missing type annotation for function argument `severity`

Check failure on line 70 in src/server_common/utilities.py

View workflow job for this annotation

GitHub Actions / call-linter-workflow / ruff

Ruff (ANN001)

src\server_common\utilities.py:70:19: ANN001 Missing type annotation for function argument `message`

Check failure on line 70 in src/server_common/utilities.py

View workflow job for this annotation

GitHub Actions / call-linter-workflow / ruff

Ruff (ANN201)

src\server_common\utilities.py:70:5: ANN201 Missing return type annotation for public function `print_and_log`

Check failure on line 70 in src/server_common/utilities.py

View workflow job for this annotation

GitHub Actions / call-linter-workflow / ruff

Ruff (ANN001)

src\server_common\utilities.py:70:52: ANN001 Missing type annotation for function argument `src`

Check failure on line 70 in src/server_common/utilities.py

View workflow job for this annotation

GitHub Actions / call-linter-workflow / ruff

Ruff (ANN001)

src\server_common\utilities.py:70:28: ANN001 Missing type annotation for function argument `severity`

Check failure on line 70 in src/server_common/utilities.py

View workflow job for this annotation

GitHub Actions / call-linter-workflow / ruff

Ruff (ANN001)

src\server_common\utilities.py:70:19: ANN001 Missing type annotation for function argument `message`

Check failure on line 70 in src/server_common/utilities.py

View workflow job for this annotation

GitHub Actions / call-linter-workflow / ruff

Ruff (ANN201)

src\server_common\utilities.py:70:5: ANN201 Missing return type annotation for public function `print_and_log`
"""Prints the specified message to the console and writes it to the log.

Args:
message (string|exception): The message to log
severity (string, optional): Gives the severity of the message. Expected serverities are MAJOR, MINOR and INFO.

Check failure on line 75 in src/server_common/utilities.py

View workflow job for this annotation

GitHub Actions / call-linter-workflow / ruff

Ruff (E501)

src\server_common\utilities.py:75:101: E501 Line too long (119 > 100)

Check failure on line 75 in src/server_common/utilities.py

View workflow job for this annotation

GitHub Actions / call-linter-workflow / ruff

Ruff (E501)

src\server_common\utilities.py:75:101: E501 Line too long (119 > 100)
Default severity is INFO.
src (string, optional): Gives the source of the message. Default source is BLOCKSVR.
"""
Expand All @@ -82,7 +82,7 @@
LOGGER.write_to_log(message, severity, src)


def compress_and_hex(value):

Check failure on line 85 in src/server_common/utilities.py

View workflow job for this annotation

GitHub Actions / call-linter-workflow / ruff

Ruff (ANN201)

src\server_common\utilities.py:85:5: ANN201 Missing return type annotation for public function `compress_and_hex`

Check failure on line 85 in src/server_common/utilities.py

View workflow job for this annotation

GitHub Actions / call-linter-workflow / ruff

Ruff (ANN201)

src\server_common\utilities.py:85:5: ANN201 Missing return type annotation for public function `compress_and_hex`
"""Compresses the inputted string and encodes it as hex.

Args:
Expand Down Expand Up @@ -371,3 +371,14 @@
except (ValueError, TypeError) as ex:
print(f"Can not interpret date '{date_arg}' error: {ex}")
exit(error_code)

def dehex_and_decompress_waveform_value(value):
"""Decompresses the inputted waveform, assuming it is available as string.

Args:
value (str): The string to be decompressed

Returns:
str : A decompressed and unhexed version of the input string
"""
return zlib.decompress(binascii.unhexlify(value))
Loading