mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-10 15:28:34 +01:00
astroid==2.5.7 has improved inference and was throwing errors that were false negatives before. Fixing these and ignoring some. Also added `funcy.decorator` to the `signature-mutators`, as it changes function signature (i.e. provides `Call` as a first argument which is not required to pass). Example errors that we were getting because of this: ``` tests/remotes/gdrive.py:40:11: E1120: No value for argument 'tries' in function call (no-value-for-parameter) ************* Module dvc.stage.serialize dvc/stage/serialize.py:38:1: E1120: No value for argument 'func' in function call (no-value-for-parameter) ************* Module dvc.fs.http dvc/fs/http.py:19:1: E1120: No value for argument 'ctx' in function call (no-value-for-parameter) ************* Module dvc.fs.gdrive dvc/fs/gdrive.py:66:11: E1120: No value for argument 'tries' in function call (no-value-for-parameter) dvc/fs/gdrive.py:459:5: E1120: No value for argument 'ctx' in function call (no-value-for-parameter) ```
53 lines
1.5 KiB
Python
53 lines
1.5 KiB
Python
import argparse
|
|
import logging
|
|
|
|
from dvc import prompt
|
|
from dvc.command.base import CmdBase, append_doc_link
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class CmdDestroy(CmdBase):
|
|
def run(self):
|
|
from dvc.exceptions import DvcException
|
|
|
|
try:
|
|
statement = (
|
|
"This will destroy all information about your pipelines,"
|
|
" all data files, as well as cache in .dvc/cache."
|
|
"\n"
|
|
"Are you sure you want to continue?"
|
|
)
|
|
|
|
if not self.args.force and not prompt.confirm(statement):
|
|
raise DvcException(
|
|
"cannot destroy without a confirmation from the user."
|
|
" Use `-f` to force."
|
|
)
|
|
|
|
self.repo.destroy()
|
|
except DvcException:
|
|
logger.exception("failed to destroy DVC")
|
|
return 1
|
|
return 0
|
|
|
|
|
|
def add_parser(subparsers, parent_parser):
|
|
DESTROY_HELP = "Remove DVC files, local DVC config and data cache."
|
|
|
|
destroy_parser = subparsers.add_parser(
|
|
"destroy",
|
|
parents=[parent_parser],
|
|
description=append_doc_link(DESTROY_HELP, "destroy"),
|
|
help=DESTROY_HELP,
|
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
)
|
|
destroy_parser.add_argument(
|
|
"-f",
|
|
"--force",
|
|
action="store_true",
|
|
default=False,
|
|
help="Force destruction.",
|
|
)
|
|
destroy_parser.set_defaults(func=CmdDestroy)
|