-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit b317169 Author: Håkon V. Treider <[email protected]> Date: Tue Oct 4 01:46:43 2022 +0200 Dps Fetch Refactor #5: New dps fetch code (#1043) * New dps fetch code * typos and tweaks * Update cognite/client/_api/datapoint_tasks.py * forgot self arg... * Fix insertion of DatapointsArray * Make dps retrieve method kwargs only * fstring fix * Fix to avoid float dtype for count agg commit 4e673cb Author: Håkon V. Treider <[email protected]> Date: Tue Oct 4 01:43:13 2022 +0200 Dps Fetch Refactor #9: Unit tests, added, fixed and improved. (#1047) * Unit tests, added, fixed and improved. * add test for split_into_n_parts and find_duplicates commit 8099cb3 Author: Håkon V. Treider <[email protected]> Date: Tue Oct 4 01:42:49 2022 +0200 Integration tests, added, fixed and improved (#1048) commit a049ec4 Author: Håkon V. Treider <[email protected]> Date: Tue Oct 4 01:42:30 2022 +0200 Dps Fetch Refactor #11: Readme, docs and changelog (#1049) * Readme, docs and changelog * Improve changelog * Changelog almost done * Mooooooare changelog details * Apply 12 spell check suggestions from code review * Reword the note about `include_aggregate_name` * Update CHANGELOG.md commit e74699e Author: Håkon V. Treider <[email protected]> Date: Tue Oct 4 00:21:33 2022 +0200 Dps Fetch Refactor #12: Fix `ms_to_datetime` on windows (#1056) * Fix ms_to_datetime for windows * make single ms_to_datetime impl. work on all OSs. remove removed warnings from filterwarnings commit 59aace9 Author: Håkon V. Treider <[email protected]> Date: Tue Oct 4 00:11:57 2022 +0200 Dps Fetch Refactor #6: Add array-based data classes. Change camel case defaults (#1044) * Add array-based data classes. Change camel case defaults * No copy in df constructor from numpy arrays yields another 100 x * Update cognite/client/data_classes/datapoints.py * Update cognite/client/data_classes/datapoints.py * remove unnecessary list conv * Remove _strip_aggregate_names entirely commit f0b0525 Author: Håkon V. Treider <[email protected]> Date: Fri Sep 30 14:04:31 2022 +0200 Dps Fetch Refactor #7: Extend utils with new functionality (#1045) * Extend utils with new functionality * add hashable bound to type var commit c281ac0 Author: Håkon V. Treider <[email protected]> Date: Fri Sep 30 14:04:00 2022 +0200 Dps Fetch Refactor #3: Add ThreadPoolExecutor with PriorityQueue (#1041) * Add ThreadPoolExecutor with PriorityQueue * move mypy ignore flag to ini file commit 920cd84 Author: Håkon V. Treider <[email protected]> Date: Fri Sep 30 13:12:17 2022 +0200 Dps Fetch Refactor #2: Update dependencies and version. Run poetry lock (#1040) * Update dependencies and version. Run poetry lock * relax and tighten dep. reqs * Trim pandas version (no-op) commit f0a69d8 Merge: 6be4b44 7abd1c2 Author: Håkon V. Treider <[email protected]> Date: Thu Sep 29 02:22:23 2022 +0200 Merge branch 'master' into v5-release commit 7abd1c2 Author: Jaime Silva <[email protected]> Date: Wed Sep 28 03:55:39 2022 -0500 Rename alpha data models destination in transformations (#1050) * rename alpha data models to data models * version bump * unskip dms and jobs tests * show warning when using FDMs on transformations commit aa3f52b Author: tuanng-cognite <[email protected]> Date: Tue Sep 27 14:00:50 2022 +0200 geospatial aggregation to support output (#1032) * geospatial aggregation to support output * format * rename * fix deprecation message * improve example commit 6be4b44 Merge: 88c3877 98f5033 Author: Håkon V. Treider <[email protected]> Date: Tue Sep 27 03:06:22 2022 +0200 Merge branch 'master' into v5-release commit 88c3877 Author: Håkon V. Treider <[email protected]> Date: Tue Sep 27 03:04:20 2022 +0200 Cleanup of CogClient mock duplicates. Update with 20 missing APIs... (#1046) commit 9b30dba Author: Håkon V. Treider <[email protected]> Date: Tue Sep 27 02:48:55 2022 +0200 Move DatapointsAPI to time_series.data. Many minor fixups. Bump max_workers to 20. (#1042) commit 98f5033 Author: Håkon V. Treider <[email protected]> Date: Mon Sep 26 19:44:30 2022 +0200 Simplify github workflows. Minor project linting settings changes (#1039) * Simplify GitHub workflows. Minor project linting settings changes
- Loading branch information
Showing
62 changed files
with
5,756 additions
and
2,460 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
from datetime import datetime | ||
from typing import Dict, Iterable, List, Optional, TypedDict, Union | ||
|
||
try: | ||
import numpy as np | ||
import numpy.typing as npt | ||
|
||
NUMPY_IS_AVAILABLE = True | ||
except ImportError: # pragma no cover | ||
NUMPY_IS_AVAILABLE = False | ||
|
||
if NUMPY_IS_AVAILABLE: | ||
NumpyDatetime64NSArray = npt.NDArray[np.datetime64] | ||
NumpyInt64Array = npt.NDArray[np.int64] | ||
NumpyFloat64Array = npt.NDArray[np.float64] | ||
NumpyObjArray = npt.NDArray[np.object_] | ||
|
||
# Datapoints API-limits: | ||
DPS_LIMIT_AGG = 10_000 | ||
DPS_LIMIT = 100_000 | ||
POST_DPS_OBJECTS_LIMIT = 10_000 | ||
FETCH_TS_LIMIT = 100 | ||
RETRIEVE_LATEST_LIMIT = 100 | ||
|
||
|
||
ALL_SORTED_DP_AGGS = sorted( | ||
[ | ||
"average", | ||
"max", | ||
"min", | ||
"count", | ||
"sum", | ||
"interpolation", | ||
"step_interpolation", | ||
"continuous_variance", | ||
"discrete_variance", | ||
"total_variation", | ||
] | ||
) | ||
|
||
|
||
class CustomDatapointsQuery(TypedDict, total=False): | ||
# No field required | ||
start: Union[int, str, datetime, None] | ||
end: Union[int, str, datetime, None] | ||
aggregates: Optional[List[str]] | ||
granularity: Optional[str] | ||
limit: Optional[int] | ||
include_outside_points: Optional[bool] | ||
ignore_unknown_ids: Optional[bool] | ||
|
||
|
||
class DatapointsQueryId(CustomDatapointsQuery): | ||
id: int # required field | ||
|
||
|
||
class DatapointsQueryExternalId(CustomDatapointsQuery): | ||
external_id: str # required field | ||
|
||
|
||
class CustomDatapoints(TypedDict, total=False): | ||
# No field required | ||
start: int | ||
end: int | ||
aggregates: Optional[List[str]] | ||
granularity: Optional[str] | ||
limit: int | ||
include_outside_points: bool | ||
|
||
|
||
class DatapointsPayload(CustomDatapoints): | ||
items: List[CustomDatapoints] | ||
|
||
|
||
DatapointsTypes = Union[int, float, str] | ||
|
||
|
||
class DatapointsFromAPI(TypedDict): | ||
id: int | ||
externalId: Optional[str] | ||
isString: bool | ||
isStep: bool | ||
datapoints: List[Dict[str, DatapointsTypes]] | ||
|
||
|
||
DatapointsIdTypes = Union[int, DatapointsQueryId, Iterable[Union[int, DatapointsQueryId]]] | ||
DatapointsExternalIdTypes = Union[str, DatapointsQueryExternalId, Iterable[Union[str, DatapointsQueryExternalId]]] |
Oops, something went wrong.