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
""" | |
Say you have a SQLite connection to database `main` | |
with attached database `attached`. | |
Does a long insert on the `attached` database in a similar connection | |
lock the `main` database in this connection? | |
No, it only locks `attached`. | |
Output: |
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
""" | |
...in which we use property-based / model-based testing to find | |
an eventually consistent way of synchronizing entries | |
from the main reader storage to an (unrelated) search index, | |
without coupling the storage and search with transactions / triggers. | |
A real model checker like TLA+ or Alloy may have been a better tool for this, | |
but I don't know how to use them. | |
This is the first step in https://github.com/lemon24/reader/issues/323. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
""" | |
Distributed key-value store prototype, with no kind of consistency. | |
--- | |
A demo (from before we had bootstapping): https://asciinema.org/a/616231 | |
On one machine: | |
>>> d = dkv.DKV() |
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
""" | |
measure how much time it takes for requests to make many localhost requests | |
try do so some optimizations | |
initial results on on an old mac: | |
$ python req.py http 100 | |
itrg 0.3003 |
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
""" | |
stricter typing | |
for https://github.com/lemon24/reader/blob/master/src/reader/_parser.py | |
for https://github.com/lemon24/reader/issues/271 | |
""" | |
from typing import * | |
import io | |
from dataclasses import dataclass | |
from random import choice |
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
""" | |
Prototype showing how a Twitter reader plugin could work, based on | |
https://github.com/lemon24/reader/issues/271#issuecomment-1111789547 | |
FooRetriever and FakeParser are simplified versions of the actual thing. | |
Typing left as an exercise for the reader (won't be straightforward). | |
UpdaterWrapper is needed because we can't choose updaters | |
(like we do with parsers and mime types); we'd likely use feed.version. |
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
""" | |
Working of off feedparser 6.0.8. | |
To do: | |
* [x] don't read entire file in memory | |
* [x] allow fallback to reading entire file in memory | |
* allow using alternative (defusedxml, lxml) sax handlers | |
* [x] fix content order bug |
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
""" | |
API proposals for Reader.add_entry(). | |
""" | |
### 1a: one-shot add entry | |
reader.add_entry( | |
feed_url='https://explainxkcd.com/rss.xml', |
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
""" | |
(Broken?) MinHash implementation attempting to optimize Jaccard similarity | |
for https://github.com/lemon24/reader/issues/202 (reader.entry_dedupe plugin). | |
--- | |
Current state: | |
It kinda works, but no matter how much I increase LOOPS, | |
the result doesn't seem to converge to the real similarity |
NewerOlder