file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
12.1k
suffix
large_stringlengths
0
12k
middle
large_stringlengths
0
7.51k
fim_type
large_stringclasses
4 values
routes.py
from application import app from flask import Response, request import json import logging import requests import traceback import kombu import re import uuid import getpass from datetime import datetime from jsonschema import Draft4Validator name_schema = { "type": "object", "properties": { "forename...
@app.errorhandler(Exception) def error_handler(err): logging.error('Unhandled exception: ' + str(err)) call_stack = traceback.format_exc() lines = call_stack.split("\n") for line in lines: logging.error(line) error = { "type": "F", "message": str(err), "stack": c...
result = { 'status': 'OK', 'dependencies': {} } status = 200 for dependency in application_dependencies: response = dependency["check"]() if response.status_code != 200: status = 500 result['dependencies'][dependency['name']] = str(response.status_code) ...
identifier_body
routes.py
from application import app from flask import Response, request import json import logging import requests import traceback import kombu import re import uuid import getpass from datetime import datetime from jsonschema import Draft4Validator name_schema = { "type": "object", "properties": { "forename...
def raise_error(error): hostname = app.config['AMQP_URI'] connection = kombu.Connection(hostname=hostname) producer = connection.SimpleQueue('errors') producer.put(error) logging.warning('Error successfully raised.')
raise RuntimeError("Unexpected response from {} -- {}".format(url, response.status_code))
random_line_split
apps.py
# Copyright (c) 2016 nVentiveUX # # 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, copy, modify, merge, publish,
# # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOS...
# distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions:
random_line_split
apps.py
# Copyright (c) 2016 nVentiveUX # # 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, copy, modify, merge, publish, # distri...
(AppConfig): name = 'mystartupmanager.showcase'
ShowcaseConfig
identifier_name
apps.py
# Copyright (c) 2016 nVentiveUX # # 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, copy, modify, merge, publish, # distri...
name = 'mystartupmanager.showcase'
identifier_body
page.ts
// // import { IElement, Element } from "./element"; // import * as request from "request"; // var cheerio: CheerioAPI = require("cheerio"); // // import * as cheerio from "cheerio"; // // export interface IPage { // url: string; // // elements: IElement[]; // } // // export class Page { // public url: string; // /...
// // return this.elements.map( (element) => new Element(element)); // // } // }
// // getElements() {
random_line_split
udpsink.rs
// Copyright (C) 2019 Mathieu Duponchelle <mathieu@centricular.com> // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any late...
thread::sleep(time::Duration::from_millis(50)); let socket = net::UdpSocket::bind("127.0.0.1:5005").unwrap(); let mut buf = [0; 5]; let (amt, _) = socket.recv_from(&mut buf).unwrap(); assert!(amt == 4); assert!(buf == [42, 43, 44, 45, 0]); }); let buf = gst::B...
use std::time;
random_line_split
udpsink.rs
// Copyright (C) 2019 Mathieu Duponchelle <mathieu@centricular.com> // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any late...
() { init(); let h = gst_check::Harness::new("ts-udpsink"); let udpsink = h.get_element().unwrap(); let clients = udpsink .get_property("clients") .unwrap() .get::<String>() .unwrap() .unwrap(); assert_eq!(clients, "127.0.0.1:5004"); udpsink.emit("add"...
test_client_management
identifier_name
udpsink.rs
// Copyright (C) 2019 Mathieu Duponchelle <mathieu@centricular.com> // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any late...
.unwrap() .unwrap(); assert_eq!(clients, "127.0.0.1:5004,192.168.1.1:57"); /* Adding a client twice is not supported */ udpsink.emit("add", &[&"192.168.1.1", &57i32]).unwrap(); let clients = udpsink .get_property("clients") .unwrap() .get::<String>() .unw...
{ init(); let h = gst_check::Harness::new("ts-udpsink"); let udpsink = h.get_element().unwrap(); let clients = udpsink .get_property("clients") .unwrap() .get::<String>() .unwrap() .unwrap(); assert_eq!(clients, "127.0.0.1:5004"); udpsink.emit("add", &...
identifier_body
about_dialog.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'resources/about_dialog.ui' # # Created: Sat Apr 8 00:53:02 2017 # by: pyside-uic 0.2.15 running on PySide 1.2.2 # # WARNING! All changes made in this file will be lost! from PySide import QtCore, QtGui class Ui_AboutDialog(object): ...
(self, AboutDialog): AboutDialog.setWindowTitle(QtGui.QApplication.translate("AboutDialog", "About", None, QtGui.QApplication.UnicodeUTF8)) self.label.setText(QtGui.QApplication.translate("AboutDialog", "Open Funktion Gen\n" "Wavetable Editor", None, QtGui.QApplication.UnicodeUTF8)) self.label_2...
retranslateUi
identifier_name
about_dialog.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'resources/about_dialog.ui' # # Created: Sat Apr 8 00:53:02 2017 # by: pyside-uic 0.2.15 running on PySide 1.2.2 # # WARNING! All changes made in this file will be lost! from PySide import QtCore, QtGui class Ui_AboutDialog(object): ...
AboutDialog.setMaximumSize(QtCore.QSize(400, 150)) AboutDialog.setFocusPolicy(QtCore.Qt.NoFocus) AboutDialog.setContextMenuPolicy(QtCore.Qt.NoContextMenu) AboutDialog.setModal(True) self.gridLayout = QtGui.QGridLayout(AboutDialog) self.gridLayout.setObjectName("gridLayout...
AboutDialog.setObjectName("AboutDialog") AboutDialog.setWindowModality(QtCore.Qt.ApplicationModal) AboutDialog.resize(400, 150) AboutDialog.setMinimumSize(QtCore.QSize(360, 110))
random_line_split
about_dialog.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'resources/about_dialog.ui' # # Created: Sat Apr 8 00:53:02 2017 # by: pyside-uic 0.2.15 running on PySide 1.2.2 # # WARNING! All changes made in this file will be lost! from PySide import QtCore, QtGui class Ui_AboutDialog(object): ...
self.label_2 = QtGui.QLabel(AboutDialog) self.label_2.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1) self.label_3 = QtGui.QLabel(AboutDialog) font = Q...
AboutDialog.setObjectName("AboutDialog") AboutDialog.setWindowModality(QtCore.Qt.ApplicationModal) AboutDialog.resize(400, 150) AboutDialog.setMinimumSize(QtCore.QSize(360, 110)) AboutDialog.setMaximumSize(QtCore.QSize(400, 150)) AboutDialog.setFocusPolicy(QtCore.Qt.NoFocus) ...
identifier_body
urlopen.py
''' Example dangerous usage of urllib[2] opener functions The urllib and urllib2 opener functions and object can open http, ftp, and file urls. Often, the ability to open file urls is overlooked leading to code that can unexpectedly open files on the local server. This could be used by an attacker to leak information ...
# Python 3 urllib.request.urlopen('file:///bin/ls') urllib.request.urlretrieve('file:///bin/ls', '/bin/ls2') opener = urllib.request.URLopener() opener.open('file:///bin/ls') opener.retrieve('file:///bin/ls') opener = urllib.request.FancyURLopener() opener.open('file:///bin/ls') open...
url = urllib.quote('file:///bin/ls') urllib.urlopen(url, 'blah', 32) urllib.urlretrieve('file:///bin/ls', '/bin/ls2') opener = urllib.URLopener() opener.open('file:///bin/ls') opener.retrieve('file:///bin/ls') opener = urllib.FancyURLopener() opener.open('file:///bin/ls') opener.retrieve...
identifier_body
urlopen.py
''' Example dangerous usage of urllib[2] opener functions The urllib and urllib2 opener functions and object can open http, ftp, and file urls. Often, the ability to open file urls is overlooked leading to code that can unexpectedly open files on the local server. This could be used by an attacker to leak information ...
# Six six.moves.urllib.request.urlopen('file:///bin/ls') six.moves.urllib.request.urlretrieve('file:///bin/ls', '/bin/ls2') opener = six.moves.urllib.request.URLopener() opener.open('file:///bin/ls') opener.retrieve('file:///bin/ls') opener = six.moves.urllib.request.FancyURLopener() op...
opener.retrieve('file:///bin/ls') opener = urllib.request.FancyURLopener() opener.open('file:///bin/ls') opener.retrieve('file:///bin/ls')
random_line_split
urlopen.py
''' Example dangerous usage of urllib[2] opener functions The urllib and urllib2 opener functions and object can open http, ftp, and file urls. Often, the ability to open file urls is overlooked leading to code that can unexpectedly open files on the local server. This could be used by an attacker to leak information ...
(): # urllib url = urllib.quote('file:///bin/ls') urllib.urlopen(url, 'blah', 32) urllib.urlretrieve('file:///bin/ls', '/bin/ls2') opener = urllib.URLopener() opener.open('file:///bin/ls') opener.retrieve('file:///bin/ls') opener = urllib.FancyURLopener() opener.open('file:///bin/ls'...
test_urlopen
identifier_name
menu.js
j = ref1 = pos - 1; ref1 <= 0 ? j <= 0 : j >= 0; i = ref1 <= 0 ? ++j : --j) { item = items[i] if (item.type === 'radio') { return item.groupId } if (item.type === 'separator') { break } } } else if (pos < items.length) { for (i = k = ref2 = pos, ref3 = items.leng...
}) insertIndex = items.length - 1 } // Find the end of the group. insertIndex++ while (insertIndex < items.length && items[insertIndex].type !== 'separator') { insertIndex++ } } return insertIndex } const Menu = bindings.Menu Object.setPrototypeOf(Menu.protot...
id: id, type: 'separator'
random_line_split
menu.js
= ref1 = pos - 1; ref1 <= 0 ? j <= 0 : j >= 0; i = ref1 <= 0 ? ++j : --j) { item = items[i] if (item.type === 'radio') { return item.groupId } if (item.type === 'separator') { break } } } else if (pos < items.length) { for (i = k = ref2 = pos, ref3 = items.length...
const [query, id] = position.split('=') insertIndex = indexOfItemById(items, id) if (insertIndex === -1 && query !== 'endof') { console.warn("Item with id '" + id + "' is not found") return items.length } switch (query) { case 'after': insertIndex++ break case 'endof': // I...
{ return items.length }
conditional_block
__init__.py
#!/usr/bin/env python # -*- coding: utf-8; py-indent-offset:4 -*- ############################################################################### # # Copyright (C) 2015 Daniel Rodriguez # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as pub...
# base for moving averages from .mabase import * # moving averages (so envelope and oscillators can be auto-generated) from .sma import * from .ema import * from .smma import * from .wma import * from .dema import * from .kama import * from .zlema import * # depends on moving averages from .deviation import * # dep...
from .basicops import *
random_line_split
mod.rs
//! An asynchronous stub resolver. //! //! A resolver is the component in the DNS that answers queries. A stub //! resolver does so by simply relaying queries to a different resolver //! chosen from a predefined set. This is how pretty much all user //! applications use DNS. //! //! This module implements a modern, asy...
//! //! Furthermore, we now can use a relative host name. It will be turned into //! an absolute name according to the rules set down by the configuration we //! used when creating the resolver. //! //! As an aside, the lookup functions are named after the thing they look //! up not their result following the example o...
random_line_split
text_equalsIgnoreCase.js
'use strict'; /* global Blockly, JST, RoboBlocks */ /** * text_equalsIgnoreCase code generation * @return {String} Code generated with block parameters */ Blockly.Arduino.text_equalsIgnoreCase = function() { var string1 = Blockly.Arduino.valueToCode(this, 'STRING1', Blockly.Arduino.ORDER_NONE); string1=s...
code+=a['code']; string1=a['pin']; a=RoboBlocks.findPinMode(string2); code+=a['code']; string2=a['pin']; code += JST['text_equalsIgnoreCase']({ 'string1': string1, 'string2': string2 }); return [code, Blockly.Arduino.ORDER_ATOMIC]; }; Blockly.Blocks.text_equalsIgnoreC...
random_line_split
outfile.rs
use std::fs::File; use std::path::Path; use std::io::Write; pub struct
{ filename: String, file: Option<File>, } impl FileIo { pub fn new(name: String) -> FileIo { FileIo { filename: name.clone(), file: match File::create(&Path::new(&*name)) { Ok(f) => Some(f), Err(e) => if name == "" { None ...
FileIo
identifier_name
outfile.rs
use std::fs::File; use std::path::Path; use std::io::Write; pub struct FileIo { filename: String, file: Option<File>, } impl FileIo { pub fn new(name: String) -> FileIo { FileIo { filename: name.clone(), file: match File::create(&Path::new(&*name)) { Ok(f) =...
}, } } pub fn write(&mut self, message: &str) -> bool { if self.filename == "" { println!("{}", message); true } else { match self.file.as_mut().unwrap().write(message.as_bytes()) { Ok(_) => true, Err(e) =>...
{ panic!("Could not open file: {}", e); }
conditional_block
outfile.rs
use std::fs::File; use std::path::Path; use std::io::Write; pub struct FileIo { filename: String,
impl FileIo { pub fn new(name: String) -> FileIo { FileIo { filename: name.clone(), file: match File::create(&Path::new(&*name)) { Ok(f) => Some(f), Err(e) => if name == "" { None } else { panic!...
file: Option<File>, }
random_line_split
outfile.rs
use std::fs::File; use std::path::Path; use std::io::Write; pub struct FileIo { filename: String, file: Option<File>, } impl FileIo { pub fn new(name: String) -> FileIo
pub fn write(&mut self, message: &str) -> bool { if self.filename == "" { println!("{}", message); true } else { match self.file.as_mut().unwrap().write(message.as_bytes()) { Ok(_) => true, Err(e) => { println!...
{ FileIo { filename: name.clone(), file: match File::create(&Path::new(&*name)) { Ok(f) => Some(f), Err(e) => if name == "" { None } else { panic!("Could not open file: {}", e); } ...
identifier_body
points.rs
use glium::{Program, Surface}; use glium::backend::Facade; use super::Figure; /// This figure is responsible for rendering points in two and three dimensions pub struct Points <'display_lifetime>{ program: Program, display: &'display_lifetime Facade } #[derive(Copy, Clone)] struct Vertex { position: [f3...
let index_buffer = NoIndices(PrimitiveType::Points); let vertex_buffer = VertexBuffer::new(self.display, &points).unwrap(); surface.draw(&vertex_buffer, &index_buffer, &self.program, &uniform!(), &Default::defau...
Vertex { position: [0.0, -0.5]}, ];
random_line_split
points.rs
use glium::{Program, Surface}; use glium::backend::Facade; use super::Figure; /// This figure is responsible for rendering points in two and three dimensions pub struct
<'display_lifetime>{ program: Program, display: &'display_lifetime Facade } #[derive(Copy, Clone)] struct Vertex { position: [f32; 2] } implement_vertex!(Vertex, position); impl <'display_lifetime> Points<'display_lifetime> { pub fn new(display: &Facade) -> Points { Points { pro...
Points
identifier_name
train_word2vec_rf.py
""" train supervised classifier with what's cooking recipe data objective - determine recipe type categorical value from 20 """ import time from features_bow import * from features_word2vec import * from sklearn.preprocessing import StandardScaler from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifie...
(use_idf=False, random_state=None, std=False, n_jobs=-1, verbose=2): wc_idf_map = None if use_idf: # ingredients inverse document frequencies wc_components = build_tfidf_wc(verbose=(verbose > 0)) wc_idf = wc_components['model'].idf_ wc_idf_words = wc_components['model'].get_featu...
main
identifier_name
train_word2vec_rf.py
""" train supervised classifier with what's cooking recipe data objective - determine recipe type categorical value from 20 """ import time from features_bow import * from features_word2vec import * from sklearn.preprocessing import StandardScaler from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifie...
# word2vec recipe feature vectors wc_components = build_word2vec_wc(feature_vec_size=120, avg=True, idf=wc_idf_map, verbose=(verbose > 0)) y_train = wc_components['train']['df']['cuisine_code'].as_matrix() X_train = wc_components['train']['features_matrix'] # standardize features aka mean ~ 0, std ~...
wc_idf = wc_components['model'].idf_ wc_idf_words = wc_components['model'].get_feature_names() wc_idf_map = dict(zip(wc_idf_words, wc_idf))
random_line_split
train_word2vec_rf.py
""" train supervised classifier with what's cooking recipe data objective - determine recipe type categorical value from 20 """ import time from features_bow import * from features_word2vec import * from sklearn.preprocessing import StandardScaler from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifie...
main()
conditional_block
train_word2vec_rf.py
""" train supervised classifier with what's cooking recipe data objective - determine recipe type categorical value from 20 """ import time from features_bow import * from features_word2vec import * from sklearn.preprocessing import StandardScaler from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifie...
# perform cross validation cv_n_fold = 8 print 'cross validating %s ways...' % cv_n_fold scores_cv = cross_val_score(clf, X_train, y_train, cv=cv_n_fold, n_jobs=-1) print 'accuracy: %0.5f (+/- %0.5f)' % (scores_cv.mean(), scores_cv.std() * 2) time_1 = time.time() elapsed_time = time_1 - time...
wc_idf_map = None if use_idf: # ingredients inverse document frequencies wc_components = build_tfidf_wc(verbose=(verbose > 0)) wc_idf = wc_components['model'].idf_ wc_idf_words = wc_components['model'].get_feature_names() wc_idf_map = dict(zip(wc_idf_words, wc_idf)) # wor...
identifier_body
lib.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ #![deny(warnings)] use std::collections::HashSet; use std::fs::create_dir_all; use std::ops::RangeBounds; use std::path::{Path, PathBuf}; ...
} _ => Err(format_err!("Fileblob does not support token, only ranges")), } } } #[cfg(test)] mod test { use super::*; use fbinit::FacebookInit; #[fbinit::test] async fn test_persist_error(fb: FacebookInit) -> Result<()> { let ctx = CoreContext::test_mock(fb...
{ match range { BlobstoreKeyParam::Start(ref range) => { let mut enum_data = BlobstoreEnumerationData { keys: HashSet::new(), next_token: None, }; WalkDir::new(&self.base) .into_iter() ...
identifier_body
lib.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ #![deny(warnings)] use std::collections::HashSet; use std::fs::create_dir_all; use std::ops::RangeBounds; use std::path::{Path, PathBuf}; ...
// This uses hardlink semantics as the production blobstores also have hardlink like semantics // (i.e. you can't discover a canonical link source when loading by the target) async fn copy<'a>( &'a self, _ctx: &'a CoreContext, old_key: &'a str, new_key: String, ) -> Resul...
) -> Result<()> { BlobstorePutOps::put_with_status(self, ctx, key, value).await?; Ok(()) }
random_line_split
lib.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ #![deny(warnings)] use std::collections::HashSet; use std::fs::create_dir_all; use std::ops::RangeBounds; use std::path::{Path, PathBuf}; ...
<'a>( &'a self, _ctx: &'a CoreContext, old_key: &'a str, new_key: String, ) -> Result<()> { // from std::fs::hard_link: The dst path will be a link pointing to the src path let src_path = self.path(old_key); let dst_path = self.path(&new_key); // hard_...
copy
identifier_name
sun.py
from random import random, randint from PIL import Image, ImageDraw, ImageFont import perlin def draw_background(setup) : canvas = setup['canvas'] image = Image.new('RGBA', canvas, tuple(setup['color']['back'])) background = Image.new('RGBA', canvas, (0,0,0,0)) draw = ImageDraw.Draw(background) stars = [[ int(p...
width, height = setup['canvas'][0], setup['canvas'][1] list_of_pixels = list(image.getdata()) for i, pixel in enumerate(list_of_pixels) : if pixel != (0, 0, 0, 0) : noise = generator.OctavePerlin((i % width) / coef, i / (height * coef), 0, 1, 5) new_pixel = [ int(x * (1 + noise)) for x in pixel[:3] ] new...
generator = perlin.Perlin() octaves = 5 persistence = 5 coef = 30
random_line_split
sun.py
from random import random, randint from PIL import Image, ImageDraw, ImageFont import perlin def
(setup) : canvas = setup['canvas'] image = Image.new('RGBA', canvas, tuple(setup['color']['back'])) background = Image.new('RGBA', canvas, (0,0,0,0)) draw = ImageDraw.Draw(background) stars = [[ int(p * random()) for p in canvas ] for x in range(400) ] scale = lambda x, r : x + r * (min(canvas) / 320) color = ...
draw_background
identifier_name
sun.py
from random import random, randint from PIL import Image, ImageDraw, ImageFont import perlin def draw_background(setup) : canvas = setup['canvas'] image = Image.new('RGBA', canvas, tuple(setup['color']['back'])) background = Image.new('RGBA', canvas, (0,0,0,0)) draw = ImageDraw.Draw(background) stars = [[ int(p...
def create_sun(setup) : canvas, size = setup['canvas'], setup['size'] d = min([x * 0.08 * 5 * size for x in canvas]) planet = [ (x - d) / 2 for x in canvas ] planet.append(planet[0] + d) planet.append(planet[1] + d) setup['sun'] = planet setup['diam'] = d setup['rad'] = d / 2 setup['center'] = [ planet[0] +...
canvas = setup['canvas'] sun_image = Image.new('RGBA', canvas, (0,0,0,0)) draw = ImageDraw.Draw(sun_image) draw.ellipse(setup['sun'], fill=tuple(setup['color']['base'])) sun_image = apply_noise(sun_image, setup) sun_image = apply_ray_effect(sun_image, setup) return Image.alpha_composite(image, sun_image)
identifier_body
sun.py
from random import random, randint from PIL import Image, ImageDraw, ImageFont import perlin def draw_background(setup) : canvas = setup['canvas'] image = Image.new('RGBA', canvas, tuple(setup['color']['back'])) background = Image.new('RGBA', canvas, (0,0,0,0)) draw = ImageDraw.Draw(background) stars = [[ int(p...
return Image.alpha_composite(image, background) def apply_noise(image, setup) : generator = perlin.Perlin() octaves = 5 persistence = 5 coef = 30 width, height = setup['canvas'][0], setup['canvas'][1] list_of_pixels = list(image.getdata()) for i, pixel in enumerate(list_of_pixels) : if pixel != (0, 0, 0, ...
r = random() draw.ellipse([x, y, scale(x, r), scale(y, r)], fill=color)
conditional_block
type_of.rs
llty } } pub fn type_of_rust_fn(cx: &CrateContext, has_env: bool, inputs: &[ty::t], output: ty::t) -> Type { let mut atys: Vec<Type> = Vec::new(); // Arg 0: Output pointer. // (if the output type is non-immediate) let use_out_pointer = return_uses_outptr(cx, output);...
} ty::ty_bare_fn(_) => { type_of_fn_from_ty(cx, t).ptr_to() } ty::ty_closure(_) => { let fn_ty = type_of_fn_from_ty(cx, t).ptr_to();
} ty::ty_vec(ref mt, Some(n)) => { Type::array(&type_of(cx, mt.ty), n as u64)
random_line_split
type_of.rs
None => () } let llsizingty = match ty::get(t).sty { ty::ty_nil | ty::ty_bot => Type::nil(cx), ty::ty_bool => Type::bool(cx), ty::ty_char => Type::char(cx), ty::ty_int(t) => Type::int_from_ty(cx, t), ty::ty_uint(t) => Type::uint_from_ty(cx, t), ty::ty_flo...
{ "enum" }
conditional_block
type_of.rs
// recursive types. For example, enum types rely on this behavior. pub fn sizing_type_of(cx: &CrateContext, t: ty::t) -> Type { match cx.llsizingtypes.borrow().find_copy(&t) { Some(t) => return t, None => () } let llsizingty = match ty::get(t).sty { ty::ty_nil | ty::ty_bot => T...
llvm_type_name
identifier_name
type_of.rs
llty } } pub fn type_of_rust_fn(cx: &CrateContext, has_env: bool, inputs: &[ty::t], output: ty::t) -> Type { let mut atys: Vec<Type> = Vec::new(); // Arg 0: Output pointer. // (if the output type is non-immediate) let use_out_pointer = return_uses_outptr(cx, output);...
Type::struct_(cx, [Type::i8p(cx), Type::i8p(cx)], false) } _ => Type::i8p(cx), } } ty::ty_bare_fn(..) => Type::i8p(cx), ty::ty_closure(..) => Type::struct_(cx, [Type::i8p(cx), Type::i8p(cx)], false), ty::ty_trait(..) => Typ...
{ match cx.llsizingtypes.borrow().find_copy(&t) { Some(t) => return t, None => () } let llsizingty = match ty::get(t).sty { ty::ty_nil | ty::ty_bot => Type::nil(cx), ty::ty_bool => Type::bool(cx), ty::ty_char => Type::char(cx), ty::ty_int(t) => Type::int_from...
identifier_body
settings.py
# Copyright (C) 2014 Ivan Koster # # This file is part of SublimeYouCompleteMe. # # SublimeYouCompleteMe is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # # SublimeYouCompleteMe is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have r...
random_line_split
cybergis-client-respond.js
respond.update = function(){}; //expose media query support flag for external use respond.mediaQueriesSupported = win.matchMedia && win.matchMedia( "only all" ).matches; //if media queries are supported, exit here if( respond.mediaQueriesSupported ){ return; } //define vars var doc = win.document, doc...
win.respond = {}; //define update even in native-mq-supporting browsers, to avoid errors
random_line_split
cybergis-client-respond.js
rules.push( repUrls( styles ) ); } //parse for styles else{ fullq = qs[ i ].match( /@media *([^\{]+)\{([\S\s]+?)$/ ) && RegExp.$1; rules.push( RegExp.$2 && repUrls( RegExp.$2 ) ); } eachq = fullq.split( "," ); eql = eachq.length; for( ; j < eql; j++ ){ thisq = eac...
{ applyMedia( true ); }
identifier_body
cybergis-client-respond.js
useMedia ){ fullq = media; rules.push( repUrls( styles ) ); } //parse for styles else{ fullq = qs[ i ].match( /@media *([^\{]+)\{([\S\s]+?)$/ ) && RegExp.$1; rules.push( RegExp.$2 && repUrls( RegExp.$2 ) ); } eachq = fullq.split( "," ); eql = eachq.length; fo...
callMedia
identifier_name
cybergis-client-respond.js
" ), requestQueue = [], //loop stylesheets, send text content to translate ripCSS = function(){ var sheets = links, sl = sheets.length, i = 0, //vars for loop: sheet, href, media, isCSS; for( ; i < sl; i++ ){ sheet = sheets[ i ], href = sheet.href, media = sheet.media, ...
{ minh = parseFloat( minh ) * ( minh.indexOf( em ) > -1 ? ( eminhpx || getEmHeight() ) : 1 ); }
conditional_block
models.py
# -*- coding: utf-8 -*- # 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, copy, modify, merge, publish, # distribute, sub...
return u class Meta: ordering = ['-order', '-date_created', 'id'] class MPTTMeta: order_insertion_by = ['name'] class Project(ProjectBase): """ Top-level organizational object. """ THEMES = ( ("", "None"), ("camping", "Camping"), ("camping2"...
u += team.members.all()
conditional_block
models.py
# -*- coding: utf-8 -*- # 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, copy, modify, merge, publish, # distribute, sub...
def __str__(self): return "%s's profile" % self.user def create_user_profile(sender, instance, created, **kwargs): if created: profile, created = UserProfile.objects.get_or_create(user=instance) post_save.connect(create_user_profile, sender=User) import sys if not 'syncdb' in sys.argv[1:2] a...
defaultScore = 1 user = models.OneToOneField(User) score = models.IntegerField(default=defaultScore)
random_line_split
models.py
# -*- coding: utf-8 -*- # 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, copy, modify, merge, publish, # distribute, sub...
post_save.connect(create_user_profile, sender=User) import sys if not 'syncdb' in sys.argv[1:2] and not 'migrate' in sys.argv[1:2]: from meta_badges import *
if created: profile, created = UserProfile.objects.get_or_create(user=instance)
identifier_body
models.py
# -*- coding: utf-8 -*- # 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, copy, modify, merge, publish, # distribute, sub...
(models.Model): """ from http://stackoverflow.com/questions/44109/extending-the-user-model-with-custom-fields-in-django; this is one mechanism for adding extra details (currently score for badges) to the User model """ defaultScore = 1 user = models.OneToOneField(User) score = models.IntegerField(defaul...
UserProfile
identifier_name
immutableRenderDecorator.ts
import * as React from 'react' let whiteList = [ '[IndexPage]' ] export default function immutableRenderDecorator(Target: React.ComponentClass<any>): any { class ImmutableRenderDecorator extends Target { shallowEqualImmutable(preObj: any, nxtObj: any) { if (preObj === nxtObj) {
if (typeof preObj !== 'object' || preObj == void 0 || typeof nxtObj !== 'object' || nxtObj == void 0) { return false } const preKey = Object.keys(preObj) const nxtKey = Object.keys(nxtObj) if (preKey.length !== nxtKey.length) ...
return true } // FIX: values may be null
random_line_split
immutableRenderDecorator.ts
import * as React from 'react' let whiteList = [ '[IndexPage]' ] export default function immutableRenderDecorator(Target: React.ComponentClass<any>): any { class ImmutableRenderDecorator extends Target { shallowEqualImmutable(preObj: any, nxtObj: any)
continue } if (nxtObj[nxtKey[i]] !== preObj[nxtKey[i]]) { return false } } return true } type() { return Target.toString().match(/\w+/g)[1] } compare(preObj: any...
{ if (preObj === nxtObj) { return true } // FIX: values may be null if (typeof preObj !== 'object' || preObj == void 0 || typeof nxtObj !== 'object' || nxtObj == void 0) { return false } const preKe...
identifier_body
immutableRenderDecorator.ts
import * as React from 'react' let whiteList = [ '[IndexPage]' ] export default function
(Target: React.ComponentClass<any>): any { class ImmutableRenderDecorator extends Target { shallowEqualImmutable(preObj: any, nxtObj: any) { if (preObj === nxtObj) { return true } // FIX: values may be null if (typeof preObj !== 'object' || pr...
immutableRenderDecorator
identifier_name
immutableRenderDecorator.ts
import * as React from 'react' let whiteList = [ '[IndexPage]' ] export default function immutableRenderDecorator(Target: React.ComponentClass<any>): any { class ImmutableRenderDecorator extends Target { shallowEqualImmutable(preObj: any, nxtObj: any) { if (preObj === nxtObj)
// FIX: values may be null if (typeof preObj !== 'object' || preObj == void 0 || typeof nxtObj !== 'object' || nxtObj == void 0) { return false } const preKey = Object.keys(preObj) const nxtKey = Object.keys(nxtObj) ...
{ return true }
conditional_block
env.rs
// Copyright 2012-2013 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-MI...
}; let msg = match exprs.next() { None => { token::intern_and_get_ident(&format!("environment variable `{}` \ not defined", var)) } Some(second) => { match expr_to_str...
random_line_split
env.rs
// Copyright 2012-2013 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-MI...
<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> Box<base::MacResult+'cx> { let var = match get_single_str_from_tts(cx, sp, tts, "option_env!") { None => return DummyResult::expr(sp), Some(v) => v }; let e = match env::var(&var[..]) { Err(...
expand_option_env
identifier_name
env.rs
// Copyright 2012-2013 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-MI...
var)) } Some(second) => { match expr_to_string(cx, second, "expected string literal") { None => return DummyResult::expr(sp), Some((s, _style)) => s } } }; match exprs.next() { ...
{ let mut exprs = match get_exprs_from_tts(cx, sp, tts) { Some(ref exprs) if exprs.is_empty() => { cx.span_err(sp, "env! takes 1 or 2 arguments"); return DummyResult::expr(sp); } None => return DummyResult::expr(sp), Some(exprs) => exprs.into_iter() }; ...
identifier_body
autoaudioinput.py
# -*- coding: utf-8 -*- # Copyright (C) 2010 Holoscópio Tecnologia # Author: Luciana Fujii Pontello <luciana@holoscopio.com> # # This program 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...
self): return None def get_name(self): return "AutoAudio" def get_description(self): return "Auto Audio Source"
et_widget(
identifier_name
autoaudioinput.py
# -*- coding: utf-8 -*- # Copyright (C) 2010 Holoscópio Tecnologia # Author: Luciana Fujii Pontello <luciana@holoscopio.com> # # This program 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...
def get_name(self): return "AutoAudio" def get_description(self): return "Auto Audio Source"
eturn None
identifier_body
lib.rs
Error, ZmqResult}; pub use crate::pull::*; pub use crate::push::*; pub use crate::r#pub::*; pub use crate::rep::*; pub use crate::req::*; pub use crate::router::*; pub use crate::sub::*; pub use message::*; use crate::codec::*; use crate::transport::AcceptStopHandle; use util::PeerIdentity; #[macro_use] extern crate ...
Err(e) => { if let Some(monitor) = cloned_backend.monitor().lock().as_mut() { let _ = monitor.try_send(SocketEvent::AcceptFailed(e)); } } } } }; let (endpoint...
{ if let Some(monitor) = cloned_backend.monitor().lock().as_mut() { let _ = monitor.try_send(SocketEvent::Accepted(endpoint, peer_id)); } }
conditional_block
lib.rs
Error, ZmqResult}; pub use crate::pull::*; pub use crate::push::*; pub use crate::r#pub::*; pub use crate::rep::*; pub use crate::req::*; pub use crate::router::*; pub use crate::sub::*; pub use message::*; use crate::codec::*; use crate::transport::AcceptStopHandle; use util::PeerIdentity; #[macro_use] extern crate ...
errs } /// Connects to the given endpoint. async fn connect(&mut self, endpoint: &str) -> ZmqResult<()> { let backend = self.backend(); let endpoint = endpoint.try_into()?; let result = match util::connect_forever(endpoint).await { Ok((socket, endpoint)) => matc...
} }
random_line_split
lib.rs
Error, ZmqResult}; pub use crate::pull::*; pub use crate::push::*; pub use crate::r#pub::*; pub use crate::rep::*; pub use crate::req::*; pub use crate::router::*; pub use crate::sub::*; pub use message::*; use crate::codec::*; use crate::transport::AcceptStopHandle; use util::PeerIdentity; #[macro_use] extern crate ...
{ pub(crate) peer_id: Option<PeerIdentity>, } impl SocketOptions { pub fn peer_identity(&mut self, peer_id: PeerIdentity) -> &mut Self { self.peer_id = Some(peer_id); self } } #[async_trait] pub trait MultiPeerBackend: SocketBackend { /// This should not be public.. /// Find a bet...
SocketOptions
identifier_name
lib.rs
Error, ZmqResult}; pub use crate::pull::*; pub use crate::push::*; pub use crate::r#pub::*; pub use crate::rep::*; pub use crate::req::*; pub use crate::router::*; pub use crate::sub::*; pub use message::*; use crate::codec::*; use crate::transport::AcceptStopHandle; use util::PeerIdentity; #[macro_use] extern crate ...
} } Err(e) => { if let Some(monitor) = cloned_backend.monitor().lock().as_mut() { let _ = monitor.try_send(SocketEvent::AcceptFailed(e)); } } } ...
{ let endpoint = endpoint.try_into()?; let cloned_backend = self.backend(); let cback = move |result| { let cloned_backend = cloned_backend.clone(); async move { let result = match result { Ok((socket, endpoint)) => { ...
identifier_body
console.ts
const consoleFilters = [ /^The above error occurred in the <.*?> component:/, // error boundary output /^Error: Uncaught .+/ // jsdom output ] function suppressErrorOutput() { const originalError = console.error const error = (...args: Parameters<typeof originalError>) => { const message = typeof args[0] ...
} console.error = error return () => { console.error = originalError } } function errorFilteringDisabled() { try { return !!process.env.RHTL_DISABLE_ERROR_FILTERING } catch { // falling back in the case that process.env.RHTL_DISABLE_ERROR_FILTERING cannot be accessed (e.g. browser environmen...
{ originalError(...args) }
conditional_block
console.ts
const consoleFilters = [ /^The above error occurred in the <.*?> component:/, // error boundary output /^Error: Uncaught .+/ // jsdom output ] function suppressErrorOutput() { const originalError = console.error const error = (...args: Parameters<typeof originalError>) => { const message = typeof args[0] ...
() { try { return !!process.env.RHTL_DISABLE_ERROR_FILTERING } catch { // falling back in the case that process.env.RHTL_DISABLE_ERROR_FILTERING cannot be accessed (e.g. browser environment) return false } } function enableErrorOutputSuppression() { // Automatically registers console error suppress...
errorFilteringDisabled
identifier_name
console.ts
const consoleFilters = [ /^The above error occurred in the <.*?> component:/, // error boundary output /^Error: Uncaught .+/ // jsdom output ] function suppressErrorOutput()
function errorFilteringDisabled() { try { return !!process.env.RHTL_DISABLE_ERROR_FILTERING } catch { // falling back in the case that process.env.RHTL_DISABLE_ERROR_FILTERING cannot be accessed (e.g. browser environment) return false } } function enableErrorOutputSuppression() { // Automatically...
{ const originalError = console.error const error = (...args: Parameters<typeof originalError>) => { const message = typeof args[0] === 'string' ? args[0] : null if (!message || !consoleFilters.some((filter) => filter.test(message))) { originalError(...args) } } console.error = error retu...
identifier_body
console.ts
const consoleFilters = [ /^The above error occurred in the <.*?> component:/, // error boundary output /^Error: Uncaught .+/ // jsdom output ] function suppressErrorOutput() { const originalError = console.error const error = (...args: Parameters<typeof originalError>) => { const message = typeof args[0] ...
if (!message || !consoleFilters.some((filter) => filter.test(message))) { originalError(...args) } } console.error = error return () => { console.error = originalError } } function errorFilteringDisabled() { try { return !!process.env.RHTL_DISABLE_ERROR_FILTERING } catch { // fa...
random_line_split
script.js
(function($) { "use strict";
$('a[href*="#"]:not([href="#"])').click(function() { if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); if (target.length) { ...
// Smooth scrolling using jQuery easing
random_line_split
script.js
(function($) { "use strict"; // Smooth scrolling using jQuery easing $('a[href*="#"]:not([href="#"])').click(function() { if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? targe...
else { $("#mainNav").removeClass("navbar-shrink"); } }); var mcSignup = $('#mc-signup'); var modal = $('#modal'); mcSignup.find('#close span').click(function() { modal.fadeOut(); mcSignup.animate({ top: '200%', }, 200, 'linear'); }); $('.mc-signup-btn').click(function() { ...
{ $("#mainNav").addClass("navbar-shrink"); }
conditional_block
test_skip_examples.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compli...
(self): self.fail("skip_unless failed to work properly.") @test.skip_if(False, "This test case should never be skipped.") def test_001_increase_test_counter(self): ExampleSkipTestCase.test_counter += 1 @test.skip_unless(True, "This test case should never be skipped.") def test_002_incr...
test_skip_unless_example
identifier_name
test_skip_examples.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compli...
@test.skip_if(False, "This test case should never be skipped.") def test_001_increase_test_counter(self): ExampleSkipTestCase.test_counter += 1 @test.skip_unless(True, "This test case should never be skipped.") def test_002_increase_test_counter(self): ExampleSkipTestCase.test_counter +...
self.fail("skip_unless failed to work properly.")
random_line_split
test_skip_examples.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compli...
self.assertEquals(ExampleSkipTestCase.test_counter, 2, "Tests were not skipped appropriately")
identifier_body
kiss.rs
use std::io; use std::io::prelude::*; use std::net::Shutdown; use std::net::TcpStream; use std::net::ToSocketAddrs; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Mutex; const FEND: u8 = 0xC0; const FESC: u8 = 0xDB; const TFEND: u8 = 0xDC; const TFESC: u8 = 0xDD; pub(crate) struct TcpKissInterface { ...
<A: ToSocketAddrs>(addr: A) -> io::Result<TcpKissInterface> { let tx_stream = TcpStream::connect(addr)?; let rx_stream = tx_stream.try_clone()?; Ok(TcpKissInterface { tx_stream: Mutex::new(tx_stream), rx_stream: Mutex::new(rx_stream), buffer: Mutex::new(Vec::n...
new
identifier_name
kiss.rs
use std::io; use std::io::prelude::*; use std::net::Shutdown; use std::net::TcpStream; use std::net::ToSocketAddrs; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Mutex; const FEND: u8 = 0xC0; const FESC: u8 = 0xDB; const TFEND: u8 = 0xDC; const TFESC: u8 = 0xDD; pub(crate) struct TcpKissInterface { ...
state = Scan::Data; } } } match final_idx { 0 => None, n => { // Draining up to "n" will leave the final FEND in place // This way we can use it as the start marker for the next frame buffer.drain(0..n); Some(p...
{ // Successfully read a non-zero-length frame final_idx = idx; break; }
conditional_block
kiss.rs
use std::io; use std::io::prelude::*; use std::net::Shutdown; use std::net::TcpStream; use std::net::ToSocketAddrs; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Mutex; const FEND: u8 = 0xC0; const FESC: u8 = 0xDB; const TFEND: u8 = 0xDC; const TFESC: u8 = 0xDD; pub(crate) struct TcpKissInterface { ...
pub(crate) fn receive_frame(&self) -> io::Result<Vec<u8>> { loop { { let mut buffer = self.buffer.lock().unwrap(); if let Some(frame) = make_frame_from_buffer(&mut buffer) { return Ok(frame); } } let mu...
{ let tx_stream = TcpStream::connect(addr)?; let rx_stream = tx_stream.try_clone()?; Ok(TcpKissInterface { tx_stream: Mutex::new(tx_stream), rx_stream: Mutex::new(rx_stream), buffer: Mutex::new(Vec::new()), is_shutdown: AtomicBool::new(false), ...
identifier_body
kiss.rs
use std::io; use std::io::prelude::*; use std::net::Shutdown; use std::net::TcpStream; use std::net::ToSocketAddrs; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Mutex; const FEND: u8 = 0xC0; const FESC: u8 = 0xDB; const TFEND: u8 = 0xDC; const TFESC: u8 = 0xDD; pub(crate) struct TcpKissInterface { ...
let mut rx = vec![0x03, 0x04, FEND, 0x01, 0x02, FEND]; assert_eq!(make_frame_from_buffer(&mut rx), Some(vec![0x01, 0x02])); assert_eq!(rx, vec![FEND]); } #[test] fn test_consecutive_marker() { let mut rx = vec![FEND, FEND, FEND, 0x01, 0x02, FEND]; assert_eq!(make_frame_from_buffer(&mut rx), Some(ve...
assert_eq!(rx, vec![FEND, 0x03, 0x04]); } #[test] fn test_leading_data() {
random_line_split
capability.js
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ '...
serializedName: 'reason', type: { name: 'String' } } } } }; } } module.exports = Capability;
random_line_split
capability.js
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ '...
() { } /** * Defines the metadata of Capability * * @returns {object} metadata of Capability * */ mapper() { return { required: false, serializedName: 'Capability', type: { name: 'Composite', className: 'Capability', modelProperties: { name: ...
constructor
identifier_name
7.4.1-2-n.js
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the Lic...
var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var true = false"; EXPECTED = "error"; new TestCase( SECTION, "var true = false", "error", eval("var true = false") ); test();
var SECTION = "7.4.1-2-n";
random_line_split
addConstantAndFraction.test.js
const addConstantAndFraction = require('../../../lib/simplifyExpression/fractionsSearch/addConstantAndFraction'); const TestUtil = require('../../TestUtil'); function testAddConstantAndFraction(exprString, outputList) { const lastString = outputList[outputList.length - 1]; TestUtil.testSubsteps(addConstantAndFrac...
], ['1/2 + 5.8', ['0.5 + 5.8', '6.3'], ], ['1/3 + 5.8', ['0.3333 + 5.8', '6.1333'] ], ]; tests.forEach(t => testAddConstantAndFraction(t[0], t[1])); });
'(5 + 18) / 6', '23/6'],
random_line_split
addConstantAndFraction.test.js
const addConstantAndFraction = require('../../../lib/simplifyExpression/fractionsSearch/addConstantAndFraction'); const TestUtil = require('../../TestUtil'); function testAddConstantAndFraction(exprString, outputList)
describe('addConstantAndFraction', function () { const tests = [ ['7 + 1/2', ['14/2 + 1/2', '(14 + 1) / 2', '15/2'] ], ['5/6 + 3', ['5/6 + 18/6', '(5 + 18) / 6', '23/6'], ], ['1/2 + 5.8', ['0.5 + 5.8', '6.3'], ], ['1/3 + 5.8', ...
{ const lastString = outputList[outputList.length - 1]; TestUtil.testSubsteps(addConstantAndFraction, exprString, outputList, lastString); }
identifier_body
addConstantAndFraction.test.js
const addConstantAndFraction = require('../../../lib/simplifyExpression/fractionsSearch/addConstantAndFraction'); const TestUtil = require('../../TestUtil'); function
(exprString, outputList) { const lastString = outputList[outputList.length - 1]; TestUtil.testSubsteps(addConstantAndFraction, exprString, outputList, lastString); } describe('addConstantAndFraction', function () { const tests = [ ['7 + 1/2', ['14/2 + 1/2', '(14 + 1) / 2', '15/2'] ]...
testAddConstantAndFraction
identifier_name
addeditmoviedlg_ans.py
#!/usr/bin/env python3 # Copyright (c) 2008-9 Qtrac Ltd. All rights reserved. # This program or module 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 # version 3 of the Lic...
(self, text): self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( not self.titleLineEdit.text().isEmpty()) def accept(self): title = self.titleLineEdit.text() year = self.yearSpinBox.value() minutes = self.minutesSpinBox.value() location = self.locationLi...
on_titleLineEdit_textEdited
identifier_name
addeditmoviedlg_ans.py
#!/usr/bin/env python3 # Copyright (c) 2008-9 Qtrac Ltd. All rights reserved. # This program or module 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 # version 3 of the Lic...
form.show() app.exec_()
app = QApplication(sys.argv) form = AddEditMovieDlg(0)
random_line_split
addeditmoviedlg_ans.py
#!/usr/bin/env python3 # Copyright (c) 2008-9 Qtrac Ltd. All rights reserved. # This program or module 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 # version 3 of the Lic...
today = QDate.currentDate() self.acquiredDateEdit.setDateRange(today.addDays(-5), today) self.acquiredDateEdit.setDate(today) self.titleLineEdit.setFocus() self.on_titleLineEdit_textEdited(QString()) @pyqtSignat...
def __init__(self, movies, movie=None, parent=None): super(AddEditMovieDlg, self).__init__(parent) self.setupUi(self) self.movies = movies self.movie = movie self.acquiredDateEdit.setDisplayFormat(moviedata.DATEFORMAT) if movie is not None: self.titleLineEdit...
identifier_body
addeditmoviedlg_ans.py
#!/usr/bin/env python3 # Copyright (c) 2008-9 Qtrac Ltd. All rights reserved. # This program or module 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 # version 3 of the Lic...
else: self.movies.updateMovie(self.movie, title, year, minutes, location, notes) QDialog.accept(self) if __name__ == "__main__": import sys app = QApplication(sys.argv) form = AddEditMovieDlg(0) form.show() app.exec_()
acquired = self.acquiredDateEdit.date() self.movie = moviedata.Movie(title, year, minutes, acquired, location, notes) self.movies.add(self.movie)
conditional_block
strings.js
omenis ir daugiau nebeklausti.<br/>", "majorAxisTooltipMessage": "Spustelėkite pagrindinės ašies ilgį", "minorAxisTooltipMessage": "Parkelkite pelės žymiklį atgal į pradinę padėtį, kad nustatytumėte šalutinę ašį ir baigtumėte brėžti elipsę", "clickToFinishLineMessage": "Spustelėkite, kad baigtumėte brėžti liniją"...
random_line_split
batch_normalization.py
#! /usr/bin/env python # -*- coding: utf-8 -*- import tensorflow as tf def batch_norm(inputs, name_scope, is_training, epsilon=1e-3, decay=0.99): with tf.variable_scope(name_scope): size = inputs.get_shape().as_list()[1] gamma = tf.get_variable( 'gamma', [size], initializer=tf.consta...
(): return tf.nn.batch_normalization(inputs, pop_mean, pop_var, beta, gamma, epsilon) # control flow return tf.cond(is_training, batch_statistics, pop_statistics)
pop_statistics
identifier_name
batch_normalization.py
#! /usr/bin/env python # -*- coding: utf-8 -*- import tensorflow as tf def batch_norm(inputs, name_scope, is_training, epsilon=1e-3, decay=0.99): with tf.variable_scope(name_scope): size = inputs.get_shape().as_list()[1] gamma = tf.get_variable( 'gamma', [size], initializer=tf.consta...
def pop_statistics(): return tf.nn.batch_normalization(inputs, pop_mean, pop_var, beta, gamma, epsilon) # control flow return tf.cond(is_training, batch_statistics, pop_statistics)
with tf.control_dependencies([train_mean_op, train_var_op]): return tf.nn.batch_normalization(inputs, batch_mean, batch_var, beta, gamma, epsilon)
identifier_body
batch_normalization.py
#! /usr/bin/env python # -*- coding: utf-8 -*- import tensorflow as tf def batch_norm(inputs, name_scope, is_training, epsilon=1e-3, decay=0.99): with tf.variable_scope(name_scope): size = inputs.get_shape().as_list()[1] gamma = tf.get_variable( 'gamma', [size], initializer=tf.consta...
return tf.cond(is_training, batch_statistics, pop_statistics)
return tf.nn.batch_normalization(inputs, pop_mean, pop_var, beta, gamma, epsilon) # control flow
random_line_split
example.config.ts
namespace Example { export function addContextSelector(HawtioExtension: Core.HawtioExtension, $compile: ng.ICompileService) { 'ngInject'; HawtioExtension.add('context-selector', $scope => { $scope.contextSelectorLabel = 'Select a context...'; $scope.contextSelectorItems = <Nav.ContextSelectorItem...
}); } }
random_line_split
example.config.ts
namespace Example { export function addContextSelector(HawtioExtension: Core.HawtioExtension, $compile: ng.ICompileService)
export function addHeaderTools(HawtioExtension: Core.HawtioExtension, $compile: ng.ICompileService) { 'ngInject'; HawtioExtension.add('header-tools', $scope => { $scope.appLauncherItems = <Nav.AppLauncherItem[]>[ { label: 'App 1' }, { label: 'App 2' }, { label: 'App 3' } ...
{ 'ngInject'; HawtioExtension.add('context-selector', $scope => { $scope.contextSelectorLabel = 'Select a context...'; $scope.contextSelectorItems = <Nav.ContextSelectorItem[]>[ { label: 'A context' }, { label: 'Another context' }, { label: 'Yet another context' } ]; ...
identifier_body
example.config.ts
namespace Example { export function
(HawtioExtension: Core.HawtioExtension, $compile: ng.ICompileService) { 'ngInject'; HawtioExtension.add('context-selector', $scope => { $scope.contextSelectorLabel = 'Select a context...'; $scope.contextSelectorItems = <Nav.ContextSelectorItem[]>[ { label: 'A context' }, { label: 'An...
addContextSelector
identifier_name
__init__.py
import os import sys import warnings import opcode # opcode is not a virtualenv module, so we can use it to find the stdlib # Important! To work on pypy, this must be a module that resides in the # lib-python/modified-x.y.z directory dirname = os.path.dirname distutils_path = os.path.join...
from distutils.command import build_ext as build_ext_module build_ext_module.build_ext = build_ext ## distutils.dist patches: old_find_config_files = dist.Distribution.find_config_files def find_config_files(self): found = old_find_config_files(self) system_distutils = os.path.join(dist...
if self.library_dirs is None: self.library_dirs = [] elif isinstance(self.library_dirs, basestring): self.library_dirs = self.library_dirs.split(os.pathsep) self.library_dirs.insert(0, os.path.join(sys.real_prefix, "Libs")) old_build_ext.f...
identifier_body
__init__.py
import os import sys import warnings import opcode # opcode is not a virtualenv module, so we can use it to find the stdlib # Important! To work on pypy, this must be a module that resides in the # lib-python/modified-x.y.z directory dirname = os.path.dirname distutils_path = os.path.join...
elif isinstance(self.library_dirs, basestring): self.library_dirs = self.library_dirs.split(os.pathsep) self.library_dirs.insert(0, os.path.join(sys.real_prefix, "Libs")) old_build_ext.finalize_options(self) from distutils.command import...
self.library_dirs = []
conditional_block
__init__.py
import os import sys import warnings import opcode # opcode is not a virtualenv module, so we can use it to find the stdlib # Important! To work on pypy, this must be a module that resides in the # lib-python/modified-x.y.z directory dirname = os.path.dirname distutils_path = os.path.join...
(plat_specific=0, standard_lib=0, prefix=None): if standard_lib and prefix is None: prefix = sys.real_prefix return old_get_python_lib(plat_specific, standard_lib, prefix) sysconfig_get_python_lib.__doc__ = old_get_python_lib.__doc__ sysconfig.get_python_lib = sysconfig_get_python_lib old_get_config_va...
sysconfig_get_python_lib
identifier_name
__init__.py
import os import sys import warnings import opcode # opcode is not a virtualenv module, so we can use it to find the stdlib # Important! To work on pypy, this must be a module that resides in the # lib-python/modified-x.y.z directory dirname = os.path.dirname distutils_path = os.path.join...
build_ext_module.build_ext = build_ext ## distutils.dist patches: old_find_config_files = dist.Distribution.find_config_files def find_config_files(self): found = old_find_config_files(self) system_distutils = os.path.join(distutils_path, 'distutils.cfg') #if os.path.exists(system_distutils): # ...
old_build_ext.finalize_options(self) from distutils.command import build_ext as build_ext_module
random_line_split
pyunit_link_functions_tweedie_basicGLM.py
import sys sys.path.insert(1, "../../../") import h2o def
(ip,port): # Connect to h2o h2o.init(ip,port) print "Read in prostate data." hdf = h2o.upload_file(h2o.locate("smalldata/prostate/prostate_complete.csv.zip")) print "Testing for family: TWEEDIE" print "Set variables for h2o." y = "CAPSULE" x = ["AGE","RACE","DCAPS","PSA","VOL","DPROS",...
link_functions_tweedie_basic
identifier_name
pyunit_link_functions_tweedie_basicGLM.py
import sys sys.path.insert(1, "../../../") import h2o def link_functions_tweedie_basic(ip,port): # Connect to h2o
if __name__ == "__main__": h2o.run_test(sys.argv, link_functions_tweedie_basic)
h2o.init(ip,port) print "Read in prostate data." hdf = h2o.upload_file(h2o.locate("smalldata/prostate/prostate_complete.csv.zip")) print "Testing for family: TWEEDIE" print "Set variables for h2o." y = "CAPSULE" x = ["AGE","RACE","DCAPS","PSA","VOL","DPROS","GLEASON"] print "Create models...
identifier_body
pyunit_link_functions_tweedie_basicGLM.py
import sys sys.path.insert(1, "../../../") import h2o def link_functions_tweedie_basic(ip,port): # Connect to h2o h2o.init(ip,port) print "Read in prostate data." hdf = h2o.upload_file(h2o.locate("smalldata/prostate/prostate_complete.csv.zip")) print "Testing for family: TWEEDIE" print "Set v...
if __name__ == "__main__": h2o.run_test(sys.argv, link_functions_tweedie_basic)
"{0}, r: {1}".format(deviance_h2o_tweedie, 0.721452)
random_line_split