Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno-f-cruz committed May 20, 2024
1 parent 2e51fc4 commit 24b8977
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 25 deletions.
3 changes: 2 additions & 1 deletion harp/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
from enum import IntEnum
from os import PathLike
from typing import Any, BinaryIO, Optional, Union
from pandas._typing import Axes

import numpy as np
import pandas as pd
from pandas._typing import Axes

REFERENCE_EPOCH = datetime(1904, 1, 1)
"""The reference epoch for UTC harp time."""
Expand Down
12 changes: 3 additions & 9 deletions harp/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,10 @@

from enum import Enum
from typing import Dict, List, Optional, Union
from typing_extensions import Annotated

from pydantic import (
BaseModel,
BeforeValidator,
ConfigDict,
Field,
RootModel,
field_serializer,
)
from pydantic import (BaseModel, BeforeValidator, ConfigDict, Field, RootModel,
field_serializer)
from typing_extensions import Annotated


class PayloadType(str, Enum):
Expand Down
34 changes: 21 additions & 13 deletions harp/reader.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
import os
import requests
from deprecated import deprecated
from collections import UserDict
from dataclasses import dataclass
from datetime import datetime
from functools import partial
from math import log2
from os import PathLike
from pathlib import Path
from datetime import datetime
from functools import partial
from dataclasses import dataclass
from typing import (Any, BinaryIO, Callable, Iterable, Mapping, Optional,
Protocol, Union)

import requests
from deprecated import deprecated
from numpy import dtype
from pandas import DataFrame, Series
from typing import Any, BinaryIO, Callable, Iterable, Mapping, Optional, Protocol, Union
from collections import UserDict
from pandas._typing import Axes

from harp import __version__
from harp.model import BitMask, GroupMask, Model, PayloadMember, Register
from harp.io import MessageType, read
from harp.model import BitMask, GroupMask, Model, PayloadMember, Register
from harp.schema import read_schema


Expand All @@ -31,8 +34,7 @@ def __call__(
file: Optional[Union[str, bytes, PathLike[Any], BinaryIO]] = None,
epoch: Optional[datetime] = None,
keep_type: bool = False,
) -> DataFrame:
...
) -> DataFrame: ...


class RegisterReader:
Expand Down Expand Up @@ -310,9 +312,12 @@ def from_dataset(
base_path=path,
include_common_registers=include_common_registers,
epoch=epoch,
keep_type=keep_type)
keep_type=keep_type,
)
else:
raise ValueError("The dataset must be a directory containing a device.yml file.")
raise ValueError(
"The dataset must be a directory containing a device.yml file."
)


def _compose_parser(
Expand Down Expand Up @@ -462,7 +467,10 @@ def parser(df: DataFrame):
reader = partial(reader, columns=[name])
return RegisterReader(register, reader)

@deprecated("This function is deprecated. Use DeviceReader.from_file, DeviceReader.from_url, DeviceReader.from_str, and DeviceReader.from_model instead.")

@deprecated(
"This function is deprecated. Use DeviceReader.from_file, DeviceReader.from_url, DeviceReader.from_str, and DeviceReader.from_model instead."
)
def create_reader(
device: Union[str, PathLike, Model],
include_common_registers: bool = True,
Expand Down
6 changes: 4 additions & 2 deletions harp/schema.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from importlib import resources
from os import PathLike
from typing import TextIO, Union
from harp.model import Model, Registers

from pydantic_yaml import parse_yaml_raw_as
from importlib import resources

from harp.model import Model, Registers


def _read_common_registers() -> Registers:
Expand Down

0 comments on commit 24b8977

Please sign in to comment.