Skip to content

Instantly share code, notes, and snippets.

View amyreese's full-sized avatar
🐍
herding snakes

Amethyst Reese amyreese

🐍
herding snakes
View GitHub Profile
jreese@jreese-mbp ~/workspace/znc-push +f2069f2 Β» make curl=yes
CXXFLAGS=" -DPUSHVERSION=\"v1.0.0-117-gf2069f2\" -DUSE_CURL -lcurl" LIBS=" -DUSE_CURL -lcurl" \
znc-buildmod push.cpp
Building "push.so" for ZNC 1.7.x... push.cpp:1774:5: error: no matching function for call to 'make_curl_request'
make_curl_request(service_host, service_url, service_auth, params, headers, use_port, use_ssl, use_post, options["proxy"], options["proxy_ssl_verify"] != "no", options["debug"] == "on"...
^~~~~~~~~~~~~~~~~
push.cpp:78:10: note: candidate function not viable: requires 11 arguments, but 12 were provided
CURLcode make_curl_request(const CString& service_host, const CString& service_url,
^
push.cpp:1914:11: error: no matching function for call to 'curl_slist_append'
@amyreese
amyreese / foo.py
Created December 8, 2016 23:13
pyflakes gives bad F821 for undefined name __module__
class Foo(object):
path = __module__ + '.Foo'
def bar(self):
print(self.path)
if __name__ == '__main__':
Foo().bar()
(.venv3) jreese@jreese-mbp ~/workspace/typeshed +socket-addressfamily⚑ » python tests/mypy_test.py
running mypy --python-version 3.6 --strict-optional # with 556 files
stdlib/3/builtins.pyi:691: error: Invalid type "typing.FrozenSet"
stdlib/3/builtins.pyi:692: error: Invalid type "typing.FrozenSet"
stdlib/3/builtins.pyi:693: error: Invalid type "typing.FrozenSet"
stdlib/3/builtins.pyi:697: error: Invalid type "typing.FrozenSet"
stdlib/3/builtins.pyi:698: error: Invalid type "typing.FrozenSet"
stdlib/3/builtins.pyi:703: error: Invalid type "typing.FrozenSet"
stdlib/3/builtins.pyi:704: error: Invalid type "typing.FrozenSet"
stdlib/3/builtins.pyi:705: error: Invalid type "typing.FrozenSet"
(.venv3) jreese@jreese-mbp ~/workspace/typeshed +multiprocessing Β» python3 tests/mypy_test.py
running mypy --python-version 3.6 --strict-optional # with 595 files
stdlib/3/multiprocessing/managers.pyi:19: error: Invalid type "Namespace"
stdlib/3/multiprocessing/managers.pyi:25: error: Invalid type "dict"
stdlib/3/multiprocessing/managers.pyi:26: error: Invalid type "list"
running mypy --python-version 3.5 --strict-optional # with 584 files
stdlib/3/multiprocessing/managers.pyi:19: error: Invalid type "Namespace"
stdlib/3/multiprocessing/managers.pyi:25: error: Invalid type "dict"
stdlib/3/multiprocessing/managers.pyi:26: error: Invalid type "list"
running mypy --python-version 3.4 --strict-optional # with 583 files
def first():
print('in first')
yield 25
print('back in first')
def second():
print('in second')
for value in first():
print('back in second, got: ', value)
async def executemany(
- self,
- sql: str,
- parameters: Iterable[Iterable[Any]],
+ self, sql: str, parameters: Iterable[Iterable[Any]]
) -> None:
"""Execute the given multiquery."""
await self._execute(self._cursor.executemany, sql, parameters)
@amyreese
amyreese / gist:c20759267e08aa45b7ce4a29747f5337
Created April 17, 2018 21:36
mypy 0.590 breaks --python-version
jreese@jreese-mbp ~/workspace/aiosqlite +master Β» python3 --version
Python 3.6.4
jreese@jreese-mbp ~/workspace/aiosqlite +master Β» mypy --version
mypy 0.580
jreese@jreese-mbp ~/workspace/aiosqlite +master Β» mypy --ignore-missing-imports --python-version 3.5 aiosqlite
jreese@jreese-mbp ~/workspace/aiosqlite +master Β» pip3 install mypy==0.590
Collecting mypy==0.590
Downloading https://files.pythonhosted.org/packages/d6/e2/37a8a5dce634a094b90e13eda246a4b736a660124e78808f47fbad99f510/mypy-0.590-py3-none-any.whl (1.3MB)
100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1.3MB 913kB/s
Requirement already satisfied: typed-ast<1.2.0,>=1.1.0 in /Users/jreese/.pyenv/versions/3.6.4/lib/python3.6/site-packages (from mypy==0.590)
./edi/bot.py:112: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.600
Traceback (most recent call last):
File "/Users/jreese/.pyenv/versions/3.6.5/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/Users/jreese/.pyenv/versions/3.6.5/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/jreese/.pyenv/versions/3.6.5/lib/python3.6/site-packages/mypy/__main__.py", line 11, in <module>
main(None)
File "/Users/jreese/.pyenv/versions/3.6.5/lib/python3.6/site-packages/mypy/main.py", line 91, in main
res = type_check_only(sources, bin_dir, options, flush_errors, fscache) # noqa
(.py3) jreese@jreese-mbp ~/workspace/mypy-recursion Β» mypy --python-version 3.6 --show-traceback foo.py
foo.py:30: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.600
Traceback (most recent call last):
File "/Users/jreese/.pyenv/versions/3.6.5/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/jreese/.pyenv/versions/3.6.5/lib/python3.6/site-packages/mypy/__main__.py", line 7, in console_entry
main(None)
File "/Users/jreese/.pyenv/versions/3.6.5/lib/python3.6/site-packages/mypy/main.py", line 91, in main
res = type_check_only(sources, bin_dir, options, flush_errors, fscache) # noqa
File "/Users/jreese/.pyenv/versions/3.6.5/lib/python3.6/site-packages/mypy/main.py", line 148, in type_check_only
@amyreese
amyreese / foo.py
Last active November 25, 2019 10:33
#!/usr/bin/env python3
from attr import dataclass, Factory
from typing import Dict, List
@dataclass
class Foo:
_instances: Dict[str, "Foo"] = Factory(dict)