file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
39k
suffix
large_stringlengths
0
36.1k
middle
large_stringlengths
0
29.4k
fim_type
large_stringclasses
4 values
name.rs
#![macro_use] use std::{ cell::RefCell, collections::{HashMap, HashSet}, fmt, string::String, }; /// An interned, freshenable identifier. /// Generally, one creates names with `n()` (short for `Name::global()`); /// two names created this way with the same spelling will be treated as the same name. /...
// Printable versions are first-come, first-served assert_eq!(a.freshen().print(), "a"); assert_eq!(a.print(), "aπŸ₯•"); }
random_line_split
name.rs
#![macro_use] use std::{ cell::RefCell, collections::{HashMap, HashSet}, fmt, string::String, }; /// An interned, freshenable identifier. /// Generally, one creates names with `n()` (short for `Name::global()`); /// two names created this way with the same spelling will be treated as the same name. /...
*id_map_.borrow_mut().entry(unique_spelling.clone()).or_insert_with(claim_id) }; Name { id: id } }) } pub fn is(self, s: &str) -> bool { self.sp() == s } pub fn is_name(self, n: Name) -> bool { self.sp() == n.sp() } } impl From<&str> for Name { fn from(s: &str) -> ...
aim_id() // ...don't put it in the table } else {
conditional_block
name.rs
#![macro_use] use std::{ cell::RefCell, collections::{HashMap, HashSet}, fmt, string::String, }; /// An interned, freshenable identifier. /// Generally, one creates names with `n()` (short for `Name::global()`); /// two names created this way with the same spelling will be treated as the same name. /...
ame { Name::new(s, true) } pub fn freshen(self) -> Name { Name::new(&self.orig_sp(), true) } fn new(orig_spelling: &str, freshen: bool) -> Name { let fake_freshness_ = fake_freshness.with(|ff| *ff.borrow()); id_map.with(|id_map_| { let mut unique_spelling = orig_spelling.to_owned()...
) -> N
identifier_name
sparc64_unknown_linux_gnu.rs
// Copyright 2016 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 fn target() -> TargetResult { let mut base = super::linux_base::opts(); base.cpu = "v9".to_string(); base.max_atomic_width = Some(64); Ok(Target { llvm_target: "sparc64-unknown-linux-gnu".to_string(), target_endian: "big".to_string(), target_pointer_width: "64".to_string(), ...
// option. This file may not be copied, modified, or distributed // except according to those terms. use spec::{LinkerFlavor, Target, TargetResult};
random_line_split
sparc64_unknown_linux_gnu.rs
// Copyright 2016 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 ...
() -> TargetResult { let mut base = super::linux_base::opts(); base.cpu = "v9".to_string(); base.max_atomic_width = Some(64); Ok(Target { llvm_target: "sparc64-unknown-linux-gnu".to_string(), target_endian: "big".to_string(), target_pointer_width: "64".to_string(), targe...
target
identifier_name
sparc64_unknown_linux_gnu.rs
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ let mut base = super::linux_base::opts(); base.cpu = "v9".to_string(); base.max_atomic_width = Some(64); Ok(Target { llvm_target: "sparc64-unknown-linux-gnu".to_string(), target_endian: "big".to_string(), target_pointer_width: "64".to_string(), target_c_int_width: "32"...
identifier_body
grayscale.js
/*! * Start Bootstrap - Grayscale Bootstrap Theme (http://startbootstrap.com) * Code licensed under the Apache License v2.0. * For details, see http://www.apache.org/licenses/LICENSE-2.0. */ // jQuery to collapse the navbar on scroll $(window).scroll(function() { if ($(".navbar").offset().top > 50) { ...
() { // Basic options for a simple Google Map // For more options see: https://developers.google.com/maps/documentation/javascript/reference#MapOptions var mapOptions = { // How zoomed in you want the map to start at (always required) zoom: 16, // The latitude and longitude t...
init
identifier_name
grayscale.js
/*! * Start Bootstrap - Grayscale Bootstrap Theme (http://startbootstrap.com) * Code licensed under the Apache License v2.0. * For details, see http://www.apache.org/licenses/LICENSE-2.0. */ // jQuery to collapse the navbar on scroll $(window).scroll(function() { if ($(".navbar").offset().top > 50)
else { $(".navbar-fixed-top").removeClass("top-nav-collapse"); } }); // jQuery for page scrolling feature - requires jQuery Easing plugin $(function() { $('a.page-scroll').bind('click', function(event) { var $anchor = $(this); $('html, body').stop().animate({ scro...
{ $(".navbar-fixed-top").addClass("top-nav-collapse"); }
conditional_block
grayscale.js
/*! * Start Bootstrap - Grayscale Bootstrap Theme (http://startbootstrap.com) * Code licensed under the Apache License v2.0. * For details, see http://www.apache.org/licenses/LICENSE-2.0. */ // jQuery to collapse the navbar on scroll $(window).scroll(function() { if ($(".navbar").offset().top > 50) { ...
"lightness": 30 }, { "gamma": 0.5 }, { "hue": "#435158" } ] } ] }; // Get the HTML DOM element that will contain your map // We are using a div with id="map" seen below in ...
random_line_split
grayscale.js
/*! * Start Bootstrap - Grayscale Bootstrap Theme (http://startbootstrap.com) * Code licensed under the Apache License v2.0. * For details, see http://www.apache.org/licenses/LICENSE-2.0. */ // jQuery to collapse the navbar on scroll $(window).scroll(function() { if ($(".navbar").offset().top > 50) { ...
$(document).ready(function(d){ $(".dropdown .dropdown-menu li").hover(function(){ //Mouse IN $(".dropdown .dropdown-menu li").removeClass("active"); $(this).addClass("active"); }, function(){ //Mouse Out $(".dropdown .dropdown-menu li").removeClass("active"); } ); });
{ // Basic options for a simple Google Map // For more options see: https://developers.google.com/maps/documentation/javascript/reference#MapOptions var mapOptions = { // How zoomed in you want the map to start at (always required) zoom: 16, // The latitude and longitude to c...
identifier_body
sw.js
/** * Welcome to your Workbox-powered service worker! * * You'll need to register this file in your web app and you should * disable HTTP caching for this file too. * See https://goo.gl/nhQhGp * * The rest of the code is auto-generated. Please don't update this file * directly; instead, make changes to your Wor...
(event) { event.waitUntil(idbKeyval.clear()) }, } self.addEventListener(`message`, event => { const { gatsbyApi } = event.data if (gatsbyApi) messageApi[gatsbyApi](event, event.data) })
clearPathResources
identifier_name
sw.js
/** * Welcome to your Workbox-powered service worker! * * You'll need to register this file in your web app and you should * disable HTTP caching for this file too. * See https://goo.gl/nhQhGp * * The rest of the code is auto-generated. Please don't update this file * directly; instead, make changes to your Wor...
"revision": "bd80d19c4b4dd12eca877feb0b5015cc" } ].concat(self.__precacheManifest || []); workbox.precaching.suppressWarnings(); workbox.precaching.precacheAndRoute(self.__precacheManifest, {}); workbox.routing.registerRoute(/(\.js$|\.css$|static\/)/, workbox.strategies.cacheFirst(), 'GET'); workbox.routing.regi...
{ "url": "manifest.webmanifest",
random_line_split
sw.js
/** * Welcome to your Workbox-powered service worker! * * You'll need to register this file in your web app and you should * disable HTTP caching for this file too. * See https://goo.gl/nhQhGp * * The rest of the code is auto-generated. Please don't update this file * directly; instead, make changes to your Wor...
, } self.addEventListener(`message`, event => { const { gatsbyApi } = event.data if (gatsbyApi) messageApi[gatsbyApi](event, event.data) })
{ event.waitUntil(idbKeyval.clear()) }
identifier_body
fit-util.js
// The MIT License (MIT) // Copyright (c) 2015 RAFAEL FERNANDES // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, co...
(list) { return _.reduce(list, function(memo, num) { return Number(memo) + Number(num); }, 0) / (list.length === 0 ? 1 : list.length); } }]); /** * Underscore as an angular module and service. */ angular.module('underscore', []) .factory('_', function() { return window._; // assumes underscore...
average
identifier_name
fit-util.js
// The MIT License (MIT) // Copyright (c) 2015 RAFAEL FERNANDES // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, co...
return Number(memo) + Number(num); }, 0) / (list.length === 0 ? 1 : list.length); } }]); /** * Underscore as an angular module and service. */ angular.module('underscore', []) .factory('_', function() { return window._; // assumes underscore has already been loaded on the page });
function average(list) { return _.reduce(list, function(memo, num) {
random_line_split
fit-util.js
// The MIT License (MIT) // Copyright (c) 2015 RAFAEL FERNANDES // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, co...
}]); /** * Underscore as an angular module and service. */ angular.module('underscore', []) .factory('_', function() { return window._; // assumes underscore has already been loaded on the page });
{ return _.reduce(list, function(memo, num) { return Number(memo) + Number(num); }, 0) / (list.length === 0 ? 1 : list.length); }
identifier_body
mod.rs
// Generated with ./mk_vsl_tag from Varnish headers: include/tbl/vsl_tags.h include/tbl/vsl_tags_http.h include/vsl_int.h // https://github.com/varnishcache/varnish-cache/blob/master/include/vapi/vsl_int.h // https://github.com/varnishcache/varnish-cache/blob/master/include/tbl/vsl_tags.h // https://github.com/varnishc...
(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { let tag = format!("{:?}", self.tag); if f.alternate() { write!(f, "{} {:5} {:18} {}", self.marker, self.ident, tag, MaybeStr::from_bytes(self.data)) } else { write!(f, "VSL record (marker: {} ident: {} tag: ...
fmt
identifier_name
mod.rs
// Generated with ./mk_vsl_tag from Varnish headers: include/tbl/vsl_tags.h include/tbl/vsl_tags_http.h include/vsl_int.h // https://github.com/varnishcache/varnish-cache/blob/master/include/vapi/vsl_int.h // https://github.com/varnishcache/varnish-cache/blob/master/include/tbl/vsl_tags.h // https://github.com/varnishc...
else { write!(f, "VSL record (marker: {} ident: {} tag: {} data: {:?})", self.marker, self.ident, tag, MaybeStr::from_bytes(self.data)) } } }
{ write!(f, "{} {:5} {:18} {}", self.marker, self.ident, tag, MaybeStr::from_bytes(self.data)) }
conditional_block
mod.rs
// Generated with ./mk_vsl_tag from Varnish headers: include/tbl/vsl_tags.h include/tbl/vsl_tags_http.h include/vsl_int.h // https://github.com/varnishcache/varnish-cache/blob/master/include/vapi/vsl_int.h // https://github.com/varnishcache/varnish-cache/blob/master/include/tbl/vsl_tags.h // https://github.com/varnishc...
pub fn is_backend(&self) -> bool { self.marker.contains(Marker::VSL_BACKENDMARKER) } } impl<'b> Debug for VslRecord<'b> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { f.debug_struct("VSL Record") .field("tag", &self.tag) .field("marker", &se...
}
random_line_split
mod.rs
// Generated with ./mk_vsl_tag from Varnish headers: include/tbl/vsl_tags.h include/tbl/vsl_tags_http.h include/vsl_int.h // https://github.com/varnishcache/varnish-cache/blob/master/include/vapi/vsl_int.h // https://github.com/varnishcache/varnish-cache/blob/master/include/tbl/vsl_tags.h // https://github.com/varnishc...
} impl<'b> Display for VslRecord<'b> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { let tag = format!("{:?}", self.tag); if f.alternate() { write!(f, "{} {:5} {:18} {}", self.marker, self.ident, tag, MaybeStr::from_bytes(self.data)) } else { ...
{ f.debug_struct("VSL Record") .field("tag", &self.tag) .field("marker", &self.marker) .field("ident", &self.ident) .field("data", &MaybeStr::from_bytes(self.data)) .finish() }
identifier_body
__init__.py
# ============================================================================= # Copyright 2016 The TensorFlow 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 #
# See the License for the specific language governing permissions and # limitations under the License. # ============================================================================= """Custom op used by periodic_resample.""" from __future__ import absolute_import from __future__ import division from __future__ import...
# http://www.apache.org/licenses/LICENSE-2.0 # # 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.
random_line_split
network.rs
// Copyright 2020 The Exonum Team // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to i...
Ok(()) } .right_future() } async fn process_messages( pool: SharedConnectionPool, connection: Connection, mut network_tx: mpsc::Sender<NetworkEvent>, ) { let (sink, stream) = connection.socket.split(); let key = connection.key; le...
{ let handler = Self::handle_connection(connection, connect, pool, network_tx); tokio::spawn(handler); }
conditional_block
network.rs
// Copyright 2020 The Exonum Team // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to i...
( &self, key: PublicKey, handshake_params: &HandshakeParams, ) -> impl Future<Output = anyhow::Result<()>> { // Resolve peer key to an address. let maybe_address = self.connect_list.find_address_by_key(&key); let unresolved_address = if let Some(address) = maybe_addre...
connect
identifier_name
network.rs
// Copyright 2020 The Exonum Team // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to i...
"Ignoring outgoing connection to {:?} because the connection limit ({}) \ is reached", key, max_connections ); return Ok(()); } let conn_addr = ConnectedPeerAddr::Out(unresolved_addr...
.send(&mut socket) .await?; if pool.read().count_outgoing() >= max_connections { log::info!(
random_line_split
network.rs
// Copyright 2020 The Exonum Team // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to i...
/// Drops the connection to a peer. The request can be optionally filtered by the connection ID /// in order to avoid issuing obsolete requests. /// /// # Return value /// /// Returns `true` if the connection with the peer was dropped. If the connection with the /// peer was not dropped (e...
{ self.peers.get(address).is_some() }
identifier_body
shortlex_strings_using_chars.rs
use itertools::Itertools; use malachite_base::chars::exhaustive::exhaustive_ascii_chars; use malachite_base::strings::exhaustive::shortlex_strings_using_chars;
let ss = shortlex_strings_using_chars(cs).take(20).collect_vec(); assert_eq!(ss.iter().map(String::as_str).collect_vec().as_slice(), out); } #[test] fn test_shortlex_strings_using_chars() { shortlex_strings_using_chars_helper(empty(), &[""]); shortlex_strings_using_chars_helper( once('a'), ...
use std::iter::{empty, once}; fn shortlex_strings_using_chars_helper<I: Clone + Iterator<Item = char>>(cs: I, out: &[&str]) {
random_line_split
shortlex_strings_using_chars.rs
use itertools::Itertools; use malachite_base::chars::exhaustive::exhaustive_ascii_chars; use malachite_base::strings::exhaustive::shortlex_strings_using_chars; use std::iter::{empty, once}; fn shortlex_strings_using_chars_helper<I: Clone + Iterator<Item = char>>(cs: I, out: &[&str])
#[test] fn test_shortlex_strings_using_chars() { shortlex_strings_using_chars_helper(empty(), &[""]); shortlex_strings_using_chars_helper( once('a'), &[ "", "a", "aa", "aaa", "aaaa", "aaaaa", "aaaaaa", ...
{ let ss = shortlex_strings_using_chars(cs).take(20).collect_vec(); assert_eq!(ss.iter().map(String::as_str).collect_vec().as_slice(), out); }
identifier_body
shortlex_strings_using_chars.rs
use itertools::Itertools; use malachite_base::chars::exhaustive::exhaustive_ascii_chars; use malachite_base::strings::exhaustive::shortlex_strings_using_chars; use std::iter::{empty, once}; fn
<I: Clone + Iterator<Item = char>>(cs: I, out: &[&str]) { let ss = shortlex_strings_using_chars(cs).take(20).collect_vec(); assert_eq!(ss.iter().map(String::as_str).collect_vec().as_slice(), out); } #[test] fn test_shortlex_strings_using_chars() { shortlex_strings_using_chars_helper(empty(), &[""]); sh...
shortlex_strings_using_chars_helper
identifier_name
data.py
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. from __future__ import absolute_import from digits.utils import subclass, override, constants from digits.extensions.data.interface import DataIngestionInterface from .forms import DatasetForm, InferenceForm import numpy as np import os TEMPLATE = "temp...
(self, stage): count = 0 if self.userdata['is_inference_db']: if stage == constants.TEST_DB: if self.test_image_count: count = self.test_image_count else: return [(self.gradient_x, self.gradient_y)] else: ...
itemize_entries
identifier_name
data.py
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. from __future__ import absolute_import from digits.utils import subclass, override, constants from digits.extensions.data.interface import DataIngestionInterface from .forms import DatasetForm, InferenceForm import numpy as np import os TEMPLATE = "temp...
@staticmethod @override def get_title(): return "Gradients" @override def itemize_entries(self, stage): count = 0 if self.userdata['is_inference_db']: if stage == constants.TEST_DB: if self.test_image_count: count = self.test...
extension_dir = os.path.dirname(os.path.abspath(__file__)) template = open(os.path.join(extension_dir, INFERENCE_TEMPLATE), "r").read() context = {'form': form} return (template, context)
identifier_body
data.py
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. from __future__ import absolute_import from digits.utils import subclass, override, constants from digits.extensions.data.interface import DataIngestionInterface from .forms import DatasetForm, InferenceForm
import numpy as np import os TEMPLATE = "templates/template.html" INFERENCE_TEMPLATE = "templates/inference_template.html" @subclass class DataIngestion(DataIngestionInterface): """ A data ingestion extension for an image gradient dataset """ def __init__(self, is_inference_db=False, **kwargs): ...
random_line_split
data.py
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. from __future__ import absolute_import from digits.utils import subclass, override, constants from digits.extensions.data.interface import DataIngestionInterface from .forms import DatasetForm, InferenceForm import numpy as np import os TEMPLATE = "temp...
return [np.random.random_sample(2) - 0.5 for i in xrange(count)] if count > 0 else []
count = self.test_image_count
conditional_block
CommandGroupManager.js
/* ************************************************************************ qooxdoo - the new era of web development http://qooxdoo.org Copyright: 2004-2012 1&1 Internet AG, Germany, http://www.1und1.de License: LGPL: http://www.gnu.org/licenses/lgpl.html EPL: http://www.eclipse.org/org/d...
} });
}
random_line_split
render.rs
use glfw_ffi::*; use nanovg; use std::os::raw::c_int; use std::ptr; #[repr(usize)] #[derive(PartialEq, Eq)] pub enum Fonts { Inter = 0, Vga8, Moderno, NumFonts, } pub struct RenderContext<'a> { window: *mut GLFWwindow, nvg: &'a nanovg::Context, fonts: [nanovg::Font<'a>; Fonts::NumFonts as...
pub fn size(&self) -> (f32, f32) { let (mut w, mut h) = (0i32, 0i32); unsafe { glfwGetWindowSize(self.window, &mut w as *mut _, &mut h as *mut _); } (w as f32, h as f32) } pub fn pixel_ratio(&self) -> f32 { unsafe { let mut fb_width: c_int =...
{ Self { window, nvg, fonts } }
identifier_body
render.rs
use glfw_ffi::*; use nanovg; use std::os::raw::c_int; use std::ptr; #[repr(usize)] #[derive(PartialEq, Eq)] pub enum Fonts { Inter = 0, Vga8, Moderno, NumFonts, } pub struct RenderContext<'a> { window: *mut GLFWwindow, nvg: &'a nanovg::Context, fonts: [nanovg::Font<'a>; Fonts::NumFonts as...
<F: FnOnce(nanovg::Frame)>(&self, f: F) { self.nvg.frame(self.size(), self.pixel_ratio(), f); } pub fn font(&self, id: Fonts) -> nanovg::Font<'a> { if id == Fonts::NumFonts { panic!("Tried to access font `Fonts::NumFonts`"); } self.fonts[id as usize] } }
frame
identifier_name
render.rs
use glfw_ffi::*; use nanovg; use std::os::raw::c_int; use std::ptr; #[repr(usize)] #[derive(PartialEq, Eq)] pub enum Fonts { Inter = 0,
NumFonts, } pub struct RenderContext<'a> { window: *mut GLFWwindow, nvg: &'a nanovg::Context, fonts: [nanovg::Font<'a>; Fonts::NumFonts as usize], } impl<'a> RenderContext<'a> { pub fn new( window: *mut GLFWwindow, nvg: &'a nanovg::Context, fonts: [nanovg::Font<'a>; Fonts::...
Vga8, Moderno,
random_line_split
render.rs
use glfw_ffi::*; use nanovg; use std::os::raw::c_int; use std::ptr; #[repr(usize)] #[derive(PartialEq, Eq)] pub enum Fonts { Inter = 0, Vga8, Moderno, NumFonts, } pub struct RenderContext<'a> { window: *mut GLFWwindow, nvg: &'a nanovg::Context, fonts: [nanovg::Font<'a>; Fonts::NumFonts as...
self.fonts[id as usize] } }
{ panic!("Tried to access font `Fonts::NumFonts`"); }
conditional_block
Block.js
'use strict'; /** * λΈ”λŸ­ λͺ¨λΈ * * @class Block * * @exception {Error} Messages.CONSTRUCT_ERROR * μ•„λž˜ λ¬Έμ„œμ˜ 1.3 Models Folder의 ν•­λͺ© μ°Έμ‘° * @link https://github.com/Gaia3D/F4DConverter/blob/master/doc/F4D_SpecificationV1.pdf */ var Block = function() { if (!(this instanceof Block)) { throw new Error(Messages
container which holds the VBO Cache Keys. * @type {VBOVertexIdxCacheKeysContainer} */ this.vBOVertexIdxCacheKeysContainer = new VBOVertexIdxCacheKeysContainer(); /** * @deprecated * @type {number} * @default -1 */ this.mIFCEntityType = -1; /** * small object flag. * if bbox.getMaxLength() < 0.5,...
.CONSTRUCT_ERROR); } /** * This class is the
conditional_block
Block.js
'use strict'; /** * λΈ”λŸ­ λͺ¨λΈ * * @class Block * * @exception {Error} Messages.CONSTRUCT_ERROR * μ•„λž˜ λ¬Έμ„œμ˜ 1.3 Models Folder의 ν•­λͺ© μ°Έμ‘° * @link https://github.com/Gaia3D/F4DConverter/blob/master/doc/F4D_SpecificationV1.pdf */ var Block = function() { if (!(this instanceof Block)) { throw new Error(Messages.CONSTR...
/** * 각각의 사물쀑 λ³΅μž‘ν•œ λͺ¨λΈμ΄ μžˆμ„ 경우 Lego둜 처리 * ν˜„μž¬λŠ” μ‚¬μš©ν•˜μ§€ μ•ŠμœΌλ‚˜ 좔후에 ν•„μš”ν•  수 μžˆμ–΄μ„œ κ·ΈλŒ€λ‘œ λ‘ . * legoBlock. * @type {Lego} */ this.lego; }; /** * block μ΄ˆκΈ°ν™”. glμ—μ„œ ν•΄λ‹Ή block 및 lego μ‚­μ œ * * @param {WebGLRenderingContext} gl * @param {VboManager} vboMemManager */ Block.prototype.deleteObjects = function(gl, vboMemManager) {...
*/ this.vertexCount = 0;
random_line_split
mvn.py
#!/usr/bin/env python3 # Copyright (C) 2013 The Android Open Source Project # # 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 ...
from __future__ import print_function import argparse from os import path, environ from subprocess import check_output, CalledProcessError from sys import stderr parser = argparse.ArgumentParser() parser.add_argument('--repository', help='maven repository id') parser.add_argument('--url', help='maven repository url')...
# 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 License.
random_line_split
mvn.py
#!/usr/bin/env python3 # Copyright (C) 2013 The Android Open Source Project # # 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 ...
check_output(exe) except Exception as e: print('%s command failed: %s\n%s' % (args.a, ' '.join(exe), e), file=stderr) if environ.get('VERBOSE') and isinstance(e, CalledProcessError): print('Command output\n%s' % e.output, file=stderr) exit(1) out = stderr...
print(' '.join(exe), file=stderr)
conditional_block
search.ts
import { ContextKeys, GlyphChars } from '../../constants'; import { Container } from '../../container'; import { getContext } from '../../context'; import { GitCommit, GitLog, Repository } from '../../git/models'; import { searchOperators, SearchOperators, SearchPattern } from '../../git/search'; import { ActionQuickPi...
if (state.showResultsInSideBar == null) { state.showResultsInSideBar = cfg.showResultsInSideBar ?? undefined; } let skippedStepOne = false; while (this.canStepsContinue(state)) { context.title = this.title; if (state.counter < 1 || state.repo == null || typeof state.repo === 'string') { skipped...
{ state.matchRegex = cfg.matchRegex; }
conditional_block
search.ts
import { ContextKeys, GlyphChars } from '../../constants'; import { Container } from '../../container'; import { getContext } from '../../context'; import { GitCommit, GitLog, Repository } from '../../git/models'; import { searchOperators, SearchOperators, SearchPattern } from '../../git/search'; import { ActionQuickPi...
continue; } state.pattern = result; } const search: SearchPattern = { pattern: state.pattern, matchAll: state.matchAll, matchCase: state.matchCase, matchRegex: state.matchRegex, }; const searchKey = SearchPattern.toKey(search); if (context.resultsPromise == null || contex...
random_line_split
search.ts
import { ContextKeys, GlyphChars } from '../../constants'; import { Container } from '../../container'; import { getContext } from '../../context'; import { GitCommit, GitLog, Repository } from '../../git/models'; import { searchOperators, SearchOperators, SearchPattern } from '../../git/search'; import { ActionQuickPi...
override isMatch(key: string) { return super.isMatch(key) || key === 'grep'; } override isFuzzyMatch(name: string) { return super.isFuzzyMatch(name) || name === 'grep'; } protected async *steps(state: PartialStepState<State>): StepGenerator { const context: Context = { repos: this.container.git.openRe...
{ return false; }
identifier_body
search.ts
import { ContextKeys, GlyphChars } from '../../constants'; import { Container } from '../../container'; import { getContext } from '../../context'; import { GitCommit, GitLog, Repository } from '../../git/models'; import { searchOperators, SearchOperators, SearchPattern } from '../../git/search'; import { ActionQuickPi...
extends QuickCommand<State> { constructor(container: Container, args?: SearchGitCommandArgs) { super(container, 'search', 'search', 'Commit Search', { description: 'aka grep, searches for commits', }); let counter = 0; if (args?.state?.repo != null) { counter++; } if (args?.state?.pattern != null ...
SearchGitCommand
identifier_name
lib.rs
#![crate_name = "librespot"] #![cfg_attr(feature = "cargo-clippy", allow(unused_io_amount))] #[macro_use] extern crate error_chain; #[macro_use] extern crate futures; #[macro_use] extern crate lazy_static; #[macro_use] extern crate log; #[macro_use] extern crate serde_json; #[macro_use] extern crate serde_derive; ex...
extern crate tremor as vorbis; #[cfg(feature = "alsa-backend")] extern crate alsa; #[cfg(feature = "portaudio")] extern crate portaudio; #[cfg(feature = "libpulse-sys")] extern crate libpulse_sys; #[macro_use] mod component; pub mod album_cover; pub mod apresolve; pub mod audio_backend; pub mod audio_decrypt; pub ...
random_line_split
keras_vectorizer.py
import sys import numpy as np from normalization import tokenize from helpers import ahash class KerasVectorizer(): ''' Convert list of documents to numpy array for input into Keras model
def __init__(self, n_features=100000, maxlen=None, maxper=100, hash_function=ahash): self.maxlen = maxlen self.maxper = maxper self.n_features = n_features self.hash_function = hash_function def _exact_hash(self, word, n_features): return self.token_lookup.get(word, ...
'''
random_line_split
keras_vectorizer.py
import sys import numpy as np from normalization import tokenize from helpers import ahash class KerasVectorizer(): ''' Convert list of documents to numpy array for input into Keras model ''' def __init__(self, n_features=100000, maxlen=None, maxper=100, hash_function=ahash): self.maxlen = ...
(KerasVectorizer): def _split_function(self, doc): return doc ''' from keras_vectorizer import KerasTokenVectorizer, KerasCharacterVectorizer ktv = KerasTokenVectorizer() ktv.fit_transform(['this is a test']) ktv.fit_transform(['this is a test', 'this is a another test']) ktv = KerasTokenVectorizer(maxl...
KerasPretokenizedVectorizer
identifier_name
keras_vectorizer.py
import sys import numpy as np from normalization import tokenize from helpers import ahash class KerasVectorizer(): ''' Convert list of documents to numpy array for input into Keras model ''' def __init__(self, n_features=100000, maxlen=None, maxper=100, hash_function=ahash): self.maxlen = ...
if len(t) > 0: X[i,-len(t):] = map(lambda x: self.hash_function(x + suffix, self.n_features), t[:maxlen]) return X class KerasCharacterVectorizer(KerasVectorizer): ''' Split a string into characters ''' def _split_function(self, doc): ...
print >> sys.stderr, 'processed %d tokens' % i
conditional_block
keras_vectorizer.py
import sys import numpy as np from normalization import tokenize from helpers import ahash class KerasVectorizer(): ''' Convert list of documents to numpy array for input into Keras model ''' def __init__(self, n_features=100000, maxlen=None, maxper=100, hash_function=ahash): self.maxlen = ...
class KerasTokenVectorizer(KerasVectorizer): ''' Split a string into words, ''' def _split_function(self, doc): return tokenize(doc, keep_punctuation=True) class KerasPretokenizedVectorizer(KerasVectorizer): def _split_function(self, doc): return doc ''' from keras_vector...
return list(doc)
identifier_body
testNightwatchApi.js
var Api = require('../../lib/api.js'); module.exports = { setUp: function (callback) { this.client = require('../nightwatch.js').init(); callback(); }, testAddCommand : function(test) { var client = this.client; var api = client.api; client.on('selenium:session_create', function(sessionId) ...
return 'testCommand action'; }; test.deepEqual(api.globals, { myGlobal : 'test' }); Api.addCommand('testCommand', command, this.client); test.ok('testCommand' in this.client.api, 'Test if the command was added'); test.throws(function() { Api.addCommand('testCommand', command...
var command = function() {
random_line_split
MessagesNoticesResponse.ts
/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { Card } from './Card'; import type { Error } from './Error'; import type { Image } from './Image'; import type { MessagesNotice } from './MessagesNotice'; export type MessagesNoticesResponse = { messagesNotices: Array<MessagesNotice...
*/ link?: string; card?: Card; }
random_line_split
legacy.ts
import * as Babylon from "../index"; import * as DebugImport from "../Debug/index"; declare var global: any; /** * Legacy support, defining window.BABYLON (global variable). * * This is the entry point for the UMD module. * The entry point for a future ESM package should be index.ts */ var globalObjec...
export * from "../index"; export const Debug = { AxesViewer: DebugImport.AxesViewer, BoneAxesViewer: DebugImport.BoneAxesViewer, PhysicsViewer: DebugImport.PhysicsViewer, SkeletonViewer: DebugImport.SkeletonViewer, };
{ (<any>globalObject).BABYLON = BABYLON; (<any>globalObject).BABYLON = (<any>globalObject).BABYLON || {}; var BABYLON = (<any>globalObject).BABYLON; BABYLON.Debug = BABYLON.Debug || {}; const keys = []; for (var key in DebugImport) { BABYLON.Debug[key] = (<any>DebugImport)[key];...
conditional_block
legacy.ts
import * as Babylon from "../index"; import * as DebugImport from "../Debug/index"; declare var global: any; /** * Legacy support, defining window.BABYLON (global variable). * * This is the entry point for the UMD module. * The entry point for a future ESM package should be index.ts */ var globalObjec...
} export * from "../index"; export const Debug = { AxesViewer: DebugImport.AxesViewer, BoneAxesViewer: DebugImport.BoneAxesViewer, PhysicsViewer: DebugImport.PhysicsViewer, SkeletonViewer: DebugImport.SkeletonViewer, };
}
random_line_split
Confirm.js
/** * Confirm Component * * Same as window.confirm but using Filter component and divs. * * @param text The text to confim. * @param onOK (optional) Javascript function to call when OK button is clicked. * Make sure that it is a String! * @param onCancel (optional) Javascript...
{ this.id = 'zuiConfirm'; // getElementById id of this DOM this.DOM = init(); window.dialog = this; function init() { window.filter = new Filter(); // create new filter at window.filter var h1 = createHeader('Confirm', id, window.filter); var p1 = document.createElement('P'); p1.classNam...
identifier_body
Confirm.js
/** * Confirm Component * * Same as window.confirm but using Filter component and divs. * * @param text The text to confim. * @param onOK (optional) Javascript function to call when OK button is clicked. * Make sure that it is a String! * @param onCancel (optional) Javascript...
(text, onOK, onCancel) { this.id = 'zuiConfirm'; // getElementById id of this DOM this.DOM = init(); window.dialog = this; function init() { window.filter = new Filter(); // create new filter at window.filter var h1 = createHeader('Confirm', id, window.filter); var p1 = document.createElement('...
Confirm
identifier_name
Confirm.js
/** * Confirm Component * * Same as window.confirm but using Filter component and divs. * * @param text The text to confim. * @param onOK (optional) Javascript function to call when OK button is clicked. * Make sure that it is a String! * @param onCancel (optional) Javascript...
var p2 = document.createElement('P'); p2.className = 'center'; p2.appendChild(ok); p2.appendChild(cancel); var container = document.createElement('DIV'); container.className = 'zuiDialog'; container.id = id; container.onkeydown = function(e) { e = e || event; ...
{ ok.value = LABEL_YES; cancel.value = LABEL_NO; }
conditional_block
Confirm.js
/** * Confirm Component * * Same as window.confirm but using Filter component and divs. * * @param text The text to confim. * @param onOK (optional) Javascript function to call when OK button is clicked. * Make sure that it is a String! * @param onCancel (optional) Javascript...
window.filter = new Filter(); // create new filter at window.filter var h1 = createHeader('Confirm', id, window.filter); var p1 = document.createElement('P'); p1.className = 'zuiAlertText'; p1.innerHTML = text; var ok = createButton('OK', id, window.filter, onOK); var cancel = createButton('C...
window.dialog = this; function init() {
random_line_split
lnbin.py
import numpy as np #x must be a np array def lnbin(x, BinNum): """ Logarithmically bins a numpy array, returns (midpoints, Freq) This function take the input of a data vector x, which is to be binned; it also takes in the amount bins one would like the data binned into. The output is two vectors,...
percent_binned = float((x.size-(i+1))) / x.size*100 #print 'Percentage of input vec binned {}'.format(percent_binned) FPT = x[i:] LFPT = np.log(FPT) max1 = np.log( np.ceil(np.amax(FPT))) #min1 = 1 min1 = np.log(np.floor(np.min(FPT))) LFreq = np.zeros((BinNum, 1)) ...
i += 1
conditional_block
lnbin.py
import numpy as np #x must be a np array def lnbin(x, BinNum):
""" Logarithmically bins a numpy array, returns (midpoints, Freq) This function take the input of a data vector x, which is to be binned; it also takes in the amount bins one would like the data binned into. The output is two vectors, one containing the normalised frequency of each bin (Freq), th...
identifier_body
lnbin.py
import numpy as np #x must be a np array def lnbin(x, BinNum): """ Logarithmically bins a numpy array, returns (midpoints, Freq) This function take the input of a data vector x, which is to be binned; it also takes in the amount bins one would like the data binned into. The output is two vectors,...
if type(x) != np.ndarray: try: x = np.array(x) except: print 'Improper input format!' raise x = np.sort(x) i = 0 while x[i] <= 0: i += 1 percent_binned = float((x.size-(i+1))) / x.size*100 #print 'Percentage o...
put; i.e.: [midpts Freq]=lnbin(x,BinNum). Updated 2/6/14 to change the min to scale automatically """
random_line_split
lnbin.py
import numpy as np #x must be a np array def
(x, BinNum): """ Logarithmically bins a numpy array, returns (midpoints, Freq) This function take the input of a data vector x, which is to be binned; it also takes in the amount bins one would like the data binned into. The output is two vectors, one containing the normalised frequency of each bi...
lnbin
identifier_name
get_users.py
import emission.analysis.modelling.tour_model.data_preprocessing as preprocess # to determine if the user is valid: # valid user should have >= 10 trips for further analysis and the proportion of filter_trips is >=50% def valid_user(filter_trips,trips): valid = False if len(filter_trips) >= 10 and len(filter_...
user_ls.append(curr_user) else: user_ls.append(curr_user) continue return user_ls,valid_user_ls
random_line_split
get_users.py
import emission.analysis.modelling.tour_model.data_preprocessing as preprocess # to determine if the user is valid: # valid user should have >= 10 trips for further analysis and the proportion of filter_trips is >=50% def valid_user(filter_trips,trips): valid = False if len(filter_trips) >= 10 and len(filter_...
else: user_ls.append(curr_user) continue return user_ls,valid_user_ls
valid_user_ls.append(curr_user) user_ls.append(curr_user)
conditional_block
get_users.py
import emission.analysis.modelling.tour_model.data_preprocessing as preprocess # to determine if the user is valid: # valid user should have >= 10 trips for further analysis and the proportion of filter_trips is >=50% def valid_user(filter_trips,trips): valid = False if len(filter_trips) >= 10 and len(filter_...
(all_users,radius): user_ls = [] valid_user_ls = [] for i in range(len(all_users)): curr_user = 'user' + str(i + 1) user = all_users[i] trips = preprocess.read_data(user) filter_trips = preprocess.filter_data(trips,radius) if valid_user(filter_trips,trips): ...
get_user_ls
identifier_name
get_users.py
import emission.analysis.modelling.tour_model.data_preprocessing as preprocess # to determine if the user is valid: # valid user should have >= 10 trips for further analysis and the proportion of filter_trips is >=50% def valid_user(filter_trips,trips):
# - user_ls: a list of strings representing short user names, such as [user1, user2, user3...] # - valid_user_ls: a subset of `user_ls` for valid users, so also string representation of user names # - all_users: a collection of all user ids, in terms of user id objects def get_user_ls(all_users,radius): user_ls ...
valid = False if len(filter_trips) >= 10 and len(filter_trips) / len(trips) >= 0.5: valid = True return valid
identifier_body
Facebook.js
import React from 'react'; import SvgIcon from '@material-ui/core/SvgIcon'; /* eslint-disable max-len */ const FacebookIcon = props => ( <SvgIcon viewBox="0 0 216 216" {...props}> <path d="M204.1,0H11.9C5.3,0,0,5.3,0,11.9v192.2c0,6.6,5.3,11.9,11.9,11.9h103.5v-83.6H87.2V99.8h28.1 v-24c0-27.9,17-43.1,41.9-43.1c11...
/* eslint-enable max-len */ export default FacebookIcon;
);
random_line_split
structure.js
var ref = require("prosemirror-model"); var Slice = ref.Slice; var Fragment = ref.Fragment; var ref$1 = require("./transform"); var Transform = ref$1.Transform; var ref$2 = require("./replace_step"); var ReplaceStep = ref$2.ReplaceStep; var ReplaceAroundStep = ref$2.ReplaceAroundStep; function canCut(node, start, end...
var parent = range.parent var content = parent.content.cutByIndex(range.startIndex, range.endIndex) for (var depth = range.depth;; --depth) { var node = range.$from.node(depth), index = range.$from.index(depth), endIndex = range.$to.indexAfter(depth) if (depth < range.depth && node.canReplace(index, endIn...
random_line_split
structure.js
var ref = require("prosemirror-model"); var Slice = ref.Slice; var Fragment = ref.Fragment; var ref$1 = require("./transform"); var Transform = ref$1.Transform; var ref$2 = require("./replace_step"); var ReplaceStep = ref$2.ReplaceStep; var ReplaceAroundStep = ref$2.ReplaceAroundStep; function canCut(node, start, end...
// :: (NodeRange) β†’ ?number // Try to find a target depth to which the content in the given range // can be lifted. function liftTarget(range) { var parent = range.parent var content = parent.content.cutByIndex(range.startIndex, range.endIndex) for (var depth = range.depth;; --depth) { var node = range.$fro...
{ return (start == 0 || node.canReplace(start, node.childCount)) && (end == node.childCount || node.canReplace(0, end)) }
identifier_body
structure.js
var ref = require("prosemirror-model"); var Slice = ref.Slice; var Fragment = ref.Fragment; var ref$1 = require("./transform"); var Transform = ref$1.Transform; var ref$2 = require("./replace_step"); var ReplaceStep = ref$2.ReplaceStep; var ReplaceAroundStep = ref$2.ReplaceAroundStep; function
(node, start, end) { return (start == 0 || node.canReplace(start, node.childCount)) && (end == node.childCount || node.canReplace(0, end)) } // :: (NodeRange) β†’ ?number // Try to find a target depth to which the content in the given range // can be lifted. function liftTarget(range) { var parent = range.parent...
canCut
identifier_name
structure.js
var ref = require("prosemirror-model"); var Slice = ref.Slice; var Fragment = ref.Fragment; var ref$1 = require("./transform"); var Transform = ref$1.Transform; var ref$2 = require("./replace_step"); var ReplaceStep = ref$2.ReplaceStep; var ReplaceAroundStep = ref$2.ReplaceAroundStep; function canCut(node, start, end...
$pos.before(d) : $pos.after(d) } } exports.joinPoint = joinPoint // :: (number, ?number, ?bool) β†’ Transform // Join the blocks around the given position. If depth is 2, their // last and first siblings are also joined, and so on. Transform.prototype.join = function(pos, depth) { if ( depth === void 0 ) depth = 1;...
dir < 0 ?
conditional_block
autoref-intermediate-types-issue-3585.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ let x = @3u; assert_eq!(x.foo(), ~"@3"); }
identifier_body
autoref-intermediate-types-issue-3585.rs
// Copyright 2012 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 ...
(&self) -> ~str { fmt!("@%s", (**self).foo()) } } impl Foo for uint { fn foo(&self) -> ~str { fmt!("%u", *self) } } pub fn main() { let x = @3u; assert_eq!(x.foo(), ~"@3"); }
foo
identifier_name
autoref-intermediate-types-issue-3585.rs
// Copyright 2012 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 fn main() { let x = @3u; assert_eq!(x.foo(), ~"@3"); }
random_line_split
L0FailsIfThereIsMkdirError.ts
import fs = require('fs'); import mockanswer = require('azure-pipelines-task-lib/mock-answer'); import mockrun = require('azure-pipelines-task-lib/mock-run'); import path = require('path'); let taskPath = path.join(__dirname, '..', 'copyfiles.js'); let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPa...
let answers = <mockanswer.TaskLibAnswers> { checkPath: { }, find: { }, }; answers.checkPath[path.normalize('/srcDir')] = true; answers.find[path.normalize('/srcDir')] = [ path.normalize('/srcDir'), path.normalize('/srcDir/someOtherDir'), path.normalize('/srcDir/someOtherDir/file1.file'), path.no...
random_line_split
GameRenderer.ts
import {Field, GameSetting} from './../logic/logic' import {CellRenderer} from './cellrenderer' class GameRenderer { private cellRenderer : CellRenderer; private ctx : CanvasRenderingContext2D; /** * Creates an new instace of the GameRenderer class * @param canvas The canvas to render the gamme * @param set...
/** * Renders the an specific cell on a field * @param field The field to render the cell * @param x The number of the cell on the X axis * @param y The number of the cell on the Y axis */ public renderAt(field: Field, x: number, y: number) { var cell = field.getCellAt(x, y); if (cell) this.cellR...
{ this.canvas.height = field.getYCellCount() * this.setting.cellHeight; this.canvas.width = field.getXCellCount() * this.setting.cellWidth; this.ctx.fillStyle = "white"; this.ctx.fillRect(0, 0, field.getXCellCount() * this.setting.cellWidth, field.getYCellCount() * this.setting.cellHeight); field.forE...
identifier_body
GameRenderer.ts
import {Field, GameSetting} from './../logic/logic' import {CellRenderer} from './cellrenderer' class GameRenderer { private cellRenderer : CellRenderer; private ctx : CanvasRenderingContext2D; /** * Creates an new instace of the GameRenderer class * @param canvas The canvas to render the gamme * @param set...
field.forEachField((x, y, cell) => this.cellRenderer.renderCell(x, y, cell)); } /** * Renders the an specific cell on a field * @param field The field to render the cell * @param x The number of the cell on the X axis * @param y The number of the cell on the Y axis */ public renderAt(field: Field,...
this.canvas.height = field.getYCellCount() * this.setting.cellHeight; this.canvas.width = field.getXCellCount() * this.setting.cellWidth; this.ctx.fillStyle = "white"; this.ctx.fillRect(0, 0, field.getXCellCount() * this.setting.cellWidth, field.getYCellCount() * this.setting.cellHeight);
random_line_split
GameRenderer.ts
import {Field, GameSetting} from './../logic/logic' import {CellRenderer} from './cellrenderer' class GameRenderer { private cellRenderer : CellRenderer; private ctx : CanvasRenderingContext2D; /** * Creates an new instace of the GameRenderer class * @param canvas The canvas to render the gamme * @param set...
(field: Field, x: number, y: number) { var cell = field.getCellAt(x, y); if (cell) this.cellRenderer.renderCell(x, y, cell); } } export {GameRenderer}
renderAt
identifier_name
final.test.ts
import { Machine, interpret, assign, AnyEventObject } from '../src'; const finalMachine = Machine({ id: 'final', initial: 'green', states: { green: { on: { TIMER: 'yellow' } }, yellow: { on: { TIMER: 'red' } }, red: { type: 'parallel', states: { crosswalk1:...
on: { FINISH: 'end' } }, end: { type: 'final', data: spy } } }); const service = interpret(machine).start(); service.send({ type: 'FINISH', value: 1 }); expect(spy).toBeCalledTimes(1); }); });
start: {
random_line_split
system_data.py
""" .. module:: system_data :platform: linux :synopsis: The module containing the system data. .. moduleauthor:: Paul Fanelli <paul.fanelli@gmail.com> .. modulecreated:: 6/26/15 """ import bunch import sys from yaml.parser import ParserError from zope.interface import implements from planet_alignment.data.inte...
(self, data): try: super(SystemData, self).__init__(data) except ParserError as pe: print("ERROR: Error parsing data!") sys.exit("ERROR: {}".format(pe)) except Exception as e: print("ERROR: Unknown exception '{}'".format(e)) sys.exit("E...
__init__
identifier_name
system_data.py
""" .. module:: system_data :platform: linux :synopsis: The module containing the system data. .. moduleauthor:: Paul Fanelli <paul.fanelli@gmail.com> .. modulecreated:: 6/26/15 """ import bunch import sys from yaml.parser import ParserError from zope.interface import implements from planet_alignment.data.inte...
def __iter__(self): return iter(self.system) def __len__(self): return len(self.system)
try: super(SystemData, self).__init__(data) except ParserError as pe: print("ERROR: Error parsing data!") sys.exit("ERROR: {}".format(pe)) except Exception as e: print("ERROR: Unknown exception '{}'".format(e)) sys.exit("ERROR: {}".format(e))
identifier_body
system_data.py
""" .. module:: system_data :platform: linux :synopsis: The module containing the system data. .. moduleauthor:: Paul Fanelli <paul.fanelli@gmail.com> .. modulecreated:: 6/26/15 """ import bunch import sys from yaml.parser import ParserError from zope.interface import implements from planet_alignment.data.inte...
- **parameters** and **types**:: :param data: The system data as a bunch object. :type data: Bunch object. """ implements(ISystemData) def __init__(self, data): try: super(SystemData, self).__init__(data) except ParserError as pe: print("ERROR:...
The system data consists of a name, theta, radius and period for each planet.
random_line_split
fitsdiff.py
"""fitsdiff is now a part of Astropy. Now this module just provides a wrapper around astropy.io.fits.diff for backwards compatibility with the old interface in case anyone uses it. """ import os import sys from astropy.io.fits.diff import FITSDiff from astropy.io.fits.scripts.fitsdiff import log, main def fitsdiff(...
def list_parse(name_list): """Parse a comma-separated list of values, or a filename (starting with @) containing a list value on each line. """ if name_list and name_list[0] == '@': value = name_list[1:] if not os.path.exists(value): log.warning('The file %s does not exis...
if isinstance(comment_excl_list, str): comment_excl_list = list_parse(comment_excl_list) if isinstance(value_excl_list, str): value_excl_list = list_parse(value_excl_list) if isinstance(field_excl_list, str): field_excl_list = list_parse(field_excl_list) diff = FITSDiff(input1, in...
identifier_body
fitsdiff.py
"""fitsdiff is now a part of Astropy. Now this module just provides a wrapper around astropy.io.fits.diff for backwards compatibility with the old interface in case anyone uses it. """ import os import sys from astropy.io.fits.diff import FITSDiff from astropy.io.fits.scripts.fitsdiff import log, main def fitsdiff(...
(name_list): """Parse a comma-separated list of values, or a filename (starting with @) containing a list value on each line. """ if name_list and name_list[0] == '@': value = name_list[1:] if not os.path.exists(value): log.warning('The file %s does not exist' % value) ...
list_parse
identifier_name
fitsdiff.py
"""fitsdiff is now a part of Astropy. Now this module just provides a wrapper around astropy.io.fits.diff for backwards compatibility with the old interface in case anyone uses it. """ import os import sys from astropy.io.fits.diff import FITSDiff from astropy.io.fits.scripts.fitsdiff import log, main def fitsdiff(...
return diff.identical def list_parse(name_list): """Parse a comma-separated list of values, or a filename (starting with @) containing a list value on each line. """ if name_list and name_list[0] == '@': value = name_list[1:] if not os.path.exists(value): log.warning(...
output = sys.stdout diff.report(output)
random_line_split
fitsdiff.py
"""fitsdiff is now a part of Astropy. Now this module just provides a wrapper around astropy.io.fits.diff for backwards compatibility with the old interface in case anyone uses it. """ import os import sys from astropy.io.fits.diff import FITSDiff from astropy.io.fits.scripts.fitsdiff import log, main def fitsdiff(...
if isinstance(value_excl_list, str): value_excl_list = list_parse(value_excl_list) if isinstance(field_excl_list, str): field_excl_list = list_parse(field_excl_list) diff = FITSDiff(input1, input2, ignore_keywords=value_excl_list, ignore_comments=comment_excl_list, ...
comment_excl_list = list_parse(comment_excl_list)
conditional_block
_util.py
import matplotlib.transforms import numpy def has_legend(axes): return axes.get_legend() is not None def get_legend_text(obj): """Check if line is in legend.""" leg = obj.axes.get_legend() if leg is None: return None keys = [h.get_label() for h in leg.legendHandles if h is not None] ...
return xdata, ydata
points = numpy.array([xdata, ydata]).T transform = matplotlib.transforms.composite_transform_factory( obj.get_transform(), obj.axes.transData.inverted() ) return transform.transform(points).T
conditional_block
_util.py
import matplotlib.transforms import numpy def has_legend(axes): return axes.get_legend() is not None def
(obj): """Check if line is in legend.""" leg = obj.axes.get_legend() if leg is None: return None keys = [h.get_label() for h in leg.legendHandles if h is not None] values = [t.get_text() for t in leg.texts] label = obj.get_label() d = dict(zip(keys, values)) if label in d: ...
get_legend_text
identifier_name
_util.py
import matplotlib.transforms import numpy def has_legend(axes): return axes.get_legend() is not None def get_legend_text(obj): """Check if line is in legend.""" leg = obj.axes.get_legend() if leg is None: return None keys = [h.get_label() for h in leg.legendHandles if h is not None] ...
return xdata, ydata
random_line_split
_util.py
import matplotlib.transforms import numpy def has_legend(axes): return axes.get_legend() is not None def get_legend_text(obj): """Check if line is in legend.""" leg = obj.axes.get_legend() if leg is None: return None keys = [h.get_label() for h in leg.legendHandles if h is not None] ...
"""The coordinates might not be in data coordinates, but could be sometimes in axes coordinates. For example, the matplotlib command axes.axvline(2) will have the y coordinates set to 0 and 1, not to the limits. Therefore, a two-stage transform has to be applied: 1. first transforming to display...
identifier_body
mod.rs
// Copyright 2020 The Tink-Rust Authors // // 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 ag...
/// Build a vector of requested size with key ID prefix pre-filled. fn create_output_prefix(size: usize, start_byte: u8, key_id: crate::KeyId) -> Vec<u8> { let mut prefix = Vec::with_capacity(size); prefix.push(start_byte); prefix.extend_from_slice(&key_id.to_be_bytes()); prefix }
{ match OutputPrefixType::from_i32(key.output_prefix_type) { Some(OutputPrefixType::Legacy) | Some(OutputPrefixType::Crunchy) => Ok( create_output_prefix(LEGACY_PREFIX_SIZE, LEGACY_START_BYTE, key.key_id), ), Some(OutputPrefixType::Tink) => Ok(create_output_prefix( TI...
identifier_body
mod.rs
// Copyright 2020 The Tink-Rust Authors // // 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 ag...
(size: usize, start_byte: u8, key_id: crate::KeyId) -> Vec<u8> { let mut prefix = Vec::with_capacity(size); prefix.push(start_byte); prefix.extend_from_slice(&key_id.to_be_bytes()); prefix }
create_output_prefix
identifier_name
mod.rs
// Copyright 2020 The Tink-Rust Authors // // 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 ag...
pub const LEGACY_START_BYTE: u8 = 0; /// Prefix size of Tink key types. /// The prefix starts with \x01 and followed by a 4-byte key id. pub const TINK_PREFIX_SIZE: usize = NON_RAW_PREFIX_SIZE; /// First byte of the prefix of Tink key types. pub const TINK_START_BYTE: u8 = 1; /// Prefix size of Raw key types. /// Raw...
/// First byte of the prefix of legacy key types.
random_line_split
frequency_status.rs
use rosrust::Duration; use rosrust_diagnostics::{FrequencyStatus, Level, Status, Task}; mod util; #[test] fn
() { let _roscore = util::run_roscore_for(util::Feature::FrequencyStatusTest); rosrust::init("frequency_status_test"); let fs = FrequencyStatus::builder() .window_size(2) .min_frequency(10.0) .max_frequency(20.0) .tolerance(0.5) .build(); fs.tick(); rosrust:...
frequency_status_test
identifier_name
frequency_status.rs
use rosrust::Duration; use rosrust_diagnostics::{FrequencyStatus, Level, Status, Task}; mod util; #[test] fn frequency_status_test() { let _roscore = util::run_roscore_for(util::Feature::FrequencyStatusTest); rosrust::init("frequency_status_test"); let fs = FrequencyStatus::builder() .window_size...
); assert_eq!( fs.name(), "Frequency Status", "Name should be \"Frequency Status\"" ); }
assert_eq!(status4.level, Level::Error, "Freshly cleared should fail"); assert_eq!( status0.name, "", "Name should not be set by FrequencyStatus"
random_line_split
frequency_status.rs
use rosrust::Duration; use rosrust_diagnostics::{FrequencyStatus, Level, Status, Task}; mod util; #[test] fn frequency_status_test()
{ let _roscore = util::run_roscore_for(util::Feature::FrequencyStatusTest); rosrust::init("frequency_status_test"); let fs = FrequencyStatus::builder() .window_size(2) .min_frequency(10.0) .max_frequency(20.0) .tolerance(0.5) .build(); fs.tick(); rosrust::sl...
identifier_body
webviewEditor.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
if (this._webview) { this.doUpdateContainer(); } super.layout(dimension); } public focus() { super.focus(); if (this._onFocusWindowHandler) { return; } // Make sure we restore focus when switching back to a VS Code window this._onFocusWindowHandler = this._windowService.onDidChangeFocus(focuse...
random_line_split
webviewEditor.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
() { if (this._webviewFocusTracker) { this._webviewFocusTracker.dispose(); } if (this._webviewFocusListenerDisposable) { this._webviewFocusListenerDisposable.dispose(); } this._webviewFocusTracker = DOM.trackFocus(this._webviewContent); this._webviewFocusListenerDisposable = this._webviewFocusTracker...
trackFocus
identifier_name
webviewEditor.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
if (this._webviewFocusListenerDisposable) { this._webviewFocusListenerDisposable.dispose(); this._webviewFocusListenerDisposable = undefined; } if (this._onFocusWindowHandler) { this._onFocusWindowHandler.dispose(); } super.dispose(); } public sendMessage(data: any): void { if (this._webview...
{ this._webviewFocusTracker.dispose(); this._webviewFocusTracker = undefined; }
conditional_block
mod.rs
extern crate android_glue; use libc; use std::ffi::{CString}; use std::sync::mpsc::{Receiver, channel}; use {CreationError, Event, MouseCursor}; use CreationError::OsError; use events::ElementState::{Pressed, Released}; use events::Event::{MouseInput, MouseMoved}; use events::MouseButton; use std::collections::VecDeq...
(&self) -> bool { unsafe { ffi::egl::GetCurrentContext() == self.context } } pub fn get_proc_address(&self, addr: &str) -> *const () { let addr = CString::from_slice(addr.as_bytes()); let addr = addr.as_ptr(); unsafe { ffi::egl::GetProcAddress(addr) as *const () ...
is_current
identifier_name