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
#! uv -n run | |
# /// script | |
# requires-python = ">=3.12" | |
# dependencies = [ | |
# "draive[gemini]~=0.49.1", | |
# ] | |
# /// | |
from asyncio import run |
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
#! uv -n run | |
# /// script | |
# requires-python = ">=3.12" | |
# dependencies = [ | |
# "draive[ollama]~=0.43.1", | |
# ] | |
# /// | |
from asyncio import run | |
from collections.abc import Sequence |
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 OSLog | |
import class Foundation.Bundle | |
import class Foundation.ProcessInfo | |
import struct Foundation.TimeZone | |
/// Diagnostics allows debugging and gathering usage data. | |
public enum Diagnostics { | |
/// Info including application name and version. | |
public static let info: 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
extension Optional | |
where Wrapped == Task<Void, Never> { | |
public mutating func clearIfCurrent() { | |
switch self { | |
case .some(let task) where task.isCurrent: | |
self = .none | |
case _: | |
break // noop |
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 Foundation | |
extension JSONEncoder { | |
public func encode( | |
any anyEncodable: any Encodable | |
) throws -> Data { | |
try self.encode( | |
JSONEncodingWrapper(encodable: anyEncodable) | |
) |
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 libkern | |
@usableFromInline | |
internal final class AsyncSpinLock { | |
@TaskLocal private static var taskContext: Array<AsyncSpinLock> = .init() | |
@usableFromInline | |
internal let atomicFlagPointer: UnsafeMutablePointer<atomic_flag> |
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 Combine | |
extension Publisher { | |
public func asAsyncThrowingSequence() -> StreamedAsyncThrowingSequence<Output> { | |
StreamedAsyncThrowingSequence(self) | |
} | |
} | |
extension Publisher where Failure == Never { |
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 struct Foundation.UUID | |
import os | |
import libkern | |
public enum MemoryLeaks { | |
public static func listActiveMarkers() -> Array<Marker> { | |
let markersRegistryCopy: Dictionary<AnyHashable, WeakMarker> = markersRegistryLock | |
.withLock { Self.markersRegistry } | |
return markersRegistryCopy.values.compactMap(\.marker) |
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
public struct Tagged<RawValue, Type>: RawRepresentable { | |
public var rawValue: RawValue | |
public init( | |
rawValue: RawValue | |
) { | |
self.rawValue = rawValue | |
} | |
} |
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 Foundation | |
import SQLite3 | |
private final class SQLiteHandle { | |
fileprivate var handle: OpaquePointer? | |
fileprivate init(handle: OpaquePointer?) { | |
self.handle = handle | |
} |
NewerOlder