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
flv_dissector.py
#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import print_function import sys from struct import * import hashlib if len(sys.argv) != 2: print("Usage " + sys.argv[0] + " input_file") sys.exit(1) in_name = sys.argv[1] def dumpHeader(f): # check for signature sig = f.read(3) if sig != b'FLV': ...
print(" > [NALU] Type: " + str(nal_unit_type) + "\t| LEN " + str(totLen) + "\t| SHA1: " + sha1) # print(" START: " + data[origOffset:origOffset+32].encode('hex')) # if totLen > 32: # print(" END: " + data[origOffset+size-31:origOffset+size].encode('hex')) return True def dumpVideoPayload...
origOffset = offset # ignore padding while (unpack('B', data[offset+size-1])[0] == 0): #print("remove padding 0 " + str(unpack('B', data[offset+size-1])) + " SZ: " + str(size)) size -= 1 totLen = size m = hashlib.sha1() m.update(data[offset:offset+size]) sha1 = m.hexdigest() a = unpack('B', da...
identifier_body
flv_dissector.py
#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import print_function import sys from struct import * import hashlib if len(sys.argv) != 2: print("Usage " + sys.argv[0] + " input_file") sys.exit(1) in_name = sys.argv[1] def dumpHeader(f): # check for signature sig = f.read(3) if sig != b'FLV': ...
return True with open(in_name, 'rb') as f: try: if not dumpHeader(f): print("Invalid FLV header", file=sys.stderr) sys.exit(1) i = 0 while dumpTag(f): i += 1 except EOFError: print("unexpected end of file") print("Done, processed " + str(i) + " tags")
return False elif tagType == 8: if not dumpAudioPayload(payload): return False
random_line_split
flv_dissector.py
#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import print_function import sys from struct import * import hashlib if len(sys.argv) != 2: print("Usage " + sys.argv[0] + " input_file") sys.exit(1) in_name = sys.argv[1] def dumpHeader(f): # check for signature sig = f.read(3) if sig != b'FLV': ...
return True with open(in_name, 'rb') as f: try: if not dumpHeader(f): print("Invalid FLV header", file=sys.stderr) sys.exit(1) i = 0 while dumpTag(f): i += 1 except EOFError: print("unexpected end of file") print("Done, processed " + str(i) + " tags")
if not dumpAudioPayload(payload): return False
conditional_block
flv_dissector.py
#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import print_function import sys from struct import * import hashlib if len(sys.argv) != 2: print("Usage " + sys.argv[0] + " input_file") sys.exit(1) in_name = sys.argv[1] def
(f): # check for signature sig = f.read(3) if sig != b'FLV': print("Wrong signature got " + sig.encode('hex')) return False # check version version = unpack('B', f.read(1))[0] if version != 1: print("Wrong version got " + str(version)) return False # get flags flags = unpack('B', f.rea...
dumpHeader
identifier_name
app.module.ts
import { NgModule, ApplicationRef } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { RouterModule } from '@angular/router'; import { NgbModule } from '@ng-bootstrap/ng-...
}
{ }
identifier_body
app.module.ts
import { NgModule, ApplicationRef } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { RouterModule } from '@angular/router'; import { NgbModule } from '@ng-bootstrap/ng-...
CommercialService, OrdinaryService, DevicerelatService, SplitbillService, ChargeorderrepotService, SplitBranchQuery, OrderreportService, SplitbillreportService, DeviceService, WithdrawService, WithdrawreportService ]; export type StoreType = { state: InternalStateType, restoreInputValues: () ...
random_line_split
app.module.ts
import { NgModule, ApplicationRef } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { RouterModule } from '@angular/router'; import { NgbModule } from '@ng-bootstrap/ng-...
(public appState: AppState) { } }
constructor
identifier_name
autocomplete_deluxe.js
var escaped = val.replace(/&/g, '&amp;').replace(/\s/g,'&nbsp;').replace(/</g, '&lt;').replace(/>/g, '&gt;'); testSubject.html(escaped); // Calculate new width + whether to change var testerWidth = testSubject.width(), newWidth = (testerWidth + o.comfortZone) >= min...
}); }; this.jqObject.autocomplete({ 'source' : this.source, 'minLength': settings.min_length }); var jqObject = this.jqObject; var autocompleteDataKey = typeof(this.jqObject.data('autocomplete')) === 'object' ? 'item.autocomplete' : 'ui-autocomplete'; var throbber = $('<di...
{ response(generateValues(data, term)); }
conditional_block
autocomplete_deluxe.js
var escaped = val.replace(/&/g, '&amp;').replace(/\s/g,'&nbsp;').replace(/</g, '&lt;').replace(/>/g, '&gt;'); testSubject.html(escaped); // Calculate new width + whether to change var testerWidth = testSubject.width(), newWidth = (testerWidth + o.comfortZone) >= minW...
return this; }; /** * If there is no result this label will be shown. * @type {{label: string, value: string}} */ Drupal.autocomplete_deluxe.empty = {label: '- ' + Drupal.t('None') + ' -', value: "" }; /** * EscapeRegex function from jquery autocomplete, is not included in drupal. */ Dr...
$(this).bind('keyup keydown blur update', check); });
random_line_split
billboardjs-plugin-bubblecompare.esm.js
/*! * Copyright (c) 2017 ~ present NAVER Corp. * billboard.js project is licensed under the MIT license * * billboard.js, JavaScript chart library * https://naver.github.io/billboard.js/ * * @version 3.1.5 * @requires billboard.js * @summary billboard.js plugin */ import { select } from 'd3-selection'...
purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES O...
/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any
random_line_split
billboardjs-plugin-bubblecompare.esm.js
/*! * Copyright (c) 2017 ~ present NAVER Corp. * billboard.js project is licensed under the MIT license * * billboard.js, JavaScript chart library * https://naver.github.io/billboard.js/ * * @version 3.1.5 * @requires billboard.js * @summary billboard.js plugin */ import { select } from 'd3-selection'...
() { this.constructor = d; } if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + (b + "") + " is not a constructor or null"); _extendStatics(d, b), d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } /** * Copyright (c) 2017 ~ present ...
__
identifier_name
billboardjs-plugin-bubblecompare.esm.js
/*! * Copyright (c) 2017 ~ present NAVER Corp. * billboard.js project is licensed under the MIT license * * billboard.js, JavaScript chart library * https://naver.github.io/billboard.js/ * * @version 3.1.5 * @requires billboard.js * @summary billboard.js plugin */ import { select } from 'd3-selection'...
/** * Copyright (c) 2017 ~ present NAVER Corp. * billboard.js project is licensed under the MIT license */ /** * Base class to generate billboard.js plugin * @class Plugin */ /** * Version info string for plugin * @name version * @static * @memberof Plugin * @type {string} * @example * bb.plugin.stan...
{ function __() { this.constructor = d; } if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + (b + "") + " is not a constructor or null"); _extendStatics(d, b), d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }
identifier_body
Socket.js
/** * Socket.js * * @description :: TODO: You might write a short summary of how this model works and what it represents here. * @docs :: http://sailsjs.org/#!documentation/models */ module.exports = { attributes: { description: { type: 'string', required: false, defaultsTo: '' }, ...
}, random: { type: 'boolean', required: false, defaultsTo: true }, randomBreaks: { type: 'boolean', required: false, defaultsTo: true }, lastMessageReceived: { type: 'string', columnType: 'bigint', required: false } } };
stopTime: { // when the socket gets switched off (in minutes after midnight) type: 'number', defaultsTo: 24*60, required: false
random_line_split
fabfile.py
from fabric.api import env from fabric.context_managers import cd from fabric.operations import run, local, put env.shell = '/bin/bash -l -c' env.user = 'd' env.roledefs.update({ 'staging': ['staging.solebtc.com'], 'production': ['solebtc.com'] }) # Heaven will execute fab -R staging deploy:branch_name=master...
print("Deploying to %s server at %s as %s" % (server, env.host, env.user))
identifier_body
fabfile.py
from fabric.api import env from fabric.context_managers import cd from fabric.operations import run, local, put env.shell = '/bin/bash -l -c' env.user = 'd' env.roledefs.update({ 'staging': ['staging.solebtc.com'], 'production': ['solebtc.com'] }) # Heaven will execute fab -R staging deploy:branch_name=master...
# TODO # scp executable file from staging to production, database up, restart service # mark current timestamp or commit as version number so we can rollback easily def printMessage(server): print("Deploying to %s server at %s as %s" % (server, env.host, env.user))
run('supervisorctl restart solebtc') def deployProduction(branch_name): printMessage("production")
random_line_split
fabfile.py
from fabric.api import env from fabric.context_managers import cd from fabric.operations import run, local, put env.shell = '/bin/bash -l -c' env.user = 'd' env.roledefs.update({ 'staging': ['staging.solebtc.com'], 'production': ['solebtc.com'] }) # Heaven will execute fab -R staging deploy:branch_name=master...
(branch_name): deployProduction(branch_name) if env.roles[0] == 'production' else deployStaging(branch_name) def deployStaging(branch_name): printMessage("staging") codedir = '$GOPATH/src/github.com/solefaucet/solebtc' run('rm -rf %s' % codedir) run('mkdir -p %s' % codedir) local('git arc...
deploy
identifier_name
github.ts
import * as path from 'path' import * as fs from 'fs' import _request from 'request' function getErrorFromBody(body: string | any, opts: any) { if (typeof body === 'string') { try { body = JSON.parse(body) } catch (e) {} } // hide token from logs opts.headers.Authorization = 'Token **********' ...
name: tag, draft: true, } return request<{ id: string }>(opts) }) } export function updateAsset( token: string, repo: string, releaseId: string, asset: string ): Promise<{ name: string }> { const name = path.basename(asset) const opts = options( token, 'https://uploa...
{ return request<{ id: string }>( options( token, 'https://api.github.com/repos/' + repo + '/releases/tags/' + tag ) ) .then(function (res) { return res }) .catch(function () { const opts = options( token, 'https://api.github.com/repos/' + repo + '/release...
identifier_body
github.ts
import * as path from 'path' import * as fs from 'fs' import _request from 'request' function getErrorFromBody(body: string | any, opts: any) { if (typeof body === 'string') { try { body = JSON.parse(body)
} // hide token from logs opts.headers.Authorization = 'Token **********' // log the request options to help debugging body.request = opts return new Error(JSON.stringify(body, null, ' ')) } function request<T>(opts: any): Promise<T> { return new Promise(function (resolve, reject) { _request(opts, (...
} catch (e) {}
random_line_split
github.ts
import * as path from 'path' import * as fs from 'fs' import _request from 'request' function getErrorFromBody(body: string | any, opts: any) { if (typeof body === 'string') { try { body = JSON.parse(body) } catch (e) {} } // hide token from logs opts.headers.Authorization = 'Token **********' ...
( token: string, repo: string, releaseId: string, asset: string ): Promise<{ name: string }> { const name = path.basename(asset) const opts = options( token, 'https://uploads.github.com/repos/' + repo + '/releases/' + releaseId + '/assets?name=' + encodeURIComponent(nam...
updateAsset
identifier_name
github.ts
import * as path from 'path' import * as fs from 'fs' import _request from 'request' function getErrorFromBody(body: string | any, opts: any) { if (typeof body === 'string') { try { body = JSON.parse(body) } catch (e) {} } // hide token from logs opts.headers.Authorization = 'Token **********' ...
resolve(body) }) }) } function options(token: string, url: string, method?: string): any { return { method: method || 'GET', url: url, headers: { Accept: 'application/vnd.github.v3+json', Authorization: 'Token ' + token, 'User-Agent': 'SKPM-Release-Agent', }, } } exp...
{ return reject(getErrorFromBody(body, opts)) }
conditional_block
win_delay_load_hook.rs
//! Rust port of [win_delay_load_hook.cc][]. //! //! When the addon tries to load the "node.exe" DLL module, this module gives it the pointer to the //! .exe we are running in instead. Typically, that will be the same value. But if the node executable //! was renamed, you would not otherwise get the correct DLL. //! //...
} #[allow(non_snake_case)] type PfnDliHook = unsafe extern "C" fn(dliNotify: usize, pdli: *const DelayLoadInfo) -> FARPROC; const HOST_BINARIES: &[&[u8]] = &[b"node.exe", b"electron.exe"]; unsafe extern "C" fn load_exe_hook(event: usize, info: *const DelayLoadInfo) -> FARPROC { if event != 0x01 /* dliNotePreLoa...
dwLastError: DWORD,
random_line_split
win_delay_load_hook.rs
//! Rust port of [win_delay_load_hook.cc][]. //! //! When the addon tries to load the "node.exe" DLL module, this module gives it the pointer to the //! .exe we are running in instead. Typically, that will be the same value. But if the node executable //! was renamed, you would not otherwise get the correct DLL. //! //...
{ /// size of structure cb: DWORD, /// raw form of data (everything is there) /// Officially a pointer to ImgDelayDescr but we don't access it. pidd: LPVOID, /// points to address of function to load ppfn: *mut FARPROC, /// name of dll szDll: LPCSTR, /// name or ordinal of proce...
DelayLoadInfo
identifier_name
win_delay_load_hook.rs
//! Rust port of [win_delay_load_hook.cc][]. //! //! When the addon tries to load the "node.exe" DLL module, this module gives it the pointer to the //! .exe we are running in instead. Typically, that will be the same value. But if the node executable //! was renamed, you would not otherwise get the correct DLL. //! //...
let dll_name = CStr::from_ptr((*info).szDll); if !HOST_BINARIES.iter().any(|&host_name| host_name == dll_name.to_bytes()) { return null_mut(); } let exe_handle = GetModuleHandleA(null_mut()); // PfnDliHook sometimes has to return a FARPROC, sometimes an HMODULE, but only one // of th...
{ return null_mut(); }
conditional_block
lib.rs
https://github.com/Twinklebear/bspline/tree/master/examples). //! //! # 1D Example //! //! This example shows how to create the 1D cardinal cubic B-spline example shown on [Wikipedia's //! B-splines page](https://en.wikipedia.org/wiki/B-spline). For examples of evaluating the spline //! to an image and saving the outpu...
{ let mut tmp = Vec::with_capacity(self.degree + 1); for j in 0..=self.degree { let p = j + i_start - self.degree - 1; tmp.push(self.control_points[p]); } for lvl in 0..self.degree { let k = lvl + 1; for j in 0..self.degree - lvl { ...
identifier_body
lib.rs
D for the positioning //! of the curve and a quadratic B-spline in RGB space to color it (check out the //! [logo](https://github.com/Twinklebear/bspline/blob/master/examples/logo.rs) example!). Other //! much simpler examples of 1D and 2D quadratic, cubic and quartic B-splines can also be found in //! the [examples](h...
(&self, t: F, i_start: usize) -> T { let mut tmp = Vec::with_capacity(self.degree + 1); for j in 0..=self.degree { let p = j + i_start - self.degree - 1; tmp.push(self.control_points[p]); } for lvl in 0..self.degree { let k = lvl + 1; for j...
de_boor_iterative
identifier_name
lib.rs
D for the positioning //! of the curve and a quadratic B-spline in RGB space to color it (check out the //! [logo](https://github.com/Twinklebear/bspline/blob/master/examples/logo.rs) example!). Other //! much simpler examples of 1D and 2D quadratic, cubic and quartic B-splines can also be found in //! the [examples](h...
if knots.len() != control_points.len() + degree + 1 { panic!( "Invalid number of knots, got {}, expected {}", knots.len(), control_points.len() + degree + 1 ); } knots.sort_by(|a, b| a.partial_cmp(b).unwrap()); BSpl...
{ panic!("Too few control points for curve"); }
conditional_block
lib.rs
D for the positioning //! of the curve and a quadratic B-spline in RGB space to color it (check out the //! [logo](https://github.com/Twinklebear/bspline/blob/master/examples/logo.rs) example!). Other //! much simpler examples of 1D and 2D quadratic, cubic and quartic B-splines can also be found in //! the [examples](h...
Some(x) => x, None => self.knots.len() - self.degree - 1, }; self.de_boor_iterative(t, i) } /// Get an iterator over the control points. pub fn control_points(&self) -> Iter<T> { self.control_points.iter() } /// Get an iterator over the knots. pub ...
let i = match upper_bounds(&self.knots[..], t) { Some(x) if x == 0 => self.degree, Some(x) if x >= self.knots.len() - self.degree - 1 => { self.knots.len() - self.degree - 1 }
random_line_split
helpers.py
#!/usr/bin/python # # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
(ldi_masks): """Enforce that the last layer's mask has all ones. Args: ldi_masks: L X [...] masks Returns: ldi_masks: L X [..], masks with last layer set as 1 """ n_layers = ldi_masks.get_shape().as_list()[0] if n_layers == 1: return ldi_masks * 0 + 1 else: masks_fg, masks_bg = tf.split(l...
enforce_bg_occupied
identifier_name
helpers.py
#!/usr/bin/python # # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
def zbuffer_weights(disps, scale=50): """Compute decreasing, non-negative inverse depths based on disparity deltas. Args: disps: [...] inverse depths, between 0 (far) and 1 (closest possible depth) scale: multiplicative factor before exponentiation Returns: z_buf_wts: [..], higher weights for clos...
masks_fg, masks_bg = tf.split(ldi_masks, [n_layers - 1, 1], axis=0) masks_bg = masks_bg * 0 + 1 return tf.concat([masks_fg, masks_bg], axis=0)
conditional_block
helpers.py
#!/usr/bin/python # # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
perm[-2] = n_inp_dim - 1 rot_t = tf.transpose(rot, perm=perm) return rot_t def divide_safe(num, den, name=None): eps = 1e-8 den += eps * tf.cast(tf.equal(den, 0), 'float32') return tf.divide(num, den, name=name) def pixel_coords(bs, h, w): """Creates a bs X h X w X 3 tensor with (x,y,1) coord at...
n_inp_dim = len(rot.get_shape()) perm = range(n_inp_dim) perm[-1] = n_inp_dim - 2
random_line_split
helpers.py
#!/usr/bin/python # # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
def pixel_coords(bs, h, w): """Creates a bs X h X w X 3 tensor with (x,y,1) coord at each pixel. Args: bs: batch_size (number of meshgrid repetitions) h: number of rows w: number of columns Returns: bs X h X w X 3 tensor with (x,y,1) coord at each pixel. Note : these coordinates are 0.5 in...
eps = 1e-8 den += eps * tf.cast(tf.equal(den, 0), 'float32') return tf.divide(num, den, name=name)
identifier_body
mark.rs
use std; pub trait Marker { fn mark(&mut self, s: usize) -> &Marker; fn is_marked(&self, s: usize) -> bool; } pub struct TMarker { marks: Vec<u32>, marking: u32 } impl Marker for TMarker { fn mark(&mut self, s: usize) -> &Marker { self.marks[s] = self.marking; self } fn is...
} impl TMarker { pub fn new(n: usize) -> TMarker { TMarker { marks: vec![0; n], marking: 1 } } pub fn reset(&mut self) -> &TMarker { if self.marking < std::u32::MAX { self.marking += 1; } else { for i in &mut self.marks { *i = 0; }...
{ self.marks[s] == self.marking }
identifier_body
mark.rs
use std; pub trait Marker { fn mark(&mut self, s: usize) -> &Marker; fn is_marked(&self, s: usize) -> bool; } pub struct TMarker { marks: Vec<u32>, marking: u32 } impl Marker for TMarker { fn mark(&mut self, s: usize) -> &Marker { self.marks[s] = self.marking; self } fn is...
else { for i in &mut self.marks { *i = 0; } } self } }
{ self.marking += 1; }
conditional_block
mark.rs
use std; pub trait Marker { fn mark(&mut self, s: usize) -> &Marker; fn is_marked(&self, s: usize) -> bool; } pub struct TMarker { marks: Vec<u32>, marking: u32 } impl Marker for TMarker { fn mark(&mut self, s: usize) -> &Marker { self.marks[s] = self.marking; self } fn is...
(n: usize) -> TMarker { TMarker { marks: vec![0; n], marking: 1 } } pub fn reset(&mut self) -> &TMarker { if self.marking < std::u32::MAX { self.marking += 1; } else { for i in &mut self.marks { *i = 0; } } self } }
new
identifier_name
mark.rs
use std; pub trait Marker { fn mark(&mut self, s: usize) -> &Marker; fn is_marked(&self, s: usize) -> bool; } pub struct TMarker { marks: Vec<u32>, marking: u32 } impl Marker for TMarker { fn mark(&mut self, s: usize) -> &Marker { self.marks[s] = self.marking; self } fn is...
for i in &mut self.marks { *i = 0; } } self } }
} else {
random_line_split
oneshot.rs
disconnected channel /// it must check for data because there is no "data plus upgrade" state. pub use self::Failure::*; pub use self::UpgradeResult::*; pub use self::SelectionResult::*; use self::MyUpgrade::*; use sync::mpsc::Receiver; use sync::mpsc::blocking::{self, SignalToken}; use cell::UnsafeCell; use ptr; us...
(&self, t: T) -> Result<(), T> { unsafe { // Sanity check match *self.upgrade.get() { NothingSent => {} _ => panic!("sending on a oneshot that's already sent on "), } assert!((*self.data.get()).is_none()); ptr::write(sel...
send
identifier_name
oneshot.rs
channel /// it must check for data because there is no "data plus upgrade" state. pub use self::Failure::*; pub use self::UpgradeResult::*; pub use self::SelectionResult::*; use self::MyUpgrade::*; use sync::mpsc::Receiver; use sync::mpsc::blocking::{self, SignalToken}; use cell::UnsafeCell; use ptr; use sync::atomi...
} else { // drop the signal token, since we never blocked drop(unsafe { SignalToken::cast_from_usize(ptr) }); } } self.try_recv() } pub fn try_recv(&self) -> Result<T, Failure<T>> { unsafe { match self.state.load(Orde...
{ wait_token.wait(); debug_assert!(self.state.load(Ordering::SeqCst) != EMPTY); }
conditional_block
oneshot.rs
disconnected channel /// it must check for data because there is no "data plus upgrade" state. pub use self::Failure::*; pub use self::UpgradeResult::*; pub use self::SelectionResult::*; use self::MyUpgrade::*; use sync::mpsc::Receiver; use sync::mpsc::blocking::{self, SignalToken}; use cell::UnsafeCell; use ptr; us...
// There's data on the channel, so make sure we destroy it promptly. // This is why not using an arc is a little difficult (need the box // to stay valid while we take the data). DATA => unsafe { (&mut *self.data.get()).take().unwrap(); }, // We're the only ...
// An empty channel has nothing to do, and a remotely disconnected // channel also has nothing to do b/c we're about to run the drop // glue DISCONNECTED | EMPTY => {}
random_line_split
morestack4.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 ...
and_then_get_big_again { x: x } } fn main() { do task::spawn { getbig_and_fail(1); }; }
fn and_then_get_big_again(x:int) -> and_then_get_big_again {
random_line_split
morestack4.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 ...
} struct and_then_get_big_again { x:int, } impl Drop for and_then_get_big_again { fn finalize(&self) {} } fn and_then_get_big_again(x:int) -> and_then_get_big_again { and_then_get_big_again { x: x } } fn main() { do task::spawn { getbig_and_fail(1); }; }
{ fail!(); }
conditional_block
morestack4.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 ...
{ x:int, } impl Drop for and_then_get_big_again { fn finalize(&self) {} } fn and_then_get_big_again(x:int) -> and_then_get_big_again { and_then_get_big_again { x: x } } fn main() { do task::spawn { getbig_and_fail(1); }; }
and_then_get_big_again
identifier_name
morestack4.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 ...
; }
{ do task::spawn { getbig_and_fail(1); }
identifier_body
0019_sitemode.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import datetime import caching.base class Migration(migrations.Migration): dependencies = [ ('opendebates', '0018_flag_note'), ] operations = [ migrations.CreateModel( na...
('show_total_votes', models.BooleanField(default=True)), ('allow_sorting_by_votes', models.BooleanField(default=True)), ('allow_voting_and_submitting_questions', models.BooleanField(default=True)), ('debate_time', models.DateTimeField(default=datetime.date...
('show_question_votes', models.BooleanField(default=True)),
random_line_split
0019_sitemode.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import datetime import caching.base class Migration(migrations.Migration):
dependencies = [ ('opendebates', '0018_flag_note'), ] operations = [ migrations.CreateModel( name='SiteMode', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('show_question_votes...
identifier_body
0019_sitemode.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import datetime import caching.base class
(migrations.Migration): dependencies = [ ('opendebates', '0018_flag_note'), ] operations = [ migrations.CreateModel( name='SiteMode', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ...
Migration
identifier_name
align.PE.py
import sys import os import re from subprocess import PIPE, Popen, call fq1, fq2, db, prefix = sys.argv[1:] bowtie2_logfh = open(prefix+'.bowtie2.log','w') bamfile = prefix+'.bam' bowtie2_cmd = ['bowtie2', '-x', db, '-1', fq1, '-2', fq2] samtools_view = ['samtools', 'view', '-bhS', '-'] samtools_sort = ['samtools', 's...
samtools_index = ['samtools', 'index', bamfile] call(samtools_index, stderr = bowtie2_logfh, stdout = bowtie2_logfh) bowtie2_logfh.close()
p2 = Popen(samtools_view, stdin = p1.stdout, stdout = PIPE, stderr = bowtie2_logfh) p3 = Popen(samtools_sort, stdin = p2.stdout, stdout = PIPE, stderr = bowtie2_logfh) p1.stdout.close() p2.stdout.close() output, err = p3.communicate()
random_line_split
wiki.py
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # # Copyright (C) 2015 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the h...
self.wiki_parts = yaml.load(content) def get_part(self, name): self._fetch() if name in self.wiki_parts: if 'plugin' and 'type' in self.wiki_parts[name]: del self.wiki_parts[name]['type'] return self.wiki_parts[name] def compose(self, name...
content = content[:-len(_WIKI_CLOSE)]
conditional_block
wiki.py
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # # Copyright (C) 2015 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the h...
(self): if self.wiki_parts is None: raw_content = requests.get(PARTS_URI, params=PARTS_URI_PARAMS) content = raw_content.text.strip() if content.startswith(_WIKI_OPEN): content = content[len(_WIKI_OPEN):].strip() if content.endswith(_WIKI_CLOSE): ...
_fetch
identifier_name
wiki.py
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # # Copyright (C) 2015 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the h...
if name in self.wiki_parts: if 'plugin' and 'type' in self.wiki_parts[name]: del self.wiki_parts[name]['type'] return self.wiki_parts[name] def compose(self, name, properties): """Return properties composed with the ones from part name in the wiki. ...
def get_part(self, name): self._fetch()
random_line_split
wiki.py
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # # Copyright (C) 2015 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the h...
return self.wiki_parts[name] def compose(self, name, properties): """Return properties composed with the ones from part name in the wiki. :param str name: The name of the part to query from the wiki :param dict properties: The current set of properties :return: Part pro...
wiki_parts = None def _fetch(self): if self.wiki_parts is None: raw_content = requests.get(PARTS_URI, params=PARTS_URI_PARAMS) content = raw_content.text.strip() if content.startswith(_WIKI_OPEN): content = content[len(_WIKI_OPEN):].strip() i...
identifier_body
testfilestat.py
#!/usr/bin/python # coding=utf-8 ################################################################################ from test import CollectorTestCase from test import get_collector_config from test import unittest from mock import Mock from mock import patch try: from cStringIO import StringIO StringIO # work...
(self): config = get_collector_config('FilestatCollector', { 'interval': 10 }) self.collector = FilestatCollector(config, None) def test_import(self): self.assertTrue(FilestatCollector) @patch('__builtin__.open') @patch('os.access', Mock(return_value=True)) ...
setUp
identifier_name
testfilestat.py
#!/usr/bin/python # coding=utf-8 ################################################################################ from test import CollectorTestCase from test import get_collector_config from test import unittest from mock import Mock from mock import patch try: from cStringIO import StringIO StringIO # work...
unittest.main()
conditional_block
testfilestat.py
#!/usr/bin/python # coding=utf-8 ################################################################################ from test import CollectorTestCase from test import get_collector_config from test import unittest from mock import Mock from mock import patch try: from cStringIO import StringIO StringIO # work...
@patch('__builtin__.open') @patch('os.access', Mock(return_value=True)) @patch.object(Collector, 'publish') def test_should_open_proc_sys_fs_file_nr(self, publish_mock, open_mock): open_mock.return_value = StringIO('') self.collector.collect() open_mock.assert_called_once_with(...
self.assertTrue(FilestatCollector)
identifier_body
testfilestat.py
#!/usr/bin/python # coding=utf-8 ################################################################################ from test import CollectorTestCase from test import get_collector_config from test import unittest from mock import Mock from mock import patch try: from cStringIO import StringIO StringIO # work...
'assigned': 576, 'unused': 0, 'max': 4835852 } self.setDocExample(collector=self.collector.__class__.__name__, metrics=metrics, defaultpath=self.collector.config['path']) self.assertPublishedMany(publish_m...
metrics = {
random_line_split
CodeReplValidationService.ts
// Copyright 2014 The Oppia 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 // // Unless required by ap...
return warningsList; }, getAllWarnings: function(stateName, customizationArgs, answerGroups, defaultOutcome) { return this.getCustomizationArgsWarnings(customizationArgs).concat( baseInteractionValidationService.getAllOutcomeWarnings( answerGroups, defaultOut...
{ warningsList.push({ type: WARNING_TYPES.ERROR, message: 'The post-code text must be a string.' }); }
conditional_block
CodeReplValidationService.ts
// Copyright 2014 The Oppia 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 // // Unless required by ap...
angular.module('oppia').factory('CodeReplValidationService', [ 'baseInteractionValidationService', 'WARNING_TYPES', function(baseInteractionValidationService, WARNING_TYPES) { return { getCustomizationArgsWarnings: function(customizationArgs) { var warningsList = []; baseInteractionValida...
random_line_split
logger.py
"""A very simple logger that tries to be concurrency-safe.""" import os, sys import time import traceback import subprocess import select LOG_FILE = '/var/log/nodemanager.func' # basically define 3 levels LOG_NONE=0 LOG_NODE=1 LOG_VERBOSE=2 # default is to log a reasonable amount of stuff for when running on oper...
except OSError: sys.stderr.write(msg) sys.stderr.flush() def log_exc(msg="",name=None): """Log the traceback resulting from an exception.""" if name: log("%s: EXCEPTION caught <%s> \n %s" %(name, msg, traceback.format_exc())) else: log("EXCEPTION caught <%s> \n %s" %(msg...
os.close(fd)
random_line_split
logger.py
"""A very simple logger that tries to be concurrency-safe.""" import os, sys import time import traceback import subprocess import select LOG_FILE = '/var/log/nodemanager.func' # basically define 3 levels LOG_NONE=0 LOG_NODE=1 LOG_VERBOSE=2 # default is to log a reasonable amount of stuff for when running on oper...
(command,timeout=default_timeout_minutes*60,poll=1): message=" ".join(command) log("log_call: running command %s" % message) verbose("log_call: timeout=%r s" % timeout) verbose("log_call: poll=%r s" % poll) trigger=time.time()+timeout result = False try: child = subprocess.Popen(comm...
log_call
identifier_name
logger.py
"""A very simple logger that tries to be concurrency-safe.""" import os, sys import time import traceback import subprocess import select LOG_FILE = '/var/log/nodemanager.func' # basically define 3 levels LOG_NONE=0 LOG_NODE=1 LOG_VERBOSE=2 # default is to log a reasonable amount of stuff for when running on oper...
os.write(fd, '%s: %s' % (time.asctime(time.gmtime()), msg)) os.close(fd) except OSError: sys.stderr.write(msg) sys.stderr.flush() def log_exc(msg="",name=None): """Log the traceback resulting from an exception.""" if name: log("%s: EXCEPTION caught <%s> \n %s" %(nam...
msg += '\n'
conditional_block
logger.py
"""A very simple logger that tries to be concurrency-safe.""" import os, sys import time import traceback import subprocess import select LOG_FILE = '/var/log/nodemanager.func' # basically define 3 levels LOG_NONE=0 LOG_NODE=1 LOG_VERBOSE=2 # default is to log a reasonable amount of stuff for when running on oper...
def flush (self): if self.buffer: log (self.message + self.buffer) self.buffer='' # time out in seconds - avoid hanging subprocesses - default is 5 minutes default_timeout_minutes=5 # returns a bool that is True when everything goes fine and the retcod is 0 def log_call(command,t...
self.buffer += c if c=='\n': self.flush()
identifier_body
sequences.py
# sequences.py # strings >>> # 4 ways to make a string >>> str1 = 'This is a string. We built it with single quotes.' >>> str2 = "This is also a string, but built with double quotes." >>> str3 = '''This is built using triple quotes, ... so it can span multiple lines.''' >>> str4 = """This too ... is a multiline one ....
>>> len(str1) 49 # indexing and slicing >>> s = "The trouble is you think you have time." >>> s[0] # indexing at position 0, which is the first char 'T' >>> s[5] # indexing at position 5, which is the sixth char 'r' >>> s[:4] # slicing, we specify only the stop position 'The ' >>> s[4:] # slicing, we specify only...
>>> type(bytes_obj) <class 'bytes'> # length
random_line_split
Publication.ts
/** * * Copyright (c) 2014 All Rights Reserved by the SDL Group. * * 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 * ...
* * @type {string} * @memberOf IPublication */ versionRef?: string; /** * Publication language */ version: string; /** * Logical id * * @type {string} * @memberOf IPublication */ language?: string; /** * Logical I...
* Version (eg 1, 1.1.1)
random_line_split
gemm.rs
//! C := alpha * A * B + beta * C use complex::Complex; use {Transpose, blasint, ffi}; /// The signature of `gemm` pub type Fn<T> = unsafe extern "C" fn ( *const Transpose, *const Transpose, *const blasint, *const blasint, *const blasint, *const T, *const T, *const blasint, *const...
() -> Fn<f64> { ffi::dgemm_ } }
gemm
identifier_name
gemm.rs
//! C := alpha * A * B + beta * C use complex::Complex; use {Transpose, blasint, ffi}; /// The signature of `gemm` pub type Fn<T> = unsafe extern "C" fn ( *const Transpose, *const Transpose, *const blasint, *const blasint, *const blasint, *const T, *const T, *const blasint, *const...
} impl ::Gemm for f64 { fn gemm() -> Fn<f64> { ffi::dgemm_ } }
{ ffi::sgemm_ }
identifier_body
gemm.rs
//! C := alpha * A * B + beta * C use complex::Complex; use {Transpose, blasint, ffi}; /// The signature of `gemm` pub type Fn<T> = unsafe extern "C" fn ( *const Transpose, *const Transpose, *const blasint, *const blasint, *const blasint, *const T, *const T, *const blasint, *const...
impl ::Gemm for f32 { fn gemm() -> Fn<f32> { ffi::sgemm_ } } impl ::Gemm for f64 { fn gemm() -> Fn<f64> { ffi::dgemm_ } }
ffi::zgemm_ } }
random_line_split
MuiTextInputField.tsx
import { FieldConfig, Field } from 'formik'; import * as React from 'react'; import InlineErrorView from 'shared/view/elements/Errors/InlineErrorView/InlineErrorView'; import MuiTextInput from 'shared/view/elements/MuiTextInput/MuiTextInput'; type AllProps = FieldConfig & Omit< React.ComponentProps<typeof MuiTe...
<div> <div style={{ position: 'relative' }}> <MuiTextInput multiline={this.props.multiline} size={this.props.size} rows={this.props.rows} value={field.value} name={field.name} ...
return ( <Field {...this.props}> {({ field, meta, form }: any) => { const isShowError = meta.touched && meta.error; return (
random_line_split
charactersCount.js
/** * Lists the number of different characters */ /* global document: true, Node: true, window: true */ exports.version = '1.0'; exports.module = function(phantomas) { 'use strict'; //phantomas.setMetric('differentCharacters'); // @desc the number of different characters in the body @offenders phantom...
if (document.body && document.body.textContent) { var allText = ''; // Traverse all DOM Tree to read text var runner = new phantomas.nodeRunner(); runner.walk(document.body, function(node, depth) { ...
{ return arr.reduce(function(prev, next){ prev[next] = 1; return prev; }, {}); }
identifier_body
charactersCount.js
/** * Lists the number of different characters */ /* global document: true, Node: true, window: true */ exports.version = '1.0'; exports.module = function(phantomas) { 'use strict'; //phantomas.setMetric('differentCharacters'); // @desc the number of different characters in the body @offenders phantom...
(arr){ return arr.reduce(function(prev, next){ prev[next] = 1; return prev; }, {}); } if (document.body && document.body.textContent) { var allText = ''; // T...
getLetterCount
identifier_name
charactersCount.js
/** * Lists the number of different characters */
exports.module = function(phantomas) { 'use strict'; //phantomas.setMetric('differentCharacters'); // @desc the number of different characters in the body @offenders phantomas.on('report', function() { phantomas.log("charactersCount: starting to analyze characters on page..."); phantomas....
/* global document: true, Node: true, window: true */ exports.version = '1.0';
random_line_split
git_submodule.py
#!/usr/bin/env python # encoding: utf-8 """ Waf tool for defining ardupilot's submodules, so that they are kept up to date. Submodules can be considered dynamic sources, since they are updated during the build. Furthermore, they can be used to generate other dynamic sources (mavlink headers generation, for example). T...
from waflib import Context, Task, Utils from waflib.Configure import conf from waflib.TaskGen import before_method, feature, taskgen_method import os.path class update_submodule(Task.Task): color = 'BLUE' run_str = '${GIT} -C ${SRC_ROOT} submodule update --init -- ${SUBMODULE_PATH}' def runnable_status(...
"""
random_line_split
git_submodule.py
#!/usr/bin/env python # encoding: utf-8 """ Waf tool for defining ardupilot's submodules, so that they are kept up to date. Submodules can be considered dynamic sources, since they are updated during the build. Furthermore, they can be used to generate other dynamic sources (mavlink headers generation, for example). T...
(Task.Task): color = 'BLUE' run_str = '${GIT} -C ${SRC_ROOT} submodule update --init -- ${SUBMODULE_PATH}' def runnable_status(self): e = self.env.get_flat cmd = e('GIT'), '-C', e('SRC_ROOT'), 'submodule', 'status', '--', e('SUBMODULE_PATH') out = self.generator.bld.cmd_and_log(cmd,...
update_submodule
identifier_name
git_submodule.py
#!/usr/bin/env python # encoding: utf-8 """ Waf tool for defining ardupilot's submodules, so that they are kept up to date. Submodules can be considered dynamic sources, since they are updated during the build. Furthermore, they can be used to generate other dynamic sources (mavlink headers generation, for example). T...
return self.uid_ def __str__(self): return 'Submodule update: %s' % self.submodule def configure(cfg): cfg.find_program('git') _submodules_tasks = {} @taskgen_method def git_submodule_update(self, name): if name not in _submodules_tasks: module_node = self.bld.srcnode.make_node...
m = Utils.md5() m.update(self.__class__.__name__) m.update(self.env.get_flat('SUBMODULE_PATH')) self.uid_ = m.digest()
conditional_block
git_submodule.py
#!/usr/bin/env python # encoding: utf-8 """ Waf tool for defining ardupilot's submodules, so that they are kept up to date. Submodules can be considered dynamic sources, since they are updated during the build. Furthermore, they can be used to generate other dynamic sources (mavlink headers generation, for example). T...
def __str__(self): return 'Submodule update: %s' % self.submodule def configure(cfg): cfg.find_program('git') _submodules_tasks = {} @taskgen_method def git_submodule_update(self, name): if name not in _submodules_tasks: module_node = self.bld.srcnode.make_node(os.path.join('modules', n...
if not hasattr(self, 'uid_'): m = Utils.md5() m.update(self.__class__.__name__) m.update(self.env.get_flat('SUBMODULE_PATH')) self.uid_ = m.digest() return self.uid_
identifier_body
vrootgraphes.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true });
const vgraph_1 = require("./vgraph"); const vrootgraph_list_1 = require("../../components/graph/vrootgraph.list"); const cabeiri_lang_1 = require("cabeiri-lang"); class RootGraphesState { constructor() { this.selectedRootGraph = cabeiri_lang_1.CID.CID_NONE; } } exports.RootGraphesState = RootGraphesStat...
const React = require("react");
random_line_split
vrootgraphes.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const React = require("react"); const vgraph_1 = require("./vgraph"); const vrootgraph_list_1 = require("../../components/graph/vrootgraph.list"); const cabeiri_lang_1 = require("cabeiri-lang"); class RootGraphesState { constructor() { ...
() { return React.createElement("div", { className: "container-fluid" }, React.createElement("div", { className: "row" }, React.createElement("div", { className: "col-xs-4 col-md-3" }, React.createElement(vrootgraph_list_1.VRootGraphList, { onItemSelected: this.on...
render
identifier_name
bootstrap-table-en-US.js
}; }; var arrayIncludes = { // `Array.prototype.includes` method // https://tc39.github.io/ecma262/#sec-array.prototype.includes includes: createMethod(true), // `Array.prototype.indexOf` method // https://tc39.github.io/ecma262/#sec-array.prototype.indexof indexOf: createMethod(false) }; var i...
var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded'; // We can't use this feature detection in V8 since it causes
random_line_split
bootstrap-table-en-US.js
var check = function (it) { return it && it.Math == Math && it; }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global_1 = // eslint-disable-next-line no-undef check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || check(t...
{ return module = { exports: {} }, fn(module, module.exports), module.exports; }
identifier_body
bootstrap-table-en-US.js
(fn, module) { return module = { exports: {} }, fn(module, module.exports), module.exports; } var check = function (it) { return it && it.Math == Math && it; }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global_1 = // eslint-disable-next-line no-undef check(typeof glob...
createCommonjsModule
identifier_name
conf.py
#!/usr/bin/env python # # eppy documentation build configuration file, created by # sphinx-quickstart on Fri Jun 9 13:47:02 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All co...
"Miscellaneous", ), ]
author, "eppy", "One line description of project.",
random_line_split
sobol_vs_uniform.py
# In this example we will show the difference between a 2-d Sobol sequence # and sampling uniformly at random in 2 dimensions. # The Sobol sequence has far lower discrepancy, i.e., the generated samples # are spread out better in the sampling space. # # This example requires matplotlib to generate figures. import matp...
x1_random = [random.random() for _ in range(num_pts)] x2_random = [random.random() for _ in range(num_pts)] # plot results plt.figure(1) plt.plot(x1_sobol, x2_sobol, 'o') plt.title('Sobol sequence') plt.draw() plt.figure(2) plt.plot(x1_random, x2_random, 'ro') plt.title('Uniform random samples') plt.show()
# generate uniform points
random_line_split
grep_test.py
#!/usr/bin/env python -u # encoding: utf-8 # # Copyright (c) 2012, Peter Hillerström <peter.hillerstrom@gmail.com> # All rights reserved. This software is licensed under 3-clause BSD license. # # For the full copyright and license information, please view the LICENSE # file that was distributed with this source code. ...
for line in log_lines(): assert search(line), "Regexp pattern '{0}' didn't match line '{1}'".format(pattern, line)
random_line_split
grep_test.py
#!/usr/bin/env python -u # encoding: utf-8 # # Copyright (c) 2012, Peter Hillerström <peter.hillerstrom@gmail.com> # All rights reserved. This software is licensed under 3-clause BSD license. # # For the full copyright and license information, please view the LICENSE # file that was distributed with this source code. ...
or line in log_lines(): assert search(line), "Regexp pattern '{0}' didn't match line '{1}'".format(pattern, line)
identifier_body
grep_test.py
#!/usr/bin/env python -u # encoding: utf-8 # # Copyright (c) 2012, Peter Hillerström <peter.hillerstrom@gmail.com> # All rights reserved. This software is licensed under 3-clause BSD license. # # For the full copyright and license information, please view the LICENSE # file that was distributed with this source code. ...
ssert search(line), "Regexp pattern '{0}' didn't match line '{1}'".format(pattern, line)
conditional_block
grep_test.py
#!/usr/bin/env python -u # encoding: utf-8 # # Copyright (c) 2012, Peter Hillerström <peter.hillerstrom@gmail.com> # All rights reserved. This software is licensed under 3-clause BSD license. # # For the full copyright and license information, please view the LICENSE # file that was distributed with this source code. ...
): return [ "[Sun Apr 08 12:51:52 2012] [notice] Digest: done", "[Mon Jul 11 09:26:13 2011] Error: [client ::1] File does not exist: /Library/WebServer/Documents/favicon.ico", ] def test_search(): for line in log_lines(): assert search(line), "Regexp pattern '{0}' didn't match line ...
og_lines(
identifier_name
tensor_types.d.ts
/** * @license * Copyright 2018 Google LLC. 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 * * Unless required by a...
* string]:Tensor|number|string} */ export declare type TensorContainer = void | Tensor | string | number | boolean | TensorContainerObject | TensorContainerArray | Float32Array | Int32Array | Uint8Array; export interface TensorContainerObject { [x: string]: TensorContainer; } export interface TensorContainerArray...
random_line_split
PostListView.js
import React, { PropTypes } from 'react'; import { connect } from 'react-redux'; import './PostListView.scss'; import { toastr } from 'react-redux-toastr'; import { bindActionCreators } from 'redux'; import { fetchPostsFromApi, selectPostCategory, clearPostsErrors, clearPostsMessages } from '../../../actions/ac...
} render() { const { posts, isFetching, postCategories, selectedCategory, errors, messages } = this.props; const items = posts.items; const visiblePosts = getFilteredPosts(selectedCategory, items); return ( <LoadingIndicator isLoading={isFetching}> ...
{ clearMessages(); }
conditional_block
PostListView.js
import React, { PropTypes } from 'react'; import { connect } from 'react-redux'; import './PostListView.scss'; import { toastr } from 'react-redux-toastr'; import { bindActionCreators } from 'redux'; import { fetchPostsFromApi, selectPostCategory, clearPostsErrors, clearPostsMessages } from '../../../actions/ac...
handleClose(sender) { const { clearErrors, clearMessages } = this.props; const theElement = sender.target.id; if (theElement === 'button-close-error-panel') { clearErrors(); } else if (theElement === 'button-close-messages-panel') { clearMessages(); } } render() { ...
{ toastr.info(message); }
identifier_body
PostListView.js
import React, { PropTypes } from 'react'; import { connect } from 'react-redux'; import './PostListView.scss'; import { toastr } from 'react-redux-toastr'; import { bindActionCreators } from 'redux'; import { fetchPostsFromApi, selectPostCategory, clearPostsErrors, clearPostsMessages } from '../../../actions/ac...
() { //TODO: Implement me!! } handleSelectCategory(category) { const { selectPostCat } = this.props; selectPostCat(category); } showMessage(message) { toastr.info(message); } handleClose(sender) { const { clearErrors, clearMessages } = this.props; const theE...
handleChangePage
identifier_name
PostListView.js
import React, { PropTypes } from 'react'; import { connect } from 'react-redux'; import './PostListView.scss'; import { toastr } from 'react-redux-toastr'; import { bindActionCreators } from 'redux'; import { fetchPostsFromApi, selectPostCategory, clearPostsErrors, clearPostsMessages } from '../../../actions/ac...
selectedCategory, errors, messages } = this.props; const items = posts.items; const visiblePosts = getFilteredPosts(selectedCategory, items); return ( <LoadingIndicator isLoading={isFetching}> <div className="post-list-view__wrapper"> <MessagesSection messages={...
isFetching, postCategories,
random_line_split
adoorable.tsx
import * as React from 'react' import SEO from '../components/seo' import '../images/adoorable.css' interface ADoorIs { text: string; className: string; } // a beginning, a transition, reception, security const aDoorIs: ADoorIs[] = [ { text: "Janus", className: "five" }, { text: "a home", cla...
{ text: "a passage", className: "nine" }, { text: "a barrier", className: "nine" }, { text: "a mystery", className: "nine" }, { text: "the future", className: "eleven" }, { text: "an entrance", className: "eleven" }, { text: "an opportunity", classNa...
className: "eight" },
random_line_split
adoorable.tsx
import * as React from 'react' import SEO from '../components/seo' import '../images/adoorable.css' interface ADoorIs { text: string; className: string; } // a beginning, a transition, reception, security const aDoorIs: ADoorIs[] = [ { text: "Janus", className: "five" }, { text: "a home", cla...
extends React.Component<Props, State> { insta = "https://www.instagram.com/a_door.able/" constructor(props: Props) { super(props) this.state = { descriptor: aDoorIs[Math.floor(Math.random()*aDoorIs.length)] } } componentDidMount() { window.setInterval(() => { if (aDoorIs.length < ...
Adoorable
identifier_name
adoorable.tsx
import * as React from 'react' import SEO from '../components/seo' import '../images/adoorable.css' interface ADoorIs { text: string; className: string; } // a beginning, a transition, reception, security const aDoorIs: ADoorIs[] = [ { text: "Janus", className: "five" }, { text: "a home", cla...
let descriptor = this.state.descriptor while (descriptor === this.state.descriptor) { descriptor = aDoorIs[Math.floor(Math.random()*aDoorIs.length)] } this.setState({descriptor}) }, 4000) } render =() => ( <div className="adoorable"> <SEO title="@a_door.able"/> ...
{ return }
conditional_block
version.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import re import shutil import logging from migrate import exceptions from migrate.versioning import pathed, script from datetime import datetime import six log = logging.getLogger(__name__) class VerNum(object): """A version number that behaves like a st...
(self, vernum=None): """Returns required version. If vernum is not given latest version will be returned otherwise required version will be returned. :raises: : exceptions.VersionNotFoundError if respective migration script file of version is not present in the migration reposit...
version
identifier_name
version.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import re import shutil import logging from migrate import exceptions from migrate.versioning import pathed, script from datetime import datetime import six log = logging.getLogger(__name__) class VerNum(object): """A version number that behaves like a st...
def __le__(self, value): return int(self) <= int(value) def __repr__(self): return "<VerNum(%s)>" % self.value def __str__(self): return str(self.value) def __int__(self): return int(self.value) def __index__(self): return int(self.value) if six.PY3:...
def __ge__(self, value): return int(self) >= int(value)
random_line_split
version.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import re import shutil import logging from migrate import exceptions from migrate.versioning import pathed, script from datetime import datetime import six log = logging.getLogger(__name__) class VerNum(object): """A version number that behaves like a st...
def __repr__(self): return "<VerNum(%s)>" % self.value def __str__(self): return str(self.value) def __int__(self): return int(self.value) def __index__(self): return int(self.value) if six.PY3: def __hash__(self): return hash(self.value) c...
return int(self) <= int(value)
identifier_body
version.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import re import shutil import logging from migrate import exceptions from migrate.versioning import pathed, script from datetime import datetime import six log = logging.getLogger(__name__) class VerNum(object): """A version number that behaves like a st...
ret = cls._instances[val] return ret def __init__(self,value): self.value = str(int(value)) if self < 0: raise ValueError("Version number cannot be negative") def __add__(self, value): ret = int(self) + int(value) return VerNum(ret) def __sub__...
cls._instances[val] = super(VerNum, cls).__new__(cls)
conditional_block
h.js
if (typeof global === 'undefined') { global = window; } else { global.XRegExp = require('../../xregexp-all'); } // Ensure that all opt-in features are disabled when each spec starts global.disableOptInFeatures = function() { XRegExp.uninstall('namespacing astral'); }; // Property name used for extended re...
{ String.prototype.repeat = function(count) { return count ? Array(count + 1).join(this) : ''; }; }
conditional_block
h.js
if (typeof global === 'undefined') { global = window; } else { global.XRegExp = require('../../xregexp-all'); } // Ensure that all opt-in features are disabled when each spec starts global.disableOptInFeatures = function() { XRegExp.uninstall('namespacing astral'); }; // Property name used for extended re...
global.hasNativeY = XRegExp._hasNativeFlag('y'); // Check for strict mode support global.hasStrictMode = (function() { 'use strict'; return !this; }()); // Naive polyfill of String.prototype.repeat if (!String.prototype.repeat) { String.prototype.repeat = function(count) { return count ? Array(cou...
// Check for ES6 `u` flag support global.hasNativeU = XRegExp._hasNativeFlag('u'); // Check for ES6 `y` flag support
random_line_split
UserController.ts
import express = require("express"); import mongodb = require("mongodb"); import bodyParser = require("body-parser"); import jwt = require('jsonwebtoken'); import config = require('../config'); import { Persistance } from "../db/Persistance"; import { Vendeur } from "../_model/Vendeur"; import { Inscription } from "../...
{ var token = await Persistance.tokensMotDePasse().findOne({token: changement.token}); if (token == null) throw "La reinitialisation a echouée, le lien n'est pas ou plus valide"; if (token.utilise) throw "Ce lien a déjà été utilisé"; await Persistance.utilis...
await EnvoiEmail.singleton().envoyerEmail(message) } async reinitialiserMotDePasse(changement:ChangementDeMotDePasse) : Promise<void>
random_line_split
UserController.ts
import express = require("express"); import mongodb = require("mongodb"); import bodyParser = require("body-parser"); import jwt = require('jsonwebtoken'); import config = require('../config'); import { Persistance } from "../db/Persistance"; import { Vendeur } from "../_model/Vendeur"; import { Inscription } from "../...
ar token = await Persistance.tokensMotDePasse().findOne({token: changement.token}); if (token == null) throw "La reinitialisation a echouée, le lien n'est pas ou plus valide"; if (token.utilise) throw "Ce lien a déjà été utilisé"; await Persistance.utilisateurs().update...
identifier_body