-
Notifications
You must be signed in to change notification settings - Fork 494
Expand file tree
/
Copy pathcli.py
More file actions
44 lines (37 loc) · 1.25 KB
/
cli.py
File metadata and controls
44 lines (37 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import argparse
import logging
import warnings
from .utils import clear_cache
def entrance():
dateparser_argparse = argparse.ArgumentParser(
description="dateparser download manager."
)
dateparser_argparse.add_argument(
"--fasttext",
type=str,
help="[DEPRECATED] fastText is no longer supported. Please use langdetect instead.",
)
dateparser_argparse.add_argument(
"--clear",
"--clear-cache",
help="To clear all cached models",
action="store_true",
)
args = dateparser_argparse.parse_args()
if args.clear:
clear_cache()
logging.info("dateparser-download: All cache deleted")
if args.fasttext:
warnings.warn(
"fastText support has been removed as the library is archived and unmaintained. "
"Please migrate to langdetect. Install with: pip install dateparser[langdetect]",
DeprecationWarning,
stacklevel=2,
)
dateparser_argparse.error(
"fastText is no longer supported. Please use langdetect for language detection."
)
if not args.clear:
dateparser_argparse.error(
"dateparser-download: You need to specify the command (i.e.: --clear)"
)