ChatterBot 1.2.14__tar.gz → 1.2.15__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {chatterbot-1.2.14 → chatterbot-1.2.15}/ChatterBot.egg-info/PKG-INFO +1 -2
- {chatterbot-1.2.14 → chatterbot-1.2.15}/ChatterBot.egg-info/requires.txt +0 -1
- {chatterbot-1.2.14 → chatterbot-1.2.15}/PKG-INFO +1 -2
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/__init__.py +1 -1
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/trainers.py +135 -18
- {chatterbot-1.2.14 → chatterbot-1.2.15}/pyproject.toml +1 -2
- {chatterbot-1.2.14 → chatterbot-1.2.15}/ChatterBot.egg-info/SOURCES.txt +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/ChatterBot.egg-info/dependency_links.txt +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/ChatterBot.egg-info/top_level.txt +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/LICENSE +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/README.md +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/__main__.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/adapters.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/chatterbot.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/comparisons.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/components.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/constants.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/conversation.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/corpus.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/exceptions.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/__init__.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/__init__.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/abstract_models.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/admin.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/apps.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0001_initial.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0002_statement_extra_data.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0003_change_occurrence_default.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0004_rename_in_response_to.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0005_statement_created_at.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0006_create_conversation.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0007_response_created_at.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0008_update_conversations.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0009_tags.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0010_statement_text.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0011_blank_extra_data.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0012_statement_created_at.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0013_change_conversations.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0014_remove_statement_extra_data.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0015_statement_persona.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0016_statement_stemmed_text.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0017_tags_unique.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0018_text_max_length.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0019_alter_statement_id_alter_tag_id_and_more.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0020_alter_statement_conversation_and_more.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0021_increase_text_max_length_to_1100.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/__init__.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/model_admin.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/models.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/settings.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/sqlalchemy_app/__init__.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/sqlalchemy_app/models.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/filters.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/languages.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/logic/__init__.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/logic/best_match.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/logic/llm_adapters.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/logic/logic_adapter.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/logic/mathematical_evaluation.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/logic/mcp_tools.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/logic/specific_response.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/logic/time_adapter.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/logic/unit_conversion.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/parsing.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/preprocessors.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/response_selection.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/search.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/storage/__init__.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/storage/django_storage.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/storage/mongodb.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/storage/redis.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/storage/sql_storage.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/storage/storage_adapter.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/tagging.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/utils.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/vectorstores.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/setup.cfg +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/tests/test_adapter_validation.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/tests/test_benchmarks.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/tests/test_chatbot.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/tests/test_cli.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/tests/test_comparisons.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/tests/test_conversations.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/tests/test_corpus.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/tests/test_examples.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/tests/test_filters.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/tests/test_initialization.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/tests/test_languages.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/tests/test_parsing.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/tests/test_preprocessors.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/tests/test_response_selection.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/tests/test_search.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/tests/test_tagging.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/tests/test_turing.py +0 -0
- {chatterbot-1.2.14 → chatterbot-1.2.15}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ChatterBot
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.15
|
|
4
4
|
Summary: ChatterBot is a machine learning, conversational dialog engine
|
|
5
5
|
Author: Gunther Cox
|
|
6
6
|
License-Expression: BSD-3-Clause
|
|
@@ -43,7 +43,6 @@ Requires-Dist: sphinx<9.2,>=5.3; extra == "test"
|
|
|
43
43
|
Requires-Dist: sphinx-sitemap>=2.6.0; extra == "test"
|
|
44
44
|
Requires-Dist: huggingface_hub; extra == "test"
|
|
45
45
|
Requires-Dist: django<6.0,>=4.1; extra == "test"
|
|
46
|
-
Requires-Dist: click<9.0,>=8.4; extra == "test"
|
|
47
46
|
Provides-Extra: dev
|
|
48
47
|
Requires-Dist: pint>=0.8.1; extra == "dev"
|
|
49
48
|
Requires-Dist: pyyaml<7.0,>=6.0; extra == "dev"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ChatterBot
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.15
|
|
4
4
|
Summary: ChatterBot is a machine learning, conversational dialog engine
|
|
5
5
|
Author: Gunther Cox
|
|
6
6
|
License-Expression: BSD-3-Clause
|
|
@@ -43,7 +43,6 @@ Requires-Dist: sphinx<9.2,>=5.3; extra == "test"
|
|
|
43
43
|
Requires-Dist: sphinx-sitemap>=2.6.0; extra == "test"
|
|
44
44
|
Requires-Dist: huggingface_hub; extra == "test"
|
|
45
45
|
Requires-Dist: django<6.0,>=4.1; extra == "test"
|
|
46
|
-
Requires-Dist: click<9.0,>=8.4; extra == "test"
|
|
47
46
|
Provides-Extra: dev
|
|
48
47
|
Requires-Dist: pint>=0.8.1; extra == "dev"
|
|
49
48
|
Requires-Dist: pyyaml<7.0,>=6.0; extra == "dev"
|
|
@@ -3,6 +3,8 @@ import csv
|
|
|
3
3
|
import time
|
|
4
4
|
import glob
|
|
5
5
|
import json
|
|
6
|
+
import shutil
|
|
7
|
+
import secrets
|
|
6
8
|
import tarfile
|
|
7
9
|
from typing import List, Union
|
|
8
10
|
from tqdm import tqdm
|
|
@@ -10,6 +12,20 @@ from dateutil import parser as date_parser
|
|
|
10
12
|
from chatterbot.chatterbot import ChatBot
|
|
11
13
|
from chatterbot.conversation import Statement
|
|
12
14
|
|
|
15
|
+
# True where a directory fd opened with O_NOFOLLOW can fully anchor both
|
|
16
|
+
# directory-metadata operations (mkdir/rename via dir_fd) and the archive
|
|
17
|
+
# writes tarfile itself performs (via the /proc/self/fd/N magic path). Both
|
|
18
|
+
# are required together: anchoring mkdir/rename alone is not enough, since
|
|
19
|
+
# tarfile.extractall() writes through plain path strings and will silently
|
|
20
|
+
# recreate a missing destination through a symlink planted over data_directory.
|
|
21
|
+
# Currently Linux-only, since it depends on procfs.
|
|
22
|
+
_DIR_FD_EXTRACTION_SUPPORTED = (
|
|
23
|
+
hasattr(os, 'O_NOFOLLOW')
|
|
24
|
+
and os.mkdir in os.supports_dir_fd
|
|
25
|
+
and os.rename in os.supports_dir_fd
|
|
26
|
+
and os.path.isdir('/proc/self/fd')
|
|
27
|
+
)
|
|
28
|
+
|
|
13
29
|
|
|
14
30
|
class Trainer(object):
|
|
15
31
|
"""
|
|
@@ -579,9 +595,16 @@ class UbuntuCorpusTrainer(CsvFileTrainer):
|
|
|
579
595
|
"""
|
|
580
596
|
import requests
|
|
581
597
|
|
|
598
|
+
self._reject_symlinked_path(self.data_directory)
|
|
599
|
+
|
|
582
600
|
# Create the data directory if it does not already exist
|
|
583
601
|
if not os.path.exists(self.data_directory):
|
|
584
|
-
|
|
602
|
+
try:
|
|
603
|
+
os.makedirs(self.data_directory)
|
|
604
|
+
except FileExistsError as e:
|
|
605
|
+
raise self.TrainerInitializationException(
|
|
606
|
+
'Unable to create data directory {}: {}'.format(self.data_directory, e)
|
|
607
|
+
) from e
|
|
585
608
|
|
|
586
609
|
file_name = url.split('/')[-1]
|
|
587
610
|
file_path = os.path.join(self.data_directory, file_name)
|
|
@@ -597,8 +620,10 @@ class UbuntuCorpusTrainer(CsvFileTrainer):
|
|
|
597
620
|
total_length = response.headers.get('content-length')
|
|
598
621
|
|
|
599
622
|
if total_length is None:
|
|
600
|
-
# No content length header
|
|
601
|
-
|
|
623
|
+
# No content length header. Stream regardless of whether
|
|
624
|
+
# progress is shown, to avoid buffering the whole body in memory.
|
|
625
|
+
for data in response.iter_content(chunk_size=4096):
|
|
626
|
+
open_file.write(data)
|
|
602
627
|
else:
|
|
603
628
|
for data in tqdm(
|
|
604
629
|
response.iter_content(chunk_size=4096),
|
|
@@ -611,6 +636,29 @@ class UbuntuCorpusTrainer(CsvFileTrainer):
|
|
|
611
636
|
print('Download location: %s' % file_path)
|
|
612
637
|
return file_path
|
|
613
638
|
|
|
639
|
+
def _reject_symlinked_path(self, path):
|
|
640
|
+
# A trailing separator forces lstat to resolve the final component,
|
|
641
|
+
# so normpath first or islink silently returns False for a symlink.
|
|
642
|
+
if os.path.islink(os.path.normpath(path)):
|
|
643
|
+
raise self.TrainerInitializationException(
|
|
644
|
+
'Refusing to use a symbolic link as a data path: {}'.format(path)
|
|
645
|
+
)
|
|
646
|
+
|
|
647
|
+
def _reject_symlinked_data_path(self):
|
|
648
|
+
self._reject_symlinked_path(self.data_directory)
|
|
649
|
+
self._reject_symlinked_path(self.data_path)
|
|
650
|
+
|
|
651
|
+
def _open_verified_directory_fd(self, path):
|
|
652
|
+
# O_NOFOLLOW makes this fail instead of dereferencing a symlink. The
|
|
653
|
+
# returned fd stays bound to this exact directory inode even if the
|
|
654
|
+
# path is later replaced, so dir_fd-relative ops can't be redirected.
|
|
655
|
+
try:
|
|
656
|
+
return os.open(path, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW)
|
|
657
|
+
except OSError as e:
|
|
658
|
+
raise self.TrainerInitializationException(
|
|
659
|
+
'Refusing to extract archive: unable to safely open {}: {}'.format(path, e)
|
|
660
|
+
) from e
|
|
661
|
+
|
|
614
662
|
def extract(self, file_path: str):
|
|
615
663
|
"""
|
|
616
664
|
Extract a tar file at the specified file path.
|
|
@@ -618,22 +666,28 @@ class UbuntuCorpusTrainer(CsvFileTrainer):
|
|
|
618
666
|
if not self.disable_progress:
|
|
619
667
|
print('Extracting {}'.format(file_path))
|
|
620
668
|
|
|
621
|
-
|
|
622
|
-
raise self.TrainerInitializationException(
|
|
623
|
-
'Refusing to extract archive to a symbolic link: {}'.format(self.data_path)
|
|
624
|
-
)
|
|
669
|
+
self._reject_symlinked_data_path()
|
|
625
670
|
|
|
626
|
-
if not os.path.exists(self.
|
|
627
|
-
|
|
671
|
+
if not os.path.exists(self.data_directory):
|
|
672
|
+
try:
|
|
673
|
+
os.makedirs(self.data_directory)
|
|
674
|
+
except FileExistsError as e:
|
|
675
|
+
raise self.TrainerInitializationException(
|
|
676
|
+
'Unable to create data directory {}: {}'.format(self.data_directory, e)
|
|
677
|
+
) from e
|
|
628
678
|
|
|
629
679
|
def is_within_directory(directory, target):
|
|
630
680
|
|
|
631
681
|
abs_directory = os.path.realpath(directory)
|
|
632
682
|
abs_target = os.path.realpath(target)
|
|
633
683
|
|
|
634
|
-
|
|
684
|
+
try:
|
|
685
|
+
common_path = os.path.commonpath([abs_directory, abs_target])
|
|
686
|
+
except ValueError:
|
|
687
|
+
# Raised when paths don't share a common root (e.g. different drives)
|
|
688
|
+
return False
|
|
635
689
|
|
|
636
|
-
return
|
|
690
|
+
return common_path == abs_directory
|
|
637
691
|
|
|
638
692
|
def safe_extract(tar, path='.', members=None, *, numeric_owner=False):
|
|
639
693
|
|
|
@@ -644,15 +698,78 @@ class UbuntuCorpusTrainer(CsvFileTrainer):
|
|
|
644
698
|
if not is_within_directory(path, member_path):
|
|
645
699
|
raise Exception('Attempted Path Traversal in Tar File')
|
|
646
700
|
|
|
647
|
-
|
|
701
|
+
extract_kwargs = {}
|
|
702
|
+
if hasattr(tarfile, 'data_filter'):
|
|
703
|
+
# Belt-and-suspenders: also apply the standard library's own
|
|
704
|
+
# vetted extraction filter (PEP 706) alongside the checks above.
|
|
705
|
+
extract_kwargs['filter'] = 'data'
|
|
706
|
+
|
|
707
|
+
tar.extractall(path, members, numeric_owner=numeric_owner, **extract_kwargs)
|
|
708
|
+
|
|
709
|
+
# Extract into an unpredictably-named staging directory rather than
|
|
710
|
+
# data_path directly, then commit it into place with a single atomic
|
|
711
|
+
# rename. extractall() writes members one at a time, so checking
|
|
712
|
+
# data_path once up front leaves a window for an attacker to swap it
|
|
713
|
+
# for a symlink mid-extraction. Renaming a directory onto an existing
|
|
714
|
+
# symlink fails closed with ENOTDIR instead of writing through it, so
|
|
715
|
+
# no window remains at the point the data actually lands at data_path.
|
|
716
|
+
#
|
|
717
|
+
# Where supported, the mkdir, the extraction writes, and the final
|
|
718
|
+
# rename are all additionally anchored to a directory fd opened with
|
|
719
|
+
# O_NOFOLLOW, via dir_fd for mkdir/rename and via the /proc/self/fd/N
|
|
720
|
+
# magic path for the archive writes themselves (tarfile has no dir_fd
|
|
721
|
+
# support of its own, and will happily recreate a missing destination
|
|
722
|
+
# through a symlink planted over data_directory if given a plain
|
|
723
|
+
# path). Anchoring only the mkdir/rename and not the archive writes
|
|
724
|
+
# would be worse than not anchoring at all: it would silently leave
|
|
725
|
+
# the real destination empty while extracting through the symlink.
|
|
726
|
+
base_fd = None
|
|
727
|
+
extraction_root = self.data_directory
|
|
728
|
+
if _DIR_FD_EXTRACTION_SUPPORTED:
|
|
729
|
+
base_fd = self._open_verified_directory_fd(self.data_directory)
|
|
730
|
+
extraction_root = '/proc/self/fd/{}'.format(base_fd)
|
|
731
|
+
|
|
732
|
+
staging_name = 'tmp_' + secrets.token_hex(8)
|
|
733
|
+
staging_dir = os.path.join(extraction_root, staging_name)
|
|
648
734
|
|
|
649
735
|
try:
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
736
|
+
try:
|
|
737
|
+
if base_fd is not None:
|
|
738
|
+
os.mkdir(staging_name, dir_fd=base_fd)
|
|
739
|
+
else:
|
|
740
|
+
os.mkdir(staging_dir)
|
|
741
|
+
except OSError as e:
|
|
742
|
+
raise self.TrainerInitializationException(
|
|
743
|
+
'Unable to create a staging directory for extraction: {}'.format(e)
|
|
744
|
+
) from e
|
|
745
|
+
|
|
746
|
+
try:
|
|
747
|
+
with tarfile.open(file_path, 'r') as tar:
|
|
748
|
+
safe_extract(tar, path=staging_dir, members=tqdm(tar, disable=self.disable_progress))
|
|
749
|
+
except tarfile.ReadError as e:
|
|
750
|
+
raise self.TrainerInitializationException(
|
|
751
|
+
f'The provided data file is not a valid tar file: {file_path}'
|
|
752
|
+
) from e
|
|
753
|
+
|
|
754
|
+
# Re-check immediately before the commit to narrow the race window further
|
|
755
|
+
self._reject_symlinked_data_path()
|
|
756
|
+
|
|
757
|
+
final_name = os.path.basename(self.data_path)
|
|
758
|
+
try:
|
|
759
|
+
if base_fd is not None:
|
|
760
|
+
os.rename(staging_name, final_name, src_dir_fd=base_fd, dst_dir_fd=base_fd)
|
|
761
|
+
else:
|
|
762
|
+
os.rename(staging_dir, self.data_path)
|
|
763
|
+
except OSError as e:
|
|
764
|
+
raise self.TrainerInitializationException(
|
|
765
|
+
'Refusing to commit extracted archive to {}: {}'.format(self.data_path, e)
|
|
766
|
+
) from e
|
|
767
|
+
except BaseException:
|
|
768
|
+
shutil.rmtree(staging_dir, ignore_errors=True)
|
|
769
|
+
raise
|
|
770
|
+
finally:
|
|
771
|
+
if base_fd is not None:
|
|
772
|
+
os.close(base_fd)
|
|
656
773
|
|
|
657
774
|
self.chatbot.logger.info('File extracted to {}'.format(self.data_path))
|
|
658
775
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0001_initial.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/0009_tags.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{chatterbot-1.2.14 → chatterbot-1.2.15}/chatterbot/ext/django_chatterbot/migrations/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|