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
class my_turn: | |
"""a first come, first served coordinator predicate for | |
asyncio.Condition.wait_for(predicate); could also do away | |
the 'caller' by just hardcoding it to the current task | |
""" | |
queue = [] | |
def __init__(self, caller): | |
type(self).queue.insert(0, caller) |
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
class bouncer(Awaitable): | |
"serve awaiters on a first-come first-served basis" | |
queue = [] | |
def __init__(self): | |
type(self).queue.append(self.caller) | |
@property | |
def caller(self): |
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
def test_cmdline_logging_info(caplog, capsys): | |
retv = tnefparse.cmdline.tnefparse(('-l', 'INFO', '-rb', 'tests/examples/rtf.tnef')) | |
assert not retv | |
stdout, _ = capsys.readouterr() | |
assert len(stdout) == 593 | |
assert caplog.record_tuples == [ | |
('tnefparse', logging.INFO, 'Skipping checksum for performance'), | |
] | |
def tnefparse(argv=None): |
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
import extruct | |
import requests | |
from w3lib.html import get_base_url | |
from urllib.parse import urlparse | |
url = "https://www.kalevala.fi/collections/korvakorut/products/paratiisi-tappikorvakorut-hopea" | |
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
import os | |
import struct | |
import fcntl | |
from decimal import Decimal | |
DEVICE_FILE_NAME = "/dev/vcio" | |
IOCTL_MBOX_PROPERTY = 0xC0046400 # _IOWR(MAJOR_NUM, 0, char *) adjusted for alignment | |
GET_GENCMD_RESULT = 0x00030080 | |
MAX_STRING = 1024 |
OlderNewer