file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
12.1k
suffix
large_stringlengths
0
12k
middle
large_stringlengths
0
7.51k
fim_type
large_stringclasses
4 values
MspImagePlugin.py
# # The Python Imaging Library. # $Id$ # # MSP file handling # # This is the format used by the Paint program in Windows 1 and 2. # # History: # 95-09-05 fl Created # 97-01-03 fl Read/write MSP images # # Copyright (c) Secret Labs AB 1997. # Copyright (c) Fredrik Lundh 1995-97. # # See the README fi...
# # write MSP files (uncompressed only) o16 = _binary.o16le def _save(im, fp, filename): if im.mode != "1": raise IOError("cannot write mode %s as MSP" % im.mode) # create MSP header header = [0] * 16 header[0], header[1] = i16(b"Da"), i16(b"nM") # version 1 header[2], header[3] = im....
s = self.fp.read(32) if s[:4] not in [b"DanM", b"LinS"]: raise SyntaxError("not an MSP file") # Header checksum sum = 0 for i in range(0, 32, 2): sum = sum ^ i16(s[i:i+2]) if sum != 0: raise SyntaxError("bad MSP checksum") self.mode =...
identifier_body
blast2dem.py
# -*- coding: utf-8 -*- """ *************************************************************************** blast2dem.py --------------------- Date : September 2013 Copyright : (C) 2013 by Martin Isenburg Email : martin near rapidlasso point com ***************...
if (self.getParameterValue(blast2dem.USE_TILE_BB)): commands.append("-use_tile_bb") self.addParametersRasterOutputCommands(commands) self.addParametersAdditionalCommands(commands) LAStoolsUtils.runLAStools(commands, progress)
commands.append("-" + blast2dem.PRODUCTS[product])
conditional_block
blast2dem.py
# -*- coding: utf-8 -*- """ *************************************************************************** blast2dem.py --------------------- Date : September 2013 Copyright : (C) 2013 by Martin Isenburg Email : martin near rapidlasso point com ***************...
def processAlgorithm(self, progress): commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "blast2dem")] self.addParametersVerboseCommands(commands) self.addParametersPointInputCommands(commands) self.addParametersFilter1ReturnClassFlagsCommands(commands) self.addP...
self.name, self.i18n_name = self.trAlgorithm('blast2dem') self.group, self.i18n_group = self.trAlgorithm('LAStools') self.addParametersVerboseGUI() self.addParametersPointInputGUI() self.addParametersFilter1ReturnClassFlagsGUI() self.addParametersStepGUI() self.addParamet...
identifier_body
blast2dem.py
# -*- coding: utf-8 -*- """ *************************************************************************** blast2dem.py --------------------- Date : September 2013 Copyright : (C) 2013 by Martin Isenburg Email : martin near rapidlasso point com ***************...
(LAStoolsAlgorithm): ATTRIBUTE = "ATTRIBUTE" PRODUCT = "PRODUCT" ATTRIBUTES = ["elevation", "slope", "intensity", "rgb"] PRODUCTS = ["actual values", "hillshade", "gray", "false"] USE_TILE_BB = "USE_TILE_BB" def defineCharacteristics(self): self.name, self.i18n_name = self.trAlgorithm(...
blast2dem
identifier_name
blast2dem.py
# -*- coding: utf-8 -*- """ *************************************************************************** blast2dem.py --------------------- Date : September 2013 Copyright : (C) 2013 by Martin Isenburg Email : martin near rapidlasso point com ***************...
# This will get replaced with a git SHA1 when you do a git archive __revision__ = '$Format:%H$' import os from .LAStoolsUtils import LAStoolsUtils from .LAStoolsAlgorithm import LAStoolsAlgorithm from processing.core.parameters import ParameterSelection from processing.core.parameters import ParameterBoolean class ...
__date__ = 'September 2013' __copyright__ = '(C) 2013, Martin Isenburg'
random_line_split
request-body.js
var _ = require('../util').lodash, PropertyBase = require('./property-base').PropertyBase, PropertyList = require('./property-list').PropertyList, QueryParam = require('./query-param').QueryParam, FormParam = require('./form-param').FormParam, EMPTY = '', RequestBody; /** * @typedef RequestB...
} }); _.assign(RequestBody, /** @lends RequestBody **/{ /** * Defines the name of this property for internal use. * * @private * @readOnly * @type {String} */ _postman_propertyName: 'RequestBody', /** * @enum {string} MODES */ MODES: { file: 'file', ...
// make sure that file content is removed because it is non-serializable ReadStream _.unset(obj, 'file.content'); return obj;
random_line_split
request-body.js
var _ = require('../util').lodash, PropertyBase = require('./property-base').PropertyBase, PropertyList = require('./property-list').PropertyList, QueryParam = require('./query-param').QueryParam, FormParam = require('./form-param').FormParam, EMPTY = '', RequestBody; /** * @typedef RequestB...
}); _.assign(RequestBody, /** @lends RequestBody **/{ /** * Defines the name of this property for internal use. * * @private * @readOnly * @type {String} */ _postman_propertyName: 'RequestBody', /** * @enum {string} MODES */ MODES: { file: 'file', ...
{ var obj = PropertyBase.toJSON(this); // make sure that file content is removed because it is non-serializable ReadStream _.unset(obj, 'file.content'); return obj; }
identifier_body
request-body.js
var _ = require('../util').lodash, PropertyBase = require('./property-base').PropertyBase, PropertyList = require('./property-list').PropertyList, QueryParam = require('./query-param').QueryParam, FormParam = require('./form-param').FormParam, EMPTY = '', RequestBody; /** * @typedef RequestB...
if (_.isFunction(data.count)) { // handle for property lists return (data.count() === 0); } return _.isEmpty(data); // catch all for remaining data modes }, /** * Convert the request body to JSON compatible plain object * * @returns {Object} */ toJ...
{ return (data.length === 0); }
conditional_block
request-body.js
var _ = require('../util').lodash, PropertyBase = require('./property-base').PropertyBase, PropertyList = require('./property-list').PropertyList, QueryParam = require('./query-param').QueryParam, FormParam = require('./form-param').FormParam, EMPTY = '', RequestBody; /** * @typedef RequestB...
() { // Formdata. Goodluck. if (this.mode === RequestBody.MODES.formdata || this.mode === RequestBody.MODES.file) { // @todo: implement this, check if we need to return undefined or something. return EMPTY; } if (this.mode === RequestBody.MODES.urlencoded) { ...
toString
identifier_name
test-case.ts
import type {SpecDirectory, OptionKey} from '../spec-directory'; import {Compiler} from '../compiler'; import { failures, TestResult, getExpectedFiles, overwriteResults, SassResult, } from './util'; import {compareResults} from './compare'; import {getExpectedResult} from './expected'; /** * A wrapper aroun...
if (warningTodo) { if (testResult.type === 'pass') { return failures.UnnecessaryTodo(); } else { return {type: 'pass'}; } } } return testResult; } actual(): SassResult { if (!this._actual) { throw new Error(`Test case ${this.dir.relPath()} ...
{ if (testResult.type === 'pass') { return failures.UnnecessaryTodo(); } else { return {type: 'todo'}; } }
conditional_block
test-case.ts
import type {SpecDirectory, OptionKey} from '../spec-directory'; import {Compiler} from '../compiler'; import { failures, TestResult, getExpectedFiles, overwriteResults, SassResult, } from './util'; import {compareResults} from './compare'; import {getExpectedResult} from './expected'; /** * A wrapper aroun...
result(): TestResult { if (!this._result) { throw new Error(`Test case ${this.dir.relPath()} has not yet run.`); } return this._result; } // Mutations /** Add the given option for the given impl */ async addOptionForImpl(option: OptionKey): Promise<void> { const options = await this....
{ if (!this._actual) { throw new Error(`Test case ${this.dir.relPath()} has not yet run.`); } return this._actual; }
identifier_body
test-case.ts
import type {SpecDirectory, OptionKey} from '../spec-directory'; import {Compiler} from '../compiler'; import { failures, TestResult, getExpectedFiles, overwriteResults, SassResult, } from './util'; import {compareResults} from './compare'; import {getExpectedResult} from './expected'; /** * A wrapper aroun...
{ readonly dir: SpecDirectory; readonly impl: string; private compiler: Compiler; private todoMode?: string; private _actual?: SassResult; private _result?: TestResult; // Private constructor that instantiates properties. // The only way to create a test case is through the async factory below priva...
TestCase
identifier_name
test-case.ts
import type {SpecDirectory, OptionKey} from '../spec-directory'; import {Compiler} from '../compiler'; import { failures, TestResult, getExpectedFiles, overwriteResults, SassResult, } from './util'; import {compareResults} from './compare'; import {getExpectedResult} from './expected'; /** * A wrapper aroun...
}
/** Mark this test as ignored for the current implementation */ async markIgnore(): Promise<void> { await this.addOptionForImpl(':ignore_for'); this._result = {type: 'skip'}; }
random_line_split
F1.py
# Copyright (C) 2010-2014 CEA/DEN, EDF R&D # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library ...
CreatePrsForFile(myParavis, file, [PrsTypeEnum.MESH], picturedir, pictureext)
print " --------------------------------- " print "CreatePrsForFile..."
random_line_split
quotes.component.ts
import { Component, OnInit } from '@angular/core'; import { Quote } from '../model/quote'; import { QuoteReactiveService } from '../quote-reactive.service'; import { QuoteBlockingService } from '../quote-blocking.service'; import { Observable } from 'rxjs'; @Component({ selector: 'app-quotes', templateUrl: './qu...
else { this.quotes = this.quoteReactiveService.getQuoteStream(); } } requestQuoteBlocking(): void { if (this.pagination === true) { this.quotes = this.quoteBlockingService.getQuotes(this.page, this.size); } else { this.quotes = this.quoteBlockingService.getQuotes(); } } onSe...
{ this.quotes = this.quoteReactiveService.getQuoteStream(this.page, this.size); }
conditional_block
quotes.component.ts
import { Component, OnInit } from '@angular/core'; import { Quote } from '../model/quote'; import { QuoteReactiveService } from '../quote-reactive.service'; import { QuoteBlockingService } from '../quote-blocking.service'; import { Observable } from 'rxjs'; @Component({ selector: 'app-quotes', templateUrl: './qu...
ngOnInit(): void { } requestQuoteStream(): void { if (this.pagination === true) { this.quotes = this.quoteReactiveService.getQuoteStream(this.page, this.size); } else { this.quotes = this.quoteReactiveService.getQuoteStream(); } } requestQuoteBlocking(): void { if (this.paginat...
{ this.mode = "reactive"; this.pagination = true; this.page = 0; this.size = 50; }
identifier_body
quotes.component.ts
import { Component, OnInit } from '@angular/core'; import { Quote } from '../model/quote'; import { QuoteReactiveService } from '../quote-reactive.service'; import { QuoteBlockingService } from '../quote-blocking.service'; import { Observable } from 'rxjs'; @Component({ selector: 'app-quotes', templateUrl: './qu...
} } onSelect(quote: Quote): void { this.selectedQuote = quote; } }
this.quotes = this.quoteBlockingService.getQuotes(this.page, this.size); } else { this.quotes = this.quoteBlockingService.getQuotes();
random_line_split
quotes.component.ts
import { Component, OnInit } from '@angular/core'; import { Quote } from '../model/quote'; import { QuoteReactiveService } from '../quote-reactive.service'; import { QuoteBlockingService } from '../quote-blocking.service'; import { Observable } from 'rxjs'; @Component({ selector: 'app-quotes', templateUrl: './qu...
(quote: Quote): void { this.selectedQuote = quote; } }
onSelect
identifier_name
config-user.js
ig.module( 'plusplus.config-user' ) .defines(function() { /** * User configuration of Impact++. * <span class="alert alert-info"><strong>Tip:</strong> it is recommended to modify this configuration file!</span> * @example * // in order to add your own custom configur...
UI: { SCALE_MIN: 2, SCALE_MAX: 4 } */ // UI should persist across all levels UI_LAYER_CLEAR_ON_LOAD: false, CHARACTER: { // add some depth using offset SIZE_OFFSET_X: 8, SIZE_OFFSET_Y: 4 } ...
/* // to try dynamic clamped UI scaling // uncomment below and delete the UI settings above
random_line_split
index.ts
import {bootstrap} from 'angular2/bootstrap'; import {bind, provide, ElementRef, ComponentRef, Component, ViewEncapsulation} from 'angular2/core'; import {UrlResolver} from 'angular2/compiler'; import { MdDialog, MdDialogRef, MdDialogConfig } from 'angular2_material/src/components/dialog/dialog'; import {commonDe...
if (isPresent(this.dialogRef)) { return; } this.dialog.open(SimpleDialogComponent, this.elementRef, this.dialogConfig) .then(ref => { this.dialogRef = ref; ref.instance.numCoconuts = 777; ref.whenClosed.then(result => { this.dialogRef = null; ...
} open() {
random_line_split
index.ts
import {bootstrap} from 'angular2/bootstrap'; import {bind, provide, ElementRef, ComponentRef, Component, ViewEncapsulation} from 'angular2/core'; import {UrlResolver} from 'angular2/compiler'; import { MdDialog, MdDialogRef, MdDialogConfig } from 'angular2_material/src/components/dialog/dialog'; import {commonDe...
this.dialog.open(SimpleDialogComponent, this.elementRef, this.dialogConfig) .then(ref => { this.dialogRef = ref; ref.instance.numCoconuts = 777; ref.whenClosed.then(result => { this.dialogRef = null; this.lastResult = result; }); });...
{ return; }
conditional_block
index.ts
import {bootstrap} from 'angular2/bootstrap'; import {bind, provide, ElementRef, ComponentRef, Component, ViewEncapsulation} from 'angular2/core'; import {UrlResolver} from 'angular2/compiler'; import { MdDialog, MdDialogRef, MdDialogConfig } from 'angular2_material/src/components/dialog/dialog'; import {commonDe...
(event) { this.toReturn = event.target.value; } done() { this.dialogRef.close(this.toReturn); } } export function main() { commonDemoSetup(); bootstrap(DemoApp, [provide(UrlResolver, {useValue: new DemoUrlResolver()})]); }
updateValue
identifier_name
index.ts
import {bootstrap} from 'angular2/bootstrap'; import {bind, provide, ElementRef, ComponentRef, Component, ViewEncapsulation} from 'angular2/core'; import {UrlResolver} from 'angular2/compiler'; import { MdDialog, MdDialogRef, MdDialogConfig } from 'angular2_material/src/components/dialog/dialog'; import {commonDe...
open() { if (isPresent(this.dialogRef)) { return; } this.dialog.open(SimpleDialogComponent, this.elementRef, this.dialogConfig) .then(ref => { this.dialogRef = ref; ref.instance.numCoconuts = 777; ref.whenClosed.then(result => { this.dialogRef = ...
{ this.dialog = mdDialog; this.elementRef = elementRef; this.dialogConfig = new MdDialogConfig(); this.dialogConfig.width = '60%'; this.dialogConfig.height = '60%'; this.lastResult = ''; }
identifier_body
release_selector.py
import re import sublime from ..versions import version_exclude_prerelease def filter_releases(package, settings, releases): """ Returns all releases in the list of releases that are compatible with the current platform and version of Sublime Text :param package: The name of the package ...
if min_version > int(sublime.version()): return False if max_version < int(sublime.version()): return False return True
return None
conditional_block
release_selector.py
import re import sublime from ..versions import version_exclude_prerelease def filter_releases(package, settings, releases): """ Returns all releases in the list of releases that are compatible with the current platform and version of Sublime Text :param package: The name of the package ...
return False return True
return False if max_version < int(sublime.version()):
random_line_split
release_selector.py
import re import sublime from ..versions import version_exclude_prerelease def
(package, settings, releases): """ Returns all releases in the list of releases that are compatible with the current platform and version of Sublime Text :param package: The name of the package :param settings: A dict optionally containing the `install_prereleases` key :param ...
filter_releases
identifier_name
release_selector.py
import re import sublime from ..versions import version_exclude_prerelease def filter_releases(package, settings, releases): """ Returns all releases in the list of releases that are compatible with the current platform and version of Sublime Text :param package: The name of the package ...
elif range_match: min_version = int(range_match.group(1)) max_version = int(range_match.group(2)) else: return None if min_version > int(sublime.version()): return False if max_version < int(sublime.version()): return False return True
min_version = float("-inf") max_version = float("inf") if version_range == '*': return True gt_match = re.match('>(\d+)$', version_range) ge_match = re.match('>=(\d+)$', version_range) lt_match = re.match('<(\d+)$', version_range) le_match = re.match('<=(\d+)$', version_range) rang...
identifier_body
karma.config.js
module.exports = function(config) { config.set({
basePath: '', frameworks: ['jasmine'], /* Important to have here all files related to the project. Double check your dependencies in Angular module and HTML. */ files: [ 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/a...
random_line_split
f23.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ let mut x = 23is; let mut y = 23is; let mut z = 23is; while x > 0is { x -= 1is; while y > 0is { y -= 1is; while z > 0is { z -= 1is; } if x > 10is { return; "unreachable"; } } } }
identifier_body
f23.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { let mut x = 23is; let mut y = 23is; let mut z = 23is; while x > 0is { x -= 1is; while y > 0is { y -= 1is; while z > 0is { z -= 1is; } if x > 10is { return; "unreachable"; } } } }
expr_while_23
identifier_name
f23.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except accordin...
random_line_split
f23.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} } }
{ return; "unreachable"; }
conditional_block
instantiateContextualTypes.ts
// @strict: true // @target: es6 // #6611 export interface A<a> { value: a; } function fn<a>(values: A<a>, value: a) : void { } declare let handlers: A<(value: number) => void>; fn(handlers, value => alert(value)); // #21382 interface BaseProps<T> { initialValues: T; nextValues: (cur: T...
) // #25814 type R = { a: (x: number) => void; b: (x: string) => void; }; type O = { on<P extends keyof R>(x: P, callback: R[P]): void; }; declare var x: O; x.on('a', a => {}); // #29775 namespace N1 { declare class Component<P> { constructor(props: P); } interface Component...
handler(VOID_ACTION, state => state)
random_line_split
instantiateContextualTypes.ts
// @strict: true // @target: es6 // #6611 export interface A<a> { value: a; } function fn<a>(values: A<a>, value: a) : void { } declare let handlers: A<(value: number) => void>; fn(handlers, value => alert(value)); // #21382 interface BaseProps<T> { initialValues: T; nextValues: (cur: T...
<P> { constructor(props: P); } interface ComponentClass<P = {}> { new (props: P): Component<P>; } type CreateElementChildren<P> = P extends { children?: infer C } ? C extends any[] ? C : C[] : unknown; declare function createElement<P extends {}>( type: ComponentClass<P>, ...
Component
identifier_name
topology.py
# -*- coding: utf-8 -*- import ipaddress __all__ = [ 'config_to_map', 'get_region' ] def
(topology_config): """ args: topology_config: dict { 'region1': [ '10.1.1.0/24', '10.1.10.0/24', '172.16.1.0/24' ], 'region2': [ '192.168.1.0/24', '10....
config_to_map
identifier_name
topology.py
# -*- coding: utf-8 -*- import ipaddress __all__ = [ 'config_to_map', 'get_region' ] def config_to_map(topology_config): """ args: topology_config: dict { 'region1': [ '10.1.1.0/24', '10.1.10.0/24', '172.1...
entry is returned is undefined. args: ip_str: string representing an IP address returns: string: region name None: if no region has been found raises: ValueError: raised by ipaddress if ip_str isn't a valid IP address """ ip = ipaddress.ip_address(ip_str) ...
random_line_split
topology.py
# -*- coding: utf-8 -*- import ipaddress __all__ = [ 'config_to_map', 'get_region' ] def config_to_map(topology_config): """ args: topology_config: dict { 'region1': [ '10.1.1.0/24', '10.1.10.0/24', '172.1...
# if only a single match is found return it if len(matches) == 1: return topology_map[matches[0]] # if more than 1 match is found, sort the matches # by prefixlen, return the longest prefixlen entry elif len(matches) > 1: matches.sort(key=lambda net: net.prefixlen) return t...
matches.append(net)
conditional_block
topology.py
# -*- coding: utf-8 -*- import ipaddress __all__ = [ 'config_to_map', 'get_region' ] def config_to_map(topology_config): """ args: topology_config: dict { 'region1': [ '10.1.1.0/24', '10.1.10.0/24', '172.1...
for net in topology_map: if ip in net: matches.append(net) # if only a single match is found return it if len(matches) == 1: return topology_map[matches[0]] # if more than 1 match is found, sort the matches # by prefixlen, return the longest prefixlen entry elif len(...
"""Return name of a region from the topology map for the given IP address, if multiple networks contain the IP, region of the most specific(longest prefix length) match is returned, if multiple equal prefix length found the behavior of which entry is returned is undefined. args: ip_str: st...
identifier_body
axis2.py
# This program is free software; you can redistribute it and/or modify # it under the terms of the (LGPL) GNU Lesser General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will ...
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # written by: Jeff Ortel ( jortel@redhat.com ) import sys sys.path.append('../') import logging import traceback as tb import suds.metrics as metrics from tests import * from suds import * from suds.client import Client from datetime import ...
# GNU Library Lesser General Public License for more details at # ( http://www.gnu.org/licenses/lgpl.html ). # # You should have received a copy of the GNU Lesser General Public License # along with this program; if not, write to the Free Software
random_line_split
axis2.py
# This program is free software; you can redistribute it and/or modify # it under the terms of the (LGPL) GNU Lesser General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will ...
print 'addPet()' dog = client.factory.create('ns2:Dog') dog.name = 'Chance' dog.trained = True print dog try: result = client.service.addPet(person, dog) print '\nreply( %s )\n' % str(result) except Exception, e: print e print '___________________ E X C E P T I O N S __________________________' # # test...
print 'getList(str, %d)' % n result = client.service.getList('hello', n) print '\nreply( %s )\n' % str(result) assert ( isinstance(result, list) and len(result) == n )
conditional_block
noop_waker.rs
//! Utilities for creating zero-cost wakers that don't do anything. use core::task::{RawWaker, RawWakerVTable, Waker}; use core::ptr::null; #[cfg(feature = "std")] use core::cell::UnsafeCell; unsafe fn noop_clone(_data: *const ()) -> RawWaker { noop_raw_waker() } unsafe fn noop(_data: *const ())
const NOOP_WAKER_VTABLE: RawWakerVTable = RawWakerVTable::new(noop_clone, noop, noop, noop); fn noop_raw_waker() -> RawWaker { RawWaker::new(null(), &NOOP_WAKER_VTABLE) } /// Create a new [`Waker`] which does /// nothing when `wake()` is called on it. /// /// # Examples /// /// ``` /// use futures::task::noop_w...
{}
identifier_body
noop_waker.rs
//! Utilities for creating zero-cost wakers that don't do anything. use core::task::{RawWaker, RawWakerVTable, Waker}; use core::ptr::null; #[cfg(feature = "std")] use core::cell::UnsafeCell; unsafe fn noop_clone(_data: *const ()) -> RawWaker { noop_raw_waker() }
fn noop_raw_waker() -> RawWaker { RawWaker::new(null(), &NOOP_WAKER_VTABLE) } /// Create a new [`Waker`] which does /// nothing when `wake()` is called on it. /// /// # Examples /// /// ``` /// use futures::task::noop_waker; /// let waker = noop_waker(); /// waker.wake(); /// ``` #[inline] pub fn noop_waker() -> W...
unsafe fn noop(_data: *const ()) {} const NOOP_WAKER_VTABLE: RawWakerVTable = RawWakerVTable::new(noop_clone, noop, noop, noop);
random_line_split
noop_waker.rs
//! Utilities for creating zero-cost wakers that don't do anything. use core::task::{RawWaker, RawWakerVTable, Waker}; use core::ptr::null; #[cfg(feature = "std")] use core::cell::UnsafeCell; unsafe fn noop_clone(_data: *const ()) -> RawWaker { noop_raw_waker() } unsafe fn noop(_data: *const ()) {} const NOOP_W...
() -> &'static Waker { thread_local! { static NOOP_WAKER_INSTANCE: UnsafeCell<Waker> = UnsafeCell::new(noop_waker()); } NOOP_WAKER_INSTANCE.with(|l| unsafe { &*l.get() }) }
noop_waker_ref
identifier_name
commander.js
var colors = require('colors'); var OS = require("os"); var path = require('path'); var environments = require('./environments'); var configLoader = require("mcms-node-config-loader").setEnv(environments); var Config = configLoader.loadConfig(path.join(__dirname,'./App/Config')); Config.baseDir = path.join(__dirname,'....
Controllers : {}, Event : Event }; var Mcms = require("mcms-node-core")(App); var argv = require('minimist')(process.argv.slice(2)); var Command = Mcms.Command(App); require('./bootstrap')(Mcms,App); App.User = Mcms.User; //Register serviceProviders App.serviceProviders = Mcms.serviceProvider; App.servicePro...
Connections : {}, Services : {},
random_line_split
commander.js
var colors = require('colors'); var OS = require("os"); var path = require('path'); var environments = require('./environments'); var configLoader = require("mcms-node-config-loader").setEnv(environments); var Config = configLoader.loadConfig(path.join(__dirname,'./App/Config')); Config.baseDir = path.join(__dirname,'....
command = App.commands[command]; command.options = argv; command.fire(function(err,res){ if (err){ console.log(colors.red(err)); process.exit(); } console.log(res); process.exit(); });
{ console.log(colors.red('Command not found')); process.exit(); }
conditional_block
index.js
'use strict'; // 1. npm install body-parser express request // 2. Download and install ngrok from https://ngrok.com/download // 3. ./ngrok http 8445 // 4. WIT_TOKEN=your_access_token FB_PAGE_ID=your_page_id FB_PAGE_TOKEN=your_page_token FB_VERIFY_TOKEN=verify_token node examples/messenger.js // 5. Subscribe your page...
}, merge(sessionId, context, entities, message, cb) { cb(context); }, error(sessionId, context, error) { console.log(error.message); }, ['blank'](sessionId, context, cb) { // Herer is where an API call would go // context.return = apiCall(context.loc); context.return = 'return String'; ...
{ console.log('Oops! Couldn\'t find user for session:', sessionId); // Giving the wheel back to our bot cb(); }
conditional_block
index.js
'use strict'; // 1. npm install body-parser express request // 2. Download and install ngrok from https://ngrok.com/download // 3. ./ngrok http 8445 // 4. WIT_TOKEN=your_access_token FB_PAGE_ID=your_page_id FB_PAGE_TOKEN=your_page_token FB_VERIFY_TOKEN=verify_token node examples/messenger.js // 5. Subscribe your page...
const FB_VERIFY_TOKEN = process.env.FB_VERIFY_TOKEN; // Messenger API specific code // See the Send API reference // https://developers.facebook.com/docs/messenger-platform/send-api-reference const fbReq = request.defaults({ uri: 'https://graph.facebook.com/me/messages', method: 'POST', json: true, qs: { acce...
throw new Error('missing FB_PAGE_TOKEN'); }
random_line_split
index.js
'use strict'; // 1. npm install body-parser express request // 2. Download and install ngrok from https://ngrok.com/download // 3. ./ngrok http 8445 // 4. WIT_TOKEN=your_access_token FB_PAGE_ID=your_page_id FB_PAGE_TOKEN=your_page_token FB_VERIFY_TOKEN=verify_token node examples/messenger.js // 5. Subscribe your page...
(sessionId, context, entities, message, cb) { cb(context); }, error(sessionId, context, error) { console.log(error.message); }, ['blank'](sessionId, context, cb) { // Herer is where an API call would go // context.return = apiCall(context.loc); context.return = 'return String'; cb(contex...
merge
identifier_name
index.js
'use strict'; // 1. npm install body-parser express request // 2. Download and install ngrok from https://ngrok.com/download // 3. ./ngrok http 8445 // 4. WIT_TOKEN=your_access_token FB_PAGE_ID=your_page_id FB_PAGE_TOKEN=your_page_token FB_VERIFY_TOKEN=verify_token node examples/messenger.js // 5. Subscribe your page...
, error(sessionId, context, error) { console.log(error.message); }, ['blank'](sessionId, context, cb) { // Herer is where an API call would go // context.return = apiCall(context.loc); context.return = 'return String'; cb(context); } }; // Setting up our bot const wit = new Wit(WIT_TOKEN, a...
{ cb(context); }
identifier_body
dispatcher.py
#!/usr/bin/python3 # Copyright (C) 2015 Bitquant Research Laboratories (Asia) Limited # Released under the Simplified BSD License import my_path import time import zmq.green as zmq import pprint import algobroker import msgpack class Dispatcher(algobroker.Broker):
self.debug("sending web") self.debug(pprint.pformat(data)) self.web_sender.send(msgpack.packb(data)) elif (data.get('broker', None) == 'bitmex'): self.debug("sending bitmex") self.debug(pprint.pformat(data)) self.bitmex_sender.send(msgpack....
def __init__(self): algobroker.Broker.__init__(self, "dispatcher") # send work self.sms_sender = self.socket(zmq.PUSH) self.sms_sender.connect(algobroker.ports['data']['broker_plivo']) self.bitmex_sender = self.socket(zmq.PUSH) self.bitmex_sender.connect(algobroker.ports[...
identifier_body
dispatcher.py
#!/usr/bin/python3 # Copyright (C) 2015 Bitquant Research Laboratories (Asia) Limited # Released under the Simplified BSD License import my_path import time import zmq.green as zmq import pprint import algobroker import msgpack class Dispatcher(algobroker.Broker): def __init__(self): algobroker.Broker._...
else: self.error("unknown action") if __name__ == "__main__": dispatcher = Dispatcher() dispatcher.run()
self.debug("sending bitmex") self.debug(pprint.pformat(data)) self.bitmex_sender.send(msgpack.packb(data))
conditional_block
dispatcher.py
#!/usr/bin/python3 # Copyright (C) 2015 Bitquant Research Laboratories (Asia) Limited # Released under the Simplified BSD License import my_path import time import zmq.green as zmq import pprint import algobroker import msgpack class
(algobroker.Broker): def __init__(self): algobroker.Broker.__init__(self, "dispatcher") # send work self.sms_sender = self.socket(zmq.PUSH) self.sms_sender.connect(algobroker.ports['data']['broker_plivo']) self.bitmex_sender = self.socket(zmq.PUSH) self.bitmex_sender...
Dispatcher
identifier_name
dispatcher.py
#!/usr/bin/python3 # Copyright (C) 2015 Bitquant Research Laboratories (Asia) Limited # Released under the Simplified BSD License import my_path import time import zmq.green as zmq import pprint import algobroker import msgpack class Dispatcher(algobroker.Broker): def __init__(self): algobroker.Broker._...
self.web_sender.send(msgpack.packb(data)) elif (data.get('broker', None) == 'bitmex'): self.debug("sending bitmex") self.debug(pprint.pformat(data)) self.bitmex_sender.send(msgpack.packb(data)) else: self.error("unknown action") if __name__ ==...
self.debug(pprint.pformat(data))
random_line_split
example_python_operator.py
# -*- coding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software ...
run_this = PythonOperator( task_id='print_the_context', provide_context=True, python_callable=print_context, dag=dag) for i in range(10): ''' Generating 10 sleeping task, sleeping from 0 to 9 seconds respectively ''' task = PythonOperator( task_id='sleep_for_'+str(i), ...
pprint(kwargs) print(ds) return 'Whatever you return gets printed in the logs'
identifier_body
example_python_operator.py
# -*- coding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software ...
from pprint import pprint seven_days_ago = datetime.combine( datetime.today() - timedelta(7), datetime.min.time()) args = { 'owner': 'airflow', 'start_date': seven_days_ago, } dag = DAG( dag_id='example_python_operator', default_args=args, schedule_interval=None) def my_sleeping_function(ra...
from datetime import datetime, timedelta import time
random_line_split
example_python_operator.py
# -*- coding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software ...
(random_base): '''This is a function that will run within the DAG execution''' time.sleep(random_base) def print_context(ds, **kwargs): pprint(kwargs) print(ds) return 'Whatever you return gets printed in the logs' run_this = PythonOperator( task_id='print_the_context', provide_context=Tr...
my_sleeping_function
identifier_name
example_python_operator.py
# -*- coding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software ...
''' Generating 10 sleeping task, sleeping from 0 to 9 seconds respectively ''' task = PythonOperator( task_id='sleep_for_'+str(i), python_callable=my_sleeping_function, op_kwargs={'random_base': float(i)/10}, dag=dag) task.set_upstream(run_this)
conditional_block
TestScopedEnumType.py
from __future__ import print_function import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class ScopedEnumType(TestBase): mydir = TestBase.compute_mydir(__file__) @skipIf(dwarf_version=['<', '4']) def test(self):
## b is not a Foo value = frame.EvaluateExpression("b == Foo::FooBar") self.assertTrue(value.IsValid()) self.assertFalse(value.GetError().Success()) ## integral is not implicitly convertible to a scoped enum value = frame.EvaluateExpression("1 == Foo::FooBar") s...
self.build() self.main_source = "main.cpp" self.main_source_spec = lldb.SBFileSpec(self.main_source) (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, '// Set break point at this line.', self.main_source_spec) frame = thr...
identifier_body
TestScopedEnumType.py
from __future__ import print_function import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class ScopedEnumType(TestBase): mydir = TestBase.compute_mydir(__file__) @skipIf(dwarf_version=['<', '4']) def test(self):
self.main_source = "main.cpp" self.main_source_spec = lldb.SBFileSpec(self.main_source) (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, '// Set break point at this line.', self.main_source_spec) frame = thread.GetFrameA...
self.build()
random_line_split
TestScopedEnumType.py
from __future__ import print_function import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class ScopedEnumType(TestBase): mydir = TestBase.compute_mydir(__file__) @skipIf(dwarf_version=['<', '4']) def
(self): self.build() self.main_source = "main.cpp" self.main_source_spec = lldb.SBFileSpec(self.main_source) (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, '// Set break point at this line.', self.main_source_spec) ...
test
identifier_name
getters.ts
export const GET_CURRENT_CATEGORY_PRODUCTS = 'products/GET_CURRENT_CATEGORY_PRODUCTS' export const GET_CURRENT_PRODUCT = 'products/GET_CURRENT_PRODUCT' export const GET_CURRENT_PRODUCT_TYPE = 'products/GET_CURRENT_PRODUCT_TYPE' export const GET_CURRENT_PRODUCT_VARIANT = 'products/GET_CURRENT_PRODUCT_VARIANT' export con...
(state) { return state.currentProductType } } /** * get variants of current product * * @param {any} state * @returns */ function getCurrentVariants(state) { if (state.currentProduct) { return [ state.currentProduct.masterVariant, ...state.currentProduct.variants ] } else { retur...
[GET_CURRENT_PRODUCT_TYPE]
identifier_name
getters.ts
export const GET_CURRENT_CATEGORY_PRODUCTS = 'products/GET_CURRENT_CATEGORY_PRODUCTS' export const GET_CURRENT_PRODUCT = 'products/GET_CURRENT_PRODUCT' export const GET_CURRENT_PRODUCT_TYPE = 'products/GET_CURRENT_PRODUCT_TYPE' export const GET_CURRENT_PRODUCT_VARIANT = 'products/GET_CURRENT_PRODUCT_VARIANT' export con...
else { return [] } } export default getters
{ return [ state.currentProduct.masterVariant, ...state.currentProduct.variants ] }
conditional_block
getters.ts
export const GET_CURRENT_CATEGORY_PRODUCTS = 'products/GET_CURRENT_CATEGORY_PRODUCTS' export const GET_CURRENT_PRODUCT = 'products/GET_CURRENT_PRODUCT' export const GET_CURRENT_PRODUCT_TYPE = 'products/GET_CURRENT_PRODUCT_TYPE' export const GET_CURRENT_PRODUCT_VARIANT = 'products/GET_CURRENT_PRODUCT_VARIANT' export con...
, [GET_CURRENT_PRODUCT_VARIANT](state, getters, rootState) { const sku = rootState.route.params.sku const variants = getCurrentVariants(state) const currentVariant = variants.find((variant) => { return variant.sku === sku }) return currentVariant }, [GET_CURRENT_PRODUCT_TYPE](state) ...
{ return getCurrentVariants(state) }
identifier_body
getters.ts
export const GET_CURRENT_CATEGORY_PRODUCTS = 'products/GET_CURRENT_CATEGORY_PRODUCTS' export const GET_CURRENT_PRODUCT = 'products/GET_CURRENT_PRODUCT' export const GET_CURRENT_PRODUCT_TYPE = 'products/GET_CURRENT_PRODUCT_TYPE' export const GET_CURRENT_PRODUCT_VARIANT = 'products/GET_CURRENT_PRODUCT_VARIANT' export con...
}, [GET_CURRENT_PRODUCT](state) { return state.currentProduct }, [GET_CURRENT_PRODUCT_VARIANTS](state) { return getCurrentVariants(state) }, [GET_CURRENT_PRODUCT_VARIANT](state, getters, rootState) { const sku = rootState.route.params.sku const variants = getCurrentVariants(state) c...
random_line_split
card.directive.js
(function () { 'use strict'; //best practice angular.module('scrumboard.demo') .directive('scrumboardCard', CardDirective); function CardDirective()
var cards = list.cards; cards.splice( cards.indexOf(card),1); } //Delete cards and splice it out of the list $scope.delete = function() { $http.delete(url).then( function() { removeCardFromList($scope.card, $scope.list); ...
{ return { //return template html templateUrl: '/static/html/card.html', //restrict as HTML element 'E' restrict: 'E', //New attribute controller to handle updating card details controller: ['$scope', '$http', function ($scope, $http) { var url = '/scrumboard/cards/' + $s...
identifier_body
card.directive.js
(function () { 'use strict'; //best practice angular.module('scrumboard.demo') .directive('scrumboardCard', CardDirective); function CardDirective() { return { //return template html templateUrl: '/static/html/card.html', //restrict as HTML element 'E' restrict: 'E', //New ...
$scope.card.list = $scope.destList.id; //save the card to the server and run update() which updates the view $scope.update().then(function() { removeCardFromList($scope.card, $scope.list); $scope.destList.cards.push($scope.card); }); } //l...
//takes id of list user select and assigns it to destList.id
random_line_split
card.directive.js
(function () { 'use strict'; //best practice angular.module('scrumboard.demo') .directive('scrumboardCard', CardDirective); function
() { return { //return template html templateUrl: '/static/html/card.html', //restrict as HTML element 'E' restrict: 'E', //New attribute controller to handle updating card details controller: ['$scope', '$http', function ($scope, $http) { var url = '/scrumboard/cards/' +...
CardDirective
identifier_name
card.directive.js
(function () { 'use strict'; //best practice angular.module('scrumboard.demo') .directive('scrumboardCard', CardDirective); function CardDirective() { return { //return template html templateUrl: '/static/html/card.html', //restrict as HTML element 'E' restrict: 'E', //New ...
//takes id of list user select and assigns it to destList.id $scope.card.list = $scope.destList.id; //save the card to the server and run update() which updates the view $scope.update().then(function() { removeCardFromList($scope.card, $scope.list); $scop...
{ return; }
conditional_block
class-fold.ts
import * as fs from 'fs'; import * as ts from 'typescript'; interface ClassData { name: string; class: ts.VariableDeclaration; return: ts.ReturnStatement; } export interface OpDesc { op: 'insert' | 'remove'; pos: number; text: string; } export function foldFile(file: string, name: string): string { let...
return; } const callExpr = (expr as ts.ParenthesizedExpression).expression as ts.CallExpression; if (callExpr.expression.kind !== ts.SyntaxKind.FunctionExpression) { return; } const fn = callExpr.expression as ts.FunctionExpression; if (fn.body.statements.length < 2) { return; ...
{ const classes: ClassData[] = []; ts.forEachChild(node, child => { if (child.kind !== ts.SyntaxKind.VariableStatement) { return; } const varStmt = child as ts.VariableStatement; if (varStmt.declarationList.declarations.length > 1) { return; } const varDecl = varStmt.declarationL...
identifier_body
class-fold.ts
import * as fs from 'fs'; import * as ts from 'typescript'; interface ClassData { name: string; class: ts.VariableDeclaration; return: ts.ReturnStatement; } export interface OpDesc { op: 'insert' | 'remove'; pos: number; text: string; } export function foldFile(file: string, name: string): string { let...
const retStmt = fn.body.statements[fn.body.statements.length - 1] as ts.ReturnStatement; classes.push({ name, class: varDecl, return: retStmt, }); }); const ops = [] as OpDesc[]; // Now find each assignment outside of the declaration. ts.forEachChild(node, child => { if (chi...
return; }
conditional_block
class-fold.ts
import * as fs from 'fs'; import * as ts from 'typescript'; interface ClassData { name: string; class: ts.VariableDeclaration; return: ts.ReturnStatement; } export interface OpDesc { op: 'insert' | 'remove'; pos: number; text: string; } export function
(file: string, name: string): string { let contents = fs.readFileSync(file).toString(); const options: ts.CompilerOptions = { allowJs: true, }; const program = ts.createProgram([file], options); const source = program.getSourceFile(file); const checker = program.getTypeChecker(); const ops = foldAl...
foldFile
identifier_name
class-fold.ts
interface ClassData { name: string; class: ts.VariableDeclaration; return: ts.ReturnStatement; } export interface OpDesc { op: 'insert' | 'remove'; pos: number; text: string; } export function foldFile(file: string, name: string): string { let contents = fs.readFileSync(file).toString(); const option...
import * as fs from 'fs'; import * as ts from 'typescript';
random_line_split
onedrive.js
callback(false, response); }, function(responseFailed) { console.error('OneDrive::*onedriveCall()', 'error', responseFailed, args); callback(responseFailed.error.message); } ); } /** * Gets OS.js VFS File Metadata type from OneDrive item */ function getItemType...
_scandir(drivePath); }); }; OneDriveStorage.read = function(item, callback, options) { options = options || {}; this.url(item, function(error, url) { if ( error ) { callback(error); return; } OSjs.VFS.remoteRead(url, item.mime, function(error, response) { ...
{ _finished(error); return; }
conditional_block
onedrive.js
callback(false, response); }, function(responseFailed) { console.error('OneDrive::*onedriveCall()', 'error', responseFailed, args); callback(responseFailed.error.message); } ); } /** * Gets OS.js VFS File Metadata type from OneDrive item */ function getItemType...
function _scandir(drivePath) { onedriveCall({ path: drivePath, method: 'GET' }, function(error, response) { if ( error ) { _finished(error); return; } console.debug('OneDrive::scandir()', '=>', response); getFilesInFolder(response.id...
{ console.groupEnd(); callback(error, result); }
identifier_body
onedrive.js
{ callback(false, response); }, function(responseFailed) { console.error('OneDrive::*onedriveCall()', 'error', responseFailed, args); callback(responseFailed.error.message); } ); } /** * Gets OS.js VFS File Metadata type from OneDrive item */ function getItemT...
(drivePath) { onedriveCall({ path: drivePath, method: 'GET' }, function(error, response) { if ( error ) { _finished(error); return; } console.debug('OneDrive::scandir()', '=>', response); getFilesInFolder(response.id, function(error, list)...
_scandir
identifier_name
onedrive.js
var itemFile = new OSjs.VFS.File({ id: item.id, filename: item.name, size: item.size || 0, path: path, mime: getItemMime(item), type: getItemType(item) }); return itemFile; } /** * Get MIME type from file extension of a file * Yeah... it's pretty rough, but One...
callback(false, false); return; }
random_line_split
mod.rs
use std::net::*; use std::thread::{sleep, spawn, JoinHandle}; use std::time::*; use super::ai::*; use super::drawer::*; use super::map::*; use super::messages::*; use super::paths::*; use super::responses::*; use super::units::*; use error::*; use networking::*; use settings::*; mod client; mod server; pub use self:...
(map: Map, settings: Settings) -> Result<(Server, ThreadHandle, ThreadHandle)> { let (ai_1_conn, server_ai_1_conn) = make_connections(); let (ai_2_conn, server_ai_2_conn) = make_connections(); let server = Server::new_local(map, server_ai_1_conn, server_ai_2_conn, settings)?; let mut ai_1 = AIClient::n...
ai_vs_ai
identifier_name
mod.rs
use std::net::*; use std::thread::{sleep, spawn, JoinHandle}; use std::time::*; use super::ai::*; use super::drawer::*; use super::map::*; use super::messages::*; use super::paths::*; use super::responses::*; use super::units::*; use error::*; use networking::*; use settings::*; mod client; mod server; pub use self:...
pub fn multiplayer(addr: &str, map: Map, settings: Settings) -> Result<(Client, ThreadHandle)> { let (client_conn, server_conn) = make_connections(); let mut server = Server::new_one_local(addr, map, server_conn, settings)?; let server = spawn(move || server.run()); let client = Client::new(client_co...
{ let (player_conn, server_player_conn) = make_connections(); let (ai_conn, server_ai_conn) = make_connections(); let mut server = Server::new_local(map, server_player_conn, server_ai_conn, settings)?; let server = spawn(move || server.run()); let client = Client::new(player_conn)?; let mut ai_...
identifier_body
mod.rs
use std::net::*;
use std::time::*; use super::ai::*; use super::drawer::*; use super::map::*; use super::messages::*; use super::paths::*; use super::responses::*; use super::units::*; use error::*; use networking::*; use settings::*; mod client; mod server; pub use self::client::*; use self::server::*; // A connection from a clien...
use std::thread::{sleep, spawn, JoinHandle};
random_line_split
IndexHtmlSource.js
var path = require('path'); var cheerio = require('cheerio'); var URI = require('URIjs'); var _ = require('lodash'); var Source = require('webpack/lib/Source'); /** * @class * @extends Source * @param {Module} sourceModule * @param {Chunk} sourceChunk * @param {Compilation} compilation */ function IndexHtmlSourc...
(s) { return s.toString().replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"); } /** * Coalesce all links with the same rel and href into one * @param $ */ function coalesceLinks($) { $('link').each(function () { var rel = $(this).attr('rel'); var href = $(this).attr('href'); $(this).nextAll("l...
regexpQuote
identifier_name
IndexHtmlSource.js
var path = require('path'); var cheerio = require('cheerio'); var URI = require('URIjs'); var _ = require('lodash'); var Source = require('webpack/lib/Source'); /** * @class * @extends Source * @param {Module} sourceModule * @param {Chunk} sourceChunk * @param {Compilation} compilation */ function IndexHtmlSourc...
/** * Extracts the HTML code from the module source */ IndexHtmlSource.prototype._getHtmlFromModule = function() { var compilation = this.compilation; var sourceChunk = this.sourceChunk; function moduleWasExtracted(module) { return module.loaders && module.loaders.some(function(loader) { ...
coalesceLinks($); this._resolveScripts($); return $.html(); };
random_line_split
IndexHtmlSource.js
var path = require('path'); var cheerio = require('cheerio'); var URI = require('URIjs'); var _ = require('lodash'); var Source = require('webpack/lib/Source'); /** * @class * @extends Source * @param {Module} sourceModule * @param {Chunk} sourceChunk * @param {Compilation} compilation */ function IndexHtmlSourc...
} else { return regexpQuote(literalPart); } }); filenamePattern = new RegExp(filenamePattern); return _.find(sourceChunk.files, function(filename) { return filename.match(filenamePattern); }); } function __we...
{ var options = getExtractTextLoaderOptions(module); var loaderId = options && options.id; var extractTextPlugin = _.find(compilation.compiler.options.plugins, function (p) { return (p.constructor.name === 'ExtractTextPlugin') && ((typeof(p.id) =...
identifier_body
IndexHtmlSource.js
var path = require('path'); var cheerio = require('cheerio'); var URI = require('URIjs'); var _ = require('lodash'); var Source = require('webpack/lib/Source'); /** * @class * @extends Source * @param {Module} sourceModule * @param {Chunk} sourceChunk * @param {Compilation} compilation */ function IndexHtmlSourc...
else { return regexpQuote(literalPart); } }); filenamePattern = new RegExp(filenamePattern); return _.find(sourceChunk.files, function(filename) { return filename.match(filenamePattern); }); } function __webpack_require__(mo...
{ if (maxLength) { return '[a-f0-9]{1,' + maxLength + '}'; } else { return '[a-f0-9]+'; } }
conditional_block
test_modbus_server.rs
use libmodbus::{Modbus, ModbusServer, ModbusTCP}; #[test] #[ignore] fn receive()
} } #[test] #[ignore] fn reply() { let _modbus = Modbus::new_tcp("127.0.0.1", 1502).unwrap(); }
{ let mut query = vec![0; Modbus::MAX_ADU_LENGTH as usize]; // create server match Modbus::new_tcp("127.0.0.1", 1502) { Ok(mut server) => { let mut socket = server.tcp_listen(1).expect("could not listen"); server .tcp_accept(&mut socket) .expec...
identifier_body
test_modbus_server.rs
use libmodbus::{Modbus, ModbusServer, ModbusTCP}; #[test] #[ignore] fn receive() { let mut query = vec![0; Modbus::MAX_ADU_LENGTH as usize]; // create server match Modbus::new_tcp("127.0.0.1", 1502) { Ok(mut server) => { let mut socket = server.tcp_listen(1).expect("could not listen"); ...
fn reply() { let _modbus = Modbus::new_tcp("127.0.0.1", 1502).unwrap(); }
#[ignore]
random_line_split
test_modbus_server.rs
use libmodbus::{Modbus, ModbusServer, ModbusTCP}; #[test] #[ignore] fn receive() { let mut query = vec![0; Modbus::MAX_ADU_LENGTH as usize]; // create server match Modbus::new_tcp("127.0.0.1", 1502) { Ok(mut server) => { let mut socket = server.tcp_listen(1).expect("could not listen"); ...
() { let _modbus = Modbus::new_tcp("127.0.0.1", 1502).unwrap(); }
reply
identifier_name
fixtures.py
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014 Anler Hernández <hello@anler.me> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
def __getattr__(self, name): return functools.partial(getattr(self.obj, name), **self.partial_params) @pytest.fixture def client(): from django.test.client import Client class _Client(Client): def login(self, user=None, backend="django.contrib.auth.backends.ModelBackend", **credentials): ...
f.obj = obj self.partial_params = partial_params
identifier_body
fixtures.py
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014 Anler Hernández <hello@anler.me> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
@property def json(self): return PartialMethodCaller(obj=self, content_type='application/json;charset="utf-8"') return _Client() @pytest.fixture def outbox(): from django.core import mail return mail.outbox
random_line_split
fixtures.py
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014 Anler Hernández <hello@anler.me> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
lf): return PartialMethodCaller(obj=self, content_type='application/json;charset="utf-8"') return _Client() @pytest.fixture def outbox(): from django.core import mail return mail.outbox
n(se
identifier_name
fixtures.py
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014 Anler Hernández <hello@anler.me> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
with mock.patch('django.contrib.auth.authenticate') as authenticate: user.backend = backend authenticate.return_value = user return super().login(**credentials) @property def json(self): return PartialMethodCaller(obj=self, content_...
urn super().login(**credentials)
conditional_block
specialcrate.rs
, 0), }; Vector { x: self.x + dx, y: self.y + dy, } } fn random (bounds: Vector) -> Vector { let mut rng = rand::thread_rng(); Vector { x: rng.gen_range::<>(0, bounds.x), y: rng.gen_range::<>(0, bounds.y), } } ...
fn give_chance_to_fire (&self) -> Option<Bullet> { let mut rng = rand::thread_rng(); let temp: f32 = rng.gen_range(0.0, 1.0); if temp > 0.996 { Some(Bullet::new(Vector { x: self.position.x, y: self.position.y + 1 }, Direction::Down)) } else { ...
{ let x = &mut self.position.x; self.direction = match self.direction { Direction::Left if *x < 0 => Direction::Right, Direction::Right if *x == bounds.x => Direction::Left, _ => self.direction.clone() }; match self.direction { Direction::L...
identifier_body
specialcrate.rs
, 0), }; Vector { x: self.x + dx, y: self.y + dy, } } fn random (bounds: Vector) -> Vector { let mut rng = rand::thread_rng(); Vector { x: rng.gen_range::<>(0, bounds.x), y: rng.gen_range::<>(0, bounds.y), } } ...
(bounds: Vector) -> Game { let mut invaders = vec!(); //for i in range(0i32, bounds.x / 3) { for i in 0i32..(bounds.x / 3) { invaders.push(Invader::new( Vector { x: 2 * i, y: 0 })); } Game { bounds: bounds, invaders: invaders, pl...
new
identifier_name
specialcrate.rs
, 0), }; Vector { x: self.x + dx, y: self.y + dy, } } fn random (bounds: Vector) -> Vector { let mut rng = rand::thread_rng(); Vector { x: rng.gen_range::<>(0, bounds.x), y: rng.gen_range::<>(0, bounds.y), } } ...
if self.snake.hits_wall(self.bounds) { Err(GameError::Wall) } else if self.snake.hits_itself() { Err(GameError::Suicide) } else { Ok(()) } } pub fn get_snake_vectors (&self) -> &[Vector] { let ref v = self.snake.segments; &v[...
{ self.snake.grow(); self.bullet = Vector::random(self.bounds); }
conditional_block
specialcrate.rs
, 0), }; Vector { x: self.x + dx, y: self.y + dy, } } fn random (bounds: Vector) -> Vector { let mut rng = rand::thread_rng(); Vector { x: rng.gen_range::<>(0, bounds.x), y: rng.gen_range::<>(0, bounds.y), } } ...
draw_char(segment, '#'); } } direction = get_new_direction(direction); board.set_direction(direction); match board.tick() { Err(err) => { match err { GameError::Wall => show_text("You hit the wall, stupid."), ...
for segment in segments.iter() {
random_line_split
expectations.js
/** * @license Copyright 2017 Google Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or a...
}, }, ];
random_line_split
theme.js
(er) {} } var config = $.cookie = function (key, value, options) { // write if (value !== undefined) { options = $.extend({}, config.defaults, options); if (typeof options.expires === 'number') { var days = options.expires, t = options.expires = new Date(); t.setDate(t.getDate() + days); } ...
(menuAdditionalList) { var html = '<div id="flowmenu"><div class="icons"><span id="logosmall"/></div></div>'; $('#header').append(html); if($('#project_quick_jump_box').length > 0){ $('#flowmenu .icons').append('<div><div class="selector-div">'+getOuterHtml('#project_quick_jump_box')+'</div></div>'); // co...
createFlowmenu
identifier_name
theme.js
) {} } var config = $.cookie = function (key, value, options) { // write if (value !== undefined) { options = $.extend({}, config.defaults, options); if (typeof options.expires === 'number') { var days = options.expires, t = options.expires = new Date(); t.setDate(t.getDate() + days); } va...
function createFlowmenu(menuAdditionalList) { var html = '<div id="flowmenu"><div class="icons"><span id="logosmall"/></div></div>'; $('#header').append(html); if($('#project_quick_jump_box').length > 0){ $('#flowmenu .icons').append('<div><div class="selector-div">'+getOuterHtml('#project_quick_jump_box')+'...
{ if ($(obj).size() > 0){ var html = $(obj)[0].outerHTML; if (html != "") return html; return $(obj).parent().html(); } else{ return ""; } }
identifier_body
theme.js
) {} } var config = $.cookie = function (key, value, options) { // write if (value !== undefined)
// read var decode = config.raw ? raw : decoded; var cookies = document.cookie.split('; '); var result = key ? undefined : {}; for (var i = 0, l = cookies.length; i < l; i++) { var parts = cookies[i].split('='); var name = decode(parts.shift()); var cookie = decode(parts.join('=')); if (key && ...
{ options = $.extend({}, config.defaults, options); if (typeof options.expires === 'number') { var days = options.expires, t = options.expires = new Date(); t.setDate(t.getDate() + days); } value = config.json ? JSON.stringify(value) : String(value); return (document.cookie = [ encodeURICo...
conditional_block
theme.js
(er) {} } var config = $.cookie = function (key, value, options) { // write if (value !== undefined) { options = $.extend({}, config.defaults, options); if (typeof options.expires === 'number') { var days = options.expires, t = options.expires = new Date(); t.setDate(t.getDate() + days); } ...
createFlowmenu(menuAdditionalArray); $(document).scroll(function(){ if ($(this).scrollTop() > scrollTop && !isVisible('#flow
if (scrollTop > -1) {
random_line_split
conf.py
that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys import os import shlex # If extensions (or modules to document with autodoc) are in another directory, # add these di...
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referrin...
#html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True
random_line_split