garf-core 0.0.3__tar.gz → 0.0.5__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.
- {garf_core-0.0.3 → garf_core-0.0.5}/PKG-INFO +2 -2
- garf_core-0.0.5/garf_core/__init__.py +15 -0
- {garf_core-0.0.3 → garf_core-0.0.5}/garf_core/parsers.py +20 -1
- {garf_core-0.0.3 → garf_core-0.0.5}/garf_core/report.py +2 -2
- {garf_core-0.0.3 → garf_core-0.0.5}/garf_core.egg-info/PKG-INFO +2 -2
- {garf_core-0.0.3 → garf_core-0.0.5}/pyproject.toml +4 -1
- garf_core-0.0.3/garf_core/__init__.py +0 -0
- {garf_core-0.0.3 → garf_core-0.0.5}/README.md +0 -0
- {garf_core-0.0.3 → garf_core-0.0.5}/garf_core/api_clients.py +0 -0
- {garf_core-0.0.3 → garf_core-0.0.5}/garf_core/base_query.py +0 -0
- {garf_core-0.0.3 → garf_core-0.0.5}/garf_core/exceptions.py +0 -0
- {garf_core-0.0.3 → garf_core-0.0.5}/garf_core/query_editor.py +0 -0
- {garf_core-0.0.3 → garf_core-0.0.5}/garf_core/report_fetcher.py +0 -0
- {garf_core-0.0.3 → garf_core-0.0.5}/garf_core.egg-info/SOURCES.txt +0 -0
- {garf_core-0.0.3 → garf_core-0.0.5}/garf_core.egg-info/dependency_links.txt +0 -0
- {garf_core-0.0.3 → garf_core-0.0.5}/garf_core.egg-info/requires.txt +0 -0
- {garf_core-0.0.3 → garf_core-0.0.5}/garf_core.egg-info/top_level.txt +0 -0
- {garf_core-0.0.3 → garf_core-0.0.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.2
|
2
2
|
Name: garf-core
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.5
|
4
4
|
Summary: Abstracts fetching data from API based on provided SQL-like query.
|
5
5
|
Author-email: "Google Inc. (gTech gPS CSE team)" <no-reply@google.com>
|
6
6
|
License: Apache 2.0
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Copyright 2025 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
__version__ = '0.0.5'
|
@@ -20,9 +20,10 @@ strategies to each element of the row.
|
|
20
20
|
from __future__ import annotations
|
21
21
|
|
22
22
|
import abc
|
23
|
+
import contextlib
|
23
24
|
import functools
|
24
25
|
import operator
|
25
|
-
from collections.abc import Mapping
|
26
|
+
from collections.abc import Mapping, MutableSequence
|
26
27
|
from typing import Union
|
27
28
|
|
28
29
|
from typing_extensions import TypeAlias, override
|
@@ -78,5 +79,23 @@ class DictParser(BaseParser):
|
|
78
79
|
return None
|
79
80
|
|
80
81
|
|
82
|
+
class NumericConverterDictParser(DictParser):
|
83
|
+
def get_nested_field(self, dictionary, key):
|
84
|
+
def convert_field(value):
|
85
|
+
for type_ in (int, float):
|
86
|
+
with contextlib.suppress(ValueError):
|
87
|
+
return type_(value)
|
88
|
+
return value
|
89
|
+
|
90
|
+
key = key.split('.')
|
91
|
+
try:
|
92
|
+
field = functools.reduce(operator.getitem, key, dictionary)
|
93
|
+
if isinstance(field, MutableSequence) or field in (True, False):
|
94
|
+
return field
|
95
|
+
return convert_field(field)
|
96
|
+
except KeyError:
|
97
|
+
return None
|
98
|
+
|
99
|
+
|
81
100
|
class GarfParserError(exceptions.GarfError):
|
82
101
|
"""Incorrect data format for parser."""
|
@@ -176,9 +176,9 @@ class GarfReport:
|
|
176
176
|
if value_column_output == 'list':
|
177
177
|
output[key].append(value)
|
178
178
|
else:
|
179
|
-
if key
|
179
|
+
if output.get(key) and output.get(key) != value:
|
180
180
|
raise GarfReportError(
|
181
|
-
f'Non unique values found for key_column: {
|
181
|
+
f'Non unique values found for key_column: {key_column}'
|
182
182
|
)
|
183
183
|
output[key] = value
|
184
184
|
return output
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.2
|
2
2
|
Name: garf-core
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.5
|
4
4
|
Summary: Abstracts fetching data from API based on provided SQL-like query.
|
5
5
|
Author-email: "Google Inc. (gTech gPS CSE team)" <no-reply@google.com>
|
6
6
|
License: Apache 2.0
|
@@ -4,7 +4,6 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "garf-core"
|
7
|
-
version = "0.0.3"
|
8
7
|
dependencies = [
|
9
8
|
"python-dateutil",
|
10
9
|
"jinja2==3.1.4",
|
@@ -29,6 +28,10 @@ classifiers = [
|
|
29
28
|
"Operating System :: OS Independent",
|
30
29
|
"License :: OSI Approved :: Apache Software License",
|
31
30
|
]
|
31
|
+
dynamic=["version"]
|
32
|
+
|
33
|
+
[tool.setuptools.dynamic]
|
34
|
+
version = {attr = "garf_core.__version__"}
|
32
35
|
|
33
36
|
[project.optional-dependencies]
|
34
37
|
pandas=[
|
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
|