text
stringlengths
9
39.2M
dir
stringlengths
25
226
lang
stringclasses
163 values
created_date
timestamp[s]
updated_date
timestamp[s]
repo_name
stringclasses
751 values
repo_full_name
stringclasses
752 values
star
int64
1.01k
183k
len_tokens
int64
1
18.5M
```yaml description: Property default value test compatible: "defaults" properties: int: type: int required: false default: 123 array: type: array required: false default: [1, 2, 3] uint8-array: type: uint8-array required: false default: [0x89, 0xAB, 0xCD] string: t...
/content/code_sandbox/scripts/dts/python-devicetree/tests/test-bindings/defaults.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
157
```yaml description: Include ordering test compatible: "order-1" include: ["foo-required.yaml", "foo-optional.yaml"] ```
/content/code_sandbox/scripts/dts/python-devicetree/tests/test-bindings/order-1.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
28
```yaml description: GPIO destination for mapping test compatible: "gpio-dst" gpio-cells: - val ```
/content/code_sandbox/scripts/dts/python-devicetree/tests/test-bindings/gpio-dst.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
25
```yaml description: Device on bar bus compatible: "on-bus" on-bus: "bar" ```
/content/code_sandbox/scripts/dts/python-devicetree/tests/test-bindings/device-on-bar-bus.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
23
```yaml description: Interrupt controller with two cells compatible: "interrupt-two-cell" interrupt-cells: - one - two ```
/content/code_sandbox/scripts/dts/python-devicetree/tests/test-bindings/interrupt-2-cell.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
29
```yaml description: Device on foo bus compatible: "on-bus" on-bus: "foo" ```
/content/code_sandbox/scripts/dts/python-devicetree/tests/test-bindings/device-on-foo-bus.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
23
```yaml properties: foo: required: false type: int baz: required: true type: int ```
/content/code_sandbox/scripts/dts/python-devicetree/tests/test-bindings/grandchild-1.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
30
```yaml include: [grandchild-1.yaml, grandchild-2.yaml, grandchild-3.yaml] properties: bar: required: true type: int ```
/content/code_sandbox/scripts/dts/python-devicetree/tests/test-bindings/child.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
38
```yaml properties: foo: type: int required: false ```
/content/code_sandbox/scripts/dts/python-devicetree/tests/test-bindings/foo-optional.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
16
```yaml description: Include ordering test compatible: "order-2" include: ["foo-optional.yaml", "foo-required.yaml"] ```
/content/code_sandbox/scripts/dts/python-devicetree/tests/test-bindings/order-2.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
28
```yaml properties: baz: required: true type: int ```
/content/code_sandbox/scripts/dts/python-devicetree/tests/test-bindings/grandchild-2.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
17
```yaml properties: foo: type: int required: true ```
/content/code_sandbox/scripts/dts/python-devicetree/tests/test-bindings/foo-required.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
16
```yaml # A file that mentions a 'compatible' string without actually implementing it. # Used to check for issues with how we optimize binding loading. # props ```
/content/code_sandbox/scripts/dts/python-devicetree/tests/test-bindings/false-positive.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
32
```yaml description: Device.props test compatible: "props" properties: nonexistent-boolean: type: boolean existent-boolean: type: boolean int: type: int const: 1 array: type: array uint8-array: type: uint8-array string: type: string const: "foo" string-array: t...
/content/code_sandbox/scripts/dts/python-devicetree/tests/test-bindings/props.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
225
```yaml description: Controller with two data values compatible: "phandle-array-controller-2" phandle-array-foo-cells: - one - two ```
/content/code_sandbox/scripts/dts/python-devicetree/tests/test-bindings/phandle-array-controller-2.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
36
```yaml description: Interrupt controller with one cell compatible: "interrupt-one-cell" interrupt-cells: - one ```
/content/code_sandbox/scripts/dts/python-devicetree/tests/test-bindings/interrupt-1-cell.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
25
```yaml description: Binding in test-bindings-2/ compatible: "in-dir-2" ```
/content/code_sandbox/scripts/dts/python-devicetree/tests/test-bindings-2/multidir.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
20
```python __all__ = ['edtlib', 'dtlib'] ```
/content/code_sandbox/scripts/dts/python-devicetree/src/devicetree/__init__.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
15
```yaml description: Property enum test compatible: "enums" properties: int-enum: type: int enum: - 1 - 2 - 3 string-enum: # not tokenizable type: string enum: - foo bar - foo_bar tokenizable-lower-enum: # tokenizable in lowercase only ...
/content/code_sandbox/scripts/dts/python-devicetree/tests/test-bindings/enums.yaml
yaml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
154
```python # Tip: You can view just the documentation with 'pydoc3 devicetree.dtlib' """ A library for extracting information from .dts (devicetree) files. See the documentation for the DT and Node classes for more information. The top-level entry point of the library is the DT class. DT.__init__() takes a .dts file ...
/content/code_sandbox/scripts/dts/python-devicetree/src/devicetree/dtlib.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
17,724
```python # # This implementation is derived from the one in # [PyXB](path_to_url stripped down and modified # specifically to manage edtlib Node instances. import collections class Graph: """ Represent a directed graph with edtlib Node objects as nodes. This is used to determine order dependencies amon...
/content/code_sandbox/scripts/dts/python-devicetree/src/devicetree/grutils.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,316
```python """ Shared internal code. Do not use outside of the package. """ from typing import Any, Callable def _slice_helper(node: Any, # avoids a circular import with dtlib prop_name: str, size: int, size_hint: str, err_class: Callable[..., Exception]): # Splits node.prop...
/content/code_sandbox/scripts/dts/python-devicetree/src/devicetree/_private.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
270
```python # '''Domain handling for west extension commands. This provides parsing of domains yaml file and creation of objects of the Domain class. ''' from dataclasses import dataclass import yaml import pykwalify.core import logging DOMAINS_SCHEMA = ''' ## A pykwalify schema for basic validation of the structure...
/content/code_sandbox/scripts/pylib/build_helpers/domains.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
750
```restructuredtext ============== Pytest Twister harness ============== Installation ------------ If you plan to use this plugin with Twister, then you don't need to install it separately by pip. When Twister uses this plugin for pytest tests, it updates `PYTHONPATH` variable, and then extends pytest command by `-p ...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/README.rst
restructuredtext
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
407
```python # import setuptools setuptools.setup() ```
/content/code_sandbox/scripts/pylib/pytest-twister-harness/setup.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
9
```ini [metadata] name = pytest-twister-harness version = attr: twister_harness.__version__ description = Plugin for pytest to run tests which require interaction with real and simulated devices long_description = file: README.rst python_requires = ~=3.8 classifiers = Development Status :: 3 - Alpha Intended Au...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/setup.cfg
ini
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
219
```toml [build-system] build-backend = "setuptools.build_meta" requires = [ "setuptools >= 48.0.0", "wheel", ] ```
/content/code_sandbox/scripts/pylib/pytest-twister-harness/pyproject.toml
toml
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
34
```python # from __future__ import annotations import os from pathlib import Path from typing import Generator import pytest from twister_harness.device.binary_adapter import NativeSimulatorAdapter from twister_harness.twister_harness_config import DeviceConfig @pytest.fixture def resources() -> Path: """Retu...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/tests/conftest.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
367
```python # import os import textwrap from pathlib import Path import pytest pytest_plugins = ['pytester'] @pytest.mark.parametrize( 'import_path, class_name, device_type', [ ('twister_harness.device.binary_adapter', 'NativeSimulatorAdapter', 'native'), ('twister_harness.device.qemu_adapter...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/tests/plugin_test.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
349
```python # import os import time from pathlib import Path from unittest import mock import pytest from twister_harness.device.hardware_adapter import HardwareAdapter from twister_harness.exceptions import TwisterHarnessException from twister_harness.twister_harness_config import DeviceConfig @pytest.fixture(name=...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/tests/device/hardware_adapter_test.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
2,460
```python # import os from pathlib import Path from typing import Generator from unittest.mock import patch import pytest from twister_harness.device.qemu_adapter import QemuAdapter from twister_harness.exceptions import TwisterHarnessException from twister_harness.twister_harness_config import DeviceConfig @pytes...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/tests/device/qemu_adapter_test.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
488
```python # import logging import os import subprocess import time from pathlib import Path from typing import Generator from unittest import mock import pytest from twister_harness.device.binary_adapter import ( CustomSimulatorAdapter, NativeSimulatorAdapter, UnitSimulatorAdapter, ) from twister_harness...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/tests/device/binary_adapter_test.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,852
```python # from __future__ import annotations zen_of_python: list[str] = """ The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability count...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/tests/resources/zen_of_python.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
204
```python # import logging import os import sys import threading import time from argparse import ArgumentParser from zen_of_python import zen_of_python class FifoFile: def __init__(self, filename, mode): self.filename = filename self.mode = mode self.thread = None self.file = No...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/tests/resources/fifo_mock.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
461
```python # """ Simple shell simulator. """ import sys from zen_of_python import zen_of_python PROMPT = 'uart:~$ ' def main() -> int: print('Start shell simulator', flush=True) print(PROMPT, end='', flush=True) for line in sys.stdin: line = line.strip() print(line, flush=True) i...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/tests/resources/shell_simulator.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
135
```python #!/usr/bin/python # """ Simply mock for bash script to use with unit tests. """ import sys import time from argparse import ArgumentParser from zen_of_python import zen_of_python def main() -> int: parser = ArgumentParser() parser.add_argument('--sleep', action='store', default=0, type=float) ...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/tests/resources/mock_script.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
268
```python # import pytest import textwrap from unittest import mock from twister_harness.helpers.mcumgr import MCUmgr, MCUmgrException @pytest.fixture(name='mcumgr') def fixture_mcumgr() -> MCUmgr: return MCUmgr.create_for_serial('SERIAL_PORT') @mock.patch('twister_harness.helpers.mcumgr.MCUmgr.run_command', ...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/tests/fixtures/mcumgr_fixture_test.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
723
```python # from twister_harness.device.binary_adapter import NativeSimulatorAdapter from twister_harness.helpers.shell import Shell def test_if_shell_helper_properly_send_command(shell_simulator_adapter: NativeSimulatorAdapter) -> None: """Run shell_simulator.py program, send "zen" command via shell helper and ...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/tests/helpers/shell_test.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
116
```python # import textwrap from twister_harness.helpers.shell import ShellMCUbootCommandParsed, ShellMCUbootArea def test_if_mcuboot_command_output_is_parsed_two_areas() -> None: cmd_output = textwrap.dedent(""" \x1b[1;32muart:~$ \x1b[mmcuboot swap type: revert confirmed: 0 prim...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/tests/helpers/shell_mcuboot_command_parser_test.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
521
```python # # flake8: noqa from twister_harness.device.device_adapter import DeviceAdapter from twister_harness.helpers.mcumgr import MCUmgr from twister_harness.helpers.shell import Shell __all__ = ['DeviceAdapter', 'MCUmgr', 'Shell'] __version__ = '0.0.1' ```
/content/code_sandbox/scripts/pylib/pytest-twister-harness/src/twister_harness/__init__.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
71
```python # from __future__ import annotations import logging import os import pytest from twister_harness.twister_harness_config import TwisterHarnessConfig logger = logging.getLogger(__name__) pytest_plugins = ( 'twister_harness.fixtures' ) def pytest_addoption(parser: pytest.Parser): twister_harness_...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/src/twister_harness/plugin.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,197
```python # class TwisterHarnessException(Exception): """General Twister harness exception.""" class TwisterHarnessTimeoutException(TwisterHarnessException): """Twister harness timeout exception""" ```
/content/code_sandbox/scripts/pylib/pytest-twister-harness/src/twister_harness/exceptions.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
39
```python # from __future__ import annotations import logging from dataclasses import dataclass, field from pathlib import Path from twister_harness.helpers.domains_helper import get_default_domain_name import pytest logger = logging.getLogger(__name__) @dataclass class DeviceConfig: type: str build_dir: ...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/src/twister_harness/twister_harness_config.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
646
```python # import logging from pathlib import Path from typing import Generator, Type import pytest import time from twister_harness.device.device_adapter import DeviceAdapter from twister_harness.device.factory import DeviceFactory from twister_harness.twister_harness_config import DeviceConfig, TwisterHarnessConf...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/src/twister_harness/fixtures.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
742
```python # from __future__ import annotations import logging import time from twister_harness.device.fifo_handler import FifoHandler from twister_harness.device.binary_adapter import BinaryAdapterBase from twister_harness.exceptions import TwisterHarnessException from twister_harness.twister_harness_config import D...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/src/twister_harness/device/qemu_adapter.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
502
```python # ```
/content/code_sandbox/scripts/pylib/pytest-twister-harness/src/twister_harness/device/__init__.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
2
```python # from __future__ import annotations import logging import os import platform import shlex import signal import subprocess import time import psutil _WINDOWS = platform.system() == 'Windows' def log_command(logger: logging.Logger, msg: str, args: list, level: int = logging.DEBUG) -> None: """ Pl...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/src/twister_harness/device/utils.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
305
```python # Tip: You can view just the documentation with 'pydoc3 devicetree.edtlib' """ Library for working with devicetrees at a higher level compared to dtlib. Like dtlib, this library presents a tree of devicetree nodes, but the nodes are augmented with information from bindings and include some interpretation of...
/content/code_sandbox/scripts/dts/python-devicetree/src/devicetree/edtlib.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
27,638
```python # from __future__ import annotations import logging import os if os.name != 'nt': import pty import re import subprocess import time from pathlib import Path import serial from twister_harness.device.device_adapter import DeviceAdapter from twister_harness.exceptions import ( TwisterHarnessExceptio...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
2,297
```python # from __future__ import annotations import logging from typing import Type from twister_harness.device.device_adapter import DeviceAdapter from twister_harness.device.hardware_adapter import HardwareAdapter from twister_harness.device.qemu_adapter import QemuAdapter from twister_harness.device.binary_adap...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/src/twister_harness/device/factory.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
323
```python # from __future__ import annotations import abc import logging import subprocess from twister_harness.device.device_adapter import DeviceAdapter from twister_harness.device.utils import log_command, terminate_process from twister_harness.exceptions import TwisterHarnessException from twister_harness.twiste...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/src/twister_harness/device/binary_adapter.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
977
```python # from __future__ import annotations import abc import logging import os import queue import re import shutil import threading import time from datetime import datetime from pathlib import Path from serial import SerialException from twister_harness.exceptions import ( TwisterHarnessException, Twis...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/src/twister_harness/device/device_adapter.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
2,357
```python # from __future__ import annotations import io import logging import os import threading import time from pathlib import Path logger = logging.getLogger(__name__) class FifoHandler: """ Class dedicated for handling communication over POSIX system FIFO (named pipes). """ def __init__(...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/src/twister_harness/device/fifo_handler.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,138
```python # from __future__ import annotations import os import sys import logging from pathlib import Path ZEPHYR_BASE = os.environ['ZEPHYR_BASE'] sys.path.insert(0, os.path.join(ZEPHYR_BASE, 'scripts', 'pylib', 'build_helpers')) from domains import Domains logger = logging.getLogger(__name__) logging.getLogger('...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/src/twister_harness/helpers/domains_helper.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
159
```python # ```
/content/code_sandbox/scripts/pylib/pytest-twister-harness/src/twister_harness/helpers/__init__.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
2
```python # from __future__ import annotations import logging import re import time from dataclasses import dataclass, field from inspect import signature from twister_harness.device.device_adapter import DeviceAdapter from twister_harness.exceptions import TwisterHarnessTimeoutException logger = logging.getLogger...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/src/twister_harness/helpers/shell.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,007
```python # from __future__ import annotations import logging import re import shlex from subprocess import check_output, getstatusoutput from pathlib import Path from dataclasses import dataclass logger = logging.getLogger(__name__) class MCUmgrException(Exception): """General MCUmgr exception.""" @dataclas...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/src/twister_harness/helpers/mcumgr.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
863
```python # from __future__ import annotations import logging import re from pathlib import Path logger = logging.getLogger(__name__) def find_in_config(config_file: Path | str, config_key: str) -> str: """Find key in config file""" re_key = re.compile(rf'{config_key}=(.+)') with open(config_file) as ...
/content/code_sandbox/scripts/pylib/pytest-twister-harness/src/twister_harness/helpers/utils.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
240
```python #! /usr/bin/python # # Zephyr's Twister library # # pylint: disable=unused-import # # Set of code that other projects can also import to do things on # Zephyr's sanity check testcases. import logging import yaml try: # Use the C LibYAML parser if available, rather than the Python parser. # It's much ...
/content/code_sandbox/scripts/pylib/twister/scl.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
674
```python #!/usr/bin/env python3 # # import copy import logging import os import re import sys import threading try: import ply.lex as lex import ply.yacc as yacc except ImportError: sys.exit("PLY library for Python 3 not installed.\n" "Please install the ply package using your workstation's\...
/content/code_sandbox/scripts/pylib/twister/expr_parser.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
2,372
```python # vim: set syntax=python ts=4 : # class TwisterException(Exception): pass class TwisterRuntimeError(TwisterException): pass class ConfigurationError(TwisterException): def __init__(self, cfile, message): TwisterException.__init__(self, str(cfile) + ": " + message) class BuildError(T...
/content/code_sandbox/scripts/pylib/twister/twisterlib/error.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
96
```python # vim: set syntax=python ts=4 : # class DisablePyTestCollectionMixin(object): __test__ = False ```
/content/code_sandbox/scripts/pylib/twister/twisterlib/mixins.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
28
```python #!/usr/bin/env python3 # vim: set syntax=python ts=4 : # import os from multiprocessing import Lock, Value import re import platform import yaml import scl import logging from pathlib import Path from natsort import natsorted from twisterlib.environment import ZEPHYR_BASE try: # Use the C LibYAML pars...
/content/code_sandbox/scripts/pylib/twister/twisterlib/hardwaremap.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
3,076
```python # vim: set syntax=python ts=4 : # import sys import os import logging import pathlib import shutil import subprocess import glob import re import tempfile logger = logging.getLogger('twister') logger.setLevel(logging.DEBUG) supported_coverage_formats = { "gcovr": ["html", "xml", "csv", "txt", "coverall...
/content/code_sandbox/scripts/pylib/twister/twisterlib/coverage.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
3,917
```python #!/usr/bin/env python3 # """ Status classes to be used instead of str statuses. """ from enum import Enum class TwisterStatus(str, Enum): def __str__(self): return str(self.value) # All statuses below this comment can be used for TestCase BLOCK = 'blocked' STARTED = 'started' ...
/content/code_sandbox/scripts/pylib/twister/twisterlib/statuses.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
150
```python #!/usr/bin/env python3 # vim: set syntax=python ts=4 : import tarfile import json import os from twisterlib.statuses import TwisterStatus class Artifacts: def __init__(self, env): self.options = env.options def make_tarfile(self, output_filename, source_dirs): root = os.path.basen...
/content/code_sandbox/scripts/pylib/twister/twisterlib/package.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
298
```python #!/usr/bin/env python3 # vim: set syntax=python ts=4 : # import logging import math import os import psutil import re import select import shlex import signal import subprocess import sys import threading import time from pathlib import Path from queue import Queue, Empty from twisterlib.environment import ...
/content/code_sandbox/scripts/pylib/twister/twisterlib/handlers.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
10,567
```python # vim: set syntax=python ts=4 : # from enum import Enum import os from pathlib import Path import re import logging import contextlib import mmap import glob from typing import List from twisterlib.mixins import DisablePyTestCollectionMixin from twisterlib.environment import canonical_zephyr_base from twist...
/content/code_sandbox/scripts/pylib/twister/twisterlib/testsuite.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
4,576
```python from __future__ import annotations import logging import re import yaml from pathlib import Path from dataclasses import dataclass, field try: from yaml import CSafeLoader as SafeLoader except ImportError: from yaml import SafeLoader logger = logging.getLogger(__name__) class QuarantineExcepti...
/content/code_sandbox/scripts/pylib/twister/twisterlib/quarantine.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,135
```python # vim: set syntax=python ts=4 : # from __future__ import annotations from enum import Enum import os import hashlib import random import logging import shutil import glob import csv from twisterlib.testsuite import TestCase, TestSuite from twisterlib.platform import Platform from twisterlib.error import Buil...
/content/code_sandbox/scripts/pylib/twister/twisterlib/testinstance.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
3,108
```python #!/usr/bin/env python3 # vim: set syntax=python ts=4 : # import os import sys import re import subprocess import glob import json import collections from collections import OrderedDict from itertools import islice import logging import copy import shutil import random import snippets from pathlib import Path ...
/content/code_sandbox/scripts/pylib/twister/twisterlib/testplan.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
9,577
```python # vim: set syntax=python ts=4 : # import copy import scl import warnings from typing import Union from twisterlib.error import ConfigurationError def extract_fields_from_arg_list(target_fields: set, arg_list: Union[str, list]): """ Given a list of "FIELD=VALUE" args, extract values of args with a ...
/content/code_sandbox/scripts/pylib/twister/twisterlib/config_parser.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
2,307
```python # vim: set syntax=python ts=4 : # import logging import multiprocessing import os import pickle import queue import re import shutil import subprocess import sys import time import traceback import yaml from multiprocessing import Lock, Process, Value from multiprocessing.managers import BaseManager from typ...
/content/code_sandbox/scripts/pylib/twister/twisterlib/runner.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
11,581
```python # vim: set syntax=python ts=4 : # import colorama import logging import os import shutil import sys import time from colorama import Fore from twisterlib.statuses import TwisterStatus from twisterlib.testplan import TestPlan from twisterlib.reports import Reporting from twisterlib.hardwaremap import Hardwa...
/content/code_sandbox/scripts/pylib/twister/twisterlib/twister_main.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,544
```python from __future__ import annotations from asyncio.log import logger from enum import Enum import platform import re import os import sys import subprocess import shlex from collections import OrderedDict import xml.etree.ElementTree as ET import logging import threading import time import shutil import json fr...
/content/code_sandbox/scripts/pylib/twister/twisterlib/harness.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
7,113
```python #!/usr/bin/env python3 # vim: set syntax=python ts=4 : # import re from collections import OrderedDict class CMakeCacheEntry: '''Represents a CMake cache entry. This class understands the type system in a CMakeCache.txt, and converts the following cache types to Python types: Cache Type ...
/content/code_sandbox/scripts/pylib/twister/twisterlib/cmakecache.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,226
```python #!/usr/bin/env python3 # vim: set syntax=python ts=4 : # import argparse import json import logging import os import re import shutil import subprocess import sys from datetime import datetime, timezone from importlib import metadata from pathlib import Path from typing import Generator, List from twisterli...
/content/code_sandbox/scripts/pylib/twister/twisterlib/environment.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
9,140
```python #!/usr/bin/env python3 # vim: set syntax=python ts=4 : # from enum import Enum import os import json import logging from colorama import Fore import xml.etree.ElementTree as ET import string from datetime import datetime from pathlib import PosixPath from twisterlib.statuses import TwisterStatus logger = l...
/content/code_sandbox/scripts/pylib/twister/twisterlib/reports.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
5,908
```python ''' Common code used when logging that is needed by multiple modules. ''' import platform import shlex _WINDOWS = (platform.system() == 'Windows') def log_command(logger, msg, args): '''Platform-independent helper for logging subprocess invocations. Will log a command string that can be copy/paste...
/content/code_sandbox/scripts/pylib/twister/twisterlib/log_helper.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
166
```python """Module for job counters, limiting the amount of concurrent executions.""" import fcntl import functools import logging import multiprocessing import os import re import select import selectors import subprocess import sys logger = logging.getLogger('twister') logger.setLevel(logging.DEBUG) class JobHand...
/content/code_sandbox/scripts/pylib/twister/twisterlib/jobserver.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,672
```python #!/usr/bin/env python3 # vim: set syntax=python ts=4 : # import subprocess import sys import os import re import typing import logging from twisterlib.error import TwisterRuntimeError logger = logging.getLogger('twister') logger.setLevel(logging.DEBUG) class SizeCalculator: alloc_sections = [ "...
/content/code_sandbox/scripts/pylib/twister/twisterlib/size_calc.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
3,666
```python #!/usr/bin/env python3 # vim: set syntax=python ts=4 : # import os import scl from twisterlib.config_parser import TwisterConfigParser from twisterlib.environment import ZEPHYR_BASE class Platform: """Class representing metadata for a particular platform Maps directly to BOARD when building""" ...
/content/code_sandbox/scripts/pylib/twister/twisterlib/platform.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,112
```python #!/usr/bin/env python3 # # """ Stack compressor for FlameGraph This translate stack samples captured by perf subsystem into format used by flamegraph.pl. Translation uses .elf file to get function names from addresses Usage: ./script/perf/stackcollapse.py <file with perf printbuf output> <ELF file> """...
/content/code_sandbox/scripts/profiling/stackcollapse.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
434
```python #!/usr/bin/env python3 # # """ Script to capture tracing data with UART backend. """ import sys import serial import argparse def parse_args(): global args parser = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)...
/content/code_sandbox/scripts/tracing/trace_capture_uart.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
335
```python """ The classes below are examples of user-defined CommitRules. Commit rules are gitlint rules that act on the entire commit at once. Once the rules are discovered, gitlint will automatically take care of applying them to the entire commit. This happens exactly once per commit. A CommitRule contrasts with a...
/content/code_sandbox/scripts/gitlint/zephyr_commit_rules.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,384
```python #!/usr/bin/env python3 # # """ Script to parse CTF data and print to the screen in a custom and colorful format. Generate trace using samples/subsys/tracing for example: west build -b qemu_x86 samples/subsys/tracing -t run \ -- -DCONF_FILE=prj_uart_ctf.conf mkdir ctf cp build/channel0_0 ...
/content/code_sandbox/scripts/tracing/parse_ctf.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,143
```python #!/usr/bin/env python3 # # """ Script to capture tracing data with USB backend. """ import usb.core import usb.util import argparse import sys def parse_args(): global args parser = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, al...
/content/code_sandbox/scripts/tracing/trace_capture_usb.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
663
```python #!/usr/bin/env python3 """Format HTTP Status codes for use in a C header This script extracts HTTP status codes from mozilla.org and formats them to fit inside of a C enum along with comments. The output may appear somewhat redundant but it strives to a) be human readable b) eliminate the need to look up s...
/content/code_sandbox/scripts/net/enumerate_http_status.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
350
```python #!/usr/bin/env python3 import subprocess import tempfile import argparse import os import string import sys quartus_cpf_template = """<?xml version="1.0" encoding="US-ASCII" standalone="yes"?> <cof> <output_filename>${OUTPUT_FILENAME}</output_filename> <n_pages>1</n_pages> <width>1</width> <mode>14</mod...
/content/code_sandbox/scripts/support/quartus-flash.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
1,222
```shell #!/bin/bash image=net-tools name=net-tools network=net-tools0 zephyr_pid=0 docker_pid=0 configuration="" result=0 dirs="" zephyr_overlay="" docker_test_script_name=docker-test.sh scan_dirs=0 RUNNING_FROM_MAIN_SCRIPT=1 check_dirs () { local ret_zephyr=0 local ret_net_tools=0 if [ -z "$ZEPHYR_BAS...
/content/code_sandbox/scripts/net/run-sample-tests.sh
shell
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
2,563
```python #!/usr/bin/env python3 """This file contains VIF element constants defined to be used by generate_vif.py""" VENDOR_NAME = "Vendor_Name" MODEL_PART_NUMBER = "Model_Part_Number" PRODUCT_REVISION = "Product_Revision" TID = "TID" VIF_PRODUCT_TYPE = "VIF_Product_Type" CERTIFICATION_TYPE = "Certification_Type" C...
/content/code_sandbox/scripts/generate_usb_vif/constants/vif_element_constants.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
292
```python #!/usr/bin/env python3 """This file contains a Python script which parses through Zephyr device tree using EDT.pickle generated at build and generates a XML file containing USB VIF policies""" import argparse import inspect import os import pickle import sys import xml.etree.ElementTree as ET from constan...
/content/code_sandbox/scripts/generate_usb_vif/generate_vif.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
2,596
```python #!/usr/bin/env python3 """This file contains device tree constants defined to be used by generate_vif.py""" SINK_PDOS = "sink-pdos" PD_DISABLE = "pd-disable" POWER_ROLE = "power-role" DT_VIF_ELEMENTS = { SINK_PDOS: "SnkPdoList", } ```
/content/code_sandbox/scripts/generate_usb_vif/constants/dt_constants.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
69
```python #!/usr/bin/env python3 """This file contains generic constants defined to be used by generate_vif.py""" NAME = "name" VALUE = "value" TEXT = "text" ATTRIBUTES = "attributes" CHILD = "child" TRUE = "true" FALSE = "false" PD_PORT_TYPE_VALUES = { "sink": ("0", "Consumer Only"), "source": ("3", "Provi...
/content/code_sandbox/scripts/generate_usb_vif/constants/other_constants.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
202
```python #!/usr/bin/env python3 """This file contains XML constants defined to be used by generate_vif.py""" from constants import other_constants from constants import vif_element_constants XML_ENCODING = "utf-8" XML_ELEMENT_NAME_PREFIX = "vif" XML_ROOT_ELEMENT_NAME = "VIF" XML_VIF_NAMESPACE = "path_to_url" XML_N...
/content/code_sandbox/scripts/generate_usb_vif/constants/xml_constants.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
232
```python #!/usr/bin/env python3 """This file contains PDO constants defined to be used by generate_vif.py""" # PDO PDO_TYPE_FIXED = 0 PDO_TYPE_BATTERY = 1 PDO_TYPE_VARIABLE = 2 PDO_TYPE_AUGUMENTED = 3 PDO_TYPES = { PDO_TYPE_FIXED: "Fixed", PDO_TYPE_BATTERY: "Battery", PDO_TYPE_VARIABLE: "Variable", ...
/content/code_sandbox/scripts/generate_usb_vif/constants/pdo_constants.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
101
```python #!/usr/bin/env python3 # # """ Log Parser for Dictionary-based Logging This uses the JSON database file to decode the input binary log data and print the log messages. """ import argparse import binascii import logging import sys import dictionary_parser from dictionary_parser.log_database import LogDatab...
/content/code_sandbox/scripts/logging/dictionary/log_parser.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
963
```python #!/usr/bin/env python3 # # """ Dictionary-based Logging Parser Module """ from .log_parser_v1 import LogParserV1 from .log_parser_v3 import LogParserV3 def get_parser(database): """Get the parser object based on database""" db_ver = int(database.get_version()) # DB version 1 and 2 correspond ...
/content/code_sandbox/scripts/logging/dictionary/dictionary_parser/__init__.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
132
```python #!/usr/bin/env python3 # # """ Utilities for Dictionary-based Logging Parser """ import binascii def convert_hex_file_to_bin(hexfile): """This converts a file in hexadecimal to binary""" bin_data = b'' with open(hexfile, "r", encoding="iso-8859-1") as hfile: for line in hfile.readline...
/content/code_sandbox/scripts/logging/dictionary/dictionary_parser/utils.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
358
```python #!/usr/bin/env python3 # # """ Abstract Class for Dictionary-based Logging Parsers """ import abc from colorama import Fore from .data_types import DataTypes LOG_LEVELS = [ ('none', Fore.WHITE), ('err', Fore.RED), ('wrn', Fore.YELLOW), ('inf', Fore.GREEN), ('dbg', Fore.BLUE) ] def get...
/content/code_sandbox/scripts/logging/dictionary/dictionary_parser/log_parser.py
python
2016-05-26T17:54:19
2024-08-16T18:09:06
zephyr
zephyrproject-rtos/zephyr
10,307
380