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
cachestatus.js
Entries( cache_visitor ); } /* * This function takes what could be 15.8912576891 and drops it to just * one decimal place. In a future version, I could have the user say * how many decimal places... */ function round_memory_usage( memory ) { memory = parseFloat( memory ); memory *= 10; memor...
{ var ram_tooltip = this._doc.createElement( 'tooltip' ); ram_tooltip.setAttribute( 'id', 'ram_tooltip' ); ram_tooltip.setAttribute( 'orient', 'horizontal' ); var ram_desc_prefix = this._doc.createElement( 'description' ); ram_desc_prefix.setAttribute( 'i...
conditional_block
cachestatus.js
( type, aDeviceInfo, prefs ) { var current = round_memory_usage( aDeviceInfo.totalSize/1024/1024 ); var max = round_memory_usage( aDeviceInfo.maximumSize/1024/1024 ); var cs_id = 'cachestatus'; var bool_pref_key = 'auto_clear'; var int_pref_key = 'ac'; var clear_directive; if ( type =...
cs_updated_stat
identifier_name
run_headless.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use compositing::*; use geom::size::Size2D; use std::unstable::intrinsics; /// Starts the compositor, which list...
Exit => break, GetSize(chan) => { chan.send(Size2D(500, 500)); } GetGraphicsMetadata(chan) => { unsafe { chan.send(intrinsics::uninit()); } } SetIds(_, response_chan, _) => { ...
/// It's intended for headless testing. pub fn run_compositor(compositor: &CompositorTask) { loop { match compositor.port.recv() {
random_line_split
run_headless.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use compositing::*; use geom::size::Size2D; use std::unstable::intrinsics; /// Starts the compositor, which list...
(compositor: &CompositorTask) { loop { match compositor.port.recv() { Exit => break, GetSize(chan) => { chan.send(Size2D(500, 500)); } GetGraphicsMetadata(chan) => { unsafe { chan.send(intrinsics::uninit())...
run_compositor
identifier_name
run_headless.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use compositing::*; use geom::size::Size2D; use std::unstable::intrinsics; /// Starts the compositor, which list...
// we'll notice and think about whether it needs a response, like // SetIds. NewLayer(*) | SetLayerPageSize(*) | SetLayerClipRect(*) | DeleteLayer(*) | Paint(*) | InvalidateRect(*) | ChangeReadyState(*) | ChangeRenderState(*) => () } } com...
{ loop { match compositor.port.recv() { Exit => break, GetSize(chan) => { chan.send(Size2D(500, 500)); } GetGraphicsMetadata(chan) => { unsafe { chan.send(intrinsics::uninit()); } ...
identifier_body
post.js
const mongoose = require('mongoose') const TABLE_NAME = 'Post' const Schema = mongoose.Schema const ObjectId = Schema.Types.ObjectId const escape = (require('../utils')).escape const PostSchema = new Schema({ //类型 type: { type: String, default: 'post' // post | page }, //标题 title: { type: String,...
}, //置顶 top: Boolean, //允许评论 allowComment: { type: Boolean, default: true }, //允许打赏 allowReward: Boolean, //著名版权 license: Boolean, //使用密码 usePassword: Boolean, //密码 password: { type: String, trim: true }, order: { type: Number, default: 1 }, //创建时间 createTim...
random_line_split
typeable.js
/*syn@0.1.4#typeable*/ var syn = require('./synthetic.js'); var typeables = []; var __indexOf = [].indexOf || function (item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) { return i; } } return -1; }; syn.typeable = function (fn) { if (_...
}; syn.typeable.test = function (el) { for (var i = 0, len = typeables.length; i < len; i++) { if (typeables[i](el)) { return true; } } return false; }; var type = syn.typeable; var typeableExp = /input|textarea/i; type(function (el) { return typeableExp.test(el.nodeName); }...
{ typeables.push(fn); }
conditional_block
typeable.js
/*syn@0.1.4#typeable*/ var syn = require('./synthetic.js'); var typeables = []; var __indexOf = [].indexOf || function (item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) { return i; } } return -1; }; syn.typeable = function (fn) { if (_...
syn.typeable.test = function (el) { for (var i = 0, len = typeables.length; i < len; i++) { if (typeables[i](el)) { return true; } } return false; }; var type = syn.typeable; var typeableExp = /input|textarea/i; type(function (el) { return typeableExp.test(el.nodeName); }); t...
typeables.push(fn); } };
random_line_split
en.js
/** * @requires OpenLayers/Lang.js */ /** * Namespace: OpenLayers.Lang["en"] * Dictionary for English. Keys for entries are used in calls to * <OpenLayers.Lang.translate>. Entry bodies are normal strings or * strings formatted for use with <OpenLayers.String.format> calls. */ OpenLayers.Lang...
};
// **** end **** 'end': ''
random_line_split
factory.py
from RPi import GPIO as gpio from robotics.actors.redbot_motor_actor import RedbotMotorActor from robotics.interfaces.spi.mcp3008_spi_interface import MCP3008SpiInterface from robotics.robots.aizek_robot import AizekRobot from robotics.sensors.redbot_wheel_encoder_sensor import RedbotWheelEncoderSensor from robotics.s...
wheel_encoder=wencoder, left_distance_sensor=lsensor, front_distance_sensor=fsensor, right_distance_sensor=rsensor, wheel_radius=wheel_radius, wheel_distance=wheel_distance, ) return robot
robot = AizekRobot( left_motor=lmotor, right_motor=rmotor,
random_line_split
factory.py
from RPi import GPIO as gpio from robotics.actors.redbot_motor_actor import RedbotMotorActor from robotics.interfaces.spi.mcp3008_spi_interface import MCP3008SpiInterface from robotics.robots.aizek_robot import AizekRobot from robotics.sensors.redbot_wheel_encoder_sensor import RedbotWheelEncoderSensor from robotics.s...
(): gpio.setmode(gpio.BOARD) lmotor = RedbotMotorActor(gpio, 8, 10, 12) rmotor = RedbotMotorActor(gpio, 11, 13, 15) spi = MCP3008SpiInterface(0) wencoder = RedbotWheelEncoderSensor(spi) lsensor = SharpIrDistanceSensor(spi, 5) fsensor = SharpIrDistanceSensor(spi, ...
createAizekRobot
identifier_name
factory.py
from RPi import GPIO as gpio from robotics.actors.redbot_motor_actor import RedbotMotorActor from robotics.interfaces.spi.mcp3008_spi_interface import MCP3008SpiInterface from robotics.robots.aizek_robot import AizekRobot from robotics.sensors.redbot_wheel_encoder_sensor import RedbotWheelEncoderSensor from robotics.s...
front_distance_sensor=fsensor, right_distance_sensor=rsensor, wheel_radius=wheel_radius, wheel_distance=wheel_distance, ) return robot
@staticmethod def createAizekRobot(): gpio.setmode(gpio.BOARD) lmotor = RedbotMotorActor(gpio, 8, 10, 12) rmotor = RedbotMotorActor(gpio, 11, 13, 15) spi = MCP3008SpiInterface(0) wencoder = RedbotWheelEncoderSensor(spi) lsensor = SharpIrDistanceSensor(spi, 5) ...
identifier_body
epw2wea.py
# coding=utf-8 from ._commandbase import RadianceCommand from ..datatype import RadiancePath import os class Epw2wea(RadianceCommand): """epw2wea transforms an EnergyPlus weather data (.epw) file into the DAYSIM weather file format, for use with the RADIANCE gendaymtx program. Attributes: ep...
@epw_file.setter def epw_file(self, value): """The path of the epw file that is to be converted to a wea file.""" if value: self._epw_file = value if not self.output_wea_file._value: self.output_wea_file = os.path.splitext(value)[0] + '.wea' else...
return self._epw_file
identifier_body
epw2wea.py
# coding=utf-8 from ._commandbase import RadianceCommand from ..datatype import RadiancePath import os class Epw2wea(RadianceCommand): """epw2wea transforms an EnergyPlus weather data (.epw) file into the DAYSIM weather file format, for use with the RADIANCE gendaymtx program. Attributes: ep...
def to_rad_string(self, relative_path=False): """Return full radiance command as string""" rad_string = "%s %s %s" % ( '"%s"' % os.path.join(self.radbin_path, 'epw2wea'), self.epw_file.to_rad_string(), self.output_wea_file.to_rad_string()) # self.check...
self._epw_file = None
conditional_block
epw2wea.py
# coding=utf-8 from ._commandbase import RadianceCommand from ..datatype import RadiancePath import os class Epw2wea(RadianceCommand): """epw2wea transforms an EnergyPlus weather data (.epw) file into the DAYSIM weather file format, for use with the RADIANCE gendaymtx program. Attributes: ep...
(self, relative_path=False): """Return full radiance command as string""" rad_string = "%s %s %s" % ( '"%s"' % os.path.join(self.radbin_path, 'epw2wea'), self.epw_file.to_rad_string(), self.output_wea_file.to_rad_string()) # self.check_input_files(rad_string...
to_rad_string
identifier_name
epw2wea.py
# coding=utf-8 from ._commandbase import RadianceCommand from ..datatype import RadiancePath import os class Epw2wea(RadianceCommand): """epw2wea transforms an EnergyPlus weather data (.epw) file into the DAYSIM weather file format, for use with the RADIANCE gendaymtx program. Attributes: ep...
""" _epw_file = RadiancePath('_epw_file', descriptive_name='Epw weather data file', relative_path=None, check_exists=False) output_wea_file = RadiancePath('output_wea_file', descriptive_name='Output wea file', ...
random_line_split
customer.d.ts
/** * @file declaration of the Customer interface * @author Bruno Ferreira <shirayuki@kitsune.com.br> * @license MIT */ import { CustomVariable } from './custom-variable'; import { Object } from './object'; /** * Defines a customer associated with an IUGU account */ export interface Customer extends Object { ...
* @type String */ street?: string; /** * Address' city * * @type String */ city?: string; /** * Address' state * * @type String */ state?: string; /** * Address' district. Required if zip_code is set. * * @type String */ d...
*
random_line_split
state.py
# Copyright 2019 Objectif Libre # # 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 agr...
return { 'results': [{ 'scope_id': r.identifier, 'scope_key': r.scope_key, 'fetcher': r.fetcher, 'collector': r.collector, 'state': r.state.isoformat(), } for r in results] } @api_utils.add_inpu...
raise http_exceptions.NotFound( "No resource found for provided filters.")
conditional_block
state.py
# Copyright 2019 Objectif Libre # # 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 agr...
results = self._storage_state.get_all( identifier=scope_id, scope_key=scope_key, fetcher=fetcher, collector=collector, offset=offset, limit=limit, ) if len(results) < 1: raise http_exceptions.NotFound( ...
flask.request.context, 'scope:get_state', {'tenant_id': scope_id or flask.request.context.project_id} )
random_line_split
state.py
# Copyright 2019 Objectif Libre # # 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 agr...
(cls): super(ScopeState, cls).reload() cls._client = messaging.get_client() cls._storage_state = storage_state.StateManager() @api_utils.paginated @api_utils.add_input_schema('query', { voluptuous.Optional('scope_id', default=[]): api_utils.MultiQueryParam(str), ...
reload
identifier_name
state.py
# Copyright 2019 Objectif Libre # # 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 agr...
voluptuous.Required('fetcher'): vutils.get_string_type(), voluptuous.Required('collector'): vutils.get_string_type(), voluptuous.Required('state'): vutils.get_string_type(), }]}) def get(self, offset=0, limit=100, scope_id=None, scope_key=N...
@classmethod def reload(cls): super(ScopeState, cls).reload() cls._client = messaging.get_client() cls._storage_state = storage_state.StateManager() @api_utils.paginated @api_utils.add_input_schema('query', { voluptuous.Optional('scope_id', default=[]): api_utils...
identifier_body
error.rs
use mysql; use std::{error, fmt, result}; #[derive(Debug)] pub enum Error { Mysql(mysql::Error), RecordNotFound(u64), ColumnNotFound, AddressChecksumToTrits, } pub type Result<T> = result::Result<T, Error>; impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self...
} impl From<mysql::Error> for Error { fn from(err: mysql::Error) -> Error { Error::Mysql(err) } }
{ match *self { Error::Mysql(ref err) => Some(err), Error::RecordNotFound(_) | Error::ColumnNotFound | Error::AddressChecksumToTrits => None, } }
identifier_body
error.rs
use mysql; use std::{error, fmt, result}; #[derive(Debug)] pub enum Error { Mysql(mysql::Error), RecordNotFound(u64), ColumnNotFound, AddressChecksumToTrits, } pub type Result<T> = result::Result<T, Error>; impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self...
write!(f, "can't convert address checksum to trits") } } } } impl error::Error for Error { fn description(&self) -> &str { match *self { Error::Mysql(ref err) => err.description(), Error::RecordNotFound(_) => "Record not found", Error::ColumnNotFound => "Column not found", ...
random_line_split
error.rs
use mysql; use std::{error, fmt, result}; #[derive(Debug)] pub enum Error { Mysql(mysql::Error), RecordNotFound(u64), ColumnNotFound, AddressChecksumToTrits, } pub type Result<T> = result::Result<T, Error>; impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self...
(&self) -> &str { match *self { Error::Mysql(ref err) => err.description(), Error::RecordNotFound(_) => "Record not found", Error::ColumnNotFound => "Column not found", Error::AddressChecksumToTrits => "Can't convert to trits", } } fn cause(&self) -> Option<&error::Error> { matc...
description
identifier_name
models.py
from django.db import models from django_hstore import hstore # Create your models here. class Place(models.Model): osm_type = models.CharField(max_length=1) osm_id = models.IntegerField(primary_key=True) class_field = models.TextField(db_column='class') # Field renamed because it was a Python reserved wor...
geometry = models.TextField() # This field type is a guess. objects = hstore.HStoreManager() class Meta : managed = False db_table= 'place' unique_together = ('osm_id', 'class_field') class Phonetique(models.Model): nom = models.TextField() #osm_id = models.Integer...
postcode = models.TextField(blank=True) country_code = models.CharField(max_length=2, blank=True) extratags = models.TextField(blank=True) # This field type is a guess.
random_line_split
models.py
from django.db import models from django_hstore import hstore # Create your models here. class Place(models.Model): osm_type = models.CharField(max_length=1) osm_id = models.IntegerField(primary_key=True) class_field = models.TextField(db_column='class') # Field renamed because it was a Python reserved wor...
class Phonetique(models.Model): nom = models.TextField() #osm_id = models.IntegerField() osm = models.ForeignKey(Place) poids = models.IntegerField() ville = models.CharField(max_length=200) semantic = models.CharField(max_length=25) class Meta : managed = False db_tab...
managed = False db_table= 'place' unique_together = ('osm_id', 'class_field')
identifier_body
models.py
from django.db import models from django_hstore import hstore # Create your models here. class Place(models.Model): osm_type = models.CharField(max_length=1) osm_id = models.IntegerField(primary_key=True) class_field = models.TextField(db_column='class') # Field renamed because it was a Python reserved wor...
(models.Model): nom = models.TextField() #osm_id = models.IntegerField() osm = models.ForeignKey(Place) poids = models.IntegerField() ville = models.CharField(max_length=200) semantic = models.CharField(max_length=25) class Meta : managed = False db_table ='phonetique' ...
Phonetique
identifier_name
webpack-isomorphic-tools.js
var WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin'); // see this link for more info on what all of this means // https://github.com/halt-hammerzeit/webpack-isomorphic-tools module.exports = { webpack_assets_file_path: 'webpack-stats.json', assets: { images: { extensions: [ ...
} } } }
{ var regex = options.development ? /exports\.locals = ((.|\n)+);/ : /module\.exports = ((.|\n)+);/; var match = m.source.match(regex); return match ? JSON.parse(match[1]) : {}; }
conditional_block
webpack-isomorphic-tools.js
var WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin'); // see this link for more info on what all of this means // https://github.com/halt-hammerzeit/webpack-isomorphic-tools module.exports = { webpack_assets_file_path: 'webpack-stats.json', assets: { images: { extensions: [ ...
if (!options.development) { return regex.test(m.name); } //filter by modules with '.scss' inside name string, that also have name and moduleName that end with 'ss'(allows for css, less, sass, and scss extensions) //this ensures that the proper scss module is returned, so that n...
style_modules: { extension: 'scss', filter: function(m, regex, options, log) {
random_line_split
systemvision.js
/* Video's aren't really an uploaded item...we just turn youtube/vimeo links into embeds */ var systemvision = P(Element, function(_, super_) { _.helpText = "<<systemvision>>\nEmbed a SystemVision file. Enter the node id (click 'embed' in SystemVision and in the embed code, look for the 'systemvision.com/node/NOD...
// Success: Delete this block and replace with the video var stream = !this.worksheet.trackingStream; if(stream) this.worksheet.startUndoStream(); systemvisionBlock().insertAfter(this).setDocument(id).show(); this.remove(); if(stream) this.worksheet.endUndoStream(); this.worksheet.save(); ...
{ // No matching provider this.outputBox.expand(); this.outputBox.setError("Invalid Node ID. Please copy in the node id (click 'embed' in SystemVision and in the embed code, look for the 'systemvision.com/node/NODE_ID' url, where NODE_ID is a number you enter here."); return; }
conditional_block
systemvision.js
/* Video's aren't really an uploaded item...we just turn youtube/vimeo links into embeds */ var systemvision = P(Element, function(_, super_) { _.helpText = "<<systemvision>>\nEmbed a SystemVision file. Enter the node id (click 'embed' in SystemVision and in the embed code, look for the 'systemvision.com/node/NOD...
} _.empty = function() { return false; } _.setDocument = function(document_id) { this.document_id = document_id; var html = '<iframe allowfullscreen="true" frameborder="0" width="100%" height="500" scrolling="no" src="https://systemvision.com/node/' + this.document_id + '" title="SystemVision Cloud"...
return this;
random_line_split
bigquerystorage_v1beta2_generated_big_query_write_append_rows_sync.py
# -*- coding: utf-8 -*- # Copyright 2022 Google LLC # # 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...
(): for request in requests: yield request # Make the request stream = client.append_rows(requests=request_generator()) # Handle the response for response in stream: print(response) # [END bigquerystorage_v1beta2_generated_BigQueryWrite_AppendRows_sync]
request_generator
identifier_name
bigquerystorage_v1beta2_generated_big_query_write_append_rows_sync.py
# -*- coding: utf-8 -*- # Copyright 2022 Google LLC # # 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...
# Make the request stream = client.append_rows(requests=request_generator()) # Handle the response for response in stream: print(response) # [END bigquerystorage_v1beta2_generated_BigQueryWrite_AppendRows_sync]
yield request
conditional_block
bigquerystorage_v1beta2_generated_big_query_write_append_rows_sync.py
# -*- coding: utf-8 -*- # Copyright 2022 Google LLC # # 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...
# Make the request stream = client.append_rows(requests=request_generator()) # Handle the response for response in stream: print(response) # [END bigquerystorage_v1beta2_generated_BigQueryWrite_AppendRows_sync]
for request in requests: yield request
identifier_body
bigquerystorage_v1beta2_generated_big_query_write_append_rows_sync.py
# -*- coding: utf-8 -*- # Copyright 2022 Google LLC # # 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...
def request_generator(): for request in requests: yield request # Make the request stream = client.append_rows(requests=request_generator()) # Handle the response for response in stream: print(response) # [END bigquerystorage_v1beta2_generated_BigQueryWrite_AppendRows...
# 'bigquery_storage_v1beta2.AppendRowsRequest' objects # Here we create a generator that yields a single `request` for # demonstrative purposes. requests = [request]
random_line_split
process.ts
const width = 50; const height = 6; let initialState: string[][] = []; for (let j = 0; j < height; ++j) { initialState.push([]); for (let i = 0; i < width; ++i) { initialState[j].push("."); } } const actions = [ { pattern: /^rect (\d+)x(\d+)$/, action: (state: string[][], colu...
state[j][i] = "#"; } } return state; } }, { pattern: /^rotate column x=(\d+) by (\d+)$/, action: (state: string[][], column: number, offset: number) => { const original: string[] = []; for (let j = 0; j ...
random_line_split
process.ts
const width = 50; const height = 6; let initialState: string[][] = []; for (let j = 0; j < height; ++j) { initialState.push([]); for (let i = 0; i < width; ++i)
} const actions = [ { pattern: /^rect (\d+)x(\d+)$/, action: (state: string[][], columns: number, rows: number) => { for (let j = 0; j < rows; ++j) { for (let i = 0; i < columns; ++i) { state[j][i] = "#"; } } ...
{ initialState[j].push("."); }
conditional_block
TestTan.rs
/* * Copyright (C) 2014 The Android Open Source Project *
* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the Licen...
* 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
random_line_split
settings.py
""" Django settings for school project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) imp...
'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickj...
MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware',
random_line_split
profile.rs
use std::cell::RefCell; use std::env; use std::fmt; use std::io::{stdout, StdoutLock, Write}; use std::iter::repeat; use std::mem; use std::time; thread_local!(static PROFILE_STACK: RefCell<Vec<time::Instant>> = RefCell::new(Vec::new())); thread_local!(static MESSAGES: RefCell<Vec<Message>> = RefCell::new(Vec::new()))...
msg ) .expect("printing profiling info to stdout"); print(lvl + 1, &msgs[last..i], enabled, stdout); last = i; } } let stdout = stdout(); MESSAGES.with(|msgs| { ...
random_line_split
profile.rs
use std::cell::RefCell; use std::env; use std::fmt; use std::io::{stdout, StdoutLock, Write}; use std::iter::repeat; use std::mem; use std::time; thread_local!(static PROFILE_STACK: RefCell<Vec<time::Instant>> = RefCell::new(Vec::new())); thread_local!(static MESSAGES: RefCell<Vec<Message>> = RefCell::new(Vec::new()))...
(&mut self) { let enabled = match enabled_level() { Some(i) => i, None => return, }; let (start, stack_len) = PROFILE_STACK.with(|stack| { let mut stack = stack.borrow_mut(); let start = stack.pop().unwrap(); (start, stack.len()) ...
drop
identifier_name
profile.rs
use std::cell::RefCell; use std::env; use std::fmt; use std::io::{stdout, StdoutLock, Write}; use std::iter::repeat; use std::mem; use std::time; thread_local!(static PROFILE_STACK: RefCell<Vec<time::Instant>> = RefCell::new(Vec::new())); thread_local!(static MESSAGES: RefCell<Vec<Message>> = RefCell::new(Vec::new()))...
impl Drop for Profiler { fn drop(&mut self) { let enabled = match enabled_level() { Some(i) => i, None => return, }; let (start, stack_len) = PROFILE_STACK.with(|stack| { let mut stack = stack.borrow_mut(); let start = stack.pop().unwrap(); ...
{ if enabled_level().is_none() { return Profiler { desc: String::new(), }; } PROFILE_STACK.with(|stack| stack.borrow_mut().push(time::Instant::now())); Profiler { desc: desc.to_string(), } }
identifier_body
profile.rs
use std::cell::RefCell; use std::env; use std::fmt; use std::io::{stdout, StdoutLock, Write}; use std::iter::repeat; use std::mem; use std::time; thread_local!(static PROFILE_STACK: RefCell<Vec<time::Instant>> = RefCell::new(Vec::new())); thread_local!(static MESSAGES: RefCell<Vec<Message>> = RefCell::new(Vec::new()))...
PROFILE_STACK.with(|stack| stack.borrow_mut().push(time::Instant::now())); Profiler { desc: desc.to_string(), } } impl Drop for Profiler { fn drop(&mut self) { let enabled = match enabled_level() { Some(i) => i, None => return, }; let (start, ...
{ return Profiler { desc: String::new(), }; }
conditional_block
line_path.rs
use crate::LinePathCommand; use geometry::{Point, Transform, Transformation}; use internal_iter::{ ExtendFromInternalIterator, FromInternalIterator, InternalIterator, IntoInternalIterator, }; use std::iter::Cloned; use std::slice::Iter; /// A sequence of commands that defines a set of contours, each of which consi...
} /// An iterator over the commands that make up a line path. #[derive(Clone, Debug)] pub struct Commands<'a> { verbs: Cloned<Iter<'a, Verb>>, points: Cloned<Iter<'a, Point>>, } impl<'a> Iterator for Commands<'a> { type Item = LinePathCommand; fn next(&mut self) -> Option<LinePathCommand> { s...
{ for point in self.points_mut() { point.transform_mut(t); } }
random_line_split
line_path.rs
use crate::LinePathCommand; use geometry::{Point, Transform, Transformation}; use internal_iter::{ ExtendFromInternalIterator, FromInternalIterator, InternalIterator, IntoInternalIterator, }; use std::iter::Cloned; use std::slice::Iter; /// A sequence of commands that defines a set of contours, each of which consi...
} impl Transform for LinePath { fn transform<T>(mut self, t: &T) -> LinePath where T: Transformation, { self.transform_mut(t); self } fn transform_mut<T>(&mut self, t: &T) where T: Transformation, { for point in self.points_mut() { point...
{ let mut path = LinePath::new(); path.extend_from_internal_iter(internal_iter); path }
identifier_body
line_path.rs
use crate::LinePathCommand; use geometry::{Point, Transform, Transformation}; use internal_iter::{ ExtendFromInternalIterator, FromInternalIterator, InternalIterator, IntoInternalIterator, }; use std::iter::Cloned; use std::slice::Iter; /// A sequence of commands that defines a set of contours, each of which consi...
(&mut self) -> &mut [Point] { &mut self.points } /// Adds a new contour, starting at the given point. pub fn move_to(&mut self, p: Point) { self.verbs.push(Verb::MoveTo); self.points.push(p); } /// Adds a line segment to the current contour, starting at the current point. ...
points_mut
identifier_name
squinney.js
Items = new Meteor.Collection('items'); Router.map(function () { this.route('home', { path: '/' }); this.route('items', { controller: 'ItemsController', action: 'customAction' }); }); if (Meteor.isServer) { var seed = function () { Items.remove({}); for (var i = 0; i < 100; i++) { ...
waitOn: Subscriptions['items'], /* * The data function will be called after the subscrition is ready, at * render time. */ data: function () { // we can return anything here, but since I don't want to use 'this' in // as the each parameter, I'm just returning an object here with...
{ Router.configure({ layout: 'layout', notFoundTemplate: 'notFound', loadingTemplate: 'loading' }); Subscriptions = { items: Meteor.subscribe('items') }; ItemsController = RouteController.extend({ template: 'items', /* * During rendering, wait on the items subscription and show...
conditional_block
squinney.js
Items = new Meteor.Collection('items'); Router.map(function () { this.route('home', { path: '/' }); this.route('items', { controller: 'ItemsController', action: 'customAction' }); }); if (Meteor.isServer) { var seed = function () { Items.remove({}); for (var i = 0; i < 100; i++) { ...
}, /* * By default the router will call the *run* method which will render the * controller's template (or the template with the same name as the route) * to the main yield area {{yield}}. But you can provide your own action * methods as well. */ customAction: function () { ...
// as the each parameter, I'm just returning an object here with a named // property. return { items: Items.find() };
random_line_split
mock-project.js
'use strict'; var Project = require('ember-cli/lib/models/project'); function MockProject() { var root = process.cwd(); var pkg = {}; Project.apply(this, [root, pkg]); } MockProject.prototype.require = function(file) { if (file === './server') { return function() { return { listen: functio...
MockProject.prototype.name = function() { return 'mock-project'; }; MockProject.prototype.initializeAddons = Project.prototype.initializeAddons; MockProject.prototype.buildAddonPackages = Project.prototype.buildAddonPackages; MockProject.prototype.discoverAddons = Project.prototype.discoverAddons; MockProject.proto...
return (/server/.test(key)); };
random_line_split
mock-project.js
'use strict'; var Project = require('ember-cli/lib/models/project'); function
() { var root = process.cwd(); var pkg = {}; Project.apply(this, [root, pkg]); } MockProject.prototype.require = function(file) { if (file === './server') { return function() { return { listen: function() { arguments[arguments.length-1](); } }; }; } }; MockProject.prototype.conf...
MockProject
identifier_name
mock-project.js
'use strict'; var Project = require('ember-cli/lib/models/project'); function MockProject() { var root = process.cwd(); var pkg = {}; Project.apply(this, [root, pkg]); } MockProject.prototype.require = function(file) { if (file === './server')
}; MockProject.prototype.config = function() { return this._config || { baseURL: '/', locationType: 'auto' }; }; MockProject.prototype.has = function(key) { return (/server/.test(key)); }; MockProject.prototype.name = function() { return 'mock-project'; }; MockProject.prototype.initializeAddons = P...
{ return function() { return { listen: function() { arguments[arguments.length-1](); } }; }; }
conditional_block
mock-project.js
'use strict'; var Project = require('ember-cli/lib/models/project'); function MockProject()
MockProject.prototype.require = function(file) { if (file === './server') { return function() { return { listen: function() { arguments[arguments.length-1](); } }; }; } }; MockProject.prototype.config = function() { return this._config || { baseURL: '/', locationType: 'auto'...
{ var root = process.cwd(); var pkg = {}; Project.apply(this, [root, pkg]); }
identifier_body
raw.rs
// Copyright 2015 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
//! iOS-specific raw type definitions use os::raw::c_long; use os::unix::raw::{uid_t, gid_t}; pub type blkcnt_t = i64; pub type blksize_t = i32; pub type dev_t = i32; pub type ino_t = u64; pub type mode_t = u16; pub type nlink_t = u16; pub type off_t = i64; pub type time_t = c_long; #[repr(C)] pub struct stat { ...
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms.
random_line_split
raw.rs
// Copyright 2015 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 ...
{ pub st_dev: dev_t, pub st_mode: mode_t, pub st_nlink: nlink_t, pub st_ino: ino_t, pub st_uid: uid_t, pub st_gid: gid_t, pub st_rdev: dev_t, pub st_atime: time_t, pub st_atime_nsec: c_long, pub st_mtime: time_t, pub st_mtime_nsec: c_long, pub st_ctime: time_t, pub s...
stat
identifier_name
config.py
# Copyright (C) 2006-2007 Robey Pointer <robeypointer@gmail.com> # # This file is part of paramiko. # # Paramiko 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 (a...
else: key, value = line.split('=', 1) key = key.strip().lower() else: # find first whitespace, and split there i = 0 while (i < len(line)) and not line[i].isspace(): i += 1 ...
match = proxy_re.match(line) key, value = match.group(1).lower(), match.group(2)
conditional_block
config.py
# Copyright (C) 2006-2007 Robey Pointer <robeypointer@gmail.com> # # This file is part of paramiko. # # Paramiko 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 (a...
@param file_obj: a file-like object to read the config file from @type file_obj: file """ configs = [self._config[0]] for line in file_obj: line = line.rstrip('\n').lstrip() if (line == '') or (line[0] == '#'): continue if '=' i...
""" Representation of config information as stored in the format used by OpenSSH. Queries can be made via L{lookup}. The format is described in OpenSSH's C{ssh_config} man page. This class is provided primarily as a convenience to posix users (since the OpenSSH format is a de-facto standard on posix...
identifier_body
config.py
# Copyright (C) 2006-2007 Robey Pointer <robeypointer@gmail.com> # # This file is part of paramiko. # # Paramiko 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 (a...
OpenSSH's C{ssh_config} man page. This class is provided primarily as a convenience to posix users (since the OpenSSH format is a de-facto standard on posix) but should work fine on Windows too. @since: 1.6 """ def __init__(self): """ Create a new OpenSSH config object. ...
random_line_split
config.py
# Copyright (C) 2006-2007 Robey Pointer <robeypointer@gmail.com> # # This file is part of paramiko. # # Paramiko 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 (a...
(self, file_obj): """ Read an OpenSSH config from the given file object. @param file_obj: a file-like object to read the config file from @type file_obj: file """ configs = [self._config[0]] for line in file_obj: line = line.rstrip('\n').lstrip() ...
parse
identifier_name
demo_mp_async.py
#!/usr/bin/env python import freenect import signal import matplotlib.pyplot as mp from misc.demo import frame_convert mp.ion() image_rgb = None image_depth = None keep_running = True def
(dev, data, timestamp): global image_depth data = frame_convert.pretty_depth(data) mp.gray() mp.figure(1) if image_depth: image_depth.set_data(data) else: image_depth = mp.imshow(data, interpolation='nearest', animated=True) mp.draw() def display_rgb(dev, data, timestamp): ...
display_depth
identifier_name
demo_mp_async.py
#!/usr/bin/env python import freenect import signal import matplotlib.pyplot as mp from misc.demo import frame_convert mp.ion() image_rgb = None image_depth = None keep_running = True def display_depth(dev, data, timestamp): global image_depth data = frame_convert.pretty_depth(data) mp.gray() mp.f...
print('Press Ctrl-C in terminal to stop') signal.signal(signal.SIGINT, handler) freenect.runloop(depth=display_depth, video=display_rgb, body=body)
global keep_running keep_running = False
identifier_body
demo_mp_async.py
#!/usr/bin/env python import freenect import signal import matplotlib.pyplot as mp from misc.demo import frame_convert mp.ion() image_rgb = None image_depth = None keep_running = True def display_depth(dev, data, timestamp): global image_depth data = frame_convert.pretty_depth(data) mp.gray() mp.f...
mp.draw() def body(*args): if not keep_running: raise freenect.Kill def handler(signum, frame): global keep_running keep_running = False print('Press Ctrl-C in terminal to stop') signal.signal(signal.SIGINT, handler) freenect.runloop(depth=display_depth, video=display_rgb...
image_rgb = mp.imshow(data, interpolation='nearest', animated=True)
conditional_block
demo_mp_async.py
#!/usr/bin/env python import freenect import signal import matplotlib.pyplot as mp from misc.demo import frame_convert mp.ion() image_rgb = None image_depth = None keep_running = True def display_depth(dev, data, timestamp): global image_depth data = frame_convert.pretty_depth(data)
else: image_depth = mp.imshow(data, interpolation='nearest', animated=True) mp.draw() def display_rgb(dev, data, timestamp): global image_rgb mp.figure(2) if image_rgb: image_rgb.set_data(data) else: image_rgb = mp.imshow(data, interpolation='nearest', animated=True) ...
mp.gray() mp.figure(1) if image_depth: image_depth.set_data(data)
random_line_split
animation.rs
use std::collections::HashMap; use ggez::Context; use serde_derive::{Deserialize, Serialize}; use warmy; use loadable_macro_derive::{LoadableRon, LoadableYaml}; #[derive(Default, Debug, Clone, Serialize, Deserialize)] pub struct SpriteData { pub sprites: HashMap<String, Sprite>, } #[derive(Debug, Clone, Eq, Par...
} #[derive(Debug, Clone, Default, Serialize, Deserialize)] pub struct Frame { pub images: Vec<Image>, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Animation { pub frames: Vec<Frame>, #[serde(default)] pub order: Option<Vec<i32>>, } #[derive(Debug, Clone, Serialize, Deserialize, Loadab...
}
random_line_split
animation.rs
use std::collections::HashMap; use ggez::Context; use serde_derive::{Deserialize, Serialize}; use warmy; use loadable_macro_derive::{LoadableRon, LoadableYaml}; #[derive(Default, Debug, Clone, Serialize, Deserialize)] pub struct SpriteData { pub sprites: HashMap<String, Sprite>, } #[derive(Debug, Clone, Eq, Par...
{ NonSolid, Collidee, Collider, Blood, BloodStain, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Image { pub sheet: String, pub image: usize, pub x: i32, pub y: i32, pub image_type: ImageType, } impl Image { pub fn is_collidee(&self) -> bool { self.i...
ImageType
identifier_name
outbox.controller.js
/** * Outbox Controller * * @description controller for outbox page. */ (function() { 'use strict'; angular .module('starter.controllers') .controller('OutboxCtrl', OutboxCtrl); OutboxCtrl.$inject = ['$rootScope', '$scope', '$ionicLoading', '$timeout', 'logger', 'OutboxService', 'SyncService', 'Netw...
($rootScope, $scope, $ionicLoading, $timeout, logger, OutboxService, SyncService, NetworkService, UserService) { logger.log("in OutboxCtrl"); var outboxControllerViewModel = this; outboxControllerViewModel.dirtyRecordExist = false; outboxControllerViewModel.syncing = false; // Methods used in vi...
OutboxCtrl
identifier_name
outbox.controller.js
/** * Outbox Controller * * @description controller for outbox page. */ (function() { 'use strict'; angular .module('starter.controllers') .controller('OutboxCtrl', OutboxCtrl); OutboxCtrl.$inject = ['$rootScope', '$scope', '$ionicLoading', '$timeout', 'logger', 'OutboxService', 'SyncService', 'Netw...
SyncService.syncAllTablesNow(); outboxControllerViewModel.syncing = true; } else { outboxControllerViewModel.syncing = false; $ionicLoading.show({ template: 'Please go on-line before attempting to sync', animation: 'fade-in', showBackdrop: true, ...
if (NetworkService.getNetworkStatus() === "online") {
random_line_split
outbox.controller.js
/** * Outbox Controller * * @description controller for outbox page. */ (function() { 'use strict'; angular .module('starter.controllers') .controller('OutboxCtrl', OutboxCtrl); OutboxCtrl.$inject = ['$rootScope', '$scope', '$ionicLoading', '$timeout', 'logger', 'OutboxService', 'SyncService', 'Netw...
// get the dirty records OutboxService.getDirtyRecords().then(function(records) { if (records.length === 0) { // If no dirty records then show the 'No records...' message outboxControllerViewModel.dirtyRecordExist = false; outboxControllerViewModel.outboxCount = ""; ...
{ logger.log("in OutboxCtrl"); var outboxControllerViewModel = this; outboxControllerViewModel.dirtyRecordExist = false; outboxControllerViewModel.syncing = false; // Methods used in view outboxControllerViewModel.syncNow = syncNow; activate(); function activate() { $ionicLoad...
identifier_body
internal.js
(function () { var parent = window.parent; //dialog对象 dialog = parent.$EDITORUI[window.frameElement.id.replace(/_iframe$/, '')]; //当前打开dialog的编辑器实例 editor = dialog.editor; UE = parent.UE; domUtils = UE.dom.domUtils; utils = UE.utils; browser = UE.browser; ajax = UE.ajax; ...
content.style = content.style.replace(/url\s*\(/g, "url(" + langImgPath) } switch (tagName.toLowerCase()) { case "var": dom.parentNode.replaceChild(document.createTextNode(content), dom); break; ...
} if (content.style) { content = utils.extend({}, content, false);
random_line_split
internal.js
(function () { var parent = window.parent; //dialog对象 dialog = parent.$EDITORUI[window.frameElement.id.replace(/_iframe$/, '')]; //当前打开dialog的编辑器实例 editor = dialog.editor; UE = parent.UE; domUtils = UE.dom.domUtils; utils = UE.utils; browser = UE.browser; ajax = UE.ajax; ...
tils.loadFile(document, { href: '../../themes/' + editor.options.theme + "/dialogbase.css?cache=" + Math.random(), tag: "link", type: "text/css", rel: "stylesheet" }); lang = editor.getLang(dialog.className.split("-")[2]); if (lang) { domUtils.on(window, 'load', funct...
() } }, 0) }; u
conditional_block
main-config.rs
extern crate cargo_update; extern crate tabwriter; use std::io::{Write, stdout}; use tabwriter::TabWriter; use std::process::exit; use std::mem; fn
() { let result = actual_main().err().unwrap_or(0); exit(result); } fn actual_main() -> Result<(), i32> { let mut opts = cargo_update::ConfigOptions::parse(); let config_file = cargo_update::ops::resolve_crates_file(mem::replace(&mut opts.crates_file.1, Default::default())).with_file_name(".install_con...
main
identifier_name
main-config.rs
extern crate cargo_update; extern crate tabwriter; use std::io::{Write, stdout}; use tabwriter::TabWriter; use std::process::exit; use std::mem; fn main() { let result = actual_main().err().unwrap_or(0); exit(result); } fn actual_main() -> Result<(), i32> { let mut opts = cargo_update::ConfigOptions::pa...
if let Some(rb) = cfg.respect_binaries { writeln!(out, "Respect binaries\t{}", rb).unwrap(); } if let Some(ref tv) = cfg.target_version { writeln!(out, "Target version\t{}", tv).unwrap(); } writeln!(out, "Default features\t{}", cfg.default_features).unwra...
{ writeln!(out, "Enforce lock\t{}", el).unwrap(); }
conditional_block
main-config.rs
extern crate cargo_update; extern crate tabwriter; use std::io::{Write, stdout}; use tabwriter::TabWriter; use std::process::exit; use std::mem; fn main()
fn actual_main() -> Result<(), i32> { let mut opts = cargo_update::ConfigOptions::parse(); let config_file = cargo_update::ops::resolve_crates_file(mem::replace(&mut opts.crates_file.1, Default::default())).with_file_name(".install_config.toml"); let mut configuration = cargo_update::ops::PackageConfig::...
{ let result = actual_main().err().unwrap_or(0); exit(result); }
identifier_body
main-config.rs
extern crate cargo_update; extern crate tabwriter; use std::io::{Write, stdout}; use tabwriter::TabWriter; use std::process::exit; use std::mem; fn main() { let result = actual_main().err().unwrap_or(0); exit(result); } fn actual_main() -> Result<(), i32> { let mut opts = cargo_update::ConfigOptions::pa...
writeln!(out, "Toolchain\t{}", t).unwrap(); } if let Some(d) = cfg.debug { writeln!(out, "Debug mode\t{}", d).unwrap(); } if let Some(ip) = cfg.install_prereleases { writeln!(out, "Install prereleases\t{}", ip).unwrap(); } if let Some(e...
let mut out = TabWriter::new(stdout()); if let Some(ref t) = cfg.toolchain {
random_line_split
PathStore.spec.js
'use strict'; var test = require('tape'); var rewire = require('rewire'); var api = require('./PathStore.api'); var PathStore = rewire('../../../src/core/PathStore'); var PathUtilsStub = require('../path/Path.stub'); var helpers = require('./PathStore.helpers'); PathStore.__set__('PathUtils', PathUtilsStub); helpers....
function checkOrder () { pathStore.getItems().forEach(function (item, i, items) { if (items[i + 1]) { t.ok( items[i + 1].isAfter(items[i]), 'remove should preserve the sort of the items in PathStore' ...
{ var ch = String.fromCharCode(i + 97); var b = pathStore.get(ch); if (b) { t.doesNotThrow(function () { pathStore.remove(ch); }, 'remove should be able to be called and remove an item by key'); t.equal(pathStore.g...
identifier_body
PathStore.spec.js
'use strict'; var test = require('tape'); var rewire = require('rewire'); var api = require('./PathStore.api'); var PathStore = rewire('../../../src/core/PathStore'); var PathUtilsStub = require('../path/Path.stub'); var helpers = require('./PathStore.helpers'); PathStore.__set__('PathUtils', PathUtilsStub); helpers....
(i) { var ch = String.fromCharCode(i + 97); var b = pathStore.get(ch); if (b) { t.doesNotThrow(function () { pathStore.remove(ch); }, 'remove should be able to be called and remove an item by key'); t.equal(pathSt...
removeItem
identifier_name
PathStore.spec.js
'use strict'; var test = require('tape'); var rewire = require('rewire'); var api = require('./PathStore.api'); var PathStore = rewire('../../../src/core/PathStore'); var PathUtilsStub = require('../path/Path.stub'); var helpers = require('./PathStore.helpers'); PathStore.__set__('PathUtils', PathUtilsStub); helpers....
pathStore.getItems().forEach(function (item, i, items) { if (items[i + 1]) { t.ok( items[i + 1].isAfter(items[i]), 'remove should preserve the sort of the items in PathStore' ); } ...
} function checkOrder () {
random_line_split
PathStore.spec.js
'use strict'; var test = require('tape'); var rewire = require('rewire'); var api = require('./PathStore.api'); var PathStore = rewire('../../../src/core/PathStore'); var PathUtilsStub = require('../path/Path.stub'); var helpers = require('./PathStore.helpers'); PathStore.__set__('PathUtils', PathUtilsStub); helpers....
}); } while (pathStore.getItems().length) { index = (Math.random() * 11)|0; if (removeItem(index)) checkOrder(); } t.end(); }); t.end(); });
{ t.ok( items[i + 1].isAfter(items[i]), 'remove should preserve the sort of the items in PathStore' ); }
conditional_block
new-server.test.ts
///<reference path="../../node_modules/@types/jasmine/index.d.ts"/> /** * @license * Copyright 2016 JBoss Inc * * 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.apac...
"tests/_fixtures/commands/new-server/3.0/new-server-document-exists.before.json", "tests/_fixtures/commands/new-server/3.0/new-server-document-exists.after.json", (document: Oas30Document) => { let server: Oas30Server = document.createServer(); server....
}); it("New Server (Document) [Already Exists]", () => { commandTest(
random_line_split
20120430B.py
""" Consider this game: Write 8 blanks on a sheet of paper. Randomly pick a digit 0-9. After seeing the digit, choose one of the 8 blanks to place that digit in. Randomly choose another digit (with replacement) and then choose one of the 7 remaining blanks to place it in. Repeat until you've filled all 8 blanks. You wi...
(data): # print(data) return all(b >= a for a, b in zip(data, itertools.islice(data, 1, None))) TRIALS = 1 win = 0 for a in range(TRIALS): l = [None] * 8 p = list(range(8)) while p: d = random.randint(0,9) # i = random.choice(p) i = int(d * (len(p)) / 10) print(p[i...
que_sort
identifier_name
20120430B.py
""" Consider this game: Write 8 blanks on a sheet of paper. Randomly pick a digit 0-9. After seeing the digit, choose one of the 8 blanks to place that digit in. Randomly choose another digit (with replacement) and then choose one of the 7 remaining blanks to place it in. Repeat until you've filled all 8 blanks. You wi...
Assigning digits to blanks randomly lets you win about 0.02% of the time. Here's a python script that wins about 10.3% of the time. Can you do better? import random def trial(): indices = range(8) # remaining unassigned indices s = [None] * 8 # the digits in their assigned places while indices: ...
random_line_split
20120430B.py
""" Consider this game: Write 8 blanks on a sheet of paper. Randomly pick a digit 0-9. After seeing the digit, choose one of the 8 blanks to place that digit in. Randomly choose another digit (with replacement) and then choose one of the 7 remaining blanks to place it in. Repeat until you've filled all 8 blanks. You wi...
print('{}/{} - {}%'.format(win, TRIALS, win/TRIALS*100))
win += 1
conditional_block
20120430B.py
""" Consider this game: Write 8 blanks on a sheet of paper. Randomly pick a digit 0-9. After seeing the digit, choose one of the 8 blanks to place that digit in. Randomly choose another digit (with replacement) and then choose one of the 7 remaining blanks to place it in. Repeat until you've filled all 8 blanks. You wi...
TRIALS = 1 win = 0 for a in range(TRIALS): l = [None] * 8 p = list(range(8)) while p: d = random.randint(0,9) # i = random.choice(p) i = int(d * (len(p)) / 10) print(p[i]) l[p[i]] = d p.pop(i) print(l) if que_sort(l): win += 1 print('{}/{...
return all(b >= a for a, b in zip(data, itertools.islice(data, 1, None)))
identifier_body
BigDisplayModeConfiguration.test.tsx
/* * Copyright (C) 2020 Graylog, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the Server Side Public License, version 1, * as published by MongoDB, Inc. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; withou...
it('including selected tabs', () => { const viewWithQueries = createViewWithQueries(); const { getByLabelText, getByTestId } = render(<SUT view={viewWithQueries} show />); const query1 = getByLabelText('Page#1'); fireEvent.click(query1); const form = getByTestId('modal-form'); ...
random_line_split
application_common.ts
} from 'angular2/src/core/facade/lang'; import {BrowserDomAdapter} from 'angular2/src/core/dom/browser_adapter'; import {BrowserGetTestability} from 'angular2/src/core/testability/browser_testability'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; import {ViewLoader} from 'angular2/src/core/render/dom/compile...
return [ bind(DOCUMENT) .toValue(DOM.defaultDoc()), EventManager, new Binding(EVENT_MANAGER_PLUGINS, {toClass: DomEventsPlugin, multi: true}), new Binding(EVENT_MANAGER_PLUGINS, {toClass: KeyEventsPlugin, multi: true}), new Binding(EVENT_MANAGER_PLUGINS, {toClass: HammerGesturesPlugin, mu...
{ throw "Must set a root DOM adapter first."; }
conditional_block
application_common.ts
/src/core/render/xhr_impl'; import { EventManager, DomEventsPlugin, EVENT_MANAGER_PLUGINS } from 'angular2/src/core/render/dom/events/event_manager'; import {KeyEventsPlugin} from 'angular2/src/core/render/dom/events/key_events'; import {HammerGesturesPlugin} from 'angular2/src/core/render/dom/events/hammer_gestu...
{ var p = platform(); var bindings = [applicationCommonBindings(), applicationDomBindings()]; if (isPresent(appBindings)) { bindings.push(appBindings); } return p.application(bindings).bootstrap(appComponentType); }
identifier_body
application_common.ts
} from 'angular2/src/core/render/dom/compiler/view_loader'; import {StyleInliner} from 'angular2/src/core/render/dom/compiler/style_inliner'; import {Promise, PromiseWrapper, PromiseCompleter} from 'angular2/src/core/facade/async'; import {XHR} from 'angular2/src/core/render/xhr'; import {XHRImpl} from 'angular2/src/co...
commonBootstrap
identifier_name
application_common.ts
} from 'angular2/src/core/facade/lang'; import {BrowserDomAdapter} from 'angular2/src/core/dom/browser_adapter'; import {BrowserGetTestability} from 'angular2/src/core/testability/browser_testability'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; import {ViewLoader} from 'angular2/src/core/render/dom/compile...
* * ## Simple Example * * Assuming this `index.html`: * * ```html * <html> * <!-- load Angular script tags here. --> * <body> * <my-app>loading...</my-app> * </body> * </html> * ``` * * An application is bootstrapped inside an existing browser DOM, typically `index.html`. * Unlike Angular 1, A...
* You instantiate an Angular application by explicitly specifying a component to use * as the root component for your application via the `bootstrap()` method.
random_line_split
ckeditor_link_tags.py
import importlib from django.conf import settings from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist from ckeditor_link import conf from django import template from django.template.defaultfilters import stringfilter try: module_name, class_name = conf.CKEDITOR_LINK_MODEL.rsplit(".", 1) ...
if new_key == 'cms_page_2': new_key = 'cms_page' # until here if hasattr(dummy_link, new_key): if hasattr(dummy_link, new_key + "_id"): # set fk directly ne...
from lxml.html import fragment_fromstring, tostring if not ckeditor_link_class: # TODO: use some log thing, or rais ImproperlyConfigured! if settings.DEBUG: msg = "Warning: CKEDITOR_LINK_MODEL (%s) could not be imported!?" % (conf.CKEDITOR_LINK_MODEL, ) raise ImproperlyConfig...
identifier_body
ckeditor_link_tags.py
import importlib from django.conf import settings from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist from ckeditor_link import conf from django import template from django.template.defaultfilters import stringfilter try: module_name, class_name = conf.CKEDITOR_LINK_MODEL.rsplit(".", 1) ...
# arf: http://makble.com/python-why-lxml-etree-tostring-method-returns-bytes # beautifulsoup to the rescue! return tostring(fragment, encoding='unicode')
random_line_split
ckeditor_link_tags.py
import importlib from django.conf import settings from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist from ckeditor_link import conf from django import template from django.template.defaultfilters import stringfilter try: module_name, class_name = conf.CKEDITOR_LINK_MODEL.rsplit(".", 1) ...
(html): # lxml is not a dependency, but needed for this tag. from lxml.html import fragment_fromstring, tostring if not ckeditor_link_class: # TODO: use some log thing, or rais ImproperlyConfigured! if settings.DEBUG: msg = "Warning: CKEDITOR_LINK_MODEL (%s) could not be imported...
ckeditor_link_add_links
identifier_name
ckeditor_link_tags.py
import importlib from django.conf import settings from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist from ckeditor_link import conf from django import template from django.template.defaultfilters import stringfilter try: module_name, class_name = conf.CKEDITOR_LINK_MODEL.rsplit(".", 1) ...
fragment = fragment_fromstring("<div>" + html + "</div>") links = fragment.cssselect('a') for link in links: if link.get('data-ckeditor-link', None): link.attrib.pop('data-ckeditor-link') kwargs = {} dummy_link = ckeditor_link_class() for key, value i...
if settings.DEBUG: msg = "Warning: CKEDITOR_LINK_MODEL (%s) could not be imported!?" % (conf.CKEDITOR_LINK_MODEL, ) raise ImproperlyConfigured(msg) return html
conditional_block
factory.rs
// Copyright 2015-2017 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any lat...
{ /// factory for evm. pub vm: EvmFactory, /// factory for tries. pub trie: TrieFactory, /// factory for account databases. pub accountdb: AccountFactory, }
Factories
identifier_name
factory.rs
// Copyright 2015-2017 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any lat...
pub struct Factories { /// factory for evm. pub vm: EvmFactory, /// factory for tries. pub trie: TrieFactory, /// factory for account databases. pub accountdb: AccountFactory, }
use evm::Factory as EvmFactory; use account_db::Factory as AccountFactory; /// Collection of factories. #[derive(Default, Clone)]
random_line_split
SuggestionThreadObjectFactorySpec.ts
// Copyright 2018 The Oppia Authors. 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 ap...
var suggestionBackendDict = { suggestion_id: 'exploration.exp1.thread1', suggestion_type: 'edit_exploration_state_content', target_type: 'exploration', target_id: 'exp1', target_version_at_submission: 1, status: 'accepted', author_name: 'author', change: { cmd...
thread_id: 'exploration.exp1.thread1' };
random_line_split
ReactNativeFiber.js
ReactNativeComponentTree'); const ReactNativeInjection = require('ReactNativeInjection'); const ReactNativeTagHandles = require('ReactNativeTagHandles'); const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); const ReactPortal = require('ReactPortal'); const UIManager = require('UIManager'); c...
else { uncacheFiberNode((node : any)._nativeTag); (node : any)._children.forEach(recursivelyUncacheFiberNode); } } const NativeRenderer = ReactFiberReconciler({ appendChild( parentInstance : Instance | Container, child : Instance | TextInstance ) : void { if (typeof parentInstance === 'numb...
{ // Leaf node (eg text) uncacheFiberNode(node); }
conditional_block
ReactNativeFiber.js
NativeComponentTree'); const ReactNativeInjection = require('ReactNativeInjection'); const ReactNativeTagHandles = require('ReactNativeTagHandles'); const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); const ReactPortal = require('ReactPortal'); const UIManager = require('UIManager'); const ...
Object.assign(NativeHostComponent.prototype, NativeMethodsMixin); function recursivelyUncacheFiberNode(node : Instance | TextInstance) { if (typeof node === 'number') { // Leaf node (eg text) uncacheFiberNode(node); } else { uncacheFiberNode((node : any)._nativeTag); (node : any)._children.forEach(re...
{ this._nativeTag = tag; this._children = []; this.viewConfig = viewConfig; }
identifier_body
ReactNativeFiber.js
// containerTag [], // moveFromIndices [], // moveToIndices [(child : any)._nativeTag], // addChildReactTags [children.length - 1], // addAtIndices [], // removeAtIndices ); } }, appendInitialChild(parentInstance : Instance, child : Instance | TextInstance) : void...
findFiberByHostInstance: ReactNativeComponentTree.getClosestInstanceFromNode,
random_line_split
ReactNativeFiber.js
NativeComponentTree'); const ReactNativeInjection = require('ReactNativeInjection'); const ReactNativeTagHandles = require('ReactNativeTagHandles'); const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); const ReactPortal = require('ReactPortal'); const UIManager = require('UIManager'); const ...
(node : Instance | TextInstance) { if (typeof node === 'number') { // Leaf node (eg text) uncacheFiberNode(node); } else { uncacheFiberNode((node : any)._nativeTag); (node : any)._children.forEach(recursivelyUncacheFiberNode); } } const NativeRenderer = ReactFiberReconciler({ appendChild( pare...
recursivelyUncacheFiberNode
identifier_name
subcontractOperationDefinitionForm.component.ts
import { Component, ViewEncapsulation, Input } from '@angular/core'; import { Subscription } from 'rxjs/Subscription'; import { ActivatedRoute, Params, Router } from '@angular/router'; import { FormGroup, AbstractControl, FormBuilder, Validators } from '@angular/forms'; import { SharedService } from '../../../...
this.formGroup.patchValue(this.subcontractOperationDefinition, { onlySelf: true }); this.item = this.subcontractOperationDefinition.item; } public onSubmit(values: any, event: Event): void { event.preventDefault(); console.log(values); this.service.save(values).subscribe(data => { ...
{ this.subcontractOperationDefinition = data; }
conditional_block
subcontractOperationDefinitionForm.component.ts
import { Component, ViewEncapsulation, Input } from '@angular/core'; import { Subscription } from 'rxjs/Subscription'; import { ActivatedRoute, Params, Router } from '@angular/router'; import { FormGroup, AbstractControl, FormBuilder, Validators } from '@angular/forms'; import { SharedService } from '../../../...
(event: any) {} /*================== ProductTypeFilter ===================*/ }
onProductTypeSelect
identifier_name