Commit 7ccd8b0b authored by Kai Chen's avatar Kai Chen
Browse files

minor fix

parent 4adf7006
......@@ -25,7 +25,7 @@ def load(file, file_format=None, **kwargs):
Returns:
The content from the file.
"""
if file_format is None and isinstance(file, str):
if file_format is None and is_str(file):
file_format = file.split('.')[-1]
if file_format not in file_processors:
raise TypeError('Unsupported format: {}'.format(file_format))
......
......@@ -13,16 +13,16 @@ class Timer(object):
:Example:
>>> import time
>>> import cvbase as cvb
>>> with cvb.Timer():
>>> import mmcv
>>> with mmcv.Timer():
>>> # simulate a code block that will run for 1s
>>> time.sleep(1)
1.000
>>> with cvb.Timer(print_tmpl='it takes {:.1f} seconds'):
>>> with mmcv.Timer(print_tmpl='it takes {:.1f} seconds'):
>>> # simulate a code block that will run for 1s
>>> time.sleep(1)
it takes 1.0 seconds
>>> timer = cvb.Timer()
>>> timer = mmcv.Timer()
>>> time.sleep(0.5)
>>> print(timer.since_start())
0.500
......@@ -95,11 +95,11 @@ def check_time(timer_id):
:Example:
>>> import time
>>> import cvbase as cvb
>>> import mmcv
>>> for i in range(1, 6):
>>> # simulate a code block
>>> time.sleep(i)
>>> cvb.check_time('task1')
>>> mmcv.check_time('task1')
2.000
3.000
4.000
......
......@@ -50,12 +50,12 @@ class VideoReader(object):
cache.
:Example:
>>> import cvbase as cvb
>>> v = cvb.VideoReader('sample.mp4')
>>> import mmcv
>>> v = mmcv.VideoReader('sample.mp4')
>>> len(v) # get the total frame number with `len()`
120
>>> for img in v: # v is iterable
>>> cvb.show_img(img)
>>> mmcv.imshow(img)
>>> v[5] # get the 6th frame
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment