file_name large_stringlengths 4 140 | prefix large_stringlengths 0 39k | suffix large_stringlengths 0 36.1k | middle large_stringlengths 0 29.4k | fim_type large_stringclasses 4
values |
|---|---|---|---|---|
life.rs | #![cfg(test)]
use traits::Cell;
use traits::Coord;
use traits::Engine;
use traits::Consumer;
use traits::Grid;
use engine::Sequential;
use grid::twodim::TwodimGrid;
use grid::nhood::MooreNhood;
use grid::EmptyState;
use utils::find_cell;
/// Implementation of Conway's Game of Life.
#[derive(Clone, Debug, PartialEq, Se... | (&self, alive: u32) -> LifeState {
match alive {
3 => LifeState::Alive,
_ => LifeState::Dead,
}
}
#[inline]
fn alive_state(&self, alive: u32) -> LifeState {
match alive {
2 | 3 => LifeState::Alive,
_ => LifeState::Dead,
}
}... | dead_state | identifier_name |
life.rs | #![cfg(test)]
use traits::Cell;
use traits::Coord;
use traits::Engine;
use traits::Consumer;
use traits::Grid;
use engine::Sequential;
use grid::twodim::TwodimGrid;
use grid::nhood::MooreNhood;
use grid::EmptyState;
use utils::find_cell;
/// Implementation of Conway's Game of Life.
#[derive(Clone, Debug, PartialEq, Se... |
// Should be in default state
let default_state = LifeState::Dead;
assert!(grid.cells()
.iter()
.all(|c| c.state == default_state));
// Vertical spinner
// D | A | D
// D | A | D
// D | A | D
let cells = vec![Life {
state: LifeState::Alive,
... | let mut grid: TwodimGrid<Life, _, _> = TwodimGrid::new(3, 3, nhood, EmptyState, 1); | random_line_split |
app.component.ts | import { Component, ViewChild, ElementRef } from "@angular/core";
import { Http, Headers, RequestOptions, Response } from "@angular/http";
import { SemanticPopupComponent } from "ng-semantic";
@Component({
selector: "app",
template: `
<nav class="ui menu inverted huge" *ngIf="!isPlaying()">
<a rout... | {
response:Response;
isLogged:boolean;
@ViewChild("myPopup") myPopup:SemanticPopupComponent;
constructor(private http:Http) {
this.isLogged = !!localStorage.getItem("id_token");
}
ngOnInit(){
localStorage.setItem("playing", "false");
}
isPlaying() {
return loc... | AppComponent | identifier_name |
app.component.ts | import { Component, ViewChild, ElementRef } from "@angular/core";
import { Http, Headers, RequestOptions, Response } from "@angular/http";
import { SemanticPopupComponent } from "ng-semantic";
@Component({
selector: "app",
template: `
<nav class="ui menu inverted huge" *ngIf="!isPlaying()">
<a rout... | // this.response = res;
// },
// (error:Error) => {
// console.log(error);
// }
// );
//}
//
//login() {
// this.http.post("/login", JSON.stringify({password: this.user.password}), new RequestOptions({
/... | // headers: new Headers({"Content-Type": "application/json"})
// }))
// .map((res:any) => res.json())
// .subscribe(
// (res:Response) => { | random_line_split |
app.component.ts | import { Component, ViewChild, ElementRef } from "@angular/core";
import { Http, Headers, RequestOptions, Response } from "@angular/http";
import { SemanticPopupComponent } from "ng-semantic";
@Component({
selector: "app",
template: `
<nav class="ui menu inverted huge" *ngIf="!isPlaying()">
<a rout... |
isPlaying() {
return localStorage.getItem("playing") == "true";
}
//signup() {
// this.http.post("/login/signup", JSON.stringify({
// password: this.user.password,
// username: this.user.username
// }), new RequestOptions({
// headers... | {
localStorage.setItem("playing", "false");
} | identifier_body |
lib.rs | // Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#![recursion_limit = "128"]
mod ext;
mod repr;
use proc_macro2::Span;
use syn::visit::{self, Visit};
use syn::{
parse_quote, punctuated::Punctuated, ... | <T: KindRepr + Eq>(config: &Config<T>) -> bool {
overlap(config.allowed_combinations, config.disallowed_but_legal_combinations)
}
assert!(!config_overlaps(&STRUCT_UNALIGNED_CFG));
assert!(!config_overlaps(&ENUM_FROM_BYTES_CFG));
assert!(!config_overlaps(&ENUM_UNALIGNED_CFG))... | config_overlaps | identifier_name |
lib.rs | // Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#![recursion_limit = "128"]
mod ext;
mod repr;
use proc_macro2::Span;
use syn::visit::{self, Visit};
use syn::{
parse_quote, punctuated::Punctuated, ... |
#[rustfmt::skip]
const STRUCT_AS_BYTES_CFG: Config<StructRepr> = {
use StructRepr::*;
Config {
// NOTE: Since disallowed_but_legal_combinations is empty, this message
// will never actually be emitted.
allowed_combinations_message: r#"AsBytes requires repr of "C", "transparent", or "pa... | {
// TODO(joshlf): Support type parameters.
if !s.ast().generics.params.is_empty() {
return Error::new(Span::call_site(), "unsupported on types with type parameters")
.to_compile_error();
}
let reprs = try_or_print!(STRUCT_AS_BYTES_CFG.validate_reprs(s.ast()));
let require_size... | identifier_body |
lib.rs | // Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#![recursion_limit = "128"]
mod ext;
mod repr;
use proc_macro2::Span;
use syn::visit::{self, Visit};
use syn::{
parse_quote, punctuated::Punctuated, ... | }
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_config_repr_orderings() {
// Validate that the repr lists in the various configs are in the
// canonical order. If they aren't, then our algorithm to look up in
// those lists won't work.
// TODO(joshlf): Remove once... | random_line_split | |
couchpotato.js | var CouchPotato = new Class({
Implements: [Events, Options], | action: 'index',
params: {}
},
pages: [],
block: [],
initialize: function(){
var self = this;
self.global_events = {};
},
setup: function(options) {
var self = this;
self.setOptions(options);
self.c = $(document.body);
self.route = new Route(self.defaults);
self.createLayout();
self.cre... |
defaults: {
page: 'home', | random_line_split |
couchpotato.js | var CouchPotato = new Class({
Implements: [Events, Options],
defaults: {
page: 'home',
action: 'index',
params: {}
},
pages: [],
block: [],
initialize: function(){
var self = this;
self.global_events = {};
},
setup: function(options) {
var self = this;
self.setOptions(options);
self.c = ... | gth, extra) {
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz" + (extra ? '-._!@#$%^&*()+=' : '');
var stringLength = length || 8;
var randomString = '';
for (var i = 0; i < stringLength; i++) {
var rnum = Math.floor(Math.random() * chars.length);
randomString += chars.charAt(rnum);
... | omString(len | identifier_name |
couchpotato.js | var CouchPotato = new Class({
Implements: [Events, Options],
defaults: {
page: 'home',
action: 'index',
params: {}
},
pages: [],
block: [],
initialize: function(){
var self = this;
self.global_events = {};
},
setup: function(options) {
var self = this;
self.setOptions(options);
self.c = ... | unction(){
var keyPaths = [];
var saveKeyPath = function(path) {
keyPaths.push({
sign: (path[0] === '+' || path[0] === '-')? parseInt(path.shift()+1) : 1,
path: path
});
};
var valueOf = function(object, path) {
var ptr = object;
path.each(function(key) { ptr = ptr[key] });
return ptr;
};
var ... | ar chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz" + (extra ? '-._!@#$%^&*()+=' : '');
var stringLength = length || 8;
var randomString = '';
for (var i = 0; i < stringLength; i++) {
var rnum = Math.floor(Math.random() * chars.length);
randomString += chars.charAt(rnum);
}
return random... | identifier_body |
restyle_hints.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 https://mozilla.org/MPL/2.0/. */
//! Restyle hints: an optimization to avoid unnecessarily matching selectors.
#[cfg(feature = "gecko")]
use crat... |
/// Returns whether the hint specifies that selector matching must be re-run
/// for the element.
#[inline]
pub fn match_self(&self) -> bool {
self.intersects(RestyleHint::RESTYLE_SELF)
}
/// Returns whether the hint specifies that some cascade levels must be
/// replaced.
#[i... | {
!(*self & !Self::for_animations()).is_empty()
} | identifier_body |
restyle_hints.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 https://mozilla.org/MPL/2.0/. */
//! Restyle hints: an optimization to avoid unnecessarily matching selectors.
#[cfg(feature = "gecko")]
use crat... | /// descendants.
pub fn contains_subtree(&self) -> bool {
self.contains(RestyleHint::RESTYLE_SELF | RestyleHint::RESTYLE_DESCENDANTS)
}
/// Returns whether we need to restyle this element.
pub fn has_non_animation_invalidations(&self) -> bool {
self.intersects(
RestyleHi... | /// Returns whether this hint invalidates the element and all its | random_line_split |
restyle_hints.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 https://mozilla.org/MPL/2.0/. */
//! Restyle hints: an optimization to avoid unnecessarily matching selectors.
#[cfg(feature = "gecko")]
use crat... |
if (raw.0 & (nsRestyleHint::eRestyle_ForceDescendants.0 | nsRestyleHint::eRestyle_Force.0)) !=
0
{
raw.0 &= !nsRestyleHint::eRestyle_Force.0;
hint.insert(RestyleHint::RECASCADE_SELF);
}
if (raw.0 & nsRestyleHint::eRestyle_ForceDescendants.0) != 0 {
... | {
raw.0 &= !nsRestyleHint::eRestyle_Subtree.0;
raw.0 &= !nsRestyleHint::eRestyle_SomeDescendants.0;
hint.insert(RestyleHint::RESTYLE_DESCENDANTS);
} | conditional_block |
restyle_hints.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 https://mozilla.org/MPL/2.0/. */
//! Restyle hints: an optimization to avoid unnecessarily matching selectors.
#[cfg(feature = "gecko")]
use crat... | (&self) -> bool {
self.intersects(
RestyleHint::RESTYLE_SELF |
RestyleHint::RECASCADE_SELF |
(Self::replacements() & !Self::for_animations()),
)
}
/// Propagates this restyle hint to a child element.
pub fn propagate(&mut self, traversal_flags: &T... | has_non_animation_invalidations | identifier_name |
LocalFileField.js | var _ = require('underscore'),
$ = require('jquery'),
React = require('react'),
Field = require('../Field'),
Note = require('../../components/Note'),
Select = require('react-select');
module.exports = Field.create({
shouldCollapse: function() {
return this.props.collapse && !this.hasExisting();
},
fileFie... | this.setState(state);
},
hasLocal: function() {
return this.state.origin === 'local';
},
hasFile: function() {
return this.hasExisting() || this.hasLocal();
},
hasExisting: function() {
return !!this.props.value.filename;
},
getFilename: function() {
if (this.hasLocal()) {
return this.fileField... | }
}
| random_line_split |
LocalFileField.js | var _ = require('underscore'),
$ = require('jquery'),
React = require('react'),
Field = require('../Field'),
Note = require('../../components/Note'),
Select = require('react-select');
module.exports = Field.create({
shouldCollapse: function() {
return this.props.collapse && !this.hasExisting();
},
fileFie... |
return <button type='button' className='btn btn-link btn-cancel btn-delete-file' onClick={this.removeFile}>
{clearText}
</button>;
}
},
renderFileField: function() {
return <input ref='fileField' type='file' name={this.props.paths.upload} className='field-upload' onChange={this.fileChanged} />;
},
... | {
clearText = (this.props.autoCleanup ? 'Delete File' : 'Remove File');
} | conditional_block |
text.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/. */
//! Computed types for text properties.
#[cfg(feature = "servo")]
use properties::StyleBuilder;
use std::fmt::{se... | let mut has_any = false;
macro_rules! write_value {
($line:path => $css:expr) => {
if self.contains($line) {
if has_any {
dest.write_str(" ")?;
}
dest.write_str($css)?;
ha... | random_line_split | |
text.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/. */
//! Computed types for text properties.
#[cfg(feature = "servo")]
use properties::StyleBuilder;
use std::fmt::{se... | (style: &StyleBuilder) -> Self {
use values::computed::Display;
// Start with no declarations if this is an atomic inline-level box;
// otherwise, start with the declarations in effect and add in the text
// decorations that this block specifies.
let mut result = match style.get... | from_style | identifier_name |
text.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/. */
//! Computed types for text properties.
#[cfg(feature = "servo")]
use properties::StyleBuilder;
use std::fmt::{se... |
}
impl ToCss for TextDecorationLine {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
where
W: Write,
{
let mut has_any = false;
macro_rules! write_value {
($line:path => $css:expr) => {
if self.contains($line) {
if has_a... | {
if self.sides_are_logical {
debug_assert_eq!(self.first, TextOverflowSide::Clip);
self.second.to_css(dest)?;
} else {
self.first.to_css(dest)?;
dest.write_str(" ")?;
self.second.to_css(dest)?;
}
Ok(())
} | identifier_body |
text.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/. */
//! Computed types for text properties.
#[cfg(feature = "servo")]
use properties::StyleBuilder;
use std::fmt::{se... |
Ok(())
}
}
/// A struct that represents the _used_ value of the text-decoration property.
///
/// FIXME(emilio): This is done at style resolution time, though probably should
/// be done at layout time, otherwise we need to account for display: contents
/// and similar stuff when we implement it.
///
///... | {
dest.write_str("none")?;
} | conditional_block |
customers_not_buying_since_long_time.py | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint
def execute(filters=None):
if not filters: filters ={}
days_since_last_order = filters.get("days_... | sum(if(so.status = "Stopped",
so.net_total * so.per_delivered/100,
so.net_total)) as 'total_order_considered',
max(so.transaction_date) as 'last_sales_order_date',
DATEDIFF(CURDATE(), max(so.transaction_date)) as 'days_since_last_order'
from `tabCustomer` cust, `tabSales Order` so
where cust.... | count(distinct(so.name)) as 'num_of_order',
sum(net_total) as 'total_order_value', | random_line_split |
customers_not_buying_since_long_time.py | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint
def execute(filters=None):
if not filters: filters ={}
days_since_last_order = filters.get("days_... | ():
return [
"Customer:Link/Customer:120",
"Customer Name:Data:120",
"Territory::120",
"Customer Group::120",
"Number of Order::120",
"Total Order Value:Currency:120",
"Total Order Considered:Currency:160",
"Last Order Amount:Currency:160",
"Last Sales Order Date:Date:160",
"Days Since Last ... | get_columns | identifier_name |
customers_not_buying_since_long_time.py | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint
def execute(filters=None):
if not filters: filters ={}
days_since_last_order = filters.get("days_... | return [
"Customer:Link/Customer:120",
"Customer Name:Data:120",
"Territory::120",
"Customer Group::120",
"Number of Order::120",
"Total Order Value:Currency:120",
"Total Order Considered:Currency:160",
"Last Order Amount:Currency:160",
"Last Sales Order Date:Date:160",
"Days Since Last Order... | identifier_body | |
customers_not_buying_since_long_time.py | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint
def execute(filters=None):
if not filters: filters ={}
days_since_last_order = filters.get("days_... |
return columns, data
def get_so_details():
return webnotes.conn.sql("""select
cust.name,
cust.customer_name,
cust.territory,
cust.customer_group,
count(distinct(so.name)) as 'num_of_order',
sum(net_total) as 'total_order_value',
sum(if(so.status = "Stopped",
so.net_total * so.per_de... | cust.insert(7,get_last_so_amt(cust[0]))
data.append(cust) | conditional_block |
pmf.rs | use std::slice;
use itertools::Itertools;
use bio::stats::LogProb;
#[derive(Clone, Debug)]
pub struct Entry<T: Clone> {
pub value: T,
pub prob: LogProb,
}
#[derive(Clone, Debug)]
pub struct PMF<T: Clone> {
inner: Vec<Entry<T>>,
}
impl<T: Clone + Sized> PMF<T> {
/// Create a new PMF from sorted vect... |
}
impl PMF<f32> {
pub fn scale(&mut self, scale: f32) {
for e in &mut self.inner {
e.value *= scale;
}
}
}
| {
let cdf = self.cdf();
let lower = cdf
.binary_search_by(|p| p.partial_cmp(&LogProb(0.025f64.ln())).unwrap())
.unwrap_or_else(|i| i);
let upper = cdf
.binary_search_by(|p| p.partial_cmp(&LogProb(0.975f64.ln())).unwrap())
.unwrap_or_else(|i| i);
... | identifier_body |
pmf.rs | use std::slice;
use itertools::Itertools;
use bio::stats::LogProb;
#[derive(Clone, Debug)]
pub struct Entry<T: Clone> {
pub value: T,
pub prob: LogProb,
}
#[derive(Clone, Debug)]
pub struct PMF<T: Clone> {
inner: Vec<Entry<T>>,
}
impl<T: Clone + Sized> PMF<T> {
/// Create a new PMF from sorted vect... | }
/// Return maximum a posteriori probability estimate (MAP).
pub fn map(&self) -> &T {
let mut max = self.iter().next().unwrap();
for e in self.iter() {
if e.prob >= max.prob {
max = e;
}
}
&max.value
}
}
impl<T: Clone + Sized + ... | LogProb::ln_cumsum_exp(self.inner.iter().map(|e| e.prob)).collect_vec() | random_line_split |
pmf.rs | use std::slice;
use itertools::Itertools;
use bio::stats::LogProb;
#[derive(Clone, Debug)]
pub struct Entry<T: Clone> {
pub value: T,
pub prob: LogProb,
}
#[derive(Clone, Debug)]
pub struct PMF<T: Clone> {
inner: Vec<Entry<T>>,
}
impl<T: Clone + Sized> PMF<T> {
/// Create a new PMF from sorted vect... | (&self) -> slice::Iter<Entry<T>> {
self.inner.iter()
}
pub fn cdf(&self) -> Vec<LogProb> {
LogProb::ln_cumsum_exp(self.inner.iter().map(|e| e.prob)).collect_vec()
}
/// Return maximum a posteriori probability estimate (MAP).
pub fn map(&self) -> &T {
let mut max = self.iter... | iter | identifier_name |
pmf.rs | use std::slice;
use itertools::Itertools;
use bio::stats::LogProb;
#[derive(Clone, Debug)]
pub struct Entry<T: Clone> {
pub value: T,
pub prob: LogProb,
}
#[derive(Clone, Debug)]
pub struct PMF<T: Clone> {
inner: Vec<Entry<T>>,
}
impl<T: Clone + Sized> PMF<T> {
/// Create a new PMF from sorted vect... |
}
&max.value
}
}
impl<T: Clone + Sized + Copy> PMF<T> {
/// Return the 95% credible interval.
pub fn credible_interval(&self) -> (T, T) {
let cdf = self.cdf();
let lower = cdf
.binary_search_by(|p| p.partial_cmp(&LogProb(0.025f64.ln())).unwrap())
.un... | {
max = e;
} | conditional_block |
urls.py | from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
|
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'DjangoApplication1.views.home', name='home'),
# url(r'^DjangoApplication1/', include('DjangoApplication1.fob.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admind... | admin.autodiscover()
| random_line_split |
index.d.ts | // Type definitions for electron-winstaller 2.6
// Project: https://github.com/electron/windows-installer
// Definitions by: Brendan Forster <https://github.com/shiftkey>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export function convertVersion(version: string): string;
export function createW... | */
signWithParams?: string;
/**
* A URL to an ICO file to use as the application icon (displayed in Control Panel > Programs and Features).
*
* Defaults to the Atom icon.
*/
iconUrl?: string;
/**
* The ICO file to use as the icon for the generated Setup.exe
*/
setu... | *
* Overrides `certificateFile` and `certificatePassword`. | random_line_split |
android-fingerprint-auth.ts | import { Cordova, Plugin } from './plugin';
export interface AndroidFingerprintAuthOptions {
/**
* Required
* Used as the alias for your key in the Android Key Store.
*/
clientId: string;
/**
* Used to create credential string for encrypted token and as alias to retrieve the cipher.
*/
usernam... | * AndroidFingerprintAuthOptions
*/
@Plugin({
pluginName: 'AndroidFingerprintAuth',
plugin: 'cordova-plugin-android-fingerprint-auth',
pluginRef: 'FingerprintAuth',
repo: 'https://github.com/mjwheatley/cordova-plugin-android-fingerprint-auth'
})
export class AndroidFingerprintAuth {
/**
* Opens a native ... | random_line_split | |
android-fingerprint-auth.ts | import { Cordova, Plugin } from './plugin';
export interface AndroidFingerprintAuthOptions {
/**
* Required
* Used as the alias for your key in the Android Key Store.
*/
clientId: string;
/**
* Used to create credential string for encrypted token and as alias to retrieve the cipher.
*/
usernam... |
/**
* Delete the cipher used for encryption and decryption by username
* @returns {Promise<any>} Returns a Promise that resolves if the cipher was successfully deleted
*/
@Cordova()
static delete(options: {clientId: string; username: string; }): Promise<{deleted: boolean}> { return; }
}
| { return; } | identifier_body |
android-fingerprint-auth.ts | import { Cordova, Plugin } from './plugin';
export interface AndroidFingerprintAuthOptions {
/**
* Required
* Used as the alias for your key in the Android Key Store.
*/
clientId: string;
/**
* Used to create credential string for encrypted token and as alias to retrieve the cipher.
*/
usernam... | (options: AndroidFingerprintAuthOptions): Promise<{
/**
* Biometric authentication
*/
withFingerprint: boolean;
/**
* Authentication using backup credential activity
*/
withBackup: boolean;
/**
* base64encoded string representation of user credentials
*/
token: stri... | encrypt | identifier_name |
lib.rs | #![feature(test)]
#![feature(plugin)]
#![feature(asm)]
#![feature(naked_functions)]
#![plugin(dynasm)]
#![allow(unused_features)]
#![allow(unknown_lints)]
#![allow(new_without_default)]
#![allow(match_same_arms)]
#[cfg(target_arch = "x86_64")]
extern crate dynasmrt;
#[macro_use]
extern crate bitflag... |
}
| {
self.cpu.ppu.rendering_enabled()
} | identifier_body |
lib.rs | #![feature(test)]
#![feature(plugin)]
#![feature(asm)]
#![feature(naked_functions)]
#![plugin(dynasm)]
#![allow(unused_features)]
#![allow(unknown_lints)]
#![allow(new_without_default)]
#![allow(match_same_arms)]
#[cfg(target_arch = "x86_64")]
extern crate dynasmrt;
#[macro_use]
extern crate bitflag... | }
}
}
pub struct EmulatorBuilder {
cart: Cart,
settings: Settings,
pub screen: Box<screen::Screen>,
pub audio_out: Box<audio::AudioOut>,
pub io: Box<IO>,
}
impl EmulatorBuilder {
pub fn new(cart: Cart, settings: Settings) -> EmulatorBuilder {
EmulatorBuilder... | trace_cpu: false,
disassemble_functions: false,
| random_line_split |
lib.rs | #![feature(test)]
#![feature(plugin)]
#![feature(asm)]
#![feature(naked_functions)]
#![plugin(dynasm)]
#![allow(unused_features)]
#![allow(unknown_lints)]
#![allow(new_without_default)]
#![allow(match_same_arms)]
#[cfg(target_arch = "x86_64")]
extern crate dynasmrt;
#[macro_use]
extern crate bitflag... |
builder.io = Box::new(io::sdl::SdlIO::new(event_pump.clone()));
builder
}
pub fn build(self) -> Emulator {
let settings = Rc::new(self.settings);
let dispatcher = cpu::dispatcher::Dispatcher::new();
let cart: Rc<UnsafeCell<Cart>> = Rc::new(UnsafeCell::new(self... | {
builder.audio_out = Box::new(audio::sdl::SDLAudioOut::new(sdl));
} | conditional_block |
lib.rs | #![feature(test)]
#![feature(plugin)]
#![feature(asm)]
#![feature(naked_functions)]
#![plugin(dynasm)]
#![allow(unused_features)]
#![allow(unknown_lints)]
#![allow(new_without_default)]
#![allow(match_same_arms)]
#[cfg(target_arch = "x86_64")]
extern crate dynasmrt;
#[macro_use]
extern crate bitflag... | (&mut self) {
self.cpu.run_frame();
}
pub fn halted(&self) -> bool {
self.cpu.halted()
}
#[cfg(feature = "debug_features")]
pub fn mouse_pick(&self, px_x: i32, px_y: i32) {
self.cpu.ppu.mouse_pick(px_x, px_y);
}
pub fn rendering_enabled(&self) -> bool ... | run_frame | identifier_name |
0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
| dependencies = [
]
operations = [
migrations.CreateModel(
name='SkipRequest',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('key', models.CharField(max_length=64, verbose_name='Sender ... | identifier_body | |
0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='SkipRequest',
fields=[
('id', models.AutoField(... | },
bases=(models.Model,),
),
migrations.CreateModel(
name='Video',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('description', models.TextField(help_text='Descr... | 'verbose_name_plural': 'Skip requests', | random_line_split |
0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class | (migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='SkipRequest',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('key', models.CharField(max_len... | Migration | identifier_name |
pygame.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
from __future__ import absolute_import
from __future__ import with_statement
from __future__ import division
from __future__ import print_function
'''
Collected utilities for pygame
It is difficult to write pixels directly in python.
There's some way to get a framebuffer bac... | ():
if sys.platform != 'darwin':
return
try:
import ctypes
import ctypes.util
ogl = ctypes.cdll.LoadLibrary(ctypes.util.find_library("OpenGL"))
# set v to 1 to enable vsync, 0 to disable vsync
v = ctypes.c_int(1)
ogl.CGLSetParameter(ogl.CGLGetCurrentContex... | enable_vsync | identifier_name |
pygame.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
from __future__ import absolute_import
from __future__ import with_statement
from __future__ import division
from __future__ import print_function
'''
Collected utilities for pygame
It is difficult to write pixels directly in python.
There's some way to get a framebuffer bac... |
if d==3:
draw[...,:3]=rgbdata[...,::-1]
draw[...,-1]=255 # alpha channel
if d==4:
draw[...,:3]=rgbdata[...,-2::-1]
draw[...,-1]=rgbdata[...,-1]
# get surface and copy data to sceeen
surface = pg.Surface((w,h))
numpy_surface = np.frombuffer(surface.get_buffer())
n... | draw[...,0]=rgbdata
draw[...,1]=rgbdata
draw[...,2]=rgbdata
draw[...,3]=255 # alpha channel | conditional_block |
pygame.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
from __future__ import absolute_import
from __future__ import with_statement
from __future__ import division
from __future__ import print_function
'''
Collected utilities for pygame
It is difficult to write pixels directly in python.
There's some way to get a framebuffer bac... | print('pygame graphics will not work')
pg = None
def enable_vsync():
if sys.platform != 'darwin':
return
try:
import ctypes
import ctypes.util
ogl = ctypes.cdll.LoadLibrary(ctypes.util.find_library("OpenGL"))
# set v to 1 to enable vsync, 0 to disable vsync
... | import pygame as pg
except:
print('pygame package is missing; it is obsolete so this is not unusual') | random_line_split |
pygame.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
from __future__ import absolute_import
from __future__ import with_statement
from __future__ import division
from __future__ import print_function
'''
Collected utilities for pygame
It is difficult to write pixels directly in python.
There's some way to get a framebuffer bac... |
def start(W,H,name='untitled'):
# Get things going
pg.quit()
pg.init()
enable_vsync()
window = pg.display.set_mode((W,H))
pg.display.set_caption(name)
return window
def draw_array(screen,rgbdata,doshow=True):
'''
Send array data to a PyGame window.
PyGame is BRG order which i... | if sys.platform != 'darwin':
return
try:
import ctypes
import ctypes.util
ogl = ctypes.cdll.LoadLibrary(ctypes.util.find_library("OpenGL"))
# set v to 1 to enable vsync, 0 to disable vsync
v = ctypes.c_int(1)
ogl.CGLSetParameter(ogl.CGLGetCurrentContext(), cty... | identifier_body |
lib.rs | //! [Experimental] Generic programming with SIMD
#![cfg_attr(test, feature(test))]
#![cfg_attr(test, plugin(quickcheck_macros))]
#![deny(missing_docs)]
#![deny(warnings)]
#![feature(core)]
#![feature(plugin)]
#![feature(simd)]
#[cfg(test)] extern crate test as stdtest;
#[cfg(test)] extern crate approx;
#[cfg(test)] e... |
/// Rounds up `n` to the nearest multiple of `k`
fn round_up(n: usize, k: usize) -> usize {
let r = n % k;
if r == 0 {
n
} else {
n + k - r
}
}
let align_of_b = mem::align_of::<B>();
let size_of_a = mem::size_of::<A>();
let size_of_b = ... | {
n - n % k
} | identifier_body |
lib.rs | //! [Experimental] Generic programming with SIMD
#![cfg_attr(test, feature(test))]
#![cfg_attr(test, plugin(quickcheck_macros))]
#![deny(missing_docs)]
#![deny(warnings)]
#![feature(core)]
#![feature(plugin)]
#![feature(simd)]
#[cfg(test)] extern crate test as stdtest;
#[cfg(test)] extern crate approx;
#[cfg(test)] e... | pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
#[allow(missing_docs, non_camel_case_types)]
#[derive(Clone, Copy, Debug)]
#[simd]
pub struct f64x2(pub f64, pub f64);
/// Sum the elements of a slice using SIMD ops
///
/// # Benchmarks
///
/// Size: 1 million elements
///
/// ``` ignore
/// test bench::f32::plai... | pub mod traits;
#[allow(missing_docs, non_camel_case_types)]
#[derive(Clone, Copy, Debug)]
#[simd] | random_line_split |
lib.rs | //! [Experimental] Generic programming with SIMD
#![cfg_attr(test, feature(test))]
#![cfg_attr(test, plugin(quickcheck_macros))]
#![deny(missing_docs)]
#![deny(warnings)]
#![feature(core)]
#![feature(plugin)]
#![feature(simd)]
#[cfg(test)] extern crate test as stdtest;
#[cfg(test)] extern crate approx;
#[cfg(test)] e... | <T>(slice: &[T]) -> T where
T: Simd,
{
use std::ops::Add;
use traits::Vector;
let (head, body, tail) = T::Vector::cast(slice);
let sum = body.iter().map(|&x| x).fold(T::Vector::zeroed(), Add::add).sum();
let sum = head.iter().map(|&x| x).fold(sum, Add::add);
tail.iter().map(|&x| x).fold(su... | sum | identifier_name |
lib.rs | //! [Experimental] Generic programming with SIMD
#![cfg_attr(test, feature(test))]
#![cfg_attr(test, plugin(quickcheck_macros))]
#![deny(missing_docs)]
#![deny(warnings)]
#![feature(core)]
#![feature(plugin)]
#![feature(simd)]
#[cfg(test)] extern crate test as stdtest;
#[cfg(test)] extern crate approx;
#[cfg(test)] e... | else {
let head_end = body_start;
let head_len = (head_end - head_start) / size_of_a;
let body_len = (body_end - body_start) / size_of_b;
let tail_start = body_end;
let tail_len = (tail_end - tail_start) / size_of_a;
let head = mem::transmute(raw::Slice { data: head_s... | {
(slice, &[], &[])
} | conditional_block |
setup.py | from setuptools import setup, find_packages
setup( | name='zeit.content.gallery',
version='2.9.2.dev0',
author='gocept, Zeit Online',
author_email='zon-backend@zeit.de',
url='http://www.zeit.de/',
description="vivi Content-Type Portraitbox",
packages=find_packages('src'),
package_dir={'': 'src'},
include_package_data=True,
zip_safe... | random_line_split | |
version.rs | use std::collections::HashMap;
use conduit::{Request, Response};
use conduit_router::RequestParams;
use diesel;
use diesel::pg::Pg;
use diesel::pg::upsert::*;
use diesel::prelude::*;
use semver;
use serde_json;
use time::{Duration, Timespec, now_utc, strptime};
use url;
use Crate;
use app::RequestApp;
use db::Request... | .select((dependencies::all_columns, crates::name))
.order((dependencies::optional, crates::name))
.load(conn)
}
pub fn max<T>(versions: T) -> semver::Version
where
T: IntoIterator<Item = semver::Version>,
{
versions.into_iter().max().unwrap_or_else(||... | pub fn dependencies(&self, conn: &PgConnection) -> QueryResult<Vec<(Dependency, String)>> {
Dependency::belonging_to(self)
.inner_join(crates::table) | random_line_split |
version.rs | use std::collections::HashMap;
use conduit::{Request, Response};
use conduit_router::RequestParams;
use diesel;
use diesel::pg::Pg;
use diesel::pg::upsert::*;
use diesel::prelude::*;
use semver;
use serde_json;
use time::{Duration, Timespec, now_utc, strptime};
use url;
use Crate;
use app::RequestApp;
use db::Request... | ;
let conn = req.db_conn()?;
let krate = Crate::by_name(crate_name).first::<Crate>(&*conn)?;
let version = Version::belonging_to(&krate)
.filter(versions::num.eq(semver))
.first(&*conn)
.map_err(|_| {
human(&format_args!(
"crate `{}` does not have a versio... | {
return Err(human(&format_args!("invalid semver: {}", semver)));
} | conditional_block |
version.rs | use std::collections::HashMap;
use conduit::{Request, Response};
use conduit_router::RequestParams;
use diesel;
use diesel::pg::Pg;
use diesel::pg::upsert::*;
use diesel::prelude::*;
use semver;
use serde_json;
use time::{Duration, Timespec, now_utc, strptime};
use url;
use Crate;
use app::RequestApp;
use db::Request... | (req: &mut Request) -> CargoResult<Response> {
let (version, krate) = match req.params().find("crate_id") {
Some(..) => version_and_crate(req)?,
None => {
let id = &req.params()["version_id"];
let id = id.parse().unwrap_or(0);
let conn = req.db_conn()?;
... | show | identifier_name |
version.rs | use std::collections::HashMap;
use conduit::{Request, Response};
use conduit_router::RequestParams;
use diesel;
use diesel::pg::Pg;
use diesel::pg::upsert::*;
use diesel::prelude::*;
use semver;
use serde_json;
use time::{Duration, Timespec, now_utc, strptime};
use url;
use Crate;
use app::RequestApp;
use db::Request... |
}
/// Handles the `GET /versions` route.
// FIXME: where/how is this used?
pub fn index(req: &mut Request) -> CargoResult<Response> {
use diesel::expression::dsl::any;
let conn = req.db_conn()?;
// Extract all ids requested.
let query = url::form_urlencoded::parse(req.query_string().unwrap_or("").as_... | {
let features = row.6
.map(|s| serde_json::from_str(&s).unwrap())
.unwrap_or_else(HashMap::new);
Version {
id: row.0,
crate_id: row.1,
num: semver::Version::parse(&row.2).unwrap(),
updated_at: row.3,
created_at: row.4,
... | identifier_body |
calc_itc_ali.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 30 20:51:31 2017
@author: mje
"""
import numpy as np
import mne
import matplotlib.pyplot as plt
from mne.stats import permutation_cluster_test
from my_settings import (subjects_select, tf_folder, epochs_folder)
d_ali_ent_right = []
for subject i... |
hf = plt.plot(times, T_obs, 'g')
plt.legend((h, ), ('cluster p-value < 0.05', ))
plt.xlabel("time (ms)")
plt.ylabel("f-values")
plt.show()
| plt.axvspan(
times[c.start],
times[c.stop - 1],
color=(0.3, 0.3, 0.3),
alpha=0.3) | conditional_block |
calc_itc_ali.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 30 20:51:31 2017
@author: mje
"""
import numpy as np
import mne
import matplotlib.pyplot as plt
from mne.stats import permutation_cluster_test
from my_settings import (subjects_select, tf_folder, epochs_folder)
d_ali_ent_right = []
for subject i... |
d_right_ent = (
data_left_ent[right_idx, :, :] - data_right_ent[right_idx, :, :])
d_left_ent = (
data_left_ent[left_idx, :, :] - data_right_ent[left_idx, :, :])
d_right_ctl = (
data_left_ctl[right_idx, :, :] - data_right_ctl[right_idx, :, :])
d_left_ctl = (
data_left_ct... | eog=False,
stim=False,
exclude=[],
selection=selection) | random_line_split |
netc.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 ... | {
pub sin_family: sa_family_t,
pub sin_port: in_port_t,
pub sin_addr: in_addr,
pub sin_zero: [u8; 8],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct sockaddr_in6 {
pub sin6_family: sa_family_t,
pub sin6_port: in_port_t,
pub sin6_flowinfo: u32,
pub sin6_addr: in6_addr,
pub sin6_scop... | sockaddr_in | identifier_name |
netc.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 ... | pub s_addr: in_addr_t,
}
#[derive(Copy, Clone)]
#[repr(align(4))]
#[repr(C)]
pub struct in6_addr {
pub s6_addr: [u8; 16],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct sockaddr {
pub sa_family: sa_family_t,
pub sa_data: [u8; 14],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct sockaddr_in {
pub s... | #[derive(Copy, Clone)]
#[repr(C)]
pub struct in_addr { | random_line_split |
psar.rs | use std::f64::NAN;
use error::Err;
/// Parabolic SAR
/// iaf : increment acceleration factor / starting acceleration. Usually 0.02
/// maxaf : max acceleration factor. Usually 0.2
/// Hypothesis : assuming long for initial conditions
/// Formula :
pub fn | (high: &[f64], low: &[f64], iaf: f64, maxaf: f64) -> Result<Vec<f64>, Err> {
let mut psar = vec![NAN; high.len()];
if high.len() < 2 {
return Err(Err::NotEnoughtData);
};
let mut long = false;
if high[0] + low[0] <= high[1] + low[1] {
long = true;
}
let mut sar;
let mu... | psar | identifier_name |
psar.rs | use std::f64::NAN;
use error::Err;
/// Parabolic SAR
/// iaf : increment acceleration factor / starting acceleration. Usually 0.02
/// maxaf : max acceleration factor. Usually 0.2
/// Hypothesis : assuming long for initial conditions
/// Formula :
pub fn psar(high: &[f64], low: &[f64], iaf: f64, maxaf: f64) -> Result... | {
let mut psar = vec![NAN; high.len()];
if high.len() < 2 {
return Err(Err::NotEnoughtData);
};
let mut long = false;
if high[0] + low[0] <= high[1] + low[1] {
long = true;
}
let mut sar;
let mut extreme;
if long {
extreme = high[0];
sar = low[0];
... | identifier_body | |
psar.rs | use std::f64::NAN;
use error::Err;
/// Parabolic SAR
/// iaf : increment acceleration factor / starting acceleration. Usually 0.02
/// maxaf : max acceleration factor. Usually 0.2
/// Hypothesis : assuming long for initial conditions
/// Formula :
pub fn psar(high: &[f64], low: &[f64], iaf: f64, maxaf: f64) -> Result... |
psar[i] = sar;
}
Ok(psar)
}
| {
af = iaf;
sar = extreme;
long = !long;
if !long {
extreme = low[i];
} else {
extreme = high[i];
}
} | conditional_block |
psar.rs | use std::f64::NAN;
use error::Err;
/// Parabolic SAR
/// iaf : increment acceleration factor / starting acceleration. Usually 0.02
/// maxaf : max acceleration factor. Usually 0.2
/// Hypothesis : assuming long for initial conditions
/// Formula :
pub fn psar(high: &[f64], low: &[f64], iaf: f64, maxaf: f64) -> Result... | extreme = high[i];
}
} else {
if i >= 2 && sar < high[i - 2] {
sar = high[i - 2]
};
if sar < high[i - 1] {
sar = high[i - 1]
};
if af < maxaf && low[i] < extreme {
af += iaf;
... | random_line_split | |
StatisticsBenchmarkSuite.ts | import { BenchmarkSuite } from 'pip-benchmark-node';
import { Parameter } from 'pip-benchmark-node';
import { IncrementMongoDbStatisticsBenchmark } from './IncrementMongoDbStatisticsBenchmark';
export class StatisticsBenchmarkSuite extends BenchmarkSuite {
public constructor() {
super("Statistics", "Stat... | }
} |
this.addBenchmark(new IncrementMongoDbStatisticsBenchmark()); | random_line_split |
StatisticsBenchmarkSuite.ts | import { BenchmarkSuite } from 'pip-benchmark-node';
import { Parameter } from 'pip-benchmark-node';
import { IncrementMongoDbStatisticsBenchmark } from './IncrementMongoDbStatisticsBenchmark';
export class | extends BenchmarkSuite {
public constructor() {
super("Statistics", "Statistics benchmark");
this.addParameter(new Parameter('InitialRecordNumber', 'Number of records at start', '0'));
this.addParameter(new Parameter('CounterNumber', 'Number of counters', '10'));
this.addParameter... | StatisticsBenchmarkSuite | identifier_name |
pl-help.component.ts | import {Component, Input, OnInit} from '@angular/core';
import {Account} from "@model/Account";
import {Gift, GiftStatus} from "@model/Gift";
@Component({
selector: 'pl-help',
templateUrl: './pl-help.component.html',
styleUrls: ['../help.component.css']
})
export class PlHelpComponent implements OnInit {
frag... |
ngOnInit() {
this.createGifts();
}
private createGifts() {
this.gift = {
id: -1,
name: 'Kolejka elektryczna',
category: {name: 'Zabawki'},
description: 'Najlepiej drewniania, ew metalowa',
hidden: true,
hasImage: true,
links: ['#'],
createdBy: this.user.i... | {
} | identifier_body |
pl-help.component.ts | import {Component, Input, OnInit} from '@angular/core';
import {Account} from "@model/Account";
import {Gift, GiftStatus} from "@model/Gift";
@Component({
selector: 'pl-help',
templateUrl: './pl-help.component.html',
styleUrls: ['../help.component.css']
})
export class | implements OnInit {
fragment: string;
@Input() isAdmin: boolean;
@Input() user: Account;
@Input() admins: Account[];
gift: Gift;
gift_claimed: Gift;
gift_realized: Gift;
constructor() {
}
ngOnInit() {
this.createGifts();
}
private createGifts() {
this.gift = {
id: -1,
nam... | PlHelpComponent | identifier_name |
pl-help.component.ts | import {Component, Input, OnInit} from '@angular/core';
import {Account} from "@model/Account";
import {Gift, GiftStatus} from "@model/Gift";
@Component({
selector: 'pl-help',
templateUrl: './pl-help.component.html',
styleUrls: ['../help.component.css']
})
export class PlHelpComponent implements OnInit {
frag... | {
name: 'google',
icon: 'fa-google',
id: 1,
searchString: '#'
}
],
created: new Date()
}
}
menuClick(event: Event) {
event.stopPropagation();
}
} | realised: new Date(),
description: 'Zdalnie sterowany, koniecznie czerwony',
links: ['#'],
engines: [ | random_line_split |
angle.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/. */
//! Specified angles.
use cssparser::{Parser, Token};
use parser::{ParserContext, Parse};
#[allow(unused_imports)... | (self) -> f32 {
use std::f32::consts::PI;
self.radians() * 360. / (2. * PI)
}
/// Returns `0deg`.
pub fn zero() -> Self {
Self::from_degrees(0.0, false)
}
/// Returns an `Angle` parsed from a `calc()` expression.
pub fn from_calc(radians: CSSFloat) -> Self {
Ang... | degrees | identifier_name |
angle.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/. */
//! Specified angles.
use cssparser::{Parser, Token};
use parser::{ParserContext, Parse};
#[allow(unused_imports)... |
fn from_computed_value(computed: &Self::ComputedValue) -> Self {
Angle {
value: *computed,
was_calc: false,
}
}
}
impl Angle {
/// Creates an angle with the given value in degrees.
pub fn from_degrees(value: CSSFloat, was_calc: bool) -> Self {
Angle { v... | {
self.value
} | identifier_body |
angle.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/. */
//! Specified angles.
use cssparser::{Parser, Token};
use parser::{ParserContext, Parse};
#[allow(unused_imports)... | Angle { value: ComputedAngle::Rad(value), was_calc }
}
/// Returns the amount of radians this angle represents.
#[inline]
pub fn radians(self) -> f32 {
self.value.radians()
}
/// Returns the amount of degrees this angle represents.
#[inline]
pub fn degrees(self) -> f32 ... | random_line_split | |
analytics.js | function generate_analytics_alert() {
var result =
'<div class="alert alert-warning">' +
novaideo_translate("Aucune valeur n'est trouvée!") +
"</div>"
return result
}
function generate_analytics_study(values) {
var result =
'<div class="alert alert-info">' +
novaideo_translate(
"Ces gra... | {
return '<canvas id="' + id + '"></canvas>'
}
$(document).on("submit", ".analytics-form", function(event) {
var button = $(this).find("button").last()
var parent = $($(this).parents(".tab-pane").first())
var url = $(event.target).data("url")
$(button).addClass("disabled")
var values = $(this).serialize()... | new_canvas(id) | identifier_name |
analytics.js | function generate_analytics_alert() {
var result =
'<div class="alert alert-warning">' +
novaideo_translate("Aucune valeur n'est trouvée!") +
"</div>"
return result
}
function generate_analytics_study(values) {
var result =
'<div class="alert alert-info">' +
novaideo_translate(
"Ces gra... | e {
result += values[key] + " " + key
}
result += "</li>"
}
result += "</ul></div>"
return result
}
function get_new_canvas(id) {
return '<canvas id="' + id + '"></canvas>'
}
$(document).on("submit", ".analytics-form", function(event) {
var button = $(this).find("button").last()
var parent ... | result += values[key] + " " + key
} els | conditional_block |
analytics.js | function generate_analytics_alert() {
var result =
'<div class="alert alert-warning">' +
novaideo_translate("Aucune valeur n'est trouvée!") +
"</div>"
return result
}
function generate_analytics_study(values) { | nction get_new_canvas(id) {
return '<canvas id="' + id + '"></canvas>'
}
$(document).on("submit", ".analytics-form", function(event) {
var button = $(this).find("button").last()
var parent = $($(this).parents(".tab-pane").first())
var url = $(event.target).data("url")
$(button).addClass("disabled")
var val... |
var result =
'<div class="alert alert-info">' +
novaideo_translate(
"Ces graphiques sont produits à partir d'un échantillon présentant:"
) +
'<ul class="list-unstyled">'
for (key in values) {
result += "<li>"
if (values[key] > 1) {
result += values[key] + " " + key
} else {
... | identifier_body |
analytics.js | function generate_analytics_alert() {
var result =
'<div class="alert alert-warning">' +
novaideo_translate("Aucune valeur n'est trouvée!") +
"</div>"
return result
}
function generate_analytics_study(values) {
var result =
'<div class="alert alert-info">' + | novaideo_translate(
"Ces graphiques sont produits à partir d'un échantillon présentant:"
) +
'<ul class="list-unstyled">'
for (key in values) {
result += "<li>"
if (values[key] > 1) {
result += values[key] + " " + key
} else {
result += values[key] + " " + key
}
resul... | random_line_split | |
lasdiff.py | try:
import traceback
import argparse
import textwrap
import glob
import os
import logging
import datetime
import multiprocessing
from libs import LasPyConverter
except ImportError as err:
print('Error {0} import module: {1}'.format(__name__, err))
traceback.print_exc()
e... | (self):
return self.args.output
def get_input(self):
return self.args.input
def get_input_format(self):
return self.args.input_format
def get_verbose(self):
return self.args.verbose
def get_cores(self):
return self.args.cores
def DiffLas(parameters):
# P... | get_output | identifier_name |
lasdiff.py | try:
import traceback
import argparse
import textwrap
import glob
import os
import logging
import datetime
import multiprocessing
from libs import LasPyConverter
except ImportError as err:
print('Error {0} import module: {1}'.format(__name__, err))
traceback.print_exc()
e... |
for workfile in inputfiles:
if os.path.isfile(workfile) and os.path.isfile(os.path.join(outputpath, os.path.basename(workfile))):
logging.info('Adding %s to the queue.' % (workfile))
doing.append([workfile, os.path.join(outputpath, os.path.basename(workfile))])
... | os.makedirs(outputfiles) | conditional_block |
lasdiff.py | try:
import traceback
import argparse
import textwrap
import glob
import os
import logging
import datetime
import multiprocessing
from libs import LasPyConverter
except ImportError as err:
print('Error {0} import module: {1}'.format(__name__, err))
traceback.print_exc()
e... |
def get_cores(self):
return self.args.cores
def DiffLas(parameters):
# Parse incoming parameters
source_file = parameters[0]
destination_file = parameters[1]
# Get name for this process
current = multiprocessing.current_proces()
proc_name = current.name
logging.info('[%s] St... | return self.args.verbose | identifier_body |
lasdiff.py | try:
import traceback
import argparse
import textwrap
import glob
import os
import logging
import datetime
import multiprocessing
from libs import LasPyConverter
except ImportError as err:
print('Error {0} import module: {1}'.format(__name__, err))
traceback.print_exc()
e... | else:
self.args.verbose = ''
if self.args.input_format == None:
self.args.input_format = 'las'
if self.args.cores == None:
self.args.cores = 1
# ---------PUBLIC METHODS--------------------
def get_output(self):
return self.args.output
def... | ##defaults
if self.args.verbose:
self.args.verbose = ' -v' | random_line_split |
helper.rs | use std::time::Duration;
use xpath_reader::Reader;
/// Note that the requirement of the `var` (variant) token is rather ugly but
/// required,
/// which is a limitation of the current Rust macro implementation.
///
/// Note that the macro wont expand if you miss ommit the last comma.
/// If this macro is ever extracte... | <'d>(
reader: &'d Reader<'d>,
path: &str,
) -> Result<Option<Duration>, ::xpath_reader::Error> {
let s: Option<String> = reader.read(path)?;
match s {
Some(millis) => Ok(Some(Duration::from_millis(
millis.parse().map_err(::xpath_reader::Error::custom_err)?,
))),
None ... | read_mb_duration | identifier_name |
helper.rs | use std::time::Duration;
use xpath_reader::Reader;
/// Note that the requirement of the `var` (variant) token is rather ugly but
/// required,
/// which is a limitation of the current Rust macro implementation.
///
/// Note that the macro wont expand if you miss ommit the last comma.
/// If this macro is ever extracte... | }
impl ::std::fmt::Display for $enum {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result
{
let s = match *self {
$(
$enum::$variant => $str,
)+
};
wri... | )
)
}
} | random_line_split |
helper.rs | use std::time::Duration;
use xpath_reader::Reader;
/// Note that the requirement of the `var` (variant) token is rather ugly but
/// required,
/// which is a limitation of the current Rust macro implementation.
///
/// Note that the macro wont expand if you miss ommit the last comma.
/// If this macro is ever extracte... | {
let s: Option<String> = reader.read(path)?;
match s {
Some(millis) => Ok(Some(Duration::from_millis(
millis.parse().map_err(::xpath_reader::Error::custom_err)?,
))),
None => Ok(None),
}
} | identifier_body | |
all_61.js | var searchData=
[
['argumentdefinition',['argumentDefinition',['../ezpgenerateautoloads_8php.html#ab9a0a1710f335bc48a13e8a94802be23',1,'argumentDefinition(): ezpgenerateautoloads.php'],['../ezpgenerateautoloads_8php.html#aed0ba19f5204d9659e823271642a6594',1,'argumentDefinition(): ezpgenerateautoloads.php']]... | ['autoloadgeneratorenum',['autoloadGeneratorEnum',['../classextension_1_1ezadvancedautoload_1_1classes_1_1enums_1_1autoload_generator_enum.html',1,'extension::ezadvancedautoload::classes::enums']]],
['autoloadgeneratorenum_2ephp',['autoloadgeneratorenum.php',['../autoloadgeneratorenum_8php.html',1,'']]]
]; | random_line_split | |
course-format.ts | // (C) Copyright 2015 Moodle Pty Ltd.
//
// 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 agree... | * @param refresher Refresher.
* @param done Function to call when done.
* @param afterCompletionChange Whether the refresh is due to a completion change.
* @return Promise resolved when done.
*/
doRefresh(refresher?: any, done?: () => void, afterCompletionChange?: boolean): Promise<any> {
... | * Refresh the data.
* | random_line_split |
course-format.ts | // (C) Copyright 2015 Moodle Pty Ltd.
//
// 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 agree... |
}
/**
* Refresh the data.
*
* @param refresher Refresher.
* @param done Function to call when done.
* @param afterCompletionChange Whether the refresh is due to a completion change.
* @return Promise resolved when done.
*/
doRefresh(refresher?: any, done?: () => void, af... | {
if (!this.component) {
// Initialize the data.
const handlerName = this.courseFormatDelegate.getHandlerName(this.course.format),
handler = this.sitePluginsProvider.getSitePluginHandler(handlerName);
if (handler) {
thi... | conditional_block |
course-format.ts | // (C) Copyright 2015 Moodle Pty Ltd.
//
// 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 agree... | (protected sitePluginsProvider: CoreSitePluginsProvider,
protected courseFormatDelegate: CoreCourseFormatDelegate) { }
/**
* Detect changes on input properties.
*/
ngOnChanges(): void {
if (this.course && this.course.format) {
if (!this.component) {
// ... | constructor | identifier_name |
checklist-nested-tree-demo.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {ChangeDetectorRef, ChangeDetectionStrategy, Component} from '@angular/core';
import {SelectionModel} from '@an... |
getChildren = (node: TodoItemNode): Observable<TodoItemNode[]> => node.children;
hasNoContent = (_nodeData: TodoItemNode) => { return _nodeData.item === ''; };
/** Whether all the descendants of the node are selected */
descendantsAllSelected(node: TodoItemNode): boolean {
const descendants = this.treeC... | {
this.treeControl = new NestedTreeControl<TodoItemNode>(this.getChildren);
this.dataSource = _database.data;
} | identifier_body |
checklist-nested-tree-demo.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {ChangeDetectorRef, ChangeDetectionStrategy, Component} from '@angular/core';
import {SelectionModel} from '@an... | (private _database: ChecklistDatabase, private _changeDetectorRef: ChangeDetectorRef) {
this.treeControl = new NestedTreeControl<TodoItemNode>(this.getChildren);
this.dataSource = _database.data;
}
getChildren = (node: TodoItemNode): Observable<TodoItemNode[]> => node.children;
hasNoContent = (_nodeData... | constructor | identifier_name |
checklist-nested-tree-demo.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {ChangeDetectorRef, ChangeDetectionStrategy, Component} from '@angular/core';
import {SelectionModel} from '@an... | /** Whether part of the descendants are selected */
descendantsPartiallySelected(node: TodoItemNode): boolean {
const descendants = this.treeControl.getDescendants(node);
if (!descendants.length) {
return false;
}
const result = descendants.some(child => this.checklistSelection.isSelected(chil... | random_line_split | |
checklist-nested-tree-demo.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {ChangeDetectorRef, ChangeDetectionStrategy, Component} from '@angular/core';
import {SelectionModel} from '@an... |
const result = descendants.some(child => this.checklistSelection.isSelected(child));
return result && !this.descendantsAllSelected(node);
}
/** Toggle the to-do item selection. Select/deselect all the descendants node */
todoItemSelectionToggle(node: TodoItemNode): void {
this.checklistSelection.tog... | {
return false;
} | conditional_block |
geonetwork.py | #########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#... | super(CatalogueBackend, self).__init__(*args, **kwargs)
self.catalogue.formats = ['Dublin Core', 'ISO'] | identifier_body | |
geonetwork.py | #########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by | # 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.
#
# You should have received a copy of the GNU General Public License
# along w... | # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# | random_line_split |
geonetwork.py | #########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#... | (self, *args, **kwargs):
super(CatalogueBackend, self).__init__(*args, **kwargs)
self.catalogue.formats = ['Dublin Core', 'ISO']
| __init__ | identifier_name |
biotestflavor.py | from fabric.api import *
from fabric.contrib.files import *
from cloudbio.flavor import Flavor
from cloudbio.custom.shared import (_fetch_and_unpack)
| """
def __init__(self, env):
Flavor.__init__(self,env)
self.name = "Bio* cross-lang flavor"
def rewrite_config_items(self, name, items):
if name == "packages":
# list.remove('screen')
# list.append('test')
return items
elif name == "python... | class BioTestFlavor(Flavor):
"""A Flavor for cross Bio* tests | random_line_split |
biotestflavor.py | from fabric.api import *
from fabric.contrib.files import *
from cloudbio.flavor import Flavor
from cloudbio.custom.shared import (_fetch_and_unpack)
class BioTestFlavor(Flavor):
"""A Flavor for cross Bio* tests
"""
def __init__(self, env):
Flavor.__init__(self,env)
self.name = "Bio* cros... |
# Special installs for the tests
with cd('Cross-language-interfacing'):
sudo('./scripts/install-packages-root.sh ')
run('./scripts/install-packages.sh')
run('./scripts/create_test_files.rb')
env.flavor = BioTestFlavor(env)
| _fetch_and_unpack("git clone git://github.com/pjotrp/Cross-language-interfacing.git") | conditional_block |
biotestflavor.py | from fabric.api import *
from fabric.contrib.files import *
from cloudbio.flavor import Flavor
from cloudbio.custom.shared import (_fetch_and_unpack)
class BioTestFlavor(Flavor):
"""A Flavor for cross Bio* tests
"""
def __init__(self, env):
Flavor.__init__(self,env)
self.name = "Bio* cros... |
env.flavor = BioTestFlavor(env)
| env.logger.info("Starting post-install")
env.logger.info("Load Scalability tests")
if exists('Scalability'):
with cd('Scalability'):
run('git pull')
else:
_fetch_and_unpack("git clone git://github.com/pjotrp/Scalability.git")
# Now run a post install... | identifier_body |
biotestflavor.py | from fabric.api import *
from fabric.contrib.files import *
from cloudbio.flavor import Flavor
from cloudbio.custom.shared import (_fetch_and_unpack)
class BioTestFlavor(Flavor):
"""A Flavor for cross Bio* tests
"""
def __init__(self, env):
Flavor.__init__(self,env)
self.name = "Bio* cros... | (self):
env.logger.info("Starting post-install")
env.logger.info("Load Scalability tests")
if exists('Scalability'):
with cd('Scalability'):
run('git pull')
else:
_fetch_and_unpack("git clone git://github.com/pjotrp/Scalability.git")
# Now ru... | post_install | identifier_name |
core.py | """
Core classes for the XBlock family.
This code is in the Runtime layer, because it is authored once by edX
and used by all runtimes.
"""
import inspect
import pkg_resources
import warnings
from collections import defaultdict
from xblock.exceptions import DisallowedFileError
from xblock.fields import String, List,... |
def __init__(self, runtime, field_data=None, scope_ids=UNSET, *args, **kwargs):
"""
Construct a new XBlock.
This class should only be instantiated by runtimes.
Arguments:
runtime (:class:`.Runtime`): Use it to access the environment.
It is available i... | """
Produce a sequence of all XBlock classes tagged with `tag`.
fail_silently causes the code to simply log warnings if a
plugin cannot import. The goal is to be able to use part of
libraries from an XBlock (and thus have it installed), even if
the overall XBlock cannot be used ... | identifier_body |
core.py | """
Core classes for the XBlock family.
This code is in the Runtime layer, because it is authored once by edX
and used by all runtimes.
"""
import inspect
import pkg_resources
import warnings
from collections import defaultdict
from xblock.exceptions import DisallowedFileError
from xblock.fields import String, List,... | contexts. Hence, the flag.
"""
# Allow this method to access the `_class_tags`
# pylint: disable=W0212
for name, class_ in cls.load_classes(fail_silently):
if tag in class_._class_tags:
yield name, class_
def __init__(self, runtime, field_data=Non... | (e.g. on startup or first page load), and in what | random_line_split |
core.py | """
Core classes for the XBlock family.
This code is in the Runtime layer, because it is authored once by edX
and used by all runtimes.
"""
import inspect
import pkg_resources
import warnings
from collections import defaultdict
from xblock.exceptions import DisallowedFileError
from xblock.fields import String, List,... | (XmlSerializationMixin, HierarchyMixin, ScopedStorageMixin, RuntimeServicesMixin, HandlersMixin,
IndexInfoMixin, ViewsMixin, SharedBlockBase):
"""Base class for XBlocks.
Derive from this class to create a new kind of XBlock. There are no
required methods, but you will probably need at least o... | XBlock | identifier_name |
core.py | """
Core classes for the XBlock family.
This code is in the Runtime layer, because it is authored once by edX
and used by all runtimes.
"""
import inspect
import pkg_resources
import warnings
from collections import defaultdict
from xblock.exceptions import DisallowedFileError
from xblock.fields import String, List,... |
# Provide backwards compatibility for external access through _field_data
super(XBlock, self).__init__(runtime=runtime, scope_ids=scope_ids, field_data=field_data, *args, **kwargs)
def render(self, view, context=None):
"""Render `view` with this block's runtime and the supplied `context`"... | raise TypeError('scope_ids are required') | conditional_block |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.