How to use Fn method in sinon

Best JavaScript code snippet using sinon

estimator_test.py

Source:estimator_test.py Github

copy

Full Screen

...286 expected_features = {'x': 42., 'y': 43.}287 expected_labels = 44.288 model_fn_call_count = [0]289 test_self = self290 class ModelFn(object):291 def __call__(self, features, labels):292 model_fn_call_count[0] += 1293 test_self.assertItemsEqual(expected_features.keys(), features.keys())294 return _estimator_spec(295 expected_features, expected_labels, features, labels,296 model_fn_lib.ModeKeys.TRAIN)297 with self.assertRaisesRegexp(ValueError, 'does not include params'):298 estimator.Estimator(model_fn=ModelFn(), params={'a': 'b'})299 est = estimator.Estimator(model_fn=ModelFn(), config=run_config.RunConfig())300 self.assertEqual(0, model_fn_call_count[0])301 est.train(302 input_fn=_make_input_fn(expected_features, expected_labels), steps=1)303 self.assertEqual(1, model_fn_call_count[0])304 def test_callable_input_fn(self):305 expected_params = {'batch_size': 10}306 expected_config = run_config.RunConfig().replace(tf_random_seed=4321)307 input_fn_call_count = [0]308 def _model_fn(features, labels, mode, params, config):309 del params, config310 return model_fn_global_step_incrementer(features, labels, mode)311 test_self = self312 class InputFn(object):313 def __call__(self, params, config):314 input_fn_call_count[0] += 1315 test_self.assertEqual(expected_params, params)316 test_self.assertEqual(4321, config.tf_random_seed)317 return dummy_input_fn()318 est = estimator.Estimator(model_fn=_model_fn,319 params=expected_params,320 config=expected_config)321 self.assertEqual(0, input_fn_call_count[0])322 est.train(InputFn(), steps=1)323 self.assertEqual(1, input_fn_call_count[0])324 def test_input_fn_args(self):325 expected_params = {'batch_size': 10}326 expected_config = run_config.RunConfig().replace(tf_random_seed=4321)327 input_fn_call_count = [0]328 def _model_fn(features, labels, mode, params, config):329 del params, config330 return model_fn_global_step_incrementer(features, labels, mode)331 def _input_fn(params, config):332 input_fn_call_count[0] += 1333 self.assertEqual(expected_params, params)334 self.assertEqual(4321, config.tf_random_seed)335 return dummy_input_fn()336 est = estimator.Estimator(model_fn=_model_fn,...

Full Screen

Full Screen

redux-saga_v1.x.x.js

Source:redux-saga_v1.x.x.js Github

copy

Full Screen

1// flow-typed signature: 689311caccb0db4742bdff80086a5a092// flow-typed version: c6154227d1/redux-saga_v1.x.x/flow_>=v0.104.x3declare module "redux-saga" {4 // These types are copied directly from the redux libdef.5 // Importing them in this libdef causes a loss in type coverage.6 // * uncomment next line:7 // import type { Middleware} from 'redux';8 // * remove next types9 declare type DispatchAPI<A> = (action: A) => A;10 declare type Dispatch<A: { type: string, ... }> = DispatchAPI<A>;11 declare type MiddlewareAPI<S, A, D = Dispatch<A>> = {12 dispatch: D,13 getState(): S,14 ...15 };16 declare type Middleware<S, A, D = Dispatch<A>> = (api: MiddlewareAPI<S, A, D>) => (next: D) => D;17 //////////////////////////////////////////////////////////////////////////18 declare export var SAGA_LOCATION: "@@redux-saga/LOCATION";19 declare export var CANCEL: "@@redux-saga/CANCEL_PROMISE";20 declare export type TEnd = {| +type: "@@redux-saga/CHANNEL_END" |};21 declare export var END: TEnd;22 declare export var isEnd: {23 (input: TEnd): true,24 (input: mixed): false,25 ...26 };27 declare export type Predicate<T> = (arg: T) => boolean;28 declare export type MulticastChannel<T> = $ReadOnly<{|29 take(cb: (message: T | TEnd) => void, matcher?: Predicate<T>): void,30 put(message: T | TEnd): void,31 close(): void32 |}>;33 declare export interface Buffer<T> {34 isEmpty(): boolean;35 put(message: T): void;36 take(): T | void;37 flush(): Array<T>;38 }39 declare export interface Task<RT> {40 isRunning: () => boolean;41 isCancelled: () => boolean;42 result: () => RT | void;43 error: () => Error | void;44 cancel: () => void;45 toPromise(): Promise<RT>;46 setContext<C: {...}>(props: $Shape<C>): void;47 }48 declare export interface SagaMonitor {49 effectTriggered?: (desc: {50 +effectId: number,51 +parentEffectId: number,52 +label: string,53 +root?: boolean,54 +effect: Effect,55 ...56 }) => void;57 effectResolved?: (effectId: number, result: mixed) => void;58 effectRejected?: (effectId: number, error: any) => void;59 effectCancelled?: (effectId: number) => void;60 actionDispatched?: <A>(action: A) => void;61 }62 declare export type Saga<T> = Generator<Effect, T, any>;63 declare export type Unsubscribe = () => void;64 declare export type Subscribe<T> = (cb: (input: T | TEnd) => void) => Unsubscribe;65 declare export interface TakeableChannel<T> {66 take(cb: (message: T | TEnd) => void): void67 }68 declare export interface PuttableChannel<T> {69 put(message: T | TEnd): void70 }71 declare export interface FlushableChannel<T> {72 flush(cb: (items: Array<T> | TEnd) => void): void73 }74 declare export interface EventChannel<T> {75 take(cb: (message: T | TEnd) => void): void;76 flush(cb: (items: Array<T> | TEnd) => void): void;77 close(): void;78 }79 declare export var eventChannel: <T>(80 subscribe: Subscribe<T>,81 buffer?: Buffer<T>82 ) => EventChannel<T>;83 declare export interface Channel<T> {84 take(cb: (message: T | TEnd) => void): void;85 put(message: T | TEnd): void;86 flush(cb: (items: Array<T> | TEnd) => void): void;87 close(): void;88 }89 declare export function channel<T>(buffer?: Buffer<T>): Channel<T>;90 declare export var buffers: $ReadOnly<{|91 none: <T>() => Buffer<T>,92 fixed: <T>(limit?: number) => Buffer<T>,93 dropping: <T>(limit?: number) => Buffer<T>,94 sliding: <T>(limit?: number) => Buffer<T>,95 expanding: <T>(initialSize?: number) => Buffer<T>96 |}>;97 declare export function multicastChannel<T>(): MulticastChannel<T>;98 declare export function stdChannel<T>(): MulticastChannel<T>;99 declare export type Logger = (level: "info" | "warning" | "error", ...args: Array<any>) => void;100 declare export type EffectMiddleware = (next: (effect: mixed) => void) => (effect: mixed) => void;101 declare export interface PredicateTakeableChannel<T> {102 take(cb: (message: T | TEnd) => void, matcher?: Predicate<T>): void;103 }104 declare type RunSagaOptions<A, S> = {|105 channel?: PredicateTakeableChannel<A>,106 dispatch?: (input: A) => mixed,107 getState?: () => S,108 context?: {...},109 sagaMonitor?: SagaMonitor,110 logger?: Logger,111 effectMiddlewares?: Array<EffectMiddleware>,112 onError?: (error: Error) => void113 |};114 declare export var runSaga: {115 <A, S, R, Fn: () => Saga<R>>(options: RunSagaOptions<A, S>, saga: Fn): Task<R>,116 <A, S, R, T1, Fn: T1 => Saga<R>>(options: RunSagaOptions<A, S>, saga: Fn, T1): Task<R>,117 <A, S, R, T1, T2, Fn: (T1, T2) => Saga<R>>(118 options: RunSagaOptions<A, S>,119 saga: Fn,120 T1,121 T2122 ): Task<R>,123 <A, S, R, T1, T2, T3, Fn: (T1, T2, T3) => Saga<R>>(124 options: RunSagaOptions<A, S>,125 saga: Fn,126 T1,127 T2,128 T3129 ): Task<R>,130 <A, S, R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => Saga<R>>(131 options: RunSagaOptions<A, S>,132 saga: Fn,133 T1,134 T2,135 T3,136 T4137 ): Task<R>,138 <A, S, R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => Saga<R>>(139 options: RunSagaOptions<A, S>,140 saga: Fn,141 T1,142 T2,143 T3,144 T4,145 T5146 ): Task<R>,147 <A, S, R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => Saga<R>>(148 options: RunSagaOptions<A, S>,149 saga: Fn,150 T1,151 T2,152 T3,153 T4,154 T5,155 T6156 ): Task<R>,157 <A, S, R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => Saga<R>>(158 options: RunSagaOptions<A, S>,159 saga: Fn,160 T1,161 T2,162 T3,163 T4,164 T5,165 T6,166 T7167 ): Task<R>,168 <A, S, R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => Saga<R>>(169 options: RunSagaOptions<A, S>,170 saga: Fn,171 T1,172 T2,173 T3,174 T4,175 T5,176 T6,177 T7,178 T8179 ): Task<R>,180 ...181 };182 declare export type SagaMiddleware<C: {...}> =183 {184 <S, A, D>(api: MiddlewareAPI<S, A, D>): (next: D) => D,185 run: {186 <R, Fn: () => Saga<R>>(saga: Fn): Task<R>,187 <R, T1, Fn: T1 => Saga<R>>(saga: Fn, T1): Task<R>,188 <R, T1, T2, Fn: (T1, T2) => Saga<R>>(saga: Fn, T1, T2): Task<R>,189 <R, T1, T2, T3, Fn: (T1, T2, T3) => Saga<R>>(saga: Fn, T1, T2, T3): Task<R>,190 <R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => Saga<R>>(saga: Fn, T1, T2, T3, T4): Task<R>,191 <R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => Saga<R>>(192 saga: Fn,193 T1,194 T2,195 T3,196 T4,197 T5198 ): Task<R>,199 <R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => Saga<R>>(200 saga: Fn,201 T1,202 T2,203 T3,204 T4,205 T5,206 T6207 ): Task<R>,208 <R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => Saga<R>>(209 saga: Fn,210 T1,211 T2,212 T3,213 T4,214 T5,215 T6,216 T7217 ): Task<R>,218 <R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => Saga<R>>(219 saga: Fn,220 T1,221 T2,222 T3,223 T4,224 T5,225 T6,226 T7,227 T8228 ): Task<R>,229 ...230 },231 setContext: (props: $Shape<C>) => void,232 ...233 };234 declare export type Emit<T> = (input: T) => void;235 declare export type SagaMiddlewareOptions<C: {...}> = {|236 context?: C,237 sagaMonitor?: SagaMonitor,238 logger?: Logger,239 effectMiddlewares?: Array<EffectMiddleware>,240 emitter?: <A>(emit: Emit<A>) => Emit<any>,241 onError?: (error: Error) => void242 |};243 declare function sagaMiddlewareFactory<C>(options?: SagaMiddlewareOptions<C>): SagaMiddleware<C>;244 declare export default typeof sagaMiddlewareFactory;245 // Effect types246 declare export type SubPattern = string | (any => boolean);247 declare export type Pattern = SubPattern | Array<SubPattern>;248 declare export interface IEffect<T, P, C: boolean> {249 +type: T;250 +payload: P;251 +combinator: C;252 }253 declare export type AllTakeEffect<254 M: { maybe: true, ... } | void255 > = IEffect<256 "TAKE",257 $ReadOnly<{|258 pattern: '*',259 ...$Exact<M>260 |}>,261 false262 >;263 declare export type TakeEffect<264 P: { pattern: Pattern, ... } | void,265 C: { channel: TakeableChannel<*>, ... } | void,266 M: { maybe: true, ... } | void267 > = IEffect<268 "TAKE",269 $ReadOnly<{|270 ...$Exact<P>,271 ...$Exact<C>,272 ...$Exact<M>273 |}>,274 false275 >;276 declare export type PutEffect<277 A: {...},278 C: PuttableChannel<*> | null,279 R: { resolve: true, ... } | void280 > = IEffect<281 "PUT",282 $ReadOnly<{|283 action: A,284 channel: C,285 ...$Exact<R>286 |}>,287 false288 >;289 declare export type CallEffect<Ctx, Fn: Function | string, Args: $ReadOnlyArray<*>> = IEffect<290 "CALL",291 $ReadOnly<{|292 context: Ctx,293 fn: Fn,294 args: Args295 |}>,296 false297 >;298 declare export type ForkEffect<299 Ctx,300 Fn: (...args: Array<*>) => *,301 D: { detached: true, ... } | void,302 Args: $ReadOnlyArray<*>303 > = IEffect<304 "FORK",305 $ReadOnly<{|306 context: Ctx,307 fn: Fn,308 args: Args,309 ...$Exact<D>310 |}>,311 false312 >;313 declare export function detach<T1, T2, T3>(314 effect: ForkEffect<T1, T2, *, T3>315 ): ForkEffect<T1, T2, { detached: true, ... }, T3>;316 declare export type CpsEffect<Ctx, Fn: (...args: Array<*>) => *, Args: $ReadOnlyArray<*>> = IEffect<317 "CPS",318 $ReadOnly<{|319 context: Ctx,320 fn: Fn,321 args: Args322 |}>,323 false324 >;325 declare export type JoinEffect<T: Task<*> | Array<Task<*>>> = IEffect<"JOIN", T, false>;326 declare export type SELF_CANCELLATION = "@@redux-saga/SELF_CANCELLATION";327 declare export type CancelEffect<328 T: Task<*> | $ReadOnlyArray<Task<*>> | SELF_CANCELLATION329 > = IEffect<"CANCEL", T, false>;330 declare export type SelectEffect<Fn: Function | void, Args: $ReadOnlyArray<*>> = IEffect<331 "SELECT",332 $ReadOnly<{|333 selector: Fn,334 args: Args335 |}>,336 false337 >;338 declare export type ActionChannelEffect<T, P: Pattern | void, B: Buffer<T> | void> = IEffect<339 "ACTION_CHANNEL",340 $ReadOnly<{|341 buffer: B,342 pattern: P343 |}>,344 false345 >;346 declare export type FlushEffect<CH: FlushableChannel<*>> = IEffect<"FLUSH", CH, false>;347 declare export type CancelledEffect = IEffect<"CANCELLED", {||}, false>;348 declare export type SetContextEffect<T: {...}> = IEffect<"SET_CONTEXT", T, false>;349 declare export type GetContextEffect<T> = IEffect<"GET_CONTEXT", T, false>;350 declare export type RaceEffect<R: { +[name: string]: Effect, ... } | $ReadOnlyArray<Effect>> = IEffect<351 "RACE",352 R,353 true354 >;355 declare export type AllEffect = IEffect<356 "ALL",357 { +[name: string]: Effect, ... } | $ReadOnlyArray<Effect>,358 true359 >;360 declare export type Effect =361 | ActionChannelEffect<*, *, *>362 | AllEffect363 | CallEffect<*, *, *>364 | CancelEffect<*>365 | CancelledEffect366 | CpsEffect<*, *, *>367 | FlushEffect<*>368 | ForkEffect<*, *, *, *>369 | GetContextEffect<*>370 | JoinEffect<*>371 | PutEffect<*, *, *>372 | RaceEffect<*>373 | SelectEffect<*, *>374 | SetContextEffect<*>375 | TakeEffect<*, *, *>376 | AllTakeEffect<*>;377}378declare module "redux-saga/effects" {379 import type {380 ActionChannelEffect,381 AllEffect,382 Buffer,383 CallEffect,384 CancelEffect,385 CancelledEffect,386 Channel,387 CpsEffect,388 Effect,389 FlushEffect,390 ForkEffect,391 GetContextEffect,392 JoinEffect,393 Pattern,394 PutEffect,395 RaceEffect,396 Saga,397 SelectEffect,398 SetContextEffect,399 TakeEffect,400 Task,401 TakeableChannel,402 PuttableChannel,403 FlushableChannel,404 AllTakeEffect,405 } from "redux-saga";406 declare export var effectTypes: $ReadOnly<{|407 TAKE: 'TAKE',408 PUT: 'PUT',409 ALL: 'ALL',410 RACE: 'RACE',411 CALL: 'CALL',412 CPS: 'CPS',413 FORK: 'FORK',414 JOIN: 'JOIN',415 CANCEL: 'CANCEL',416 SELECT: 'SELECT',417 ACTION_CHANNEL: 'ACTION_CHANNEL',418 CANCELLED: 'CANCELLED',419 FLUSH: 'FLUSH',420 GET_CONTEXT: 'GET_CONTEXT',421 SET_CONTEXT: 'SET_CONTEXT'422 |}>;423 declare export var put: {424 <A: {...}>(action: A): PutEffect<A, null, void>,425 <A: {...}, T, CH: PuttableChannel<T>>(channel: CH, action: A): PutEffect<A, CH, void>,426 ...427 };428 declare export var putResolve: {429 <A: {...}>(action: A): PutEffect<A, null, { resolve: true, ... }>,430 <A: {...}, T, CH: PuttableChannel<T>>(channel: CH, action: A): PutEffect<A, CH, { resolve: true, ... }>,431 ...432 };433 declare export var call: {434 // call(fn, ...args)435 <R, Fn: () => R>(Fn): CallEffect<null, Fn, []>,436 <R, T1, Fn: T1 => R>(Fn, T1): CallEffect<null, Fn, [T1]>,437 <R, T1, T2, Fn: (T1, T2) => R>(Fn, T1, T2): CallEffect<null, Fn, [T1, T2]>,438 <R, T1, T2, T3, Fn: (T1, T2, T3) => R>(Fn, T1, T2, T3): CallEffect<null, Fn, [T1, T2, T3]>,439 <R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>(440 Fn,441 T1,442 T2,443 T3,444 T4445 ): CallEffect<null, Fn, [T1, T2, T3, T4]>,446 <R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>(447 Fn,448 T1,449 T2,450 T3,451 T4,452 T5453 ): CallEffect<null, Fn, [T1, T2, T3, T4, T5]>,454 <R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => R>(455 Fn,456 T1,457 T2,458 T3,459 T4,460 T5,461 T6462 ): CallEffect<null, Fn, [T1, T2, T3, T4, T5, T6]>,463 <R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => R>(464 Fn,465 T1,466 T2,467 T3,468 T4,469 T5,470 T6,471 T7472 ): CallEffect<null, Fn, [T1, T2, T3, T4, T5, T6, T7]>,473 <R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R>(474 Fn,475 T1,476 T2,477 T3,478 T4,479 T5,480 T6,481 T7,482 T8483 ): CallEffect<null, Fn, [T1, T2, T3, T4, T5, T6, T7, T8]>,484 // call([context, fn], ...args)485 <Ctx, R, Fn: () => R>(cfn: [Ctx, Fn]): CallEffect<Ctx, Fn, []>,486 <Ctx, R, T1, Fn: T1 => R>(cfn: [Ctx, Fn], T1): CallEffect<Ctx, Fn, [T1]>,487 <Ctx, R, T1, T2, Fn: (T1, T2) => R>(cfn: [Ctx, Fn], T1, T2): CallEffect<Ctx, Fn, [T1, T2]>,488 <Ctx, R, T1, T2, T3, Fn: (T1, T2, T3) => R>(489 cfn: [Ctx, Fn],490 T1,491 T2,492 T3493 ): CallEffect<Ctx, Fn, [T1, T2, T3]>,494 <Ctx, R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>(495 cfn: [Ctx, Fn],496 T1,497 T2,498 T3,499 T4500 ): CallEffect<Ctx, Fn, [T1, T2, T3, T4]>,501 <Ctx, R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>(502 cfn: [Ctx, Fn],503 T1,504 T2,505 T3,506 T4,507 T5508 ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5]>,509 <Ctx, R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => R>(510 cfn: [Ctx, Fn],511 T1,512 T2,513 T3,514 T4,515 T5,516 T6517 ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6]>,518 <Ctx, R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => R>(519 cfn: [Ctx, Fn],520 T1,521 T2,522 T3,523 T4,524 T5,525 T6,526 T7527 ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7]>,528 <Ctx, R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R>(529 cfn: [Ctx, Fn],530 T1,531 T2,532 T3,533 T4,534 T5,535 T6,536 T7,537 T8538 ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7, T8]>,539 // call([context, fnName], ...args)540 <R, FnName: string, Fn: () => R, Ctx: { [FnName]: Fn, ... }>(541 cfn: [Ctx, FnName]542 ): CallEffect<Ctx, Fn, []>,543 <R, FnName: string, T1, Fn: T1 => R, Ctx: { [FnName]: Fn, ... }>(544 cfn: [Ctx, FnName],545 T1546 ): CallEffect<Ctx, Fn, [T1]>,547 <R, FnName: string, T1, T2, Fn: (T1, T2) => R, Ctx: { [FnName]: Fn, ... }>(548 cfn: [Ctx, FnName],549 T1,550 T2551 ): CallEffect<Ctx, Fn, [T1, T2]>,552 <R, FnName: string, T1, T2, T3, Fn: (T1, T2, T3) => R, Ctx: { [FnName]: Fn, ... }>(553 cfn: [Ctx, FnName],554 T1,555 T2,556 T3557 ): CallEffect<Ctx, Fn, [T1, T2, T3]>,558 <R, FnName: string, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R, Ctx: { [FnName]: Fn, ... }>(559 cfn: [Ctx, FnName],560 T1,561 T2,562 T3,563 T4564 ): CallEffect<Ctx, Fn, [T1, T2, T3, T4]>,565 <R, FnName: string, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R, Ctx: { [FnName]: Fn, ... }>(566 cfn: [Ctx, FnName],567 T1,568 T2,569 T3,570 T4,571 T5572 ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5]>,573 <574 R,575 FnName: string,576 T1,577 T2,578 T3,579 T4,580 T5,581 T6,582 Fn: (T1, T2, T3, T4, T5, T6) => R,583 Ctx: { [FnName]: Fn, ... }584 >(585 cfn: [Ctx, FnName],586 T1,587 T2,588 T3,589 T4,590 T5,591 T6592 ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6]>,593 <594 R,595 FnName: string,596 T1,597 T2,598 T3,599 T4,600 T5,601 T6,602 T7,603 Fn: (T1, T2, T3, T4, T5, T6, T7) => R,604 Ctx: { [FnName]: Fn, ... }605 >(606 cfn: [Ctx, FnName],607 T1,608 T2,609 T3,610 T4,611 T5,612 T6,613 T7614 ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7]>,615 <616 R,617 FnName: string,618 T1,619 T2,620 T3,621 T4,622 T5,623 T6,624 T7,625 T8,626 Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R,627 Ctx: { [FnName]: Fn, ... }628 >(629 cfn: [Ctx, FnName],630 T1,631 T2,632 T3,633 T4,634 T5,635 T6,636 T7,637 T8638 ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7, T8]>,639 // call({context, fn}, ...args)640 <Ctx, R, Fn: () => R>(cfn: {641 context: Ctx,642 fn: Fn,643 ...644 }): CallEffect<Ctx, Fn, []>,645 <Ctx, R, T1, Fn: T1 => R>(cfn: {646 context: Ctx,647 fn: Fn,648 ...649 }, T1): CallEffect<Ctx, Fn, [T1]>,650 <Ctx, R, T1, T2, Fn: (T1, T2) => R>(651 cfn: {652 context: Ctx,653 fn: Fn,654 ...655 },656 T1,657 T2658 ): CallEffect<Ctx, Fn, [T1, T2]>,659 <Ctx, R, T1, T2, T3, Fn: (T1, T2, T3) => R>(660 cfn: {661 context: Ctx,662 fn: Fn,663 ...664 },665 T1,666 T2,667 T3668 ): CallEffect<Ctx, Fn, [T1, T2, T3]>,669 <Ctx, R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>(670 cfn: {671 context: Ctx,672 fn: Fn,673 ...674 },675 T1,676 T2,677 T3,678 T4679 ): CallEffect<Ctx, Fn, [T1, T2, T3, T4]>,680 <Ctx, R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>(681 cfn: {682 context: Ctx,683 fn: Fn,684 ...685 },686 T1,687 T2,688 T3,689 T4,690 T5691 ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5]>,692 <Ctx, R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => R>(693 cfn: {694 context: Ctx,695 fn: Fn,696 ...697 },698 T1,699 T2,700 T3,701 T4,702 T5,703 T6704 ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6]>,705 <Ctx, R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => R>(706 cfn: {707 context: Ctx,708 fn: Fn,709 ...710 },711 T1,712 T2,713 T3,714 T4,715 T5,716 T6,717 T7718 ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7]>,719 <Ctx, R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R>(720 cfn: {721 context: Ctx,722 fn: Fn,723 ...724 },725 T1,726 T2,727 T3,728 T4,729 T5,730 T6,731 T7,732 T8733 ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7, T8]>,734 ...735 };736 declare export var apply: {737 // apply(context, fn, args)738 <Ctx, R, Fn: () => R>(Ctx, Fn): CallEffect<Ctx, Fn, []>,739 <Ctx, R, T1, Fn: T1 => R>(Ctx, Fn, T1): CallEffect<Ctx, Fn, [T1]>,740 <Ctx, R, T1, T2, Fn: (T1, T2) => R>(Ctx, Fn, T1, T2): CallEffect<Ctx, Fn, [T1, T2]>,741 <Ctx, R, T1, T2, T3, Fn: (T1, T2, T3) => R>(742 Ctx,743 Fn,744 T1,745 T2,746 T3747 ): CallEffect<Ctx, Fn, [T1, T2, T3]>,748 <Ctx, R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>(749 Ctx,750 Fn,751 T1,752 T2,753 T3,754 T4755 ): CallEffect<Ctx, Fn, [T1, T2, T3, T4]>,756 <Ctx, R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>(757 Ctx,758 Fn,759 T1,760 T2,761 T3,762 T4,763 T5764 ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5]>,765 <Ctx, R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => R>(766 Ctx,767 Fn,768 T1,769 T2,770 T3,771 T4,772 T5,773 T6774 ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6]>,775 <Ctx, R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => R>(776 Ctx,777 Fn,778 T1,779 T2,780 T3,781 T4,782 T5,783 T6,784 T7785 ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7]>,786 <Ctx, R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R>(787 Ctx,788 Fn,789 T1,790 T2,791 T3,792 T4,793 T5,794 T6,795 T7,796 T8797 ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7, T8]>,798 ...799 };800 declare type NodeCallback<R> = {801 (err: Error): void,802 (err: null | void | false, result: R): void,803 ...804 };805 declare export var cps: {806 // cps(fn, ...args)807 <R, Fn: (NodeCallback<R>) => void>(Fn): CpsEffect<null, Fn, []>,808 <R, T1, Fn: (T1, NodeCallback<R>) => void>(Fn, T1): CpsEffect<null, Fn, [T1]>,809 <R, T1, T2, Fn: (T1, T2, NodeCallback<R>) => void>(Fn, T1, T2): CpsEffect<null, Fn, [T1, T2]>,810 <R, T1, T2, T3, Fn: (T1, T2, T3, NodeCallback<R>) => void>(811 Fn,812 T1,813 T2,814 T3815 ): CpsEffect<null, Fn, [T1, T2, T3]>,816 <R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4, NodeCallback<R>) => void>(817 Fn,818 T1,819 T2,820 T3,821 T4822 ): CpsEffect<null, Fn, [T1, T2, T3, T4]>,823 <R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5, NodeCallback<R>) => void>(824 Fn,825 T1,826 T2,827 T3,828 T4,829 T5830 ): CpsEffect<null, Fn, [T1, T2, T3, T4, T5]>,831 <R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6, NodeCallback<R>) => void>(832 Fn,833 T1,834 T2,835 T3,836 T4,837 T5,838 T6839 ): CpsEffect<null, Fn, [T1, T2, T3, T4, T5, T6]>,840 <R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7, NodeCallback<R>) => void>(841 Fn,842 T1,843 T2,844 T3,845 T4,846 T5,847 T6,848 T7849 ): CpsEffect<null, Fn, [T1, T2, T3, T4, T5, T6, T7]>,850 <851 R,852 T1,853 T2,854 T3,855 T4,856 T5,857 T6,858 T7,859 T8,860 Fn: (T1, T2, T3, T4, T5, T6, T7, T8, NodeCallback<R>) => void861 >(862 Fn,863 T1,864 T2,865 T3,866 T4,867 T5,868 T6,869 T7,870 T8871 ): CpsEffect<null, Fn, [T1, T2, T3, T4, T5, T6, T7, T8]>,872 // cps([context, fn], ...args)873 <Ctx, R, Fn: (NodeCallback<R>) => void>(cfn: [Ctx, Fn]): CpsEffect<Ctx, Fn, []>,874 <Ctx, R, T1, Fn: (T1, NodeCallback<R>) => void>(cfn: [Ctx, Fn], T1): CpsEffect<Ctx, Fn, [T1]>,875 <Ctx, R, T1, T2, Fn: (T1, T2, NodeCallback<R>) => void>(876 cfn: [Ctx, Fn],877 T1,878 T2879 ): CpsEffect<Ctx, Fn, [T1, T2]>,880 <Ctx, R, T1, T2, T3, Fn: (T1, T2, T3, NodeCallback<R>) => void>(881 cfn: [Ctx, Fn],882 T1,883 T2,884 T3885 ): CpsEffect<Ctx, Fn, [T1, T2, T3]>,886 <Ctx, R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4, NodeCallback<R>) => void>(887 cfn: [Ctx, Fn],888 T1,889 T2,890 T3,891 T4892 ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4]>,893 <Ctx, R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5, NodeCallback<R>) => void>(894 cfn: [Ctx, Fn],895 T1,896 T2,897 T3,898 T4,899 T5900 ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4, T5]>,901 <Ctx, R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6, NodeCallback<R>) => void>(902 cfn: [Ctx, Fn],903 T1,904 T2,905 T3,906 T4,907 T5,908 T6909 ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6]>,910 <Ctx, R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7, NodeCallback<R>) => void>(911 cfn: [Ctx, Fn],912 T1,913 T2,914 T3,915 T4,916 T5,917 T6,918 T7919 ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7]>,920 <921 Ctx,922 R,923 T1,924 T2,925 T3,926 T4,927 T5,928 T6,929 T7,930 T8,931 Fn: (T1, T2, T3, T4, T5, T6, T7, T8, NodeCallback<R>) => void932 >(933 cfn: [Ctx, Fn],934 T1,935 T2,936 T3,937 T4,938 T5,939 T6,940 T7,941 T8942 ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7, T8]>,943 // cps({context, fn}, ...args)944 <Ctx, R, Fn: (NodeCallback<R>) => void>(cfn: {945 context: Ctx,946 fn: Fn,947 ...948 }): CpsEffect<Ctx, Fn, []>,949 <Ctx, R, T1, Fn: (T1, NodeCallback<R>) => void>(950 cfn: {951 context: Ctx,952 fn: Fn,953 ...954 },955 T1956 ): CpsEffect<Ctx, Fn, [T1]>,957 <Ctx, R, T1, T2, Fn: (T1, T2, NodeCallback<R>) => void>(958 cfn: {959 context: Ctx,960 fn: Fn,961 ...962 },963 T1,964 T2965 ): CpsEffect<Ctx, Fn, [T1, T2]>,966 <Ctx, R, T1, T2, T3, Fn: (T1, T2, T3, NodeCallback<R>) => void>(967 cfn: {968 context: Ctx,969 fn: Fn,970 ...971 },972 T1,973 T2,974 T3975 ): CpsEffect<Ctx, Fn, [T1, T2, T3]>,976 <Ctx, R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4, NodeCallback<R>) => void>(977 cfn: {978 context: Ctx,979 fn: Fn,980 ...981 },982 T1,983 T2,984 T3,985 T4986 ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4]>,987 <Ctx, R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5, NodeCallback<R>) => void>(988 cfn: {989 context: Ctx,990 fn: Fn,991 ...992 },993 T1,994 T2,995 T3,996 T4,997 T5998 ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4, T5]>,999 <Ctx, R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6, NodeCallback<R>) => void>(1000 cfn: {1001 context: Ctx,1002 fn: Fn,1003 ...1004 },1005 T1,1006 T2,1007 T3,1008 T4,1009 T5,1010 T61011 ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6]>,1012 <Ctx, R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7, NodeCallback<R>) => void>(1013 cfn: {1014 context: Ctx,1015 fn: Fn,1016 ...1017 },1018 T1,1019 T2,1020 T3,1021 T4,1022 T5,1023 T6,1024 T71025 ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7]>,1026 <1027 Ctx,1028 R,1029 T1,1030 T2,1031 T3,1032 T4,1033 T5,1034 T6,1035 T7,1036 T8,1037 Fn: (T1, T2, T3, T4, T5, T6, T7, T8, NodeCallback<R>) => void1038 >(1039 cfn: {1040 context: Ctx,1041 fn: Fn,1042 ...1043 },1044 T1,1045 T2,1046 T3,1047 T4,1048 T5,1049 T6,1050 T7,1051 T81052 ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7, T8]>,1053 ...1054 };1055 declare export var fork: {1056 // fork(fn, ...args)1057 <R, Fn: () => R>(Fn): ForkEffect<null, Fn, void, []>,1058 <R, T1, Fn: T1 => R>(Fn, T1): ForkEffect<null, Fn, void, [T1]>,1059 <R, T1, T2, Fn: (T1, T2) => R>(Fn, T1, T2): ForkEffect<null, Fn, void, [T1, T2]>,1060 <R, T1, T2, T3, Fn: (T1, T2, T3) => R>(1061 Fn,1062 T1,1063 T2,1064 T31065 ): ForkEffect<null, Fn, void, [T1, T2, T3]>,1066 <R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>(1067 Fn,1068 T1,1069 T2,1070 T3,1071 T41072 ): ForkEffect<null, Fn, void, [T1, T2, T3, T4]>,1073 <R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>(1074 Fn,1075 T1,1076 T2,1077 T3,1078 T4,1079 T51080 ): ForkEffect<null, Fn, void, [T1, T2, T3, T4, T5]>,1081 <R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => R>(1082 Fn,1083 T1,1084 T2,1085 T3,1086 T4,1087 T5,1088 T61089 ): ForkEffect<null, Fn, void, [T1, T2, T3, T4, T5, T6]>,1090 <R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => R>(1091 Fn,1092 T1,1093 T2,1094 T3,1095 T4,1096 T5,1097 T6,1098 T71099 ): ForkEffect<null, Fn, void, [T1, T2, T3, T4, T5, T6, T7]>,1100 <R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R>(1101 Fn,1102 T1,1103 T2,1104 T3,1105 T4,1106 T5,1107 T6,1108 T7,1109 T81110 ): ForkEffect<null, Fn, void, [T1, T2, T3, T4, T5, T6, T7, T8]>,1111 // fork([context, fn], ...args)1112 <Ctx, R, Fn: () => R>(cfn: [Ctx, Fn]): ForkEffect<Ctx, Fn, void, []>,1113 <Ctx, R, T1, Fn: T1 => R>(cfn: [Ctx, Fn], T1): ForkEffect<Ctx, Fn, void, [T1]>,1114 <Ctx, R, T1, T2, Fn: (T1, T2) => R>(1115 cfn: [Ctx, Fn],1116 T1,1117 T21118 ): ForkEffect<Ctx, Fn, void, [T1, T2]>,1119 <Ctx, R, T1, T2, T3, Fn: (T1, T2, T3) => R>(1120 cfn: [Ctx, Fn],1121 T1,1122 T2,1123 T31124 ): ForkEffect<Ctx, Fn, void, [T1, T2, T3]>,1125 <Ctx, R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>(1126 cfn: [Ctx, Fn],1127 T1,1128 T2,1129 T3,1130 T41131 ): ForkEffect<Ctx, Fn, void, [T1, T2, T3, T4]>,1132 <Ctx, R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>(1133 cfn: [Ctx, Fn],1134 T1,1135 T2,1136 T3,1137 T4,1138 T51139 ): ForkEffect<Ctx, Fn, void, [T1, T2, T3, T4, T5]>,1140 <Ctx, R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => R>(1141 cfn: [Ctx, Fn],1142 T1,1143 T2,1144 T3,1145 T4,1146 T5,1147 T61148 ): ForkEffect<Ctx, Fn, void, [T1, T2, T3, T4, T5, T6]>,1149 <Ctx, R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => R>(1150 cfn: [Ctx, Fn],1151 T1,1152 T2,1153 T3,1154 T4,1155 T5,1156 T6,1157 T71158 ): ForkEffect<Ctx, Fn, void, [T1, T2, T3, T4, T5, T6, T7]>,1159 <Ctx, R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R>(1160 cfn: [Ctx, Fn],1161 T1,1162 T2,1163 T3,1164 T4,1165 T5,1166 T6,1167 T7,1168 T81169 ): ForkEffect<Ctx, Fn, void, [T1, T2, T3, T4, T5, T6, T7, T8]>,1170 // fork({context, fn}, ...args)1171 <Ctx, R, Fn: () => R>(cfn: {1172 context: Ctx,1173 fn: Fn,1174 ...1175 }): ForkEffect<Ctx, Fn, void, []>,1176 <Ctx, R, T1, Fn: T1 => R>(cfn: {1177 context: Ctx,1178 fn: Fn,1179 ...1180 }, T1): ForkEffect<Ctx, Fn, void, [T1]>,1181 <Ctx, R, T1, T2, Fn: (T1, T2) => R>(1182 cfn: {1183 context: Ctx,1184 fn: Fn,1185 ...1186 },1187 T1,1188 T21189 ): ForkEffect<Ctx, Fn, void, [T1, T2]>,1190 <Ctx, R, T1, T2, T3, Fn: (T1, T2, T3) => R>(1191 cfn: {1192 context: Ctx,1193 fn: Fn,1194 ...1195 },1196 T1,1197 T2,1198 T31199 ): ForkEffect<Ctx, Fn, void, [T1, T2, T3]>,1200 <Ctx, R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>(1201 cfn: {1202 context: Ctx,1203 fn: Fn,1204 ...1205 },1206 T1,1207 T2,1208 T3,1209 T41210 ): ForkEffect<Ctx, Fn, void, [T1, T2, T3, T4]>,1211 <Ctx, R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>(1212 cfn: {1213 context: Ctx,1214 fn: Fn,1215 ...1216 },1217 T1,1218 T2,1219 T3,1220 T4,1221 T51222 ): ForkEffect<Ctx, Fn, void, [T1, T2, T3, T4, T5]>,1223 <Ctx, R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => R>(1224 cfn: {1225 context: Ctx,1226 fn: Fn,1227 ...1228 },1229 T1,1230 T2,1231 T3,1232 T4,1233 T5,1234 T61235 ): ForkEffect<Ctx, Fn, void, [T1, T2, T3, T4, T5, T6]>,1236 <Ctx, R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => R>(1237 cfn: {1238 context: Ctx,1239 fn: Fn,1240 ...1241 },1242 T1,1243 T2,1244 T3,1245 T4,1246 T5,1247 T6,1248 T71249 ): ForkEffect<Ctx, Fn, void, [T1, T2, T3, T4, T5, T6, T7]>,1250 <Ctx, R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R>(1251 cfn: {1252 context: Ctx,1253 fn: Fn,1254 ...1255 },1256 T1,1257 T2,1258 T3,1259 T4,1260 T5,1261 T6,1262 T7,1263 T81264 ): ForkEffect<Ctx, Fn, void, [T1, T2, T3, T4, T5, T6, T7, T8]>,1265 ...1266 };1267 declare export var spawn: {1268 // spawn(fn, ...args)1269 <R, Fn: () => R>(Fn): ForkEffect<null, Fn, { detached: true, ... }, []>,1270 <R, T1, Fn: T1 => R>(Fn, T1): ForkEffect<null, Fn, { detached: true, ... }, [T1]>,1271 <R, T1, T2, Fn: (T1, T2) => R>(Fn, T1, T2): ForkEffect<null, Fn, { detached: true, ... }, [T1, T2]>,1272 <R, T1, T2, T3, Fn: (T1, T2, T3) => R>(1273 Fn,1274 T1,1275 T2,1276 T31277 ): ForkEffect<null, Fn, { detached: true, ... }, [T1, T2, T3]>,1278 <R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>(1279 Fn,1280 T1,1281 T2,1282 T3,1283 T41284 ): ForkEffect<null, Fn, { detached: true, ... }, [T1, T2, T3, T4]>,1285 <R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>(1286 Fn,1287 T1,1288 T2,1289 T3,1290 T4,1291 T51292 ): ForkEffect<null, Fn, { detached: true, ... }, [T1, T2, T3, T4, T5]>,1293 <R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => R>(1294 Fn,1295 T1,1296 T2,1297 T3,1298 T4,1299 T5,1300 T61301 ): ForkEffect<null, Fn, { detached: true, ... }, [T1, T2, T3, T4, T5, T6]>,1302 <R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => R>(1303 Fn,1304 T1,1305 T2,1306 T3,1307 T4,1308 T5,1309 T6,1310 T71311 ): ForkEffect<null, Fn, { detached: true, ... }, [T1, T2, T3, T4, T5, T6, T7]>,1312 <R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R>(1313 Fn,1314 T1,1315 T2,1316 T3,1317 T4,1318 T5,1319 T6,1320 T7,1321 T81322 ): ForkEffect<null, Fn, { detached: true, ... }, [T1, T2, T3, T4, T5, T6, T7, T8]>,1323 // spawn([context, fn], ...args)1324 <Ctx, R, Fn: () => R>(cfn: [Ctx, Fn]): ForkEffect<Ctx, Fn, { detached: true, ... }, []>,1325 <Ctx, R, T1, Fn: T1 => R>(cfn: [Ctx, Fn], T1): ForkEffect<Ctx, Fn, { detached: true, ... }, [T1]>,1326 <Ctx, R, T1, T2, Fn: (T1, T2) => R>(1327 cfn: [Ctx, Fn],1328 T1,1329 T21330 ): ForkEffect<Ctx, Fn, { detached: true, ... }, [T1, T2]>,1331 <Ctx, R, T1, T2, T3, Fn: (T1, T2, T3) => R>(1332 cfn: [Ctx, Fn],1333 T1,1334 T2,1335 T31336 ): ForkEffect<Ctx, Fn, { detached: true, ... }, [T1, T2, T3]>,1337 <Ctx, R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>(1338 cfn: [Ctx, Fn],1339 T1,1340 T2,1341 T3,1342 T41343 ): ForkEffect<Ctx, Fn, { detached: true, ... }, [T1, T2, T3, T4]>,1344 <Ctx, R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>(1345 cfn: [Ctx, Fn],1346 T1,1347 T2,1348 T3,1349 T4,1350 T51351 ): ForkEffect<Ctx, Fn, { detached: true, ... }, [T1, T2, T3, T4, T5]>,1352 <Ctx, R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => R>(1353 cfn: [Ctx, Fn],1354 T1,1355 T2,1356 T3,1357 T4,1358 T5,1359 T61360 ): ForkEffect<Ctx, Fn, { detached: true, ... }, [T1, T2, T3, T4, T5, T6]>,1361 <Ctx, R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => R>(1362 cfn: [Ctx, Fn],1363 T1,1364 T2,1365 T3,1366 T4,1367 T5,1368 T6,1369 T71370 ): ForkEffect<Ctx, Fn, { detached: true, ... }, [T1, T2, T3, T4, T5, T6, T7]>,1371 <Ctx, R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R>(1372 cfn: [Ctx, Fn],1373 T1,1374 T2,1375 T3,1376 T4,1377 T5,1378 T6,1379 T7,1380 T81381 ): ForkEffect<Ctx, Fn, { detached: true, ... }, [T1, T2, T3, T4, T5, T6, T7, T8]>,1382 ...1383 };1384 declare export var join: {1385 // join(task)1386 // join([...tasks])1387 <T: Task<*>>(task: T): JoinEffect<T>,1388 <T: Array<Task<*>>>(tasks: T): JoinEffect<T>,1389 ...1390 };1391 declare export var cancel: {1392 // cancel()1393 // cancel(task)1394 // cancel([...tasks])1395 (): CancelEffect<"@@redux-saga/SELF_CANCELLATION">,1396 <T: Task<*>>(task: T): CancelEffect<T>,1397 <T: Task<*>>(tasks: Array<T>): CancelEffect<$ReadOnlyArray<T>>,1398 ...1399 };1400 declare export var select: {1401 // select(selector, ...args)1402 (): SelectEffect<void, []>,1403 <S, R, Fn: S => R>(Fn): SelectEffect<Fn, []>,1404 <S, R, T1, Fn: (S, T1) => R>(Fn, T1): SelectEffect<Fn, [T1]>,1405 <S, R, T1, T2, Fn: (S, T1, T2) => R>(Fn, T1, T2): SelectEffect<Fn, [T1, T2]>,1406 <S, R, T1, T2, T3, Fn: (S, T1, T2, T3) => R>(Fn, T1, T2, T3): SelectEffect<Fn, [T1, T2, T3]>,1407 <S, R, T1, T2, T3, T4, Fn: (S, T1, T2, T3, T4) => R>(1408 Fn,1409 T1,1410 T2,1411 T3,1412 T41413 ): SelectEffect<Fn, [T1, T2, T3, T4]>,1414 <S, R, T1, T2, T3, T4, T5, Fn: (S, T1, T2, T3, T4, T5) => R>(1415 Fn,1416 T1,1417 T2,1418 T3,1419 T4,1420 T51421 ): SelectEffect<Fn, [T1, T2, T3, T4, T5]>,1422 <S, R, T1, T2, T3, T4, T5, T6, Fn: (S, T1, T2, T3, T4, T5, T6) => R>(1423 Fn,1424 T1,1425 T2,1426 T3,1427 T4,1428 T5,1429 T61430 ): SelectEffect<Fn, [T1, T2, T3, T4, T5, T6]>,1431 <S, R, T1, T2, T3, T4, T5, T6, T7, Fn: (S, T1, T2, T3, T4, T5, T6, T7) => R>(1432 Fn,1433 T1,1434 T2,1435 T3,1436 T4,1437 T5,1438 T6,1439 T71440 ): SelectEffect<Fn, [T1, T2, T3, T4, T5, T6, T7]>,1441 <S, R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (S, T1, T2, T3, T4, T5, T6, T7, T8) => R>(1442 Fn,1443 T1,1444 T2,1445 T3,1446 T4,1447 T5,1448 T6,1449 T7,1450 T81451 ): SelectEffect<Fn, [T1, T2, T3, T4, T5, T6, T7, T8]>,1452 ...1453 };1454 declare export var actionChannel: {1455 // actionChannel(pattern, [buffer])1456 <BT>(): ActionChannelEffect<BT, void, void>,1457 <BT, P: Pattern>(pattern: P): ActionChannelEffect<BT, P, void>,1458 <BT, T, P: Pattern, B: Buffer<T>>(pattern: P, buffer: B): ActionChannelEffect<BT, P, B>,1459 ...1460 };1461 declare export var flush: { // flush(channel)1462 <T, CH: FlushableChannel<T>>(channel: CH): FlushEffect<CH>, ... };1463 declare export var cancelled: { // cancelled()1464 (): CancelledEffect, ... };1465 declare export var setContext: { // setContext(props)1466 <T: {...}>(props: T): SetContextEffect<T>, ... };1467 declare export var getContext: { // getContext(prop)1468 <T: string>(prop: T): GetContextEffect<T>, ... };1469 declare export var race: {1470 // race(effects)1471 // race([...effects])1472 <R: { +[name: string]: Effect, ... }>(effects: R): RaceEffect<R>,1473 <R: $ReadOnlyArray<Effect>>(effects: R): RaceEffect<R>,1474 ...1475 };1476 declare export var all: {1477 // all(effects)1478 // all([...effects])1479 (effects: { +[name: string]: Effect, ... }): AllEffect,1480 (effects: $ReadOnlyArray<Effect>): AllEffect,1481 ...1482 };1483 declare export var take: {1484 // take(pattern)1485 // take(channel)1486 (): AllTakeEffect<void>,1487 <T, CH: TakeableChannel<T>>(channel: CH): TakeEffect<void, { channel: CH, ... }, void>,1488 <P: Pattern>(pattern: P): TakeEffect<{ pattern: P, ... }, void, void>,1489 ...1490 };1491 declare export var takeMaybe: {1492 // takeMaybe(pattern)1493 // takeMaybe(channel)1494 (): AllTakeEffect<{ maybe: true, ... }>,1495 <T, CH: TakeableChannel<T>>(channel: CH): TakeEffect<void, { channel: CH, ... }, { maybe: true, ... }>,1496 <P: Pattern>(pattern: P): TakeEffect<{ pattern: P, ... }, void, { maybe: true, ... }>,1497 ...1498 };1499 declare export var takeEvery: {1500 // takeEvery(pattern, saga, ...args)1501 // takeEvery(channel, saga, ...args)1502 <A, R, P: TakeableChannel<*> | Pattern, Fn: A => R>(P, Fn): ForkEffect<null, Fn, void, [P, Fn]>,1503 <A, R, P: TakeableChannel<*> | Pattern, T1, Fn: (T1, A) => R>(1504 P,1505 Fn,1506 T11507 ): ForkEffect<null, Fn, void, [P, Fn, T1]>,1508 <A, R, P: TakeableChannel<*> | Pattern, T1, T2, Fn: (T1, T2, A) => R>(1509 P,1510 Fn,1511 T1,1512 T21513 ): ForkEffect<null, Fn, void, [P, Fn, T1, T2]>,1514 <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, Fn: (T1, T2, T3, A) => R>(1515 P,1516 Fn,1517 T1,1518 T2,1519 T31520 ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3]>,1521 <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, Fn: (T1, T2, T3, T4, A) => R>(1522 P,1523 Fn,1524 T1,1525 T2,1526 T3,1527 T41528 ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4]>,1529 <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5, A) => R>(1530 P,1531 Fn,1532 T1,1533 T2,1534 T3,1535 T4,1536 T51537 ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5]>,1538 <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6, A) => R>(1539 P,1540 Fn,1541 T1,1542 T2,1543 T3,1544 T4,1545 T5,1546 T61547 ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5, T6]>,1548 <1549 A,1550 R,1551 P: TakeableChannel<*> | Pattern,1552 T1,1553 T2,1554 T3,1555 T4,1556 T5,1557 T6,1558 T7,1559 Fn: (T1, T2, T3, T4, T5, T6, T7, A) => R1560 >(1561 P,1562 Fn,1563 T1,1564 T2,1565 T3,1566 T4,1567 T5,1568 T6,1569 T71570 ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5, T6, T7]>,1571 <1572 A,1573 R,1574 P: TakeableChannel<*> | Pattern,1575 T1,1576 T2,1577 T3,1578 T4,1579 T5,1580 T6,1581 T7,1582 T8,1583 Fn: (T1, T2, T3, T4, T5, T6, T7, T8, A) => R1584 >(1585 P,1586 Fn,1587 T1,1588 T2,1589 T3,1590 T4,1591 T5,1592 T6,1593 T7,1594 T81595 ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5, T6, T7, T8]>,1596 ...1597 };1598 declare export var takeLatest: {1599 // takeLatest(pattern, saga, ...args)1600 // takeLatest(channel, saga, ...args)1601 <A, R, P: TakeableChannel<*> | Pattern, Fn: A => R>(P, Fn): ForkEffect<null, Fn, void, [P, Fn]>,1602 <A, R, P: TakeableChannel<*> | Pattern, T1, Fn: (T1, A) => R>(1603 P,1604 Fn,1605 T11606 ): ForkEffect<null, Fn, void, [P, Fn, T1]>,1607 <A, R, P: TakeableChannel<*> | Pattern, T1, T2, Fn: (T1, T2, A) => R>(1608 P,1609 Fn,1610 T1,1611 T21612 ): ForkEffect<null, Fn, void, [P, Fn, T1, T2]>,1613 <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, Fn: (T1, T2, T3, A) => R>(1614 P,1615 Fn,1616 T1,1617 T2,1618 T31619 ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3]>,1620 <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, Fn: (T1, T2, T3, T4, A) => R>(1621 P,1622 Fn,1623 T1,1624 T2,1625 T3,1626 T41627 ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4]>,1628 <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5, A) => R>(1629 P,1630 Fn,1631 T1,1632 T2,1633 T3,1634 T4,1635 T51636 ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5]>,1637 <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6, A) => R>(1638 P,1639 Fn,1640 T1,1641 T2,1642 T3,1643 T4,1644 T5,1645 T61646 ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5, T6]>,1647 <1648 A,1649 R,1650 P: TakeableChannel<*> | Pattern,1651 T1,1652 T2,1653 T3,1654 T4,1655 T5,1656 T6,1657 T7,1658 Fn: (T1, T2, T3, T4, T5, T6, T7, A) => R1659 >(1660 P,1661 Fn,1662 T1,1663 T2,1664 T3,1665 T4,1666 T5,1667 T6,1668 T71669 ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5, T6, T7]>,1670 <1671 A,1672 R,1673 P: TakeableChannel<*> | Pattern,1674 T1,1675 T2,1676 T3,1677 T4,1678 T5,1679 T6,1680 T7,1681 T8,1682 Fn: (T1, T2, T3, T4, T5, T6, T7, T8, A) => R1683 >(1684 P,1685 Fn,1686 T1,1687 T2,1688 T3,1689 T4,1690 T5,1691 T6,1692 T7,1693 T81694 ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5, T6, T7, T8]>,1695 ...1696 };1697 declare export var takeLeading: {1698 // takeLeading(pattern, saga, ...args)1699 // takeLeading(channel, saga, ...args)1700 <A, R, P: TakeableChannel<*> | Pattern, Fn: A => R>(P, Fn): ForkEffect<null, Fn, void, [P, Fn]>,1701 <A, R, P: TakeableChannel<*> | Pattern, T1, Fn: (T1, A) => R>(1702 P,1703 Fn,1704 T11705 ): ForkEffect<null, Fn, void, [P, Fn, T1]>,1706 <A, R, P: TakeableChannel<*> | Pattern, T1, T2, Fn: (T1, T2, A) => R>(1707 P,1708 Fn,1709 T1,1710 T21711 ): ForkEffect<null, Fn, void, [P, Fn, T1, T2]>,1712 <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, Fn: (T1, T2, T3, A) => R>(1713 P,1714 Fn,1715 T1,1716 T2,1717 T31718 ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3]>,1719 <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, Fn: (T1, T2, T3, T4, A) => R>(1720 P,1721 Fn,1722 T1,1723 T2,1724 T3,1725 T41726 ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4]>,1727 <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5, A) => R>(1728 P,1729 Fn,1730 T1,1731 T2,1732 T3,1733 T4,1734 T51735 ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5]>,1736 <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6, A) => R>(1737 P,1738 Fn,1739 T1,1740 T2,1741 T3,1742 T4,1743 T5,1744 T61745 ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5, T6]>,1746 <1747 A,1748 R,1749 P: TakeableChannel<*> | Pattern,1750 T1,1751 T2,1752 T3,1753 T4,1754 T5,1755 T6,1756 T7,1757 Fn: (T1, T2, T3, T4, T5, T6, T7, A) => R1758 >(1759 P,1760 Fn,1761 T1,1762 T2,1763 T3,1764 T4,1765 T5,1766 T6,1767 T71768 ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5, T6, T7]>,1769 <1770 A,1771 R,1772 P: TakeableChannel<*> | Pattern,1773 T1,1774 T2,1775 T3,1776 T4,1777 T5,1778 T6,1779 T7,1780 T8,1781 Fn: (T1, T2, T3, T4, T5, T6, T7, T8, A) => R1782 >(1783 P,1784 Fn,1785 T1,1786 T2,1787 T3,1788 T4,1789 T5,1790 T6,1791 T7,1792 T81793 ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5, T6, T7, T8]>,1794 ...1795 };1796 declare export var delay: {1797 // delay(ms, [val])1798 <T1: number>(timeout: T1): CallEffect<null, (ms: T1) => Promise<true>, [T1]>,1799 <T1: number, T2>(timeout: T1, T2): CallEffect<null, (ms: T1) => Promise<true>, [T1, T2]>,1800 ...1801 };1802 declare export var throttle: {1803 // throttle(ms, pattern, saga, ...args)1804 // throttle(ms, channel, saga, ...args)1805 <MS: number, P: TakeableChannel<*> | Pattern, A, R, Fn: A => R>(1806 MS,1807 P,1808 Fn1809 ): ForkEffect<null, Fn, void, [MS, P, Fn]>,1810 <MS: number, P: TakeableChannel<*> | Pattern, A, R, T1, Fn: (T1, A) => R>(1811 MS,1812 P,1813 Fn,1814 T11815 ): ForkEffect<null, Fn, void, [MS, P, Fn, T1]>,1816 <MS: number, P: TakeableChannel<*> | Pattern, A, R, T1, T2, Fn: (T1, T2, A) => R>(1817 MS,1818 P,1819 Fn,1820 T1,1821 T21822 ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2]>,1823 <MS: number, P: TakeableChannel<*> | Pattern, A, R, T1, T2, T3, Fn: (T1, T2, T3, A) => R>(1824 MS,1825 P,1826 Fn,1827 T1,1828 T2,1829 T31830 ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3]>,1831 <MS: number, P: TakeableChannel<*> | Pattern, A, R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4, A) => R>(1832 MS,1833 P,1834 Fn,1835 T1,1836 T2,1837 T3,1838 T41839 ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3, T4]>,1840 <1841 MS: number,1842 P: TakeableChannel<*> | Pattern,1843 A,1844 R,1845 T1,1846 T2,1847 T3,1848 T4,1849 T5,1850 Fn: (T1, T2, T3, T4, T5, A) => R1851 >(1852 MS,1853 P,1854 Fn,1855 T1,1856 T2,1857 T3,1858 T4,1859 T51860 ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3, T4, T5]>,1861 <1862 MS: number,1863 P: TakeableChannel<*> | Pattern,1864 A,1865 R,1866 T1,1867 T2,1868 T3,1869 T4,1870 T5,1871 T6,1872 Fn: (T1, T2, T3, T4, T5, T6, A) => R1873 >(1874 MS,1875 P,1876 Fn,1877 T1,1878 T2,1879 T3,1880 T4,1881 T5,1882 T61883 ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3, T4, T5, T6]>,1884 <1885 MS: number,1886 P: TakeableChannel<*> | Pattern,1887 A,1888 R,1889 T1,1890 T2,1891 T3,1892 T4,1893 T5,1894 T6,1895 T7,1896 Fn: (T1, T2, T3, T4, T5, T6, T7, A) => R1897 >(1898 MS,1899 P,1900 Fn,1901 T1,1902 T2,1903 T3,1904 T4,1905 T5,1906 T6,1907 T71908 ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3, T4, T5, T6, T7]>,1909 <1910 MS: number,1911 P: TakeableChannel<*> | Pattern,1912 A,1913 R,1914 T1,1915 T2,1916 T3,1917 T4,1918 T5,1919 T6,1920 T7,1921 T8,1922 Fn: (T1, T2, T3, T4, T5, T6, T7, T8, A) => R1923 >(1924 MS,1925 P,1926 Fn,1927 T1,1928 T2,1929 T3,1930 T4,1931 T5,1932 T6,1933 T7,1934 T81935 ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3, T4, T5, T6, T7, T8]>,1936 ...1937 };1938 declare export var debounce: {1939 // debounce(ms, pattern, saga, ...args)1940 // debounce(ms, channel, saga, ...args)1941 <R, MS: number, P: TakeableChannel<*> | Pattern, Fn: () => R>(1942 MS,1943 P,1944 Fn1945 ): ForkEffect<null, Fn, void, [MS, P, Fn]>,1946 <R, MS: number, P: TakeableChannel<*> | Pattern, T1, Fn: T1 => R>(1947 MS,1948 P,1949 Fn,1950 T11951 ): ForkEffect<null, Fn, void, [MS, P, Fn, T1]>,1952 <R, MS: number, P: TakeableChannel<*> | Pattern, T1, T2, Fn: (T1, T2) => R>(1953 MS,1954 P,1955 Fn,1956 T1,1957 T21958 ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2]>,1959 <R, MS: number, P: TakeableChannel<*> | Pattern, T1, T2, T3, Fn: (T1, T2, T3) => R>(1960 MS,1961 P,1962 Fn,1963 T1,1964 T2,1965 T31966 ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3]>,1967 <R, MS: number, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>(1968 MS,1969 P,1970 Fn,1971 T1,1972 T2,1973 T3,1974 T41975 ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3, T4]>,1976 <R, MS: number, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>(1977 MS,1978 P,1979 Fn,1980 T1,1981 T2,1982 T3,1983 T4,1984 T51985 ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3, T4, T5]>,1986 <1987 R,1988 MS: number,1989 P: TakeableChannel<*> | Pattern,1990 T1,1991 T2,1992 T3,1993 T4,1994 T5,1995 T6,1996 Fn: (T1, T2, T3, T4, T5, T6) => R1997 >(1998 MS,1999 P,2000 Fn,2001 T1,2002 T2,2003 T3,2004 T4,2005 T5,2006 T62007 ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3, T4, T5, T6]>,2008 <2009 R,2010 MS: number,2011 P: TakeableChannel<*> | Pattern,2012 T1,2013 T2,2014 T3,2015 T4,2016 T5,2017 T6,2018 T7,2019 Fn: (T1, T2, T3, T4, T5, T6, T7) => R2020 >(2021 MS,2022 P,2023 Fn,2024 T1,2025 T2,2026 T3,2027 T4,2028 T5,2029 T6,2030 T72031 ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3, T4, T5, T6, T7]>,2032 <2033 R,2034 MS: number,2035 P: TakeableChannel<*> | Pattern,2036 T1,2037 T2,2038 T3,2039 T4,2040 T5,2041 T6,2042 T7,2043 T8,2044 Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R2045 >(2046 MS,2047 P,2048 Fn,2049 T1,2050 T2,2051 T3,2052 T4,2053 T5,2054 T6,2055 T7,2056 T82057 ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3, T4, T5, T6, T7, T8]>,2058 ...2059 };2060 declare export var retry: {2061 // retry(maxTries, delay, fn, ...args)2062 <R, MT: number, D: number, Fn: () => R>(MT, D, Fn): CallEffect<null, Function, [MT, D, Fn]>,2063 <R, MT: number, D: number, T1, Fn: T1 => R>(2064 MT,2065 D,2066 Fn,2067 T12068 ): CallEffect<null, Function, [MT, D, Fn, T1]>,2069 <R, MT: number, D: number, T1, T2, Fn: (T1, T2) => R>(2070 MT,2071 D,2072 Fn,2073 T1,2074 T22075 ): CallEffect<null, Function, [MT, D, Fn, T1, T2]>,2076 <R, MT: number, D: number, T1, T2, T3, Fn: (T1, T2, T3) => R>(2077 MT,2078 D,2079 Fn,2080 T1,2081 T2,2082 T32083 ): CallEffect<null, Function, [MT, D, Fn, T1, T2, T3]>,2084 <R, MT: number, D: number, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>(2085 MT,2086 D,2087 Fn,2088 T1,2089 T2,2090 T3,2091 T42092 ): CallEffect<null, Function, [MT, D, Fn, T1, T2, T3, T4]>,2093 <R, MT: number, D: number, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>(2094 MT,2095 D,2096 Fn,2097 T1,2098 T2,2099 T3,2100 T4,2101 T52102 ): CallEffect<null, Function, [MT, D, Fn, T1, T2, T3, T4, T5]>,2103 <R, MT: number, D: number, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => R>(2104 MT,2105 D,2106 Fn,2107 T1,2108 T2,2109 T3,2110 T4,2111 T5,2112 T62113 ): CallEffect<null, Function, [MT, D, Fn, T1, T2, T3, T4, T5, T6]>,2114 <R, MT: number, D: number, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => R>(2115 MT,2116 D,2117 Fn,2118 T1,2119 T2,2120 T3,2121 T4,2122 T5,2123 T6,2124 T72125 ): CallEffect<null, Function, [MT, D, Fn, T1, T2, T3, T4, T5, T6, T7]>,2126 <2127 R,2128 MT: number,2129 D: number,2130 T1,2131 T2,2132 T3,2133 T4,2134 T5,2135 T6,2136 T7,2137 T8,2138 Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R2139 >(2140 MT,2141 D,2142 Fn,2143 T1,2144 T2,2145 T3,2146 T4,2147 T5,2148 T6,2149 T7,2150 T82151 ): CallEffect<null, Function, [MT, D, Fn, T1, T2, T3, T4, T5, T6, T7, T8]>,2152 ...2153 };...

Full Screen

Full Screen

common.py

Source:common.py Github

copy

Full Screen

1from __future__ import print_function2import sys, os, re3#4# Parser helpers5#6def remove_comments(s):7 def replacer(match):8 s = match.group(0)9 if s.startswith('/'):10 return ""11 else:12 return s13 pattern = re.compile(14 r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"',15 re.DOTALL | re.MULTILINE16 )17 return re.sub(pattern, replacer, s)18def getTokens(s):19 return re.findall(r'[a-z_A-Z0-9_]+|[^[a-z_A-Z0-9_ \n\r\t]', s)20def getParameter(pos, tokens):21 deep = 022 p = []23 while True:24 if pos >= len(tokens):25 break26 if (tokens[pos] == ')' or tokens[pos] == ',') and deep == 0:27 if tokens[pos] == ')':28 pos = len(tokens)29 else:30 pos += 131 break32 if tokens[pos] == '(':33 deep += 134 if tokens[pos] == ')':35 deep -= 136 p.append(tokens[pos])37 pos += 138 return (' '.join(p), pos)39def getParameters(i, tokens):40 assert tokens[i] == '('41 i += 142 params = []43 while True:44 if i >= len(tokens) or tokens[i] == ')':45 break46 (param, i) = getParameter(i, tokens)47 if len(param) > 0:48 params.append(param)49 else:50 assert False51 break52 if len(params) > 0 and params[0] == 'void':53 del params[0]54 return params55def postProcessParameters(fns):56 fns.sort(key=lambda x: x['name'])57 for fn in fns:58 fn['params_full'] = list(fn['params'])59 for i in range(len(fn['params'])):60 p = fn['params'][i]61 if p.find('(') != -1:62 p = re.sub(r'\* *([a-zA-Z0-9_]*) ?\)', '*)', p, 1)63 fn['params'][i] = p64 continue65 parts = re.findall(r'[a-z_A-Z0-9]+|\*', p)66 if len(parts) > 1:67 if parts[-1].find('*') == -1:68 del parts[-1]69 fn['params'][i] = ' '.join(parts)70def readFunctionFilter(fns, fileName):71 try:72 f = open(fileName, "r")73 except:74 print("ERROR: Can't open filter file: %s" % fileName)75 return 076 count = 077 while f:78 line = f.readline()79 if not line:80 break81 assert isinstance(line, str)82 if line.startswith('#') or line.startswith('//'):83 continue84 line = line.replace('\n', '')85 if len(line) == 0:86 continue87 found = False88 for fn in fns:89 if fn['name'] == line:90 found = True91 fn['enabled'] = True92 if not found:93 sys.exit("FATAL ERROR: Unknown function: %s" % line)94 count = count + 195 f.close()96 return count97#98# Generator helpers99#100def outputToString(f):101 def wrapped(*args, **kwargs):102 from cStringIO import StringIO103 old_stdout = sys.stdout104 sys.stdout = str_stdout = StringIO()105 res = f(*args, **kwargs)106 assert res is None107 sys.stdout = old_stdout108 result = str_stdout.getvalue()109 result = re.sub(r'([^\n /]) [ ]+', r'\1 ', result) # don't remove spaces at start of line110 result = re.sub(r' ,', ',', result)111 result = re.sub(r' \*', '*', result)112 result = re.sub(r'\( ', '(', result)113 result = re.sub(r' \)', ')', result)114 return result115 return wrapped116@outputToString117def generateFilterNames(fns):118 for fn in fns:119 print('%s%s' % ('' if 'enabled' in fn else '//', fn['name']))120 print('#total %d' % len(fns))121callback_check = re.compile(r'([^\(]*\(.*)(\* *)(\).*\(.*\))')122def getTypeWithParam(t, p):123 if callback_check.match(t):124 return callback_check.sub(r'\1 *' + p + r'\3', t)125 return t + ' ' + p126@outputToString127def generateStructDefinitions(fns, lprefix='opencl_fn', enumprefix='OPENCL_FN'):128 print('// generated by %s' % os.path.basename(sys.argv[0]))129 for fn in fns:130 commentStr = '' if 'enabled' in fn else '//'131 decl_args = []132 for (i, t) in enumerate(fn['params']):133 decl_args.append(getTypeWithParam(t, 'p%d' % (i+1)))134 decl_args_str = '(' + (', '.join(decl_args)) + ')'135 print('%s%s%d(%s_%s, %s, %s)' % \136 (commentStr, lprefix, len(fn['params']), enumprefix, fn['name'], \137 ' '.join(fn['ret']), decl_args_str))138 print(commentStr + ('%s%s (%s *%s)(%s) =\n%s %s_%s_switch_fn;' % \139 ((' '.join(fn['modifiers'] + ' ') if len(fn['modifiers']) > 0 else ''),140 ' '.join(fn['ret']), ' '.join(fn['calling']), fn['name'], ', '.join(fn['params']), \141 commentStr, enumprefix, fn['name'])))142 print(commentStr + ('static const struct DynamicFnEntry %s_definition = { "%s", (void**)&%s};' % (fn['name'], fn['name'], fn['name'])))143 print()144@outputToString145def generateStaticDefinitions(fns):146 print('// generated by %s' % os.path.basename(sys.argv[0]))147 for fn in fns:148 commentStr = '' if 'enabled' in fn else '//'149 decl_args = []150 for (i, t) in enumerate(fn['params']):151 decl_args.append(getTypeWithParam(t, 'p%d' % (i+1)))152 decl_args_str = '(' + (', '.join(decl_args)) + ')'153 print(commentStr + ('CL_RUNTIME_EXPORT %s%s (%s *%s_pfn)(%s) = %s;' % \154 ((' '.join(fn['modifiers'] + ' ') if len(fn['modifiers']) > 0 else ''),155 ' '.join(fn['ret']), ' '.join(fn['calling']), fn['name'], ', '.join(fn['params']), \156 fn['name'])))157@outputToString158def generateListOfDefinitions(fns, name='opencl_fn_list'):159 print('// generated by %s' % os.path.basename(sys.argv[0]))160 print('static const struct DynamicFnEntry* %s[] = {' % (name))161 for fn in fns:162 commentStr = '' if 'enabled' in fn else '//'163 if 'enabled' in fn:164 print(' &%s_definition,' % (fn['name']))165 else:166 print(' NULL/*&%s_definition*/,' % (fn['name']))167 first = False168 print('};')169@outputToString170def generateEnums(fns, prefix='OPENCL_FN'):171 print('// generated by %s' % os.path.basename(sys.argv[0]))172 print('enum %s_ID {' % prefix)173 for (i, fn) in enumerate(fns):174 commentStr = '' if 'enabled' in fn else '//'175 print(commentStr + (' %s_%s = %d,' % (prefix, fn['name'], i)))176 print('};')177@outputToString178def generateRemapOrigin(fns):179 print('// generated by %s' % os.path.basename(sys.argv[0]))180 for fn in fns:181 print('#define %s %s_' % (fn['name'], fn['name']))182@outputToString183def generateRemapDynamic(fns):184 print('// generated by %s' % os.path.basename(sys.argv[0]))185 for fn in fns:186 print('#undef %s' % (fn['name']))187 commentStr = '' if 'enabled' in fn else '//'188 print(commentStr + ('#define %s %s_pfn' % (fn['name'], fn['name'])))189@outputToString190def generateFnDeclaration(fns):191 print('// generated by %s' % os.path.basename(sys.argv[0]))192 for fn in fns:193 commentStr = '' if 'enabled' in fn else '//'194 print(commentStr + ('extern CL_RUNTIME_EXPORT %s %s (%s *%s)(%s);' % (' '.join(fn['modifiers']), ' '.join(fn['ret']), ' '.join(fn['calling']),195 fn['name'], ', '.join(fn['params'] if 'params_full' not in fn else fn['params_full']))))196@outputToString197def generateTemplates(total, lprefix, switch_name, calling_convention=''):198 print('// generated by %s' % os.path.basename(sys.argv[0]))199 for sz in range(total):200 template_params = ['ID', '_R', 'decl_args']201 params = ['p%d' % (i + 1) for i in range(0, sz)]202 print('#define %s%d(%s) \\' % (lprefix, sz, ', '.join(template_params)))203 print(' typedef _R (%s *ID##FN)decl_args; \\' % (calling_convention))204 print(' static _R %s ID##_switch_fn decl_args \\' % (calling_convention))205 print(' { return ((ID##FN)%s(ID))(%s); } \\' % (switch_name, ', '.join(params)))206 print('')207@outputToString208def generateInlineWrappers(fns):209 print('// generated by %s' % os.path.basename(sys.argv[0]))210 for fn in fns:211 commentStr = '' if 'enabled' in fn else '//'212 print('#undef %s' % (fn['name']))213 print(commentStr + ('#define %s %s_fn' % (fn['name'], fn['name'])))214 params = []215 call_params = []216 for i in range(0, len(fn['params'])):217 t = fn['params'][i]218 if t.find('*)') >= 0:219 p = re.sub(r'\*\)', (' *p%d)' % i), t, 1)220 params.append(p)221 else:222 params.append('%s p%d' % (t, i))223 call_params.append('p%d' % (i))224 if len(fn['ret']) == 1 and fn['ret'][0] == 'void':225 print(commentStr + ('inline void %s(%s) { %s_pfn(%s); }' \226 % (fn['name'], ', '.join(params), fn['name'], ', '.join(call_params))))227 else:228 print(commentStr + ('inline %s %s(%s) { return %s_pfn(%s); }' \229 % (' '.join(fn['ret']), fn['name'], ', '.join(params), fn['name'], ', '.join(call_params))))230def ProcessTemplate(inputFile, ctx, noteLine='//\n// AUTOGENERATED, DO NOT EDIT\n//'):231 f = open(inputFile, "r")232 if noteLine:233 print(noteLine)234 for line in f:235 if line.startswith('@'):236 assert line[-1] == '\n'237 line = line[:-1] # remove '\n'238 assert line[-1] == '@'239 name = line[1:-1]240 assert name in ctx, name241 line = ctx[name] + ('\n' if len(ctx[name]) > 0 and ctx[name][-1] != '\n' else '')242 sys.stdout.write(line)...

Full Screen

Full Screen

_getDataFunctions.js

Source:_getDataFunctions.js Github

copy

Full Screen

...10 // Object property access11 oTest.fnTest(12 "Single object, single property",13 function () {14 fn = table.oApi._fnGetObjectDataFn('test');15 test = fn( { "test": true } );16 },17 function () { return test }18 );19 20 oTest.fnTest(21 "Single property from object",22 function () {23 fn = table.oApi._fnGetObjectDataFn('test');24 test = fn( { "test": true, "test2": false } );25 },26 function () { return test }27 );28 29 oTest.fnTest(30 "Single property from object - different property",31 function () {32 fn = table.oApi._fnGetObjectDataFn('test2');33 test = fn( { "test": true, "test2": false } );34 },35 function () { return test===false }36 );37 38 oTest.fnTest(39 "Undefined property from object",40 function () {41 fn = table.oApi._fnGetObjectDataFn('test3');42 test = fn( { "test": true, "test2": false } );43 },44 function () { return test===undefined }45 );46 47 // Array index access48 oTest.fnTest(49 "Array access - index 0",50 function () {51 fn = table.oApi._fnGetObjectDataFn(0);52 test = fn( [true, false, false, false] );53 },54 function () { return test }55 );56 57 oTest.fnTest(58 "Array access - index 1",59 function () {60 fn = table.oApi._fnGetObjectDataFn(2);61 test = fn( [false, false, true, false] );62 },63 function () { return test }64 );65 66 oTest.fnTest(67 "Array access - undefined",68 function () {69 fn = table.oApi._fnGetObjectDataFn(7);70 test = fn( [false, false, true, false] );71 },72 function () { return test===undefined }73 );74 // null source75 oTest.fnTest(76 "null source",77 function () {78 fn = table.oApi._fnGetObjectDataFn( null );79 test = fn( [false, false, true, false] );80 },81 function () { return test===null }82 );83 // nested objects84 oTest.fnTest(85 "Nested object property",86 function () {87 fn = table.oApi._fnGetObjectDataFn( 'a.b' );88 test = fn( {89 "a":{90 "b": true,91 "c": false,92 "d": 193 }94 } );95 },96 function () { return test }97 );98 oTest.fnTest(99 "Nested object property - different prop",100 function () {101 fn = table.oApi._fnGetObjectDataFn( 'a.d' );102 test = fn( {103 "a":{104 "b": true,105 "c": false,106 "d": 1107 }108 } );109 },110 function () { return test===1 }111 );112 113 oTest.fnTest(114 "Nested object property - undefined prop",115 function () {116 fn = table.oApi._fnGetObjectDataFn( 'a.z' );117 test = fn( {118 "a":{119 "b": true,120 "c": false,121 "d": 1122 }123 } );124 },125 function () { return test===undefined }126 );127 // Nested array128 oTest.fnTest(129 "Nested array index property",130 function () {131 fn = table.oApi._fnGetObjectDataFn( 'a.0' );132 test = fn( {133 "a": [134 true,135 false,136 1137 ]138 } );139 },140 function () { return test }141 );142 oTest.fnTest(143 "Nested array index property - different index",144 function () {145 fn = table.oApi._fnGetObjectDataFn( 'a.2' );146 test = fn( {147 "a": [148 true,149 false,150 1151 ]152 } );153 },154 function () { return test===1 }155 );156 oTest.fnTest(157 "Nested array index property - undefined index",158 function () {159 fn = table.oApi._fnGetObjectDataFn( 'a.10' );160 test = fn( {161 "a": [162 true,163 false,164 1165 ]166 } );167 },168 function () { return test===undefined }169 );170 // Nested array object property171 oTest.fnTest(172 "Nested array index object property",173 function () {174 fn = table.oApi._fnGetObjectDataFn( 'a.0.m' );175 test = fn( {176 "a": [177 { "m": true, "n": 1 },178 { "m": false, "n": 2 },179 { "m": false, "n": 3 }180 ]181 } );182 },183 function () { return test }184 );185 oTest.fnTest(186 "Nested array index object property - different index",187 function () {188 fn = table.oApi._fnGetObjectDataFn( 'a.2.n' );189 test = fn( {190 "a": [191 { "m": true, "n": 1 },192 { "m": false, "n": 2 },193 { "m": false, "n": 3 }194 ]195 } );196 },197 function () { return test===3 }198 );199 oTest.fnTest(200 "Nested array index object property - undefined index",201 function () {202 fn = table.oApi._fnGetObjectDataFn( 'a.0.z' );203 test = fn( {204 "a": [205 { "m": true, "n": 1 },206 { "m": false, "n": 2 },207 { "m": false, "n": 3 }208 ]209 } );210 },211 function () { return test===undefined }212 );213 // Array notation - no join214 oTest.fnTest(215 "Array notation - no join - property",216 function () {217 fn = table.oApi._fnGetObjectDataFn( 'a[].n' );218 test = fn( {219 "a": [220 { "m": true, "n": 1 },221 { "m": false, "n": 2 },222 { "m": false, "n": 3 }223 ]224 } );225 },226 function () {227 return test.length===3 && test[0]===1228 && test[1]===2 && test[2]===3;229 }230 );231 oTest.fnTest(232 "Array notation - no join - property (2)",233 function () {234 fn = table.oApi._fnGetObjectDataFn( 'a[].m' );235 test = fn( {236 "a": [237 { "m": true, "n": 1 },238 { "m": false, "n": 2 }239 ]240 } );241 },242 function () {243 return test.length===2 && test[0]===true244 && test[1]===false;245 }246 );247 oTest.fnTest(248 "Array notation - no join - undefined property",249 function () {250 fn = table.oApi._fnGetObjectDataFn( 'a[].z' );251 test = fn( {252 "a": [253 { "m": true, "n": 1 },254 { "m": false, "n": 2 }255 ]256 } );257 },258 function () {259 return test.length===2 && test[0]===undefined260 && test[1]===undefined;261 }262 );263 // Array notation - join264 oTest.fnTest(265 "Array notation - space join - property",266 function () {267 fn = table.oApi._fnGetObjectDataFn( 'a[ ].n' );268 test = fn( {269 "a": [270 { "m": true, "n": 1 },271 { "m": false, "n": 2 },272 { "m": false, "n": 3 }273 ]274 } );275 },276 function () { return test === '1 2 3'; }277 );278 oTest.fnTest(279 "Array notation - space join - property (2)",280 function () {281 fn = table.oApi._fnGetObjectDataFn( 'a[ ].m' );282 test = fn( {283 "a": [284 { "m": true, "n": 1 },285 { "m": false, "n": 2 }286 ]287 } );288 },289 function () { return test === 'true false'; }290 );291 oTest.fnTest(292 "Array notation - sapce join - undefined property",293 function () {294 fn = table.oApi._fnGetObjectDataFn( 'a[ ].z' );295 test = fn( {296 "a": [297 { "m": true, "n": 1 },298 { "m": false, "n": 2 }299 ]300 } );301 },302 function () { return test === ' '; }303 );304 oTest.fnTest(305 "Array notation - string join - property",306 function () {307 fn = table.oApi._fnGetObjectDataFn( 'a[qwerty].n' );308 test = fn( {309 "a": [310 { "m": true, "n": 1 },311 { "m": false, "n": 2 },312 { "m": false, "n": 3 }313 ]314 } );315 },316 function () { return test === '1qwerty2qwerty3'; }317 );318 oTest.fnTest(319 "Array notation - string join - property (2)",320 function () {321 fn = table.oApi._fnGetObjectDataFn( 'a[qwerty].m' );322 test = fn( {323 "a": [324 { "m": true, "n": 1 },325 { "m": false, "n": 2 }326 ]327 } );328 },329 function () { return test === 'trueqwertyfalse'; }330 );331 332 // Array alone join333 oTest.fnTest(334 "Flat array join",335 function () {336 fn = table.oApi._fnGetObjectDataFn( 'a[ ]' );337 test = fn( {338 "a": [339 true,340 false,341 1342 ]343 } );344 },345 function () { return test==="true false 1"; }346 );347 oTest.fnTest(348 "Flat array string join",349 function () {350 fn = table.oApi._fnGetObjectDataFn( 'a[qwerty]' );351 test = fn( {352 "a": [353 true,354 false,355 1356 ]357 } );358 },359 function () { return test==="trueqwertyfalseqwerty1"; }360 );361 oTest.fnTest(362 "Flat array no join",363 function () {364 fn = table.oApi._fnGetObjectDataFn( 'a[]' );365 test = fn( {366 "a": [367 true,368 false,369 1370 ]371 } );372 },373 function () { return test.length===3 && test[0]===true &&374 test[1]===false && test[2]===1; }375 );376 377 378 ...

Full Screen

Full Screen

test_math.py

Source:test_math.py Github

copy

Full Screen

1from __future__ import print_function, absolute_import2import numpy as np3import math4import numba.unittest_support as unittest5from numba import hsa6from numba import utils7class TestMath(unittest.TestCase):8 def _get_tol(self, math_fn, ty):9 """gets the tolerance for functions when the input is of type 'ty'"""10 low_res = {11 (math.gamma, np.float64): 1e-14,12 (math.lgamma, np.float64): 1e-13,13 }14 default = 1e-15 if ty == np.float64 else 1e-615 return low_res.get((math_fn, ty), default)16 def _generic_test_unary(self, math_fn, npy_fn,17 cases=None,18 span=(-1., 1.), count=128,19 types=(np.float32, np.float64)):20 @hsa.jit21 def fn(dst, src):22 i = hsa.get_global_id(0)23 if i < dst.size:24 dst[i] = math_fn(src[i])25 for dtype in types:26 if cases is None:27 src = np.linspace(span[0], span[1], count).astype(dtype)28 else:29 src = np.array(cases, dtype=dtype)30 dst = np.zeros_like(src)31 fn[src.size, 1](dst, src)32 np.testing.assert_allclose(dst, npy_fn(src),33 rtol=self._get_tol(math_fn, dtype),34 err_msg='{0} ({1})'.format(35 math_fn.__name__,36 dtype.__name__))37 def _generic_test_binary(self, math_fn, npy_fn,38 cases=None,39 span=(-1., 1., 1., -1.), count=128,40 types=(np.float32, np.float64)):41 @hsa.jit42 def fn(dst, src1, src2):43 i = hsa.get_global_id(0)44 if i < dst.size:45 dst[i] = math_fn(src1[i], src2[i])46 for dtype in types:47 if cases is None:48 src1 = np.linspace(span[0], span[1], count).astype(dtype)49 src2 = np.linspace(span[2], span[3], count).astype(dtype)50 else:51 src1 = np.array(cases[0], dtype=dtype)52 src2 = np.array(cases[1], dtype=dtype)53 dst = np.zeros_like(src1)54 fn[dst.size, 1](dst, src1, src2)55 np.testing.assert_allclose(dst, npy_fn(src1, src2),56 rtol=self._get_tol(math_fn, dtype),57 err_msg='{0} ({1})'.format(58 math_fn.__name__,59 dtype.__name__))60 def test_trig(self):61 funcs = [math.sin, math.cos, math.tan]62 for fn in funcs:63 self._generic_test_unary(fn, getattr(np, fn.__name__),64 span=(-np.pi, np.pi))65 def test_trig_inv(self):66 funcs = [(math.asin, np.arcsin),67 (math.acos, np.arccos),68 (math.atan, np.arctan)]69 for fn, np_fn in funcs:70 self._generic_test_unary(fn, np_fn)71 def test_trigh(self):72 funcs = [math.sinh, math.cosh, math.tanh]73 for fn in funcs:74 self._generic_test_unary(fn, getattr(np, fn.__name__),75 span=(-4.0, 4.0))76 def test_trigh_inv(self):77 funcs = [(math.asinh, np.arcsinh, (-4, 4)),78 (math.acosh, np.arccosh, (1, 9)),79 (math.atanh, np.arctanh, (-0.9, 0.9))]80 for fn, np_fn, span in funcs:81 self._generic_test_unary(fn, np_fn, span=span)82 def test_classify(self):83 funcs = [math.isnan, math.isinf]84 cases = (float('nan'), float('inf'), float('-inf'), float('-nan'),85 0, 3, -2)86 for fn in funcs:87 self._generic_test_unary(fn, getattr(np, fn.__name__),88 cases=cases)89 def test_floor_ceil(self):90 funcs = [math.ceil, math.floor]91 for fn in funcs:92 # cases with varied decimals93 self._generic_test_unary(fn, getattr(np, fn.__name__),94 span=(-1013.14, 843.21))95 # cases that include "exact" integers96 self._generic_test_unary(fn, getattr(np, fn.__name__),97 span=(-16, 16), count=129)98 def test_fabs(self):99 funcs = [math.fabs]100 for fn in funcs:101 self._generic_test_unary(fn, getattr(np, fn.__name__),102 span=(-63.3, 63.3))103 def test_unary_exp(self):104 funcs = [math.exp]105 for fn in funcs:106 self._generic_test_unary(fn, getattr(np, fn.__name__),107 span=(-30, 30))108 def test_unary_expm1(self):109 funcs = [math.expm1]110 for fn in funcs:111 self._generic_test_unary(fn, getattr(np, fn.__name__),112 span=(-30, 30))113 def test_sqrt(self):114 funcs = [math.sqrt]115 for fn in funcs:116 self._generic_test_unary(fn, getattr(np, fn.__name__),117 span=(0, 1000))118 def test_log(self):119 funcs = [math.log, math.log10, math.log1p]120 for fn in funcs:121 self._generic_test_unary(fn, getattr(np, fn.__name__),122 span=(0.1, 2500))123 def test_binaries(self):124 funcs = [math.copysign, math.fmod]125 for fn in funcs:126 self._generic_test_binary(fn, getattr(np, fn.__name__))127 def test_pow(self):128 funcs = [(math.pow, np.power)]129 for fn, npy_fn in funcs:130 self._generic_test_binary(fn, npy_fn)131 def test_atan2(self):132 funcs = [(math.atan2, np.arctan2)]133 for fn, npy_fn in funcs:134 self._generic_test_binary(fn, npy_fn)135 def test_erf(self):136 funcs = [math.erf, math.erfc]137 for fn in funcs:138 self._generic_test_unary(fn, np.vectorize(fn))139 @unittest.skipIf(True, "gamma() freezing computer on Carrizo (Kaveri may "140 "crash the process but no harm to system)")141 def test_gamma(self):142 funcs = [math.gamma, math.lgamma]143 for fn in funcs:144 self._generic_test_unary(fn, np.vectorize(fn), span=(1e-4, 4.0))145if __name__ == '__main__':...

Full Screen

Full Screen

single_return_test.py

Source:single_return_test.py Github

copy

Full Screen

1# Copyright 2017 The TensorFlow Authors. All Rights Reserved.2#3# Licensed under the Apache License, Version 2.0 (the "License");4# you may not use this file except in compliance with the License.5# You may obtain a copy of the License at6#7# http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS,11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12# See the License for the specific language governing permissions and13# limitations under the License.14# ==============================================================================15"""Tests for single_return module."""16from __future__ import absolute_import17from __future__ import division18from __future__ import print_function19from tensorflow.contrib.autograph.converters import converter_test_base20from tensorflow.contrib.autograph.converters import single_return21from tensorflow.python.framework.ops import name_scope22from tensorflow.python.platform import test23class SingleReturnTest(converter_test_base.TestCase):24 def compiled_fn(self, test_fn, *args):25 node = self.parse_and_analyze(test_fn, {})26 node = single_return.transform(node, self.ctx)27 module = self.compiled(node, *args)28 return module29 def test_noop(self):30 # Noop31 def test_fn(x):32 return x33 with self.compiled_fn(test_fn) as result:34 self.assertEqual(test_fn(2.0), result.test_fn(2.0))35 def test_return_expression(self):36 # ANF37 def test_fn(x):38 return x * x39 with self.compiled_fn(test_fn) as result:40 x = 241 self.assertEqual(test_fn(x), result.test_fn(x))42 def test_merge(self):43 # Simple merge44 def test_fn(x):45 if x > 0:46 return x47 else:48 return x * x49 with self.compiled_fn(test_fn) as result:50 for x in [-2, 2]:51 self.assertEqual(test_fn(x), result.test_fn(x))52 def test_orphan_branch(self):53 def test_fn(x):54 if x > 0:55 return x56 with self.assertRaises(ValueError):57 self.compiled_fn(test_fn)58 def test_lift_body_into_false_branch(self):59 def test_fn(x):60 if x > 0:61 return x62 return x * x63 with self.compiled_fn(test_fn) as result:64 for x in [-2, 2]:65 self.assertEqual(test_fn(x), result.test_fn(x))66 def test_lift_body_into_true_branch(self):67 def test_fn(x):68 if x < 0:69 x *= x70 else:71 # TODO(alexbw): linter bug here that requires us suppress this warning.72 return x # pylint: disable=undefined-loop-variable73 return x74 with self.compiled_fn(test_fn) as result:75 for x in [-2, 2]:76 self.assertEqual(test_fn(x), result.test_fn(x))77 def test_nested_if(self):78 def test_fn(x):79 if x > 0:80 if x < 5:81 return x82 else:83 return x * x84 else:85 return x * x * x86 with self.compiled_fn(test_fn) as result:87 for x in [-2, 2, 5]:88 self.assertEqual(test_fn(x), result.test_fn(x))89 def test_context_manager(self):90 def test_fn(x):91 with name_scope(''):92 return x * x93 with self.compiled_fn(test_fn) as result:94 result.name_scope = name_scope95 for x in [-2, 2]:96 self.assertEqual(test_fn(x), result.test_fn(x))97 def test_context_manager_in_conditional(self):98 def test_fn(x):99 if x > 0:100 with name_scope(''):101 return x * x102 else:103 return x104 with self.compiled_fn(test_fn, name_scope) as result:105 result.name_scope = name_scope106 for x in [-2, 2]:107 self.assertEqual(test_fn(x), result.test_fn(x))108 def text_conditional_in_context_manager(self):109 def test_fn(x):110 with name_scope(''):111 if x > 0:112 return x * x113 else:114 return x115 with self.compiled_fn(test_fn) as result:116 result.name_scope = name_scope117 for x in [-2, 2]:118 self.assertEqual(test_fn(x), result.test_fn(x))119 def test_no_return(self):120 def test_fn(x):121 x *= x122 with self.compiled_fn(test_fn) as result:123 self.assertEqual(test_fn(2), result.test_fn(2))124 def test_nested_functiondefs(self):125 def test_fn(x):126 def inner_fn(y):127 if y > 0:128 return y * y129 else:130 return y131 return inner_fn(x)132 with self.compiled_fn(test_fn) as result:133 for x in [-2, 2]:134 self.assertEqual(test_fn(x), result.test_fn(x))135 def test_loop(self):136 def test_fn(x):137 for _ in range(10):138 return x139 return x140 with self.assertRaises(ValueError):141 self.compiled_fn(test_fn)142if __name__ == '__main__':...

Full Screen

Full Screen

api.internal.js

Source:api.internal.js Github

copy

Full Screen

1/*2 * This is really a good bit rubbish this method of exposing the internal methods3 * publicly... - To be fixed in 2.0 using methods on the prototype4 */5/**6 * Create a wrapper function for exporting an internal functions to an external API.7 * @param {string} sFunc API function name8 * @returns {function} wrapped function9 * @memberof DataTable#oApi10 */11function _fnExternApiFunc (sFunc)12{13 return function() {14 var aArgs = [_fnSettingsFromNode(this[DataTable.ext.iApiIndex])].concat( 15 Array.prototype.slice.call(arguments) );16 return DataTable.ext.oApi[sFunc].apply( this, aArgs );17 };18}19/**20 * Reference to internal functions for use by plug-in developers. Note that these21 * methods are references to internal functions and are considered to be private.22 * If you use these methods, be aware that they are liable to change between versions23 * (check the upgrade notes).24 * @namespace25 */26this.oApi = {27 "_fnExternApiFunc": _fnExternApiFunc,28 "_fnInitialise": _fnInitialise,29 "_fnInitComplete": _fnInitComplete,30 "_fnLanguageCompat": _fnLanguageCompat,31 "_fnAddColumn": _fnAddColumn,32 "_fnColumnOptions": _fnColumnOptions,33 "_fnAddData": _fnAddData,34 "_fnCreateTr": _fnCreateTr,35 "_fnGatherData": _fnGatherData,36 "_fnBuildHead": _fnBuildHead,37 "_fnDrawHead": _fnDrawHead,38 "_fnDraw": _fnDraw,39 "_fnReDraw": _fnReDraw,40 "_fnAjaxUpdate": _fnAjaxUpdate,41 "_fnAjaxParameters": _fnAjaxParameters,42 "_fnAjaxUpdateDraw": _fnAjaxUpdateDraw,43 "_fnServerParams": _fnServerParams,44 "_fnAddOptionsHtml": _fnAddOptionsHtml,45 "_fnFeatureHtmlTable": _fnFeatureHtmlTable,46 "_fnScrollDraw": _fnScrollDraw,47 "_fnAdjustColumnSizing": _fnAdjustColumnSizing,48 "_fnFeatureHtmlFilter": _fnFeatureHtmlFilter,49 "_fnFilterComplete": _fnFilterComplete,50 "_fnFilterCustom": _fnFilterCustom,51 "_fnFilterColumn": _fnFilterColumn,52 "_fnFilter": _fnFilter,53 "_fnBuildSearchArray": _fnBuildSearchArray,54 "_fnBuildSearchRow": _fnBuildSearchRow,55 "_fnFilterCreateSearch": _fnFilterCreateSearch,56 "_fnDataToSearch": _fnDataToSearch,57 "_fnSort": _fnSort,58 "_fnSortAttachListener": _fnSortAttachListener,59 "_fnSortingClasses": _fnSortingClasses,60 "_fnFeatureHtmlPaginate": _fnFeatureHtmlPaginate,61 "_fnPageChange": _fnPageChange,62 "_fnFeatureHtmlInfo": _fnFeatureHtmlInfo,63 "_fnUpdateInfo": _fnUpdateInfo,64 "_fnFeatureHtmlLength": _fnFeatureHtmlLength,65 "_fnFeatureHtmlProcessing": _fnFeatureHtmlProcessing,66 "_fnProcessingDisplay": _fnProcessingDisplay,67 "_fnVisibleToColumnIndex": _fnVisibleToColumnIndex,68 "_fnColumnIndexToVisible": _fnColumnIndexToVisible,69 "_fnNodeToDataIndex": _fnNodeToDataIndex,70 "_fnVisbleColumns": _fnVisbleColumns,71 "_fnCalculateEnd": _fnCalculateEnd,72 "_fnConvertToWidth": _fnConvertToWidth,73 "_fnCalculateColumnWidths": _fnCalculateColumnWidths,74 "_fnScrollingWidthAdjust": _fnScrollingWidthAdjust,75 "_fnGetWidestNode": _fnGetWidestNode,76 "_fnGetMaxLenString": _fnGetMaxLenString,77 "_fnStringToCss": _fnStringToCss,78 "_fnDetectType": _fnDetectType,79 "_fnSettingsFromNode": _fnSettingsFromNode,80 "_fnGetDataMaster": _fnGetDataMaster,81 "_fnGetTrNodes": _fnGetTrNodes,82 "_fnGetTdNodes": _fnGetTdNodes,83 "_fnEscapeRegex": _fnEscapeRegex,84 "_fnDeleteIndex": _fnDeleteIndex,85 "_fnReOrderIndex": _fnReOrderIndex,86 "_fnColumnOrdering": _fnColumnOrdering,87 "_fnLog": _fnLog,88 "_fnClearTable": _fnClearTable,89 "_fnSaveState": _fnSaveState,90 "_fnLoadState": _fnLoadState,91 "_fnCreateCookie": _fnCreateCookie,92 "_fnReadCookie": _fnReadCookie,93 "_fnDetectHeader": _fnDetectHeader,94 "_fnGetUniqueThs": _fnGetUniqueThs,95 "_fnScrollBarWidth": _fnScrollBarWidth,96 "_fnApplyToChildren": _fnApplyToChildren,97 "_fnMap": _fnMap,98 "_fnGetRowData": _fnGetRowData,99 "_fnGetCellData": _fnGetCellData,100 "_fnSetCellData": _fnSetCellData,101 "_fnGetObjectDataFn": _fnGetObjectDataFn,102 "_fnSetObjectDataFn": _fnSetObjectDataFn,103 "_fnApplyColumnDefs": _fnApplyColumnDefs,104 "_fnBindAction": _fnBindAction,105 "_fnExtend": _fnExtend,106 "_fnCallbackReg": _fnCallbackReg,107 "_fnCallbackFire": _fnCallbackFire,108 "_fnJsonString": _fnJsonString,109 "_fnRender": _fnRender,110 "_fnNodeToColumnIndex": _fnNodeToColumnIndex,111 "_fnInfoMacros": _fnInfoMacros,112 "_fnBrowserDetect": _fnBrowserDetect,113 "_fnGetColumns": _fnGetColumns114};115$.extend( DataTable.ext.oApi, this.oApi );116for ( var sFunc in DataTable.ext.oApi )117{118 if ( sFunc )119 {120 this[sFunc] = _fnExternApiFunc(sFunc);121 }...

Full Screen

Full Screen

_setDataFunctions.js

Source:_setDataFunctions.js Github

copy

Full Screen

...10 // Object property access11 oTest.fnTest(12 "Create property",13 function () {14 fn = table.oApi._fnSetObjectDataFn('test');15 o = {};16 fn( o, true );17 },18 function () { return o.test }19 );20 21 oTest.fnTest(22 "Single property doesn't kill other properties",23 function () {24 fn = table.oApi._fnSetObjectDataFn('test');25 o = {26 "test2": false27 };28 fn( o, true );29 },30 function () { return o.test && o.test2===false; }31 );32 33 oTest.fnTest(34 "Single property overwrite old property",35 function () {36 fn = table.oApi._fnSetObjectDataFn('test');37 o = {38 "test": false,39 "test2": false40 };41 fn( o, true );42 },43 function () { return o.test && o.test2===false; }44 );45 // Nested46 oTest.fnTest(47 "Create nested property",48 function () {49 fn = table.oApi._fnSetObjectDataFn('test.inner');50 o = {51 "test": {}52 };53 fn( o, true );54 },55 function () { return o.test.inner }56 );57 oTest.fnTest(58 "Deep create nested property",59 function () {60 fn = table.oApi._fnSetObjectDataFn('test.inner');61 o = {};62 fn( o, true );63 },64 function () { return o.test.inner }65 );66 67 oTest.fnTest(68 "Nested property doesn't kill other properties",69 function () {70 fn = table.oApi._fnSetObjectDataFn('test.inner');71 o = {72 "test": {73 "test2": false74 }75 };76 fn( o, true );77 },78 function () { return o.test.inner && o.test.test2===false; }79 );80 81 oTest.fnTest(82 "Single property overwrite old property",83 function () {84 fn = table.oApi._fnSetObjectDataFn('nested.test');85 o = {86 "nested": {87 "test": false,88 "test2": false89 }90 };91 fn( o, true );92 },93 function () { return o.nested.test && o.nested.test2===false; }94 );95 // Set arrays / objects96 oTest.fnTest(97 "Create object",98 function () {99 fn = table.oApi._fnSetObjectDataFn('test');100 o = {};101 fn( o, {"a":true, "b":false} );102 },103 function () { return o.test.a && o.test.b===false }104 );105 oTest.fnTest(106 "Create nested object",107 function () {108 fn = table.oApi._fnSetObjectDataFn('nested.test');109 o = {};110 fn( o, {"a":true, "b":false} );111 },112 function () { return o.nested.test.a && o.nested.test.b===false }113 );114 oTest.fnTest(115 "Create array",116 function () {117 fn = table.oApi._fnSetObjectDataFn('test');118 o = {};119 fn( o, [1,2,3] );120 },121 function () { return o.test[0]===1 && o.test[2]===3 }122 );123 oTest.fnTest(124 "Create nested array",125 function () {126 fn = table.oApi._fnSetObjectDataFn('nested.test');127 o = {};128 fn( o, [1,2,3] );129 },130 function () { return o.nested.test[0]===1 && o.nested.test[2]===3 }131 );132 // Array notation133 oTest.fnTest(134 "Create array of objects",135 function () {136 fn = table.oApi._fnSetObjectDataFn('test[].a');137 o = {};138 fn( o, [1,2,3] );139 },140 function () { return o.test.length===3 && o.test[0].a===1 && o.test[1].a===2; }141 );142 oTest.fnTest(143 "Create array of nested objects",144 function () {145 fn = table.oApi._fnSetObjectDataFn('test[].a.b');146 o = {};147 fn( o, [1,2,3] );148 },149 function () { return o.test.length===3 && o.test[0].a.b===1 && o.test[1].a.b===2; }150 );151 oTest.fnTest(152 "Create array",153 function () {154 fn = table.oApi._fnSetObjectDataFn('test[]');155 o = {};156 fn( o, [1,2,3] );157 },158 function () { return o.test.length===3 && o.test[0]===1 && o.test[1]===2; }159 );160 161 oTest.fnComplete();...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var fn = sinon.fake();2fn(1, 2, 3);3fn(4, 5, 6);4var fn = sinon.spy();5fn(1, 2, 3);6fn(4, 5, 6);7var fn = sinon.stub();8fn(1, 2, 3);9fn(4, 5, 6);10fn.calledWith(4, 5,

Full Screen

Using AI Code Generation

copy

Full Screen

1var stub = sinon.stub().returns(42);2stub(1, 2, 3);3var stub = sinon.stub().returns(42);4stub(1, 2, 3);5var stub = sinon.stub().returns(42);6stub(1, 2, 3);7var stub = sinon.stub().returns(42);8stub(1, 2, 3);9var stub = sinon.stub().returns(42);10stub(1, 2, 3);11var stub = sinon.stub().returns(42);12stub(1, 2, 3);13var stub = sinon.stub().returns(42);14stub(1, 2, 3);15var stub = sinon.stub().returns(42);16stub(1, 2, 3);17var stub = sinon.stub().returns(42);18stub(1, 2, 3);19var stub = sinon.stub().returns(42);20stub(1, 2, 3);21var stub = sinon.stub().returns(42);22stub(1, 2, 3);23var stub = sinon.stub().returns(42);24stub(1, 2, 3);25var stub = sinon.stub().returns(42);26stub(1, 2, 3);

Full Screen

Using AI Code Generation

copy

Full Screen

1var sinon = require('sinon');2var assert = require('assert');3var myObject = {4 myMethod: function (param) {5 return param;6 }7};8var spy = sinon.spy(myObject, "myMethod");9myObject.myMethod(123);10assert(spy.calledOnce);11assert(spy.calledWith(123));12var sinon = require('sinon');13var assert = require('assert');14var myObject = {15 myMethod: function (param) {16 return param;17 }18};19var stub = sinon.stub(myObject, "myMethod").returns(456);20var result = myObject.myMethod(123);21assert(stub.calledOnce);22assert(stub.calledWith(123));23assert.equal(result, 456);24var sinon = require('sinon');25var assert = require('assert');26var myObject = {27 myMethod: function (param) {28 return param;29 }30};31var mock = sinon.mock(myObject);32mock.expects("myMethod").once().withArgs(123);33myObject.myMethod(123);34mock.verify();35var sinon = require('sinon');36var assert = require('assert');37var server = sinon.fakeServer.create();38server.respondWith("GET", "/resource", [200, { "Content-Type": "text/plain" }, "Hello, World!"]);39var request = new XMLHttpRequest();40request.open("GET", "/resource");41request.send();42server.respond();43assert(request.status === 200);44assert(request.responseText === "Hello, World!");45var sinon = require('sinon');46var assert = require('assert');47var clock = sinon.useFakeTimers();48setTimeout(function () {49 console.log("Hello, World!");50}, 1000);51clock.tick(1000);52assert(console.log.calledWith("Hello, World!"));53var sinon = require('sinon');54var assert = require('assert');55var xhr = sinon.useFakeXMLHttpRequest();56var requests = [];57xhr.onCreate = function (req) {58 requests.push(req);59};60var request = new XMLHttpRequest();61request.open("GET", "/resource");62request.send();63assert(requests.length === 1);64assert(requests[0].method === "GET");65assert(request

Full Screen

Using AI Code Generation

copy

Full Screen

1sinon.stub(object, 'method').callsFake(function() {2});3sinon.stub(object, 'method').withArgs(arg).callsFake(function() {4});5sinon.stub(object, 'method').withArgs(arg1, arg2).callsFake(function() {6});7sinon.stub(object, 'method').withArgs(arg1, arg2).callsFake(function() {8});9sinon.stub(object, 'method').withArgs(arg1, arg2).callsFake(function() {10});11sinon.stub(object, 'method').withArgs(arg1, arg2).callsFake(function() {12});13sinon.stub(object, 'method').withArgs(arg1, arg2).callsFake(function() {14});15sinon.stub(object, 'method').withArgs(arg1, arg2).callsFake(function() {16});17sinon.stub(object, 'method').withArgs(arg1, arg2).callsFake(function() {18});19sinon.stub(object, 'method').withArgs(arg1, arg2).callsFake(function() {20});21sinon.stub(object, 'method').withArgs(arg1, arg2).callsFake(function() {22});23sinon.stub(object, 'method').withArgs(arg1, arg2).callsFake(function() {24});25sinon.stub(object, 'method').withArgs(arg1, arg2).callsFake(function() {26});27sinon.stub(object, 'method').withArgs(arg1, arg2).callsFake(function() {

Full Screen

Using AI Code Generation

copy

Full Screen

1const sinon = require('sinon');2const { expect } = require('chai');3const { Fn } = sinon;4const chai = require('chai');5const chaiAsPromised = require('chai-as-promised');6chai.use(chaiAsPromised);7const proxyquire = require('proxyquire');8describe('get method', () => {9 it('should return a promise', () => {10 const rp = proxyquire('request-promise', {11 'request': {12 'get': sinon.stub().returns(Promise.resolve())13 }14 });15 expect(rp.get()).to.be.a('promise');16 });17});18describe('post method', () => {19 it('should return a promise', () => {20 const rp = proxyquire('request-promise', {21 'request': {22 'post': sinon.stub().returns(Promise.resolve())23 }24 });25 expect(rp.post()).to.be.a('promise');26 });27});28describe('put method', () => {29 it('should return a promise', () => {30 const rp = proxyquire('request-promise', {31 'request': {32 'put': sinon.stub().returns(Promise.resolve())33 }34 });35 expect(rp.put()).to.be.a('promise');36 });37});38describe('delete method', () => {39 it('should return a promise', () => {40 const rp = proxyquire('request-promise', {41 'request': {42 'delete': sinon.stub().returns(Promise.resolve())43 }44 });45 expect(rp.delete()).to.be.a('promise');46 });47});48describe('get method', () => {49 it('should return a promise', () => {50 const rp = proxyquire('request-promise', {51 'request': {52 'get': sinon.stub().returns(Promise.reject())53 }54 });55 expect(rp.get()).to.be.rejected;56 });57});58describe('post method', () => {59 it('should return a promise', () => {60 const rp = proxyquire('request-promise', {

Full Screen

Using AI Code Generation

copy

Full Screen

1const sinon = require('sinon');2const assert = require('assert');3const myModule = require('myModule');4describe('myModule', () => {5 it('should call the callback', () => {6 const callback = sinon.spy();7 const stub = sinon.stub(myModule, 'myMethod').callsFake(callback);8 myModule.myMethod();9 assert(callback.called);10 stub.restore();11 });12});13module.exports = {14 myMethod: () => {15 }16};17const sinon = require('sinon');18const assert = require('assert');19const myModule = require('myModule');20describe('myModule', () => {21 it('should call the callback', () => {22 const callback = sinon.spy();23 const stub = sinon.stub(myModule, 'myMethod').callsFake(callback);24 myModule.myMethod();25 assert(callback.called);26 stub.restore();27 });28});29module.exports = {30 myMethod: () => {31 }32};33const sinon = require('sinon');34const assert = require('assert');35const myModule = require('myModule');36describe('myModule', () => {37 it('should call the callback', () => {38 const callback = sinon.spy();39 const stub = sinon.stub(myModule, 'myMethod').callsFake(callback);40 myModule.myMethod();41 assert(callback.called);42 stub.restore();43 });44});45module.exports = {46 myMethod: () => {47 }48};49const sinon = require('sinon');50const assert = require('assert');51const myModule = require('myModule');52describe('myModule', () => {53 it('should call the callback', () => {54 const callback = sinon.spy();55 const stub = sinon.stub(myModule, 'myMethod').callsFake(callback);56 myModule.myMethod();57 assert(callback.called);58 stub.restore();59 });

Full Screen

Using AI Code Generation

copy

Full Screen

1import sinon from 'sinon';2require(['sinon'], function(sinon) {3});4var sinon = require('sinon');5import sinon from 'sinon';6import sinon from 'sinon';7import sinon from 'sinon';8var stub = sinon.stub(object, 'method');9stub.returns(42);10var stub = sinon.stub(object, 'method');11stub.callsArgWith(0, 'foo', 'bar');12object.method(function (arg1, arg2) {13});14var stub = sinon.stub(object, 'method');15stub.callsArgWith(0, new Error('foo'));16object.method(function (err, arg2) {17});18var stub = sinon.stub(object, 'method');19stub.callsArgWith(0, null, new Error('foo'));20object.method(function (err, arg

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run sinon automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful