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 |
|---|---|---|---|---|
matgen.go | -i], 1, 0, work[n:2*n-i], 1)
// Compute v := y - 1/2 * tau * ( y, u ) * u.
alpha := -0.5 * tau * bi.Ddot(n-i, work[n:2*n-i], 1, work[:n-i], 1)
bi.Daxpy(n-i, alpha, work[:n-i], 1, work[n:2*n-i], 1)
// Apply the transformation as a rank-2 update to A[i:n,i:n].
bi.Dsyr2(blas.Lower, n-i, -1, work[:n-i], 1, work... | }
if i < n-1 {
for j := 0; j < n-i; j++ {
work[j] = rnd.NormFloat64()
}
wn := bi.Dnrm2(n-i, work[:n-i], 1)
wa := math.Copysign(wn, work[0])
var tau float64
if wn != 0 {
wb := work[0] + wa
bi.Dscal(n-i-1, 1/wb, work[1:n-i], 1)
work[0] = 1
tau = wb / wa
}
// Multiply A[i:m... | -tau, work[:m-i], 1, work[m:m+n-i], 1,
a[i*lda+i:], lda) | random_line_split |
matgen.go | ], 1, 0, work[n:2*n-i], 1)
// Compute v := y - 1/2 * tau * ( y, u ) * u.
alpha := -0.5 * tau * bi.Ddot(n-i, work[n:2*n-i], 1, work[:n-i], 1)
bi.Daxpy(n-i, alpha, work[:n-i], 1, work[n:2*n-i], 1)
// Apply the transformation as a rank-2 update to A[i:n,i:n].
bi.Dsyr2(blas.Lower, n-i, -1, work[:n-i], 1, work[n... | dlattr generates an n×n triangular test matrix A with its properties uniquely
// determined by imat and uplo, and returns whether A has unit diagonal. If diag
// is blas.Unit, the diagonal elements are set so that A[k,k]=k.
//
// trans specifies whether the matrix A or its transpose will be used.
//
// If imat is great... | itch dist {
default:
panic("testlapack: invalid dist")
case 1:
for i := range dst {
dst[i] = rnd.Float64()
}
case 2:
for i := range dst {
dst[i] = 2*rnd.Float64() - 1
}
case 3:
for i := range dst {
dst[i] = rnd.NormFloat64()
}
}
}
// | identifier_body |
page.rs | PartialEq, Debug)]
pub struct Dir {
title: String,
base_path: String,
read_only: bool,
files: Vec<EntryProps>,
folders: Vec<EntryProps>,
}
#[derive(Debug)]
pub enum PageMsg {
Page(Dir),
File,
Error(Error),
Modal(String),
ModalNext,
ModalPrevious,
}
#[derive(Properties, Clo... | (&mut self, msg: Self::Message) -> ShouldRender {
match msg {
PageMsg::Page(page) => {
self.props.page = Some(page);
self.error = None;
self.show_loading = false;
true
}
// TODO: This means non-media (non-modal d... | update | identifier_name |
page.rs | PartialEq, Debug)]
pub struct Dir {
title: String,
base_path: String,
read_only: bool,
files: Vec<EntryProps>,
folders: Vec<EntryProps>,
}
#[derive(Debug)]
pub enum PageMsg {
Page(Dir),
File,
Error(Error),
Modal(String),
ModalNext,
ModalPrevious,
}
#[derive(Properties, Clo... | } else {
html! {}
};
let error = if self.error.is_some() {
html! {<h2 class="text-danger">{ "Error: " }{ self.error.as_ref().unwrap() }</h2>}
} else {
html! {}
};
html! {
<>
<Modal src={ self.modal.src.to_o... | });
let loading = if self.show_loading {
html! {<span class="loading"></span>} | random_line_split |
page.rs | PartialEq, Debug)]
pub struct Dir {
title: String,
base_path: String,
read_only: bool,
files: Vec<EntryProps>,
folders: Vec<EntryProps>,
}
#[derive(Debug)]
pub enum PageMsg {
Page(Dir),
File,
Error(Error),
Modal(String),
ModalNext,
ModalPrevious,
}
#[derive(Properties, Clo... |
PageMsg::ModalNext => {
let src = format!("/{}", self.next_file());
App::change_route(src);
true
}
PageMsg::ModalPrevious => {
let src = format!("/{}", self.prev_file());
App::change_route(src);
... | {
ConsoleService::info(format!("Loading modal for: {:?}", src).as_str());
self.modal.src = src.to_string();
self.modal.media = MediaType::from_path(src.as_str());
self.show_loading = false;
true
} | conditional_block |
lib.rs | , Clone, Serialize)]
#[serde(crate = "near_sdk::serde")]
pub struct UserInfo {
pub name: String,
pub dob: String,
pub national_id: String,
pub from: Issuer,
pub owner: ValidAccountId
}
#[derive(BorshDeserialize, BorshSerialize, Clone, Serialize)]
#[serde(crate = "near_sdk::serde")]
pub struct Tok... |
}
const DATA_IMAGE_SVG_NEAR_ICON: &str = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 288 288'%3E%3Cg id='l' data-name='l'%3E%3Cpath d='M187.58,79.81l-30.1,44.69a3.2,3.2,0,0,0,4.75,4.2L191.86,103a1.2,1.2,0,0,1,2,.91v80.46a1.2,1.2,0,0,1-2.12.77L102.18,77.93A15.35,15.35,0,0,0,90.47,72.5H87... | {
env::panic(b"SmartCertificate contract should be initialized before usage")
} | identifier_body |
lib.rs | , Clone, Serialize)]
#[serde(crate = "near_sdk::serde")]
pub struct UserInfo {
pub name: String,
pub dob: String,
pub national_id: String,
pub from: Issuer,
pub owner: ValidAccountId
}
#[derive(BorshDeserialize, BorshSerialize, Clone, Serialize)]
#[serde(crate = "near_sdk::serde")]
pub struct Tok... |
return false;
}
pub fn create_cert(&mut self, user_account_id: ValidAccountId, name: String, dob: String, national_id: String) {
self.assert_called_by_issuers();
let issuer = self.issuers.get(&env::predecessor_account_id()).clone().unwrap();
let user = UserInfo {
n... | {
let new_issuer = Issuer {
name: name,
issuer_id: issuer_account.clone(),
};
self.issuers.insert(&issuer_account, &new_issuer);
return true;
} | conditional_block |
lib.rs | , Clone, Serialize)]
#[serde(crate = "near_sdk::serde")]
pub struct UserInfo {
pub name: String,
pub dob: String,
pub national_id: String,
pub from: Issuer,
pub owner: ValidAccountId
}
#[derive(BorshDeserialize, BorshSerialize, Clone, Serialize)]
#[serde(crate = "near_sdk::serde")]
pub struct Tok... | assert!(
env::is_valid_account_id(issuer_account.as_bytes()),
"The given account ID is invalid"
);
self.assert_called_by_foundation();
if !self.issuers.get(&issuer_account).is_some() {
let new_issuer = Issuer {
name: name,
... | pub fn add_issuer(&mut self, issuer_account: AccountId, name: String) -> bool { | random_line_split |
lib.rs | , Clone, Serialize)]
#[serde(crate = "near_sdk::serde")]
pub struct UserInfo {
pub name: String,
pub dob: String,
pub national_id: String,
pub from: Issuer,
pub owner: ValidAccountId
}
#[derive(BorshDeserialize, BorshSerialize, Clone, Serialize)]
#[serde(crate = "near_sdk::serde")]
pub struct Tok... | (&mut self, issuer_account: AccountId, name: String) -> bool {
assert!(
env::is_valid_account_id(issuer_account.as_bytes()),
"The given account ID is invalid"
);
self.assert_called_by_foundation();
if !self.issuers.get(&issuer_account).is_some() {
le... | add_issuer | identifier_name |
label_leaves_in_expr_with_numbered_intervals.py | # -*- encoding: utf-8 -*-
from abjad.tools import scoretools
from abjad.tools import scoretools
from abjad.tools import markuptools
from abjad.tools import scoretools
from abjad.tools import pitchtools
from abjad.tools.topleveltools import attach
from abjad.tools.topleveltools import iterate
def label_leaves_in_expr_... | b,8 ^ \markup { +22 }
a'8 ^ \markup { +1 }
bf'8 ^ \markup { -4 }
fs'8 ^ \markup { -1 }
f'8
}
::
>>> show(staff) # doctest: +SKIP
Returns none.
"""
for note in iterate(expr).by_class(scoretools.Note):
logical_voice_it... | r"""Label leaves in `expr` with numbered intervals:
::
>>> notes = scoretools.make_notes(
... [0, 25, 11, -4, -14, -13, 9, 10, 6, 5],
... [Duration(1, 8)],
... )
>>> staff = Staff(notes)
>>> labeltools.label_leaves_in_expr_with_numbered_intervals(staff)
... | identifier_body |
label_leaves_in_expr_with_numbered_intervals.py | # -*- encoding: utf-8 -*-
from abjad.tools import scoretools
from abjad.tools import scoretools
from abjad.tools import markuptools
from abjad.tools import scoretools
from abjad.tools import pitchtools
from abjad.tools.topleveltools import attach
from abjad.tools.topleveltools import iterate
def label_leaves_in_expr_... |
except StopIteration:
pass
| mci = pitchtools.NumberedInterval.from_pitch_carriers(
note, next_leaf)
markup = markuptools.Markup(mci, markup_direction)
attach(markup, note) | conditional_block |
label_leaves_in_expr_with_numbered_intervals.py | # -*- encoding: utf-8 -*-
from abjad.tools import scoretools
from abjad.tools import scoretools
from abjad.tools import markuptools
from abjad.tools import scoretools
from abjad.tools import pitchtools
from abjad.tools.topleveltools import attach
from abjad.tools.topleveltools import iterate
def | (expr, markup_direction=Up):
r"""Label leaves in `expr` with numbered intervals:
::
>>> notes = scoretools.make_notes(
... [0, 25, 11, -4, -14, -13, 9, 10, 6, 5],
... [Duration(1, 8)],
... )
>>> staff = Staff(notes)
>>> labeltools.label_leaves_in_exp... | label_leaves_in_expr_with_numbered_intervals | identifier_name |
label_leaves_in_expr_with_numbered_intervals.py | # -*- encoding: utf-8 -*-
from abjad.tools import scoretools
from abjad.tools import scoretools
from abjad.tools import markuptools
from abjad.tools import scoretools
from abjad.tools import pitchtools
from abjad.tools.topleveltools import attach |
def label_leaves_in_expr_with_numbered_intervals(expr, markup_direction=Up):
r"""Label leaves in `expr` with numbered intervals:
::
>>> notes = scoretools.make_notes(
... [0, 25, 11, -4, -14, -13, 9, 10, 6, 5],
... [Duration(1, 8)],
... )
>>> staff = Staff(... | from abjad.tools.topleveltools import iterate
| random_line_split |
in-memory-data.service.ts | import {InMemoryDbService} from "angular-in-memory-web-api";
export class InMemoryDataService implements InMemoryDbService {
createDb() {
let heroes = [
{ id: 11, name: 'Mr. Nice' },
{ id: 12, name: 'Narco' },
{ id: 13, name: 'Bombasto' },
{ id: 14, name: 'Celeritas' },
{ id: 15, ... | ];
return {heroes};
}
} | { id: 19, name: 'Magma' },
{ id: 20, name: 'Tornado' } | random_line_split |
in-memory-data.service.ts | import {InMemoryDbService} from "angular-in-memory-web-api";
export class InMemoryDataService implements InMemoryDbService {
createDb() |
}
| {
let heroes = [
{ id: 11, name: 'Mr. Nice' },
{ id: 12, name: 'Narco' },
{ id: 13, name: 'Bombasto' },
{ id: 14, name: 'Celeritas' },
{ id: 15, name: 'Magneta' },
{ id: 16, name: 'RubberMan' },
{ id: 17, name: 'Dynama' },
{ id: 18, name: 'Dr IQ' },
{ id: 19, n... | identifier_body |
in-memory-data.service.ts | import {InMemoryDbService} from "angular-in-memory-web-api";
export class InMemoryDataService implements InMemoryDbService {
| () {
let heroes = [
{ id: 11, name: 'Mr. Nice' },
{ id: 12, name: 'Narco' },
{ id: 13, name: 'Bombasto' },
{ id: 14, name: 'Celeritas' },
{ id: 15, name: 'Magneta' },
{ id: 16, name: 'RubberMan' },
{ id: 17, name: 'Dynama' },
{ id: 18, name: 'Dr IQ' },
{ id: 19... | createDb | identifier_name |
args.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 ... | (argc: isize, argv: *const *const u8) {
let args = (0..argc).map(|i| {
CStr::from_ptr(*argv.offset(i) as *const libc::c_char).to_bytes().to_vec()
}).collect();
LOCK.lock();
let ptr = get_global_ptr();
assert!((*ptr).is_none());
(*ptr) = Some(box args);
... | init | identifier_name |
args.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 ... | fn next_back(&mut self) -> Option<OsString> { self.iter.next_back() }
}
mod imp {
use os::unix::prelude::*;
use mem;
use ffi::{CStr, OsString};
use marker::PhantomData;
use libc;
use super::Args;
use sys_common::mutex::Mutex;
static mut GLOBAL_ARGS_PTR: usize = 0;
static LOCK:... | impl DoubleEndedIterator for Args { | random_line_split |
args.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 ... |
}
impl Iterator for Args {
type Item = OsString;
fn next(&mut self) -> Option<OsString> { self.iter.next() }
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
}
impl ExactSizeIterator for Args {
fn len(&self) -> usize { self.iter.len() }
}
impl DoubleEndedIterator for Args {
... | {
self.iter.as_slice()
} | identifier_body |
windows_1257.rs | 88,
189, 190, 0, 0, 0, 0, 0, 196, 197, 175, 0, 0, 201, 0, 0, 0, 0, 0, 0, 0, 0,
0, 211, 0, 213, 214, 215, 168, 0, 0, 0, 220, 0, 0, 223, 0, 0, 0, 0, 228,
229, 191, 0, 0, 233, 0, 0, 0, 0, 0, 0, 0, 0, 0, 243, 0, 245, 246, 247, 184,
0, 0, 0, 252, 0, 0, 0, 194, 226, 0, 0, 192, 224, 195, 227, 0, 0, 0, 0, 200,
... | {BACKWARD_TABLE_UPPER[offset] as uint} | conditional_block | |
windows_1257.rs | 2,
183, 248, 185, 343, 187, 188, 189, 190, 230, 260, 302, 256, 262, 196, 197,
280, 274, 268, 201, 377, 278, 290, 310, 298, 315, 352, 323, 325, 211, 332,
213, 214, 215, 370, 321, 346, 362, 220, 379, 381, 223, 261, 303, 257, 263,
228, 229, 281, 275, 269, 233, 378, 279, 291, 311, 299, 316, 353, 324, 326,
... |
static BACKWARD_TABLE_LOWER: &'static [u8] = &[
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 0, 131, 0, 0, 0, 0, 136,
0, 138, 0, 140, 0, 0, 0, 144,... | {
FORWARD_TABLE[(code - 0x80) as uint]
} | identifier_body |
windows_1257.rs | 179, 180, 181, 182, 183, 143, 185, 0, 187, 188,
189, 190, 0, 0, 0, 0, 0, 196, 197, 175, 0, 0, 201, 0, 0, 0, 0, 0, 0, 0, 0,
0, 211, 0, 213, 214, 215, 168, 0, 0, 0, 220, 0, 0, 223, 0, 0, 0, 0, 228,
229, 191, 0, 0, 233, 0, 0, 0, 0, 0, 0, 0, 0, 0, 243, 0, 245, 246, 247, 184,
0, 0, 0, 252, 0, 0, 0, 194, 226,... | backward | identifier_name | |
windows_1257.rs | 82,
183, 248, 185, 343, 187, 188, 189, 190, 230, 260, 302, 256, 262, 196, 197,
280, 274, 268, 201, 377, 278, 290, 310, 298, 315, 352, 323, 325, 211, 332,
213, 214, 215, 370, 321, 346, 362, 220, 379, 381, 223, 261, 303, 257, 263,
228, 229, 281, 275, 269, 233, 378, 279, 291, 311, 299, 316, 353, 324, 326,
... | 149, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 137, 0, 0, 0, 0, 0, 0, 0, 0,
139, 155, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 150, 151, 0, 0, 0, 145, 146, 130, 0, 147, 148, 132, 0, 134, 135, | random_line_split |
empathy.py | Empathy")
__kupfer_sources__ = ("ContactsSource", )
__kupfer_actions__ = ("ChangeStatus", 'OpenChat')
__description__ = _("Access to Empathy Contacts")
__version__ = "2010-10-17"
__author__ = "Jakh Daven <tuxcanfly@gmail.com>"
import dbus
import time
from kupfer import icons
from kupfer import plugin_support
from kup... | contacts = [c for c in contacts]
contact_attributes = connection.Get(CONTACT_IFACE, "ContactAttributeInterfaces")
contact_attributes = [str(a) for a in contact_attributes]
contact_details = connection.GetContactAttributes(contacts, contact_attributes, False)
for contact, details in contact... | show_offline = __kupfer_settings__["show_offline"]
bus = dbus.SessionBus()
for valid_account in interface.Get(ACCOUNTMANAGER_IFACE, "ValidAccounts"):
account = bus.get_object(ACCOUNTMANAGER_IFACE, valid_account)
connection_status = account.Get(ACCOUNT_IFACE, "ConnectionStatus")
if connection_status != 0:
... | identifier_body |
empathy.py | Empathy")
__kupfer_sources__ = ("ContactsSource", )
__kupfer_actions__ = ("ChangeStatus", 'OpenChat')
__description__ = _("Access to Empathy Contacts")
__version__ = "2010-10-17"
__author__ = "Jakh Daven <tuxcanfly@gmail.com>"
import dbus
import time
from kupfer import icons
from kupfer import plugin_support
from kup... |
else:
connection_path = account.Get(ACCOUNT_IFACE, "Connection")
connection_iface = connection_path.replace("/", ".")[1:]
connection = bus.get_object(connection_iface, connection_path)
simple_presence = dbus.Interface(connection, SIMPLE_PRESENCE_IFACE)
simple_presence.SetPresence(iobj.object, _S... | false = dbus.Boolean(0, variant_level=1)
account.Set(ACCOUNT_IFACE, "Enabled", false) | conditional_block |
empathy.py | Empathy Contacts")
__version__ = "2010-10-17"
__author__ = "Jakh Daven <tuxcanfly@gmail.com>"
import dbus
import time
from kupfer import icons
from kupfer import plugin_support
from kupfer import pretty
from kupfer.objects import Leaf, Action, Source, AppLeaf
from kupfer.weaklib import dbus_signal_connect_weakly
fro... | def __init__(self):
Source.__init__(self, _("Empathy Account Status")) | random_line_split | |
empathy.py | Empathy")
__kupfer_sources__ = ("ContactsSource", )
__kupfer_actions__ = ("ChangeStatus", 'OpenChat')
__description__ = _("Access to Empathy Contacts")
__version__ = "2010-10-17"
__author__ = "Jakh Daven <tuxcanfly@gmail.com>"
import dbus
import time
from kupfer import icons
from kupfer import plugin_support
from kup... | (self):
Action.__init__(self, _('Change Global Status To...'))
def activate(self, leaf, iobj):
bus = dbus.SessionBus()
interface = _create_dbus_connection()
for valid_account in interface.Get(ACCOUNTMANAGER_IFACE, "ValidAccounts"):
account = bus.get_object(ACCOUNTMANAGER_IFACE, valid_account)
connection... | __init__ | identifier_name |
props.rs | // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
use dbus::arg::IterAppend;
use dbus_tree::{MTSync, MethodErr, PropInfo};
use crate::{
dbus_api::{
filesy... | where
E: Engine,
{
get_filesystem_property(i, p, |(_, fs_name, _)| Ok(shared::fs_name_prop(&fs_name)))
}
/// Get the creation date and time in rfc3339 format.
pub fn get_filesystem_created<E>(
i: &mut IterAppend<'_>,
p: &PropInfo<'_, MTSync<TData<E>>, TData<E>>,
) -> Result<(), MethodErr>
where
E: ... | pub fn get_filesystem_name<E>(
i: &mut IterAppend<'_>,
p: &PropInfo<'_, MTSync<TData<E>>, TData<E>>,
) -> Result<(), MethodErr> | random_line_split |
props.rs | // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
use dbus::arg::IterAppend;
use dbus_tree::{MTSync, MethodErr, PropInfo};
use crate::{
dbus_api::{
filesy... |
pub fn get_filesystem_name<E>(
i: &mut IterAppend<'_>,
p: &PropInfo<'_, MTSync<TData<E>>, TData<E>>,
) -> Result<(), MethodErr>
where
E: Engine,
{
get_filesystem_property(i, p, |(_, fs_name, _)| Ok(shared::fs_name_prop(&fs_name)))
}
/// Get the creation date and time in rfc3339 format.
pub fn get_fil... | {
get_filesystem_property(i, p, |(pool_name, fs_name, fs)| {
Ok(shared::fs_devnode_prop::<E>(fs, &pool_name, &fs_name))
})
} | identifier_body |
props.rs | // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
use dbus::arg::IterAppend;
use dbus_tree::{MTSync, MethodErr, PropInfo};
use crate::{
dbus_api::{
filesy... | <F, R, E>(
i: &mut IterAppend<'_>,
p: &PropInfo<'_, MTSync<TData<E>>, TData<E>>,
getter: F,
) -> Result<(), MethodErr>
where
F: Fn((Name, Name, &<E::Pool as Pool>::Filesystem)) -> Result<R, String>,
R: dbus::arg::Append,
E: Engine,
{
#[allow(clippy::redundant_closure)]
i.append(
... | get_filesystem_property | identifier_name |
content.component.ts | import { Component, OnDestroy, OnInit, ViewChild, AfterViewInit } from '@angular/core';
import { RecordService } from '../../common/record.service'
@Component({
selector: 'content-page',
template: require('./content.component.html'),
styles: [require('./content.component.css')]
})
export class ContentCompo... |
get frameid(){
return this.recorder.framelist[this.fid-1];
}
updateprogress(fid: number) {
if (fid > this.total_frames) {
this.recorder.submit();
this.snackbarRef.nativeElement.MaterialSnackbar.showSnackbar({
message: `You have finished the test`,
... | {
return this.recorder.framelist.length;
} | identifier_body |
content.component.ts | import { Component, OnDestroy, OnInit, ViewChild, AfterViewInit } from '@angular/core';
import { RecordService } from '../../common/record.service'
@Component({
selector: 'content-page',
template: require('./content.component.html'),
styles: [require('./content.component.css')]
})
export class ContentCompo... | ) {
this.fid = 1;
}
get total_frames() {
return this.recorder.framelist.length;
}
get frameid(){
return this.recorder.framelist[this.fid-1];
}
updateprogress(fid: number) {
if (fid > this.total_frames) {
this.recorder.submit();
this.s... | private recorder: RecordService | random_line_split |
content.component.ts | import { Component, OnDestroy, OnInit, ViewChild, AfterViewInit } from '@angular/core';
import { RecordService } from '../../common/record.service'
@Component({
selector: 'content-page',
template: require('./content.component.html'),
styles: [require('./content.component.css')]
})
export class ContentCompo... |
this.fid = fid;
this.progressRef.nativeElement.MaterialProgress.setProgress(100 * this.fid / this.total_frames);
}
choose(id: string) {
this.recorder.put(this.fid, id);
var fid = this.fid;
this.snackbarRef.nativeElement.MaterialSnackbar.showSnackbar({
messag... | {
this.recorder.submit();
this.snackbarRef.nativeElement.MaterialSnackbar.showSnackbar({
message: `You have finished the test`,
timeout: 1000,
actionText: 'RESTART',
actionHandler: () => {
this.updateprogress(1);... | conditional_block |
content.component.ts | import { Component, OnDestroy, OnInit, ViewChild, AfterViewInit } from '@angular/core';
import { RecordService } from '../../common/record.service'
@Component({
selector: 'content-page',
template: require('./content.component.html'),
styles: [require('./content.component.css')]
})
export class ContentCompo... | (fid: number) {
if (fid > this.total_frames) {
this.recorder.submit();
this.snackbarRef.nativeElement.MaterialSnackbar.showSnackbar({
message: `You have finished the test`,
timeout: 1000,
actionText: 'RESTART',
actionHandler... | updateprogress | identifier_name |
utils.js | var base58 = require('base58-native');
var cnUtil = require('cryptonote-util');
exports.uid = function () {
var min = 100000000000000;
var max = 999999999999999;
var id = Math.floor(Math.random() * (max - min + 1)) + min;
return id.toString();
};
exports.ringBuffer = function (maxSize) {
var data ... |
},
avg: function (plusOne) {
var sum = data.reduce(function (a, b) {
return a + b
}, plusOne || 0);
return sum / ((isFull ? maxSize : cursor) + (plusOne ? 1 : 0));
},
size: function () {
return isFull ? maxSize : cursor;
... | {
data.push(x);
cursor++;
if (data.length === maxSize) {
cursor = 0;
isFull = true;
}
} | conditional_block |
utils.js | var base58 = require('base58-native');
var cnUtil = require('cryptonote-util');
exports.uid = function () {
var min = 100000000000000;
var max = 999999999999999;
var id = Math.floor(Math.random() * (max - min + 1)) + min;
return id.toString();
};
exports.ringBuffer = function (maxSize) {
var data ... | };
exports.varIntEncode = function (n) {
}; | isFull = false;
}
}; | random_line_split |
settings.py | # Django settings for ibistu_serverV2_webserver project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('admin', 'c0710204@gmail.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME':... | # calendars according to the current locale.
USE_L10N = True
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/var/www/example.com/media/"
MEDIA_ROOT = ''
# URL that handles the media se... | random_line_split | |
tests.py | #
# Test-Related Pages
#
import pscheduler
from pschedulerapiserver import application
from flask import request
from .dbcursor import dbcursor_query
from .json import *
from .response import *
#
# Tests
#
# All tests
@application.route("/tests", methods=['GET'])
def tests():
return json_query("SELECT json FR... | def tests_name_tools(name):
# TODO: Should probably 404 if the test doesn't exist.
# TODO: Is this used anywhere?
expanded = is_expanded()
cursor = dbcursor_query("""
SELECT
tool.name,
tool.json
FROM
tool
JOIN tool_test ON tool_test.tool = tool.id
JOIN t... | # Tools that can carry out test <name>
@application.route("/tests/<name>/tools", methods=['GET']) | random_line_split |
tests.py | #
# Test-Related Pages
#
import pscheduler
from pschedulerapiserver import application
from flask import request
from .dbcursor import dbcursor_query
from .json import *
from .response import *
#
# Tests
#
# All tests
@application.route("/tests", methods=['GET'])
def tests():
return json_query("SELECT json FR... |
try:
returncode, stdout, stderr = pscheduler.run_program(
[ "pscheduler", "internal", "invoke", "test", name,
"participants"],
stdin = spec,
)
except KeyError:
return bad_request("Invalid spec")
except Exception as ex:
return bad_re... | return bad_request("No test spec provided") | conditional_block |
tests.py | #
# Test-Related Pages
#
import pscheduler
from pschedulerapiserver import application
from flask import request
from .dbcursor import dbcursor_query
from .json import *
from .response import *
#
# Tests
#
# All tests
@application.route("/tests", methods=['GET'])
def | ():
return json_query("SELECT json FROM test"
" WHERE available ORDER BY name", [])
# Test <name>
@application.route("/tests/<name>", methods=['GET'])
def tests_name(name):
return json_query("SELECT json FROM test"
" WHERE available AND name = %s",
... | tests | identifier_name |
tests.py | #
# Test-Related Pages
#
import pscheduler
from pschedulerapiserver import application
from flask import request
from .dbcursor import dbcursor_query
from .json import *
from .response import *
#
# Tests
#
# All tests
@application.route("/tests", methods=['GET'])
def tests():
|
# Test <name>
@application.route("/tests/<name>", methods=['GET'])
def tests_name(name):
return json_query("SELECT json FROM test"
" WHERE available AND name = %s",
[name], single=True)
# Derive a spec from command line arguments in 'arg'
@application.route("/tests/<... | return json_query("SELECT json FROM test"
" WHERE available ORDER BY name", []) | identifier_body |
engine.rs | : impl IntoIterator<Item = BasicBlock>,
vis: &mut impl ResultsVisitor<'mir, 'tcx, FlowState = A::Domain>,
) {
visit_results(body, blocks, self, vis)
}
pub fn visit_reachable_with(
&self,
body: &'mir mir::Body<'tcx>,
vis: &mut impl ResultsVisitor<'mir, 'tcx, FlowState... |
/// Computes the fixpoint for this dataflow problem and returns it.
pub fn iterate_to_fixpoint(self) -> Results<'tcx, A>
where
A::Domain: DebugWithContext<A>,
{
let Engine {
analysis,
body,
dead_unwinds,
mut entry_sets,
tcx,
... | {
self.pass_name = Some(name);
self
} | identifier_body |
engine.rs | : impl IntoIterator<Item = BasicBlock>,
vis: &mut impl ResultsVisitor<'mir, 'tcx, FlowState = A::Domain>,
) {
visit_results(body, blocks, self, vis)
}
pub fn visit_reachable_with(
&self,
body: &'mir mir::Body<'tcx>,
vis: &mut impl ResultsVisitor<'mir, 'tcx, FlowState... | (self) -> Results<'tcx, A>
where
A::Domain: DebugWithContext<A>,
{
let Engine {
analysis,
body,
dead_unwinds,
mut entry_sets,
tcx,
apply_trans_for_block,
pass_name,
..
} = self;
let m... | iterate_to_fixpoint | identifier_name |
engine.rs | blocks: impl IntoIterator<Item = BasicBlock>,
vis: &mut impl ResultsVisitor<'mir, 'tcx, FlowState = A::Domain>,
) {
visit_results(body, blocks, self, vis)
}
pub fn visit_reachable_with(
&self,
body: &'mir mir::Body<'tcx>,
vis: &mut impl ResultsVisitor<'mir, 'tcx, Fl... | tcx: TyCtxt<'tcx>,
body: &mir::Body<'tcx>,
results: &Results<'tcx, A>,
pass_name: Option<&'static str>,
) -> std::io::Result<()>
where
A: Analysis<'tcx>,
A::Domain: DebugWithContext<A>,
{
use std::fs;
use std::io::{self, Write};
let def_id = body.source.def_id();
let attrs = mat... | /// `rustc_mir` attributes.
fn write_graphviz_results<A>( | random_line_split |
length-test.js | /**
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
import Ember from 'ember';
import {
moduleFor, test
}
from 'ember-qunit';
var options, validator, message;
var set = Ember.set;
moduleFor('validator:length', 'Unit | Validator | len... | is: 4
};
set(validator, 'options', options);
message = validator.validate('testing');
assert.equal(message, 'This field is the wrong length (should be 4 characters)');
message = validator.validate('test');
assert.equal(message, true);
});
test('min', function(assert) {
assert.expect(2);
options ... | random_line_split | |
as_unsigned_mut.rs | #![feature(core)]
extern crate core;
#[cfg(test)]
mod tests {
use core::slice::IntSliceExt;
// pub trait IntSliceExt<U, S> {
// /// Converts the slice to an immutable slice of unsigned integers with the same width.
// fn as_unsigned<'a>(&'a self) -> &'a [U];
// /// Converts the slice t... | () {
let slice: &mut [T] = &mut [0];
{
let as_unsigned_mut: &mut [U] = slice.as_unsigned_mut();
as_unsigned_mut[0] = 0xff;
}
assert_eq!(slice, &mut[-1]);
}
}
| as_unsigned_mut_test1 | identifier_name |
as_unsigned_mut.rs | #![feature(core)]
extern crate core;
#[cfg(test)]
mod tests {
use core::slice::IntSliceExt;
// pub trait IntSliceExt<U, S> {
// /// Converts the slice to an immutable slice of unsigned integers with the same width.
// fn as_unsigned<'a>(&'a self) -> &'a [U];
// /// Converts the slice t... |
}
| {
let slice: &mut [T] = &mut [0];
{
let as_unsigned_mut: &mut [U] = slice.as_unsigned_mut();
as_unsigned_mut[0] = 0xff;
}
assert_eq!(slice, &mut[-1]);
} | identifier_body |
as_unsigned_mut.rs | #![feature(core)]
extern crate core; | // pub trait IntSliceExt<U, S> {
// /// Converts the slice to an immutable slice of unsigned integers with the same width.
// fn as_unsigned<'a>(&'a self) -> &'a [U];
// /// Converts the slice to an immutable slice of signed integers with the same width.
// fn as_signed<'a>(&'a self)... |
#[cfg(test)]
mod tests {
use core::slice::IntSliceExt;
| random_line_split |
mod.rs | tcx ast::Expr)
-> Result<MethodCallee<'tcx>, MethodError>
{
debug!("lookup(method_name={}, self_ty={}, call_expr={}, self_expr={})",
method_name.repr(fcx.tcx()),
self_ty.repr(fcx.tcx()),
call_expr.repr(fcx.tcx()),
self_expr.repr(fcx.tcx()));
l... | resolve_ufcs | identifier_name | |
mod.rs | from which a method
// candidate can arise. Used for error reporting only.
#[derive(Copy, PartialOrd, Ord, PartialEq, Eq)]
pub enum CandidateSource {
ImplSource(ast::DefId),
TraitSource(/* trait id */ ast::DefId),
}
type MethodIndex = uint; // just for doc purposes
/// Determines whether the type `self_ty` s... | Ok(..) => true,
Err(NoMatch(..)) => false,
Err(Ambiguity(..)) => true,
Err(ClosureAmbiguity(..)) => true,
}
}
/// Performs method lookup. If lookup is successful, it will return the callee and store an
/// appropriate adjustment for the self-expr. In some cases it may report an erro... | {
let mode = probe::Mode::MethodCall;
match probe::probe(fcx, span, mode, method_name, self_ty, call_expr_id) { | random_line_split |
test-fs-open-close.js | // Copyright IBM Corp. 2014. All Rights Reserved.
// Node module: async-tracker
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
var assert = require('assert');
require('../index.js');
var fs = require('fs');
var util = require('util');
var cnt = 0;
var ... |
function openCallback(err, fd) {
fs.close(fd, closeCallback);
}
fs.open(__filename, 'r', openCallback);
asyncTracker.removeListener('listener'); | {
} | identifier_body |
test-fs-open-close.js | // Copyright IBM Corp. 2014. All Rights Reserved.
// Node module: async-tracker
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
var assert = require('assert');
require('../index.js');
var fs = require('fs');
var util = require('util');
var cnt = 0;
var ... | (err, fd) {
fs.close(fd, closeCallback);
}
fs.open(__filename, 'r', openCallback);
asyncTracker.removeListener('listener'); | openCallback | identifier_name |
test-fs-open-close.js | // Copyright IBM Corp. 2014. All Rights Reserved.
// Node module: async-tracker
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
var assert = require('assert');
require('../index.js');
var fs = require('fs');
var util = require('util');
var cnt = 0;
var ... | this.deferredReleased = {};
this.deferredCreated[evtName] = function(fName, fId, args) {
assert.equal(cnt, 0);
cnt += 1;
};
this.deferredCreated['default'] = function(fName, fId, args) {
assert.equal(cnt, 4);
cnt += 1;
};
this.invokeDeferred[evtName] = function(fName, fId, next) {
ass... | this.deferredCreated = {};
this.invokeDeferred = {}; | random_line_split |
setup.py | #!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------... |
CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python ... | import re
import sys
m = re.search(r'__version__\s*=\s*[\'"](.+?)[\'"]', content)
if not m:
print('Could not find __version__ in azure/cli/__init__.py')
sys.exit(1)
if m.group(1) != VERSION:
print('Expected __version__ = "{}"; found "{}"'.format(VERSION, m.group(1)))
sys.... | conditional_block |
setup.py | #!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------... | 'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'License :: ... | random_line_split | |
snippetedMessages.js | /* global SnippetedMessages */
Template.snippetedMessages.helpers({
hasMessages() {
return SnippetedMessages.find({ snippeted:true, rid: this.rid }, { sort: { ts: -1 } }).count() > 0;
},
messages() {
return SnippetedMessages.find({ snippeted: true, rid: this.rid }, { sort: { ts: -1 } });
},
| () {
return _.extend(this, { customClass: 'snippeted' });
},
hasMore() {
return Template.instance().hasMore.get();
}
});
Template.snippetedMessages.onCreated(function() {
this.hasMore = new ReactiveVar(true);
this.limit = new ReactiveVar(50);
const self = this;
this.autorun(function() {
const data = Templ... | message | identifier_name |
snippetedMessages.js | /* global SnippetedMessages */
Template.snippetedMessages.helpers({
hasMessages() {
return SnippetedMessages.find({ snippeted:true, rid: this.rid }, { sort: { ts: -1 } }).count() > 0;
},
messages() {
return SnippetedMessages.find({ snippeted: true, rid: this.rid }, { sort: { ts: -1 } });
},
message() {
retur... |
});
Template.snippetedMessages.onCreated(function() {
this.hasMore = new ReactiveVar(true);
this.limit = new ReactiveVar(50);
const self = this;
this.autorun(function() {
const data = Template.currentData();
self.subscribe('snippetedMessages', data.rid, self.limit.get(), function() {
if (SnippetedMessages.... | {
return Template.instance().hasMore.get();
} | identifier_body |
snippetedMessages.js | /* global SnippetedMessages */
Template.snippetedMessages.helpers({
hasMessages() {
return SnippetedMessages.find({ snippeted:true, rid: this.rid }, { sort: { ts: -1 } }).count() > 0;
},
messages() {
return SnippetedMessages.find({ snippeted: true, rid: this.rid }, { sort: { ts: -1 } });
},
message() {
retur... |
});
});
});
| {
return self.hasMore.set(false);
} | conditional_block |
snippetedMessages.js | /* global SnippetedMessages */
Template.snippetedMessages.helpers({
hasMessages() {
return SnippetedMessages.find({ snippeted:true, rid: this.rid }, { sort: { ts: -1 } }).count() > 0;
},
messages() {
return SnippetedMessages.find({ snippeted: true, rid: this.rid }, { sort: { ts: -1 } });
},
message() {
retur... | }
});
Template.snippetedMessages.onCreated(function() {
this.hasMore = new ReactiveVar(true);
this.limit = new ReactiveVar(50);
const self = this;
this.autorun(function() {
const data = Template.currentData();
self.subscribe('snippetedMessages', data.rid, self.limit.get(), function() {
if (SnippetedMessage... | hasMore() {
return Template.instance().hasMore.get(); | random_line_split |
lastfm.py | """
Simplish interface to parts of the Last.fm API.
Has a built-in lock to stop requests happening at more than one per second.
"""
import os
import time
# Import [c]ElementTree
try:
import cElementTree as ET
except:
import elementtree.ElementTree as ET
# The directory to use to cache downloaded xml
cachedir = "/v... |
i += 1.0 / len(matching_weeks)
callback(i/2.0)
artists = artists.items()
artists.sort(key=lambda (x,y):y)
artists.reverse()
return artists | artists[artist].append(plays.get(artist, 0)) | conditional_block |
lastfm.py | """
Simplish interface to parts of the Last.fm API.
Has a built-in lock to stop requests happening at more than one per second.
"""
import os
import time
# Import [c]ElementTree
try:
import cElementTree as ET
except:
import elementtree.ElementTree as ET
# The directory to use to cache downloaded xml
cachedir = "/v... | return tracks
def artist_chart(username, start, end):
"""Retrieves the track chart for a single week.
The data is returned as an ordered list of (artist, plays) tuples.
Implements caching of the XML."""
# We use the track data as it might already be cached
tracks = track_chart(username, start, end)
artists ... | plays = int(tag.find("playcount").text)
tracks.append((name, artist_name, plays))
| random_line_split |
lastfm.py | """
Simplish interface to parts of the Last.fm API.
Has a built-in lock to stop requests happening at more than one per second.
"""
import os
import time
# Import [c]ElementTree
try:
import cElementTree as ET
except:
import elementtree.ElementTree as ET
# The directory to use to cache downloaded xml
cachedir = "/v... | (username, start, end, callback=lambda x:x, dated=False):
"""Like artist_chart, but aggregates over several weeks' charts into a list of values."""
weeks = available_weeks(username)
artist_totals = {}
artists = {}
matching_weeks = [(week_start, week_end) for week_start, week_end in weeks if (week_end > start) ... | artist_range_chart | identifier_name |
lastfm.py | """
Simplish interface to parts of the Last.fm API.
Has a built-in lock to stop requests happening at more than one per second.
"""
import os
import time
# Import [c]ElementTree
try:
import cElementTree as ET
except:
import elementtree.ElementTree as ET
# The directory to use to cache downloaded xml
cachedir = "/v... |
def track_chart(username, start, end):
"""Retrieves the track chart for a single week.
The data is returned as an ordered list of (trackname, artist, plays) tuples.
Implements caching of the XML."""
# Get the XML if it doesn't already exist
filename = os.path.join(cachedir, "trackchart-%s-%s-%s.xml" % (usern... | """Returns a list of integer tuples, representing the
available weeks for charts."""
# Get and parse the XML
root = ET.fromstring(fetch("user/%s/weeklychartlist.xml" % username).read())
# Check the type
assert root.tag == "weeklychartlist", "This is not a Weekly Chart List"
# For each week, get the times
w... | identifier_body |
prewitt.rs | use rgb::*;
use imgref::*;
use loop9::{Triple,loop9};
pub trait ToGray {
fn to_gray(self) -> i16;
}
impl ToGray for RGBA8 {
fn to_gray(self) -> i16 {
self.rgb().to_gray()
}
}
impl ToGray for RGB8 {
fn to_gray(self) -> i16 {
let px = self.map(|c| c as i16);
px.r + px.g + px.g + p... | }
#[inline]
pub fn prewitt_squared3<T: Into<i16>>(top: Triple<T>, mid: Triple<T>, bot: Triple<T>) -> u16 {
prewitt_squared(top.prev, top.curr, top.next, mid.prev, mid.next, bot.prev, bot.curr, bot.next)
}
#[inline]
pub fn prewitt_squared<T: Into<i16>>(top_prev: T, top_curr: T, top_next: T, mid_prev: T, mid_next: ... | loop9(gray.as_ref(), 0,0, gray.width(), gray.height(), |_x,_y,top,mid,bot|{
prew.push(prewitt_squared3(top, mid, bot));
});
ImgVec::new(prew, gray.width(), gray.height()) | random_line_split |
prewitt.rs | use rgb::*;
use imgref::*;
use loop9::{Triple,loop9};
pub trait ToGray {
fn to_gray(self) -> i16;
}
impl ToGray for RGBA8 {
fn to_gray(self) -> i16 {
self.rgb().to_gray()
}
}
impl ToGray for RGB8 {
fn | (self) -> i16 {
let px = self.map(|c| c as i16);
px.r + px.g + px.g + px.b
}
}
pub fn prewitt_squared_img<T: ToGray + Copy>(input: ImgRef<'_, T>) -> ImgVec<u16> {
let gray: Vec<_> = input.pixels().map(|px|px.to_gray()).collect();
let gray = Img::new(gray, input.width(), input.height());
... | to_gray | identifier_name |
prewitt.rs | use rgb::*;
use imgref::*;
use loop9::{Triple,loop9};
pub trait ToGray {
fn to_gray(self) -> i16;
}
impl ToGray for RGBA8 {
fn to_gray(self) -> i16 {
self.rgb().to_gray()
}
}
impl ToGray for RGB8 {
fn to_gray(self) -> i16 {
let px = self.map(|c| c as i16);
px.r + px.g + px.g + p... |
#[inline]
pub fn prewitt_squared<T: Into<i16>>(top_prev: T, top_curr: T, top_next: T, mid_prev: T, mid_next: T, bot_prev: T, bot_curr: T, bot_next: T) -> u16 {
let top_prev = top_prev.into();
let top_curr = top_curr.into();
let top_next = top_next.into();
let mid_prev = mid_prev.into();
let mid_ne... | {
prewitt_squared(top.prev, top.curr, top.next, mid.prev, mid.next, bot.prev, bot.curr, bot.next)
} | identifier_body |
data_class.py | # DATA class v1.0 written by HR,JB@KIT 2011, 2016
'''
DATA exchange class, also holds global variables for thread management.
Generalized version based on TIP.
'''
# 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... |
def store_value(self,value):
'''
Store method, used by the worker.
'''
with Lock():
try:
self.value = float(value)
except ValueError:
print('type cast error, ignoring')
... | return [0] | conditional_block |
data_class.py | # DATA class v1.0 written by HR,JB@KIT 2011, 2016
'''
DATA exchange class, also holds global variables for thread management.
Generalized version based on TIP.
'''
# 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... | Read out the h5 file.
- range: history data range
- nchunks: number of data points to be returned
'''
if self.url_timestamps != None:
try:
with self.log_lock:
timestamps = np.array(self.h... | with Lock():
return self.timestamp
def get_history(self,range,nchunks=100):
''' | random_line_split |
data_class.py | # DATA class v1.0 written by HR,JB@KIT 2011, 2016
'''
DATA exchange class, also holds global variables for thread management.
Generalized version based on TIP.
'''
# 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... | (self):
self.hf.close_file()
def schedule(self):
'''
Specifiy whether the parameter is to be updated,
typicalled called in each worker iteration.
Returns True if new parameter value needs to be read.
'''
if time.time(... | close_logfile | identifier_name |
data_class.py | # DATA class v1.0 written by HR,JB@KIT 2011, 2016
'''
DATA exchange class, also holds global variables for thread management.
Generalized version based on TIP.
'''
# 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... |
class PARAMETER(object):
def __init__(self,config,p_index,p_attr):
'''
Initialize parameter attributes, mostly taken from the config file.
'''
self.p_index = p_index
self.name = config.get(str(p_attr),'name')
self.interval... | self.name = config.get('REMOTEHOST','name')
self.ip = config.get('REMOTEHOST','ip')
self.port = config.getint('REMOTEHOST','port') | identifier_body |
MVCSBundle.ts | // ------------------------------------------------------------------------------
// Copyright (c) 2016 Goodgame Studios. All Rights Reserved.
//
// NOTICE: You are permitted to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
// ------------------------... | (context: IContext): void {
context.install(
ConsoleLoggingExtension,
InjectableLoggerExtension,
EventDispatcherExtension,
DirectCommandMapExtension,
EventCommandMapExtension,
LocalEventMapExtension
);
}
}
| extend | identifier_name |
MVCSBundle.ts | // ------------------------------------------------------------------------------
// Copyright (c) 2016 Goodgame Studios. All Rights Reserved.
//
// NOTICE: You are permitted to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
// ------------------------... |
}
| {
context.install(
ConsoleLoggingExtension,
InjectableLoggerExtension,
EventDispatcherExtension,
DirectCommandMapExtension,
EventCommandMapExtension,
LocalEventMapExtension
);
} | identifier_body |
MVCSBundle.ts | // ------------------------------------------------------------------------------
// Copyright (c) 2016 Goodgame Studios. All Rights Reserved.
//
// NOTICE: You are permitted to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
// ------------------------... | /**
* @inheritDoc
*/
public extend(context: IContext): void {
context.install(
ConsoleLoggingExtension,
InjectableLoggerExtension,
EventDispatcherExtension,
DirectCommandMapExtension,
EventCommandMapExtension,
LocalEventMa... | /*============================================================================*/
/* Public Functions */
/*============================================================================*/
| random_line_split |
snmp-decode.rs | extern crate asn1_cereal;
extern crate argparse;
extern crate serde;
extern crate serde_json;
use asn1_cereal::{tag, byte};
use asn1_cereal::ber::stream;
// SNMP ASN.1 Definition
// https://tools.ietf.org/html/rfc1157#page-30
type ObjectIdentifier = u64;
type NetworkAddress = u64;
type ObjectName = String;
struct M... |
struct GetNextRequest(PDU);
struct GetResponse(PDU);
struct SetRequest(PDU);
struct PDU {
request_id: i32,
error_status: i32,
error_index: i32,
variable_bindings: VarBindList,
}
struct TrapPDU {
enterprise: ObjectIdentifier,
agent_addr: NetworkAddress,
generic_trap: i32,
specific_trap: i32,
time_... | struct GetRequest(PDU); | random_line_split |
snmp-decode.rs | extern crate asn1_cereal;
extern crate argparse;
extern crate serde;
extern crate serde_json;
use asn1_cereal::{tag, byte};
use asn1_cereal::ber::stream;
// SNMP ASN.1 Definition
// https://tools.ietf.org/html/rfc1157#page-30
type ObjectIdentifier = u64;
type NetworkAddress = u64;
type ObjectName = String;
struct M... |
// Create a buffered reader from the file.
let reader = io::BufReader::new(fs::File::open(path).unwrap()).bytes();
}
struct ProgOpts {
file: Option<String>,
verbose: bool,
}
fn parse_args() -> ProgOpts {
let mut opts = ProgOpts {
file: None,
verbose: false,
};
{
let mut ap = ArgumentParse... | {
panic!("Supplied file does not exist");
} | conditional_block |
snmp-decode.rs | extern crate asn1_cereal;
extern crate argparse;
extern crate serde;
extern crate serde_json;
use asn1_cereal::{tag, byte};
use asn1_cereal::ber::stream;
// SNMP ASN.1 Definition
// https://tools.ietf.org/html/rfc1157#page-30
type ObjectIdentifier = u64;
type NetworkAddress = u64;
type ObjectName = String;
struct M... | (PDU);
struct SetRequest(PDU);
struct PDU {
request_id: i32,
error_status: i32,
error_index: i32,
variable_bindings: VarBindList,
}
struct TrapPDU {
enterprise: ObjectIdentifier,
agent_addr: NetworkAddress,
generic_trap: i32,
specific_trap: i32,
time_stamp: TimeTicks,
variable_bindings: VarBindLi... | GetResponse | identifier_name |
xla_test.py | .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 agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
... |
@property
def all_types(self):
name = '{}.{}'.format(type(self).__name__, self._testMethodName)
return self._all_types - self._method_types_filter.get(name, set())
def setUp(self):
super(XLATestCase, self).setUp()
name = '{}.{}'.format(type(self).__name__, self._testMethodName)
if self.disa... | name = '{}.{}'.format(type(self).__name__, self._testMethodName)
return self._numeric_types - self._method_types_filter.get(name, set()) | identifier_body |
xla_test.py | .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 agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
... |
elif len(entry) == 2:
disabled_method_types.append(
(entry[0], entry[1].strip().split(',')))
else:
raise ValueError('Bad entry in manifest file.')
self.disabled_regex = re.compile('|'.join(disabled_tests))
for method, types in disabled_method_types:
... | disabled_tests.append(entry[0]) | conditional_block |
xla_test.py | .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 agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
... | (self):
name = '{}.{}'.format(type(self).__name__, self._testMethodName)
return self._float_types - self._method_types_filter.get(name, set())
@property
def float_tf_types(self):
name = '{}.{}'.format(type(self).__name__, self._testMethodName)
return self._float_tf_types - self._method_types_filter... | float_types | identifier_name |
xla_test.py | 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 agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,... | device,
separate_compiled_gradients=False):
"""Build a graph and run benchmarks against it, with or without XLA.
Args:
tf_bench: An instance of tf.test.Benchmark, used to run the benchmark.
builder_fn: A function that builds a graph when invoked, and returns
(name, fetch... | builder_fn,
use_xla_jit, | random_line_split |
edit_role.rs | use std::collections::HashMap;
use bytes::buf::Buf;
use reqwest::Url;
use tokio::{fs::File, io::AsyncReadExt};
use crate::http::{AttachmentType, Http};
use crate::internal::prelude::*;
use crate::model::{guild::Role, Permissions};
/// A builder to create or edit a [`Role`] for use via a number of model methods.
///
... | (&mut self, position: u8) -> &mut Self {
self.0.insert("position", Value::Number(Number::from(position)));
self
}
/// The unicode emoji to set as the role image.
pub fn unicode_emoji<S: ToString>(&mut self, unicode_emoji: S) -> &mut Self {
self.0.remove("icon");
self.0.inser... | position | identifier_name |
edit_role.rs | use std::collections::HashMap;
use bytes::buf::Buf;
use reqwest::Url;
use tokio::{fs::File, io::AsyncReadExt};
use crate::http::{AttachmentType, Http};
use crate::internal::prelude::*;
use crate::model::{guild::Role, Permissions};
/// A builder to create or edit a [`Role`] for use via a number of model methods.
///
... |
EditRole(map)
}
/// Sets the colour of the role.
pub fn colour(&mut self, colour: u64) -> &mut Self {
self.0.insert("color", Value::Number(Number::from(colour)));
self
}
/// Whether or not to hoist the role above lower-positioned role in the user
/// list.
pub fn ... | {
map.insert("icon", Value::String(icon.clone()));
} | conditional_block |
edit_role.rs | use std::collections::HashMap;
use bytes::buf::Buf;
use reqwest::Url;
use tokio::{fs::File, io::AsyncReadExt};
use crate::http::{AttachmentType, Http};
use crate::internal::prelude::*;
use crate::model::{guild::Role, Permissions};
/// A builder to create or edit a [`Role`] for use via a number of model methods.
///
... |
/// The set of permissions to assign the role.
pub fn permissions(&mut self, permissions: Permissions) -> &mut Self {
self.0.insert("permissions", Value::Number(Number::from(permissions.bits())));
self
}
/// The position to assign the role in the role list. This correlates to the
... | {
self.0.insert("name", Value::String(name.to_string()));
self
} | identifier_body |
edit_role.rs | use std::collections::HashMap;
use bytes::buf::Buf;
use reqwest::Url;
use tokio::{fs::File, io::AsyncReadExt};
use crate::http::{AttachmentType, Http};
use crate::internal::prelude::*;
use crate::model::{guild::Role, Permissions};
/// A builder to create or edit a [`Role`] for use via a number of model methods.
///
... | self.0.insert("permissions", Value::Number(Number::from(permissions.bits())));
self
}
/// The position to assign the role in the role list. This correlates to the
/// role's position in the user list.
pub fn position(&mut self, position: u8) -> &mut Self {
self.0.insert("positio... |
/// The set of permissions to assign the role.
pub fn permissions(&mut self, permissions: Permissions) -> &mut Self { | random_line_split |
source-map.d.ts | // Type definitions for source-map v0.1.38
// Project: https://github.com/mozilla/source-map
// Definitions by: Morten Houston Ludvigsen <https://github.com/MortenHoustonLudvigsen>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module SourceMap {
interface StartOfSourceMap {
file?:... |
constructor(startOfSourceMap?: StartOfSourceMap);
public static fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator;
public addMapping(mapping: Mapping): void;
public setSourceContent(sourceFile: string, sourceContent: string): void;
public applySourceMap(sou... | urceMapGenerator { | identifier_name |
source-map.d.ts | // Type definitions for source-map v0.1.38
// Project: https://github.com/mozilla/source-map
// Definitions by: Morten Houston Ludvigsen <https://github.com/MortenHoustonLudvigsen>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module SourceMap {
interface StartOfSourceMap {
file?:... | public toString(): string;
}
class SourceNode {
constructor();
constructor(line: number, column: number, source: string);
constructor(line: number, column: number, source: string, chunk?: string, name?: string);
public static fromStringWithSourceMap(code: string, sourceM... | public static fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator;
public addMapping(mapping: Mapping): void;
public setSourceContent(sourceFile: string, sourceContent: string): void;
public applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sou... | random_line_split |
types.ts | export type L10nFormat = 'language' | 'language-script' | 'language-region' | 'language-script-region';
export interface L10nProvider {
/**
* The name of the provider.
*/
name: string;
/** | * Options to pass the loader.
*/
options?: any;
}
export interface L10nLocale {
/**
* language[-script][-region][-extension]
* Where:
* - language: ISO 639 two-letter or three-letter code
* - script: ISO 15924 four-letter script code
* - region: ISO 3166 two-letter, uppercase... | * The asset of the provider.
*/
asset: any;
/** | random_line_split |
bugtracker.py | from djblets.cache.backend import cache_memoize
class BugTracker(object):
"""An interface to a bug tracker.
BugTracker subclasses are used to enable interaction with different
bug trackers. | 'status' keys.
This is cached for 60 seconds to reduce the number of queries to the
bug trackers and make things seem fast after the first infobox load,
but is still a short enough time to give relatively fresh data.
"""
return cache_memoize(self.make_bug_cache_key(repos... | """
def get_bug_info(self, repository, bug_id):
"""Get the information for the specified bug.
This should return a dictionary with 'summary', 'description', and | random_line_split |
bugtracker.py | from djblets.cache.backend import cache_memoize
class BugTracker(object):
"""An interface to a bug tracker.
BugTracker subclasses are used to enable interaction with different
bug trackers.
"""
def | (self, repository, bug_id):
"""Get the information for the specified bug.
This should return a dictionary with 'summary', 'description', and
'status' keys.
This is cached for 60 seconds to reduce the number of queries to the
bug trackers and make things seem fast after the firs... | get_bug_info | identifier_name |
bugtracker.py | from djblets.cache.backend import cache_memoize
class BugTracker(object):
"""An interface to a bug tracker.
BugTracker subclasses are used to enable interaction with different
bug trackers.
"""
def get_bug_info(self, repository, bug_id):
"""Get the information for the specified bug.
... |
def make_bug_cache_key(self, repository, bug_id):
"""Returns a key to use when caching fetched bug information."""
return 'repository-%s-bug-%s' % (repository.pk, bug_id)
| """Get the information for the specified bug (implementation).
This should be implemented by subclasses, and should return a
dictionary with 'summary', 'description', and 'status' keys.
If any of those are unsupported by the given bug tracker, the unknown
values should be given as an em... | identifier_body |
mod.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/. */
pub use self::builder::BlockFlowDisplayListBuilding;
pub use self::builder::BorderPaintingMode;
pub use self::buil... | mod background;
mod builder;
mod conversions;
pub mod items;
mod webrender_helpers; | pub use self::builder::StackingContextCollectionFlags;
pub use self::builder::StackingContextCollectionState;
pub use self::conversions::ToLayout;
pub use self::webrender_helpers::WebRenderDisplayListConverter;
| random_line_split |
EditAssignmentDetails.js | Affero General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import I18n from 'i18n!calendar'
import $ from 'jquery'
import moment from 'moment'
import natcompare from '../util/natcompare'
import commonEventFactory from './commonEventFactory'
import ValidatedFormView from ... | () {
this.$el.find('select.context_id').change()
if (this.event.assignment && this.event.assignment.assignment_group_id) {
return this.$el
.find('.assignment_group_select .assignment_group')
.val(this.event.assignment.assignment_group_id)
}
}
moreOptions(jsEvent) {
jsEvent.pre... | activate | identifier_name |
EditAssignmentDetails.js | Affero General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import I18n from 'i18n!calendar'
import $ from 'jquery'
import moment from 'moment'
import natcompare from '../util/natcompare'
import commonEventFactory from './commonEventFactory'
import ValidatedFormView from ... |
}
unfudgedDate(date) {
const unfudged = $.unfudgeDateForProfileTimezone(date)
if (unfudged) {
return unfudged.toISOString()
} else {
return ''
}
}
getFormData() {
const data = super.getFormData(...arguments)
if (data.assignment != null) {
data.assignment.due_at = thi... | {
return this.submitOverride(e, data.assignment_override)
} | conditional_block |
EditAssignmentDetails.js | Affero General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import I18n from 'i18n!calendar'
import $ from 'jquery'
import moment from 'moment'
import natcompare from '../util/natcompare'
import commonEventFactory from './commonEventFactory'
import ValidatedFormView from ... | return this.event.possibleContexts().find(context => context.asset_string === code)
}
activate() {
this.$el.find('select.context_id').change()
if (this.event.assignment && this.event.assignment.assignment_group_id) {
return this.$el
.find('.assignment_group_select .assignment_group')
... | contextInfoForCode(code) { | random_line_split |
EditAssignmentDetails.js | Affero General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import I18n from 'i18n!calendar'
import $ from 'jquery'
import moment from 'moment'
import natcompare from '../util/natcompare'
import commonEventFactory from './commonEventFactory'
import ValidatedFormView from ... |
onSaveFail(xhr) {
let resp
if ((resp = JSON.parse(xhr.responseText))) {
showFlashAlert({message: resp.error, err: null, type: 'error'})
}
this.closeCB()
this.disableWhileLoadingOpts = {}
return super.onSaveFail(xhr)
}
validateBeforeSave(data, errors) {
if (data.assignment != n... | {
return this.closeCB()
} | identifier_body |
font_face.rs | ://drafts.csswg.org/css-fonts/#at-font-face-rule
#![deny(missing_docs)]
#[cfg(feature = "gecko")]
use computed_values::{font_style, font_weight, font_stretch};
use computed_values::font_family::FamilyName;
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
#[cfg(feature = "gecko")] use c... | else {
true
}
}).cloned().collect())
}
}
impl iter::Iterator for EffectiveSources {
type Item = Source;
fn next(&mut self) -> Option<Source> {
self.0.pop()
}
}
struct FontFaceRuleParser<'a, 'b: 'a> {
context: &'a ParserContext<'b>,
rule: &'a mut Fon... | {
let hints = &url_source.format_hints;
// We support only opentype fonts and truetype is an alias for
// that format. Sources without format hints need to be
// downloaded in case we support them.
hints.is_empty() || hints.iter().any(|hint... | conditional_block |
font_face.rs | ://drafts.csswg.org/css-fonts/#at-font-face-rule
#![deny(missing_docs)]
#[cfg(feature = "gecko")]
use computed_values::{font_style, font_weight, font_stretch};
use computed_values::font_family::FamilyName;
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
#[cfg(feature = "gecko")] use c... | {
/// The specified url.
pub url: SpecifiedUrl,
/// The format hints specified with the `format()` function.
pub format_hints: Vec<String>,
}
impl ToCss for UrlSource {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
where W: fmt::Write,
{
dest.write_str(self.url.as_str())
... | UrlSource | identifier_name |
font_face.rs | ://drafts.csswg.org/css-fonts/#at-font-face-rule
#![deny(missing_docs)]
#[cfg(feature = "gecko")]
use computed_values::{font_style, font_weight, font_stretch};
use computed_values::font_family::FamilyName;
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
#[cfg(feature = "gecko")] use c... | Ok(Source::Url(UrlSource {
url: url,
format_hints: format_hints,
}))
}
}
macro_rules! font_face_descriptors {
(
mandatory descriptors = [
$( #[$m_doc: meta] $m_name: tt $m_ident: ident: $m_ty: ty = $m_initial: expr, )*
]
optional desc... | {
if input.try(|input| input.expect_function_matching("local")).is_ok() {
return input.parse_nested_block(|input| {
FamilyName::parse(context, input)
}).map(Source::Local)
}
let url = SpecifiedUrl::parse(context, input)?;
// Parsing optional form... | identifier_body |
font_face.rs | ://drafts.csswg.org/css-fonts/#at-font-face-rule
#![deny(missing_docs)]
#[cfg(feature = "gecko")]
use computed_values::{font_style, font_weight, font_stretch};
use computed_values::font_family::FamilyName;
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
#[cfg(feature = "gecko")] use c... | }
}
impl FontFaceRule {
fn initial() -> Self {
FontFaceRule {
$(
$m_ident: $m_initial,
)*
$(
$o_ident: $o_initial,
)*
}... | self.$m_ident
)||* | random_line_split |
test_concurrency.py | from __future__ import absolute_import
import os
from itertools import count
from mock import Mock
from celery.concurrency.base import apply_target, BasePool
from celery.tests.case import AppCase
class test_BasePool(AppCase):
def test_apply_target(self):
scratch = {}
counter = count(0)
... |
def test_interface_on_apply(self):
BasePool(10).on_apply()
def test_interface_info(self):
self.assertDictEqual(BasePool(10).info, {})
def test_active(self):
p = BasePool(10)
self.assertFalse(p.active)
p._state = p.RUN
self.assertTrue(p.active)
def test... | BasePool(10).on_stop() | random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.