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 |
|---|---|---|---|---|
into_matcher.rs | use super::Matcher;
use regex::{Regex, Captures};
impl From<Regex> for Matcher {
fn from(regex: Regex) -> Matcher |
}
impl<'a> From<&'a str> for Matcher {
fn from(s: &'a str) -> Matcher {
From::from(s.to_string())
}
}
lazy_static! {
static ref REGEX_VAR_SEQ: Regex = Regex::new(r":([,a-zA-Z0-9_-]*)").unwrap();
}
pub static FORMAT_PARAM: &'static str = "format";
// FIXME: Once const fn lands this could be ... | {
let path = regex.as_str().to_string();
Matcher::new(path, regex)
} | identifier_body |
into_matcher.rs | use super::Matcher;
use regex::{Regex, Captures};
impl From<Regex> for Matcher {
fn from(regex: Regex) -> Matcher {
let path = regex.as_str().to_string();
Matcher::new(path, regex)
}
} | fn from(s: &'a str) -> Matcher {
From::from(s.to_string())
}
}
lazy_static! {
static ref REGEX_VAR_SEQ: Regex = Regex::new(r":([,a-zA-Z0-9_-]*)").unwrap();
}
pub static FORMAT_PARAM: &'static str = "format";
// FIXME: Once const fn lands this could be defined in terms of the above
static FORM... |
impl<'a> From<&'a str> for Matcher { | random_line_split |
BiPartite.js | * @author Yongnan
* @version 1.0
* @time 11/26/2014
* @name PathBubble_BiPartite
*/
PATHBUBBLES.BiPartite = function (x, y, w, h, data, name) {
var tmp;
PATHBUBBLES.BubbleBase.call(this, {
type: 'BiPartite',
mainMenu: true, closeMenu: true, groupMenu: true,
html_elements: ['svg', 'm... | /** | random_line_split | |
BiPartite.js | /**
* @author Yongnan
* @version 1.0
* @time 11/26/2014
* @name PathBubble_BiPartite
*/
PATHBUBBLES.BiPartite = function (x, y, w, h, data, name) {
var tmp;
PATHBUBBLES.BubbleBase.call(this, {
type: 'BiPartite',
mainMenu: true, closeMenu: true, groupMenu: true,
html_elements: ['svg'... |
// var blob = new Blob([saveString],{type:"text/plain;chartset=utf-8"});
// download(blob, "geneSymbol.txt", "text/plain");
download(saveString, "geneSymbol.txt", "text/plain");
}
});
},
updateMenu: function () {
var $menuBarbubble = $('#menuView' + this... | {
for(var j=0;j<tempData[1][i].length; ++j)
{
if(tempData[1][i][j] ==1)
{
saveString += tempKey[0][j];
saveString += "\t";
saveString += tempKey[1][i];
saveString += "\n";
}
}
} | conditional_block |
is_integer.rs | use malachite_base::num::conversion::traits::IsInteger;
use Rational;
impl<'a> IsInteger for &'a Rational {
/// Determines whether a `Rational` is an integer.
///
/// $f(x) = x \in \Z$.
///
/// # Worst-case complexity
/// Constant time and additional memory.
///
/// # Examples
/// `... |
}
| {
self.denominator == 1u32
} | identifier_body |
is_integer.rs | use malachite_base::num::conversion::traits::IsInteger;
use Rational;
impl<'a> IsInteger for &'a Rational {
/// Determines whether a `Rational` is an integer.
///
/// $f(x) = x \in \Z$.
///
/// # Worst-case complexity
/// Constant time and additional memory.
///
/// # Examples
/// `... | (self) -> bool {
self.denominator == 1u32
}
}
| is_integer | identifier_name |
is_integer.rs | use malachite_base::num::conversion::traits::IsInteger;
use Rational;
impl<'a> IsInteger for &'a Rational {
/// Determines whether a `Rational` is an integer.
///
/// $f(x) = x \in \Z$.
///
/// # Worst-case complexity
/// Constant time and additional memory. | /// extern crate malachite_q;
///
/// use malachite_base::num::basic::traits::{One, Zero};
/// use malachite_base::num::conversion::traits::IsInteger;
/// use malachite_q::Rational;
/// use std::str::FromStr;
///
/// assert_eq!(Rational::ZERO.is_integer(), true);
/// assert_eq!(Ratio... | ///
/// # Examples
/// ```
/// extern crate malachite_base; | random_line_split |
materialize-css.js | //
// https://github.com/Dogfalo/materialize/issues/634#issuecomment-113213629
// and
// https://github.com/noodny/materializecss-amd/blob/master/config.js
//
//
require([
'global',
'initial', | 'animation',
'buttons',
'cards',
'carousel',
'character_counter',
'chips',
'collapsible',
'dropdown',
'forms',
'hammerjs',
'jquery.easing',
'jquery.hammer',
'jquery.timeago',
'leanModal',
'materialbox',
'parallax',
'picker',
'picker.date',
'prism',
'pushpin',
'scrollFire',
's... | random_line_split | |
index.ts | // tslint:disable:no-console no-string-literal
import * as fs from 'fs';
import * as minimist from 'minimist';
import * as mkdirp from 'mkdirp';
import * as path from 'path';
import { format as pretty, Options as PrettyOptions } from 'prettier';
import { Config } from './config';
import { DataModelsOptions, generateDa... |
export async function codegen(
idlArchive: string | undefined,
dataModel: string | undefined,
ignorePackage: string[],
addType: string | undefined
) {
const config = loadConfig();
if (!dataModel) {
throw new Error(`Missing required cli argument data-model`);
}
mkdirp.sync(config.output);
if (id... | {
const restModels = await processIdlFolder(idlArchive, {
cacheFolder: config.cacheFolder
});
if (restModels.length === 0) {
throw new Error(`Did not generate any models from idl ${idlArchive}`);
}
// Output the resources under the resources folder.
const resources = path.join(config.output, 'reso... | identifier_body |
index.ts | // tslint:disable:no-console no-string-literal
import * as fs from 'fs';
import * as minimist from 'minimist';
import * as mkdirp from 'mkdirp';
import * as path from 'path';
import { format as pretty, Options as PrettyOptions } from 'prettier';
import { Config } from './config';
import { DataModelsOptions, generateDa... | (idlArchive: string, config: Config) {
const restModels = await processIdlFolder(idlArchive, {
cacheFolder: config.cacheFolder
});
if (restModels.length === 0) {
throw new Error(`Did not generate any models from idl ${idlArchive}`);
}
// Output the resources under the resources folder.
const resou... | generateIdl | identifier_name |
index.ts | // tslint:disable:no-console no-string-literal
import * as fs from 'fs';
import * as minimist from 'minimist';
import * as mkdirp from 'mkdirp';
import * as path from 'path';
import { format as pretty, Options as PrettyOptions } from 'prettier';
import { Config } from './config';
import { DataModelsOptions, generateDa... | fs.unlinkSync(outputFile);
}
const options: DataModelsOptions = {
addType,
ignorePackage,
outputFile
};
await generateDataModels(dataModel, options);
const formatted = pretty(fs.readFileSync(outputFile).toString(), PRETTY_OPTIONS);
fs.writeFileSync(outputFile, formatted);... | if (fs.existsSync(outputFile)) { | random_line_split |
index.ts | // tslint:disable:no-console no-string-literal
import * as fs from 'fs';
import * as minimist from 'minimist';
import * as mkdirp from 'mkdirp';
import * as path from 'path';
import { format as pretty, Options as PrettyOptions } from 'prettier';
import { Config } from './config';
import { DataModelsOptions, generateDa... |
return config;
}
if (!module.parent) {
/**
* Main command line entry point.
* @param args
*/
async function main(args: string[]) {
const cli = minimist(process.argv.slice(2));
const idlArchive: string | undefined = cli['rest-spec'];
const dataModel: string | undefined = cli['data-model'];
... | {
throw new Error(`Missing configuration file ${CONFIG}`);
} | conditional_block |
index.d.ts | // Type definitions for bootstrap-notify v3.1.3
// Project: http://bootstrap-notify.remabledesigns.com/
// Definitions by: Blake Niemyjski <https://github.com/niemyjski>, Robert McIntosh <https://github.com/mouse0270>, Robert Voica <https://github.com/robert-voica>
// Definitions: https://github.com/DefinitelyTyped/Def... | onShow?: (($ele: JQuery) => void) | undefined;
onShown?: (($ele: JQuery) => void) | undefined;
onClose?: (($ele: JQuery) => void) | undefined;
onClosed?: (($ele: JQuery) => void) | undefined;
icon_type?: string | undefined;
template?: string | undefined;
}
interface NotifyReturn {
$ele: JQu... | } | undefined; | random_line_split |
mem_size_tbl.rs | // SPDX-License-Identifier: MIT
// Copyright wtfsckgh@gmail.com
// Copyright iced contributors
use super::super::super::iced_constants::IcedConstants;
use alloc::vec::Vec;
// GENERATOR-BEGIN: MemorySizes
// ⚠️This was generated by GENERATOR!🦹♂️
#[rustfmt::skip]
static MEM_SIZE_TBL_DATA: [u8; 141] = [
0x00,
0x01,
... | 0x08,
0x0C,
0x0D,
0x03,
0x0B,
0x03,
0x0B,
0x0B,
0x09,
0x08,
0x08,
0x0D,
0x03,
0x0B,
0x0C,
0x0E,
0x0D,
0x04,
0x05,
0x07,
0x06,
0x00,
0x00,
0x00,
0x00,
0x0C,
0x10,
0x00,
0x0C,
0x11,
0x10,
0x0D,
0x0D,
0x03,
0x03,
0x03,
0x03,
0x03,
0x0B,
0x0B,
0x0B,
0x0B,
0x0B,
0x0B,
0x0B,
0x0B... | 0x03, | random_line_split |
soln.py | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
# We use the inorder to find which elements are left and right of the curr element.
# And the post order to start with the fir... | :
def buildTree(self, inorder: List[int], postorder: List[int]) -> TreeNode:
def helper(inorderL, inorderR):
# base case
if inorderL >= inorderR:
return None
nonlocal postorder
curr = postorder.pop()
root = TreeNode(curr)
... | Solution | identifier_name |
soln.py | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
# We use the inorder to find which elements are left and right of the curr element.
# And the post order to start with the fir... | def helper(inorderL, inorderR):
# base case
if inorderL >= inorderR:
return None
nonlocal postorder
curr = postorder.pop()
root = TreeNode(curr)
currPos = inorderMap[curr]
root.right = helper(currPos+1, inorderR)
... | identifier_body | |
soln.py | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
# We use the inorder to find which elements are left and right of the curr element.
# And the post order to start with the fir... |
nonlocal postorder
curr = postorder.pop()
root = TreeNode(curr)
currPos = inorderMap[curr]
root.right = helper(currPos+1, inorderR)
root.left = helper(inorderL, currPos)
return root
inorderMap = {v:k for k, v ... | return None | conditional_block |
soln.py | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
# We use the inorder to find which elements are left and right of the curr element.
# And the post order to start with the fir... | nonlocal postorder
curr = postorder.pop()
root = TreeNode(curr)
currPos = inorderMap[curr]
root.right = helper(currPos+1, inorderR)
root.left = helper(inorderL, currPos)
return root
inorderMap = {v:k for k, v i... | def helper(inorderL, inorderR):
# base case
if inorderL >= inorderR:
return None | random_line_split |
enable_stratagem_button.rs | // Copyright (c) 2020 DDN. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
use crate::{
components::{
font_awesome_outline,
stratagem::{Command, StratagemEnable},
},
extensions::{MergeAttrs, NodeExt, RequestExt},
... |
}
| {
btn.merge_attrs(attrs! {At::Disabled => "disabled"})
.merge_attrs(class![C.opacity_50, C.cursor_not_allowed])
} | conditional_block |
enable_stratagem_button.rs | // Copyright (c) 2020 DDN. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
use crate::{
components::{
font_awesome_outline,
stratagem::{Command, StratagemEnable},
},
extensions::{MergeAttrs, NodeExt, RequestExt},
... |
pub fn view(is_valid: bool, disabled: bool) -> Node<Command> {
let btn = button![
class![
C.bg_blue_500,
C.hover__bg_blue_700,
C.text_white,
C.font_bold,
C.p_2,
C.rounded,
C.w_full,
C.text_sm,
C.col... | {
fetch::Request::api_call(StratagemConfiguration::endpoint_name())
.method(fetch::Method::Post)
.with_auth()
.send_json(&model)
.fetch_json(std::convert::identity)
.await
} | identifier_body |
enable_stratagem_button.rs | // Copyright (c) 2020 DDN. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
use crate::{
components::{
font_awesome_outline,
stratagem::{Command, StratagemEnable},
},
extensions::{MergeAttrs, NodeExt, RequestExt},
... | C.font_bold,
C.p_2,
C.rounded,
C.w_full,
C.text_sm,
C.col_span_2,
],
"Enable Scan Interval",
font_awesome_outline(class![C.inline, C.h_4, C.w_4, C.ml_2], "clock")
];
if is_valid && !disabled {
btn.with_liste... | C.bg_blue_500,
C.hover__bg_blue_700,
C.text_white, | random_line_split |
enable_stratagem_button.rs | // Copyright (c) 2020 DDN. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
use crate::{
components::{
font_awesome_outline,
stratagem::{Command, StratagemEnable},
},
extensions::{MergeAttrs, NodeExt, RequestExt},
... | (is_valid: bool, disabled: bool) -> Node<Command> {
let btn = button![
class![
C.bg_blue_500,
C.hover__bg_blue_700,
C.text_white,
C.font_bold,
C.p_2,
C.rounded,
C.w_full,
C.text_sm,
C.col_span_2,
... | view | identifier_name |
constants.rs | pub const MH_MAGIC_64: u32 = 0xfeedfacf;
pub const MH_CIGAM_64: u32 = 0xcffaedfe;
const LC_REQ_DYLD: u32 = 0x80000000;
#[repr(u32)]
#[derive(Eq,PartialEq)]
#[allow(non_camel_case_types)]
pub enum | {
/// After MacOS X 10.1 when a new load command is added that is required to be
/// understood by the dynamic linker for the image to execute properly the
/// LC_REQ_DYLD bit will be or'ed into the load command constant. If the dynamic
/// linker sees such a load command it it does not understand wil... | LcType | identifier_name |
constants.rs | pub const MH_MAGIC_64: u32 = 0xfeedfacf;
pub const MH_CIGAM_64: u32 = 0xcffaedfe;
const LC_REQ_DYLD: u32 = 0x80000000;
#[repr(u32)]
#[derive(Eq,PartialEq)]
#[allow(non_camel_case_types)]
pub enum LcType {
/// After MacOS X 10.1 when a new load command is added that is required to be
/// understood by the dyna... |
/// two-level namespace lookup hints
LC_TWOLEVEL_HINTS = 0x16,
/// prebind checksum
LC_PREBIND_CKSUM = 0x17,
/// load a dynamically linked shared library that is allowed to be missing
/// (all symbols are weak imported).
LC_LOAD_WEAK_DYLIB = (0x18 | LC_REQ_DYLD),
/// 64-bit segment o... | LC_SUB_LIBRARY = 0x15, | random_line_split |
Sandbox.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2013 University of Dundee & Open Microscopy Environment
# All Rights Reserved.
#
# 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 Foundat... |
def rename_origin_remote(self, new_name):
"""
Rename the remote used for the upstream repository
"""
self.sandbox.call("git", "remote", "rename", self.origin_remote,
new_name)
self.origin_remote = new_name
def push_branch(self, branch):
... | remote_url = "https://%s:x-oauth-basic@github.com/%s/%s.git" \
% (self.token, self.user, self.sandbox.origin.name)
self.sandbox.add_remote(self.user, remote_url) | conditional_block |
Sandbox.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2013 University of Dundee & Open Microscopy Environment
# All Rights Reserved.
#
# 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 Foundat... |
def init_submodules(self):
"""
Fetch submodules after cloning the repository
"""
try:
with open(os.devnull, 'w') as dev_null:
p = Popen(["git", "submodule", "update", "--init"],
stdout=dev_null, stderr=dev_null)
... | return None | identifier_body |
Sandbox.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2013 University of Dundee & Open Microscopy Environment
# All Rights Reserved.
#
# 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 Foundat... | (self, new_name):
"""
Rename the remote used for the upstream repository
"""
self.sandbox.call("git", "remote", "rename", self.origin_remote,
new_name)
self.origin_remote = new_name
def push_branch(self, branch):
"""
Push a local bra... | rename_origin_remote | identifier_name |
Sandbox.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2013 University of Dundee & Open Microscopy Environment
# All Rights Reserved.
#
# 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 Foundat... | """
Push a local branch to GitHub
"""
self.add_remote()
self.sandbox.push_branch(branch, remote=self.user)
def open_pr(self, branch, base, description=None):
"""
Push a local branch and open a PR against the selected base
"""
self.push_branch(... | def push_branch(self, branch): | random_line_split |
lib.rs | // Definitions
mod definitions {
//
// Each encoded block begins with the varint-encoded length of the decoded data,
// followed by a sequence of chunks. Chunks begin and end on byte boundaries.
// The
// first byte of each chunk is broken into its 2 least and 6 most significant
// bits
// called l and m: l ran... | // - For l == 3, this tag is a legacy format that is no longer supported.
//
pub const TAG_LITERAL: u8 = 0x00;
pub const TAG_COPY_1: u8 = 0x01;
pub const TAG_COPY_2: u8 = 0x02;
pub const TAG_COPY_4: u8 = 0x03;
pub const CHECK_SUM_SIZE: u8 = 4;
pub const CHUNK_HEADER_SIZE: u8 = 4;
pub cons... | // - For l == 2, the offset ranges in [0, 1<<16) and the length in [1, 65).
// The length is 1 + m. The offset is the little-endian unsigned integer
// denoted by the next 2 bytes. | random_line_split |
main.rs | use std::io;
pub struct JiaeHomework {
index: usize,
value: i32,
}
fn stdinln_i32() -> i32 {
// 이 함수는 하나의 줄을 stdin으로 받아 단 하나의 integer를 리턴합니다.
let mut buffer = String::new();
std::io::stdin().read_line(&mut buffer).expect("Failed to read stdin.");
buffer.trim().parse::<i32>().unwrap()
}
fn stdinln_vec_i32() -> ... | 를 완성해주세요!
let mut problem = JiaeHomework::new();
problem.solve(&inputs, nr_case);
problem.print();
} | ts = stdinln_vec_i32();
// JiaeHomework.solve(...) | conditional_block |
main.rs | use std::io;
pub struct JiaeHomework {
index: usize,
value: i32,
}
fn stdinln_i32() -> i32 {
// 이 함수는 하나의 줄을 stdin으로 받아 단 하나의 integer를 리턴합니다.
let mut buffer = String::new();
std::io::stdin().read_line(&mut buffer).expect("Failed to read stdin.");
buffer.trim().parse::<i32>().unwrap()
}
fn stdinln_vec_i32() -> ... | identifier_body | ||
main.rs | use std::io;
pub struct JiaeHomework {
index: usize,
value: i32,
}
fn stdinln_i32() -> i32 {
// 이 함수는 하나의 줄을 stdin으로 받아 단 하나의 integer를 리턴합니다.
let mut buffer = String::new();
std::io::stdin().read_line(&mut buffer).expect("Failed to read stdin.");
buffer.trim().parse::<i32>().unwrap()
}
fn stdinln_vec_i32() -> ... | ;
}
let avg = sum/nr_items as i32;
// Rust 2018에서는 (source[0]-avg).abs() 를 해도 되나.
// 현재 구름은 rustc 2017년대 버젼을 쓰고있다. 따라서 이와같이 해결한다.
// i32::abs(...)
let mut near_gap = i32::abs(source[0]-avg);
for i in 1..nr_items {
let current_gap = i32::abs(source[i]-avg);
if current_gap < near_gap {
self.index ... | ce[i] | identifier_name |
main.rs | use std::io;
pub struct JiaeHomework {
index: usize,
value: i32,
}
fn stdinln_i32() -> i32 {
// 이 함수는 하나의 줄을 stdin으로 받아 단 하나의 integer를 리턴합니다.
let mut buffer = String::new();
std::io::stdin().read_line(&mut buffer).expect("Failed to read stdin.");
buffer.trim().parse::<i32>().unwrap()
}
fn stdinln_vec_i32() -> ... | .collect();
ret
}
/*
이번 문제는 Method 스타일로 풀어봅시다.!
https://doc.rust-lang.org/rust-by-example/fn/methods.html
이번 문제는 Rust-Ownership 문제가 야기될 수 있습니다. 한번 읽어보세요.
https://rinthel.github.io/rust-lang-book-ko/ch04-02-references-and-borrowing.html
*/
impl JiaeHomework {
fn new() -> JiaeHomework {
JiaeHomework{index:0, v... | // 이 함수는 하나의 줄을 stdin으로 받아 여러개의 integer 을 vector로 리턴합니다.
let mut buffer = String::new();
std::io::stdin().read_line(&mut buffer).expect("Failed to read line");
let ret: Vec<i32> = buffer.split(" ")
.map(|x| x.trim().parse().expect("Unexpected Integer Pattern")) | random_line_split |
player.rs | use diesel::prelude::*;
use diesel::pg::PgConnection;
use video::Video;
use room::Room;
use std::{thread, time};
use schema;
use std::time::SystemTime;
use std::collections::HashMap;
use std::sync::Mutex;
use establish_connection;
lazy_static! {
static ref PLAYLIST_THREADS: Mutex<HashMap<i64, VideoStatus>> = Mute... |
pub fn stop_playing(room: &Room) {
PLAYLIST_THREADS.lock().unwrap().remove(&room.id);
}
// Returns a duration string as seconds
// EG: "PT1H10M10S" -> 4210
pub fn duration_to_seconds(duration: &str) -> u64 {
let v: Vec<&str> = duration.split(|c: char| !c.is_numeric()).collect();
let mut index: u32 = 0;
... | {
let mut hashmap = PLAYLIST_THREADS.lock().unwrap();
if !hashmap.contains_key(&room.id) {
hashmap.insert(room.id, VideoStatus::Play);
play_video_thread(room);
}
} | identifier_body |
player.rs | use diesel::prelude::*;
use diesel::pg::PgConnection;
use video::Video;
use room::Room;
use std::{thread, time};
use schema;
use std::time::SystemTime;
use std::collections::HashMap;
use std::sync::Mutex;
use establish_connection;
lazy_static! {
static ref PLAYLIST_THREADS: Mutex<HashMap<i64, VideoStatus>> = Mute... | {
Play,
Skip,
}
/// Fetches the current video from the playlist and waits for the duration of the video
/// Afterwards it updates the database and marks the video as played.
pub fn play_current_video(conn: &PgConnection, room: &Room) -> bool {
use self::schema::videos::dsl::*;
let video = Video::belo... | VideoStatus | identifier_name |
player.rs | use diesel::prelude::*;
use diesel::pg::PgConnection;
use video::Video;
use room::Room;
use std::{thread, time};
use schema;
use std::time::SystemTime;
use std::collections::HashMap;
use std::sync::Mutex;
use establish_connection;
|
enum VideoStatus {
Play,
Skip,
}
/// Fetches the current video from the playlist and waits for the duration of the video
/// Afterwards it updates the database and marks the video as played.
pub fn play_current_video(conn: &PgConnection, room: &Room) -> bool {
use self::schema::videos::dsl::*;
let vi... | lazy_static! {
static ref PLAYLIST_THREADS: Mutex<HashMap<i64, VideoStatus>> = Mutex::new(HashMap::new());
} | random_line_split |
player.rs | use diesel::prelude::*;
use diesel::pg::PgConnection;
use video::Video;
use room::Room;
use std::{thread, time};
use schema;
use std::time::SystemTime;
use std::collections::HashMap;
use std::sync::Mutex;
use establish_connection;
lazy_static! {
static ref PLAYLIST_THREADS: Mutex<HashMap<i64, VideoStatus>> = Mute... |
None => {
PLAYLIST_THREADS
.lock()
.unwrap()
.insert(room.id, VideoStatus::Play);
}
}
// Check if the video has ran out of time
... | {
playing = handle_video_event(status);
} | conditional_block |
statement.ts | import { Month } from '../core/month';
import { Balance } from '../core/balance';
// Abstraction for a financial statement for a period of time.
export abstract class Statement {
name: string;
// Period of time for the statement
month: Month;
// Recorded start balance for the statement.
startBalance?: Bala... | return endAmount - startAmount;
}
get percentChange(): number | undefined {
const startAmount = this.startBalance?.amount;
const change = this.change;
return change && startAmount && (100 * change) / startAmount;
}
get unaccounted(): number | undefined {
const change = this.change;
ret... | const endAmount = this.endBalance?.amount;
if (endAmount === undefined) return undefined; | random_line_split |
statement.ts | import { Month } from '../core/month';
import { Balance } from '../core/balance';
// Abstraction for a financial statement for a period of time.
export abstract class Statement {
name: string;
// Period of time for the statement
month: Month;
// Recorded start balance for the statement.
startBalance?: Bala... |
addOutFlow(outFlow: number): void {
if (outFlow > 0) {
this.inFlows += outFlow;
} else {
this.outFlows += outFlow;
}
}
}
| {
if (inFlow > 0) {
this.inFlows += inFlow;
} else {
this.outFlows += inFlow;
}
} | identifier_body |
statement.ts | import { Month } from '../core/month';
import { Balance } from '../core/balance';
// Abstraction for a financial statement for a period of time.
export abstract class Statement {
name: string;
// Period of time for the statement
month: Month;
// Recorded start balance for the statement.
startBalance?: Bala... |
}
addOutFlow(outFlow: number): void {
if (outFlow > 0) {
this.inFlows += outFlow;
} else {
this.outFlows += outFlow;
}
}
}
| {
this.outFlows += inFlow;
} | conditional_block |
statement.ts | import { Month } from '../core/month';
import { Balance } from '../core/balance';
// Abstraction for a financial statement for a period of time.
export abstract class Statement {
name: string;
// Period of time for the statement
month: Month;
// Recorded start balance for the statement.
startBalance?: Bala... | (): number | undefined {
const change = this.change;
return change !== undefined ? change - this.addSub : undefined;
}
abstract get isClosed(): boolean;
addInFlow(inFlow: number): void {
if (inFlow > 0) {
this.inFlows += inFlow;
} else {
this.outFlows += inFlow;
}
}
addOutFl... | unaccounted | identifier_name |
issue_3979_traits.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | (&mut self, dx: int) {
let x = self.X() + dx;
self.SetX(x);
}
}
| translate | identifier_name |
issue_3979_traits.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
}
| {
let x = self.X() + dx;
self.SetX(x);
} | identifier_body |
issue_3979_traits.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | self.SetX(x);
}
} | random_line_split | |
test_bokeh_model.py | import argparse
import importlib
import inspect
import os
import sys
import traceback
from bokeh.plotting import output_file, show
from fabulous.color import bold, red
from app import create_app
def error(msg, stacktrace=None):
|
# get command line arguments
parser = argparse.ArgumentParser(description='Test a Bokeh model.')
parser.add_argument('module_file',
type=str,
help='Python file containing the Bokeh model')
parser.add_argument('model_function',
type=str,
h... | """Print an error message and exit.
Params:
-------
msg: str
Error message.
stacktrace: str
Stacktrace.
"""
if stacktrace:
print(stacktrace)
print(bold(red(msg)))
sys.exit(1) | identifier_body |
test_bokeh_model.py | import argparse
import importlib
import inspect
import os
import sys
import traceback
|
from app import create_app
def error(msg, stacktrace=None):
"""Print an error message and exit.
Params:
-------
msg: str
Error message.
stacktrace: str
Stacktrace.
"""
if stacktrace:
print(stacktrace)
print(bold(red(msg)))
sys.exit(1)
# get command line ... | from bokeh.plotting import output_file, show
from fabulous.color import bold, red | random_line_split |
test_bokeh_model.py | import argparse
import importlib
import inspect
import os
import sys
import traceback
from bokeh.plotting import output_file, show
from fabulous.color import bold, red
from app import create_app
def | (msg, stacktrace=None):
"""Print an error message and exit.
Params:
-------
msg: str
Error message.
stacktrace: str
Stacktrace.
"""
if stacktrace:
print(stacktrace)
print(bold(red(msg)))
sys.exit(1)
# get command line arguments
parser = argparse.ArgumentPar... | error | identifier_name |
test_bokeh_model.py | import argparse
import importlib
import inspect
import os
import sys
import traceback
from bokeh.plotting import output_file, show
from fabulous.color import bold, red
from app import create_app
def error(msg, stacktrace=None):
"""Print an error message and exit.
Params:
-------
msg: str
Er... |
print(bold(red(msg)))
sys.exit(1)
# get command line arguments
parser = argparse.ArgumentParser(description='Test a Bokeh model.')
parser.add_argument('module_file',
type=str,
help='Python file containing the Bokeh model')
parser.add_argument('model_function',
... | print(stacktrace) | conditional_block |
Dropdown.tsx | import classNames from 'classnames';
import PropTypes from 'prop-types';
import * as React from 'react';
import { useContext, useMemo } from 'react';
import BaseDropdown, {
DropdownProps as BaseDropdownProps,
ToggleMetadata,
} from '@restart/ui/Dropdown';
import { useUncontrolled } from 'uncontrollable';
import use... | *
* ```js
* (eventKey: any, event: Object) => any
* ```
*/
onSelect: PropTypes.func,
/**
* Controls the focus behavior for when the Dropdown is opened. Set to
* `true` to always focus the first menu item, `keyboard` to focus only when
* navigating via the keyboard, or `false` to disable com... | * A callback fired when a menu item is selected. | random_line_split |
ext-lang-fi.js | /*
* Ext JS Library 2.3.0
* Copyright(c) 2006-2009, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
/**
* Finnish Translations
* <tuomas.salo (at) iki.fi>
* 'ä' should read as lowercase 'a' with two dots on top (ä)
*/
Ext.UpdateManager.defaults.indicatorText = '<div class="l... | teFormat : "j.m.Y"
});
}
if(Ext.layout.BorderLayout && Ext.layout.BorderLayout.SplitRegion){
Ext.apply(Ext.layout.BorderLayout.SplitRegion.prototype, {
splitTip : "Muuta kokoa vetämällä.",
collapsibleSplitTip : "Muuta kokoa vetämällä. Piilota kaksoisklikkauksella."
});
}
| ,
showGroupsText : 'Näytä ryhmissä'
});
}
if(Ext.grid.PropertyColumnModel){
Ext.apply(Ext.grid.PropertyColumnModel.prototype, {
nameText : "Nimi",
valueText : "Arvo",
da | conditional_block |
ext-lang-fi.js | /*
* Ext JS Library 2.3.0
* Copyright(c) 2006-2009, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
/**
* Finnish Translations
* <tuomas.salo (at) iki.fi>
* 'ä' should read as lowercase 'a' with two dots on top (ä)
*/
Ext.UpdateManager.defaults.indicatorText = '<div class="l... | text: 'Vaihda valitun tekstin väriä.',
cls: 'x-html-editor-tip'
},
justifyleft : {
title: 'Tasaa vasemmalle',
text: 'Tasaa teksti vasempaan reunaan.',
cls: 'x-html-editor-tip'
},
justifycenter : {
title: 'Keskitä',
text: 'Keskitä teksti.',
... | cls: 'x-html-editor-tip'
},
forecolor : {
title: 'Tekstin väri', | random_line_split |
dstr-dflt-obj-ptrn-id-get-value-err.js | // This file was procedurally generated from the following sources:
// - src/dstr-binding/obj-ptrn-id-get-value-err.case
// - src/dstr-binding/error/gen-func-decl-dflt.template
/*---
description: Error thrown when accessing the corresponding property of the value object (generator function declaration (default paramete... | es6id: 14.4.12
features: [generators, destructuring-binding, default-parameters]
flags: [generated]
info: |
GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
[...]
2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
GeneratorBody, scope, strict).
... | esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject | random_line_split |
rpc_txoutproof.py | #!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test gettxoutproof and verifytxoutproof RPCs."""
from test_framework.messages import CMerkleBlock, Fro... |
def run_test(self):
miniwallet = MiniWallet(self.nodes[0])
# Add enough mature utxos to the wallet, so that all txs spend confirmed coins
miniwallet.generate(5)
self.nodes[0].generate(100)
self.sync_all()
chain_height = self.nodes[1].getblockcount()
assert_... | self.num_nodes = 2
self.setup_clean_chain = True
self.extra_args = [
[],
["-txindex"],
] | identifier_body |
rpc_txoutproof.py | #!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test gettxoutproof and verifytxoutproof RPCs."""
from test_framework.messages import CMerkleBlock, Fro... | (self):
self.num_nodes = 2
self.setup_clean_chain = True
self.extra_args = [
[],
["-txindex"],
]
def run_test(self):
miniwallet = MiniWallet(self.nodes[0])
# Add enough mature utxos to the wallet, so that all txs spend confirmed coins
... | set_test_params | identifier_name |
rpc_txoutproof.py | #!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test gettxoutproof and verifytxoutproof RPCs."""
from test_framework.messages import CMerkleBlock, Fro... | MerkleBlockTest().main() | conditional_block | |
rpc_txoutproof.py | #!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test gettxoutproof and verifytxoutproof RPCs."""
from test_framework.messages import CMerkleBlock, Fro... | miniwallet = MiniWallet(self.nodes[0])
# Add enough mature utxos to the wallet, so that all txs spend confirmed coins
miniwallet.generate(5)
self.nodes[0].generate(100)
self.sync_all()
chain_height = self.nodes[1].getblockcount()
assert_equal(chain_height, 105)
... |
def run_test(self): | random_line_split |
blob_records.rs | // Copyright 2021 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under The General Public License (GPL), version 3.
// Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed
// under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTI... | correlation_id,
&src,
response.is_success(),
) {
// If a full adult responds with error. Drop the response
if !response.is_success() && self.capacity.is_full(&src).await {
// We've already responded already with a success
... | }
let mut duties = vec![];
if let Some((_address, end_user)) = self.adult_liveness.record_adult_read_liveness( | random_line_split |
blob_records.rs | // Copyright 2021 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under The General Public License (GPL), version 3.
// Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed
// under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTI... | (&mut self, node_id: PublicKey) {
info!(
"No. of full Adults: {:?}",
self.capacity.full_adults_count().await
);
info!("Increasing full Adults count");
self.capacity
.insert_full_adults(btree_set!(XorName::from(node_id)))
.await;
}
... | increase_full_node_count | identifier_name |
blob_records.rs | // Copyright 2021 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under The General Public License (GPL), version 3.
// Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed
// under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTI... |
pub async fn record_adult_read_liveness(
&mut self,
correlation_id: MessageId,
response: QueryResponse,
src: XorName,
) -> Result<NodeDuties> {
if !matches!(response, QueryResponse::GetBlob(_)) {
return Err(Error::Logic(format!(
"Got {:?}, bu... | {
if let Err(error) = validate_data_owner(&data, &client_signed.public_key) {
return self.send_error(error, msg_id, origin).await;
}
self.send_chunks_to_adults(data, msg_id, client_signed, origin)
.await
} | identifier_body |
fmt.rs | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
//! Handles nested padding in `Debug::fmt` output.
//!
//! `PadAdapter` is taken from rustc:
//! https://github.com/rust-lang/rust/commit/e... |
};
self.fmt.write_str(&s[..split])?;
s = &s[split..];
}
Ok(())
}
}
/// Write Debug output with alternative form considered.
pub fn write_debug(formatter: &mut fmt::Formatter, value: impl fmt::Debug) -> fmt::Result {
if formatter.alternate() {
let mu... | {
self.on_newline = false;
s.len()
} | conditional_block |
fmt.rs | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
//! Handles nested padding in `Debug::fmt` output.
//!
//! `PadAdapter` is taken from rustc:
//! https://github.com/rust-lang/rust/commit/e... | fn new(fmt: &'a mut fmt::Formatter<'b>) -> PadAdapter<'a, 'b> {
PadAdapter {
fmt,
on_newline: false,
}
}
}
impl<'a, 'b: 'a> fmt::Write for PadAdapter<'a, 'b> {
fn write_str(&mut self, mut s: &str) -> fmt::Result {
while !s.is_empty() {
if self.on_... | random_line_split | |
fmt.rs | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
//! Handles nested padding in `Debug::fmt` output.
//!
//! `PadAdapter` is taken from rustc:
//! https://github.com/rust-lang/rust/commit/e... |
}
/// Write Debug output with alternative form considered.
pub fn write_debug(formatter: &mut fmt::Formatter, value: impl fmt::Debug) -> fmt::Result {
if formatter.alternate() {
let mut writer = PadAdapter::new(formatter);
fmt::write(&mut writer, format_args!("\n{:#?}", value))
} else {
... | {
while !s.is_empty() {
if self.on_newline {
self.fmt.write_str(" ")?;
}
let split = match s.find('\n') {
Some(pos) => {
self.on_newline = true;
pos + 1
}
None => {
... | identifier_body |
fmt.rs | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
//! Handles nested padding in `Debug::fmt` output.
//!
//! `PadAdapter` is taken from rustc:
//! https://github.com/rust-lang/rust/commit/e... | <'a, 'b: 'a> {
fmt: &'a mut fmt::Formatter<'b>,
on_newline: bool,
}
impl<'a, 'b: 'a> PadAdapter<'a, 'b> {
fn new(fmt: &'a mut fmt::Formatter<'b>) -> PadAdapter<'a, 'b> {
PadAdapter {
fmt,
on_newline: false,
}
}
}
impl<'a, 'b: 'a> fmt::Write for PadAdapter<'a, 'b... | PadAdapter | identifier_name |
constants.py | ## This file is part of PyGaze - the open-source toolbox for eye tracking
##
## PyGaze is a Python module for easily creating gaze contingent experiments
## or other software (as well as non-gaze contingent experiments/software)
## Copyright (C) 2012-2013 Edwin S. Dalmaijer
##
## This program is free... | # MAIN
DUMMYMODE = True # False for gaze contingent display, True for dummy mode (using mouse or joystick)
LOGFILENAME = 'default' # logfilename, without path
LOGFILE = LOGFILENAME[:] # .txt; adding path before logfilename is optional; logs responses (NOT eye movements, these are stored in an EDF file!)
TRIALS = 5
... | # version: 0.4 (25-03-2013)
| random_line_split |
array1esmee.py | >>> couses = ['Photography', 'Design Philosophy', 'Media Theory', 'Design Research', 'Digital Media', 'Computer Skills', 'Graphic Design', 'Typography']
>>> print len(couses)
8
>>> couses.append(Media Theory lecture series)
File "<stdin>", line 1
couses.append(Media Theory lecture series)
... | IndexError: pop index out of range
>>> couses.pop()9
File "<stdin>", line 1
couses.pop()9
^
SyntaxError: invalid syntax
>>> couses.pop(9)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: pop index out of range
>>> len(couses)
9 | Traceback (most recent call last):
File "<stdin>", line 1, in <module> | random_line_split |
actions.ts | /*
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
* License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
*/
/*
Actions involving configuration of the course.
*/
import { webapp_client } from "../../webapp-client";
import { SiteLicenseStrategy, SyncDBRecord, UpgradeGoal } from "../ty... | import { reuseInFlight } from "async-await-utils/hof";
import {
SoftwareEnvironmentState,
derive_project_img_name,
} from "../../custom-software/selector";
import { Datastore, EnvVars } from "../../projects/actions";
import { StudentProjectFunctionality } from "./customize-student-project-functionality";
import { D... | import { redux } from "../../app-framework"; | random_line_split |
actions.ts | /*
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
* License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
*/
/*
Actions involving configuration of the course.
*/
import { webapp_client } from "../../webapp-client";
import { SiteLicenseStrategy, SyncDBRecord, UpgradeGoal } from "../ty... | public async configure_host_project(): Promise<void> {
const id = this.course_actions.set_activity({
desc: "Configuring host project.",
});
try {
// NOTE: we never remove it or any other licenses from the host project,
// since instructor may want to augment license with another license.
... | if (typeof pay != "string") {
pay = pay.toISOString();
}
this.set({
pay,
table: "settings",
});
await this.course_actions.student_projects.set_all_student_project_course_info(
pay
);
}
| identifier_body |
actions.ts | /*
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
* License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
*/
/*
Actions involving configuration of the course.
*/
import { webapp_client } from "../../webapp-client";
import { SiteLicenseStrategy, SyncDBRecord, UpgradeGoal } from "../ty... | // we also make sure all teachers have access to that project – otherwise NBGrader can't work, etc.
// this has to happen *after* setting the course field, extended access control, ...
const ps = redux.getStore("projects");
const teachers = ps.get_users(store.get("course_project_id"));
cons... | await projects_actions.set_project_course_info(
project_id,
store.get("course_project_id"),
store.get("course_filename"),
"", // pay
null, // account_id
null, // email_address
datastore,
"nbgrader", // type of project
undef... | conditional_block |
actions.ts | /*
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
* License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
*/
/*
Actions involving configuration of the course.
*/
import { webapp_client } from "../../webapp-client";
import { SiteLicenseStrategy, SyncDBRecord, UpgradeGoal } from "../ty... | this.course_actions.student_projects.configure_all_projects();
this.course_actions.shared_project.set_datastore_and_envvars();
// in case there is a separate nbgrader project, we have to set the envvars as well
this.configure_nbgrader_grade_project();
}
public purgeDeleted(): void {
const { syncd... | re_all_projects_shared_and_nbgrader() {
| identifier_name |
deque.rs | // Copyright 2013 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 ... |
}
| {
static AMT: int = 10000;
static NTHREADS: int = 4;
static mut DONE: AtomicBool = INIT_ATOMIC_BOOL;
let mut pool = BufferPool::<(int, uint)>::new();
let (mut w, s) = pool.deque();
let (threads, hits) = vec::unzip(range(0, NTHREADS).map(|_| {
let s = s.clone(... | identifier_body |
deque.rs | // Copyright 2013 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 ... |
// XXX: all atomic operations in this module use a SeqCst ordering. That is
// probably overkill
use cast;
use clone::Clone;
use iter::range;
use kinds::Send;
use libc;
use mem;
use ops::Drop;
use option::{Option, Some, None};
use ptr;
use unstable::atomics::{AtomicInt, AtomicPtr, SeqCst};
use unstable::sync::{U... | // NB: the "buffer pool" strategy is not done for speed, but rather for
// correctness. For more info, see the comment on `swap_buffer` | random_line_split |
deque.rs | // Copyright 2013 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 ... | (&self, b: int, t: int, delta: int) -> Buffer<T> {
let mut buf = Buffer::new(self.log_size + delta);
for i in range(t, b) {
buf.put(i, self.get(i));
}
return buf;
}
}
#[unsafe_destructor]
impl<T: Send> Drop for Buffer<T> {
fn drop(&mut self) {
// It is assume... | resize | identifier_name |
deque.rs | // Copyright 2013 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 ... | else {
cast::forget(data); // someone else stole this value
Abort
}
}
unsafe fn maybe_shrink(&mut self, b: int, t: int) {
let a = self.array.load(SeqCst);
if b - t < (*a).size() / K && b - t > (1 << MIN_BITS) {
self.swap_buffer(b, a, (*a).resize(b, t... | {
Data(data)
} | conditional_block |
pngjs-tests.ts | import { PNG } from 'pngjs';
import { createDeflate } from 'zlib';
import fs = require('fs');
const pngs = [
new PNG(),
new PNG({}),
new PNG({ width: 1 }),
new PNG({ checkCRC: false }),
new PNG({ deflateChunkSize: 3 }),
new PNG({
bitDepth: 8,
checkCRC: true,
colorType: 4... |
png.width === 1;
png.height === 1;
png.gamma === 1;
png.adjustGamma();
png.bitblt(pngs[1]);
png.bitblt(pngs[1], 1);
png.bitblt(pngs[1], 1, 1);
png.bitblt(pngs[1], 1, 1, 1, 1, 1, 1);
png.on('metadata', metadata => {
metadata.bpp === 1;
});
png.on('metadata', function(metadata) {
this; // $ExpectType PNG
t... | {
console.log('writable');
} | conditional_block |
pngjs-tests.ts | import { PNG } from 'pngjs';
import { createDeflate } from 'zlib';
import fs = require('fs');
const pngs = [
new PNG(),
new PNG({}),
new PNG({ width: 1 }),
new PNG({ checkCRC: false }),
new PNG({ deflateChunkSize: 3 }),
new PNG({
bitDepth: 8,
checkCRC: true,
colorType: 4... | data.adjustGamma();
}).adjustGamma();
PNG.adjustGamma(png);
PNG.bitblt(png, pngs[1]);
PNG.bitblt(png, pngs[1], 1, 1, 1, 1, 1, 1);
const pngWithMeta = PNG.sync.read(Buffer.from('foo'));
!pngWithMeta.alpha;
pngWithMeta.bpp === 1;
!pngWithMeta.color;
pngWithMeta.colorType === 0;
pngWithMeta.depth === 1;
pngWithMeta... | png.parse('foo', (error, data) => {
error.stack; | random_line_split |
show_off.rs |
use data_type::data_type::Data;
pub struct ShowOff;
impl ShowOff {
pub fn | (host: &str, data: Data) -> String {
"".to_string()
// html!{
// link rel="stylesheet" type="text/css"
// href={"http://" (host) "/style/style.css"} /
//
// div.gallery {
// @for image in &data.data {
// a.super-item href=... | get_page | identifier_name |
show_off.rs |
use data_type::data_type::Data;
pub struct ShowOff;
impl ShowOff {
pub fn get_page(host: &str, data: Data) -> String | }
| {
"".to_string()
// html!{
// link rel="stylesheet" type="text/css"
// href={"http://" (host) "/style/style.css"} /
//
// div.gallery {
// @for image in &data.data {
// a.super-item href={"http://" (host) "/" (&image.id)} ... | identifier_body |
show_off.rs | use data_type::data_type::Data;
pub struct ShowOff;
impl ShowOff {
pub fn get_page(host: &str, data: Data) -> String {
"".to_string()
// html!{ | // href={"http://" (host) "/style/style.css"} /
//
// div.gallery {
// @for image in &data.data {
// a.super-item href={"http://" (host) "/" (&image.id)} id={(&image.id)}{
// img.item.lazy data-original={"http://" (host) ... | // link rel="stylesheet" type="text/css" | random_line_split |
empty.rs | use consumer::*;
use parallel_stream::*;
use stream::*;
/// A [`Stream`](./trait.Stream.html) that do not emits any element.
///
/// # Examples
///
/// ```
/// use asyncplify::*;
///
/// let mut count = 0;
///
/// Empty
/// .inspect(|_| count += 1)
/// .subscribe();
///
/// assert!(count == 0, "count = {}", co... |
/// A [`ParallelStream`](./trait.ParallelStream.html) that do not emits any element.
///
/// # Examples
///
/// ```
/// use asyncplify::*;
/// use std::sync::atomic::{AtomicBool, Ordering};
/// use std::sync::Arc;
///
/// let found = Arc::new(AtomicBool::new(false));
///
/// ParallelEmpty
/// .inspect(|_| found.st... | } | random_line_split |
empty.rs | use consumer::*;
use parallel_stream::*;
use stream::*;
/// A [`Stream`](./trait.Stream.html) that do not emits any element.
///
/// # Examples
///
/// ```
/// use asyncplify::*;
///
/// let mut count = 0;
///
/// Empty
/// .inspect(|_| count += 1)
/// .subscribe();
///
/// assert!(count == 0, "count = {}", co... | ;
impl ParallelStream for ParallelEmpty {
type Item = ();
fn consume<C: ParallelConsumer<()>>(self, _: C) {}
}
| ParallelEmpty | identifier_name |
empty.rs | use consumer::*;
use parallel_stream::*;
use stream::*;
/// A [`Stream`](./trait.Stream.html) that do not emits any element.
///
/// # Examples
///
/// ```
/// use asyncplify::*;
///
/// let mut count = 0;
///
/// Empty
/// .inspect(|_| count += 1)
/// .subscribe();
///
/// assert!(count == 0, "count = {}", co... |
}
| {} | identifier_body |
LegacyInput.js | /**
* LegacyInput.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
tinymce.onAddEditor.add(function(tinymce, ed) {
var filters, fontSizes, dom, settings = ed.settings;
if ... | ;
filters = {
font : function(dom, node) {
replaceWithSpan(node, {
backgroundColor : node.style.backgroundColor,
color : node.color,
fontFamily : node.face,
fontSize : fontSizes[parseInt(node.size) - 1]
});
},
u : function(dom, node) {
replaceWithSpan(node, {
textDecora... | {
tinymce.each(styles, function(value, name) {
if (value)
dom.setStyle(node, name, value);
});
dom.rename(node, 'span');
} | identifier_body |
LegacyInput.js | /**
* LegacyInput.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
tinymce.onAddEditor.add(function(tinymce, ed) {
var filters, fontSizes, dom, settings = ed.settings;
if ... | (editor, params) {
dom = editor.dom;
if (settings.convert_fonts_to_spans) {
tinymce.each(dom.select('font,u,strike', params.node), function(node) {
filters[node.nodeName.toLowerCase()](ed.dom, node);
});
}
};
ed.onPreProcess.add(convert);
ed.onSetContent.add(convert);
ed.onInit.add(func... | convert | identifier_name |
LegacyInput.js | /**
* LegacyInput.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
tinymce.onAddEditor.add(function(tinymce, ed) {
var filters, fontSizes, dom, settings = ed.settings;
if ... |
};
ed.onPreProcess.add(convert);
ed.onSetContent.add(convert);
ed.onInit.add(function() {
ed.selection.onSetContent.add(convert);
});
}
});
| {
tinymce.each(dom.select('font,u,strike', params.node), function(node) {
filters[node.nodeName.toLowerCase()](ed.dom, node);
});
} | conditional_block |
LegacyInput.js | /**
* LegacyInput.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
tinymce.onAddEditor.add(function(tinymce, ed) {
var filters, fontSizes, dom, settings = ed.settings;
if ... | replaceWithSpan(node, {
backgroundColor : node.style.backgroundColor,
color : node.color,
fontFamily : node.face,
fontSize : fontSizes[parseInt(node.size) - 1]
});
},
u : function(dom, node) {
replaceWithSpan(node, {
textDecoration : 'underline'
});
},
strike : fun... | dom.rename(node, 'span');
};
filters = {
font : function(dom, node) { | random_line_split |
conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# uFlash documentation build configuration file, created by
# sphinx-quickstart on Thu Dec 17 19:01:47 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# aut... | # html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
# html_sidebars = {}
# Additional templates that should be rendered to pages, ... | random_line_split | |
reexported_static_methods.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | impl Bort {
pub fn bort() -> String {
"bort()".to_string()
}
}
} | random_line_split | |
reexported_static_methods.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | {
unused_str: String
}
impl Boz {
pub fn boz(i: int) -> bool {
i > 0
}
}
pub enum Bort {
Bort1,
Bort2
}
impl Bort {
pub fn bort() -> String {
"bort()".to_string()
}
}
}
| Boz | identifier_name |
reexported_static_methods.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
}
pub mod sub_foo {
pub trait Foo {
fn foo() -> Self;
}
impl Foo for int {
fn foo() -> int { 42 }
}
pub struct Boz {
unused_str: String
}
impl Boz {
pub fn boz(i: int) -> bool {
i > 0
}
}
pub enum Bort {
Bort1,
... | { 84 } | identifier_body |
example2.rs | #[feature(link_args)];
extern crate cairo;
#[link_args = "-L /Users/Jens/.homebrew/lib"]
extern {}
fn | () {
use cairo;
use cairo::surface;
use cairo::surface::Surface;
let (width, height) = (500.0, 500.0);
let mut s = Surface::create_image(surface::format::ARGB32, width as i32, height as i32);
let mut cairo = cairo::Cairo::create(&mut s);
cairo.save();
cairo.set_source_rgb(0.3, 0.3, 1.0);
cairo.pain... | main | identifier_name |
example2.rs | #[feature(link_args)];
extern crate cairo;
#[link_args = "-L /Users/Jens/.homebrew/lib"]
extern {}
fn main() | {
use cairo;
use cairo::surface;
use cairo::surface::Surface;
let (width, height) = (500.0, 500.0);
let mut s = Surface::create_image(surface::format::ARGB32, width as i32, height as i32);
let mut cairo = cairo::Cairo::create(&mut s);
cairo.save();
cairo.set_source_rgb(0.3, 0.3, 1.0);
cairo.paint()... | identifier_body | |
example2.rs | #[feature(link_args)];
extern crate cairo;
#[link_args = "-L /Users/Jens/.homebrew/lib"]
extern {}
fn main() {
use cairo;
use cairo::surface;
use cairo::surface::Surface;
let (width, height) = (500.0, 500.0); |
let mut cairo = cairo::Cairo::create(&mut s);
cairo.save();
cairo.set_source_rgb(0.3, 0.3, 1.0);
cairo.paint();
cairo.restore();
cairo.move_to(0.0, 0.0);
cairo.line_to(2.0 * width / 6.0, 2.0 * height / 6.0);
cairo.line_to(3.0 * width / 6.0, 1.0 * height / 6.0);
cairo.line_to(4.0 * width / 6.0, 2.0 ... | let mut s = Surface::create_image(surface::format::ARGB32, width as i32, height as i32); | random_line_split |
RegisterClient.js | const React = require('react')
const moment = require('moment')
const agent = require('../agent')
import {Link} from 'react-router'
import {Row, Col} from 'react-bootstrap'
import ClientForm from './ClientForm'
import _ from 'underscore'
class RegisterClient extends React.Component {
constructor (props, context) {
... | // noinspection JSUnusedLocalSymbols | random_line_split | |
RegisterClient.js | // noinspection JSUnusedLocalSymbols
const React = require('react')
const moment = require('moment')
const agent = require('../agent')
import {Link} from 'react-router'
import {Row, Col} from 'react-bootstrap'
import ClientForm from './ClientForm'
import _ from 'underscore'
class RegisterClient extends React.Component... | () {
const {query} = this.props.location
const state = this.state
return (
<div className='container'>
<Row>
<Col>
<h1>
<span>Register a New Client </span>
<small>
<span>or </span>
<Link to={{pathname: `/clients... | render | identifier_name |
RegisterClient.js | // noinspection JSUnusedLocalSymbols
const React = require('react')
const moment = require('moment')
const agent = require('../agent')
import {Link} from 'react-router'
import {Row, Col} from 'react-bootstrap'
import ClientForm from './ClientForm'
import _ from 'underscore'
class RegisterClient extends React.Component... |
}
RegisterClient.propTypes = {
location: React.PropTypes.object,
history: React.PropTypes.object,
router: React.PropTypes.object
}
export default RegisterClient
| {
const {query} = this.props.location
const state = this.state
return (
<div className='container'>
<Row>
<Col>
<h1>
<span>Register a New Client </span>
<small>
<span>or </span>
<Link to={{pathname: `/clients/loc... | identifier_body |
RegisterClient.js | // noinspection JSUnusedLocalSymbols
const React = require('react')
const moment = require('moment')
const agent = require('../agent')
import {Link} from 'react-router'
import {Row, Col} from 'react-bootstrap'
import ClientForm from './ClientForm'
import _ from 'underscore'
class RegisterClient extends React.Component... |
})
.catch((error) => {
console.error(error)
this.setState(client)
})
}
render () {
const {query} = this.props.location
const state = this.state
return (
<div className='container'>
<Row>
<Col>
<h1>
<span>Register a New Client </s... | {
this.props.router.push({
pathname: `${this.props.location.query.returnTo}/${body.id}`
})
} | conditional_block |
aboutbox.js | //Application description box
AnnoJ.AboutBox = (function()
{
var info = {
//logo : "<a href='http://www.annoj.org'><img src='http://neomorph.salk.edu/epigenome/img/Anno-J.jpg' alt='Anno-J logo' /></a>",
logo : "",
version : 'Beta 1.1',
engineer : 'Julian Tonti-Filippini',
contact : 'tontij01(a... | (c)
{
body.update(c + html);
};
return function()
{
AnnoJ.AboutBox.superclass.constructor.call(this, {
title : 'Citation',
iconCls : 'silk_user_comment',
border : false,
contentEl : body,
autoScroll : true
});
this.info = info;
this.addCitation = addCitation;
};
})();
// Ex... | addCitation | identifier_name |
aboutbox.js | //Application description box
AnnoJ.AboutBox = (function()
{
var info = {
//logo : "<a href='http://www.annoj.org'><img src='http://neomorph.salk.edu/epigenome/img/Anno-J.jpg' alt='Anno-J logo' /></a>",
logo : "",
version : 'Beta 1.1',
engineer : 'Julian Tonti-Filippini',
contact : 'tontij01(a... | ;
return function()
{
AnnoJ.AboutBox.superclass.constructor.call(this, {
title : 'Citation',
iconCls : 'silk_user_comment',
border : false,
contentEl : body,
autoScroll : true
});
this.info = info;
this.addCitation = addCitation;
};
})();
// Ext.extend(AnnoJ.AboutBox, Ext.Panel... | {
body.update(c + html);
} | identifier_body |
aboutbox.js | //Application description box
AnnoJ.AboutBox = (function()
{
var info = {
//logo : "<a href='http://www.annoj.org'><img src='http://neomorph.salk.edu/epigenome/img/Anno-J.jpg' alt='Anno-J logo' /></a>",
logo : "",
version : 'Beta 1.1',
engineer : 'Julian Tonti-Filippini',
contact : 'tontij01(a... | "<tr><td><div><b>License: </b></td><td>" + info.license +"</div></td></tr>" +
"<tr><td><div><b>Tutorial: </b></td><td>" + info.tutorial +"</div></td></tr>" +
"</table>"
;
body.addCls('AJ_aboutbox');
body.update(html);
function addCitation(c)
{
body.update(c + html);
};
return function()
{
... | "<tr><td><div><b>Version: </b></td><td>" + info.version +"</div></td></tr>" +
"<tr><td><div><b>Engineer: </b></td><td>" + info.engineer +"</div></td></tr>" +
"<tr><td><div><b>Contact: </b></td><td>" + info.contact +"</div></td></tr>" +
"<tr><td><div><b>Copyright: </b></td><td>" + info.copyright +"</di... | random_line_split |
__init__.py | # __init__.py - collection of Luxembourgian numbers
# coding: utf-8
#
# Copyright (C) 2012 Arthur de Jong
# | # version 2.1 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
... | # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either | random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.