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 itertools import chain, repeat | |
| from time import sleep | |
| try: | |
| # python3 | |
| from http.server import HTTPServer, SimpleHTTPRequestHandler | |
| except: | |
| # python2 | |
| from SimpleHTTPServer import SimpleHTTPRequestHandler | |
| from BaseHTTPServer import HTTPServer |
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
| def returns(wrap_function): | |
| def decorator(f): | |
| def decorated(*args, **kwargs): | |
| return wrap_function(f(*args, **kwargs)) | |
| return decorated | |
| return decorator |
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
| test id1 |
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 typing import * | |
| from typing import IO, BinaryIO, TextIO | |
| import collections | |
| import datetime | |
| import enum | |
| import numbers | |
| import decimal | |
| import fractions | |
| from itertools import groupby | |
| from more_itertools import first |
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 typing import TypeVar, Iterable, Generator, List | |
| from more_itertools import peekable | |
| T = TypeVar("T") | |
| Gen = Generator[T, None, None] | |
| def partition(items: Iterable[T]) -> Gen[List[T]]: | |
| items = peekable(items) | |
| result = [] |
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 * as _ from "lodash"; | |
| function mapToObj<V>(map: Map<number, V>): _.NumericDictionary<V>; | |
| function mapToObj<V>(map: Map<string, V>): _.Dictionary<V>; | |
| function mapToObj<V>(map: Map<any, V>): _.Dictionary<V> { | |
| return _.fromPairs([...map]); | |
| } | |
| function objToMap<V>(obj: _.NumericDictionary<V>): Map<number, V>; | |
| function objToMap<V>(obj: _.Dictionary<V>): Map<string, V>; |
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
| { | |
| id: string; | |
| id2?: number; | |
| key: string; | |
| value?: boolean; | |
| names?: Array<string>; | |
| names2: Array<string>; | |
| value2?: Array<Array<string>>; | |
| } |
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
| const log = console.log; | |
| async function f0() { | |
| return "ZZZ"; | |
| } | |
| async function f1() { | |
| await f0(); | |
| return "XXX"; | |
| } |
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
| class Base { | |
| public static create() { | |
| return new class extends Base { | |
| constructor() { | |
| super("XXX"); | |
| } | |
| }(); | |
| } | |
| constructor(private value: string) { |
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
| const tupleStrNum = ["X", 2]; // (string|number)[] |
NewerOlder