syncmodels 0.1.322__py2.py3-none-any.whl → 0.1.324__py2.py3-none-any.whl
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.
- syncmodels/__init__.py +1 -1
- syncmodels/crawler.py +39 -30
- syncmodels/crud.py +1 -1
- syncmodels/session/sql.py +1 -1
- syncmodels/storage.py +9 -6
- {syncmodels-0.1.322.dist-info → syncmodels-0.1.324.dist-info}/METADATA +2 -2
- {syncmodels-0.1.322.dist-info → syncmodels-0.1.324.dist-info}/RECORD +12 -12
- {syncmodels-0.1.322.dist-info → syncmodels-0.1.324.dist-info}/AUTHORS.rst +0 -0
- {syncmodels-0.1.322.dist-info → syncmodels-0.1.324.dist-info}/LICENSE +0 -0
- {syncmodels-0.1.322.dist-info → syncmodels-0.1.324.dist-info}/WHEEL +0 -0
- {syncmodels-0.1.322.dist-info → syncmodels-0.1.324.dist-info}/entry_points.txt +0 -0
- {syncmodels-0.1.322.dist-info → syncmodels-0.1.324.dist-info}/top_level.txt +0 -0
syncmodels/__init__.py
CHANGED
syncmodels/crawler.py
CHANGED
@@ -763,7 +763,7 @@ class iBot(iAgent):
|
|
763
763
|
# TODO: agp: generalize and provide a better way to save activity records
|
764
764
|
|
765
765
|
notify = 0
|
766
|
-
t0 = time.time()
|
766
|
+
# t0 = time.time()
|
767
767
|
N = len(self.plugins)
|
768
768
|
for i, plugin in enumerate(self.plugins):
|
769
769
|
t1 = time.time()
|
@@ -779,7 +779,7 @@ class iBot(iAgent):
|
|
779
779
|
except Exception as why:
|
780
780
|
log.error(why)
|
781
781
|
log.error("".join(traceback.format_exception(*sys.exc_info())))
|
782
|
-
foo = 1
|
782
|
+
# foo = 1
|
783
783
|
elapsed = time.time() - t1
|
784
784
|
notify -= elapsed
|
785
785
|
if notify <= 0:
|
@@ -1927,6 +1927,7 @@ class MetaExtractPlugin(iPlugin):
|
|
1927
1927
|
"""
|
1928
1928
|
|
1929
1929
|
SCORE = 1000 # before NormalizePlugin
|
1930
|
+
USED_GEO = set()
|
1930
1931
|
|
1931
1932
|
def __init__(self, geojson=True, **kw):
|
1932
1933
|
super().__init__(**kw)
|
@@ -1950,6 +1951,9 @@ class MetaExtractPlugin(iPlugin):
|
|
1950
1951
|
# of the value of the item data
|
1951
1952
|
# this will provent mistakes of assuming that each geojson
|
1952
1953
|
# relate to the same fquid changs within the stream live
|
1954
|
+
|
1955
|
+
# Note: we use this geoid to check if different geo objects are different
|
1956
|
+
# Note: can be commended in the future
|
1953
1957
|
geoids = dict()
|
1954
1958
|
|
1955
1959
|
# -------------------------------------------------
|
@@ -1974,35 +1978,40 @@ class MetaExtractPlugin(iPlugin):
|
|
1974
1978
|
# maybe in the future for some EndPoints
|
1975
1979
|
# that we trust, this restriction can be relaxed
|
1976
1980
|
if fquid: # fquid not in geoids:
|
1977
|
-
#
|
1978
|
-
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
1982
|
-
|
1983
|
-
|
1984
|
-
|
1985
|
-
|
1986
|
-
|
1987
|
-
|
1988
|
-
|
1981
|
+
# discard geo info that has been already saved in Storage
|
1982
|
+
blueprint = hashlib.md5(fquid.encode("utf-8")).digest()
|
1983
|
+
if blueprint not in self.USED_GEO:
|
1984
|
+
# TODO: use a new dict (item) and kind
|
1985
|
+
# TODO: or share same dict (data) and provide multiples { id, kind }
|
1986
|
+
# TODO: letting pydantic takes only the data needed for each kind/mapper
|
1987
|
+
|
1988
|
+
# Note: we `stich` all items belongs to the same wave
|
1989
|
+
# Note: with the same monotonic value
|
1990
|
+
item = {
|
1991
|
+
**data,
|
1992
|
+
"id": fquid,
|
1993
|
+
KIND_KEY: kind,
|
1994
|
+
# MONOTONIC_KEY: monotonic, # not needed (data has)
|
1995
|
+
}
|
1996
|
+
|
1997
|
+
# add the related geojson item
|
1998
|
+
|
1999
|
+
holder = geoids.setdefault(fquid, [])
|
2000
|
+
if not holder:
|
2001
|
+
# only add
|
2002
|
+
# stream.insert(0, item)
|
2003
|
+
stream.append(item)
|
2004
|
+
|
2005
|
+
# don't trust the EndPoint and check geojson
|
2006
|
+
# related to the same fquid
|
2007
|
+
_new = item[GEOJSON_KEY]
|
2008
|
+
for _existing in holder:
|
2009
|
+
assert (
|
2010
|
+
_new == _existing
|
2011
|
+
), f"GeoJSON related to {fquid} doesn't match, you need to review fqui and geojson association"
|
2012
|
+
holder.append(_new)
|
1989
2013
|
|
1990
|
-
|
1991
|
-
|
1992
|
-
holder = geoids.setdefault(fquid, [])
|
1993
|
-
if not holder:
|
1994
|
-
# only add
|
1995
|
-
# stream.insert(0, item)
|
1996
|
-
stream.append(item)
|
1997
|
-
|
1998
|
-
# don't trust the EndPoint and check geojson
|
1999
|
-
# related to the same fquid
|
2000
|
-
_new = item[GEOJSON_KEY]
|
2001
|
-
for _existing in holder:
|
2002
|
-
assert (
|
2003
|
-
_new == _existing
|
2004
|
-
), f"GeoJSON related to {fquid} doesn't match, you need to review fqui and geojson association"
|
2005
|
-
holder.append(_new)
|
2014
|
+
self.USED_GEO.add(blueprint)
|
2006
2015
|
else:
|
2007
2016
|
log.error("can't build geo_uri from [%s]", data)
|
2008
2017
|
log.error(
|
syncmodels/crud.py
CHANGED
@@ -261,7 +261,7 @@ class iStorage(iCRUD):
|
|
261
261
|
f"/{_uri['_path']}" # force remove "id" and give back compability
|
262
262
|
)
|
263
263
|
table = build_uri(**_uri)
|
264
|
-
self._index_2_create
|
264
|
+
self._index_2_create.setdefault(table, set()).update(keys)
|
265
265
|
|
266
266
|
async def build_indexes(self):
|
267
267
|
"build the registered indexes"
|
syncmodels/session/sql.py
CHANGED
@@ -111,7 +111,7 @@ class iSQLSession(iSession):
|
|
111
111
|
|
112
112
|
since_key = params.get(MONOTONIC_SINCE_KEY)
|
113
113
|
table = context[KIND_KEY]
|
114
|
-
limit = params.get(LIMIT_KEY_VALUE, context.get(LIMIT_KEY_VALUE)) or
|
114
|
+
limit = params.get(LIMIT_KEY_VALUE, context.get(LIMIT_KEY_VALUE)) or 42
|
115
115
|
|
116
116
|
query = f"SELECT * FROM {table}"
|
117
117
|
if MONOTONIC_SINCE_VALUE in params:
|
syncmodels/storage.py
CHANGED
@@ -980,6 +980,9 @@ class WaveStorage(iWaves, iStorage):
|
|
980
980
|
ORG_KEY: uid,
|
981
981
|
**data_sort_blueprint, # implies sv = True
|
982
982
|
}
|
983
|
+
# requests index creation
|
984
|
+
self.register_index(uid, [ORG_KEY])
|
985
|
+
|
983
986
|
identical = await self.storage.query(
|
984
987
|
query,
|
985
988
|
**identical_bp,
|
@@ -1182,7 +1185,7 @@ class WaveStorage(iWaves, iStorage):
|
|
1182
1185
|
log.info("[%s] prevously_inserted took: %s secs", uid, elapsed)
|
1183
1186
|
else:
|
1184
1187
|
# hack for not altering the data
|
1185
|
-
|
1188
|
+
push = False
|
1186
1189
|
pass
|
1187
1190
|
|
1188
1191
|
# check if ORG_KEY could be formated wrong
|
@@ -1650,11 +1653,11 @@ class SurrealistStorage(Storage):
|
|
1650
1653
|
sufix = "_".join(columns)
|
1651
1654
|
keynames = ", ".join(columns)
|
1652
1655
|
# TODO: agp: comment these lines next week :)
|
1653
|
-
name = f"index_{table}_{sufix}"
|
1654
|
-
sql = f"REMOVE INDEX IF EXISTS {name} ON TABLE {table}"
|
1655
|
-
log.info("deleting index: [%s] on [%s]", name, keynames)
|
1656
|
-
res = connection.query(sql)
|
1657
|
-
log.info("result: [%s]", res)
|
1656
|
+
# name = f"index_{table}_{sufix}"
|
1657
|
+
# sql = f"REMOVE INDEX IF EXISTS {name} ON TABLE {table}"
|
1658
|
+
# log.info("deleting index: [%s] on [%s]", name, keynames)
|
1659
|
+
# res = connection.query(sql)
|
1660
|
+
# log.info("result: [%s]", res)
|
1658
1661
|
|
1659
1662
|
name = f"idx_{table}_{sufix}"
|
1660
1663
|
sql = f"DEFINE INDEX IF NOT EXISTS {name} ON TABLE {table} COLUMNS {keynames}"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: syncmodels
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.324
|
4
4
|
Summary: Synchronizable Models
|
5
5
|
Home-page: https://github.com/asterio.gonzalez/syncmodels
|
6
6
|
Author: Asterio Gonzalez
|
@@ -18,7 +18,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
18
18
|
Requires-Python: >=3.6
|
19
19
|
License-File: LICENSE
|
20
20
|
License-File: AUTHORS.rst
|
21
|
-
Requires-Dist: agptools>=0.1.
|
21
|
+
Requires-Dist: agptools>=0.1.324
|
22
22
|
Requires-Dist: aiocache
|
23
23
|
Requires-Dist: aiohttp
|
24
24
|
Requires-Dist: Click
|
@@ -1,7 +1,7 @@
|
|
1
|
-
syncmodels/__init__.py,sha256=
|
1
|
+
syncmodels/__init__.py,sha256=afw4_wa5FaFcdZ_w4hP1EVGiGoXhSRbq4dIM-6aVcP0,142
|
2
2
|
syncmodels/context.py,sha256=k1Gs_ip9BfyRFpyRnzqYvRDKo0sYBqJsh6z9sWln9oE,451
|
3
|
-
syncmodels/crawler.py,sha256=
|
4
|
-
syncmodels/crud.py,sha256=
|
3
|
+
syncmodels/crawler.py,sha256=_pgelyrIKuVl8vdINJ6NSh5qkSnZf4rAACph4SZ_2H4,95281
|
4
|
+
syncmodels/crud.py,sha256=oZIcwEKR2i-lesEF_059Y4yThohd9m7gs6R6xYgLH-I,15351
|
5
5
|
syncmodels/definitions.py,sha256=vQ6-Zsftzy5y02z6Dd3_p5cd37Zqk0lcVrv-06gnDZk,5475
|
6
6
|
syncmodels/exceptions.py,sha256=ZLAwu19cs2UN2Sv3jaLnixT_jRI7T42TfyutCkUsuIk,685
|
7
7
|
syncmodels/geofactory.py,sha256=1FkrdEn0QA0O4_lSUAwjqXH2dmlQWi32AkntnG4AEQY,10372
|
@@ -11,7 +11,7 @@ syncmodels/registry.py,sha256=YaQtgbSwa0je1MpCcVHALI3_b85vrddyOlhsnrUcKZs,8224
|
|
11
11
|
syncmodels/requests.py,sha256=wWoC5hPDm1iBM_zrlyKRauzhXgdKR3pT5RqyC-5UZhQ,538
|
12
12
|
syncmodels/runner.py,sha256=IHDKuQ3yJ1DN9wktMiIrerPepYX61tc3AzbFfuUqEFw,5454
|
13
13
|
syncmodels/schema.py,sha256=uinUt8Asq_x7xa6MKWVXNyoWO6gKocjGPppjimaXzEU,2492
|
14
|
-
syncmodels/storage.py,sha256=
|
14
|
+
syncmodels/storage.py,sha256=Q5P0Kuu0vPLJbgGMyfst_6t9k9lJkGtAy0blIbGDtLM,73905
|
15
15
|
syncmodels/syncmodels.py,sha256=jcUxVbv1hrx5hI81VCO1onIM6WyORTqJVPwIqlPocOc,10596
|
16
16
|
syncmodels/timequeue.py,sha256=YRd3ULRaIhoszaBsYhfr0epMqAbL6-NwVEtScjUYttM,595
|
17
17
|
syncmodels/wave.py,sha256=Gra22BLiA9z2nF-6diXpjAc4GZv9nebmyvHxdAfXec4,7764
|
@@ -299,13 +299,13 @@ syncmodels/model/schema_org/xpathtype.py,sha256=D8gKiCrGSSuUVYw7BIWmOIUbKATfv2Ip
|
|
299
299
|
syncmodels/session/__init__.py,sha256=NxFkOiL_oGaYt2qv9yAvWrNcXn_xT9yLzCLd7PGRaWI,15564
|
300
300
|
syncmodels/session/http.py,sha256=tf7z0ccAEYoCOZT4Ukv3NBXz9hUO3vs2s9bm491pCj8,1480
|
301
301
|
syncmodels/session/postgresql.py,sha256=ZMIu1Rv93pKfvFlovFBmWArzlrT2xaQWNYGZT_LW61k,175
|
302
|
-
syncmodels/session/sql.py,sha256=
|
302
|
+
syncmodels/session/sql.py,sha256=4501Prer2Fz0e4goP98tNXMg7oD36B3X91l4tf2waFU,6567
|
303
303
|
syncmodels/session/sqlite.py,sha256=nCDjopLiBpX1F10qkKoARM7JrVdIpJ1WdGOduFVxaiA,2080
|
304
304
|
syncmodels/source/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
305
|
-
syncmodels-0.1.
|
306
|
-
syncmodels-0.1.
|
307
|
-
syncmodels-0.1.
|
308
|
-
syncmodels-0.1.
|
309
|
-
syncmodels-0.1.
|
310
|
-
syncmodels-0.1.
|
311
|
-
syncmodels-0.1.
|
305
|
+
syncmodels-0.1.324.dist-info/AUTHORS.rst,sha256=3ZPoqg8Aav8DSYKd0fwcwn4_5HwSiMLart0E5Un00-U,168
|
306
|
+
syncmodels-0.1.324.dist-info/LICENSE,sha256=uzMOYtIiUsnsD0xHJR7aJWJ4v_bvan0kTnvufy5eNoA,1075
|
307
|
+
syncmodels-0.1.324.dist-info/METADATA,sha256=zvOOR5KpvS238h1j2Hs-NAWoFzmHBno2Gp7xUM2n9eI,2700
|
308
|
+
syncmodels-0.1.324.dist-info/WHEEL,sha256=SrDKpSbFN1G94qcmBqS9nyHcDMp9cUS9OC06hC0G3G0,109
|
309
|
+
syncmodels-0.1.324.dist-info/entry_points.txt,sha256=dMnigjZsHMxTwXiiZyBZdBbMYE0-hY3L5cG15EcDAzw,51
|
310
|
+
syncmodels-0.1.324.dist-info/top_level.txt,sha256=2DfQ9NuAhKMjY3BvQGVBA7GfqTm7EoHNbaehSUiqiHQ,11
|
311
|
+
syncmodels-0.1.324.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|