Skip to content

Commit

Permalink
formating with black
Browse files Browse the repository at this point in the history
  • Loading branch information
kthare10 committed Oct 11, 2024
1 parent 10fc278 commit c2e3593
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions fabrictestbed_extensions/fablib/fablib.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,12 +744,20 @@ def remove_slice_from_cache(self, slice_object: Slice):
:type slice_object: Slice
"""
with self.lock:
if slice_object.get_slice_id() and slice_object.get_slice_id() in self.__slices_by_id:
if (
slice_object.get_slice_id()
and slice_object.get_slice_id() in self.__slices_by_id
):
self.__slices_by_id.pop(slice_object.get_slice_id())
if slice_object.get_name() and slice_object.get_name() in self.__slices_by_name:
if (
slice_object.get_name()
and slice_object.get_name() in self.__slices_by_name
):
self.__slices_by_name.pop(slice_object.get_name())

def _get_slice_from_cache(self, slice_id: str = None, slice_name: str = None) -> Slice:
def _get_slice_from_cache(
self, slice_id: str = None, slice_name: str = None
) -> Slice:
"""
Retrieves a Slice object from the cache by its ID or name.
Expand Down Expand Up @@ -1986,7 +1994,7 @@ def list_slices(
filter_function=None,
pretty_names=True,
user_only: bool = True,
show_un_submitted: bool = False
show_un_submitted: bool = False,
):
"""
Lists all the slices created by a user.
Expand Down Expand Up @@ -2026,7 +2034,9 @@ def list_slices(
:rtype: Object
"""
table = []
for slice in self.get_slices(excludes=excludes, user_only=user_only, show_un_submitted=show_un_submitted):
for slice in self.get_slices(
excludes=excludes, user_only=user_only, show_un_submitted=show_un_submitted
):
table.append(slice.toDict())

if pretty_names:
Expand All @@ -2053,7 +2063,7 @@ def show_slice(
quiet=False,
pretty_names=True,
user_only: bool = True,
show_un_submitted: bool = False
show_un_submitted: bool = False,
):
"""
Show a table with all the properties of a specific site
Expand Down Expand Up @@ -2089,7 +2099,12 @@ def show_slice(
:rtype: Object
"""

slice = self.get_slice(name=name, slice_id=id, user_only=user_only, show_un_submitted=show_un_submitted)
slice = self.get_slice(
name=name,
slice_id=id,
user_only=user_only,
show_un_submitted=show_un_submitted,
)

return slice.show(
output=output, fields=fields, quiet=quiet, pretty_names=pretty_names
Expand Down Expand Up @@ -2207,7 +2222,7 @@ def get_slice(
excludes=[SliceState.Dead, SliceState.Closing],
slice_name=name,
user_only=user_only,
show_un_submitted=show_un_submitted
show_un_submitted=show_un_submitted,
)

if len(slices) > 0:
Expand Down

0 comments on commit c2e3593

Please sign in to comment.