dao-scripts 1.4.6__tar.gz → 1.5.1__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.
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/CHANGELOG.md +6 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/PKG-INFO +1 -1
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/dao_scripts.egg-info/PKG-INFO +1 -1
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/_version.py +2 -2
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/common/blockscout.py +1 -1
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/common/thegraph.py +36 -2
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/daohaus/runner.py +1 -1
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/metadata.py +1 -1
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/utils/uploadDataWarehouse.py +1 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/.envrc +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/.github/workflows/ci.yml +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/.github/workflows/update-datasets.yml +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/.gitignore +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/LICENSE +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/README.md +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/dao_scripts.egg-info/SOURCES.txt +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/dao_scripts.egg-info/dependency_links.txt +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/dao_scripts.egg-info/entry_points.txt +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/dao_scripts.egg-info/namespace_packages.txt +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/dao_scripts.egg-info/requires.txt +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/dao_scripts.egg-info/top_level.txt +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/pyproject.toml +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/setup.cfg +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/setup.py +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/__init__.py +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/__main__.py +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/aragon/__init__.py +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/aragon/dao_names.json +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/aragon/runner.py +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/argparser.py +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/common/__init__.py +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/common/api_requester.py +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/common/common.py +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/common/cryptocompare.py +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/config.py +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/daohaus/__init__.py +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/daostack/__init__.py +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/daostack/runner.py +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/endpoints.json +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/logging.py +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/main.py +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/src/utils/__init__.py +0 -0
- {dao_scripts-1.4.6 → dao_scripts-1.5.1}/test/test_placeholder.py +0 -0
@@ -1,6 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## 1.5.1 - 2024-06-05
|
5
|
+
- Multiple small bugfixes
|
6
|
+
|
7
|
+
## 1.5.0 - 2024-06-04
|
8
|
+
- Avoid errors when no new data is available
|
9
|
+
|
4
10
|
## 1.4.1 - 2024-06-03
|
5
11
|
- Added debug logging to `dao-utils-upload-dw`
|
6
12
|
|
@@ -44,7 +44,7 @@ class BlockscoutBallancesCollector(NetworkCollector):
|
|
44
44
|
def endpoint(self) -> str:
|
45
45
|
return ENDPOINTS[self.network]['blockscout']
|
46
46
|
|
47
|
-
def _get_from_address(self, addr: str, retry: int = 0, maxretries: int =
|
47
|
+
def _get_from_address(self, addr: str, retry: int = 0, maxretries: int = 5, block: Union[int, Block, None] = None, ignore_errors=False) -> pd.DataFrame: # noqa: C901
|
48
48
|
if retry >= maxretries:
|
49
49
|
raise ValueError(f"Too many retries {retry}/{maxretries}")
|
50
50
|
|
@@ -2,6 +2,7 @@ from typing import Optional, Callable, Any
|
|
2
2
|
from abc import ABC, abstractmethod
|
3
3
|
|
4
4
|
from gql.dsl import DSLField
|
5
|
+
from graphql.language import visit, Visitor
|
5
6
|
|
6
7
|
import pandas as pd
|
7
8
|
|
@@ -32,6 +33,34 @@ def partial_query(q: Callable[..., DSLField], w: dict[str, Any]) -> Callable[...
|
|
32
33
|
return q(**add_where(kwargs, **w))
|
33
34
|
return wrapper
|
34
35
|
|
36
|
+
class ColumnsVisitor(Visitor):
|
37
|
+
def __init__(self):
|
38
|
+
super().__init__()
|
39
|
+
self.columns = []
|
40
|
+
self._bases = []
|
41
|
+
|
42
|
+
def enter_field(self, node, *args):
|
43
|
+
self._bases.append(node)
|
44
|
+
|
45
|
+
def leave_field(self, node, *args):
|
46
|
+
self._bases.pop()
|
47
|
+
|
48
|
+
def leave_selection_set(self, node, *_args):
|
49
|
+
base = ".".join([x.name.value for x in self._bases])
|
50
|
+
for s in node.selections:
|
51
|
+
# Skip non-leaf nodes
|
52
|
+
if s.selection_set:
|
53
|
+
continue
|
54
|
+
name = s.name.value
|
55
|
+
fullname = ".".join([base, name]) if base else name
|
56
|
+
self.columns.append(fullname)
|
57
|
+
|
58
|
+
def get_columns_from_query(q: DSLField) -> list[str]:
|
59
|
+
c = ColumnsVisitor()
|
60
|
+
# We use selection_set directly to avoid putting the name of the query
|
61
|
+
# i.e: returning id instead of moloches.id
|
62
|
+
visit(q.ast_field.selection_set, c)
|
63
|
+
return c.columns
|
35
64
|
|
36
65
|
class TheGraphCollector(NetworkCollector, UpdatableCollector, ABC):
|
37
66
|
def __init__(
|
@@ -83,7 +112,13 @@ class TheGraphCollector(NetworkCollector, UpdatableCollector, ABC):
|
|
83
112
|
return df
|
84
113
|
|
85
114
|
def transform_to_df(self, data: list[dict[str, Any]], skip_post: bool=False) -> pd.DataFrame:
|
86
|
-
|
115
|
+
if data:
|
116
|
+
df = pd.DataFrame.from_dict(pd.json_normalize(data))
|
117
|
+
else:
|
118
|
+
df = pd.DataFrame(columns=get_columns_from_query(self.query()))
|
119
|
+
|
120
|
+
if (s1 := set(df.columns)) != (s2 := set(get_columns_from_query(self.query()))):
|
121
|
+
raise ValueError(f"Received columns are not the expected columns: {s1} != {s2}")
|
87
122
|
|
88
123
|
# For compatibility reasons we change from . to snake case
|
89
124
|
def dotsToSnakeCase(str: str) -> str:
|
@@ -165,7 +200,6 @@ class TheGraphCollector(NetworkCollector, UpdatableCollector, ABC):
|
|
165
200
|
self.logger.error('Subgraph has indexing errors')
|
166
201
|
return False
|
167
202
|
|
168
|
-
# TODO: Save the block info to use it later in run
|
169
203
|
self._indexer_block = Block(r['block'])
|
170
204
|
|
171
205
|
if not check_deployment:
|
@@ -156,7 +156,7 @@ class TokenBalancesCollector(TheGraphCollector):
|
|
156
156
|
def coalesce_bank_type(df: pd.DataFrame) -> pd.DataFrame:
|
157
157
|
bank_idx = ['guildBank', 'memberBank', 'ecrowBank']
|
158
158
|
|
159
|
-
df['bank'] = df[bank_idx].idxmax(1)
|
159
|
+
df['bank'] = df[bank_idx].idxmax(1).astype(str)
|
160
160
|
df['bank'] = df['bank'].str.lower()
|
161
161
|
df['bank'] = df['bank'].str.replace('bank', '')
|
162
162
|
df = df.drop(columns=bank_idx)
|
@@ -25,7 +25,7 @@ class Block:
|
|
25
25
|
self.number = int(init["number"]) if "number" in init else self.number
|
26
26
|
self.id = init["id"] if "id" in init else self.id
|
27
27
|
|
28
|
-
if "timestamp"
|
28
|
+
if init.get("timestamp", None):
|
29
29
|
if isinstance(init['timestamp'], int) or init["timestamp"].isdigit():
|
30
30
|
self.timestamp = datetime.fromtimestamp(int(init["timestamp"]))
|
31
31
|
else:
|
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
|