Skip to content

Commit 99095de

Browse files
authored
Merge branch 'main' into sqlbox
2 parents e27d62e + 8fc0dd7 commit 99095de

File tree

60 files changed

+410
-1150
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+410
-1150
lines changed

components/clp-py-utils/clp_py_utils/compression.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,12 @@
33

44
import Levenshtein
55

6+
from clp_py_utils.core import FileMetadata
7+
68
# Constants
79
FILE_GROUPING_MIN_LEVENSHTEIN_RATIO = 0.6
810

911

10-
class FileMetadata:
11-
__slots__ = ("path", "size", "estimated_uncompressed_size")
12-
13-
def __init__(self, path: pathlib.Path, size: int):
14-
self.path = path
15-
self.size = size
16-
self.estimated_uncompressed_size = size
17-
18-
filename = path.name
19-
if any(filename.endswith(extension) for extension in [".gz", ".gzip", ".tgz", ".tar.gz"]):
20-
self.estimated_uncompressed_size *= 13
21-
elif any(
22-
filename.endswith(extension)
23-
for extension in [".zstd", ".zstandard", ".tar.zstd", ".tar.zstandard"]
24-
):
25-
self.estimated_uncompressed_size *= 8
26-
27-
2812
class FilesPartition:
2913
def __init__(self):
3014
self.__files = []

components/clp-py-utils/clp_py_utils/core.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@
44
from yaml.parser import ParserError
55

66

7+
class FileMetadata:
8+
__slots__ = ("path", "size", "estimated_uncompressed_size")
9+
10+
def __init__(self, path: pathlib.Path, size: int):
11+
self.path = path
12+
self.size = size
13+
self.estimated_uncompressed_size = size
14+
15+
filename = path.name
16+
if any(filename.endswith(extension) for extension in [".gz", ".gzip", ".tgz", ".tar.gz"]):
17+
self.estimated_uncompressed_size *= 13
18+
elif any(
19+
filename.endswith(extension)
20+
for extension in [".zstd", ".zstandard", ".tar.zstd", ".tar.zstandard"]
21+
):
22+
self.estimated_uncompressed_size *= 8
23+
24+
725
def get_config_value(config, key):
826
"""
927
Gets a value from the given dictionary using a dot-separated configuration

components/clp-py-utils/clp_py_utils/s3_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
StorageType,
2323
WEBUI_COMPONENT_NAME,
2424
)
25-
from clp_py_utils.compression import FileMetadata
25+
from clp_py_utils.core import FileMetadata
2626

2727
# Constants
2828
AWS_ENDPOINT = "amazonaws.com"

components/core/cmake/Options/options.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ endfunction()
198198

199199
function(validate_clp_s_archivereader_dependencies)
200200
validate_clp_dependencies_for_target(CLP_BUILD_CLP_S_ARCHIVEREADER
201+
CLP_BUILD_CLP_STRING_UTILS
201202
CLP_BUILD_CLP_S_CLP_DEPENDENCIES
202203
CLP_BUILD_CLP_S_IO
203204
CLP_BUILD_CLP_S_TIMESTAMPPATTERN
@@ -300,6 +301,7 @@ endfunction()
300301

301302
function(validate_clp_s_search_dependencies)
302303
validate_clp_dependencies_for_target(CLP_BUILD_CLP_S_SEARCH
304+
CLP_BUILD_CLP_STRING_UTILS
303305
CLP_BUILD_CLP_S_ARCHIVEREADER
304306
CLP_BUILD_CLP_S_CLP_DEPENDENCIES
305307
CLP_BUILD_CLP_S_SEARCH_AST

components/core/src/clp/SQLitePreparedStatement.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef CLP_SQLITEPREPAREDSTATEMENT_HPP
22
#define CLP_SQLITEPREPAREDSTATEMENT_HPP
33

4+
#include <cstdint>
45
#include <string>
56

67
#include <sqlite3/sqlite3.h>

components/core/src/clp_s/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ if(CLP_BUILD_CLP_S_ARCHIVEREADER)
302302
clp_s_archive_reader
303303
PUBLIC
304304
absl::flat_hash_map
305+
clp::string_utils
305306
clp_s::io
306307
msgpack-cxx
307308
nlohmann_json::nlohmann_json

components/core/src/clp_s/DictionaryReader.hpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <unordered_set>
77

88
#include <boost/algorithm/string/case_conv.hpp>
9+
#include <string_utils/string_utils.hpp>
910

1011
#include "ArchiveReaderAdaptor.hpp"
1112
#include "DictionaryEntry.hpp"
@@ -191,7 +192,12 @@ void DictionaryReader<DictionaryIdType, EntryType>::get_entries_matching_wildcar
191192
std::unordered_set<EntryType const*>& entries
192193
) const {
193194
for (auto const& entry : m_entries) {
194-
if (StringUtils::wildcard_match_unsafe(entry.get_value(), wildcard_string, !ignore_case)) {
195+
if (clp::string_utils::wildcard_match_unsafe(
196+
entry.get_value(),
197+
wildcard_string,
198+
!ignore_case
199+
))
200+
{
195201
entries.insert(&entry);
196202
}
197203
}

0 commit comments

Comments
 (0)