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
preinstallprovprofile.ts
import path = require('path'); import sign = require('ios-signing-common/ios-signing-common'); import secureFilesCommon = require('securefiles-common/securefiles-common'); import tl = require('azure-pipelines-task-lib/task'); import os = require('os'); async function run() { let secureFileId: string; let secur...
} catch (err) { tl.setResult(tl.TaskResult.Failed, err); } finally { // delete provisioning profile from temp location after installing if (secureFileId && secureFileHelpers) { secureFileHelpers.deleteSecureFile(secureFileId); } } } run();
{ // download decrypted contents secureFileId = tl.getInput('provProfileSecureFile', true); secureFileHelpers = new secureFilesCommon.SecureFileHelpers(); let provProfilePath: string = await secureFileHelpers.downloadSecureFile(secureFileId); if (tl.exist(pro...
conditional_block
app.module.ts
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { HttpModule } from '@angular/http'; import { RouterModule } from '@angular/router'; import { AppComponent } from './app.component'; //import { WelcomeComponent } from './home/welcome.component'; import { HpeW...
{ }
AppModule
identifier_name
app.module.ts
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser';
//import { WelcomeComponent } from './home/welcome.component'; import { HpeWelcomeComponent } from './hpeHome/hpeWelcome.component'; import { TopNav } from './nav/nav.component'; import { Footer } from './footer/footer.component'; import { ProductModule } from './products/product.module'; import { SearchModule } fr...
import { HttpModule } from '@angular/http'; import { RouterModule } from '@angular/router'; import { AppComponent } from './app.component';
random_line_split
xml.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/. */ #![allow(unrooted_must_root)] use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::trace::JSTraceable; use dom::document::Document; use dom::htmlscriptelement::HTMLScriptElement; use dom::node::Node; use dom::servoparser::Sink; use js::jsapi::JSTra...
random_line_split
xml.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/. */ #![allow(unrooted_must_root)] use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::trace::JSTraceable; use...
(&self) -> &ServoUrl { &self.inner.sink.sink.base_url } } #[allow(unsafe_code)] unsafe impl JSTraceable for XmlTokenizer<XmlTreeBuilder<Dom<Node>, Sink>> { unsafe fn trace(&self, trc: *mut JSTracer) { struct Tracer(*mut JSTracer); let tracer = Tracer(trc); impl XmlTracer for Tr...
url
identifier_name
xml.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/. */ #![allow(unrooted_must_root)] use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::trace::JSTraceable; use...
} #[allow(unsafe_code)] unsafe impl JSTraceable for XmlTokenizer<XmlTreeBuilder<Dom<Node>, Sink>> { unsafe fn trace(&self, trc: *mut JSTracer) { struct Tracer(*mut JSTracer); let tracer = Tracer(trc); impl XmlTracer for Tracer { type Handle = Dom<Node>; #[allow(unr...
{ &self.inner.sink.sink.base_url }
identifier_body
xml.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/. */ #![allow(unrooted_must_root)] use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::trace::JSTraceable; use...
Ok(()) } pub fn end(&mut self) { self.inner.end() } pub fn url(&self) -> &ServoUrl { &self.inner.sink.sink.base_url } } #[allow(unsafe_code)] unsafe impl JSTraceable for XmlTokenizer<XmlTreeBuilder<Dom<Node>, Sink>> { unsafe fn trace(&self, trc: *mut JSTracer) { ...
{ self.inner.run(); if let Some(script) = self.inner.sink.sink.script.take() { return Err(script); } }
conditional_block
RadixSort.py
#implementation of radix sort in Python. def
(A): RADIX = 10 maxLength = False tmp , placement = -1, 1 while not maxLength: maxLength = True buckets = [list() for _ in range(RADIX)] for i in A: tmp = i / placement buckets[tmp % RADIX].append(i) if maxLength and tmp > 0: maxLength = False a = 0 for b in range(RADIX): bu...
RadixSort
identifier_name
RadixSort.py
#implementation of radix sort in Python. def RadixSort(A):
# move to next digit placement *= RADIX A = [534, 246, 933, 127, 277, 321, 454, 565, 220] print(RadixSort(A))
RADIX = 10 maxLength = False tmp , placement = -1, 1 while not maxLength: maxLength = True buckets = [list() for _ in range(RADIX)] for i in A: tmp = i / placement buckets[tmp % RADIX].append(i) if maxLength and tmp > 0: maxLength = False a = 0 for b in range(RADIX): buck = buc...
identifier_body
RadixSort.py
#implementation of radix sort in Python. def RadixSort(A): RADIX = 10 maxLength = False tmp , placement = -1, 1 while not maxLength: maxLength = True buckets = [list() for _ in range(RADIX)] for i in A: tmp = i / placement buckets[tmp % RADIX].append(i) if maxLength and tmp > 0:
a = 0 for b in range(RADIX): buck = buckets[b] for i in buck: A[a] = i a += 1 # move to next digit placement *= RADIX A = [534, 246, 933, 127, 277, 321, 454, 565, 220] print(RadixSort(A))
maxLength = False
conditional_block
RadixSort.py
#implementation of radix sort in Python. def RadixSort(A): RADIX = 10 maxLength = False tmp , placement = -1, 1 while not maxLength: maxLength = True buckets = [list() for _ in range(RADIX)] for i in A: tmp = i / placement buckets[tmp % RADIX].append(i) if maxLength and tmp > 0: maxL...
A = [534, 246, 933, 127, 277, 321, 454, 565, 220] print(RadixSort(A))
random_line_split
util.rs
use std::rand; use std::rand::Rng; use settings::Settings; use piece::Piece; pub fn check_overlap(settings: &Settings, pos: u32, content_len: u32, files: &Vec<Piece>) -> bool { for i in files.iter() { if pos + 1 > i.start_pos && pos - 1 < i.end_pos || pos + 1 + content_len > i.start_p...
pub fn concat_vec<T>(a: Vec<T>, b: Vec<T>) -> Vec<T> { let mut r = a; r.extend(b.into_iter()); r } pub fn random_pass(len: uint) -> Vec<u8> { rand::task_rng().gen_ascii_chars().take(len).map(|x| x as u8).collect::<Vec<u8>>() }
{ for i in files.iter() { if pos >= i.start_pos && pos < i.end_pos { return Some(i.clone()); } } None }
identifier_body
util.rs
use std::rand; use std::rand::Rng; use settings::Settings; use piece::Piece; pub fn check_overlap(settings: &Settings, pos: u32, content_len: u32, files: &Vec<Piece>) -> bool { for i in files.iter() { if pos + 1 > i.start_pos && pos - 1 < i.end_pos || pos + 1 + content_len > i.start_p...
<T>(a: Vec<T>, b: Vec<T>) -> Vec<T> { let mut r = a; r.extend(b.into_iter()); r } pub fn random_pass(len: uint) -> Vec<u8> { rand::task_rng().gen_ascii_chars().take(len).map(|x| x as u8).collect::<Vec<u8>>() }
concat_vec
identifier_name
util.rs
use std::rand; use std::rand::Rng; use settings::Settings; use piece::Piece; pub fn check_overlap(settings: &Settings, pos: u32, content_len: u32, files: &Vec<Piece>) -> bool { for i in files.iter() { if pos + 1 > i.start_pos && pos - 1 < i.end_pos || pos + 1 + content_len > i.start_p...
} false } pub fn find_file_next_distance(settings: &Settings, pos:u32, files:Vec<Piece>) -> Option<u32> { let mut dist: u32 = settings.blocksize - pos; let mut found: bool = false; for i in files.iter() { if pos > i.start_pos && pos < i.end_pos { return Some(0u32); } ...
{ return true; }
conditional_block
util.rs
use std::rand; use std::rand::Rng; use settings::Settings; use piece::Piece; pub fn check_overlap(settings: &Settings, pos: u32, content_len: u32, files: &Vec<Piece>) -> bool { for i in files.iter() { if pos + 1 > i.start_pos && pos - 1 < i.end_pos || pos + 1 + content_len > i.start_p...
if pos > i.start_pos && pos < i.end_pos { return Some(0u32); } else { let spos = i.start_pos - pos; if spos < dist { dist = spos; found = true; } } } return if found { Some(dist) } else { None }; } pub fn ...
let mut dist: u32 = settings.blocksize - pos; let mut found: bool = false; for i in files.iter() {
random_line_split
camera.py
"""Support for the Netatmo cameras.""" import logging import pyatmo import requests import voluptuous as vol from homeassistant.components.camera import ( DOMAIN as CAMERA_DOMAIN, SUPPORT_STREAM, Camera, ) from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON import homeassistant.helpers.con...
(self): """Gather person data for webhooks.""" for person_id, person_data in self.camera_data.persons.items(): self._hass.data[DOMAIN][DATA_PERSONS][person_id] = person_data.get( ATTR_PSEUDO ) @Throttle(MIN_TIME_BETWEEN_UPDATES) def update(self): ...
update_persons
identifier_name
camera.py
"""Support for the Netatmo cameras.""" import logging import pyatmo import requests import voluptuous as vol from homeassistant.components.camera import ( DOMAIN as CAMERA_DOMAIN, SUPPORT_STREAM, Camera, ) from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON import homeassistant.helpers.con...
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the Netatmo camera platform.""" return class NetatmoCamera(Camera): """Representation of a Netatmo camera.""" def __init__(self, data, camera_id, camera_type, verify_ssl, quality): """Set up fo...
"""Set up the Netatmo camera platform.""" def get_entities(): """Retrieve Netatmo entities.""" entities = [] try: camera_data = CameraData(hass, hass.data[DOMAIN][entry.entry_id][AUTH]) for camera in camera_data.get_all_cameras(): _LOGGER.debug("Setti...
identifier_body
camera.py
"""Support for the Netatmo cameras.""" import logging import pyatmo import requests import voluptuous as vol from homeassistant.components.camera import ( DOMAIN as CAMERA_DOMAIN, SUPPORT_STREAM, Camera, ) from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON import homeassistant.helpers.con...
return cameras def get_modules(self, camera_id): """Return all modules for a given camera.""" return self.camera_data.get_camera(camera_id).get("modules", []) def get_camera_type(self, camera_id): """Return camera type for a camera, cid has preference over camera.""" r...
cameras.extend(camera.values())
conditional_block
camera.py
"""Support for the Netatmo cameras.""" import logging import pyatmo import requests import voluptuous as vol from homeassistant.components.camera import ( DOMAIN as CAMERA_DOMAIN, SUPPORT_STREAM, Camera, ) from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON import homeassistant.helpers.con...
def camera_image(self): """Return a still image response from the camera.""" try: if self._localurl: response = requests.get( f"{self._localurl}/live/snapshot_720.jpg", timeout=10 ) elif self._vpnurl: respons...
self._alim_status = None self._is_local = None
random_line_split
planet.js
importScripts('/poc/orbits/javascripts/geometry/vector3.js'); (function () { var root = this, P = (root.P = {}); P.R = 7000000; // Polar unit vector var ax = 0.423, ay = 0, az = 0.906; // fixed vector var polar = V3.build(ax, ay, az); P.polar = polar; // Base unit vector for lon...
P.equiZero = equiZero; // The normal unit vector for any point on the surface function vector(lng, lat, lday) { var equo = equiZero(lday); var cos = Math.cos(lng), sin = Math.sin(lng); var temp = V3.add(V3.expand(equo, cos), V3.expand(V3.cross(polar, equo), sin)); ...
{// lday: local time var phi = - 2 * Math.PI * (lday - Math.floor(lday)); var cos = Math.cos(phi), sin = Math.sin(phi); //by Rodrigues' rotation formula return V3.add(V3.expand(base, cos), V3.expand(V3.cross(polar, base), sin)); }
identifier_body
planet.js
importScripts('/poc/orbits/javascripts/geometry/vector3.js'); (function () { var root = this, P = (root.P = {}); P.R = 7000000; // Polar unit vector var ax = 0.423, ay = 0, az = 0.906; // fixed vector var polar = V3.build(ax, ay, az); P.polar = polar; // Base unit vector for lon...
(lng, lat, lday) { var equo = equiZero(lday); var cos = Math.cos(lng), sin = Math.sin(lng); var temp = V3.add(V3.expand(equo, cos), V3.expand(V3.cross(polar, equo), sin)); var axis = V3.cross(polar, temp); cos = Math.cos(lat); sin = Math.sin(lat); var...
vector
identifier_name
planet.js
importScripts('/poc/orbits/javascripts/geometry/vector3.js'); (function () { var root = this, P = (root.P = {}); P.R = 7000000; // Polar unit vector var ax = 0.423, ay = 0, az = 0.906; // fixed vector var polar = V3.build(ax, ay, az); P.polar = polar; // Base unit vector for lon...
return V3.add(V3.expand(base, cos), V3.expand(V3.cross(polar, base), sin)); } P.equiZero = equiZero; // The normal unit vector for any point on the surface function vector(lng, lat, lday) { var equo = equiZero(lday); var cos = Math.cos(lng), sin = Math.sin(lng); ...
random_line_split
demo.js
FusionCharts.ready(function () { var gradientCheckBox = document.getElementById('useGradient'); //Set event listener for radio button if (gradientCheckBox.addEventListener) { gradientCheckBox.addEventListener("click", changeGradient); } function
(evt, obj) { //Set gradient fill for chart using usePlotGradientColor attribute (gradientCheckBox.checked) ?revenueChart.setChartAttribute('usePlotGradientColor', 1) : revenueChart.setChartAttribute('usePlotGradientColor', 0); }; var revenueChart = new FusionCharts({ type: 'column2d...
changeGradient
identifier_name
demo.js
FusionCharts.ready(function () { var gradientCheckBox = document.getElementById('useGradient'); //Set event listener for radio button if (gradientCheckBox.addEventListener) { gradientCheckBox.addEventListener("click", changeGradient); } function changeGradient(evt, obj)
; var revenueChart = new FusionCharts({ type: 'column2d', renderAt: 'chart-container', width: '400', height: '300', dataFormat: 'json', dataSource: { "chart": { "caption": "Quarterly Revenue", "subCaption": "Last ye...
{ //Set gradient fill for chart using usePlotGradientColor attribute (gradientCheckBox.checked) ?revenueChart.setChartAttribute('usePlotGradientColor', 1) : revenueChart.setChartAttribute('usePlotGradientColor', 0); }
identifier_body
demo.js
FusionCharts.ready(function () { var gradientCheckBox = document.getElementById('useGradient'); //Set event listener for radio button if (gradientCheckBox.addEventListener) { gradientCheckBox.addEventListener("click", changeGradient); } function changeGradient(evt, obj) { //Set...
}, { "label": "Q2", "value": "1450000", "color": "#9b59b6" }, { "label": "Q3", "value": "1730000", "color": "#6baa01" }, { "label": "Q4", ...
"color": "#008ee4"
random_line_split
demo.js
FusionCharts.ready(function () { var gradientCheckBox = document.getElementById('useGradient'); //Set event listener for radio button if (gradientCheckBox.addEventListener)
function changeGradient(evt, obj) { //Set gradient fill for chart using usePlotGradientColor attribute (gradientCheckBox.checked) ?revenueChart.setChartAttribute('usePlotGradientColor', 1) : revenueChart.setChartAttribute('usePlotGradientColor', 0); }; var revenueChart = new Fusio...
{ gradientCheckBox.addEventListener("click", changeGradient); }
conditional_block
decode_mesh.py
def biggestDraw(prevBiggest, d): ret = prevBiggest if ret == None or d.numIndices > ret.numIndices: ret = d for c in d.children: biggest = biggestDraw(ret, c) if biggest.numIndices > ret.numIndices: ret = biggest return ret # Unpack a tuple of the given format, from the data def unpackData(fmt, data): ...
# The total offset is the attribute offset from the base of the vertex meshInput.vertexByteOffset = attr.byteOffset + vbs[attr.vertexBuffer].byteOffset + draw.vertexOffset * vbs[attr.vertexBuffer].byteStride meshInput.format = attr.format meshInput.vertexResourceId = vbs[attr.vertexBuffer].resourceId meshIn...
meshInput.indexResourceId = rd.ResourceId.Null()
conditional_block
decode_mesh.py
biggest = biggestDraw(ret, c) if biggest.numIndices > ret.numIndices: ret = biggest return ret # Unpack a tuple of the given format, from the data def unpackData(fmt, data): # We don't handle 'special' formats - typically bit-packed such as 10:10:10:2 if fmt.Special(): raise RuntimeError("Packed formats a...
# Open a capture file handle cap = rd.OpenCaptureFile()
random_line_split
decode_mesh.py
def biggestDraw(prevBiggest, d): ret = prevBiggest if ret == None or d.numIndices > ret.numIndices: ret = d for c in d.children: biggest = biggestDraw(ret, c) if biggest.numIndices > ret.numIndices: ret = biggest return ret # Unpack a tuple of the given format, from the data def unpackData(fmt, data): ...
(controller, postvs): meshOutputs = [] posidx = 0 vs = controller.GetPipelineState().GetShaderReflection(rd.ShaderStage.Vertex) # Repeat the process, but this time sourcing the data from postvs. # Since these are outputs, we iterate over the list of outputs from the # vertex shader's reflection data for attr i...
getMeshOutputs
identifier_name
decode_mesh.py
def biggestDraw(prevBiggest, d): ret = prevBiggest if ret == None or d.numIndices > ret.numIndices: ret = d for c in d.children: biggest = biggestDraw(ret, c) if biggest.numIndices > ret.numIndices: ret = biggest return ret # Unpack a tuple of the given format, from the data def unpackData(fmt, data): ...
meshOutput.vertexByteOffset = postvs.vertexByteOffset meshOutput.vertexResourceId = postvs.vertexResourceId meshOutput.vertexByteStride = postvs.vertexByteStride # Construct a resource format for this element meshOutput.format = rd.ResourceFormat() meshOutput.format.compByteWidth = rd.VarTypeByteSize(attr....
meshOutputs = [] posidx = 0 vs = controller.GetPipelineState().GetShaderReflection(rd.ShaderStage.Vertex) # Repeat the process, but this time sourcing the data from postvs. # Since these are outputs, we iterate over the list of outputs from the # vertex shader's reflection data for attr in vs.outputSignature: ...
identifier_body
forms.py
# -*- coding: utf-8 -*- """ Romanian specific form helpers. """ import re from django.core.validators import EMPTY_VALUES from django.forms import ValidationError, Field, RegexField, Select from django.utils.translation import ugettext_lazy as _ class ROCIFField(RegexField): """ A Romanian fiscal identity co...
uper(ROPostalCodeField, self).__init__(r'^[0-9][0-8][0-9]{4}$', max_length=6, min_length=6, *args, **kwargs)
identifier_body
forms.py
# -*- coding: utf-8 -*- """ Romanian specific form helpers. """ import re from django.core.validators import EMPTY_VALUES from django.forms import ValidationError, Field, RegexField, Select from django.utils.translation import ugettext_lazy as _ class ROCIFField(RegexField): """ A Romanian fiscal identity co...
(RegexField): """ A Romanian personal identity code (CNP) field For CNP validation algorithm see http://www.validari.ro/cnp.html """ default_error_messages = { 'invalid': _("Enter a valid CNP."), } def __init__(self, *args, **kwargs): super(ROCNPField, self).__init__(r'^[1-...
ROCNPField
identifier_name
forms.py
# -*- coding: utf-8 -*- """ Romanian specific form helpers. """ import re from django.core.validators import EMPTY_VALUES from django.forms import ValidationError, Field, RegexField, Select from django.utils.translation import ugettext_lazy as _ class ROCIFField(RegexField): """ A Romanian fiscal identity co...
try: value = value.strip().upper() except AttributeError: pass # search for county code for entry in COUNTIES_CHOICES: if value in entry: return value # search for county name normalized_CC = [] for entry in COUN...
eturn u''
conditional_block
forms.py
# -*- coding: utf-8 -*- """ Romanian specific form helpers. """ import re from django.core.validators import EMPTY_VALUES from django.forms import ValidationError, Field, RegexField, Select from django.utils.translation import ugettext_lazy as _ class ROCIFField(RegexField): """ A Romanian fiscal identity co...
for entry in normalized_CC: if entry[1] == value: return entry[0] raise ValidationError(self.error_messages['invalid']) class ROCountySelect(Select): """ A Select widget that uses a list of Romanian counties (judete) as its choices. """ def __init__(self,...
normalized_CC.append((entry[0],entry[1].upper()))
random_line_split
main.rs
use std::io; use std::io::Read; fn read_input() -> io::Result<String> { let mut buffer = String::new(); try!(io::stdin().read_to_string(&mut buffer)); Ok(buffer.trim().to_string()) } fn has_escaped_backslash(chars: &Vec<char>, index: usize) -> Option<usize> { if (index + 1 < chars.len()) && (ch...
(chars: &Vec<char>, index: usize) -> Option<usize> { if (index + 1 < chars.len()) && (chars[index] == '\\') && (chars[index + 1] == '\"') { Some(index + 2) } else { None } } fn has_escaped_character(chars: &Vec<char>, index: usize) -> Option<usize> { if (index + 3 < chars.l...
has_escaped_quote
identifier_name
main.rs
use std::io; use std::io::Read; fn read_input() -> io::Result<String> { let mut buffer = String::new(); try!(io::stdin().read_to_string(&mut buffer)); Ok(buffer.trim().to_string()) } fn has_escaped_backslash(chars: &Vec<char>, index: usize) -> Option<usize> { if (index + 1 < chars.len()) && (ch...
println!("Chars when encoded: {}", encoded); println!("Diff with encoded: {}", encoded - total_and_decoded.0); }
random_line_split
main.rs
use std::io; use std::io::Read; fn read_input() -> io::Result<String> { let mut buffer = String::new(); try!(io::stdin().read_to_string(&mut buffer)); Ok(buffer.trim().to_string()) } fn has_escaped_backslash(chars: &Vec<char>, index: usize) -> Option<usize> { if (index + 1 < chars.len()) && (ch...
} } encoded_size } fn main() { let input = read_input().unwrap(); let total_and_decoded = input .lines() .map(calculate_decoded_size) .fold( (0, 0), |(total_and_decoded_code, total_and_decoded_memory), (code, memory)| (total_and_...
{ let mut encoded_size = line.len() + 2; // " in the beginning and in the end. let chars: Vec<_> = line.chars().collect(); let mut i = 0; loop { if i == chars.len() { break; } if chars[i] == '\"' { encoded_size += 1; i += 1; } else if let Some(next) = h...
identifier_body
sass-error.js
/** * @class Cogwheels.SassError * @extends Error */ 'use strict'; var util = require('util') , indent = require('indent-string') ; function SassError(properties) { Error.call(this); if (typeof properties === 'object') { for (var key in properties) { this[key] = properties[key]; } } els...
} module.exports = SassError; util.inherits(SassError, Error); SassError.prototype.status = 1; SassError.prototype.line = 1; SassError.prototype.column = 1; SassError.prototype.code = undefined; SassError.prototype.file = undefined; var FULL_MESSAGE_FORMAT = '[SassError] in file `%s` on line %d colu...
{ this.message = 'Sass Error'; }
conditional_block
sass-error.js
/** * @class Cogwheels.SassError * @extends Error */ 'use strict'; var util = require('util') , indent = require('indent-string') ; function SassError(properties) { Error.call(this); if (typeof properties === 'object') { for (var key in properties) { this[key] = properties[key]; } } els...
if (!this.message) { this.message = 'Sass Error'; } } module.exports = SassError; util.inherits(SassError, Error); SassError.prototype.status = 1; SassError.prototype.line = 1; SassError.prototype.column = 1; SassError.prototype.code = undefined; SassError.prototype.file = undefined; var FUL...
random_line_split
sass-error.js
/** * @class Cogwheels.SassError * @extends Error */ 'use strict'; var util = require('util') , indent = require('indent-string') ; function SassError(properties)
module.exports = SassError; util.inherits(SassError, Error); SassError.prototype.status = 1; SassError.prototype.line = 1; SassError.prototype.column = 1; SassError.prototype.code = undefined; SassError.prototype.file = undefined; var FULL_MESSAGE_FORMAT = '[SassError] in file `%s` on line %d column...
{ Error.call(this); if (typeof properties === 'object') { for (var key in properties) { this[key] = properties[key]; } } else if (typeof properties === 'string') { this.message = properties; } if (!this.message) { this.message = 'Sass Error'; } }
identifier_body
sass-error.js
/** * @class Cogwheels.SassError * @extends Error */ 'use strict'; var util = require('util') , indent = require('indent-string') ; function
(properties) { Error.call(this); if (typeof properties === 'object') { for (var key in properties) { this[key] = properties[key]; } } else if (typeof properties === 'string') { this.message = properties; } if (!this.message) { this.message = 'Sass Error'; } } module.exports = SassEr...
SassError
identifier_name
helper_log.rs
use crate::context::Context; #[cfg(not(feature = "no_logging"))] use crate::error::RenderError; use crate::helpers::{HelperDef, HelperResult}; #[cfg(not(feature = "no_logging"))] use crate::json::value::JsonRender; use crate::output::Output; use crate::registry::Registry; use crate::render::{Helper, RenderContext}; #[c...
else { p.value().render() } }) .collect::<Vec<String>>() .join(", "); let level = h .hash_get("level") .and_then(|v| v.value().as_str()) .unwrap_or("info"); if let Ok(log_level) = Level::from_s...
{ format!("{}: {}", relative_path, p.value().render()) }
conditional_block
helper_log.rs
use crate::context::Context; #[cfg(not(feature = "no_logging"))] use crate::error::RenderError; use crate::helpers::{HelperDef, HelperResult}; #[cfg(not(feature = "no_logging"))] use crate::json::value::JsonRender; use crate::output::Output; use crate::registry::Registry; use crate::render::{Helper, RenderContext}; #[c...
<'reg: 'rc, 'rc>( &self, _: &Helper<'reg, 'rc>, _: &Registry<'reg>, _: &Context, _: &mut RenderContext<'reg, 'rc>, _: &mut dyn Output, ) -> HelperResult { Ok(()) } } pub static LOG_HELPER: LogHelper = LogHelper;
call
identifier_name
helper_log.rs
use crate::context::Context; #[cfg(not(feature = "no_logging"))] use crate::error::RenderError; use crate::helpers::{HelperDef, HelperResult}; #[cfg(not(feature = "no_logging"))] use crate::json::value::JsonRender; use crate::output::Output; use crate::registry::Registry; use crate::render::{Helper, RenderContext}; #[c...
} pub static LOG_HELPER: LogHelper = LogHelper;
{ Ok(()) }
identifier_body
helper_log.rs
use crate::context::Context; #[cfg(not(feature = "no_logging"))] use crate::error::RenderError; use crate::helpers::{HelperDef, HelperResult}; #[cfg(not(feature = "no_logging"))] use crate::json::value::JsonRender; use crate::output::Output; use crate::registry::Registry; use crate::render::{Helper, RenderContext}; #[c...
.params() .iter() .map(|p| { if let Some(ref relative_path) = p.relative_path() { format!("{}: {}", relative_path, p.value().render()) } else { p.value().render() } }) .col...
let param_to_log = h
random_line_split
flowplayer.playlist-3.0.7.js
/** * flowplayer.playlist 3.0.7. Flowplayer JavaScript plugin. * * This file is part of Flowplayer, http://flowplayer.org * * Author: Tero Piirainen, <info@flowplayer.org> * Copyright (c) 2008 Flowplayer Ltd * * Dual licensed under MIT and GPL 2+ licenses * SEE: http://www.opensource.org/licenses * * Date:...
(el, clip) { if (el.hasClass(opts.playingClass) || el.hasClass(opts.pausedClass)) { self.toggle(); } else { el.addClass(opts.progressClass); self.play(clip); } return false; } function clearCSS() { if (manual) { els = wrap.children(); } els.removeClass(op...
play
identifier_name
flowplayer.playlist-3.0.7.js
/** * flowplayer.playlist 3.0.7. Flowplayer JavaScript plugin. * * This file is part of Flowplayer, http://flowplayer.org * * Author: Tero Piirainen, <info@flowplayer.org> * Copyright (c) 2008 Flowplayer Ltd * * Dual licensed under MIT and GPL 2+ licenses * SEE: http://www.opensource.org/licenses * * Date:...
}); // what happens when clip ends ? if (!opts.loop && !manual) { // stop the playback exept on the last clip, which is stopped by default self.onBeforeFinish(function(clip) { if (!clip.isInStream && clip.index < els.length -1) { return false; } }); } // on manual setups per...
// onResume self.onResume(function(clip) { getEl(clip).removeClass(opts.pausedClass).addClass(opts.playingClass);
random_line_split
flowplayer.playlist-3.0.7.js
/** * flowplayer.playlist 3.0.7. Flowplayer JavaScript plugin. * * This file is part of Flowplayer, http://flowplayer.org * * Author: Tero Piirainen, <info@flowplayer.org> * Copyright (c) 2008 Flowplayer Ltd * * Dual licensed under MIT and GPL 2+ licenses * SEE: http://www.opensource.org/licenses * * Date:...
var clip = self.getClip(0); if (!clip.url && opts.playOnClick) { clip.update({url: els.eq(0).attr("href")}); } } // onBegin self.onBegin(function(clip) { clearCSS(); getEl(clip).addClass(opts.playingClass); }); // onPause self.onPause(function(clip) { getEl(clip).re...
{ els = wrap.children(); // allows dynamic addition of elements if ($.isFunction(els.live)) { $(wrap.selector + "> *").live("click", function() { var el = $(this); return play(el, el.attr("href")); }); } else { els.click(function() { var el = $(this); return p...
conditional_block
flowplayer.playlist-3.0.7.js
/** * flowplayer.playlist 3.0.7. Flowplayer JavaScript plugin. * * This file is part of Flowplayer, http://flowplayer.org * * Author: Tero Piirainen, <info@flowplayer.org> * Copyright (c) 2008 Flowplayer Ltd * * Dual licensed under MIT and GPL 2+ licenses * SEE: http://www.opensource.org/licenses * * Date:...
function getEl(clip) { return (manual) ? els.filter("[href=" + clip.originalUrl + "]") : els.eq(clip.index); } //}}} /* setup playlists with onClick handlers */ // internal playlist if (!manual) { var template = wrap.is(":empty") ? opts.template : wrap.html(); buildPlaylist(); ...
{ if (manual) { els = wrap.children(); } els.removeClass(opts.playingClass); els.removeClass(opts.pausedClass); els.removeClass(opts.progressClass); }
identifier_body
google_analytics.py
""" Google Analytics template tags and filters. """ from __future__ import absolute_import import re from django.template import Library, Node, TemplateSyntaxError from templatetags.utils import is_internal_ip, disable_html, get_required_setting SCOPE_VISITOR = 1 SCOPE_SESSION = 2 SCOPE_PAGE = 3 PROPERTY_ID_RE = ...
(Node): def __init__(self): self.property_id = get_required_setting( 'GOOGLE_ANALYTICS_PROPERTY_ID', PROPERTY_ID_RE, "must be a string looking like 'UA-XXXXXX-Y'") def render(self, context): commands = self._get_custom_var_commands(context) html = SETUP_C...
GoogleAnalyticsNode
identifier_name
google_analytics.py
""" Google Analytics template tags and filters. """ from __future__ import absolute_import import re from django.template import Library, Node, TemplateSyntaxError from templatetags.utils import is_internal_ip, disable_html, get_required_setting SCOPE_VISITOR = 1 SCOPE_SESSION = 2 SCOPE_PAGE = 3 PROPERTY_ID_RE = ...
def render(self, context): commands = self._get_custom_var_commands(context) html = SETUP_CODE % {'property_id': self.property_id, 'commands': " ".join(commands)} if is_internal_ip(context, 'GOOGLE_ANALYTICS'): html = disable_html(html, 'Google Analytics') ...
self.property_id = get_required_setting( 'GOOGLE_ANALYTICS_PROPERTY_ID', PROPERTY_ID_RE, "must be a string looking like 'UA-XXXXXX-Y'")
identifier_body
google_analytics.py
""" Google Analytics template tags and filters. """ from __future__ import absolute_import import re from django.template import Library, Node, TemplateSyntaxError from templatetags.utils import is_internal_ip, disable_html, get_required_setting SCOPE_VISITOR = 1 SCOPE_SESSION = 2 SCOPE_PAGE = 3 PROPERTY_ID_RE = ...
register = Library() @register.tag def google_analytics(parser, token): """ Google Analytics tracking template tag. Renders Javascript code to track page visits. You must supply your website property ID (as a string) in the ``GOOGLE_ANALYTICS_PROPERTY_ID`` setting. """ bits = token.split...
random_line_split
google_analytics.py
""" Google Analytics template tags and filters. """ from __future__ import absolute_import import re from django.template import Library, Node, TemplateSyntaxError from templatetags.utils import is_internal_ip, disable_html, get_required_setting SCOPE_VISITOR = 1 SCOPE_SESSION = 2 SCOPE_PAGE = 3 PROPERTY_ID_RE = ...
return html def _get_custom_var_commands(self, context): values = (context.get('google_analytics_var%s' % i) for i in range(1, 6)) vars = [(i, v) for i, v in enumerate(values, 1) if v is not None] commands = [] for index, var in vars: name = var[...
html = disable_html(html, 'Google Analytics')
conditional_block
travels.js
angular.module('app.travels', ['pascalprecht.translate']) .controller('TravelsCtrl', function($scope, $http, $ionicModal, $timeout, $ionicLoading, $filter) { $scope.loadMorePagination = true; $scope.travels = []; $scope.page = 0; $scope.doRefresh = function() { /* travels refresh: */ $ht...
else{ console.log("limit pagination reached"); $scope.$broadcast('scroll.infiniteScrollComplete'); } }; });
{ $scope.page++; console.log($scope.page); $scope.doRefresh(); }
conditional_block
travels.js
angular.module('app.travels', ['pascalprecht.translate']) .controller('TravelsCtrl', function($scope, $http, $ionicModal, $timeout, $ionicLoading, $filter) { $scope.loadMorePagination = true; $scope.travels = []; $scope.page = 0; $scope.doRefresh = function() { /* travels refresh: */ $ht...
}; });
console.log("limit pagination reached"); $scope.$broadcast('scroll.infiniteScrollComplete'); }
random_line_split
lib.rs
#[macro_use] extern crate log; pub mod keyboard; #[cfg(feature = "legacy")] mod keyboard_legacy; #[cfg(not(feature = "legacy"))] mod keyboard_win8; mod language; pub mod platform; mod types; mod winrust; #[cfg(not(feature = "legacy"))] mod win8; #[cfg(not(feature = "legacy"))] pub use self::win8::*; #[cfg(feature = ...
.chain(std::io::stdout()) .chain(fern::log_file(log_path.join(format!("run.log")))?) .apply()?; Ok(()) }
.level_for("kbdi", log::LevelFilter::Trace)
random_line_split
lib.rs
#[macro_use] extern crate log; pub mod keyboard; #[cfg(feature = "legacy")] mod keyboard_legacy; #[cfg(not(feature = "legacy"))] mod keyboard_win8; mod language; pub mod platform; mod types; mod winrust; #[cfg(not(feature = "legacy"))] mod win8; #[cfg(not(feature = "legacy"))] pub use self::win8::*; #[cfg(feature = ...
(tag: &str) -> u32 { crate::platform::winnls::locale_name_to_lcid(&tag) .map(|x| if x == 0x1000 { 0x2000 } else { x }) .unwrap_or(0x2000) } #[derive(Debug, thiserror::Error)] pub enum Error { #[error("IO error")] Io(#[from] std::io::Error), #[error("Path error")] Path(#[from] patho...
lcid
identifier_name
lib.rs
#[macro_use] extern crate log; pub mod keyboard; #[cfg(feature = "legacy")] mod keyboard_legacy; #[cfg(not(feature = "legacy"))] mod keyboard_win8; mod language; pub mod platform; mod types; mod winrust; #[cfg(not(feature = "legacy"))] mod win8; #[cfg(not(feature = "legacy"))] pub use self::win8::*; #[cfg(feature = ...
else { pathos::user::app_log_dir("kbdi")? }; std::fs::create_dir_all(&log_path)?; fern::Dispatch::new() .format(|out, message, record| { out.finish(format_args!( "[{} {:<5} {}] {}", chrono::Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Milli...
{ pathos::system::app_log_dir("kbdi") }
conditional_block
tasks.rs
// Copyright 2017 Pants project contributors (see CONTRIBUTORS.md). // Licensed under the Apache License, Version 2.0 (see LICENSE). use std::fmt; use crate::intrinsics::Intrinsics; use crate::python::{Function, TypeId}; use crate::selectors::{DependencyKey, Get, Select}; use indexmap::IndexSet; use log::Level; use ...
pub fn intrinsics_set(&mut self, intrinsics: &Intrinsics) { for intrinsic in intrinsics.keys() { self.rules.insert(Rule::Intrinsic(intrinsic.clone())); } } /// /// The following methods define the Task registration lifecycle. /// pub fn task_begin( &mut self, func: Function, ret...
{ &self.queries }
identifier_body
tasks.rs
// Copyright 2017 Pants project contributors (see CONTRIBUTORS.md). // Licensed under the Apache License, Version 2.0 (see LICENSE). use std::fmt; use crate::intrinsics::Intrinsics; use crate::python::{Function, TypeId}; use crate::selectors::{DependencyKey, Get, Select}; use indexmap::IndexSet; use log::Level; use ...
/// /// A collection of Rules (TODO: rename to Rules). /// /// Defines a stateful lifecycle for defining tasks via the C api. Call in order: /// 1. task_begin() - once per task /// 2. add_*() - zero or more times per task to add input clauses /// 3. task_end() - once per task /// /// (This protocol was original d...
preparing: Option<Task>, queries: IndexSet<Query<Rule>>, }
random_line_split
tasks.rs
// Copyright 2017 Pants project contributors (see CONTRIBUTORS.md). // Licensed under the Apache License, Version 2.0 (see LICENSE). use std::fmt; use crate::intrinsics::Intrinsics; use crate::python::{Function, TypeId}; use crate::selectors::{DependencyKey, Get, Select}; use indexmap::IndexSet; use log::Level; use ...
{ pub product: TypeId, pub inputs: Vec<TypeId>, } /// /// Registry of native (rust) Intrinsic tasks and user (python) Tasks. /// #[derive(Clone, Debug)] pub struct Tasks { rules: IndexSet<Rule>, // Used during the construction of a rule. preparing: Option<Task>, queries: IndexSet<Query<Rule>>, } /// /// ...
Intrinsic
identifier_name
TimePicker.controller.js
sap.ui.define([ 'sap/ui/core/mvc/Controller', 'sap/ui/model/json/JSONModel' ], function(Controller, JSONModel) { "use strict"; return Controller.extend("sap.m.sample.TimePickerValueState.TimePicker", { onInit: function () { var oModel, sText = "TimePicker with valueState ", aData = [ { label:...
oModel = new JSONModel({ modelData: aData }); this.getView().setModel(oModel); } }); });
random_line_split
makeAsyncFunc.ts
= require('./asyncIterator'); import defer = require('./defer'); import await = require('../await/index'); export = makeAsyncFunc; /** Function for creating a specific variant of the async function. */ function makeAsyncFunc(config: Config): types.AsyncFunction { // Validate the specified configuration...
// Remove concurrency restrictions for nested calls, to avoid race conditions. if (FiberMgr.isExecutingInFiber()) this._semaphore = Semaphore.unlimited; // Configure the run context. var runContext = new RunContext(bodyFunc, this, argsAsArray, () => semaphore.leave()); if...
random_line_split
makeAsyncFunc.ts
= require('./asyncIterator'); import defer = require('./defer'); import await = require('../await/index'); export = makeAsyncFunc; /** Function for creating a specific variant of the async function. */ function makeAsyncFunc(config: Config): types.AsyncFunction { // Validate the specified configuration...
n: Function, arity: number) { // Need to handle each arity individually, but the body never changes. switch (arity) { case 0: return function f0() {var i,l=arguments.length,r=new Array(l);for(i=0;i<l;++i)r[i]=arguments[i];return fn.apply(this,r)} case 1: return function f1(a) {var i,l=argu...
keFuncWithArity(f
identifier_name
makeAsyncFunc.ts
require('./asyncIterator'); import defer = require('./defer'); import await = require('../await/index'); export = makeAsyncFunc; /** Function for creating a specific variant of the async function. */ function makeAsyncFunc(config: Config): types.AsyncFunction { // Validate the specified configuration ...
runContext.callback = callback; } // Execute bodyFunc to completion in a coroutine. For thunks, this is a lazy operation. if (config.returnValue === Config.THUNK) { var thunk: types.Thunk<any> = (done?) => { if (done) resolver.promise.then(val => do...
// Return a function that executes fn in a fiber and returns a promise of fn's result. return function nonIterable(): any { // Get all the arguments passed in, as an array. var argsAsArray = new Array(arguments.length); for (var i = 0; i < argsAsArray.length; ++i) argsAsArray[i]...
identifier_body
OfferNote.jest.tsx
import { Link } from "@artsy/palette" import { SystemContextProvider } from "v2/Artsy" import { ReactWrapper, mount } from "enzyme" import React from "react" import { ExtractProps } from "v2/Utils/ExtractProps" import { OfferNote } from "../OfferNote" import { mediator } from "lib/mediator" const simulateTyping = (wra...
const twoHundredAndOneAs = new Array(201).fill("a").join("") simulateTyping(wrapper, twoHundredAndOneAs) expect(onChange).toHaveBeenCalledWith({ value: twoHundredAndOneAs, exceedsCharacterLimit: true, }) }) it("has a title and description and a character limit", () => { const text...
})
random_line_split
SwipeableDrawer.js
(anchor, touches) { return anchor === 'bottom' ? window.innerHeight - touches[0].clientY : touches[0].clientY; } function getMaxTranslate(horizontalSwipe, paperInstance) { return horizontalSwipe ? paperInstance.clientWidth : paperInstance.clientHeight; } function getTranslate(currentTranslate, startLocation, open...
calculateCurrentY
identifier_name
SwipeableDrawer.js
useEnhancedEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect; var SwipeableDrawer = React.forwardRef(function SwipeableDrawer(props, ref) { var _props$anchor = props.anchor, anchor = _props$anchor === void 0 ? 'left' : _props$anchor, _props$disableBackdro = props.disableBac...
{ var dx = Math.abs(currentX - swipeInstance.current.startX); var dy = Math.abs(currentY - swipeInstance.current.startY); // We are likely to be swiping, let's prevent the scroll event on iOS. if (dx > dy) { if (event.cancelable) { event.preventDefault(); } } va...
conditional_block
SwipeableDrawer.js
function getDomTreeShapes(element, rootNode) { // Adapted from https://github.com/oliviertassinari/react-swipeable-views/blob/7666de1dba253b896911adf2790ce51467670856/packages/react-swipeable-views/src/SwipeableViews.js#L129 var domTreeShapes = []; while (element && element !== rootNode) { var style = wind...
{ return Math.min(Math.max(open ? startLocation - currentTranslate : maxTranslate + startLocation - currentTranslate, 0), maxTranslate); }
identifier_body
SwipeableDrawer.js
element = element.parentElement; } return domTreeShapes; } function findNativeHandler(_ref) { var domTreeShapes = _ref.domTreeShapes, start = _ref.start, current = _ref.current, anchor = _ref.anchor; // Adapted from https://github.com/oliviertassinari/react-swipeable-views/blob/7666de1db...
// Keep elements with a scroll domTreeShapes.push(element); }
random_line_split
rule.ts
/* * Copyright 2013 Palantir Technologies, 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.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable l...
() { return this.position; } public getLineAndCharacter() { return this.lineAndCharacter; } public toJson() { return { position: this.position, line: this.lineAndCharacter.line(), character: this.lineAn...
getPosition
identifier_name
rule.ts
/* * Copyright 2013 Palantir Technologies, 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.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable l...
public equals(ruleFailurePosition: RuleFailurePosition) { var ll = this.lineAndCharacter; var rr = ruleFailurePosition.lineAndCharacter; return (this.position === ruleFailurePosition.position && ll.line() === rr.line() && ll.characte...
{ return { position: this.position, line: this.lineAndCharacter.line(), character: this.lineAndCharacter.character() }; }
identifier_body
rule.ts
/* * Copyright 2013 Palantir Technologies, 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.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable l...
export interface IDisabledInterval { startPosition: number; endPosition: number; } export interface Rule { getOptions(): IOptions; isEnabled(): boolean; apply(syntaxTree: TypeScript.SyntaxTree): RuleFailure[]; applyWithWalker(walker: Lint.RuleWalker): Rul...
}
random_line_split
base.py
# Django settings for opendata project. import os from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS from django.core.urlresolvers import reverse_lazy PROJECT_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) PROJECT_ROOT = os.path.abspath(os.path.join(PROJECT_PATH, os.pardir...
HAYSTACK_SEARCH_RESULTS_PER_PAGE = 5 ACCOUNT_ACTIVATION_DAYS = 7 DEFAULT_FROM_EMAIL = "Open NC <info@open-nc.org>" # DATEFORMAT DATE_INPUT_FORMATS = ( '%m/%d/%Y', '%m/%d/%y', '%Y-%m-%d', # '2006-10-25', '10/25/2006', '10/25/06' # '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006' # '%d %...
'URL': 'http://127.0.0.1:8983/solr' }, } HAYSTACK_SIGNAL_PROCESSOR = 'opendata.search.index_processors.M2MRealtimeSignalProcessor'
random_line_split
UnifiedAlertingPromotion.test.tsx
import React from 'react'; import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { UnifiedAlertingPromotion, LOCAL_STORAGE_KEY } from './UnifiedAlertingPromotion'; describe('Unified Alerting promotion', () => { beforeEach(() => { window.localStorage...
}); it('should not render if previously dismissed', () => { window.localStorage.setItem(LOCAL_STORAGE_KEY, 'false'); render(<UnifiedAlertingPromotion />); expect(screen.queryByText('Try out the Grafana 8 alerting!')).not.toBeInTheDocument(); }); });
expect(window.localStorage.getItem(LOCAL_STORAGE_KEY)).toBe('false');
random_line_split
lists.py
"""List of supported formats """ from collections import namedtuple _FORMAT = namedtuple('FormatDefinition', 'mime_type,' 'extension, schema') _FORMATS = namedtuple('FORMATS', 'GEOJSON, JSON, SHP, GML, GEOTIFF, WCS,' 'WCS100, WCS110, WCS20, WFS, WFS100,' ...
_FORMAT('application/x-ogc-wfs; version=1.1.0', '.xml', None), _FORMAT('application/x-ogc-wfs; version=2.0', '.xml', None), _FORMAT('application/x-ogc-wms', '.xml', None), _FORMAT('application/x-ogc-wms; version=1.3.0', '.xml', None), _FORMAT('application/x-ogc-wms; version=1.1.0', '.xml', None), ...
_FORMAT('application/x-ogc-wcs; version=2.0', '.xml', None), _FORMAT('application/x-ogc-wfs', '.xml', None), _FORMAT('application/x-ogc-wfs; version=1.0.0', '.xml', None),
random_line_split
ex43.py
from sys import exit from random import randint class Scene(object): def enter(self): print "This scene is not yet configured. Subclass it and implement enrer()." exit(1) class Engine(object): def __init__(self, scene_map): self.scene_map = scene_map def play(self): curr...
else: print "DOES NOT COMPUTE!" return 'central_corridor' class LaserWeaponArmory(Scene): def enter(self): print "A lot of things happen in here. Blablabla." code = "%d%d%d" % (randint(1,9), randint(1,9), randint(1,9)) guess = raw_input("[keypad]> ") ...
print "Lucky for you they made you learn Gothon insults in the academy. You tell the one Gothon joke you know: \nLbhe zbgure vf fb sbg, jura fur fvgf nebhaq gur ubhfr, fur fvgf nebhaq gur. \n The Gothon stops, tries not to laugh, then busts out laughing and can't stop. While he's laughing you run up and shoot him squar...
conditional_block
ex43.py
from sys import exit from random import randint class Scene(object): def enter(self): print "This scene is not yet configured. Subclass it and implement enrer()." exit(1) class Engine(object): def __init__(self, scene_map): self.scene_map = scene_map def play(self): curr...
action = raw_input("> ") if action == "throw the bomb": print "You die." return 'death' elif action == "slowly place the bomb": print "You run to the escape podto get off this tin can." return 'escape_pod' else: print "DOES N...
print "You have a bomb under your arm and haven't pulled your weapon yet as more Gorthons emerge."
random_line_split
ex43.py
from sys import exit from random import randint class Scene(object): def enter(self): print "This scene is not yet configured. Subclass it and implement enrer()." exit(1) class Engine(object): def __init__(self, scene_map): self.scene_map = scene_map def play(self): curr...
class EscapePod(Scene): def enter(self): print "There's 5 pods, which one do you take?" good_pot = randint(1,5) guess = raw_input("[pod #]> ") if int(guess) != good_pod: print "You die." return 'death' else: print "You won!" ...
print "You have a bomb under your arm and haven't pulled your weapon yet as more Gorthons emerge." action = raw_input("> ") if action == "throw the bomb": print "You die." return 'death' elif action == "slowly place the bomb": print "You run to the escape p...
identifier_body
ex43.py
from sys import exit from random import randint class
(object): def enter(self): print "This scene is not yet configured. Subclass it and implement enrer()." exit(1) class Engine(object): def __init__(self, scene_map): self.scene_map = scene_map def play(self): current_scene = self.scene_map.opening_scene() last_scen...
Scene
identifier_name
WithTheme.js
import React, { Component } from "react"; import { ReactiveBase, MultiList, ReactiveElement } from "../../app.js"; import { combineStreamData } from "../../middleware/helper.js"; import ResponsiveStory from "./ResponsiveStory"; import { GetTopTopics } from "./helper"; import { Img } from "../Img.js"; require("../list....
}} /> </div> <div className="col s6 col-xs-6"> <MultiList componentId="CitySensor" dataField="group.group_city.group_city_simple" showCount={true} size={10} title="Input Filter" initialLoader="Loading city list.." selectAllLabel="All cities"...
{ return ( <ReactiveBase app="meetup2" credentials="qz4ZD8xq1:a0edfc7f-5611-46f6-8fe1-d4db234631f3" type="meetup" theme="rbc-dark" > <div className="row reverse-labels"> <div className="col s6 col-xs-6"> <ReactiveElement componentId="SearchResult" from={0} siz...
identifier_body
WithTheme.js
import React, { Component } from "react"; import { ReactiveBase, MultiList, ReactiveElement } from "../../app.js"; import { combineStreamData } from "../../middleware/helper.js"; import ResponsiveStory from "./ResponsiveStory"; import { GetTopTopics } from "./helper"; import { Img } from "../Img.js"; require("../list....
() { ResponsiveStory(); } onAllData(res, err) { let result = null; if (res && res.appliedQuery) { let combineData = res.currentData; if (res.mode === "historic") { combineData = res.currentData.concat(res.newData); } else if (res.mode === "streaming") { combineData = combineStreamData(res.cu...
componentDidMount
identifier_name
WithTheme.js
import React, { Component } from "react"; import { ReactiveBase, MultiList, ReactiveElement } from "../../app.js"; import { combineStreamData } from "../../middleware/helper.js"; import ResponsiveStory from "./ResponsiveStory"; import { GetTopTopics } from "./helper"; import { Img } from "../Img.js"; require("../list....
else if (res.mode === "streaming") { combineData = combineStreamData(res.currentData, res.newData); } if (combineData) { combineData = GetTopTopics(combineData); const resultMarkup = combineData.map((data, index) => { if (index < 5) { return this.itemMarkup(data, index); } }); ...
{ combineData = res.currentData.concat(res.newData); }
conditional_block
WithTheme.js
import React, { Component } from "react"; import { ReactiveBase, MultiList, ReactiveElement } from "../../app.js"; import { combineStreamData } from "../../middleware/helper.js"; import ResponsiveStory from "./ResponsiveStory"; import { GetTopTopics } from "./helper"; import { Img } from "../Img.js"; require("../list....
}
</div> </ReactiveBase> ); }
random_line_split
index.js
import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; function Square(props) { return ( <button className="square" onClick={props.onClick}> {props.value} </button> ); } class Board extends React.Component { renderSquare(i) { return ( <Square value={th...
let status; if (winner) { status = "Winner: " + winner; } else { status = "Next player: " + (this.state.xIsNext ? "X" : "O"); } return ( <div className="game"> <div className="game-board"> <Board squares={current.squares} onClick={i => thi...
random_line_split
index.js
import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; function Square(props) { return ( <button className="square" onClick={props.onClick}> {props.value} </button> ); } class Board extends React.Component { renderSquare(i) { return ( <Square value={th...
else { status = "Next player: " + (this.state.xIsNext ? "X" : "O"); } return ( <div className="game"> <div className="game-board"> <Board squares={current.squares} onClick={i => this.handleClick(i)} /> </div> <div className="game-...
{ status = "Winner: " + winner; }
conditional_block
index.js
import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; function
(props) { return ( <button className="square" onClick={props.onClick}> {props.value} </button> ); } class Board extends React.Component { renderSquare(i) { return ( <Square value={this.props.squares[i]} onClick={() => this.props.onClick(i)} /> ); } render() ...
Square
identifier_name
renderer-texture.rs
extern crate sdl2; use sdl2::pixels::PixelFormatEnum; use sdl2::rect::Rect; use sdl2::event::Event; use sdl2::keyboard::Keycode; pub fn main() { let sdl_context = sdl2::init().unwrap(); let video_subsystem = sdl_context.video().unwrap(); let window = video_subsystem.window("rust-sdl2 demo: Video", 800, 6...
renderer.copy(&texture, None, Some(Rect::new(100, 100, 256, 256))).unwrap(); renderer.copy_ex(&texture, None, Some(Rect::new(450, 100, 256, 256)), 30.0, None, false, false).unwrap(); renderer.present(); let mut event_pump = sdl_context.event_pump().unwrap(); 'running: loop { for e...
random_line_split
renderer-texture.rs
extern crate sdl2; use sdl2::pixels::PixelFormatEnum; use sdl2::rect::Rect; use sdl2::event::Event; use sdl2::keyboard::Keycode; pub fn main() { let sdl_context = sdl2::init().unwrap(); let video_subsystem = sdl_context.video().unwrap(); let window = video_subsystem.window("rust-sdl2 demo: Video", 800, 6...
, _ => {} } } // The rest of the game loop goes here... } }
{ break 'running }
conditional_block
renderer-texture.rs
extern crate sdl2; use sdl2::pixels::PixelFormatEnum; use sdl2::rect::Rect; use sdl2::event::Event; use sdl2::keyboard::Keycode; pub fn
() { let sdl_context = sdl2::init().unwrap(); let video_subsystem = sdl_context.video().unwrap(); let window = video_subsystem.window("rust-sdl2 demo: Video", 800, 600) .position_centered() .opengl() .build() .unwrap(); let mut renderer = window.renderer().build().unwra...
main
identifier_name
renderer-texture.rs
extern crate sdl2; use sdl2::pixels::PixelFormatEnum; use sdl2::rect::Rect; use sdl2::event::Event; use sdl2::keyboard::Keycode; pub fn main()
buffer[offset + 1] = y as u8; buffer[offset + 2] = 0; } } }).unwrap(); renderer.clear(); renderer.copy(&texture, None, Some(Rect::new(100, 100, 256, 256))).unwrap(); renderer.copy_ex(&texture, None, Some(Rect::new(450, 100, 256, 256)), 30.0, ...
{ let sdl_context = sdl2::init().unwrap(); let video_subsystem = sdl_context.video().unwrap(); let window = video_subsystem.window("rust-sdl2 demo: Video", 800, 600) .position_centered() .opengl() .build() .unwrap(); let mut renderer = window.renderer().build().unwrap()...
identifier_body
weak_crypto.py
from cryptography.hazmat import backends from cryptography.hazmat.primitives.asymmetric import ec, dsa, rsa # Crypto and Cryptodome have same API if random(): from Crypto.PublicKey import DSA from Crypto.PublicKey import RSA else: from Cryptodome.PublicKey import DSA from Cryptodome.PublicKey import RS...
return RSA.generate(bits)
make_new_rsa_key_strong(RSA_STRONG) def only_used_by_test(bits): # Although this call will technically not be ok, since it's only used in a test, we don't want to alert on it.
random_line_split
weak_crypto.py
from cryptography.hazmat import backends from cryptography.hazmat.primitives.asymmetric import ec, dsa, rsa # Crypto and Cryptodome have same API if random(): from Crypto.PublicKey import DSA from Crypto.PublicKey import RSA else: from Cryptodome.PublicKey import DSA from Cryptodome.PublicKey import RS...
make_new_rsa_key_weak(RSA_WEAK) def make_new_rsa_key_strong(bits): return RSA.generate(bits) # OK make_new_rsa_key_strong(RSA_STRONG) def only_used_by_test(bits): # Although this call will technically not be ok, since it's only used in a test, we don't want to alert on it. return RSA.generate(bits)
return RSA.generate(bits) # NOT OK
identifier_body
weak_crypto.py
from cryptography.hazmat import backends from cryptography.hazmat.primitives.asymmetric import ec, dsa, rsa # Crypto and Cryptodome have same API if random(): from Crypto.PublicKey import DSA from Crypto.PublicKey import RSA else:
RSA_WEAK = 1024 RSA_OK = 2048 RSA_STRONG = 3076 DSA_WEAK = 1024 DSA_OK = 2048 DSA_STRONG = 3076 BIG = 10000 EC_WEAK = ec.SECT163K1() # has key size of 163 EC_OK = ec.SECP224R1() EC_STRONG = ec.SECP384R1() EC_BIG = ec.SECT571R1() dsa_gen_key = dsa.generate_private_key ec_gen_key = ec.generate_private_key rsa_gen_...
from Cryptodome.PublicKey import DSA from Cryptodome.PublicKey import RSA
conditional_block
weak_crypto.py
from cryptography.hazmat import backends from cryptography.hazmat.primitives.asymmetric import ec, dsa, rsa # Crypto and Cryptodome have same API if random(): from Crypto.PublicKey import DSA from Crypto.PublicKey import RSA else: from Cryptodome.PublicKey import DSA from Cryptodome.PublicKey import RS...
(bits): return RSA.generate(bits) # NOT OK make_new_rsa_key_weak(RSA_WEAK) def make_new_rsa_key_strong(bits): return RSA.generate(bits) # OK make_new_rsa_key_strong(RSA_STRONG) def only_used_by_test(bits): # Although this call will technically not be ok, since it's only used in a test, we don't want to ...
make_new_rsa_key_weak
identifier_name
icf.py
%s\xfd" % (chr(cmd), payload) if SAVE_PIPE: LOG.debug("Saving data...") SAVE_PIPE.write(frame) # LOG.debug("Sending:\n%s" % util.hexprint(frame)) # LOG.debug("Sending:\n%s" % util.hexprint(hed[6:])) if cmd == 0xe4: # Uncomment to avoid cloning to the radio # return fram...
LOG.debug("ICF Size change from %i to %i at %04x" % (last_size, dst - src, src)) last_size = dst - src if addr != src: LOG.debug("ICF GAP %04x - %04x" % (addr, src)) addr = dst elif fram...
if frame.cmd == CMD_CLONE_DAT: src, dst = process_data_frame(radio, frame, _mmap) if last_size != (dst - src):
random_line_split
icf.py
0660000", "28880000"] def is_icf_file(filename): """Returns True if @filename is an ICF file""" f = file(filename) data = f.readline() data += f.readline() f.close() data = data.replace("\n", "").replace("\r", "") return bool(re.match("^[0-9]{8}#", data)) class IcomBank(chirp_common.Ba...
"""Subclass for Icom clone-mode radios using the raw data protocol.""" def process_frame_payload(self, payload): """Payloads from a raw-clone-mode radio are already in raw format.""" return unescape_raw_bytes(payload) def get_payload(self, data, raw, checksum): """Returns the data with...
identifier_body
icf.py
else: frames.append(frame) self.data = rest except errors.InvalidDataError, e: LOG.error("Failed to parse frame (cmd=%i): %s" % (cmd, e)) return [] return frames def get_frames(self, nolimit=False): "...
pass
conditional_block
icf.py
def start_hispeed_clone(radio, cmd): """Send the magic incantation to the radio to go fast""" buf = ("\xFE" * 20) + \ "\xEE\xEF\xE8" + \ radio.get_model() + \ "\x00\x00\x02\x01\xFD" LOG.debug("Starting HiSpeed:\n%s" % util.hexprint(buf)) radio.pipe.write(buf) radio.pipe.fl...
get_mappings
identifier_name
kubernetesHelpers.d.ts
var log: Logging.Logger; var keepPollingModel: boolean; var defaultIconUrl: string; var hostIconUrl: string; var osConfig: KubernetesConfig; var masterUrl: string; var defaultApiVersion: string; var defaultOSApiVersion: string; var labelFilterTextSeparator: string; var defaultNamesp...
function runApp($location: any, $scope: any, $http: any, KubernetesApiURL: any, json: any, name?: string, onSuccessFn?: any, namespace?: any, onCompleteFn?: any): void; /** * Returns true if the current status of the pod is running */ function isRunning(podCurrentState: any): any; /** * R...
function buildLogsRestUrl(id: any): string; /** * Runs the given application JSON */
random_line_split