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
allocator.rs
use crate::attributes; use libc::c_uint; use rustc_ast::expand::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS}; use rustc_middle::bug; use rustc_middle::ty::TyCtxt; use rustc_session::config::DebugInfo; use rustc_span::symbol::sym; use crate::debuginfo; use crate::llvm::{self, False, True}; use crate::Modu...
{ let llcx = &*module_llvm.llcx; let llmod = module_llvm.llmod(); let usize = match tcx.sess.target.pointer_width { 16 => llvm::LLVMInt16TypeInContext(llcx), 32 => llvm::LLVMInt32TypeInContext(llcx), 64 => llvm::LLVMInt64TypeInContext(llcx), tws => bug!("Unsupported target wo...
identifier_body
allocator.rs
use crate::attributes; use libc::c_uint; use rustc_ast::expand::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS}; use rustc_middle::bug; use rustc_middle::ty::TyCtxt; use rustc_session::config::DebugInfo; use rustc_span::symbol::sym; use crate::debuginfo; use crate::llvm::{self, False, True}; use crate::Modu...
let ty = llvm::LLVMFunctionType(void, args.as_ptr(), args.len() as c_uint, False); let name = "__rust_alloc_error_handler"; let llfn = llvm::LLVMRustGetOrInsertFunction(llmod, name.as_ptr().cast(), name.len(), ty); // -> ! DIFlagNoReturn llvm::Attribute::NoReturn.apply_llfn(llvm::AttributePlace::Fu...
// rust alloc error handler let args = [usize, usize]; // size, align
random_line_split
allocator.rs
use crate::attributes; use libc::c_uint; use rustc_ast::expand::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS}; use rustc_middle::bug; use rustc_middle::ty::TyCtxt; use rustc_session::config::DebugInfo; use rustc_span::symbol::sym; use crate::debuginfo; use crate::llvm::{self, False, True}; use crate::Modu...
( tcx: TyCtxt<'_>, module_llvm: &mut ModuleLlvm, module_name: &str, kind: AllocatorKind, has_alloc_error_handler: bool, ) { let llcx = &*module_llvm.llcx; let llmod = module_llvm.llmod(); let usize = match tcx.sess.target.pointer_width { 16 => llvm::LLVMInt16TypeInContext(llcx), ...
codegen
identifier_name
allocator.rs
use crate::attributes; use libc::c_uint; use rustc_ast::expand::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS}; use rustc_middle::bug; use rustc_middle::ty::TyCtxt; use rustc_session::config::DebugInfo; use rustc_span::symbol::sym; use crate::debuginfo; use crate::llvm::{self, False, True}; use crate::Modu...
else { llvm::LLVMBuildRetVoid(llbuilder); } llvm::LLVMDisposeBuilder(llbuilder); } // rust alloc error handler let args = [usize, usize]; // size, align let ty = llvm::LLVMFunctionType(void, args.as_ptr(), args.len() as c_uint, False); let name = "__rust_alloc_error_ha...
{ llvm::LLVMBuildRet(llbuilder, ret); }
conditional_block
resourceRole.js
/** * @require common:widget/jquery/jqueryEx.js * @require common:widget/utils/underscore.js * @require common:widget/dhtmlxSuite/dhtmlxEx.js */ $(window).resize(function() { GPW.layout.mainLayout.setSizes(); }); var GPC = { url:{ refreshGridUrl:GLOBAL.S.URL+GLOBAL.P.MODULES+"/a/resLoadRole?_value="+GLOBAL....
this.mainToolbarClick(); }, mainToolbarClick:function(){ this.mainToolbar.attachEvent("onClick", function(id) { switch(id) { case GPC.constant.query: var toolbar = GPW.toolbar.mainToolbar; var where = toolbar.getInput("queryName").value; var queryValue = toolbar.getInput("queryValue").val...
this.mainToolbar.addSelectEx("queryName", 1, [{"text":"编码","value":"name"},{"text":"名称","value":"alias"}], 100); toolbar.addInput("queryValue", 3, "", 200); toolbar.addButton("query", 9, "查询", "new.gif", "new_dis.gif"); toolbar.addSeparator("sep1", 10); toolbar.addButton("update", 16, "更新", "new.gif", "new_di...
random_line_split
resourceRole.js
/** * @require common:widget/jquery/jqueryEx.js * @require common:widget/utils/underscore.js * @require common:widget/dhtmlxSuite/dhtmlxEx.js */ $(window).resize(function() { GPW.layout.mainLayout.setSizes(); }); var GPC = { url:{ refreshGridUrl:GLOBAL.S.URL+GLOBAL.P.MODULES+"/a/resLoadRole?_value="+GLOBAL....
Update", function(id, action, tid, element){ if(element instanceof Element){ if(element.getElementsByTagName("code").item(0)!=null){ var code=element.getElementsByTagName("code").item(0).childNodes[0].nodeValue; var message=element.getElementsByTagName("message").item(0).childNodes[0].nodeValue; i...
this.gridDataProcessor.attachEvent("onAfter
conditional_block
import3DS.py
#*************************************************************************** #* * #* Copyright (c) 2016 Yorik van Havre <yorik@uncreated.net> * #* * #* This ...
#* USA * #* * #*************************************************************************** from __future__ import print_function import os,FreeCAD,Mesh __title__="FreeCAD 3DS imp...
#* GNU Library General Public License for more details. * #* * #* You should have received a copy of the GNU Library General Public * #* License along with this program; if not, write to the Free Software * #* Foundat...
random_line_split
import3DS.py
#*************************************************************************** #* * #* Copyright (c) 2016 Yorik van Havre <yorik@uncreated.net> * #* * #* This ...
m = [tuple(r) for r in d_nobj.obj.matrix.array] m = m[0] + m[1] + m[2] + m[3] placement = FreeCAD.Placement(FreeCAD.Matrix(*m)) mesh = Mesh.Mesh(meshdata) obj = FreeCAD.ActiveDocument.addObject("Mesh::Feature","Mesh") obj.Mesh = mesh o...
meshdata.append([verts[int(d_face[i])] for i in xrange(3)])
conditional_block
import3DS.py
#*************************************************************************** #* * #* Copyright (c) 2016 Yorik van Havre <yorik@uncreated.net> * #* * #* This ...
def insert(filename,docname): "called when freecad wants to import a file" if not check3DS(): return try: doc = FreeCAD.getDocument(docname) except NameError: doc = FreeCAD.newDocument(docname) FreeCAD.ActiveDocument = doc read(filename) return doc def decode(na...
"called when freecad wants to open a file" if not check3DS(): return docname = (os.path.splitext(os.path.basename(filename))[0]).encode("utf8") doc = FreeCAD.newDocument(docname) doc.Label = decode(docname) FreeCAD.ActiveDocument = doc read(filename) return doc
identifier_body
import3DS.py
#*************************************************************************** #* * #* Copyright (c) 2016 Yorik van Havre <yorik@uncreated.net> * #* * #* This ...
(): "checks if collada if available" global dom3ds dom3ds = None try: from Dice3DS import dom3ds except ImportError: FreeCAD.Console.PrintError("Dice3DS not found, 3DS support is disabled.\n") return False else: return True def open(filename): "calle...
check3DS
identifier_name
main.rs
#[macro_use] extern crate glium; extern crate glium_text_rusttype as glium_text; extern crate glutin; extern crate winit; use std::io; use std::io::prelude::*; use std::fs::File; use glium::{Surface, Program}; use glium::backend::Facade; use glium::glutin::{Event, WindowEvent}; #[derive(Copy, Clone, Debug, PartialEq...
(_e: io::Error) -> ShaderError { ShaderError } } fn read_file(path: &str) -> io::Result<String> { let mut s = String::new(); let mut f = try!(File::open(path)); try!(f.read_to_string(&mut s)); Ok(s) } fn load_shader_program<F: Facade>(display: &F) -> Result<Program, ShaderError> { let ...
from
identifier_name
main.rs
#[macro_use] extern crate glium; extern crate glium_text_rusttype as glium_text; extern crate glutin; extern crate winit; use std::io; use std::io::prelude::*; use std::fs::File; use glium::{Surface, Program}; use glium::backend::Facade; use glium::glutin::{Event, WindowEvent}; #[derive(Copy, Clone, Debug, PartialEq...
Point { position: ( -1.0, 1.0 ) }, Point { position: ( -1.0, -1.0 ) }, Point { position: ( 1.0, -1.0 ) }, ]; /// Two triangles arranged as a rectangle covering OpenGL screen space. /// All the real work happens in the fragment shader, so we just want to /// run the shader on every pixel. const INDICES: [...
const VERTICES: [Point; 4] = [ Point { position: ( 1.0, 1.0 ) },
random_line_split
main.rs
#[macro_use] extern crate glium; extern crate glium_text_rusttype as glium_text; extern crate glutin; extern crate winit; use std::io; use std::io::prelude::*; use std::fs::File; use glium::{Surface, Program}; use glium::backend::Facade; use glium::glutin::{Event, WindowEvent}; #[derive(Copy, Clone, Debug, PartialEq...
}
{ Err(ShaderError) }
conditional_block
blockDoc.rs
/*! # Iterator * * The heart and soul of this module is the [`Iterator`] trait. The core of * [`Iterator`] looks like this: * * ``` * trait Iterator { * type Item; * fn next(&mut self) -> Option<Self::Item>; * }
* [`Option`]`<Item>`. [`next()`] will return `Some(Item)` as long as there * are elements, and once they've all been exhausted, will return `None` to * indicate that iteration is finished. Individual iterators may choose to * resume iteration, and so calling [`next()`] again may or may not eventually * start ...
* ``` * * An iterator has a method, [`next()`], which when called, returns an
random_line_split
log.js
var fs = require("fs"); var mkdirp = require("mkdirp"); var moment = require("moment"); var Helper = require("./helper"); module.exports.write = function(user, network, chan, msg) { try { var path = Helper.HOME + "/logs/" + user + "/" + network; mkdirp.sync(path); } catch(e) { console.log(e); return; } va...
else { // Format: // [2014-01-01 00:00:00] * Arnold quit line += "* " + msg.from + " " + msg.type; if (msg.text) { line += " " + msg.text; } } fs.appendFile( path + "/" + chan + ".log", line + "\n", function(e) { if (e) { console.log("Log#write():\n" + e) } } ); };
{ // Format: // [2014-01-01 00:00:00] <Arnold> Put that cookie down.. Now!! line += "<" + msg.from + "> " + msg.text; }
conditional_block
log.js
var fs = require("fs"); var mkdirp = require("mkdirp"); var moment = require("moment"); var Helper = require("./helper"); module.exports.write = function(user, network, chan, msg) { try { var path = Helper.HOME + "/logs/" + user + "/" + network; mkdirp.sync(path); } catch(e) { console.log(e); return; } va...
path + "/" + chan + ".log", line + "\n", function(e) { if (e) { console.log("Log#write():\n" + e) } } ); };
fs.appendFile(
random_line_split
admin.py
# (c) Copyright 2017-2019 SUSE LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
(auth_url, username=None, password=None, user_domain_name='Default'): """Authenticate with keystone Creates an unscoped token using the given credentials (which validates them), and then uses that token to get a project-scoped token. """ unscoped_auth = v3.Password(auth_url, ...
_authenticate
identifier_name
admin.py
# (c) Copyright 2017-2019 SUSE LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
@bp.route("/api/v2/connection_test", methods=['POST']) def connection_test(): body = request.get_json() or {} host = body['host'] try: ping(host, 22) return jsonify('Success') except Exception as e: return jsonify(error=str(e)), 404
"""Returns whether authentication is required Returns a json object indicating whether the service is configured to enforce authentication .. :quickref: Model; Returns whether authentication is required **Example Response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: appli...
identifier_body
admin.py
# (c) Copyright 2017-2019 SUSE LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
# Return the first project token that we have the admin role on, otherwise # return the first project token we have any role on. fallback_auth_ref = None for project in projects: auth = v3.Token(auth_url=auth_url, token=unscoped_auth_ref.auth_token, ...
projects.pop(pos) projects.insert(0, project) break
conditional_block
admin.py
# (c) Copyright 2017-2019 SUSE LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
return jsonify('Success') except Exception as e: return jsonify(error=str(e)), 404
random_line_split
appSpec.js
define(function(require) { var App = require('modules/app/app'); var Section = require('component/section'); describe('app', function() { var app, el; beforeEach(function() { el = $('<div></div>'); app = new App({ el: el }); }); afterEach(function...
}); it('triggers the done callback when the setup is finished', function() { var spy = sinon.spy(); app.run(spy); expect(spy).toHaveBeenCalledOnce(); }); }); }); });
random_line_split
RP14part2.js
/* global console, LAMBDA */ (function() { "use strict"; var L = LAMBDA; var question = {}; var RP14part2 = { init: function() { var vs = "uvxyz"; var maxDepth = 5; var minDepth = 4; var exp; var numCorrect = 0; var exps = [ ]; var isCorrect; var options = [ ...
closing--; } var p1 = L.getRnd(0,closing-1); var p2 = L.getRnd(closing+1,n-1); // do not insert in front of a space or a dot if (s[p1] === " " || s[p1] === ".") { p1++; } // do not insert after a lambda if (p1>0 && s[p1-1] === "\u03BB" ) { p1 += 2; } return s.substring(0,p1) + "(" ...
random_line_split
RP14part2.js
/* global console, LAMBDA */ (function() { "use strict"; var L = LAMBDA; var question = {}; var RP14part2 = { init: function() { var vs = "uvxyz"; var maxDepth = 5; var minDepth = 4; var exp; var numCorrect = 0; var exps = [ ]; var isCorrect; var options = [ ...
(s) { var n = s.length; var closing = n-1; while (s[closing] === ')') { closing--; } var p1 = L.getRnd(0,closing-1); var p2 = L.getRnd(closing+1,n-1); // do not insert in front of a space or a dot if (s[p1] === " " || s[p1] === ".") { p1++; } // do not insert after a lambda if (p1>0 &&...
addParens
identifier_name
RP14part2.js
/* global console, LAMBDA */ (function() { "use strict"; var L = LAMBDA; var question = {}; var RP14part2 = { init: function() { var vs = "uvxyz"; var maxDepth = 5; var minDepth = 4; var exp; var numCorrect = 0; var exps = [ ]; var isCorrect; var options = [ ...
while (exps.length < 4) { if (L.getRnd(0,1) === 0) { // syntactically correct lambda exp exps.push( L.printExp( L.getRndExp(1,minDepth,maxDepth,vs,"")) ); isCorrect = true; } else { exps.push( getSyntaxError(minDepth,maxDepth,vs) ); isCorrect = question.answer === "True"; } ...
{ var exp = arr[arr.length-1]; for(var i=0; i<arr.length-1; i++) { if (arr[i] === exp) { return false; } } return true; }
identifier_body
autocomplete_utils.py
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2013, 2014 CERN. # # Invenio is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any...
(name, mapper=None): """Create an autocomplete function from dynamic knowledge base. :param name: Name of knowledge base :param mapper: Function that will map an knowledge base entry to autocomplete entry. """ def inner(dummy_form, dummy_field, term, limit=50): from inven...
kb_dynamic_autocomplete
identifier_name
autocomplete_utils.py
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2013, 2014 CERN. # # Invenio is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any...
return inner def kb_dynamic_autocomplete(name, mapper=None): """Create an autocomplete function from dynamic knowledge base. :param name: Name of knowledge base :param mapper: Function that will map an knowledge base entry to autocomplete entry. """ def inner(dummy_form, du...
return map(mapper, result) if mapper is not None else result
random_line_split
autocomplete_utils.py
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2013, 2014 CERN. # # Invenio is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any...
"""Autocomplete authors from ORCID service.""" if term: orcid = OrcidSearch() orcid.search_authors(term) return orcid.get_authors_names() return []
identifier_body
autocomplete_utils.py
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2013, 2014 CERN. # # Invenio is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any...
return [] def orcid_authors(dummy_form, dummy_field, term, limit=50): """Autocomplete authors from ORCID service.""" if term: orcid = OrcidSearch() orcid.search_authors(term) return orcid.get_authors_names() return []
if isinstance(term, unicode): term = term.encode('utf8') s = SherpaRomeoSearch() journals = s.search_journal(term) if journals is not None: return map(lambda x: {'value': x}, journals[:limit])
conditional_block
html_writer.rs
extern crate marksman_escape; use self::marksman_escape::Escape; use {DomNode, DomNodes, DomValue}; use processors::DomNodeProcessor; // This module as a whole is "use_std"-only, so these don't need to be cfg'd use std::marker::PhantomData; use std::fmt; use std::io; /// Type to use for processing a `DomNode` tree a...
} } add_node } } /// Wrapper struct to allow `DomNode`s to implement `Display` as html #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] pub struct HtmlDisplayable<'a, M, T: DomNode<M> + 'a>(pub &'a T, pub PhantomData<M>); impl<'a, M, T: DomNode<M>> fmt::Display for ...
{ for escaped_u8 in Escape::new(text.bytes()) { w.write(&[escaped_u8])?; } Ok(()) }
conditional_block
html_writer.rs
extern crate marksman_escape; use self::marksman_escape::Escape; use {DomNode, DomNodes, DomValue}; use processors::DomNodeProcessor; // This module as a whole is "use_std"-only, so these don't need to be cfg'd use std::marker::PhantomData; use std::fmt; use std::io; /// Type to use for processing a `DomNode` tree a...
impl<'a, M, T: DomNode<M>> fmt::Display for HtmlDisplayable<'a, M, T> { fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> { // TODO the extra string allocation here is almost certainly avoidable let mut string_buffer = Vec::new(); self.0.write_html(&mut string_buffer) ...
/// Wrapper struct to allow `DomNode`s to implement `Display` as html #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] pub struct HtmlDisplayable<'a, M, T: DomNode<M> + 'a>(pub &'a T, pub PhantomData<M>);
random_line_split
html_writer.rs
extern crate marksman_escape; use self::marksman_escape::Escape; use {DomNode, DomNodes, DomValue}; use processors::DomNodeProcessor; // This module as a whole is "use_std"-only, so these don't need to be cfg'd use std::marker::PhantomData; use std::fmt; use std::io; /// Type to use for processing a `DomNode` tree a...
}
{ // TODO the extra string allocation here is almost certainly avoidable let mut string_buffer = Vec::new(); self.0.write_html(&mut string_buffer) .map_err(|_| fmt::Error)?; let string = String::from_utf8(string_buffer) .map_err(|_| fmt::Error)?; formatter...
identifier_body
html_writer.rs
extern crate marksman_escape; use self::marksman_escape::Escape; use {DomNode, DomNodes, DomValue}; use processors::DomNodeProcessor; // This module as a whole is "use_std"-only, so these don't need to be cfg'd use std::marker::PhantomData; use std::fmt; use std::io; /// Type to use for processing a `DomNode` tree a...
<'a, M, T: DomNode<M> + 'a>(pub &'a T, pub PhantomData<M>); impl<'a, M, T: DomNode<M>> fmt::Display for HtmlDisplayable<'a, M, T> { fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> { // TODO the extra string allocation here is almost certainly avoidable let mut string_buffer ...
HtmlDisplayable
identifier_name
tetrahedronGeometry.ts
import {TetrahedronBufferGeometry, TetrahedronGeometry} from "three"; import {createGeometryAndBufferGeometryDescriptors} from "../../common/createGeometryDescriptor"; import {IThreeElementPropsBase} from "../../common/IReactThreeRendererElement"; export interface ITetrahedronGeometryProps { radius?: number; detai...
namespace JSX { interface IntrinsicElements { tetrahedronGeometry: IThreeElementPropsBase<TetrahedronGeometry> & ITetrahedronGeometryProps; tetrahedronBufferGeometry: IThreeElementPropsBase<TetrahedronBufferGeometry> & ITetrahedronGeometryProps; } } } export const { bufferGeometryDescriptor, ge...
declare global {
random_line_split
generation.py
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
class PatchExampleDoFn(beam.DoFn): """Extracts labeled patches from generated VexFlow music scores.""" def __init__(self, negative_example_distance, patch_width, negative_to_positive_example_ratio, noise_fn=lambda x: x): self.negative_example_dista...
svg_to_png_command = list(self.svg_to_png_command) svg_to_png_command[0] = _normalize_path(svg_to_png_command[0]) popen = subprocess.Popen( svg_to_png_command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = popen.communicate(input=svg)...
identifier_body
generation.py
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
yield example self.patch_counter.inc() def _create_example(self, staffline, x, label): start_x = x - self.patch_width // 2 limit_x = x + self.patch_width // 2 + 1 assert limit_x - start_x == self.patch_width # x is the last axis of staffline if 0 <= start_x <= limit_x < staffline.shap...
negative_example_x = negative_example_x[negative_example_inds] for staffline, x in zip(negative_example_staffline, negative_example_x): example = self._create_example(stafflines[0, staffline], x, musicscore_pb2.Glyph.NONE) assert example, 'Negative example xs sho...
random_line_split
generation.py
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
(self, item): png_contents, staff_message = item staff_message = musicscore_pb2.Staff.FromString(staff_message) with tf.Session(graph=self.omr.graph) as sess: # Load the image, then feed it in to apply noise. # Randomly rotate the image and apply noise, then dump it back out as a # PNG. ...
process
identifier_name
generation.py
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
for example in random.sample(all_positive_examples, POSITIVE_EXAMPLES_PER_IMAGE): yield example self.patch_counter.inc() negative_example_staffline, negative_example_x = np.where( negative_example_whitelist) negative_example_inds = np.random.choice( ...
staffline_index = staffline_extractor.y_position_to_index( glyph.y_position, stafflines.shape[staffline_extractor.Axes.POSITION]) # Blacklist the area adjacent to the glyph, even if it is not selected # as a positive example below. negative_example_whitelist[staffline_ind...
conditional_block
request.validator.js
'use strict'; let Joi = require('joi'); class RequestVaildator { getListParameterValidator() { return { type: Joi.any().valid(process.env.TEMPLATE_PARTS.split(',')) } } getListQueryValidator() { return { page: Joi.number().min(1), limit: Joi.number().min(parseInt(process.env.PAGI...
getUpdateValidator() { let updateValidator = this.getPostValidator(); updateValidator.id = Joi.string().alphanum().min(24); return updateValidator; } } module.exports = new RequestVaildator();
{ return { name: Joi.string().min(5).max(35).required(), group: Joi.any().valid(process.env.TEMPLATE_PARTS.split(',')).required(), subgroup: Joi.string().min(3).max(35), content: Joi.object().keys({ html: Joi.string().required(), css: Joi.string(), js: Joi.string(), ...
identifier_body
request.validator.js
'use strict'; let Joi = require('joi'); class
{ getListParameterValidator() { return { type: Joi.any().valid(process.env.TEMPLATE_PARTS.split(',')) } } getListQueryValidator() { return { page: Joi.number().min(1), limit: Joi.number().min(parseInt(process.env.PAGINATION_LIMIT)) } } getPostValidator() { return { ...
RequestVaildator
identifier_name
request.validator.js
'use strict'; let Joi = require('joi'); class RequestVaildator { getListParameterValidator() { return { type: Joi.any().valid(process.env.TEMPLATE_PARTS.split(',')) } } getListQueryValidator() { return { page: Joi.number().min(1), limit: Joi.number().min(parseInt(process.env.PAGI...
getPostValidator() { return { name: Joi.string().min(5).max(35).required(), group: Joi.any().valid(process.env.TEMPLATE_PARTS.split(',')).required(), subgroup: Joi.string().min(3).max(35), content: Joi.object().keys({ html: Joi.string().required(), css: Joi.string(), ...
random_line_split
resized_fuse_test.py
# coding=utf-8 # Copyright 2022 The Deeplab2 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 ...
tf.test.main()
conditional_block
resized_fuse_test.py
# coding=utf-8 # Copyright 2022 The Deeplab2 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 ...
if __name__ == '__main__': tf.test.main()
batch, height, width, channels = 2, 11, 11, 6 smaller_height, smaller_width, smaller_channels = 6, 6, 3 larger_height1, larger_width1 = 21, 21 # Stride 2 conv. larger_height2, larger_width2 = 22, 22 # Stride 2 conv. larger_height3, larger_width3 = 23, 23 # Conv and resize. feature_list = [] ...
identifier_body
resized_fuse_test.py
# coding=utf-8 # Copyright 2022 The Deeplab2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. "...
# You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0
random_line_split
resized_fuse_test.py
# coding=utf-8 # Copyright 2022 The Deeplab2 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 ...
(self): batch, height, width, channels = 2, 11, 11, 6 smaller_height, smaller_width, smaller_channels = 6, 6, 3 larger_height1, larger_width1 = 21, 21 # Stride 2 conv. larger_height2, larger_width2 = 22, 22 # Stride 2 conv. larger_height3, larger_width3 = 23, 23 # Conv and resize. feature_li...
test_resize_and_fuse_features
identifier_name
models.py
from amon.apps.core.basemodel import BaseModel class BaseDeviceModel(BaseModel): def __init__(self): super(BaseDeviceModel, self).__init__() self.collection = self.mongo.get_collection(self.collection_name) # Pylint displays errors for undefined self, it actually works fine def get_by_name(...
for device in valid_devices: device_object = self.get_or_create(server_id=server_id, name=device) device_id = device_object.get('_id') try: device_data = formated_data[device] except: device_data = None if device_da...
valid_devices = filter(lambda x: x not in ['time','last','lo'], device_list)
random_line_split
models.py
from amon.apps.core.basemodel import BaseModel class BaseDeviceModel(BaseModel): def __init__(self): super(BaseDeviceModel, self).__init__() self.collection = self.mongo.get_collection(self.collection_name) # Pylint displays errors for undefined self, it actually works fine def get_by_name(...
(self): self.device_type = 'volume' self.collection_name = 'volumes' super(VolumesModel, self).__init__() volumes_model = VolumesModel() interfaces_model = InterfacesModel()
__init__
identifier_name
models.py
from amon.apps.core.basemodel import BaseModel class BaseDeviceModel(BaseModel): def __init__(self): super(BaseDeviceModel, self).__init__() self.collection = self.mongo.get_collection(self.collection_name) # Pylint displays errors for undefined self, it actually works fine def get_by_name(...
return result def get_check_for_timestamp(self, server, timestamp): result_dict = {} server_id = server['_id'] devices = self.get_all_for_server(server_id=server_id) data_collection = self.get_data_collection(server_id=server_id) if devices: for devi...
result = self.collection.find({"server_id": server_id})
conditional_block
models.py
from amon.apps.core.basemodel import BaseModel class BaseDeviceModel(BaseModel): def __init__(self): super(BaseDeviceModel, self).__init__() self.collection = self.mongo.get_collection(self.collection_name) # Pylint displays errors for undefined self, it actually works fine def get_by_name(...
volumes_model = VolumesModel() interfaces_model = InterfacesModel()
def __init__(self): self.device_type = 'volume' self.collection_name = 'volumes' super(VolumesModel, self).__init__()
identifier_body
index.tsx
import * as React from 'react' import * as Kb from '../../../../../../common-adapters/index' import * as Styles from '../../../../../../styles' import {formatTimeForMessages} from '../../../../../../util/timestamp' import UnfurlImage from '../image' export type Props = { isCollapsed: boolean title: string url: s...
type="iconfont-close" onClick={onClose} style={styles.closeBox} padding="xtiny" className="unfurl-closebox" fontSize={12} /> )} </Kb.Box2> <Kb.Text type="BodyPrimaryLink" style={styles.url} onClickU...
{!!onClose && ( <Kb.Icon
random_line_split
auto_grader.py
#! /usr/bin/python import os, sys, glob, time, subprocess, signal import popen2 subdirectories = ['first', 'second', 'third', 'fourth', 'fifth'] formats = {'first':'line', 'second':'line', 'third':'file', 'fourth':'file', 'fifth':'file'}# if a program has single liner input and output, we put all test cases in single...
(dirname): print "Grading", dirname prevdir = os.getcwd() os.chdir(dirname) make_executable(dirname) if not os.path.isfile(dirname): print "Executable %s missing. Please check the compilation output."%(dirname) return if not os.path.isfile("test.txt"): print "Expecting th...
single_grade
identifier_name
auto_grader.py
#! /usr/bin/python import os, sys, glob, time, subprocess, signal import popen2 subdirectories = ['first', 'second', 'third', 'fourth', 'fifth'] formats = {'first':'line', 'second':'line', 'third':'file', 'fourth':'file', 'fifth':'file'}# if a program has single liner input and output, we put all test cases in single...
def run_command(command_string, input_string="", max_lines=0, verbose=False, echo=True, throw_exception=True, return_valgrind_output=False, user_program=False): if echo: print "executing:", command_string obj = popen2.Popen4(command_string) output = "" valgrind_output = "" obj.tochild.wri...
def __init__(self, command, output): self.command = command limit = 10000 if(len(output) > limit): self.output = output[:limit/2] + "\n\n...TRUNCATED...\n\n" + output[-limit/2:] else: self.output = output def __str__(self): return "ExperimentError:" + `sel...
identifier_body
auto_grader.py
#! /usr/bin/python import os, sys, glob, time, subprocess, signal import popen2 subdirectories = ['first', 'second', 'third', 'fourth', 'fifth'] formats = {'first':'line', 'second':'line', 'third':'file', 'fourth':'file', 'fifth':'file'}# if a program has single liner input and output, we put all test cases in single...
def __str__(self): return "ExperimentError:" + `self.command` def run_command(command_string, input_string="", max_lines=0, verbose=False, echo=True, throw_exception=True, return_valgrind_output=False, user_program=False): if echo: print "executing:", command_string obj = popen2.Popen4(com...
self.output = output
conditional_block
auto_grader.py
#! /usr/bin/python import os, sys, glob, time, subprocess, signal import popen2 subdirectories = ['first', 'second', 'third', 'fourth', 'fifth'] formats = {'first':'line', 'second':'line', 'third':'file', 'fourth':'file', 'fifth':'file'}# if a program has single liner input and output, we put all test cases in single...
i=0 flag=True for line in fd: if i<len(test_list): if line.strip()!=test_list[i].strip(): flag=False elif len(line.strip())>0: print "Output missing: ", line flag=False i+=1 fd.close() while(i<len(te...
def compare_string_file(ref_file, test_string, show_difference=False): test_list=test_string.split("\n") fd = open(ref_file)
random_line_split
global.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.run = undefined; var _asyncToGenerator2; function _load_asyncToGenerator() { return _asyncToGenerator2 = _interopRequireDefault(require('babel-runtime/helpers/asyncToGenerator')); } let updateCwd = (() => { var _ref = (0, (_a...
function _load_upgrade() { return _upgrade = require('./upgrade.js'); } var _packageLinker; function _load_packageLinker() { return _packageLinker = require('../../package-linker.js'); } var _fs; function _load_fs() { return _fs = _interopRequireWildcard(require('../../util/fs.js')); } function _interopRequ...
var _upgrade;
random_line_split
global.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.run = undefined; var _asyncToGenerator2; function _load_asyncToGenerator() { return _asyncToGenerator2 = _interopRequireDefault(require('babel-runtime/helpers/asyncToGenerator')); } let updateCwd = (() => { var _ref = (0, (_a...
var _install; function _load_install() { return _install = require('./install.js'); } var _add; function _load_add() { return _add = require('./add.js'); } var _remove; function _load_remove() { return _remove = require('./remove.js'); } var _upgrade; function _load_upgrade() { return _upgrade = requir...
{ return _wrapper = _interopRequireDefault(require('../../lockfile/wrapper.js')); }
identifier_body
global.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.run = undefined; var _asyncToGenerator2; function _load_asyncToGenerator() { return _asyncToGenerator2 = _interopRequireDefault(require('babel-runtime/helpers/asyncToGenerator')); } let updateCwd = (() => { var _ref = (0, (_a...
(flags, args) { return args[0] !== 'bin'; } function getGlobalPrefix(config, flags) { if (flags.prefix) { return flags.prefix; } else if (config.getOption('prefix')) { return String(config.getOption('prefix')); } else if (process.env.PREFIX) { return process.env.PREFIX; } else if (process.platfor...
hasWrapper
identifier_name
global.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.run = undefined; var _asyncToGenerator2; function _load_asyncToGenerator() { return _asyncToGenerator2 = _interopRequireDefault(require('babel-runtime/helpers/asyncToGenerator')); } let updateCwd = (() => { var _ref = (0, (_a...
else { return path.resolve(prefix, 'bin'); } } function ls(manifest, reporter, saved) { const bins = manifest.bin ? Object.keys(manifest.bin) : []; const human = `${manifest.name}@${manifest.version}`; if (bins.length) { if (saved) { reporter.success(reporter.lang('packageInstalledWithBinaries',...
{ return prefix; }
conditional_block
ssdp.js
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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/. */ (function(global) { // Spec in...
this._searchSocket.opened.then((function() { // Perform a UDP broadcast to search for SSDP devices this._searchTimeout = setTimeout(this._searchShutdown.bind(this), SSDP_DISCOVER_MX * 1000); var data = SSDP_DISCOVER_PACKET; this._targets.forEach((function(target) { var...
{ this._searchSocket = new UDPSocket({loopback: true}); this._searchSocket.joinMulticastGroup(SSDP_ADDRESS); this._searchSocket.onmessage = this._onmessage.bind(this); }
conditional_block
ssdp.js
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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/. */ (function(global) { // Spec in...
if (!this._callbacks.hasOwnProperty(type)) { return; } var callbacks = this._callbacks[type]; var index = callbacks.indexOf(callback); if (index >= 0) { callbacks.splice(index, 1); } }, dispatchEvent: function(event) { if (this._callbacks.hasOwnProperty...
} this._callbacks[type].push(callback); }, removeEventListener: function(type, callback, capture) {
random_line_split
ssdp.js
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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/. */ (function(global) { // Spec in...
, // EventTarget addEventListener: function(type, callback, capture) { if (!this._callbacks.hasOwnProperty(type)) { return; } this._callbacks[type].push(callback); }, removeEventListener: function(type, callback, capture) { if (!this._callbacks.hasOwnProperty(type)) { ...
{ this.addEventListener('notify', callback); }
identifier_body
ssdp.js
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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/. */ (function(global) { // Spec in...
(types) { var needSearch = {}; types.forEach(function(type) { var found = Object.keys(targetRegister).find(function(prefix) { return type.startsWith(prefix); }); if (found) { targetRegister[found].register(type); if (!needSearch.hasOwnProperty(found)) { needSe...
_register
identifier_name
web-contents-context-menu.ts
import electron from "electron"; import { actions } from "common/actions"; import { Store } from "common/types"; import IntlMessageFormat from "intl-messageformat"; import env from "common/env"; import { _ } from "renderer/t"; import { t } from "common/format/t"; const emptyObj: any = {}; export function hookWebCon...
const editFlags = props.editFlags; const hasText = props.selectionText.trim().length > 0; const can = (type: string) => ((editFlags as any)[`can${type}`] as boolean) && hasText; let menuTpl: Electron.MenuItemConstructorOptions[] = [ { type: "separator", }, { id: ...
const { i18n } = store.getState();
random_line_split
web-contents-context-menu.ts
import electron from "electron"; import { actions } from "common/actions"; import { Store } from "common/types"; import IntlMessageFormat from "intl-messageformat"; import env from "common/env"; import { _ } from "renderer/t"; import { t } from "common/format/t"; const emptyObj: any = {}; export function hookWebCon...
, }); } if (menuTpl.length > 0) { const menu = (electron.Menu || electron.remote.Menu).buildFromTemplate( menuTpl as any ); menu.popup({}); } }); } function delUnusedElements(menuTpl: Electron.MenuItemConstructorOptions[]) { let notDeletedPrevEl: Electron.MenuItemConst...
{ store.dispatch( actions.inspect({ webContentsId: wc.id, x: props.x, y: props.y, }) ); }
identifier_body
web-contents-context-menu.ts
import electron from "electron"; import { actions } from "common/actions"; import { Store } from "common/types"; import IntlMessageFormat from "intl-messageformat"; import env from "common/env"; import { _ } from "renderer/t"; import { t } from "common/format/t"; const emptyObj: any = {}; export function hookWebCon...
// filter out leading/trailing separators // TODO: https://github.com/electron/electron/issues/5869 menuTpl = delUnusedElements(menuTpl); if (env.development) { menuTpl.push({ id: "inspect", label: t(i18n, _("web.context_menu.inspect")), click() { store.dispatc...
{ menuTpl = []; if (store.getState().preferences.enableTabs) { menuTpl = [ ...menuTpl, { type: "separator", }, { id: "openInNewTab", label: t(i18n, _("web.context_menu.open_in_new_tab")), click() { ...
conditional_block
web-contents-context-menu.ts
import electron from "electron"; import { actions } from "common/actions"; import { Store } from "common/types"; import IntlMessageFormat from "intl-messageformat"; import env from "common/env"; import { _ } from "renderer/t"; import { t } from "common/format/t"; const emptyObj: any = {}; export function hookWebCon...
() { store.dispatch( actions.navigate({ wind, url: props.linkURL, background: true, }) ); }, }, ]; } menuTpl = [ ...menuTpl, { type: "sep...
click
identifier_name
index.js
/** * Error parser for apeman. * @module apemanerror * @version 5.3.2 */ 'use strict'; var _assign = require('babel-runtime/core-js/object/assign'); var _assign2 = _interopRequireDefault(_assign); function _interopRequireDefault(obj)
var apemanerror = require('./apemanerror'); var buildin = require('./buildin'); var lib = apemanerror.bind(undefined); (0, _assign2.default)(lib, apemanerror, { buildin: buildin }); module.exports = lib; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjp...
{ return obj && obj.__esModule ? obj : { default: obj }; }
identifier_body
index.js
/** * Error parser for apeman. * @module apemanerror * @version 5.3.2 */ 'use strict'; var _assign = require('babel-runtime/core-js/object/assign'); var _assign2 = _interopRequireDefault(_assign); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var apemanerror = ...
module.exports = lib; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbImFwZW1hbmVycm9yIiwicmVxdWlyZSIsImJ1aWxkaW4iLCJsaWIiLCJiaW5kIiwibW9kdWxlIiwiZXhwb3J0cyJdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztBQU1BOzs7Ozs7OztBQUVBLElBQU1BLGNBQWNDLFFBQVEsZUFBUixDQUFwQjtBQUNBLElB...
random_line_split
index.js
/** * Error parser for apeman. * @module apemanerror * @version 5.3.2 */ 'use strict'; var _assign = require('babel-runtime/core-js/object/assign'); var _assign2 = _interopRequireDefault(_assign); function
(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var apemanerror = require('./apemanerror'); var buildin = require('./buildin'); var lib = apemanerror.bind(undefined); (0, _assign2.default)(lib, apemanerror, { buildin: buildin }); module.exports = lib; //# sourceMappingURL=data:application/json;ba...
_interopRequireDefault
identifier_name
CustomTabBar.js
import React from 'react'; import { StyleSheet, Text, TouchableOpacity, View, Animated } from 'react-native'; const propTypes = { goToPage: React.PropTypes.func, activeTab: React.PropTypes.number, tabs: React.PropTypes.array, underlineColor: React.PropTypes.string, backgroundColor: React.PropType...
() { var containerWidth = this.props.containerWidth; var numberOfTabs = this.props.tabs.length; let tabUnderlineStyle = { position: 'absolute', width: containerWidth / numberOfTabs, height: 2, backgroundColor: this.props.underlineColor || "navy", bottom: 0 }; var left =...
render
identifier_name
CustomTabBar.js
import React from 'react'; import { StyleSheet, Text, TouchableOpacity, View, Animated } from 'react-native'; const propTypes = { goToPage: React.PropTypes.func, activeTab: React.PropTypes.number, tabs: React.PropTypes.array, underlineColor: React.PropTypes.string, backgroundColor: React.PropType...
}); return ( <View style={[styles.tabs, {backgroundColor: this.props.backgroundColor || null}]}> {this.props.tabs.map((tab, i) => this.renderTabOption(tab, i))} <Animated.View style={[tabUnderlineStyle, {left}]} /> </View> ); } } let styles = StyleSheet.create({ tab: { f...
backgroundColor: this.props.underlineColor || "navy", bottom: 0 }; var left = this.props.scrollValue.interpolate({ inputRange: [0, 1], outputRange: [0, containerWidth / numberOfTabs]
random_line_split
CustomTabBar.js
import React from 'react'; import { StyleSheet, Text, TouchableOpacity, View, Animated } from 'react-native'; const propTypes = { goToPage: React.PropTypes.func, activeTab: React.PropTypes.number, tabs: React.PropTypes.array, underlineColor: React.PropTypes.string, backgroundColor: React.PropType...
} let styles = StyleSheet.create({ tab: { flex: 1, alignItems: 'center', justifyContent: 'center' }, tabs: { height: 50, flexDirection: 'row', justifyContent: 'space-around', borderWidth: 1, borderTopWidth: 0, borderLeftWidth: 0, borderRightWidth: 0, borderBottomColor...
{ var containerWidth = this.props.containerWidth; var numberOfTabs = this.props.tabs.length; let tabUnderlineStyle = { position: 'absolute', width: containerWidth / numberOfTabs, height: 2, backgroundColor: this.props.underlineColor || "navy", bottom: 0 }; var left = th...
identifier_body
serialization.test.ts
import { expect } from "chai"; import { TargetTypeEnum } from "../../src/constants/literal_types"; import { Target } from "../../src/planning/target"; import { getFunctionName, getSymbolDescription, listMetadataForTarget } from "../../src/utils/serialization"; describe("Serialization", () => { it("Should ret...
});
random_line_split
serialization.test.ts
import { expect } from "chai"; import { TargetTypeEnum } from "../../src/constants/literal_types"; import { Target } from "../../src/planning/target"; import { getFunctionName, getSymbolDescription, listMetadataForTarget } from "../../src/utils/serialization"; describe("Serialization", () => { it("Should ret...
expect(getFunctionName(testFunction)).eql("testFunction"); }); it("Should return a good function name by using the regex", () => { const testFunction = { name: null }; testFunction.toString = () => "function testFunction"; expect(getFunctionName(testFunction)).eql("testFuncti...
{ return false; }
identifier_body
serialization.test.ts
import { expect } from "chai"; import { TargetTypeEnum } from "../../src/constants/literal_types"; import { Target } from "../../src/planning/target"; import { getFunctionName, getSymbolDescription, listMetadataForTarget } from "../../src/utils/serialization"; describe("Serialization", () => { it("Should ret...
() { return false; } expect(getFunctionName(testFunction)).eql("testFunction"); }); it("Should return a good function name by using the regex", () => { const testFunction = { name: null }; testFunction.toString = () => "function testFunction"; expect(getFunctionNam...
testFunction
identifier_name
__init__.py
#!/usr/bin/env python # encoding: utf-8 """ __init__.py The MIT License (MIT) Copyright (c) 2013 Matt Ryan 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 ...
(self, queue_name): self.queue_name = queue_name self.queue_handle = stomp.Connection() self.queue_handle.start() self.queue_handle.connect() self.queue_handle.subscribe(destination=queue_name, ack='auto') def __del__(self): self.queue_handle.disconnect() def put(self, msg): self.queue_handle.send(msg, ...
__init__
identifier_name
__init__.py
#!/usr/bin/env python # encoding: utf-8 """ __init__.py The MIT License (MIT) Copyright (c) 2013 Matt Ryan 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 ...
pass
conditional_block
__init__.py
#!/usr/bin/env python # encoding: utf-8 """ __init__.py The MIT License (MIT) Copyright (c) 2013 Matt Ryan 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 ...
def put(self, msg): self.queue_handle.send(msg, destination=self.queue_name) class BasicHandler: '''Represents an ActiveMQ handler that consumes information from the queue. ''' def __init__(self, aflib, queue_name): self.aflib = aflib self.queue_name = queue_name self.queue_handle = stomp.Connection() ...
self.queue_handle.disconnect()
identifier_body
__init__.py
#!/usr/bin/env python # encoding: utf-8 """ __init__.py The MIT License (MIT) Copyright (c) 2013 Matt Ryan 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 ...
def __del__(self): self.queue_handle.disconnect() def put(self, msg): self.queue_handle.send(msg, destination=self.queue_name) class BasicHandler: '''Represents an ActiveMQ handler that consumes information from the queue. ''' def __init__(self, aflib, queue_name): self.aflib = aflib self.queue_name = ...
self.queue_handle.connect() self.queue_handle.subscribe(destination=queue_name, ack='auto')
random_line_split
index.js
import Vue from 'vue'; import merge from 'element-ui/src/utils/merge'; import PopupManager from 'element-ui/src/utils/popup/popup-manager'; import getScrollBarWidth from '../scrollbar-width'; let idSeed = 1; const transitions = []; const hookTransition = (transition) => { if (transitions.indexOf(transition) !== -1)...
if (dom.nodeType === 3) { dom = dom.nextElementSibling || dom.nextSibling; getDOM(dom); } return dom; }; export default { model: { prop: 'visible', event: 'visible-change' }, props: { visible: { type: Boolean, default: false }, transition: { type: String, ...
let scrollBarWidth; const getDOM = function(dom) {
random_line_split
index.js
import Vue from 'vue'; import merge from 'element-ui/src/utils/merge'; import PopupManager from 'element-ui/src/utils/popup/popup-manager'; import getScrollBarWidth from '../scrollbar-width'; let idSeed = 1; const transitions = []; const hookTransition = (transition) => { if (transitions.indexOf(transition) !== -1)...
, doOpen(props) { if (this.$isServer) return; if (this.willOpen && !this.willOpen()) return; if (this.opened) return; this._opening = true; this.$emit('visible-change', true); const dom = getDOM(this.$el); const modal = props.modal; const zIndex = props.zIndex; ...
{ if (!this.rendered) { this.rendered = true; this.$emit('visible-change', true); } const props = merge({}, this.$props || this, options); if (this._closeTimer) { clearTimeout(this._closeTimer); this._closeTimer = null; } clearTimeout(this._openTimer...
identifier_body
index.js
import Vue from 'vue'; import merge from 'element-ui/src/utils/merge'; import PopupManager from 'element-ui/src/utils/popup/popup-manager'; import getScrollBarWidth from '../scrollbar-width'; let idSeed = 1; const transitions = []; const hookTransition = (transition) => { if (transitions.indexOf(transition) !== -1)...
() { this._opening = false; }, close() { if (this.willClose && !this.willClose()) return; if (this._openTimer !== null) { clearTimeout(this._openTimer); this._openTimer = null; } clearTimeout(this._closeTimer); const closeDelay = Number(this.closeDelay); ...
doAfterOpen
identifier_name
imooc_requests_urllib.py
#__*__coding:utf-8__*__ import urllib import urllib2 URL_IP = 'http://127.0.0.1:8000/ip' URL_GET = 'http://127.0.0.1:8000/get' def use_simple_urllib2(): response = urllib2.urlopen(URL_IP) print '>>>>Response Headers:' print response.info() print '>>>>Response Body:' print ''.join([line for line i...
: print '>>>Use simple urllib2:' use_simple_urllib2() print print '>>>Use params urllib2:' use_params_urllib2()
lib.urlencode({'param1':'hello','param2':'world'}) print 'Request Params:' print params #发送请求 response = urllib2.urlopen('?'.join([URL_GET, '%s']) % params) #处理响应 print '>>>>Response Headers:' print response.info() print '>>>>Status Code:' print response.getcode() print '>>>>Resp...
identifier_body
imooc_requests_urllib.py
#__*__coding:utf-8__*__ import urllib import urllib2 URL_IP = 'http://127.0.0.1:8000/ip' URL_GET = 'http://127.0.0.1:8000/get' def
(): response = urllib2.urlopen(URL_IP) print '>>>>Response Headers:' print response.info() print '>>>>Response Body:' print ''.join([line for line in response.readlines()]) def use_params_urllib2(): #构建请求参数 params = urllib.urlencode({'param1':'hello','param2':'world'}) print 'Request Pa...
use_simple_urllib2
identifier_name
imooc_requests_urllib.py
#__*__coding:utf-8__*__ import urllib import urllib2 URL_IP = 'http://127.0.0.1:8000/ip' URL_GET = 'http://127.0.0.1:8000/get' def use_simple_urllib2(): response = urllib2.urlopen(URL_IP) print '>>>>Response Headers:' print response.info() print '>>>>Response Body:' print ''.join([line for line i...
use_params_urllib2()
print print '>>>Use params urllib2:'
random_line_split
imooc_requests_urllib.py
#__*__coding:utf-8__*__ import urllib import urllib2 URL_IP = 'http://127.0.0.1:8000/ip' URL_GET = 'http://127.0.0.1:8000/get' def use_simple_urllib2(): response = urllib2.urlopen(URL_IP) print '>>>>Response Headers:' print response.info() print '>>>>Response Body:' print ''.join([line for line i...
:' use_simple_urllib2() print print '>>>Use params urllib2:' use_params_urllib2()
conditional_block
load_instructions.rs
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 extern crate test_generation; use test_generation::abstract_state::{AbstractState, AbstractValue}; use vm::file_format::{Bytecode, ConstantPoolIndex, SignatureToken}; mod common; #[test] fn bytecode_ldu64() { let state1 = Abstract...
{ let state1 = AbstractState::new(); let (state2, _) = common::run_instruction(Bytecode::LdConst(ConstantPoolIndex::new(0)), state1); assert_eq!( state2.stack_peek(0), Some(AbstractValue::new_primitive(SignatureToken::Address)), "stack type postcondition not met" ); }
identifier_body
load_instructions.rs
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 extern crate test_generation; use test_generation::abstract_state::{AbstractState, AbstractValue}; use vm::file_format::{Bytecode, ConstantPoolIndex, SignatureToken}; mod common; #[test] fn bytecode_ldu64() { let state1 = Abstract...
() { let state1 = AbstractState::new(); let (state2, _) = common::run_instruction(Bytecode::LdConst(ConstantPoolIndex::new(0)), state1); assert_eq!( state2.stack_peek(0), Some(AbstractValue::new_primitive(SignatureToken::Address)), "stack type postcondition not met" ); }
bytecode_ldconst
identifier_name
load_instructions.rs
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0
#[test] fn bytecode_ldu64() { let state1 = AbstractState::new(); let (state2, _) = common::run_instruction(Bytecode::LdU64(0), state1); assert_eq!( state2.stack_peek(0), Some(AbstractValue::new_primitive(SignatureToken::U64)), "stack type postcondition not met" ); } #[test] fn ...
extern crate test_generation; use test_generation::abstract_state::{AbstractState, AbstractValue}; use vm::file_format::{Bytecode, ConstantPoolIndex, SignatureToken}; mod common;
random_line_split
lib.rs
#![cfg(any( target_os = "windows", target_os = "linux", target_os = "android", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd" ))] #![allow(non_camel_case_types)] pub mod egl { pub type khronos_utime_nanoseconds_t = super::khronos_utime_nanose...
include!(concat!(env!("OUT_DIR"), "/egl_bindings.rs")); } pub use self::egl::types::EGLContext; pub use self::egl::types::EGLDisplay; use std::os::raw; pub type khronos_utime_nanoseconds_t = khronos_uint64_t; pub type khronos_uint64_t = u64; pub type khronos_ssize_t = raw::c_long; pub type EGLint = i32; pub typ...
pub type NativeDisplayType = super::EGLNativeDisplayType; pub type NativePixmapType = super::EGLNativePixmapType; pub type NativeWindowType = super::EGLNativeWindowType;
random_line_split
register.js
// Get the registration <form> element from the DOM. var form = document.getElementById("registration-form"); var submitButton = form.querySelector("button"); // TODO: Get the password <input> elements from the DOM by ID // var passwordInput = ...; // var confirmPasswordInput = ...; var checkPasswords = function...
// SIG // Jy+B+ngNzVSNTLm1S1Z55aoQw6itwCgMwwAlhENOsSnu // SIG // 0r/sKjkmwoLmTy7QxJ0bkkj8lR5MRA2xxXINfBoOY/Rr // SIG // ziYKDUWNWIZlMwaqCXszkdYi31ZJFS0g4HKjRD4inVJz // SIG // KVJbdUhtryLtU8mDCu10k8IF5Ljw4D/aFWllC3ArBIrZ // SIG // DjAR0GQe/ooke7ttvPo= // SIG // End signature block
// SIG // Q0g/8WtPgq63LrqxruHLqliyblcmQr5+BS6zhCqDUaQF // SIG // oJpEzCZKV4oi2+UA8B73muVJbjY63lHdFAxvM3YHICpV // SIG // hePwgVj0hjqS+df3wHgJvjuUiyN2F9pdq3AzwxG3W6uh
random_line_split
signin.state.js
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
templateUrl, resolve: { user: ['$state', 'User', ($state, User) => { return User.read() .then(() => $state.go('base.configuration.clusters')) .catch(() => {}); }] }, controllerAs: '$ctrl', controller(...
.state('signin', { url: '/',
random_line_split
signin.state.js
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
, metaTags: { } }); }]);
{}
identifier_body
signin.state.js
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
() {}, metaTags: { } }); }]);
controller
identifier_name
test_get_neighborhoods.py
#!/usr/bin/env python """ PURPOSE: The routines in this file test the get_neighborhoods module. Created on 2015-04-02T21:24:17 """ from __future__ import division, print_function #import numpy as np #from types import * #from nose.tools import raises #import pandas as pd import nhrc2.backend.read_seeclickfix_api_to...
(): """ Ensure the number in the hood list length = the number of issues """ scf_cats = rscf.read_categories(readfile=True) issues = rscf.read_issues(scf_cats, readfile=True) hoods = get_ngbrhd.get_neighborhoods() assert len(issues) == len(hoods) #@raises(ValueError) #def test_make_functi...
test_get_neighborhoods
identifier_name
test_get_neighborhoods.py
#!/usr/bin/env python """ PURPOSE: The routines in this file test the get_neighborhoods module. Created on 2015-04-02T21:24:17 """ from __future__ import division, print_function #import numpy as np #from types import * #from nose.tools import raises #import pandas as pd import nhrc2.backend.read_seeclickfix_api_to...
#@raises(ValueError) #def test_make_function_raise_value_error():
""" Ensure the number in the hood list length = the number of issues """ scf_cats = rscf.read_categories(readfile=True) issues = rscf.read_issues(scf_cats, readfile=True) hoods = get_ngbrhd.get_neighborhoods() assert len(issues) == len(hoods)
identifier_body
test_get_neighborhoods.py
#!/usr/bin/env python """ PURPOSE: The routines in this file test the get_neighborhoods module. Created on 2015-04-02T21:24:17 """
#from nose.tools import raises #import pandas as pd import nhrc2.backend.read_seeclickfix_api_to_csv as rscf from nhrc2.backend import get_neighborhoods as get_ngbrhd __author__ = "Matt Giguere (github: @mattgiguere)" __license__ = "MIT" __version__ = '0.0.1' __maintainer__ = "Matt Giguere" __email__ = "matthew.gigue...
from __future__ import division, print_function #import numpy as np #from types import *
random_line_split
runtests.py
""" Standalone test runner for OPAT plugin """ import os import sys from django.conf import settings settings.configure(DEBUG=True, DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', } }, ...
'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.admin', 'django.contrib.staticfiles', 'compressor', ...
'opal.middleware.DjangoReversionWorkaround', 'reversion.middleware.RevisionMiddleware', 'axes.middleware.FailedLoginMiddleware', ), INSTALLED_APPS=('django.contrib.auth',
random_line_split
runtests.py
""" Standalone test runner for OPAT plugin """ import os import sys from django.conf import settings settings.configure(DEBUG=True, DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', } }, ...
sys.exit(failures)
conditional_block
mqtt_chat_client.py
# -*- coding: utf-8 -*- ''' Created on 17/2/16. @author: love ''' import paho.mqtt.client as mqtt import json import ssl def on_connect(client, userdata, flags, rc): print("Connected with result code %d"%rc) client.publish("Login/HD_Login/1", json.dumps({"userName": user, "passWord": "Hello,anyone!"}),qos=0,re...
(self,userdata,level, buf): print buf if __name__ == '__main__': client = mqtt.Client(protocol=mqtt.MQTTv31) client.username_pw_set("admin", "password") # 必须设置,否则会返回「Connected with result code 4」 client.on_connect = on_connect client.on_message = on_message #链接测试服务器 需要用tls请求 python tls功能比较弱。 ...
mylog
identifier_name
mqtt_chat_client.py
# -*- coding: utf-8 -*- ''' Created on 17/2/16. @author: love ''' import paho.mqtt.client as mqtt import json import ssl def on_connect(client, userdata, flags, rc):
def on_message(client, userdata, msg): print ('---------------') print ("topic :"+msg.topic) print ("payload :"+msg.payload) client.subscribe([("chat",2),("aaa",2)]) client.unsubscribe(["chat"]) #client.publish("login/addUser", json.dumps({"user": user, "say": "Hello,anyone!"}),qos=2,retai...
print("Connected with result code %d"%rc) client.publish("Login/HD_Login/1", json.dumps({"userName": user, "passWord": "Hello,anyone!"}),qos=0,retain=False)
identifier_body