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
SSAOPass.d.ts
import { Camera, Color, DataTexture, Material, MeshNormalMaterial, Scene, ShaderMaterial, Vector3, WebGLRenderer, WebGLRenderTarget } from '../../../src/Three'; import { Pass } from './Pass'; export class
extends Pass { constructor( scene: Scene, camera: Camera, width?: number, height?: number ); scene: Scene; camera: Camera; width: number; height: boolean; clear: boolean; kernelRadius: number; kernelSize: number; kernel: Vector3[]; noiseTexture: DataTexture; output: number; minDistance: number; maxDistan...
SSAOPass
identifier_name
issue-36082.rs
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { let mut r = 0; let s = 0; let x = RefCell::new((&mut r,s)); let val: &_ = x.borrow().0; //[ast]~^ ERROR borrowed value does not live long enough [E0597] //[ast]~| NOTE temporary value dropped here while still borrowed //[ast]~| NOTE temporary value does not live long enough //[ast]...
main
identifier_name
issue-36082.rs
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
// revisions: ast mir //[mir]compile-flags: -Z borrowck=mir // FIXME(#49821) -- No tip about using a let binding use std::cell::RefCell; fn main() { let mut r = 0; let s = 0; let x = RefCell::new((&mut r,s)); let val: &_ = x.borrow().0; //[ast]~^ ERROR borrowed value does not live long enough [E...
random_line_split
issue-36082.rs
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
//[ast]~^ NOTE temporary value needs to live until here
{ let mut r = 0; let s = 0; let x = RefCell::new((&mut r,s)); let val: &_ = x.borrow().0; //[ast]~^ ERROR borrowed value does not live long enough [E0597] //[ast]~| NOTE temporary value dropped here while still borrowed //[ast]~| NOTE temporary value does not live long enough //[ast]~| ...
identifier_body
Searching_Faculty.py
import time import os import sys import pickle a=sys.argv[1] q=open('facultysubject.txt','r') w=open('facultydept.txt','r') e=open('facultyprojects.txt','r') dic1={} dic2={} dic3={} dic1=pickle.load(q) ##print dic1.keys() dic2=pickle.load(w) ##print dic2.keys() dic3=pickle.load(e) #3print dic3.keys() print 'NAME OF FA...
if dic1.has_key(a)==False and dic2.has_key(a)==False and dic3.has_key(a)==False : print ' **************SEARACHING***************' time.sleep(2) print ' ........Sorry!No Matches Found.........'
var4=dic3[a] var5='ONGOING PROJECTS: '+var4 print var5+'\n'
conditional_block
Searching_Faculty.py
import time import os import sys import pickle a=sys.argv[1] q=open('facultysubject.txt','r') w=open('facultydept.txt','r') e=open('facultyprojects.txt','r') dic1={} dic2={} dic3={} dic1=pickle.load(q) ##print dic1.keys() dic2=pickle.load(w) ##print dic2.keys() dic3=pickle.load(e) #3print dic3.keys() print 'NAME OF FA...
##print var1 var ='SUBJECT OF FACULTY: '+var1 print var+'\n' if dic2.has_key(a)==True : var2=dic2[a] var3='DEPT. OF FACULTY: '+var2 print var3+'\n' if dic3.has_key(a)==True : var4=dic3[a] var5='ONGOING PROJECTS: '+var4 print var5+'\n' if dic1.has_key(a)==False and dic2.has_key(a)==False and dic3.has_key(a)=...
if dic1.has_key(a)==True : var1=dic1[a]
random_line_split
__init__.py
# -*- coding: utf-8 -*- # Copyright (C) 2015 mulhern <amulhern@redhat.com> # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by the # Free Software Foundation; either version 2.1 of the License, or (at your # option) any la...
================= Wrappers for libraries. .. moduleauthor:: mulhern <amulhern@redhat.com> """ from . import libc from . import libudev
random_line_split
client.js
"use strict" Meteor.startup(function () { Meteor.subscribe('users') }) Template.userList.events({ 'click .name a': manageRolesClicked, 'click .roles': manageRolesClicked }) Template.userList.helpers({ users: function () { return Meteor.users.find() }, mobile: function () { var profile = this.pro...
{ var $person, userId evt.preventDefault() $person = $(evt.target).closest('.person') userId = $person.attr('data-id') Session.set('selectedUserId', userId) $('#user-roles').modal() }
identifier_body
client.js
"use strict" Meteor.startup(function () { Meteor.subscribe('users') }) Template.userList.events({ 'click .name a': manageRolesClicked, 'click .roles': manageRolesClicked }) Template.userList.helpers({ users: function () { return Meteor.users.find() }, mobile: function () { var profile = this.pro...
return "" } }) function manageRolesClicked (evt) { var $person, userId evt.preventDefault() $person = $(evt.target).closest('.person') userId = $person.attr('data-id') Session.set('selectedUserId', userId) $('#user-roles').modal() }
{ return emails[0].address }
conditional_block
client.js
"use strict" Meteor.startup(function () { Meteor.subscribe('users') }) Template.userList.events({ 'click .name a': manageRolesClicked, 'click .roles': manageRolesClicked }) Template.userList.helpers({ users: function () { return Meteor.users.find() }, mobile: function () {
if (profile) mobile = profile.mobile if ("null" === mobile || !mobile) mobile = '' return mobile }, emailAddress: function () { var emails = this.emails if (emails && emails.length > 0) { return emails[0].address } return "" } }) function manageRolesClicked (e...
var profile = this.profile, mobile = ''
random_line_split
client.js
"use strict" Meteor.startup(function () { Meteor.subscribe('users') }) Template.userList.events({ 'click .name a': manageRolesClicked, 'click .roles': manageRolesClicked }) Template.userList.helpers({ users: function () { return Meteor.users.find() }, mobile: function () { var profile = this.pro...
(evt) { var $person, userId evt.preventDefault() $person = $(evt.target).closest('.person') userId = $person.attr('data-id') Session.set('selectedUserId', userId) $('#user-roles').modal() }
manageRolesClicked
identifier_name
flash_kl28z.py
00e7e3, 0xbdf0b005, 0x00000272, 0x40020000, 0x2800b510, 0x4804d006, 0x71c22240, 0xf0007181, 0xbd10f837, 0xbd102004, 0x40020000, 0x9f08b5f8, 0x4616001c, 0xd005460d, 0xf7ff2304, 0x2800ff49, 0xe01dd101, 0xbdf82004, 0x4478480f, 0x600d6801, 0x2202490e, 0x9a0671ca, 0x680072ca, 0x60816821, 0xf816f000, 0xd00828...
def __init__(self, target): super(Flash_kl28z, self).__init__(target, flash_algo)
identifier_body
flash_kl28z.py
4cf000, 0xd1032800, 0x19f61be4, 0x2000e7e3, 0xbdf0b005, 0x00000272, 0x40020000, 0x2800b510, 0x4804d006, 0x71c22240, 0xf0007181, 0xbd10f837, 0xbd102004, 0x40020000, 0x9f08b5f8, 0x4616001c, 0xd005460d, 0xf7ff2304, 0x2800ff49, 0xe01dd101, 0xbdf82004, 0x4478480f, 0x600d6801, 0x2202490e, 0x9a0671ca, 0x680072ca, ...
Flash_kl28z
identifier_name
flash_kl28z.py
0xf85ef000, 0xd1060004, 0x46312300, 0x68ea4628, 0xf934f000, 0xf0004604, 0x4620f81e, 0xb5febd70, 0x460b460d, 0x46014607, 0x46164811, 0xf0004448, 0x0004f8f5, 0x9001d10b, 0x21019002, 0x9100480c, 0x462a4633, 0x44484639, 0xf95ef000, 0xf0004604, 0x4620f802, 0x4808bdfe, 0x220168c1, 0x43110292, 0x477060c1, 0xd9...
'instructions' : [ 0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2, 0x4831b510, 0x6041492f, 0x60814930, 0x22806801, 0x22204391, 0x60014311, 0x4448482d, 0xf8cef000, 0xd0002800, 0xbd102001, 0x47702000, 0xb5104828, 0x44484928, 0xf8aef000, 0xd1050004...
random_line_split
cdpserver.py
def _assign_variablesReference(self, v): self._references.append(v) v.variablesReference = len(self._references) def _add_variables_references(self, v): if hasattr(v, "children") and isinstance(v.children, list) and len(v.children) > 0: self._assign_variablesReference(v) ...
self._references = [] self._scopes = [] self._fixed_reference_end = None self._fixed_scope_end = None self._known_frame_levels = []
identifier_body
cdpserver.py
._register_model = model_registers(dev) self._register_model.accessor = functools.partial(get_data_value, mroot=self._register_model) self._memory_model = model_memory(dev) self._memory_model.accessor = functools.partial(get_data_value, mroot=self._register_model) self._vt = Var_Tracker(...
b = {"verified": success, "line": line} breakpoints_set += [b] self._respond(cmd, True, body = {"breakpoints": breakpoints_set}) def __advance_to_next_line(self): while True: self.dev.rxcpu.mode.single_step = 1 count = 0 while sel...
success = self._setup_breakpoint(source, line)
conditional_block
cdpserver.py
self._register_model = model_registers(dev) self._register_model.accessor = functools.partial(get_data_value, mroot=self._register_model) self._memory_model = model_memory(dev) self._memory_model.accessor = functools.partial(get_data_value, mroot=self._register_model) self._vt = Var_Tra...
breakpoints_set = [] if "lines" in cmd["arguments"]: for line in cmd["arguments"]["lines"]: success = self._setup_breakpoint(source, line) b = {"verified": success, "line": line} breakpoints_set += [b] if "breakpoints" in cmd["arguments...
def _cmd_setBreakpoints(self, cmd): source = os.path.basename(cmd["arguments"]["source"]["path"]) self._clear_breakpoint(source)
random_line_split
cdpserver.py
[unicode(i[5:])] = getattr(self, i) def _dispatch_cmd(self, cmd): try: fncall = self.__dispatch_tbl[cmd["command"]] except: fncall = self._default_cmd fncall(cmd) def _cmd_initialize(self, cmd): self._seq = 1 ex = {} ex["supportsConfigura...
_collect_vars
identifier_name
keyvalue_differs.d.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { Provider } from '../../di'; import { ChangeDetectorRef } from '../change_detector_ref'; /** * A differ that...
}
*/ static extend(factories: KeyValueDifferFactory[]): Provider; find(kv: Object): KeyValueDifferFactory;
random_line_split
keyvalue_differs.d.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { Provider } from '../../di'; import { ChangeDetectorRef } from '../change_detector_ref'; /** * A differ that...
{ factories: KeyValueDifferFactory[]; constructor(factories: KeyValueDifferFactory[]); static create(factories: KeyValueDifferFactory[], parent?: KeyValueDiffers): KeyValueDiffers; /** * Takes an array of {@link KeyValueDifferFactory} and returns a provider used to extend the * inherited {@li...
KeyValueDiffers
identifier_name
answer_transformer.py
""" # Name: check_answer_api/utilities/answer_transformer.py # Description: # Created by: Unknown # Date Created: --- # Last Modified: Dec 2, 2016 # Modified by: Martinus Alexander """ import re import pattern_dictionary_all import pattern_dictionary_standardize_mathquill """ Helper method to make...
return expr """ Transform expression in Latex format into ASCII (Sympy) format. Approach: Recursive transformation using regular expression. """ def transform_latex_to_sympy(expression, mode="Other"): # Remove all spaces expr = expression.replace(' ', '') # Remove all '*' because it makes the dicti...
expr, count = re.subn(pattern, repl, expr)
conditional_block
answer_transformer.py
""" # Name: check_answer_api/utilities/answer_transformer.py # Description: # Created by: Unknown # Date Created: --- # Last Modified: Dec 2, 2016 # Modified by: Martinus Alexander """ import re import pattern_dictionary_all import pattern_dictionary_standardize_mathquill """ Helper method to make...
""" Transform expression in Latex format into ASCII (Sympy) format. Approach: Recursive transformation using regular expression. """ def transform_latex_to_sympy(expression, mode="Other"): # Remove all spaces expr = expression.replace(' ', '') # Remove all '*' because it makes the dictionary fails (the...
count = 1 expr = expression[:] while count != 0: expr, count = re.subn(pattern, repl, expr) return expr
identifier_body
answer_transformer.py
""" # Name: check_answer_api/utilities/answer_transformer.py # Description: # Created by: Unknown # Date Created: --- # Last Modified: Dec 2, 2016 # Modified by: Martinus Alexander """ import re import pattern_dictionary_all import pattern_dictionary_standardize_mathquill """ Helper method to make...
(pattern, repl, expression): count = 1 expr = expression[:] while count != 0: expr, count = re.subn(pattern, repl, expr) return expr """ Transform expression in Latex format into ASCII (Sympy) format. Approach: Recursive transformation using regular expression. """ def transform_latex_to_sym...
replace_recursive
identifier_name
answer_transformer.py
""" # Name: check_answer_api/utilities/answer_transformer.py
# Modified by: Martinus Alexander """ import re import pattern_dictionary_all import pattern_dictionary_standardize_mathquill """ Helper method to make sure that the process is recursive. """ def replace_recursive(pattern, repl, expression): count = 1 expr = expression[:] while count != 0: ex...
# Description: # Created by: Unknown # Date Created: --- # Last Modified: Dec 2, 2016
random_line_split
mock_store.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. */ use std::collections::HashMap; use std::sync::{ atomic::{AtomicUsize, Ordering}, Arc, Mutex, }; #[derive(Debug, PartialEq)] pub st...
(&self) -> MockStoreStats { MockStoreStats { sets: self.set_count.load(Ordering::SeqCst), gets: self.get_count.load(Ordering::SeqCst), misses: self.miss_count.load(Ordering::SeqCst), hits: self.hit_count.load(Ordering::SeqCst), } } } impl<T: Clone> Mo...
stats
identifier_name
mock_store.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. */ use std::collections::HashMap; use std::sync::{ atomic::{AtomicUsize, Ordering}, Arc, Mutex, }; #[derive(Debug, PartialEq)] pub st...
gets: 2, misses: 1, hits: 1 } ); } }
store.stats(), MockStoreStats { sets: 1,
random_line_split
mock_store.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. */ use std::collections::HashMap; use std::sync::{ atomic::{AtomicUsize, Ordering}, Arc, Mutex, }; #[derive(Debug, PartialEq)] pub st...
} #[cfg(test)] mod test { use super::*; #[test] fn test_counts() { let store = MockStore::new(); assert_eq!( store.stats(), MockStoreStats { sets: 0, gets: 0, misses: 0, hits: 0 } )...
{ self.data.lock().expect("poisoned lock").clone() }
identifier_body
config-functions.ts
/** * Copyright 2013-2019 GenieACS Inc. * * This file is part of GenieACS. * * GenieACS is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) an...
res += w; const v = config[k]; delete config[k]; config[k] = v; } return res; } export function structureConfig(config: Config[]): any { config.sort((a, b) => (a._id > b._id ? 1 : a._id < b._id ? -1 : 0)); const _config = {}; for (const c of config) { const keys = c._id.split("."); l...
{ let res = 1; if (typeof config !== "object") return res; if (Array.isArray(config)) { for (const c of config) res += orderKeys(c); return res; } const weights: [string, number][] = Object.entries(config).map(([k, v]) => [ k, orderKeys(v), ]); weights.sort((a, b) => { if (a[1] !== b...
identifier_body
config-functions.ts
/** * Copyright 2013-2019 GenieACS Inc. * * This file is part of GenieACS. * * GenieACS is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) an...
(config: any): number { let res = 1; if (typeof config !== "object") return res; if (Array.isArray(config)) { for (const c of config) res += orderKeys(c); return res; } const weights: [string, number][] = Object.entries(config).map(([k, v]) => [ k, orderKeys(v), ]); weights.sort((a, b) =...
orderKeys
identifier_name
config-functions.ts
/** * Copyright 2013-2019 GenieACS Inc. * * This file is part of GenieACS. * * GenieACS is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) an...
return diff; }
for (const [k, v] of Object.entries(target)) if (!current[k] || current[k] !== v) diff.add.push({ _id: k, value: v }); for (const k of Object.keys(current)) if (!target[k]) diff.remove.push(k);
random_line_split
fix.py
import json with open('medalofhonor-old.json') as input: data = json.load(input) months = { 'January': 1, 'February': 2, 'March': 3, 'April': 4, 'May': 5, 'June': 6, 'July': 7, 'August': 8, 'September': 9, 'October': 10, 'November': 11, 'December': 12, } d...
(record): if ',' in record['Place / Date']: try: year, month, day = record['Place / Date'].rsplit(",", 1)[1].strip().split(" ") year, day = int(year), int(day) month = months[month] return [year, month, day] except KeyError: return [int(rec...
parse_locdate
identifier_name
fix.py
import json with open('medalofhonor-old.json') as input: data = json.load(input) months = { 'January': 1, 'February': 2, 'March': 3, 'April': 4, 'May': 5, 'June': 6, 'July': 7, 'August': 8, 'September': 9, 'October': 10, 'November': 11, 'December': 12, } d...
'longitude': force_int(record['location'].get('longitude', 0)), 'name': record['location'].get('name', 'Unknown'), }, 'General Order number': force_int(record['G.O. Number']), 'citation': record['citation'], 'issued': record['Date of Issue'...
'latitude': force_int(record['location'].get('latitude', 0)),
random_line_split
fix.py
import json with open('medalofhonor-old.json') as input: data = json.load(input) months = { 'January': 1, 'February': 2, 'March': 3, 'April': 4, 'May': 5, 'June': 6, 'July': 7, 'August': 8, 'September': 9, 'October': 10, 'November': 11, 'December': 12, } d...
def parse_birth(record): if ',' in record['Born']: date, location = record['Born'].split(",", 1) try: year, month, day = date.split(" ") year, day = int(year), int(day) month = months[month] return [year, month, day, location] except...
if ',' in record['Place / Date']: try: year, month, day = record['Place / Date'].rsplit(",", 1)[1].strip().split(" ") year, day = int(year), int(day) month = months[month] return [year, month, day] except KeyError: return [int(record['Place / D...
identifier_body
fix.py
import json with open('medalofhonor-old.json') as input: data = json.load(input) months = { 'January': 1, 'February': 2, 'March': 3, 'April': 4, 'May': 5, 'June': 6, 'July': 7, 'August': 8, 'September': 9, 'October': 10, 'November': 11, 'December': 12, } d...
from pprint import pprint [parse_locdate(record) for record in data] new_data = [ { 'name': record['name'].title(), 'death': record['Departed'] == 'Yes', 'awarded': { 'date': { 'year': parse_locdate(record)[2], 'month': parse_locdate...
try: return [-1, -1, int(record['Born']), ""] except ValueError: return [-1, -1, -1, record['Born']]
conditional_block
loading_dialog.js
/** * Created by liumengjun on 2016-04-11. * 注: 不用于微信端, 微信端自行处理 */ function showLoading(msg) { var $loadingDialog = $('#mLoadingDialog'); var $loadingText = $("#mLoadingText"); $loadingText.html(msg ? msg : ""); $loadingDialog.show(); } function hideLoading() { $('#mLoadingDialog').hide(); } var ...
alaAjaxPost(url, data, success, dataType, error, loadingMsg) { return _malaAjax0('post', url, data, success, dataType, error, loadingMsg); } function malaAjaxGet(url, data, success, dataType, error, loadingMsg) { return _malaAjax0('get', url, data, success, dataType, error, loadingMsg); }
} hideLoading(); } }); } function m
conditional_block
loading_dialog.js
/** * Created by liumengjun on 2016-04-11. * 注: 不用于微信端, 微信端自行处理 */ function showLoading(msg) { var $loadingDialog = $('#mLoadingDialog'); var $loadingText = $("#mLoadingText"); $loadingText.html(msg ? msg : ""); $loadingDialog.show(); } function hideLoading() { $('#mLoadingDialog').hide(); } var ...
turn _malaAjax0('post', url, data, success, dataType, error, loadingMsg); } function malaAjaxGet(url, data, success, dataType, error, loadingMsg) { return _malaAjax0('get', url, data, success, dataType, error, loadingMsg); }
sg) { re
identifier_name
loading_dialog.js
/** * Created by liumengjun on 2016-04-11. * 注: 不用于微信端, 微信端自行处理 */ function showLoading(msg) { var $loadingDialog = $('#mLoadingDialog'); var $loadingText = $("#mLoadingText"); $loadingText.html(msg ? msg : ""); $loadingDialog.show(); } function hideLoading() { $('#mLoadingDialog').hide(); } var ...
e, error, loadingMsg); }
identifier_body
loading_dialog.js
/** * Created by liumengjun on 2016-04-11. * 注: 不用于微信端, 微信端自行处理 */ function showLoading(msg) { var $loadingDialog = $('#mLoadingDialog'); var $loadingText = $("#mLoadingText"); $loadingText.html(msg ? msg : ""); $loadingDialog.show(); } function hideLoading() {
loadingMsg = error; error = dataType; dataType = success; success = data; data = undefined; } if ($.isFunction(dataType)) { loadingMsg = error; error = dataType; dataType = undefined; } showLoading(loadingMsg); return $.ajax({ u...
$('#mLoadingDialog').hide(); } var DEFAULT_ERR_MSG = '请求失败, 请稍后重试, 或联系管理员!'; function _malaAjax0(method, url, data, success, dataType, error, loadingMsg) { if ($.isFunction(data)) {
random_line_split
borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ let mut _a = 3; let b = &mut _a; { let c = &*b; _a = 4; //[ast]~ ERROR cannot assign to `_a` //[mir]~^ ERROR cannot assign to `_a` because it is borrowed drop(c); } drop(b); }
identifier_body
borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { let mut _a = 3; let b = &mut _a; { let c = &*b; _a = 4; //[ast]~ ERROR cannot assign to `_a` //[mir]~^ ERROR cannot assign to `_a` because it is borrowed drop(c); } drop(b); }
main
identifier_name
borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
_a = 4; //[ast]~ ERROR cannot assign to `_a` //[mir]~^ ERROR cannot assign to `_a` because it is borrowed drop(c); } drop(b); }
let c = &*b;
random_line_split
CallsInfoResponse.ts
/* eslint-disable */ ///////////////////////////////////////////////////////////////////////////////////////// // // // !!! DO NOT EDIT THIS FILE !!! // // ...
call?: Call; error?: string; needed?: string; provided?: string; }; export interface Call { id?: string; date_start?: number; external_unique_id?: string; join_url?: string; channels?: string[]; external_display_id?: string; title?: ...
import { WebAPICallResult } from '../WebClient'; export type CallsInfoResponse = WebAPICallResult & { ok?: boolean;
random_line_split
shapeshift.js
// Copyright 2015-2017 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any lat...
() { this.store.retrieveCoins(); } componentWillUnmount () { this.store.unsubscribe(); } render () { const { error, stage } = this.store; return ( <Portal activeStep={ stage } busySteps={ [ STAGE_WAIT_DEPOSIT, STAGE_WAIT_EXCHANGE ] } ...
componentDidMount
identifier_name
shapeshift.js
// Copyright 2015-2017 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any lat...
]; } } renderPage () { const { error, stage } = this.store; if (error) { return ( <ErrorStep store={ this.store } /> ); } switch (stage) { case STAGE_OPTIONS: return ( <OptionsStep store={ this.store } /> ); case STAGE_WAIT_DE...
onClick={ this.onClose } />
random_line_split
Fonts.py
# # Copyright 2001 - 2006 Ludek Smid [http://www.ospace.net/] # # This file is part of Pygame.UI. # # Pygame.UI is free software; you can redistribute it and/or modify # it under the terms of the Lesser GNU General Public License as published by # the Free Software Foundation; either version 2.1 of the Lice...
if misses > 2000: print 'FONT CACHE STATS:', misses, hits, hits / float(misses + hits) misses = 0 fontCache.clear() return surface def renderSmartText(surface, x, y, name, text, antialias, fg, bg = None): # TODO pass def getTextSize(name, text): #return renderText(name, text, 1, (0x00, 0x00, 0x...
antialias = 1 tType = type(text) if tType != StringType and tType != UnicodeType: text = str(text) if len(text) == 0: # TODO return very small surface text = " " #@print "->", text, "<-", type(text) global misses, hits, fontCache surface = fontCache.get((name, text, antialias, fg, bg), None) if n...
identifier_body
Fonts.py
# # Copyright 2001 - 2006 Ludek Smid [http://www.ospace.net/] # # This file is part of Pygame.UI. # # Pygame.UI is free software; you can redistribute it and/or modify # it under the terms of the Lesser GNU General Public License as published by # the Free Software Foundation; either version 2.1 of the Lice...
(name): return fontFaces[name].get_linesize()
getLineSize
identifier_name
Fonts.py
# # Copyright 2001 - 2006 Ludek Smid [http://www.ospace.net/] # # This file is part of Pygame.UI. # # Pygame.UI is free software; you can redistribute it and/or modify # it under the terms of the Lesser GNU General Public License as published by # the Free Software Foundation; either version 2.1 of the Lice...
else: surface = fontFaces[name].render(text, antialias, fg) fontCache[name, text, antialias, fg, bg] = surface else: hits += 1 # clean up cache if size is > 2000 if misses > 2000: print 'FONT CACHE STATS:', misses, hits, hits / float(misses + hits) misses = 0 fontCache.clear() return surfac...
if not surface: misses += 1 if bg: surface = fontFaces[name].render(text, antialias, fg, bg)
random_line_split
Fonts.py
# # Copyright 2001 - 2006 Ludek Smid [http://www.ospace.net/] # # This file is part of Pygame.UI. # # Pygame.UI is free software; you can redistribute it and/or modify # it under the terms of the Lesser GNU General Public License as published by # the Free Software Foundation; either version 2.1 of the Lice...
if len(text) == 0: # TODO return very small surface text = " " #@print "->", text, "<-", type(text) global misses, hits, fontCache surface = fontCache.get((name, text, antialias, fg, bg), None) if not surface: misses += 1 if bg: surface = fontFaces[name].render(text, antialias, fg, bg) els...
text = str(text)
conditional_block
uhci.rs
use alloc::boxed::Box; use collections::vec::Vec; use core::intrinsics::volatile_load; use core::mem; use scheduler::context::context_switch; use common::debug; use common::memory::Memory; use drivers::pci::config::PciConfig; use drivers::pio::*; use schemes::KScheme; use super::{Hci, Packet, Pipe, Setup}; pub ...
{ pub base: usize, pub irq: u8, pub frame_list: Memory<u32>, } impl KScheme for Uhci { fn on_irq(&mut self, irq: u8) { if irq == self.irq { // d("UHCI IRQ\n"); } } fn on_poll(&mut self) { } } #[repr(packed)] #[derive(Copy, Clone, Debug, Default)] struct Td { ...
Uhci
identifier_name
uhci.rs
use alloc::boxed::Box; use collections::vec::Vec; use core::intrinsics::volatile_load; use core::mem; use scheduler::context::context_switch; use common::debug; use common::memory::Memory; use drivers::pci::config::PciConfig; use drivers::pio::*; use schemes::KScheme; use super::{Hci, Packet, Pipe, Setup}; pub ...
debug::d(" FRNUM "); debug::dh(inw(frnum) as usize); outw(frnum, 0); debug::d(" to "); debug::dh(inw(frnum) as usize); debug::d(" FLBASEADD "); debug::dh(ind(flbaseadd) as usize); for i in 0..1024 { self.frame_list.write(i, 1); } ...
debug::d(" INTR "); debug::dh(inw(usbintr) as usize);
random_line_split
uhci.rs
use alloc::boxed::Box; use collections::vec::Vec; use core::intrinsics::volatile_load; use core::mem; use scheduler::context::context_switch; use common::debug; use common::memory::Memory; use drivers::pci::config::PciConfig; use drivers::pio::*; use schemes::KScheme; use super::{Hci, Packet, Pipe, Setup}; pub ...
} #[repr(packed)] #[derive(Copy, Clone, Debug, Default)] struct Td { link_ptr: u32, ctrl_sts: u32, token: u32, buffer: u32, } #[repr(packed)] #[derive(Copy, Clone, Debug, Default)] struct Qh { head_ptr: u32, element_ptr: u32, } impl Uhci { pub unsafe fn new(mut pci: PciConfig) -> Box<Sel...
{ }
identifier_body
fr.py
delete this object?': 'Êtes-vous sûr de vouloir supprimer cet objet?', 'Authentication': 'Authentification', 'Available Databases and Tables': 'Bases de données et tables disponibles', 'Buy this book': 'Acheter ce livre', 'cache': 'cache', 'Cache': 'Cache', 'Cache Keys': 'Clés de cache', 'Cannot be empty': 'Ne peut pa...
'You are successfully running web2py': 'Vous exécutez avec succès web2py', 'You can modify this application and adapt it to your needs': "Vous pouvez modifier cette application et l'adapter à vos besoins",
random_line_split
equipamento.service.ts
import { Injectable } from '@angular/core'; import { Http, Response, Headers, RequestOptions } from '@angular/http'; import { AuthHttp } from 'angular2-jwt'; import { Observable } from 'rxjs/Observable'; @Injectable() export class EquipamentoService { private url = 'http://localhost:8000/api/equipamentos'; cons...
let errMsg = error.message || 'Server error'; console.error(errMsg); return Observable.throw(errMsg); } }
random_line_split
equipamento.service.ts
import { Injectable } from '@angular/core'; import { Http, Response, Headers, RequestOptions } from '@angular/http'; import { AuthHttp } from 'angular2-jwt'; import { Observable } from 'rxjs/Observable'; @Injectable() export class EquipamentoService { private url = 'http://localhost:8000/api/equipamentos'; cons...
() { return this.authHttp.get(this.url) .map(this.extractData) .catch(this.handleError); } private extractData(res: Response) { if (res.status < 200 || res.status >= 300) { throw new Error('Bad response status: ' + res.status); } let body = res.json(); return body || {}; } private han...
getEquipamentos
identifier_name
equipamento.service.ts
import { Injectable } from '@angular/core'; import { Http, Response, Headers, RequestOptions } from '@angular/http'; import { AuthHttp } from 'angular2-jwt'; import { Observable } from 'rxjs/Observable'; @Injectable() export class EquipamentoService { private url = 'http://localhost:8000/api/equipamentos'; cons...
let body = res.json(); return body || {}; } private handleError(error: any) { console.log(error.message); let errMsg = error.message || 'Server error'; console.error(errMsg); return Observable.throw(errMsg); } }
{ throw new Error('Bad response status: ' + res.status); }
conditional_block
equipamento.service.ts
import { Injectable } from '@angular/core'; import { Http, Response, Headers, RequestOptions } from '@angular/http'; import { AuthHttp } from 'angular2-jwt'; import { Observable } from 'rxjs/Observable'; @Injectable() export class EquipamentoService { private url = 'http://localhost:8000/api/equipamentos'; cons...
}
{ console.log(error.message); let errMsg = error.message || 'Server error'; console.error(errMsg); return Observable.throw(errMsg); }
identifier_body
browser.py
# -*- coding: utf-8 -*- # Copyright(C) 2013 Julien Veyssier # # This file is part of weboob. # # weboob is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your op...
def iter_movie_persons(self, movie_id, role): self.location('http://www.imdb.com/title/%s/fullcredits' % movie_id) assert self.is_on_page(MovieCrewPage) for p in self.page.iter_persons(role): yield p def iter_person_movies(self, person_id, role): self.location('htt...
self.location('http://www.imdb.com/name/%s/bio' % id) assert self.is_on_page(BiographyPage) return self.page.get_biography()
identifier_body
browser.py
# -*- coding: utf-8 -*- # Copyright(C) 2013 Julien Veyssier # # This file is part of weboob. # # weboob is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your op...
movie = Movie(id, title) movie.other_titles = other_titles movie.release_date = release_date movie.duration = duration movie.genres = genres movie.pitch = pitch movie.country = country movie.note = note movie.roles = roles movie.short_desc...
note = u'%s/10 (%s votes)' % (jres['rating'], jres['rating_count']) for r in ['actor', 'director', 'writer']: if '%ss' % r in jres: roles['%s' % r] = list(jres['%ss' % r])
random_line_split
browser.py
# -*- coding: utf-8 -*- # Copyright(C) 2013 Julien Veyssier # # This file is part of weboob. # # weboob is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your op...
if 'also_known_as' in jres: for other_t in jres['also_known_as']: if 'country' in other_t and 'title' in other_t: other_titles.append('%s : %s' % (other_t['country'], htmlparser.unescape(other_t['title']))) if 'release_date' in jres: dstr = st...
duration = int(dur_str[1].split()[0])
conditional_block
browser.py
# -*- coding: utf-8 -*- # Copyright(C) 2013 Julien Veyssier # # This file is part of weboob. # # weboob is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your op...
(self, pattern): res = self.readurl('http://www.imdb.com/xml/find?json=1&nr=1&nm=on&q=%s' % pattern.encode('utf-8')) jres = json.loads(res) htmlparser = HTMLParser() for cat in ['name_popular', 'name_exact', 'name_approx']: if cat in jres: for p in jres[cat]: ...
iter_persons
identifier_name
lib.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! This module contains traits in script used generically in the rest of Servo. //! The traits are here instead o...
impl DomParallelInfo { pub fn new() -> DomParallelInfo { DomParallelInfo { children_to_process: AtomicIsize::new(0), } } } #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum LayoutNodeType { Element(LayoutElementType), Text, } #[derive(Clone, Copy, Debug, Eq, PartialEq...
random_line_split
lib.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! This module contains traits in script used generically in the rest of Servo. //! The traits are here instead o...
{ Element(LayoutElementType), Text, } #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum LayoutElementType { Element, HTMLCanvasElement, HTMLIFrameElement, HTMLImageElement, HTMLInputElement, HTMLObjectElement, HTMLTableCellElement, HTMLTableColElement, HTMLTableElement,...
LayoutNodeType
identifier_name
htmlhrelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLHRElementBinding; use dom::bindings::codegen::InheritTypes::HTMLHRElemen...
(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLHRElement { HTMLHRElement { htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLHRElement, localName, prefix, document) } } #[allow(unrooted_must_root)] pub fn new(localName: DOMString, ...
new_inherited
identifier_name
htmlhrelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLHRElementBinding; use dom::bindings::codegen::InheritTypes::HTMLHRElemen...
#[allow(unrooted_must_root)] pub fn new(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> Root<HTMLHRElement> { let element = HTMLHRElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLHRElementB...
{ HTMLHRElement { htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLHRElement, localName, prefix, document) } }
identifier_body
htmlhrelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLHRElementBinding; use dom::bindings::codegen::InheritTypes::HTMLHRElemen...
document: &Document) -> Root<HTMLHRElement> { let element = HTMLHRElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLHRElementBinding::Wrap) } }
random_line_split
config.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # config.py # # Copyright 2013 Cinnarch # # 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 the License, or # (at your...
'timezone_human_zone' : '', \ 'timezone_country' : '', \ 'timezone_zone' : '', \ 'timezone_human_country' : '', \ 'timezone_comment' : '', \ 'timezone_latitude' : 0, \ 'timezone_longitude' : 0, \ ...
'locale' : '', \ 'keyboard_layout' : '', \ 'keyboard_variant' : '', \
random_line_split
index.stories.tsx
/* import React from 'react' import * as Types from '../../../../constants/types/chat2' import {storiesOf} from '../../../../stories/storybook' import MessagePlaceholder from '.' const load = () => { storiesOf('Chat/Conversation/Rows', module).add('Placeholder', () => ( <> <MessagePlaceholder ordinal={Type...
export default {}
random_line_split
arrow-up-circle.js
import React, { forwardRef } from 'react'; import PropTypes from 'prop-types'; const ArrowUpCircle = forwardRef(({ color = 'currentColor', size = 24, ...rest }, ref) => { return ( <svg ref={ref} xmlns="http://www.w3.org/2000/svg" width={size} height={size} viewBox="0 0 24 24" ...
<polyline points="16 12 12 8 8 12" /> <line x1="12" y1="16" x2="12" y2="8" /> </svg> ); }); ArrowUpCircle.propTypes = { color: PropTypes.string, size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), }; ArrowUpCircle.displayName = 'ArrowUpCircle'; export default ArrowUpCircle;
random_line_split
cpp_postman.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2009, Roboterclub Aachen e.V. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the ...
(self, optparser): optparser.add_option( "--container", dest = "container", default = None, help = "name of the container in the XML file") optparser.add_option( "--namespace", dest = "namespace", default = "robot", help = "Namespace of the generated identifiers.") def generate(sel...
setup
identifier_name
cpp_postman.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2009, Roboterclub Aachen e.V. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the ...
if self.options.namespace: namespace = self.options.namespace else: raise builder_base.BuilderException("You need to provide a namespace!") cppFilter = { 'camelcase': filter_lower, 'camelCase': filter.variableName, 'CamelCase': filter.typeName, 'CAMELCASE': filter.enumElement, } containe...
raise builder_base.BuilderException("Please specify a valid container!")
conditional_block
cpp_postman.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2009, Roboterclub Aachen e.V. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the ...
def generate(self): # check the commandline options if not self.options.outpath: raise builder_base.BuilderException("You need to provide an output path!") if not self.options.container or self.options.container not in self.tree.container: raise builder_base.BuilderException("Please specify a valid conta...
optparser.add_option( "--container", dest = "container", default = None, help = "name of the container in the XML file") optparser.add_option( "--namespace", dest = "namespace", default = "robot", help = "Namespace of the generated identifiers.")
identifier_body
cpp_postman.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2009, Roboterclub Aachen e.V. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the ...
default = "robot", help = "Namespace of the generated identifiers.") def generate(self): # check the commandline options if not self.options.outpath: raise builder_base.BuilderException("You need to provide an output path!") if not self.options.container or self.options.container not in self.tree.con...
"--namespace", dest = "namespace",
random_line_split
test_strcasecmp.py
import angr import claripy import os test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests') def test_i386(): p = angr.Project(os.path.join(test_location, 'i386', 'test_strcasecmp'), auto_load_libs=False) arg1 = claripy.BVS('arg1', 20*8) s = p.factory.en...
test_i386()
conditional_block
test_strcasecmp.py
import angr
test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests') def test_i386(): p = angr.Project(os.path.join(test_location, 'i386', 'test_strcasecmp'), auto_load_libs=False) arg1 = claripy.BVS('arg1', 20*8) s = p.factory.entry_state(args=("test_strcasecmp", arg1...
import claripy import os
random_line_split
test_strcasecmp.py
import angr import claripy import os test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests') def
(): p = angr.Project(os.path.join(test_location, 'i386', 'test_strcasecmp'), auto_load_libs=False) arg1 = claripy.BVS('arg1', 20*8) s = p.factory.entry_state(args=("test_strcasecmp", arg1)) sm = p.factory.simulation_manager(s) sm.explore() sm.move('deadended', 'found', filter_func=lambda s: b"W...
test_i386
identifier_name
test_strcasecmp.py
import angr import claripy import os test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests') def test_i386():
if __name__ == "__main__": test_i386()
p = angr.Project(os.path.join(test_location, 'i386', 'test_strcasecmp'), auto_load_libs=False) arg1 = claripy.BVS('arg1', 20*8) s = p.factory.entry_state(args=("test_strcasecmp", arg1)) sm = p.factory.simulation_manager(s) sm.explore() sm.move('deadended', 'found', filter_func=lambda s: b"Welcome" ...
identifier_body
enumeration.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from .base import BaseDomainNameScanQuery
""" @classmethod def get_queried_class(cls): from wselasticsearch.models import SubdomainEnumerationModel return SubdomainEnumerationModel def filter_by_enumeration_method(self, method): """ Apply a filter to this query that restricts results to only those results found...
class SubdomainEnumerationQuery(BaseDomainNameScanQuery): """ This is an Elasticsearch query class for querying SubdomainEnumerationModel objects.
random_line_split
enumeration.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from .base import BaseDomainNameScanQuery class SubdomainEnumerationQuery(BaseDomainNameScanQuery): """ This is an Elasticsearch query class for querying SubdomainEnumerationModel objects. """ @classmethod def get_queried_class(cls):...
def filter_by_enumeration_method(self, method): """ Apply a filter to this query that restricts results to only those results found by the given method. :param method: The method to filter on. :return: None """ self.must_by_term(key="enumeration_method", val...
from wselasticsearch.models import SubdomainEnumerationModel return SubdomainEnumerationModel
identifier_body
enumeration.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from .base import BaseDomainNameScanQuery class SubdomainEnumerationQuery(BaseDomainNameScanQuery): """ This is an Elasticsearch query class for querying SubdomainEnumerationModel objects. """ @classmethod def
(cls): from wselasticsearch.models import SubdomainEnumerationModel return SubdomainEnumerationModel def filter_by_enumeration_method(self, method): """ Apply a filter to this query that restricts results to only those results found by the given method. :param method...
get_queried_class
identifier_name
exp4p.py
""" EXP4.P: An extention to exponential-weight algorithm for exploration and exploitation. This module contains a class that implements EXP4.P, a contextual bandit algorithm with expert advice. """ import logging import six from six.moves import zip import numpy as np from striatum.bandit.bandit import BaseBandit L...
action_probs_list = np.asarray(action_probs_list) action_probs_list /= action_probs_list.sum() estimated_reward = {} uncertainty = {} score = {} for action_id, action_prob in zip(self.action_ids, action_probs_list): estimated_reward[action_id] = action_prob ...
weighted_exp = [w[advisor_id] * context[advisor_id][action_id] for advisor_id in advisor_ids] prob_vector = np.sum(weighted_exp) / w_sum action_probs_list.append((1 - self.n_actions * self.p_min) * prob_vector ...
conditional_block
exp4p.py
""" EXP4.P: An extention to exponential-weight algorithm for exploration and exploitation. This module contains a class that implements EXP4.P, a contextual bandit algorithm with expert advice. """ import logging import six from six.moves import zip import numpy as np from striatum.bandit.bandit import BaseBandit L...
(BaseBandit): r"""Exp4.P with pre-trained supervised learning algorithm. Parameters ---------- actions : list of Action objects List of actions to be chosen from. historystorage: a HistoryStorage object The place where we store the histories of contexts and rewards. modelstora...
Exp4P
identifier_name
exp4p.py
""" EXP4.P: An extention to exponential-weight algorithm for exploration and
bandit algorithm with expert advice. """ import logging import six from six.moves import zip import numpy as np from striatum.bandit.bandit import BaseBandit LOGGER = logging.getLogger(__name__) class Exp4P(BaseBandit): r"""Exp4.P with pre-trained supervised learning algorithm. Parameters ---------- ...
exploitation. This module contains a class that implements EXP4.P, a contextual
random_line_split
exp4p.py
""" EXP4.P: An extention to exponential-weight algorithm for exploration and exploitation. This module contains a class that implements EXP4.P, a contextual bandit algorithm with expert advice. """ import logging import six from six.moves import zip import numpy as np from striatum.bandit.bandit import BaseBandit L...
"given is: %f" % p_min) else: self.p_min = p_min # Initialize the model storage model = { # probability distribution for action recommendation 'action_probs': {}, # weight vector for each expert 'w': {}, ...
super(Exp4P, self).__init__(historystorage, modelstorage, actions) self.n_total = 0 # number of actions (i.e. K in the paper) self.n_actions = len(self._actions) self.max_rounds = max_rounds # delta > 0 if not isinstance(delta, float): raise ValueError("delta...
identifier_body
any.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. //! Traits for dynamic typing of any `'static` type (through runtime reflection) //! //!...
random_line_split
any.rs
// Copyright 2013-2014 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...
<T: 'static>(self) -> bool { // Get TypeId of the type this function is instantiated with let t = TypeId::of::<T>(); // Get TypeId of the type in the trait object let boxed = self.get_type_id(); // Compare both TypeIds on equality t == boxed } #[inline] fn ...
is
identifier_name
any.rs
// Copyright 2013-2014 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...
} /// Extension methods for a mutable referenced `Any` trait object pub trait AnyMutRefExt<'a> { /// Returns some mutable reference to the boxed value if it is of type `T`, or /// `None` if it isn't. fn as_mut<T: 'static>(self) -> Option<&'a mut T>; } impl<'a> AnyMutRefExt<'a> for &'a mut Any { #[inl...
{ if self.is::<T>() { unsafe { // Get the raw representation of the trait object let to: TraitObject = transmute_copy(&self); // Extract the data pointer Some(transmute(to.data)) } } else { None ...
identifier_body
any.rs
// Copyright 2013-2014 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...
} } /// Extension methods for a mutable referenced `Any` trait object pub trait AnyMutRefExt<'a> { /// Returns some mutable reference to the boxed value if it is of type `T`, or /// `None` if it isn't. fn as_mut<T: 'static>(self) -> Option<&'a mut T>; } impl<'a> AnyMutRefExt<'a> for &'a mut Any { ...
{ None }
conditional_block
login.js
const express = require('express'); const router = express.Router(); const indexController = require('../controllers/index'); const bcrypt = require('bcryptjs'); const salt = bcrypt.genSaltSync(10); const knex = require('../db/knex'); const existingUser = require('../auth/init').existingUser; router.get('/', function ...
} // const loginPassword = bcrypt.hashSync(req.body.password, salt); // console.log('route pass', existingUser(loginUsername, loginPassword)); // if (existingUser(loginUsername, loginPassword) === 1) { // res.redirect('/'); // } else if (existingUser(loginUsername, loginPassword) === 0){ // const rend...
} }) .catch(err => { console.log(err); })
random_line_split
login.js
const express = require('express'); const router = express.Router(); const indexController = require('../controllers/index'); const bcrypt = require('bcryptjs'); const salt = bcrypt.genSaltSync(10); const knex = require('../db/knex'); const existingUser = require('../auth/init').existingUser; router.get('/', function ...
} }) .catch(err => { console.log(err); }) } // const loginPassword = bcrypt.hashSync(req.body.password, salt); // console.log('route pass', existingUser(loginUsername, loginPassword)); // if (existingUser(loginUsername, loginPassword) === 1) { // res.redirect('/'); // } else if (e...
{ let result = {}; result.message = 'It just might be your password, but who knows?'; res.render('login', result); }
conditional_block
CohortPage.js
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { dataBind } from 'dbdi/react'; import { Alert, Button, Jumbotron, Well, Panel } from 'react-bootstrap'; import { LoadOverlay } from 'src/views/components/overlays'; import CohortList from 'src/views/components/cohorts/CohortList'...
<div className="container"> <Panel bsStyle="primary"> <Panel.Heading> Cohorts </Panel.Heading> <Panel.Body> <CohortList /> </Panel.Body> </Panel> </div> ); } }
random_line_split
CohortPage.js
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { dataBind } from 'dbdi/react'; import { Alert, Button, Jumbotron, Well, Panel } from 'react-bootstrap'; import { LoadOverlay } from 'src/views/components/overlays'; import CohortList from 'src/views/components/cohorts/CohortList'...
extends Component { static propTypes = { }; constructor(...args) { super(...args); } render( { }, { }, { currentUser_isLoaded } ) { if (!currentUser_isLoaded) { return (<LoadOverlay />); } return ( <div className="container"> <Panel bsStyle="primary"> ...
CohortPage
identifier_name
CohortPage.js
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { dataBind } from 'dbdi/react'; import { Alert, Button, Jumbotron, Well, Panel } from 'react-bootstrap'; import { LoadOverlay } from 'src/views/components/overlays'; import CohortList from 'src/views/components/cohorts/CohortList'...
return ( <div className="container"> <Panel bsStyle="primary"> <Panel.Heading> Cohorts </Panel.Heading> <Panel.Body> <CohortList /> </Panel.Body> </Panel> </div> ); } }
{ return (<LoadOverlay />); }
conditional_block
CohortPage.js
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { dataBind } from 'dbdi/react'; import { Alert, Button, Jumbotron, Well, Panel } from 'react-bootstrap'; import { LoadOverlay } from 'src/views/components/overlays'; import CohortList from 'src/views/components/cohorts/CohortList'...
}
{ if (!currentUser_isLoaded) { return (<LoadOverlay />); } return ( <div className="container"> <Panel bsStyle="primary"> <Panel.Heading> Cohorts </Panel.Heading> <Panel.Body> <CohortList /> </Panel.Body> </Panel> ...
identifier_body
Variant.tsx
import React from 'react'; import styled, { ThemeProvider } from 'styled-components'; import NoSsr from '@material-ui/core/NoSsr'; import { PropsFor, style, typography, TypographyProps } from '@material-ui/system'; const variant = style({ prop: 'variant', cssProperty: false, themeKey: 'typography', }); // ⚠ Tex...
{ return ( <NoSsr> <ThemeProvider theme={theme}> <div> <Text variant="h1" as="div"> variant=h1 </Text> <Text variant="h1" fontWeight={300} as="div"> fontWeight=300 </Text> <Text variant="h2" as="div"> variant=h2 ...
riant()
identifier_name
Variant.tsx
import React from 'react'; import styled, { ThemeProvider } from 'styled-components'; import NoSsr from '@material-ui/core/NoSsr'; import { PropsFor, style, typography, TypographyProps } from '@material-ui/system'; const variant = style({ prop: 'variant', cssProperty: false, themeKey: 'typography', }); // ⚠ Tex...
return ( <NoSsr> <ThemeProvider theme={theme}> <div> <Text variant="h1" as="div"> variant=h1 </Text> <Text variant="h1" fontWeight={300} as="div"> fontWeight=300 </Text> <Text variant="h2" as="div"> variant=h2 ...
identifier_body
Variant.tsx
import React from 'react'; import styled, { ThemeProvider } from 'styled-components'; import NoSsr from '@material-ui/core/NoSsr'; import { PropsFor, style, typography, TypographyProps } from '@material-ui/system'; const variant = style({ prop: 'variant', cssProperty: false, themeKey: 'typography', }); // ⚠ Tex...
`; const theme = { typography: { h1: { fontSize: 30, lineHeight: 1.5, }, h2: { fontSize: 25, lineHeight: 1.5, }, }, }; export default function Variant() { return ( <NoSsr> <ThemeProvider theme={theme}> <div> <Text variant="h1" as="div"> ...
${typography}
random_line_split
response.py
from datetime import datetime import hashlib from extractor import Ways from date import way_date class Helpers: ''' ''' @staticmethod def make_id(website, timestamp): ''' ''' m=hashlib.md5() m.update(''.join([website, timestamp]).encode()) return m.hexdigest() ...
def __init__(self, snap_dict): ''' ''' self._raw=snap_dict self.timestamp=snap_dict['timestamp'] self._data=self.parser.parse(self._raw['page']) self._data.update({ 'website':snap_dict['website'], 'timestamp':way_date(self.timestamp), })...
''' ''' cls.parser=ParserObj
identifier_body
response.py
from datetime import datetime import hashlib from extractor import Ways from date import way_date class Helpers: ''' ''' @staticmethod def make_id(website, timestamp): ''' ''' m=hashlib.md5() m.update(''.join([website, timestamp]).encode()) return m.hexdigest() ...
''' cls.parser=ParserObj def __init__(self, snap_dict): ''' ''' self._raw=snap_dict self.timestamp=snap_dict['timestamp'] self._data=self.parser.parse(self._raw['page']) self._data.update({ 'website':snap_dict['website'], 'timestamp':...
def set_parser(cls, ParserObj): '''
random_line_split
response.py
from datetime import datetime import hashlib from extractor import Ways from date import way_date class Helpers: ''' ''' @staticmethod def make_id(website, timestamp): ''' ''' m=hashlib.md5() m.update(''.join([website, timestamp]).encode()) return m.hexdigest() ...
(self): ''' ''' return {k:v for k,v in self._data.items() if k != 'page'} @property def snapshot(self): ''' ''' return self._data['page'] @property def data(self): ''' ''' return self._data WayDefault.set_parser(Ways)
extracted
identifier_name
package.py
############################################################################## # Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
(RPackage): """Provides efficient low-level and highly reusable S4 classes for storing, manipulating and aggregating over annotated ranges of integers. Implements an algebra of range operations, including efficient algorithms for finding overlaps and nearest neighbors. Defines efficient list...
RIranges
identifier_name