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 |
|---|---|---|---|---|
char_class.rs | // Copyright 2014 Strahinja Val Markovic
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... | () {
assert!( charClassMatch( class!( "a" ), b"a" ) );
assert!( charClassMatch( class!( "abcdef" ), b"e" ) );
assert!( charClassMatch( class!( "a-z" ), b"a" ) );
assert!( charClassMatch( class!( "a-z" ), b"c" ) );
assert!( charClassMatch( class!( "a-z" ), b"z" ) );
... | CharClass_Match | identifier_name |
char_class.rs | // Copyright 2014 Strahinja Val Markovic
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
_ => None
}
}
}
impl Expression for CharClass {
fn apply<'a>( &self, parse_state: &ParseState<'a> ) ->
Option< ParseResult<'a> > {
self.applyToUtf8( parse_state ).or( self.applyToBytes( parse_state ) )
}
}
#[cfg(test)]
mod tests {
use base;
use base::{Node, Data, ParseResult, Expressi... | {
parse_state.offsetToResult( parse_state.offset + 1 )
} | conditional_block |
char_class.rs | // Copyright 2014 Strahinja Val Markovic
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... | assert!( charClassMatch( class!( "a-zA-Z-" ), b"z" ) );
assert!( charClassMatch( class!( "aa-zA-Z-0" ), b"0" ) );
assert!( charClassMatch( class!( "a-cdefgh-k" ), b"e" ) );
assert!( charClassMatch( class!( "---" ), b"-" ) );
assert!( charClassMatch( class!( "a-a" ), b"a" ) );
}
... | assert!( charClassMatch( class!( "-" ), b"-" ) );
assert!( charClassMatch( class!( "a-" ), b"-" ) );
assert!( charClassMatch( class!( "-a" ), b"-" ) );
assert!( charClassMatch( class!( "a-zA-Z-" ), b"-" ) );
assert!( charClassMatch( class!( "aa-zA-Z-a" ), b"-" ) ); | random_line_split |
issue-3953.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 ... | {
if Lol(2) == Lol(4) {
println!("2 == 4");
} else {
println!("2 != 4");
}
} | identifier_body | |
issue-3953.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 ... |
}
| {
println!("2 != 4");
} | conditional_block |
issue-3953.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, other: &Lol) -> bool { **self == **other }
}
fn main() {
if Lol(2) == Lol(4) {
println!("2 == 4");
} else {
println!("2 != 4");
}
}
| ne | identifier_name |
issue-3953.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.
// | // option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-tidy-linelength
use std::cmp::PartialEq;
trait Hahaha: PartialEq + PartialEq {
//~^ ERROR trait `PartialEq` already appears in the list of bounds
}
struct Lol(isize);
impl Hahaha for Lol { }
impl Par... | // 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 | random_line_split |
gate.rs | // ignore-arm
// ignore-aarch64
// ignore-wasm
// ignore-emscripten
// ignore-mips
// ignore-mips64
// ignore-powerpc
// ignore-powerpc64
// ignore-powerpc64le
// ignore-riscv64
// ignore-sparc
// ignore-sparc64
// ignore-s390x
// gate-test-sse4a_target_feature
// gate-test-powerpc_target_feature
// gate-test-avx512_ta... |
fn main() {}
| {} | identifier_body |
gate.rs | // ignore-arm
// ignore-aarch64
// ignore-wasm
// ignore-emscripten
// ignore-mips
// ignore-mips64
// ignore-powerpc
// ignore-powerpc64
// ignore-powerpc64le | // gate-test-powerpc_target_feature
// gate-test-avx512_target_feature
// gate-test-tbm_target_feature
// gate-test-arm_target_feature
// gate-test-aarch64_target_feature
// gate-test-hexagon_target_feature
// gate-test-mips_target_feature
// gate-test-wasm_target_feature
// gate-test-adx_target_feature
// gate-test-cm... | // ignore-riscv64
// ignore-sparc
// ignore-sparc64
// ignore-s390x
// gate-test-sse4a_target_feature | random_line_split |
gate.rs | // ignore-arm
// ignore-aarch64
// ignore-wasm
// ignore-emscripten
// ignore-mips
// ignore-mips64
// ignore-powerpc
// ignore-powerpc64
// ignore-powerpc64le
// ignore-riscv64
// ignore-sparc
// ignore-sparc64
// ignore-s390x
// gate-test-sse4a_target_feature
// gate-test-powerpc_target_feature
// gate-test-avx512_ta... | () {}
fn main() {}
| foo | identifier_name |
translate-unit-warning-confirm-dialog.component.spec.ts | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateUnitWarningConfirmDialogComponent } from './translate-unit-warning-confirm-dialog.component';
import {NO_ERRORS_SCHEMA} from '@angular/core';
import {MAT_DIALOG_DATA, MatDialog, MatDialogContainer, MatDialogModule, MatDialogRef... | {
}
describe('TranslateUnitWarningConfirmDialogComponent', () => {
let dialog: MatDialog;
let component: TranslateUnitWarningConfirmDialogComponent;
let fixture: ComponentFixture<TranslateUnitWarningConfirmDialogComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [],... | MatDialogRefMock | identifier_name |
translate-unit-warning-confirm-dialog.component.spec.ts | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateUnitWarningConfirmDialogComponent } from './translate-unit-warning-confirm-dialog.component';
import {NO_ERRORS_SCHEMA} from '@angular/core';
import {MAT_DIALOG_DATA, MatDialog, MatDialogContainer, MatDialogModule, MatDialogRef... |
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [],
imports: [AppModule, MatDialogModule],
providers: [
{ provide: MatDialogRef, useClass: MatDialogRefMock },
{ provide: MAT_DIALOG_DATA, useValue: "lmaa"}],
schemas: [NO_ERRORS_SCHEMA]
})
.co... | let component: TranslateUnitWarningConfirmDialogComponent;
let fixture: ComponentFixture<TranslateUnitWarningConfirmDialogComponent>; | random_line_split |
email_template_preview.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009 Sharoon Thomas
# Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it ... |
_columns = {
'res_id': fields.selection(_get_records, 'Sample Document'),
'partner_ids': fields.many2many('res.partner', string='Recipients'),
}
def on_change_res_id(self, cr, uid, ids, res_id, context=None):
if context is None:
context = {'value': {}}
if not r... | if context is None:
context = {}
result = super(email_template_preview, self).default_get(cr, uid, fields, context=context)
email_template = self.pool.get('email.template')
template_id = context.get('template_id')
if 'res_id' in fields and not result.get('res_id'):
... | identifier_body |
email_template_preview.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009 Sharoon Thomas
# Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it ... |
return model.name_get(cr, uid, record_ids, context)
def default_get(self, cr, uid, fields, context=None):
if context is None:
context = {}
result = super(email_template_preview, self).default_get(cr, uid, fields, context=context)
email_template = self.pool.get('email... | record_ids.insert(0, default_id) | conditional_block |
email_template_preview.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009 Sharoon Thomas
# Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it ... | (self, cr, uid, fields, context=None):
if context is None:
context = {}
result = super(email_template_preview, self).default_get(cr, uid, fields, context=context)
email_template = self.pool.get('email.template')
template_id = context.get('template_id')
if 'res_id' in... | default_get | identifier_name |
email_template_preview.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009 Sharoon Thomas
# Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it ... | if template_id and 'model_id' in fields and not result.get('model_id'):
result['model_id'] = email_template.read(cr, uid, int(template_id), ['model_id'], context).get('model_id', False)
return result
_columns = {
'res_id': fields.selection(_get_records, 'Sample Document'),
... | if 'res_id' in fields and not result.get('res_id'):
records = self._get_records(cr, uid, context=context)
result['res_id'] = records and records[0][0] or False # select first record as a Default | random_line_split |
let.js | // 7: block scope - let
// To do: make all tests pass, leave the asserts unchanged!
describe('`let` restricts the scope of the variable to the current block', () => {
describe('`let` vs. `var`', () => {
it('`var` works as usual', () => {
if (true) |
assert.equal(varX, true);
});
it('`let` restricts scope to inside the block', () => {
if (true) {
var letX = true;
}
assert.throws(() => console.log(letX));
});
});
describe('`let` usage', () => {
it('`let` use in `for` loops', () => {
let obj =... | {
let varX = true;
} | conditional_block |
let.js | // 7: block scope - let
// To do: make all tests pass, leave the asserts unchanged!
describe('`let` restricts the scope of the variable to the current block', () => {
describe('`let` vs. `var`', () => {
it('`var` works as usual', () => {
if (true) {
let varX = true;
}
assert.equal(var... | describe('`let` usage', () => {
it('`let` use in `for` loops', () => {
let obj = {x: 1};
for (var key in obj) {}
assert.throws(() => console.log(key));
});
it('create artifical scope, using curly braces', () => {
{
var letX = true;
}
assert.throws(() =... | });
| random_line_split |
values.rs | use num::FromPrimitive;
pub const FALSE: u8 = 0;
pub const TRUE: u8 = 1;
/// This gets added to the trainer class when setting CURRENT_OPPONENT
pub const TRAINER_TAG: u8 = 0xC8;
/// Any tile that has a value above this is a menu tile and therefore should be drawn on top of
/// sprites.
pub const MAX_MAP_TILE: u8 = 0... | pub const RYHDON: u8 = 0x01;
pub const WEEDLE: u8 = 0x70;
}
pub mod status {
pub const NONE : u8 = 0;
pub const POISON : u8 = 3;
pub const BURN : u8 = 4;
pub const FREEZE : u8 = 5;
pub const PARALYZE: u8 = 6;
pub const SLEEP : u8 = 7;
}
pub mod types {
pub const NORMAL :... |
pub mod pokeid {
// TODO: Add more pokemon | random_line_split |
values.rs | use num::FromPrimitive;
pub const FALSE: u8 = 0;
pub const TRUE: u8 = 1;
/// This gets added to the trainer class when setting CURRENT_OPPONENT
pub const TRAINER_TAG: u8 = 0xC8;
/// Any tile that has a value above this is a menu tile and therefore should be drawn on top of
/// sprites.
pub const MAX_MAP_TILE: u8 = 0... | (n: i64) -> Option<Direction> {
match n {
0x0 => Some(Direction::Down),
0x4 => Some(Direction::Up),
0x8 => Some(Direction::Left),
0xC => Some(Direction::Right),
_ => None,
}
}
fn from_u64(n: u64) -> Option<Direction> {
From... | from_i64 | identifier_name |
MedianFilter.py | import numpy as np
from scipy.signal import medfilt
import manager.operations.method as method
from manager.operations.methodsteps.confirmation import Confirmation
from manager.exceptions import VoltPyNotAllowed
class MedianFilter(method.ProcessingMethod):
can_be_applied = True
_steps = [
{
... |
def apply(self, user, dataset):
if self.model.completed is not True:
raise VoltPyNotAllowed('Incomplete procedure.')
self.__perform(dataset)
def __perform(self, dataset):
for cd in dataset.curves_data.all():
yvec = cd.yVector
newyvec = medfilt(yvec)... | return "Median Filter" | identifier_body |
MedianFilter.py | import numpy as np
from scipy.signal import medfilt
import manager.operations.method as method
from manager.operations.methodsteps.confirmation import Confirmation
from manager.exceptions import VoltPyNotAllowed
class MedianFilter(method.ProcessingMethod):
can_be_applied = True
_steps = [
{
... |
dataset.save()
def finalize(self, user):
self.__perform(self.model.dataset)
self.model.step = None
self.model.completed = True
self.model.save()
return True
| yvec = cd.yVector
newyvec = medfilt(yvec)
dataset.updateCurve(self.model, cd, newyvec) | conditional_block |
MedianFilter.py | import numpy as np
from scipy.signal import medfilt
import manager.operations.method as method
from manager.operations.methodsteps.confirmation import Confirmation
from manager.exceptions import VoltPyNotAllowed
class MedianFilter(method.ProcessingMethod):
can_be_applied = True
_steps = [
{
... | dataset.save()
def finalize(self, user):
self.__perform(self.model.dataset)
self.model.step = None
self.model.completed = True
self.model.save()
return True | newyvec = medfilt(yvec)
dataset.updateCurve(self.model, cd, newyvec) | random_line_split |
MedianFilter.py | import numpy as np
from scipy.signal import medfilt
import manager.operations.method as method
from manager.operations.methodsteps.confirmation import Confirmation
from manager.exceptions import VoltPyNotAllowed
class | (method.ProcessingMethod):
can_be_applied = True
_steps = [
{
'class': Confirmation,
'title': 'Apply median filter',
'desc': 'Press Forward to apply Median Filter.',
},
]
description = """
Median filter is smoothing algorithm similar to the Savitzk... | MedianFilter | identifier_name |
harmony-string.js | // Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
new BenchmarkSuite('StringRepeat', [10], [
new Benchmark('StringRepeat', false, false, 0,
Repeat, RepeatSetup, RepeatTearDown),
]);
new Benchmark... |
}
function FromCodePointTearDown() {
for (var i = 0; i <= MAX_CODE_POINT; i += K) {
if (i !== result[i].codePointAt(0)) return false;
}
return true;
}
var allCodePoints;
function CodePointAtSetup() {
allCodePoints = new Array((MAX_CODE_POINT + 1) / K);
for (var i = 0; i <= MAX_CODE_POINT; i += K) {
... | {
result[i] = String.fromCodePoint(i);
} | conditional_block |
harmony-string.js | // Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
new BenchmarkSuite('StringRepeat', [10], [
new Benchmark('StringRepeat', false, false, 0,
Repeat, RepeatSetup, RepeatTearDown),
]);
new Benchmark... | }
function RepeatTearDown() {
var expected = "";
for (var i = 0; i < 1000; i++) {
expected += stringRepeatSource;
}
return result === expected;
}
var str;
var substr;
function WithSetup() {
str = "abc".repeat(500);
substr = "abc".repeat(200);
result = undefined;
}
function WithTearDown() {
retu... | function Repeat() {
result = stringRepeatSource.repeat(500); | random_line_split |
harmony-string.js | // Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
new BenchmarkSuite('StringRepeat', [10], [
new Benchmark('StringRepeat', false, false, 0,
Repeat, RepeatSetup, RepeatTearDown),
]);
new Benchmark... |
var MAX_CODE_POINT = 0xFFFFF;
const K = 1024;
function FromCodePointSetup() {
result = new Array((MAX_CODE_POINT + 1) / K);
}
function FromCodePoint() {
for (var i = 0; i <= MAX_CODE_POINT; i += K) {
result[i] = String.fromCodePoint(i);
}
}
function FromCodePointTearDown() {
for (var i = 0; i <= MAX_CO... | {
result = str.includes(substr);
} | identifier_body |
harmony-string.js | // Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
new BenchmarkSuite('StringRepeat', [10], [
new Benchmark('StringRepeat', false, false, 0,
Repeat, RepeatSetup, RepeatTearDown),
]);
new Benchmark... | () {
result = new Array((MAX_CODE_POINT + 1) / K);
}
function FromCodePoint() {
for (var i = 0; i <= MAX_CODE_POINT; i += K) {
result[i] = String.fromCodePoint(i);
}
}
function FromCodePointTearDown() {
for (var i = 0; i <= MAX_CODE_POINT; i += K) {
if (i !== result[i].codePointAt(0)) return false;
... | FromCodePointSetup | identifier_name |
check-rpc-mappings.py | #!/usr/bin/env python3
# Copyright (c) 2009-2019 The Bitcoin Core developers
# Copyright (c) 2014-2019 The DigiByte Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Check RPC argument consistency."""
from collect... |
assert not in_rpcs and cmds
return cmds
def main():
root = sys.argv[1]
# Get all commands from dispatch tables
cmds = []
for fname in SOURCES:
cmds += process_commands(os.path.join(root, fname))
cmds_by_name = {}
for cmd in cmds:
cmds_by_name[cmd.name] = cmd
# Ge... | line = line.rstrip()
if not in_rpcs:
if line == 'static const CRPCConvertParam vRPCConvertParams[] =':
in_rpcs = True
else:
if line.startswith('};'):
in_rpcs = False
elif '{' in line and '"' in line:
... | conditional_block |
check-rpc-mappings.py | #!/usr/bin/env python3
# Copyright (c) 2009-2019 The Bitcoin Core developers
# Copyright (c) 2014-2019 The DigiByte Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Check RPC argument consistency."""
from collect... |
def process_commands(fname):
"""Find and parse dispatch table in implementation file `fname`."""
cmds = []
in_rpcs = False
with open(fname, "r", encoding="utf8") as f:
for line in f:
line = line.rstrip()
if not in_rpcs:
if re.match("static const CRPCComm... | assert s[0] == '"'
assert s[-1] == '"'
return s[1:-1] | identifier_body |
check-rpc-mappings.py | #!/usr/bin/env python3
# Copyright (c) 2009-2019 The Bitcoin Core developers
# Copyright (c) 2014-2019 The DigiByte Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | import sys
# Source files (relative to root) to scan for dispatch tables
SOURCES = [
"src/rpc/server.cpp",
"src/rpc/blockchain.cpp",
"src/rpc/mining.cpp",
"src/rpc/misc.cpp",
"src/rpc/net.cpp",
"src/rpc/rawtransaction.cpp",
"src/wallet/rpcwallet.cpp",
]
# Source file (relative to root) cont... | """Check RPC argument consistency."""
from collections import defaultdict
import os
import re | random_line_split |
check-rpc-mappings.py | #!/usr/bin/env python3
# Copyright (c) 2009-2019 The Bitcoin Core developers
# Copyright (c) 2014-2019 The DigiByte Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Check RPC argument consistency."""
from collect... | (self, name, args):
self.name = name
self.args = args
class RPCArgument:
def __init__(self, names, idx):
self.names = names
self.idx = idx
self.convert = False
def parse_string(s):
assert s[0] == '"'
assert s[-1] == '"'
return s[1:-1]
def process_commands(fname... | __init__ | identifier_name |
htmlparagraphelement.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::codegen::Bindings::HTMLParagraphElementBinding;
use crate::dom::bindings::root::DomRoot... |
}
| {
Node::reflect_node(
Box::new(HTMLParagraphElement::new_inherited(
local_name, prefix, document,
)),
document,
HTMLParagraphElementBinding::Wrap,
)
} | identifier_body |
htmlparagraphelement.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::codegen::Bindings::HTMLParagraphElementBinding;
use crate::dom::bindings::root::DomRoot... | (
local_name: LocalName,
prefix: Option<Prefix>,
document: &Document,
) -> DomRoot<HTMLParagraphElement> {
Node::reflect_node(
Box::new(HTMLParagraphElement::new_inherited(
local_name, prefix, document,
)),
document,
HTM... | new | identifier_name |
htmlparagraphelement.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::codegen::Bindings::HTMLParagraphElementBinding;
use crate::dom::bindings::root::DomRoot... | document: &Document,
) -> HTMLParagraphElement {
HTMLParagraphElement {
htmlelement: HTMLElement::new_inherited(local_name, prefix, document),
}
}
#[allow(unrooted_must_root)]
pub fn new(
local_name: LocalName,
prefix: Option<Prefix>,
document... |
impl HTMLParagraphElement {
fn new_inherited(
local_name: LocalName,
prefix: Option<Prefix>, | random_line_split |
all.py | # Global configuration information used across all the
# translations of documentation.
#
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as stri... |
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
html_use_opensearch = 'yes'
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = N... | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True | random_line_split |
previews.js | /*!
* Copyright 2014 Apereo Foundation (AF) Licensed under the
* Educational Community License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may
* obtain a copy of the License at
*
* http://opensource.org/licenses/ECL-2.0
*
* Unless required by applicab... | // A collaborative document gets published or a new file body gets uploaded.
ContentAPI.on(ContentConstants.events.UPDATED_CONTENT_BODY, function(ctx, newContentObj, oldContentObj, revision) {
PreviewProcessorAPI.submitForProcessing(newContentObj.id, newContentObj.latestRevisionId);
}); | random_line_split | |
previews.js | /*!
* Copyright 2014 Apereo Foundation (AF) Licensed under the
* Educational Community License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may
* obtain a copy of the License at
*
* http://opensource.org/licenses/ECL-2.0
*
* Unless required by applicab... |
});
// A collaborative document gets published or a new file body gets uploaded.
ContentAPI.on(ContentConstants.events.UPDATED_CONTENT_BODY, function(ctx, newContentObj, oldContentObj, revision) {
PreviewProcessorAPI.submitForProcessing(newContentObj.id, newContentObj.latestRevisionId);
});
| {
PreviewProcessorAPI.submitForProcessing(newContentObj.id, oldContentObj.latestRevisionId);
} | conditional_block |
base-command.test.ts | // 3rd party imports installed via npm install
import { Test, TestFixture, AsyncTest, TestCase, AsyncSetup, AsyncTeardown, Teardown, Setup } from 'alsatian';
import { Command } from "commandpost";
import * as TypeMoq from "typemoq"; |
import { BaseCommand } from './base-command';
import { mockMessagerFactory } from '../../spec-lib'
import { CommandValidationResult, CommandResult } from '../models';
import { Assert } from 'alsatian-fluent-assertions';
@TestFixture("Base command tests")
export class BaseCommandTests {
cmdDef: Command<any, any>;
... | import { It, Times } from 'typemoq';
import * as _ from "lodash"; | random_line_split |
base-command.test.ts | // 3rd party imports installed via npm install
import { Test, TestFixture, AsyncTest, TestCase, AsyncSetup, AsyncTeardown, Teardown, Setup } from 'alsatian';
import { Command } from "commandpost";
import * as TypeMoq from "typemoq";
import { It, Times } from 'typemoq';
import * as _ from "lodash";
import { BaseCommand... | (cmd: Command<any, any>, opts: any, args: any): Promise<CommandResult> {
return new CommandResult();
}
} | run | identifier_name |
lib.rs | degree zero).
//!
//! Furthermore the crate is well structurized and documented - you can use
//! pieces it provides to create your own custom solutions (you can use or change
//! a tokenizer, parser and evaluator however you want). Look at implementations
//! of `PolynomialParser`, `LinearSolverParser`, `PolynomialEv... | /// List of tokens with their position.
///
/// Tokens are represented as space-efficient continous vector
/// of tuples consisting of position in a input string and a
/// corresponding Token.
pub type TokenList = Vec<(usize, Token)>;
/// Vector of unique identifiers.
///
/// `Token::Identifier` stores just a location... | random_line_split | |
lib.rs | can use or change
//! a tokenizer, parser and evaluator however you want). Look at implementations
//! of `PolynomialParser`, `LinearSolverParser`, `PolynomialEvaluator` or
//! `LinearSolverEvaluator` to see how to extend default implementations.
//!
//! With the crate a `xxcalc` binary is provided which can be used a... | EvaluationError | identifier_name | |
ldap.py | binding as a :class:`burpui.misc.auth.ldap.LdapUser` user.
"""
section = name = "LDAP:AUTH"
def __init__(self, app=None, handler=None):
""":func:`burpui.misc.auth.ldap.LdapLoader.__init__` establishes a
connection to the LDAP server.
:param app: Instance of the app we are runn... | (self):
return self.ldap
class LdapUser(BUIuser):
"""The :class:`burpui.misc.auth.ldap.LdapUser` class generates a ``Burp-UI``
user from a user object found in the LDAP server.
"""
def __init__(self, ldap=None, name=None):
""":func:`burpui.misc.auth.ldap.LdapUser.__init__` function fi... | loader | identifier_name |
ldap.py | binding as a :class:`burpui.misc.auth.ldap.LdapUser` user.
"""
section = name = "LDAP:AUTH"
def __init__(self, app=None, handler=None):
""":func:`burpui.misc.auth.ldap.LdapLoader.__init__` establishes a
connection to the LDAP server.
:param app: Instance of the app we are runn... | self.logger.debug("LDAP Connection = {0}".format(str(con)))
self.logger.info("Bound as user: {0}".format(dn))
return con.bind()
except Exception as e:
self.logger.error(
"Failed to authenticate user: {0}, {1}".format(dn, str(e))
... | """:func:`burpui.misc.auth.ldap.LdapLoader.check` authenticates a user
against the LDAP server.
:param dn: canonical `dn` of the user to authenticate as
:type dn: str
:param passwd: password of the user to authenticate as
:type passwd: str
:returns: True if bind was su... | identifier_body |
ldap.py | binding as a :class:`burpui.misc.auth.ldap.LdapUser` user.
"""
section = name = "LDAP:AUTH"
def __init__(self, app=None, handler=None):
""":func:`burpui.misc.auth.ldap.LdapLoader.__init__` establishes a
connection to the LDAP server.
:param app: Instance of the app we are runn... | local_certificate_file=self.cafile,
validate=self.validate,
version=self.version,
)
self.auto_bind = AUTO_BIND_TLS_BEFORE_BIND
if self.port:
try:
self.port = int(self.port)
except ValueError:
... | self.tls = Tls( | random_line_split |
ldap.py | binding as a :class:`burpui.misc.auth.ldap.LdapUser` user.
"""
section = name = "LDAP:AUTH"
def __init__(self, app=None, handler=None):
""":func:`burpui.misc.auth.ldap.LdapLoader.__init__` establishes a
connection to the LDAP server.
:param app: Instance of the app we are runn... |
for record in r:
attrs = record["attributes"]
if self.attr in attrs and searchval in attrs[self.attr]:
self.logger.info("Found DN: {0}".format(record["dn"]))
return {"dn": record["dn"], "cn": attrs["cn"][0]}
def _prefetch(self):
"""Prefetch ... | return r | conditional_block |
dependency_format.rs | of mixing rlibs and dylibs
//!
//! When producing a final artifact, such as a dynamic library, the compiler has
//! a choice between linking an rlib or linking a dylib of all upstream
//! dependencies. The linking phase must guarantee, however, that a library only
//! show up once in the object file. For example, it i... | (sess: &session::Session,
cnum: ast::CrateNum,
link: cstore::LinkagePreference,
m: &mut FnvHashMap<ast::CrateNum, cstore::LinkagePreference>) {
| add_library | identifier_name |
dependency_format.rs | rlib contains only one library (it's just an object file)
//! 3. Each dylib can contain more than one library (due to static linking),
//! and can also bring in many dynamic dependencies.
//!
//! With these constraints in mind, it's generally a very difficult problem to
//! find a solution that's not "all r... | } | random_line_split | |
dependency_format.rs | of mixing rlibs and dylibs
//!
//! When producing a final artifact, such as a dynamic library, the compiler has
//! a choice between linking an rlib or linking a dylib of all upstream
//! dependencies. The linking phase must guarantee, however, that a library only
//! show up once in the object file. For example, it i... | None => {}
}
sess.cstore.iter_crate_data(|cnum, data| {
let src = sess.cstore.get_used_crate_source(cnum).unwrap();
if src.rlib.is_some() { return }
sess.err(&format!("dependency `{}` not found in rlib format",
... | {
match ty {
// If the global prefer_dynamic switch is turned off, first attempt
// static linkage (this can fail).
config::CrateTypeExecutable if !sess.opts.cg.prefer_dynamic => {
match attempt_static(sess) {
Some(v) => return v,
None => {}
... | identifier_body |
simple.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 ... |
fn maybe_yield(self: Box<SimpleTask>, _cur_task: Box<Task>) { fail!() }
fn spawn_sibling(self: Box<SimpleTask>,
_cur_task: Box<Task>,
_opts: TaskOpts,
_f: proc():Send) {
fail!()
}
fn local_io<'a>(&'a mut self) -> Option<rtio::LocalI... | { fail!() } | identifier_body |
simple.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 ... |
struct SimpleTask {
lock: NativeMutex,
awoken: bool,
}
impl Runtime for SimpleTask {
// Implement the simple tasks of descheduling and rescheduling, but only in
// a simple number of cases.
fn deschedule(mut self: Box<SimpleTask>,
times: uint,
mut cur_task: Box<... | use std::rt::rtio;
use std::rt::task::{Task, BlockedTask, TaskOpts}; | random_line_split |
simple.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: Box<SimpleTask>) -> Box<Any> { fail!() }
}
pub fn task() -> Box<Task> {
let mut task = box Task::new();
task.put_runtime(box SimpleTask {
lock: unsafe {NativeMutex::new()},
awoken: false,
});
return task;
}
| wrap | identifier_name |
circle_queue.rs | #[derive(Debug)]
struct CircleQueue {
queue: Vec<i32>,
head: i32,
tail: i32,
n: i32,
}
impl CircleQueue {
fn new(n: i32) -> Self {
CircleQueue {
queue: vec![-1; n as usize],
head: 0,
tail: 0,
n: n,
}
}
fn enqueue(&mut self, nu... |
let shift = self.queue[self.head as usize];
self.head = (self.head + 1) % self.n;
shift
}
fn print_all(&self) {
let mut s = String::from("");
for i in self.head..self.tail {
s.push(self.queue[i as usize] as u8 as char);
s.push_str("->");
... | { return -1; } | conditional_block |
circle_queue.rs | #[derive(Debug)]
struct CircleQueue {
queue: Vec<i32>,
head: i32,
tail: i32,
n: i32,
}
impl CircleQueue {
fn new(n: i32) -> Self {
CircleQueue {
queue: vec![-1; n as usize],
head: 0,
tail: 0,
n: n,
}
}
fn enqueue(&mut self, nu... | s.push_str("->");
}
println!("{:?}", s);
}
}
fn main() {
let mut queue = CircleQueue::new(10);
queue.enqueue(2);
queue.enqueue(2);
queue.enqueue(2);
queue.enqueue(2);
queue.dequeue();
queue.dequeue();
queue.enqueue(4);
queue.dequeue();
queue.print... | random_line_split | |
circle_queue.rs | #[derive(Debug)]
struct CircleQueue {
queue: Vec<i32>,
head: i32,
tail: i32,
n: i32,
}
impl CircleQueue {
fn new(n: i32) -> Self {
CircleQueue {
queue: vec![-1; n as usize],
head: 0,
tail: 0,
n: n,
}
}
fn enqueue(&mut self, nu... |
fn print_all(&self) {
let mut s = String::from("");
for i in self.head..self.tail {
s.push(self.queue[i as usize] as u8 as char);
s.push_str("->");
}
println!("{:?}", s);
}
}
fn main() {
let mut queue = CircleQueue::new(10);
queue.enqueue(2);
... | {
if self.head == self.tail { return -1; }
let shift = self.queue[self.head as usize];
self.head = (self.head + 1) % self.n;
shift
} | identifier_body |
circle_queue.rs | #[derive(Debug)]
struct CircleQueue {
queue: Vec<i32>,
head: i32,
tail: i32,
n: i32,
}
impl CircleQueue {
fn new(n: i32) -> Self {
CircleQueue {
queue: vec![-1; n as usize],
head: 0,
tail: 0,
n: n,
}
}
fn enqueue(&mut self, nu... | () {
let mut queue = CircleQueue::new(10);
queue.enqueue(2);
queue.enqueue(2);
queue.enqueue(2);
queue.enqueue(2);
queue.dequeue();
queue.dequeue();
queue.enqueue(4);
queue.dequeue();
queue.print_all();
}
| main | identifier_name |
clear_buffer_object.py | '''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... | ( function ):
return _p.createFunction( function,_p.PLATFORM.GL,'GL_ARB_clear_buffer_object',error_checker=_errors._error_checker)
@_f
@_p.types(None,_cs.GLenum,_cs.GLenum,_cs.GLenum,_cs.GLenum,ctypes.c_void_p)
def glClearBufferData(target,internalformat,format,type,data):pass
@_f
@_p.types(None,_cs.GLenum,_cs.GLe... | _f | identifier_name |
clear_buffer_object.py | '''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... |
@_f
@_p.types(None,_cs.GLenum,_cs.GLenum,_cs.GLenum,_cs.GLenum,ctypes.c_void_p)
def glClearBufferData(target,internalformat,format,type,data):pass
@_f
@_p.types(None,_cs.GLenum,_cs.GLenum,_cs.GLintptr,_cs.GLsizeiptr,_cs.GLenum,_cs.GLenum,ctypes.c_void_p)
def glClearBufferSubData(target,internalformat,offset,size,form... | return _p.createFunction( function,_p.PLATFORM.GL,'GL_ARB_clear_buffer_object',error_checker=_errors._error_checker) | identifier_body |
clear_buffer_object.py | from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_EXTENSION_NAME = 'GL_ARB_clear_buffer_object'
def _f( fun... | '''Autogenerated by xml_generate script, do not edit!''' | random_line_split | |
ticket.js | /* globals setTimeout, clearTimeout */
var Transit = require('./transit.js');
var Errors = require('./errors.js');
/**
* The ticket instance takes an single argument in the browser environment; the browser window
*
* @param {object} emmitter The event emitter that emits the kernel events
* @param {Resolver} resolv... |
return normalizer.normalizeBrowserEvent(e);
}
};
};
module.exports = Ticket; | {
throw new Error('[CLIENT] normalize() expects argument to be an DOMEvent, received:' + e);
} | conditional_block |
ticket.js | /* globals setTimeout, clearTimeout */
var Transit = require('./transit.js');
var Errors = require('./errors.js');
/**
* The ticket instance takes an single argument in the browser environment; the browser window
*
* @param {object} emmitter The event emitter that emits the kernel events
* @param {Resolver} resolv... | var req = arguments[0];
var res = arguments[1];
if(req.url === undefined)
throw new Error('[SERVER] normalize() expects first arguments to be an req object with an url, received: '+ req);
if(res.statusCode === undefined)
throw new Error('[SERVER] normalize() expects second argu... | if(self.isServer()) {
if(arguments.length !== 2) {
throw new Error('[SERVER] normalize() expects 2 arguments, received: '+ arguments.length);
}
| random_line_split |
directoryresult.js | //
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requi... |
DirectoryResult.parse = function (dirXml) {
return new DirectoryResult(dirXml.Name);
};
DirectoryResult.prototype.getPropertiesFromHeaders = function (headers) {
var self = this;
var setDirectoryPropertyFromHeaders = function (directoryProperty, headerProperty) {
if (!self[directoryProperty] && headers[he... | {
this.name = name;
} | identifier_body |
directoryresult.js | //
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requi... | };
module.exports = DirectoryResult; | setDirectoryPropertyFromHeaders('etag', HeaderConstants.ETAG);
setDirectoryPropertyFromHeaders('lastModified', HeaderConstants.LAST_MODIFIED);
setDirectoryPropertyFromHeaders('requestId', HeaderConstants.REQUEST_ID_HEADER); | random_line_split |
directoryresult.js | //
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requi... | (name) {
this.name = name;
}
DirectoryResult.parse = function (dirXml) {
return new DirectoryResult(dirXml.Name);
};
DirectoryResult.prototype.getPropertiesFromHeaders = function (headers) {
var self = this;
var setDirectoryPropertyFromHeaders = function (directoryProperty, headerProperty) {
if (!self[di... | DirectoryResult | identifier_name |
directoryresult.js | //
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requi... |
};
setDirectoryPropertyFromHeaders('etag', HeaderConstants.ETAG);
setDirectoryPropertyFromHeaders('lastModified', HeaderConstants.LAST_MODIFIED);
setDirectoryPropertyFromHeaders('requestId', HeaderConstants.REQUEST_ID_HEADER);
};
module.exports = DirectoryResult; | {
self[directoryProperty] = headers[headerProperty.toLowerCase()];
} | conditional_block |
op.rs | #[derive(Debug, PartialEq)]
pub enum InfixOp {
// A + B
Add,
// A - B
Sub,
// A / B
Div,
// A * B
Mul,
// A % B
Mod,
// A ^ B
Pow,
// A equals B (traditionally A == B)
Equ,
// A < B
Lt,
// A <= B
Lte,
// A > B
Gt,
// A >= B
Gte,
}
... | {
// -A
Negate,
// not A (traditionally !A)
Not
}
| UnaryOp | identifier_name |
op.rs | #[derive(Debug, PartialEq)]
pub enum InfixOp {
// A + B
Add,
// A - B
Sub,
// A / B
Div,
// A * B
Mul,
// A % B
Mod, | // A ^ B
Pow,
// A equals B (traditionally A == B)
Equ,
// A < B
Lt,
// A <= B
Lte,
// A > B
Gt,
// A >= B
Gte,
}
impl InfixOp {
pub fn get_precedence(&self) -> u8 {
// Precedence(High -> Low):
// 9. () | [] .
// 8. not | negate
// 7. ... | random_line_split | |
test_reboot_unprovisioned.py | # Copyright 2015 Rackspace, Inc
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
@mock.patch('onmetal_scripts.reboot_unprovisioned.RebootUnprovisioned.'
'ironic_client')
def test_run(self, ironic_mock):
active_node = self._get_test_node(
provision_state=states.ACTIVE,
instance_uuid='118ad976-084a-443f-9ec5-77d477f2bfcc')
inactive_nod... | self.script = reboot_unprovisioned.RebootUnprovisioned()
self.script.get_argument = mock.Mock()
self.script.get_argument.return_value = 0 | identifier_body |
test_reboot_unprovisioned.py | # Copyright 2015 Rackspace, Inc
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | inactive_node = self._get_test_node(
provision_state=states.AVAILABLE,
instance_uuid=None,
maintenance=False)
ironic_mock.list_nodes.return_value = [active_node, inactive_node]
self.script.run()
ironic_mock.set_target_power_state.assert_called_once_... | random_line_split | |
test_reboot_unprovisioned.py | # Copyright 2015 Rackspace, Inc
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | (self, ironic_mock):
active_node = self._get_test_node(
provision_state=states.ACTIVE,
instance_uuid='118ad976-084a-443f-9ec5-77d477f2bfcc')
inactive_node = self._get_test_node(
provision_state=states.AVAILABLE,
instance_uuid=None,
maintenance=... | test_run | identifier_name |
index.js | var Transform = require('stream').Transform,
util = require('util');
var StreamConcat = function(streams, options) {
Transform.call(this, options);
var self = this;
this.streams = streams;
this.canAddStream = true;
this.currentStream = null;
this.streamIndex = 0;
var nextStream = function() {
s... | this.canAddStream = false;
self.currentStream = self.streams();
}
if (self.currentStream === null) {
this.canAddStream = false;
self.push(null);
} else {
self.currentStream.pipe(self, {end: false});
self.currentStream.on('end', nextStream);
}
};
nextStream();
};... | random_line_split | |
union_find.rs | pub struct UnionFind {
parents: Vec<usize>,
ranks: Vec<u64>
}
impl UnionFind {
pub fn new(size: usize) -> UnionFind {
UnionFind {
parents: (0..size).map(|i| i).collect(),
ranks: (0..size).map(|_| 0).collect()
}
}
pub fn find(&mut self, x: usize) -> usize {
... | assert!(uf.find(2) != uf.find(6));
}
} | assert!(uf.find(3) == uf.find(8));
assert!(uf.find(3) != uf.find(6)); | random_line_split |
union_find.rs | pub struct UnionFind {
parents: Vec<usize>,
ranks: Vec<u64>
}
impl UnionFind {
pub fn new(size: usize) -> UnionFind {
UnionFind {
parents: (0..size).map(|i| i).collect(),
ranks: (0..size).map(|_| 0).collect()
}
}
pub fn find(&mut self, x: usize) -> usize {
... |
}
| {
let mut uf = UnionFind::new(10);
uf.union(3, 5);
uf.union(7, 8);
uf.union(7, 9);
uf.union(5, 9);
assert!(uf.find(3) == uf.find(8));
assert!(uf.find(3) != uf.find(6));
assert!(uf.find(2) != uf.find(6));
} | identifier_body |
union_find.rs | pub struct UnionFind {
parents: Vec<usize>,
ranks: Vec<u64>
}
impl UnionFind {
pub fn | (size: usize) -> UnionFind {
UnionFind {
parents: (0..size).map(|i| i).collect(),
ranks: (0..size).map(|_| 0).collect()
}
}
pub fn find(&mut self, x: usize) -> usize {
let parent = self.parents[x];
if parent != x {
self.parents[x] = self.find... | new | identifier_name |
PrintStatus.py | # encoding: utf-8
# module gtk._gtk
# from /usr/lib/python2.7/dist-packages/gtk-2.0/gtk/_gtk.so
# by generator 1.135
# no doc
# imports |
class PrintStatus(__gobject.GEnum):
# no doc
def __init__(self, *args, **kwargs): # real signature unknown
pass
__weakref__ = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
"""list of weak references to the object (if defined)"""
__dict__ = None # (!)... | import atk as __atk
import gio as __gio
import gobject as __gobject
import gobject._gobject as __gobject__gobject
| random_line_split |
PrintStatus.py | # encoding: utf-8
# module gtk._gtk
# from /usr/lib/python2.7/dist-packages/gtk-2.0/gtk/_gtk.so
# by generator 1.135
# no doc
# imports
import atk as __atk
import gio as __gio
import gobject as __gobject
import gobject._gobject as __gobject__gobject
class | (__gobject.GEnum):
# no doc
def __init__(self, *args, **kwargs): # real signature unknown
pass
__weakref__ = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
"""list of weak references to the object (if defined)"""
__dict__ = None # (!) real value is ''
... | PrintStatus | identifier_name |
PrintStatus.py | # encoding: utf-8
# module gtk._gtk
# from /usr/lib/python2.7/dist-packages/gtk-2.0/gtk/_gtk.so
# by generator 1.135
# no doc
# imports
import atk as __atk
import gio as __gio
import gobject as __gobject
import gobject._gobject as __gobject__gobject
class PrintStatus(__gobject.GEnum):
# no doc
| def __init__(self, *args, **kwargs): # real signature unknown
pass
__weakref__ = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
"""list of weak references to the object (if defined)"""
__dict__ = None # (!) real value is ''
__enum_values__ = {
0: 0... | identifier_body | |
colorConverter.js | /**
* Created by JinWYP on 7/27/16.
*/
var expect = require('chai').expect;
var colorConverter = require('../../../business-libs/colorConverter');
describe('Color Code Converter', function() {
describe('RGB to Hex conversion', function() {
it('converts the basic colors', function() {
va... | expect(blue).to.deep.equal([0, 0, 255]);
});
});
}); | var blue = colorConverter.hexToRgb('0000ff');
expect(red).to.deep.equal([255, 0, 0]);
expect(green).to.deep.equal([0, 255, 0]); | random_line_split |
detect.rs | /* Copyright (C) 2017 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
* Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARR... | unsafe {
*buffer = ptr::null();
*buffer_len = 0;
}
return 0;
}
#[no_mangle]
pub extern "C" fn rs_smb_tx_match_dce_opnum(tx: &mut SMBTransaction,
dce_data: &mut DCEOpnumData)
-> u8
{
SCLogDebug!("rs_sm... | {
match tx.type_data {
Some(SMBTransactionTypeData::DCERPC(ref x)) => {
let vref = if direction == STREAM_TOSERVER {
&x.stub_data_ts
} else {
&x.stub_data_tc
};
if vref.len() > 0 {
unsafe {
*b... | identifier_body |
detect.rs | /* Copyright (C) 2017 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
* Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARR... | if range.range1 == x.opnum as u32 {
return 1;
} else if range.range1 <= x.opnum as u32 && range.range2 >= x.opnum as u32 {
return 1;
}
}
}
}
... | if range.range2 == DETECT_DCE_OPNUM_RANGE_UNINITIALIZED { | random_line_split |
detect.rs | /* Copyright (C) 2017 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
* Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARR... | (tx: &mut SMBTransaction,
dce_data: &mut DCEOpnumData)
-> u8
{
SCLogDebug!("rs_smb_tx_get_dce_opnum: start");
match tx.type_data {
Some(SMBTransactionTypeData::DCERPC(ref x)) => {
if x.req_cmd == 1 { // REQ... | rs_smb_tx_match_dce_opnum | identifier_name |
index.js | // Copyright 2016, Google, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wr... | });
} catch (err) {
console.error(err);
return context.failure(err.message);
}
}
/**
* Retrieves a record.
*
* @example
* gcloud alpha functions call ds-get --data '{"kind":"gcf-test","key":"foobar"}'
*
* @param {Object} context Cloud Function context.
* @param {Function} context.success Succes... | {
try {
// The value contains a JSON document representing the entity we want to save
if (!data.value) {
throw new Error('Value not provided. Make sure you have a "value" ' +
'property in your request');
}
var key = getKeyFromRequestData(data);
return datastore.save({
key: ke... | identifier_body |
index.js | // Copyright 2016, Google, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wr... | */
function get (context, data) {
try {
var key = getKeyFromRequestData(data);
return datastore.get(key, function (err, entity) {
if (err) {
console.error(err);
return context.failure(err);
}
// The get operation will not fail for a non-existent entity, it just
// re... | random_line_split | |
index.js | // Copyright 2016, Google, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wr... |
return context.success('Entity saved');
});
} catch (err) {
console.error(err);
return context.failure(err.message);
}
}
/**
* Retrieves a record.
*
* @example
* gcloud alpha functions call ds-get --data '{"kind":"gcf-test","key":"foobar"}'
*
* @param {Object} context Cloud Function conte... | {
console.error(err);
return context.failure(err);
} | conditional_block |
index.js | // Copyright 2016, Google, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wr... | (context, data) {
try {
var key = getKeyFromRequestData(data);
return datastore.get(key, function (err, entity) {
if (err) {
console.error(err);
return context.failure(err);
}
// The get operation will not fail for a non-existent entity, it just
// returns null.
... | get | identifier_name |
cht.rs | // Copyright 2015-2017 Parity Technologies (UK) Ltd. |
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITH... | // This file is part of Parity. | random_line_split |
cht.rs | // Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any lat... |
/// Check a proof for a CHT.
/// Given a set of a trie nodes, a number to query, and a trie root,
/// verify the given trie branch and extract the canonical hash and total difficulty.
// TODO: better support for partially-checked queries.
pub fn check_proof(proof: &[Bytes], num: u64, root: H256) -> Option<(H256, U256... | {
let mut v = Vec::with_capacity(SIZE as usize);
let start_num = start_number(cht_num) as usize;
for (i, (h, td)) in iterable.into_iter().take(SIZE as usize).enumerate() {
v.push((key!(i + start_num).to_vec(), val!(h, td).to_vec()))
}
if v.len() == SIZE as usize {
Some(::util::triehash::trie_root(v))
} else... | identifier_body |
cht.rs | // Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any lat... | () {
assert!(::cht::block_to_cht_number(0).is_none());
assert_eq!(::cht::block_to_cht_number(1).unwrap(), 0);
assert_eq!(::cht::block_to_cht_number(::cht::SIZE + 1).unwrap(), 1);
assert_eq!(::cht::block_to_cht_number(::cht::SIZE).unwrap(), 0);
}
#[test]
fn start_number() {
assert_eq!(::cht::start_number(0... | block_to_cht_number | identifier_name |
__init__.py | #!/usr/bin/python
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
# All Rights Reserved
###############Credits##########################... | #
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
##############################################################################
import account | random_line_split | |
mod.rs | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
use common::SourceLocationKey;
use fixture_tests::Fixture;
use graphql_ir::{build, Program};
use graphql_syntax::parse_executable;
... | Ok(result.join("\n\n"))
}
| {
let ast = parse_executable(
fixture.content,
SourceLocationKey::standalone(fixture.file_name),
)
.unwrap();
let schema = get_test_schema();
let ir = build(&schema, &ast.definitions).unwrap();
let program = Program::from_definitions(Arc::clone(&schema), ir);
let next_program... | identifier_body |
mod.rs | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
use common::SourceLocationKey;
use fixture_tests::Fixture;
use graphql_ir::{build, Program};
use graphql_syntax::parse_executable;
... | (fixture: &Fixture<'_>) -> Result<String, String> {
let ast = parse_executable(
fixture.content,
SourceLocationKey::standalone(fixture.file_name),
)
.unwrap();
let schema = get_test_schema();
let ir = build(&schema, &ast.definitions).unwrap();
let program = Program::from_definiti... | transform_fixture | identifier_name |
mod.rs | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
use common::SourceLocationKey;
use fixture_tests::Fixture;
use graphql_ir::{build, Program};
use graphql_syntax::parse_executable;
... | .chain(
next_program
.operations()
.map(|def| print_operation(&schema, &def, JsModuleFormat::Haste)),
)
.collect::<Vec<_>>();
result.sort_unstable();
Ok(result.join("\n\n"))
} | .fragments()
.map(|def| print_fragment(&schema, &def, JsModuleFormat::Haste)) | random_line_split |
gn.py | #!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""This script is a wrapper around the GN binary that is pulled from Google
Cloud Storage when you sync Chrome. The binaries go into pl... | (args):
bin_path = gclient_utils.GetBuildtoolsPlatformBinaryPath()
if not bin_path:
print >> sys.stderr, ('gn.py: Could not find checkout in any parent of '
'the current path.\nThis must be run inside a '
'checkout.')
return 1
gn_path = os.path.join(bin_... | main | identifier_name |
gn.py | #!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""This script is a wrapper around the GN binary that is pulled from Google
Cloud Storage when you sync Chrome. The binaries go into pl... |
gn_path = os.path.join(bin_path, 'gn' + gclient_utils.GetExeSuffix())
if not os.path.exists(gn_path):
print >> sys.stderr, 'gn.py: Could not find gn executable at: %s' % gn_path
return 2
else:
return subprocess.call([gn_path] + sys.argv[1:])
if __name__ == '__main__':
sys.exit(main(sys.argv))
| print >> sys.stderr, ('gn.py: Could not find checkout in any parent of '
'the current path.\nThis must be run inside a '
'checkout.')
return 1 | conditional_block |
gn.py | #!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""This script is a wrapper around the GN binary that is pulled from Google
Cloud Storage when you sync Chrome. The binaries go into pl... |
if __name__ == '__main__':
sys.exit(main(sys.argv))
| bin_path = gclient_utils.GetBuildtoolsPlatformBinaryPath()
if not bin_path:
print >> sys.stderr, ('gn.py: Could not find checkout in any parent of '
'the current path.\nThis must be run inside a '
'checkout.')
return 1
gn_path = os.path.join(bin_path, 'gn'... | identifier_body |
gn.py | #!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""This script is a wrapper around the GN binary that is pulled from Google
Cloud Storage when you sync Chrome. The binaries go into pl... | print >> sys.stderr, ('gn.py: Could not find checkout in any parent of '
'the current path.\nThis must be run inside a '
'checkout.')
return 1
gn_path = os.path.join(bin_path, 'gn' + gclient_utils.GetExeSuffix())
if not os.path.exists(gn_path):
print >... | random_line_split | |
settings.py | # Configuration for fargo.
# You can override Fargo default settings here
# Fargo is a Django application: for the full list of settings and their
# values, see https://docs.djangoproject.com/en/1.7/ref/settings/
# For more information on settings see
# https://docs.djangoproject.com/en/1.7/topics/settings/
# WARNING... | # CSRF_COOKIE_SECURE = True
# SESSION_COOKIE_SECURE = True | # HTTPS Security | random_line_split |
0026_auto_20180921_1630.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-09-21 19:30
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import smart_selects.db_fields
class | (migrations.Migration):
dependencies = [
('cerimonial', '0025_auto_20180921_1623'),
]
operations = [
migrations.AlterField(
model_name='endereco',
name='distrito',
field=smart_selects.db_fields.ChainedForeignKey(auto_choose=True, blank=True, chained_fiel... | Migration | identifier_name |
0026_auto_20180921_1630.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-09-21 19:30
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import smart_selects.db_fields
class Migration(migrations.Migration):
dependencies = [
('cerimonial', '0025_auto_2018... | model_name='endereco',
name='estado',
field=models.ForeignKey(default=21, on_delete=django.db.models.deletion.CASCADE, related_name='endereco_set', to='core.Estado', verbose_name='Estado'),
),
migrations.AlterField(
model_name='endereco',
name=... | ),
migrations.AlterField( | random_line_split |
0026_auto_20180921_1630.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-09-21 19:30
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import smart_selects.db_fields
class Migration(migrations.Migration):
| migrations.AlterField(
model_name='endereco',
name='regiao_municipal',
field=smart_selects.db_fields.ChainedForeignKey(auto_choose=True, blank=True, chained_field='municipio', chained_model_field='municipio', null=True, on_delete=django.db.models.deletion.CASCADE, to='core.Re... | dependencies = [
('cerimonial', '0025_auto_20180921_1623'),
]
operations = [
migrations.AlterField(
model_name='endereco',
name='distrito',
field=smart_selects.db_fields.ChainedForeignKey(auto_choose=True, blank=True, chained_field='municipio', chained_model_... | identifier_body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.