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
json_dumper.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 ...
<O: DumpOutput> { result: Analysis, config: Config, output: O, } pub trait DumpOutput { fn dump(&mut self, result: &Analysis); } pub struct WriteOutput<'b, W: Write + 'b> { output: &'b mut W, } impl<'b, W: Write> DumpOutput for WriteOutput<'b, W> { fn dump(&mut self, result: &Analysis) { ...
JsonDumper
identifier_name
json_dumper.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 ...
if data.kind == DefKind::Mod && data.span.file_name.to_str().unwrap() != data.value { // If the module is an out-of-line definition, then we'll make the // definition the first character in the module's file and turn // the declaration into a reference to it. let...
{ return; }
conditional_block
ElementaryFluxVectors.py
import pandas as pd import numpy as np import cobra from pyefm.ElementaryFluxModes import EFMToolWrapper from tqdm import tqdm class EFVWrapper(EFMToolWrapper): def create_matrices(self, extra_g=None, extra_h=None): """ Initialize the augmented stoichiometric matrix. extra_g: (n x nr) array ...
et_dict): all_keys = set(set_dict.keys()) is_support_minimal = [] for this_key, val in tqdm(set_dict.items()): for key in all_keys.difference(set([this_key])): if val.issuperset(set_dict[key]): break else: is_support_minimal.append(this_key) re...
et_support_minimal_list(s
identifier_name
ElementaryFluxVectors.py
import pandas as pd import numpy as np import cobra from pyefm.ElementaryFluxModes import EFMToolWrapper from tqdm import tqdm class EFVWrapper(EFMToolWrapper): def create_matrices(self, extra_g=None, extra_h=None): """ Initialize the augmented stoichiometric matrix. extra_g: (n x nr) array ...
bounded_df = pd.DataFrame( bounded[:, :self.nr], columns=[r.id for r in self.model.reactions], index=('BEV{}'.format(i) for i in range(1, bounded.shape[0] + 1))) return unbounded_df.append(bounded_df) def calculate_elementary_vectors(cobra_m...
with open(out_file, 'rb') as f: out_arr = np.fromstring(f.read()[13:], dtype='>d').reshape( (-1, self.nt + self.nr + 1)).T out_arr = np.asarray(out_arr, dtype=np.float64).T # Sort by the absolute value of the stoichiometry sort_inds= np.abs(out_arr[:, :self.nr])....
identifier_body
ElementaryFluxVectors.py
import pandas as pd import numpy as np import cobra from pyefm.ElementaryFluxModes import EFMToolWrapper from tqdm import tqdm class EFVWrapper(EFMToolWrapper): def create_matrices(self, extra_g=None, extra_h=None): """ Initialize the augmented stoichiometric matrix. extra_g: (n x nr) array ...
self.D = np.vstack([ np.hstack([N, np.zeros((nm, nt)), np.zeros((nm, 1))]), np.hstack([G, -np.eye(nt), np.atleast_2d(-h).T]) ]) def create_model_files(self, temp_dir): # Stoichiometric Matrix np.savetxt(temp_dir + '/stoich.txt', self.D, delimiter='\t') ...
self.nt = nt = len(h)
random_line_split
ElementaryFluxVectors.py
import pandas as pd import numpy as np import cobra from pyefm.ElementaryFluxModes import EFMToolWrapper from tqdm import tqdm class EFVWrapper(EFMToolWrapper): def create_matrices(self, extra_g=None, extra_h=None): """ Initialize the augmented stoichiometric matrix. extra_g: (n x nr) array ...
unbounded_df = pd.DataFrame( unbounded[:, :self.nr], columns=[r.id for r in self.model.reactions], index=['UEV{}'.format(i) for i in range(1, unbounded.shape[0] + 1)]) bounded_df = pd.DataFrame( bounded[:, :self.nr], co...
bounded /= np.atleast_2d(bounded[:,-1]).T
conditional_block
ActivityListView.js
import React from 'react'; import { Container, Content, Button, Text, List, ListItem, SwipeRow, Icon, Fab } from 'native-base'; import { FlatList } from 'react-native'; import I18n from 'yasav/locales/i18n' import { GenericHeader } from 'yasav/src/viewElements/shared/Header'; import Style from '../styles/style.js'; imp...
() { this.setState({ active: !this.state.active }); this.props.navigateToActivityAddMeeting(); } navigateToActivityAddEvent() { this.setState({ active: !this.state.active }); this.props.navigateToActivityAddEvent(); } navigateToActivityAddContent() { this.setState({ active: !this.state.activ...
navigateToActivityAddMeeting
identifier_name
ActivityListView.js
import React from 'react'; import { Container, Content, Button, Text, List, ListItem, SwipeRow, Icon, Fab } from 'native-base'; import { FlatList } from 'react-native'; import I18n from 'yasav/locales/i18n' import { GenericHeader } from 'yasav/src/viewElements/shared/Header'; import Style from '../styles/style.js'; imp...
</Button> <Button onPress={this.navigateToActivityAddEvent} style={{ backgroundColor: Colors.event }} > <Icon name="calendar" /> </Button> <Button onPress={this.navigateToActivityAddContent} style={{ backgroundColor: Colors.content }} > <Icon n...
{ return ( <Container style={StyleList.container}> <SearchContainer requestType={SearchType.ACTIVITY} modifySearchActivity={this.props.modifySearchActivity} /> <ListView displayList={this.props.displayActivityList} navigateToDisplayScreen={this....
identifier_body
ActivityListView.js
import React from 'react'; import { Container, Content, Button, Text, List, ListItem, SwipeRow, Icon, Fab } from 'native-base'; import { FlatList } from 'react-native'; import I18n from 'yasav/locales/i18n' import { GenericHeader } from 'yasav/src/viewElements/shared/Header';
import Style from '../styles/style.js'; import StyleList from 'yasav/src/styles/List' import SearchContainer from 'yasav/src/components/search/screens/Search/containers/SearchContainer' import { SearchType } from 'yasav/src/const'; import ListView from 'yasav/src/viewElements/shared/listView/ListView' import Colors fr...
random_line_split
blink.rs
extern crate firmata; extern crate serial; use firmata::*; use serial::*; use std::thread; fn main() { let mut sp = serial::open("/dev/ttyACM0").unwrap(); sp.reconfigure(&|settings| { settings.set_baud_rate(Baud57600).unwrap(); settings.set_char_size(Bits8); settings.set_parity(Parity...
}
random_line_split
blink.rs
extern crate firmata; extern crate serial; use firmata::*; use serial::*; use std::thread; fn
() { let mut sp = serial::open("/dev/ttyACM0").unwrap(); sp.reconfigure(&|settings| { settings.set_baud_rate(Baud57600).unwrap(); settings.set_char_size(Bits8); settings.set_parity(ParityNone); settings.set_stop_bits(Stop1); settings.set_flow_control(FlowNone); O...
main
identifier_name
blink.rs
extern crate firmata; extern crate serial; use firmata::*; use serial::*; use std::thread; fn main()
let mut i = 0; loop { thread::sleep_ms(400); println!("{}",i); b.digital_write(13, i); i ^= 1; } }
{ let mut sp = serial::open("/dev/ttyACM0").unwrap(); sp.reconfigure(&|settings| { settings.set_baud_rate(Baud57600).unwrap(); settings.set_char_size(Bits8); settings.set_parity(ParityNone); settings.set_stop_bits(Stop1); settings.set_flow_control(FlowNone); Ok((...
identifier_body
pycapsule.rs
use libc::{c_void, c_char, c_int}; use object::*; #[cfg_attr(windows, link(name="pythonXY"))] extern "C" { pub static mut PyCapsule_Type: PyTypeObject; } pub type PyCapsule_Destructor = unsafe extern "C" fn(o: *mut PyObject); #[inline] pub unsafe fn PyCapsule_CheckExact(ob: *mut PyObject) -> c_int { (Py_TYPE...
pub fn PyCapsule_GetPointer(capsule: *mut PyObject, name: *const c_char) -> *mut c_void; pub fn PyCapsule_GetDestructor(capsule: *mut PyObject) -> Option<PyCapsule_Destructor>; pub fn PyCapsule_GetName(capsule: *mut PyObject) -> *const c_char; pub fn PyCapsule_G...
random_line_split
pycapsule.rs
use libc::{c_void, c_char, c_int}; use object::*; #[cfg_attr(windows, link(name="pythonXY"))] extern "C" { pub static mut PyCapsule_Type: PyTypeObject; } pub type PyCapsule_Destructor = unsafe extern "C" fn(o: *mut PyObject); #[inline] pub unsafe fn
(ob: *mut PyObject) -> c_int { (Py_TYPE(ob) == &mut PyCapsule_Type) as c_int } #[cfg_attr(windows, link(name="pythonXY"))] extern "C" { pub fn PyCapsule_New(pointer: *mut c_void, name: *const c_char, destructor: Option<PyCapsule_Destructor>) -> *mut PyObject; ...
PyCapsule_CheckExact
identifier_name
pycapsule.rs
use libc::{c_void, c_char, c_int}; use object::*; #[cfg_attr(windows, link(name="pythonXY"))] extern "C" { pub static mut PyCapsule_Type: PyTypeObject; } pub type PyCapsule_Destructor = unsafe extern "C" fn(o: *mut PyObject); #[inline] pub unsafe fn PyCapsule_CheckExact(ob: *mut PyObject) -> c_int
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" { pub fn PyCapsule_New(pointer: *mut c_void, name: *const c_char, destructor: Option<PyCapsule_Destructor>) -> *mut PyObject; pub fn PyCapsule_GetPointer(capsule: *mut PyObject, ...
{ (Py_TYPE(ob) == &mut PyCapsule_Type) as c_int }
identifier_body
compiler.rs
immediately higher) Precedence. /// Note that this is not defined for the item with the highest /// precedence. In such case you'll get a panic fn next(self) -> Precedence { // This reduces some boilerplate. Precedence::from_u8(self.to_u8().unwrap() + 1).unwrap() } } /// A single-pass ...
/// associated with a token. It operates only according to their /// variant. /// /// This is generally used on the token peeked from the front of /// the iterator. This lookahead allows us to decide what to do next /// according to the "table" below. fn find_rule(token: &Token) -> (Preceden...
/// Note that this function doesn't care about the values possibly
random_line_split
compiler.rs
higher) Precedence. /// Note that this is not defined for the item with the highest /// precedence. In such case you'll get a panic fn next(self) -> Precedence { // This reduces some boilerplate. Precedence::from_u8(self.to_u8().unwrap() + 1).unwrap() } } /// A single-pass Pratt Parser...
/// Adds an opcode to the current chunk fn emit(&mut self, opcode: OpCode, line: usize) -> () { self.chunk.add_instruction(opcode, line) } /// Peeks the first *valid* token in the iterator fn peek(&mut self) -> Option<&TokenWithContext> { self.skip_to_valid(); self.tokens....
{ // Peek to skip errors and keep track of them. // This makes unwrapping safe. self.skip_to_valid(); self.tokens.next().map(|r| r.unwrap()) }
identifier_body
compiler.rs
{ ScannerError(ScannerError), ParsingError(ParsingError), } #[derive(PartialEq, PartialOrd, FromPrimitive, ToPrimitive, Clone, Copy)] enum Precedence { None, Assignment, Or, And, Equality, Comparison, Term, Factor, Unary, Call, Primary, } impl Precedence { /// ...
CompilationError
identifier_name
daterangepicker-tests.ts
/// <reference path="daterangepicker.d.ts"/> function tests_simple() { $('#daterange').daterangepicker(); $('input[name="daterange"]').daterangepicker({ timePicker: true, timePickerIncrement: 30, locale: { format: 'MM/DD/YYYY h:mm A' } }); $('#reportrange')....
cb(moment().subtract(29, 'days'), moment()); $('#reportrange').daterangepicker({ ranges: { 'Today': [moment(), moment()], 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')], 'Last 7 Days': [moment().subtract(6, 'days'), moment()], 'Las...
{ $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY')); }
identifier_body
daterangepicker-tests.ts
/// <reference path="daterangepicker.d.ts"/> function
() { $('#daterange').daterangepicker(); $('input[name="daterange"]').daterangepicker({ timePicker: true, timePickerIncrement: 30, locale: { format: 'MM/DD/YYYY h:mm A' } }); $('#reportrange').daterangepicker({ ranges: { 'Today': [moment(),...
tests_simple
identifier_name
daterangepicker-tests.ts
/// <reference path="daterangepicker.d.ts"/> function tests_simple() { $('#daterange').daterangepicker(); $('input[name="daterange"]').daterangepicker({ timePicker: true, timePickerIncrement: 30, locale: { format: 'MM/DD/YYYY h:mm A' } }); $('#reportrange')....
$(this).val(picker.startDate.format('MM/DD/YYYY') + ' - ' + picker.endDate.format('MM/DD/YYYY')); }); $('input[name="datefilter"]').on('cancel.daterangepicker', function (ev, picker) { $(this).val(''); }); $('#demo').daterangepicker({ "startDate": "05/06/2016", "endDat...
$('input[name="datefilter"]').on('apply.daterangepicker', function (ev, picker) {
random_line_split
Avatar.js
import Canvas from '../tool/Canvas.js'; import Animation from './Animation/Animation.js'; import Frame from './Animation/Frame.js'; import Player from '../engine/Player.js'; class Avatar { static radius = 360; static shakeTime = 300; constructor(player, direction) { this.player = player; ...
context.scale(size, size); canvas.setAlpha(alpha); canvas.setFill(color); context.beginPath(); context.moveTo(left.x, left.y); context.lineTo(top.x, top.y); context.lineTo(right.x, right.y); context.fill(); canvas.setFill(colorDark); co...
{ canvas.reverse(); }
conditional_block
Avatar.js
import Canvas from '../tool/Canvas.js'; import Animation from './Animation/Animation.js'; import Frame from './Animation/Frame.js'; import Player from '../engine/Player.js'; class Avatar { static radius = 360; static shakeTime = 300; constructor(player, direction) { this.player = player; ...
const bottom = { x: center.x, y: top.y + height }; const left = { x: center.x - body, y: center.y }; if (direction) { canvas.reverse(); } context.scale(size, size); canvas.setAlpha(alpha); canvas.setFill(color); context.beginPath(); ...
const top = { x: center.x, y: center.y - (height / 2) }; const right = { x: center.x + head, y: center.y }
random_line_split
Avatar.js
import Canvas from '../tool/Canvas.js'; import Animation from './Animation/Animation.js'; import Frame from './Animation/Frame.js'; import Player from '../engine/Player.js'; class Avatar { static radius = 360; static shakeTime = 300; constructor(player, direction) { this.player = player; ...
static createLozange(color, colorDark, alpha, direction, height, body, head) { const canvasWidth = 2; const canvasHeight = 2; const size = Avatar.radius * 2; const canvas = new Canvas(size * canvasWidth, size * canvasHeight); const context = canvas.context; const ...
{ const size = Avatar.radius * 2; const canvas = new Canvas(size, size); const context = canvas.context(); let frames = [ ]; }
identifier_body
Avatar.js
import Canvas from '../tool/Canvas.js'; import Animation from './Animation/Animation.js'; import Frame from './Animation/Frame.js'; import Player from '../engine/Player.js'; class
{ static radius = 360; static shakeTime = 300; constructor(player, direction) { this.player = player; this.idle = Avatar.createLozange('#FFFD1B', '#BCBB14', 1, direction, 0.5, 0.75, 0.25); this.idleShadow = Avatar.createLozange('#000000', '#000000', 0.1, direction, 0.5, 0.75, 0.2...
Avatar
identifier_name
script.py
""" Name : Stegano Extract and Read File From Image Created By : Agus Makmun (Summon Agus) Blog : bloggersmart.net - python.web.id License : GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Documentation : https://github.com/agusmakmun/Some-Examples-of-Simple-Python-Script/ "...
(object): def _secure(self, image, zipfile, new_image): return os.system("cat "+image+" "+zipfile+" > "+new_image) def _openScure(self, new_image): return os.system("unzip "+new_image) def _stegano(self, zipFile): archive = zipfile.ZipFile(zipFile, 'r') ...
scureImage
identifier_name
script.py
""" Name : Stegano Extract and Read File From Image Created By : Agus Makmun (Summon Agus) Blog : bloggersmart.net - python.web.id License : GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Documentation : https://github.com/agusmakmun/Some-Examples-of-Simple-Python-Script/ "...
return os.system("cat "+image+" "+zipfile+" > "+new_image) def _openScure(self, new_image): return os.system("unzip "+new_image) def _stegano(self, zipFile): archive = zipfile.ZipFile(zipFile, 'r') list_name = archive.namelist() print "[+] This lis...
class scureImage(object): def _secure(self, image, zipfile, new_image):
random_line_split
script.py
""" Name : Stegano Extract and Read File From Image Created By : Agus Makmun (Summon Agus) Blog : bloggersmart.net - python.web.id License : GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Documentation : https://github.com/agusmakmun/Some-Examples-of-Simple-Python-Script/ "...
if __name__ == "__main__": mome = scureImage() mome.main()
print os.listdir(".") zipName = raw_input("[+] Type Image where your file was saved.\n[+] >>> ") try: mome._stegano(zipName) except IOError: print "[-] Uppss, {", zipName, "} is not image or not found at this directory." ...
conditional_block
script.py
""" Name : Stegano Extract and Read File From Image Created By : Agus Makmun (Summon Agus) Blog : bloggersmart.net - python.web.id License : GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Documentation : https://github.com/agusmakmun/Some-Examples-of-Simple-Python-Script/ "...
def _openScure(self, new_image): return os.system("unzip "+new_image) def _stegano(self, zipFile): archive = zipfile.ZipFile(zipFile, 'r') list_name = archive.namelist() print "[+] This list of files in the image." print "+------------------------...
return os.system("cat "+image+" "+zipfile+" > "+new_image)
identifier_body
hdfs_d3.js
curConf.hdfs.namenode.port; }); hdfsWorker.postMessage(formData); }); var sunburstLayout = function(root) { var margin = { top: 10, right: 10, bottom: 10, left: 10 }; var width = parseInt(d3.select('#chartContainer').styl...
{ //console.log(d); var kx = w / d.dx, ky = h / d.dy; x.domain([d.x, d.x + d.dx]); y.domain([d.y, d.y + d.dy]); var t = svg.selectAll('g').transition() .duration(d3.event.altKey ? 7500 : 750) .attr('transform', ...
identifier_body
hdfs_d3.js
(root); } } else if (event.data.message === 'path') { var path = event.data.path, rev = path.split('').reverse().join(''); if (rev.length > 140) { rev = rev.substr(0, 140); path = '...' + rev.split('').reverse().join(''); ...
{ return elm.label + '<br/>' + bytesToSize(elm.size); }
conditional_block
hdfs_d3.js
new Worker('scripts/hdfsWorker.js'); // Bind a handler so we know when data is available hdfsWorker.onmessage = function(event) { if (!event.data.success) { $('#errorContainer').trigger('showError', 'There was an error retrieving the data'); return; } //console....
.outerRadius(function(d) { return Math.max(0, y(d.y + d.dy)); }); // Keep track of the node that is currently being displayed as the root. var node; node = root; var click = function(d) { node = d; path.transition() ...
.innerRadius(function(d) { return Math.max(0, y(d.y)); })
random_line_split
hdfs_d3.js
(bytes) { var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; if (bytes === 0) { return '0 Byte'; } var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i]; } $('#chartContainer').css('min-he...
bytesToSize
identifier_name
timeout_heap.rs
use futures::{Future, Poll, Async}; use std::cmp::{Ord, Ordering, PartialOrd}; use std::hash::Hash; use std::collections::{HashSet, BinaryHeap}; use std::time::Instant; use tokio::timer::Delay; pub struct TimeoutHeap<K> { deadlines: BinaryHeap<Deadline<K>>, key_set: HashSet<K>, delay: Delay, } impl<K> ...
// reverse order so that the maximum deadline expires first. other.instant.cmp(&self.instant) } } impl<K: Eq> PartialOrd for Deadline<K> { fn partial_cmp(&self, other: &Deadline<K>) -> Option<Ordering> { Some(self.cmp(other)) } }
random_line_split
timeout_heap.rs
use futures::{Future, Poll, Async}; use std::cmp::{Ord, Ordering, PartialOrd}; use std::hash::Hash; use std::collections::{HashSet, BinaryHeap}; use std::time::Instant; use tokio::timer::Delay; pub struct TimeoutHeap<K> { deadlines: BinaryHeap<Deadline<K>>, key_set: HashSet<K>, delay: Delay, } impl<K> ...
(&self, other: &Deadline<K>) -> Ordering { // reverse order so that the maximum deadline expires first. other.instant.cmp(&self.instant) } } impl<K: Eq> PartialOrd for Deadline<K> { fn partial_cmp(&self, other: &Deadline<K>) -> Option<Ordering> { Some(self.cmp(other)) } }
cmp
identifier_name
prediction_metrics_manager_test.py
#!/usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have purchased from # Numenta, Inc. a separate commercial license for this software code, the # following terms and conditio...
predictionMetricsManagerTest()
conditional_block
prediction_metrics_manager_test.py
#!/usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have purchased from # Numenta, Inc. a separate commercial license for this software code, the # following terms and conditio...
# You should have received a copy of the GNU General Public License # along with this program. If not, see http://www.gnu.org/licenses. # # http://numenta.org/licenses/ # ---------------------------------------------------------------------- """This file invokes predictionmetricsmanager.py tests TODO: Move these tes...
# This program 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. #
random_line_split
index.tsx
import { isBoolean } from 'lodash'; import * as React from 'react'; import { render } from 'react-dom'; import { Store } from 'redux'; import ComponentWrapper from '../../components/ComponentWrapper'; import { changeAmount, changeCurrency, setPaymentType, setRecurring, setStoreInVault, updateForm, } from '....
this.setAmount(amount); } public setAmount(amount: any) { if (Number.isInteger(amount) && amount > 0) { this.store.dispatch(changeAmount(amount)); } return this; } get currency() { return this.state.currency; } set currency(currency: any) { this.setCurrency(currency); } ...
} set amount(amount: any) {
random_line_split
index.tsx
import { isBoolean } from 'lodash'; import * as React from 'react'; import { render } from 'react-dom'; import { Store } from 'redux'; import ComponentWrapper from '../../components/ComponentWrapper'; import { changeAmount, changeCurrency, setPaymentType, setRecurring, setStoreInVault, updateForm, } from '....
get state() { return this.store.getState().fundraiser; } get formValues() { return this.state.form; } get amount() { return this.state.donationAmount; } set amount(amount: any) { this.setAmount(amount); } public setAmount(amount: any) { if (Number.isInteger(amount) && amount ...
{ super(options); this.render(); }
identifier_body
index.tsx
import { isBoolean } from 'lodash'; import * as React from 'react'; import { render } from 'react-dom'; import { Store } from 'redux'; import ComponentWrapper from '../../components/ComponentWrapper'; import { changeAmount, changeCurrency, setPaymentType, setRecurring, setStoreInVault, updateForm, } from '....
() { return this.state.form; } get amount() { return this.state.donationAmount; } set amount(amount: any) { this.setAmount(amount); } public setAmount(amount: any) { if (Number.isInteger(amount) && amount > 0) { this.store.dispatch(changeAmount(amount)); } return this; } ...
formValues
identifier_name
index.tsx
import { isBoolean } from 'lodash'; import * as React from 'react'; import { render } from 'react-dom'; import { Store } from 'redux'; import ComponentWrapper from '../../components/ComponentWrapper'; import { changeAmount, changeCurrency, setPaymentType, setRecurring, setStoreInVault, updateForm, } from '....
return this; } get currency() { return this.state.currency; } set currency(currency: any) { this.setCurrency(currency); } public setCurrency(currency: any) { this.store.dispatch(changeCurrency(currency)); return this; } public updateForm(fieldName: string, value: any) { this...
{ this.store.dispatch(changeAmount(amount)); }
conditional_block
friendsWrapper.js
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you m...
}); html.push('</ul>'); } var friendsUsingApp = data.get('friendsUsingApp').getData(); html.push('Friends using this Widget (',friendsUsingApp.size(),') <br>'); html.push('<ul>'); friendsUsingApp.each(function(person) { if (person.getId()) { htm...
{ html.push('<li>', person.getDisplayName(), '</li>'); }
conditional_block
friendsWrapper.js
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you m...
req.add(req.newFetchPeopleRequest(ownerFriends, opt_params), 'ownerFriends'); var params = {}; params[opensocial.DataRequest.PeopleRequestFields.MAX] = 100; // Usage of isFriendsWith filter to get mutual friends. filterValue should be set to the friend with whom mutual friends is to be found. ...
req.add(req.newFetchPeopleRequest(viewerFriends, opt_params), 'viewerFriends');
random_line_split
friendsWrapper.js
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you m...
() { /* * Loads the owner, the viewer, the owner's friends, and the viewer's * friends and mutual friends between owner and viewer. Response data is put into the variables owner, viewer, * ownerFriends, and viewerFriends, mutualFriends respectively. * * */ this.loadFriends = function(){ var req = opensocial....
friendsWrapper
identifier_name
friendsWrapper.js
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you m...
if (person.getId()) { html.push('<li>', person.getDisplayName(), '</li>'); } }); html.push('</ul>'); } var friendsUsingApp = data.get('friendsUsingApp').getData(); html.push('Friends using this Widget (',friendsUsingApp.size(),') <br>'...
{ var viewer = data.get('viewer').getData(); var viewerFriends = data.get('viewerFriends').getData(); var owner = data.get('owner').getData(); var ownerFriends = data.get('ownerFriends').getData(); html = new Array(); html.push(owner.getDisplayName() + '\'s Friends(',ownerFrie...
identifier_body
energy.rs
// Lumol, an extensible molecular simulation engine // Copyright (C) Lumol's contributors — BSD license use std::fs::File; use std::io::{self, BufWriter}; use std::io::prelude::*; use std::path::{Path, PathBuf}; use log::error; use super::Output; use lumol_core::System; use lumol_core::units; /// The `EnergyOutput`...
{ test_output( |path| Box::new(EnergyOutput::new(path).unwrap()), "# Energy of the simulation (kJ/mol) # Step Potential Kinetic Total 42 1.5000000000000027 949.9201593348566 951.4201593348566 ", ); } }
ergy()
identifier_name
energy.rs
// Copyright (C) Lumol's contributors — BSD license use std::fs::File; use std::io::{self, BufWriter}; use std::io::prelude::*; use std::path::{Path, PathBuf}; use log::error; use super::Output; use lumol_core::System; use lumol_core::units; /// The `EnergyOutput` writes the energy of the system to a text file, org...
// Lumol, an extensible molecular simulation engine
random_line_split
build.rs
extern crate pkg_config; use pkg_config::{Config, Error}; use std::env; use std::io::prelude::*; use std::io; use std::process; fn main() { if let Err(s) = find() { let _ = writeln!(io::stderr(), "{}", s); process::exit(1); } } fn find() -> Result<(), Error> { let package_name = "cairo"; ...
else { "1.10" }; if let Ok(lib_dir) = env::var("GTK_LIB_DIR") { for lib_ in shared_libs.iter() { println!("cargo:rustc-link-lib=dylib={}", lib_); } println!("cargo:rustc-link-search=native={}", lib_dir); return Ok(()) } let target = env::var("TARGET...
{ "1.12" }
conditional_block
build.rs
extern crate pkg_config; use pkg_config::{Config, Error}; use std::env; use std::io::prelude::*; use std::io; use std::process; fn main() { if let Err(s) = find() { let _ = writeln!(io::stderr(), "{}", s); process::exit(1); } } fn find() -> Result<(), Error> {
let shared_libs = ["cairo"]; let version = if cfg!(feature = "1.14") { "1.14" } else if cfg!(feature = "1.12") { "1.12" } else { "1.10" }; if let Ok(lib_dir) = env::var("GTK_LIB_DIR") { for lib_ in shared_libs.iter() { println!("cargo:rustc-link-lib=d...
let package_name = "cairo";
random_line_split
build.rs
extern crate pkg_config; use pkg_config::{Config, Error}; use std::env; use std::io::prelude::*; use std::io; use std::process; fn main() { if let Err(s) = find() { let _ = writeln!(io::stderr(), "{}", s); process::exit(1); } } fn find() -> Result<(), Error>
let hardcode_shared_libs = target.contains("windows"); let mut config = Config::new(); config.atleast_version(version); if hardcode_shared_libs { config.cargo_metadata(false); } match config.probe(package_name) { Ok(library) => { if hardcode_shared_libs { ...
{ let package_name = "cairo"; let shared_libs = ["cairo"]; let version = if cfg!(feature = "1.14") { "1.14" } else if cfg!(feature = "1.12") { "1.12" } else { "1.10" }; if let Ok(lib_dir) = env::var("GTK_LIB_DIR") { for lib_ in shared_libs.iter() { ...
identifier_body
build.rs
extern crate pkg_config; use pkg_config::{Config, Error}; use std::env; use std::io::prelude::*; use std::io; use std::process; fn main() { if let Err(s) = find() { let _ = writeln!(io::stderr(), "{}", s); process::exit(1); } } fn
() -> Result<(), Error> { let package_name = "cairo"; let shared_libs = ["cairo"]; let version = if cfg!(feature = "1.14") { "1.14" } else if cfg!(feature = "1.12") { "1.12" } else { "1.10" }; if let Ok(lib_dir) = env::var("GTK_LIB_DIR") { for lib_ in shared_...
find
identifier_name
user-service.spec.ts
import { UserService } from './user-service'; import { IUser } from './user-model'; import { MockAuthService } from '../../common/services/mock-auth.service'; import { TestBed, getTestBed } from '@angular/core/testing'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; impor...
}); const req = httpMock.expectOne(`${environment.serviceRootUrl}Users(${dummyUser.id})`); expect(req.request.method).toBe('GET'); req.flush(dummyUser); }); }); describe('#createUser', () => { it('should return an Observable<IUser>', () => { ...
random_line_split
manager.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
self._sensor_container.remove_sensor(sensor=self._to_sensor_object(sensor)) def _get_sensor_ref(self, sensor): return ResourceReference.to_string_reference(pack=sensor.pack, name=sensor.name)
random_line_split
manager.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
LOG.info('(PID:%s) SensorContainer started.', os.getpid()) self._setup_sigterm_handler() self._spin_container_and_wait(sensors_to_run) def _spin_container_and_wait(self, sensors): try: self._sensor_container = ProcessSensorContainer(sensors=sensors) self._c...
sensors_to_run.append(self._to_sensor_object(sensor))
conditional_block
manager.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
(self, sensor): if not self._sensors_partitioner.is_sensor_owner(sensor): LOG.info('sensor %s is not supported. Ignoring delete.', self._get_sensor_ref(sensor)) return LOG.info('Unloading sensor %s.', self._get_sensor_ref(sensor)) self._sensor_container.remove_sensor(sens...
_handle_delete_sensor
identifier_name
manager.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
return ResourceReference.to_string_reference(pack=sensor.pack, name=sensor.name)
identifier_body
codeReference.py
('') lines.append(' This is an empty file, because we cannot parse this file correctly or it causes problems') lines.append(' , please look at the source code directly') writeLinesToFile(filename, lines) def mkModuleRst(self, classname, fullclassname, buildtype='full'): """Create rst file for module....
run
identifier_name
codeReference.py
, fullmodulename, subpackages=None, modules=None): """Make a rst file for module containing other modules.""" if modulename == 'scripts': return else: modulefinal = modulename lines = [] lines.append('%s' % modulefinal) lines.append('=' * len(modulefinal)) lines.append('.. modul...
if buildtype == 'limited':
random_line_split
codeReference.py
def optionDict(self): oDict = super(CLParser, self).optionDict() oDict['buildType'] = self.buildType oDict['clean'] = self.clean return oDict class CodeReference(object): """Module to create rst files containing autodoc for sphinx.""" def __init__(self, configFile='docs.conf'): self.confi...
super(CLParser, self).parse() self.log.info('Parsing options') self.buildType = self.parsed.buildType self.clean = self.parsed.clean
identifier_body
codeReference.py
WorkingDir = os.getcwd() def end(self): """Make sure we are back in the original working directory.""" LOG.info('Done with creating code reference') os.chdir(self.orgWorkingDir) def getCustomDocs(self): """Import the dynamically created docstrings from the files in CustomizedDocs. Use 'exec' ...
else: lines.append(ds.doc_string) writeLinesToFile(filename, lines) def getsubpackages(self, abspath, direc): """return list of subpackages with full path""" packages = [] for dire in direc: if dire.lower() == 'test' or dire.lower() == 'tests' or '/test' in dire.lower(): ...
lines = ds.doc_string
conditional_block
protein.py
from . import sqldb class aminoAcid(): def __init__(self,abbr1,abbr3,name): self.abbr3 = abbr3 self.abbr1 = abbr1 self.name = name def __str__(self): return self.name def __repr__(self): return self.name def getOne(self): return self.abbr1 def getThree...
def getAA3(self,codon): return self.db.getItem(codon,'protein') def codonTranslate(codon,codonDB,aaDB): return aaDB.getAA3(codonDB.getAA3(codon)) def nucleotideTranslation(posStrand): pointer = 0 result = '' lastAA = 'M' adb = aminoAcidDB() cdb = translateDB() while posStrand[p...
class translateDB(): def __init__(self): self.db = sqldb.sqliteDB('bioChemData/data.sql','translate')
random_line_split
protein.py
from . import sqldb class aminoAcid(): def
(self,abbr1,abbr3,name): self.abbr3 = abbr3 self.abbr1 = abbr1 self.name = name def __str__(self): return self.name def __repr__(self): return self.name def getOne(self): return self.abbr1 def getThree(self): return self.abbr3 class aminoAcidDB():...
__init__
identifier_name
protein.py
from . import sqldb class aminoAcid(): def __init__(self,abbr1,abbr3,name): self.abbr3 = abbr3 self.abbr1 = abbr1 self.name = name def __str__(self): return self.name def __repr__(self): return self.name def getOne(self): return self.abbr1 def getThree...
return result
lastAA = adb.getAA3(cdb.getAA3(posStrand[pointer:pointer+3])).getOne() result += lastAA pointer += 3
conditional_block
protein.py
from . import sqldb class aminoAcid(): def __init__(self,abbr1,abbr3,name): self.abbr3 = abbr3 self.abbr1 = abbr1 self.name = name def __str__(self): return self.name def __repr__(self): return self.name def getOne(self): return self.abbr1 def getThree...
def getAA3(self,abbr3): abbr1 = self.db.getItem(abbr3,'one') name = self.db.getItem(abbr3,'name') return aminoAcid(abbr1,abbr3,name) class translateDB(): def __init__(self): self.db = sqldb.sqliteDB('bioChemData/data.sql','translate') def getAA3(self,codon): return ...
self.db = sqldb.sqliteDB('bioChemData/data.sql','protein')
identifier_body
assets.ts
import { Injectable } from '@angular/core'; @Injectable() export class
{ private assets = { api: { blueprintsUrl: 'api/v1/blueprints', parseBlueprintUrl: 'api/v1/parse/blueprint', }, alerts: { AlertsService: { error: "There are some internal issues while trying to process your request.", notImplemented: "Not implemented yet.", }, ...
AssetsService
identifier_name
assets.ts
import { Injectable } from '@angular/core'; @Injectable() export class AssetsService { private assets = { api: { blueprintsUrl: 'api/v1/blueprints', parseBlueprintUrl: 'api/v1/parse/blueprint', }, alerts: { AlertsService: { error: "There are some internal issues while trying to...
}
}
random_line_split
assets.ts
import { Injectable } from '@angular/core'; @Injectable() export class AssetsService { private assets = { api: { blueprintsUrl: 'api/v1/blueprints', parseBlueprintUrl: 'api/v1/parse/blueprint', }, alerts: { AlertsService: { error: "There are some internal issues while trying to...
}
{ return this.assets[key]; }
identifier_body
prelude.rs
use cgmath; use glium; use std; pub use cgmath::EuclideanSpace; pub type Vector = cgmath::Vector3<f32>; pub type Point = cgmath::Point3<f32>; pub type Matrix = cgmath::Matrix3<f32>; mod dumb_submodule { use cgmath::{InnerSpace}; pub fn normalize(v: super::Vector) -> super::Vector { v.normalize() } pub ...
} pub use self::dumb_submodule::*; #[derive(Debug ,Clone)] pub struct Ray { pub origin : Point, pub direction : Vector, } #[repr(C)] #[derive(Debug, Clone, Copy)] pub struct RGB { pub r: f32, pub g: f32, pub b: f32, } unsafe impl Send for RGB {} unsafe impl glium::texture::PixelValue for RGB { fn g...
{ v1.cross(v2) }
identifier_body
prelude.rs
use cgmath; use glium; use std; pub use cgmath::EuclideanSpace; pub type Vector = cgmath::Vector3<f32>; pub type Point = cgmath::Point3<f32>; pub type Matrix = cgmath::Matrix3<f32>; mod dumb_submodule { use cgmath::{InnerSpace}; pub fn normalize(v: super::Vector) -> super::Vector { v.normalize() } pub ...
{ pub origin : Point, pub direction : Vector, } #[repr(C)] #[derive(Debug, Clone, Copy)] pub struct RGB { pub r: f32, pub g: f32, pub b: f32, } unsafe impl Send for RGB {} unsafe impl glium::texture::PixelValue for RGB { fn get_format() -> glium::texture::ClientFormat { glium::texture::ClientForm...
Ray
identifier_name
prelude.rs
use cgmath; use glium; use std; pub use cgmath::EuclideanSpace; pub type Vector = cgmath::Vector3<f32>;
pub type Matrix = cgmath::Matrix3<f32>; mod dumb_submodule { use cgmath::{InnerSpace}; pub fn normalize(v: super::Vector) -> super::Vector { v.normalize() } pub fn dot(v1: super::Vector, v2: super::Vector) -> f32 { v1.dot(v2) } pub fn cross(v1: super::Vector, v2: super::Vector) -> super::Vector ...
pub type Point = cgmath::Point3<f32>;
random_line_split
svg-calendar.js
SVGCalendar = function (root_width, root_height, i_options) { var DEFAULTS = { start_date: new Date()// Date : default is today //--- end_date , end_date: null// Date : default is today , day_num: null// int : active when end_date is null , week_num: 4// int : active when en...
}; // table options var table_options = { column_num:7, row_num:row_num, cell_texts: cell_texts, cell_texts_is_row_col:true, CLASSES:CLASSES, column_names: column_names, column_name_height: args.day_name_height, column_name_text_transform: ar...
{ args.cell_hook(cell_elem, that_table) }
conditional_block
svg-calendar.js
SVGCalendar = function (root_width, root_height, i_options) { var DEFAULTS = { start_date: new Date()// Date : default is today //--- end_date , end_date: null// Date : default is today , day_num: null// int : active when end_date is null , week_num: 4// int : active when en...
})(); // args $.extend(true, CLASSES, args.CLASSES); this.options = args; // week of days var day2int = function (day_str) { // if invalid input, return -1 day_str = day_str.toLowerCase().slice(0, 3); return ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'].indexOf(day...
var options = $.extend(true, {}, DEFAULTS); $.extend(true, options, i_options); return options;
random_line_split
SpvChoicePage.spec.js
import SpvChoicePage from "components/views/GetStartedPage/SpvChoicePage"; import { render } from "test-utils.js"; import { screen } from "@testing-library/react"; import user from "@testing-library/user-event"; import * as sel from "selectors"; import * as da from "actions/DaemonActions"; let mockIsTestNet; let mockT...
user.click(enableSpvLabel); expect(mockToggleSpv).toHaveBeenCalledWith(true); mockToggleSpv.mockClear(); const disableSpvLabel = screen.getByText(/disable spv/i); expect(disableSpvLabel).toBeInTheDocument(); expect(disableSpvLabel.nextSibling.textContent).toMatchInlineSnapshot( '"This will use the regu...
"\"SPV will allow your wallets to be restored and used much more quickly. This speed comes at cost, with blocks not being fully verified. It's 'less secure' but very unlikely that there will be any problems.\"" );
random_line_split
__init__.py
# Copyright (c) 2015 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. from . import CuraProfileReader from UM.i18n import i18nCatalog catalog = i18nCatalog("cura") def getMetaData(): return { "plugin": { "name": catalog.i18nc("@label", "Cura Profile Reader"),
"api": 3 }, "profile_reader": [ { "extension": "curaprofile", "description": catalog.i18nc("@item:inlistbox", "Cura Profile") } ] } def register(app): return { "profile_reader": CuraProfileReader.CuraProfileReader() }
"author": "Ultimaker", "version": "1.0", "description": catalog.i18nc("@info:whatsthis", "Provides support for importing Cura profiles."),
random_line_split
__init__.py
# Copyright (c) 2015 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. from . import CuraProfileReader from UM.i18n import i18nCatalog catalog = i18nCatalog("cura") def
(): return { "plugin": { "name": catalog.i18nc("@label", "Cura Profile Reader"), "author": "Ultimaker", "version": "1.0", "description": catalog.i18nc("@info:whatsthis", "Provides support for importing Cura profiles."), "api": 3 }, ...
getMetaData
identifier_name
__init__.py
# Copyright (c) 2015 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. from . import CuraProfileReader from UM.i18n import i18nCatalog catalog = i18nCatalog("cura") def getMetaData():
def register(app): return { "profile_reader": CuraProfileReader.CuraProfileReader() }
return { "plugin": { "name": catalog.i18nc("@label", "Cura Profile Reader"), "author": "Ultimaker", "version": "1.0", "description": catalog.i18nc("@info:whatsthis", "Provides support for importing Cura profiles."), "api": 3 }, "profile...
identifier_body
settingslist.js
import SettingsListView from '../components/settingslist.js' import { connect } from 'react-redux' import { showToggleAcceptingModal, hideToggleAcceptingModal, updateSettings, pushSettings } from '../actions/actions.js' import { bindActionCreators } from 'redux' import { Map } from 'immutable' const mapDispatc...
value: state.settingsReducer.get('storageprice') }), downloadbandwidthprice: Map({ name: 'Bandwidth Price (SC/TB)', value: state.settingsReducer.get('downloadbandwidthprice') }) }), conversionRate: state.settingsReducer.get('conversionRate'), acceptingContracts: state.settingsReducer...
}), storageprice: Map({ name: 'Price per TB per Month (SC)',
random_line_split
transitions.ts
import { useSpectron, test, TExecutionContext } from '../../helpers/spectron'; import { getApiClient } from '../../helpers/api-client'; import { makeScreenshots, useScreentest } from '../screenshoter'; import { ScenesService } from 'services/api/external-api/scenes'; import { TransitionsService } from 'services/transit...
await makeScreenshots(t, 'Add connection'); t.pass(); });
await (await t.context.app.client.$('button=Done')).click(); await (await t.context.app.client.$('button=Connections')).click(); await makeScreenshots(t, 'Connections'); await (await t.context.app.client.$('button=Add Connection')).click();
random_line_split
sbcsgroupprober.py
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All R...
self._mProbers.extend([hebrewProber, logicalHebrewProber, visualHebrewProber]) self.reset()
CharSetGroupProber.__init__(self) self._mProbers = [ \ SingleByteCharSetProber(Win1251CyrillicModel), SingleByteCharSetProber(Koi8rModel), SingleByteCharSetProber(Latin5CyrillicModel), SingleByteCharSetProber(MacCyrillicModel), SingleByteCharSetProber(Ibm866Model), SingleByteCharSetProber(Ibm855Mode...
identifier_body
sbcsgroupprober.py
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All R...
# # 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 later version. # # This library is distributed in the hope that it will be u...
# Contributor(s): # Mark Pilgrim - port to Python # Shy Shalom - original C code
random_line_split
sbcsgroupprober.py
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All R...
(self): CharSetGroupProber.__init__(self) self._mProbers = [ \ SingleByteCharSetProber(Win1251CyrillicModel), SingleByteCharSetProber(Koi8rModel), SingleByteCharSetProber(Latin5CyrillicModel), SingleByteCharSetProber(MacCyrillicModel), SingleByteCharSetProber(Ibm866Model), SingleByteCharSetProber(...
__init__
identifier_name
plotfixEND1.py
#!/usr/bin/env python import os,sys import glob def mysystem(s):
def main(): alphas = range(-8,9) orders = [1] machs = [0.55,0.65,0.75,0.85,0.95,1.05] #now, we need to recursively move everybody back for order in orders: for mach in machs: for alpha in alphas: result = '/home/vbetro/online_edu/images/order%d/mach%0.2f/alpha%+03d/naca0012_%d...
print(s) retval = os.system(s) return retval
identifier_body
plotfixEND1.py
#!/usr/bin/env python import os,sys import glob def mysystem(s): print(s) retval = os.system(s) return retval def
(): alphas = range(-8,9) orders = [1] machs = [0.55,0.65,0.75,0.85,0.95,1.05] #now, we need to recursively move everybody back for order in orders: for mach in machs: for alpha in alphas: result = '/home/vbetro/online_edu/images/order%d/mach%0.2f/alpha%+03d/naca0012_%d_%0.2f_%+0...
main
identifier_name
plotfixEND1.py
#!/usr/bin/env python import os,sys import glob def mysystem(s): print(s) retval = os.system(s) return retval def main(): alphas = range(-8,9) orders = [1]
for order in orders: for mach in machs: for alpha in alphas: result = '/home/vbetro/online_edu/images/order%d/mach%0.2f/alpha%+03d/naca0012_%d_%0.2f_%+03d_02.png'%(order,mach,alpha,order,mach,alpha); if not os.path.exists(result): mysystem('cp /home/vbe...
machs = [0.55,0.65,0.75,0.85,0.95,1.05] #now, we need to recursively move everybody back
random_line_split
plotfixEND1.py
#!/usr/bin/env python import os,sys import glob def mysystem(s): print(s) retval = os.system(s) return retval def main(): alphas = range(-8,9) orders = [1] machs = [0.55,0.65,0.75,0.85,0.95,1.05] #now, we need to recursively move everybody back for order in orders: for mach in machs: ...
if __name__ == "__main__": main()
result = '/home/vbetro/online_edu/images/order%d/mach%0.2f/alpha%+03d/naca0012_%d_%0.2f_%+03d_02.png'%(order,mach,alpha,order,mach,alpha); if not os.path.exists(result): mysystem('cp /home/vbetro/online_edu/images/order%d/mach%0.2f/alpha%+03d/naca0012_%d_%0.2f_%+03d_01.png /home/vbetr...
conditional_block
app.js
var express = require('express') , passport = require('passport') , util = require('util') , WeiboStrategy = require('../../').Strategy; var WEIBO_CLIENT_ID = "--CLIENT_ID--"; var WEIBO_CLIENT_SECRET = "--CLIENT_SECRET--"; // Passport session setup. // To support persistent login sessions, Passport needs to ...
{ if (req.isAuthenticated()) { return next(); } res.redirect('/login') }
identifier_body
app.js
var express = require('express') , passport = require('passport') , util = require('util') , WeiboStrategy = require('../../').Strategy; var WEIBO_CLIENT_ID = "--CLIENT_ID--"; var WEIBO_CLIENT_SECRET = "--CLIENT_SECRET--"; // Passport session setup. // To support persistent login sessions, Passport needs to ...
(req, res, next) { if (req.isAuthenticated()) { return next(); } res.redirect('/login') }
ensureAuthenticated
identifier_name
app.js
var express = require('express') , passport = require('passport') , util = require('util') , WeiboStrategy = require('../../').Strategy; var WEIBO_CLIENT_ID = "--CLIENT_ID--"; var WEIBO_CLIENT_SECRET = "--CLIENT_SECRET--"; // Passport session setup. // To support persistent login sessions, Passport needs to ...
res.redirect('/login') }
{ return next(); }
conditional_block
app.js
var express = require('express') , passport = require('passport') , util = require('util') , WeiboStrategy = require('../../').Strategy; var WEIBO_CLIENT_ID = "--CLIENT_ID--"; var WEIBO_CLIENT_SECRET = "--CLIENT_SECRET--";
// Passport session setup. // To support persistent login sessions, Passport needs to be able to // serialize users into and deserialize users out of the session. Typically, // this will be as simple as storing the user ID when serializing, and finding // the user by ID when deserializing. However, since this...
random_line_split
jscompiler_test.py
#!/usr/bin/env python # # Copyright 2013 The Closure Library Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
['path/to/src1.js', 'path/to/src2.js'], ['--test_jvm_flag'], ['--test_compiler_flag'])) def testGetJavaVersion(self): def assertVersion(expected, version_string): self.assertEquals(expected, version_string) assertVersion(1.7, _TEST_JAVA_VERSION_STRING) asse...
'path/to/jscompiler.jar', 1.5,
random_line_split
jscompiler_test.py
#!/usr/bin/env python # # Copyright 2013 The Closure Library Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
_TEST_JAVA_VERSION_STRING = """\ openjdk version "1.7.0-google-v5" OpenJDK Runtime Environment (build 1.7.0-google-v5-64327-39803485) OpenJDK Server VM (build 22.0-b10, mixed mode) """ if __name__ == '__main__': unittest.main()
def assertVersion(expected, version_string): self.assertEquals(expected, version_string) assertVersion(1.7, _TEST_JAVA_VERSION_STRING) assertVersion(1.4, 'java version "1.4.0_03-ea"')
identifier_body
jscompiler_test.py
#!/usr/bin/env python # # Copyright 2013 The Closure Library Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
(expected, version_string): self.assertEquals(expected, version_string) assertVersion(1.7, _TEST_JAVA_VERSION_STRING) assertVersion(1.4, 'java version "1.4.0_03-ea"') _TEST_JAVA_VERSION_STRING = """\ openjdk version "1.7.0-google-v5" OpenJDK Runtime Environment (build 1.7.0-google-v5-64327-39803485...
assertVersion
identifier_name
jscompiler_test.py
#!/usr/bin/env python # # Copyright 2013 The Closure Library Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
unittest.main()
conditional_block
test_mnist_tutorial_keras.py
# pylint: disable=missing-docstring import unittest import numpy as np # pylint bug on next line from tensorflow.python.client import device_lib # pylint: disable=no-name-in-module from cleverhans.devtools.checks import CleverHansTest HAS_GPU = 'GPU' in {x.device_type for x in device_lib.list_local_devices()} class ...
unittest.main()
conditional_block
test_mnist_tutorial_keras.py
# pylint: disable=missing-docstring import unittest import numpy as np # pylint bug on next line from tensorflow.python.client import device_lib # pylint: disable=no-name-in-module from cleverhans.devtools.checks import CleverHansTest HAS_GPU = 'GPU' in {x.device_type for x in device_lib.list_local_devices()} class ...
self.assertTrue(report.train_adv_train_clean_eval > 0.90) self.assertTrue(report.train_adv_train_adv_eval > 0.30) atol_fac = 5e-2 if HAS_GPU else 1e-6 g = tf.Graph() with g.as_default(): np.random.seed(42) report_2 = mnist_tutorial_keras.mnist_tutorial(**test_dataset_indices) self....
def test_mnist_tutorial_keras(self): import tensorflow as tf from cleverhans_tutorials import mnist_tutorial_keras # Run the MNIST tutorial on a dataset of reduced size test_dataset_indices = {'train_start': 0, 'train_end': 5000, 'test_start': 0,...
identifier_body
test_mnist_tutorial_keras.py
# pylint: disable=missing-docstring import unittest import numpy as np # pylint bug on next line from tensorflow.python.client import device_lib # pylint: disable=no-name-in-module from cleverhans.devtools.checks import CleverHansTest HAS_GPU = 'GPU' in {x.device_type for x in device_lib.list_local_devices()} class ...
atol_fac = 5e-2 if HAS_GPU else 1e-6 g = tf.Graph() with g.as_default(): np.random.seed(42) report_2 = mnist_tutorial_keras.mnist_tutorial(**test_dataset_indices) self.assertClose(report.train_clean_train_clean_eval, report_2.train_clean_train_clean_eval, ...
self.assertTrue(report.train_adv_train_adv_eval > 0.30)
random_line_split
test_mnist_tutorial_keras.py
# pylint: disable=missing-docstring import unittest import numpy as np # pylint bug on next line from tensorflow.python.client import device_lib # pylint: disable=no-name-in-module from cleverhans.devtools.checks import CleverHansTest HAS_GPU = 'GPU' in {x.device_type for x in device_lib.list_local_devices()} class
(CleverHansTest): def test_mnist_tutorial_keras(self): import tensorflow as tf from cleverhans_tutorials import mnist_tutorial_keras # Run the MNIST tutorial on a dataset of reduced size test_dataset_indices = {'train_start': 0, 'train_end': 5000, ...
TestMNISTTutorialKeras
identifier_name
documenttype.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::DocumentTypeBinding; use dom::bindings::codegen::Bindings::DocumentTypeBindi...
} impl DocumentTypeMethods for DocumentType { // https://dom.spec.whatwg.org/#dom-documenttype-name fn Name(&self) -> DOMString { self.name.clone() } // https://dom.spec.whatwg.org/#dom-documenttype-publicid fn PublicId(&self) -> DOMString { self.public_id.clone() } // ht...
{ &self.system_id }
identifier_body
documenttype.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::DocumentTypeBinding; use dom::bindings::codegen::Bindings::DocumentTypeBindi...
(&self) { self.upcast::<Node>().remove_self(); } }
Remove
identifier_name
documenttype.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::DocumentTypeBinding; use dom::bindings::codegen::Bindings::DocumentTypeBindi...
let documenttype = DocumentType::new_inherited(name, public_id, system_id, document); Node::reflect_node(box documenttype, document, DocumentTypeBinding::Wrap) } #[inline] pub fn name(&self) -> &DOMString { &self.name } #[inline] pub fn public_id(&self) -> &DOMString { ...
document: &Document) -> Root<DocumentType> {
random_line_split