View uuid_format.js
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
const buf = Buffer.allocUnsafe(16); | |
function f1(buf) { | |
return ( | |
buf.slice(0, 4).toString("hex") + | |
"-" + | |
buf.slice(4, 6).toString("hex") + | |
"-" + | |
buf.slice(6, 8).toString("hex") + | |
"-" + |
View ag.py
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 time | |
import threading | |
def generator(): | |
try: | |
print('STARTED') | |
time.sleep(5) | |
yield 1 | |
finally: |
View bench.py
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 pyrsistent | |
import immutables | |
import time | |
I = 1000000 | |
KEY = '5' | |
for N in [5, 10, 20, 30, 100, 200, 300, 400, 500, 1000]: | |
print('=============') |
View ds.py
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
# | |
# This source file is part of the EdgeDB open source project. | |
# | |
# Copyright 2016-present MagicStack Inc. and the EdgeDB authors. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |
View fix.diff
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/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py | |
index 492e377d09..3b1ed00af3 100644 | |
--- a/Lib/asyncio/base_events.py | |
+++ b/Lib/asyncio/base_events.py | |
@@ -477,10 +477,7 @@ class BaseEventLoop(events.AbstractEventLoop): | |
def _asyncgen_finalizer_hook(self, agen): | |
self._asyncgens.discard(agen) | |
if not self.is_closed(): | |
- self.create_task(agen.aclose()) | |
- # Wake up the loop if the finalizer was called from |
View avg.pyx
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
# | |
# This source file is part of the EdgeDB open source project. | |
# | |
# Copyright 2016-present MagicStack Inc. and the EdgeDB authors. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |
View fix_dataclass_introspection.diff
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/Lib/dataclasses.py b/Lib/dataclasses.py | |
index 28e9f75127..ad3dc46b67 100644 | |
--- a/Lib/dataclasses.py | |
+++ b/Lib/dataclasses.py | |
@@ -868,7 +868,7 @@ def _process_class(cls, init, repr, eq, order, unsafe_hash, frozen): | |
# Include InitVars and regular fields (so, not ClassVars). | |
flds = [f for f in fields.values() | |
if f._field_type in (_FIELD, _FIELD_INITVAR)] | |
- _set_new_attribute(cls, '__init__', | |
+ had_own_init = _set_new_attribute(cls, '__init__', |
View mod_getattr.patch
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/Lib/test/bad_getattr.py b/Lib/test/bad_getattr.py | |
new file mode 100644 | |
index 0000000000..b4f790f3bf | |
--- /dev/null | |
+++ b/Lib/test/bad_getattr.py | |
@@ -0,0 +1,3 @@ | |
+x = 1 | |
+ | |
+__getattr__ = "Surprise!" | |
diff --git a/Lib/test/bad_getattr2.py b/Lib/test/bad_getattr2.py |
View example.py
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 | |
import random | |
import time | |
async def worker(name, queue): | |
while True: | |
# Get a "work item" out of the queue. | |
sleep_for = await queue.get() |
View fixed.py
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 | |
from twisted.internet import asyncioreactor | |
asyncioreactor.install() | |
import treq | |
from twisted.internet.defer import Deferred, ensureDeferred | |
from twisted.internet.task import react | |
async def run(): |
NewerOlder