mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 06:44:46 +08:00
Turn off FS cache in sith.py by default
This commit is contained in:
16
sith.py
16
sith.py
@@ -28,6 +28,8 @@ import traceback
|
|||||||
|
|
||||||
import jedi
|
import jedi
|
||||||
|
|
||||||
|
_unspecified = object()
|
||||||
|
|
||||||
|
|
||||||
class SourceCode(object):
|
class SourceCode(object):
|
||||||
|
|
||||||
@@ -236,7 +238,12 @@ class AttackApp(object):
|
|||||||
parser = self.get_parser()
|
parser = self.get_parser()
|
||||||
self.do_run(**vars(parser.parse_args(args)))
|
self.do_run(**vars(parser.parse_args(args)))
|
||||||
|
|
||||||
def do_run(self, func, debugger, **kwds):
|
def do_run(self, func, debugger, fs_cache, **kwds):
|
||||||
|
if fs_cache is _unspecified:
|
||||||
|
jedi.settings.use_filesystem_cache = False
|
||||||
|
else:
|
||||||
|
jedi.settings.cache_directory = fs_cache
|
||||||
|
|
||||||
try:
|
try:
|
||||||
func(**kwds)
|
func(**kwds)
|
||||||
except:
|
except:
|
||||||
@@ -274,6 +281,13 @@ class AttackApp(object):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--ipdb', dest='debugger', const='ipdb', action='store_const',
|
'--ipdb', dest='debugger', const='ipdb', action='store_const',
|
||||||
help='Launch ipdb when error is raised.')
|
help='Launch ipdb when error is raised.')
|
||||||
|
parser.add_argument(
|
||||||
|
'--fs-cache', '-C', default=_unspecified,
|
||||||
|
help="""
|
||||||
|
By default, file system cache is off for reproducibility.
|
||||||
|
Pass a temporary directory to use file system cache.
|
||||||
|
It is set to ``jedi.settings.cache_directory``.
|
||||||
|
""")
|
||||||
|
|
||||||
self.subparsers = parser.add_subparsers()
|
self.subparsers = parser.add_subparsers()
|
||||||
self.add_parser(RandomAttacker, 'random')
|
self.add_parser(RandomAttacker, 'random')
|
||||||
|
|||||||
Reference in New Issue
Block a user