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
LIMIT = 5 | |
BOUND = 'object' | |
def prelude(limit: int, bound: str) -> None: | |
print('from typing import Callable, Iterable, Iterator, Tuple, TypeVar, overload') | |
print('Ts = TypeVar(\'Ts\', bound={bound})'.format(bound=bound)) | |
print('R = TypeVar(\'R\')') | |
for i in range(LIMIT): | |
print('T{i} = TypeVar(\'T{i}\', bound={bound})'.format(i=i+1, bound=bound)) |
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
# Don't name this file html.py! | |
from __future__ import annotations | |
from typing import * | |
from dataclasses import dataclass | |
from html import escape | |
from html.parser import HTMLParser |
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 generate(source): | |
print("# What comes before") | |
print(f"{source.removesuffix(".py")}.c: $(srcdir)/{source}") | |
print("\t$(COMMAND)") | |
def generate_too(source): | |
print("# What comes before") | |
print(f"{source.removesuffix("some/bad-\"-stuff%!")}.c: $(srcdir)/{source}") | |
print("\t$(COMMAND)") |
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 f(a): | |
t = 0 | |
for x in a: | |
if x > 0: | |
t = t + x | |
return t | |
import dis | |
dis.dis(f) |
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 asyncio | |
END = b'Bye-bye!\n' | |
@asyncio.coroutine | |
def echo_client(): | |
reader, writer = yield from asyncio.open_connection('localhost', 8000) | |
writer.write(b'Hello, world\n') | |
writer.write(b'What a fine day it is.\n') | |
writer.write(END) |
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
# A local timezone class that inherits its behavior from the time | |
# module's knowledge about the local time zone. | |
# TODO: Use tm_gmtoff and tm_zone if supported? (Probably should be a | |
# separate class so we can compare them.) | |
import calendar # TODO: Really shouldn't. | |
import datetime | |
import time |
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 sys | |
import time | |
sys.setrecursionlimit(1200) | |
def g1(depth): | |
if depth > 0: | |
it = g1(depth-1) | |
yield next(it) | |
else: |
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
Hello Dear, | |
This is Ellen from ***.com | |
We are pleased to get to know that your articles on your blog are awesome and the writing style is so suitable for introducing our company's products. | |
And we sincerely invite you to cooperate with us, | |
*Write an article about our products on your blog about 400-500 words + 2 pictures+ 3 links | |
*Promote it on your social website. |
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
diff --git a/mypy/checker.py b/mypy/checker.py | |
index 7b0180f79..488ae825f 100644 | |
--- a/mypy/checker.py | |
+++ b/mypy/checker.py | |
@@ -991,9 +991,11 @@ class TypeChecker(NodeVisitor[None], CheckerPluginInterface): | |
if is_unsafe_overlapping_signatures(forward_tweaked, | |
reverse_tweaked): | |
+ rev_name = reverse_class.name() if reverse_class is not None else None | |
+ fwd_name = forward_base.type.name() if forward_base and hasattr(forward_base, 'type ') and forward_base.type else 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
variadic.py:17: error: Overloaded function signatures 1 and 2 overlap with incompatible return types | |
variadic.py:17: error: Overloaded function signatures 1 and 3 overlap with incompatible return types | |
variadic.py:38: error: Revealed type is 'Any' | |
variadic.py:39: error: Revealed type is 'Any' |
NewerOlder