MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / __init__

Method __init__

tools/sampcd_processor.py:361–404  ·  view source on GitHub ↗
(
        self,
        debug=False,
        style='freeform',
        target='codeblock',
        mode='native',
        verbose=2,
        patch_global_state=True,
        patch_tensor_place=True,
        patch_float_precision=5,
        use_multiprocessing=True,
        **config,
    )

Source from the content-addressed store, hash-verified

359 }
360
361 def __init__(
362 self,
363 debug=False,
364 style='freeform',
365 target='codeblock',
366 mode='native',
367 verbose=2,
368 patch_global_state=True,
369 patch_tensor_place=True,
370 patch_float_precision=5,
371 use_multiprocessing=True,
372 **config,
373 ):
374 self.debug = debug
375
376 self.style = style
377 self.target = target
378 self.mode = mode
379 self.verbose = verbose
380 self.config = XDOCTEST_CONFIG | (config or {})
381 self._test_capacity = set()
382
383 self._patch_global_state = patch_global_state
384 self._patch_tensor_place = patch_tensor_place
385 self._patch_float_precision = patch_float_precision
386 self._use_multiprocessing = use_multiprocessing
387
388 # patch xdoctest before `xdoctest.core.parse_docstr_examples`
389 self._patch_xdoctest()
390
391 self.docstring_parser = functools.partial(
392 xdoctest.core.parse_docstr_examples, style=self.style
393 )
394
395 self.directive_pattern = re.compile(
396 r"""
397 (?<=(\#\s)) # positive lookbehind, directive begins
398 (doctest) # directive prefix, which should be replaced
399 (?=(:\s*.*\n)) # positive lookahead, directive content
400 """,
401 re.VERBOSE,
402 )
403
404 self.directive_prefix = 'xdoctest'
405
406 def _patch_xdoctest(self):
407 if self._patch_global_state:

Callers

nothing calls this directly

Calls 3

_patch_xdoctestMethod · 0.95
setClass · 0.85
compileMethod · 0.45

Tested by

no test coverage detected