Skip to content

Instantly share code, notes, and snippets.

View ethanhs's full-sized avatar
🐍
▄▄▀▀▄▄▀▀▄▄▀▀▄▄▀ꜚ

Ethan Smith ethanhs

🐍
▄▄▀▀▄▄▀▀▄▄▀▀▄▄▀ꜚ
View GitHub Profile
@ethanhs
ethanhs / singledispatchmethod.py
Created April 25, 2018 03:35
`functools.singledispatchmethod` for use before 3.8
from functools import singledispatch, update_wrapper
class singledispatchmethod:
"""Single-dispatch generic method descriptor.
Supports wrapping existing descriptors and handles non-descriptor
callables as instance methods.
"""
def __init__(self, func):
if not callable(func) and not hasattr(func, "__get__"):
@ethanhs
ethanhs / output.log
Created March 6, 2018 13:24
Changing default python version in mypy
Worker information
hostname: 26f6015e-26d2-496e-a5c1-f4148fa0eb71@1.i-0198d17-production-2-worker-org-ec2.travisci.net
version: v3.5.0 https://github.com/travis-ci/worker/tree/77dbc57c72d00592aeb754773b712da843c7e00d
instance: 24be829 travisci/ci-garnet:packer-1512502276-986baf0 (via amqp)
startup: 417.936957ms
mode of ‘/usr/local/clang-5.0.0/bin’ changed from 0777 (rwxrwxrwx) to 0775 (rwxrwxr-x)
system_info
Build system information
Build language: python
Build group: stable
@ethanhs
ethanhs / keybase.md
Created March 2, 2018 06:59
keybase.md

Keybase proof

I hereby claim:

  • I am ethanhs on github.
  • I am ethanhs (https://keybase.io/ethanhs) on keybase.
  • I have a public key ASB62E5i52bI_UgYyZyjrivJLeaf9qTzpAD4vITJ7-7dtAo

To claim this, I am signing this object:

travis_fold:start:worker_info
Worker information
hostname: 38bd253f-48d2-4d66-b916-0779d5cf1f1f@1.i-05f7a68-production-2-worker-org-ec2.travisci.net
version: v3.5.0 https://github.com/travis-ci/worker/tree/77dbc57c72d00592aeb754773b712da843c7e00d
instance: 355a358 travisci/ci-garnet:packer-1512502276-986baf0 (via amqp)
startup: 463.749498ms
travis_fold:end:worker_info
mode of ‘/usr/local/clang-5.0.0/bin’ changed from 0777 (rwxrwxrwx) to 0775 (rwxrwxr-x)
travis_fold:start:system_info
Build system information
@ethanhs
ethanhs / my_first_calc.c.py
Created October 20, 2017 04:16
Because we need a C version
MAX = 250
nums = range(MAX + 1)
signs = '+-*/'
if_template = '''
if (a == {0} && b == '{1}' && c == {2})
puts("{0} {1} {2} = {3}");
'''
main_template = '''
@ethanhs
ethanhs / output.log
Created June 25, 2017 06:53
Failed build of Pyjion
1>------ Build started: Project: Pyjion, Configuration: Debug x64 ------
1> intrins.cpp
1>intrins.cpp(534): error C2059: syntax error: '.'
1>intrins.cpp(534): error C2143: syntax error: missing ';' before '}'
1>intrins.cpp(535): error C2065: 'PyId_displayhook': undeclared identifier
1>intrins.cpp(537): error C2059: syntax error: 'if'
1>intrins.cpp(537): error C2143: syntax error: missing ';' before '{'
1>intrins.cpp(537): error C2447: '{': missing function header (old-style formal list?)
1>intrins.cpp(543): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>intrins.cpp(543): error C2373: 'res': redefinition; different type modifiers
@ethanhs
ethanhs / Depend on typing.md
Last active May 31, 2017 07:19
A list of modules that depend on typing as of 5-30-2017

netsgiro typing

pykechain typing

typed-astunparse typing (>=3.5)

ninjag typing

PyOTA typing

@ethanhs
ethanhs / python-version
Last active May 30, 2017 04:42
This Gist contains download information on PyPi for the MyPy package. uses https://github.com/ofek/pypinfo
$ pypinfo -d 135 -l 3000 -o python_version mypy pyversion
python_version download_count
-------------- --------------
3.7 1203
3.6 26997
3.5 39128
3.4 40122
3.3 1558
3.2 16
2.7 2443
total runtime: 116.39472845223841 sec
317052 function calls (313012 primitive calls) in 116.395 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 116.395 116.395 <string>:1(<module>)
1 0.001 0.001 0.012 0.012 __init__.py:120(dump)
2 0.000 0.000 0.001 0.001 __init__.py:274(load)
2 0.000 0.000 0.001 0.000 __init__.py:302(loads)
@ethanhs
ethanhs / stubbed_clean.txt
Last active May 24, 2017 02:18
This is the output of following imports in the zulip sources with ignored files removed
# stub issues
zerver/migrations/0081_make_emoji_lowercase.py:34: error: Module has no attribute "validators"
zerver/migrations/0018_realm_emoji_message.py:18: error: Module has no attribute "validators"
zerver/migrations/0013_realmemoji.py:23: error: Module has no attribute "validators"
zerver/migrations/0002_django_1_8.py:18: error: Module has no attribute "contrib"
zerver/tornado/handlers.py:12: error: Module 'django.core' has no attribute 'signals'
zerver/views/auth.py:18: error: Module 'django.core' has no attribute 'signing'
zerver/models.py:188: error: Module has no attribute "contrib"
zproject/backends.py:49: error: Module has no attribute "contrib"
zerver/migrations/0043_realm_filter_validators.py:24: error: Module has no attribute "validators"