Skip to content

Instantly share code, notes, and snippets.

@dimaqq
dimaqq / ops __init__.py
Last active August 28, 2024 01:17
Fixing ops.main() type hints, the protocol version
from typing import Protocol, cast
import ._main
import .main as _legacy_main
class Main(Protocol):
def __call__(self, arg1: Arg1, ...): ...
def main(self, arg1: Arg1, ...): ...
main = cast(Main, _main.main)
main.main = _legacy_main.main
@dimaqq
dimaqq / ops __init__.py
Last active August 28, 2024 01:09
Fixing ops.main() type hints, the callable class version
import ._main
import .main as _legacy_main
class Main:
__call__ = staticmethod(_main.main)
main = staticmethod(_legacy_main.main)
main = Main()
@dimaqq
dimaqq / ops __init__.py
Last active August 28, 2024 01:07
Fixing ops.main() type hints, the callable module version
import .main as _main
main = _main._CallableMainModule('ops.main', _main.__doc__)

Totally OT: if you wanna test nogil out:

  • macos 3.13b2 installer includes the nogil build, needs to be exp[licitly selected
    • at "Installation type" click "Customise" instead of "Install"
  • ubuntu (and similar), the deadsnakes project apparently ships nogil versions too
    • apt/nala install python3.13-nogil
  • GitHub actions, via deadsnakes/[email protected] with nogil:true
{
"Profiles": [
{
"Ansi 7 Color (Light)" : {
"Red Component" : 0.93333333333333335,
"Color Space" : "sRGB",
"Blue Component" : 0.83529411764705885,
"Green Component" : 0.90980392156862744
},
"Ansi 15 Color (Light)" : {
" -*- coding: utf-8 -*-
" scriptencoding utf-8
set termencoding=utf-8
set termguicolors
set encoding=utf-8
setglobal fileencoding=utf-8
syntax on
set hls
set expandtab
set colorcolumn=88
alias v=vim
alias fd=fdfind
alias v=vim
#alias top=htop
alias gc="git commit"
alias gcam="git commit -am"
" -*- coding: utf-8 -*-
" scriptencoding utf-8
set termencoding=utf-8
set termguicolors
set encoding=utf-8
setglobal fileencoding=utf-8
syntax on
set hls
set expandtab
set colorcolumn=88
# This is Git's per-user configuration file.
[user]
name = Dima Tisnek
email = [email protected]
[alias]
tree = log --all --decorate --oneline --graph
ls = log --decorate --graph
st = status
branchdate = for-each-ref --sort='-committerdate:iso8601' --format=' %(committerdate:iso8601)%09%(refname)' refs/heads
[diff "minjs"]
# Set up ThinkPad X1 Carbon trackpad on Ubuntu to behave kindof like Mac
#
# dima@kuro ~> functions fix_middle_button
# Defined in /home/dima/.config/fish/conf.d/no-middle-button.fish @ line 6
function fix_middle_button --description 'remap middle buttons to prmiary'
string match -r 'Touchpad.*id=(?<id>[0-9]+)' (xinput list)
if test -n "$id";
xinput set-button-map "$id" 1 1 1 4 5 6 7 8 9 10 11 12
end