This file contains hidden or 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
| from collections import namedtuple | |
| from pprint import pprint | |
| import sys | |
| import timeit | |
| class C1: | |
| __slots__ = ('a', ) | |
| class C2: |
This file contains hidden or 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
| #pragma once | |
| namespace xx { | |
| // A memory stream buffer class compliant with `std::basic_streambuf`. | |
| // | |
| // Usage example: | |
| // | |
| // std::vector<char> data; | |
| // // ... fill-in *data* here ... |
This file contains hidden or 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.path | |
| import sublime | |
| import sublime_plugin | |
| # build 3176: this does not work properly. self.view.set_name() works but it | |
| # seems to sort-of "unlinks" the view from its physical file path, so that if | |
| # the "Save" command is invoked upon this view, a "Save As" dialog will pop up | |
| # even though the view was loaded from an existing file. |
This file contains hidden or 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 itertools | |
| import threading | |
| _datastruct_cache_lock = threading.Lock() | |
| _datastruct_cache = {} | |
| class DataStruct(object): | |
| """ | |
| A ``__slots__`` based class that works pretty much like a mutable | |
| `collections.namedtuple` |
This file contains hidden or 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
| # Copyright (c) Jean-Charles Lefebvre | |
| # SPDX-License-Identifier: MIT | |
| import contextlib | |
| import importlib | |
| import importlib.resources | |
| import os | |
| import re | |
| import sqlite3 | |
| import sys |
This file contains hidden or 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
| # Copyright (c) Jean-Charles Lefebvre | |
| # SPDX-License-Identifier: MIT | |
| import re | |
| from collections.abc import Iterable, Mapping, Sequence, Sized | |
| __all__ = ["Arty"] | |
| _NONE_TYPE = type(None) |
This file contains hidden or 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
| from collections import Counter | |
| from typing import Union | |
| def should_compress( | |
| data: Union[bytes | bytearray | memoryview], | |
| /, *, | |
| threshold: int = 128) -> bool: | |
| # do not compress if buffer size is < threshold | |
| if len(data) < threshold: |
OlderNewer