litequant 3.0.1__tar.gz → 3.0.2__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.
- {litequant-3.0.1 → litequant-3.0.2}/LiteQuantClient.py +13 -3
- {litequant-3.0.1 → litequant-3.0.2}/PKG-INFO +1 -1
- {litequant-3.0.1 → litequant-3.0.2}/__init__.py +1 -1
- {litequant-3.0.1 → litequant-3.0.2}/pyproject.toml +1 -1
- {litequant-3.0.1 → litequant-3.0.2}/LICENSE +0 -0
- {litequant-3.0.1 → litequant-3.0.2}/MANIFEST.in +0 -0
- {litequant-3.0.1 → litequant-3.0.2}/ParquetManager.py +0 -0
- {litequant-3.0.1 → litequant-3.0.2}/README.md +0 -0
- {litequant-3.0.1 → litequant-3.0.2}/exceptions.py +0 -0
- {litequant-3.0.1 → litequant-3.0.2}/litequant.egg-info/SOURCES.txt +0 -0
- {litequant-3.0.1 → litequant-3.0.2}/log.py +0 -0
- {litequant-3.0.1 → litequant-3.0.2}/setup.cfg +0 -0
|
@@ -29,6 +29,7 @@ import io
|
|
|
29
29
|
import json
|
|
30
30
|
import logging
|
|
31
31
|
import os
|
|
32
|
+
import fnmatch
|
|
32
33
|
import time
|
|
33
34
|
import threading
|
|
34
35
|
from typing import Any, Dict, List, Optional, Literal
|
|
@@ -75,6 +76,7 @@ class DataTicket:
|
|
|
75
76
|
expires_at: datetime
|
|
76
77
|
datasets: List[str]
|
|
77
78
|
key_patterns: List[str]
|
|
79
|
+
category_patterns: Optional[List[str]] = None
|
|
78
80
|
redis_username: Optional[str] = None
|
|
79
81
|
redis_ssl: bool = False
|
|
80
82
|
|
|
@@ -312,7 +314,7 @@ class LiteQuantClient:
|
|
|
312
314
|
try:
|
|
313
315
|
data = self._api_post_json(
|
|
314
316
|
"/api/v1/data/ticket/",
|
|
315
|
-
{"client_version": "3.0.
|
|
317
|
+
{"client_version": "3.0.2"},
|
|
316
318
|
timeout=30,
|
|
317
319
|
)
|
|
318
320
|
|
|
@@ -330,6 +332,7 @@ class LiteQuantClient:
|
|
|
330
332
|
expires_at=datetime.now() + timedelta(seconds=data["expires_in"]),
|
|
331
333
|
datasets=scope.get("datasets", []),
|
|
332
334
|
key_patterns=scope.get("key_patterns", []),
|
|
335
|
+
category_patterns=scope.get("category_patterns", []),
|
|
333
336
|
redis_username=redis_username,
|
|
334
337
|
redis_ssl=redis_ssl,
|
|
335
338
|
)
|
|
@@ -650,13 +653,20 @@ class LiteQuantClient:
|
|
|
650
653
|
all_categories = [str(x) for x in categories]
|
|
651
654
|
|
|
652
655
|
# 过滤:只保留授权数据集的类别
|
|
653
|
-
if self._ticket and self._ticket.
|
|
656
|
+
if self._ticket and self._ticket.category_patterns:
|
|
657
|
+
authorized_patterns = [str(x) for x in self._ticket.category_patterns]
|
|
658
|
+
filtered_categories = [
|
|
659
|
+
cat for cat in all_categories
|
|
660
|
+
if any(fnmatch.fnmatchcase(cat, pattern) for pattern in authorized_patterns)
|
|
661
|
+
]
|
|
662
|
+
self.logger.debug("??????: %s -> %s", len(all_categories), len(filtered_categories))
|
|
663
|
+
elif self._ticket and self._ticket.datasets:
|
|
654
664
|
authorized_datasets = set(self._ticket.datasets)
|
|
655
665
|
filtered_categories = [
|
|
656
666
|
cat for cat in all_categories
|
|
657
667
|
if any(cat.startswith(f"{ds}#") for ds in authorized_datasets)
|
|
658
668
|
]
|
|
659
|
-
self.logger.debug("
|
|
669
|
+
self.logger.debug("??????: %s -> %s", len(all_categories), len(filtered_categories))
|
|
660
670
|
else:
|
|
661
671
|
filtered_categories = all_categories
|
|
662
672
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|