file_name large_stringlengths 4 140 | prefix large_stringlengths 0 39k | suffix large_stringlengths 0 36.1k | middle large_stringlengths 0 29.4k | fim_type large_stringclasses 4
values |
|---|---|---|---|---|
models.py | #!/usr/bin/env python
# encoding: utf-8
"""
models.py
Created by Darcy Liu on 2012-03-03.
Copyright (c) 2012 Close To U. All rights reserved.
"""
from django.db import models
from django.contrib.auth.models import User
# class Setting(models.Model):
# sid = models.AutoField(primary_key=True)
# option = model... | (models.Model):
key = models.AutoField(primary_key=True)
name = models.CharField(max_length=256,verbose_name='name')
slug = models.CharField(unique=True,max_length=128,verbose_name='slug')
meta = models.TextField(blank=True, verbose_name='meta')
description = models.TextField(blank=True, verbose_nam... | Minisite | identifier_name |
models.py | #!/usr/bin/env python
# encoding: utf-8
"""
models.py
Created by Darcy Liu on 2012-03-03.
Copyright (c) 2012 Close To U. All rights reserved.
"""
from django.db import models
from django.contrib.auth.models import User
# class Setting(models.Model):
# sid = models.AutoField(primary_key=True)
# option = model... | slug = models.CharField(unique=True,max_length=128,verbose_name='slug')
meta = models.TextField(blank=True, verbose_name='meta')
description = models.TextField(blank=True, verbose_name='description')
author = models.ForeignKey(User,verbose_name='author')
created = models.DateTimeField(auto_now_add=T... | name = models.CharField(max_length=256,verbose_name='name') | random_line_split |
models.py | #!/usr/bin/env python
# encoding: utf-8
"""
models.py
Created by Darcy Liu on 2012-03-03.
Copyright (c) 2012 Close To U. All rights reserved.
"""
from django.db import models
from django.contrib.auth.models import User
# class Setting(models.Model):
# sid = models.AutoField(primary_key=True)
# option = model... |
class Meta:
unique_together = (('slug', 'minisite'),) | result = self.name
return unicode(result) | identifier_body |
inherited.rs | use super::callee::DeferredCallResolution;
use super::MaybeInProgressTables;
use rustc_hir as hir;
use rustc_hir::def_id::{DefIdMap, LocalDefId};
use rustc_hir::HirIdMap;
use rustc_infer::infer;
use rustc_infer::infer::{InferCtxt, InferOk, TyCtxtInferExt};
use rustc_middle::ty::fold::TypeFoldable;
use rustc_middle::ty... | RefCell<Vec<(Ty<'tcx>, Span, traits::ObligationCauseCode<'tcx>)>>,
// When we process a call like `c()` where `c` is a closure type,
// we may not have decided yet whether `c` is a `Fn`, `FnMut`, or
// `FnOnce` closure. In that case, we defer full resolution of the
// call until upvar inference... | // These obligations are added in a later stage of typeck.
pub(super) deferred_sized_obligations: | random_line_split |
inherited.rs | use super::callee::DeferredCallResolution;
use super::MaybeInProgressTables;
use rustc_hir as hir;
use rustc_hir::def_id::{DefIdMap, LocalDefId};
use rustc_hir::HirIdMap;
use rustc_infer::infer;
use rustc_infer::infer::{InferCtxt, InferOk, TyCtxtInferExt};
use rustc_middle::ty::fold::TypeFoldable;
use rustc_middle::ty... |
pub(super) fn register_predicates<I>(&self, obligations: I)
where
I: IntoIterator<Item = traits::PredicateObligation<'tcx>>,
{
for obligation in obligations {
self.register_predicate(obligation);
}
}
pub(super) fn register_infer_ok_obligations<T>(&self, infer_o... | {
debug!("register_predicate({:?})", obligation);
if obligation.has_escaping_bound_vars() {
span_bug!(obligation.cause.span, "escaping bound vars in predicate {:?}", obligation);
}
self.fulfillment_cx.borrow_mut().register_predicate_obligation(self, obligation);
} | identifier_body |
inherited.rs | use super::callee::DeferredCallResolution;
use super::MaybeInProgressTables;
use rustc_hir as hir;
use rustc_hir::def_id::{DefIdMap, LocalDefId};
use rustc_hir::HirIdMap;
use rustc_infer::infer;
use rustc_infer::infer::{InferCtxt, InferOk, TyCtxtInferExt};
use rustc_middle::ty::fold::TypeFoldable;
use rustc_middle::ty... | (&self) -> &Self::Target {
&self.infcx
}
}
/// Helper type of a temporary returned by `Inherited::build(...)`.
/// Necessary because we can't write the following bound:
/// `F: for<'b, 'tcx> where 'tcx FnOnce(Inherited<'b, 'tcx>)`.
pub struct InheritedBuilder<'tcx> {
infcx: infer::InferCtxtBuilder<'tcx... | deref | identifier_name |
inherited.rs | use super::callee::DeferredCallResolution;
use super::MaybeInProgressTables;
use rustc_hir as hir;
use rustc_hir::def_id::{DefIdMap, LocalDefId};
use rustc_hir::HirIdMap;
use rustc_infer::infer;
use rustc_infer::infer::{InferCtxt, InferOk, TyCtxtInferExt};
use rustc_middle::ty::fold::TypeFoldable;
use rustc_middle::ty... |
self.fulfillment_cx.borrow_mut().register_predicate_obligation(self, obligation);
}
pub(super) fn register_predicates<I>(&self, obligations: I)
where
I: IntoIterator<Item = traits::PredicateObligation<'tcx>>,
{
for obligation in obligations {
self.register_predicate... | {
span_bug!(obligation.cause.span, "escaping bound vars in predicate {:?}", obligation);
} | conditional_block |
global.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/. */
//! Abstractions for global scopes.
//!
//! This module contains smart pointers to global scopes, to simplify writ... | (&self) -> GlobalRoot {
match *self {
GlobalField::Window(ref window) => GlobalRoot::Window(window.root()),
GlobalField::Worker(ref worker) => GlobalRoot::Worker(worker.root()),
}
}
}
impl GlobalUnrooted {
/// Create a stack-bounded root for this reference.
pub fn ro... | root | identifier_name |
global.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/. */
//! Abstractions for global scopes.
//!
//! This module contains smart pointers to global scopes, to simplify writ... | match *self {
GlobalRef::Window(ref window) => window.new_script_pair(),
GlobalRef::Worker(ref worker) => worker.new_script_pair(),
}
}
/// Process a single event as if it were the next event in the task queue for
/// this global.
pub fn process_event(&self, msg:... | /// Create a new sender/receiver pair that can be used to implement an on-demand
/// event loop. Used for implementing web APIs that require blocking semantics
/// without resorting to nested event loops.
pub fn new_script_pair(&self) -> (Box<ScriptChan+Send>, Box<ScriptPort+Send>) { | random_line_split |
global.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/. */
//! Abstractions for global scopes.
//!
//! This module contains smart pointers to global scopes, to simplify writ... |
/// Process a single event as if it were the next event in the task queue for
/// this global.
pub fn process_event(&self, msg: ScriptMsg) {
match *self {
GlobalRef::Window(_) => ScriptTask::process_event(msg),
GlobalRef::Worker(ref worker) => worker.process_event(msg),
... | {
match *self {
GlobalRef::Window(ref window) => window.new_script_pair(),
GlobalRef::Worker(ref worker) => worker.new_script_pair(),
}
} | identifier_body |
ngb-calendar-islamic-umalqura.ts | import {NgbCalendarIslamicCivil} from './ngb-calendar-islamic-civil';
import {NgbDate} from '../ngb-date';
import {Injectable} from '@angular/core';
/**
* Umalqura calendar is one type of Hijri calendars used in islamic countries.
* This Calendar is used by Saudi Arabia for administrative purpose.
* Unlike tabular ... | extends NgbCalendarIslamicCivil {
/**
* Returns the equivalent islamic(Umalqura) date value for a give input Gregorian date.
* `gdate` is s JS Date to be converted to Hijri.
*/
fromGregorian(gDate: Date): NgbDate {
let hDay = 1, hMonth = 0, hYear = 1300;
let daysDiff = getDaysDiff(gDate, GREGORIAN_FI... | NgbCalendarIslamicUmalqura | identifier_name |
ngb-calendar-islamic-umalqura.ts | import {NgbCalendarIslamicCivil} from './ngb-calendar-islamic-civil';
import {NgbDate} from '../ngb-date';
import {Injectable} from '@angular/core';
/**
* Umalqura calendar is one type of Hijri calendars used in islamic countries.
* This Calendar is used by Saudi Arabia for administrative purpose.
* Unlike tabular ... |
return super.getDaysPerMonth(hMonth, hYear);
}
}
| {
const pos = hYear - HIJRI_BEGIN;
return +MONTH_LENGTH[pos][hMonth - 1] + 29;
} | conditional_block |
ngb-calendar-islamic-umalqura.ts | import {NgbCalendarIslamicCivil} from './ngb-calendar-islamic-civil';
import {NgbDate} from '../ngb-date';
import {Injectable} from '@angular/core';
/**
* Umalqura calendar is one type of Hijri calendars used in islamic countries.
* This Calendar is used by Saudi Arabia for administrative purpose.
* Unlike tabular ... | // 1305-1309
'001101101100', '101010101101', '010101010101', '011010101001', '011110010010',
// 1310-1314
'101110101001', '010111010100', '101011011010', '010101011100', '110100101101',
// 1315-1319
'011010010101', '011101001010', '101101010100', '101101101010', '010110101101',
// 1320-1324
'01001010111... | random_line_split | |
ngb-calendar-islamic-umalqura.ts | import {NgbCalendarIslamicCivil} from './ngb-calendar-islamic-civil';
import {NgbDate} from '../ngb-date';
import {Injectable} from '@angular/core';
/**
* Umalqura calendar is one type of Hijri calendars used in islamic countries.
* This Calendar is used by Saudi Arabia for administrative purpose.
* Unlike tabular ... |
/**
* Converts the current Hijri date to Gregorian.
*/
toGregorian(hDate: NgbDate): Date {
const hYear = hDate.year;
const hMonth = hDate.month - 1;
const hDay = hDate.day;
let gDate = new Date(GREGORIAN_FIRST_DATE);
let dayDiff = hDay - 1;
if (hYear >= HIJRI_BEGIN && hYear <= HIJRI_END... | {
let hDay = 1, hMonth = 0, hYear = 1300;
let daysDiff = getDaysDiff(gDate, GREGORIAN_FIRST_DATE);
if (gDate.getTime() - GREGORIAN_FIRST_DATE.getTime() >= 0 && gDate.getTime() - GREGORIAN_LAST_DATE.getTime() <= 0) {
let year = 1300;
for (let i = 0; i < MONTH_LENGTH.length; i++, year++) {
... | identifier_body |
Fn.js | // The MIT License (MIT)
// Copyright (c) 2016 – 2019 David Hofmann <the.urban.drone@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitati... | throw `Fn::concat cannot append ${typeOf(a)} to ${typeOf(this)}`;
};
// Polyfill `.run()`, too. This often makes for better readability
Fn.fn.run = function(a) {
return this.value(a);
};
| return Fn(x => a.value(this.value(x)));
}
| conditional_block |
Fn.js | // The MIT License (MIT)
// Copyright (c) 2016 – 2019 David Hofmann <the.urban.drone@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitati... | * const {Fn} = require('futils').monoid;
*
* const fn = Fn((a) => a * 2);
*
* fn.concat(Fn((a) => a * 3)); // -> Fn(a -> a * 2 * 3)
*/
Fn.fn.concat = function(a) {
if (Fn.is(a)) {
return Fn(x => a.value(this.value(x)));
}
throw `Fn::concat cannot append ${typeOf(a)} to ${typeOf(this)}`;
};
// Polyfill ... | *
* @example | random_line_split |
virtualMachineExtensionImage.js | /*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
... |
util.inherits(VirtualMachineExtensionImage, models['Resource']);
/**
* Defines the metadata of VirtualMachineExtensionImage
*
* @returns {object} metadata of VirtualMachineExtensionImage
*
*/
VirtualMachineExtensionImage.prototype.mapper = function () {
return {
required: false,
serializedName: 'Virtu... | {
VirtualMachineExtensionImage['super_'].call(this);
} | identifier_body |
virtualMachineExtensionImage.js | /*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
... | () {
VirtualMachineExtensionImage['super_'].call(this);
}
util.inherits(VirtualMachineExtensionImage, models['Resource']);
/**
* Defines the metadata of VirtualMachineExtensionImage
*
* @returns {object} metadata of VirtualMachineExtensionImage
*
*/
VirtualMachineExtensionImage.prototype.mapper = function () {... | VirtualMachineExtensionImage | identifier_name |
virtualMachineExtensionImage.js | /*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
... | required: false,
serializedName: 'properties.vmScaleSetEnabled',
type: {
name: 'Boolean'
}
},
supportsMultipleExtensions: {
required: false,
serializedName: 'properties.supportsMultipleExtensions',
type: {
name... | name: 'String'
}
},
vmScaleSetEnabled: { | random_line_split |
parse.js | 'use strict';
exports.__esModule = true;
const moduleRequire = require('./module-require').default;
const extname = require('path').extname;
const fs = require('fs');
const log = require('debug')('eslint-plugin-import:parse');
function getBabelEslintVisitorKeys(parserPath) {
if (parserPath.endsWith('index.js')) {
... |
}
const keys = keysFromParser(parserPath, parser, undefined);
return {
ast: parser.parse(content, parserOptions),
visitorKeys: keys,
};
};
function getParserPath(path, context) {
const parsers = context.settings['import/parsers'];
if (parsers != null) {
const extension = extname(path);
fo... | {
return {
ast,
visitorKeys: keysFromParser(parserPath, parser, undefined),
};
} | conditional_block |
parse.js | 'use strict';
exports.__esModule = true;
const moduleRequire = require('./module-require').default;
const extname = require('path').extname;
const fs = require('fs');
const log = require('debug')('eslint-plugin-import:parse');
function getBabelEslintVisitorKeys(parserPath) {
if (parserPath.endsWith('index.js')) {
... | if (parsers != null) {
const extension = extname(path);
for (const parserPath in parsers) {
if (parsers[parserPath].indexOf(extension) > -1) {
// use this alternate parser
log('using alt parser:', parserPath);
return parserPath;
}
}
}
// default to use ESLint parser... | const parsers = context.settings['import/parsers']; | random_line_split |
parse.js | 'use strict';
exports.__esModule = true;
const moduleRequire = require('./module-require').default;
const extname = require('path').extname;
const fs = require('fs');
const log = require('debug')('eslint-plugin-import:parse');
function getBabelEslintVisitorKeys(parserPath) {
if (parserPath.endsWith('index.js')) {
... | {
const parsers = context.settings['import/parsers'];
if (parsers != null) {
const extension = extname(path);
for (const parserPath in parsers) {
if (parsers[parserPath].indexOf(extension) > -1) {
// use this alternate parser
log('using alt parser:', parserPath);
return parserP... | identifier_body | |
parse.js | 'use strict';
exports.__esModule = true;
const moduleRequire = require('./module-require').default;
const extname = require('path').extname;
const fs = require('fs');
const log = require('debug')('eslint-plugin-import:parse');
function | (parserPath) {
if (parserPath.endsWith('index.js')) {
const hypotheticalLocation = parserPath.replace('index.js', 'visitor-keys.js');
if (fs.existsSync(hypotheticalLocation)) {
const keys = moduleRequire(hypotheticalLocation);
return keys.default || keys;
}
}
return null;
}
function keysF... | getBabelEslintVisitorKeys | identifier_name |
jquery.dateobj.js | /*
* Copyright © 2015-2019 the contributors (see Contributors.md).
*
* This file is part of Knora.
*
* Knora 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, either version 3 of the License, or
*... | d1_era = "BCE";
} else {
d1_era = "CE";
}
if (d2.year < 0) {
d2_era = "BCE";
} else {
d2_era = "CE";
}
d1_abs_year = Math.abs(d1.year);
d2_abs_year = Math.abs(d2.year);
d1_yea... |
d1 = parse_datestr(dateobj.dateval1, dateobj.calendar, dateobj.era1, 'START');
d2 = parse_datestr(dateobj.dateval2, dateobj.calendar, dateobj.era2, 'END');
if (d1.year < 0) { | random_line_split |
attr.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 devtools_traits::AttrInfo;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::AttrBind... | #[inline]
pub fn prefix(&self) -> &Option<Atom> {
&self.prefix
}
}
impl AttrMethods for Attr {
// https://dom.spec.whatwg.org/#dom-attr-localname
fn LocalName(&self) -> DOMString {
(**self.local_name()).to_owned()
}
// https://dom.spec.whatwg.org/#dom-attr-value
fn Valu... | &self.namespace
}
| random_line_split |
attr.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 devtools_traits::AttrInfo;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::AttrBind... |
#[inline]
unsafe fn local_name_atom_forever(&self) -> Atom {
(*self.unsafe_get()).local_name.clone()
}
#[inline]
unsafe fn value_for_layout(&self) -> &AttrValue {
(*self.unsafe_get()).value.borrow_for_layout()
}
}
| {
// This transmute is used to cheat the lifetime restriction.
match *self.value_forever() {
AttrValue::TokenList(_, ref tokens) => Some(tokens),
_ => None,
}
} | identifier_body |
attr.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 devtools_traits::AttrInfo;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::AttrBind... | (string: DOMString, default: u32) -> AttrValue {
let result = parse_unsigned_integer(string.chars()).unwrap_or(default);
let result = if result > 2147483647 {
default
} else {
result
};
AttrValue::UInt(string, result)
}
// https://html.spec.whatwg... | from_u32 | identifier_name |
simple-lexical-scope.rs | // Copyright 2013-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-MI... | () {()}
fn sentinel() {()}
| zzz | identifier_name |
simple-lexical-scope.rs | // Copyright 2013-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-MI... |
{
zzz(); // #break
sentinel();
let x = 10.5f64;
zzz(); // #break
sentinel();
}
zzz(); // #break
sentinel();
}
zzz(); // #break
sentinel();
}
fn zzz() {()}
fn sentinel() {()} | zzz(); // #break
sentinel(); | random_line_split |
simple-lexical-scope.rs | // Copyright 2013-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-MI... |
fn sentinel() {()}
| {()} | identifier_body |
LyricItemContainer.tsx | import * as React from 'react';
import { observer } from 'mobx-react';
interface LyricItemContainerProps {
timeline: number;
text: string;
translation: string | object;
index: number;
}
@observer
export default class LyricItemContainer extends React.Component<LyricItemContainerProps> {
construct... |
render() {
const { text, translation, index } = this.props;
return (
<li
className={ 'muse-lyric__item' }
data-lyric-item-id={ index }
>
<span className={ 'muse-lyric__text' }>{ text }</span>
{(() => {
if (translation) {
return ... | {
super(props);
} | identifier_body |
LyricItemContainer.tsx | import * as React from 'react';
import { observer } from 'mobx-react';
interface LyricItemContainerProps {
timeline: number;
text: string;
translation: string | object;
index: number;
}
@observer
export default class LyricItemContainer extends React.Component<LyricItemContainerProps> {
| constructor(props: LyricItemContainerProps) {
super(props);
}
render() {
const { text, translation, index } = this.props;
return (
<li
className={ 'muse-lyric__item' }
data-lyric-item-id={ index }
>
<span className={ 'muse-lyric__text' }>{ text }</span>
... | random_line_split | |
LyricItemContainer.tsx | import * as React from 'react';
import { observer } from 'mobx-react';
interface LyricItemContainerProps {
timeline: number;
text: string;
translation: string | object;
index: number;
}
@observer
export default class LyricItemContainer extends React.Component<LyricItemContainerProps> {
| (props: LyricItemContainerProps) {
super(props);
}
render() {
const { text, translation, index } = this.props;
return (
<li
className={ 'muse-lyric__item' }
data-lyric-item-id={ index }
>
<span className={ 'muse-lyric__text' }>{ text }</span>
{(... | constructor | identifier_name |
LyricItemContainer.tsx | import * as React from 'react';
import { observer } from 'mobx-react';
interface LyricItemContainerProps {
timeline: number;
text: string;
translation: string | object;
index: number;
}
@observer
export default class LyricItemContainer extends React.Component<LyricItemContainerProps> {
construct... |
})()}
</li>
);
}
}
| {
return (
<span className={ 'muse-lyric__translation' }>
{ translation }
</span>
);
} // inject translation if exists
| conditional_block |
issue-40001-plugin.rs | // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
}
}
| {
cx.span_lint(MISSING_WHITELISTED_ATTR, span,
"Missing 'whitelisted_attr' attribute");
} | conditional_block |
issue-40001-plugin.rs | // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | (&mut self,
cx: &LateContext<'a, 'tcx>,
_: intravisit::FnKind<'tcx>,
_: &'tcx hir::FnDecl,
_: &'tcx hir::Body,
span: source_map::Span,
id: ast::NodeId) {
let item = match cx.tcx.hir().get(id) {
Node::Ite... | check_fn | identifier_name |
issue-40001-plugin.rs | // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
declare_lint!(MISSING_WHITELISTED_ATTR, Deny,
"Checks for missing `whitelisted_attr` attribute");
struct MissingWhitelistedAttrPass;
impl LintPass for MissingWhitelistedAttrPass {
fn get_lints(&self) -> LintArray {
lint_array!(MISSING_WHITELISTED_ATTR)
}
}
impl<'a, 'tcx> LateLintPass<... | {
reg.register_late_lint_pass(box MissingWhitelistedAttrPass);
reg.register_attribute("whitelisted_attr".to_string(), Whitelisted);
} | identifier_body |
issue-40001-plugin.rs | // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | // except according to those terms.
#![feature(box_syntax, plugin, plugin_registrar, rustc_private)]
#![crate_type = "dylib"]
#[macro_use]
extern crate rustc;
extern crate rustc_plugin;
extern crate syntax;
use rustc_plugin::Registry;
use syntax::attr;
use syntax::ext::base::*;
use syntax::feature_gate::AttributeTyp... | // option. This file may not be copied, modified, or distributed | random_line_split |
cms_plugins.py | # coding: utf-8
import re
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from .models import *
from django.utils.translation import ugettext as _
from django.contrib import admin
from django.forms import ModelForm, ValidationError
class GalleryForm(ModelForm):
|
class GalleryItemInline(admin.TabularInline):
model = GalleryItem
class GalleryPlugin(CMSPluginBase):
model = Gallery
form = GalleryForm
name = _("Gallery")
render_template = "gallery.html"
inlines = [
GalleryItemInline,
]
def render(self, context, instance, placeholde... | class Meta:
model = Gallery
def clean_domid(self):
data = self.cleaned_data['domid']
if not re.match(r'^[a-zA-Z_]\w*$', data):
raise ValidationError(
_("The name must be a single word beginning with a letter"))
return data | identifier_body |
cms_plugins.py | # coding: utf-8
import re
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from .models import *
from django.utils.translation import ugettext as _
from django.contrib import admin
from django.forms import ModelForm, ValidationError
| data = self.cleaned_data['domid']
if not re.match(r'^[a-zA-Z_]\w*$', data):
raise ValidationError(
_("The name must be a single word beginning with a letter"))
return data
class GalleryItemInline(admin.TabularInline):
model = GalleryItem
class GalleryPlugin(CM... | class GalleryForm(ModelForm):
class Meta:
model = Gallery
def clean_domid(self): | random_line_split |
cms_plugins.py | # coding: utf-8
import re
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from .models import *
from django.utils.translation import ugettext as _
from django.contrib import admin
from django.forms import ModelForm, ValidationError
class GalleryForm(ModelForm):
class Meta:
... |
return data
class GalleryItemInline(admin.TabularInline):
model = GalleryItem
class GalleryPlugin(CMSPluginBase):
model = Gallery
form = GalleryForm
name = _("Gallery")
render_template = "gallery.html"
inlines = [
GalleryItemInline,
]
def render(self, context, ... | raise ValidationError(
_("The name must be a single word beginning with a letter")) | conditional_block |
cms_plugins.py | # coding: utf-8
import re
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from .models import *
from django.utils.translation import ugettext as _
from django.contrib import admin
from django.forms import ModelForm, ValidationError
class GalleryForm(ModelForm):
class Meta:
... | (CMSPluginBase):
model = Gallery
form = GalleryForm
name = _("Gallery")
render_template = "gallery.html"
inlines = [
GalleryItemInline,
]
def render(self, context, instance, placeholder):
context.update({'instance': instance})
return context
plugin_pool.registe... | GalleryPlugin | identifier_name |
test_model.py | #!/usr/bin/python3
# -*- encoding: utf-8 -*-
import unittest
from model import *
from example_data import expenses, payments, participations, persons, events
kasse = Gruppenkasse.create_new()
kasse.fill_with(expenses, payments, participations)
class TestGruppenkasse(unittest.TestCase):
def setUp(self):
.... |
def test_events(self):
print(kasse.person_dict)
event_names = list(map(lambda p: p.name, kasse.events))
for name in event_names:
self.assertTrue(name in events, msg=name)
for name in events:
self.assertTrue(name in event_names, msg=name)
def test_even... | person_names = list(map(lambda p: p.name, kasse.persons))
for name in person_names:
self.assertTrue(name in persons, msg=name) | identifier_body |
test_model.py | #!/usr/bin/python3
# -*- encoding: utf-8 -*-
import unittest
from model import *
from example_data import expenses, payments, participations, persons, events
kasse = Gruppenkasse.create_new()
kasse.fill_with(expenses, payments, participations)
class TestGruppenkasse(unittest.TestCase):
def setUp(self):
.... | unittest.main() | conditional_block | |
test_model.py | #!/usr/bin/python3
# -*- encoding: utf-8 -*-
import unittest
from model import *
from example_data import expenses, payments, participations, persons, events
kasse = Gruppenkasse.create_new()
kasse.fill_with(expenses, payments, participations)
class TestGruppenkasse(unittest.TestCase):
def setUp(self):
.... | (self):
print(kasse.person_dict)
event_names = list(map(lambda p: p.name, kasse.events))
for name in event_names:
self.assertTrue(name in events, msg=name)
for name in events:
self.assertTrue(name in event_names, msg=name)
def test_event(self):
for ... | test_events | identifier_name |
test_model.py | #!/usr/bin/python3
# -*- encoding: utf-8 -*-
import unittest
from model import *
from example_data import expenses, payments, participations, persons, events
kasse = Gruppenkasse.create_new()
kasse.fill_with(expenses, payments, participations)
class TestGruppenkasse(unittest.TestCase):
def setUp(self):
.... | def test_person(self):
for person in kasse.persons:
print(person, "\t{:5.2f}".format(person.balance / 100))
def test_payments(self):
print(kasse.payments)
if __name__ == '__main__':
unittest.main() | random_line_split | |
logcat-helper.ts | import byline = require("byline");
import { DeviceAndroidDebugBridge } from "./device-android-debug-bridge";
import { ChildProcess } from "child_process";
import * as semver from "semver";
interface IDeviceLoggingData {
loggingProcess: ChildProcess;
lineStream: any;
keepSingleProcess: boolean;
}
export class Logca... |
}
private async getLogcatStream(deviceIdentifier: string, pid?: string) {
const device = await this.$devicesService.getDevice(deviceIdentifier);
const minAndroidWithLogcatPidSupport = "7.0.0";
const isLogcatPidSupported = semver.gte(semver.coerce(device.deviceInfo.version), minAndroidWithLogcatPidSupport);
... | {
this.mapDevicesLoggingData[deviceIdentifier] = {
loggingProcess: null,
lineStream: null,
keepSingleProcess: options.keepSingleProcess
};
const logcatStream = await this.getLogcatStream(deviceIdentifier, options.pid);
const lineStream = byline(logcatStream.stdout);
this.mapDevicesLoggingDat... | conditional_block |
logcat-helper.ts | import byline = require("byline");
import { DeviceAndroidDebugBridge } from "./device-android-debug-bridge";
import { ChildProcess } from "child_process";
import * as semver from "semver";
interface IDeviceLoggingData {
loggingProcess: ChildProcess;
lineStream: any;
keepSingleProcess: boolean;
}
export class | implements Mobile.ILogcatHelper {
private mapDevicesLoggingData: IDictionary<IDeviceLoggingData>;
constructor(private $deviceLogProvider: Mobile.IDeviceLogProvider,
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
private $logger: ILogger,
private $injector: IInjector,
private $processSe... | LogcatHelper | identifier_name |
logcat-helper.ts | import byline = require("byline");
import { DeviceAndroidDebugBridge } from "./device-android-debug-bridge";
import { ChildProcess } from "child_process";
import * as semver from "semver";
interface IDeviceLoggingData {
loggingProcess: ChildProcess;
lineStream: any;
keepSingleProcess: boolean;
}
| export class LogcatHelper implements Mobile.ILogcatHelper {
private mapDevicesLoggingData: IDictionary<IDeviceLoggingData>;
constructor(private $deviceLogProvider: Mobile.IDeviceLogProvider,
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
private $logger: ILogger,
private $injector: IInjec... | random_line_split | |
logcat-helper.ts | import byline = require("byline");
import { DeviceAndroidDebugBridge } from "./device-android-debug-bridge";
import { ChildProcess } from "child_process";
import * as semver from "semver";
interface IDeviceLoggingData {
loggingProcess: ChildProcess;
lineStream: any;
keepSingleProcess: boolean;
}
export class Logca... |
private async getLogcatStream(deviceIdentifier: string, pid?: string) {
const device = await this.$devicesService.getDevice(deviceIdentifier);
const minAndroidWithLogcatPidSupport = "7.0.0";
const isLogcatPidSupported = semver.gte(semver.coerce(device.deviceInfo.version), minAndroidWithLogcatPidSupport);
co... | {
const deviceIdentifier = options.deviceIdentifier;
if (deviceIdentifier && !this.mapDevicesLoggingData[deviceIdentifier]) {
this.mapDevicesLoggingData[deviceIdentifier] = {
loggingProcess: null,
lineStream: null,
keepSingleProcess: options.keepSingleProcess
};
const logcatStream = await this... | identifier_body |
update.py | # Copyright (c) 2013 Calin Crisan
# This file is part of motionEye.
#
# motionEye 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.
#
# ... | length = min(len1, len2)
for i in xrange(length):
p1 = version1[i]
p2 = version2[i]
if p1 < p2:
return -1
elif p1 > p2:
return 1
if len1 < len2:
return -1
elif len1 > len2:
return 1
else:
... |
len1 = len(version1)
len2 = len(version2) | random_line_split |
update.py |
# Copyright (c) 2013 Calin Crisan
# This file is part of motionEye.
#
# motionEye 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.
#
#... | (version):
logging.error('updating is not implemented')
return False
| perform_update | identifier_name |
update.py |
# Copyright (c) 2013 Calin Crisan
# This file is part of motionEye.
#
# motionEye 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.
#
#... | logging.error('updating is not implemented')
return False | identifier_body | |
update.py |
# Copyright (c) 2013 Calin Crisan
# This file is part of motionEye.
#
# motionEye 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.
#
#... |
elif len1 > len2:
return 1
else:
return 0
def perform_update(version):
logging.error('updating is not implemented')
return False
| return -1 | conditional_block |
main.rs | extern crate serde;
extern crate serde_json;
#[macro_use]
extern crate serde_derive;
extern crate curl;
extern crate inflections;
mod parser;
mod types;
mod writer;
use std::env;
use std::collections::HashMap;
use curl::easy::Easy;
fn main() |
fn download(url: &str) -> String {
let mut buf = Vec::new();
{
let mut easy = Easy::new();
easy.url(url).unwrap();
let mut transfer = easy.transfer();
transfer.write_function(|data| {
buf.extend(data);
Ok(data.len())
}).unwrap();
transfer... | {
let mut args = env::args();
let name = args.next().unwrap();
let (version, path) = match (args.next(), args.next()) {
(Some(v), Some(f)) => (v,f),
_ => {
println!("Usage: {} [qemu-version] [export-path]", name);
::std::process::exit(1);
}
};
let sch... | identifier_body |
main.rs | extern crate serde;
extern crate serde_json;
#[macro_use] | extern crate serde_derive;
extern crate curl;
extern crate inflections;
mod parser;
mod types;
mod writer;
use std::env;
use std::collections::HashMap;
use curl::easy::Easy;
fn main() {
let mut args = env::args();
let name = args.next().unwrap();
let (version, path) = match (args.next(), args.next()) {
... | random_line_split | |
main.rs | extern crate serde;
extern crate serde_json;
#[macro_use]
extern crate serde_derive;
extern crate curl;
extern crate inflections;
mod parser;
mod types;
mod writer;
use std::env;
use std::collections::HashMap;
use curl::easy::Easy;
fn | () {
let mut args = env::args();
let name = args.next().unwrap();
let (version, path) = match (args.next(), args.next()) {
(Some(v), Some(f)) => (v,f),
_ => {
println!("Usage: {} [qemu-version] [export-path]", name);
::std::process::exit(1);
}
};
let ... | main | identifier_name |
core.js | var
// A central reference to the root jQuery(document)
rootjQuery,
// The deferred used on DOM ready
readyList,
// Support: IE9
// For `typeof xmlNode.method` instead of `xmlNode.method !== undefined`
core_strundefined = typeof undefined,
// Use the correct document accordingly with window argument (sandbox... | ( obj ) {
var length = obj.length,
type = jQuery.type( obj );
if ( jQuery.isWindow( obj ) ) {
return false;
}
if ( obj.nodeType === 1 && length ) {
return true;
}
return type === "array" || type !== "function" &&
( length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj );
}... | isArraylike | identifier_name |
core.js | var
// A central reference to the root jQuery(document)
rootjQuery,
// The deferred used on DOM ready
readyList,
// Support: IE9
// For `typeof xmlNode.method` instead of `xmlNode.method !== undefined`
core_strundefined = typeof undefined,
// Use the correct document accordingly with window argument (sandbox... | if ( jQuery.type( key ) === "object" ) {
chainable = true;
for ( i in key ) {
jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
}
// Sets one value
} else if ( value !== undefined ) {
chainable = true;
if ( !jQuery.isFunction( value ) ) {
raw = true;
}
if ( bulk ) {
/... | length = elems.length,
bulk = key == null;
// Sets many values | random_line_split |
core.js | var
// A central reference to the root jQuery(document)
rootjQuery,
// The deferred used on DOM ready
readyList,
// Support: IE9
// For `typeof xmlNode.method` instead of `xmlNode.method !== undefined`
core_strundefined = typeof undefined,
// Use the correct document accordingly with window argument (sandbox... |
// All jQuery objects should point back to these
rootjQuery = jQuery(document);
| {
var length = obj.length,
type = jQuery.type( obj );
if ( jQuery.isWindow( obj ) ) {
return false;
}
if ( obj.nodeType === 1 && length ) {
return true;
}
return type === "array" || type !== "function" &&
( length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj );
} | identifier_body |
core.js | var
// A central reference to the root jQuery(document)
rootjQuery,
// The deferred used on DOM ready
readyList,
// Support: IE9
// For `typeof xmlNode.method` instead of `xmlNode.method !== undefined`
core_strundefined = typeof undefined,
// Use the correct document accordingly with window argument (sandbox... |
// HANDLE: $(DOMElement)
} else if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
return this;
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) {
return rootjQuery.ready( selector );
}
if ( selector.selector !== ... | {
return this.constructor( context ).find( selector );
} | conditional_block |
toUniqueStringsArray.test.js | import toUniqueStringsArray from "../toUniqueStringsArray";
describe("toUniqueStringsArray", () => {
it("sane defaults", () => {
expect(toUniqueStringsArray()).toEqual([]); | });
it("handles a single string", () => {
expect(toUniqueStringsArray("red")).toEqual(["red"]);
});
it("handles comma separated string", () => {
expect(toUniqueStringsArray("red, blue, red, green, blue")).toEqual([
"red",
"blue",
"green",
]);
});
it("handles array of strings... | expect(toUniqueStringsArray(null)).toEqual([]);
expect(toUniqueStringsArray({})).toEqual([]);
expect(toUniqueStringsArray("")).toEqual([]);
expect(toUniqueStringsArray([])).toEqual([]); | random_line_split |
GeometryBatchAnalysisSpec.js | import {SpatialAnalystService} from '../../../src/mapboxgl/services/SpatialAnalystService';
import {GeometryBufferAnalystParameters} from '../../../src/common/iServer/GeometryBufferAnalystParameters';
import {GeometryOverlayAnalystParameters} from '../../../src/common/iServer/GeometryOverlayAnalystParameters';
import {... | i].resultGeometry).not.toBeNull();
expect(serviceResult.result[i].resultGeometry.geometry).not.toBeNull();
expect(serviceResult.result[i].resultGeometry.geometry.coordinates.length).toBeGreaterThan(0);
expect(serviceResult.result[i].resultGeometry.geometry.type).toBe("Mul... | conditional_block | |
GeometryBatchAnalysisSpec.js | import {SpatialAnalystService} from '../../../src/mapboxgl/services/SpatialAnalystService';
import {GeometryBufferAnalystParameters} from '../../../src/common/iServer/GeometryBufferAnalystParameters';
import {GeometryOverlayAnalystParameters} from '../../../src/common/iServer/GeometryOverlayAnalystParameters';
import {... | var sourceGeometry = {
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [[[116, 39.75],
[116, 39.15],
[117, 39.15],
[117, 39.85],
[116, 39.85]]]
}... | };
//叠加分析参数 | random_line_split |
MonitorRFDischargesScanSynthAmp.py | # This loop monitors the rf Discharges for a particular amplitude, then repeats for other amplitudes
# n
from DAQ.Environment import *
def scanRF(LowestAmp, HighestAmp, step, numScans):
# setup
AmpList = []
fileSystem = Environs.FileSystem
file = \
fileSystem.GetDataDirectory(\
fileSystem.Paths["scanMaster... |
print "List of Measured Amplitudes =" + str(AmpList).strip('[]')
def run_script():
print "Use scanRF(LowestAmp, HighestAmp, step, numScans)"
| print "hc:rf1 Amplitude -> " + str(float(r[i])/10)
hc.SetGreenSynthAmp(float(r[i])/10)
# hc.GreenSynthOnAmplitude = double(r[i]/10)
hc.EnableGreenSynth( False )
hc.EnableGreenSynth( True )
hc.UpdateRFPowerMonitor()
rfAmpMeasured = hc.RF1PowerCentre
hc.StepTarget(2)
System.Threading.Thread.Sleep(500)
... | conditional_block |
MonitorRFDischargesScanSynthAmp.py | # This loop monitors the rf Discharges for a particular amplitude, then repeats for other amplitudes
# n
from DAQ.Environment import *
def scanRF(LowestAmp, HighestAmp, step, numScans):
# setup
|
def run_script():
print "Use scanRF(LowestAmp, HighestAmp, step, numScans)"
| AmpList = []
fileSystem = Environs.FileSystem
file = \
fileSystem.GetDataDirectory(\
fileSystem.Paths["scanMasterDataPath"])\
+ fileSystem.GenerateNextDataFileName()
print("Saving as " + file + "_" + "MeasuredRF1Amp" + "*.zip")
print("")
# start looping
r = range(int(10*LowestAmp), int(10*HighestAmp), in... | identifier_body |
MonitorRFDischargesScanSynthAmp.py | # This loop monitors the rf Discharges for a particular amplitude, then repeats for other amplitudes
# n
from DAQ.Environment import *
def scanRF(LowestAmp, HighestAmp, step, numScans):
# setup
AmpList = []
fileSystem = Environs.FileSystem
file = \
fileSystem.GetDataDirectory(\
fileSystem.Paths["scanMaster... | scanPath = file + "_" + str(i) + "_" + str(rfAmpMeasured) + ".zip"
sm.SaveData(scanPath)
AmpList.append(str(rfAmpMeasured))
print "List of Measured Amplitudes =" + str(AmpList).strip('[]')
def run_script():
print "Use scanRF(LowestAmp, HighestAmp, step, numScans)" | sm.AcquireAndWait(numScans) | random_line_split |
MonitorRFDischargesScanSynthAmp.py | # This loop monitors the rf Discharges for a particular amplitude, then repeats for other amplitudes
# n
from DAQ.Environment import *
def | (LowestAmp, HighestAmp, step, numScans):
# setup
AmpList = []
fileSystem = Environs.FileSystem
file = \
fileSystem.GetDataDirectory(\
fileSystem.Paths["scanMasterDataPath"])\
+ fileSystem.GenerateNextDataFileName()
print("Saving as " + file + "_" + "MeasuredRF1Amp" + "*.zip")
print("")
# start looping
... | scanRF | identifier_name |
aim_server.py | #!/usr/bin/env python
from threaded_ssh import ThreadedClients
from ServerConfig import Aim
from ServerConfig import TellStore
from ServerConfig import General
from ServerConfig import Storage
from ServerConfig import Kudu
def hostToIp(host):
return General.infinibandIp[host]
def semicolonReduce(x, y):
return... | clients = startAimServers()
for c in clients:
c.join() | conditional_block | |
aim_server.py | #!/usr/bin/env python
from threaded_ssh import ThreadedClients
from ServerConfig import Aim
from ServerConfig import TellStore
from ServerConfig import General
from ServerConfig import Storage
from ServerConfig import Kudu
def hostToIp(host):
return General.infinibandIp[host]
def semicolonReduce(x, y):
return... | serverExec = "aim_kudu -P {0} -s {1}".format((len(Storage.servers) + len(Storage.servers1)) * 2, Storage.master)
elif Storage.storage == TellStore:
serverExec = 'aim_server -M {0} -m {1} -c "{2}" -s "{3}" --processing-threads {4}'.format(numChunks, chunkSize, TellStore.getCommitManagerAddress(), Tel... | serverExec = ""
if Storage.storage == Kudu: | random_line_split |
aim_server.py | #!/usr/bin/env python
from threaded_ssh import ThreadedClients
from ServerConfig import Aim
from ServerConfig import TellStore
from ServerConfig import General
from ServerConfig import Storage
from ServerConfig import Kudu
def hostToIp(host):
return General.infinibandIp[host]
def semicolonReduce(x, y):
return... | (observers = []):
Aim.rsyncBuild()
numChunks = (len(Storage.servers) + len(Storage.servers1)) * Aim.numRTAClients * 16
chunkSize = ((TellStore.scanMemory // numChunks) // 8) * 8
serverExec = ""
if Storage.storage == Kudu:
serverExec = "aim_kudu -P {0} -s {1}".format((len(Storage.servers... | startAimServers | identifier_name |
aim_server.py | #!/usr/bin/env python
from threaded_ssh import ThreadedClients
from ServerConfig import Aim
from ServerConfig import TellStore
from ServerConfig import General
from ServerConfig import Storage
from ServerConfig import Kudu
def hostToIp(host):
return General.infinibandIp[host]
def semicolonReduce(x, y):
|
def startAimServers(observers = []):
Aim.rsyncBuild()
numChunks = (len(Storage.servers) + len(Storage.servers1)) * Aim.numRTAClients * 16
chunkSize = ((TellStore.scanMemory // numChunks) // 8) * 8
serverExec = ""
if Storage.storage == Kudu:
serverExec = "aim_kudu -P {0} -s {1}".format... | return x + ';' + y | identifier_body |
stop_guard.rs | // Copyright 2015, 2016 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 la... |
}
| {
self.flag.store(true, Ordering::Relaxed)
} | identifier_body |
stop_guard.rs | // Copyright 2015, 2016 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 la... | {
flag: Arc<AtomicBool>,
}
impl StopGuard {
/// Create a stop guard
pub fn new() -> StopGuard {
StopGuard {
flag: Arc::new(AtomicBool::new(false))
}
}
/// Share stop guard between the threads
pub fn share(&self) -> Arc<AtomicBool> {
self.flag.clone()
}
}
impl Drop for StopGuard {
fn drop(&mut self)... | StopGuard | identifier_name |
stop_guard.rs | // Copyright 2015, 2016 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 la... |
use std::sync::Arc;
use std::sync::atomic::*;
/// Stop guard that will set a stop flag on drop
pub struct StopGuard {
flag: Arc<AtomicBool>,
}
impl StopGuard {
/// Create a stop guard
pub fn new() -> StopGuard {
StopGuard {
flag: Arc::new(AtomicBool::new(false))
}
}
/// Share stop guard between the thre... | random_line_split | |
fs.js | // Parts of this source are modified from npm and lerna:
// npm: https://github.com/npm/npm/blob/master/LICENSE
// lerna: https://github.com/lerna/lerna/blob/master/LICENSE
// @flow
import fs from 'fs';
import path from 'path';
import _cmdShim from 'cmd-shim';
import _readCmdShim from 'read-cmd-shim';
import promisify ... | (err.code !== 'ENOTASHIM' && err.code !== 'EISDIR') {
throw err;
}
}
}
return result;
}
export async function dirExists(dir: string) {
try {
let _stat = await stat(dir);
return _stat.isDirectory();
} catch (err) {
return false;
}
}
export async function symlinkExists(filePath... | if | identifier_name |
fs.js | // Parts of this source are modified from npm and lerna:
// npm: https://github.com/npm/npm/blob/master/LICENSE
// lerna: https://github.com/lerna/lerna/blob/master/LICENSE
// @flow
import fs from 'fs';
import path from 'path';
import _cmdShim from 'cmd-shim';
import _readCmdShim from 'read-cmd-shim';
import promisify ... | }
if (process.platform === 'win32') {
return await createWindowsSymlink(src, dest, type);
} else {
return await createPosixSymlink(src, dest, type);
}
}
export async function readdir(dir: string) {
return promisify(cb => fs.readdir(dir, cb));
}
// Return an empty array if a directory doesnt exist (... | random_line_split | |
fs.js | // Parts of this source are modified from npm and lerna:
// npm: https://github.com/npm/npm/blob/master/LICENSE
// lerna: https://github.com/lerna/lerna/blob/master/LICENSE
// @flow
import fs from 'fs';
import path from 'path';
import _cmdShim from 'cmd-shim';
import _readCmdShim from 'read-cmd-shim';
import promisify ... |
}
}
return result;
}
export async function dirExists(dir: string) {
try {
let _stat = await stat(dir);
return _stat.isDirectory();
} catch (err) {
return false;
}
}
export async function symlinkExists(filePath: string) {
try {
let stat = await lstat(filePath);
return stat.isSymbo... | {
throw err;
} | identifier_body |
security_group_rules_client.py | # Copyright 2012 OpenStack Foundation
# 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 requ... | (self, **kwargs):
"""Create a new security group rule.
Available params: see http://developer.openstack.org/
api-ref-compute-v2.1.html#createSecGroupRule
"""
post_body = json.dumps({'security_group_rule': kwargs})
url = 'os-security-group-rules'
... | create_security_group_rule | identifier_name |
security_group_rules_client.py | # Copyright 2012 OpenStack Foundation
# 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 requ... | def create_security_group_rule(self, **kwargs):
"""Create a new security group rule.
Available params: see http://developer.openstack.org/
api-ref-compute-v2.1.html#createSecGroupRule
"""
post_body = json.dumps({'security_group_rule': kwargs})
url =... | identifier_body | |
security_group_rules_client.py | # Copyright 2012 OpenStack Foundation
# 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 requ... | url = 'os-security-group-rules'
resp, body = self.post(url, post_body)
body = json.loads(body)
self.validate_response(schema.create_security_group_rule, resp, body)
return rest_client.ResponseBody(resp, body)
def delete_security_group_rule(self, group_rule_id):
"""De... | random_line_split | |
app.component.ts | import {Component, OnInit} from '@angular/core';
import {UserService} from './shared/services/user.service';
import {AuthenticationService} from './shared/services/authentication.service';
import {ShowProgressService} from './shared/services/show-progress.service';
import {Router} from '@angular/router';
import {APIInf... | const routeTest = /^(\/|\/login|\/register)$/.test(this.router.url);
return (routeTest && !this.isLoggedIn()) ? 'special-style' : '';
}
} | return this.userService.isAdmin();
}
specialContainerStyle(): string { | random_line_split |
app.component.ts | import {Component, OnInit} from '@angular/core';
import {UserService} from './shared/services/user.service';
import {AuthenticationService} from './shared/services/authentication.service';
import {ShowProgressService} from './shared/services/show-progress.service';
import {Router} from '@angular/router';
import {APIInf... | implements OnInit {
title = 'app works!';
showProgressBar = false;
apiInfo: APIInfo;
constructor(private router: Router,
private authenticationService: AuthenticationService,
public userService: UserService,
private showProgress: ShowProgressService,
pr... | AppComponent | identifier_name |
app.component.ts | import {Component, OnInit} from '@angular/core';
import {UserService} from './shared/services/user.service';
import {AuthenticationService} from './shared/services/authentication.service';
import {ShowProgressService} from './shared/services/show-progress.service';
import {Router} from '@angular/router';
import {APIInf... |
hasWarning() {
return !isNullOrUndefined(this.apiInfo) && !isNullOrUndefined(this.apiInfo.nonProductionWarning);
}
isLoggedIn() {
return this.authenticationService.isLoggedIn;
}
logout() {
this.authenticationService.logout();
}
toggleProgressBar() {
this.showProgressBar = !this.showPr... | {
this.authenticationService.reloadUser();
this.apiInfoService.readItems()
.then((info: any) => {
this.ravenErrorHandler.setup(info.sentryDsn);
this.apiInfo = info;
})
.catch((err) => {
this.snackBar.open('Error on init', '', {duration: 3000});
});
} | identifier_body |
testcases.py | import re
import unittest
from urlparse import urlsplit, urlunsplit
from xml.dom.minidom import parseString, Node
from django.conf import settings
from django.core import mail
from django.core.management import call_command
from django.core.urlresolvers import clear_url_caches
from django.db import transaction
from dj... |
def _post_teardown(self):
""" Performs any post-test things. This includes:
* Putting back the original ROOT_URLCONF if it was changed.
"""
if hasattr(self, '_old_root_urlconf'):
settings.ROOT_URLCONF = self._old_root_urlconf
clear_url_caches()
def... | """
Wrapper around default __call__ method to perform common Django test
set up. This means that user-defined Test Cases aren't required to
include a call to super().setUp().
"""
self.client = Client()
try:
self._pre_setup()
except (KeyboardInterrupt, ... | identifier_body |
testcases.py | import re
import unittest
from urlparse import urlsplit, urlunsplit
from xml.dom.minidom import parseString, Node
from django.conf import settings
from django.core import mail
from django.core.management import call_command
from django.core.urlresolvers import clear_url_caches
from django.db import transaction
from dj... | (self, response, template_name):
"""
Asserts that the template with the provided name was NOT used in
rendering the response.
"""
template_names = [t.name for t in to_list(response.template)]
self.failIf(template_name in template_names,
(u"Template '%s' was us... | assertTemplateNotUsed | identifier_name |
testcases.py | import re
import unittest
from urlparse import urlsplit, urlunsplit
from xml.dom.minidom import parseString, Node
from django.conf import settings
from django.core import mail
from django.core.management import call_command
from django.core.urlresolvers import clear_url_caches
from django.db import transaction
from dj... | >>> o = OutputChecker()
>>> o._strip_quotes("'foo'")
"foo"
>>> o._strip_quotes('"foo"')
"foo"
>>> o._strip_quotes("u'foo'")
"foo"
>>> o._strip_quotes('u"foo"')
"foo"
"""
def is_quoted_string(s):
s = s.strip()
... | Strip quotes of doctests output values:
| random_line_split |
testcases.py | import re
import unittest
from urlparse import urlsplit, urlunsplit
from xml.dom.minidom import parseString, Node
from django.conf import settings
from django.core import mail
from django.core.management import call_command
from django.core.urlresolvers import clear_url_caches
from django.db import transaction
from dj... |
else:
self.fail("The form '%s' in context %d does not"
" contain the field '%s'" %
(form, i, field))
else:
non_field_errors = context[form].non_field_errors()
... | self.fail("The field '%s' on form '%s' in context %d"
" contains no errors" % (field, form, i)) | conditional_block |
helm.rs | // Copyright (c) 2017 Chef Software Inc. and/or applicable contributors
//
// 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 r... | (ui: &mut UI, args: Vec<OsString>) -> Result<()> {
::command::pkg::export::export_common::start(
ui,
args,
EXPORT_CMD,
EXPORT_CMD_ENVVAR,
EXPORT_PKG_IDENT,
EXPORT_PKG_IDENT_ENVVAR,
)
}
| start | identifier_name |
helm.rs | // Copyright (c) 2017 Chef Software Inc. and/or applicable contributors
//
// 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 r... | pub fn start(ui: &mut UI, args: Vec<OsString>) -> Result<()> {
::command::pkg::export::export_common::start(
ui,
args,
EXPORT_CMD,
EXPORT_CMD_ENVVAR,
EXPORT_PKG_IDENT,
EXPORT_PKG_IDENT_ENVVAR,
)
} | const EXPORT_CMD: &'static str = "hab-pkg-export-helm";
const EXPORT_CMD_ENVVAR: &'static str = "HAB_PKG_EXPORT_HELM_BINARY";
const EXPORT_PKG_IDENT: &'static str = "core/hab-pkg-export-helm";
const EXPORT_PKG_IDENT_ENVVAR: &'static str = "HAB_PKG_EXPORT_HELM_PKG_IDENT";
| random_line_split |
helm.rs | // Copyright (c) 2017 Chef Software Inc. and/or applicable contributors
//
// 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 r... | {
::command::pkg::export::export_common::start(
ui,
args,
EXPORT_CMD,
EXPORT_CMD_ENVVAR,
EXPORT_PKG_IDENT,
EXPORT_PKG_IDENT_ENVVAR,
)
} | identifier_body | |
AlunoANEE.js | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* @author Municipio de Itajaí - Secretaria de Educação - DITEC *
* @updated 30/06/2016 *
* Pacote: Erudio *
* ... | this.urlPorInstituicao = this.erudioConfig.urlRelatorios+'/alunos/anee-nominal-instituicao';
}
/*
* @method getURL
* @methodReturn String
* @methodParams unidade|Int
* @methodDescription Busca a url para gerar o relatório de ANEE por unidade.
*/
... | constructor(rest,erudioConfig){
this.rest = rest;
this.erudioConfig = erudioConfig;
this.url = this.erudioConfig.urlRelatorios+'/alunos/anee-nominal-unidade'; | random_line_split |
AlunoANEE.js | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* @author Municipio de Itajaí - Secretaria de Educação - DITEC *
* @updated 30/06/2016 *
* Pacote: Erudio *
* ... | getURL
* @methodReturn String
* @methodParams unidade|Int
* @methodDescription Busca a url para gerar o relatório de ANEE por unidade.
*/
getURL(unidade){ return this.url+'?unidade='+unidade; }
/*
* @method getURLPorInstituicao
* @methodReturn String... | this.erudioConfig = erudioConfig;
this.url = this.erudioConfig.urlRelatorios+'/alunos/anee-nominal-unidade';
this.urlPorInstituicao = this.erudioConfig.urlRelatorios+'/alunos/anee-nominal-instituicao';
}
/*
* @method | identifier_body |
AlunoANEE.js | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* @author Municipio de Itajaí - Secretaria de Educação - DITEC *
* @updated 30/06/2016 *
* Pacote: Erudio *
* ... | ioConfig){
this.rest = rest;
this.erudioConfig = erudioConfig;
this.url = this.erudioConfig.urlRelatorios+'/alunos/anee-nominal-unidade';
this.urlPorInstituicao = this.erudioConfig.urlRelatorios+'/alunos/anee-nominal-instituicao';
}
/*
* @method ... | ructor(rest,erud | identifier_name |
exampleFour.js | /****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms ... | () {
var component = Qt.createComponent("exampleTwo.qml");
var exampleOneElement = component.createObject(null);
var avatarExample = exampleOneElement.a;
var retn = avatarExample.avatar;
retn.preserve();
return retn;
}
function releaseAvatar(avatar) {
avatar.destroy();
}
//![0] | importAvatar | identifier_name |
exampleFour.js | /****************************************************************************
** | ** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyri... | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
** | random_line_split |
exampleFour.js | /****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms ... |
//![0] | {
avatar.destroy();
} | identifier_body |
15.4.4.22-9-c-ii-32.js | /// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyrigh... |
runTestCase(testcase);
| {
var accessed = false;
var objRegExp = new RegExp();
function callbackfn(prevVal, curVal, idx, obj) {
accessed = true;
return prevVal === objRegExp;
}
var obj = { 0: 11, length: 1 };
return Array.prototype.reduceRight.call(obj, callb... | identifier_body |
15.4.4.22-9-c-ii-32.js | /// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyrigh... | }
var obj = { 0: 11, length: 1 };
return Array.prototype.reduceRight.call(obj, callbackfn, objRegExp) === true && accessed;
}
runTestCase(testcase); | accessed = true;
return prevVal === objRegExp;
| random_line_split |
15.4.4.22-9-c-ii-32.js | /// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyrigh... | () {
var accessed = false;
var objRegExp = new RegExp();
function callbackfn(prevVal, curVal, idx, obj) {
accessed = true;
return prevVal === objRegExp;
}
var obj = { 0: 11, length: 1 };
return Array.prototype.reduceRight.call(obj, ca... | testcase | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.