Skip to content

Commit d1b1b84

Browse files
committed
Removed unused code.
1 parent d6d60b7 commit d1b1b84

File tree

3 files changed

+6
-74
lines changed

3 files changed

+6
-74
lines changed

pyrep/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
__version__ = '4.1.0.2'
22

33
testing = False
4-
suppress_std_out_err = False
54

65
from .pyrep import PyRep

pyrep/backend/utils.py

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
import os
2-
import io
3-
import sys
4-
from contextlib import contextmanager
51
from threading import Lock
62
from typing import List, Tuple
7-
import pyrep
83
from pyrep.backend import sim
94
from pyrep.objects.object import Object
105
from pyrep.objects.shape import Shape
@@ -79,63 +74,3 @@ def _is_in_ipython():
7974
except NameError:
8075
pass
8176
return False
82-
83-
84-
@contextmanager
85-
def suppress_std_out_and_err():
86-
"""Used for suppressing std out/err.
87-
88-
This is needed because the OMPL plugin outputs logging info even when
89-
logging is turned off.
90-
"""
91-
if not pyrep.suppress_std_out_err:
92-
yield
93-
return
94-
95-
try:
96-
# If we are using an IDE, then this will fail
97-
original_stdout_fd = sys.stdout.fileno()
98-
original_stderr_fd = sys.stderr.fileno()
99-
except io.UnsupportedOperation:
100-
# Nothing we can do about this, just don't suppress
101-
yield
102-
return
103-
104-
if _is_in_ipython():
105-
yield
106-
return
107-
108-
with open(os.devnull, "w") as devnull:
109-
110-
devnull_fd = devnull.fileno()
111-
112-
def _redirect_stdout(to_fd):
113-
sys.stdout.close()
114-
os.dup2(to_fd, original_stdout_fd)
115-
if pyrep.testing:
116-
sys.stdout = io.TextIOWrapper(
117-
os.fdopen(original_stdout_fd, 'wb'))
118-
else:
119-
sys.stdout = os.fdopen(original_stdout_fd, 'w')
120-
121-
def _redirect_stderr(to_fd):
122-
sys.stderr.close()
123-
os.dup2(to_fd, original_stderr_fd)
124-
if pyrep.testing:
125-
sys.stderr = io.TextIOWrapper(
126-
os.fdopen(original_stderr_fd, 'wb'))
127-
else:
128-
sys.stderr = os.fdopen(original_stderr_fd, 'wb')
129-
130-
saved_stdout_fd = os.dup(original_stdout_fd)
131-
# saved_stderr_fd = os.dup(original_stderr_fd)
132-
133-
try:
134-
_redirect_stdout(devnull_fd)
135-
# _redirect_stderr(devnull_fd)
136-
yield
137-
_redirect_stdout(saved_stdout_fd)
138-
# _redirect_stderr(saved_stderr_fd)
139-
finally:
140-
os.close(saved_stdout_fd)
141-
# os.close(saved_stderr_fd)

pyrep/robots/mobiles/mobile_base.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,12 @@ def _get_nonlinear_path_points(self, position: List[float],
130130
handle_base = self.get_handle()
131131
handle_target_base = self.target_base.get_handle()
132132

133-
# Despite verbosity being set to 0, OMPL spits out a lot of text
134-
with utils.suppress_std_out_and_err():
135-
_, ret_floats, _, _ = utils.script_call(
136-
'getNonlinearPathMobile@PyRep', PYREP_SCRIPT_TYPE,
137-
ints=[handle_base, handle_target_base,
138-
self._collision_collection,
139-
int(ignore_collisions), path_pts], floats=[boundaries],
140-
strings=[algorithm.value])
133+
_, ret_floats, _, _ = utils.script_call(
134+
'getNonlinearPathMobile@PyRep', PYREP_SCRIPT_TYPE,
135+
ints=[handle_base, handle_target_base,
136+
self._collision_collection,
137+
int(ignore_collisions), path_pts], floats=[boundaries],
138+
strings=[algorithm.value])
141139

142140
# self.set_parent(None)
143141
# self.base_ref.set_parent(self)

0 commit comments

Comments
 (0)