Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vladistan committed Aug 8, 2024
1 parent f723348 commit 39ea83c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/greenbutton_objects/atom/object_tree.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from dataclasses import dataclass, field
from itertools import chain
from typing import Any, Dict, Iterable, List, Optional, Sequence
from typing import Any, Dict, Iterable, List, Optional, Sequence, Union

from greenbutton_objects.atom.href_tree import HRefForest, HRefTreeNode
from greenbutton_objects.util import get_first
Expand Down Expand Up @@ -44,7 +44,7 @@ def get_related_of_type(self, elements_type: type) -> Iterable["EntryNode"]:
elements = [obj for obj in self.related if obj.content_type is elements_type]
return elements

def safe_get_content(self, type: type) -> Any | None:
def safe_get_content(self, type: type) -> Union[Any, None]:
obj = get_first(self.get_related_of_type(type))
return obj.first_content() if obj else None

Expand Down
1 change: 0 additions & 1 deletion src/greenbutton_objects/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def parse_feed_representation(feed: ObjectFeed) -> str:
result = []

# Get all usage point containers and elements

for up in feed.usage_points:
result.append("UsagePoint (%s) Service: %s (%s) " % (up.title, up.service_kind.name, up.status))

Expand Down
4 changes: 2 additions & 2 deletions src/greenbutton_objects/util.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import Iterable, Type, TypeVar
from typing import Iterable, Type, TypeVar, Union

T = TypeVar("T")
S = TypeVar("S")


def get_first(iterable: Iterable[T]) -> T | None:
def get_first(iterable: Iterable[T]) -> Union[T, None]:
for item in iterable:
return item
return None
Expand Down
2 changes: 0 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import pytest

from greenbutton_objects.data.espi import UsagePoint

_ROOT_DIR = pathlib.Path(__file__).parent


Expand Down

0 comments on commit 39ea83c

Please sign in to comment.