Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes dependency on singledispatchmethod package which is included … #317

Merged
merged 1 commit into from
Mar 27, 2024
Merged
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
20 changes: 9 additions & 11 deletions kubric/renderer/blender.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,25 @@
# pylint: disable=function-redefined (removes singledispatchmethod pylint errors)

import collections
from contextlib import redirect_stdout
import functools
import io
import logging
import os
import sys
from contextlib import redirect_stdout
from typing import Any, Dict, Optional, Sequence, Union
import tempfile

from kubric.safeimport.bpy import bpy

import numpy as np
import tensorflow as tf
from singledispatchmethod import singledispatchmethod
from typing import Any, Dict, Optional, Sequence, Union

import kubric as kb
from kubric import core
from kubric import file_io
from kubric.core.assets import UndefinedAsset
from kubric.file_io import PathLike
from kubric.redirect_io import RedirectStream
from kubric.renderer import blender_utils
from kubric import file_io
from kubric.file_io import PathLike
from kubric.safeimport.bpy import bpy
import numpy as np
import tensorflow as tf

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -358,7 +356,7 @@ def clear_and_reset_blender_scene(verbose: bool = False, custom_scene: str = Non
logger.info("Loading scene from '%s'", custom_scene)
bpy.ops.wm.open_mainfile(filepath=custom_scene)

@singledispatchmethod
@functools.singledispatchmethod
def add_asset(self, asset: core.Asset) -> Any:
raise NotImplementedError(f"Cannot add {asset!r}")

Expand Down
6 changes: 2 additions & 4 deletions kubric/simulator/pybullet.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@
import tempfile
from typing import Dict, List, Optional, Tuple, Union

import tensorflow as tf
from singledispatchmethod import singledispatchmethod

from kubric import core
from kubric.redirect_io import RedirectStream
import tensorflow as tf

# --- hides the "pybullet build time: May 26 2021 18:52:36" message on import
with RedirectStream(stream=sys.stderr):
Expand Down Expand Up @@ -86,7 +84,7 @@ def __init__(self, scene: core.Scene, scratch_dir=tempfile.mkdtemp()):
def physics_client(self):
return self._physics_client.client

@singledispatchmethod
@functools.singledispatchmethod
def add_asset(self, asset: core.Asset) -> Optional[int]:
raise NotImplementedError(f"Cannot add {asset!r}")

Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ pypng
pyquaternion
python-Levenshtein
scikit-learn
singledispatchmethod
tensorflow
tensorflow-datasets>=4.1.0
traitlets
Expand Down
Loading