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
mnist.py
loss_part = loss_part.mean() g = theano.grad(loss_part, w) w = w - learning_rate * (g - g_tilde + mu) return w w_tilde, scan_updates = theano.scan(fn=oneStep, outputs_info=param, n_steps=m) updates.update(scan_updates) updates[param] = w_tilde[-...
theano.pp(loss) grads = theano.grad(loss, params) n = data.shape[0] updates = OrderedDict() rng = T.shared_randomstreams.RandomStreams(seed=149) for param, grad in zip(params, grads): value = param.get_value(borrow=True) mu = grad / n def oneStep(w): ...
identifier_body
compare_the_triplets.py
#!/bin/python3 import sys def solve(a0, a1, a2, b0, b1, b2):
a0, a1, a2 = input().strip().split(' ') a0, a1, a2 = [int(a0), int(a1), int(a2)] b0, b1, b2 = input().strip().split(' ') b0, b1, b2 = [int(b0), int(b1), int(b2)] result = solve(a0, a1, a2, b0, b1, b2) print (" ".join(map(str, result)))
score = [0, 0] alist = [a0, a1, a2] blist = [b0, b1, b2] clist = zip(alist, blist) for pair in clist: if pair[0] > pair[1]: score[0] += 1 elif pair[0] < pair[1]: score[1] += 1 else: continue return score
identifier_body
compare_the_triplets.py
#!/bin/python3 import sys def solve(a0, a1, a2, b0, b1, b2): score = [0, 0] alist = [a0, a1, a2] blist = [b0, b1, b2] clist = zip(alist, blist) for pair in clist:
if pair[0] > pair[1]: score[0] += 1 elif pair[0] < pair[1]: score[1] += 1 else: continue return score a0, a1, a2 = input().strip().split(' ') a0, a1, a2 = [int(a0), int(a1), int(a2)] b0, b1, b2 = input().strip().split(' ') b0, b1, b2 = [int(b0), ...
random_line_split
compare_the_triplets.py
#!/bin/python3 import sys def
(a0, a1, a2, b0, b1, b2): score = [0, 0] alist = [a0, a1, a2] blist = [b0, b1, b2] clist = zip(alist, blist) for pair in clist: if pair[0] > pair[1]: score[0] += 1 elif pair[0] < pair[1]: score[1] += 1 else: continue return score ...
solve
identifier_name
compare_the_triplets.py
#!/bin/python3 import sys def solve(a0, a1, a2, b0, b1, b2): score = [0, 0] alist = [a0, a1, a2] blist = [b0, b1, b2] clist = zip(alist, blist) for pair in clist: if pair[0] > pair[1]: score[0] += 1 elif pair[0] < pair[1]:
else: continue return score a0, a1, a2 = input().strip().split(' ') a0, a1, a2 = [int(a0), int(a1), int(a2)] b0, b1, b2 = input().strip().split(' ') b0, b1, b2 = [int(b0), int(b1), int(b2)] result = solve(a0, a1, a2, b0, b1, b2) print (" ".join(map(str, result)))
score[1] += 1
conditional_block
customerService.js
//嘉福客服模块 var jfCustomerService = { init: function (service, token) {//初始化 if (!$("#MEIQIA-PANEL-HOLDER").length > 0) { var isIosProduct = 0; //判断是不是可能出现位移的页面 function jfServiceInit(visibility)...
j.async = true; j.charset = 'UTF-8'; j.src = '//static.meiqia.com/dist/meiqia.js'; s.parentNode.insertBefore(j, s); })(window, document, 'script', '_MEIQIA'); _MEIQIA('entId', '39750'); // 在这里开启手动模式(必须紧跟美洽的嵌入代码) ...
m[i] = m[i] || function () { (m[i].a = m[i].a || []).push(arguments) }; j = ei.createElement(q); s = ei.getElementsByTagName(q)[0];
random_line_split
customerService.js
//嘉福客服模块 var jfCustomerService = { init: function (service, token) {//初始化 if (!$("#MEIQIA-PANEL-HOLDER").length > 0) { var isIosProduct = 0; //判断是不是可能出现位移的页面 function jfServiceInit(visibili...
} , 300); if (isIosProduct) { //解决ios10的在详情页聊天移位问题。 $('html').addClass('ovfHiden'); $('body').addClass('ovfHiden'); ...
(isIosProduct) { //解决ios10的在详情页聊天移位问题。 $('html').removeClass('ovfHiden'); $('body').removeClass('ovfHiden') } $('#MEIQIA-PANEL-HOLDER').show().remov...
identifier_body
customerService.js
//嘉福客服模块 var jfCustomerService = { init: function (service, token) {//初始化 if (!$("#MEIQIA-PANEL-HOLDER").length > 0) { var isIosProduct = 0; //判断是不是可能出现位移的页面 function jfServiceInit(visibili...
if (visibility === 'visible') { if (isIosProduct) { //解决ios10的在详情页聊天移位问题。 $('html').removeClass('ovfHiden'); $('body').removeClass('ovfHiden') ...
isIosProduct = 1; $(document).scrollTop(0); } } function jfServiceSwitch(visibility) {
conditional_block
customerService.js
//嘉福客服模块 var jfCustomerService = { init: function (service, token) {//初始化 if (!$("#MEIQIA-PANEL-HOLDER").length > 0) { var isIosProduct = 0; //判断是不是可能出现位移的页面 function jfServiceInit(visibili...
if (isIosProduct) { //解决ios10的在详情页聊天移位问题。 $('html').removeClass('ovfHiden'); $('body').removeClass('ovfHiden') } $('#MEIQIA-PANEL-HOLDER')...
') {
identifier_name
ApplicationInstanceCertificate_schema.js
"use strict"; require("requirish")._(module); var factories = require("lib/misc/factories"); // OPC Unified Architecture, Part 4 page 106 var ApplicationInstanceCertificate_Schema = { // ApplicationInstanceCertificate with signature created by a Certificate Authority name: "ApplicationInstanceCertificate", ...
// The public key associated with the Certificate . { name: "publicKey", fieldType: "ByteString" }, // Specifies how the Certificate key may be used. // ApplicationInstanceCertificates shall support Digital Signature, Non-Repudiation // Key Encryption, Data Encryption and Client...
random_line_split
ueditor.config.js
高度(如果参数大于等于编辑器高度,则设置无效) //,toolbarTopOffset:400 //设置远程图片是否抓取到本地保存 //,catchRemoteImageEnable: true //设置是否抓取远程图片 //pageBreakTag //分页标识符,默认是_ueditor_page_break_tag_ //,pageBreakTag:'_ueditor_page_break_tag_' //autotypeset //自动排版参数 //,autotypeset: {...
identifier_body
ueditor.config.js
高度(如果参数大于等于编辑器高度,则设置无效) //,toolbarTopOffset:400 //设置远程图片是否抓取到本地保存 //,catchRemoteImageEnable: true //设置是否抓取远程图片 //pageBreakTag //分页标识符,默认是_ueditor_page_break_tag_ //,pageBreakTag:'_ueditor_page_break_tag_' //autotypeset //自动排版参数 //,autotypeset: {...
conditional_block
ueditor.config.js
高度(如果参数大于等于编辑器高度,则设置无效) //,toolbarTopOffset:400 //设置远程图片是否抓取到本地保存 //,catchRemoteImageEnable: true //设置是否抓取远程图片 //pageBreakTag //分页标识符,默认是_ueditor_page_break_tag_ //,pageBreakTag:'_ueditor_page_break_tag_' //autotypeset //自动排版参数 //,autotypeset: {...
identifier_name
ueditor.config.js
// { label:'',name:'andaleMono',val:'andale mono'}, // { label:'',name:'arial',val:'arial, helvetica,sans-serif'}, // { label:'',name:'arialBlack',val:'arial black,avant garde'}, // { label:'',name:'comicSansMs',val:'comic sans ms'}, // { label:'',name:'impact',val...
//iframeUrlMap //dialog内容的路径 ~会被替换成URL,垓属性一旦打开,将覆盖所有的dialog的默认路径
random_line_split
App.js
import React, { Component } from 'react'; import './App.css'; import Articles from './components/Articles'; class App extends Component {
(props) { super(props) this.state = {sortOrder: "VOTES"} } handleTopClick = () => { this.setState({sortOrder: "VOTES"}) } handleNewestClick = () => { this.setState({sortOrder: "DATE"}) } render() { const { articles } = this.props; const { sortOrder } = this.state; return ( ...
constructor
identifier_name
App.js
import React, { Component } from 'react'; import './App.css'; import Articles from './components/Articles'; class App extends Component { constructor(props) { super(props) this.state = {sortOrder: "VOTES"}
} handleNewestClick = () => { this.setState({sortOrder: "DATE"}) } render() { const { articles } = this.props; const { sortOrder } = this.state; return ( <div className="App"> <div className="navigation"> <button data-testid="top-link" onClick={this.handleTopClick}>Top...
} handleTopClick = () => { this.setState({sortOrder: "VOTES"})
random_line_split
trait-pointers.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 ...
trait Trait { fn method(&self) -> int { 0 } } struct Struct { a: int, b: f64 } impl Trait for Struct {} // There is no real test here yet. Just make sure that it compiles without crashing. fn main() { let stack_struct = Struct { a:0, b: 1.0 }; let reference: &Trait = &stack_struct as &Trait; ...
// debugger:run #[allow(unused_variable)];
random_line_split
trait-pointers.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 ...
{ a: int, b: f64 } impl Trait for Struct {} // There is no real test here yet. Just make sure that it compiles without crashing. fn main() { let stack_struct = Struct { a:0, b: 1.0 }; let reference: &Trait = &stack_struct as &Trait; let managed: @Trait = @Struct { a:2, b: 3.0 } as @Trait; let...
Struct
identifier_name
conf.py
'()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They ...
setup
identifier_name
conf.py
documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.napoleon', ] # Add any paths ...
#html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # do...
# The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation".
random_line_split
conf.py
# If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # out...
"""Execute the specified python code and insert the output into the document""" has_content = True def run(self): oldStdout, sys.stdout = sys.stdout, StringIO() tab_width = self.options.get('tab-width', self.state.document.settings.tab_width) source = self.state_machine.input_lines.sou...
identifier_body
core.py
import os import re import sys import json import shlex import logging import inspect import functools import importlib from pprint import pformat from collections import namedtuple from traceback import format_tb from requests.exceptions import RequestException import strutil from cachely.loader import Loader from ....
def load_libraries(extensions=None): if isinstance(extensions, str): extensions = [extensions] libs = BASE_LIBS + (extensions or []) for lib in libs: importlib.import_module(lib) class Interpreter: def __init__( self, contents=None, loader=None, us...
''' Takes the script source code, scans it, and lexes it into ``Instructions`` ''' for chars in code.splitlines(): lineno += 1 line = chars.rstrip() if not line or line.lstrip().startswith('#'): continue logger.debug('Lexed {} byte(s) line {}'.format(len(line...
identifier_body
core.py
import os import re import sys import json import shlex import logging import inspect import functools import importlib from pprint import pformat from collections import namedtuple from traceback import format_tb from requests.exceptions import RequestException import strutil from cachely.loader import Loader from ....
: def __init__( self, contents=None, loader=None, use_cache=False, do_pm=False, extensions=None ): self.use_cache = use_cache self.loader = loader if loader else Loader(use_cache=use_cache) self.contents = Contents(contents) self.d...
Interpreter
identifier_name
core.py
import os import re import sys import json import shlex import logging import inspect import functools import importlib from pprint import pformat from collections import namedtuple from traceback import format_tb from requests.exceptions import RequestException import strutil from cachely.loader import Loader from ....
args.append(cls.get_value(arg)) text = text[len(m.group()):] if text: raise SyntaxError( 'Syntax error: "{}" (line {})'.format(text, lineno) ) return cls(cmd, args, kws, line, lineno) def lexer(code, lineno=0): ''' Take...
arg = gdict.get('arg', '').strip() if arg != ',':
random_line_split
core.py
import os import re import sys import json import shlex import logging import inspect import functools import importlib from pprint import pformat from collections import namedtuple from traceback import format_tb from requests.exceptions import RequestException import strutil from cachely.loader import Loader from ....
elif s in cls.value_dict: return cls.value_dict[s] elif s.startswith(('r"', "r'")): return re.compile(utils.escaped(s[2:-1])) elif s.startswith("j'"): return json.loads(utils.escaped(s[2:-1])) elif s.startswith(('"', "'")): return utils.es...
return int(s)
conditional_block
edit-registry.controller.ts
/* * Copyright (c) 2015-2017 Codenvy, S.A. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Coden...
let promise = this.chePreferences.addRegistry(this.registry.url, this.registry.username, this.registry.password); promise.then(() => { this.$mdDialog.hide(); if(this.originRegistryUrl !== this.registry.url) { this.chePreferences.removeRegistry(this.originRegistryUrl).then(() => { ...
{ return; }
conditional_block
edit-registry.controller.ts
/* * Copyright (c) 2015-2017 Codenvy, S.A. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Coden...
} /** * Callback of the edit button. */ editRegistry() { if(!this.registry) { return; } let promise = this.chePreferences.addRegistry(this.registry.url, this.registry.username, this.registry.password); promise.then(() => { this.$mdDialog.hide(); if(this.originRegistryUrl...
this.$mdDialog.hide();
random_line_split
edit-registry.controller.ts
/* * Copyright (c) 2015-2017 Codenvy, S.A. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Coden...
() { if(!this.registry) { return; } let promise = this.chePreferences.addRegistry(this.registry.url, this.registry.username, this.registry.password); promise.then(() => { this.$mdDialog.hide(); if(this.originRegistryUrl !== this.registry.url) { this.chePreferences.removeRegis...
editRegistry
identifier_name
edit-registry.controller.ts
/* * Copyright (c) 2015-2017 Codenvy, S.A. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Coden...
/** * Callback of the cancel button of the dialog. */ abort() { this.$mdDialog.hide(); } /** * Callback of the edit button. */ editRegistry() { if(!this.registry) { return; } let promise = this.chePreferences.addRegistry(this.registry.url, this.registry.username, this.reg...
{ this.$mdDialog = $mdDialog; this.chePreferences = chePreferences; this.cheNotification = cheNotification; this.originRegistryUrl = angular.copy(this.registry.url); }
identifier_body
recursive.rs
fn comb<T>(slice: &[T], k: usize) -> Vec<Vec<T>> where T: Copy, { // If k == 1, return a vector containing a vector for each element of the slice. if k == 1 { return slice.iter().map(|x| vec![*x]).collect::<Vec<Vec<T>>>(); } // If k is exactly the slice length, return the slice inside a vect...
() { let computed = comb(&["h", "e", "l", "l", "o"], 2); let expected = vec![ vec!["h", "e"], vec!["h", "l"], vec!["h", "l"], vec!["h", "o"], vec!["e", "l"], vec!["e", "l"], vec!["e", "o"], vec!["l", "l"], ...
four_letters_choose_two
identifier_name
recursive.rs
fn comb<T>(slice: &[T], k: usize) -> Vec<Vec<T>> where T: Copy,
fn main() { let vec1 = vec![1, 2, 3, 4, 5]; println!("{:?}", comb(&vec1, 3)); let vec2 = vec!["A", "B", "C", "D", "E"]; println!("{:?}", comb(&vec2, 3)); } #[cfg(test)] mod tests { use super::*; #[test] fn five_numbers_choose_three() { let computed = comb(&[1, 2, 3, 4, 5], 3); ...
{ // If k == 1, return a vector containing a vector for each element of the slice. if k == 1 { return slice.iter().map(|x| vec![*x]).collect::<Vec<Vec<T>>>(); } // If k is exactly the slice length, return the slice inside a vector. if k == slice.len() { return vec![slice.to_vec()]; ...
identifier_body
recursive.rs
fn comb<T>(slice: &[T], k: usize) -> Vec<Vec<T>> where T: Copy, { // If k == 1, return a vector containing a vector for each element of the slice. if k == 1 { return slice.iter().map(|x| vec![*x]).collect::<Vec<Vec<T>>>(); } // If k is exactly the slice length, return the slice inside a vect...
vec!["e", "o"], vec!["l", "l"], vec!["l", "o"], vec!["l", "o"], ]; assert_eq!(computed, expected); } }
vec!["e", "l"], vec!["e", "l"],
random_line_split
recursive.rs
fn comb<T>(slice: &[T], k: usize) -> Vec<Vec<T>> where T: Copy, { // If k == 1, return a vector containing a vector for each element of the slice. if k == 1
// If k is exactly the slice length, return the slice inside a vector. if k == slice.len() { return vec![slice.to_vec()]; } // Make a vector from the first element + all combinations of k - 1 elements of the rest of the slice. let mut result = comb(&slice[1..], k - 1) .into_iter() ...
{ return slice.iter().map(|x| vec![*x]).collect::<Vec<Vec<T>>>(); }
conditional_block
google.py
import aiohttp import discord import random from config import GoogleAPIKey from config import GoogleCSECX async def google(cmd, message, args): if not args: await message.channel.send(cmd.help()) return else: se
arch = ' '.join(args) url = 'https://www.googleapis.com/customsearch/v1?q=' + search + '&cx=' + GoogleCSECX + '&key=' + GoogleAPIKey async with aiohttp.ClientSession() as session: async with session.get(url) as data: results = await data.json() google_colors = [0x4285...
conditional_block
google.py
import aiohttp import discord import random from config import GoogleAPIKey from config import GoogleCSECX async def go
md, message, args): if not args: await message.channel.send(cmd.help()) return else: search = ' '.join(args) url = 'https://www.googleapis.com/customsearch/v1?q=' + search + '&cx=' + GoogleCSECX + '&key=' + GoogleAPIKey async with aiohttp.ClientSession() as session: ...
ogle(c
identifier_name
google.py
import aiohttp import discord import random from config import GoogleAPIKey from config import GoogleCSECX async def google(cmd, message, args): if
cmd.log.error(e) embed = discord.Embed(color=0xDB0000, title='❗ Daily Limit Reached.') embed.set_footer(text='Google limits this API feature, and we hit that limit.') await message.channel.send(None, embed=embed)
not args: await message.channel.send(cmd.help()) return else: search = ' '.join(args) url = 'https://www.googleapis.com/customsearch/v1?q=' + search + '&cx=' + GoogleCSECX + '&key=' + GoogleAPIKey async with aiohttp.ClientSession() as session: async with session....
identifier_body
google.py
import aiohttp import discord import random from config import GoogleAPIKey from config import GoogleCSECX
if not args: await message.channel.send(cmd.help()) return else: search = ' '.join(args) url = 'https://www.googleapis.com/customsearch/v1?q=' + search + '&cx=' + GoogleCSECX + '&key=' + GoogleAPIKey async with aiohttp.ClientSession() as session: async with se...
async def google(cmd, message, args):
random_line_split
GettingStartedCollaborationsSpec.js
/* * Copyright (C) 2016 - present Instructure, Inc. * * This file is part of Canvas. * * Canvas is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, version 3 of the License. * * Canvas is distribut...
test('renders the Getting Startted app div', () => { setEnvironment([], 'course_4') const wrapper = mount( <GettingStartedCollaborations ltiCollaborators={{ltiCollaboratorsData: ['test']}} /> ) equal(wrapper.find('.GettingStartedCollaborations').length, 1) }) test('renders the correct content with lti to...
{ ENV.context_asset_string = context ENV.current_user_roles = roles }
identifier_body
GettingStartedCollaborationsSpec.js
/* * Copyright (C) 2016 - present Instructure, Inc. * * This file is part of Canvas. * * Canvas is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, version 3 of the License. * * Canvas is distribut...
test('renders the correct content with lti tools configured as a student', () => { setEnvironment(['student'], 'course_4') const wrapper = mount( <GettingStartedCollaborations ltiCollaborators={{ltiCollaboratorsData: ['test']}} /> ) const expectedHeader = 'Getting started with Collaborations' const expect...
equal(expectedHeader, wrapper.find('.ic-Action-header__Heading').text()) equal(expectedContent, wrapper.find('p').text()) })
random_line_split
GettingStartedCollaborationsSpec.js
/* * Copyright (C) 2016 - present Instructure, Inc. * * This file is part of Canvas. * * Canvas is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, version 3 of the License. * * Canvas is distribut...
(roles, context) { ENV.context_asset_string = context ENV.current_user_roles = roles } test('renders the Getting Startted app div', () => { setEnvironment([], 'course_4') const wrapper = mount( <GettingStartedCollaborations ltiCollaborators={{ltiCollaboratorsData: ['test']}} /> ) equal(wrapper.find('.G...
setEnvironment
identifier_name
os_str.rs
// Copyright 2015 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, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> { self.as_slice().fmt(formatter) } } impl Buf { pub fn from_string(s: String) -> Buf { Buf { inner: s.into_bytes() } } pub fn from_str(s: &str) -> Buf { Buf { inner: s.as_bytes().to_vec() } } pub fn as_s...
fmt
identifier_name
os_str.rs
// Copyright 2015 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 ...
}
{ Buf { inner: self.inner.to_vec() } }
identifier_body
os_str.rs
// Copyright 2015 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 ...
String::from_utf8_lossy(&self.inner) } pub fn to_owned(&self) -> Buf { Buf { inner: self.inner.to_vec() } } }
str::from_utf8(&self.inner).ok() } pub fn to_string_lossy(&self) -> CowString {
random_line_split
nbody.rs
// The Computer Language Benchmarks Game // http://benchmarksgame.alioth.debian.org/ // // contributed by the Rust Project Developers // contributed by TeXitoi const PI: f64 = 3.141592653589793; const SOLAR_MASS: f64 = 4.0 * PI * PI; const YEAR: f64 = 365.24; const N_BODIES: usize = 5; static BODIES: [Planet;N_BODIES...
{ x: f64, y: f64, z: f64, vx: f64, vy: f64, vz: f64, mass: f64, } fn advance(bodies: &mut [Planet;N_BODIES], dt: f64, steps: i32) { for _ in (0..steps) { let mut b_slice: &mut [_] = bodies; loop { let bi = match shift_mut_ref(&mut b_slice) { Some(bi) => bi, ...
Planet
identifier_name
nbody.rs
// The Computer Language Benchmarks Game // http://benchmarksgame.alioth.debian.org/ // // contributed by the Rust Project Developers // contributed by TeXitoi const PI: f64 = 3.141592653589793; const SOLAR_MASS: f64 = 4.0 * PI * PI; const YEAR: f64 = 365.24; const N_BODIES: usize = 5; static BODIES: [Planet;N_BODIES...
for _ in (0..steps) { let mut b_slice: &mut [_] = bodies; loop { let bi = match shift_mut_ref(&mut b_slice) { Some(bi) => bi, None => break }; for bj in b_slice.iter_mut() { let dx = bi.x - bj.x; let ...
random_line_split
nbody.rs
// The Computer Language Benchmarks Game // http://benchmarksgame.alioth.debian.org/ // // contributed by the Rust Project Developers // contributed by TeXitoi const PI: f64 = 3.141592653589793; const SOLAR_MASS: f64 = 4.0 * PI * PI; const YEAR: f64 = 365.24; const N_BODIES: usize = 5; static BODIES: [Planet;N_BODIES...
fn offset_momentum(bodies: &mut [Planet;N_BODIES]) { let mut px = 0.0; let mut py = 0.0; let mut pz = 0.0; for bi in bodies.iter() { px += bi.vx * bi.mass; py += bi.vy * bi.mass; pz += bi.vz * bi.mass; } let sun = &mut bodies[0]; sun.vx = - px / SOLAR_MASS; sun....
{ let mut e = 0.0; let mut bodies = bodies.iter(); loop { let bi = match bodies.next() { Some(bi) => bi, None => break }; e += (bi.vx * bi.vx + bi.vy * bi.vy + bi.vz * bi.vz) * bi.mass / 2.0; for bj in bodies.clone() { let dx = bi.x - bj.x;...
identifier_body
popup.js
document.addEventListener('DOMContentLoaded', function() { var YouTubeButton = document.getElementById('YouTube'); YouTubeButton.addEventListener('click', function() { chrome.tabs.getSelected(null, function(tab) {
d = document; var f = d.createElement('form'); f.action = 'http://youtube.com'; f.method = 'post'; var i = d.createElement('input'); i.type = 'hidden'; i.name = 'url'; i.value = tab.url; f.appendChild(i); d.body.appendChild(f); f.submit(); }); }, ...
random_line_split
managed.rs
use gfx::{Encoder, Resources, CommandBuffer, Slice, IndexBuffer}; use gfx::memory::{Usage, TRANSFER_DST}; use gfx::handle::Buffer; use gfx::traits::{Factory, FactoryExt}; use gfx::buffer::Role; use ui::render::Vertex; // step: 128 vertices (4096 bytes, 42 triangles + 2 extra vertices) const ALLOC_STEP: usize = 128; #...
pub fn slice(&self) -> Slice<R> { Slice { start: 0, end: self.tail as u32, base_vertex: 0, instances: None, buffer: IndexBuffer::Auto } } } impl<R> Extend<Vertex> for ManagedBuffer<R> where R: Resources { fn extend<I>(&mut self, iter: I) where I: IntoIterator<Item=Vertex> { if let Some(zone)...
{ &self.remote }
identifier_body
managed.rs
use gfx::{Encoder, Resources, CommandBuffer, Slice, IndexBuffer}; use gfx::memory::{Usage, TRANSFER_DST}; use gfx::handle::Buffer; use gfx::traits::{Factory, FactoryExt}; use gfx::buffer::Role; use ui::render::Vertex; // step: 128 vertices (4096 bytes, 42 triangles + 2 extra vertices) const ALLOC_STEP: usize = 128; #...
{ start: usize, size: usize } pub struct ManagedBuffer<R> where R: Resources { local: Vec<Vertex>, remote: Buffer<R, Vertex>, zones: Vec<(Zone, bool)>, tail: usize } impl<R> ManagedBuffer<R> where R: Resources { pub fn new<F>(factory: &mut F) -> Self where F: Factory<R> { ManagedBuffer { local: Vec::new(...
Zone
identifier_name
managed.rs
use gfx::{Encoder, Resources, CommandBuffer, Slice, IndexBuffer}; use gfx::memory::{Usage, TRANSFER_DST}; use gfx::handle::Buffer; use gfx::traits::{Factory, FactoryExt}; use gfx::buffer::Role; use ui::render::Vertex; // step: 128 vertices (4096 bytes, 42 triangles + 2 extra vertices) const ALLOC_STEP: usize = 128; #...
} }
{ panic!("Tried to extend to a previously created zone, but there are no zones."); }
conditional_block
managed.rs
use gfx::{Encoder, Resources, CommandBuffer, Slice, IndexBuffer}; use gfx::memory::{Usage, TRANSFER_DST}; use gfx::handle::Buffer; use gfx::traits::{Factory, FactoryExt}; use gfx::buffer::Role; use ui::render::Vertex; // step: 128 vertices (4096 bytes, 42 triangles + 2 extra vertices) const ALLOC_STEP: usize = 128; #...
*dirty = true; if zone.size == buffer.len() { let slice = &mut self.local[zone.start..zone.start + zone.size]; slice.copy_from_slice(buffer); } else { // TODO: Shift later elements forward or backwards. unimplemented!() } } fn get_zone(&self, index: usize) -> &[Vertex] { let zone = &self.zo...
let (ref mut zone, ref mut dirty) = self.zones[zone];
random_line_split
typeck_type_placeholder_mismatch.rs
// Copyright 2014 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 test1() { let x: Foo<_> = Bar::<uint>; //~^ ERROR mismatched types: expected `Foo<<generic #0>>` but found `Bar<uint>` let y: Foo<uint> = x; } fn test2() { let x: Foo<_> = Bar::<uint>; //~^ ERROR mismatched types: expected `Foo<<generic #0>>` but found `Bar<uint>` }
}
random_line_split
typeck_type_placeholder_mismatch.rs
// Copyright 2014 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 test1() { let x: Foo<_> = Bar::<uint>; //~^ ERROR mismatched types: expected `Foo<<generic #0>>` but found `Bar<uint>` let y: Foo<uint> = x; } fn test2() { let x: Foo<_> = Bar::<uint>; //~^ ERROR mismatched types: expected `Foo<<generic #0>>` but found `Bar<uint>` }
{ }
identifier_body
typeck_type_placeholder_mismatch.rs
// Copyright 2014 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 ...
<T>; struct Bar<U>; pub fn main() { } fn test1() { let x: Foo<_> = Bar::<uint>; //~^ ERROR mismatched types: expected `Foo<<generic #0>>` but found `Bar<uint>` let y: Foo<uint> = x; } fn test2() { let x: Foo<_> = Bar::<uint>; //~^ ERROR mismatched types: expected `Foo<<generic #0>>` but found `Ba...
Foo
identifier_name
thuv1f.py
memmap.MemoryMap(data) def uvf1_upload(radio): """Upload to TYT TH-UVF1""" data = uvf1_identify(radio) radio.pipe.timeout = 1 if data != radio._mmap[:16]: raise errors.RadioError("Unable to talk to this model") for i in range(0, 0x1000, 0x10): addr = i + 0x10 msg = stru...
(self): rf = chirp_common.RadioFeatures() rf.memory_bounds = (1, 128) rf.has_bank = False rf.has_ctone = True rf.has_tuning_step = False rf.has_cross = True rf.has_rx_dtcs = True rf.has_settings = True rf.can_odd_split = True rf.valid_duple...
get_features
identifier_name
thuv1f.py
bbcd tx_freq[4]; lbcd rx_tone[2]; lbcd tx_tone[2]; u8 unknown1:1, pttid:2, unknown2:2, ishighpower:1, unknown3:2; u8 unknown4:4, isnarrow:1, vox:1, bcl:2; u8 unknown5:1, scan:1, unknown6:3, scramble_code:3; u8 unknown7; }; struct name { char name[7]; };...
random_line_split
thuv1f.py
memmap.MemoryMap(data) def uvf1_upload(radio): """Upload to TYT TH-UVF1""" data = uvf1_identify(radio) radio.pipe.timeout = 1 if data != radio._mmap[:16]: raise errors.RadioError("Unable to talk to this model") for i in range(0, 0x1000, 0x10): addr = i + 0x10 msg = stru...
@classmethod def match_model(cls, filedata, filename): # TYT TH-UVF1 original if filedata.startswith("\x13\x60\x17\x40\x40\x00\x48\x00" + "\x35\x00\x39\x00\x47\x00\x52\x00"): return True # TYT TH-UVF1 V2 elif filedata.startswith("\x14\...
try: uvf1_upload(self) except errors.RadioError: raise except Exception, e: raise errors.RadioError("Failed to communicate with radio: %s" % e)
identifier_body
thuv1f.py
memmap.MemoryMap(data) def uvf1_upload(radio): """Upload to TYT TH-UVF1""" data = uvf1_identify(radio) radio.pipe.timeout = 1 if data != radio._mmap[:16]: raise errors.RadioError("Unable to talk to this model") for i in range(0, 0x1000, 0x10): addr = i + 0x10 msg = stru...
else: mode = "Tone" val = int(toneval) / 10.0 return mode, val, pol def _encode_tone(self, _toneval, mode, val, pol): toneval = 0 if mode == "Tone": toneval = int("%i" % (val * 10), 16) elif mode == "DTCS": toneval = int("%i"...
mode = "DTCS" val = int("%x" % (rawval & 0x3FFF))
conditional_block
board-category-form.component.ts
import { Component } from '@angular/core'; import { Router } from '@angular/router'; import { BoardCategoryService, ErrorHandlerService, ModalService } from '../services/index'; import { Board, BoardCategory } from '../models/index'; import { HomeComponent } from '../components/home/home.component'; @Component({ ...
{ this.loading = true; this.boardCategoryService.create(this.homeComponent.selectedBoard, this.boardCategory) .subscribe( data => { this.loading = false; let boardCategory = data as BoardCategory; this.homeComponent.selectedBoard....
veNewBoardCategory()
identifier_name
BlueprintOutputDebugCircles.js
/* globals window, _, VIZI, THREE */ (function() { "use strict"; /** * Blueprint debug circles output * @author Robin Hawkes - vizicities.com * @author Edward Oliver Greer - eogreer.me */ // output: { // type: "BlueprintOutputDebugCircles", // options: {} // } VIZI.BlueprintOutputDebugCircles = ...
_.defaults(self.options, {}); // Triggers and actions reference self.triggers = [ {name: "initialised", arguments: []} ]; self.actions = [ {name: "outputCircles", arguments: ["data"]} ]; self.world; }; VIZI.BlueprintOutputDebugCircles.prototype = Object.create( VIZI.Bluep...
VIZI.BlueprintOutput.call(self, options);
random_line_split
BlueprintOutputDebugCircles.js
/* globals window, _, VIZI, THREE */ (function() { "use strict"; /** * Blueprint debug circles output * @author Robin Hawkes - vizicities.com * @author Edward Oliver Greer - eogreer.me */ // output: { // type: "BlueprintOutputDebugCircles", // options: {} // } VIZI.BlueprintOutputDebugCircles = ...
var geom; // = new THREE.CircleGeometry(); // Local pixels per meter - set once per tile var pixelsPerMeter; _.each(data, function(point) { var latLon = new VIZI.LatLon(point.coordinates[1], point.coordinates[0]); var geoCoord = self.world.project(latLon); // Set local pixels per ...
{ material.opacity = self.options.opacity; material.transparent = true; }
conditional_block
popup.js
/*! * ezLife AutoIn - The most easiest Anime i.ntere.st bot ever made * https://github.com/KazeFlame/ezLife-AutoIn/ * * Copyright 2015 by KazeFlame and contributors * Released under the MIT license * https://github.com/KazeFlame/ezLife-AutoIn/blob/master/LICENSE * */ KangoAPI.onReady(function(){ kango.brow...
}); $('#autoInAlbum').click(function(event){ // Set the action to be AutoIn Album kango.invokeAsync('kango.storage.setItem', 'action', 'autoInAlbum'); // Set the url for the action kango.invokeAsync('kango.storage.setItem', 'urlForAction', curren...
{ $('#autoInAlbum').prop('disabled', true); $('#autoInNewArrivals').prop('disabled', true); $('#autoCreateAlbum').prop('disabled', true); $('#dumpImages').prop('disabled', true); }
conditional_block
popup.js
/*! * ezLife AutoIn - The most easiest Anime i.ntere.st bot ever made * https://github.com/KazeFlame/ezLife-AutoIn/ * * Copyright 2015 by KazeFlame and contributors * Released under the MIT license * https://github.com/KazeFlame/ezLife-AutoIn/blob/master/LICENSE * */ KangoAPI.onReady(function(){ kango.brow...
});
random_line_split
lzss2.rs
> 0 { if self.out_count < 8 { self.out_flags <<= 8 - self.out_count; } self.out_data[0] = self.out_flags; try!(self.inner.write_all(&self.out_data[..self.out_len])); self.out_flags = 0; self.out_count = 0; ...
/// Process a group of 8 literals or match/length pairs. The /// given token is contains the flag bits. fn process_group(&mut self, token: u8) -> io::Result<()> { for i in 0..8 { if token & 0x80 >> i == 0 { // Zero bit indicates a match/length pair. Decode the ...
{ while *written < output.len() && self.returned != self.position { output[*written] = self.window[self.returned]; *written += 1; self.returned = mod_window(self.returned + 1); } }
identifier_body
lzss2.rs
_count > 0 { if self.out_count < 8 { self.out_flags <<= 8 - self.out_count; } self.out_data[0] = self.out_flags; try!(self.inner.write_all(&self.out_data[..self.out_len])); self.out_flags = 0; self.out_count = 0; ...
fn flush(&mut self) -> io::Result<()> { while self.look_ahead_bytes > 0 { try!(self.process()); } try!(self.emit_flush()); self.inner.flush() } } /// Reader for LZSS compressed streams. pub struct Reader<R> { inner: Bytes<nested::Reader<R>>, window: [u8; WIND...
random_line_split
lzss2.rs
_count > 0 { if self.out_count < 8 { self.out_flags <<= 8 - self.out_count; } self.out_data[0] = self.out_flags; try!(self.inner.write_all(&self.out_data[..self.out_len])); self.out_flags = 0; self.out_count = 0; ...
(inner: R) -> Reader<R> { Reader { inner: nested::Reader::new(inner).bytes(), window: [0; WINDOW_SIZE], position: 0, returned: 0, eof: false, } } /// Copy all decompressed data from the window to the output /// buffer. fn copy_...
new
identifier_name
lzss2.rs
> 0 { if self.out_count < 8 { self.out_flags <<= 8 - self.out_count; } self.out_data[0] = self.out_flags; try!(self.inner.write_all(&self.out_data[..self.out_len])); self.out_flags = 0; self.out_count = 0; ...
self.out_count += 1; self.out_flags = (self.out_flags << 1) | 1; self.out_data[self.out_len] = lit; self.out_len += 1; Ok(()) } /// Emit a match/length pair, which is already encoded in `m1` and /// `m2`. pub fn emit_match(&mut self, m1: u8, m2: u8) -> io::Resul...
{ try!(self.emit_flush()); }
conditional_block
mouse.rs
use libc::{c_int, c_uint, c_void, uint8_t, uint32_t}; use surface::SDL_Surface; use video::SDL_Window; use sdl::SDL_bool; use event::SDL_State; pub type SDL_Cursor = c_void; pub type SDL_SystemCursor = c_uint; pub const SDL_SYSTEM_CURSOR_ARROW: SDL_SystemCursor = 0; pub const SDL_SYSTEM_CURSOR_IBEAM: SDL_SystemCursor...
pub const SDL_SYSTEM_CURSOR_SIZENESW: SDL_SystemCursor = 6; pub const SDL_SYSTEM_CURSOR_SIZEWE: SDL_SystemCursor = 7; pub const SDL_SYSTEM_CURSOR_SIZENS: SDL_SystemCursor = 8; pub const SDL_SYSTEM_CURSOR_SIZEALL: SDL_SystemCursor = 9; pub const SDL_SYSTEM_CURSOR_NO: SDL_SystemCursor = 10; pub const SDL_SYSTEM_CURSOR_HA...
random_line_split
must-use-ops.rs
// Issue #50124 - Test warning for unused operator expressions // check-pass #![warn(unused_must_use)] fn
() { let val = 1; let val_pointer = &val; // Comparison Operators val == 1; //~ WARNING unused comparison val < 1; //~ WARNING unused comparison val <= 1; //~ WARNING unused comparison val != 1; //~ WARNING unused comparison val >= 1; //~ WARNING unused comparison val > 1; //~ WARNING u...
main
identifier_name
must-use-ops.rs
// Issue #50124 - Test warning for unused operator expressions // check-pass #![warn(unused_must_use)] fn main()
true && true; //~ WARNING unused logical operation false || true; //~ WARNING unused logical operation // Bitwise Operators 5 ^ val; //~ WARNING unused bitwise operation 5 & val; //~ WARNING unused bitwise operation 5 | val; //~ WARNING unused bitwise operation 5 << val; //~ WARNING unused bitw...
{ let val = 1; let val_pointer = &val; // Comparison Operators val == 1; //~ WARNING unused comparison val < 1; //~ WARNING unused comparison val <= 1; //~ WARNING unused comparison val != 1; //~ WARNING unused comparison val >= 1; //~ WARNING unused comparison val > 1; //~ WARNING unus...
identifier_body
must-use-ops.rs
// Issue #50124 - Test warning for unused operator expressions // check-pass #![warn(unused_must_use)] fn main() { let val = 1;
val == 1; //~ WARNING unused comparison val < 1; //~ WARNING unused comparison val <= 1; //~ WARNING unused comparison val != 1; //~ WARNING unused comparison val >= 1; //~ WARNING unused comparison val > 1; //~ WARNING unused comparison // Arithmetic Operators val + 2; //~ WARNING unused a...
let val_pointer = &val; // Comparison Operators
random_line_split
az-Cyrl.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js export default [ [ ...
'ахшамүстү', 'ахшам', 'ҝеҹә' ], , ], [ '00:00', '12:00', ['04:00', '06:00'], ['06:00', '12:00'], ['12:00', '17:00'], ['17:00', '19:00'], ['19:00', '24:00'], ['00:00', '04:00'] ] ];
], ], [ [ 'ҝеҹәјары', 'ҝүнорта', 'сүбһ', 'сәһәр', 'ҝүндүз',
random_line_split
plane-details.component.ts
import { Component, OnInit, Input, Output } from '@angular/core'; import {PlanesService} from '../planes/planes.service'; import {IPlane, AppStore} from '../interfaces'; @Component({ moduleId: module.id, selector: 'app-plane-details', // templateUrl: 'plane-details.component.html', template: ` <div class="...
ngOnInit() { } }
{ // this.plane = this.planesService.selectedPlane; this.sPlane = planesService.selectedPlane; }
identifier_body
plane-details.component.ts
import { Component, OnInit, Input, Output } from '@angular/core'; import {PlanesService} from '../planes/planes.service'; import {IPlane, AppStore} from '../interfaces'; @Component({ moduleId: module.id, selector: 'app-plane-details', // templateUrl: 'plane-details.component.html', template: ` <div class="...
constructor(private planesService: PlanesService) { // this.plane = this.planesService.selectedPlane; this.sPlane = planesService.selectedPlane; } ngOnInit() { } }
export class PlaneDetailsComponent implements OnInit { @Input('plane') plane: any; @Output('upPlane') upPlane: any; sPlane: IPlane;
random_line_split
plane-details.component.ts
import { Component, OnInit, Input, Output } from '@angular/core'; import {PlanesService} from '../planes/planes.service'; import {IPlane, AppStore} from '../interfaces'; @Component({ moduleId: module.id, selector: 'app-plane-details', // templateUrl: 'plane-details.component.html', template: ` <div class="...
() { } }
ngOnInit
identifier_name
test.rs
extern crate mio; extern crate bytes; #[macro_use] extern crate log; extern crate env_logger; extern crate tempdir; pub use ports::localhost; mod test_battery; mod test_close_on_drop; mod test_echo_server; mod test_multicast; mod test_notify; mod test_register_deregister; mod test_timer; mod test_udp_socket; mod tes...
pub fn sleep_ms(ms: usize) { use std::thread; thread::sleep_ms(ms as u32); }
random_line_split
test.rs
extern crate mio; extern crate bytes; #[macro_use] extern crate log; extern crate env_logger; extern crate tempdir; pub use ports::localhost; mod test_battery; mod test_close_on_drop; mod test_echo_server; mod test_multicast; mod test_notify; mod test_register_deregister; mod test_timer; mod test_udp_socket; mod tes...
() -> SocketAddr { let s = format!("127.0.0.1:{}", next_port()); FromStr::from_str(&s).unwrap() } } pub fn sleep_ms(ms: usize) { use std::thread; thread::sleep_ms(ms as u32); }
localhost
identifier_name
test.rs
extern crate mio; extern crate bytes; #[macro_use] extern crate log; extern crate env_logger; extern crate tempdir; pub use ports::localhost; mod test_battery; mod test_close_on_drop; mod test_echo_server; mod test_multicast; mod test_notify; mod test_register_deregister; mod test_timer; mod test_udp_socket; mod tes...
{ use std::thread; thread::sleep_ms(ms as u32); }
identifier_body
htmlsourceelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLSourceElementBinding; use dom::bindings::codegen::InheritTypes::HTMLSour...
(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLSourceElement> { let element = HTMLSourceElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLSourceElementBinding::Wrap) } } impl Reflectable for HTMLSourceEl...
new
identifier_name
htmlsourceelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLSourceElementBinding; use dom::bindings::codegen::InheritTypes::HTMLSour...
} impl HTMLSourceElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLSourceElement { HTMLSourceElement { htmlelement: HTMLElement::new_inherited(HTMLSourceElementTypeId, localName, prefix, document) } } #[allow(unrooted_...
}
random_line_split
htmlsourceelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLSourceElementBinding; use dom::bindings::codegen::InheritTypes::HTMLSour...
}
{ self.htmlelement.reflector() }
identifier_body
mod.rs
// Copyright (c) 2017 Atsushi Miyake // // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or http://apache.org/licenses/LICENSE-2.0> // or the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. // This file may not be copied, modified, or distributed except according to th...
mod reflector; mod plugboard; mod alphabets; pub use self::enigma::Enigma; pub use self::router::Router; pub use self::router::RouterProtocol; pub use self::router::Digit; pub use self::router_manager::RouterManager; pub use self::reflector::Reflector; pub use self::substitution_table::SubstitutionTable; pub use self:...
random_line_split
read_image_from_hbase.py
import happybase from StringIO import StringIO from PIL import Image def
(binary_data): """ Returns PIL image from binary buffer. """ f = StringIO(binary_data) img = Image.open(f) return img if __name__=="__main__": tab_image = 'image_cache' col_image = dict() col_image['image_cache'] = 'image:binary' conn = happybase.Connection(host='10.1.94.57') i...
decode_image_PIL
identifier_name
read_image_from_hbase.py
import happybase from StringIO import StringIO from PIL import Image def decode_image_PIL(binary_data):
if __name__=="__main__": tab_image = 'image_cache' col_image = dict() col_image['image_cache'] = 'image:binary' conn = happybase.Connection(host='10.1.94.57') image_rows = dict() image_rows['image_cache'] = ['0000007031E3FA80C97940017253BEAB542EA334', '000001EC5DD154E58B72326EFC26A41A4C8E9586...
""" Returns PIL image from binary buffer. """ f = StringIO(binary_data) img = Image.open(f) return img
identifier_body
read_image_from_hbase.py
""" Returns PIL image from binary buffer. """ f = StringIO(binary_data) img = Image.open(f) return img if __name__=="__main__": tab_image = 'image_cache' col_image = dict() col_image['image_cache'] = 'image:binary' conn = happybase.Connection(host='10.1.94.57') image_rows = dic...
import happybase from StringIO import StringIO from PIL import Image def decode_image_PIL(binary_data):
random_line_split
read_image_from_hbase.py
import happybase from StringIO import StringIO from PIL import Image def decode_image_PIL(binary_data): """ Returns PIL image from binary buffer. """ f = StringIO(binary_data) img = Image.open(f) return img if __name__=="__main__":
tab_image = 'image_cache' col_image = dict() col_image['image_cache'] = 'image:binary' conn = happybase.Connection(host='10.1.94.57') image_rows = dict() image_rows['image_cache'] = ['0000007031E3FA80C97940017253BEAB542EA334', '000001EC5DD154E58B72326EFC26A41A4C8E9586', '0000081A1D6D1A2023DAE07547C...
conditional_block
__openerp__.py
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar) # All Rights Reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Pu...
'views/product_view.xml', 'security/security.xml', 'security/ir.model.access.csv', ], 'test': [ ], 'demo': [], 'installable': True, 'auto_install': False, }
], 'data': [ 'views/res_company_property_view.xml', 'views/res_company_view.xml', 'views/res_partner_view.xml',
random_line_split
ThreeVerticalDots.tsx
import * as React from 'react'; import { IconProps } from './IconProps'; export function
({ className, size = 24, width = size, height = size }: IconProps) { return ( <svg width={width} height={height} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" className={className}><g fill="none" clipPath="url(#icon24pxThreeVerticalDotsClip0)"><path d="M12 7.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm0...
ThreeVerticalDots
identifier_name
ThreeVerticalDots.tsx
import * as React from 'react'; import { IconProps } from './IconProps'; export function ThreeVerticalDots({ className, size = 24, width = size, height = size }: IconProps)
{ return ( <svg width={width} height={height} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" className={className}><g fill="none" clipPath="url(#icon24pxThreeVerticalDotsClip0)"><path d="M12 7.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm1.5 4.5a1.5 1.5 0 1 1-3 0 1...
identifier_body
ThreeVerticalDots.tsx
import * as React from 'react'; import { IconProps } from './IconProps'; export function ThreeVerticalDots({ className, size = 24, width = size, height = size }: IconProps) {
return ( <svg width={width} height={height} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" className={className}><g fill="none" clipPath="url(#icon24pxThreeVerticalDotsClip0)"><path d="M12 7.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm1.5 4.5a1.5 1.5 0 1 1-3 0 1.5...
random_line_split
base_file_attachment.py
from __future__ import unicode_literals from django.utils import six from reviewboard.attachments.models import FileAttachment from reviewboard.webapi.base import WebAPIResource class BaseFileAttachmentResource(WebAPIResource): """A base resource representing file attachments.""" added_in = '1.6' model...
def serialize_caption_field(self, obj, **kwargs): # We prefer 'caption' here, because when creating a new file # attachment, it won't be full of data yet (and since we're posting # to file-attachments/, it doesn't hit DraftFileAttachmentResource). # DraftFileAttachmentResource will...
return request.build_absolute_uri(obj.get_absolute_url())
identifier_body
base_file_attachment.py
from __future__ import unicode_literals from django.utils import six from reviewboard.attachments.models import FileAttachment from reviewboard.webapi.base import WebAPIResource class
(WebAPIResource): """A base resource representing file attachments.""" added_in = '1.6' model = FileAttachment name = 'file_attachment' fields = { 'id': { 'type': int, 'description': 'The numeric ID of the file.', }, 'caption': { 'type': s...
BaseFileAttachmentResource
identifier_name
base_file_attachment.py
from __future__ import unicode_literals from django.utils import six from reviewboard.attachments.models import FileAttachment from reviewboard.webapi.base import WebAPIResource class BaseFileAttachmentResource(WebAPIResource): """A base resource representing file attachments.""" added_in = '1.6' model...
def serialize_caption_field(self, obj, **kwargs): # We prefer 'caption' here, because when creating a new file # attachment, it won't be full of data yet (and since we're posting # to file-attachments/, it doesn't hit DraftFileAttachmentResource). # DraftFileAttachmentResource will ...
return request.build_absolute_uri(obj.get_absolute_url())
random_line_split
network.js
/* globals Promise:true */ var _ = require('lodash') var EventEmitter = require('events').EventEmitter var inherits = require('util').inherits var timers = require('timers') var Promise = require('bluebird') var bitcore = require('bitcore') var p2p = require('bitcore-p2p') var RpcClient = require('bitcoind-rpc') var ...
return id }) .then(function (hash) { return self.bitcoind.getBlockAsync(hash, false) }) .then(function (ret) { var rawBlock = new Buffer(ret.result, 'hex') return new bitcore.Block(rawBlock) }) } /** * @return {Promise<{hash: string, height: number}>} */ Network.prototype.getLatest = func...
{ return self.getBlockHash(id) }
conditional_block
network.js
/* globals Promise:true */ var _ = require('lodash') var EventEmitter = require('events').EventEmitter var inherits = require('util').inherits var timers = require('timers') var Promise = require('bluebird') var bitcore = require('bitcore') var p2p = require('bitcore-p2p') var RpcClient = require('bitcoind-rpc') var ...
() { EventEmitter.call(this) } inherits(Network, EventEmitter) /** * @return {Promise} */ Network.prototype.init = function () { return Promise.all([this._initBitcoind(), this._initTrustedPeer()]) } /** * @return {Promise} */ Network.prototype._initBitcoind = function () { var self = this // create rpc...
Network
identifier_name
network.js
/* globals Promise:true */ var _ = require('lodash') var EventEmitter = require('events').EventEmitter var inherits = require('util').inherits var timers = require('timers') var Promise = require('bluebird') var bitcore = require('bitcore') var p2p = require('bitcore-p2p') var RpcClient = require('bitcoind-rpc') var ...
} /** * @return {Promise<number>} */ Network.prototype.getBlockCount = function () { return this.bitcoind.getBlockCountAsync() .then(function (ret) { return ret.result }) } /** * @param {number} height * @return {Promise<string>} */ Network.prototype.getBlockHash = function (height) { return this.bitcoin...
*/ Network.prototype.getBitcoindInfo = function () { return this.bitcoind.getInfoAsync() .then(function (ret) { return ret.result })
random_line_split
network.js
/* globals Promise:true */ var _ = require('lodash') var EventEmitter = require('events').EventEmitter var inherits = require('util').inherits var timers = require('timers') var Promise = require('bluebird') var bitcore = require('bitcore') var p2p = require('bitcore-p2p') var RpcClient = require('bitcoind-rpc') var ...
inherits(Network, EventEmitter) /** * @return {Promise} */ Network.prototype.init = function () { return Promise.all([this._initBitcoind(), this._initTrustedPeer()]) } /** * @return {Promise} */ Network.prototype._initBitcoind = function () { var self = this // create rpc client self.bitcoind = Promise...
{ EventEmitter.call(this) }
identifier_body
examples.ts
export const importExample = `import { Tag } from 'wix-ui-tpa/Tag';`; export const removable = ` <ul style={{ display: 'flex', flexDirection: 'column' }}> <Tag size="small" isRemovable onRemove={() => alert('onRemove handler')}>Removable Tag</Tag> <br /> <Tag size="medium" isRemovable onRemove={() => alert('on...
`; export const readonly = ` <ul style={{ display: 'flex', flexDirection: 'column' }}> <Tag size="small">Readonly tag </Tag> <br /> <Tag size="medium">Readonly tag </Tag> <br /> <Tag size="large">Readonly tag </Tag> </ul> `;
<Tag size="large" onClick={() => alert('onClick handler')}>Clickable tag</Tag> </ul>
random_line_split
unknown.rs
// Copyright (c) 2016 com-rs developers // // 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 http://opensource.org/licenses/MIT>, at your // option. All files in the project carrying such notice may not be copied, //...
{ query_interface: extern "stdcall" fn( *const IUnknown, &IID, *mut *mut c_void) -> HResult, add_ref: extern "stdcall" fn(*const IUnknown) -> u32, release: extern "stdcall" fn(*const IUnknown) -> u32 } extern { static IID_IUnknown: IID; } impl IUnknown { /// Retrieves pointers to the supp...
IUnknownVtbl
identifier_name
unknown.rs
// Copyright (c) 2016 com-rs developers // // 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 http://opensource.org/licenses/MIT>, at your // option. All files in the project carrying such notice may not be copied, //...
/// /// None of the methods on this struct should be called directly, /// use [`ComPtr`](struct.ComPtr.html) instead. #[derive(Debug)] #[repr(C)] pub struct IUnknown { vtable: *const IUnknownVtbl } #[allow(missing_debug_implementations)] #[repr(C)] #[doc(hidden)] pub struct IUnknownVtbl { query_interface: ext...
use super::{AsComPtr, HResult, IID}; /// Base interface for all COM types.
random_line_split