def grr_head(line): """Reads the first bytes of a specified file. Args: line: A string representing arguments passed to the magic command. Returns: Specified number of the first bytes of the file. Raises: NoClientSelectedError: Client is not selected to perform this operation. """ args = grr_head.parser.parse_args(shlex.split(line)) return magics_impl.grr_head_impl(path=args.path, bytes=args.bytes, offset=args.offset, cached=args.cached)
def testNoClientSelected(self): with self.assertRaises(magics_impl.NoClientSelectedError): magics_impl.grr_head_impl('foo')